优化调解书签名功能

This commit is contained in:
qitz
2024-01-19 15:50:46 +08:00
parent 9af4469d16
commit dcad0d8634
7 changed files with 216 additions and 3 deletions
@@ -29,6 +29,13 @@ public class SealSignRecord extends BaseEntity {
/** 被申请人姓名 */
private String pensonNameRes;
/** 调解员账户 */
private String pensonAccountMedi;
/** 调解员姓名 */
private String pensonNameMedi;
/** 机构名称 */
private String orgnizeName;
/** 机构经办人 */
@@ -66,6 +73,13 @@ public class SealSignRecord extends BaseEntity {
/** 被申请人签名位置y坐标 */
private double positionYpsnRes;
/** 调解员签名位置页数 */
private String positionPagepsnMedi;
/** 调解员签名位置x坐标 */
private double positionXpsnMedi;
/** 调解员签名位置y坐标 */
private double positionYpsnMedi;
/** 印章位置页数 */
private String positionPageorg;
/** 印章位置x坐标 */
@@ -127,6 +127,23 @@ public class MsSealSignRecord {
@Column(name = "position_ypsn_res")
private double positionYpsnRes;
/** 调解员账户 */
@Column(name = "penson_account_medi")
private String pensonAccountMedi;
/** 调解员姓名 */
@Column(name = "penson_name_medi")
private String pensonNameMedi;
/** 调解员签名位置页数 */
@Column(name = "position_pagepsn_medi")
private String positionPagepsnMedi;
/** 调解员签名位置x坐标 */
@Column(name = "position_xpsn_medi")
private double positionXpsnMedi;
/** 调解员签名位置y坐标 */
@Column(name = "position_ypsn_medi")
private double positionYpsnMedi;
}
@@ -23,4 +23,5 @@ public interface MsSignSealService {
List<MsCaseLogRecordVO> selectCaseLogRecordList(MsSignSealDTO dto);
AjaxResult testSeal(MsSignSealDTO dto);
}
@@ -20,6 +20,7 @@ import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
@@ -68,6 +69,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
@Autowired
MsCaseFlowMapper caseFlowMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private MsSealSignRecordMapper sealSignRecordMapper;
@@ -125,6 +129,16 @@ public class MsSignSealServiceImpl implements MsSignSealService {
//发起签署
sealSignRecord.setFilename(fileName);
Long arbitratorId = caseApplication.getMediatorId();
if (arbitratorId != null) {
SysUser sysUser = sysUserMapper.selectUserById(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());
@@ -161,7 +175,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
double positionX = coordinateObj.getDoubleValue("positionX");
double positionY = coordinateObj.getDoubleValue("positionY");
sealSignRecord.setPositionXpsn(positionX + 90);
sealSignRecord.setPositionYpsn(positionY);
sealSignRecord.setPositionYpsn(positionY + 30);
}
}else if (keyword.equals("被申请人:")) {
//签名
@@ -178,6 +192,21 @@ public class MsSignSealServiceImpl implements MsSignSealService {
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");
@@ -288,6 +317,20 @@ public class MsSignSealServiceImpl implements MsSignSealService {
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"));
@@ -646,7 +689,103 @@ public class MsSignSealServiceImpl implements MsSignSealService {
}
@Override
@Transactional
public AjaxResult testSeal(MsSignSealDTO dto) {
Gson gson = new Gson();
List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat();
try {
if (sealSignRecords != null && sealSignRecords.size() > 0) {
for (int i = 0; i < sealSignRecords.size(); i++) {
MsSealSignRecord mssealSignRecord = sealSignRecords.get(i);
SealSignRecord sealSignRecord = new SealSignRecord();
BeanUtil.copyProperties(mssealSignRecord, sealSignRecord);
String signFlowId = mssealSignRecord.getSignFlowId();
if(StringUtils.isNotEmpty(signFlowId) && "819e60824fe241e9b862bd787403fa5e".equals(signFlowId)){
sealSignRecord.setSignFlowid(mssealSignRecord.getSignFlowId());
EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(), JsonObject.class);
JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
List<Integer> psnsignStatusList = new ArrayList<>();
Integer psnsignStatus = null;
Integer orgsignStatus = null;
for (int j = 0; j < signersArray.size(); j++) {
JsonObject signerObject = (JsonObject) signersArray.get(j);
if (!(signerObject.get("psnSigner").toString()).equals("null")) {
JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
if (psnSignerData != null) {
psnsignStatus = signerObject.get("signStatus").getAsInt();
psnsignStatusList.add(psnsignStatus);
}
}
if (!(signerObject.get("orgSigner").toString()).equals("null")) {
JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
if (orgSignerData != null) {
orgsignStatus = signerObject.get("signStatus").getAsInt();
}
}
}
List<Integer> psnsignStatusListnew = psnsignStatusList.stream().distinct().collect(Collectors.toList());
if (( psnsignStatusListnew.size()==1 && (psnsignStatusListnew.get(0).intValue() == 2)) && (orgsignStatus.intValue() == 1)) {
//更新立案申请状态为待用印
MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(sealSignRecord.getCaseAppliId());
if ((mssealSignRecord.getSignFlowStatus() != null) && (mssealSignRecord.getSignFlowStatus().intValue() == 1)) {
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
MsCaseApplication application = new MsCaseApplication();
application.setId(caseApplicationselect.getId());
application.setCaseFlowId(nextFlow.getId());
application.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(application);
//修改"签署用印记录表"的状态为待用印
mssealSignRecord.setSignFlowStatus(2);
sealSignRecordMapper.updateByPrimaryKeySelective(mssealSignRecord);
}
}
if (( psnsignStatusListnew.size()==1 && (psnsignStatusListnew.get(0).intValue() == 2)) && (orgsignStatus.intValue() == 2)) {
//更新立案申请状态为待送达
MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(sealSignRecord.getCaseAppliId());
if ((mssealSignRecord.getSignFlowStatus() != null) && (mssealSignRecord.getSignFlowStatus().intValue() == 2)) {
//修改"签署用印记录表"的状态为签署完成
mssealSignRecord.setSignFlowStatus(3);
sealSignRecordMapper.updateByPrimaryKeySelective(mssealSignRecord);
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
MsCaseApplication application = new MsCaseApplication();
application.setId(caseApplicationselect.getId());
application.setCaseFlowId(nextFlow.getId());
application.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(application);
}
}
}
}
}
} catch (EsignDemoException e) {
e.printStackTrace();
}
return AjaxResult.success();
}
}
@@ -244,7 +244,7 @@ public class FixSelectFlowDetailUtils {
/*
定时查询签署流程详情
*/
@Scheduled(cron = "0/10 * * * * ?")
// @Scheduled(cron = "0/10 * * * * ?")
@Transactional
public void fixExecuteSelectFlowDetailUtils() {
Gson gson = new Gson();
@@ -304,6 +304,9 @@ public class SignAward {
String psnAccountRes = sealSignRecord.getPensonAccountRes();
String psnNameRes = sealSignRecord.getPensonNameRes();
String psnAccountMedi = sealSignRecord.getPensonAccountMedi();
String psnNameMedi = sealSignRecord.getPensonNameMedi();
String orgName = sealSignRecord.getOrgnizeName();
String orgNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount();
String orgNamepsnName = sealSignRecord.getOrgnizeNamepsnName();
@@ -316,6 +319,10 @@ public class SignAward {
double positionXpsnRes = sealSignRecord.getPositionXpsnRes();
double positionYpsnRes = sealSignRecord.getPositionYpsnRes();
String positionPagepsnMedi = sealSignRecord.getPositionPagepsnMedi();
double positionXpsnMedi = sealSignRecord.getPositionXpsnMedi();
double positionYpsnMedi = sealSignRecord.getPositionYpsnMedi();
String positionPageorg = sealSignRecord.getPositionPageorg();
double positionXorg = sealSignRecord.getPositionXorg();
double positionYorg = sealSignRecord.getPositionYorg();
@@ -406,6 +413,34 @@ public class SignAward {
" \"signerType\": 0\n" +
" },\n" +
" {\n" +
" \"psnSignerInfo\": {\n" +
" \"psnAccount\": \"" + psnAccountMedi + "\",\n" +
" \"psnInfo\": {\n" +
" \"psnName\": \"" + psnNameMedi + "\"\n" +
" }\n" +
" },\n" +
" \"signFields\": [\n" +
" {\n" +
" \"fileId\": \"" + fileId + "\",\n" +
" \"normalSignFieldConfig\": {\n" +
" \"autoSign\": false,\n" +
" \"freeMode\": false,\n" +
" \"movableSignField\": false,\n" +
" \"signFieldPosition\": {\n" +
" \"positionPage\": \"" + positionPagepsnMedi + "\",\n" +
" \"positionX\": " + positionXpsnMedi + ",\n" +
" \"positionY\": " + positionYpsnMedi + "\n" +
" },\n" +
" \"signFieldStyle\": 1\n" +
" },\n" +
" \"signFieldType\": 0\n" +
" }\n" +
" ],\n" +
" \"signerType\": 0\n" +
" },\n" +
" {\n" +
" \"orgSignerInfo\": {\n" +
" \"orgName\": \"" + orgName + "\",\n" +
@@ -695,6 +730,7 @@ public class SignAward {
" \"keywords\": [\n" +
" \"申请人:\",\n" +
" \"被申请人:\",\n" +
" \"调解员:\",\n" +
" \"(盖章)\"\n" +
" ]\n" +
"}";