Merge branch 'qtz5' of SH-Arbitrate/Arbitrate-Backend into dev

This commit was merged in pull request #333.
This commit is contained in:
qtz
2024-01-10 11:39:27 +08:00
committed by Gitea
3 changed files with 63 additions and 7 deletions
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.wisdomarbitrate.StringIdsReq;
import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
@@ -18,6 +19,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
@RestController
@@ -200,7 +202,7 @@ public class AdjudicationController extends BaseController {
* @return
*/
@PostMapping("/serviceBatch")
public AjaxResult serviceBatch(@Validated @RequestBody CaseApplication caseApplication){
public AjaxResult serviceBatch(@Validated @RequestBody CaseApplication caseApplication) throws EsignDemoException, IOException {
if(StrUtil.isEmpty(caseApplication.getBatchNumber().toString())){
return error("参数校验失败");
}
@@ -1,12 +1,14 @@
package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.wisdomarbitrate.StringIdsReq;
import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO;
import java.io.IOException;
import java.util.List;
public interface IAdjudicationService {
@@ -64,5 +66,5 @@ public interface IAdjudicationService {
AjaxResult caseFileBatch(Integer batchNumber);
AjaxResult serviceBatch(Integer batchNumber);
AjaxResult serviceBatch(Integer batchNumber) throws EsignDemoException, IOException;
}
@@ -6,8 +6,10 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.deepoove.poi.data.PictureRenderData;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.constant.FileTransformation;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
@@ -16,6 +18,7 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.common.utils.thread.MultipleThreadListParam;
import com.ruoyi.common.utils.thread.MultipleThreadWorkUtil;
import com.ruoyi.system.mapper.SysDictDataMapper;
@@ -1567,7 +1570,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
@Override
@Transactional
public AjaxResult serviceBatch(Integer batchNumber) {
public AjaxResult serviceBatch(Integer batchNumber) throws EsignDemoException, IOException {
CaseApplication caseApplicationsel = new CaseApplication();
caseApplicationsel.setBatchNumber(batchNumber);
caseApplicationsel.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
@@ -1582,6 +1585,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
return AjaxResult.error("未查询到相关案件");
}
List<CaseAttach> caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication1);
if (caseAttachList != null && caseAttachList.size() > 0) {
for (CaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == 3) {
@@ -1592,12 +1596,60 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
File file = new File(path);
// todo 部署放开
if (!file.exists()) {
return AjaxResult.error("未生成裁决书");
}
Gson gson = new Gson();
SealSignRecord sealSignRecord = new SealSignRecord();
sealSignRecord.setCaseAppliId(id);
List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecord);
if (sealSignRecords != null && sealSignRecords.size() > 0) {
String signFlowid = sealSignRecords.get(0).getSignFlowid();
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();
String filearbitraUrl = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
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/";
// 创建日期目录
File saveFolder = new File(saveFolderPath);
if (!saveFolder.exists()) {
saveFolder.mkdirs();
}
String resultFilePath = saveFolderPath + "/" + fileName;
File resultFilePathFile = new File(resultFilePath);
if (!resultFilePathFile.exists()) {
resultFilePathFile.createNewFile();
}
boolean downLoadFile = FileTransformation.downLoadFileByUrl(filearbitraUrl, resultFilePath);
if (downLoadFile) {
CaseAttach caseAttach1 = new CaseAttach();
caseAttach1.setCaseAppliId(id);
caseAttach1.setAnnexType(3);
caseAttach1.setAnnexPath(savePath);
caseAttach1.setAnnexName(saveName);
caseAttachMapper.updateCaseAttachBycaseid(caseAttach1);
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
}
}
}
}
}
}
}
//修改案件状态
caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING);
caseApplicationMapper.submitCaseApplication(caseApplication1);
@@ -1610,9 +1662,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
if (caseAffiliates != null && caseAffiliates.size() > 0) {
for (CaseAffiliate affiliate : caseAffiliates) {
if (affiliate.getIdentityType() == 1) { //申请人
appEmail = affiliate.getSendEmail();
appEmail = affiliate.getEmail();
} else {
resEmail = affiliate.getSendEmail();
resEmail = affiliate.getEmail();
}
}
}