bug修复

This commit is contained in:
18792927508
2024-04-07 11:10:35 +08:00
parent 9537faea90
commit 666090fbe3
21 changed files with 311 additions and 118 deletions
@@ -107,6 +107,7 @@ public class WeChatUserServiceImpl implements WeChatUserService {
}else if(!codeCache.equals(ientityAuthentication.getVerifyCode())){
return AjaxResult.warn("验证码校验失败");
}
// 根据用户名或者邮箱或者手机号查询系统用户表中是否存在该用户
SysUser sysUserName=sysUserMapper.checkUserNameUnique(ientityAuthentication.getUserName());
if(sysUserName!=null){
return AjaxResult.warn("账号已存在");
@@ -259,6 +259,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if(CollectionUtil.isEmpty(list)){
return;
}
isMediatorRole=false;
// 查询申请人和被申请人
List<Long> caseIds = list.stream().map(MsCaseApplicationVO::getId).collect(Collectors.toList());
@@ -271,6 +272,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
for (MsCaseApplicationVO vo : list) {
if(vo.getMediatorId()!=null&&vo.getMediatorId()==loginUserId){
isMediatorRole=true;
}
// 设置申请人和被申请人
if(affiliateMap!=null && affiliateMap.containsKey(vo.getId())){
List<MsCaseAffiliate> affiliates = affiliateMap.get(vo.getId());
@@ -291,12 +295,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
}
if(StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("申请人")
&& affiliate.getRoleType()!=null && affiliate.getRoleType()==1){
applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA);
if(vo.getOrganizeFlag()==null || vo.getOrganizeFlag()!=1) {
if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("申请人")
&& affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getName())) {
applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA);
}
}else {
// 组织机构
if ( affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getApplicantOrgName())) {
applicantName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA);
}
}
if(StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人")
&& affiliate.getRoleType()!=null && affiliate.getRoleType()==3){
&& affiliate.getRoleType()!=null && affiliate.getRoleType()==3&&StrUtil.isNotEmpty(affiliate.getName())){
respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA);
}
@@ -585,6 +596,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (caseApplication.getId() == null) {
caseApplication.setId(IdWorkerUtil.getId());
}
if(caseApplication.getOrganizeFlag()==null){
caseApplication.setOrganizeFlag(0);
}
caseApplication.setCaseStatusName(caseFlow.getCaseStatusName());
caseApplication.setCaseFlowId(caseFlow.getId());
caseApplication.setCreateTime(new Date());
@@ -680,7 +694,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
*/
@Transactional
public void setCaseAfflicate(MsCaseApplicationVO caseApplication, MsCaseAffiliate affiliate,int groupOrder) {
if(affiliate==null || StrUtil.isEmpty(affiliate.getEmail()) || StrUtil.isEmpty(affiliate.getName())){
boolean b = caseApplication.getOrganizeFlag() != 1 && affiliate.getRoleType() == 1 && StrUtil.isEmpty(affiliate.getEmail());
if(affiliate==null ||b|| StrUtil.isEmpty(affiliate.getName())){
return;
}
affiliate.setGroupOrder(groupOrder);
@@ -739,6 +754,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} else {
// 申请机构
if (affiliate.getRoleType() == 1) {
affiliate.setOperatorFlag(0);
// 申请人,从缓存中判断部门是否存在
Object deptCache = redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName());
if (ObjectUtil.isEmpty(deptCache)) {
@@ -751,12 +767,27 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
dept.setStatus("0");
dept.setDelFlag("0");
dept.setCode(affiliate.getCode());
dept.setHome(affiliate.getHome());
dept.setAddress(affiliate.getAddress());
dept.setCompLegalPerson(affiliate.getCompLegalPerson());
dept.setCreateBy(getUsername());
dept.setUpdateBy(getUsername());
dept.setCreateTime(new Date());
dept.setNationality(affiliate.getNationality());
sysDeptMapper.insertDept(dept);
// 更新缓存
redisCache.setCacheObject(CacheConstants.DEPT_KEY + dept.getDeptName(), dept.getDeptId());
}else {
// 更新部门
SysDept dept = new SysDept();
dept.setDeptId((Long) deptCache);
dept.setCode(affiliate.getCode());
dept.setCompLegalPerson(affiliate.getCompLegalPerson());
dept.setUpdateBy(getUsername());
dept.setUpdateTime(new Date());
dept.setNationality(affiliate.getNationality());
dept.setHome(affiliate.getHome());
dept.setAddress(affiliate.getAddress());
sysDeptMapper.updateDept(dept);
}
affiliate.setApplicantDeptId(redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName()));
} else {
@@ -779,13 +810,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if(StrUtil.isEmpty(affiliate.getEmail())){
return;
}
Object userEmailCache = redisCache.getCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail());
// Object userEmailCache = redisCache.getCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail());
SysUser user=null;
if(ObjectUtil.isEmpty(userEmailCache)){
// if(ObjectUtil.isEmpty(userEmailCache)){
user = sysUserMapper.selectUserByUserName(affiliate.getEmail());
}else {
user=(SysUser)userEmailCache;
}
// }else {
// user=(SysUser)userEmailCache;
// }
// 判断该用户是否存在
@@ -951,6 +982,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (msCaseAffiliateVO==null) {
return AjaxResult.error("案件相关人员未填写");
}
if(caseApplication.getOrganizeFlag()==null){
caseApplication.setOrganizeFlag(0);
}
// 计算仲裁费用
caseApplication.setCaseSubjectAmount(new BigDecimal("30000"));
setFeePayableMethod(caseApplication);
@@ -1507,7 +1541,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath();
File file = new File(templatePath.replace("/profile", "/uploadPath"));
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplication.getCaseNum(),AttachmentOperateTypeEnum.ADD);
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplication.getCaseNum(),AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_METERIAL);
// 更新附件表
if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
@@ -1905,7 +1939,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// selectedMediatorIds = selectedMediators.stream().map(MsCaseMediator::getMediatorId).collect(Collectors.toList());
// }
for (MsCaseAffiliate affiliate : affiliates) {
if(affiliate.getUserId().equals(loginUser.getUser().getUserId())){
if(affiliate.getUserId()!=null && affiliate.getUserId().equals(loginUser.getUser().getUserId())){
if( affiliate.getRoleType()==null){
continue;
}
@@ -1971,7 +2005,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
return AjaxResult.error("未找到案件相关人员");
}
for (MsCaseAffiliate affiliate : affiliates) {
if(affiliate.getUserId().equals(user.getUserId())){
if((affiliate.getUserId()!=null && affiliate.getUserId().equals(user.getUserId()))){
if( affiliate.getRoleType()==null){
continue;
}
@@ -2370,8 +2404,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
public SysUser getUserInfo() {
SysUser sysUser =new SysUser();
if(StrUtil.isNotEmpty(SecurityUtils.getUsername())){
sysUser = sysUserMapper.selectUserByUserName(getUsername());
if(SecurityUtils.getUserId()!=null){
sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId());
}
return sysUser;
@@ -2671,7 +2705,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
//发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("2115975");
request.setTemplateId("2116857");
// todo
// 申请人发送短信
request.setPhone(applicantAffiliateOpt.get().getPhone());
@@ -2698,7 +2732,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1);
SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
request1.setTemplateId("2115975");
request1.setTemplateId("2116857");
request1.setPhone(resAffiliateOpt.get().getPhone());
request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew});
Boolean aBoolean1 = SmsUtils.sendSms(request1);
@@ -2722,7 +2756,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/") + 1);
SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest();
requestMedi.setTemplateId("2115975");
requestMedi.setTemplateId("2116857");
requestMedi.setPhone(sealSignRecord.getPensonAccountMedi());
requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(), urlResponnewMedi});
Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi);
@@ -3104,7 +3138,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
for (MsCaseAttach msCaseAttach : msCaseAttaches) {
String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath();
File file = new File(templatePath.replace("/profile", "/uploadPath"));
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(),AttachmentOperateTypeEnum.ADD);
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(),AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT);
// 更新附件表
if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId());
@@ -3363,6 +3397,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
.build();
}
//保存到附件表里,先删除之前的在保存
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType);
msCaseAttachMapper.save(caseAttach);
}
}else {
@@ -3372,12 +3409,32 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
.annexPath(resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX))
.annexType(annexType)
.build();
}
//保存到附件表里,先删除之前的在保存
if(caseAttach != null) {
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType);
// 查找已经存在的附件
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(application.getId(), annexType);
if(CollectionUtil.isNotEmpty(existAttach)){
// todo 对接北明,同步案件状态,删除
for (MsCaseAttach msCaseAttach : existAttach) {
if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
continue;
}
beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
}
}
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType);
if(StrUtil.isEmpty(application.getCaseSource())) {
// 北明推送
String path = "/home/ruoyi" + caseAttach.getAnnexPath();
File file = new File(path.replace("/profile", "/uploadPath"));
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_APPLY_BOOK);
// 更新附件表
if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) {
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
}
}
msCaseAttachMapper.save(caseAttach);
}
}
/**
@@ -15,10 +15,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.AnnexTypeEnum;
import com.ruoyi.common.enums.AttachmentOperateTypeEnum;
import com.ruoyi.common.enums.PushCaseStatusEnum;
import com.ruoyi.common.enums.YesOrNoEnum;
import com.ruoyi.common.enums.*;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.EmailOutUtil;
@@ -27,6 +24,7 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
import com.ruoyi.system.service.impl.BeiMingInterfaceService;
@@ -110,6 +108,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
@Autowired
private SendMailRecordMapper sendMailRecordMapper;
@Autowired
private SysRoleMapper roleMapper;
// 北明配置
@Value("${BMConfig.userName}")
private String BMUserName;
@@ -550,36 +550,37 @@ public class MsSignSealServiceImpl implements MsSignSealService {
if(CollectionUtil.isEmpty(affiliates)){
return AjaxResult.error("未找到案件相关人员");
}
SysUser user = sysUserMapper.selectUserById(SecurityUtils.getLoginUser().getUser().getUserId());
List<SysRole> roles = user.getRoles();
if(CollectionUtil.isEmpty(roles)){
return AjaxResult.error("该用户未绑定角色");
}
long mediatorCount = roles.stream().filter(sysRole -> sysRole.getRoleName().equals("调解员")).count();
List<MsCaseAffiliate> operatorList = affiliates.stream().filter(msCaseAffiliate -> msCaseAffiliate.getOperatorFlag() != null
&& msCaseAffiliate.getOperatorFlag() == 1
&& StrUtil.isNotEmpty(msCaseAffiliate.getPhone())).collect(Collectors.toList());
Optional<MsCaseAffiliate> appOpt =null;
Optional<MsCaseAffiliate> resOpt =null;
if(CollectionUtil.isNotEmpty(operatorList)){
appOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null
appOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null && msCaseAffiliate.getUserId()!=null
&& (msCaseAffiliate.getRoleType() == 1 || msCaseAffiliate.getRoleType() == 2))
.findFirst();
resOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null
resOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null&& msCaseAffiliate.getUserId()!=null
&& (msCaseAffiliate.getRoleType() == 3 || msCaseAffiliate.getRoleType() == 4))
.findFirst();
}
if(appOpt==null || !appOpt.isPresent()){
return AjaxResult.error("未找到案件申请操作人");
}
if(resOpt==null || !resOpt.isPresent()){
return AjaxResult.error("未找到案件被申请操作人");
}
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId);
Integer organizeFlag = caseApplication.getOrganizeFlag();
SysUser user = new SysUser();
Long userId = SecurityUtils.getUserId();
user.setUserId(userId);
List<SysUser> listSysUser = userMapper.selectUserList(user);
List<SysRole> allSysRole = new ArrayList<>();
for(SysUser sysUser :listSysUser){
List<SysRole> roles = sysUser.getRoles();
allSysRole.addAll(roles);
}
List<String> roleNames = allSysRole.stream().map(SysRole::getRoleName).collect(Collectors.toList());
if(roleNames.contains("申请人")){
if(appOpt==null || !appOpt.isPresent()){
return AjaxResult.error("未找到案件申请操作人");
}
if(appOpt.get().getUserId()!=null && appOpt.get().getUserId().equals(userId)){
// 申请人链接
SealSignRecord sealSignRecordres = new SealSignRecord();
MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
mssealSignRecord.setCaseAppliId(caseId);
@@ -605,10 +606,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
}
}else if(roleNames.contains("被申请人")){
if(resOpt==null || !resOpt.isPresent()){
return AjaxResult.error("未找到案件申请操作人");
}
}
if(resOpt.get().getUserId()!=null && resOpt.get().getUserId().equals(userId)){
SealSignRecord sealSignRecordres = new SealSignRecord();
MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
mssealSignRecord.setCaseAppliId(caseId);
@@ -630,7 +630,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
}else {
return AjaxResult.error();
}
}else if(roleNames.contains("调解员")){
}
if(mediatorCount>0){
SealSignRecord sealSignRecordres = new SealSignRecord();
MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
mssealSignRecord.setCaseAppliId(caseId);
@@ -859,7 +860,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + savePath;
File file = new File(templatePath.replace("/profile", "/uploadPath"));
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD);
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
// 更新附件表
if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
@@ -954,7 +955,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + savePath;
File file = new File(templatePath.replace("/profile", "/uploadPath"));
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD);
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT);
// 更新附件表
if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
@@ -1041,20 +1042,19 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseAttach.setAnnexType(7);
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
caseAttachMapper.save(caseAttach);
// todo 对接北明,调用上传附件接口
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + savePath;
File file = new File(templatePath.replace("/profile", "/uploadPath"));
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD);
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT);
// 更新附件表
if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
}
}
caseAttachMapper.save(caseAttach);
}
}
@@ -1,6 +1,8 @@
package com.ruoyi.wisdomarbitrate.service.mscase.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@@ -9,15 +11,19 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.AnnexTypeEnum;
import com.ruoyi.common.enums.AttachmentOperateTypeEnum;
import com.ruoyi.common.enums.DocumentTypeEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.PdfUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.impl.BeiMingInterfaceService;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.ReservedConference;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsReservedConferenceVO;
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper;
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper;
@@ -39,6 +45,7 @@ import tk.mybatis.mapper.entity.Example;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.*;
@@ -78,6 +85,15 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
private ReservedConferenceMapper reservedConferenceMapper;
@Autowired
private SysUserMapper sysUserMapper;
// 北明配置
@Value("${BMConfig.userName}")
private String BMUserName;
@Value("${BMConfig.password}")
private String BMPassword;
@Value("${BMConfig.syncSource}")
private String BMSyncSource;
@Autowired
BeiMingInterfaceService beiMingInterfaceService;
/**
视频回调
@@ -399,6 +415,11 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
@Transactional
@Override
public AjaxResult htmlToPDF(MsReservedConferenceVO reservedConferenceVO) {
// 查询案件
MsCaseApplication caseApplication = caseApplicationMapper.selectByPrimaryKey(reservedConferenceVO.getCaseId());
if(caseApplication==null){
return AjaxResult.error("案件不存在");
}
String currentFileName = System.currentTimeMillis() + ".pdf";
String fileName = null;
try {
@@ -413,12 +434,35 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
// 绑定案件
if(convertFlag){
// 删除之前的庭审笔录
if(StrUtil.isEmpty(caseApplication.getCaseSource())){
List<MsCaseAttach> existAttach = caseAttachMapper.listCaseAttachByCaseIdAndType(reservedConferenceVO.getCaseId(), AnnexTypeEnum.MEDIATE.getCode());
if(CollectionUtil.isNotEmpty(existAttach)){
// todo 对接北明,同步案件状态,删除
for (MsCaseAttach msCaseAttach : existAttach) {
if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
continue;
}
beiMingInterfaceService.deleteAttachmentInfo(caseApplication.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
}
}
}
caseAttachMapper.deleteCaseAttachByCasedIdAndType(reservedConferenceVO.getCaseId(),AnnexTypeEnum.MEDIATE.getCode());
MsCaseAttach caseAttach = MsCaseAttach.builder().caseAppliId(reservedConferenceVO.getCaseId())
.annexName(currentFileName)
.annexPath(fileName)
.annexType(AnnexTypeEnum.MEDIATE.getCode())
.build();
// todo 对接北明,调用上传附件接口
if(StrUtil.isEmpty(caseApplication.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath();
File file = new File(templatePath.replace("/profile", "/uploadPath"));
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplication.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_MEDIATION_RECORD);
// 更新附件表
if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
}
}
caseAttachMapper.save(caseAttach);
return AjaxResult.success();
}else {
@@ -460,7 +504,20 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
.annexPath(annexName)
.annexType(AnnexTypeEnum.MEETING_VIDEO.getCode())
.build();
// todo 对接北明,调用上传附件接口
if(StrUtil.isEmpty(caseApplication.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath();
File file = new File(templatePath.replace("/profile", "/uploadPath"));
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplication.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_MEDIATION_VIDEO);
// 更新附件表
if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
}
}
caseAttachMapper.save(caseAttach);
return annexName;
}
}