From 4fb50c0fb3ae885d61db850d1bfcd18431adb44d Mon Sep 17 00:00:00 2001 From: qitz <18810291185@163.com> Date: Mon, 22 Jan 2024 15:01:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=A1=AE=E8=AE=A4=E8=B0=83?= =?UTF-8?q?=E8=A7=A3=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mscase/MsCaseApplicationController.java | 3 +- .../mscase/MsCaseApplicationService.java | 3 +- .../impl/MsCaseApplicationServiceImpl.java | 301 +++++++++++++++++- .../mscase/impl/MsSignSealServiceImpl.java | 40 ++- .../utils/FixSelectFlowDetailUtils.java | 8 +- .../wisdomarbitrate/utils/SignAward.java | 8 +- 6 files changed, 336 insertions(+), 27 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java index f5b7c19..07a629a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java @@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.BookingVO; @@ -235,7 +236,7 @@ public class MsCaseApplicationController extends BaseController { * @return */ @PostMapping("/confirmMediation") - public AjaxResult confirmMediation(@RequestBody MsCaseAttachVO attach) { + public AjaxResult confirmMediation(@RequestBody MsCaseAttachVO attach) throws EsignDemoException, InterruptedException { if (attach.getCaseFlowId()==null || attach.getCaseAppliId()==null ) { return error("参数校验失败"); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java index 3ce872c..46f88d0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java @@ -1,6 +1,7 @@ package com.ruoyi.wisdomarbitrate.service.mscase; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; @@ -163,5 +164,5 @@ public interface MsCaseApplicationService { * @return */ - AjaxResult confirmMediation(MsCaseAttachVO attach); + AjaxResult confirmMediation(MsCaseAttachVO attach) throws EsignDemoException, InterruptedException; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index 1cdbe33..f67d982 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -3,32 +3,42 @@ package com.ruoyi.wisdomarbitrate.service.mscase.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; +import com.google.gson.JsonObject; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.entity.SysDept; -import com.ruoyi.common.core.domain.entity.SysDictData; -import com.ruoyi.common.core.domain.entity.SysRole; -import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.entity.*; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.enums.YesOrNoEnum; +import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.*; import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.file.SaaSAPIFileUtils; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated; import com.ruoyi.system.mapper.*; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper; +import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify; +import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage; +import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule; import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage; +import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*; +import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper; +import com.ruoyi.wisdomarbitrate.mapper.dept.MsSealSignRecordMapper; +import com.ruoyi.wisdomarbitrate.mapper.dept.SealManageMapper; import com.ruoyi.wisdomarbitrate.mapper.mscase.*; import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.template.FatchRuleMapper; @@ -36,6 +46,7 @@ import com.ruoyi.wisdomarbitrate.mapper.template.TemplateManageMapper; import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.wisdomarbitrate.utils.OCRUtils; +import com.ruoyi.wisdomarbitrate.utils.SignAward; import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument; @@ -109,6 +120,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { private SmsRecordMapper smsRecordMapper; @Autowired private MsCaseLogRecordMapper caseLogRecordMapper; + @Autowired + private SysUserMapper sysUserMapper; + @Autowired + private DeptIdentifyMapper deptIdentifyMapper; + @Autowired + private SealManageMapper sealManageMapper; + @Autowired + private MsSealSignRecordMapper sealSignRecordMapper; // 案件基本字段 public static final List CASE_BASE_COLUMN = Arrays.asList("caseSubjectAmount", "arbitratClaims", "facts", "requestRule"); public static final SimpleDateFormat yyyymmddFormat = new SimpleDateFormat("yyyy-MM-dd"); @@ -1011,7 +1030,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Transactional @Override - public AjaxResult confirmMediation(MsCaseAttachVO attach) { + public AjaxResult confirmMediation(MsCaseAttachVO attach) throws EsignDemoException, InterruptedException { if(attach.getAnnexId()!=null){ // 删除之前的调解书 msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(attach.getCaseAppliId(),AnnexTypeEnum.MEDIATE_BOOK.getCode()); @@ -1019,6 +1038,278 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } // 更新流程节点 nextFlow(attach.getCaseAppliId(),attach.getCaseFlowId(),YesOrNoEnum.YES.getCode()); + + Long id = attach.getCaseAppliId(); + MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id); + // 查询案件相关人员 + MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id); + // 查询附件 + List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(id); + 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); + //获取文件上传地址 + EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); + String body = response.getBody(); + if (body != null) { + JSONObject jsonObject = JSONObject.parseObject(body); + String fileId = jsonObject.getJSONObject("data").getString("fileId"); + String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); + //上传文件流 + EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); + JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); + if (jsonObject1.getIntValue("errCode") == 0) { + //查看文件上传状态 + Thread.sleep(1000); + EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); + JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); + JSONObject data = jsonObject2.getJSONObject("data"); + int fileStatus = data.getIntValue("fileStatus"); + if (fileStatus == 2 || fileStatus == 5) { + String fileName = data.getString("fileName"); + //上传成功,获取文件签名印章位置 + SealSignRecord sealSignRecord = new SealSignRecord(); + sealSignRecord.setFileid(fileId); + EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); + Gson gson = new Gson(); + JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); + JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); + String keywordPositions = positionsData.get("keywordPositions").toString(); + //发起签署 + sealSignRecord.setFilename(fileName); + + String arbitratorId = caseApplication.getMediatorId(); + if (StringUtils.isNotEmpty(arbitratorId)) { + SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId)); + if (sysUser == null) { + return AjaxResult.error(); + } + sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); + sealSignRecord.setPensonNameMedi(sysUser.getNickName()); + } + + sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); + sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); + sealSignRecord.setPensonAccountRes(caseAffiliate.getRespondentPhone()); + sealSignRecord.setPensonNameRes(caseAffiliate.getRespondentName()); + + DeptIdentify deptIdentify = new DeptIdentify(); + deptIdentify.setIsUse(1); + DeptIdentify deptIdentifyselect = new DeptIdentify(); + List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); + if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { + deptIdentifyselect = deptIdentifysnew.get(0); + sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName()); + sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone()); + sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName()); + } else { + return AjaxResult.error("没有用印时的机构名称及经办人信息"); + } + + //解析文件签名印章位置 + JSONArray jsonArray = JSONArray.parseArray(keywordPositions); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject3 = jsonArray.getJSONObject(i); + String keyword = jsonObject3.getString("keyword"); + if (keyword.equals("甲方(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsn(positionX + 90); + sealSignRecord.setPositionYpsn(positionY + 30); + } + }else if (keyword.equals("乙方(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsnRes(positionX + 90); + sealSignRecord.setPositionYpsnRes(positionY); + } + }else if (keyword.equals("调解员(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsnMedi(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsnMedi(positionX + 90); + sealSignRecord.setPositionYpsnMedi(positionY); + } + }else { + //用印 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXorg(positionX + 90); + sealSignRecord.setPositionYorg(positionY); + } + } + } + /*DeptIdentify deptIdentify1 = new DeptIdentify(); + deptIdentify1.setSealStatus(1); // 印章状态为启用 + //根据机构名称查询部门id + SysDept sysDept = new SysDept(); + sysDept.setDeptName(sealSignRecord.getOrgnizeName()); + List sysDepts = deptMapper.selectDeptList(sysDept); + if (sysDepts != null && sysDepts.size() > 0) { + Long deptId = sysDepts.get(0).getDeptId(); + deptIdentify1.setDeptId(deptId); + } + List deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify1); + List sealIds = new ArrayList<>(); + if (deptIdentifies != null && deptIdentifies.size() > 0) { + for (DeptIdentify identify : deptIdentifies) { + String sealId = identify.getSealId(); + sealIds.add(sealId); + } + }*/ + String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称 + String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名 + String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式 + //查询机构信息 + DeptIdentify deptIdentify1 = new DeptIdentify(); + deptIdentify1.setIdentifyName(orgnizeName); + deptIdentify1.setOperName(orgnizeNamepsnName); + deptIdentify1.setOperPhone(orgnizeNamePsnAccount); + List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1); + if (deptIdentifies != null && deptIdentifies.size() > 0) { + Long iddeptIdent = deptIdentifies.get(0).getId(); + SealManage sealManage = new SealManage(); + sealManage.setIdentifyId(iddeptIdent); + List sealIdList = new ArrayList<>(); + List selectSealList = sealManageMapper.selectSealList(sealManage); + if (selectSealList != null && selectSealList.size() > 0) { + for (SealManage manage : selectSealList) { + Integer sealStatus = manage.getSealStatus(); + Integer isUse = manage.getIsUse(); + if (sealStatus == 1 && isUse ==1) { + sealIdList.add(manage.getSealId()); + } + } + EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList); + + JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); + if (jsonObject3 != null) { + if (jsonObject3.getIntValue("code") == 0) { + //获取签署流程ID + JSONObject data1 = jsonObject3.getJSONObject("data"); + String signFlowId = data1.getString("signFlowId"); + //保存案件id,文件id,文件名称.流程id到签署用印记录表里 + sealSignRecord.setCaseAppliId(caseApplication.getId()); + sealSignRecord.setSignFlowid(signFlowId); + sealSignRecord.setSignFlowStatus(1);//待签名 + MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); + BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); + msSealSignRecord.setFileId(sealSignRecord.getFileid()); + msSealSignRecord.setFileName(sealSignRecord.getFilename()); + msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); + msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); + msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); + sealSignRecordMapper.insert(msSealSignRecord); + + SealSignRecord sealSignRecordapply = new SealSignRecord(); + sealSignRecordapply.setSignFlowid(signFlowId); + sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); + EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); + JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); + JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); + String urlapply = signUrlData.get("shortUrl").getAsString(); + String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1); + + //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId("2047719"); + request.setPhone(caseAffiliate.getContactTelphoneAgent()); + request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), caseApplication.getCaseNum(),urlapplynew}); + Boolean aBoolean = SmsUtils.sendSms(request); + + SealSignRecord sealSignRecordRespon = new SealSignRecord(); + sealSignRecordRespon.setSignFlowid(signFlowId); + sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone()); + EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); + JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); + JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); + String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); + String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1); + + SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); + request1.setTemplateId("2047719"); + request1.setPhone(caseAffiliate.getRespondentPhone()); + request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew}); + Boolean aBoolean1 = SmsUtils.sendSms(request1); + + SealSignRecord sealSignRecordMedi = new SealSignRecord(); + sealSignRecordMedi.setSignFlowid(signFlowId); + sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi()); + EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi); + JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class); + JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); + String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); + String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1); + + SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); + requestMedi.setTemplateId("2047719"); + requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); + requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), caseApplication.getCaseNum(),urlResponnewMedi}); + Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi); + + } else { + throw new ServiceException(jsonObject3.getString("message")); + } + } else { + return AjaxResult.error(); + } + + } + + + } else { + return AjaxResult.error(); + } + } + } + } + break; + } + + } + + } + + + return AjaxResult.success(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 3968677..21c590e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -14,6 +14,7 @@ import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.EsignHttpResponse; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.enums.YesOrNoEnum; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.ServiceException; @@ -110,9 +111,14 @@ public class MsSignSealServiceImpl implements MsSignSealService { List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(id); if (caseAttachList != null && caseAttachList.size() > 0) { for (MsCaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == 3) { + if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { +// String annexPath = caseAttach.getAnnexPath(); +// String path = "/home/ruoyi" + annexPath; + String prefix = "/profile"; + int startIndex = prefix.length(); String annexPath = caseAttach.getAnnexPath(); - String path = "/home/ruoyi" + annexPath; +// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); + String path = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\12\\f8551b0e003e4af89acae7b500dacb77调解书.docx"; //获取文件上传地址 EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); String body = response.getBody(); @@ -176,7 +182,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { for (int i = 0; i < jsonArray.size(); i++) { JSONObject jsonObject3 = jsonArray.getJSONObject(i); String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("申请人:")) { + if (keyword.equals("甲方(签字):")) { //签名 JSONArray positionsArray = jsonObject3.getJSONArray("positions"); // 遍历 positionsArray 中的每个元素 @@ -191,7 +197,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { sealSignRecord.setPositionXpsn(positionX + 90); sealSignRecord.setPositionYpsn(positionY + 30); } - }else if (keyword.equals("被申请人:")) { + }else if (keyword.equals("乙方(签字):")) { //签名 JSONArray positionsArray = jsonObject3.getJSONArray("positions"); // 遍历 positionsArray 中的每个元素 @@ -206,7 +212,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { sealSignRecord.setPositionXpsnRes(positionX + 90); sealSignRecord.setPositionYpsnRes(positionY); } - }else if (keyword.equals("调解员:")) { + }else if (keyword.equals("调解员(签字):")) { //签名 JSONArray positionsArray = jsonObject3.getJSONArray("positions"); // 遍历 positionsArray 中的每个元素 @@ -523,11 +529,15 @@ public class MsSignSealServiceImpl implements MsSignSealService { List caseAttachList = msCaseAttachMapper.queryCaseAttachList(msCaseApplicationVO); if (caseAttachList != null && caseAttachList.size() > 0) { for (MsCaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == 3) { - String annexName = caseAttach.getAnnexName(); - String prefix = "/profile/upload/"; + if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { +// String annexName = caseAttach.getAnnexName(); +// String prefix = "/profile/upload/"; +// int startIndex = prefix.length(); +// String path = caseAttach.getAnnexPath() + annexName.substring(startIndex); + String prefix = "/profile"; int startIndex = prefix.length(); - String path = caseAttach.getAnnexPath() + annexName.substring(startIndex); + String annexPath = caseAttach.getAnnexPath(); + String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); File file = new File(path); // todo 部署放开 if (!file.exists()) { @@ -671,11 +681,15 @@ public class MsSignSealServiceImpl implements MsSignSealService { File file = null; if (caseAttachList != null && caseAttachList.size() > 0) { for (MsCaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == 3) { - String annexName = caseAttach.getAnnexName(); - String prefix = "/profile/upload/"; + if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { +// String annexName = caseAttach.getAnnexName(); +// String prefix = "/profile/upload/"; +// int startIndex = prefix.length(); +// String path = caseAttach.getAnnexPath() + annexName.substring(startIndex); + String prefix = "/profile"; int startIndex = prefix.length(); - String path = caseAttach.getAnnexPath() + annexName.substring(startIndex); + String annexPath = caseAttach.getAnnexPath(); + String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); // todo 部署放开 file = new File(path); fileList.add(file); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java index 56e4698..6c587f1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java @@ -335,8 +335,10 @@ public class FixSelectFlowDetailUtils { 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 = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; - String savePath = "/home/ruoyi/uploadPath/upload/"; +// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; +// String savePath = "/home/ruoyi/uploadPath/upload/"; + String saveName = fileName; + String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; // 创建日期目录 File saveFolder = new File(saveFolderPath); @@ -355,7 +357,7 @@ public class FixSelectFlowDetailUtils { Long caseAppliId = sealSignRecord.getCaseAppliId(); MsCaseAttach caseAttach = new MsCaseAttach(); caseAttach.setCaseAppliId(caseAppliId); - caseAttach.setAnnexType(3); + caseAttach.setAnnexType(7); caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); caseAttachMapper.updateCaseAttachBycaseid(caseAttach); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java index b9ae889..cb96874 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java @@ -728,10 +728,10 @@ public class SignAward { String apiaddr = "/v3/files/" + fileId + "/keyword-positions"; String jsonParm = "{\n" + " \"keywords\": [\n" + - " \"申请人:\",\n" + - " \"被申请人:\",\n" + - " \"调解员:\",\n" + - " \"(盖章)\"\n" + + " \"甲方(签字):\",\n" + + " \"乙方(签字):\",\n" + + " \"调解员(签字):\",\n" + + " \"调解机构(盖章):\"\n" + " ]\n" + "}"; //请求方法