实现和解功能

This commit is contained in:
qitz
2024-01-29 14:25:14 +08:00
parent 6550e31112
commit d88a440264
5 changed files with 286 additions and 88 deletions
@@ -222,4 +222,10 @@ public class MsCaseApplication {
@Column(name = "mediation_agreement") @Column(name = "mediation_agreement")
private String mediationAgreement; private String mediationAgreement;
/**
* 是否和解,0-否,1-是
*/
@Column(name = "is_reconci")
private Integer isReconci;
} }
@@ -3,6 +3,8 @@ package com.ruoyi.wisdomarbitrate.domain.vo.mscase;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import lombok.*; import lombok.*;
import javax.persistence.Column;
@Getter @Getter
@Setter @Setter
@ToString @ToString
@@ -14,4 +16,9 @@ public class MsCaseAttachVO extends MsCaseAttach {
* 案件状态ID * 案件状态ID
*/ */
private Integer caseFlowId; private Integer caseFlowId;
/**
* 是否和解,0-否,1-是
*/
private Integer isReconci;
} }
@@ -1173,7 +1173,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id); MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
// 查询案件相关人员 // 查询案件相关人员
MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id); MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id);
Integer isReconci = attach.getIsReconci();
if(attach.getAnnexId()!=null){ if(attach.getAnnexId()!=null){
MsCaseAttach caseAttach = msCaseAttachMapper.queryAnnexById(attach.getAnnexId()); MsCaseAttach caseAttach = msCaseAttachMapper.queryAnnexById(attach.getAnnexId());
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
@@ -1306,7 +1306,67 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
} }
} }
/*DeptIdentify deptIdentify1 = new DeptIdentify();
if(isReconci.intValue()==1){
EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord);
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());
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);
} else {
throw new ServiceException(jsonObject3.getString("message"));
}
} else {
return AjaxResult.error();
}
}else {
/*DeptIdentify deptIdentify1 = new DeptIdentify();
deptIdentify1.setSealStatus(1); // 印章状态为启用 deptIdentify1.setSealStatus(1); // 印章状态为启用
//根据机构名称查询部门id //根据机构名称查询部门id
SysDept sysDept = new SysDept(); SysDept sysDept = new SysDept();
@@ -1324,106 +1384,109 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
sealIds.add(sealId); sealIds.add(sealId);
} }
}*/ }*/
String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称 String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称
String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名 String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名
String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式 String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式
//查询机构信息 //查询机构信息
DeptIdentify deptIdentify1 = new DeptIdentify(); DeptIdentify deptIdentify1 = new DeptIdentify();
deptIdentify1.setIdentifyName(orgnizeName); deptIdentify1.setIdentifyName(orgnizeName);
deptIdentify1.setOperName(orgnizeNamepsnName); deptIdentify1.setOperName(orgnizeNamepsnName);
deptIdentify1.setOperPhone(orgnizeNamePsnAccount); deptIdentify1.setOperPhone(orgnizeNamePsnAccount);
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1); List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1);
if (deptIdentifies != null && deptIdentifies.size() > 0) { if (deptIdentifies != null && deptIdentifies.size() > 0) {
Long iddeptIdent = deptIdentifies.get(0).getId(); Long iddeptIdent = deptIdentifies.get(0).getId();
SealManage sealManage = new SealManage(); SealManage sealManage = new SealManage();
sealManage.setIdentifyId(iddeptIdent); sealManage.setIdentifyId(iddeptIdent);
List<String> sealIdList = new ArrayList<>(); List<String> sealIdList = new ArrayList<>();
List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage); List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
if (selectSealList != null && selectSealList.size() > 0) { if (selectSealList != null && selectSealList.size() > 0) {
for (SealManage manage : selectSealList) { for (SealManage manage : selectSealList) {
Integer sealStatus = manage.getSealStatus(); Integer sealStatus = manage.getSealStatus();
Integer isUse = manage.getIsUse(); Integer isUse = manage.getIsUse();
if (sealStatus == 1 && isUse ==1) { if (sealStatus == 1 && isUse ==1) {
sealIdList.add(manage.getSealId()); sealIdList.add(manage.getSealId());
}
} }
} EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList);
EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList);
JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
if (jsonObject3 != null) { if (jsonObject3 != null) {
if (jsonObject3.getIntValue("code") == 0) { if (jsonObject3.getIntValue("code") == 0) {
//获取签署流程ID //获取签署流程ID
JSONObject data1 = jsonObject3.getJSONObject("data"); JSONObject data1 = jsonObject3.getJSONObject("data");
String signFlowId = data1.getString("signFlowId"); String signFlowId = data1.getString("signFlowId");
//保存案件id,文件id,文件名称.流程id到签署用印记录表里 //保存案件id,文件id,文件名称.流程id到签署用印记录表里
sealSignRecord.setCaseAppliId(caseApplication.getId()); sealSignRecord.setCaseAppliId(caseApplication.getId());
sealSignRecord.setSignFlowid(signFlowId); sealSignRecord.setSignFlowid(signFlowId);
sealSignRecord.setSignFlowStatus(1);//待签名 sealSignRecord.setSignFlowStatus(1);//待签名
MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); MsSealSignRecord msSealSignRecord = new MsSealSignRecord();
BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); BeanUtil.copyProperties(sealSignRecord, msSealSignRecord);
msSealSignRecord.setFileId(sealSignRecord.getFileid()); msSealSignRecord.setFileId(sealSignRecord.getFileid());
msSealSignRecord.setFileName(sealSignRecord.getFilename()); msSealSignRecord.setFileName(sealSignRecord.getFilename());
msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid());
msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount());
msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName());
sealSignRecordMapper.insert(msSealSignRecord); sealSignRecordMapper.insert(msSealSignRecord);
SealSignRecord sealSignRecordapply = new SealSignRecord(); SealSignRecord sealSignRecordapply = new SealSignRecord();
sealSignRecordapply.setSignFlowid(signFlowId); sealSignRecordapply.setSignFlowid(signFlowId);
sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply);
JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String urlapply = signUrlData.get("shortUrl").getAsString(); String urlapply = signUrlData.get("shortUrl").getAsString();
String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1); String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1);
//发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("2047719"); request.setTemplateId("2047719");
request.setPhone(caseAffiliate.getContactTelphoneAgent()); request.setPhone(caseAffiliate.getContactTelphoneAgent());
request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), caseApplication.getCaseNum(),urlapplynew}); request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), caseApplication.getCaseNum(),urlapplynew});
Boolean aBoolean = SmsUtils.sendSms(request); Boolean aBoolean = SmsUtils.sendSms(request);
SealSignRecord sealSignRecordRespon = new SealSignRecord(); SealSignRecord sealSignRecordRespon = new SealSignRecord();
sealSignRecordRespon.setSignFlowid(signFlowId); sealSignRecordRespon.setSignFlowid(signFlowId);
sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone()); sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone());
EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon);
JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class);
JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data");
String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); String urlRespon = signUrlDataRespon.get("shortUrl").getAsString();
String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1); String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1);
SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
request1.setTemplateId("2047719"); request1.setTemplateId("2047719");
request1.setPhone(caseAffiliate.getRespondentPhone()); request1.setPhone(caseAffiliate.getRespondentPhone());
request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew}); request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew});
Boolean aBoolean1 = SmsUtils.sendSms(request1); Boolean aBoolean1 = SmsUtils.sendSms(request1);
SealSignRecord sealSignRecordMedi = new SealSignRecord(); SealSignRecord sealSignRecordMedi = new SealSignRecord();
sealSignRecordMedi.setSignFlowid(signFlowId); sealSignRecordMedi.setSignFlowid(signFlowId);
sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi()); sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi());
EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi); EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi);
JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class); JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class);
JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data");
String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString();
String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1); String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1);
SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest();
requestMedi.setTemplateId("2047719"); requestMedi.setTemplateId("2047719");
requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); requestMedi.setPhone(sealSignRecord.getPensonAccountMedi());
requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), caseApplication.getCaseNum(),urlResponnewMedi}); requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), caseApplication.getCaseNum(),urlResponnewMedi});
Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi); Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi);
} else {
throw new ServiceException(jsonObject3.getString("message"));
}
} else { } else {
throw new ServiceException(jsonObject3.getString("message")); return AjaxResult.error();
} }
} else {
return AjaxResult.error();
} }
} else {
return AjaxResult.error();
} }
} else {
return AjaxResult.error();
} }
}else { }else {
return AjaxResult.error(); return AjaxResult.error();
} }
@@ -488,6 +488,127 @@ public class SignAward {
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
} }
/**
* 发起签署
*
* @return
* @throws EsignDemoException
*/
public static EsignHttpResponse createByFileReconci(SealSignRecord sealSignRecord ) throws EsignDemoException {
String apiaddr = "/v3/sign-flow/create-by-file";
String fileId = sealSignRecord.getFileid();
String fileName = sealSignRecord.getFilename();
String psnAccount = sealSignRecord.getPensonAccount();
String psnName = sealSignRecord.getPensonName();
String psnAccountRes = sealSignRecord.getPensonAccountRes();
String psnNameRes = sealSignRecord.getPensonNameRes();
String positionPagepsn = sealSignRecord.getPositionPagepsn();
double positionXpsn = sealSignRecord.getPositionXpsn();
double positionYpsn = sealSignRecord.getPositionYpsn();
String positionPagepsnRes = sealSignRecord.getPositionPagepsnRes();
double positionXpsnRes = sealSignRecord.getPositionXpsnRes();
double positionYpsnRes = sealSignRecord.getPositionYpsnRes();
String jsonParm = "{\n" +
" \"docs\": [\n" +
" {\n" +
" \"fileId\": \"" + fileId + "\",\n" +
" \"fileName\": \"" + fileName + "\"\n" +
" }\n" +
" ],\n" +
" \"signFlowConfig\": {\n" +
" \"signFlowTitle\": \"测试合同\",\n" +
" \"autoStart\": true,\n" +
" \"authConfig\": {\n" +
" \"willingnessAuthModes\": [\n" +
" \"CODE_SMS\"\n" +
" ],\n" +
" \"psnAvailableAuthModes\": [\n" +
" \"PSN_MOBILE3\"\n" +
" ],\n" +
" \"orgAvailableAuthModes\": [\n" +
" \"ORG_LEGALREP\"\n" +
" ]\n" +
" },\n" +
" \"signConfig\": {\n" +
" \"availableSignClientTypes\": \"1\"\n" +
" },\n" +
" \"autoFinish\": true\n" +
" },\n" +
" \"signers\": [\n" +
" {\n" +
" \"psnSignerInfo\": {\n" +
" \"psnAccount\": \"" + psnAccount + "\",\n" +
" \"psnInfo\": {\n" +
" \"psnName\": \"" + psnName + "\"\n" +
" }\n" +
" },\n" +
" \"signFields\": [\n" +
" {\n" +
" \"fileId\": \"" + fileId + "\",\n" +
" \"normalSignFieldConfig\": {\n" +
" \"autoSign\": false,\n" +
" \"freeMode\": false,\n" +
" \"movableSignField\": false,\n" +
" \"signFieldPosition\": {\n" +
" \"positionPage\": \"" + positionPagepsn + "\",\n" +
" \"positionX\": " + positionXpsn + ",\n" +
" \"positionY\": " + positionYpsn + "\n" +
" },\n" +
" \"signFieldStyle\": 1\n" +
" },\n" +
" \"signFieldType\": 0\n" +
" }\n" +
" ],\n" +
" \"signerType\": 0\n" +
" },\n" +
" {\n" +
" \"psnSignerInfo\": {\n" +
" \"psnAccount\": \"" + psnAccountRes + "\",\n" +
" \"psnInfo\": {\n" +
" \"psnName\": \"" + psnNameRes + "\"\n" +
" }\n" +
" },\n" +
" \"signFields\": [\n" +
" {\n" +
" \"fileId\": \"" + fileId + "\",\n" +
" \"normalSignFieldConfig\": {\n" +
" \"autoSign\": false,\n" +
" \"freeMode\": false,\n" +
" \"movableSignField\": false,\n" +
" \"signFieldPosition\": {\n" +
" \"positionPage\": \"" + positionPagepsnRes + "\",\n" +
" \"positionX\": " + positionXpsnRes + ",\n" +
" \"positionY\": " + positionYpsnRes + "\n" +
" },\n" +
" \"signFieldStyle\": 1\n" +
" },\n" +
" \"signFieldType\": 0\n" +
" }\n" +
" ],\n" +
" \"signerType\": 0\n" +
" }\n" +
" ]\n" +
"}";
//请求方法
EsignRequestType requestType = EsignRequestType.POST;
//生成请求签名鉴权方式的Header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
//发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
}
/** /**
* 获取合同文件签名链接 * 获取合同文件签名链接
* *
@@ -37,6 +37,7 @@
<result column="mediation_url" jdbcType="LONGVARCHAR" property="mediationUrl" /> <result column="mediation_url" jdbcType="LONGVARCHAR" property="mediationUrl" />
<result column="adjudica_counter_reason" jdbcType="LONGVARCHAR" property="adjudicaCounterReason" /> <result column="adjudica_counter_reason" jdbcType="LONGVARCHAR" property="adjudicaCounterReason" />
<result column="mediation_agreement" jdbcType="LONGVARCHAR" property="mediationAgreement" /> <result column="mediation_agreement" jdbcType="LONGVARCHAR" property="mediationAgreement" />
<result column="is_reconci" jdbcType="INTEGER" property="isReconci" />
</resultMap> </resultMap>
<select id="listMediator" resultMap="BaseResultMap"> <select id="listMediator" resultMap="BaseResultMap">