Merge branch 'wq1' of SH-Arbitrate/Mediation-Backend into dev

This commit was merged in pull request #151.
This commit is contained in:
2024-04-23 18:04:24 +08:00
committed by Gitea
7 changed files with 290 additions and 313 deletions
@@ -23,7 +23,7 @@ public class IdentityAuthenticationController extends BaseController {
@Anonymous @Anonymous
@PostMapping("/selectIdentityAuthenticaEIDtoken") @PostMapping("/selectIdentityAuthenticaEIDtoken")
public AjaxResult selectIdentityAuthenticaEIDtoken() { public AjaxResult selectIdentityAuthenticaEIDtoken() {
JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthenticaEIDtoken(false); JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthEIDToken(false);
return success(tokenResult); return success(tokenResult);
} }
/** /**
@@ -32,7 +32,7 @@ public class IdentityAuthenticationController extends BaseController {
@Anonymous @Anonymous
@PostMapping("/selectPCIdentityAuthenticaEIDtoken") @PostMapping("/selectPCIdentityAuthenticaEIDtoken")
public AjaxResult selectPCIdentityAuthenticaEIDtoken() { public AjaxResult selectPCIdentityAuthenticaEIDtoken() {
JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthenticaEIDtoken(true); JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthEIDToken(true);
return success(tokenResult); return success(tokenResult);
} }
/** /**
@@ -22,6 +22,7 @@ public enum AnnexTypeEnum implements EnumsInterface {
SEAL_PICTURE(10, "印章图片"), SEAL_PICTURE(10, "印章图片"),
FLOW_SVG(11, "流程节点SVG"), FLOW_SVG(11, "流程节点SVG"),
MEETING_FILE(12, "被申请人证据"), MEETING_FILE(12, "被申请人证据"),
MEDIATE_BOOK_PDF(13, "PDF调解书或和解协议"),
; ;
@@ -22,7 +22,7 @@ public interface IdentityAuthenticationService {
* isPC 是否PC端 * isPC 是否PC端
* @return * @return
*/ */
JSONObject selectIdentityAuthenticaEIDtoken(boolean isPC); JSONObject selectIdentityAuthEIDToken(boolean isPC);
/** /**
* 小程序人脸核身后查询身份认证结果 * 小程序人脸核身后查询身份认证结果
@@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.service.miniprogress.impl;
import cn.hutool.core.codec.Base64; import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SmUtil; import cn.hutool.crypto.SmUtil;
import cn.hutool.crypto.asymmetric.SM2; import cn.hutool.crypto.asymmetric.SM2;
import cn.hutool.crypto.symmetric.SymmetricCrypto; import cn.hutool.crypto.symmetric.SymmetricCrypto;
@@ -90,7 +91,7 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication
* @return * @return
*/ */
@Override @Override
public JSONObject selectIdentityAuthenticaEIDtoken(boolean isPC) { public JSONObject selectIdentityAuthEIDToken(boolean isPC) {
JSONObject objJSON = new JSONObject(); JSONObject objJSON = new JSONObject();
objJSON.put("EidToken", ""); objJSON.put("EidToken", "");
try { try {
@@ -116,8 +117,7 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication
String respJSON = GetEidTokenResponse.toJsonString(resp); String respJSON = GetEidTokenResponse.toJsonString(resp);
objJSON = JSON.parseObject(respJSON); objJSON = JSON.parseObject(respJSON);
} catch (TencentCloudSDKException e) { } catch (TencentCloudSDKException e) {
System.out.println(e.toString()); throw new ServiceException("获取Eidtoken失败");
System.out.println("获取Eidtoken失败");
} }
return objJSON; return objJSON;
} }
@@ -139,7 +139,7 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication
parse = JSON.parseObject(s); parse = JSON.parseObject(s);
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println(e.toString()); throw new ServiceException(e.getMessage());
} }
return parse; return parse;
} }
@@ -226,13 +226,14 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication
} }
return AjaxResult.success(authentication); return AjaxResult.success(authentication);
} catch (TencentCloudSDKException e) { } catch (TencentCloudSDKException e) {
System.out.println(e.toString()); return AjaxResult.error(e.getMessage());
} }
return AjaxResult.success();
} }
@Override @Override
public JSONObject selectPCEIDtokenStatus(String eidToken) { public JSONObject selectPCEIDtokenStatus(String eidToken) {
// todo 送达时需要判断是否有pdf版的调解书,没有则不送达,签名完后下载pdf时不删除之前的doc调解书,上传调解书时,pdf的需要将类型设为13,异步发送短信邮件时将登录用户传参过来
// todo E证通审核过后将PC端的机器id在YML文件中改掉
JSONObject objJSON = null; JSONObject objJSON = null;
try { try {
Credential cred = new Credential(credentialSecretId, credentialSecretKey); Credential cred = new Credential(credentialSecretId, credentialSecretKey);
@@ -251,7 +252,9 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication
GetEidResultResponse resp = client.GetEidResult(req); GetEidResultResponse resp = client.GetEidResult(req);
// 输出json格式的字符串回包,Status String 枚举:init:token未验证 doing: 验证中 finished: 验证完成 timeout: token已超时 // 输出json格式的字符串回包,Status String 枚举:init:token未验证 doing: 验证中 finished: 验证完成 timeout: token已超时
String s = GetEidResultResponse.toJsonString(resp); String s = GetEidResultResponse.toJsonString(resp);
objJSON = JSON.parseObject(s); if(StrUtil.isNotEmpty(s)) {
objJSON = JSON.parseObject(s);
}
} catch (TencentCloudSDKException e) { } catch (TencentCloudSDKException e) {
throw new ServiceException("获取E证通Token状态失败"); throw new ServiceException("获取E证通Token状态失败");
} }
@@ -1,9 +1,11 @@
package com.ruoyi.wisdomarbitrate.service.mscase; package com.ruoyi.wisdomarbitrate.service.mscase;
import com.google.gson.Gson;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.MsSignSealDTO; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.MsSignSealDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
import java.io.IOException; import java.io.IOException;
@@ -32,4 +34,13 @@ public interface MsSignSealService {
AjaxResult signSeaalCaseApplicaCallback(String reqbodystr) throws EsignDemoException, IOException; AjaxResult signSeaalCaseApplicaCallback(String reqbodystr) throws EsignDemoException, IOException;
AjaxResult sealCheckCallback(String reqbodystr) throws EsignDemoException, IOException; AjaxResult sealCheckCallback(String reqbodystr) throws EsignDemoException, IOException;
/**
* 签名后下载调解书
* @param caseApplicationselect 案件信息
* @param signFlowId 签名流程id
* @param gson
* @param caseAppliId 案件id
*/
void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId);
} }
@@ -3114,19 +3114,21 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
.execute(); .execute();
} }
MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
if (caseFlow != null) { if (caseFlow != null ) {
application.setCaseFlowId(caseFlow.getId()); application.setCaseFlowId(caseFlow.getId());
application.setCaseStatusName(caseFlow.getCaseStatusName()); application.setCaseStatusName(caseFlow.getCaseStatusName());
application.setMediaResult(mediaResult); application.setMediaResult(mediaResult);
msCaseApplicationMapper.updateByPrimaryKeySelective(application); msCaseApplicationMapper.updateByPrimaryKeySelective(application);
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) { if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) {
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
// 结束对接北明,为调解失败状态 // 结束对接北明,为调解失败状态
caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL); caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL);
} }
}else {
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
} }
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
return AjaxResult.success(); return AjaxResult.success();
} }
@@ -78,9 +78,12 @@ import java.util.stream.Collectors;
import static com.google.common.io.Files.getFileExtension; import static com.google.common.io.Files.getFileExtension;
import static com.ruoyi.common.core.domain.AjaxResult.success; import static com.ruoyi.common.core.domain.AjaxResult.success;
@Slf4j @Slf4j
@Service @Service
public class MsSignSealServiceImpl implements MsSignSealService { public class MsSignSealServiceImpl implements MsSignSealService {
@Autowired
private MsSignSealService msSignSealService;
@Autowired @Autowired
MsCaseApplicationMapper msCaseApplicationMapper; MsCaseApplicationMapper msCaseApplicationMapper;
@@ -135,8 +138,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
ShortMessageService shortMessageService; ShortMessageService shortMessageService;
@Override @Override
@Transactional @Transactional
public AjaxResult sealApply(MsSignSealDTO dto) { public AjaxResult sealApply(MsSignSealDTO dto) {
@@ -161,7 +162,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
application.setCaseFlowId(nextFlow.getId()); application.setCaseFlowId(nextFlow.getId());
application.setCaseStatusName(nextFlow.getCaseStatusName()); application.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(application); caseApplicationMapper.updateByPrimaryKeySelective(application);
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null); CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), null);
} }
} else { } else {
// 单独 // 单独
@@ -171,7 +172,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
application.setCaseFlowId(nextFlow.getId()); application.setCaseFlowId(nextFlow.getId());
application.setCaseStatusName(nextFlow.getCaseStatusName()); application.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(application); caseApplicationMapper.updateByPrimaryKeySelective(application);
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null); CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), null);
} }
return AjaxResult.success("用印申请成功"); return AjaxResult.success("用印申请成功");
@@ -217,13 +218,13 @@ public class MsSignSealServiceImpl implements MsSignSealService {
if (records != null && records.size() > 0) { if (records != null && records.size() > 0) {
for (MsCaseLogRecordVO msCaseLogRecordVO : records) { for (MsCaseLogRecordVO msCaseLogRecordVO : records) {
String content = msCaseLogRecordVO.getCaseStatusName(); String content = msCaseLogRecordVO.getCaseStatusName();
if(StringUtils.isNotEmpty(content)){ if (StringUtils.isNotEmpty(content)) {
if(content.equals("结束")){ if (content.equals("结束")) {
recordsNew.add(msCaseLogRecordVO); recordsNew.add(msCaseLogRecordVO);
}else { } else {
if(!content.equals(msCaseFlow.getCaseStatusName())){ if (!content.equals(msCaseFlow.getCaseStatusName())) {
recordsNew.add(msCaseLogRecordVO); recordsNew.add(msCaseLogRecordVO);
}else{ } else {
break; break;
} }
} }
@@ -234,28 +235,28 @@ public class MsSignSealServiceImpl implements MsSignSealService {
CaseLogRecord caseLogRecordin = new CaseLogRecord(); CaseLogRecord caseLogRecordin = new CaseLogRecord();
List<MsCaseLogRecordVO> caseLogRecordsin = new ArrayList<>(); List<MsCaseLogRecordVO> caseLogRecordsin = new ArrayList<>();
if(!"结束".equals(msCaseFlow.getNodeName())){ if (!"结束".equals(msCaseFlow.getNodeName())) {
caseLogRecordin.setCaseNodeName(msCaseFlow.getNodeName()); caseLogRecordin.setCaseNodeName(msCaseFlow.getNodeName());
List<MsCaseFlowVO> msCaseFlowvos = caseFlowMapper.selectFlowRole(caseFlowId); List<MsCaseFlowVO> msCaseFlowvos = caseFlowMapper.selectFlowRole(caseFlowId);
StringBuilder roleIn = new StringBuilder(); StringBuilder roleIn = new StringBuilder();
for(MsCaseFlowVO mscaseFlowVO:msCaseFlowvos){ for (MsCaseFlowVO mscaseFlowVO : msCaseFlowvos) {
if(!"结束".equals(mscaseFlowVO.getNodeName())){ if (!"结束".equals(mscaseFlowVO.getNodeName())) {
roleIn.append( mscaseFlowVO.getRoleName()+"正在进行"+mscaseFlowVO.getNodeName()+";"); roleIn.append(mscaseFlowVO.getRoleName() + "正在进行" + mscaseFlowVO.getNodeName() + ";");
} }
} }
caseLogRecordin.setContent(roleIn.toString().substring(0,roleIn.toString().length()-1)); caseLogRecordin.setContent(roleIn.toString().substring(0, roleIn.toString().length() - 1));
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId); MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
if(nextFlow!=null){ if (nextFlow != null) {
String nodeName = nextFlow.getNodeName(); String nodeName = nextFlow.getNodeName();
if(StringUtils.isNotEmpty(nodeName)){ if (StringUtils.isNotEmpty(nodeName)) {
if(!"结束".equals(nodeName)){ if (!"结束".equals(nodeName)) {
List<MsCaseFlowVO> nextMsCaseFlowvo = caseFlowMapper.selectFlowRole(nextFlow.getId()); List<MsCaseFlowVO> nextMsCaseFlowvo = caseFlowMapper.selectFlowRole(nextFlow.getId());
StringBuilder roleIn1 = new StringBuilder(); StringBuilder roleIn1 = new StringBuilder();
for(MsCaseFlowVO mscaseFlowVO:nextMsCaseFlowvo){ for (MsCaseFlowVO mscaseFlowVO : nextMsCaseFlowvo) {
roleIn1.append( mscaseFlowVO.getRoleName()+";"); roleIn1.append(mscaseFlowVO.getRoleName() + ";");
} }
caseLogRecordin.setNextRoleName("下一节点角色:"+roleIn1.toString().substring(0,roleIn1.toString().length()-1)); caseLogRecordin.setNextRoleName("下一节点角色:" + roleIn1.toString().substring(0, roleIn1.toString().length() - 1));
} }
} }
} }
@@ -274,24 +275,24 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseLogRecord1.setCaseNodeName(msCaseFlowVOs.get(0).getNodeName()); caseLogRecord1.setCaseNodeName(msCaseFlowVOs.get(0).getNodeName());
StringBuilder rolenext = new StringBuilder(); StringBuilder rolenext = new StringBuilder();
for(MsCaseFlowVO mscaseFlowVO:msCaseFlowVOs){ for (MsCaseFlowVO mscaseFlowVO : msCaseFlowVOs) {
String nodeName1 = mscaseFlowVO.getNodeName(); String nodeName1 = mscaseFlowVO.getNodeName();
if(StringUtils.isNotEmpty(nodeName1)){ if (StringUtils.isNotEmpty(nodeName1)) {
if("结束".equals(nodeName1)){ if ("结束".equals(nodeName1)) {
rolenext.append("结束;"); rolenext.append("结束;");
}else { } else {
rolenext.append( mscaseFlowVO.getRoleName()+"将进行"+mscaseFlowVO.getNodeName()+";"); rolenext.append(mscaseFlowVO.getRoleName() + "将进行" + mscaseFlowVO.getNodeName() + ";");
} }
} }
} }
caseLogRecord1.setContent( rolenext.toString().substring(0,rolenext.toString().length()-1)); caseLogRecord1.setContent(rolenext.toString().substring(0, rolenext.toString().length() - 1));
caseLogRecordsnext.add(caseLogRecord1); caseLogRecordsnext.add(caseLogRecord1);
} }
} }
if(caseLogRecordsin!=null&&caseLogRecordsin.size()>0){ if (caseLogRecordsin != null && caseLogRecordsin.size() > 0) {
datas.put("finishCasenode", recordsNew); datas.put("finishCasenode", recordsNew);
}else { } else {
MsCaseLogRecordVO msCaseLogRecordVO1 = new MsCaseLogRecordVO(); MsCaseLogRecordVO msCaseLogRecordVO1 = new MsCaseLogRecordVO();
msCaseLogRecordVO1.setContent("结束"); msCaseLogRecordVO1.setContent("结束");
recordsNew.add(msCaseLogRecordVO1); recordsNew.add(msCaseLogRecordVO1);
@@ -308,27 +309,27 @@ public class MsSignSealServiceImpl implements MsSignSealService {
MsCaseLogRecord caseLogRecord = new MsCaseLogRecord(); MsCaseLogRecord caseLogRecord = new MsCaseLogRecord();
caseLogRecord.setCaseAppliId(id); caseLogRecord.setCaseAppliId(id);
List<MsCaseLogRecordVO> records = caseLogRecordMapper.selectCaseLogRecordList(caseLogRecord); List<MsCaseLogRecordVO> records = caseLogRecordMapper.selectCaseLogRecordList(caseLogRecord);
if(CollectionUtil.isNotEmpty(records)){ if (CollectionUtil.isNotEmpty(records)) {
records.forEach(record->{ records.forEach(record -> {
StringBuilder contentBuilder = new StringBuilder(); StringBuilder contentBuilder = new StringBuilder();
String caseNodeTime=""; String caseNodeTime = "";
if(record.getCreateTime()!=null){ if (record.getCreateTime() != null) {
caseNodeTime= DateUtil.format(record.getCreateTime(), DatePattern.NORM_DATETIME_FORMATTER); caseNodeTime = DateUtil.format(record.getCreateTime(), DatePattern.NORM_DATETIME_FORMATTER);
} }
Integer caseNode = record.getCaseNode(); Integer caseNode = record.getCaseNode();
String createBy = record.getCreateBy(); String createBy = record.getCreateBy();
if(StrUtil.isNotEmpty(createBy)){ if (StrUtil.isNotEmpty(createBy)) {
contentBuilder.append(Optional.ofNullable(record.getCreateNickName()).orElse("")).append("(").append(record.getCreateBy()).append(")").append("于").append(caseNodeTime); contentBuilder.append(Optional.ofNullable(record.getCreateNickName()).orElse("")).append("(").append(record.getCreateBy()).append(")").append("于").append(caseNodeTime);
}else{ } else {
contentBuilder.append(Optional.ofNullable(record.getCreateNickName()).orElse("")).append("于").append(caseNodeTime); contentBuilder.append(Optional.ofNullable(record.getCreateNickName()).orElse("")).append("于").append(caseNodeTime);
} }
if(StrUtil.isNotEmpty(record.getContent())){ if (StrUtil.isNotEmpty(record.getContent())) {
contentBuilder.append(record.getContent()); contentBuilder.append(record.getContent());
}else if(caseNode.intValue() == 0){ } else if (caseNode.intValue() == 0) {
contentBuilder.append(record.getCaseStatusName()); contentBuilder.append(record.getCaseStatusName());
} }
if(StrUtil.isNotEmpty(record.getNotes())){ if (StrUtil.isNotEmpty(record.getNotes())) {
contentBuilder.append(",").append(record.getNotes()); contentBuilder.append(",").append(record.getNotes());
} }
record.setContent(contentBuilder.toString()); record.setContent(contentBuilder.toString());
@@ -340,137 +341,86 @@ public class MsSignSealServiceImpl implements MsSignSealService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult msCaseFile(List<Long> ids){ public AjaxResult msCaseFile(List<Long> ids) {
// todo StringBuilder error = new StringBuilder();
try { try {
for (Long id : ids) { for (Long id : ids) {
MsCaseApplication caseApplication1 = msCaseApplicationMapper.selectByPrimaryKey(id); MsCaseApplication caseApplication1 = msCaseApplicationMapper.selectByPrimaryKey(id);
if (caseApplication1 == null) { if (caseApplication1 != null) {
return AjaxResult.error("未查询到相关案件");
}
MsCaseApplicationVO msCaseApplicationVO = new MsCaseApplicationVO();
BeanUtil.copyProperties(caseApplication1, msCaseApplicationVO);
List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryCaseAttachList(msCaseApplicationVO);
if (caseAttachList != null && caseAttachList.size() > 0) {
for (MsCaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
String prefix = "/profile";
int startIndex = prefix.length();
String annexPath = caseAttach.getAnnexPath();
String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
File file = new File(path);
if (!file.exists()) {
Gson gson = new Gson();
MsSealSignRecord sealSignRecord = new MsSealSignRecord();
sealSignRecord.setCaseAppliId(id);
List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecord);
if (sealSignRecords != null && sealSignRecords.size() > 0) {
String signFlowid = sealSignRecords.get(0).getSignFlowId();
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowid);
JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
if (filesArray != null && filesArray.size() > 0) {
JsonObject fileObject = (JsonObject) filesArray.get(0);
String fileDownloadUrl = fileObject.get("downloadUrl").toString();
String filearbitraUrl = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
LocalDate now = LocalDate.now(); MsCaseApplicationVO msCaseApplicationVO = new MsCaseApplicationVO();
String year = Integer.toString(now.getYear()); BeanUtil.copyProperties(caseApplication1, msCaseApplicationVO);
String month = String.format("%02d", now.getMonthValue()); List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryCaseAttachList(msCaseApplicationVO);
String day = String.format("%02d", now.getDayOfMonth()); // 只能送达pdf版调解书
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
String saveName = fileName;
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
// 创建日期目录 if (CollectionUtil.isNotEmpty(caseAttachList)) {
File saveFolder = new File(saveFolderPath); long count = caseAttachList.stream().filter(msCaseAttach -> msCaseAttach.getAnnexType() != null && msCaseAttach.getAnnexType().equals(AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode())).count();
if (!saveFolder.exists()) { if (count > 0) {
saveFolder.mkdirs(); Integer caseFlowId = caseApplication1.getCaseFlowId();
} // 查询当前节点
String resultFilePath = saveFolderPath + "/" + fileName; MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseFlowId);
File resultFilePathFile = new File(resultFilePath); if (currentFlow != null) {
if (!resultFilePathFile.exists()) { // 根据流程id查找下一个流程节点
resultFilePathFile.createNewFile(); MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
} caseApplication1.setCaseFlowId(nextFlow.getId());
caseApplication1.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(caseApplication1);
boolean downLoadFile = FileTransformation.downLoadFileByUrl(filearbitraUrl, resultFilePath); // 获取案件相关人员
if (downLoadFile) { List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(id);
MsCaseAttach caseAttach1 = new MsCaseAttach(); if (CollectionUtil.isNotEmpty(affiliates)) {
caseAttach1.setCaseAppliId(id); // 申请操作人
caseAttach1.setAnnexType(7); Optional<MsCaseAffiliate> applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst();
caseAttach1.setAnnexPath(savePath); // 被申请操作人
caseAttach1.setAnnexName(saveName); Optional<MsCaseAffiliate> resAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst();
msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach1); if (applicantAffiliateOpt.isPresent() && resAffiliateOpt.isPresent()) {
ExecutorService executor = ThreadUtil.createThreadPool();
caseAttach.setAnnexPath(savePath); // 发送邮件
caseAttach.setAnnexName(saveName); CompletableFuture.runAsync(() -> {
} if (StrUtil.isNotEmpty(applicantAffiliateOpt.get().getEmail())) {
boolean appEmailFlag = sendCaseEmail(caseApplication1, applicantAffiliateOpt.get().getEmail(), caseAttachList);
}
if (!StrUtil.isEmpty(resAffiliateOpt.get().getEmail())) {
boolean appEmailFlag = sendCaseEmail(caseApplication1, resAffiliateOpt.get().getEmail(), caseAttachList);
}
}, executor);
// 发送签收短信,2126313 尊敬的{1}用户,您的{2}文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?{3},如非本人操作,请忽略本短信
CompletableFuture.runAsync(() -> {
SysUser sysUser = sysUserMapper.selectUserById(applicantAffiliateOpt.get().getUserId());
// 获取短信链接uuid
MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication1.getId()).systemType("TJ").build();
String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
if (!StrUtil.isEmpty(sysUser.getPhonenumber())) {
SmsUtils.sendSms(caseApplication1, "2126313", sysUser.getPhonenumber(), new String[]{sysUser.getNickName(), caseApplication1.getCaseNum(), "authId=" + roomUuid});
} else if (StrUtil.isNotEmpty(sysUser.getEmail())) {
String content = "尊敬的" + sysUser.getNickName() + "用户,您的" + caseApplication1.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId=" + roomUuid + ",如非本人操作,请忽略本短信";
sendEmail(caseApplication1, sysUser, "调解系统文件签收", content);
}
}, executor);
} }
} }
} }
CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
} else {
error.append("案件编号为" + caseApplication1.getCaseNum() + "未找到pdf版调解书,请上传\r\n");
} }
} else {
error.append("案件编号为" + caseApplication1.getCaseNum() + "未找到pdf版调解书,请上传\r\n");
} }
} }
Integer caseFlowId = caseApplication1.getCaseFlowId();
// 查询当前节点
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseFlowId);
if(currentFlow==null){
return AjaxResult.error("未找到当前流程节点");
}
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
caseApplication1.setCaseFlowId(nextFlow.getId());
caseApplication1.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(caseApplication1);
// 获取案件相关人员
List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(id);
if(CollectionUtil.isEmpty(affiliates)){
return AjaxResult.error("未找到案件相关人员");
}
// 申请操作人
Optional<MsCaseAffiliate> applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst();
// 被申请操作人
Optional<MsCaseAffiliate> resAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst();
if (!applicantAffiliateOpt.isPresent() || !resAffiliateOpt.isPresent()) {
throw new ServiceException("未找到案件操作人员");
}
ExecutorService executor = ThreadUtil.createThreadPool();
// 发送邮件
CompletableFuture.runAsync(() -> {
if (StrUtil.isNotEmpty(applicantAffiliateOpt.get().getEmail())) {
boolean appEmailFlag = sendCaseEmail(caseApplication1, applicantAffiliateOpt.get().getEmail(), caseAttachList);
}
if (!StrUtil.isEmpty(resAffiliateOpt.get().getEmail())) {
boolean appEmailFlag = sendCaseEmail(caseApplication1, resAffiliateOpt.get().getEmail(), caseAttachList);
} }, executor);
// 发送签收短信,2126313 尊敬的{1}用户,您的{2}文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?{3},如非本人操作,请忽略本短信
CompletableFuture.runAsync(() -> {
SysUser sysUser = sysUserMapper.selectUserById(applicantAffiliateOpt.get().getUserId());
// 获取短信链接uuid
MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication1.getId()).systemType("TJ").build();
String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
if (!StrUtil.isEmpty(sysUser.getPhonenumber())) {
SmsUtils.sendSms(caseApplication1,"2126313", sysUser.getPhonenumber(),new String[]{sysUser.getNickName(),caseApplication1.getCaseNum(),"authId="+ roomUuid});
}else if(StrUtil.isNotEmpty(sysUser.getEmail())){
String content = "尊敬的"+sysUser.getNickName()+"用户,您的" + caseApplication1.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId="+ roomUuid + ",如非本人操作,请忽略本短信";
sendEmail(caseApplication1, sysUser, "调解系统文件签收", content);
}
}, executor);
CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"");
} }
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException("调解书发送失败"); throw new ServiceException("调解书发送失败");
} }
if (error.length() > 0) {
return AjaxResult.error(error.toString());
}
return AjaxResult.success(""); return AjaxResult.success("");
} }
public void sendEmail(MsCaseApplication application, SysUser user, String subject, String sendContent) { public void sendEmail(MsCaseApplication application, SysUser user, String subject, String sendContent) {
boolean emailFlag = emailOutUtil.sendMessage(user.getEmail(), subject, sendContent, null, null); boolean emailFlag = emailOutUtil.sendMessage(user.getEmail(), subject, sendContent, null, null);
@@ -498,12 +448,13 @@ public class MsSignSealServiceImpl implements MsSignSealService {
msSendMailHistoryRecord.setId(null); msSendMailHistoryRecord.setId(null);
sendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord); sendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord);
} }
@Override @Override
@Transactional @Transactional
public AjaxResult msCaseSign(MsSignSealDTO dto) { public AjaxResult msCaseSign(MsSignSealDTO dto) {
Long caseId = dto.getCaseId(); Long caseId = dto.getCaseId();
MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseId); MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseId);
if(caseApplicationselect==null){ if (caseApplicationselect == null) {
return AjaxResult.error("当前案件不存在"); return AjaxResult.error("当前案件不存在");
} }
// 查询当前节点 // 查询当前节点
@@ -515,20 +466,20 @@ public class MsSignSealServiceImpl implements MsSignSealService {
Example example = new Example(MsCaseAffiliate.class); Example example = new Example(MsCaseAffiliate.class);
example.createCriteria().andEqualTo("caseAppliId", caseId); example.createCriteria().andEqualTo("caseAppliId", caseId);
List<MsCaseAffiliate> msCaseAffiliates = msCaseAffiliateMapper.selectByExample(example); List<MsCaseAffiliate> msCaseAffiliates = msCaseAffiliateMapper.selectByExample(example);
if(CollectionUtil.isEmpty(msCaseAffiliates)){ if (CollectionUtil.isEmpty(msCaseAffiliates)) {
return AjaxResult.error("未找到案件相关人员"); return AjaxResult.error("未找到案件相关人员");
} }
// 被申请操作人 // 被申请操作人
Optional<MsCaseAffiliate> resAffiliateOpt = msCaseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); Optional<MsCaseAffiliate> resAffiliateOpt = msCaseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst();
ExecutorService executor = ThreadUtil.createThreadPool(); ExecutorService executor = ThreadUtil.createThreadPool();
if(!resAffiliateOpt.isPresent()){ if (!resAffiliateOpt.isPresent()) {
return AjaxResult.error("案件相关人员不完整"); return AjaxResult.error("案件相关人员不完整");
} }
for (MsCaseAffiliate affiliate : msCaseAffiliates) { for (MsCaseAffiliate affiliate : msCaseAffiliates) {
// 申请人签收,根据流程id查找下一个流程节点 // 申请人签收,根据流程id查找下一个流程节点
if(affiliate.getUserId()!=null if (affiliate.getUserId() != null
&& loginUserId.equals(affiliate.getUserId()) && loginUserId.equals(affiliate.getUserId())
&&affiliate.getRoleType()!=null&&(affiliate.getRoleType().equals(1)||affiliate.getRoleType().equals(2))) { && affiliate.getRoleType() != null && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) {
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
caseApplicationselect.setCaseFlowId(nextFlow.getId()); caseApplicationselect.setCaseFlowId(nextFlow.getId());
caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName()); caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
@@ -552,19 +503,19 @@ public class MsSignSealServiceImpl implements MsSignSealService {
} }
// 被申请人签收 // 被申请人签收
if(affiliate.getUserId()!=null if (affiliate.getUserId() != null
&& loginUserId.equals(affiliate.getUserId()) && loginUserId.equals(affiliate.getUserId())
&&affiliate.getRoleType()!=null&&(affiliate.getRoleType().equals(3)||affiliate.getRoleType().equals(4))) { && affiliate.getRoleType() != null && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))) {
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
caseApplicationselect.setCaseFlowId(nextFlow.getId()); caseApplicationselect.setCaseFlowId(nextFlow.getId());
caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName()); caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null); CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), null);
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null); CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null);
// 被申请人签收结束对接北明,为调解成功状态 // 被申请人签收结束对接北明,为调解成功状态
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) { if (StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS); applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS);
} }
break; break;
@@ -580,39 +531,39 @@ public class MsSignSealServiceImpl implements MsSignSealService {
public AjaxResult msCaseSignUrlApplyPC(MsSignSealDTO dto) throws EsignDemoException { public AjaxResult msCaseSignUrlApplyPC(MsSignSealDTO dto) throws EsignDemoException {
Long caseId = dto.getCaseId(); Long caseId = dto.getCaseId();
List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(caseId); List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(caseId);
if(CollectionUtil.isEmpty(affiliates)){ if (CollectionUtil.isEmpty(affiliates)) {
return AjaxResult.error("未找到案件相关人员"); return AjaxResult.error("未找到案件相关人员");
} }
SysUser user = sysUserMapper.selectUserById(SecurityUtils.getLoginUser().getUser().getUserId()); SysUser user = sysUserMapper.selectUserById(SecurityUtils.getLoginUser().getUser().getUserId());
List<SysRole> roles = user.getRoles(); List<SysRole> roles = user.getRoles();
if(CollectionUtil.isEmpty(roles)){ if (CollectionUtil.isEmpty(roles)) {
return AjaxResult.error("该用户未绑定角色"); return AjaxResult.error("该用户未绑定角色");
} }
long mediatorCount = roles.stream().filter(sysRole -> sysRole.getRoleName().equals("调解员")).count(); long mediatorCount = roles.stream().filter(sysRole -> sysRole.getRoleName().equals("调解员")).count();
List<MsCaseAffiliate> operatorList = affiliates.stream().filter(msCaseAffiliate -> msCaseAffiliate.getOperatorFlag() != null List<MsCaseAffiliate> operatorList = affiliates.stream().filter(msCaseAffiliate -> msCaseAffiliate.getOperatorFlag() != null
&& msCaseAffiliate.getOperatorFlag() == 1 && msCaseAffiliate.getOperatorFlag() == 1
&& StrUtil.isNotEmpty(msCaseAffiliate.getPhone())).collect(Collectors.toList()); && StrUtil.isNotEmpty(msCaseAffiliate.getPhone())).collect(Collectors.toList());
Optional<MsCaseAffiliate> appOpt =null; Optional<MsCaseAffiliate> appOpt = null;
Optional<MsCaseAffiliate> resOpt =null; Optional<MsCaseAffiliate> resOpt = null;
if(CollectionUtil.isNotEmpty(operatorList)){ if (CollectionUtil.isNotEmpty(operatorList)) {
appOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null && msCaseAffiliate.getUserId()!=null appOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null && msCaseAffiliate.getUserId() != null
&& (msCaseAffiliate.getRoleType() == 1 || msCaseAffiliate.getRoleType() == 2)) && (msCaseAffiliate.getRoleType() == 1 || msCaseAffiliate.getRoleType() == 2))
.findFirst(); .findFirst();
resOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null&& msCaseAffiliate.getUserId()!=null resOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null && msCaseAffiliate.getUserId() != null
&& (msCaseAffiliate.getRoleType() == 3 || msCaseAffiliate.getRoleType() == 4)) && (msCaseAffiliate.getRoleType() == 3 || msCaseAffiliate.getRoleType() == 4))
.findFirst(); .findFirst();
} }
if(appOpt==null || !appOpt.isPresent()){ if (appOpt == null || !appOpt.isPresent()) {
return AjaxResult.error("未找到案件申请操作人"); return AjaxResult.error("未找到案件申请操作人");
} }
if(resOpt==null || !resOpt.isPresent()){ if (resOpt == null || !resOpt.isPresent()) {
return AjaxResult.error("未找到案件被申请操作人"); return AjaxResult.error("未找到案件被申请操作人");
} }
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId); MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId);
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
if(appOpt.get().getUserId()!=null && appOpt.get().getUserId().equals(userId)){ if (appOpt.get().getUserId() != null && appOpt.get().getUserId().equals(userId)) {
// 申请人链接 // 申请人链接
SealSignRecord sealSignRecordres = new SealSignRecord(); SealSignRecord sealSignRecordres = new SealSignRecord();
MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
@@ -620,29 +571,29 @@ public class MsSignSealServiceImpl implements MsSignSealService {
List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord); List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord);
if (sealSignRecords != null && sealSignRecords.size() > 0) { if (sealSignRecords != null && sealSignRecords.size() > 0) {
String signFlowid = sealSignRecords.get(0).getSignFlowId(); String signFlowid = sealSignRecords.get(0).getSignFlowId();
SealSignRecord sealSignRecord = new SealSignRecord(); SealSignRecord sealSignRecord = new SealSignRecord();
sealSignRecord.setPensonAccount(appOpt.get().getPhone()); sealSignRecord.setPensonAccount(appOpt.get().getPhone());
sealSignRecord.setPensonName(appOpt.get().getName()); sealSignRecord.setPensonName(appOpt.get().getName());
sealSignRecord.setSignFlowid(signFlowid); sealSignRecord.setSignFlowid(signFlowid);
Gson gson = new Gson(); Gson gson = new Gson();
EsignHttpResponse signUrl = SignAward.signUrl(sealSignRecord); EsignHttpResponse signUrl = SignAward.signUrl(sealSignRecord);
JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
if(signUrlJsonObject.get("data")==null||signUrlJsonObject.get("data").isJsonNull()){ if (signUrlJsonObject.get("data") == null || signUrlJsonObject.get("data").isJsonNull()) {
throw new ServiceException("该用户和流程无关,不能查看当前流程"); throw new ServiceException("该用户和流程无关,不能查看当前流程");
}else { } else {
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String urlapply = signUrlData.get("shortUrl").getAsString(); String urlapply = signUrlData.get("shortUrl").getAsString();
sealSignRecordres.setSealUrl(urlapply); sealSignRecordres.setSealUrl(urlapply);
} }
return AjaxResult.success(sealSignRecordres); return AjaxResult.success(sealSignRecordres);
}else { } else {
return AjaxResult.error(); return AjaxResult.error();
} }
} }
if(resOpt.get().getUserId()!=null && resOpt.get().getUserId().equals(userId)){ if (resOpt.get().getUserId() != null && resOpt.get().getUserId().equals(userId)) {
// 被申 // 被申
SealSignRecord sealSignRecordres = new SealSignRecord(); SealSignRecord sealSignRecordres = new SealSignRecord();
MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
@@ -662,11 +613,11 @@ public class MsSignSealServiceImpl implements MsSignSealService {
String urlapply = signUrlData.get("shortUrl").getAsString(); String urlapply = signUrlData.get("shortUrl").getAsString();
sealSignRecordres.setSealUrl(urlapply); sealSignRecordres.setSealUrl(urlapply);
return AjaxResult.success(sealSignRecordres); return AjaxResult.success(sealSignRecordres);
}else { } else {
return AjaxResult.error(); return AjaxResult.error();
} }
} }
if(mediatorCount>0){ if (mediatorCount > 0) {
// 调解员 // 调解员
SealSignRecord sealSignRecordres = new SealSignRecord(); SealSignRecord sealSignRecordres = new SealSignRecord();
MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
@@ -677,7 +628,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
SealSignRecord sealSignRecord = new SealSignRecord(); SealSignRecord sealSignRecord = new SealSignRecord();
Long arbitratorId = caseApplication.getMediatorId(); Long arbitratorId = caseApplication.getMediatorId();
if (arbitratorId!=null) { if (arbitratorId != null) {
SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
if (sysUser == null) { if (sysUser == null) {
return AjaxResult.error(); return AjaxResult.error();
@@ -693,7 +644,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
String urlapply = signUrlData.get("shortUrl").getAsString(); String urlapply = signUrlData.get("shortUrl").getAsString();
sealSignRecordres.setSealUrl(urlapply); sealSignRecordres.setSealUrl(urlapply);
return AjaxResult.success(sealSignRecordres); return AjaxResult.success(sealSignRecordres);
}else { } else {
return AjaxResult.error(); return AjaxResult.error();
} }
@@ -708,7 +659,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
JSONObject jsonObjectCallback = JSONObject.parseObject(reqbodystr); JSONObject jsonObjectCallback = JSONObject.parseObject(reqbodystr);
Gson gson = new Gson(); Gson gson = new Gson();
if (jsonObjectCallback != null) { if (jsonObjectCallback != null) {
log.info("签名回调======"+jsonObjectCallback); log.info("签名回调======" + jsonObjectCallback);
int signResult = jsonObjectCallback.getIntValue("signResult"); int signResult = jsonObjectCallback.getIntValue("signResult");
String action = jsonObjectCallback.getString("action"); String action = jsonObjectCallback.getString("action");
String signFlowId = jsonObjectCallback.getString("signFlowId"); String signFlowId = jsonObjectCallback.getString("signFlowId");
@@ -742,10 +693,10 @@ public class MsSignSealServiceImpl implements MsSignSealService {
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseApplicationselect.getCaseFlowId()); MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseApplicationselect.getCaseFlowId());
Integer caseNode = currentFlow.getNodeId(); Integer caseNode = currentFlow.getNodeId();
String caseStatusName = currentFlow.getCaseStatusName(); String caseStatusName = currentFlow.getCaseStatusName();
if("SIGN_MISSON_COMPLETE".equals(action) && signResult==2){ if ("SIGN_MISSON_COMPLETE".equals(action) && signResult == 2) {
if(mediaResult.equals(1)){ if (mediaResult.equals(1)) {
//调解 //调解
if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){ if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(pensonAccountApply)) {
//申请人签名 //申请人签名
sealSignRecordsel.setSignStatusApply(1); sealSignRecordsel.setSignStatusApply(1);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
@@ -756,14 +707,14 @@ public class MsSignSealServiceImpl implements MsSignSealService {
operLog.setCaseNode(caseNode); operLog.setCaseNode(caseNode);
operLog.setCreateTime(dateOperate); operLog.setCreateTime(dateOperate);
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
if(signStatusResponse!=null&&signStatusResponse.equals(1)&& if (signStatusResponse != null && signStatusResponse.equals(1) &&
signStatusMediator!=null&&signStatusMediator.equals(1)){ signStatusMediator != null && signStatusMediator.equals(1)) {
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
MsCaseFlow nextFlow=null; MsCaseFlow nextFlow = null;
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag().equals(1)) { if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag().equals(1)) {
// 需要用印 // 需要用印
nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
}else { } else {
// 不需要用印 // 不需要用印
nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId()); nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
} }
@@ -774,19 +725,19 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseApplicationMapper.updateByPrimaryKeySelective(application); caseApplicationMapper.updateByPrimaryKeySelective(application);
//修改"签署用印记录表"的状态为待用印 //修改"签署用印记录表"的状态为待用印
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
sealSignRecordsel.setSignFlowStatus(2); sealSignRecordsel.setSignFlowStatus(2);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
}else { } else {
// 否则为已完成 // 否则为已完成
sealSignRecordsel.setSignFlowStatus(3); sealSignRecordsel.setSignFlowStatus(3);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
// 下载调解书 // 下载调解书
downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
} }
} }
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){ } else if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(pensonAccountRes)) {
//被申请人签名 //被申请人签名
sealSignRecordsel.setSignStatusResponse(1); sealSignRecordsel.setSignStatusResponse(1);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
@@ -797,15 +748,15 @@ public class MsSignSealServiceImpl implements MsSignSealService {
operLog.setCaseNode(caseNode); operLog.setCaseNode(caseNode);
operLog.setCreateTime(dateOperate); operLog.setCreateTime(dateOperate);
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
if(signStatusApply!=null&&signStatusApply.equals(1)&& if (signStatusApply != null && signStatusApply.equals(1) &&
signStatusMediator!=null&&signStatusMediator.equals(1)){ signStatusMediator != null && signStatusMediator.equals(1)) {
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
MsCaseFlow nextFlow=null; MsCaseFlow nextFlow = null;
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
// 需要用印 // 需要用印
nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
}else { } else {
// 不需要用印 // 不需要用印
nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId()); nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
} }
@@ -816,19 +767,19 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseApplicationMapper.updateByPrimaryKeySelective(application); caseApplicationMapper.updateByPrimaryKeySelective(application);
//修改"签署用印记录表"的状态为待用印 //修改"签署用印记录表"的状态为待用印
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
sealSignRecordsel.setSignFlowStatus(2); sealSignRecordsel.setSignFlowStatus(2);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
}else { } else {
// 否则为已完成 // 否则为已完成
sealSignRecordsel.setSignFlowStatus(3); sealSignRecordsel.setSignFlowStatus(3);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
// 下载调解书 // 下载调解书
downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
} }
} }
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountMedi)){ } else if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(pensonAccountMedi)) {
//调解员签名 //调解员签名
sealSignRecordsel.setSignStatusMediator(1); sealSignRecordsel.setSignStatusMediator(1);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
@@ -839,15 +790,15 @@ public class MsSignSealServiceImpl implements MsSignSealService {
operLog.setCaseNode(caseNode); operLog.setCaseNode(caseNode);
operLog.setCreateTime(dateOperate); operLog.setCreateTime(dateOperate);
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
if(signStatusApply!=null&&signStatusApply.equals(1)&& if (signStatusApply != null && signStatusApply.equals(1) &&
signStatusResponse!=null&&signStatusResponse.equals(1)){ signStatusResponse != null && signStatusResponse.equals(1)) {
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
// 根据流程id查找下一个流程节点 // 根据流程id查找下一个流程节点
MsCaseFlow nextFlow=null; MsCaseFlow nextFlow = null;
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
// 需要用印 // 需要用印
nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
}else { } else {
// 不需要用印 // 不需要用印
nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId()); nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
} }
@@ -858,19 +809,19 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseApplicationMapper.updateByPrimaryKeySelective(application); caseApplicationMapper.updateByPrimaryKeySelective(application);
//修改"签署用印记录表"的状态为待用印 //修改"签署用印记录表"的状态为待用印
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
sealSignRecordsel.setSignFlowStatus(2); sealSignRecordsel.setSignFlowStatus(2);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
}else { } else {
// 否则为已完成 // 否则为已完成
sealSignRecordsel.setSignFlowStatus(3); sealSignRecordsel.setSignFlowStatus(3);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
// 下载调解书 // 下载调解书
downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
} }
} }
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc) && caseApplicationselect.getSealFlag()!=null && caseApplicationselect.getSealFlag()==1 ){ } else if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(orgnNamePsnAcc) && caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
//需要用印 //需要用印
sealSignRecordsel.setSealStatus(1); sealSignRecordsel.setSealStatus(1);
sealSignRecordsel.setSignFlowStatus(3); sealSignRecordsel.setSignFlowStatus(3);
@@ -892,13 +843,13 @@ public class MsSignSealServiceImpl implements MsSignSealService {
caseApplicationMapper.updateByPrimaryKeySelective(application); caseApplicationMapper.updateByPrimaryKeySelective(application);
//下载审核完成的调解书 //下载审核完成的调解书
downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
} }
}else if(mediaResult.equals(5)){ } else if (mediaResult.equals(5)) {
//和解 //和解
if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){ if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(pensonAccountApply)) {
//申请人签名 //申请人签名
sealSignRecordsel.setSignStatusApply(1); sealSignRecordsel.setSignStatusApply(1);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
@@ -909,7 +860,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
operLog.setCaseNode(caseNode); operLog.setCaseNode(caseNode);
operLog.setCreateTime(dateOperate); operLog.setCreateTime(dateOperate);
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
if(signStatusResponse!=null&&signStatusResponse.equals(1)){ if (signStatusResponse != null && signStatusResponse.equals(1)) {
MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId()); MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
MsCaseApplication application = new MsCaseApplication(); MsCaseApplication application = new MsCaseApplication();
application.setId(caseApplicationselect.getId()); application.setId(caseApplicationselect.getId());
@@ -922,7 +873,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
//下载审核完成的调解书 //下载审核完成的调解书
downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
// EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); // EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
// JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); // JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
// JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); // JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
@@ -989,7 +940,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
// //
// } // }
} }
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){ } else if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(pensonAccountRes)) {
//被申请人签名 //被申请人签名
sealSignRecordsel.setSignStatusResponse(1); sealSignRecordsel.setSignStatusResponse(1);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
@@ -1000,7 +951,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
operLog.setCaseNode(caseNode); operLog.setCaseNode(caseNode);
operLog.setCreateTime(dateOperate); operLog.setCreateTime(dateOperate);
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
if(signStatusApply!=null&&signStatusApply.equals(1)){ if (signStatusApply != null && signStatusApply.equals(1)) {
MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId()); MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
MsCaseApplication application = new MsCaseApplication(); MsCaseApplication application = new MsCaseApplication();
application.setId(caseApplicationselect.getId()); application.setId(caseApplicationselect.getId());
@@ -1013,7 +964,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
//下载审核完成的调解书 //下载审核完成的调解书
downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
// EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); // EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
// JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); // JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
// JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); // JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
@@ -1084,84 +1035,96 @@ public class MsSignSealServiceImpl implements MsSignSealService {
} }
} }
}else{ } else {
return AjaxResult.error("error"); return AjaxResult.error("error");
} }
return AjaxResult.success("success"); return AjaxResult.success("success");
} }
private void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId) throws EsignDemoException, IOException { /**
log.info("signFlowId===="+signFlowId); * 下载调解书
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); *
log.info("下载成功===="+fileDownload); * @param caseApplicationselect
JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); * @param signFlowId
JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); * @param gson
JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); * @param caseAppliId
log.info("下载调解书pdf===="+filesArray); * @throws EsignDemoException
if (filesArray != null && filesArray.size() > 0) { * @throws IOException
JsonObject fileObject = (JsonObject) filesArray.get(0); */
String fileDownloadUrl = fileObject.get("downloadUrl").toString(); @Transactional
LocalDate now = LocalDate.now(); public void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId) {
String year = Integer.toString(now.getYear()); EsignHttpResponse fileDownload = null;
String month = String.format("%02d", now.getMonthValue()); try {
String day = String.format("%02d", now.getDayOfMonth()); fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
String saveName = fileName;
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
// 创建日期目录 JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
File saveFolder = new File(saveFolderPath); JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
if (!saveFolder.exists()) { JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
saveFolder.mkdirs(); if (filesArray != null && filesArray.size() > 0) {
} JsonObject fileObject = (JsonObject) filesArray.get(0);
String resultFilePath = saveFolderPath + "/" + fileName; String fileDownloadUrl = fileObject.get("downloadUrl").toString();
File resultFilePathFile = new File(resultFilePath); LocalDate now = LocalDate.now();
if (!resultFilePathFile.exists()) { String year = Integer.toString(now.getYear());
resultFilePathFile.createNewFile(); String month = String.format("%02d", now.getMonthValue());
} String day = String.format("%02d", now.getDayOfMonth());
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
String saveName = fileName;
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); // 创建日期目录
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); File saveFolder = new File(saveFolderPath);
log.info("是否下载成功======="+downLoadFile); if (!saveFolder.exists()) {
if (downLoadFile) { saveFolder.mkdirs();
// 先删除已经存在的调解书 }
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ String resultFilePath = saveFolderPath + "/" + fileName;
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); File resultFilePathFile = new File(resultFilePath);
if(CollectionUtil.isNotEmpty(existAttach)){ if (!resultFilePathFile.exists()) {
// 对接北明,同步案件状态,删除 resultFilePathFile.createNewFile();
for (MsCaseAttach msCaseAttach : existAttach) { }
if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
continue; String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
if (downLoadFile) {
// 先删除已经存在的pdf调解书
if (StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode());
if (CollectionUtil.isNotEmpty(existAttach)) {
// 对接北明,同步案件状态,删除
for (MsCaseAttach msCaseAttach : existAttach) {
if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) {
continue;
}
beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
} }
beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
} }
} }
} msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode());
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
MsCaseAttach caseAttach = new MsCaseAttach();
caseAttach.setCaseAppliId(caseAppliId);
caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode());
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
caseAttach.setSuffix(getFileExtension(caseAttach.getAnnexPath()));
caseAttachMapper.save(caseAttach);
// 对接北明,调用上传附件接口
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, DocumentTypeEnum.EVEDENT_AGREEMENT);
// 更新附件表
if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) {
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
}
MsCaseAttach caseAttach = new MsCaseAttach();
caseAttach.setCaseAppliId(caseAppliId);
caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
caseAttach.setSuffix(getFileExtension(caseAttach.getAnnexPath()));
log.info("调解书保存======="+downLoadFile);
caseAttachMapper.save(caseAttach);
// 对接北明,调用上传附件接口
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, DocumentTypeEnum.EVEDENT_AGREEMENT);
// 更新附件表
if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
} }
} }
}
}
} catch (Exception e) {
throw new ServiceException("E签宝下载调解书失败");
} }
} }
@@ -1193,7 +1156,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
} }
} }
if("SEAL_AUDIT".equals(action) && auditStatus==1){ if ("SEAL_AUDIT".equals(action) && auditStatus == 1) {
EsignHttpResponse response = SignAward.getOrgSeal(orgId, sealId); EsignHttpResponse response = SignAward.getOrgSeal(orgId, sealId);
JSONObject jsonObject = JSONObject.parseObject(response.getBody()); JSONObject jsonObject = JSONObject.parseObject(response.getBody());
int code = jsonObject.getIntValue("code"); int code = jsonObject.getIntValue("code");
@@ -1241,7 +1204,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
} }
} }
} }
}else{ } else {
return AjaxResult.error("error"); return AjaxResult.error("error");
} }
return AjaxResult.success("success"); return AjaxResult.success("success");
@@ -1258,14 +1221,14 @@ public class MsSignSealServiceImpl implements MsSignSealService {
Long fileId = null; Long fileId = null;
if (caseAttachList != null && caseAttachList.size() > 0) { if (caseAttachList != null && caseAttachList.size() > 0) {
for (MsCaseAttach caseAttach : caseAttachList) { for (MsCaseAttach caseAttach : caseAttachList) {
if (Objects.equals(caseAttach.getAnnexType(), AnnexTypeEnum.MEDIATE_BOOK.getCode())) { if (Objects.equals(caseAttach.getAnnexType(), AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode())) {
String prefix = "/profile"; String prefix = "/profile";
int startIndex = prefix.length(); int startIndex = prefix.length();
String annexPath = caseAttach.getAnnexPath(); String annexPath = caseAttach.getAnnexPath();
String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex + 1);
file = new File(path); file = new File(path);
fileList.add(file); fileList.add(file);
fileId=caseAttach.getAnnexId(); fileId = caseAttach.getAnnexId();
System.out.println("文件长度==================:" + file.length()); System.out.println("文件长度==================:" + file.length());
} }
} }
@@ -1279,7 +1242,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sendMailRecord.setSendTime(new Date()); sendMailRecord.setSendTime(new Date());
sendMailRecord.setMailSubject("签署后的调解书"); sendMailRecord.setMailSubject("签署后的调解书");
sendMailRecord.setMailFromAddress(emailFrom); sendMailRecord.setMailFromAddress(emailFrom);
sendMailRecord.setFileIds(fileId!=null?fileId.toString():null); sendMailRecord.setFileIds(fileId != null ? fileId.toString() : null);
// sendMailRecord.setCreateBy(SecurityUtils.getUsername()); // sendMailRecord.setCreateBy(SecurityUtils.getUsername());
sendMailRecord.setCreateTime(new Date()); sendMailRecord.setCreateTime(new Date());
sendMailRecord.setMailFromAddress(emailFrom); sendMailRecord.setMailFromAddress(emailFrom);
@@ -1315,7 +1278,4 @@ public class MsSignSealServiceImpl implements MsSignSealService {
} }
} }