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

This commit was merged in pull request #277.
This commit is contained in:
2023-12-05 15:25:00 +08:00
committed by Gitea
6 changed files with 58 additions and 55 deletions
@@ -276,12 +276,22 @@ public class CaseApplicationController extends BaseController {
* 部门长审核裁决书 * 部门长审核裁决书
*/ */
// @PreAuthorize("@ss.hasPermi('caseApplication:checkArbitrateRecord')") // @PreAuthorize("@ss.hasPermi('caseApplication:checkArbitrateRecord')")
@Log(title = "审核裁决书", businessType = BusinessType.UPDATE) @Log(title = "部门长审核裁决书", businessType = BusinessType.UPDATE)
@PostMapping("/checkArbitrateRecord") @PostMapping("/checkArbitrateRecord")
public AjaxResult checkArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) { public AjaxResult checkArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) {
return caseApplicationService.checkArbitrateRecord(caseApplication); return caseApplicationService.checkArbitrateRecord(caseApplication);
} }
/**
* 仲裁员审核裁决书
*/
// @PreAuthorize("@ss.hasPermi('caseApplication:checkArbitrateRecord')")
@Log(title = "仲裁员审核裁决书", businessType = BusinessType.UPDATE)
@PostMapping("/arbitrator/checkArbitrateRecord")
public AjaxResult arbitratorCheckArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) {
return caseApplicationService.arbitratorCheckArbitrateRecord(caseApplication);
}
/** /**
@@ -120,4 +120,11 @@ public interface ICaseApplicationService {
* @return * @return
*/ */
AjaxResult updateCaseIdByAnnexId(CaseAttach caseAttach); AjaxResult updateCaseIdByAnnexId(CaseAttach caseAttach);
/**
* 仲裁员审核裁决书
* @param caseApplication
* @return
*/
AjaxResult arbitratorCheckArbitrateRecord(CaseApplication caseApplication);
} }
@@ -352,7 +352,6 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("year", year); datas.put("year", year);
String month = String.format("%02d", now.getMonthValue()); String month = String.format("%02d", now.getMonthValue());
String day = String.format("%02d", now.getDayOfMonth()); String day = String.format("%02d", now.getDayOfMonth());
// todo 服务器路径
String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx"; String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
// String modalFilePath = "D:/新裁决书模板.docx"; // String modalFilePath = "D:/新裁决书模板.docx";
// todo 服务器路径 // todo 服务器路径
@@ -393,9 +393,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if (file.isEmpty()) { if (file.isEmpty()) {
return AjaxResult.error("请选择要上传的文件"); return AjaxResult.error("请选择要上传的文件");
} }
// todo 服务器上要放开 // todo 服务器路径需要改
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile"; String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
// String targetPath = "D:/zip"; // String targetPath = "D:/";
File zipFile = null; File zipFile = null;
InputStream ins = null; InputStream ins = null;
try { try {
@@ -412,7 +412,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
String zipName = file.getOriginalFilename(); String zipName = file.getOriginalFilename();
String subzipName = zipName.substring(0, zipName.indexOf(".zip")); String subzipName = zipName.substring(0, zipName.indexOf(".zip"));
// String zipPath = "F:\\testZip\\uploadPath\\upload\\upload1\\unzipFile\\"+subzipName; // String zipPath = "F:\\testZip\\uploadPath\\upload\\upload1\\unzipFile\\"+subzipName;
// todo 服务器上要放开
String zipPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + subzipName; String zipPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + subzipName;
// String zipPath = "D:/" + subzipName; // String zipPath = "D:/" + subzipName;
@@ -506,8 +505,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
String year = Integer.toString(now.getYear()); String year = Integer.toString(now.getYear());
String month = String.format("%02d", now.getMonthValue()); String month = String.format("%02d", now.getMonthValue());
String day = String.format("%02d", now.getDayOfMonth()); String day = String.format("%02d", now.getDayOfMonth());
// // todo 服务器路径需要改
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
// String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day; // String saveFolderPath = "D:/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + "_" + substrfile; String fileName = UUID.randomUUID().toString().replace("-", "") + "_" + substrfile;
String resultFilePath = saveFolderPath + "/" + fileName; String resultFilePath = saveFolderPath + "/" + fileName;
try { try {
@@ -1931,30 +1931,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
} }
/** /**
* 仲裁员,部门长审核裁决书 * 部门长审核裁决书
* @param caseApplication * @param caseApplication
* @return * @return
*/ */
@Override @Override
@Transactional @Transactional
public AjaxResult checkArbitrateRecord(CaseApplication caseApplication) { public AjaxResult checkArbitrateRecord(CaseApplication caseApplication) {
// 查询当前登录人角色
LoginUser loginUser = getLoginUser();
// 查询登录人角色
SysUser user = sysUserMapper.selectUserById(loginUser.getUser().getUserId());
List<SysRole> roles = user.getRoles(); if (CollectionUtil.isEmpty(roles)) {
throw new ServiceException("该用户没有角色权限");
}
String roleName="";
for (SysRole role : roles) {
if (StrUtil.isEmpty(role.getRoleName())) {
continue;
}
roleName=role.getRoleName();
}
// 如果是仲裁员,同意后状态改为待部门长审核仲裁文书(CHECK_ARBITRATION = 12),拒绝改为待秘书核验仲裁文书(VERPRIF_ARBITRATION = 11)
// 如果是部门长,同意后状态改为待仲裁文书签名(SIGN_ARBITRATION = 13),拒绝改为待仲裁员审核仲裁文书(HEAD_CHECK_ARBITRATION = 18)
int rows = 0; int rows = 0;
ArbitrateRecord arbitrateRecord = caseApplication.getArbitrateRecord(); ArbitrateRecord arbitrateRecord = caseApplication.getArbitrateRecord();
arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord); arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
@@ -1970,7 +1953,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
String annexPath = caseAttach.getAnnexPath(); String annexPath = caseAttach.getAnnexPath();
String path = "/home/ruoyi" + annexPath; String path = "/home/ruoyi" + annexPath;
// System.out.println("这是查询到的裁决书路径" + path); // System.out.println("这是查询到的裁决书路径" + path);
// String path = "D:\\home\\新裁决书模板.docx"; // String path = "D:\\home\\新裁决书模板.docx";
//获取文件上传地址 //获取文件上传地址
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
String body = response.getBody(); String body = response.getBody();
@@ -2139,30 +2122,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
// 如果是仲裁员,同意后状态改为待部门长审核仲裁文书(CHECK_ARBITRATION = 12) caseApplication.setCaseStatus(CaseApplicationConstants.SIGN_ARBITRATION);
if(roleName.contains("仲裁员")){
caseApplication.setCaseStatus(CaseApplicationConstants.CHECK_ARBITRATION);
}else if(roleName.contains("仲裁委")||roleName.contains("部门长")){
// 如果是部门长,同意后状态改为待仲裁文书签名(SIGN_ARBITRATION = 13),
caseApplication.setCaseStatus(CaseApplicationConstants.SIGN_ARBITRATION);
}
// 新增日志 // 新增日志
insertCaseLog(caseApplication.getId(), caseApplication.getCaseStatus(), ""); insertCaseLog(caseApplication.getId(), CaseApplicationConstants.SIGN_ARBITRATION, "");
rows = caseApplicationMapper.submitCaseApplication(caseApplication); rows = caseApplicationMapper.submitCaseApplication(caseApplication);
} else if (agreeOrNotCheck.intValue() == 2) {//拒绝审核 } else if (agreeOrNotCheck.intValue() == 2) {//拒绝审核
// 如果是仲裁员,拒绝改为待秘书核验仲裁文书(VERPRIF_ARBITRATION = 11) caseApplication.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
if(roleName.contains("仲裁员")){
caseApplication.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
}else if(roleName.contains("仲裁委")||roleName.contains("部门长")){
// 如果是部门长,拒绝改为待仲裁员审核仲裁文书(HEAD_CHECK_ARBITRATION = 18)
caseApplication.setCaseStatus(CaseApplicationConstants.HEAD_CHECK_ARBITRATION);
}
// 新增日志 // 新增日志
insertCaseLog(caseApplication.getId(), caseApplication.getCaseStatus(), ""); insertCaseLog(caseApplication.getId(), CaseApplicationConstants.VERPRIF_ARBITRATION, "");
rows = caseApplicationMapper.submitCaseApplication(caseApplication); rows = caseApplicationMapper.submitCaseApplication(caseApplication);
} }
@@ -2170,6 +2138,18 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
return success(); return success();
} }
/**
* 仲裁员审核裁决书
* @param caseApplication
* @return
*/
@Override
public AjaxResult arbitratorCheckArbitrateRecord(CaseApplication caseApplication) {
// 同意后状态改为待部门长审核仲裁文书(CHECK_ARBITRATION = 12),拒绝改为待秘书核验仲裁文书(VERPRIF_ARBITRATION = 11)
return null;
}
@Override @Override
@Transactional @Transactional
public int submitCaseApplicationCheck(List<Long> ids, Integer agreeOrNotCheck) { public int submitCaseApplicationCheck(List<Long> ids, Integer agreeOrNotCheck) {
@@ -2974,7 +2954,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
return AjaxResult.error("请选择要上传的文件"); return AjaxResult.error("请选择要上传的文件");
} }
UUID uuid = UUID.randomUUID(); UUID uuid = UUID.randomUUID();
// todo 服务器上要放开 // todo 服务器路径需要改
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/"; String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/";
// String targetPath = "D:/zip"; // String targetPath = "D:/zip";
File zipFile = null; File zipFile = null;
@@ -2982,7 +2962,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
try { try {
ins = file.getInputStream(); ins = file.getInputStream();
//上传的压缩包保存的路径 //上传的压缩包保存的路径
// todo 服务器上要放开 // todo 服务器路径需要改
String savePath = "/home/ruoyi/uploadPath/upload/zipFile/"; String savePath = "/home/ruoyi/uploadPath/upload/zipFile/";
// String savePath = "D:/zip/"; // String savePath = "D:/zip/";
String saveName = uuid + "_" + file.getOriginalFilename(); String saveName = uuid + "_" + file.getOriginalFilename();
@@ -3001,18 +2981,18 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
// oc识别pdf并组装数据 // oc识别pdf并组装数据
// 抓取申请书 // 抓取申请书
if(!OCRAndBuildInfo(andConvertPDF, "仲裁申请书", map)){ if(!OCRAndBuildInfo(andConvertPDF, "仲裁申请书", map)){
return AjaxResult.error("文件转base64编码有误,请检查"); return AjaxResult.error("未找到该路径:"+andConvertPDF);
} }
// 抓取调节协议书 // 抓取调节协议书
if(!OCRAndBuildInfo(andConvertPDF, "调解协议", map)){ if(!OCRAndBuildInfo(andConvertPDF, "调解协议", map)){
return AjaxResult.error("文件转base64编码有误,请检查"); return AjaxResult.error("未找到该路径:"+andConvertPDF);
} }
// 抓取合同 // 抓取合同
if(!OCRAndBuildInfo(andConvertPDF, "合同", map)){ if(!OCRAndBuildInfo(andConvertPDF, "贷款合同", map)){
return AjaxResult.error("文件转base64编码有误,请检查"); return AjaxResult.error("未找到该路径:"+andConvertPDF);
} }
if(!OCRAndBuildInfo(andConvertPDF, "授权委托书", map)){ if(!OCRAndBuildInfo(andConvertPDF, "授权委托书", map)){
return AjaxResult.error("文件转base64编码有误,请检查"); return AjaxResult.error("未找到该路径:"+andConvertPDF);
} }
if (map.size()>0){ if (map.size()>0){
@@ -3206,15 +3186,18 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
private boolean OCRAndBuildInfo( Map<String, String> andConvertPDF, String mapKey, Map<String, List<String>> map) { private boolean OCRAndBuildInfo( Map<String, String> andConvertPDF, String mapKey, Map<String, List<String>> map) {
String pdfUrl = andConvertPDF.get(mapKey); String pdfUrl = andConvertPDF.get(mapKey);
if(StrUtil.isEmpty(pdfUrl)){ if(StrUtil.isEmpty(pdfUrl)){
return false; throw new ServiceException("pdfUrl:"+pdfUrl+"===mapKey:"+mapKey);
// return false;
} }
//获取文件的页数 //获取文件的页数
int fileNumPage = getFileNumPage(pdfUrl); int fileNumPage = getFileNumPage(pdfUrl);
//文件转成base64 //文件转成base64
String base64 = OCRUtils.pdfConvertBase64(pdfUrl); String base64 = OCRUtils.pdfConvertBase64(pdfUrl);
if (base64 == null){ if (base64 == null){
return false; throw new ServiceException("文件转成base64 pdfUrl:"+pdfUrl+"===mapKey:"+mapKey);
// return false;
} }
StringBuilder stringBuilder = new StringBuilder(); // 创建一个StringBuilder对象 StringBuilder stringBuilder = new StringBuilder(); // 创建一个StringBuilder对象
for (int i = 0; i < fileNumPage; i++) { for (int i = 0; i < fileNumPage; i++) {
@@ -3304,6 +3287,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
return success(); return success();
} }
public static Map<String,String> findAndConvertPDF(File directory) { public static Map<String,String> findAndConvertPDF(File directory) {
Map<String,String> pdfPathMap= new HashMap<>(); Map<String,String> pdfPathMap= new HashMap<>();
if (directory.isFile()) { if (directory.isFile()) {
@@ -3452,7 +3436,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
private static String convertToPDF(File file) { private static String convertToPDF(File file) {
String wordFilePath = file.getAbsolutePath(); String wordFilePath = file.getAbsolutePath();
//String pdfSaveDirectory = "D:\\home\\unzip\\wordToPDF\\"; //String pdfSaveDirectory = "D:\\home\\unzip\\wordToPDF\\";
// todo 服务器路径需要改
String pdfSaveDirectory = "/home/ruoyi/uploadPath/upload/wordToPDF/"; String pdfSaveDirectory = "/home/ruoyi/uploadPath/upload/wordToPDF/";
// String pdfSaveDirectory = "D:/";
File directory = new File(pdfSaveDirectory); File directory = new File(pdfSaveDirectory);
if (!directory.exists()) { if (!directory.exists()) {
directory.mkdirs(); directory.mkdirs();
@@ -65,7 +65,7 @@ public class OCRUtils {
if(type.contains("申请书")){ if(type.contains("申请书")){
req.setItemNames(applicantName); req.setItemNames(applicantName);
}else if(type.contains("调解协议")){ }else if(type.contains("调解协议")){
// req.setItemNames(accordName); req.setItemNames(accordName);
}else if(type.contains("合同")){ }else if(type.contains("合同")){
req.setItemNames(contractName); req.setItemNames(contractName);
}else if(type.contains("授权委托书")){ }else if(type.contains("授权委托书")){
@@ -20,9 +20,10 @@
</insert> </insert>
<insert id="batchSave" useGeneratedKeys="true" keyProperty="annexId"> <insert id="batchSave" useGeneratedKeys="true" keyProperty="annexId">
INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,is_batch_upload) INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,is_batch_upload)
VALUES
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
VALUES
(#{item.caseAppliId}, #{item.annexName}, #{item.annexPath},#{item.annexType},#{item.note},#{item.userId},#{item.userName},#{item.sealStatus},#{item.isBatchUpload}) (#{item.caseAppliId}, #{item.annexName}, #{item.annexPath},#{item.annexType},#{item.note},#{item.userId},#{item.userName},#{item.sealStatus},#{item.isBatchUpload})
</foreach> </foreach>
</insert> </insert>