优化用印接口 #27

Merged
qtz merged 2 commits from qtz into dev 2024-01-19 09:25:52 +00:00
3 changed files with 5 additions and 109 deletions
@@ -75,13 +75,7 @@ public class MsSignSealController extends BaseController {
return AjaxResult.success(list);
}
/**
* test
*/
@PostMapping("/testSeal")
public AjaxResult testSeal(@Validated @RequestBody MsSignSealDTO dto) throws EsignDemoException {
return msSignSealService.testSeal(dto);
}
@@ -23,5 +23,4 @@ public interface MsSignSealService {
List<MsCaseLogRecordVO> selectCaseLogRecordList(MsSignSealDTO dto);
AjaxResult testSeal(MsSignSealDTO dto);
}
@@ -97,8 +97,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
for (MsCaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == 3) {
String annexPath = caseAttach.getAnnexPath();
// String path = "/home/ruoyi" + annexPath;
String path = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\12\\调解书测试.docx";
String path = "/home/ruoyi" + annexPath;
//获取文件上传地址
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
String body = response.getBody();
@@ -129,9 +128,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
//发起签署
sealSignRecord.setFilename(fileName);
Long arbitratorId = caseApplication.getMediatorId();
if (arbitratorId != null) {
SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
String arbitratorId = caseApplication.getMediatorId();
if (StringUtils.isNotEmpty(arbitratorId)) {
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
if (sysUser == null) {
return AjaxResult.error();
}
@@ -689,103 +688,7 @@ 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();
}
}