优化报错代码

This commit is contained in:
gy b
2023-10-13 19:24:52 +08:00
parent edfd847318
commit 032c7bfca1
@@ -3,6 +3,9 @@ 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;
@@ -10,28 +13,37 @@ 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.file.SaaSAPIFileUtils;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.mapper.SysUserMapper;
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.CaseLogUtils;
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.*;
@@ -53,22 +65,21 @@ 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}$");
@Override
public List<CaseApplication> selectCaseApplicationList(CaseApplication caseApplication) {
return caseApplicationMapper.selectCaseApplicationList(caseApplication);
@@ -142,7 +153,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
/**
* 获取自动编码
*
* @return
*/
@@ -295,9 +305,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){
caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName()));
}
applicantName.append(caseAffiliateselect.getName()).append(",");
applicantName.append(caseAffiliateselect.getName()).append(",");;
}else if(identityType==2){
respondentName.append(caseAffiliateselect.getName()).append(",");
respondentName.append(caseAffiliateselect.getName()).append(",");;
}
}
caseApplicationselect.setApplicantName(applicantName.toString());
@@ -418,7 +428,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
/**
* 导入校验
*
* @param caseApplication
* @param
*/
@@ -439,7 +448,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
/**
* 校验被申请人代理信息
*
* @param caseApplication
* @param failureMsg
*/
@@ -469,7 +477,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
/**
* 校验被申请人信息
*
* @param caseApplication
* @param failureMsg
*/
@@ -510,7 +517,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
/**
* 校验申请人代理信息
*
* @param caseApplication
* @param failureMsg
*/
@@ -540,7 +546,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
/**
* 校验申请人主题信息
*
* @param caseApplication
* @param failureMsg
*/
@@ -579,7 +584,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
/**
* 校验基本字段
*
* @param caseApplication
* @param failureMsg
*/
@@ -724,6 +728,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if (caseAttach.getAnnexType() == 3) {
String annexPath = caseAttach.getAnnexPath();
String path = "/home/ruoyi/" + annexPath;
System.out.println("这是查询到的裁决书路径"+path);
//String path ="D:\\home\\仲裁裁决书模板.docx";
//获取文件上传地址
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
@@ -751,7 +756,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
Gson gson = new Gson();
JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
String keywordPositions = positionsData.get("keywordPositions").getAsString();
String keywordPositions = positionsData.get("keywordPositions").toString();
//发起签署
sealSignRecord.setFilename(fileName);
String arbitratorId = caseApplication2.getArbitratorId();
@@ -764,8 +769,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
sealSignRecord.setPensonName(sysUser.getNickName());
}
sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
sealSignRecord.setOrgnizeNamePsnAccount("秦桃则");
sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
sealSignRecord.setOrgnizeNamePsnAccount("17691338406");
sealSignRecord.setOrgnizeNamepsnName("韩超勃");
//解析文件签名印章位置
@@ -773,7 +776,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
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 中的每个元素
@@ -807,7 +810,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
}
EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord);
JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
if (jsonObject1.getIntValue("code") == 0) {
if (jsonObject3.getIntValue("code")==0){
//获取签署流程ID
JSONObject data1 = jsonObject3.getJSONObject("data");
String signFlowId = data1.getString("signFlowId");
@@ -816,6 +819,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
sealSignRecord.setSignFlowid(signFlowId);
sealSignRecord.setSignFlowStatus(1);//待签名
sealSignRecordMapper.insertSealSignRecord(sealSignRecord);
}else {
throw new ServiceException("发起签署流程失败,请检查参数是否有误");
}
}
}
@@ -832,6 +837,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);
@@ -889,8 +895,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){
caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName()));
}
applicantName.append(caseAffiliateselect.getName()).append(",");
;
applicantName.append(caseAffiliateselect.getName()).append(",");;
}
}
caseApplicationselect.setApplicantName(applicantName.toString());
@@ -902,7 +907,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
/**
* 给被申请人发送房间号短信
*
* @param messageVO
* @return
*/
@@ -918,7 +922,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
//发送短信通知
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1948332");
request.setTemplateId("1952136");
// 1948332 普通短信 开庭审理房间号通知 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请知晓,如非本人操作,请忽略本短信。
request.setPhone(caseAffiliate.getContactTelphone());
request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo()});
@@ -988,14 +992,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
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},请知晓,如非本人操作,请忽略本短信。
@@ -1006,7 +1006,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
}
}
}
CaseAffiliate caseAffiliate = new CaseAffiliate();
@@ -1046,6 +1045,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
}
@Override
@Transactional
public int pendingAppointArbotrar(CaseApplication caseApplication) {
@@ -1077,6 +1077,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
}
private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew, Map<String, Long> deptMap) {
// 申请人信息
CaseAffiliate caseAffiliate = new CaseAffiliate();
@@ -1097,7 +1098,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
/**
* 设置申请人的组织机构
*
* @param caseAffiliate
* @param caseApplication
*/
@@ -1105,6 +1105,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
private void setApplicantOrganization(CaseAffiliate caseAffiliate, CaseApplication caseApplication, Map<String, Long> deptMap ) {
// 将组织机构id设为申请人名称
if(deptMap.containsKey(caseApplication.getName())){
caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName())));
@@ -1129,7 +1130,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
/**
* 组装被申请人信息
*
* @param caseApplication
* @return
*/
@@ -1165,61 +1165,79 @@ 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();
}
}
}
}
}