From ce01c9366a5ce0b86d155d841c36285e47f4c65f Mon Sep 17 00:00:00 2001 From: gy b Date: Fri, 13 Oct 2023 15:20:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8F=96=E6=B6=88=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=9D=83=E9=99=90=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdjudicationController.java | 9 +- .../CaseApplicationController.java | 28 +-- .../CaseArbitrateController.java | 1 - .../CasePaymentController.java | 4 +- .../src/main/resources/application.yml | 10 +- .../service/impl/AdjudicationServiceImpl.java | 47 +++- .../impl/CaseApplicationServiceImpl.java | 229 +++++++++--------- 7 files changed, 186 insertions(+), 142 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java index 1057b3f..04a7419 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java @@ -25,7 +25,6 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/document") - @PreAuthorize("@ss.hasPermi('caseManagement:list:createaward')") public AjaxResult createDocument(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.createDocument(caseApplication); } @@ -58,7 +57,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/signature") - @PreAuthorize("@ss.hasPermi('awardManagement:list:sign')") +// @PreAuthorize("@ss.hasPermi('awardManagement:list:sign')") public AjaxResult signature(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.signature(caseApplication); } @@ -69,7 +68,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/caseFile") - @PreAuthorize("@ss.hasPermi('awardManagement:list:file')") +// @PreAuthorize("@ss.hasPermi('awardManagement:list:file')") public AjaxResult caseFile(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.caseFile(caseApplication); } @@ -80,7 +79,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/service") - @PreAuthorize("@ss.hasPermi('awardManagement:list:sendaward')") +// @PreAuthorize("@ss.hasPermi('awardManagement:list:sendaward')") public AjaxResult service(@RequestBody BookSendVO bookSendVO){ return adjudicationService.service(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum()); } @@ -90,7 +89,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/stamp") - @PreAuthorize("@ss.hasPermi('awardManagement:list:signprint')") +// @PreAuthorize("@ss.hasPermi('awardManagement:list:signprint')") public AjaxResult stamp(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.stamp(caseApplication); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 2f90649..5363a95 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -41,7 +41,7 @@ public class CaseApplicationController extends BaseController { /** * 新增立案数据 */ - @PreAuthorize("@ss.hasPermi('caseManagement:list:add')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:add')") @Log(title = "新增立案数据", businessType = BusinessType.INSERT) @PostMapping("/addCaseApplication") public AjaxResult addCaseApplication(@Validated @RequestBody CaseApplication caseApplication) @@ -54,7 +54,7 @@ public class CaseApplicationController extends BaseController { /** * 修改立案数据 */ - @PreAuthorize("@ss.hasPermi('caseManagement:list:update')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:update')") @Log(title = "修改立案数据", businessType = BusinessType.UPDATE) @PostMapping("/editCaseApplication") public AjaxResult editCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { @@ -66,7 +66,7 @@ public class CaseApplicationController extends BaseController { /** * 提交立案申请 */ - @PreAuthorize("@ss.hasPermi('caseManagement:list:submit')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:submit')") @Log(title = "提交立案申请", businessType = BusinessType.UPDATE) @PostMapping("/submitCaseApplication") public AjaxResult submitCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { @@ -77,7 +77,7 @@ public class CaseApplicationController extends BaseController { /** * 删除立案数据 */ - @PreAuthorize("@ss.hasPermi('caseManagement:list:delete')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:delete')") @Log(title = "删除立案数据", businessType = BusinessType.DELETE) @PostMapping("/removeCaseApplication") public AjaxResult removeCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { @@ -88,7 +88,7 @@ public class CaseApplicationController extends BaseController { /** * 查询立案信息 */ - @PreAuthorize("@ss.hasPermi('caseManagement:list:detail')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:detail')") @PostMapping("/selectCaseApplication") public AjaxResult selectCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { CaseApplication caseApplicationselect = caseApplicationService.selectCaseApplication(caseApplication); @@ -105,7 +105,7 @@ public class CaseApplicationController extends BaseController { } @Log(title = "立案信息导入", businessType = BusinessType.IMPORT) - @PreAuthorize("@ss.hasPermi('caseManagement:list:import')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:import')") @PostMapping("/importData") public AjaxResult importData(MultipartFile file) throws Exception { if(file==null){ @@ -121,7 +121,7 @@ public class CaseApplicationController extends BaseController { /** * 组庭 */ - @PreAuthorize("@ss.hasPermi('caseApplication:pendTral')") +// @PreAuthorize("@ss.hasPermi('caseApplication:pendTral')") @Log(title = "组庭", businessType = BusinessType.UPDATE) @PostMapping("/pendTral") public AjaxResult pendTral(@Validated @RequestBody CaseApplication caseApplication) { @@ -131,7 +131,7 @@ public class CaseApplicationController extends BaseController { /** * 组庭审核 */ - @PreAuthorize("@ss.hasPermi('caseManagement:list:checkgroup')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:checkgroup')") @Log(title = "组庭审核", businessType = BusinessType.UPDATE) @PostMapping("/pendTralCheck") public AjaxResult pendTralCheck(@Validated @RequestBody CaseApplication caseApplication) { @@ -141,7 +141,7 @@ public class CaseApplicationController extends BaseController { /** * 组庭确认 */ - @PreAuthorize("@ss.hasPermi('caseManagement:list:confirmgroup')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:confirmgroup')") @Log(title = "组庭确认", businessType = BusinessType.UPDATE) @PostMapping("/pendTralSure") public AjaxResult pendTralSure(@Validated @RequestBody CaseApplication caseApplication) { @@ -151,7 +151,7 @@ public class CaseApplicationController extends BaseController { /** * 核验裁决书 */ - @PreAuthorize("@ss.hasPermi('caseApplication:verificationArbitrateRecord')") +// @PreAuthorize("@ss.hasPermi('caseApplication:verificationArbitrateRecord')") @Log(title = "核验裁决书", businessType = BusinessType.UPDATE) @PostMapping("/verificationArbitrateRecord") public AjaxResult verificationArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) { @@ -161,7 +161,7 @@ public class CaseApplicationController extends BaseController { /** * 审核裁决书 */ - @PreAuthorize("@ss.hasPermi('caseApplication:checkArbitrateRecord')") +// @PreAuthorize("@ss.hasPermi('caseApplication:checkArbitrateRecord')") @Log(title = "审核裁决书", businessType = BusinessType.UPDATE) @PostMapping("/checkArbitrateRecord") public AjaxResult checkArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) { @@ -172,7 +172,7 @@ public class CaseApplicationController extends BaseController { /** * 是否指派仲裁员 */ - @PreAuthorize("@ss.hasPermi('caseApplication:pendingAppointArbotrar')") +// @PreAuthorize("@ss.hasPermi('caseApplication:pendingAppointArbotrar')") @Log(title = "是否指派仲裁员", businessType = BusinessType.UPDATE) @PostMapping("/pendingAppointArbotrar") public AjaxResult pendingAppointArbotrar(@Validated @RequestBody CaseApplication caseApplication) { @@ -182,7 +182,7 @@ public class CaseApplicationController extends BaseController { /** * 提交立案审查 */ - @PreAuthorize("@ss.hasPermi('caseManagement:list:check')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:check')") @Log(title = "提交立案审查", businessType = BusinessType.UPDATE) @PostMapping("/submitCaseApplicationCheck") public AjaxResult submitCaseApplicationCheck(@Validated @RequestBody CaseApplication caseApplication) { @@ -193,7 +193,7 @@ public class CaseApplicationController extends BaseController { /** * 确认缴费查询立案信息 */ - @PreAuthorize("@ss.hasPermi('paymentManagement:list:detail')") +// @PreAuthorize("@ss.hasPermi('paymentManagement:list:detail')") @PostMapping("/selectCaseApplicationConfirm") public AjaxResult selectCaseApplicationConfirm(@Validated @RequestBody CaseApplication caseApplication) { CaseApplication caseApplicationselect = caseApplicationService.selectCaseApplicationConfirm(caseApplication); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java index 20c5b17..dda5a73 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java @@ -35,7 +35,6 @@ public class CaseArbitrateController extends BaseController { * @return */ @PostMapping("/writtenHear") - @PreAuthorize("@ss.hasPermi('caseManagement:hear')") public AjaxResult writtenHear(@Validated @RequestBody ArbitrateRecord arbitrateRecord){ return caseArbitrateService.writtenHear(arbitrateRecord); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java index 5f13ee7..4c73eed 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java @@ -25,7 +25,7 @@ public class CasePaymentController { * @param casePayDTO 缴费传入参数 * @return 统一响应结果 */ - @PreAuthorize("@ss.hasPermi('caseManagement:list:pay')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:pay')") @PostMapping("/casePay") public AjaxResult casePay(@Validated @RequestBody CasePayDTO casePayDTO) { return paymentService.casePay(casePayDTO); @@ -36,7 +36,7 @@ public class CasePaymentController { * @param caseApplication * @return */ - @PreAuthorize("@ss.hasPermi('paymentManagement:list:payconfirm')") +// @PreAuthorize("@ss.hasPermi('paymentManagement:list:payconfirm')") @PutMapping("/confirm") public AjaxResult confirmPayment(@Validated @RequestBody CaseApplication caseApplication) { return paymentService.confirmPayment(caseApplication); diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 3e9f5c0..54afe82 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -94,14 +94,20 @@ spring: mail: host: smtp.163.com port: 25 - username: hjbjava@163.com - password: BSRSSEPJWGNNVYYL + username: lmj1549843951@163.com + password: JGIOQVFCLAZKXRKO default-encoding: UTF-8 properties: mail: smtp: + connectiontimeout: 5000 + timeout: 5000 + writetimeout: 5000 socketFactoryClass: javax.net.ssl.SSLSocketFactory + socketFactoryFallback: false + socketFactoryPort: 465 debug: false + protocol: smtp #上上签配置参数 ssq: developerId: 1695872832013855470 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java index 929d348..04b87a1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java @@ -299,7 +299,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL); caseApplicationMapper.submitCaseApplication(caseApplication); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.ARBITRATED_SEAL,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.ARBITRATED_SEAL, ""); return AjaxResult.success("签名成功,案件状态已改为待仲裁文书用印"); } @@ -310,7 +310,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { caseApplication.setCaseStatus(CaseApplicationConstants.CASE_ARCHIVED); caseApplicationMapper.submitCaseApplication(caseApplication); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CASE_ARCHIVED,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_ARCHIVED, ""); return AjaxResult.success("归档成功,案件状态已改为已归档"); } @@ -343,19 +343,58 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } } } + //发送邮件 + sendCaseEmail(caseApplication1, appEmail, resEmail); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CASE_FILING,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_FILING, ""); return AjaxResult.success("仲裁文书送达成功"); } + /** + * 通过邮件发送裁决书文件 + * + * @param caseApplication1 + * @param appEmail + * @param resEmail + */ + private void sendCaseEmail(CaseApplication caseApplication1, String appEmail, String resEmail) { + List fileList = new ArrayList<>(); + File file = null; +// List caseAttachList = caseApplication1.getCaseAttachList(); +// if (caseAttachList != null && caseAttachList.size() > 0) { +// for (CaseAttach caseAttach : caseAttachList) { +// if (caseAttach.getAnnexType() == 3) { +// String annexPath = caseAttach.getAnnexPath(); +// String path = "/home/ruoyi/" + annexPath; +// String path = "/home/ruoyi/uploadPath/upload/2023/10/12/裁决书测试20231012test.docx"; + String path = "E:/WorkDoc/SH/裁决书测试20231012test.docx"; + file = new File(path); + fileList.add(file); + System.out.println("文件长度:" + file.length()); +// } +// } +// } + if (file != null) { + JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender(); + try { +// emailOutUtil.sendMessageCarryFile(appEmail, "裁决书", "您好,审核后的裁决书在附件中请查阅", file, "hjbjava@163.com", javaMailSender); + emailOutUtil.sendMessageCarryFiles(appEmail, "裁决书", "您好,审核后的裁决书在附件中请查阅", fileList, "lmj1549843951@163.com", javaMailSender); + } catch (Exception e) { + System.out.println("邮件发送失败++++++++++++++++++++++++++++++++"); + System.out.println(e.toString()); + } + } + + } + @Override public AjaxResult stamp(CaseApplication caseApplication) { //更改案件状态(暂时) caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY); caseApplicationMapper.submitCaseApplication(caseApplication); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.ARBITRATION_DELIVERY,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.ARBITRATION_DELIVERY, ""); return AjaxResult.success("用印成功,案件状态已改为待仲裁文书送达"); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 3d63ec4..f34ac02 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -716,120 +716,121 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord); Integer agreeOrNotCheck = caseApplication.getAgreeOrNotCheck(); if(agreeOrNotCheck.intValue()==1){//同意审核 - try { - //获取当前案件的裁决书 - CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication); - List caseAttachList = caseApplication2.getCaseAttachList(); - if (caseAttachList != null && caseAttachList.size() > 0) { - for (CaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == 3) { - String annexPath = caseAttach.getAnnexPath(); - //String path = "/home/ruoyi/" + annexPath; - String path ="D:\\home\\仲裁裁决书模板.docx"; - //获取文件上传地址 - EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); - String body = response.getBody(); - if (body != null){ - JSONObject jsonObject = JSONObject.parseObject(body); - String fileId = jsonObject.getJSONObject("data").getString("fileId"); - String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); - //上传文件流 - EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); - JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); - if (jsonObject1.getIntValue("errCode")==0){ - //查看文件上传状态 - Thread.sleep(5000); - EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); - JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); - JSONObject data = jsonObject2.getJSONObject("data"); - int fileStatus =data.getIntValue("fileStatus"); - if (fileStatus == 2 || fileStatus == 5){ - String fileName = data.getString("fileName"); - //上传成功,获取文件签名印章位置 - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setFileid(fileId); - EsignHttpResponse positions = SignAward.getPositions(sealSignRecord); - Gson gson = new Gson(); - JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); - JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); - String keywordPositions = positionsData.get("keywordPositions").getAsString(); - //发起签署 - sealSignRecord.setFilename(fileName); - String arbitratorId = caseApplication2.getArbitratorId(); - if (arbitratorId!=null){ - SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId)); - if (sysUser == null){ - return rows; - } - sealSignRecord.setPensonAccount(sysUser.getPhonenumber()); - sealSignRecord.setPensonName(sysUser.getNickName()); - } - sealSignRecord.setOrgnizeName("西安云美电子科技有限公司"); - sealSignRecord.setOrgnizeNamePsnAccount("秦桃则"); - sealSignRecord.setOrgnizeName("西安云美电子科技有限公司"); - sealSignRecord.setOrgnizeNamePsnAccount("17691338406"); - sealSignRecord.setOrgnizeNamepsnName("韩超勃"); - //解析文件签名印章位置 - JSONArray jsonArray = JSONArray.parseArray(keywordPositions); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject3 = jsonArray.getJSONObject(i); - String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("仲裁员")){ - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++){ - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsn(positionX); - sealSignRecord.setPositionYpsn(positionY); - } - }else { - //用印 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXorg(positionX); - sealSignRecord.setPositionYorg(positionY); - } - } - } - EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord); - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject1.getIntValue("code")==0){ - //获取签署流程ID - JSONObject data1 = jsonObject3.getJSONObject("data"); - String signFlowId = data1.getString("signFlowId"); - //保存案件id,文件id,文件名称.流程id到签署用印记录表里 - sealSignRecord.setCaseAppliId(caseApplication.getId()); - sealSignRecord.setSignFlowid(signFlowId); - sealSignRecord.setSignFlowStatus(1);//待签名 - sealSignRecordMapper.insertSealSignRecord(sealSignRecord); - } - } - } - } - break; - } - } - } - } catch (EsignDemoException e) { - e.printStackTrace(); - } catch (InterruptedException e) { - e.printStackTrace(); - } + //TODO 取消一下注释 +// try { +// //获取当前案件的裁决书 +// CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication); +// List caseAttachList = caseApplication2.getCaseAttachList(); +// if (caseAttachList != null && caseAttachList.size() > 0) { +// for (CaseAttach caseAttach : caseAttachList) { +// if (caseAttach.getAnnexType() == 3) { +// String annexPath = caseAttach.getAnnexPath(); +// String path = "/home/ruoyi/" + annexPath; +//// String path ="D:\\home\\仲裁裁决书模板.docx"; +// //获取文件上传地址 +// EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); +// String body = response.getBody(); +// if (body != null){ +// JSONObject jsonObject = JSONObject.parseObject(body); +// String fileId = jsonObject.getJSONObject("data").getString("fileId"); +// String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); +// //上传文件流 +// EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); +// JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); +// if (jsonObject1.getIntValue("errCode")==0){ +// //查看文件上传状态 +// Thread.sleep(5000); +// EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); +// JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); +// JSONObject data = jsonObject2.getJSONObject("data"); +// int fileStatus =data.getIntValue("fileStatus"); +// if (fileStatus == 2 || fileStatus == 5){ +// String fileName = data.getString("fileName"); +// //上传成功,获取文件签名印章位置 +// SealSignRecord sealSignRecord = new SealSignRecord(); +// sealSignRecord.setFileid(fileId); +// EsignHttpResponse positions = SignAward.getPositions(sealSignRecord); +// Gson gson = new Gson(); +// JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); +// JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); +// String keywordPositions = positionsData.get("keywordPositions").getAsString(); +// //发起签署 +// sealSignRecord.setFilename(fileName); +// String arbitratorId = caseApplication2.getArbitratorId(); +// if (arbitratorId!=null){ +// SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId)); +// if (sysUser == null){ +// return rows; +// } +// sealSignRecord.setPensonAccount(sysUser.getPhonenumber()); +// sealSignRecord.setPensonName(sysUser.getNickName()); +// } +// sealSignRecord.setOrgnizeName("西安云美电子科技有限公司"); +// sealSignRecord.setOrgnizeNamePsnAccount("秦桃则"); +// sealSignRecord.setOrgnizeName("西安云美电子科技有限公司"); +// sealSignRecord.setOrgnizeNamePsnAccount("17691338406"); +// sealSignRecord.setOrgnizeNamepsnName("韩超勃"); +// //解析文件签名印章位置 +// JSONArray jsonArray = JSONArray.parseArray(keywordPositions); +// for (int i = 0; i < jsonArray.size(); i++) { +// JSONObject jsonObject3 = jsonArray.getJSONObject(i); +// String keyword = jsonObject3.getString("keyword"); +// if (keyword.equals("仲裁员")){ +// //签名 +// JSONArray positionsArray = jsonObject3.getJSONArray("positions"); +// // 遍历 positionsArray 中的每个元素 +// for (int j = 0; j < positionsArray.size(); j++){ +// JSONObject positionObj = positionsArray.getJSONObject(j); +// int pageNum = positionObj.getIntValue("pageNum"); +// sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); +// JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); +// JSONObject coordinateObj = coordinatesArray.getJSONObject(0); +// double positionX = coordinateObj.getDoubleValue("positionX"); +// double positionY = coordinateObj.getDoubleValue("positionY"); +// sealSignRecord.setPositionXpsn(positionX); +// sealSignRecord.setPositionYpsn(positionY); +// } +// }else { +// //用印 +// JSONArray positionsArray = jsonObject3.getJSONArray("positions"); +// // 遍历 positionsArray 中的每个元素 +// for (int j = 0; j < positionsArray.size(); j++) { +// JSONObject positionObj = positionsArray.getJSONObject(j); +// int pageNum = positionObj.getIntValue("pageNum"); +// sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); +// JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); +// JSONObject coordinateObj = coordinatesArray.getJSONObject(0); +// double positionX = coordinateObj.getDoubleValue("positionX"); +// double positionY = coordinateObj.getDoubleValue("positionY"); +// sealSignRecord.setPositionXorg(positionX); +// sealSignRecord.setPositionYorg(positionY); +// } +// } +// } +// EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord); +// JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); +// if (jsonObject1.getIntValue("code")==0){ +// //获取签署流程ID +// JSONObject data1 = jsonObject3.getJSONObject("data"); +// String signFlowId = data1.getString("signFlowId"); +// //保存案件id,文件id,文件名称.流程id到签署用印记录表里 +// sealSignRecord.setCaseAppliId(caseApplication.getId()); +// sealSignRecord.setSignFlowid(signFlowId); +// sealSignRecord.setSignFlowStatus(1);//待签名 +// sealSignRecordMapper.insertSealSignRecord(sealSignRecord); +// } +// } +// } +// } +// break; +// } +// } +// } +// } catch (EsignDemoException e) { +// e.printStackTrace(); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } caseApplication.setCaseStatus(CaseApplicationConstants.SIGN_ARBITRATION); // 新增日志 CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.SIGN_ARBITRATION,""); From edfd847318cdbd3c8ccfa6ae34835611a8613b02 Mon Sep 17 00:00:00 2001 From: gy b Date: Fri, 13 Oct 2023 18:25:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=95=B4=E5=90=88=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 4 +- .../CaseArbitrateController.java | 2 +- .../CaseLogRecordController.java | 2 +- .../service/impl/AdjudicationServiceImpl.java | 28 +- .../impl/CaseApplicationServiceImpl.java | 540 ++++++++++-------- 5 files changed, 304 insertions(+), 272 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index a973250..003c1f9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -101,7 +101,7 @@ public class CaseApplicationController extends BaseController { /** * 查询签名链接 */ - @PreAuthorize("@ss.hasPermi('caseManagement:list:selectSignUrl')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:selectSignUrl')") @PostMapping("/selectSignUrl") public AjaxResult selectSignUrl(@Validated @RequestBody CaseApplication caseApplication) throws EsignDemoException { SealSignRecord sealSignRecordselect = caseApplicationService.selectSignUrl(caseApplication); @@ -111,7 +111,7 @@ public class CaseApplicationController extends BaseController { /** * 查询用印链接 */ - @PreAuthorize("@ss.hasPermi('caseManagement:list:selectSealUrl')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:selectSealUrl')") @PostMapping("/selectSealUrl") public AjaxResult selectSealUrl(@Validated @RequestBody CaseApplication caseApplication) throws EsignDemoException { SealSignRecord sealUrlRecordselect = caseApplicationService.selectSealUrl(caseApplication); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java index dda5a73..4978baa 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java @@ -23,7 +23,7 @@ public class CaseArbitrateController extends BaseController { * @return */ @PutMapping("/method") - @PreAuthorize("@ss.hasPermi('caseManagement:list:checkarbitrationway')") +// @PreAuthorize("@ss.hasPermi('caseManagement:list:checkarbitrationway')") public AjaxResult examineArbitrateMethod(@Validated @RequestBody CaseApplication caseApplication ,Integer opinion){ return caseArbitrateService.examineArbitrateMethod(caseApplication,opinion); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java index 8fd1ee0..6cc330d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java @@ -22,7 +22,7 @@ public class CaseLogRecordController extends BaseController { /** * 查询案件日志列表 */ - @PreAuthorize("@ss.hasPermi('caseLog:list')") +// @PreAuthorize("@ss.hasPermi('caseLog:list')") @GetMapping("/list") public TableDataInfo list(CaseLogRecord caseLogRecord) { diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java index 9967dc3..d66eed1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java @@ -364,20 +364,20 @@ public class AdjudicationServiceImpl implements IAdjudicationService { private void sendCaseEmail(CaseApplication caseApplication1, String appEmail, String resEmail) { List fileList = new ArrayList<>(); File file = null; -// List caseAttachList = caseApplication1.getCaseAttachList(); -// if (caseAttachList != null && caseAttachList.size() > 0) { -// for (CaseAttach caseAttach : caseAttachList) { -// if (caseAttach.getAnnexType() == 3) { -// String annexPath = caseAttach.getAnnexPath(); -// String path = "/home/ruoyi/" + annexPath; + List caseAttachList = caseApplication1.getCaseAttachList(); + if (caseAttachList != null && caseAttachList.size() > 0) { + for (CaseAttach caseAttach : caseAttachList) { + if (caseAttach.getAnnexType() == 3) { + String annexPath = caseAttach.getAnnexPath(); + String path = "/home/ruoyi/" + annexPath; // String path = "/home/ruoyi/uploadPath/upload/2023/10/12/裁决书测试20231012test.docx"; - String path = "E:/WorkDoc/SH/裁决书测试20231012test.docx"; - file = new File(path); - fileList.add(file); - System.out.println("文件长度:" + file.length()); -// } -// } -// } +// String path = "E:/WorkDoc/SH/裁决书测试20231012test.docx"; + file = new File(path); + fileList.add(file); + System.out.println("文件长度:" + file.length()); + } + } + } if (file != null) { JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender(); try { @@ -431,7 +431,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { try { // List fileList = new ArrayList<>(); // fileList.add(new File("D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\b442880179844a848f1f8b08c29e3d0c.docx")); - // File file = fileList.get(0);//System.out.println("这是文件"+file); + // File file = fileList.get(0);//System.out.println("这是文件"+file); //电子邮件送达 // EmailOutUtil emailOutUtil = new EmailOutUtil(); // JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 44204d2..f71b323 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -3,8 +3,6 @@ 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; @@ -14,31 +12,26 @@ import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.CaseApplicationConstants; 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.SignAward; -import com.ruoyi.common.utils.bean.SealSignRecord; - -import com.ruoyi.common.utils.file.SaaSAPIFileUtils; -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.*; @@ -73,8 +66,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { 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}$"); - + 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 @@ -99,18 +91,18 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { int rows = caseApplicationMapper.insertCaseApplication(caseApplication); List caseAffiliates = caseApplication.getCaseAffiliates(); - Map deptMap =new HashMap<>(); + Map deptMap = new HashMap<>(); if (caseAffiliates != null && caseAffiliates.size() > 0) { - // 查询所有的组织机构,组装成map - List deptList = sysDeptMapper.selectDeptList(new SysDept()); - if (CollectionUtil.isEmpty(deptList)) { - deptList = new ArrayList<>(); - } - deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId,(oldV,newV)->newV)); + // 查询所有的组织机构,组装成map + List deptList = sysDeptMapper.selectDeptList(new SysDept()); + if (CollectionUtil.isEmpty(deptList)) { + deptList = new ArrayList<>(); + } + deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId, (oldV, newV) -> newV)); for (CaseAffiliate caseAffiliate : caseAffiliates) { caseAffiliate.setCaseAppliId(caseApplication.getId()); - if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) { + if (caseAffiliate.getIdentityType() == 1 && StrUtil.isNotEmpty(caseAffiliate.getName())) { // 将组织机构id设为申请人名称 if (deptMap.containsKey(caseAffiliate.getName())) { caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName()))); @@ -144,24 +136,25 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } } // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CASE_APPLICATION,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, ""); return rows; } /** * 获取自动编码 + * * @return */ private String generateCaseNum() { // 自动编码格式 zc+yyyyMMdd+001 String currentDay = DateUtils.dateTime(); - String caseNum = "zc"+ currentDay; + String caseNum = "zc" + currentDay; //查询出当天的案件编号的最大值 - Integer maxCaseNum = caseApplicationMapper.selectCaseNumLike(caseNum,caseNum.length()); - if(null == maxCaseNum){ + Integer maxCaseNum = caseApplicationMapper.selectCaseNumLike(caseNum, caseNum.length()); + if (null == maxCaseNum) { caseNum = caseNum + "001"; - }else { + } else { caseNum = caseNum + String.format("%03d", maxCaseNum); } return caseNum; @@ -179,21 +172,21 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { //根据仲裁费用计费规则计算应缴费用 //暂时设置计费比率为0.01 BigDecimal feeRate = new BigDecimal(0.01); - BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP); + BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP); caseApplication.setFeePayable(feePayable); int rows = caseApplicationMapper.updataCaseApplication(caseApplication); List caseAffiliates = caseApplication.getCaseAffiliates(); - if(caseAffiliates!=null&&caseAffiliates.size()>0){ + if (caseAffiliates != null && caseAffiliates.size() > 0) { // 查询所有的组织机构,组装成map List deptList = sysDeptMapper.selectDeptList(new SysDept()); if (CollectionUtil.isEmpty(deptList)) { deptList = new ArrayList<>(); } - Map deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId,(oldV,newV)->newV)); - for (CaseAffiliate caseAffiliate : caseAffiliates){ + Map deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId, (oldV, newV) -> newV)); + for (CaseAffiliate caseAffiliate : caseAffiliates) { caseAffiliate.setCaseAppliId(caseApplication.getId()); - if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) { + if (caseAffiliate.getIdentityType() == 1 && StrUtil.isNotEmpty(caseAffiliate.getName())) { // 将组织机构id设为申请人名称 if (deptMap.containsKey(caseAffiliate.getName())) { caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName()))); @@ -219,8 +212,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } List caseAttachList = caseApplication.getCaseAttachList(); - if(caseAttachList!=null&&caseAttachList.size()>0){ - for (CaseAttach caseAttach : caseAttachList){ + if (caseAttachList != null && caseAttachList.size() > 0) { + for (CaseAttach caseAttach : caseAttachList) { caseAttach.setCaseAppliId(caseApplication.getId()); caseAttachMapper.updateCaseAttach(caseAttach); } @@ -237,7 +230,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplication.setCaseStatus(CaseApplicationConstants.CASE_CHECK); int rows = caseApplicationMapper.submitCaseApplication(caseApplication); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CASE_CHECK,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_CHECK, ""); return rows; } @@ -273,8 +266,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { String annexPath = "/uploadPath" + annexName.substring(startIndex); caseAttach.setAnnexPath(annexPath); int startIndexnew = annexName.lastIndexOf("/"); - if(startIndexnew!=-1){ - String annexNamenew = annexName.substring(startIndexnew+1); + if (startIndexnew != -1) { + String annexNamenew = annexName.substring(startIndexnew + 1); caseAttach.setAnnexName(annexNamenew); } @@ -284,27 +277,27 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplicationselect.setCaseAttachList(caseAttachList); List caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if(caseAffiliatListeselect!=null){ + if (caseAffiliatListeselect != null) { // 查询组织机构 List sysDepts = sysDeptMapper.selectDeptList(new SysDept()); - Map deptMap=new HashMap<>(); - if(CollectionUtil.isNotEmpty(sysDepts)){ + Map deptMap = new HashMap<>(); + if (CollectionUtil.isNotEmpty(sysDepts)) { for (SysDept sysDept : sysDepts) { - deptMap.put(String.valueOf(sysDept.getDeptId()),sysDept.getDeptName()); + deptMap.put(String.valueOf(sysDept.getDeptId()), sysDept.getDeptName()); } } StringBuffer applicantName = new StringBuffer(); StringBuffer respondentName = new StringBuffer(); - for (int i = 0; i < caseAffiliatListeselect.size(); i++){ + for (int i = 0; i < caseAffiliatListeselect.size(); i++) { CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i); int identityType = caseAffiliateselect.getIdentityType(); - if(identityType==1){ - if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){ + if (identityType == 1) { + if (StrUtil.isNotEmpty(caseAffiliateselect.getName()) && deptMap.containsKey(caseAffiliateselect.getName())) { caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName())); } - applicantName.append(caseAffiliateselect.getName()).append(",");; - }else if(identityType==2){ - respondentName.append(caseAffiliateselect.getName()).append(",");; + applicantName.append(caseAffiliateselect.getName()).append(","); + } else if (identityType == 2) { + respondentName.append(caseAffiliateselect.getName()).append(","); } } caseApplicationselect.setApplicantName(applicantName.toString()); @@ -317,26 +310,26 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { @Override @Transactional - public String importCaseApplication(List caseApplicationList, String operName) { + public String importCaseApplication(List caseApplicationList, String operName) { StringBuilder failureMsg = new StringBuilder(); StringBuilder successMsg = new StringBuilder(); int successNum = 0; int failureNum = 0; - if(caseApplicationList!=null&&caseApplicationList.size()>0){ + if (caseApplicationList != null && caseApplicationList.size() > 0) { // 1,查询所有的组织机构,组装成map List deptList = sysDeptMapper.selectDeptList(new SysDept()); - Map deptMap =new HashMap<>(); - if(CollectionUtil.isNotEmpty(deptList)) { - deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId,(oldV,newV)->newV)); + Map deptMap = new HashMap<>(); + if (CollectionUtil.isNotEmpty(deptList)) { + deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId, (oldV, newV) -> newV)); } List caseApplicationListinsert = new ArrayList<>(); - for (int i = 0; i < caseApplicationList.size(); i++){ + for (int i = 0; i < caseApplicationList.size(); i++) { CaseApplication caseApplication = caseApplicationList.get(i); // 导入校验 importValid(caseApplication); // 校验成功的数据 - if(StrUtil.isEmpty(caseApplication.getErrorMsg())) { + if (StrUtil.isEmpty(caseApplication.getErrorMsg())) { //根据仲裁费用计费规则计算应缴费用 //暂时设置计费比率为0.01 BigDecimal feeRate = new BigDecimal(0.01); @@ -356,12 +349,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { // caseApplicationListinsert.add(caseApplication); // } caseApplicationListinsert.add(caseApplication); - }else { + } else { // 拼接错误信息 - failureMsg.append("
").append("第").append(i+2).append("行:").append(caseApplication.getErrorMsg().toString()); + failureMsg.append("
").append("第").append(i + 2).append("行:").append(caseApplication.getErrorMsg().toString()); } } - if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){ + if (caseApplicationListinsert != null && caseApplicationListinsert.size() > 0) { // List caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect( // collectingAndThen( // toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))), @@ -370,45 +363,45 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { //对不重复的立案对象集合的立案对象重新组装对应的案件关联人信息 // if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){ - List caseApplicationNewList = null; - for (int i = 0; i < caseApplicationListinsert.size(); i++){ - caseApplicationNewList = new ArrayList<>(); - CaseApplication caseApplicationinsertDiffer = caseApplicationListinsert.get(i); - // 设置自动编码 - caseApplicationinsertDiffer.setCaseNum(generateCaseNum()); - List caseAffiliatesnew = new ArrayList<>(); - CaseApplication caseApplicationNew = new CaseApplication(); - copyCaseApplication(caseApplicationinsertDiffer,caseApplicationNew); - if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){ - for (int j = 0; j < caseApplicationListinsert.size(); j++){ - CaseApplication caseApplicationinsert = caseApplicationListinsert.get(j); + List caseApplicationNewList = null; + for (int i = 0; i < caseApplicationListinsert.size(); i++) { + caseApplicationNewList = new ArrayList<>(); + CaseApplication caseApplicationinsertDiffer = caseApplicationListinsert.get(i); + // 设置自动编码 + caseApplicationinsertDiffer.setCaseNum(generateCaseNum()); + List caseAffiliatesnew = new ArrayList<>(); + CaseApplication caseApplicationNew = new CaseApplication(); + copyCaseApplication(caseApplicationinsertDiffer, caseApplicationNew); + if (caseApplicationListinsert != null && caseApplicationListinsert.size() > 0) { + for (int j = 0; j < caseApplicationListinsert.size(); j++) { + CaseApplication caseApplicationinsert = caseApplicationListinsert.get(j); - if(StringUtils.isNotEmpty(caseApplicationinsert.getCaseNum())&& - caseApplicationinsert.getCaseNum().equals(caseApplicationinsertDiffer.getCaseNum())){ + if (StringUtils.isNotEmpty(caseApplicationinsert.getCaseNum()) && + caseApplicationinsert.getCaseNum().equals(caseApplicationinsertDiffer.getCaseNum())) { - caseAffiliatesnew.addAll(caseApplicationinsert.getCaseAffiliates()); - } + caseAffiliatesnew.addAll(caseApplicationinsert.getCaseAffiliates()); } - caseApplicationNew.setCaseAffiliates(caseAffiliatesnew); - caseApplicationNewList.add(caseApplicationNew); } + caseApplicationNew.setCaseAffiliates(caseAffiliatesnew); + caseApplicationNewList.add(caseApplicationNew); + } - for (int k = 0; k < caseApplicationNewList.size(); k++){ - CaseApplication caseApplicationItera = caseApplicationNewList.get(k); - // 新增立案信息 - caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); + for (int k = 0; k < caseApplicationNewList.size(); k++) { + CaseApplication caseApplicationItera = caseApplicationNewList.get(k); + // 新增立案信息 + caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); - int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera); - List caseAffiliates = caseApplicationItera.getCaseAffiliates(); - if(caseAffiliates!=null&&caseAffiliates.size()>0){ - for (CaseAffiliate caseAffiliate : caseAffiliates){ - caseAffiliate.setCaseAppliId(caseApplicationItera.getId()); - } - caseAffiliateMapper.batchCaseAffiliate(caseAffiliates); + int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera); + List caseAffiliates = caseApplicationItera.getCaseAffiliates(); + if (caseAffiliates != null && caseAffiliates.size() > 0) { + for (CaseAffiliate caseAffiliate : caseAffiliates) { + caseAffiliate.setCaseAppliId(caseApplicationItera.getId()); } - successNum++; - successMsg.append("
" + successNum + "、立案编号 " + caseApplicationItera.getCaseNum() + " 导入成功"); + caseAffiliateMapper.batchCaseAffiliate(caseAffiliates); } + successNum++; + successMsg.append("
" + successNum + "、立案编号 " + caseApplicationItera.getCaseNum() + " 导入成功"); + } // } @@ -416,233 +409,239 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } - }else { + } else { throw new ServiceException("导入立案申请数据不能为空!"); } - return successMsg.append(failureMsg.toString()).toString(); + return successMsg.append(failureMsg.toString()).toString(); } /** * 导入校验 + * * @param caseApplication * @param */ private void importValid(CaseApplication caseApplication) { - StringBuilder failureMsg=new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); caseApplication.setErrorMsg(failureMsg); // 校验基本字段 - validBaseColumn(caseApplication,failureMsg); + validBaseColumn(caseApplication, failureMsg); // 校验申请人信息 - validApplicationColumn(caseApplication,failureMsg); + validApplicationColumn(caseApplication, failureMsg); // 校验申请人代理信息 - validApplicationAgentColumn(caseApplication,failureMsg); + validApplicationAgentColumn(caseApplication, failureMsg); // 校验被申请人信息 - validDebtorApplicationColumn(caseApplication,failureMsg); + validDebtorApplicationColumn(caseApplication, failureMsg); // 校验被申请人代理信息 - validDebtorApplicationAgentColumn(caseApplication,failureMsg); + validDebtorApplicationAgentColumn(caseApplication, failureMsg); } /** * 校验被申请人代理信息 + * * @param caseApplication * @param failureMsg */ private void validDebtorApplicationAgentColumn(CaseApplication caseApplication, StringBuilder failureMsg) { - if( StrUtil.isEmpty(caseApplication.getDebtorNameAgent())){ + if (StrUtil.isEmpty(caseApplication.getDebtorNameAgent())) { failureMsg.append("【被申请人主体信息-代理人姓名】字段不能为空;"); - }else if(caseApplication.getDebtorNameAgent().length()>50){ + } else if (caseApplication.getDebtorNameAgent().length() > 50) { failureMsg.append("【被申请人主体信息-代理人姓名】字段超出指定长度,最大长度为50;"); } - if( StrUtil.isEmpty(caseApplication.getDebtorIdentityNumAgent())){ + if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNumAgent())) { failureMsg.append("【被申请人主体信息-代理人身份证号】字段不能为空;"); - }else if(caseApplication.getDebtorIdentityNumAgent().length()>50){ + } else if (caseApplication.getDebtorIdentityNumAgent().length() > 50) { failureMsg.append("【被申请人主体信息-代理人身份证号】字段超出指定长度,最大长度为50;"); } String debtorContactTelphoneAgent = caseApplication.getDebtorContactTelphoneAgent(); - if( StrUtil.isEmpty(debtorContactTelphoneAgent)){ + if (StrUtil.isEmpty(debtorContactTelphoneAgent)) { failureMsg.append("【被申请人主体信息-代理人联系电话】字段不能为空;"); - }else if(!TELEPHONE_REGX.matcher(debtorContactTelphoneAgent).matches()){ + } else if (!TELEPHONE_REGX.matcher(debtorContactTelphoneAgent).matches()) { failureMsg.append("【被申请人主体信息-代理人联系电话】字段不合法;"); } - if( StrUtil.isEmpty(caseApplication.getDebtorContactAddressAgent())){ + if (StrUtil.isEmpty(caseApplication.getDebtorContactAddressAgent())) { failureMsg.append("【被申请人主体信息-代理人联系地址】字段不能为空;"); - }else if(caseApplication.getDebtorContactAddressAgent().length()>50){ + } else if (caseApplication.getDebtorContactAddressAgent().length() > 50) { failureMsg.append("【被申请人主体信息-代理人联系地址】字段超出指定长度,最大长度为50;"); } } /** * 校验被申请人信息 + * * @param caseApplication * @param failureMsg */ private void validDebtorApplicationColumn(CaseApplication caseApplication, StringBuilder failureMsg) { - if( StrUtil.isEmpty(caseApplication.getDebtorName())){ + if (StrUtil.isEmpty(caseApplication.getDebtorName())) { failureMsg.append("【被申请人主体信息-申请人姓名】字段不能为空;"); - }else if(caseApplication.getDebtorName().length()>50){ + } else if (caseApplication.getDebtorName().length() > 50) { failureMsg.append("【被申请人主体信息-申请人姓名】字段超出指定长度,最大长度为50;"); } - if( StrUtil.isEmpty(caseApplication.getDebtorIdentityNum())){ + if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNum())) { failureMsg.append("【被申请人主体信息-身份证号】字段不能为空;"); - }else if(caseApplication.getDebtorIdentityNum().length()>50){ + } else if (caseApplication.getDebtorIdentityNum().length() > 50) { failureMsg.append("【被申请人主体信息-身份证号】字段超出指定长度,最大长度为50;"); } String debtorContactTelphone = caseApplication.getDebtorContactTelphone(); - if( StrUtil.isEmpty(debtorContactTelphone)){ + if (StrUtil.isEmpty(debtorContactTelphone)) { failureMsg.append("【被申请人主体信息-联系电话】字段不能为空;"); - }else if(!TELEPHONE_REGX.matcher(debtorContactTelphone).matches()){ + } else if (!TELEPHONE_REGX.matcher(debtorContactTelphone).matches()) { failureMsg.append("【被申请人主体信息-联系电话】字段不合法;"); } - if( StrUtil.isEmpty(caseApplication.getDebtorContactAddress())){ + if (StrUtil.isEmpty(caseApplication.getDebtorContactAddress())) { failureMsg.append("【被申请人主体信息-联系地址】字段不能为空;"); - }else if(caseApplication.getDebtorContactAddress().length()>50){ + } else if (caseApplication.getDebtorContactAddress().length() > 50) { failureMsg.append("【被申请人主体信息-联系地址】字段超出指定长度,最大长度为50;"); } String debtorWorkTelphone = caseApplication.getDebtorWorkTelphone(); - if( StrUtil.isEmpty(debtorWorkTelphone)){ + if (StrUtil.isEmpty(debtorWorkTelphone)) { failureMsg.append("【被申请人主体信息-单位电话】字段不能为空;"); - }else if(!TELEPHONE_REGX.matcher(debtorWorkTelphone).matches()){ + } else if (!TELEPHONE_REGX.matcher(debtorWorkTelphone).matches()) { failureMsg.append("【被申请人主体信息-单位电话】字段不合法;"); } - if( StrUtil.isEmpty(caseApplication.getDebtorWorkAddress())){ + if (StrUtil.isEmpty(caseApplication.getDebtorWorkAddress())) { failureMsg.append("【被申请人主体信息-单位地址】字段不能为空;"); - }else if(caseApplication.getDebtorWorkAddress().length()>50){ + } else if (caseApplication.getDebtorWorkAddress().length() > 50) { failureMsg.append("【被申请人主体信息-单位地址】字段超出指定长度,最大长度为50;"); } } /** * 校验申请人代理信息 + * * @param caseApplication * @param failureMsg */ private void validApplicationAgentColumn(CaseApplication caseApplication, StringBuilder failureMsg) { - if( StrUtil.isEmpty(caseApplication.getNameAgent())){ + if (StrUtil.isEmpty(caseApplication.getNameAgent())) { failureMsg.append("【申请人主体信息-代理人姓名】字段不能为空;"); - }else if(caseApplication.getNameAgent().length()>50){ + } else if (caseApplication.getNameAgent().length() > 50) { failureMsg.append("【申请人主体信息-代理人姓名】字段超出指定长度,最大长度为50;"); } - if( StrUtil.isEmpty(caseApplication.getIdentityNumAgent())){ + if (StrUtil.isEmpty(caseApplication.getIdentityNumAgent())) { failureMsg.append("【申请人主体信息-代理人身份证号】字段不能为空;"); - }else if(caseApplication.getIdentityNumAgent().length()>50){ + } else if (caseApplication.getIdentityNumAgent().length() > 50) { failureMsg.append("【申请人主体信息-代理人身份证号】字段超出指定长度,最大长度为50;"); } String contactTelphoneAgent = caseApplication.getContactTelphoneAgent(); - if( StrUtil.isEmpty(contactTelphoneAgent)){ + if (StrUtil.isEmpty(contactTelphoneAgent)) { failureMsg.append("【申请人主体信息-代理人联系电话】字段不能为空;"); - }else if(!TELEPHONE_REGX.matcher(contactTelphoneAgent).matches()){ + } else if (!TELEPHONE_REGX.matcher(contactTelphoneAgent).matches()) { failureMsg.append("【申请人主体信息-代理人联系电话】字段不合法;"); } - if( StrUtil.isEmpty(caseApplication.getContactAddressAgent())){ + if (StrUtil.isEmpty(caseApplication.getContactAddressAgent())) { failureMsg.append("【申请人主体信息-代理人联系地址】字段不能为空;"); - }else if(caseApplication.getContactAddressAgent().length()>50){ + } else if (caseApplication.getContactAddressAgent().length() > 50) { failureMsg.append("【申请人主体信息-代理人联系地址】字段超出指定长度,最大长度为50;"); } } /** * 校验申请人主题信息 + * * @param caseApplication * @param failureMsg */ private void validApplicationColumn(CaseApplication caseApplication, StringBuilder failureMsg) { - if( StrUtil.isEmpty(caseApplication.getName())){ + if (StrUtil.isEmpty(caseApplication.getName())) { failureMsg.append("【申请人主体信息-申请人(机构)】字段不能为空;"); - }else if(caseApplication.getName().length()>20){ + } else if (caseApplication.getName().length() > 20) { failureMsg.append("【申请人主体信息-申请人(机构)】字段超出指定长度,最大长度为20;"); } - if( StrUtil.isNotEmpty(caseApplication.getIdentityNum())&&caseApplication.getIdentityNum().length()>50){ + if (StrUtil.isNotEmpty(caseApplication.getIdentityNum()) && caseApplication.getIdentityNum().length() > 50) { failureMsg.append("【申请人主体信息-代码】字段超出指定长度,最大长度为50;"); } String contactTelphone = caseApplication.getContactTelphone(); - if( StrUtil.isEmpty(contactTelphone)){ + if (StrUtil.isEmpty(contactTelphone)) { failureMsg.append("【申请人主体信息-联系电话】字段不能为空;"); - }else if(!TELEPHONE_REGX.matcher(contactTelphone).matches()){ + } else if (!TELEPHONE_REGX.matcher(contactTelphone).matches()) { failureMsg.append("【申请人主体信息-联系电话】字段不合法;"); } - if( StrUtil.isEmpty(caseApplication.getContactAddress())){ + if (StrUtil.isEmpty(caseApplication.getContactAddress())) { failureMsg.append("【申请人主体信息-联系地址】字段不能为空;"); - }else if(caseApplication.getName().length()>50){ + } else if (caseApplication.getName().length() > 50) { failureMsg.append("【申请人主体信息-联系地址】字段超出指定长度,最大长度为50;"); } String workTelphone = caseApplication.getWorkTelphone(); - if( StrUtil.isEmpty(workTelphone)){ + if (StrUtil.isEmpty(workTelphone)) { failureMsg.append("【申请人主体信息-单位电话】字段不能为空;"); - }else if(!TELEPHONE_REGX.matcher(workTelphone).matches()){ + } else if (!TELEPHONE_REGX.matcher(workTelphone).matches()) { failureMsg.append("【申请人主体信息-单位电话】字段不合法;"); } - if( StrUtil.isEmpty(caseApplication.getWorkAddress())){ + if (StrUtil.isEmpty(caseApplication.getWorkAddress())) { failureMsg.append("【申请人主体信息-单位地址】字段不能为空;"); - }else if(caseApplication.getWorkAddress().length()>50){ + } else if (caseApplication.getWorkAddress().length() > 50) { failureMsg.append("【申请人主体信息-单位地址】字段超出指定长度,最大长度为50;"); } } /** * 校验基本字段 + * * @param caseApplication * @param failureMsg */ private void validBaseColumn(CaseApplication caseApplication, StringBuilder failureMsg) { BigDecimal caseSubjectAmount = caseApplication.getCaseSubjectAmount(); - if(null== caseSubjectAmount){ + if (null == caseSubjectAmount) { failureMsg.append("【案件标的】字段不合法;"); - }else { - if(caseSubjectAmount.compareTo(new BigDecimal("0")) < 0 ||caseSubjectAmount.compareTo(new BigDecimal("99999999.99"))>0){ + } else { + if (caseSubjectAmount.compareTo(new BigDecimal("0")) < 0 || caseSubjectAmount.compareTo(new BigDecimal("99999999.99")) > 0) { failureMsg.append("【案件标的】字段超出范围,范围为[0,100000000);"); } - if(caseSubjectAmount.scale()>2){ + if (caseSubjectAmount.scale() > 2) { failureMsg.append("【案件标的】字段超出指定精度(10^-2);"); } } - if( caseApplication.getLoanStartDate()== null){ + if (caseApplication.getLoanStartDate() == null) { failureMsg.append("【借款开始日期】字段不合法;"); } - if( caseApplication.getLoanEndDate()== null){ + if (caseApplication.getLoanEndDate() == null) { failureMsg.append("【借款结束日期】字段不合法;"); } - if( StrUtil.isEmpty(caseApplication.getContractNumber())){ + if (StrUtil.isEmpty(caseApplication.getContractNumber())) { failureMsg.append("【合同编号】字段不能为空;"); - }else if(caseApplication.getContractNumber().length()>50){ + } else if (caseApplication.getContractNumber().length() > 50) { failureMsg.append("【合同编号】字段超出指定长度,最大长度为50;"); } BigDecimal claimPrinciOwed = caseApplication.getClaimPrinciOwed(); - if(null== claimPrinciOwed){ + if (null == claimPrinciOwed) { failureMsg.append("【申请人主张欠本金】字段不合法;"); - }else { - if(claimPrinciOwed.compareTo(new BigDecimal("0")) < 0 ||claimPrinciOwed.compareTo(new BigDecimal("99999999.99"))>0){ + } else { + if (claimPrinciOwed.compareTo(new BigDecimal("0")) < 0 || claimPrinciOwed.compareTo(new BigDecimal("99999999.99")) > 0) { failureMsg.append("【申请人主张欠本金】字段超出范围,范围为[0,100000000);"); } - if(claimPrinciOwed.scale()>2){ + if (claimPrinciOwed.scale() > 2) { failureMsg.append("【申请人主张欠本金】字段超出指定精度(10^-2);"); } } BigDecimal claimInterestOwed = caseApplication.getClaimInterestOwed(); - if(null== claimInterestOwed){ + if (null == claimInterestOwed) { failureMsg.append("【申请人主张欠利息】字段不合法;"); - }else { - if(claimInterestOwed.compareTo(new BigDecimal("0")) < 0 ||claimInterestOwed.compareTo(new BigDecimal("99999999.99"))>0){ + } else { + if (claimInterestOwed.compareTo(new BigDecimal("0")) < 0 || claimInterestOwed.compareTo(new BigDecimal("99999999.99")) > 0) { failureMsg.append("【申请人主张欠利息】字段超出范围,范围为[0,100000000);"); } - if(claimInterestOwed.scale()>2){ + if (claimInterestOwed.scale() > 2) { failureMsg.append("【申请人主张欠利息】字段超出指定精度(10^-2);"); } } BigDecimal claimLiquidDamag = caseApplication.getClaimLiquidDamag(); - if(null== claimLiquidDamag){ + if (null == claimLiquidDamag) { failureMsg.append("【申请人主张违约金】字段不合法;"); - }else { - if(claimLiquidDamag.compareTo(new BigDecimal("0")) < 0 ||claimLiquidDamag.compareTo(new BigDecimal("99999999.99"))>0){ + } else { + if (claimLiquidDamag.compareTo(new BigDecimal("0")) < 0 || claimLiquidDamag.compareTo(new BigDecimal("99999999.99")) > 0) { failureMsg.append("【申请人主张违约金】字段超出范围,范围为[0,100000000);"); } - if(claimLiquidDamag.scale()>2){ + if (claimLiquidDamag.scale() > 2) { failureMsg.append("【申请人主张违约金】字段超出指定精度(10^-2);"); } } - if( StrUtil.isEmpty(caseApplication.getArbitratClaims())){ + if (StrUtil.isEmpty(caseApplication.getArbitratClaims())) { failureMsg.append("【申请人仲裁诉求】字段不能为空;"); - }else if(caseApplication.getArbitratClaims().length()>10000){ + } else if (caseApplication.getArbitratClaims().length() > 10000) { failureMsg.append("【申请人仲裁诉求】字段超出指定长度,最大长度为10000;"); } } @@ -653,7 +652,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { public int pendTral(CaseApplication caseApplication) { List arbitrators = caseApplication.getArbitrators(); int rows = 0; - if(arbitrators!=null&&arbitrators.size()>0){ + if (arbitrators != null && arbitrators.size() > 0) { List ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList()); List arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList()); String idstr = ids.stream().map(Object::toString).collect(Collectors.joining(",")); @@ -675,12 +674,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplication.setCaseStatus(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL); int rows = 0; //同意组庭 - if(isAgreePendTral!=null&&isAgreePendTral==1){ + if (isAgreePendTral != null && isAgreePendTral == 1) { rows = caseApplicationMapper.submitCaseApplication(caseApplication); - }else { + } else { List arbitrators = caseApplication.getArbitrators(); // 仲裁员信息 - if(arbitrators!=null&&arbitrators.size()>0){ + if (arbitrators != null && arbitrators.size() > 0) { List ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList()); List arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList()); String idstr = ids.stream().map(Object::toString).collect(Collectors.joining(",")); @@ -691,7 +690,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } } // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL, ""); return rows; } @@ -703,7 +702,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { ArbitrateRecord arbitrateRecord = caseApplication.getArbitrateRecord(); arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CHECK_ARBITRATION,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CHECK_ARBITRATION, ""); return rows; } @@ -715,7 +714,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { ArbitrateRecord arbitrateRecord = caseApplication.getArbitrateRecord(); arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord); Integer agreeOrNotCheck = caseApplication.getAgreeOrNotCheck(); - if(agreeOrNotCheck.intValue()==1){//同意审核 + if (agreeOrNotCheck.intValue() == 1) {//同意审核 try { //获取当前案件的裁决书 CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication); @@ -729,21 +728,21 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { //获取文件上传地址 EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); String body = response.getBody(); - if (body != null){ + if (body != null) { JSONObject jsonObject = JSONObject.parseObject(body); String fileId = jsonObject.getJSONObject("data").getString("fileId"); String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); //上传文件流 EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); - if (jsonObject1.getIntValue("errCode")==0){ + if (jsonObject1.getIntValue("errCode") == 0) { //查看文件上传状态 Thread.sleep(5000); EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); JSONObject data = jsonObject2.getJSONObject("data"); - int fileStatus =data.getIntValue("fileStatus"); - if (fileStatus == 2 || fileStatus == 5){ + int fileStatus = data.getIntValue("fileStatus"); + if (fileStatus == 2 || fileStatus == 5) { String fileName = data.getString("fileName"); //上传成功,获取文件签名印章位置 SealSignRecord sealSignRecord = new SealSignRecord(); @@ -756,9 +755,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { //发起签署 sealSignRecord.setFilename(fileName); String arbitratorId = caseApplication2.getArbitratorId(); - if (arbitratorId!=null){ + if (arbitratorId != null) { SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId)); - if (sysUser == null){ + if (sysUser == null) { return rows; } sealSignRecord.setPensonAccount(sysUser.getPhonenumber()); @@ -774,11 +773,11 @@ 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 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++){ + for (int j = 0; j < positionsArray.size(); j++) { JSONObject positionObj = positionsArray.getJSONObject(j); int pageNum = positionObj.getIntValue("pageNum"); sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); @@ -789,7 +788,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { sealSignRecord.setPositionXpsn(positionX); sealSignRecord.setPositionYpsn(positionY); } - }else { + } else { //用印 JSONArray positionsArray = jsonObject3.getJSONArray("positions"); // 遍历 positionsArray 中的每个元素 @@ -808,7 +807,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord); JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject1.getIntValue("code")==0){ + if (jsonObject1.getIntValue("code") == 0) { //获取签署流程ID JSONObject data1 = jsonObject3.getJSONObject("data"); String signFlowId = data1.getString("signFlowId"); @@ -832,12 +831,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } caseApplication.setCaseStatus(CaseApplicationConstants.SIGN_ARBITRATION); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.SIGN_ARBITRATION,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.SIGN_ARBITRATION, ""); rows = caseApplicationMapper.submitCaseApplication(caseApplication); - }else if(agreeOrNotCheck.intValue()==2){//拒绝审核 + } else if (agreeOrNotCheck.intValue() == 2) {//拒绝审核 caseApplication.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.VERPRIF_ARBITRATION,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.VERPRIF_ARBITRATION, ""); rows = caseApplicationMapper.submitCaseApplication(caseApplication); } @@ -851,15 +850,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { //提交立案审查 int rows = 0; Integer agreeOrNotCheck = caseApplication.getAgreeOrNotCheck(); - if(agreeOrNotCheck.intValue()==1){//同意审核 + if (agreeOrNotCheck.intValue() == 1) {//同意审核 caseApplication.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT); rows = caseApplicationMapper.submitCaseApplication(caseApplication); - }else if(agreeOrNotCheck.intValue()==2){//拒绝审核 + } else if (agreeOrNotCheck.intValue() == 2) {//拒绝审核 caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); rows = caseApplicationMapper.submitCaseApplication(caseApplication); } // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.PENDING_PAYMENT,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_PAYMENT, ""); return rows; } @@ -867,30 +866,31 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { @Override public CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication) { CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplicationConfirm(caseApplication); - if(caseApplicationselect==null){ + if (caseApplicationselect == null) { return caseApplicationselect; } CaseAffiliate caseAffiliate = new CaseAffiliate(); caseAffiliate.setCaseAppliId(caseApplication.getId()); List caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if(caseAffiliatListeselect!=null){ + if (caseAffiliatListeselect != null) { // 查询组织机构 List sysDepts = sysDeptMapper.selectDeptList(new SysDept()); - Map deptMap=new HashMap<>(); - if(CollectionUtil.isNotEmpty(sysDepts)){ + Map deptMap = new HashMap<>(); + if (CollectionUtil.isNotEmpty(sysDepts)) { for (SysDept sysDept : sysDepts) { - deptMap.put(String.valueOf(sysDept.getDeptId()),sysDept.getDeptName()); + deptMap.put(String.valueOf(sysDept.getDeptId()), sysDept.getDeptName()); } } StringBuffer applicantName = new StringBuffer(); - for (int i = 0; i < caseAffiliatListeselect.size(); i++){ + for (int i = 0; i < caseAffiliatListeselect.size(); i++) { CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i); int identityType = caseAffiliateselect.getIdentityType(); - if(identityType==1){ - if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){ + if (identityType == 1) { + 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,13 +902,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { /** * 给被申请人发送房间号短信 + * * @param messageVO * @return */ @Override public String sendRoomNoMessage(SendRoomNoMessageVO messageVO) { CaseAffiliate caseAffiliate = caseAffiliateMapper.selectCaseAffiliateByIdentityType(messageVO.getId(), 2); - if(null==caseAffiliate){ + if (null == caseAffiliate) { return "被申请人不存在"; } CaseApplication caseApplication = new CaseApplication(); @@ -926,6 +927,43 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { return "短信发送成功"; } + @Override + public SealSignRecord selectSignUrl(CaseApplication caseApplication) throws EsignDemoException { + SealSignRecord sealSignRecord = new SealSignRecord(); + sealSignRecord.setCaseAppliId(caseApplication.getId()); + Gson gson = new Gson(); + List sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecord); + SealSignRecord sealSignRecordReslt = new SealSignRecord(); + if (sealSignRecords != null && sealSignRecords.size() > 0) { + SealSignRecord sealSignRecordselect = sealSignRecords.get(0); + EsignHttpResponse signUrl = SignAward.signUrl(sealSignRecordselect); + JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); + JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); + String url = signUrlData.get("url").getAsString(); + sealSignRecordReslt.setSignUrl(url); + } + + return sealSignRecordReslt; + } + + @Override + public SealSignRecord selectSealUrl(CaseApplication caseApplication) throws EsignDemoException { + SealSignRecord sealSignRecord = new SealSignRecord(); + sealSignRecord.setCaseAppliId(caseApplication.getId()); + Gson gson = new Gson(); + List sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecord); + SealSignRecord sealSignRecordReslt = new SealSignRecord(); + if (sealSignRecords != null && sealSignRecords.size() > 0) { + SealSignRecord sealSignRecordselect = sealSignRecords.get(0); + EsignHttpResponse signUrl = SignAward.usesealUrl(sealSignRecordselect); + JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); + JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); + String url = signUrlData.get("url").getAsString(); + sealSignRecordReslt.setSealUrl(url); + } + return sealSignRecordReslt; + } + @Override @Transactional public int pendTralSure(CaseApplication caseApplication) { @@ -944,29 +982,29 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { String arbitratorId = caseApplicationselect.getArbitratorId(); // List arbitratorList = new ArrayList<>(); - if(StringUtils.isNotEmpty(arbitratorId)){ - String[] idStrList = arbitratorId.split(","); + if (StringUtils.isNotEmpty(arbitratorId)) { + String[] idStrList = arbitratorId.split(","); List idList = new ArrayList<>(); - for(int i = 0;i < idStrList.length;i ++ ){ + for (int i = 0; i < idStrList.length; i++) { idList.add(Long.parseLong(idStrList[i])); } // - // 查询仲裁员电话号 - List userList= sysUserMapper.selectUserListByIds(idList); - if(CollectionUtil.isNotEmpty(userList)) { - for (SysUser user : userList) { + // 查询仲裁员电话号 + List userList = sysUserMapper.selectUserListByIds(idList); + if (CollectionUtil.isNotEmpty(userList)) { + for (SysUser user : userList) { - //给仲裁员发送短信通知 - request.setPhone(user.getPhonenumber()); - // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。 - String name = user.getNickName(); - request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr}); - SmsUtils.sendSms(request); + //给仲裁员发送短信通知 + request.setPhone(user.getPhonenumber()); + // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。 + String name = user.getNickName(); + request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr}); + SmsUtils.sendSms(request); - } - } + } + } } @@ -974,20 +1012,20 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { CaseAffiliate caseAffiliate = new CaseAffiliate(); caseAffiliate.setCaseAppliId(caseApplication.getId()); List caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if(caseAffiliatListeselect!=null) { + if (caseAffiliatListeselect != null) { // 查询组织机构 List sysDepts = sysDeptMapper.selectDeptList(new SysDept()); - Map deptMap=new HashMap<>(); - if(CollectionUtil.isNotEmpty(sysDepts)){ + Map deptMap = new HashMap<>(); + if (CollectionUtil.isNotEmpty(sysDepts)) { for (SysDept sysDept : sysDepts) { - deptMap.put(String.valueOf(sysDept.getDeptId()),sysDept.getDeptName()); + deptMap.put(String.valueOf(sysDept.getDeptId()), sysDept.getDeptName()); } } for (int j = 0; j < caseAffiliatListeselect.size(); j++) { CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(j); int identityType = caseAffiliateselect.getIdentityType(); - if(identityType==1){ - if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){ + if (identityType == 1) { + if (StrUtil.isNotEmpty(caseAffiliateselect.getName()) && deptMap.containsKey(caseAffiliateselect.getName())) { caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName())); } @@ -1001,22 +1039,21 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } } // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CHECK_ARBITRATION_METHOD,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CHECK_ARBITRATION_METHOD, ""); return rows; } - @Override @Transactional public int pendingAppointArbotrar(CaseApplication caseApplication) { int pendingAppointArbotrar = caseApplication.getPendingAppointArbotrar(); List arbitrators = caseApplication.getArbitrators(); int rows = 0; - if(pendingAppointArbotrar==1){ - if(arbitrators!=null&&arbitrators.size()>0){ + if (pendingAppointArbotrar == 1) { + if (arbitrators != null && arbitrators.size() > 0) { List ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList()); List arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList()); String idstr = ids.stream().map(Object::toString).collect(Collectors.joining(",")); @@ -1028,7 +1065,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { rows = caseApplicationMapper.submitCaseApplication(caseApplication); } - }else { + } else { caseApplication.setCaseStatus(CaseApplicationConstants.PENDING_TRIAL); caseApplication.setPendingAppointArbotrar(2); rows = caseApplicationMapper.submitCaseApplication(caseApplication); @@ -1040,59 +1077,59 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } - private void assignmentCaseAffiliates(CaseApplication caseApplication, List caseAffiliatesnew, Map deptMap) { - // 申请人信息 + // 申请人信息 CaseAffiliate caseAffiliate = new CaseAffiliate(); // BeanUtils.copyBeanProp(caseApplication,caseAffiliate); - BeanUtils.copyBeanProp(caseAffiliate,caseApplication); + BeanUtils.copyBeanProp(caseAffiliate, caseApplication); caseAffiliate.setIdentityType(1); // 申请人(机构),需要判断部门中是否存在,不存在则新增,当身份类型为1的时候,查询时需要根据名称查询组织机构 - if(StrUtil.isNotEmpty(caseApplication.getName())){ + if (StrUtil.isNotEmpty(caseApplication.getName())) { setApplicantOrganization(caseAffiliate, caseApplication, deptMap); } caseAffiliatesnew.add(caseAffiliate); // 组装被申请人信息 - caseAffiliatesnew.add( buildDebtorInfo(caseApplication)); + caseAffiliatesnew.add(buildDebtorInfo(caseApplication)); caseApplication.setCaseAffiliates(caseAffiliatesnew); } /** * 设置申请人的组织机构 + * * @param caseAffiliate * @param caseApplication */ @DataScope(deptAlias = "d") - private void setApplicantOrganization(CaseAffiliate caseAffiliate, CaseApplication caseApplication, Map deptMap ) { + private void setApplicantOrganization(CaseAffiliate caseAffiliate, CaseApplication caseApplication, Map deptMap) { + // 将组织机构id设为申请人名称 + if (deptMap.containsKey(caseApplication.getName())) { + caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName()))); + } else { + // 如果不存在则新增 + SysDept dept = new SysDept(); + dept.setParentId(0L); + dept.setDeptName(caseApplication.getName()); + dept.setAncestors("0"); + dept.setOrderNum(1); + dept.setStatus("0"); + dept.setDelFlag("0"); + dept.setCreateBy(getUsername()); + dept.setUpdateBy(getUsername()); + sysDeptMapper.insertDept(dept); + deptMap.put(dept.getDeptName(), dept.getDeptId()); + caseAffiliate.setName(String.valueOf(dept.getDeptId())); - // 将组织机构id设为申请人名称 - if(deptMap.containsKey(caseApplication.getName())){ - caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName()))); - }else { - // 如果不存在则新增 - SysDept dept = new SysDept(); - dept.setParentId(0L); - dept.setDeptName(caseApplication.getName()); - dept.setAncestors("0"); - dept.setOrderNum(1); - dept.setStatus("0"); - dept.setDelFlag("0"); - dept.setCreateBy(getUsername()); - dept.setUpdateBy(getUsername()); - sysDeptMapper.insertDept(dept); - deptMap.put(dept.getDeptName(),dept.getDeptId()); - caseAffiliate.setName(String.valueOf(dept.getDeptId())); - - } + } } /** * 组装被申请人信息 + * * @param caseApplication * @return */ @@ -1134,24 +1171,23 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { Gson gson = new Gson(); - SealSignRecord sealSignRecord = new SealSignRecord(); sealSignRecord.setSignFlowid("41e6732b48c54c63a91b2379c352212d"); EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord); - JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class); + 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 signerObject = (JsonObject) signersArray.get(i); + Integer psnsignStatus; + Integer orgsignStatus; + if (!(signerObject.get("psnSigner").toString()).equals("null")) { JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner"); - if(psnSignerData!=null){ + if (psnSignerData != null) { psnsignStatus = signerObject.get("signStatus").getAsInt(); sealSignRecord.setPsnsignStatus(psnsignStatus); - if(psnsignStatus.intValue()==2){ + if (psnsignStatus.intValue() == 2) { //更新立案申请状态为待用印 CaseApplication caseApplication = new CaseApplication(); caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL); @@ -1162,9 +1198,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } } } - if(!(signerObject.get("orgSigner").toString()).equals("null")){ + if (!(signerObject.get("orgSigner").toString()).equals("null")) { JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner"); - if(orgSignerData!=null){ + if (orgSignerData != null) { orgsignStatus = signerObject.get("signStatus").getAsInt(); sealSignRecord.setOrgsignStatus(orgsignStatus); //更新立案申请状态为待送达 @@ -1186,8 +1222,4 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } - - - - }