实现签署回调功能
This commit is contained in:
+20
@@ -2,6 +2,8 @@ package com.ruoyi.web.controller.wisdomarbitrate.mscase;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.exception.EsignDemoException;
|
import com.ruoyi.common.exception.EsignDemoException;
|
||||||
@@ -10,6 +12,8 @@ import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
|
|||||||
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
|
||||||
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
|
||||||
import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService;
|
import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService;
|
||||||
|
import com.ruoyi.wisdomarbitrate.utils.SignVerifyUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -57,6 +61,22 @@ public class MsSignSealController extends BaseController {
|
|||||||
return success(sealUrlRecordselect);
|
return success(sealUrlRecordselect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签名用印回调
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/signSeaalCaseApplicaCallback")
|
||||||
|
public AjaxResult signSeaalCaseApplicaCallback() throws Exception {
|
||||||
|
boolean checkResult= SignVerifyUtils.checkSignuter();
|
||||||
|
if(checkResult){
|
||||||
|
String reqbodystr =SignVerifyUtils.getRequestBody();
|
||||||
|
return msSignSealService.signSeaalCaseApplicaCallback(reqbodystr);
|
||||||
|
}else {
|
||||||
|
return AjaxResult.error("error");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询案件进度
|
* 查询案件进度
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -191,6 +191,9 @@ organizeConfig:
|
|||||||
# 引入仲裁系统url配置
|
# 引入仲裁系统url配置
|
||||||
arbitrateConfig:
|
arbitrateConfig:
|
||||||
url: http://121.40.189.20:9001/callArbitrateCaseApplication/generateCaseApplication
|
url: http://121.40.189.20:9001/callArbitrateCaseApplication/generateCaseApplication
|
||||||
|
# 回调通知
|
||||||
|
signSealCallbackConfig:
|
||||||
|
url: http://121.40.189.20:6001/mssignSeal/signSeaalCaseApplicaCallback
|
||||||
#jodconverter:
|
#jodconverter:
|
||||||
# local:
|
# local:
|
||||||
# host: 121.40.189.20
|
# host: 121.40.189.20
|
||||||
|
|||||||
+3
@@ -7,6 +7,7 @@ import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
|
|||||||
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
|
||||||
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface MsSignSealService {
|
public interface MsSignSealService {
|
||||||
@@ -34,4 +35,6 @@ public interface MsSignSealService {
|
|||||||
AjaxResult msCaseSignUrlApplyAPP(MsSignSealDTO dto) throws EsignDemoException;
|
AjaxResult msCaseSignUrlApplyAPP(MsSignSealDTO dto) throws EsignDemoException;
|
||||||
|
|
||||||
AjaxResult msCaseSignUrlResAPP(MsSignSealDTO dto) throws EsignDemoException;
|
AjaxResult msCaseSignUrlResAPP(MsSignSealDTO dto) throws EsignDemoException;
|
||||||
|
|
||||||
|
AjaxResult signSeaalCaseApplicaCallback(String reqbodystr) throws EsignDemoException, IOException;
|
||||||
}
|
}
|
||||||
|
|||||||
+287
@@ -60,6 +60,7 @@ import tk.mybatis.mapper.entity.Example;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -83,6 +84,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|||||||
MsCaseFlowMapper caseFlowMapper;
|
MsCaseFlowMapper caseFlowMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysUserMapper userMapper;
|
private SysUserMapper userMapper;
|
||||||
|
@Autowired
|
||||||
|
private MsCaseAttachMapper caseAttachMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysUserMapper sysUserMapper;
|
private SysUserMapper sysUserMapper;
|
||||||
@@ -1008,6 +1011,290 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|||||||
return AjaxResult.success(sealSignRecordres);
|
return AjaxResult.success(sealSignRecordres);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult signSeaalCaseApplicaCallback(String reqbodystr) throws EsignDemoException, IOException {
|
||||||
|
|
||||||
|
System.out.println("请求参数reqbodystr:----------->>>>>>"+reqbodystr);
|
||||||
|
|
||||||
|
JSONObject jsonObjectCallback = JSONObject.parseObject(reqbodystr);
|
||||||
|
Gson gson = new Gson();
|
||||||
|
if (jsonObjectCallback != null) {
|
||||||
|
int signResult = jsonObjectCallback.getIntValue("signResult");
|
||||||
|
String action = jsonObjectCallback.getString("action");
|
||||||
|
String signFlowId = jsonObjectCallback.getString("signFlowId");
|
||||||
|
Long operateTime = jsonObjectCallback.getLongValue("operateTime");
|
||||||
|
JSONObject operator = jsonObjectCallback.getJSONObject("operator");
|
||||||
|
JSONObject psnAccount = operator.getJSONObject("psnAccount");
|
||||||
|
String accountMobile = psnAccount.getString("accountMobile");
|
||||||
|
|
||||||
|
System.out.println("请求参数signResult:----------->>>>>>"+signResult);
|
||||||
|
System.out.println("请求参数action:---------->>>>>>"+action);
|
||||||
|
System.out.println("请求参数signFlowId:---------->>>>>>"+signFlowId);
|
||||||
|
System.out.println("请求参数accountMobile:---------->>>>>>"+accountMobile);
|
||||||
|
|
||||||
|
Example msSealSignRecordExample = new Example(MsSealSignRecord.class);
|
||||||
|
msSealSignRecordExample.createCriteria().andEqualTo("signFlowId", signFlowId);
|
||||||
|
MsSealSignRecord sealSignRecordsel = sealSignRecordMapper.selectOneByExample(msSealSignRecordExample);
|
||||||
|
|
||||||
|
String pensonAccountApply = sealSignRecordsel.getPensonAccount();
|
||||||
|
String orgnNamePsnAcc = sealSignRecordsel.getOrgnNamePsnAcc();
|
||||||
|
String pensonAccountRes = sealSignRecordsel.getPensonAccountRes();
|
||||||
|
String pensonAccountMedi = sealSignRecordsel.getPensonAccountMedi();
|
||||||
|
|
||||||
|
Integer signStatusApply = sealSignRecordsel.getSignStatusApply();
|
||||||
|
Integer signStatusResponse = sealSignRecordsel.getSignStatusResponse();
|
||||||
|
Integer signStatusMediator = sealSignRecordsel.getSignStatusMediator();
|
||||||
|
Integer sealStatus = sealSignRecordsel.getSealStatus();
|
||||||
|
|
||||||
|
Long caseAppliId = sealSignRecordsel.getCaseAppliId();
|
||||||
|
MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseAppliId);
|
||||||
|
Integer mediaResult = caseApplicationselect.getMediaResult();
|
||||||
|
|
||||||
|
if("SIGN_MISSON_COMPLETE".equals(action) && signResult==2){
|
||||||
|
if(mediaResult.intValue()==1){
|
||||||
|
//调解
|
||||||
|
if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){
|
||||||
|
//申请人签名
|
||||||
|
sealSignRecordsel.setSignStatusApply(1);
|
||||||
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
||||||
|
if(signStatusResponse!=null&&signStatusResponse.intValue()==1&&
|
||||||
|
signStatusMediator!=null&&signStatusMediator.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);
|
||||||
|
|
||||||
|
//修改"签署用印记录表"的状态为待用印
|
||||||
|
sealSignRecordsel.setSignFlowStatus(2);
|
||||||
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
||||||
|
}
|
||||||
|
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){
|
||||||
|
//被申请人签名
|
||||||
|
sealSignRecordsel.setSignStatusResponse(1);
|
||||||
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
||||||
|
if(signStatusApply!=null&&signStatusApply.intValue()==1&&
|
||||||
|
signStatusMediator!=null&&signStatusMediator.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);
|
||||||
|
|
||||||
|
//修改"签署用印记录表"的状态为待用印
|
||||||
|
sealSignRecordsel.setSignFlowStatus(2);
|
||||||
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
||||||
|
}
|
||||||
|
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountMedi)){
|
||||||
|
//调解员签名
|
||||||
|
sealSignRecordsel.setSignStatusMediator(1);
|
||||||
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
||||||
|
if(signStatusApply!=null&&signStatusApply.intValue()==1&&
|
||||||
|
signStatusResponse!=null&&signStatusResponse.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);
|
||||||
|
|
||||||
|
//修改"签署用印记录表"的状态为待用印
|
||||||
|
sealSignRecordsel.setSignFlowStatus(2);
|
||||||
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
||||||
|
}
|
||||||
|
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc)){
|
||||||
|
sealSignRecordsel.setSealStatus(1);
|
||||||
|
sealSignRecordsel.setSignFlowStatus(3);
|
||||||
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
||||||
|
|
||||||
|
// 根据流程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);
|
||||||
|
|
||||||
|
//下载审核完成的调解书
|
||||||
|
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
|
||||||
|
JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
|
||||||
|
JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
|
||||||
|
JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
|
||||||
|
if (filesArray != null && filesArray.size() > 0) {
|
||||||
|
JsonObject fileObject = (JsonObject) filesArray.get(0);
|
||||||
|
String fileDownloadUrl = fileObject.get("downloadUrl").toString();
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
String year = Integer.toString(now.getYear());
|
||||||
|
String month = String.format("%02d", now.getMonthValue());
|
||||||
|
String day = String.format("%02d", now.getDayOfMonth());
|
||||||
|
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||||
|
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
|
||||||
|
// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||||
|
// String savePath = "/home/ruoyi/uploadPath/upload/";
|
||||||
|
String saveName = fileName;
|
||||||
|
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||||
|
|
||||||
|
// 创建日期目录
|
||||||
|
File saveFolder = new File(saveFolderPath);
|
||||||
|
if (!saveFolder.exists()) {
|
||||||
|
saveFolder.mkdirs();
|
||||||
|
}
|
||||||
|
String resultFilePath = saveFolderPath + "/" + fileName;
|
||||||
|
File resultFilePathFile = new File(resultFilePath);
|
||||||
|
if (!resultFilePathFile.exists()) {
|
||||||
|
resultFilePathFile.createNewFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
|
||||||
|
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
|
||||||
|
if (downLoadFile) {
|
||||||
|
MsCaseAttach caseAttach = new MsCaseAttach();
|
||||||
|
caseAttach.setCaseAppliId(caseAppliId);
|
||||||
|
caseAttach.setAnnexType(7);
|
||||||
|
caseAttach.setAnnexPath(savePath);
|
||||||
|
caseAttach.setAnnexName(saveName);
|
||||||
|
caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if(mediaResult.intValue()==5){
|
||||||
|
//和解
|
||||||
|
if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){
|
||||||
|
//申请人签名
|
||||||
|
sealSignRecordsel.setSignStatusApply(1);
|
||||||
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
||||||
|
if(signStatusResponse!=null&&signStatusResponse.intValue()==1){
|
||||||
|
MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue());
|
||||||
|
MsCaseApplication application = new MsCaseApplication();
|
||||||
|
application.setId(caseApplicationselect.getId());
|
||||||
|
application.setCaseFlowId(nextFlow.getId());
|
||||||
|
application.setCaseStatusName(nextFlow.getCaseStatusName());
|
||||||
|
caseApplicationMapper.updateByPrimaryKeySelective(application);
|
||||||
|
|
||||||
|
//修改"签署用印记录表"的状态为完成
|
||||||
|
sealSignRecordsel.setSignFlowStatus(3);
|
||||||
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
||||||
|
|
||||||
|
//下载审核完成的调解书
|
||||||
|
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
|
||||||
|
JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
|
||||||
|
JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
|
||||||
|
JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
|
||||||
|
if (filesArray != null && filesArray.size() > 0) {
|
||||||
|
JsonObject fileObject = (JsonObject) filesArray.get(0);
|
||||||
|
String fileDownloadUrl = fileObject.get("downloadUrl").toString();
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
String year = Integer.toString(now.getYear());
|
||||||
|
String month = String.format("%02d", now.getMonthValue());
|
||||||
|
String day = String.format("%02d", now.getDayOfMonth());
|
||||||
|
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||||
|
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
|
||||||
|
// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||||
|
// String savePath = "/home/ruoyi/uploadPath/upload/";
|
||||||
|
String saveName = fileName;
|
||||||
|
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||||
|
|
||||||
|
// 创建日期目录
|
||||||
|
File saveFolder = new File(saveFolderPath);
|
||||||
|
if (!saveFolder.exists()) {
|
||||||
|
saveFolder.mkdirs();
|
||||||
|
}
|
||||||
|
String resultFilePath = saveFolderPath + "/" + fileName;
|
||||||
|
File resultFilePathFile = new File(resultFilePath);
|
||||||
|
if (!resultFilePathFile.exists()) {
|
||||||
|
resultFilePathFile.createNewFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
|
||||||
|
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
|
||||||
|
if (downLoadFile) {
|
||||||
|
MsCaseAttach caseAttach = new MsCaseAttach();
|
||||||
|
caseAttach.setCaseAppliId(caseAppliId);
|
||||||
|
caseAttach.setAnnexType(7);
|
||||||
|
caseAttach.setAnnexPath(savePath);
|
||||||
|
caseAttach.setAnnexName(saveName);
|
||||||
|
caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){
|
||||||
|
//被申请人签名
|
||||||
|
sealSignRecordsel.setSignStatusResponse(1);
|
||||||
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
||||||
|
if(signStatusApply!=null&&signStatusApply.intValue()==1){
|
||||||
|
MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue());
|
||||||
|
MsCaseApplication application = new MsCaseApplication();
|
||||||
|
application.setId(caseApplicationselect.getId());
|
||||||
|
application.setCaseFlowId(nextFlow.getId());
|
||||||
|
application.setCaseStatusName(nextFlow.getCaseStatusName());
|
||||||
|
caseApplicationMapper.updateByPrimaryKeySelective(application);
|
||||||
|
|
||||||
|
//修改"签署用印记录表"的状态为完成
|
||||||
|
sealSignRecordsel.setSignFlowStatus(3);
|
||||||
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
||||||
|
|
||||||
|
//下载审核完成的调解书
|
||||||
|
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
|
||||||
|
JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
|
||||||
|
JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
|
||||||
|
JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
|
||||||
|
if (filesArray != null && filesArray.size() > 0) {
|
||||||
|
JsonObject fileObject = (JsonObject) filesArray.get(0);
|
||||||
|
String fileDownloadUrl = fileObject.get("downloadUrl").toString();
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
String year = Integer.toString(now.getYear());
|
||||||
|
String month = String.format("%02d", now.getMonthValue());
|
||||||
|
String day = String.format("%02d", now.getDayOfMonth());
|
||||||
|
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||||
|
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
|
||||||
|
// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||||
|
// String savePath = "/home/ruoyi/uploadPath/upload/";
|
||||||
|
String saveName = fileName;
|
||||||
|
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||||
|
|
||||||
|
// 创建日期目录
|
||||||
|
File saveFolder = new File(saveFolderPath);
|
||||||
|
if (!saveFolder.exists()) {
|
||||||
|
saveFolder.mkdirs();
|
||||||
|
}
|
||||||
|
String resultFilePath = saveFolderPath + "/" + fileName;
|
||||||
|
File resultFilePathFile = new File(resultFilePath);
|
||||||
|
if (!resultFilePathFile.exists()) {
|
||||||
|
resultFilePathFile.createNewFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
|
||||||
|
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
|
||||||
|
if (downLoadFile) {
|
||||||
|
MsCaseAttach caseAttach = new MsCaseAttach();
|
||||||
|
caseAttach.setCaseAppliId(caseAppliId);
|
||||||
|
caseAttach.setAnnexType(7);
|
||||||
|
caseAttach.setAnnexPath(savePath);
|
||||||
|
caseAttach.setAnnexName(saveName);
|
||||||
|
caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return AjaxResult.error("error");
|
||||||
|
}
|
||||||
|
return AjaxResult.success("success");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过邮件发送裁决书文件
|
* 通过邮件发送裁决书文件
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.ruoyi.wisdomarbitrate.utils;
|
||||||
|
|
||||||
|
import javax.crypto.Mac;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
public class DigesdateUtils {
|
||||||
|
|
||||||
|
public static String getSignStr(String paramsStr, String accessSec ) {
|
||||||
|
Mac macDiges = null;
|
||||||
|
try {
|
||||||
|
macDiges = Mac.getInstance("HmacSHA256");
|
||||||
|
SecretKeySpec accessSecKey = new SecretKeySpec(accessSec.getBytes("UTF-8"), "HmacSHA256");
|
||||||
|
macDiges.init(accessSecKey);
|
||||||
|
macDiges.update(paramsStr.getBytes("UTF-8"));
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
} catch (InvalidKeyException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return byteTrasferhex(macDiges.doFinal());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String byteTrasferhex(byte[] byteArrayData) {
|
||||||
|
StringBuilder hashBuilder = new StringBuilder();
|
||||||
|
String stmpHex;
|
||||||
|
for (int n = 0; byteArrayData != null && n < byteArrayData.length; n++) {
|
||||||
|
stmpHex = Integer.toHexString(byteArrayData[n] & 0XFF);
|
||||||
|
if (stmpHex.length() == 1){
|
||||||
|
hashBuilder.append('0');
|
||||||
|
}else {
|
||||||
|
hashBuilder.append(stmpHex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hashBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+1
-1
@@ -243,7 +243,7 @@ public class FixSelectFlowDetailUtils {
|
|||||||
/*
|
/*
|
||||||
定时查询签署流程详情
|
定时查询签署流程详情
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0/10 * * * * ?")
|
// @Scheduled(cron = "0/10 * * * * ?")
|
||||||
@Transactional
|
@Transactional
|
||||||
public void fixExecuteSelectFlowDetailUtils() {
|
public void fixExecuteSelectFlowDetailUtils() {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.ruoyi.common.utils.SealUtil;
|
|||||||
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
|
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
|
||||||
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
|
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
|
||||||
import com.ruoyi.wisdomarbitrate.domain.vo.base.StringIdsReq;
|
import com.ruoyi.wisdomarbitrate.domain.vo.base.StringIdsReq;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -22,6 +23,9 @@ public class SignAward {
|
|||||||
private static String eSignAppId = EsignApplicaConfig.EsignAppId;
|
private static String eSignAppId = EsignApplicaConfig.EsignAppId;
|
||||||
private static String eSignAppSecret = EsignApplicaConfig.EsignAppSecret;
|
private static String eSignAppSecret = EsignApplicaConfig.EsignAppSecret;
|
||||||
|
|
||||||
|
@Value("${signSealCallbackConfig.url}")
|
||||||
|
private static String signSealCallbackUrl;
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws EsignDemoException {
|
public static void main(String[] args) throws EsignDemoException {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
@@ -351,7 +355,7 @@ public class SignAward {
|
|||||||
" \"signConfig\": {\n" +
|
" \"signConfig\": {\n" +
|
||||||
" \"availableSignClientTypes\": \"1\"\n" +
|
" \"availableSignClientTypes\": \"1\"\n" +
|
||||||
" },\n" +
|
" },\n" +
|
||||||
|
" \"notifyUrl\": \"" + signSealCallbackUrl + "\",\n" +
|
||||||
" \"autoFinish\": true\n" +
|
" \"autoFinish\": true\n" +
|
||||||
" },\n" +
|
" },\n" +
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.ruoyi.wisdomarbitrate.utils;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.EsignApplicaConfig;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SignVerifyUtils {
|
||||||
|
private static String eSignAppSecret = EsignApplicaConfig.EsignAppSecret;
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean checkSignuter() throws Exception {
|
||||||
|
HttpServletRequest httprequest = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
||||||
|
String orialsignature = httprequest.getHeader("X-Tsign-Open-SIGNATURE");
|
||||||
|
String timestampreq = httprequest.getHeader("X-Tsign-Open-TIMESTAMP");
|
||||||
|
String reqQuerystr =getHttpreqQuery();
|
||||||
|
//获取请求参数
|
||||||
|
String reqbodystr =getRequestBody();
|
||||||
|
String signOriaData = timestampreq + reqQuerystr + reqbodystr;
|
||||||
|
String newDisgSignuter= DigesdateUtils.getSignStr(signOriaData, eSignAppSecret);
|
||||||
|
|
||||||
|
System.out.println("请求参数timestampreq:----------->>>>>>"+timestampreq);
|
||||||
|
System.out.println("请求参数reqQuerystr:---------->>>>>>"+reqQuerystr);
|
||||||
|
System.out.println("请求参数reqbodystr:---------->>>>>>"+reqbodystr);
|
||||||
|
System.out.println("加密出来的签名值:----------->>>>>>"+newDisgSignuter);
|
||||||
|
System.out.println("header里面的签名值:---------->>>>>>"+orialsignature);
|
||||||
|
|
||||||
|
if (StringUtils.equals(orialsignature, newDisgSignuter)) {
|
||||||
|
return true;
|
||||||
|
}else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getHttpreqQuery() {
|
||||||
|
HttpServletRequest httprequest = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
||||||
|
List<String> reqNames= new ArrayList();
|
||||||
|
Enumeration<String> httpreqEle =httprequest.getParameterNames();
|
||||||
|
while (httpreqEle.hasMoreElements()){
|
||||||
|
reqNames.add(httpreqEle.nextElement());
|
||||||
|
}
|
||||||
|
Collections.sort(reqNames);
|
||||||
|
String httpreqQuery = "";
|
||||||
|
for (String reqName : reqNames) {
|
||||||
|
String reqvalue = httprequest.getParameter(reqName);
|
||||||
|
httpreqQuery += reqvalue == null ? "" : reqvalue;
|
||||||
|
}
|
||||||
|
System.out.println("获取请求字符串是:---"+httpreqQuery);
|
||||||
|
return httpreqQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getRequestBody() {
|
||||||
|
HttpServletRequest httprequest = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
||||||
|
String requestBody = "";
|
||||||
|
int reqContentLen = httprequest.getContentLength();
|
||||||
|
if (reqContentLen < 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
byte bufByteArray[] = new byte[reqContentLen];
|
||||||
|
try {
|
||||||
|
for (int i = 0; i < reqContentLen;) {
|
||||||
|
int lengthReadInputStream = httprequest.getInputStream().read(bufByteArray, i, reqContentLen - i);
|
||||||
|
if (lengthReadInputStream == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i += lengthReadInputStream;
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
requestBody = new String(bufByteArray, "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return requestBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user