# Conflicts:
#	ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/SealSignRecordMapper.java
#	ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java
#	ruoyi-system/src/main/resources/mapper/wisdomarbitrate/SealSignRecordMapper.xml
This commit is contained in:
hejinbo
2023-10-13 14:52:00 +08:00
9 changed files with 361 additions and 143 deletions
@@ -1,6 +1,8 @@
package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
import java.util.List;
@@ -40,4 +42,8 @@ public interface ICaseApplicationService {
CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication);
String sendRoomNoMessage(SendRoomNoMessageVO messageVO);
SealSignRecord selectSignUrl(CaseApplication caseApplication) throws EsignDemoException;
SealSignRecord selectSealUrl(CaseApplication caseApplication) throws EsignDemoException;
}
@@ -4,25 +4,18 @@ package com.ruoyi.wisdomarbitrate.service.impl;
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.JsonArray;
import com.google.gson.JsonObject;
import com.ruoyi.common.annotation.DataScope;
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.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SignAward;
import com.ruoyi.common.utils.bean.SealSignRecord;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
@@ -35,11 +28,10 @@ import com.ruoyi.wisdomarbitrate.domain.*;
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
import com.ruoyi.wisdomarbitrate.mapper.*;
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
import com.ruoyi.wisdomarbitrate.utils.SignAward;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -61,18 +53,17 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
private ArbitratorMapper arbitratorMapper;
@Autowired
private ArbitrateRecordMapper arbitrateRecordMapper;
@Autowired
private ICaseApplicationService caseApplicationService;
@Autowired
private CaseAttachMapper caseAttachMapper;
@Autowired
private SysDeptMapper sysDeptMapper;
@Autowired
private ICaseApplicationService caseApplicationService;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private SealSignRecordMapper sealSignRecordMapper;
// 手机号正则
private static final Pattern TELEPHONE_REGX = Pattern.compile("^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$");
@@ -113,7 +104,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAffiliate.setCaseAppliId(caseApplication.getId());
if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
// 将组织机构id设为申请人名称
if (deptMap.containsKey(caseAffiliate.getName())) {
if (deptMap.containsKey(caseApplication.getName())) {
caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName())));
} else {
// 如果不存在则新增
@@ -196,7 +187,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAffiliate.setCaseAppliId(caseApplication.getId());
if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
// 将组织机构id设为申请人名称
if (deptMap.containsKey(caseAffiliate.getName())) {
if (deptMap.containsKey(caseApplication.getName())) {
caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName())));
} else {
// 如果不存在则新增
@@ -680,7 +671,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
rows = caseApplicationMapper.submitCaseApplication(caseApplication);
}else {
List<Arbitrator> arbitrators = caseApplication.getArbitrators();
// 仲裁员信息
if(arbitrators!=null&&arbitrators.size()>0){
List<Long> ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList());
List<String> arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList());
@@ -835,6 +825,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseApplication.setCaseStatus(CaseApplicationConstants.SIGN_ARBITRATION);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.SIGN_ARBITRATION,"");
rows = caseApplicationMapper.submitCaseApplication(caseApplication);
}else if(agreeOrNotCheck.intValue()==2){//拒绝审核
caseApplication.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
@@ -928,6 +919,43 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
return "短信发送成功";
}
@Override
public SealSignRecord selectSignUrl(CaseApplication caseApplication) throws EsignDemoException {
SealSignRecord sealSignRecord = new SealSignRecord();
sealSignRecord.setCaseAppliId(caseApplication.getId());
Gson gson = new Gson();
List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecord);
SealSignRecord sealSignRecordReslt = new SealSignRecord();
if(sealSignRecords!=null&&sealSignRecords.size()>0){
SealSignRecord sealSignRecordselect = sealSignRecords.get(0);
EsignHttpResponse signUrl = SignAward.signUrl(sealSignRecordselect);
JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String url = signUrlData.get("url").getAsString();
sealSignRecordReslt.setSignUrl(url);
}
return sealSignRecordReslt;
}
@Override
public SealSignRecord selectSealUrl(CaseApplication caseApplication) throws EsignDemoException {
SealSignRecord sealSignRecord = new SealSignRecord();
sealSignRecord.setCaseAppliId(caseApplication.getId());
Gson gson = new Gson();
List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecord);
SealSignRecord sealSignRecordReslt = new SealSignRecord();
if(sealSignRecords!=null&&sealSignRecords.size()>0){
SealSignRecord sealSignRecordselect = sealSignRecords.get(0);
EsignHttpResponse signUrl = SignAward.usesealUrl(sealSignRecordselect);
JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String url = signUrlData.get("url").getAsString();
sealSignRecordReslt.setSealUrl(url);
}
return sealSignRecordReslt;
}
@Override
@Transactional
public int pendTralSure(CaseApplication caseApplication) {
@@ -945,32 +973,27 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
String hearDatestr = dateFormat.format(hearDate);
String arbitratorId = caseApplicationselect.getArbitratorId();
// List<Arbitrator> arbitratorList = new ArrayList<>();
List<Arbitrator> arbitratorList = new ArrayList<>();
if(StringUtils.isNotEmpty(arbitratorId)){
String[] idStrList = arbitratorId.split(",");
List<Long> idList = new ArrayList<>();
for(int i = 0;i < idStrList.length;i ++ ){
idList.add(Long.parseLong(idStrList[i]));
}
//
// 查询仲裁员电话号
List<SysUser> userList= sysUserMapper.selectUserListByIds(idList);
if(CollectionUtil.isNotEmpty(userList)) {
for (SysUser user : userList) {
//给仲裁员发送短信通知
request.setPhone(user.getPhonenumber());
// 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
String name = user.getNickName();
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
SmsUtils.sendSms(request);
}
}
Arbitrator arbitrator = new Arbitrator();
arbitrator.setIdList(idList);
arbitratorList = arbitratorMapper.selectArbitratorList(arbitrator);
if(arbitratorList!=null) {
for (int i = 0; i < arbitratorList.size(); i++) {
Arbitrator arbitratorselect = arbitratorList.get(i);
//给仲裁员发送短信通知
request.setPhone(arbitratorselect.getTelephone());
// 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
String name = arbitratorselect.getArbitratorName();
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
SmsUtils.sendSms(request);
}
}
}
CaseAffiliate caseAffiliate = new CaseAffiliate();
@@ -992,7 +1015,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){
caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName()));
}
caseAffiliateselect.setName(caseAffiliateselect.getName());;
}
//给申请人、被申请人发送短信通知
request.setPhone(caseAffiliateselect.getContactTelphone());
@@ -1130,62 +1153,75 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseApplicationNew.setFeePayable(caseApplicationinsertDiffer.getFeePayable());
}
@Transactional
public void fixExecuteSelectFlowDetailUtils() throws EsignDemoException {
Gson gson = new Gson();
// @Transactional
// public void fixExecuteSelectFlowDetailUtils() throws EsignDemoException {
//
// Gson gson = new Gson();
//
// SealSignRecord sealSignRecordselect = new SealSignRecord();
// sealSignRecordselect.setSignFlowStatus(1);
//
// List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecordselect);
// if(sealSignRecords!=null&&sealSignRecords.size()>0){
// for (int i = 0; i < sealSignRecords.size(); i++) {
// SealSignRecord sealSignRecord = sealSignRecords.get(i);
// EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
// JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
// JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
// JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
// for (int j = 0; j < signersArray.size(); j++) {
// JsonObject signerObject = (JsonObject)signersArray.get(j);
// Integer psnsignStatus ;
// Integer orgsignStatus ;
// if(!(signerObject.get("psnSigner").toString()).equals("null")){
// JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
// if(psnSignerData!=null){
// psnsignStatus = signerObject.get("signStatus").getAsInt();
// sealSignRecord.setPsnsignStatus(psnsignStatus);
//
// if(psnsignStatus.intValue()==2){
// //更新立案申请状态为待用印
// CaseApplication caseApplication = new CaseApplication();
// caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
// caseApplicationMapper.submitCaseApplication(caseApplication);
//
// //修改"签署用印记录表"的状态为待用印
// sealSignRecord.setSignFlowStatus(2);
// sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
//
// }
// }
// }
// if(!(signerObject.get("orgSigner").toString()).equals("null")){
// JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
// if(orgSignerData!=null){
// orgsignStatus = signerObject.get("signStatus").getAsInt();
// sealSignRecord.setOrgsignStatus(orgsignStatus);
// //更新立案申请状态为待送达
// CaseApplication caseApplication = new CaseApplication();
// caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
// caseApplicationMapper.submitCaseApplication(caseApplication);
//
// //修改"签署用印记录表"的状态为签署完成
// sealSignRecord.setSignFlowStatus(3);
// sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
//
// //下载审核完成的裁决书,
//// SaaSAPIFileUtils.fileDownloadUrl();
//
// }
//
// }
//
// }
//
// }
//
// }
SealSignRecord sealSignRecord = new SealSignRecord();
sealSignRecord.setSignFlowid("41e6732b48c54c63a91b2379c352212d");
EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
for (int i = 0; i < signersArray.size(); i++) {
JsonObject signerObject = (JsonObject)signersArray.get(i);
Integer psnsignStatus ;
Integer orgsignStatus ;
if(!(signerObject.get("psnSigner").toString()).equals("null")){
JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
if(psnSignerData!=null){
psnsignStatus = signerObject.get("signStatus").getAsInt();
sealSignRecord.setPsnsignStatus(psnsignStatus);
if(psnsignStatus.intValue()==2){
//更新立案申请状态为待用印
CaseApplication caseApplication = new CaseApplication();
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
caseApplicationMapper.submitCaseApplication(caseApplication);
//修改"签署用印记录表"的状态为待用印
}
}
}
if(!(signerObject.get("orgSigner").toString()).equals("null")){
JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
if(orgSignerData!=null){
orgsignStatus = signerObject.get("signStatus").getAsInt();
sealSignRecord.setOrgsignStatus(orgsignStatus);
//更新立案申请状态为待送达
CaseApplication caseApplication = new CaseApplication();
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
caseApplicationMapper.submitCaseApplication(caseApplication);
//修改"签署用印记录表"的状态为签署完成
//下载审核完成的裁决书,
// SaaSAPIFileUtils.fileDownloadUrl();
}
}
}
}
// }