From 084c22a00f6d03c7668be7bf7b5732f1066e7e6c Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Fri, 24 May 2024 15:39:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=B2=E8=A3=81=E7=B3=BB=E7=BB=9F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdjudicationController.java | 48 +- .../ArbitrateApplicationController.java | 5 +- .../CaseApplicationController.java | 77 +- .../CaseEvidenceController.java | 34 +- .../wisdomarbitrate/VideoController.java | 26 +- .../constant/CaseApplicationConstants.java | 4 + .../common/core/domain/entity/SysDept.java | 62 + .../common/core/domain/entity/SysUser.java | 69 + .../ruoyi/system/mapper/SysDeptMapper.java | 7 + .../ruoyi/system/mapper/SysUserMapper.java | 13 + .../system/mapper/SysUserRoleMapper.java | 9 + .../service/impl/SysUserServiceImpl.java | 22 +- .../domain/CaseApplication.java | 22 +- .../domain/dto/CaseApplicationDTO.java | 309 ++ .../domain/entity/CaseAffiliateEntity.java | 129 + .../domain/vo/CaseAffiliateBase.java | 33 + .../domain/vo/CaseAffiliateVO.java | 32 + .../mapper/CaseAffiliateLogMapper.java | 3 +- .../mapper/CaseAffiliateMapper.java | 36 +- .../mapper/CaseApplicationMapper.java | 35 +- .../mapper/CaseEvidenceMapper.java | 7 +- .../service/IAdjudicationService.java | 7 +- .../service/ICaseApplicationService.java | 75 +- .../service/ICaseEvidenceService.java | 4 +- .../service/impl/AdjudicationServiceImpl.java | 956 ++--- .../impl/CaseApplicationLogServiceImpl.java | 147 +- .../impl/CaseApplicationServiceImpl.java | 3344 +++++++++-------- .../impl/CaseArbitrateServiceImpl.java | 432 +-- .../service/impl/CaseEvidenceServiceImpl.java | 387 +- .../service/impl/CasePaymentServiceImpl.java | 147 +- .../service/impl/CaseZipImportImpl.java | 54 +- .../service/impl/DeptIdentifyServiceImpl.java | 4 +- .../service/impl/MsSignSealServiceImpl.java | 15 +- .../service/impl/VideoServiceImpl.java | 75 +- .../utils/FixSelectFlowDetailUtils.java | 4 +- .../resources/mapper/system/SysDeptMapper.xml | 20 +- .../resources/mapper/system/SysUserMapper.xml | 36 +- .../mapper/system/SysUserRoleMapper.xml | 10 +- .../wisdomarbitrate/ArbitrateRecordMapper.xml | 1 + .../CaseAffiliateLogMapper.xml | 19 +- .../wisdomarbitrate/CaseAffiliateMapper.xml | 276 +- .../wisdomarbitrate/CaseApplicationMapper.xml | 1559 +++----- .../wisdomarbitrate/CaseEvidenceMapper.xml | 75 - .../wisdomarbitrate/CaseLogRecordMapper.xml | 22 +- .../wisdomarbitrate/SealSignRecordMapper.xml | 9 +- 45 files changed, 4202 insertions(+), 4458 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/CaseApplicationDTO.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/CaseAffiliateEntity.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseAffiliateBase.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseAffiliateVO.java 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 5460b45..208af01 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 @@ -45,14 +45,14 @@ public class AdjudicationController extends BaseController { /** * 根据批号查询批量签名链接 */ - @PostMapping("/getSignUrlBatch") - public AjaxResult getSignUrlBatch(@RequestBody StringIdsReq idsReq) { - if(StrUtil.isEmpty(idsReq.getBatchNumber().toString())|| StrUtil.isEmpty(idsReq.getPsnAccount())){ - return error("参数校验失败"); - } - SealSignRecord sealSignRecordselect = adjudicationService.getSignUrlBatch(idsReq); - return success(sealSignRecordselect); - } +// @PostMapping("/getSignUrlBatch") +// public AjaxResult getSignUrlBatch(@RequestBody StringIdsReq idsReq) { +// if(StrUtil.isEmpty(idsReq.getBatchNumber().toString())|| StrUtil.isEmpty(idsReq.getPsnAccount())){ +// return error("参数校验失败"); +// } +// SealSignRecord sealSignRecordselect = adjudicationService.getSignUrlBatch(idsReq); +// return success(sealSignRecordselect); +// } /** * 根据签署流程id查询批量用印链接 @@ -127,15 +127,7 @@ public class AdjudicationController extends BaseController { return adjudicationService.batchDocument(caseApplication.getIds()); } - /** - * 重新生成裁决书 - * @param caseApplication - * @return - */ - @PostMapping("/regenerationDocument") - public AjaxResult regenerationDocument(@Validated @RequestBody CaseApplication caseApplication){ - return adjudicationService.regenerationDocument(caseApplication); - } + /** * 裁决书送达(电子邮件) @@ -152,12 +144,12 @@ public class AdjudicationController extends BaseController { * @param caseApplication * @return */ - @GetMapping("/logistics") -// @PreAuthorize("@ss.hasPermi('delivery:detail')") - public AjaxResult getLogisticsInfo(CaseApplication caseApplication){ - List logisticsInfo = adjudicationService.getLogisticsInfo(caseApplication); - return AjaxResult.success(logisticsInfo); - } +// @GetMapping("/logistics") +//// @PreAuthorize("@ss.hasPermi('delivery:detail')") +// public AjaxResult getLogisticsInfo(CaseApplication caseApplication){ +// List logisticsInfo = adjudicationService.getLogisticsInfo(caseApplication); +// return AjaxResult.success(logisticsInfo); +// } @@ -220,11 +212,11 @@ public class AdjudicationController extends BaseController { * @param id 案件id * @return */ - @GetMapping("/archives") - public AjaxResult getArchivesDetail(Long id){ - - return adjudicationService.getArchivesDetail(id); - } +// @GetMapping("/archives") +// public AjaxResult getArchivesDetail(Long id){ +// +// return adjudicationService.getArchivesDetail(id); +// } /** * 根据案件id获取邮箱 * @param id 案件id diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitrateApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitrateApplicationController.java index 993d31c..a3d82ad 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitrateApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitrateApplicationController.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.CheckSignatuerUtils; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; +import com.ruoyi.wisdomarbitrate.domain.dto.CaseApplicationDTO; import com.ruoyi.wisdomarbitrate.domain.vo.CaseApplicationVO; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; import org.springframework.beans.BeanUtils; @@ -32,10 +33,10 @@ public class ArbitrateApplicationController extends BaseController { String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); boolean checkResult= CheckSignatuerUtils.checkSignuter(paramsbody); if(checkResult){ - CaseApplication caseApplication = new CaseApplication(); + CaseApplicationDTO caseApplication = new CaseApplicationDTO(); BeanUtils.copyProperties(caseApplicationVO,caseApplication); caseApplication.setCreateBy(getUsername()); - return toAjax(caseApplicationService.insertcaseApplication1(caseApplication)); + return caseApplicationService.insertOrUpdate(caseApplication); }else { return AjaxResult.error("签名验证失败"); } 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 a490cc9..54332cb 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 @@ -12,6 +12,7 @@ import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.WxAppletNotifyUtils; import com.ruoyi.wisdomarbitrate.domain.*; +import com.ruoyi.wisdomarbitrate.domain.dto.CaseApplicationDTO; import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO; import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO; import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount; @@ -37,8 +38,17 @@ public class CaseApplicationController extends BaseController { private ICaseApplicationService caseApplicationService; @Autowired private IAdjudicationService adjudicationService; + /** + * 根据登录人返回用户信息 + */ + @GetMapping("/getUserInfo") + public AjaxResult getUserInfo() + { + return success(caseApplicationService.getUserInfo()); + } + /** * 查询立案数据 */ @@ -53,15 +63,15 @@ public class CaseApplicationController extends BaseController { return getDataTable(list); } - /** - * 查询批量管理案件列表 - */ - @GetMapping("/listBatch") - public TableDataInfo listBatch(CaseApplication caseApplication) { - startPage(); - List list = caseApplicationService.selectCaseApplicationListBatchByRole(caseApplication); - return getDataTable(list); - } +// /** +// * 查询批量管理案件列表 +// */ +// @GetMapping("/listBatch") +// public TableDataInfo listBatch(CaseApplication caseApplication) { +// startPage(); +// List list = caseApplicationService.selectCaseApplicationListBatchByRole(caseApplication); +// return getDataTable(list); +// } /** * 根据角色查询待办数量 @@ -81,24 +91,24 @@ public class CaseApplicationController extends BaseController { // @PreAuthorize("@ss.hasPermi('caseManagement:list:add')") @Log(title = "新增立案数据", businessType = BusinessType.INSERT) @PostMapping("/addCaseApplication") - public AjaxResult addCaseApplication(@Validated @RequestBody CaseApplication caseApplication) + public AjaxResult addCaseApplication(@Validated @RequestBody CaseApplicationDTO caseApplication) { caseApplication.setCreateBy(getUsername()); - return toAjax(caseApplicationService.insertcaseApplication(caseApplication)); + return caseApplicationService.insertOrUpdate(caseApplication); } /** * 修改立案数据 */ // @PreAuthorize("@ss.hasPermi('caseManagement:list:update')") - @Log(title = "修改立案数据", businessType = BusinessType.UPDATE) - @PostMapping("/editCaseApplication") - public AjaxResult editCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { - - caseApplication.setUpdateBy(getUsername()); - return caseApplicationService.editCaseApplication(caseApplication); - } +// @Log(title = "修改立案数据", businessType = BusinessType.UPDATE) +// @PostMapping("/editCaseApplication") +// public AjaxResult editCaseApplication(@Validated @RequestBody CaseApplicationDTO caseApplication) { +// +// caseApplication.setUpdateBy(getUsername()); +// return caseApplicationService.editCaseApplication(caseApplication); +// } /** * 修改立案数据自定义字段 @@ -132,7 +142,7 @@ public class CaseApplicationController extends BaseController { if(StringUtils.isEmpty(batchCaseApplication.getBatchNumber())){ return error("参数校验失败"); } - return toAjax(caseApplicationService.submitCaseApplicationBatch(batchCaseApplication.getBatchNumber())); + return caseApplicationService.submitCaseApplicationBatch(batchCaseApplication.getBatchNumber()); } @@ -411,15 +421,6 @@ public class CaseApplicationController extends BaseController { return success(caseApplicationService.submitCaseApplicationCheck(batchCaseApplication.getIds(),batchCaseApplication.getAgreeOrNotCheck(),batchCaseApplication.getCaseCheckReject())); } - /** - * 确认缴费查询立案信息 - */ -// @PreAuthorize("@ss.hasPermi('paymentManagement:list:detail')") - @PostMapping("/selectCaseApplicationConfirm") - public AjaxResult selectCaseApplicationConfirm(@Validated @RequestBody CaseApplication caseApplication) { - CaseApplication caseApplicationselect = caseApplicationService.selectCaseApplicationConfirm(caseApplication); - return success(caseApplicationselect); - } /** * 批量提交立案审查 @@ -430,18 +431,18 @@ public class CaseApplicationController extends BaseController { if(StringUtils.isEmpty(batchCaseApplication.getBatchNumber()) || batchCaseApplication.getAgreeOrNotCheck()==null){ return error("参数校验失败"); } - return success(caseApplicationService.submitCaseApplicationCheckBatch(batchCaseApplication.getBatchNumber(),batchCaseApplication.getAgreeOrNotCheck(),batchCaseApplication.getCaseCheckReject())); + return caseApplicationService.submitCaseApplicationCheckBatch(batchCaseApplication.getBatchNumber(),batchCaseApplication.getAgreeOrNotCheck(),batchCaseApplication.getCaseCheckReject()); } - /** - * 下载案件压缩包 - */ - @PostMapping("/downloadCaseZipFile") - public AjaxResult downloadCaseZipFile(@Validated @RequestBody CaseApplication caseApplication) { - - CaseAttach caseAttach = caseApplicationService.downloadCaseZipFile(caseApplication); - return success(caseAttach); - } +// /** +// * 下载案件压缩包 +// */ +// @PostMapping("/downloadCaseZipFile") +// public AjaxResult downloadCaseZipFile(@Validated @RequestBody CaseApplication caseApplication) { +// +// CaseAttach caseAttach = caseApplicationService.downloadCaseZipFile(caseApplication); +// return success(caseAttach); +// } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java index c7f29ec..a10e304 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java @@ -33,17 +33,17 @@ public class CaseEvidenceController extends BaseController { this.caseEvidenceService = caseEvidenceService; } - /** - * 根据案件id查询案件详情 - * - * @param id - * @return - */ - @GetMapping("/{id}") - public AjaxResult getCaseDetailsById(@PathVariable Long id) { - String username = this.getUsername(); - return caseEvidenceService.getCaseDetailsById(id, username); - } +// /** +// * 根据案件id查询案件详情 +// * +// * @param id +// * @return +// */ +// @GetMapping("/{id}") +// public AjaxResult getCaseDetailsById(@PathVariable Long id) { +// String username = this.getUsername(); +// return caseEvidenceService.getCaseDetailsById(id, username); +// } /** * 案件证据上传 @@ -121,12 +121,12 @@ public class CaseEvidenceController extends BaseController { * @param caseStatus * @return */ - @GetMapping("/all") - public AjaxResult getCaseListAll(@RequestParam("caseStatus") Integer caseStatus) { - - return success(caseEvidenceService.getCaseListAll(caseStatus)); - - } +// @GetMapping("/all") +// public AjaxResult getCaseListAll(@RequestParam("caseStatus") Integer caseStatus) { +// +// return success(caseEvidenceService.getCaseListAll(caseStatus)); +// +// } /** * 证据确认 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/VideoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/VideoController.java index 25b30c8..6b40fc7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/VideoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/VideoController.java @@ -133,7 +133,6 @@ public class VideoController extends BaseController { @Anonymous @GetMapping("secretaryRoleByUserId") public AjaxResult secretaryRoleByUserId( @RequestParam(value = "userId",required = true) Long userId,@RequestParam(value = "caseId",required = true) Long caseId) { - return videoService.secretaryRoleByUserId(userId,caseId); } /** @@ -186,6 +185,7 @@ public class VideoController extends BaseController { // 上传文件路径 String filePath = RuoYiConfig.getUploadPath(); + String name=file.getOriginalFilename(); // 上传并返回新文件名称 String fileName = FileUploadUtils.upload(filePath, file); String suffix = getFileExtension(fileName); @@ -205,18 +205,22 @@ public class VideoController extends BaseController { CaseAttach caseAttach=null; for (Object obj : jsonArray) { JSONObject jsonObject = (JSONObject) obj; + String path = jsonObject.get("filePath")!=null?jsonObject.getString("filePath"):""; + path=path.replace("/home/ruoyi/uploadPath/","profile/"); caseAttach = CaseAttach.builder() .caseAppliId(caseId) - .annexName(jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):"") +// .annexName(jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):"") + .annexName(name) .annexType(annexType) .onlyOfficeFileId(jsonObject.getString("fileId")) + .annexPath(path) .build(); - if(jsonObject.get("filePath")!=null){ - String officePath = jsonObject.getString("filePath"); - String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); - caseAttach.setAnnexPath(replace); - - } +// if(jsonObject.get("filePath")!=null){ +// String officePath = jsonObject.getString("filePath"); +// String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); +// caseAttach.setAnnexPath(replace); +// +// } caseAttachMapper.save(caseAttach); } if(caseAttach==null){ @@ -226,7 +230,7 @@ public class VideoController extends BaseController { ajax.put("annexId", caseAttach.getAnnexId()); ajax.put("annexType", annexType); // ajax.put("url", url); - ajax.put("fileName", fileName); + ajax.put("fileName", name); ajax.put("newFileName", FileUtils.getName(fileName)); ajax.put("originalFilename", file.getOriginalFilename()); return ajax; @@ -245,13 +249,13 @@ public class VideoController extends BaseController { caseAttachMapper.deleteCaseAttachByCasedIdAndType(caseId, annexType); } } - Long annexId = saveCaseAttach(annexType, fileName, file.getOriginalFilename(), caseId); + Long annexId = saveCaseAttach(annexType, name, file.getOriginalFilename(), caseId); AjaxResult ajax = AjaxResult.success(); ajax.put("annexId", annexId); ajax.put("annexType", annexType); ajax.put("url", url); - ajax.put("fileName", fileName); + ajax.put("fileName", name); ajax.put("newFileName", FileUtils.getName(fileName)); ajax.put("originalFilename", file.getOriginalFilename()); return ajax; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CaseApplicationConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CaseApplicationConstants.java index 0952ae7..c08a512 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CaseApplicationConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CaseApplicationConstants.java @@ -6,6 +6,10 @@ package com.ruoyi.common.constant; public class CaseApplicationConstants { /** 申请人/代理人,立案申请 */ public static final int CASE_APPLICATION = 0; + /** + * 案件新增 + */ + public static final int CASE_INSERT = -2; /** 申请人/代理人,案件修改 */ public static final int CASE_EDIT = -1; /** 顾问,待立案审查 */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index f98291a..2b94d71 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -54,6 +54,68 @@ public class SysDept extends BaseEntity /** 父部门名称 */ private String parentName; + /** + * 代码(统一社会信用代码或者身份证号) + */ + private String code; + + /** + * 法定代表人 + */ + private String compLegalPerson; + /** + * 住所 + */ + private String home; + /** + * 联系地址 + */ + private String address; + /** + * + * 国籍,0-国内,1-国外 + */ + private Integer nationality; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getCompLegalPerson() { + return compLegalPerson; + } + + public void setCompLegalPerson(String compLegalPerson) { + this.compLegalPerson = compLegalPerson; + } + + public String getHome() { + return home; + } + + public void setHome(String home) { + this.home = home; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Integer getNationality() { + return nationality; + } + + public void setNationality(Integer nationality) { + this.nationality = nationality; + } public Integer getDeptType() { return deptType; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java index 4fd0af0..1073d80 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java @@ -49,6 +49,23 @@ public class SysUser extends BaseEntity public void setNickNameAndNum(String nickNameAndNum) { this.nickNameAndNum = nickNameAndNum; } + /** 身份类别,0-身份证,1-护照,默认0 */ + private Integer idType; + /** 国籍,0-国内,1-国外,默认0 */ + + private Integer nationality; + /** + * 生日 + */ + private Date birth; + /** + * 住所 + */ + private String home; + /** + * 联系地址 + */ + private String address; /** 用户身份证号 */ @Excel(name = "身份证号") @@ -105,12 +122,64 @@ public class SysUser extends BaseEntity /** 角色ID */ private Long roleId; + /** + * 职位 + */ + private String position; + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } public SysUser() { } + public Integer getIdType() { + return idType; + } + + public void setIdType(Integer idType) { + this.idType = idType; + } + + public Integer getNationality() { + return nationality; + } + + public void setNationality(Integer nationality) { + this.nationality = nationality; + } + + public Date getBirth() { + return birth; + } + + public void setBirth(Date birth) { + this.birth = birth; + } + + public String getHome() { + return home; + } + + public void setHome(String home) { + this.home = home; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + public SysUser(Long userId) { this.userId = userId; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java index 4ef0d06..4270b36 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java @@ -124,4 +124,11 @@ public interface SysDeptMapper * @return */ int batchSave(@Param("list")List sysDepts); + + /** + * 根据部门名称查询部门信息 + * @param deptName + * @return + */ + public SysDept selectDeptByName(@Param("deptName") String deptName); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java index e23c18f..cf2cc6b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java @@ -171,4 +171,17 @@ public interface SysUserMapper * @return */ int batchSave(@Param("list")List addUsers); + /** + * 根据邮箱查询用户信息 + * @param email + * @return + */ + SysUser selectUserByEmail(String email); + + /** + * 根据角色查询用户 + * @param 法律顾问 + * @return + */ + SysUser selectUserByRole(String 法律顾问); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java index 3143ec8..8942a7b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java @@ -59,4 +59,13 @@ public interface SysUserRoleMapper * @return 结果 */ public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds); + + /** + * 根据用户id查询关联的角色id + * @param userId + * @return + */ + List selectRoleIdsByUserId(Long userId); + + void insertUserRole(@Param("userId") Long userId,@Param("roleId") Long roleId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index a5ad9b0..0684335 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -13,8 +13,10 @@ import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.system.mapper.*; import com.ruoyi.wisdomarbitrate.domain.Arbitrator; import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate; +import com.ruoyi.wisdomarbitrate.domain.entity.CaseAffiliateEntity; import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper; import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper; +import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -73,6 +75,8 @@ public class SysUserServiceImpl implements ISysUserService { @Autowired protected Validator validator; + @Autowired + protected ICaseApplicationService caseApplicationService; /** * 根据条件分页查询用户列表 @@ -94,25 +98,21 @@ public class SysUserServiceImpl implements ISysUserService { @Override public List selectUserListByAdRole(Arbitrator arbitrator) { // 根据案件id查询案件 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(arbitrator.getCaseId()); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - List phoneList=new ArrayList<>(); + List caseAffiliates = caseApplicationService.selectAfflicatesByCaseId(arbitrator.getCaseId()); + List userIds=new ArrayList<>(); if(CollectionUtil.isNotEmpty(caseAffiliates)){ - for (CaseAffiliate affiliate : caseAffiliates) { - if(StrUtil.isNotEmpty(affiliate.getContactTelphone())) { - phoneList.add(affiliate.getContactTelphone()); - } - if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) { - phoneList.add(affiliate.getContactTelphoneAgent()); + for (CaseAffiliateEntity affiliate : caseAffiliates) { + if(null!=affiliate.getUserId()) { + userIds.add(affiliate.getUserId()); } + } } List sysUsers = userMapper.selectUserListByAdRole(arbitrator); List arbitrators = new ArrayList<>(); if(CollectionUtil.isNotEmpty(sysUsers)){ for(SysUser sysUser: sysUsers){ - if(!phoneList.contains(sysUser.getPhonenumber())) { + if(!userIds.contains(sysUser.getUserId())) { Long userId = sysUser.getUserId(); int todoCount = caseApplicationMapper.selectCasenum(userId.toString()); String nickName = sysUser.getNickName(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java index 7f1cf71..4d9b7e6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java @@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.domain; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.wisdomarbitrate.domain.vo.CaseAffiliateVO; import lombok.Data; import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; @@ -17,6 +18,19 @@ public class CaseApplication extends BaseEntity { * 查询案件时区分是否待办案件,0待办案件,1已办案件 */ private String selectCaseStatus; + /** + * 房间号 + */ + private String roomId; + /** + * 仲裁员,0-否,1-是 + */ + private Integer arbitratorFlag; + /** + * 第三方代理人,0-否,1-是 + */ + private Integer agentFlag; + /** ID */ private Long id; @@ -26,6 +40,10 @@ public class CaseApplication extends BaseEntity { /** 案件编号 */ // @Excel(name = "案件编号") private String caseNum; + /** + * 是否同意,0-否 + */ + private Integer opinion; /** 案件标的 */ @Excel(name = "案件标的") private BigDecimal caseSubjectAmount; @@ -188,7 +206,7 @@ public class CaseApplication extends BaseEntity { /** * 用户id */ - private String userId; + private Long userId; /** * 登录用户用户名 */ @@ -223,7 +241,7 @@ public class CaseApplication extends BaseEntity { /** 是否指派仲裁员 */ private int pendingAppointArbotrar; /** 案件关联人信息 */ - private List caseAffiliates; + private CaseAffiliateVO affiliate; /** 案件仲裁员 */ private List arbitrators; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/CaseApplicationDTO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/CaseApplicationDTO.java new file mode 100644 index 0000000..3ea30ce --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/CaseApplicationDTO.java @@ -0,0 +1,309 @@ +package com.ruoyi.wisdomarbitrate.domain.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.wisdomarbitrate.domain.CaseAttach; +import com.ruoyi.wisdomarbitrate.domain.vo.CaseAffiliateVO; +import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @Classname CaseApplicationDTO + * @Description 案件申请表 + * @Version 1.0.0 + * @Date 2024/5/22 9:19 + * @Created wangqiong + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CaseApplicationDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id + */ + private Long id; + + /** + * 案件编号 + */ + private String caseNum; + + /** + * 案件标的 + */ + private BigDecimal caseSubjectAmount; + + /** + * 立案日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private Date registerDate; + + /** + * 仲裁方式,视频仲裁(1)、书面仲裁(2) + */ + private Long arbitratMethod; + + /** + * 案件状态,立案申请(0)、待立案审查(1)、 待缴费(2)、待缴费确认(3)、 待案件质证(4)、 + */ + private Integer caseStatus; + + /** + * 开庭日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private Date hearDate; + + /** + * 申请人仲裁请求及事实和理由 + */ + private String arbitratClaims; + + /** + * 借款开始日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private Date loanStartDate; + + /** + * 借款结束日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private Date loanEndDate; + + /** + * 申请人主张欠本金 + */ + private BigDecimal claimPrinciOwed; + + /** + * 申请人主张欠利息 + */ + private BigDecimal claimInterestOwed; + + /** + * 申请人主张违约金 + */ + private BigDecimal claimLiquidDamag; + + /** + * 仲裁应缴费用 + */ + private BigDecimal feePayable; + + + /** + * 合同编号 + */ + private String contractNumber; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private Date createTime; + + /** + * 更新者 + */ + private String updateBy; + + /** + * 更新时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private Date updateTime; + + /** + * 创建者 + */ + private String createBy; + + /** + * 仲裁员id + */ + private String arbitratorId; + + /** + * 案件名称 + */ + private String caseName; + + /** + * 仲裁结果 + */ + private String caseResult; + + /** + * 是否同意组庭,0否,1是 + */ + private Integer isAgreePendTral; + + /** + * 是否有异议需要举证,1是,0否 + */ + private Integer objectionAddEviden; + + + /** + * 案件实缴费用 + */ + private BigDecimal paidExpenses; + + /** + * 裁决书URL + */ + private String filearbitraUrl; + + /** + * 支付方式(0线上支付,1线下支付) + */ + private String payType; + + /** + * 申请人请求仲裁庭裁决 + */ + private String requestRule; + + /** + * 是否仲裁反请求,1是,0否 + */ + private Integer adjudicaCounter; + + /** + * 仲裁反请求原因 + */ + private String adjudicaCounterReason; + + /** + * 是否财产保全申请,1是,0否 + */ + private Integer properPreser; + + /** + * 是否管辖异议申请,1是,0否 + */ + private Integer objectiJuris; + + /** + * 被申请人是否缺席,1是,0否 + */ + private Integer isAbsence; + + /** + * 被申请人质证意见 + */ + private String responCrossOpin; + + /** + * 申请人质证意见 + */ + private String applicaCrossOpin; + + /** + * 被申请人的答辩意见 + */ + private String responDefenOpini; + + /** + * 申请人是否缺席,1是,0否 + */ + private Integer appliIsAbsen; + + /** + * 是否锁定,0-否,1-是 + */ + private Integer lockStatus; + + /** + * 视频会议房间号id + */ + private String roomId; + + /** + * 是否导入,0手动录入,1导入,默认0 + */ + private Integer importFlag=0; + + /** + * 版本号 + */ + private Integer version; + + /** + * 事实和理由 + */ + private String facts; + + /** + * 批次 + */ + private Integer batchNumber; + + /** + * 模板id + */ + private Long templateId; + + /** + * 调解内容 + */ + private String mediationAgreement; + + /** + * 申请人是否书面审理 ,0否,1是 + */ + private Integer appliIswritHear; + + /** + * 被申请人是否书面审理 + */ + private Integer responIsWritHear; + + /** + * 案件附件相关表 + */ + private List caseAttachList; + /** + * 附件类型 + */ + private List annexTypeList; + /** + * 附件类型 + */ + private Integer annexType; + /** + * 自定义字段 + */ + private List columnValueList; + /** + * 案件相关人员 + */ + private CaseAffiliateVO affiliate; + /** + * 待办状态,0-待办,1-已办 + */ + private Integer pendingStatus; + /** + * 仲裁方式名称,1-线上调解,2-线下调解 + */ + private String arbitratMethodName; + /** + * 申请机构名称 + */ + private String applicationName; + /** + * 被申请人姓名 + */ + private String respondentName; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/CaseAffiliateEntity.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/CaseAffiliateEntity.java new file mode 100644 index 0000000..c11dce4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/CaseAffiliateEntity.java @@ -0,0 +1,129 @@ +package com.ruoyi.wisdomarbitrate.domain.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.util.Date; + +@Getter +@Setter +@ToString +@Data +public class CaseAffiliateEntity { + /** + * id + */ + private Long id; + /** + * 案件主表id,案件申请表主键 + */ + private Long caseAppliId; + /** + * 案件日志表id + */ + private Long caseAppliLogId; + /** + * 用户id,用户表user_id关联 + */ + private Long userId; + /** + * 申请机构id,和部门表id关联 + */ + private Long applicantDeptId; + + /** + * 代码(统一社会信用代码或者身份证号) + */ + private String code; + /** + * 用户名 + */ + private String userName; + + /** + * 法定代表人 + */ + private String compLegalPerson; + /** + * 角色类别,1-申请操作人/申请人,2-申请人代理人,3-被申请人操作人/被申请人,4-被申请人代理人 + */ + private Integer roleType=1; + /** + * 组别 + */ + private Integer groupOrder; + /** + * 是否操作人,0-否,1-是 + */ + private Integer operatorFlag=1; + /** + * 是否机构申请,0-自然人,1-申请机构,默认0 + */ + private Integer organizeFlag=0; + /** + * 电话 + */ + private String phone; + /** + * 邮箱 + */ + private String email; + /** + * 姓名 + */ + private String name; + /** + * 住所 + */ + private String home; + /** + * 联系地址 + */ + private String address; + /** + * 身份证号 + */ + private String idCard; + + /** + * '身份类别,0-身份证,1-护照,默认0' + */ + private Integer idType; + /** + * 国籍,0-境内,1-境外,默认0 + */ + private Integer nationality; + /** + * 生日 + */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai") + private Date birth; + /** + * 性别,0-男,1-女 + */ + private String sex; + /** + * 被申请人姓名 + */ + private String resName; + /** + * 角色名称 + */ + private String roleName; + /** + * 申请机构名称 + */ + private String applicantOrgName; + /** + * 角色id + */ + private Long roleId; + /** + * 职位 + */ + private String position; + +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseAffiliateBase.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseAffiliateBase.java new file mode 100644 index 0000000..70a2324 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseAffiliateBase.java @@ -0,0 +1,33 @@ +package com.ruoyi.wisdomarbitrate.domain.vo; + +import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate; +import com.ruoyi.wisdomarbitrate.domain.entity.CaseAffiliateEntity; +import lombok.Data; + +/** + * @Classname MsCaseAffiliateList + * @Description 案件人员表 + * @Version 1.0.0 + * @Date 2024/3/27 16:08 + * @Created wangqiong + */ +@Data +public class CaseAffiliateBase { + /** + * 申请人/操作人 + */ + private CaseAffiliateEntity applicant; + /** + * 申请人代理人 + */ + private CaseAffiliateEntity applicantAgent; + /** + * 被申请人/操作人 + */ + private CaseAffiliateEntity res; + /** + * 被申请人代理人 + */ + private CaseAffiliateEntity resAgent; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseAffiliateVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseAffiliateVO.java new file mode 100644 index 0000000..6f099f9 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseAffiliateVO.java @@ -0,0 +1,32 @@ +package com.ruoyi.wisdomarbitrate.domain.vo; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.util.List; + +/** + * @Classname MsCaseAffiliateVO + * @Description 案件人员表 + * @Version 1.0.0 + * @Date 2024/3/22 11:46 + * @Created wangqiong + */ +@Getter +@Setter +@ToString +@Data +public class CaseAffiliateVO { + /** + * 申请人/操作人 + */ + private List applicant; + + /** + * 被申请人/操作人 + */ + private List res; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateLogMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateLogMapper.java index 7e5affd..b56b105 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateLogMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateLogMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.mapper; import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; +import com.ruoyi.wisdomarbitrate.domain.entity.CaseAffiliateEntity; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -10,7 +11,7 @@ import java.util.List; public interface CaseAffiliateLogMapper { - int batchCaseAffiliate(List caseAffiliates); + int batchCaseAffiliate(List caseAffiliates); void deletecaseAffiliate(CaseApplication caseApplication); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateMapper.java index 97eca71..f98a5cf 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateMapper.java @@ -3,6 +3,8 @@ package com.ruoyi.wisdomarbitrate.mapper; import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication; import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; +import com.ruoyi.wisdomarbitrate.domain.dto.CaseApplicationDTO; +import com.ruoyi.wisdomarbitrate.domain.entity.CaseAffiliateEntity; import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO; import org.apache.ibatis.annotations.Param; @@ -18,28 +20,26 @@ public interface CaseAffiliateMapper { void batchDeletecaseAffiliate(@Param("ids") List ids); - List selectCaseAffiliate(CaseAffiliate caseAffiliate); - List selectCaseAffiliateByCaseIds(@Param("ids") List ids); - CaseAffiliate selectCaseAffiliateByIdentityType(@Param("caseAppliId") Long caseAppliId, @Param("identityType")int identityType); - - int updataCaseAffiliate(CaseAffiliate caseAffiliate); - - /** - * 根据案件查询邮箱 - * @param id - * @return - */ - List emailByCaseId(@Param("caseAppliId")Long id); - - /** - * 批量修改 - * @param affiliateLogList - */ - void updateCaseAffiliateByCaseId(@Param("caseAppliId")Long caseAppliId,@Param("list") List affiliateLogList); + List selectCaseAffiliate(CaseAffiliateEntity entity); + List selectCaseAffiliateByCaseIds(@Param("caseIds") List ids); /** * 根据案件id删除 * @param caseId */ void deleteByCaseId(@Param("caseAppliId") Long caseId); + + /** + * 新增人员 + * @param affiliate + */ + + void insert(CaseAffiliateEntity affiliate); + + /** + * 根据案件id查询邮箱 + * @param id + * @return + */ + List emailByCaseId(Long id); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseApplicationMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseApplicationMapper.java index 630dd6a..f771d46 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseApplicationMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseApplicationMapper.java @@ -4,6 +4,7 @@ import com.ruoyi.wisdomarbitrate.domain.Arbitrator; import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication; import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; +import com.ruoyi.wisdomarbitrate.domain.dto.CaseApplicationDTO; import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO; import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount; import org.apache.ibatis.annotations.Param; @@ -11,17 +12,9 @@ import org.apache.ibatis.annotations.Param; import java.util.List; public interface CaseApplicationMapper { - List selectCaseApplicationList(CaseApplication caseApplication); int selectCaseApplicationCount(CaseApplication caseApplication); - /** - * 查询超级管理员案件 - * @param caseApplication - * @return - */ - List selectAdminCaseApplicationList(CaseApplication caseApplication); - int insertCaseApplication(CaseApplication caseApplication); @@ -40,7 +33,7 @@ public interface CaseApplicationMapper { */ List listCaseApplicationByIds(@Param("ids")List ids); - CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication); + /** * 查询最大编号 @@ -64,12 +57,11 @@ public interface CaseApplicationMapper { void updatePayType(CaseConfirmPayDTO payDTO); - ToDoCount selectAdminCaseToDoCount(); ToDoCount selectTodoCountByRole(@Param("caseApplication") CaseApplication caseApplication, @Param("caseStatusList") List caseStatusList, - @Param("roleNames") List roleNames); + @Param("roleIds") List roleIds); /** * 修改案件锁定状态 @@ -100,12 +92,6 @@ public interface CaseApplicationMapper { */ Long selectCaseIdByRoomId(@Param("roomId")String roomId); - /** - * 查询已办案件 - * @param caseApplication - * @return - */ - List selectHandledCase(CaseApplication caseApplication); /** * 查询最大房间号 * @return @@ -124,7 +110,7 @@ public interface CaseApplicationMapper { * 查询最大批号 * @return */ - Integer selectBatchNumberLike(); + Integer selectMaxBatchNumber(); /** * 批量新增案件 @@ -139,7 +125,7 @@ public interface CaseApplicationMapper { List listCaseApplicationByBatchNumber(CaseApplication caseApplication); - List selectAdminCaseApplicationListBatch1(CaseApplication caseApplication); + /** * 案件列表查询 @@ -148,7 +134,7 @@ public interface CaseApplicationMapper { */ List list(@Param("caseApplication") CaseApplication caseApplication, @Param("caseStatusList") List caseStatusList, - @Param("roleNames") List roleNames); + @Param("roleIds") List roleIds); /** * 查询当前案件节点 @@ -156,4 +142,13 @@ public interface CaseApplicationMapper { * @return */ Integer selectCaseApplicationCaseStatus(@Param("id") Long id); + + /** + * 新增 + * @param caseApplication + * @return + */ + int insert(CaseApplicationDTO caseApplication); + int update(CaseApplicationDTO caseApplication); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseEvidenceMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseEvidenceMapper.java index 61d6c8d..77ee77a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseEvidenceMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseEvidenceMapper.java @@ -9,10 +9,5 @@ import java.util.List; @Mapper public interface CaseEvidenceMapper { - List getCaseListByRespondent(@Param(value = "identityNum" ) String identityNum - , @Param(value = "caseStatusList") List caseStatusList - , @Param(value = "identityType" ) Integer identityType - , @Param(value = "phone" ) String phone - , @Param(value = "loginUserName" ) String loginUserName - ); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java index 9cf782e..9478c73 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java @@ -16,19 +16,16 @@ public interface IAdjudicationService { AjaxResult sendDocumentByEmail(Long id,String appEmail,String resEmail ,String apptrackingNum,String restrackingNum); - List getLogisticsInfo(CaseApplication caseApplication); +// List getLogisticsInfo(CaseApplication caseApplication); - AjaxResult signature(CaseApplication caseApplication); AjaxResult caseFile( List ids); AjaxResult service(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum); - AjaxResult stamp(CaseApplication caseApplication); - AjaxResult getArchivesDetail(Long id); - AjaxResult regenerationDocument(CaseApplication caseApplication); + /** * 根据案件id查询邮箱 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java index c3667e2..6ff1f1c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java @@ -2,12 +2,12 @@ package com.ruoyi.wisdomarbitrate.service; import com.alibaba.fastjson.JSONArray; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.wisdomarbitrate.domain.*; -import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; -import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO; -import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO; -import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount; +import com.ruoyi.wisdomarbitrate.domain.dto.CaseApplicationDTO; +import com.ruoyi.wisdomarbitrate.domain.entity.CaseAffiliateEntity; +import com.ruoyi.wisdomarbitrate.domain.vo.*; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; @@ -16,17 +16,15 @@ import java.util.List; import java.util.Map; public interface ICaseApplicationService { - List selectCaseApplicationList(CaseApplication caseApplication); - List selectCaseApplicationListByRole(CaseApplication caseApplication); - int insertcaseApplication(CaseApplication caseApplication); +// int insertcaseApplication(CaseApplication caseApplication); - int insertcaseApplication1(CaseApplication caseApplication); +// int insertcaseApplication1(CaseApplication caseApplication); int selectCaseApplicationCount(CaseApplication caseApplication); - AjaxResult editCaseApplication(CaseApplication caseApplication); +// AjaxResult editCaseApplication(CaseApplication caseApplication); int submitCaseApplication( List ids); @@ -50,8 +48,6 @@ public interface ICaseApplicationService { int submitCaseApplicationCheck(List ids, Integer agreeOrNotCheck,String caseCheckReject); - CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication); - String sendRoomNoMessage(SendRoomNoMessageVO messageVO); SealSignRecord selectSignUrl(CaseApplication caseApplication) throws EsignDemoException; @@ -139,13 +135,13 @@ public interface ICaseApplicationService { CaseAttach downloadCaseZipFile(CaseApplication caseApplication); - List selectCaseApplicationListBatchByRole(CaseApplication caseApplication); +// List selectCaseApplicationListBatchByRole(CaseApplication caseApplication); public List page(CaseApplication caseApplication) ; - int submitCaseApplicationBatch(String batchNumber); + AjaxResult submitCaseApplicationBatch(String batchNumber); - int submitCaseApplicationCheckBatch(String batchNumber, Integer agreeOrNotCheck, String caseCheckReject); + AjaxResult submitCaseApplicationCheckBatch(String batchNumber, Integer agreeOrNotCheck, String caseCheckReject); int pendTralCheckBatch(CaseApplication caseApplication); @@ -168,4 +164,55 @@ public interface ICaseApplicationService { */ AjaxResult saveOnlyOfficeFile(CaseAttach caseAttach); + + /** + * 新增或编辑 + * @param caseApplication + * @return + */ + + AjaxResult insertOrUpdate(CaseApplicationDTO caseApplication); + + /** + * 设置案件相关信息 + * @param caseApplication + * @param affiliate + * @param groupOrder 组别 + * @param operatorCount 操作人数量 + * @param updateFlag 是否修改案件 + */ + public int setCaseAfflicate(List affliates,CaseApplicationDTO caseApplication, CaseAffiliateEntity affiliate, int groupOrder, int operatorCount, boolean updateFlag); + + /** + * 新增案件 + * @param caseApplication + */ + void insert(CaseApplicationDTO caseApplication); + + /** + * 修改案件 + * @param caseApplication + */ + + void update(CaseApplicationDTO caseApplication); + /** + * 新增案件相关人员信息 + * @param affiliate 相关人员信息 + * @param roleIdList 角色id + * @param updateFlag 是否修改案件 + + */ + public void insertAfficateUser(CaseAffiliateEntity affiliate, List roleIdList,boolean updateFlag); + + void insertCaseAfflicate(CaseAffiliateVO caseAffiliateVO, List affliates,CaseApplicationDTO caseApplication); + + /** + * 根据案件id查询相关人员 + * @param id + * @return + */ + + List selectAfflicatesByCaseId(Long id); + + SysUser getUserInfo(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseEvidenceService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseEvidenceService.java index 7d8affe..fefde22 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseEvidenceService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseEvidenceService.java @@ -13,11 +13,11 @@ import java.util.List; public interface ICaseEvidenceService { - AjaxResult getCaseDetailsById(Long id,String userName); +// AjaxResult getCaseDetailsById(Long id,String userName); AjaxResult uploadEvidence(MultipartFile file, Integer annexType, Long id,String userName,Long userId); - List getCaseListAll(Integer caseStatus); +// List getCaseListAll(Integer caseStatus); AjaxResult evidenceConfirmation(CaseApplication caseApplication); 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 b43e75b..8da713d 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 @@ -26,6 +26,8 @@ import com.ruoyi.common.utils.thread.MultipleThreadListParam; import com.ruoyi.system.mapper.SysDictDataMapper; import com.ruoyi.wisdomarbitrate.StringIdsReq; import com.ruoyi.wisdomarbitrate.domain.*; +import com.ruoyi.wisdomarbitrate.domain.dto.CaseApplicationDTO; +import com.ruoyi.wisdomarbitrate.domain.entity.CaseAffiliateEntity; import com.ruoyi.wisdomarbitrate.domain.vo.ArchivesDetailVO; import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO; import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; @@ -104,7 +106,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService { @Autowired private SealSignRecordMapper sealSignRecordMapper; - + @Autowired + private IAdjudicationService adjudicationService; // 仲裁反请求模板内容 private final String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" + "《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" + "仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。"; // 财产保全内容 @@ -139,6 +142,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { /** * 生成裁决书 + * * @param caseApplicationReq * @return */ @@ -183,9 +187,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } templateName = templateManages.get(0).getFileName(); // 查询案件相关表信息 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(id); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); + List caseAffiliates = caseApplicationService.selectAfflicatesByCaseId(id); //获取仲裁记录表里的相关信息 ArbitrateRecord arbitrateRecord = new ArbitrateRecord(); arbitrateRecord.setCaseAppliId(id); @@ -256,35 +258,38 @@ public class AdjudicationServiceImpl implements IAdjudicationService { // String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName; // 将word中的标签替换掉,生成新的word String docFilePath = wordChangeText(templatePath, datas, saveFolderPath, fileName); - String annexPath=saveName.replace("/profile/upload/","/home/ruoyi/uploadPath/upload/"); + String annexPath = saveName.replace("/profile/upload/", "/home/ruoyi/uploadPath/upload/"); // 上传到onlyoffice - JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath,caseApplicationReq.getId()); - CaseAttach caseAttach=null; - if(jsonArray!=null && jsonArray.size() > 0){ + JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath, caseApplicationReq.getId()); + CaseAttach caseAttach = null; + if (jsonArray != null && jsonArray.size() > 0) { for (Object obj : jsonArray) { JSONObject jsonObject = (JSONObject) obj; - caseAttach= CaseAttach.builder() + String path = jsonObject.get("filePath")!=null?jsonObject.getString("filePath"):""; + path=path.replace("/home/ruoyi/uploadPath/","/profile/"); + String name = jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):""; + caseAttach = CaseAttach.builder() .caseAppliId(caseApplicationReq.getId()) - .annexName(jsonObject.getString("fileName")) - .annexPath("/home/ruoyi/uploadPath/onlyoffice/") + .annexName(name) + .annexPath(path) .annexType(3) .onlyOfficeFileId(jsonObject.getString("fileId")) .build(); - if(jsonObject.get("filePath")!=null){ - String officePath = jsonObject.getString("filePath"); - String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); - caseAttach.setAnnexName(replace); - - } +// if (jsonObject.get("filePath") != null) { +// String officePath = jsonObject.getString("filePath"); +// String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); +// caseAttach.setAnnexName(replace); +// +// } } } - if(caseAttach!=null) { + if (caseAttach != null) { // 保存裁决书附件 saveArbitorFile(caseAttach, caseApplicationById, arbitrateRecordSelect, CaseApplicationConstants.VERPRIF_ARBITRATION); - }else { + } else { return AjaxResult.error("上传onlyoffice服务器失败"); } @@ -383,7 +388,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { String replace = onLine.replace(onLineDate, Optional.of(hearDateStr).orElse("")); datas.put("线上开庭并线上仲裁", replace); // 所有附件 - List caseAttachList = caseApplicationById.getCaseAttachList(); + List caseAttachList = caseAttachMapper.queryAnnexPathByCaseId(caseApplicationById.getId()); Map> caseAttachMap = new HashMap<>(); if (caseAttachList != null && caseAttachList.size() > 0) { caseAttachMap = caseAttachList.stream().collect(Collectors.groupingBy(CaseAttach::getAnnexType)); @@ -495,38 +500,45 @@ public class AdjudicationServiceImpl implements IAdjudicationService { * @param caseAffiliates 关联人员 * @param valueMap 组装的值 */ - private void buildDefaultColumnValue(List dictDataList, List caseAffiliates, Map valueMap, CaseApplication caseApplication) { + private void buildDefaultColumnValue(List dictDataList, List caseAffiliates, Map valueMap, CaseApplication caseApplication) { if (CollectionUtil.isNotEmpty(dictDataList)) { - Map affiliateMap = caseAffiliates.stream().collect(Collectors.toMap(CaseAffiliate::getIdentityType, Function.identity(), (n1, n2) -> n2)); + // 申请操作人 + Optional applicantAffiliateOpt = caseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst(); + Optional applicantAgentAffiliateOpt = caseAffiliates.stream().filter(affiliate -> StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(2))).findFirst(); + // 被申请操作人 + Optional resAffiliateOpt = caseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); + Optional resAgentAffiliateOpt = caseAffiliates.stream().filter(affiliate -> StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(4))).findFirst(); + if (!applicantAffiliateOpt.isPresent() || !resAffiliateOpt.isPresent()) { + throw new ServiceException("未找到案件操作人员"); + } + for (SysDictData dictData : dictDataList) { if (StrUtil.isNotEmpty(dictData.getDictLabel())) { if (dictData.getDictLabel().contains("被申请人")) { - CaseAffiliate affiliate = affiliateMap.get(2); - if (affiliate == null) { - continue; - } + CaseAffiliateEntity res = resAffiliateOpt.get(); + // 被申请人 switch (dictData.getDictLabel()) { case "被申请人姓名": - valueMap.put(dictData.getDictLabel(), affiliate.getName()); + valueMap.put(dictData.getDictLabel(), res.getName()); break; case "被申请人身份证号": - valueMap.put(dictData.getDictLabel(), affiliate.getIdentityNum()); + valueMap.put(dictData.getDictLabel(), res.getIdCard()); break; case "被申请人住所": - valueMap.put(dictData.getDictLabel(), affiliate.getResidenAffili()); + valueMap.put(dictData.getDictLabel(), res.getHome()); break; case "被申请人联系地址": - valueMap.put(dictData.getDictLabel(), affiliate.getContactAddress()); + valueMap.put(dictData.getDictLabel(), res.getAddress()); break; case "被申请人联系电话": - valueMap.put(dictData.getDictLabel(), affiliate.getContactTelphone()); + valueMap.put(dictData.getDictLabel(), res.getPhone()); break; case "被申请人电子邮件": - valueMap.put(dictData.getDictLabel(), affiliate.getEmail()); + valueMap.put(dictData.getDictLabel(), res.getEmail()); break; case "被申请人性别": - String responSex = affiliate.getResponSex(); + String responSex = res.getSex(); if (responSex.equals("0")) { valueMap.put(dictData.getDictLabel(), "男"); } else { @@ -534,7 +546,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } break; case "被申请人出生年月日": - Date responBirth = affiliate.getResponBirth(); + Date responBirth = res.getBirth(); if (responBirth != null) { valueMap.put(dictData.getDictLabel(), sdf.format(responBirth)); } else { @@ -545,38 +557,42 @@ public class AdjudicationServiceImpl implements IAdjudicationService { break; } } else if (dictData.getDictLabel().contains("申请人") || dictData.getDictLabel().contains("统一社会信用代码") || dictData.getDictLabel().contains("法定代表人") || dictData.getDictLabel().contains("法定代表人职位") || dictData.getDictLabel().contains("代理人")) { - CaseAffiliate affiliate = affiliateMap.get(1); - if (affiliate == null) { - continue; - } + CaseAffiliateEntity app = applicantAffiliateOpt.get(); + CaseAffiliateEntity appAgent = applicantAgentAffiliateOpt.orElse(null); // 申请人 switch (dictData.getDictLabel()) { case "申请人姓名": - valueMap.put(dictData.getDictLabel(), affiliate.getName()); + valueMap.put(dictData.getDictLabel(), app.getName()); break; case "统一社会信用代码": - valueMap.put(dictData.getDictLabel(), affiliate.getIdentityNum()); + valueMap.put(dictData.getDictLabel(), app.getCode()); break; case "法定代表人": - valueMap.put(dictData.getDictLabel(), affiliate.getCompLegalPerson()); + valueMap.put(dictData.getDictLabel(), app.getCompLegalPerson()); break; case "法定代表人职位": - valueMap.put(dictData.getDictLabel(), affiliate.getCompLegalperPost()); + valueMap.put(dictData.getDictLabel(), app.getPosition()); break; case "申请人住所": - valueMap.put(dictData.getDictLabel(), affiliate.getResidenAffili()); + valueMap.put(dictData.getDictLabel(), app.getHome()); break; case "申请人联系地址": - valueMap.put(dictData.getDictLabel(), affiliate.getContactAddress()); + valueMap.put(dictData.getDictLabel(), app.getAddress()); break; case "委托代理人姓名": - valueMap.put(dictData.getDictLabel(), affiliate.getNameAgent()); + if (appAgent != null) { + valueMap.put(dictData.getDictLabel(), appAgent.getName()); + } break; case "委托代理人联系电话": - valueMap.put(dictData.getDictLabel(), affiliate.getContactTelphoneAgent()); + if (appAgent != null) { + valueMap.put(dictData.getDictLabel(), appAgent.getPhone()); + } break; case "委托代理人电子邮件": - valueMap.put(dictData.getDictLabel(), affiliate.getAgentEmail()); + if (appAgent != null) { + valueMap.put(dictData.getDictLabel(), appAgent.getEmail()); + } break; default: break; @@ -597,9 +613,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { * * @param caseApplicationById 案件基本信息 * @param arbitrateRecordSelect 出裁决书生成记录 - * @param caseStatus 案件状态,不为空则更新案件状态 + * @param caseStatus 案件状态,不为空则更新案件状态 */ - private void saveArbitorFile( CaseAttach caseAttach, CaseApplication caseApplicationById, ArbitrateRecord arbitrateRecordSelect,Integer caseStatus) { + private void saveArbitorFile(CaseAttach caseAttach, CaseApplication caseApplicationById, ArbitrateRecord arbitrateRecordSelect, Integer caseStatus) { //保存到附件表里,先判断之前有没有,有的话更新,没有的话新增 List caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach); if (caseAttachList != null && caseAttachList.size() > 0) { @@ -618,7 +634,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } } //修改案件状态 - if(caseStatus!=null) { + if (caseStatus != null) { caseApplicationById.setCaseStatus(caseStatus); } Integer arbitratMethod = caseApplicationById.getArbitratMethod(); @@ -675,22 +691,22 @@ public class AdjudicationServiceImpl implements IAdjudicationService { caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING); caseApplicationMapper.submitCaseApplication(caseApplication1); //保存邮箱信息和快递单号到关联人表 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(id); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - if (affiliate.getIdentityType() == 1) { //申请人 - affiliate.setSendEmail(appEmail); - affiliate.setTrackNum(apptrackingNum); - caseAffiliateMapper.updataCaseAffiliate(affiliate); - } else { - affiliate.setSendEmail(resEmail); - affiliate.setTrackNum(restrackingNum); - caseAffiliateMapper.updataCaseAffiliate(affiliate); - } - } - } +// CaseAffiliate caseAffiliate = new CaseAffiliate(); +// caseAffiliate.setCaseAppliId(id); +// List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); +// if (caseAffiliates != null && caseAffiliates.size() > 0) { +// for (CaseAffiliate affiliate : caseAffiliates) { +// if (affiliate.getIdentityType() == 1) { //申请人 +// affiliate.setSendEmail(appEmail); +// affiliate.setTrackNum(apptrackingNum); +// caseAffiliateMapper.updataCaseAffiliate(affiliate); +// } else { +// affiliate.setSendEmail(resEmail); +// affiliate.setTrackNum(restrackingNum); +// caseAffiliateMapper.updataCaseAffiliate(affiliate); +// } +// } +// } return AjaxResult.success("裁决书送达成功"); } catch (MailSendException e) { @@ -698,74 +714,61 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } } - @Override - public List getLogisticsInfo(CaseApplication caseApplication) { - try { - //快递单号查询 - String key = "729437f92468910aee6c12dbfeaee3c1"; - String com = "auto"; - //根据案件id查询单号信息 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseApplication.getId()); - List logisticsInfoVOList = new ArrayList<>(); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - LogisticsInfoVO logisticsInfoVO = new LogisticsInfoVO(); - String trackNum = affiliate.getTrackNum(); - if (trackNum != null) { - // 构造查询字符串参数 - String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d", URLEncoder.encode(key, "UTF-8"), URLEncoder.encode(com, "UTF-8"), URLEncoder.encode(trackNum, "UTF-8"), null); - // 拼接到API URL中 - String fullUrl = apiUrl + "?" + queryParameters; - URL url = new URL(fullUrl); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setRequestMethod("GET"); - int responseCode = connection.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK) { - BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String line; - StringBuilder response = new StringBuilder(); - while ((line = reader.readLine()) != null) { - response.append(line); - } - reader.close(); - // 处理返回的响应数据\ - JSONObject jsonObject = JSON.parseObject(response.toString()); - // 提取 "data" 字段并转换为字符串 - String data = jsonObject.getString("data"); - if (data != null) { - logisticsInfoVO.setIdentityType(affiliate.getIdentityType()); - logisticsInfoVO.setLogisticsInfo(data); - logisticsInfoVOList.add(logisticsInfoVO); - } - } else { - // 请求失败 - return null; - } - } - } - return logisticsInfoVOList; - } - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } +// @Override +// public List getLogisticsInfo(CaseApplication caseApplication) { +// try { +// //快递单号查询 +// String key = "729437f92468910aee6c12dbfeaee3c1"; +// String com = "auto"; +// //根据案件id查询单号信息 +// CaseAffiliate caseAffiliate = new CaseAffiliate(); +// caseAffiliate.setCaseAppliId(caseApplication.getId()); +// List logisticsInfoVOList = new ArrayList<>(); +// List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); +// if (caseAffiliates != null && caseAffiliates.size() > 0) { +// for (CaseAffiliate affiliate : caseAffiliates) { +// LogisticsInfoVO logisticsInfoVO = new LogisticsInfoVO(); +// String trackNum = affiliate.getTrackNum(); +// if (trackNum != null) { +// // 构造查询字符串参数 +// String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d", URLEncoder.encode(key, "UTF-8"), URLEncoder.encode(com, "UTF-8"), URLEncoder.encode(trackNum, "UTF-8"), null); +// // 拼接到API URL中 +// String fullUrl = apiUrl + "?" + queryParameters; +// URL url = new URL(fullUrl); +// HttpURLConnection connection = (HttpURLConnection) url.openConnection(); +// connection.setRequestMethod("GET"); +// int responseCode = connection.getResponseCode(); +// if (responseCode == HttpURLConnection.HTTP_OK) { +// BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); +// String line; +// StringBuilder response = new StringBuilder(); +// while ((line = reader.readLine()) != null) { +// response.append(line); +// } +// reader.close(); +// // 处理返回的响应数据\ +// JSONObject jsonObject = JSON.parseObject(response.toString()); +// // 提取 "data" 字段并转换为字符串 +// String data = jsonObject.getString("data"); +// if (data != null) { +// logisticsInfoVO.setIdentityType(affiliate.getIdentityType()); +// logisticsInfoVO.setLogisticsInfo(data); +// logisticsInfoVOList.add(logisticsInfoVO); +// } +// } else { +// // 请求失败 +// return null; +// } +// } +// } +// return logisticsInfoVOList; +// } +// } catch (IOException e) { +// e.printStackTrace(); +// } +// return null; +// } - @Override - @Transactional - public AjaxResult signature(CaseApplication caseApplication) { - // 查询当前案件节点 - Integer currentStatus= caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); - //更改案件状态(暂时) - caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL); - caseApplicationMapper.submitCaseApplication(caseApplication); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),currentStatus, ""); - - return AjaxResult.success("签名成功,案件状态已改为待裁决书用印"); - } @Override @Transactional @@ -775,12 +778,12 @@ public class AdjudicationServiceImpl implements IAdjudicationService { CaseApplication caseApplication = new CaseApplication(); caseApplication.setId(id); // 查询当前案件节点 - Integer currentStatus= caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); //更改案件状态(暂时) caseApplication.setCaseStatus(CaseApplicationConstants.CASE_ARCHIVED); caseApplicationMapper.submitCaseApplication(caseApplication); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),currentStatus, ""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_FILING, ""); } } catch (Exception e) { return AjaxResult.error(e.getMessage()); @@ -801,17 +804,19 @@ public class AdjudicationServiceImpl implements IAdjudicationService { if (caseApplication1 == null) { return AjaxResult.error("未查询到相关案件"); } - Integer currentNode=caseApplication1.getCaseStatus(); + Integer currentNode = caseApplication1.getCaseStatus(); List caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication1); Boolean isExistPdf = false; + String path=null; if (caseAttachList != null && caseAttachList.size() > 0) { for (CaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == 3) { isExistPdf = true; - String annexName = caseAttach.getAnnexName(); - String prefix = "/profile/upload/"; - int startIndex = prefix.length(); - String path = caseAttach.getAnnexPath() + annexName.substring(startIndex); + String filePath = caseAttach.getAnnexPath(); + if (StrUtil.isEmpty(filePath)) { + throw new ServiceException("未找到文件"); + } + path = filePath.replace("/profile/", "/home/ruoyi/uploadPath/"); File file = new File(path); //判断文件是否存在 if (!file.exists()) { @@ -831,16 +836,16 @@ public class AdjudicationServiceImpl implements IAdjudicationService { for (CaseAttach caseAttach1 : caseAttachList1) { if (caseAttach1.getAnnexType() == 3) { isExistPdf = true; - annexName = caseAttach1.getAnnexName(); - prefix = "/profile/upload/"; - startIndex = prefix.length(); - path = caseAttach1.getAnnexPath() + annexName.substring(startIndex); + filePath = caseAttach.getAnnexPath(); + if (StrUtil.isEmpty(filePath)) { + throw new ServiceException("未找到文件"); + } + path = filePath.replace("/profile/", "/home/ruoyi/uploadPath/"); File file1 = new File(path); if (!file1.exists()) { isExistPdf = false; } - annexName = null; - prefix = null; + path = null; caseAttachList = caseAttachList1; break; @@ -866,25 +871,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService { //修改案件状态 caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING); caseApplicationMapper.submitCaseApplication(caseApplication1); - //保存邮箱信息和快递单号到关联人表 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(id); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - if (affiliate.getIdentityType() == 1) { //申请人 - affiliate.setSendEmail(appEmail); - affiliate.setTrackNum(apptrackingNum); - caseAffiliateMapper.updataCaseAffiliate(affiliate); - } else { - affiliate.setSendEmail(resEmail); - affiliate.setTrackNum(restrackingNum); - caseAffiliateMapper.updataCaseAffiliate(affiliate); - } - } - } //申请人发送邮件 - boolean appEmailFlag = sendCaseEmail(caseApplication1, appEmail, caseAttachList); + boolean appEmailFlag = sendCaseEmail(appEmail, path); SendMailRecord sendMailRecord = new SendMailRecord(); sendMailRecord.setCaseId(id); sendMailRecord.setMailAddress(appEmail); @@ -900,7 +888,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } sendMailRecordMapper.saveSendMailRecord(sendMailRecord); // 被申请人发送邮件 - boolean resEmailFlag = sendCaseEmail(caseApplication1, resEmail, caseAttachList); + boolean resEmailFlag = sendCaseEmail( resEmail, path); SendMailRecord sendMailRecord1 = new SendMailRecord(); sendMailRecord1.setCaseId(id); @@ -927,46 +915,36 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } // 发送短信 if (appEmailFlag || resEmailFlag) { - - if (CollectionUtil.isNotEmpty(caseAffiliates)) { + // 查询案件相关人员 + CaseAffiliateEntity affiliateEntity = new CaseAffiliateEntity(); + affiliateEntity.setCaseAppliId(id); + List affiliateEntities = caseAffiliateMapper.selectCaseAffiliate(affiliateEntity); +// 申请操作人 + Optional applicantAffiliateOpt = affiliateEntities.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst(); + // 被申请操作人 + Optional resAffiliateOpt = affiliateEntities.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); + List operatorList = new ArrayList<>(); + if (applicantAffiliateOpt.isPresent() && StrUtil.isNotEmpty(applicantAffiliateOpt.get().getPhone())) { + operatorList.add(applicantAffiliateOpt.get()); + } + if (resAffiliateOpt.isPresent() && StrUtil.isNotEmpty(resAffiliateOpt.get().getPhone())) { + operatorList.add(resAffiliateOpt.get()); + } + if (CollectionUtil.isNotEmpty(operatorList)) { SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); request.setTemplateId("1990362"); - for (CaseAffiliate affiliate : caseAffiliates) { - String telphone = null; - if (appEmailFlag && affiliate.getIdentityType() == 1) { - telphone = affiliate.getContactTelphone(); - } else if (resEmailFlag && affiliate.getIdentityType() == 2) { - telphone = affiliate.getContactTelphone(); - } - if (StrUtil.isEmpty(telphone)) { - continue; - } - + for (CaseAffiliateEntity affiliate : operatorList) { + String telphone = affiliate.getPhone(); request.setPhone(telphone); -// if(affiliate.getIdentityType() == 1) { -// request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), appEmail}); -// }else { -// request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), resEmail}); -// } request.setTemplateParamSet(new String[]{affiliate.getName(), caseApplication1.getCaseNum()}); Boolean aBoolean = SmsUtils.sendSms(request); - // 保存短信发送记录 SmsSendRecord smsSendRecord = new SmsSendRecord(); - smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId()); - + smsSendRecord.setCaseId(id); smsSendRecord.setCaseNum(caseApplication1.getCaseNum()); smsSendRecord.setPhone(request.getPhone()); smsSendRecord.setSendTime(new Date()); -// // 尊敬的{1}用户,您的{2}仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。 -// if(affiliate.getIdentityType() == 1) { -// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +appEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。"); -// }else { -// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +resEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。"); -// } smsSendRecord.setSendContent("尊敬的" + affiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。"); - - smsSendRecord.setCreateBy(getUsername()); if (aBoolean) { smsSendRecord.setSendStatus(1); @@ -984,7 +962,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentNode, ""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.ARBITRATION_DELIVERY, ""); return AjaxResult.success("裁决书送达成功"); } @@ -1016,17 +994,6 @@ public class AdjudicationServiceImpl implements IAdjudicationService { if (file != null && file.exists()) { try { Boolean aBoolean = emailOutUtil.sendEmil(email, "您好,审核后的裁决书在附件中请查阅", "签署后的裁决书", fileList, null); - -// String appUid = UUID.randomUUID().toString(); -// Boolean aBoolean = emailOutUtil.sendEmil(email, "您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅", appUid +"裁决书", fileList, null); -// // Thread.sleep(20); - // 收到退信的所有id,即发送失败的uuid - // emailOutUtil.receiverMail(); - // Thread.sleep(3); - // List messageIds = emailOutUtil.receiverMail(); -// if (aBoolean&&(CollectionUtil.isEmpty(messageIds)||!messageIds.contains(appUid))) { -// return Boolean.TRUE; -// } if (aBoolean) { return Boolean.TRUE; } @@ -1039,321 +1006,53 @@ public class AdjudicationServiceImpl implements IAdjudicationService { return Boolean.FALSE; } - @Override - public AjaxResult stamp(CaseApplication caseApplication) { - Integer caseStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); - //更改案件状态(暂时) - caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY); - caseApplicationMapper.submitCaseApplication(caseApplication); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), caseStatus, ""); - - return AjaxResult.success("用印成功,案件状态已改为待裁决书送达"); - } - - @Override - public AjaxResult getArchivesDetail(Long id) { - ArchivesDetailVO archivesDetailVO = new ArchivesDetailVO(); - CaseApplication caseApplication = new CaseApplication(); - caseApplication.setId(id); - //查询案件信息 -// CaseApplication caseApplication1 = caseApplicationService.selectCaseApplication(caseApplication); -// if (caseApplication1 != null) { -// archivesDetailVO.setCaseApplication(caseApplication1); -// } - //查询案件日志信息 -// CaseLogRecord caseLogRecord = new CaseLogRecord(); -// caseLogRecord.setCaseAppliId(id); -// List caseLogRecords = caseLogRecordService.selectCaseLogRecordList(caseLogRecord); -// if (caseLogRecords != null && caseLogRecords.size() > 0) { -// archivesDetailVO.setCaseLogRecordList(caseLogRecords); -// } - //查询快递信息 - List logisticsInfo = this.getLogisticsInfo(caseApplication); - if (logisticsInfo != null && logisticsInfo.size() > 0) { - archivesDetailVO.setLogisticsInfoVOList(logisticsInfo); + /** + * 通过邮件发送裁决书文件 + * + * @param + */ + private boolean sendCaseEmail(String email, String path) { + if(StrUtil.isEmpty(path)){ + return Boolean.FALSE; } - return AjaxResult.success(archivesDetailVO); - } + List fileList = new ArrayList<>(); + File file = new File(path); + fileList.add(file); + System.out.println("文件长度==================:" + file.length()); - @Override - @Transactional - public AjaxResult regenerationDocument(CaseApplication caseApplication) { - try { - Map datas = new HashMap<>(); - Long id = caseApplication.getId(); - if (id == null) { - return null; - } - //获取案件详细信息 - CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); - //生成编码 - String equipmentNo = getNewEquipmentNo(); - datas.put("num", equipmentNo); - //获取仲裁记录相关信息 - ArbitrateRecord arbitrateRecord1 = caseApplication.getArbitrateRecord(); - //获取案件关联人信息 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(id); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - List nameAgentList = new ArrayList<>(); - if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - //获取身份类型 - int identityType = affiliate.getIdentityType(); - if (identityType == 1) { //申请人 - datas.put("appName", affiliate.getName()); - datas.put("appAddress", affiliate.getResidenAffili()); - datas.put("appContactAddress", affiliate.getContactAddress()); - datas.put("appLegalPerson", affiliate.getCompLegalPerson()); - datas.put("appLegalPersonTitle", affiliate.getCompLegalperPost()); - datas.put("appAgentName", affiliate.getNameAgent()); - datas.put("appAgentTitle", affiliate.getAppliAgentTitle()); - nameAgentList.add(affiliate.getNameAgent()); - } else if (identityType == 2) { //被申请人 - datas.put("resName", affiliate.getName()); - datas.put("resAddress", affiliate.getResidenAffili()); - String responSex = affiliate.getResponSex(); - if (responSex.equals("0")) { - datas.put("resSex", "男"); - } else { - datas.put("resSex", "女"); - } - Date responBirth = affiliate.getResponBirth(); - if (responBirth != null) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - String responBirthStr = sdf.format(responBirth); - datas.put("resDateOfBirth", responBirthStr); - } - datas.put("resContactAddress", affiliate.getContactAddress()); - nameAgentList.add(affiliate.getNameAgent()); - } + if (file != null && file.exists()) { + try { + Boolean aBoolean = emailOutUtil.sendEmil(email, "您好,审核后的裁决书在附件中请查阅", "签署后的裁决书", fileList, null); + if (aBoolean) { + return Boolean.TRUE; } + } catch (Exception e) { + System.out.println("邮件发送失败++++++++++++++++++++++++++++++++"); + System.out.println(e.toString()); + return Boolean.FALSE; } - Date createTime = caseApplication1.getCreateTime(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - // 将日期格式化为字符串 - String createTimeStr = sdf.format(createTime); - datas.put("submissionDate", createTimeStr); - Date registerDate = caseApplication1.getRegisterDate(); - String registerDateStr = sdf.format(registerDate); - datas.put("acceptDate", registerDateStr); - //反请求 - Integer adjudicaCounter = caseApplication1.getAdjudicaCounter(); - String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" + "《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" + "仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。"; - if (adjudicaCounter == null) { - datas.put("counterclaim", null); - } else if (adjudicaCounter == 1) { - datas.put("counterclaim", counterclaim); - } else { - datas.put("counterclaim", null); - } - //财产保全 - Integer properPreser = caseApplication1.getProperPreser(); - String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" + "第二十八条之规定,将该申请提交至法院。"; - if (properPreser == null) { - datas.put("preservation", null); - } else if (properPreser == 1) { - datas.put("preservation", preservation); - } else { - datas.put("preservation", null); - } - //管辖权异议 - Integer objectiJuris = caseApplication1.getObjectiJuris(); - String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《管辖异议申请书》,认为" + ",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。"; - if (objectiJuris == null) { - datas.put("jurisdictionalObjection", null); - } else if (objectiJuris == 1) { - datas.put("jurisdictionalObjection", jurisdictionalObjection); - } else { - datas.put("jurisdictionalObjection", null); - } - String arbitratorName = caseApplication1.getArbitratorName(); - datas.put("arbitratorName", arbitratorName); - Integer arbitratMethod = caseApplication1.getArbitratMethod(); - Date hearDate = caseApplication1.getHearDate(); - String hearDateStr = ""; - if (hearDate != null) { - hearDateStr = sdf.format(hearDate); - } - //线上开庭时 - if (arbitratMethod == 1) { - String onLine1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"; - String onLine2 = "通过仲裁委智慧仲裁平台开庭审理了本案。"; - datas.put("onLine1", onLine1); - datas.put("hearDate", hearDateStr); - datas.put("onLine2", onLine2); - } else { - //书面仲裁时 - String written1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"; - String written2 = "在仲裁委所在地开庭审理了本案。"; - datas.put("written1", written1); - datas.put("hearDate1", hearDateStr); - datas.put("written2", written2); - } - Integer isAbsence = caseApplication1.getIsAbsence(); - if (isAbsence == null) { - datas.put("absent1", null); - datas.put("absent2", null); - datas.put("absent3", null); - datas.put("absent4", null); - datas.put("absent5", null); - datas.put("attend1", null); - datas.put("attend2", null); - datas.put("attend3", null); - datas.put("attend4", null); - datas.put("attend5", null); - datas.put("attend6", null); - datas.put("attend7", null); - datas.put("appAgentName1", null); - datas.put("appAgentName2", null); - datas.put("resAgentName", null); - } else if (isAbsence == 1) { - //缺席审理 - String absent1 = "申请人的特别授权委托代理人"; - String absent2 = "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" + "《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。"; - String absent3 = "庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明," + "发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。"; - String absent4 = "(二/三)当事人提供的证据材料\n" + "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:"; - String absent5 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + "第四十条第(二)项、第五十一条的规定,缺席裁决如下:"; - datas.put("absent1", absent1); - datas.put("absent2", absent2); - datas.put("absent3", absent3); - datas.put("absent4", absent4); - datas.put("absent5", absent5); - datas.put("appAgentName1", nameAgentList.get(0)); - } else { - //出席审理 - String attend1 = "申请人的特别授权委托代理人"; - String attend2 = "和被申请人本人/的特别授权委托代理人"; - String attend3 = "出席了庭审。"; - String attend4 = "庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;" + "双方当事人均出示了证据材料并对对方的证据材料进行了质证;申请人出示了证据材料," + "被申请人对对方的证据材料进行了质证;双方当事人均回答了仲裁庭的提问,进行了辩论," + "并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。"; - String attend5 = "(二)被申请人的答辩意见"; - String attend6 = "(二/三)当事人提供的证据材料及对方的质证意见\n" + "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:"; - String attend7 = "被申请人对上述材料的质证意见为:"; - datas.put("attend1", attend1); - datas.put("attend2", attend2); - datas.put("attend3", attend3); - datas.put("attend4", attend4); - datas.put("attend5", attend5); - datas.put("attend6", attend6); - datas.put("attend7", attend7); - datas.put("responCrossOpin", caseApplication1.getResponCrossOpin()); - datas.put("appAgentName2", nameAgentList.get(0)); - datas.put("resAgentName", nameAgentList.get(1)); - if (arbitratMethod == 1) { - //被申出席+开庭 - String attend8 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + "第五十一条的规定,裁决如下:"; - datas.put("attend8", attend8); - } else { - //被申出席+书面 - String attend9 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + "第五十一条、第五十八条的规定,裁决如下:"; - datas.put("attend9", attend9); - } - } - datas.put("claims", caseApplication1.getArbitratClaims()); - datas.put("request", caseApplication1.getRequestRule()); - CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication); - List caseAttachList1 = caseApplication2.getCaseAttachList(); - if (caseAttachList1 != null && caseAttachList1.size() > 0) { - for (CaseAttach caseAttach : caseAttachList1) { - if (caseAttach.getAnnexType() == 6) { //被申请人证据材料 - String annexName = caseAttach.getAnnexName(); - boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName); - if (isImageFile) { - String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath(); - System.out.println("路径是===========" + annexPath); - PictureRenderData pictureRenderData = WordUtil.rebuildImageContent(100, 100, null, annexPath); - datas.put("resEvidenceMaterial", pictureRenderData); - } - } else if (caseAttach.getAnnexType() == 2) { //申请人证据材料 - String annexName = caseAttach.getAnnexName(); - boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName); - if (isImageFile) { - String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath(); - System.out.println("路径是===========" + annexPath); - PictureRenderData pictureRenderData = WordUtil.rebuildImageContent(100, 100, null, annexPath); - //申请人证据材料 - datas.put("appEvidenceMaterial", pictureRenderData); - } - } - } - } - datas.put("applicaCrossOpin", "被申请人证据不足,无法说明事实"); - - datas.put("factDetermi", "被申请人欠款属实"); - datas.put("arbitrateThink", "被申请人应按约定还款"); - datas.put("rulingFollows", "被申请人依法偿还申请人欠款"); - - LocalDate now = LocalDate.now(); - String year = Integer.toString(now.getYear()); - datas.put("year", year); - String month = String.format("%02d", now.getMonthValue()); - String day = String.format("%02d", now.getDayOfMonth()); - String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx"; -// String modalFilePath = "D:/develop/新裁决书模板.docx"; - String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; -// String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day; - String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx"; - String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; - String resultFilePath = saveFolderPath + "/" + fileName; - // 创建日期目录 - File saveFolder = new File(saveFolderPath); - if (!saveFolder.exists()) { - saveFolder.mkdirs(); - } - Path sourcePath = new File(modalFilePath).toPath(); - Path destinationPath = new File(resultFilePath).toPath(); - Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING); - String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath); - String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8); - - - //将裁决书更新到附件表里 - CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id).annexName(saveName).annexPath(savePath).annexType(3).build(); - int i = caseAttachMapper.updateCaseAttachBycaseid(caseAttach); - - - if (i > 0) { - if (arbitrateRecord1 != null) { - //将仲裁记录更新到仲裁记录表 - arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1); - } - } - - String annexName = caseAttach.getAnnexName(); - String prefix = "/profile"; - int startIndex = annexName.indexOf(prefix); - startIndex += prefix.length(); - String annexPath = "/uploadPath" + annexName.substring(startIndex); - caseAttach.setAnnexPath(annexPath); - int startIndexnew = annexName.lastIndexOf("/"); - if (startIndexnew != -1) { - String annexNamenew = annexName.substring(startIndexnew + 1); - caseAttach.setAnnexName(annexNamenew); - } - - return AjaxResult.success(caseAttach); - } catch (IOException e) { - e.printStackTrace(); - return AjaxResult.error("重新生成裁决书异常"); } + return Boolean.FALSE; } + + + @Override public AjaxResult emailByCaseId(Long id) { - List list = caseAffiliateMapper.emailByCaseId(id); + List list = caseAffiliateMapper.emailByCaseId(id); BookSendVO bookSendVO = new BookSendVO(); if (CollectionUtil.isNotEmpty(list)) { - for (CaseAffiliate caseAffiliate : list) { - // 申请人邮箱 - if (caseAffiliate.getIdentityType() == 1) { - bookSendVO.setAppEmail(caseAffiliate.getEmail()); - } else { - // 被申请人邮箱 - bookSendVO.setResEmail(caseAffiliate.getEmail()); - } + // 申请操作人 + Optional applicantAffiliateOpt = list.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getEmail()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst(); + // 被申请操作人 + Optional resAffiliateOpt = list.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getEmail()) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); + if (!applicantAffiliateOpt.isPresent() || !resAffiliateOpt.isPresent()) { + throw new ServiceException("未找到案件操作人员"); } + bookSendVO.setAppEmail(applicantAffiliateOpt.get().getEmail()); + bookSendVO.setResEmail(resAffiliateOpt.get().getEmail()); } return AjaxResult.success(bookSendVO); } @@ -1583,14 +1282,14 @@ public class AdjudicationServiceImpl implements IAdjudicationService { List ids = caseApplications1.stream().map(CaseApplication::getId).collect(Collectors.toList()); try { for (Long id : ids) { - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(id); + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(id); CaseApplication caseApplication = new CaseApplication(); caseApplication.setId(id); //更改案件状态(暂时) caseApplication.setCaseStatus(CaseApplicationConstants.CASE_ARCHIVED); caseApplicationMapper.submitCaseApplication(caseApplication); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus, ""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_FILING, ""); } } catch (Exception e) { return AjaxResult.error(e.getMessage()); @@ -1606,6 +1305,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { @Override @Transactional public AjaxResult serviceBatch(Integer batchNumber) throws EsignDemoException, IOException { + List operatorList = new ArrayList<>(); CaseApplication caseApplicationsel = new CaseApplication(); caseApplicationsel.setBatchNumber(batchNumber); caseApplicationsel.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY); @@ -1615,197 +1315,37 @@ public class AdjudicationServiceImpl implements IAdjudicationService { for (Long id : ids) { CaseApplication caseApplication = new CaseApplication(); caseApplication.setId(id); + CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); if (caseApplication1 == null) { return AjaxResult.error("未查询到相关案件"); } - Integer currentCaseNode=caseApplication1.getCaseStatus(); - List caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication1); - - if (caseAttachList != null && caseAttachList.size() > 0) { - for (CaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == 3) { - String annexName = caseAttach.getAnnexName(); - String prefix = "/profile/upload/"; - int startIndex = prefix.length(); - String path = caseAttach.getAnnexPath() + annexName.substring(startIndex); - File file = new File(path); - // todo 部署放开 - if (!file.exists()) { - Gson gson = new Gson(); - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setCaseAppliId(id); - List sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecord); - if (sealSignRecords != null && sealSignRecords.size() > 0) { - String signFlowid = sealSignRecords.get(0).getSignFlowid(); - EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowid); - JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); - JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); - JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); - if (filesArray != null && filesArray.size() > 0) { - JsonObject fileObject = (JsonObject) filesArray.get(0); - String fileDownloadUrl = fileObject.get("downloadUrl").toString(); - String filearbitraUrl = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); - - LocalDate now = LocalDate.now(); - String year = Integer.toString(now.getYear()); - String month = String.format("%02d", now.getMonthValue()); - String day = String.format("%02d", now.getDayOfMonth()); - String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; - String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; - String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; - String savePath = "/home/ruoyi/uploadPath/upload/"; - - // 创建日期目录 - File saveFolder = new File(saveFolderPath); - if (!saveFolder.exists()) { - saveFolder.mkdirs(); - } - String resultFilePath = saveFolderPath + "/" + fileName; - File resultFilePathFile = new File(resultFilePath); - if (!resultFilePathFile.exists()) { - resultFilePathFile.createNewFile(); - } - - boolean downLoadFile = FileTransformation.downLoadFileByUrl(filearbitraUrl, resultFilePath); - if (downLoadFile) { - CaseAttach caseAttach1 = new CaseAttach(); - caseAttach1.setCaseAppliId(id); - caseAttach1.setAnnexType(3); - caseAttach1.setAnnexPath(savePath); - caseAttach1.setAnnexName(saveName); - caseAttachMapper.updateCaseAttachBycaseid(caseAttach1); - - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); - } - } - } - } - } - } - } - - //修改案件状态 - caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING); - caseApplicationMapper.submitCaseApplication(caseApplication1); String appEmail = ""; String resEmail = ""; CaseAffiliate caseAffiliate = new CaseAffiliate(); caseAffiliate.setCaseAppliId(id); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); + List caseAffiliates = caseApplicationService.selectAfflicatesByCaseId(id); if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - if (affiliate.getIdentityType() == 1) { //申请人 - appEmail = affiliate.getEmail(); - } else { - resEmail = affiliate.getEmail(); - } +// 申请操作人 + Optional applicantAffiliateOpt = caseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst(); + // 被申请操作人 + Optional resAffiliateOpt = caseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); + if (applicantAffiliateOpt.isPresent()) { + operatorList.add(applicantAffiliateOpt.get()); + appEmail = applicantAffiliateOpt.get().getEmail(); } - } - - //申请人发送邮件 - boolean appEmailFlag = sendCaseEmail(caseApplication1, appEmail, caseAttachList); - SendMailRecord sendMailRecord = new SendMailRecord(); - sendMailRecord.setCaseId(id); - sendMailRecord.setMailAddress(appEmail); - sendMailRecord.setMailContent("您好,审核后的裁决书在附件中请查阅"); -// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅"); - sendMailRecord.setMailName("签署后的裁决书"); - sendMailRecord.setSendTime(new Date()); - sendMailRecord.setCreateBy(getUsername()); - if (appEmailFlag) { - sendMailRecord.setSendStatus(1); - } else { - sendMailRecord.setSendStatus(0); - } - sendMailRecordMapper.saveSendMailRecord(sendMailRecord); - // 被申请人发送邮件 - boolean resEmailFlag = sendCaseEmail(caseApplication1, resEmail, caseAttachList); - - SendMailRecord sendMailRecord1 = new SendMailRecord(); - sendMailRecord1.setCaseId(id); - sendMailRecord1.setMailAddress(resEmail); -// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅"); - sendMailRecord1.setMailContent("您好,审核后的裁决书在附件中请查阅"); - sendMailRecord1.setMailName("签署后的裁决书"); - sendMailRecord1.setSendTime(new Date()); - sendMailRecord1.setCreateBy(getUsername()); - if (resEmailFlag) { - sendMailRecord1.setSendStatus(1); - } else { - sendMailRecord1.setSendStatus(0); - } - sendMailRecordMapper.saveSendMailRecord(sendMailRecord1); - if (!appEmailFlag && !resEmailFlag) { - throw new ServiceException("裁决书发送失败"); - } - if (!appEmailFlag) { - throw new ServiceException("申请人裁决书发送失败"); - } - if (!resEmailFlag) { - throw new ServiceException("被申请人裁决书发送失败"); - } - // 发送短信 - if (appEmailFlag || resEmailFlag) { - - if (CollectionUtil.isNotEmpty(caseAffiliates)) { - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("1990362"); - for (CaseAffiliate affiliate : caseAffiliates) { - String telphone = null; - if (appEmailFlag && affiliate.getIdentityType() == 1) { - telphone = affiliate.getContactTelphone(); - } else if (resEmailFlag && affiliate.getIdentityType() == 2) { - telphone = affiliate.getContactTelphone(); - } - if (StrUtil.isEmpty(telphone)) { - continue; - } - - request.setPhone(telphone); -// if(affiliate.getIdentityType() == 1) { -// request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), appEmail}); -// }else { -// request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), resEmail}); -// } - request.setTemplateParamSet(new String[]{affiliate.getName(), caseApplication1.getCaseNum()}); - Boolean aBoolean = SmsUtils.sendSms(request); - - // 保存短信发送记录 - SmsSendRecord smsSendRecord = new SmsSendRecord(); - smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId()); - - smsSendRecord.setCaseNum(caseApplication1.getCaseNum()); - smsSendRecord.setPhone(request.getPhone()); - smsSendRecord.setSendTime(new Date()); -// // 尊敬的{1}用户,您的{2}仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。 -// if(affiliate.getIdentityType() == 1) { -// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +appEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。"); -// }else { -// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +resEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。"); -// } - smsSendRecord.setSendContent("尊敬的" + affiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。"); - - - smsSendRecord.setCreateBy(getUsername()); - if (aBoolean) { - smsSendRecord.setSendStatus(1); - } else { - smsSendRecord.setSendStatus(0); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - } - + if (resAffiliateOpt.isPresent()) { + operatorList.add(resAffiliateOpt.get()); + resEmail = resAffiliateOpt.get().getEmail(); } - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentCaseNode, ""); } + adjudicationService.service(id, appEmail, resEmail, "",""); } + } else { throw new ServiceException("这个批号没有批量送达裁决书的案件"); } @@ -1815,6 +1355,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { /** * 开庭审理,确定审理结果,生成裁决书 + * * @param req * @return */ @@ -1836,7 +1377,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { if (CollectionUtil.isEmpty(templateManages)) { return AjaxResult.error("请先指定裁决书模板"); } - String templatePath = templateManages.get(0).getTemOrigPath(); + String templatePath = templateManages.get(0).getTemOrigPath(); if (StrUtil.isEmpty(templatePath)) { return AjaxResult.error("未找到该模板"); } @@ -1847,10 +1388,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService { return AjaxResult.error("未找到该模板"); } // 查询案件相关表信息 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(req.getId()); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if(CollectionUtil.isEmpty(caseAffiliates)){ + List caseAffiliates = caseApplicationService.selectAfflicatesByCaseId(req.getId()); + if (CollectionUtil.isEmpty(caseAffiliates)) { return AjaxResult.error("未找到案件相关人员"); } // 在系统表中查询案件内置字段 @@ -1892,7 +1431,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { // 遍历书签,给书签赋值 replaceBookmark(bookmarkList, datas, valueMap); // 根据条件替换书签 - conditionReplaceBookmark(caseApplicationById, datas,"", "", arbitrateRecordSelect); + conditionReplaceBookmark(caseApplicationById, datas, "", "", arbitrateRecordSelect); // 裁决书生成时间 LocalDate now = LocalDate.now(); String year = Integer.toString(now.getYear()); @@ -1930,35 +1469,38 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } catch (IOException e) { throw new ServiceException("生成裁决书失败"); } - String annexPath=saveName.replace("/profile/upload/","/home/ruoyi/uploadPath/upload/"); + String annexPath = saveName.replace("/profile/upload/", "/home/ruoyi/uploadPath/upload/"); // 上传到onlyoffice - JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath,req.getId()); - CaseAttach caseAttach=null; - if(jsonArray!=null && jsonArray.size() > 0){ + JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath, req.getId()); + CaseAttach caseAttach = null; + if (jsonArray != null && jsonArray.size() > 0) { for (Object obj : jsonArray) { JSONObject jsonObject = (JSONObject) obj; - caseAttach= CaseAttach.builder() + String path = jsonObject.get("filePath")!=null?jsonObject.getString("filePath"):""; + path=path.replace("/home/ruoyi/uploadPath/","/profile/"); + String name = jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):""; + caseAttach = CaseAttach.builder() .caseAppliId(req.getId()) - .annexName(jsonObject.getString("fileName")) - .annexPath("/home/ruoyi/uploadPath/onlyoffice/") + .annexName(name) + .annexPath(path) .annexType(3) .onlyOfficeFileId(jsonObject.getString("fileId")) .build(); - if(jsonObject.get("filePath")!=null){ - String officePath = jsonObject.getString("filePath"); - String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); - caseAttach.setAnnexName(replace); - - } +// if (jsonObject.get("filePath") != null) { +// String officePath = jsonObject.getString("filePath"); +// String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); +// caseAttach.setAnnexName(replace); +// +// } } } - if(caseAttach!=null) { + if (caseAttach != null) { // 保存裁决书附件 saveArbitorFile(caseAttach, caseApplicationById, arbitrateRecordSelect, null); - }else { + } else { return AjaxResult.error("上传onlyoffice服务器失败"); } @@ -1978,7 +1520,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { caseApplicationMapper.submitCaseApplication(caseApplication); // 新增日志 - insertCaseLog(id,currentStatus , ""); + insertCaseLog(id, CaseApplicationConstants.PENDING_OPENCOURT_HEAR, ""); return AjaxResult.success(); } @@ -2035,7 +1577,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { xwpfDocument = new XWPFDocument(fileInputStream); log.error("xwpfDocument====" + xwpfDocument); } catch (IOException e) { - throw new ServiceException("系统找不到指定的文件。"); + throw new ServiceException("系统找不到指定的文件。"); } if (xwpfDocument == null) { return new ArrayList<>(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationLogServiceImpl.java index d879caf..0d142dd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationLogServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationLogServiceImpl.java @@ -247,7 +247,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService CaseApplication beforeCase = caseApplicationService.selectCaseApplication(caseApplication); // 查询案件关联人员 - afterCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(afterCase.getCaseLogId())); + // afterCase.setAffiliate(caseAffiliateLogMapper.selectCaseAffiliate(afterCase.getCaseLogId())); // 查询自定义字段表 afterCase.setColumnValues(columnValueLogMapper.listBycaseAppliLogId(afterCase.getCaseLogId())); // 查询附件 @@ -259,17 +259,10 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService List afterAttachList = caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach); if (CollectionUtil.isNotEmpty(afterAttachList)) { for (CaseAttach attach : afterAttachList) { - String annexName = attach.getAnnexName(); - String prefix = "/profile"; - int startIndex = annexName.indexOf(prefix); - startIndex += prefix.length(); - String annexPath = "/uploadPath" + annexName.substring(startIndex); - attach.setAnnexPath(annexPath); - int startIndexnew = annexName.lastIndexOf("/"); - if (startIndexnew != -1) { - String annexNamenew = annexName.substring(startIndexnew + 1); - attach.setAnnexName(annexNamenew); - } + String path = attach.getAnnexPath()==null?"":attach.getAnnexPath(); + attach.setAnnexPath(path); + attach.setAnnexName(attach.getAnnexName()); + } afterCase.setCaseAttachList(afterAttachList); } @@ -299,7 +292,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService } // 对比案件人员字段 - compareAffilate(beforeCase, afterCase); +// compareAffilate(beforeCase, afterCase); // 对比申请人证据资料 compareCaseVO.setChangeColumn(compareApplicantFile(beforeCase, afterCase, changeColumn).toString()); // 对比自定义字段 @@ -385,70 +378,70 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService * @param beforeCase * @param afterCase */ - private void compareAffilate(CaseApplication beforeCase, CaseApplication afterCase) { - // 对比人员字段 - List beforeCaseCaseAffiliates = beforeCase.getCaseAffiliates(); - List afterCaseCaseAffiliates = afterCase.getCaseAffiliates(); - Map beforeCaseCaseAffiliateMap = null; - if (CollectionUtil.isNotEmpty(beforeCaseCaseAffiliates)) { - // 转为map - beforeCaseCaseAffiliateMap = beforeCaseCaseAffiliates.stream().collect(Collectors.toMap(CaseAffiliate::getIdentityType, v -> v, (n1, n2) -> n2)); - } - StringBuilder affiliateChangeColumn; - // 如果上一个版本和现版本有一个为空,那么所有字段都修改 - if (beforeCaseCaseAffiliates != null && afterCaseCaseAffiliates == null) { - affiliateChangeColumn = new StringBuilder(); - for (String column : affiliateColumns) { - - affiliateChangeColumn.append(column).append(","); - } - - } else if (beforeCaseCaseAffiliates == null && afterCaseCaseAffiliates != null) { - affiliateChangeColumn = new StringBuilder(); - for (String column : affiliateColumns) { - - affiliateChangeColumn.append(column).append(","); - } - } else if (beforeCaseCaseAffiliates != null && afterCaseCaseAffiliates != null) { - for (CaseAffiliate afterCaseCaseAffiliate : afterCaseCaseAffiliates) { - // 找到相同身份类型的数据,进行对比 - affiliateChangeColumn = new StringBuilder(); - int identityType = afterCaseCaseAffiliate.getIdentityType(); - if (beforeCaseCaseAffiliateMap != null && beforeCaseCaseAffiliateMap.containsKey(identityType)) { - CaseAffiliate beforeCaseCaseAffiliate = beforeCaseCaseAffiliateMap.get(identityType); - for (String column : affiliateColumns) { - String beforeValue = ObjectFieldUtils.getValue(beforeCaseCaseAffiliate, column); - String afterValue = ObjectFieldUtils.getValue(afterCaseCaseAffiliate, column); - if (StrUtil.isEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue)) { - affiliateChangeColumn.append(column).append(","); - continue; - } - if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isEmpty(afterValue)) { - affiliateChangeColumn.append(column).append(","); - continue; - } - if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue) && !Objects.equals(beforeValue, afterValue)) { - affiliateChangeColumn.append(column).append(","); - continue; - - } - - } - - - } else { - for (String column : affiliateColumns) { - - affiliateChangeColumn.append(column).append(","); - } - } - afterCaseCaseAffiliate.setChangeColumn(affiliateChangeColumn.toString()); - - } - - - } - } +// private void compareAffilate(CaseApplication beforeCase, CaseApplication afterCase) { +// // 对比人员字段 +// List beforeCaseCaseAffiliates = beforeCase.getCaseAffiliates(); +// List afterCaseCaseAffiliates = afterCase.getCaseAffiliates(); +// Map beforeCaseCaseAffiliateMap = null; +// if (CollectionUtil.isNotEmpty(beforeCaseCaseAffiliates)) { +// // 转为map +// beforeCaseCaseAffiliateMap = beforeCaseCaseAffiliates.stream().collect(Collectors.toMap(CaseAffiliate::getIdentityType, v -> v, (n1, n2) -> n2)); +// } +// StringBuilder affiliateChangeColumn; +// // 如果上一个版本和现版本有一个为空,那么所有字段都修改 +// if (beforeCaseCaseAffiliates != null && afterCaseCaseAffiliates == null) { +// affiliateChangeColumn = new StringBuilder(); +// for (String column : affiliateColumns) { +// +// affiliateChangeColumn.append(column).append(","); +// } +// +// } else if (beforeCaseCaseAffiliates == null && afterCaseCaseAffiliates != null) { +// affiliateChangeColumn = new StringBuilder(); +// for (String column : affiliateColumns) { +// +// affiliateChangeColumn.append(column).append(","); +// } +// } else if (beforeCaseCaseAffiliates != null && afterCaseCaseAffiliates != null) { +// for (CaseAffiliate afterCaseCaseAffiliate : afterCaseCaseAffiliates) { +// // 找到相同身份类型的数据,进行对比 +// affiliateChangeColumn = new StringBuilder(); +// int identityType = afterCaseCaseAffiliate.getIdentityType(); +// if (beforeCaseCaseAffiliateMap != null && beforeCaseCaseAffiliateMap.containsKey(identityType)) { +// CaseAffiliate beforeCaseCaseAffiliate = beforeCaseCaseAffiliateMap.get(identityType); +// for (String column : affiliateColumns) { +// String beforeValue = ObjectFieldUtils.getValue(beforeCaseCaseAffiliate, column); +// String afterValue = ObjectFieldUtils.getValue(afterCaseCaseAffiliate, column); +// if (StrUtil.isEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue)) { +// affiliateChangeColumn.append(column).append(","); +// continue; +// } +// if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isEmpty(afterValue)) { +// affiliateChangeColumn.append(column).append(","); +// continue; +// } +// if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue) && !Objects.equals(beforeValue, afterValue)) { +// affiliateChangeColumn.append(column).append(","); +// continue; +// +// } +// +// } +// +// +// } else { +// for (String column : affiliateColumns) { +// +// affiliateChangeColumn.append(column).append(","); +// } +// } +// afterCaseCaseAffiliate.setChangeColumn(affiliateChangeColumn.toString()); +// +// } +// +// +// } +// } /** * 同意撤销 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 acd88a2..624fe14 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 @@ -12,11 +12,13 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.*; import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.UpdateSubmitStatus; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.ServiceException; @@ -26,11 +28,10 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.thread.ThreadPoolUtil; import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.mapper.*; -import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; -import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO; -import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount; +import com.ruoyi.wisdomarbitrate.domain.dto.CaseApplicationDTO; +import com.ruoyi.wisdomarbitrate.domain.entity.CaseAffiliateEntity; +import com.ruoyi.wisdomarbitrate.domain.vo.*; import com.ruoyi.wisdomarbitrate.domain.*; -import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO; import com.ruoyi.wisdomarbitrate.mapper.*; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; @@ -58,6 +59,7 @@ import java.time.LocalDate; import java.time.ZoneId; import java.util.*; import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -65,6 +67,7 @@ import java.util.zip.ZipOutputStream; import static cn.hutool.system.SystemUtil.getUserInfo; import static com.google.common.io.Files.getFileExtension; +import static com.ruoyi.common.constant.CaseApplicationConstants.HEAD_CHECK_ARBITRATION; import static com.ruoyi.common.core.domain.AjaxResult.error; import static com.ruoyi.common.core.domain.AjaxResult.success; import static com.ruoyi.common.utils.PageUtils.startPage; @@ -134,249 +137,22 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { private CaseZipImportImpl caseZipImportImpl; @Autowired IAdjudicationService adjudicationService; + @Autowired + private RedisCache redisCache; // 手机号正则 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 EMAIL_PATTERN = Pattern.compile("^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$"); // 基本字段校验 - private static final String[] baseColumns = {"caseName","caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag", - "claimPrinciOwed","arbitratClaims"}; + private static final String[] baseColumns = {"caseName", "caseSubjectAmount", "loanStartDate", "loanEndDate", "contractNumber", "claimInterestOwed", "claimLiquidDamag", + "claimPrinciOwed", "arbitratClaims"}; // 申请人字段校验 - private static final String[] applicAffiliateColumns = {"name", "contactTelphone","contactAddress","workTelphone","workAddress", - "residenAffili","compLegalPerson", - "compLegalperPost","email","nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent"}; - // 申请人/被申请人代理人字段校验 - private static final String[] applicAgentAffiliateColumns = {"nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent"}; + private static final String[] applicAffiliateColumns = {"name", "phone", "address", "home", "email"}; // 被申请人字段校验 - private static final String[] dectborAffiliateColumns = {"name", "identityNum","contactTelphone","contactAddress","workTelphone","workAddress", - "residenAffili","responSex","responBirth","email","nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent"}; - /** - * 案件列表查询 - * - * @param req - * @return - */ -// public List list(CaseApplication req) { -// // 查询的案件状态 -// List caseStatusList=new ArrayList<>(); -// // 根据用户查询角色 -// LoginUser loginUser = SecurityUtils.getLoginUser(); -// // 根据id查询用户 -// SysUser sysUser = sysUserMapper.selectUserById(loginUser.getUserId()); -// List roles = sysUser.getRoles(); -// req.setUserName(sysUser.getUserName()); -// if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) { -// startPage(); -// List list = caseApplicationMapper.list(req, null,null); -// // 设置申请人被申请人及签名按钮限 -// // setAfflicate(new HashMap<>(),list,loginUser.getUserId(),roles); -// return list; -// } -// if(CollectionUtil.isEmpty(roles) ){ -// throw new RuntimeException("用户未分配角色,请联系管理员"); -// } -// List roleIds = roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()); -// -// // 流程名称分组 -// Map flowNameMap = allCaseFlows.stream().collect(Collectors.toMap(MsCaseFlow::getCaseStatusName, MsCaseFlow::getSort, (k1, k2) -> k2)); -// -// // 是否查询所有 -// boolean isSelectAll = false; -// -// for (SysRole role : roles) { -// if(StrUtil.isNotEmpty(role.getRoleName())){ -// if(StrUtil.contains(role.getRoleName(),"财务") -// ||StrUtil.contains(role.getRoleName(),"法律顾问") -// ||StrUtil.contains(role.getRoleName(),"部门长") -// ){ -// isSelectAll=true; -// roleIds=null; -// } -// if(StrUtil.equals(role.getRoleName(),"调解员")) { -// req.setMediatorId(String.valueOf(sysUser.getUserId())); -// } -// } -// } -// if(!isSelectAll){ -// req.setUserId(String.valueOf(loginUser.getUserId())); -// } -// if(req.getMediationMethod()!=null){ -// // 查询视频审理 -// req.setCaseFlowId(9); -// } -// startPage(); -// -// // 查询案件列表 -// List list = caseApplicationMapper.list(req, caseFlowIds,roleIds); -// // 设置申请人被申请人及签名按钮限 -// // setAfflicate(flowNameMap,list,loginUser.getUserId(),roles); -// return list; -// } - - /** - * 数据权限:1.每个人不同的角色,而每个角色可以操作不同的案件状态 - * 2.申请人:金融机构下,可以看到改机构的所有的案件 - * 3.被申请人:可以看到自己相关的案件(案件有被申请人相关的信息) - * 4.仲裁员:案件选定了某个仲裁员后,该仲裁员就可以查看该案件 - * 5.仲裁委(部门长):可以查看所有的案件 - * 6.法律顾问秘书:可以属于多个机构,可以查看相关机构的所有案件 - * 7.超级管理员:可以查看所有的信息和数据 - * - * @param caseApplication - * @return - */ - @Override - public List selectCaseApplicationListByRole(CaseApplication caseApplication) { - // 获取登录用户 - LoginUser loginUser = getLoginUser(); - SysUser user = loginUser.getUser(); - Long userId = user.getUserId(); - // 查询登录人身份证号 - SysUser sysUser = sysUserMapper.selectUserById(userId); - startPage(); - caseApplication.setLoginUserName(sysUser.getUserName()); - List roles = sysUser.getRoles(); - // 没有角色不能查看案件列表 - if (CollectionUtil.isEmpty(roles)) { - throw new ServiceException("该用户没有角色权限"); - } - - for (SysRole role : roles) { - if (StrUtil.isEmpty(role.getRoleName())) { - continue; - } - // 超级管理员和仲裁委(部门长)案件,可查看所有案件 - if ("超级管理员".equals(role.getRoleName()) - ) { - List caseApplicationlist = caseApplicationMapper.selectAdminCaseApplicationList(caseApplication); - if(caseApplicationlist!=null&&caseApplicationlist.size()>0){ - for(CaseApplication caseApplicationsel : caseApplicationlist){ - Integer caseStatus = caseApplicationsel.getCaseStatus(); - if(caseStatus.intValue() == CaseApplicationConstants.CHECK_ARBITRATION_METHOD){ - Integer applicantIsWrittenHear = caseApplicationsel.getApplicantIsWrittenHear(); - Integer respondentIsWrittenHear = caseApplicationsel.getRespondentIsWrittenHear(); - if(applicantIsWrittenHear!=null&&respondentIsWrittenHear!=null){ - if(applicantIsWrittenHear.intValue()==respondentIsWrittenHear.intValue()){ - caseApplicationsel.setArbitraMethodIssame(1); - if(applicantIsWrittenHear.intValue()==1&&respondentIsWrittenHear.intValue()==1){ - caseApplicationsel.setArbitratMethod(2); - }else { - caseApplicationsel.setArbitratMethod(1); - } - }else { - caseApplicationsel.setArbitraMethodIssame(2); - String applicantarbitratMethod = ""; - String respondentbitratMethod = ""; - if(applicantIsWrittenHear.intValue()==1){ - applicantarbitratMethod = "书面审理"; - }else { - applicantarbitratMethod = "开庭审理"; - } - if(respondentIsWrittenHear.intValue()==1){ - respondentbitratMethod = "书面审理"; - }else { - respondentbitratMethod = "开庭审理"; - } - String arbitratMethodIllustrate = "当前案件开庭方式:申请人选择开庭方式为"+applicantarbitratMethod+ - "被申请人选择开庭方式为"+respondentbitratMethod+",请确定开庭方式。"; - caseApplicationsel.setArbitratMethodIllustrate(arbitratMethodIllustrate); - } - } - - } - } - } - return caseApplicationlist; - } - if ("仲裁委".equals(role.getRoleName()) - || "部门长".equals(role.getRoleName())) { - List caseStatusList = new ArrayList<>(); - caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL); - caseStatusList.add(CaseApplicationConstants.CHECK_ARBITRATION); - // caseStatusList.add(CaseApplicationConstants.ARBITRATED_SEAL); - caseApplication.setDeptHeadStatus(caseStatusList); - caseApplication.setIsOtherRole(1); - } - if ("仲裁员".equals(role.getRoleName())) { - caseApplication.setUserId(String.valueOf(userId)); - caseApplication.setIsOtherRole(1); - } - if ("财务".equals(role.getRoleName())) { - caseApplication.setIsOtherRole(1); - caseApplication.setFinanceStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM); - } - if ("法律顾问".equals(role.getRoleName())) { - // 秘书查看所有案件 - // 查询角色有关的用户部门 - List deptIds = new ArrayList<>(); - deptIds.add(sysUser.getDeptId()); - caseApplication.setDeptIds(deptIds); - } - if ("申请人".equals(role.getRoleName())) { - // caseApplication.setIsOtherRole(1); - // 查询有关的用户部门 - caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId())); - } - if ("被申请人".equals(role.getRoleName())) { - caseApplication.setIsOtherRole(1); - // - caseApplication.setIdCard(String.valueOf(sysUser.getIdCard())); - } - if ("代理人".equals(role.getRoleName())) { - caseApplication.setIsOtherRole(1); - // 查询角色有关的用户部门 - // List agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId()); - List agentDeptIds = new ArrayList<>(); - agentDeptIds.add(sysUser.getDeptId()); - caseApplication.setAgentDeptIds(agentDeptIds); - } - } - - - // 根据条件查询申请人,被申请人,仲裁员,法律顾问案件 -// return caseApplicationMapper.selectCaseApplicationList(caseApplication); - List caseApplications = caseApplicationMapper.selectCaseApplicationList(caseApplication); - if(caseApplications!=null&&caseApplications.size()>0){ - for(CaseApplication caseApplicationsel : caseApplications){ - Integer caseStatus = caseApplicationsel.getCaseStatus(); - if(caseStatus.intValue() == CaseApplicationConstants.CHECK_ARBITRATION_METHOD){ - Integer applicantIsWrittenHear = caseApplicationsel.getApplicantIsWrittenHear(); - Integer respondentIsWrittenHear = caseApplicationsel.getRespondentIsWrittenHear(); - if(applicantIsWrittenHear!=null&&respondentIsWrittenHear!=null){ - if(applicantIsWrittenHear.intValue()==respondentIsWrittenHear.intValue()){ - caseApplicationsel.setArbitraMethodIssame(1); - if(applicantIsWrittenHear.intValue()==1&&respondentIsWrittenHear.intValue()==1){ - caseApplicationsel.setArbitratMethod(2); - }else { - caseApplicationsel.setArbitratMethod(1); - } - }else { - caseApplicationsel.setArbitraMethodIssame(2); - String applicantarbitratMethod = ""; - String respondentbitratMethod = ""; - if(applicantIsWrittenHear.intValue()==1){ - applicantarbitratMethod = "书面审理"; - }else { - applicantarbitratMethod = "开庭审理"; - } - if(respondentIsWrittenHear.intValue()==1){ - respondentbitratMethod = "书面审理"; - }else { - respondentbitratMethod = "开庭审理"; - } - String arbitratMethodIllustrate = "当前案件开庭方式:申请人选择开庭方式为"+applicantarbitratMethod+ - "被申请人选择开庭方式为"+respondentbitratMethod+",请确定开庭方式。"; - caseApplicationsel.setArbitratMethodIllustrate(arbitratMethodIllustrate); - } - } - - } - } - } - return caseApplications; - - } +// private static final String[] dectborAffiliateColumns = {"name", "identityNum", "contactTelphone", "contactAddress", "workTelphone", "workAddress", +// "residenAffili", "responSex", "responBirth", "email", "nameAgent", "identityNumAgent", "contactTelphoneAgent", "contactAddressAgent"}; + private static final String[] dectborAffiliateColumns = {"name", "phone", "address", "home", "email"}; /** * 分页查询 @@ -389,14 +165,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { * @return */ public List page(CaseApplication caseApplication) { - List caseApplications= new ArrayList<>(); + List caseApplications = new ArrayList<>(); // 获取登录用户 LoginUser loginUser = getLoginUser(); SysUser user = loginUser.getUser(); Long userId = user.getUserId(); // 查询登录人,根据邮箱查询 SysUser sysUser = sysUserMapper.selectUserById(userId); - if(sysUser==null){ + if (sysUser == null) { throw new ServiceException("未获取到登录用户信息"); } @@ -406,109 +182,161 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { if (CollectionUtil.isEmpty(roles)) { throw new ServiceException("该用户没有角色权限"); } + // 是否嗲三方代理人 + boolean agentFlag = false; List caseStatusList = new ArrayList<>(); - List roleNames = roles.stream().map(SysRole::getRoleName).collect(Collectors.toList()); + List roleIds = roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()); startPage(); + // 查看所有权限 + if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) { + startPage(); + caseApplication.setIsOtherRole(1); + caseApplications = caseApplicationMapper.list(caseApplication, caseStatusList, null); + setArbitorMethod(caseApplications, agentFlag); + return caseApplications; + } + for (SysRole role : roles) { - if(StrUtil.isEmpty(role.getRoleName())){ + if (StrUtil.isEmpty(role.getRoleName())) { continue; } - // 查看所有权限 - if("超级管理员".equals(role.getRoleName())){ - caseApplication.setIsOtherRole(1); - caseApplications = caseApplicationMapper.list(caseApplication,caseStatusList,null); - setArbitorMethod(caseApplications); - return caseApplications; + if (StrUtil.contains(role.getRoleName(), "财务") + || StrUtil.contains(role.getRoleName(), "法律顾问") + || StrUtil.contains(role.getRoleName(), "部门长") + ) { + roleIds = null; } - caseApplication.setLoginUserName(sysUser.getUserName()); - caseApplication.setLoginUserPhone(sysUser.getPhonenumber()); - if("申请人".equals(role.getRoleName())){ - // 申请人在生成裁决书之前都可以修改案件 - Integer[] array = {0,-1,1,2,3,4,5,6,7,8,9,10,31}; - caseStatusList.addAll(Arrays.asList(array)); + if ("申请人".equals(role.getRoleName()) || "被申请人".equals(role.getRoleName())) { + caseApplication.setUserId(userId); } - if("被申请人".equals(role.getRoleName())) { - // 案件质证,开庭审理,书面审理 - caseStatusList.add(4); - caseStatusList.add(8); - caseStatusList.add(9); + if (StrUtil.contains(role.getRoleName(), "代理")) { + caseApplication.setCreateBy(String.valueOf(sysUser.getUserName())); + agentFlag = true; + } - if("仲裁员".equals(role.getRoleName())){ - caseApplication.setIsOtherRole(1); - Integer[] array = {7,8,9,13,18}; - caseStatusList.addAll(Arrays.asList(array)); + if (StrUtil.equals(role.getRoleName(), "仲裁员")) { caseApplication.setArbitratorId(String.valueOf(sysUser.getUserId())); } - if ("仲裁委".equals(role.getRoleName()) - || "部门长".equals(role.getRoleName())) { - caseApplication.setIsOtherRole(1); - // 组庭确定,部门长审核裁决书 - caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL); - caseStatusList.add(CaseApplicationConstants.CHECK_ARBITRATION); - } - if ("财务".equals(role.getRoleName())) { - caseApplication.setIsOtherRole(1); - caseStatusList.add(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM); - } - if ("法律顾问".equals(role.getRoleName()) || "秘书".equals(role.getRoleName()) ) { - caseApplication.setIsOtherRole(1); - Integer[] array = {1,5,8,9,11,14,15,16,31}; - caseStatusList.addAll(Arrays.asList(array)); - } +// if ("申请人".equals(role.getRoleName())) { +// // 申请人在生成裁决书之前都可以修改案件 +// Integer[] array = {0, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 31}; +// caseStatusList.addAll(Arrays.asList(array)); +// } +// if ("被申请人".equals(role.getRoleName())) { +// // 案件质证,开庭审理,书面审理 +// caseStatusList.add(4); +// caseStatusList.add(8); +// caseStatusList.add(9); +// } +// if ("仲裁员".equals(role.getRoleName())) { +// caseApplication.setIsOtherRole(1); +// Integer[] array = {7, 8, 9, 13, 18}; +// caseStatusList.addAll(Arrays.asList(array)); +// caseApplication.setArbitratorId(String.valueOf(sysUser.getUserId())); +// } +// if ("仲裁委".equals(role.getRoleName()) +// || "部门长".equals(role.getRoleName())) { +// caseApplication.setIsOtherRole(1); +// // 组庭确定,部门长审核裁决书 +// caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL); +// caseStatusList.add(CaseApplicationConstants.CHECK_ARBITRATION); +// } +// if ("财务".equals(role.getRoleName())) { +// caseStatusList.add(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM); +// } +// if ("法律顾问".equals(role.getRoleName()) || "秘书".equals(role.getRoleName())) { +// Integer[] array = {1, 5, 8, 9, 11, 14, 15, 16, 31}; +// caseStatusList.addAll(Arrays.asList(array)); +// } } - caseApplications = caseApplicationMapper.list(caseApplication,caseStatusList, roleNames); - setArbitorMethod(caseApplications); + startPage(); + caseApplications = caseApplicationMapper.list(caseApplication, caseStatusList, roleIds); + setArbitorMethod(caseApplications, agentFlag); return caseApplications; } /** * 设置仲裁方式 - * @param caseApplications + * + * @param list + * @param agentFlag 是否第三方代理人 */ - private void setArbitorMethod(List caseApplications) { + private void setArbitorMethod(List list, boolean agentFlag) { - if(CollectionUtil.isEmpty(caseApplications)){ + if (CollectionUtil.isEmpty(list)) { return; } - for(CaseApplication caseApplicationsel : caseApplications){ - Integer caseStatus = caseApplicationsel.getCaseStatus(); - if(caseStatus.intValue() == CaseApplicationConstants.CHECK_ARBITRATION_METHOD){ - Integer applicantIsWrittenHear = caseApplicationsel.getApplicantIsWrittenHear(); - Integer respondentIsWrittenHear = caseApplicationsel.getRespondentIsWrittenHear(); - if(applicantIsWrittenHear!=null&&respondentIsWrittenHear!=null){ - if(applicantIsWrittenHear.intValue()==respondentIsWrittenHear.intValue()){ - caseApplicationsel.setArbitraMethodIssame(1); - if(applicantIsWrittenHear.intValue()==1&&respondentIsWrittenHear.intValue()==1){ - caseApplicationsel.setArbitratMethod(2); - caseApplicationsel.setArbitratMethodName("书面审理"); - }else { - caseApplicationsel.setArbitratMethod(1); - caseApplicationsel.setArbitratMethodName("开庭审理"); - } + // 是否调解员 + boolean isMediatorRole = false; + List caseIds = list.stream().map(CaseApplication::getId).collect(Collectors.toList()); + List affiliatesList = caseAffiliateMapper.selectCaseAffiliateByCaseIds(caseIds); + // 根据案件id分组 + Map> affiliateMap=new HashMap<>(); + if(CollectionUtil.isNotEmpty(affiliatesList)){ + affiliateMap = affiliatesList.stream().collect(Collectors.groupingBy(CaseAffiliateEntity::getCaseAppliId)); + } + for (CaseApplication vo : list) { + if (StrUtil.isNotEmpty(vo.getArbitratorId()) && vo.getArbitratorId().equals(String.valueOf(SecurityUtils.getUserId()))) { + isMediatorRole = true; + vo.setArbitratorFlag(1); + } else { + vo.setArbitratorFlag(0); + } + // 第三方代理人标志 + if (StrUtil.isNotEmpty(vo.getCreateBy())) { + if (StrUtil.isEmpty(SecurityUtils.getUsername())) { + vo.setAgentFlag(0); + } else { + // todo 如果案件流程id变了需要改 + if (StrUtil.equals(SecurityUtils.getUsername(), vo.getCreateBy()) && agentFlag ) { + vo.setAgentFlag(1); + } else { + vo.setAgentFlag(0); + } + } + } else { + vo.setAgentFlag(0); + } + // 设置申请人和被申请人 + if ( affiliateMap.containsKey(vo.getId())) { + List affiliates = affiliateMap.get(vo.getId()); + StringBuilder applicantName = new StringBuilder(); + StringBuilder respondentName = new StringBuilder(); + for (CaseAffiliateEntity affiliate : affiliates) { - }else { - caseApplicationsel.setArbitraMethodIssame(2); - String applicantarbitratMethod = ""; - String respondentbitratMethod = ""; - if(applicantIsWrittenHear.intValue()==1){ - applicantarbitratMethod = "书面审理"; - }else { - applicantarbitratMethod = "开庭审理"; - } - if(respondentIsWrittenHear.intValue()==1){ - respondentbitratMethod = "书面审理"; - }else { - respondentbitratMethod = "开庭审理"; - } - String arbitratMethodIllustrate = "当前案件开庭方式:申请人选择开庭方式为"+applicantarbitratMethod+ - "被申请人选择开庭方式为"+respondentbitratMethod+",请确定开庭方式。"; - caseApplicationsel.setArbitratMethodIllustrate(arbitratMethodIllustrate); + if (affiliate.getOrganizeFlag() == null || affiliate.getOrganizeFlag() != 1) { + if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("申请人") + && affiliate.getRoleType() != null && affiliate.getRoleType() == 1 && StrUtil.isNotEmpty(affiliate.getName()) + && !applicantName.toString().contains(affiliate.getName() + Constants.CN_SPLIT_COMMA)) { + applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + } + } else { + // 组织机构 + if (affiliate.getRoleType() != null && affiliate.getRoleType() == 1 && StrUtil.isNotEmpty(affiliate.getApplicantOrgName()) + && !applicantName.toString().contains(affiliate.getApplicantOrgName() + Constants.CN_SPLIT_COMMA)) { + applicantName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); + } + } + if (affiliate.getOrganizeFlag() == null || affiliate.getOrganizeFlag() != 1) { + if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") + && affiliate.getRoleType() != null && affiliate.getRoleType() == 3 && StrUtil.isNotEmpty(affiliate.getName()) + && !respondentName.toString().contains(affiliate.getName() + Constants.CN_SPLIT_COMMA)) { + + respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + } + } else { + // 组织机构 + if (affiliate.getRoleType() != null && affiliate.getRoleType() == 3 && StrUtil.isNotEmpty(affiliate.getApplicantOrgName()) && !respondentName.toString().contains(affiliate.getApplicantOrgName() + Constants.CN_SPLIT_COMMA)) { + respondentName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); } } } + vo.setApplicantName(removeLastComma(applicantName.toString(), Constants.CN_SPLIT_COMMA)); + vo.setRespondentName(removeLastComma(respondentName.toString(), Constants.CN_SPLIT_COMMA)); } + } } @Override @@ -518,73 +346,93 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { Long userId = user.getUserId(); // 查询登录人,根据邮箱查询 SysUser sysUser = sysUserMapper.selectUserById(userId); - if(sysUser==null){ + if (sysUser == null) { throw new ServiceException("未获取到登录用户信息"); } - - - List roles = sysUser.getRoles(); - // 没有角色不能查看案件列表 - if (CollectionUtil.isEmpty(roles)) { - throw new ServiceException("该用户没有角色权限"); - } - List caseStatusList = new ArrayList<>(); - List roleNames = roles.stream().map(SysRole::getRoleName).collect(Collectors.toList()); - ToDoCount toDoCount=null; + ToDoCount toDoCount = null; CaseApplication caseApplication = new CaseApplication(); - for (SysRole role : roles) { - if(StrUtil.isEmpty(role.getRoleName())){ - continue; + List caseStatusList = new ArrayList<>(); + if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) { + caseApplication.setCreateBy(String.valueOf(sysUser.getUserName())); + toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication, caseStatusList, null); + if (toDoCount == null) { + toDoCount = new ToDoCount(); } - // 查看所有权限 - if("超级管理员".equals(role.getRoleName())){ - caseApplication.setIsOtherRole(1); - toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication,caseStatusList,null); - if(toDoCount==null){ - toDoCount=new ToDoCount(); - } - return toDoCount; - } - caseApplication.setLoginUserName(sysUser.getUserName()); - caseApplication.setLoginUserPhone(sysUser.getPhonenumber()); + return toDoCount; + } else { - if("申请人".equals(role.getRoleName())){ - // 申请人在生成裁决书之前都可以修改案件 - Integer[] array = {0,-1,1,2,3,4,5,6,7,8,9,10,31}; - caseStatusList.addAll(Arrays.asList(array)); + List roles = sysUser.getRoles(); + // 没有角色不能查看案件列表 + if (CollectionUtil.isEmpty(roles)) { + throw new ServiceException("该用户没有角色权限"); } - if("被申请人".equals(role.getRoleName())) { - // 案件质证,开庭审理,书面审理 - caseStatusList.add(4); - caseStatusList.add(8); - caseStatusList.add(9); + + List roleIds = roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()); + + for (SysRole role : roles) { + if (StrUtil.isEmpty(role.getRoleName())) { + continue; + } + if (StrUtil.isEmpty(role.getRoleName())) { + continue; + } + if (StrUtil.contains(role.getRoleName(), "财务") + || StrUtil.contains(role.getRoleName(), "法律顾问") + || StrUtil.contains(role.getRoleName(), "部门长") + ) { + roleIds = null; + } + if ("申请人".equals(role.getRoleName()) || "被申请人".equals(role.getRoleName())) { + caseApplication.setUserId(userId); + } + if (StrUtil.contains(role.getRoleName(), "代理")) { + caseApplication.setCreateBy(String.valueOf(sysUser.getUserName())); + + } + if (StrUtil.equals(role.getRoleName(), "仲裁员")) { + caseApplication.setArbitratorId(String.valueOf(sysUser.getUserId())); + } +// caseApplication.setLoginUserName(sysUser.getUserName()); +// caseApplication.setLoginUserPhone(sysUser.getPhonenumber()); +// +// if ("申请人".equals(role.getRoleName())) { +// // 申请人在生成裁决书之前都可以修改案件 +// Integer[] array = {0, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 31}; +// caseStatusList.addAll(Arrays.asList(array)); +// } +// if ("被申请人".equals(role.getRoleName())) { +// // 案件质证,开庭审理,书面审理 +// caseStatusList.add(4); +// caseStatusList.add(8); +// caseStatusList.add(9); +// } +// if ("仲裁员".equals(role.getRoleName())) { +// caseApplication.setIsOtherRole(1); +// Integer[] array = {7, 8, 9, 13, 18}; +// caseStatusList.addAll(Arrays.asList(array)); +// caseApplication.setArbitratorId(String.valueOf(sysUser.getUserId())); +// } +// if ("仲裁委".equals(role.getRoleName()) +// || "部门长".equals(role.getRoleName())) { +// caseApplication.setIsOtherRole(1); +// // 组庭确定,部门长审核裁决书 +// caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL); +// caseStatusList.add(CaseApplicationConstants.CHECK_ARBITRATION); +// } +// if ("财务".equals(role.getRoleName())) { +// caseApplication.setIsOtherRole(1); +// caseStatusList.add(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM); +// } +// if ("法律顾问".equals(role.getRoleName()) || "秘书".equals(role.getRoleName())) { +// caseApplication.setIsOtherRole(1); +// Integer[] array = {1, 5, 8, 9, 11, 14, 15, 16, 31}; +// caseStatusList.addAll(Arrays.asList(array)); +// } } - if("仲裁员".equals(role.getRoleName())){ - caseApplication.setIsOtherRole(1); - Integer[] array = {7,8,9,13,18}; - caseStatusList.addAll(Arrays.asList(array)); - caseApplication.setArbitratorId(String.valueOf(sysUser.getUserId())); + toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication, caseStatusList, roleIds); + if (toDoCount == null) { + toDoCount = new ToDoCount(); } - if ("仲裁委".equals(role.getRoleName()) - || "部门长".equals(role.getRoleName())) { - caseApplication.setIsOtherRole(1); - // 组庭确定,部门长审核裁决书 - caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL); - caseStatusList.add(CaseApplicationConstants.CHECK_ARBITRATION); - } - if ("财务".equals(role.getRoleName())) { - caseApplication.setIsOtherRole(1); - caseStatusList.add(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM); - } - if ("法律顾问".equals(role.getRoleName()) || "秘书".equals(role.getRoleName()) ) { - caseApplication.setIsOtherRole(1); - Integer[] array = {1,5,8,9,11,14,15,16,31}; - caseStatusList.addAll(Arrays.asList(array)); - } - } - toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication,caseStatusList,roleNames); - if(toDoCount==null){ - toDoCount=new ToDoCount(); } return toDoCount; } @@ -596,13 +444,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication); // 当前案件节点 Integer caseStatus = caseApplicationselect.getCaseStatus(); - List allCaseNode= getAllCaseNode(caseApplicationselect.getArbitratMethod()); - if(caseApplicationselect.getArbitratMethod()!=null){ - if(caseApplicationselect.getArbitratMethod().equals(1)) { + List allCaseNode = getAllCaseNode(caseApplicationselect.getArbitratMethod()); + if (caseApplicationselect.getArbitratMethod() != null) { + if (caseApplicationselect.getArbitratMethod().equals(1)) { // 开庭审理 allCaseNode.removeIf(record -> record.getCaseNode().equals(9)); } - if(caseApplicationselect.getArbitratMethod().equals(2)) { + if (caseApplicationselect.getArbitratMethod().equals(2)) { // 书面审理 allCaseNode.removeIf(record -> record.getCaseNode().equals(8) || record.getCaseNode().equals(31)); } @@ -616,50 +464,51 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { /** * 获取所有案件节点 * arbitratMethod : 1:开庭诉讼,2:书面诉讼 + * * @return */ private List getAllCaseNode(Integer arbitratMethod) { List allCaseNode = new ArrayList<>(); - allCaseNode.add(getCaseNode("当前节点角色:申请人", "立案申请", 0, "申请人将提交案件","下一节点角色:法律顾问")); - allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "立案审查", 1, "法律顾问将立案审查","下一节点角色:申请人")); - allCaseNode.add(getCaseNode("当前节点角色:申请人", "缴费", 2, "申请人将缴费","下一节点角色:财务")); - allCaseNode.add(getCaseNode("当前节点角色:财务", "缴费确认", 3, "财务将缴费确认","下一节点角色:被申请人")); - allCaseNode.add(getCaseNode("当前节点角色:被申请人", "案件质证", 4, "被申请人将案件质证","下一节点角色:法律顾问")); - allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "组庭审核", 5, "法律顾问将组庭审核","下一节点角色:部门长")); - allCaseNode.add(getCaseNode("当前节点角色:部门长", "组庭确定", 6, "部门长将组庭确定","下一节点角色:仲裁员")); + allCaseNode.add(getCaseNode("当前节点角色:申请人", "立案申请", 0, "申请人将提交案件", "下一节点角色:法律顾问")); + allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "立案审查", 1, "法律顾问将立案审查", "下一节点角色:申请人")); + allCaseNode.add(getCaseNode("当前节点角色:申请人", "缴费", 2, "申请人将缴费", "下一节点角色:财务")); + allCaseNode.add(getCaseNode("当前节点角色:财务", "缴费确认", 3, "财务将缴费确认", "下一节点角色:被申请人")); + allCaseNode.add(getCaseNode("当前节点角色:被申请人", "案件质证", 4, "被申请人将案件质证", "下一节点角色:法律顾问")); + allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "组庭审核", 5, "法律顾问将组庭审核", "下一节点角色:部门长")); + allCaseNode.add(getCaseNode("当前节点角色:部门长", "组庭确定", 6, "部门长将组庭确定", "下一节点角色:仲裁员")); // allCaseNode.add(getLastNodeRecord("当前节点角色:仲裁员", "审核仲裁方式", 7, "仲裁员将审核仲裁方式","下一节点角色:法律顾问")); - if(arbitratMethod==null) { - allCaseNode.add(getCaseNode("当前节点角色:仲裁员", "审核仲裁方式", 7, "仲裁员将审核仲裁方式","下一节点角色:法律顾问或仲裁员")); + if (arbitratMethod == null) { + allCaseNode.add(getCaseNode("当前节点角色:仲裁员", "审核仲裁方式", 7, "仲裁员将审核仲裁方式", "下一节点角色:法律顾问或仲裁员")); allCaseNode.add(getCaseNode("当前节点角色:法律顾问或仲裁员", "修改开庭时间或书面审理", 31, "法律顾问将修改开庭时间或仲裁员将书面审理", "下一节点角色:法律顾问,仲裁员,申请人,被申请人或仲裁员")); - // allCaseNode.add(getLastNodeRecord("当前节点角色:法律顾问", "修改开庭时间", 31, "法律顾问将修改开庭时间", "下一节点角色:法律顾问,仲裁员,申请人,被申请人")); + // allCaseNode.add(getLastNodeRecord("当前节点角色:法律顾问", "修改开庭时间", 31, "法律顾问将修改开庭时间", "下一节点角色:法律顾问,仲裁员,申请人,被申请人")); allCaseNode.add(getCaseNode("当前节点角色:法律顾问,仲裁员,申请人,被申请人或仲裁员", "开庭审理或书面审理", 8, "法律顾问,仲裁员,申请人,被申请人将开庭审理或仲裁员将书面审理", "下一节点角色:法律顾问")); - // allCaseNode.add(getLastNodeRecord("当前节点角色:仲裁员", "书面审理", 9, "仲裁员将书面审理", "下一节点角色:法律顾问")); - }else if(arbitratMethod.equals(1)){ - allCaseNode.add(getCaseNode("当前节点角色:仲裁员", "审核仲裁方式", 7, "仲裁员将审核仲裁方式","下一节点角色:法律顾问")); + // allCaseNode.add(getLastNodeRecord("当前节点角色:仲裁员", "书面审理", 9, "仲裁员将书面审理", "下一节点角色:法律顾问")); + } else if (arbitratMethod.equals(1)) { + allCaseNode.add(getCaseNode("当前节点角色:仲裁员", "审核仲裁方式", 7, "仲裁员将审核仲裁方式", "下一节点角色:法律顾问")); // 开庭 allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "修改开庭时间", 31, "法律顾问将修改开庭时间", "下一节点角色:法律顾问,仲裁员,申请人,被申请人")); allCaseNode.add(getCaseNode("当前节点角色:法律顾问,仲裁员,申请人,被申请人", "开庭审理", 8, "法律顾问,仲裁员,申请人,被申请人将开庭审理", "下一节点角色:法律顾问")); - }else if(arbitratMethod.equals(2)){ - allCaseNode.add(getCaseNode("当前节点角色:仲裁员", "审核仲裁方式", 7, "仲裁员将审核仲裁方式","下一节点角色:仲裁员")); + } else if (arbitratMethod.equals(2)) { + allCaseNode.add(getCaseNode("当前节点角色:仲裁员", "审核仲裁方式", 7, "仲裁员将审核仲裁方式", "下一节点角色:仲裁员")); // 书面 allCaseNode.add(getCaseNode("当前节点角色:仲裁员", "书面审理", 9, "仲裁员将书面审理", "下一节点角色:法律顾问")); } - allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "核验裁决书", 11, "法律顾问将核验裁决书","下一节点角色:仲裁员")); - allCaseNode.add(getCaseNode("当前节点角色:仲裁员", "仲裁员审核裁决书", 18, "仲裁员将审核裁决书","下一节点角色:部门长")); - allCaseNode.add(getCaseNode("当前节点角色:部门长", "部门长审核裁决书", 12, "部门长将审核裁决书","下一节点角色:仲裁员")); - allCaseNode.add(getCaseNode("当前节点角色:仲裁员", "裁决书签名", 13, "仲裁员将进行裁决书签名","下一节点角色:法律顾问")); - allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "裁决书用印", 14, "法律顾问将进行裁决书用印","下一节点角色:法律顾问")); - allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "裁决书送达", 15, "法律顾问将送达裁决书","下一节点角色:法律顾问")); - allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "案件归档", 16, "法律顾问将进行案件归档","")); - allCaseNode.add(getCaseNode(null, "结束", 17, "","")); + allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "核验裁决书", 11, "法律顾问将核验裁决书", "下一节点角色:仲裁员")); + allCaseNode.add(getCaseNode("当前节点角色:仲裁员", "仲裁员审核裁决书", 18, "仲裁员将审核裁决书", "下一节点角色:部门长")); + allCaseNode.add(getCaseNode("当前节点角色:部门长", "部门长审核裁决书", 12, "部门长将审核裁决书", "下一节点角色:仲裁员")); + allCaseNode.add(getCaseNode("当前节点角色:仲裁员", "裁决书签名", 13, "仲裁员将进行裁决书签名", "下一节点角色:法律顾问")); + allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "裁决书用印", 14, "法律顾问将进行裁决书用印", "下一节点角色:法律顾问")); + allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "裁决书送达", 15, "法律顾问将送达裁决书", "下一节点角色:法律顾问")); + allCaseNode.add(getCaseNode("当前节点角色:法律顾问", "案件归档", 16, "法律顾问将进行案件归档", "")); + allCaseNode.add(getCaseNode(null, "结束", 17, "", "")); return allCaseNode; } @Override @Transactional public int updateHeardate(CaseApplication caseApplication) { - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); // caseApplication.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR); caseApplication.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR); caseApplication.setLockStatus(1); @@ -672,7 +521,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { // 发送开庭日期通知短信 sendHearDateMessage(caseApplication, request, "1975139"); // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, ""); + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.MODIFY_HEARDATE, ""); return rows; } @@ -682,7 +531,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } - @Override @Transactional public AjaxResult uploadZipFile(MultipartFile file, Long id, String username, Long userId) { @@ -690,7 +538,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { return AjaxResult.error("请选择要上传的文件"); } - String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile"; + String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile"; File zipFile = null; InputStream ins = null; try { @@ -797,7 +645,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { String year = Integer.toString(now.getYear()); String month = String.format("%02d", now.getMonthValue()); String day = String.format("%02d", now.getDayOfMonth()); - // todo + // todo String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; // String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; String fileName = UUID.randomUUID().toString().replace("-", "") + "_" + substrfile; @@ -833,13 +681,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } else if ("证据材料".equals(substrTwo)) { annexType = 2; } - String savePath = "/home/ruoyi/uploadPath/upload"; String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; //将附件保存到附件表里 CaseAttach caseAttach = CaseAttach.builder() .caseAppliId(id) - .annexName(saveName) - .annexPath(savePath) + .annexName(fileName) + .annexPath(saveName) .annexType(annexType) .build(); int i = caseAttachMapper.save(caseAttach); @@ -881,14 +728,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { /** * 获取每个节点的流程 + * * @param currentRoleName 当前节点角色 - * @param caseNodeName 节点名称 - * @param caseNode 案件节点 - * @param content 内容 + * @param caseNodeName 节点名称 + * @param caseNode 案件节点 + * @param content 内容 * @return */ - private CaseLogRecord getCaseNode(String currentRoleName, String caseNodeName, int caseNode, String content,String nextRoleName) { - CaseLogRecord lastNodeRecord = new CaseLogRecord(); + private CaseLogRecord getCaseNode(String currentRoleName, String caseNodeName, int caseNode, String content, String nextRoleName) { + CaseLogRecord lastNodeRecord = new CaseLogRecord(); lastNodeRecord.setCaseNodeName(caseNodeName); lastNodeRecord.setCaseNode(caseNode); lastNodeRecord.setContent(content); @@ -897,11 +745,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { return lastNodeRecord; } - @Override - public List selectCaseApplicationList(CaseApplication caseApplication) { - return caseApplicationMapper.selectAdminCaseApplicationList(caseApplication); - - } /** * 新增案件 @@ -909,144 +752,144 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { * @param caseApplication * @return */ - @Override - @Transactional - public int insertcaseApplication(CaseApplication caseApplication) { - List columnValueList=caseApplication.getColumnValues(); - caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); - //根据仲裁费用计费规则计算应缴费用 - //暂时设置计费比率为0.01 - BigDecimal feeRate = new BigDecimal(0.01); - BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP); - caseApplication.setFeePayable(feePayable); - // 获取自动编码 - String caseNum = generateCaseNum(); - caseApplication.setCaseNum(caseNum); - // 设置批号 - - caseApplication.setBatchNumber(0); - - caseApplication.setCreateBy(getUsername()); - caseApplication.setVersion(1); - caseApplication.setId(IdWorkerUtil.getId()); - // 新增立案信息 - int rows = caseApplicationMapper.insertCaseApplication(caseApplication); - if (rows == 0) { - return rows; - } - List caseAffiliates = caseApplication.getCaseAffiliates(); - 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)); - // 查询申请人角色id - Long roleId = roleMapper.selectRoleIdByName("申请人"); - for (CaseAffiliate caseAffiliate : caseAffiliates) { - caseAffiliate.setCaseAppliId(caseApplication.getId()); - // caseAffiliate.setCaseAppliLogId(caseApplication.getId()); - if (caseAffiliate.getIdentityType() == 1 && StrUtil.isNotEmpty(caseAffiliate.getName())) { - // 将组织机构id设为申请人名称 - if (deptMap.containsKey(caseAffiliate.getName())) { - caseAffiliate.setApplicationOrganId(String.valueOf(deptMap.get(caseAffiliate.getName()))); - caseAffiliate.setApplicationOrganName(caseAffiliate.getName()); - } else { - // 如果不存在则新增 - SysDept dept = new SysDept(); - dept.setParentId(0L); - dept.setDeptName(caseAffiliate.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.setApplicationOrganId(String.valueOf(dept.getDeptId())); - caseAffiliate.setApplicationOrganName(caseAffiliate.getName()); - - } - // 组装申请代理人信息 - String agentInfoFlag = buildAgentInfo(caseAffiliate, roleId); - if (StrUtil.isNotEmpty(agentInfoFlag)) { - throw new ServiceException(agentInfoFlag); - } - } - } - // 新增案件关联人 - caseAffiliateMapper.batchCaseAffiliate(caseAffiliates); - } - - List caseAttachList = caseApplication.getCaseAttachList(); - // 是否是压缩包导入,压缩包导入则不更新附件 - boolean isZipImport = caseApplication.getImportFlag() == null || caseApplication.getImportFlag() != 2; - if (caseAttachList != null && caseAttachList.size() > 0 ) { - if(isZipImport) { - for (CaseAttach caseAttach : caseAttachList) { - caseAttach.setCaseAppliId(caseApplication.getId()); - // 修改案件附件 - caseAttachMapper.updateCaseAttach(caseAttach); - } - }else { - // 压缩包导入 - for (CaseAttach caseAttach : caseAttachList) { - caseAttach.setCaseAppliId(caseApplication.getId()); - } - caseAttachMapper.batchSave(caseAttachList); - } - } - // 新增日志 - insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, ""); - // 异步新增案件日志 - - ThreadPoolUtil.execute(() -> { - // 批量新增columnValue自定义字段 - if(CollectionUtil.isNotEmpty(columnValueList)) { - columnValueList.forEach(columnValue -> columnValue.setCaseId(caseApplication.getId())); - columnValueMapper.batchSave(columnValueList); - } - // 新增案件日志表 - caseApplication.setCaseAppliId(caseApplication.getId()); - caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode()); - caseApplication.setCaseLogId(IdWorkerUtil.getId()); - int insertRow = caseApplicationLogMapper.insert(caseApplication); - // 插入案件相关人员表日志 - if (insertRow != 0 && CollectionUtil.isNotEmpty(caseAffiliates)) { - caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getCaseLogId())); - - caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliates); - } - // 插入附件表日志 - if (CollectionUtil.isNotEmpty(caseAttachList)) { - List filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList()); - // 插入日志附件表 - if (CollectionUtil.isNotEmpty(filterList)) { - for (CaseAttach caseAttach : filterList) { - // 查询附件表 - CaseAttach attach = caseAttachMapper.queryAnnexById(caseAttach.getAnnexId()); - attach.setCaseAppliLogId(caseApplication.getCaseLogId()); - caseAttachLogMapper.save(attach); - } - } - - } - // 插入columnValueLog自定义字段日志表 - if (CollectionUtil.isNotEmpty(columnValueList)) { - columnValueList.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getCaseLogId())); - columnValueLogMapper.batchSave(columnValueList); - - } - - - }); - - return rows; - } +// @Override +// @Transactional +// public int insertcaseApplication(CaseApplication caseApplication) { +// List columnValueList=caseApplication.getColumnValues(); +// caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); +// //根据仲裁费用计费规则计算应缴费用 +// //暂时设置计费比率为0.01 +// BigDecimal feeRate = new BigDecimal(0.01); +// BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP); +// caseApplication.setFeePayable(feePayable); +// // 获取自动编码 +// String caseNum = generateCaseNum(); +// caseApplication.setCaseNum(caseNum); +// // 设置批号 +// +// caseApplication.setBatchNumber(0); +// +// caseApplication.setCreateBy(getUsername()); +// caseApplication.setVersion(1); +// caseApplication.setId(IdWorkerUtil.getId()); +// // 新增立案信息 +// int rows = caseApplicationMapper.insertCaseApplication(caseApplication); +// if (rows == 0) { +// return rows; +// } +// List caseAffiliates = caseApplication.getCaseAffiliates(); +// 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)); +// // 查询申请人角色id +// Long roleId = roleMapper.selectRoleIdByName("申请人"); +// for (CaseAffiliate caseAffiliate : caseAffiliates) { +// caseAffiliate.setCaseAppliId(caseApplication.getId()); +// // caseAffiliate.setCaseAppliLogId(caseApplication.getId()); +// if (caseAffiliate.getIdentityType() == 1 && StrUtil.isNotEmpty(caseAffiliate.getName())) { +// // 将组织机构id设为申请人名称 +// if (deptMap.containsKey(caseAffiliate.getName())) { +// caseAffiliate.setApplicationOrganId(String.valueOf(deptMap.get(caseAffiliate.getName()))); +// caseAffiliate.setApplicationOrganName(caseAffiliate.getName()); +// } else { +// // 如果不存在则新增 +// SysDept dept = new SysDept(); +// dept.setParentId(0L); +// dept.setDeptName(caseAffiliate.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.setApplicationOrganId(String.valueOf(dept.getDeptId())); +// caseAffiliate.setApplicationOrganName(caseAffiliate.getName()); +// +// } +// // 组装申请代理人信息 +// String agentInfoFlag = buildAgentInfo(caseAffiliate, roleId); +// if (StrUtil.isNotEmpty(agentInfoFlag)) { +// throw new ServiceException(agentInfoFlag); +// } +// } +// } +// // 新增案件关联人 +// caseAffiliateMapper.batchCaseAffiliate(caseAffiliates); +// } +// +// List caseAttachList = caseApplication.getCaseAttachList(); +// // 是否是压缩包导入,压缩包导入则不更新附件 +// boolean isZipImport = caseApplication.getImportFlag() == null || caseApplication.getImportFlag() != 2; +// if (caseAttachList != null && caseAttachList.size() > 0 ) { +// if(isZipImport) { +// for (CaseAttach caseAttach : caseAttachList) { +// caseAttach.setCaseAppliId(caseApplication.getId()); +// // 修改案件附件 +// caseAttachMapper.updateCaseAttach(caseAttach); +// } +// }else { +// // 压缩包导入 +// for (CaseAttach caseAttach : caseAttachList) { +// caseAttach.setCaseAppliId(caseApplication.getId()); +// } +// caseAttachMapper.batchSave(caseAttachList); +// } +// } +// // 新增日志 +// insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, ""); +// // 异步新增案件日志 +// +// ThreadPoolUtil.execute(() -> { +// // 批量新增columnValue自定义字段 +// if(CollectionUtil.isNotEmpty(columnValueList)) { +// columnValueList.forEach(columnValue -> columnValue.setCaseId(caseApplication.getId())); +// columnValueMapper.batchSave(columnValueList); +// } +// // 新增案件日志表 +// caseApplication.setCaseAppliId(caseApplication.getId()); +// caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode()); +// caseApplication.setCaseLogId(IdWorkerUtil.getId()); +// int insertRow = caseApplicationLogMapper.insert(caseApplication); +// // 插入案件相关人员表日志 +// if (insertRow != 0 && CollectionUtil.isNotEmpty(caseAffiliates)) { +// caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getCaseLogId())); +// +// caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliates); +// } +// // 插入附件表日志 +// if (CollectionUtil.isNotEmpty(caseAttachList)) { +// List filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList()); +// // 插入日志附件表 +// if (CollectionUtil.isNotEmpty(filterList)) { +// for (CaseAttach caseAttach : filterList) { +// // 查询附件表 +// CaseAttach attach = caseAttachMapper.queryAnnexById(caseAttach.getAnnexId()); +// attach.setCaseAppliLogId(caseApplication.getCaseLogId()); +// caseAttachLogMapper.save(attach); +// } +// } +// +// } +// // 插入columnValueLog自定义字段日志表 +// if (CollectionUtil.isNotEmpty(columnValueList)) { +// columnValueList.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getCaseLogId())); +// columnValueLogMapper.batchSave(columnValueList); +// +// } +// +// +// }); +// +// return rows; +// } /** * 新增案件 @@ -1054,114 +897,114 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { * @param caseApplication * @return */ - @Override - @Transactional - public int insertcaseApplication1(CaseApplication caseApplication) { - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); - caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); - //根据仲裁费用计费规则计算应缴费用 - //暂时设置计费比率为0.01 - BigDecimal feeRate = new BigDecimal(0.01); - BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP); - caseApplication.setFeePayable(feePayable); - // 获取自动编码 - String caseNum = generateCaseNum(); - caseApplication.setCaseNum(caseNum); - - caseApplication.setCreateBy(getUsername()); - caseApplication.setVersion(1); - caseApplication.setId(IdWorkerUtil.getId()); - // 新增立案信息 - int rows = caseApplicationMapper.insertCaseApplication(caseApplication); - if (rows == 0) { - return rows; - } - List caseAffiliates = caseApplication.getCaseAffiliates(); - 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)); - // 查询申请人角色id - Long roleId = roleMapper.selectRoleIdByName("申请人"); - for (CaseAffiliate caseAffiliate : caseAffiliates) { - caseAffiliate.setCaseAppliId(caseApplication.getId()); - // caseAffiliate.setCaseAppliLogId(caseApplication.getId()); - if (caseAffiliate.getIdentityType() == 1 && StrUtil.isNotEmpty(caseAffiliate.getName())) { - // 将组织机构id设为申请人名称 - if (deptMap.containsKey(caseAffiliate.getName())) { - caseAffiliate.setApplicationOrganId(String.valueOf(deptMap.get(caseAffiliate.getName()))); - caseAffiliate.setApplicationOrganName(caseAffiliate.getName()); - } else { - // 如果不存在则新增 - SysDept dept = new SysDept(); - dept.setParentId(0L); - dept.setDeptName(caseAffiliate.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.setApplicationOrganId(String.valueOf(dept.getDeptId())); - caseAffiliate.setApplicationOrganName(caseAffiliate.getName()); - - } - // 组装申请代理人信息 - String agentInfoFlag = buildAgentInfo(caseAffiliate, roleId); - if (StrUtil.isNotEmpty(agentInfoFlag)) { - throw new ServiceException(agentInfoFlag); - } - } - } - // 新增案件关联人 - caseAffiliateMapper.batchCaseAffiliate(caseAffiliates); - } - - List caseAttachList = caseApplication.getCaseAttachList(); - if (caseAttachList != null && caseAttachList.size() > 0 ) { - for (CaseAttach caseAttach : caseAttachList) { - caseAttach.setCaseAppliId(caseApplication.getId()); - } - caseAttachMapper.batchSave(caseAttachList); - } - // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, ""); - - // 新增案件日志表 - caseApplication.setCaseAppliId(caseApplication.getId()); - caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode()); - caseApplication.setCaseLogId(IdWorkerUtil.getId()); - int insertRow = caseApplicationLogMapper.insert(caseApplication); - // 插入案件相关人员表日志 - if (insertRow != 0 && CollectionUtil.isNotEmpty(caseAffiliates)) { - caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getCaseLogId())); - - caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliates); - } - // 插入附件表日志 - if (CollectionUtil.isNotEmpty(caseAttachList)) { - List filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList()); - // 插入日志附件表 - if (CollectionUtil.isNotEmpty(filterList)) { - for (CaseAttach caseAttach : filterList) { - // 查询附件表 - CaseAttach attach = caseAttachMapper.queryAnnexById(caseAttach.getAnnexId()); - attach.setCaseAppliLogId(caseApplication.getCaseLogId()); - caseAttachLogMapper.save(attach); - } - } - - } - - return rows; - } +// @Override +// @Transactional +// public int insertcaseApplication1(CaseApplication caseApplication) { +// Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); +// caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); +// //根据仲裁费用计费规则计算应缴费用 +// //暂时设置计费比率为0.01 +// BigDecimal feeRate = new BigDecimal(0.01); +// BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP); +// caseApplication.setFeePayable(feePayable); +// // 获取自动编码 +// String caseNum = generateCaseNum(); +// caseApplication.setCaseNum(caseNum); +// +// caseApplication.setCreateBy(getUsername()); +// caseApplication.setVersion(1); +// caseApplication.setId(IdWorkerUtil.getId()); +// // 新增立案信息 +// int rows = caseApplicationMapper.insertCaseApplication(caseApplication); +// if (rows == 0) { +// return rows; +// } +// List caseAffiliates = caseApplication.getCaseAffiliates(); +// 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)); +// // 查询申请人角色id +// Long roleId = roleMapper.selectRoleIdByName("申请人"); +// for (CaseAffiliate caseAffiliate : caseAffiliates) { +// caseAffiliate.setCaseAppliId(caseApplication.getId()); +// // caseAffiliate.setCaseAppliLogId(caseApplication.getId()); +// if (caseAffiliate.getIdentityType() == 1 && StrUtil.isNotEmpty(caseAffiliate.getName())) { +// // 将组织机构id设为申请人名称 +// if (deptMap.containsKey(caseAffiliate.getName())) { +// caseAffiliate.setApplicationOrganId(String.valueOf(deptMap.get(caseAffiliate.getName()))); +// caseAffiliate.setApplicationOrganName(caseAffiliate.getName()); +// } else { +// // 如果不存在则新增 +// SysDept dept = new SysDept(); +// dept.setParentId(0L); +// dept.setDeptName(caseAffiliate.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.setApplicationOrganId(String.valueOf(dept.getDeptId())); +// caseAffiliate.setApplicationOrganName(caseAffiliate.getName()); +// +// } +// // 组装申请代理人信息 +// String agentInfoFlag = buildAgentInfo(caseAffiliate, roleId); +// if (StrUtil.isNotEmpty(agentInfoFlag)) { +// throw new ServiceException(agentInfoFlag); +// } +// } +// } +// // 新增案件关联人 +// caseAffiliateMapper.batchCaseAffiliate(caseAffiliates); +// } +// +// List caseAttachList = caseApplication.getCaseAttachList(); +// if (caseAttachList != null && caseAttachList.size() > 0 ) { +// for (CaseAttach caseAttach : caseAttachList) { +// caseAttach.setCaseAppliId(caseApplication.getId()); +// } +// caseAttachMapper.batchSave(caseAttachList); +// } +// // 新增日志 +// insertCaseLog(caseApplication.getId(), currentStatus, ""); +// +// // 新增案件日志表 +// caseApplication.setCaseAppliId(caseApplication.getId()); +// caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode()); +// caseApplication.setCaseLogId(IdWorkerUtil.getId()); +// int insertRow = caseApplicationLogMapper.insert(caseApplication); +// // 插入案件相关人员表日志 +// if (insertRow != 0 && CollectionUtil.isNotEmpty(caseAffiliates)) { +// caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getCaseLogId())); +// +// caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliates); +// } +// // 插入附件表日志 +// if (CollectionUtil.isNotEmpty(caseAttachList)) { +// List filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList()); +// // 插入日志附件表 +// if (CollectionUtil.isNotEmpty(filterList)) { +// for (CaseAttach caseAttach : filterList) { +// // 查询附件表 +// CaseAttach attach = caseAttachMapper.queryAnnexById(caseAttach.getAnnexId()); +// attach.setCaseAppliLogId(caseApplication.getCaseLogId()); +// caseAttachLogMapper.save(attach); +// } +// } +// +// } +// +// return rows; +// } /** @@ -1179,7 +1022,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { if (null == maxCaseNum) { caseNum = caseNum + "001"; } else { - maxCaseNum=maxCaseNum+1; + maxCaseNum = maxCaseNum + 1; caseNum = caseNum + String.format("%03d", maxCaseNum); } return caseNum; @@ -1191,146 +1034,146 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { return caseApplicationMapper.selectCaseApplicationCount(caseApplication); } - @Override - @Transactional - public AjaxResult editCaseApplication(CaseApplication caseApplication) { - //根据仲裁费用计费规则计算应缴费用 - //暂时设置计费比率为0.01 - BigDecimal feeRate = new BigDecimal("0.01"); - BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, RoundingMode.HALF_UP); - caseApplication.setFeePayable(feePayable); - caseApplication.setUpdateBy(getUsername()); - // 立案申请状态直接修改主表信息 - if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) { - // 修改内置字段 - caseApplicationMapper.updataCaseApplication(caseApplication); - if(CollectionUtil.isNotEmpty(caseApplication.getColumnValues())) { - // 修改自定义字段 - for (ColumnValue columnValue : caseApplication.getColumnValues()) { - if(StrUtil.isNotEmpty(columnValue.getValue())) { - columnValueMapper.updateColumnValue(columnValue); - } - } - } - // 修改记录表状态为同意提交修改的内容 - caseApplication.setUpdateSubmitStatus(0); - } else { - // 修改记录表状态为已提交修改的内容 - caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.COMMITTED.getCode()); - } - List caseAffiliates = caseApplication.getCaseAffiliates(); - 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)); - // 查询申请人角色id - Long roleId = roleMapper.selectRoleIdByName("申请人"); - for (CaseAffiliate caseAffiliate : caseAffiliates) { - caseAffiliate.setCaseAppliId(caseApplication.getId()); - if (caseAffiliate.getIdentityType() == 1 && StrUtil.isNotEmpty(caseAffiliate.getName())) { - // 将组织机构id设为申请人名称 - if (deptMap.containsKey(caseAffiliate.getName())) { - caseAffiliate.setApplicationOrganName(caseAffiliate.getName()); - caseAffiliate.setApplicationOrganId(String.valueOf(deptMap.get(caseAffiliate.getName()))); - } else { - // 如果不存在则新增 - SysDept dept = new SysDept(); - dept.setParentId(0L); - dept.setDeptName(caseAffiliate.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.setApplicationOrganName(caseAffiliate.getName()); - caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId())); - - } - String agentInfoFlag = buildAgentInfo(caseAffiliate, roleId); - if (StrUtil.isNotEmpty(agentInfoFlag)) { - throw new ServiceException(agentInfoFlag); - } - - } - // 立案申请状态直接修改主表信息 - if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) { - - caseAffiliateMapper.updataCaseAffiliate(caseAffiliate); - } - } - - } - List caseAttachList = caseApplication.getCaseAttachList(); - // 立案申请状态直接修改主表信息 - if (caseAttachList != null && caseAttachList.size() > 0 - && caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) { - List filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(filterList)) { - for (CaseAttach caseAttach : caseAttachList) { - caseAttach.setCaseAppliId(caseApplication.getId()); - caseAttachMapper.updateCaseAttach(caseAttach); - } - } - - } - // 根据案件id查询最新版本号 - Integer maxVersion = caseApplicationLogMapper.selectMaxVersionByCaseId(caseApplication.getId()); - if (maxVersion == null) { - maxVersion = 1; - } - caseApplication.setVersion(maxVersion + 1); - LoginUser loginUser = getLoginUser(); - // 异步新增案件日志 - ThreadPoolUtil.execute(() -> { - try { - //新增案件日志记录 - insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_EDIT, "修改案件信息",loginUser); - caseApplication.setCaseAppliId(caseApplication.getId()); - caseApplication.setCaseLogId(IdWorkerUtil.getId()); - int insertRow = caseApplicationLogMapper.insert(caseApplication); - if (insertRow != 0) { - if (CollectionUtil.isNotEmpty(caseAffiliates)) { - caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getCaseLogId())); - // 插入案件日志人员相关表 - caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliates); - } - if (CollectionUtil.isNotEmpty(caseAttachList)) { - List filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList()); - // 插入日志附件表 - if (CollectionUtil.isNotEmpty(filterList)) { - for (CaseAttach caseAttach : filterList) { - // 查询附件表 - Long annexId = caseAttach.getAnnexId(); - CaseAttach attach = caseAttachMapper.queryAnnexById(annexId); - if(attach!=null){ - attach.setCaseAppliLogId(caseApplication.getCaseLogId()); - caseAttachLogMapper.save(attach); - } - } - } - - } - // 插入案件columnValueLog自定义字段表 - if (CollectionUtil.isNotEmpty(caseApplication.getColumnValues())) { - caseApplication.getColumnValues().forEach(columnValue -> columnValue.setCaseAppliLogId(caseApplication.getCaseLogId())); - - columnValueLogMapper.batchSave(caseApplication.getColumnValues()); - } - } - } catch (Exception e) { - throw new RuntimeException(e); - } - }); - - return success(); - } +// @Override +// @Transactional +// public AjaxResult editCaseApplication(CaseApplication caseApplication) { +// //根据仲裁费用计费规则计算应缴费用 +// //暂时设置计费比率为0.01 +// BigDecimal feeRate = new BigDecimal("0.01"); +// BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, RoundingMode.HALF_UP); +// caseApplication.setFeePayable(feePayable); +// caseApplication.setUpdateBy(getUsername()); +// // 立案申请状态直接修改主表信息 +// if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) { +// // 修改内置字段 +// caseApplicationMapper.updataCaseApplication(caseApplication); +// if(CollectionUtil.isNotEmpty(caseApplication.getColumnValues())) { +// // 修改自定义字段 +// for (ColumnValue columnValue : caseApplication.getColumnValues()) { +// if(StrUtil.isNotEmpty(columnValue.getValue())) { +// columnValueMapper.updateColumnValue(columnValue); +// } +// } +// } +// // 修改记录表状态为同意提交修改的内容 +// caseApplication.setUpdateSubmitStatus(0); +// } else { +// // 修改记录表状态为已提交修改的内容 +// caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.COMMITTED.getCode()); +// } +// List caseAffiliates = caseApplication.getCaseAffiliates(); +// 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)); +// // 查询申请人角色id +// Long roleId = roleMapper.selectRoleIdByName("申请人"); +// for (CaseAffiliate caseAffiliate : caseAffiliates) { +// caseAffiliate.setCaseAppliId(caseApplication.getId()); +// if (caseAffiliate.getIdentityType() == 1 && StrUtil.isNotEmpty(caseAffiliate.getName())) { +// // 将组织机构id设为申请人名称 +// if (deptMap.containsKey(caseAffiliate.getName())) { +// caseAffiliate.setApplicationOrganName(caseAffiliate.getName()); +// caseAffiliate.setApplicationOrganId(String.valueOf(deptMap.get(caseAffiliate.getName()))); +// } else { +// // 如果不存在则新增 +// SysDept dept = new SysDept(); +// dept.setParentId(0L); +// dept.setDeptName(caseAffiliate.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.setApplicationOrganName(caseAffiliate.getName()); +// caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId())); +// +// } +// String agentInfoFlag = buildAgentInfo(caseAffiliate, roleId); +// if (StrUtil.isNotEmpty(agentInfoFlag)) { +// throw new ServiceException(agentInfoFlag); +// } +// +// } +// // 立案申请状态直接修改主表信息 +// if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) { +// +// caseAffiliateMapper.updataCaseAffiliate(caseAffiliate); +// } +// } +// +// } +// List caseAttachList = caseApplication.getCaseAttachList(); +// // 立案申请状态直接修改主表信息 +// if (caseAttachList != null && caseAttachList.size() > 0 +// && caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) { +// List filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList()); +// if (CollectionUtil.isNotEmpty(filterList)) { +// for (CaseAttach caseAttach : caseAttachList) { +// caseAttach.setCaseAppliId(caseApplication.getId()); +// caseAttachMapper.updateCaseAttach(caseAttach); +// } +// } +// +// } +// // 根据案件id查询最新版本号 +// Integer maxVersion = caseApplicationLogMapper.selectMaxVersionByCaseId(caseApplication.getId()); +// if (maxVersion == null) { +// maxVersion = 1; +// } +// caseApplication.setVersion(maxVersion + 1); +// LoginUser loginUser = getLoginUser(); +// // 异步新增案件日志 +// ThreadPoolUtil.execute(() -> { +// try { +// //新增案件日志记录 +// insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_EDIT, "修改案件信息",loginUser); +// caseApplication.setCaseAppliId(caseApplication.getId()); +// caseApplication.setCaseLogId(IdWorkerUtil.getId()); +// int insertRow = caseApplicationLogMapper.insert(caseApplication); +// if (insertRow != 0) { +// if (CollectionUtil.isNotEmpty(caseAffiliates)) { +// caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getCaseLogId())); +// // 插入案件日志人员相关表 +// caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliates); +// } +// if (CollectionUtil.isNotEmpty(caseAttachList)) { +// List filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList()); +// // 插入日志附件表 +// if (CollectionUtil.isNotEmpty(filterList)) { +// for (CaseAttach caseAttach : filterList) { +// // 查询附件表 +// Long annexId = caseAttach.getAnnexId(); +// CaseAttach attach = caseAttachMapper.queryAnnexById(annexId); +// if(attach!=null){ +// attach.setCaseAppliLogId(caseApplication.getCaseLogId()); +// caseAttachLogMapper.save(attach); +// } +// } +// } +// +// } +// // 插入案件columnValueLog自定义字段表 +// if (CollectionUtil.isNotEmpty(caseApplication.getColumnValues())) { +// caseApplication.getColumnValues().forEach(columnValue -> columnValue.setCaseAppliLogId(caseApplication.getCaseLogId())); +// +// columnValueLogMapper.batchSave(caseApplication.getColumnValues()); +// } +// } +// } catch (Exception e) { +// throw new RuntimeException(e); +// } +// }); +// +// return success(); +// } /** @@ -1403,9 +1246,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAffiliate.setContactTelphoneAgent(agentUser.getPhonenumber()); caseAffiliate.setNameAgent(agentUser.getNickName()); caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId())); - if(StrUtil.isNotEmpty(agentUser.getIdCard())){ + if (StrUtil.isNotEmpty(agentUser.getIdCard())) { caseAffiliate.setIdentityNumAgent(agentUser.getIdCard()); - }else { + } else { caseAffiliate.setIdentityNumAgent(caseAffiliate.getIdentityNumAgent()); } List longList = new ArrayList<>(); @@ -1451,50 +1294,59 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { // 查询案件信息,做必填校验,校验不通过,提示,不能提交 StringBuilder errorMsg = new StringBuilder(); List caseApplications = caseApplicationMapper.listCaseApplicationByIds(ids); - if(CollectionUtil.isNotEmpty(caseApplications)) { + if (CollectionUtil.isNotEmpty(caseApplications)) { Map applicationMap = caseApplications.stream().collect(Collectors.toMap(CaseApplication::getId, Function.identity(), (n1, n2) -> n2)); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliateByCaseIds(ids); + List caseAffiliates = caseAffiliateMapper.selectCaseAffiliateByCaseIds(ids); // 转换为Map>形式 - Map> caseAffiliateMap = caseAffiliates.stream().collect(Collectors.groupingBy(CaseAffiliate::getCaseAppliId)); + Map> caseAffiliateMap = caseAffiliates.stream().collect(Collectors.groupingBy(CaseAffiliateEntity::getCaseAppliId)); for (Long id : ids) { - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(id); + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(id); // 必填校验 CaseApplication caseApplication = applicationMap.get(id); // 基本字段校验 - if(caseApplication!=null) { + if (caseApplication != null) { for (String baseColumn : baseColumns) { - if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseApplication, baseColumn))){ - errorMsg.append(baseColumn).append("不能为空,"); - throw new ServiceException("必填字段未填写,请完善案件信息!"); - } + if (StrUtil.isEmpty(ObjectFieldUtils.getValue(caseApplication, baseColumn))) { + errorMsg.append(baseColumn).append("不能为空,"); + throw new ServiceException("必填字段未填写,请完善案件信息!"); + } } // 校验人员 - if(CollectionUtil.isNotEmpty(caseAffiliates)){ - List affiliateList = caseAffiliateMap.get(id); - if(CollectionUtil.isNotEmpty(affiliateList)){ - for (CaseAffiliate caseAffiliate : affiliateList) { - if(caseAffiliate.getIdentityType()==1){ + if (CollectionUtil.isNotEmpty(caseAffiliates)) { + List affiliateList = caseAffiliateMap.get(id); + if (CollectionUtil.isNotEmpty(affiliateList)) { + int appCount = 0; + int resCount = 0; + for (CaseAffiliateEntity caseAffiliate : affiliateList) { + if (caseAffiliate.getOperatorFlag() != null && caseAffiliate.getOperatorFlag().equals(1) && caseAffiliate.getRoleType() != null && (caseAffiliate.getRoleType().equals(1) || caseAffiliate.getRoleType().equals(2))) { + appCount++; // 校验申请人 for (String applicAffiliateColumn : applicAffiliateColumns) { - if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseAffiliate, applicAffiliateColumn))){ + if (StrUtil.isEmpty(ObjectFieldUtils.getValue(caseAffiliate, applicAffiliateColumn))) { errorMsg.append(applicAffiliateColumn).append("不能为空,"); throw new ServiceException("必填字段未填写,请完善案件信息!"); } } - }else { + } else if (caseAffiliate.getOperatorFlag() != null && caseAffiliate.getOperatorFlag().equals(1) && caseAffiliate.getRoleType() != null && (caseAffiliate.getRoleType().equals(3) || caseAffiliate.getRoleType().equals(4))) { + resCount++; // 校验被申请人 // 校验申请人 for (String applicAffiliateColumn : dectborAffiliateColumns) { - if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseAffiliate, applicAffiliateColumn))){ + if (StrUtil.isEmpty(ObjectFieldUtils.getValue(caseAffiliate, applicAffiliateColumn))) { errorMsg.append(applicAffiliateColumn).append("不能为空,"); throw new ServiceException("必填字段未填写,请完善案件信息!"); } } } } + if (appCount == 0 || resCount == 0) { + throw new ServiceException("必填字段未填写,请完善案件信息!"); + } } } + } else { + throw new ServiceException("必填字段未填写,请完善案件信息!"); } CaseApplication application = new CaseApplication(); @@ -1503,7 +1355,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { application.setCaseStatus(CaseApplicationConstants.CASE_CHECK); rows += caseApplicationMapper.submitCaseApplication(application); // 新增日志 - insertCaseLog(application.getId(), currentStatus, ""); + insertCaseLog(application.getId(), CaseApplicationConstants.CASE_APPLICATION, ""); } } return rows; @@ -1513,19 +1365,25 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { @Transactional public int deletecaseApplicationByIds(List ids) { // 查出所有的日志id - List logIds= caseApplicationLogMapper.selectLogsByCaseIds(ids); + List logIds = caseApplicationLogMapper.selectLogsByCaseIds(ids); int rows = caseApplicationMapper.batchDeletecaseApplication(ids); // 删除日志 - if(CollectionUtil.isNotEmpty(logIds)) { + if (CollectionUtil.isNotEmpty(logIds)) { caseApplicationLogMapper.batchDeleteLog(logIds); } return rows; } + /** + * 查询详情 + * + * @param caseApplication + * @return + */ @Override public CaseApplication selectCaseApplication(CaseApplication caseApplication) { CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication); - if(caseApplicationselect==null){ + if (caseApplicationselect == null) { throw new ServiceException("案件不存在"); } CaseAffiliate caseAffiliate = new CaseAffiliate(); @@ -1542,73 +1400,161 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { List caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication); if (caseAttachList != null && caseAttachList.size() > 0) { for (CaseAttach caseAttach : caseAttachList) { - String annexName = caseAttach.getAnnexName(); - String prefix = "/profile"; - int startIndex = annexName.indexOf(prefix); - if(startIndex!=-1) { - startIndex += prefix.length(); + String annexPath = caseAttach.getAnnexPath(); + if(StrUtil.isEmpty(annexPath)){ + continue; + } + // String annexPath =annexName.replace("/profile/","/home/ruoyi/uploadPath/"); - String annexPath = "/uploadPath" + annexName.substring(startIndex); caseAttach.setAnnexPath(annexPath); - } - int startIndexnew = annexName.lastIndexOf("/"); - if (startIndexnew != -1) { - String annexNamenew = annexName.substring(startIndexnew + 1); - caseAttach.setAnnexName(annexNamenew); - } + caseAttach.setAnnexName(caseAttach.getAnnexName()); } } caseApplicationselect.setCaseAttachList(caseAttachList); - List caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if (caseAffiliatListeselect != null) { - // 查询组织机构 - List sysDepts = sysDeptMapper.selectDeptList(new SysDept()); - Map deptMap = new HashMap<>(); - if (CollectionUtil.isNotEmpty(sysDepts)) { - for (SysDept sysDept : sysDepts) { - deptMap.put(String.valueOf(sysDept.getDeptId()), sysDept.getDeptName()); - } - } - StringBuilder applicantName = new StringBuilder(); - StringBuilder respondentName = new StringBuilder(); - 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())) { - caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName())); + // 查询案件相关人员 + List msCaseAffiliates = caseApplicationService.selectAfflicatesByCaseId(caseApplication.getId()); + if (CollectionUtil.isNotEmpty(msCaseAffiliates)) { + Map> affliateMap = msCaseAffiliates.stream().collect(Collectors.groupingBy(CaseAffiliateEntity::getGroupOrder, Collectors.toList())); + CaseAffiliateVO affiliateVO = new CaseAffiliateVO(); + List applicantList = new ArrayList<>(); + List resList = new ArrayList<>(); + affiliateVO.setApplicant(applicantList); + affiliateVO.setRes(resList); + StringBuffer applicantName=new StringBuffer(); + StringBuffer respondentName=new StringBuffer(); + affliateMap.forEach((k, v) -> { + CaseAffiliateBase affiliateBase = null; + + CaseAffiliateBase resBase = null; + + for (CaseAffiliateEntity affiliate : v) { + + switch (affiliate.getRoleType()) { + case 1: + if (affiliateBase == null) { + affiliateBase = new CaseAffiliateBase(); + } + affiliateBase.setApplicant(affiliate); + if (affiliate.getOrganizeFlag() == null || affiliate.getOrganizeFlag() != 1) { + if (StrUtil.isNotEmpty(affiliate.getName()) + && !applicantName.toString().contains(affiliate.getName() + Constants.CN_SPLIT_COMMA)) { + applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + } + } else { + // 组织机构 + if ( StrUtil.isNotEmpty(affiliate.getApplicantOrgName()) + && !applicantName.toString().contains(affiliate.getApplicantOrgName() + Constants.CN_SPLIT_COMMA)) { + applicantName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); + } + } + break; + case 2: + if (affiliateBase == null) { + affiliateBase = new CaseAffiliateBase(); + } + affiliateBase.setApplicantAgent(affiliate); + break; + case 3: + if (resBase == null) { + resBase = new CaseAffiliateBase(); + } + resBase.setRes(affiliate); + if (affiliate.getOrganizeFlag() == null || affiliate.getOrganizeFlag() != 1) { + if ( StrUtil.isNotEmpty(affiliate.getName()) + && !respondentName.toString().contains(affiliate.getName() + Constants.CN_SPLIT_COMMA)) { + + respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + } + } else { + // 组织机构 + if ( StrUtil.isNotEmpty(affiliate.getApplicantOrgName()) && !respondentName.toString().contains(affiliate.getApplicantOrgName() + Constants.CN_SPLIT_COMMA)) { + respondentName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); + } + } + break; + case 4: + if (resBase == null) { + resBase = new CaseAffiliateBase(); + } + resBase.setResAgent(affiliate); + break; + default: + + break; } - applicantName.append(caseAffiliateselect.getName()).append(Constants.CN_SPLIT_COMMA); - ; - } else if (identityType == 2) { - respondentName.append(caseAffiliateselect.getName()).append(Constants.CN_SPLIT_COMMA); + + } + if (affiliateBase != null) { + applicantList.add(affiliateBase); + } + if (resBase != null) { + resList.add(resBase); + } + }); + caseApplicationselect.setAffiliate(affiliateVO); + caseApplicationselect.setApplicantName(removeLastComma(applicantName.toString(),Constants.CN_SPLIT_COMMA)); + caseApplicationselect.setRespondentName(removeLastComma(respondentName.toString(),Constants.CN_SPLIT_COMMA)); + } + caseApplicationselect.setArbitrateRecord(arbitrateRecordselect); + if (arbitrateRecordselect != null) { + caseApplicationselect.setPayRejectReason(arbitrateRecordselect.getPayRejectReason()); + // 仲裁员审核驳回原因 + caseApplicationselect.setArbitrateReject(arbitrateRecordselect.getArbitrateReject()); + caseApplicationselect.setDeptorReject(arbitrateRecordselect.getDeptorReject()); + } + // 设置仲裁方式 + Integer caseStatus = caseApplicationselect.getCaseStatus(); + if (caseStatus != null && caseStatus.equals(CaseApplicationConstants.CHECK_ARBITRATION_METHOD)) { + Integer applicantIsWrittenHear = caseApplicationselect.getApplicantIsWrittenHear(); + Integer respondentIsWrittenHear = caseApplicationselect.getRespondentIsWrittenHear(); + if (applicantIsWrittenHear != null && respondentIsWrittenHear != null) { + if (applicantIsWrittenHear.intValue() == respondentIsWrittenHear.intValue()) { + caseApplicationselect.setArbitraMethodIssame(1); + if (applicantIsWrittenHear.intValue() == 1 && respondentIsWrittenHear.intValue() == 1) { + caseApplicationselect.setArbitratMethod(2); + caseApplicationselect.setArbitratMethodName("书面审理"); + } else { + caseApplicationselect.setArbitratMethod(1); + caseApplicationselect.setArbitratMethodName("开庭审理"); + } + + } else { + caseApplicationselect.setArbitraMethodIssame(2); + String applicantarbitratMethod = ""; + String respondentbitratMethod = ""; + if (applicantIsWrittenHear.intValue() == 1) { + applicantarbitratMethod = "书面审理"; + } else { + applicantarbitratMethod = "开庭审理"; + } + if (respondentIsWrittenHear.intValue() == 1) { + respondentbitratMethod = "书面审理"; + } else { + respondentbitratMethod = "开庭审理"; + } + String arbitratMethodIllustrate = "当前案件开庭方式:申请人选择开庭方式为" + applicantarbitratMethod + + "被申请人选择开庭方式为" + respondentbitratMethod + ",请确定开庭方式。"; + caseApplicationselect.setArbitratMethodIllustrate(arbitratMethodIllustrate); } - } - caseApplicationselect.setApplicantName(removeLastComma(applicantName.toString(), Constants.CN_SPLIT_COMMA)); - caseApplicationselect.setRespondentName(removeLastComma(respondentName.toString(), Constants.CN_SPLIT_COMMA)); - caseApplicationselect.setCaseAffiliates(caseAffiliatListeselect); - caseApplicationselect.setArbitrateRecord(arbitrateRecordselect); - if(arbitrateRecordselect!=null){ - caseApplicationselect.setPayRejectReason(arbitrateRecordselect.getPayRejectReason()); - // 仲裁员审核驳回原因 - caseApplicationselect.setArbitrateReject(arbitrateRecordselect.getArbitrateReject()); - caseApplicationselect.setDeptorReject(arbitrateRecordselect.getDeptorReject()); } } + return caseApplicationselect; } + /** * 去除字符串末尾特殊字符 + * * @param input 字符串 - * @param str 去除字符串末尾的特殊字符 + * @param str 去除字符串末尾的特殊字符 * @return */ - public String removeLastComma(String input,String str) { - if(StrUtil.isEmpty(input)){ + public String removeLastComma(String input, String str) { + if (StrUtil.isEmpty(input)) { return input; } if (input.endsWith(str)) { @@ -1616,131 +1562,132 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } return input; // 如果没有末尾逗号,则直接返回原字符串 } + @Override @Transactional public String importCaseApplication(List caseApplicationList, String operName) { - StringBuilder failureMsg = new StringBuilder(); - StringBuilder successMsg = new StringBuilder(); - int successNum = 0; - List caseAffiliateLogList = new ArrayList<>(); - 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)); - } - // 查询申请人角色id - Long roleId = roleMapper.selectRoleIdByName("申请人"); - List caseApplicationListinsert = new ArrayList<>(); - for (int i = 0; i < caseApplicationList.size(); i++) { - CaseApplication caseApplication = caseApplicationList.get(i); - CaseImportValid caseImportValid = new CaseImportValid(caseApplication, deptMap); - // 导入校验 - caseImportValid.importValid(caseApplication, deptMap); - // 校验成功的数据 - if (StrUtil.isEmpty(caseApplication.getErrorMsg())) { - //根据仲裁费用计费规则计算应缴费用 - //暂时设置计费比率为0.01 - BigDecimal feeRate = new BigDecimal("0.01"); - BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, RoundingMode.HALF_UP); - caseApplication.setFeePayable(feePayable); - - //赋值CaseApplication的案件关联人信息 - List caseAffiliatesnew = new ArrayList<>(); - // 组装案件关联人信息 - assignmentCaseAffiliates(caseApplication, caseAffiliatesnew, deptMap, roleId); - caseApplication.setImportFlag(1); - caseApplicationListinsert.add(caseApplication); - } else { - // 拼接错误信息 - failureMsg.append("
").append("第").append(i + 2).append("行:").append(caseApplication.getErrorMsg().toString()); - } - } - if (caseApplicationListinsert.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.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())) { - - caseAffiliatesnew.addAll(caseApplicationinsert.getCaseAffiliates()); - } - } - caseApplicationNew.setCaseAffiliates(caseAffiliatesnew); - caseApplicationNewList.add(caseApplicationNew); - } - - for (int k = 0; k < caseApplicationNewList.size(); k++) { - CaseApplication caseApplicationItera = caseApplicationNewList.get(k); - // 新增立案信息 - caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); - caseApplicationItera.setCreateBy(getUsername()); - caseApplicationItera.setImportFlag(1); - caseApplicationItera.setId(IdWorkerUtil.getId()); - int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera); - if (rows == 0) { - continue; - } - // 新增日志 - insertCaseLog(caseApplicationItera.getId(), CaseApplicationConstants.CASE_APPLICATION, ""); - - List caseAffiliates = caseApplicationItera.getCaseAffiliates(); - if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate caseAffiliate : caseAffiliates) { - caseAffiliate.setCaseAppliId(caseApplicationItera.getId()); - - } - caseAffiliateMapper.batchCaseAffiliate(caseAffiliates); - } - // 新增案件记录 - caseApplicationItera.setCaseAppliId(caseApplicationItera.getId()); - caseApplicationItera.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode()); - caseApplicationItera.setVersion(1); - caseApplicationItera.setCaseLogId(IdWorkerUtil.getId()); - int insertRow = caseApplicationLogMapper.insert(caseApplicationItera); - if (insertRow > 0) { - caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplicationItera.getId())); - caseAffiliateLogList.addAll(caseAffiliates); - } - successNum++; - successMsg.append("
").append(successNum).append("、立案编号 ").append(caseApplicationItera.getCaseNum()).append(" 导入成功"); - } - - - } - - } - // 异步新增案件日志 - ThreadPoolUtil.execute(() -> { - if (CollectionUtil.isNotEmpty(caseAffiliateLogList)) { - // 插入案件日志人员相关表 - caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliateLogList); - } - }); - - - } else { - throw new ServiceException("导入立案申请数据不能为空!"); - } - return successMsg.append(failureMsg).toString(); +// StringBuilder failureMsg = new StringBuilder(); +// StringBuilder successMsg = new StringBuilder(); +// int successNum = 0; +// List caseAffiliateLogList = new ArrayList<>(); +// 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)); +// } +// // 查询申请人角色id +// Long roleId = roleMapper.selectRoleIdByName("申请人"); +// List caseApplicationListinsert = new ArrayList<>(); +// for (int i = 0; i < caseApplicationList.size(); i++) { +// CaseApplication caseApplication = caseApplicationList.get(i); +// CaseImportValid caseImportValid = new CaseImportValid(caseApplication, deptMap); +// // 导入校验 +// caseImportValid.importValid(caseApplication, deptMap); +// // 校验成功的数据 +// if (StrUtil.isEmpty(caseApplication.getErrorMsg())) { +// //根据仲裁费用计费规则计算应缴费用 +// //暂时设置计费比率为0.01 +// BigDecimal feeRate = new BigDecimal("0.01"); +// BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, RoundingMode.HALF_UP); +// caseApplication.setFeePayable(feePayable); +// +// //赋值CaseApplication的案件关联人信息 +// List caseAffiliatesnew = new ArrayList<>(); +// // 组装案件关联人信息 +// assignmentCaseAffiliates(caseApplication, caseAffiliatesnew, deptMap, roleId); +// caseApplication.setImportFlag(1); +// caseApplicationListinsert.add(caseApplication); +// } else { +// // 拼接错误信息 +// failureMsg.append("
").append("第").append(i + 2).append("行:").append(caseApplication.getErrorMsg().toString()); +// } +// } +// if (caseApplicationListinsert.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.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())) { +// +// caseAffiliatesnew.addAll(caseApplicationinsert.getCaseAffiliates()); +// } +// } +// caseApplicationNew.setCaseAffiliates(caseAffiliatesnew); +// caseApplicationNewList.add(caseApplicationNew); +// } +// +// for (int k = 0; k < caseApplicationNewList.size(); k++) { +// CaseApplication caseApplicationItera = caseApplicationNewList.get(k); +// // 新增立案信息 +// caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); +// caseApplicationItera.setCreateBy(getUsername()); +// caseApplicationItera.setImportFlag(1); +// caseApplicationItera.setId(IdWorkerUtil.getId()); +// int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera); +// if (rows == 0) { +// continue; +// } +// // 新增日志 +// insertCaseLog(caseApplicationItera.getId(), CaseApplicationConstants.CASE_APPLICATION, ""); +// +// List caseAffiliates = caseApplicationItera.getCaseAffiliates(); +// if (caseAffiliates != null && caseAffiliates.size() > 0) { +// for (CaseAffiliate caseAffiliate : caseAffiliates) { +// caseAffiliate.setCaseAppliId(caseApplicationItera.getId()); +// +// } +// caseAffiliateMapper.batchCaseAffiliate(caseAffiliates); +// } +// // 新增案件记录 +// caseApplicationItera.setCaseAppliId(caseApplicationItera.getId()); +// caseApplicationItera.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode()); +// caseApplicationItera.setVersion(1); +// caseApplicationItera.setCaseLogId(IdWorkerUtil.getId()); +// int insertRow = caseApplicationLogMapper.insert(caseApplicationItera); +// if (insertRow > 0) { +// caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplicationItera.getId())); +// caseAffiliateLogList.addAll(caseAffiliates); +// } +// successNum++; +// successMsg.append("
").append(successNum).append("、立案编号 ").append(caseApplicationItera.getCaseNum()).append(" 导入成功"); +// } +// +// +// } +// +// } +// // 异步新增案件日志 +// ThreadPoolUtil.execute(() -> { +// if (CollectionUtil.isNotEmpty(caseAffiliateLogList)) { +// // 插入案件日志人员相关表 +// caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliateLogList); +// } +// }); +// +// +// } else { +// throw new ServiceException("导入立案申请数据不能为空!"); +// } +// return successMsg.append(failureMsg).toString(); + // todo + return null; } - - @Override @Transactional public int pendTral(CaseApplication caseApplication) { @@ -1765,15 +1712,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { @Transactional public AjaxResult pendTralCheck(CaseApplication caseApplication) { CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication); - if(caseApplicationselect==null){ + if (caseApplicationselect == null) { throw new ServiceException("案件不存在"); } - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); for (Arbitrator arbitrator : caseApplication.getArbitrators()) { caseApplication.setCaseStatus(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL); - if(arbitrator.getId()==null || StrUtil.isEmpty(arbitrator.getArbitratorName())){ + if (arbitrator.getId() == null || StrUtil.isEmpty(arbitrator.getArbitratorName())) { return AjaxResult.warn("请选择仲裁员"); } caseApplication.setArbitratorId(String.valueOf(arbitrator.getId())); @@ -1782,27 +1729,28 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplicationMapper.submitCaseApplication(caseApplication); } // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, ""); + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL_SUBMMIT, ""); return success(); } @Override @Transactional public int verificationArbitrateRecord(CaseApplication caseApplication) { - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); // 秘书核验裁决书,流转到待仲裁员审核裁决书 - caseApplication.setCaseStatus(CaseApplicationConstants.HEAD_CHECK_ARBITRATION); + caseApplication.setCaseStatus(HEAD_CHECK_ARBITRATION); int rows = caseApplicationMapper.submitCaseApplication(caseApplication); ArbitrateRecord arbitrateRecord = caseApplication.getArbitrateRecord(); arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord); // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, ""); + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.VERPRIF_ARBITRATION, ""); return rows; } /** * 部门长审核裁决书 + * * @param caseApplication * @return */ @@ -1810,11 +1758,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { @Transactional public AjaxResult checkArbitrateRecord(CaseApplication caseApplication) { int rows = 0; - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); ArbitrateRecord arbitrateRecord = caseApplication.getArbitrateRecord(); arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord); Integer agreeOrNotCheck = caseApplication.getAgreeOrNotCheck(); - if (agreeOrNotCheck!=null&&agreeOrNotCheck.intValue() == 1) {//同意审核 + if (agreeOrNotCheck != null && agreeOrNotCheck.intValue() == 1) {//同意审核 try { //获取当前案件的裁决书 CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication); @@ -1823,7 +1771,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { for (CaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == 3) { String annexPath = caseAttach.getAnnexPath(); - String path = "/home/ruoyi" + annexPath; + if(StrUtil.isEmpty(annexPath)){ + throw new ServiceException("文件找不到"); + } + String path = annexPath.replace("/profile/","/home/ruoyi/uploadPath/"); // System.out.println("这是查询到的裁决书路径" + path); // String path = "D:\\home\\新裁决书模板.docx"; //获取文件上传地址 @@ -1952,7 +1903,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { for (SealManage manage : selectSealList) { Integer sealStatus = manage.getSealStatus(); Integer isUse = manage.getIsUse(); - if (sealStatus == 1 && isUse ==1) { + if (sealStatus == 1 && isUse == 1) { sealIdList.add(manage.getSealId()); } } @@ -1996,17 +1947,17 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } caseApplication.setCaseStatus(CaseApplicationConstants.SIGN_ARBITRATION); // 新增日志 - insertCaseLog(caseApplication.getId(),currentStatus , ""); + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CHECK_ARBITRATION, ""); rows = caseApplicationMapper.submitCaseApplication(caseApplication); } else if (agreeOrNotCheck.intValue() == 2) {//拒绝审核 - caseApplication.setCaseStatus(CaseApplicationConstants.HEAD_CHECK_ARBITRATION); - String notes=""; - if(caseApplication.getArbitrateRecord()!=null&&StrUtil.isNotEmpty(caseApplication.getArbitrateRecord().getDeptorReject())){ - notes="驳回裁决书,驳回原因:"+caseApplication.getArbitrateRecord().getDeptorReject(); + caseApplication.setCaseStatus(HEAD_CHECK_ARBITRATION); + String notes = ""; + if (caseApplication.getArbitrateRecord() != null && StrUtil.isNotEmpty(caseApplication.getArbitrateRecord().getDeptorReject())) { + notes = "驳回裁决书,驳回原因:" + caseApplication.getArbitrateRecord().getDeptorReject(); } // 新增日志 - insertCaseLog(caseApplication.getId(),currentStatus , notes); + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CHECK_ARBITRATION, notes); rows = caseApplicationMapper.submitCaseApplication(caseApplication); } @@ -2016,13 +1967,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { /** * 仲裁员审核裁决书 + * * @param caseApplication * @return */ @Override @Transactional public AjaxResult arbitratorCheckArbitrateRecord(CaseApplication caseApplication) { - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); // 同意后状态改为待部门长审核裁决书(CHECK_ARBITRATION = 12),拒绝改为待秘书核验裁决书(VERPRIF_ARBITRATION = 11) int rows = 0; Integer agreeOrNotCheck = caseApplication.getAgreeOrNotCheck(); @@ -2031,154 +1983,100 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { rows = caseApplicationMapper.submitCaseApplication(caseApplication); // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, ""); + insertCaseLog(caseApplication.getId(), HEAD_CHECK_ARBITRATION, ""); } else if (agreeOrNotCheck.intValue() == 2) {//拒绝审核 ArbitrateRecord arbitrateRecord = caseApplication.getArbitrateRecord(); - if(arbitrateRecord.getId()!=null){ + if (arbitrateRecord.getId() != null) { arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord); - }else { + } else { arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord); } caseApplication.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION); rows = caseApplicationMapper.submitCaseApplication(caseApplication); - String notes=""; - if(caseApplication.getArbitrateRecord()!=null&&StrUtil.isNotEmpty(caseApplication.getArbitrateRecord().getArbitrateReject())){ - notes="仲裁员驳回裁决书,驳回原因:"+caseApplication.getArbitrateRecord().getArbitrateReject(); + String notes = ""; + if (caseApplication.getArbitrateRecord() != null && StrUtil.isNotEmpty(caseApplication.getArbitrateRecord().getArbitrateReject())) { + notes = "仲裁员驳回裁决书,驳回原因:" + caseApplication.getArbitrateRecord().getArbitrateReject(); } // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, notes); + insertCaseLog(caseApplication.getId(), HEAD_CHECK_ARBITRATION, notes); } return success(); } - @Override @Transactional - public int submitCaseApplicationCheck(List ids, Integer agreeOrNotCheck,String caseCheckReject) { + public int submitCaseApplicationCheck(List ids, Integer agreeOrNotCheck, String caseCheckReject) { //提交立案审查 int rows = 0; for (Long id : ids) { - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(id); - String notes=""; + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(id); + String notes = ""; CaseApplication caseApplication = new CaseApplication(); caseApplication.setId(id); caseApplication.setAgreeOrNotCheck(agreeOrNotCheck); if (agreeOrNotCheck == 1) {//同意审核 caseApplication.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT); rows += caseApplicationMapper.submitCaseApplication(caseApplication); - // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, notes); + } else if (agreeOrNotCheck == 2) {//拒绝审核 - notes="驳回立案申请,驳回原因:"+caseCheckReject; + notes = "驳回立案申请,驳回原因:" + caseCheckReject; caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); rows += caseApplicationMapper.submitCaseApplication(caseApplication); - // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, notes); + ArbitrateRecord arbitrateRecordsel = new ArbitrateRecord(); arbitrateRecordsel.setCaseAppliId(id); ArbitrateRecord arbitrateRecordnew = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecordsel); - if(arbitrateRecordnew!=null){ + if (arbitrateRecordnew != null) { arbitrateRecordnew.setCaseCheckReject(caseCheckReject); arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecordnew); - }else { + } else { arbitrateRecordsel.setCaseCheckReject(caseCheckReject); arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecordsel); } + //查询案件详细信息 + CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); //发短信给申请人 SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseApplication.getId()); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - //获取身份类型 - int identityType = affiliate.getIdentityType(); - //查询案件详细信息 - CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); + List affiliates = selectAfflicatesByCaseId(id); + if (affiliates != null && affiliates.size() > 0) { + // 申请操作人 + Optional applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst(); + if (applicantAffiliateOpt.isPresent() && StrUtil.isNotEmpty(applicantAffiliateOpt.get().getPhone())) { + + CaseAffiliateEntity affiliate = applicantAffiliateOpt.get(); String caseName = "仲裁"; String caseNum = caseApplication1.getCaseNum(); - - if (identityType == 1) { - request.setPhone(affiliate.getContactTelphone()); - request.setTemplateId("2018697"); - String name = affiliate.getName(); - request.setTemplateParamSet(new String[]{name, caseName, caseNum,caseCheckReject}); - Boolean aBoolean = SmsUtils.sendSms(request); - //保存短信发送记录 - SmsSendRecord smsSendRecord = new SmsSendRecord(); - smsSendRecord.setCaseId(caseApplication.getId()); - smsSendRecord.setCaseNum(caseNum); - smsSendRecord.setPhone(request.getPhone()); - smsSendRecord.setSendTime(new Date()); - String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已拒绝,拒接原因:" + caseCheckReject; - smsSendRecord.setSendContent(content); - smsSendRecord.setCreateBy(getUsername()); - if (aBoolean) { - smsSendRecord.setSendStatus(1); - } else { - smsSendRecord.setSendStatus(0); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - + request.setPhone(affiliate.getPhone()); + request.setTemplateId("2018697"); + String name = affiliate.getName(); + request.setTemplateParamSet(new String[]{name, caseName, caseNum, caseCheckReject}); + Boolean aBoolean = SmsUtils.sendSms(request); + //保存短信发送记录 + SmsSendRecord smsSendRecord = new SmsSendRecord(); + smsSendRecord.setCaseId(caseApplication.getId()); + smsSendRecord.setCaseNum(caseNum); + smsSendRecord.setPhone(request.getPhone()); + smsSendRecord.setSendTime(new Date()); + String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已拒绝,拒接原因:" + caseCheckReject; + smsSendRecord.setSendContent(content); + smsSendRecord.setCreateBy(getUsername()); + if (aBoolean) { + smsSendRecord.setSendStatus(1); + } else { + smsSendRecord.setSendStatus(0); } - + smsRecordMapper.saveSmsSendRecord(smsSendRecord); } } } - + // 新增日志 + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_CHECK, notes); } return rows; } - @Override - public CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication) { - CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplicationConfirm(caseApplication); - if (caseApplicationselect == null) { - return caseApplicationselect; - } - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseApplication.getId()); - List caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if (caseAffiliatListeselect != null) { - // caseAffiliatListeselect=new ArrayList<>(caseAffiliatListeselect.stream().collect(Collectors.toMap(CaseAffiliate::getContactTelphone ,Function.identity(), (k1, k2) -> k1)).values()); - for (int i = 0; i < caseAffiliatListeselect.size(); i++) { - CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i); - int identityType = caseAffiliateselect.getIdentityType(); - if (identityType == 1 && StrUtil.isNotEmpty(caseAffiliateselect.getApplicationOrganId())) { - - caseApplicationselect.setApplicantName(caseAffiliateselect.getApplicationOrganName()); - }else { - caseApplicationselect.setApplicantName(caseAffiliateselect.getName()); - } - } - - } - caseApplication.setAnnexType(8); - // 查询缴费凭证 - List caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication); - if (caseAttachList != null && caseAttachList.size() > 0) { - for (CaseAttach caseAttach : caseAttachList) { - String annexName = caseAttach.getAnnexName(); - String prefix = "/profile"; - int startIndex = annexName.indexOf(prefix); - startIndex += prefix.length(); - String annexPath = "/uploadPath" + annexName.substring(startIndex); - caseAttach.setAnnexPath(annexPath); - int startIndexnew = annexName.lastIndexOf("/"); - if (startIndexnew != -1) { - String annexNamenew = annexName.substring(startIndexnew + 1); - caseAttach.setAnnexName(annexNamenew); - } - - - } - } - caseApplicationselect.setPayOrderList(caseAttachList); - - return caseApplicationselect; - } /** * 给被申请人发送房间号短信 @@ -2188,64 +2086,68 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { */ @Override public String sendRoomNoMessage(SendRoomNoMessageVO messageVO) { - CaseAffiliate caseAffiliateSelect = new CaseAffiliate(); - caseAffiliateSelect.setCaseAppliId(messageVO.getId()); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliateSelect); - if (CollectionUtil.isEmpty(caseAffiliates)) { - return "申请人、被申请人不存在"; + List afflicates = selectAfflicatesByCaseId(messageVO.getId()); + if (CollectionUtil.isEmpty(afflicates)) { + throw new ServiceException("未找到案件相关人员"); } - caseAffiliates=new ArrayList<>(caseAffiliates.stream().collect(Collectors.toMap(CaseAffiliate::getContactTelphone ,Function.identity(), (k1, k2) -> k1)).values()); CaseApplication caseApplication = new CaseApplication(); caseApplication.setId(messageVO.getId()); CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication); + if (caseApplicationselect == null) { + throw new ServiceException("案件不存在"); + } String returnResult = "短信发送成功"; // 需要申请模板,申请人,被申请人发送短信通知 SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); String startFormat = ""; String endFormat = ""; // 创建房间短信通知 - String format = "yyyy/MM/dd HH:mm:ss"; // 目标格式 - Date startDate = messageVO.getScheduleStartTime(); - Date endDate = messageVO.getScheduleEndTime(); - SimpleDateFormat sdf = new SimpleDateFormat(format); - if(startDate!=null) { - startFormat = sdf.format(startDate); - } - if(endDate!=null) { - endFormat = sdf.format(endDate); - } - // 预约会议短信模板 - request.setTemplateId("1983711"); + String format = "yyyy/MM/dd HH:mm:ss"; // 目标格式 + Date startDate = messageVO.getScheduleStartTime(); + Date endDate = messageVO.getScheduleEndTime(); + SimpleDateFormat sdf = new SimpleDateFormat(format); + if (startDate != null) { + startFormat = sdf.format(startDate); + } + if (endDate != null) { + endFormat = sdf.format(endDate); + } + // 预约会议短信模板 + request.setTemplateId("1983711"); - for (CaseAffiliate caseAffiliate : caseAffiliates) { - request.setPhone(caseAffiliate.getContactTelphone()); - // 1983711 开庭审理预约会议短信通知 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},会议时间为{4},请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。 - request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo() , startFormat + "-" + endFormat}); + for (CaseAffiliateEntity affiliate : afflicates) { + if (affiliate.getOperatorFlag() == 1) { + // 操作人发送短信短信 - Boolean aBoolean = SmsUtils.sendSms(request); - //保存短信发送记录 - SmsSendRecord smsSendRecord = new SmsSendRecord(); - smsSendRecord.setCaseId(messageVO.getId()); - smsSendRecord.setCaseNum(caseApplicationselect.getCaseNum()); - smsSendRecord.setPhone(request.getPhone()); - smsSendRecord.setSendTime(new Date()); - String content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo() + "会议时间为" + startFormat + "-" + endFormat + ",请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。"; - smsSendRecord.setSendContent(content); + request.setPhone(affiliate.getPhone()); + // 1983711 开庭审理预约会议短信通知 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},会议时间为{4},请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。 + request.setTemplateParamSet(new String[]{affiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo(), startFormat + "-" + endFormat}); - String userName; - try { - userName = getUsername(); - } catch (Exception e) { - userName = "admin"; + Boolean aBoolean = SmsUtils.sendSms(request); + //保存短信发送记录 + SmsSendRecord smsSendRecord = new SmsSendRecord(); + smsSendRecord.setCaseId(messageVO.getId()); + smsSendRecord.setCaseNum(caseApplicationselect.getCaseNum()); + smsSendRecord.setPhone(request.getPhone()); + smsSendRecord.setSendTime(new Date()); + String content = "尊敬的" + affiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo() + "会议时间为" + startFormat + "-" + endFormat + ",请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。"; + smsSendRecord.setSendContent(content); + + String userName; + try { + userName = getUsername(); + } catch (Exception e) { + userName = "admin"; + } + smsSendRecord.setCreateBy(userName); + if (aBoolean) { + smsSendRecord.setSendStatus(1); + } else { + smsSendRecord.setSendStatus(0); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord); } - smsSendRecord.setCreateBy(userName); - if (aBoolean) { - smsSendRecord.setSendStatus(1); - } else { - smsSendRecord.setSendStatus(0); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); } return returnResult; } @@ -2283,11 +2185,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); String url = signUrlData.get("url").getAsString(); sealSignRecordReslt.setSealUrl(url); - if(StrUtil.isEmpty(SecurityUtils.getUsername())){ + if (StrUtil.isEmpty(SecurityUtils.getUsername())) { throw new ServiceException("未获取到当前登录用户"); } SysUser sysUser = sysUserMapper.selectUserByUserName(getUsername()); - if(sysUser==null){ + if (sysUser == null) { throw new ServiceException("未获取到当前登录用户"); } CaseLogRecord operLog = new CaseLogRecord(); @@ -2303,7 +2205,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } - @Override @Transactional public AjaxResult creatTrialRecordnew(ArbitrateRecord arbitrateRecordselect) { @@ -2331,7 +2232,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { @Override @Transactional public AjaxResult editCaseApplicationDefineval(CaseApplication caseApplication) { - if(CollectionUtil.isNotEmpty(caseApplication.getColumnValues())) { + if (CollectionUtil.isNotEmpty(caseApplication.getColumnValues())) { for (ColumnValue columnValue : caseApplication.getColumnValues()) { columnValueMapper.updateColumnValue(columnValue); } @@ -2344,14 +2245,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { public CaseAttach downloadCaseZipFile(CaseApplication caseApplication) { caseApplication.setAnnexType(12); CaseAttach caseAttach = new CaseAttach(); - List caseAttachs = caseAttachMapper.queryCaseAttachList( caseApplication); - if(caseAttachs!=null&&caseAttachs.size()>0){ - caseAttach = caseAttachs.get(0); + List caseAttachs = caseAttachMapper.queryCaseAttachList(caseApplication); + if (caseAttachs != null && caseAttachs.size() > 0) { + caseAttach = caseAttachs.get(0); String annexName = caseAttach.getAnnexName(); String prefix = "/profile"; int startIndex = annexName.indexOf(prefix); - if(startIndex!=-1) { + if (startIndex != -1) { startIndex += prefix.length(); String annexPath = "/uploadPath" + annexName.substring(startIndex); @@ -2363,7 +2264,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAttach.setAnnexName(annexNamenew); } - }else { + } else { CaseApplication caseApplicationsel = new CaseApplication(); caseApplicationsel.setId(caseApplication.getId()); List annexTypeList = new ArrayList<>(); @@ -2375,26 +2276,26 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { annexTypeList.add(9); annexTypeList.add(11); caseApplicationsel.setAnnexTypeList(annexTypeList); - List caseAttachList = caseAttachMapper.queryCaseAttachList( caseApplicationsel); - if(caseAttachList!=null&&caseAttachList.size()>0){ + List caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplicationsel); + if (caseAttachList != null && caseAttachList.size() > 0) { List pathList = new ArrayList<>(); for (CaseAttach caseAttach1 : caseAttachList) { String annexName = caseAttach1.getAnnexName(); String annexPathsel = caseAttach1.getAnnexPath(); String prefix = "/profile"; int startIndex = annexName.indexOf(prefix); - if(startIndex!=-1) { + if (startIndex != -1) { startIndex += prefix.length(); String annexPath = "/uploadPath" + annexName.substring(startIndex); String path = "/home/ruoyi" + annexPath; pathList.add(path); - }else if(annexPathsel.contains(annexName)){ + } else if (annexPathsel.contains(annexName)) { pathList.add(annexPathsel); } } //将案件相关附件压缩zip文件 - if(pathList!=null&&pathList.size()>0){ + if (pathList != null && pathList.size() > 0) { LocalDate now = LocalDate.now(); String year = Integer.toString(now.getYear()); String month = String.format("%02d", now.getMonthValue()); @@ -2407,37 +2308,37 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { saveFolder.mkdirs(); } String zipFileOutPath = saveFolderPath + "/" + fileName; - try { + try { - FileOutputStream zfous = new FileOutputStream(zipFileOutPath); - ZipOutputStream zipFileOutstream = new ZipOutputStream(zfous); + FileOutputStream zfous = new FileOutputStream(zipFileOutPath); + ZipOutputStream zipFileOutstream = new ZipOutputStream(zfous); - for (String pathstr : pathList) { - FileInputStream fis1 = new FileInputStream(pathstr); - ZipFileUtils.zipFile(pathstr, fis1, zipFileOutstream); - } - zipFileOutstream.close(); - zfous.close(); - } catch (IOException e) { - e.printStackTrace(); + for (String pathstr : pathList) { + FileInputStream fis1 = new FileInputStream(pathstr); + ZipFileUtils.zipFile(pathstr, fis1, zipFileOutstream); } + zipFileOutstream.close(); + zfous.close(); + } catch (IOException e) { + e.printStackTrace(); + } - //保存压缩文件附件 - String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; + //保存压缩文件附件 + String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; // String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName; - String savePath = "/home/ruoyi/uploadPath/upload"; - caseAttach = CaseAttach.builder() + String savePath = "/home/ruoyi/uploadPath/upload"; + caseAttach = CaseAttach.builder() .caseAppliId(caseApplication.getId()) .annexName(saveName) .annexPath(savePath) .annexType(12) .build(); - int i = caseAttachMapper.save(caseAttach); + int i = caseAttachMapper.save(caseAttach); String annexName = caseAttach.getAnnexName(); String prefix = "/profile"; int startIndex = annexName.indexOf(prefix); - if(startIndex!=-1) { + if (startIndex != -1) { startIndex += prefix.length(); String annexPath = "/uploadPath" + annexName.substring(startIndex); @@ -2449,284 +2350,148 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAttach.setAnnexName(annexNamenew); } - return caseAttach; + return caseAttach; - } - } - } - return caseAttach; - } - - @Override - public List selectCaseApplicationListBatchByRole(CaseApplication caseApplication) { - // 获取登录用户 - LoginUser loginUser = getLoginUser(); - SysUser user = loginUser.getUser(); - Long userId = user.getUserId(); - SysUser sysUser = sysUserMapper.selectUserById(userId); - List roles = sysUser.getRoles(); - // 没有角色不能查看案件列表 - if (CollectionUtil.isEmpty(roles)) { - throw new ServiceException("该用户没有角色权限"); - } - for (SysRole role : roles) { - if (StrUtil.isEmpty(role.getRoleName())) { - continue; - } - if ("超级管理员".equals(role.getRoleName())) { - List caseApplicationlist = caseApplicationMapper.selectAdminCaseApplicationListBatch(caseApplication); - if(caseApplicationlist!=null&&caseApplicationlist.size()>0){ - for(CaseApplication caseApplicationselect : caseApplicationlist){ - Integer batchNumber = caseApplicationselect.getBatchNumber(); - CaseApplication caseApplicationsel = new CaseApplication(); - caseApplicationsel.setBatchNumber(batchNumber); - List caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel); - if (caseApplications != null && caseApplications.size() > 0) { - List caseStatuss = caseApplications.stream().map(CaseApplication::getCaseStatus).collect(Collectors.toList()); - System.out.println("ceshi:"+caseStatuss.toString()); - List caseStatusNames = caseApplications.stream().map(CaseApplication::getCaseStatusName).collect(Collectors.toList()); - List caseStatussnew = caseStatuss.stream().distinct().collect(Collectors.toList()); - List caseStatusNamesnew = caseStatusNames.stream().distinct().collect(Collectors.toList()); - String caseStatusName = caseStatusNamesnew.stream().map(Object::toString).collect(Collectors.joining(",")); - String caseStatusstr = caseStatussnew.stream().map(Object::toString).collect(Collectors.joining(",")); - caseApplicationselect.setCaseStatusName(caseStatusName); - caseApplicationselect.setCaseStatusstr(caseStatusstr); - } - } - } - return caseApplicationlist; - - } - - if ("仲裁委".equals(role.getRoleName()) - || "部门长".equals(role.getRoleName())) { - List caseStatusList = new ArrayList<>(); - caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL); - caseStatusList.add(CaseApplicationConstants.CHECK_ARBITRATION); - // caseStatusList.add(CaseApplicationConstants.ARBITRATED_SEAL); - caseApplication.setDeptHeadStatus(caseStatusList); - caseApplication.setIsOtherRole(1); - } - if ("仲裁员".equals(role.getRoleName())) { - caseApplication.setUserId(String.valueOf(userId)); - caseApplication.setIsOtherRole(1); - } - if ("财务".equals(role.getRoleName())) { - caseApplication.setIsOtherRole(1); - caseApplication.setFinanceStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM); - } - if ("法律顾问".equals(role.getRoleName())) { - // 秘书查看所有案件 - // 查询角色有关的用户部门 - List deptIds = new ArrayList<>(); - deptIds.add(sysUser.getDeptId()); - caseApplication.setDeptIds(deptIds); - } - if ("申请人".equals(role.getRoleName())) { - // caseApplication.setIsOtherRole(1); - // 查询有关的用户部门 - caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId())); - } - if ("被申请人".equals(role.getRoleName())) { - caseApplication.setIsOtherRole(1); - // - caseApplication.setIdCard(String.valueOf(sysUser.getIdCard())); - } - if ("代理人".equals(role.getRoleName())) { - caseApplication.setIsOtherRole(1); - // 查询角色有关的用户部门 - // List agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId()); - List agentDeptIds = new ArrayList<>(); - agentDeptIds.add(sysUser.getDeptId()); - caseApplication.setAgentDeptIds(agentDeptIds); - } - - } - List caseApplicationlist = caseApplicationMapper.selectAdminCaseApplicationListBatch1(caseApplication); - if(caseApplicationlist!=null&&caseApplicationlist.size()>0){ - for(CaseApplication caseApplicationselect : caseApplicationlist){ - Integer batchNumber = caseApplicationselect.getBatchNumber(); - CaseApplication caseApplicationsel = new CaseApplication(); - caseApplicationsel.setBatchNumber(batchNumber); - List caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel); - if (caseApplications != null && caseApplications.size() > 0) { - List caseStatuss = caseApplications.stream().map(CaseApplication::getCaseStatus).collect(Collectors.toList()); - System.out.println("ceshi:"+caseStatuss.toString()); - List caseStatusNames = caseApplications.stream().map(CaseApplication::getCaseStatusName).collect(Collectors.toList()); - List caseStatussnew = caseStatuss.stream().distinct().collect(Collectors.toList()); - List caseStatusNamesnew = caseStatusNames.stream().distinct().collect(Collectors.toList()); - String caseStatusName = caseStatusNamesnew.stream().map(Object::toString).collect(Collectors.joining(",")); - String caseStatusstr = caseStatussnew.stream().map(Object::toString).collect(Collectors.joining(",")); - caseApplicationselect.setCaseStatusName(caseStatusName); - caseApplicationselect.setCaseStatusstr(caseStatusstr); } } } - - return caseApplicationlist; + return caseAttach; } +// @Override +// public List selectCaseApplicationListBatchByRole(CaseApplication caseApplication) { +// // 获取登录用户 +// LoginUser loginUser = getLoginUser(); +// SysUser user = loginUser.getUser(); +// Long userId = user.getUserId(); +// SysUser sysUser = sysUserMapper.selectUserById(userId); +// List roles = sysUser.getRoles(); +// // 没有角色不能查看案件列表 +// if (CollectionUtil.isEmpty(roles)) { +// throw new ServiceException("该用户没有角色权限"); +// } +// for (SysRole role : roles) { +// if (StrUtil.isEmpty(role.getRoleName())) { +// continue; +// } +// if ("超级管理员".equals(role.getRoleName())) { +// List caseApplicationlist = caseApplicationMapper.selectAdminCaseApplicationListBatch(caseApplication); +// if (caseApplicationlist != null && caseApplicationlist.size() > 0) { +// for (CaseApplication caseApplicationselect : caseApplicationlist) { +// Integer batchNumber = caseApplicationselect.getBatchNumber(); +// CaseApplication caseApplicationsel = new CaseApplication(); +// caseApplicationsel.setBatchNumber(batchNumber); +// List caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel); +// if (caseApplications != null && caseApplications.size() > 0) { +// List caseStatuss = caseApplications.stream().map(CaseApplication::getCaseStatus).collect(Collectors.toList()); +// System.out.println("ceshi:" + caseStatuss.toString()); +// List caseStatusNames = caseApplications.stream().map(CaseApplication::getCaseStatusName).collect(Collectors.toList()); +// List caseStatussnew = caseStatuss.stream().distinct().collect(Collectors.toList()); +// List caseStatusNamesnew = caseStatusNames.stream().distinct().collect(Collectors.toList()); +// String caseStatusName = caseStatusNamesnew.stream().map(Object::toString).collect(Collectors.joining(",")); +// String caseStatusstr = caseStatussnew.stream().map(Object::toString).collect(Collectors.joining(",")); +// caseApplicationselect.setCaseStatusName(caseStatusName); +// caseApplicationselect.setCaseStatusstr(caseStatusstr); +// } +// } +// } +// return caseApplicationlist; +// +// } +// +// if ("仲裁委".equals(role.getRoleName()) +// || "部门长".equals(role.getRoleName())) { +// List caseStatusList = new ArrayList<>(); +// caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL); +// caseStatusList.add(CaseApplicationConstants.CHECK_ARBITRATION); +// // caseStatusList.add(CaseApplicationConstants.ARBITRATED_SEAL); +// caseApplication.setDeptHeadStatus(caseStatusList); +// caseApplication.setIsOtherRole(1); +// } +// if ("仲裁员".equals(role.getRoleName())) { +// caseApplication.setUserId(String.valueOf(userId)); +// caseApplication.setIsOtherRole(1); +// } +// if ("财务".equals(role.getRoleName())) { +// caseApplication.setIsOtherRole(1); +// caseApplication.setFinanceStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM); +// } +// if ("法律顾问".equals(role.getRoleName())) { +// // 秘书查看所有案件 +// // 查询角色有关的用户部门 +// List deptIds = new ArrayList<>(); +// deptIds.add(sysUser.getDeptId()); +// caseApplication.setDeptIds(deptIds); +// } +// if ("申请人".equals(role.getRoleName())) { +// // caseApplication.setIsOtherRole(1); +// // 查询有关的用户部门 +// caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId())); +// } +// if ("被申请人".equals(role.getRoleName())) { +// caseApplication.setIsOtherRole(1); +// // +// caseApplication.setIdCard(String.valueOf(sysUser.getIdCard())); +// } +// if ("代理人".equals(role.getRoleName())) { +// caseApplication.setIsOtherRole(1); +// // 查询角色有关的用户部门 +// // List agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId()); +// List agentDeptIds = new ArrayList<>(); +// agentDeptIds.add(sysUser.getDeptId()); +// caseApplication.setAgentDeptIds(agentDeptIds); +// } +// +// } +// List caseApplicationlist = caseApplicationMapper.selectAdminCaseApplicationListBatch1(caseApplication); +// if (caseApplicationlist != null && caseApplicationlist.size() > 0) { +// for (CaseApplication caseApplicationselect : caseApplicationlist) { +// Integer batchNumber = caseApplicationselect.getBatchNumber(); +// CaseApplication caseApplicationsel = new CaseApplication(); +// caseApplicationsel.setBatchNumber(batchNumber); +// List caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel); +// if (caseApplications != null && caseApplications.size() > 0) { +// List caseStatuss = caseApplications.stream().map(CaseApplication::getCaseStatus).collect(Collectors.toList()); +// System.out.println("ceshi:" + caseStatuss.toString()); +// List caseStatusNames = caseApplications.stream().map(CaseApplication::getCaseStatusName).collect(Collectors.toList()); +// List caseStatussnew = caseStatuss.stream().distinct().collect(Collectors.toList()); +// List caseStatusNamesnew = caseStatusNames.stream().distinct().collect(Collectors.toList()); +// String caseStatusName = caseStatusNamesnew.stream().map(Object::toString).collect(Collectors.joining(",")); +// String caseStatusstr = caseStatussnew.stream().map(Object::toString).collect(Collectors.joining(",")); +// caseApplicationselect.setCaseStatusName(caseStatusName); +// caseApplicationselect.setCaseStatusstr(caseStatusstr); +// } +// } +// } +// +// return caseApplicationlist; +// } + @Override @Transactional - public int submitCaseApplicationBatch(String batchNumber) { - - int rows = 0; - CaseApplication caseApplicationsel = new CaseApplication(); - caseApplicationsel.setBatchNumber(Integer.parseInt(batchNumber)); - caseApplicationsel.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); - List caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel); + public AjaxResult submitCaseApplicationBatch(String batchNumber) { + CaseApplication caseApplication = new CaseApplication(); + List caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplication); + if (CollectionUtil.isEmpty(caseApplications)) { + return error("该批次案件不存在"); + } List ids = caseApplications.stream().map(CaseApplication::getId).collect(Collectors.toList()); - if(caseApplications!=null&&caseApplications.size()>0){ - Map applicationMap = caseApplications.stream().collect(Collectors.toMap(CaseApplication::getId, Function.identity(), (n1, n2) -> n2)); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliateByCaseIds(ids); - // 转换为Map>形式 - Map> caseAffiliateMap = caseAffiliates.stream().collect(Collectors.groupingBy(CaseAffiliate::getCaseAppliId)); - for (Long id : ids) { - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(id); - // 查询案件信息,做必填校验,校验不通过,提示,不能提交 - StringBuilder errorMsg = new StringBuilder(); - // 必填校验 - CaseApplication caseApplication = applicationMap.get(id); - String caseNum = caseApplication.getCaseNum(); - // 基本字段校验 - if(caseApplication!=null) { - for (String baseColumn : baseColumns) { - if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseApplication, baseColumn))){ - errorMsg.append(getColumnstr(baseColumn)).append("不能为空,"); -// throw new ServiceException("必填字段未填写,请完善案件信息!"); - } - } - // 校验人员 - if(CollectionUtil.isNotEmpty(caseAffiliates)){ - List affiliateList = caseAffiliateMap.get(id); - if(CollectionUtil.isNotEmpty(affiliateList)){ - for (CaseAffiliate caseAffiliate : affiliateList) { - if(caseAffiliate.getIdentityType()==1){ - // 校验申请人 - for (String applicAffiliateColumn : applicAffiliateColumns) { - if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseAffiliate, applicAffiliateColumn))){ - errorMsg.append(getColumnstr(applicAffiliateColumn)).append("不能为空,"); -// throw new ServiceException("必填字段未填写,请完善案件信息!"); - } - } - }else { - // 校验被申请人 - for (String applicAffiliateColumn : dectborAffiliateColumns) { - if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseAffiliate, applicAffiliateColumn))){ - errorMsg.append(getColumnstr(applicAffiliateColumn)).append("不能为空,"); -// throw new ServiceException("必填字段未填写,请完善案件信息!"); - } - } - } - } - } - } - } - if(StringUtils.isNotEmpty(errorMsg.toString())){ - throw new ServiceException("案件编号" + caseNum + errorMsg.toString()+"请完善案件信息!"); - } + caseApplicationService.submitCaseApplication(ids); - CaseApplication application = new CaseApplication(); - application.setId(id); - //提交立案申请 - application.setCaseStatus(CaseApplicationConstants.CASE_CHECK); - rows += caseApplicationMapper.submitCaseApplication(application); - // 新增日志 - insertCaseLog(application.getId(),currentStatus , ""); - } - - }else{ - throw new ServiceException("这个批号没有批量提交的案件"); - } - - return rows; + return success(); } @Override @Transactional - public int submitCaseApplicationCheckBatch(String batchNumber, Integer agreeOrNotCheck, String caseCheckReject) { + public AjaxResult submitCaseApplicationCheckBatch(String batchNumber, Integer agreeOrNotCheck, String caseCheckReject) { int rows = 0; CaseApplication caseApplicationsel = new CaseApplication(); caseApplicationsel.setBatchNumber(Integer.parseInt(batchNumber)); caseApplicationsel.setCaseStatus(CaseApplicationConstants.CASE_CHECK); List caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel); List ids = caseApplications.stream().map(CaseApplication::getId).collect(Collectors.toList()); - if(caseApplications!=null&&caseApplications.size()>0){ - for (Long id : ids) { - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(id); - String notes=""; - CaseApplication caseApplication = new CaseApplication(); - caseApplication.setId(id); - caseApplication.setAgreeOrNotCheck(agreeOrNotCheck); - if (agreeOrNotCheck == 1) { - //同意审核 - caseApplication.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT); - rows += caseApplicationMapper.submitCaseApplication(caseApplication); - // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, notes); - } else if (agreeOrNotCheck == 2) { - //拒绝审核 - notes="驳回立案申请,驳回原因:"+caseCheckReject; - caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); - rows += caseApplicationMapper.submitCaseApplication(caseApplication); - // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, notes); - ArbitrateRecord arbitrateRecordsel = new ArbitrateRecord(); - arbitrateRecordsel.setCaseAppliId(id); - ArbitrateRecord arbitrateRecordnew = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecordsel); - if(arbitrateRecordnew!=null){ - arbitrateRecordnew.setCaseCheckReject(caseCheckReject); - arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecordnew); - }else { - arbitrateRecordsel.setCaseCheckReject(caseCheckReject); - arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecordsel); - } - //发短信给申请人 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseApplication.getId()); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - //获取身份类型 - int identityType = affiliate.getIdentityType(); - //查询案件详细信息 - CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); - String caseName = "仲裁"; - String caseNum = caseApplication1.getCaseNum(); - - if (identityType == 1) { - request.setPhone(affiliate.getContactTelphone()); - request.setTemplateId("2018697"); - String name = affiliate.getName(); - request.setTemplateParamSet(new String[]{name, caseName, caseNum,caseCheckReject}); - Boolean aBoolean = SmsUtils.sendSms(request); - //保存短信发送记录 - SmsSendRecord smsSendRecord = new SmsSendRecord(); - smsSendRecord.setCaseId(caseApplication.getId()); - smsSendRecord.setCaseNum(caseNum); - smsSendRecord.setPhone(request.getPhone()); - smsSendRecord.setSendTime(new Date()); - String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已拒绝,拒接原因:" + caseCheckReject; - smsSendRecord.setSendContent(content); - smsSendRecord.setCreateBy(getUsername()); - if (aBoolean) { - smsSendRecord.setSendStatus(1); - } else { - smsSendRecord.setSendStatus(0); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - - } - - } - } - } - } - }else{ - throw new ServiceException("这个批号没有批量审查的案件"); - } - return rows; + caseApplicationService.submitCaseApplicationCheck(ids, agreeOrNotCheck, caseCheckReject); + return success(); } @Override @@ -2742,25 +2507,24 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { List caseNums = caseApplications.stream().map(CaseApplication::getCaseNum).collect(Collectors.toList()); List caseNumsnew = caseNums.stream().distinct().collect(Collectors.toList()); String caseNumsstr = caseNumsnew.stream().map(Object::toString).collect(Collectors.joining(",")); - throw new ServiceException("案件编号"+caseNumsstr+"在案件质证节点,请先进行案件质证,然后再批量组庭审核"); + throw new ServiceException("案件编号" + caseNumsstr + "在案件质证节点,请先进行案件质证,然后再批量组庭审核"); } - CaseApplication caseApplication1 = new CaseApplication(); caseApplication1.setBatchNumber(caseApplication.getBatchNumber()); caseApplication1.setCaseStatus(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL_SUBMMIT); List caseApplications1 = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplication1); if (caseApplications1 != null && caseApplications1.size() > 0) { - for(CaseApplication caseApplicationse:caseApplications1){ - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplicationse.getId()); + for (CaseApplication caseApplicationse : caseApplications1) { + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplicationse.getId()); //同意组庭 if (isAgreePendTral != null && isAgreePendTral == 1) { String arbitratorId = caseApplicationse.getArbitratorId(); String arbitratorName = caseApplicationse.getArbitratorName(); List arbitrators = caseApplication.getArbitrators(); - if(arbitrators != null && arbitrators.size() > 0 && StringUtils.isEmpty(arbitratorId) && StringUtils.isEmpty(arbitratorName)){ + if (arbitrators != null && arbitrators.size() > 0 && StringUtils.isEmpty(arbitratorId) && StringUtils.isEmpty(arbitratorName)) { 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(",")); @@ -2785,10 +2549,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } } // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, ""); + insertCaseLog(caseApplication.getId(),CaseApplicationConstants. CONFIRMDED_PENDING_TRIAL_SUBMMIT, ""); } - }else{ + } else { throw new ServiceException("这个批号没有批量组庭审核的案件"); } return rows; @@ -2804,8 +2568,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplication1.setCaseStatus(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL); List caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplication1); if (caseApplications != null && caseApplications.size() > 0) { - for(CaseApplication caseApplicationse:caseApplications){ - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplicationse.getId()); + for (CaseApplication caseApplicationse : caseApplications) { + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplicationse.getId()); caseApplicationse.setCaseStatus(CaseApplicationConstants.CHECK_ARBITRATION_METHOD); caseApplicationse.setIsAgreePendTral(isAgreePendTral); if (isAgreePendTral != null && isAgreePendTral == 1) { @@ -2828,10 +2592,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { request.setTemplateId("2033619"); sendHearDateMessage(caseApplicationse, request, "2033619"); // 新增日志 - insertCaseLog(caseApplication.getId(),currentStatus , ""); + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL, ""); } - }else{ + } else { throw new ServiceException("这个批号没有批量组庭审核的案件"); } return rows; @@ -2846,17 +2610,17 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { List caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplication1); int rows = 0; if (caseApplications != null && caseApplications.size() > 0) { - for(CaseApplication caseApplicationse:caseApplications){ - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplicationse.getId()); + for (CaseApplication caseApplicationse : caseApplications) { + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplicationse.getId()); // 秘书核验裁决书,流转到待仲裁员审核裁决书 - caseApplicationse.setCaseStatus(CaseApplicationConstants.HEAD_CHECK_ARBITRATION); + caseApplicationse.setCaseStatus(HEAD_CHECK_ARBITRATION); rows += caseApplicationMapper.submitCaseApplication(caseApplicationse); // ArbitrateRecord arbitrateRecord = caseApplication.getArbitrateRecord(); // arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord); // 新增日志 - insertCaseLog(caseApplicationse.getId(), currentStatus, ""); + insertCaseLog(caseApplicationse.getId(), CaseApplicationConstants.VERPRIF_ARBITRATION, ""); } - }else{ + } else { throw new ServiceException("这个批号没有批量核验裁决书的案件"); } @@ -2871,28 +2635,28 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { CaseApplication caseApplicationsel = new CaseApplication(); caseApplicationsel.setBatchNumber(caseApplication.getBatchNumber()); - caseApplicationsel.setCaseStatus(CaseApplicationConstants.HEAD_CHECK_ARBITRATION); + caseApplicationsel.setCaseStatus(HEAD_CHECK_ARBITRATION); List caseApplications1 = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel); if (caseApplications1 != null && caseApplications1.size() > 0) { - for(CaseApplication caseApplicationse:caseApplications1){ - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplicationse.getId()); + for (CaseApplication caseApplicationse : caseApplications1) { + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplicationse.getId()); if (agreeOrNotCheck.intValue() == 1) { caseApplicationse.setCaseStatus(CaseApplicationConstants.CHECK_ARBITRATION); rows += caseApplicationMapper.submitCaseApplication(caseApplicationse); // 新增日志 - insertCaseLog(caseApplication.getId(),currentStatus, ""); + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.HEAD_CHECK_ARBITRATION, ""); } else if (agreeOrNotCheck.intValue() == 2) {//拒绝审核 ArbitrateRecord arbitrateRecord = caseApplication.getArbitrateRecord(); ArbitrateRecord arbitrateRecordsel = new ArbitrateRecord(); arbitrateRecordsel.setCaseAppliId(caseApplicationse.getId()); ArbitrateRecord arbitrateRecordnew = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecordsel); - if(arbitrateRecordnew!=null){ + if (arbitrateRecordnew != null) { arbitrateRecordnew.setCheckOpinion(arbitrateRecord.getCheckOpinion()); arbitrateRecordnew.setArbitrateReject(arbitrateRecord.getArbitrateReject()); arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecordnew); - }else { + } else { arbitrateRecordnew.setCheckOpinion(arbitrateRecord.getCheckOpinion()); arbitrateRecordnew.setArbitrateReject(arbitrateRecord.getArbitrateReject()); arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecordsel); @@ -2900,37 +2664,39 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplicationse.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION); rows += caseApplicationMapper.submitCaseApplication(caseApplicationse); - String notes=""; - if(caseApplication.getArbitrateRecord()!=null&&StrUtil.isNotEmpty(caseApplication.getArbitrateRecord().getArbitrateReject())){ - notes="仲裁员驳回裁决书,驳回原因:"+caseApplication.getArbitrateRecord().getArbitrateReject(); + String notes = ""; + if (caseApplication.getArbitrateRecord() != null && StrUtil.isNotEmpty(caseApplication.getArbitrateRecord().getArbitrateReject())) { + notes = "仲裁员驳回裁决书,驳回原因:" + caseApplication.getArbitrateRecord().getArbitrateReject(); } // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, notes); + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.HEAD_CHECK_ARBITRATION, notes); } } - }else{ + } else { throw new ServiceException("这个批号没有批量仲裁员审核裁决书的案件"); } return success(rows); } + /** * 附件上传到onlyoffice服务器 + * * @param annexPath */ @Override @Transactional - public JSONArray uploadOnlyOffice(String annexPath,Long caseId) { - annexPath=annexPath.replace("/profile/","/home/ruoyi/uploadPath/"); + public JSONArray uploadOnlyOffice(String annexPath, Long caseId) { + annexPath = annexPath.replace("/profile/", "/home/ruoyi/uploadPath/"); File file = new File(annexPath); if (file.exists()) { // 调用onlyoffice try { Map params = new HashMap<>(); params.put("file", file); - String postResult = HttpUtil.post(onlyOfficeUrl+ "/"+String.valueOf(caseId), params); - if(StrUtil.isNotEmpty(postResult)){ + String postResult = HttpUtil.post(onlyOfficeUrl + "/" + String.valueOf(caseId), params); + if (StrUtil.isNotEmpty(postResult)) { // 转为jsonArray JSONArray jsonArray = JSONArray.parseArray(postResult); @@ -2939,11 +2705,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } catch (Exception e) { throw new ServiceException("上传OnlyOffice服务器失败"); } - }else { + } else { throw new ServiceException("文件不存在"); } return null; } + @Override @Transactional public AjaxResult checkArbitrateRecordBatch(CaseApplication caseApplication) { @@ -2954,8 +2721,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplicationsel.setCaseStatus(CaseApplicationConstants.CHECK_ARBITRATION); List caseApplications1 = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel); if (caseApplications1 != null && caseApplications1.size() > 0) { - for(CaseApplication caseApplicationse:caseApplications1){ - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplicationse.getId()); + for (CaseApplication caseApplicationse : caseApplications1) { + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplicationse.getId()); if (agreeOrNotCheck.intValue() == 1) { try { //获取当前案件的裁决书 @@ -3094,7 +2861,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { for (SealManage manage : selectSealList) { Integer sealStatus = manage.getSealStatus(); Integer isUse = manage.getIsUse(); - if (sealStatus == 1 && isUse ==1) { + if (sealStatus == 1 && isUse == 1) { sealIdList.add(manage.getSealId()); } } @@ -3138,16 +2905,16 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } caseApplicationse.setCaseStatus(CaseApplicationConstants.SIGN_ARBITRATION); // 新增日志 - insertCaseLog(caseApplicationse.getId(),currentStatus, ""); + insertCaseLog(caseApplicationse.getId(), CaseApplicationConstants.CHECK_ARBITRATION, ""); rows += caseApplicationMapper.submitCaseApplication(caseApplicationse); } else if (agreeOrNotCheck.intValue() == 2) { - caseApplicationse.setCaseStatus(CaseApplicationConstants.HEAD_CHECK_ARBITRATION); - String notes=""; - if(caseApplication.getArbitrateRecord()!=null&&StrUtil.isNotEmpty(caseApplication.getArbitrateRecord().getDeptorReject())){ - notes="部门长驳回裁决书,驳回原因:"+caseApplication.getArbitrateRecord().getDeptorReject(); + caseApplicationse.setCaseStatus(HEAD_CHECK_ARBITRATION); + String notes = ""; + if (caseApplication.getArbitrateRecord() != null && StrUtil.isNotEmpty(caseApplication.getArbitrateRecord().getDeptorReject())) { + notes = "部门长驳回裁决书,驳回原因:" + caseApplication.getArbitrateRecord().getDeptorReject(); } // 新增日志 - insertCaseLog(caseApplicationse.getId(), currentStatus, notes); + insertCaseLog(caseApplicationse.getId(), CaseApplicationConstants.CHECK_ARBITRATION, notes); rows = caseApplicationMapper.submitCaseApplication(caseApplicationse); @@ -3161,7 +2928,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } private String getColumnstr(String columnname) { - String columnstr = ""; + String columnstr = ""; switch (columnname) { case "caseName": columnstr = "案件名称"; @@ -3274,7 +3041,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { @Transactional public int pendTralSure(CaseApplication caseApplication) { // caseApplication.setCaseStatus(CaseApplicationConstants.CHECK_ARBITRATION_METHOD); - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); caseApplication.setCaseStatus(CaseApplicationConstants.CHECK_ARBITRATION_METHOD); caseApplication.setLockStatus(1); Integer isAgreePendTral = caseApplication.getIsAgreePendTral(); @@ -3302,7 +3069,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { // 发送开庭日期通知短信 sendHearDateMessage(caseApplication, request, "2033619"); // 新增日志 - insertCaseLog(caseApplication.getId(), currentStatus, ""); + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL, ""); return rows; @@ -3316,12 +3083,18 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { */ private void sendHearDateMessage(CaseApplication caseApplication, SmsUtils.SendSmsRequest request, String templateId) { CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication); - + if (caseApplicationselect == null) { + throw new ServiceException("案件不存在"); + } + List afflicates = selectAfflicatesByCaseId(caseApplicationselect.getId()); + if (CollectionUtil.isEmpty(afflicates)) { + throw new ServiceException("案件相关人员不存在"); + } String caseNum = caseApplicationselect.getCaseNum(); Date hearDate = caseApplicationselect.getHearDate(); String hearDatestr = ""; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - if(hearDate!=null) { + if (hearDate != null) { hearDatestr = dateFormat.format(hearDate); } String arbitratorId = caseApplicationselect.getArbitratorId(); @@ -3374,19 +3147,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseApplication.getId()); - List caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - if (caseAffiliatListeselect != null) { - for (int j = 0; j < caseAffiliatListeselect.size(); j++) { - CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(j); - int identityType = caseAffiliateselect.getIdentityType(); - if (identityType == 1) { - caseAffiliateselect.setName(caseAffiliateselect.getApplicationOrganName()); - } + for (int j = 0; j < afflicates.size(); j++) { + CaseAffiliateEntity caseAffiliateselect = afflicates.get(j); + if (caseAffiliateselect.getOperatorFlag() != null && caseAffiliateselect.getOperatorFlag().equals(1) && StrUtil.isNotEmpty(caseAffiliateselect.getPhone())) { //给申请人、被申请人发送短信通知 - request.setPhone(caseAffiliateselect.getContactTelphone()); + request.setPhone(caseAffiliateselect.getPhone()); // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。 String name = caseAffiliateselect.getName(); if (templateId.equals("2033619")) { @@ -3418,7 +3184,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } smsRecordMapper.saveSmsSendRecord(smsSendRecord); } + } + } @@ -3453,31 +3221,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } - private void assignmentCaseAffiliates(CaseApplication caseApplication, List caseAffiliatesnew, - Map deptMap, Long roleId) { - // 申请人信息 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate = buildApplicaInfo(caseApplication); - // 申请人(机构),需要判断部门中是否存在,不存在则新增,当身份类型为1的时候,查询时需要根据名称查询组织机构 - if (StrUtil.isNotEmpty(caseApplication.getName())) { - setApplicantOrganization(caseAffiliate, caseApplication, deptMap); - } - String s = buildAgentInfo(caseAffiliate, roleId); - if (StrUtil.isNotEmpty(s)) { - StringBuilder errorMsg = caseApplication.getErrorMsg(); - if (StrUtil.isEmpty(errorMsg)) { - errorMsg = new StringBuilder(); - } - errorMsg.append(s); - caseApplication.setErrorMsg(errorMsg); - } - caseAffiliatesnew.add(caseAffiliate); - - // 组装被申请人信息 - caseAffiliatesnew.add(buildDebtorInfo(caseApplication)); - caseApplication.setCaseAffiliates(caseAffiliatesnew); - } - private CaseAffiliate buildApplicaInfo(CaseApplication caseApplication) { // 申请人信息 CaseAffiliate caseAffiliate = new CaseAffiliate(); @@ -3639,7 +3382,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { // 查询最大房间号 Long maxRoomId = caseApplicationMapper.selectMaxRoomId(); - if (null == maxRoomId || maxRoomId > 4294967294L/2) { + if (null == maxRoomId || maxRoomId > 4294967294L / 2) { return 1L; } else { return maxRoomId + 1; @@ -3700,16 +3443,17 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { return success(reservedConferenceMapper.deleteByRoomId(roomId)); } + @Transactional @Override public AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId) { - return caseZipImportImpl.zipImport( file, templateId); + return caseZipImportImpl.zipImport(file, templateId); } - /** * 根据附件id修改案件id + * * @param caseAttach * @return */ @@ -3718,20 +3462,22 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAttachMapper.updateCaseAttach(caseAttach); return success(); } + /** * 保存onlyOffice在线编辑的文件 + * * @param * @return */ @Transactional @Override public AjaxResult saveOnlyOfficeFile(CaseAttach caseAttach) { - if(StrUtil.isNotEmpty(caseAttach.getAnnexPath())){ + if (StrUtil.isNotEmpty(caseAttach.getAnnexPath())) { String replace = caseAttach.getAnnexPath().replace("/home/ruoyi/uploadPath/", "/profile/"); - caseAttach.setAnnexName(replace); + caseAttach.setAnnexPath(replace); } - caseAttach.setAnnexPath("/home/ruoyi/uploadPath/onlyoffice/"); + // caseAttach.setAnnexPath("/home/ruoyi/uploadPath/onlyoffice/"); caseAttach.setAnnexType(3); caseAttach.setUserId(SecurityUtils.getUserId()); @@ -3743,6 +3489,538 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { return AjaxResult.success(); } + /** + * 新增或编辑案件 + * + * @param caseApplication + * @return + */ + @Transactional + @Override + public AjaxResult insertOrUpdate(CaseApplicationDTO caseApplication) { + CaseAffiliateVO caseAffiliateVO = caseApplication.getAffiliate(); + if (null == caseAffiliateVO) { + throw new ServiceException("案件相关人员未填写"); + } + if (caseApplication.getId() != null) { + // 修改 + caseApplicationService.update(caseApplication); + } else { + // 新增 + caseApplicationService.insert(caseApplication); + } + return success(); + } + + /** + * 新增案件 + * + * @param caseApplication + */ + @Transactional + @Override + public void insert(CaseApplicationDTO caseApplication) { + CaseAffiliateVO caseAffiliateVO = caseApplication.getAffiliate(); + caseApplication.setCreateBy(getUsername()); + caseApplication.setVersion(1); + caseApplication.setId(IdWorkerUtil.getId()); + caseApplication.setCreateTime(new Date()); + caseApplication.setRegisterDate(new Date()); + caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); + // 设置编码 + caseApplication.setCaseNum(generateCaseNum()); + // 设置批号 + caseApplication.setBatchNumber(generateBatchNumber()); + // 计算仲裁费用 + caseApplication.setFeePayable(calculateFee(caseApplication.getCaseSubjectAmount())); + caseApplication.setPaidExpenses(caseApplication.getFeePayable()); + // 新增立案申请表 + int rows = caseApplicationMapper.insert(caseApplication); + if (rows == 0) { + throw new ServiceException("新增失败"); + } + List affliates = new ArrayList<>(); + // 新增案件相关人员 + caseApplicationService.insertCaseAfflicate(caseAffiliateVO, affliates, caseApplication); + + + // 保存附件 + // 是否是压缩包导入,压缩包导入则不更新附件 + boolean isZipImport = caseApplication.getImportFlag() == null || caseApplication.getImportFlag() != 2; + List caseAttachList = caseApplication.getCaseAttachList(); + if (caseAttachList != null && caseAttachList.size() > 0) { + if (isZipImport) { + for (CaseAttach caseAttach : caseAttachList) { + caseAttach.setCaseAppliId(caseApplication.getId()); + // 修改案件附件 + caseAttachMapper.updateCaseAttach(caseAttach); + } + } else { + // 压缩包导入 + for (CaseAttach caseAttach : caseAttachList) { + caseAttach.setCaseAppliId(caseApplication.getId()); + } + caseAttachMapper.batchSave(caseAttachList); + } + } + // 新增日志 + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_INSERT, ""); + // 异步新增案件日志 + List columnValueList = caseApplication.getColumnValueList(); + ThreadPoolUtil.execute(() -> { + // 批量新增columnValue自定义字段 + if (CollectionUtil.isNotEmpty(columnValueList)) { + columnValueList.forEach(columnValue -> columnValue.setCaseId(caseApplication.getId())); + columnValueMapper.batchSave(columnValueList); + } + CaseApplication application = new CaseApplication(); + BeanUtil.copyProperties(caseApplication, application); + // 新增案件日志表 + application.setCaseAppliId(caseApplication.getId()); + application.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode()); + application.setCaseLogId(IdWorkerUtil.getId()); + int insertRow = caseApplicationLogMapper.insert(application); + // 插入案件相关人员表日志 + if (insertRow != 0 && CollectionUtil.isNotEmpty(affliates)) { + affliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(application.getCaseLogId())); + + caseAffiliateLogMapper.batchCaseAffiliate(affliates); + } + // 插入附件表日志 + if (CollectionUtil.isNotEmpty(caseAttachList)) { + List filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList()); + // 插入日志附件表 + if (CollectionUtil.isNotEmpty(filterList)) { + for (CaseAttach caseAttach : filterList) { + // 查询附件表 + CaseAttach attach = caseAttachMapper.queryAnnexById(caseAttach.getAnnexId()); + attach.setCaseAppliLogId(application.getCaseLogId()); + caseAttachLogMapper.save(attach); + } + } + + } + // 插入columnValueLog自定义字段日志表 + if (CollectionUtil.isNotEmpty(columnValueList)) { + columnValueList.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(application.getCaseLogId())); + columnValueLogMapper.batchSave(columnValueList); + + } + + + }); + } + + /** + * 设置案件相关信息 + * + * @param caseApplication + * @param affiliate + * @param groupOrder 组别 + * @param operatorCount 操作人数量 + * @param updateFlag 是否修改案件 + */ + @Transactional + public int setCaseAfflicate(List affliates, CaseApplicationDTO caseApplication, CaseAffiliateEntity affiliate, int groupOrder, int operatorCount, boolean updateFlag) { + if (affiliate == null) { + return operatorCount; + } + affiliate.setCaseAppliId(caseApplication.getId()); + boolean b = affiliate.getOrganizeFlag() != 1 && (affiliate.getRoleType() == 1 || affiliate.getRoleType() == 3) && StrUtil.isEmpty(affiliate.getEmail()); + if (b || StrUtil.isEmpty(affiliate.getName())) { + return operatorCount; + } + affiliate.setGroupOrder(groupOrder); + List sysRoles = roleMapper.selectRoleAll(); + if (CollectionUtil.isEmpty(sysRoles)) { + throw new ServiceException("角色不全,请联系管理员新增角色"); + } + Map roleMap = sysRoles.stream().collect(Collectors.toMap(SysRole::getRoleName, SysRole::getRoleId, (n1, n2) -> n2)); + + affiliate.setCaseAppliId(caseApplication.getId()); + List roleIdList = new ArrayList<>(); + switch (affiliate.getRoleType()) { + case 1: + // 申请人 + roleIdList.add(roleMap.get("申请人")); + if (affiliate.getOperatorFlag() == 1) { + // 是操作人 + roleIdList.add(roleMap.get("申请人操作人")); + } + break; + case 2: + // 申请代理人 + roleIdList.add(roleMap.get("委托代理人")); + if (affiliate.getOperatorFlag() == 1) { + // 是操作人 + roleIdList.add(roleMap.get("申请人操作人")); + } + break; + case 3: + // 被申 + roleIdList.add(roleMap.get("被申请人")); + if (affiliate.getOperatorFlag() == 1) { + // 是操作人 + roleIdList.add(roleMap.get("被申请人操作人")); + } + + break; + case 4: + // 被申代理 + roleIdList.add(roleMap.get("委托代理人")); + if (affiliate.getOperatorFlag() == 1) { + // 是操作人 + roleIdList.add(roleMap.get("被申请人操作人")); + } + break; + default: + break; + } + // 如果是申请人,则和用户表关联 + if (affiliate.getOrganizeFlag() == 0) { + caseApplicationService.insertAfficateUser(affiliate, roleIdList, updateFlag); + } else { + // 申请机构 + if (affiliate.getRoleType() == 1 || affiliate.getRoleType() == 3) { + affiliate.setOperatorFlag(0); + // 申请人,从缓存中判断部门是否存在 + SysDept dept = null; + if (!updateFlag) { + // 新增则根据部门名称查 + dept = sysDeptMapper.selectDeptByName(affiliate.getName()); + } else { + if (affiliate.getApplicantDeptId() != null) { + // 修改根据部门id查 + dept = sysDeptMapper.selectDeptById(affiliate.getApplicantDeptId()); + } else { + dept = sysDeptMapper.selectDeptByName(affiliate.getName()); + } + } + if (dept == null) { + // 不存在该部门,新增 + dept = new SysDept(); + dept.setParentId(0L); + dept.setDeptName(affiliate.getName()); + dept.setAncestors("0"); + dept.setOrderNum(1); + dept.setStatus("0"); + dept.setDelFlag("0"); + dept.setCode(affiliate.getCode()); + dept.setHome(affiliate.getHome()); + dept.setAddress(affiliate.getAddress()); + dept.setCompLegalPerson(affiliate.getCompLegalPerson()); + dept.setCreateBy(getUsername()); + dept.setCreateTime(new Date()); + dept.setNationality(affiliate.getNationality()); + sysDeptMapper.insertDept(dept); + } else { + // 更新部门 + dept.setCode(affiliate.getCode()); + dept.setCompLegalPerson(affiliate.getCompLegalPerson()); + dept.setUpdateBy(getUsername()); + dept.setUpdateTime(new Date()); + dept.setNationality(affiliate.getNationality()); + dept.setHome(affiliate.getHome()); + dept.setAddress(affiliate.getAddress()); + sysDeptMapper.updateDept(dept); + } + affiliate.setApplicantDeptId(dept.getDeptId()); + } else { + caseApplicationService.insertAfficateUser(affiliate, roleIdList, updateFlag); + } + } + affliates.add(affiliate); + // 保存人员 + caseAffiliateMapper.insert(affiliate); + if (affiliate.getOperatorFlag() != null && affiliate.getOperatorFlag() == 1) { + operatorCount++; + } + return operatorCount; + } + + /** + * 新增案件相关人员信息 + * + * @param affiliate 相关人员信息 + * @param roleIdList 角色id + * @param updateFlag 是否修改案件 + */ + @Transactional + public void insertAfficateUser(CaseAffiliateEntity affiliate, List roleIdList, boolean updateFlag) { + + if (StrUtil.isEmpty(affiliate.getEmail())) { + return; + } + SysUser user = null; + if (!updateFlag) { + // 新增案件则根据邮箱查用户 + user = sysUserMapper.selectUserByEmail(affiliate.getEmail()); + } else { + // 修改案件则根据userId查用户 + if (affiliate.getUserId() != null) { + user = sysUserMapper.selectUserById(affiliate.getUserId()); + } else { + user = sysUserMapper.selectUserByEmail(affiliate.getEmail()); + } + } + // 判断该用户是否存在 + if (user == null) { + // 不存在,则新增 + user = new SysUser(); + user.setPosition(affiliate.getPosition()); + user.setPassword(SecurityUtils.encryptPassword("abc123456")); + user.setUserName(affiliate.getEmail()); + user.setNickName(affiliate.getName()); + user.setEmail(affiliate.getEmail()); + user.setHome(affiliate.getHome()); + user.setSex(affiliate.getSex()); + user.setIdCard(affiliate.getIdCard()); + user.setBirth(affiliate.getBirth()); + user.setPhonenumber(affiliate.getPhone()); + user.setAddress(affiliate.getAddress()); + user.setIdType(affiliate.getIdType()); + user.setNationality(affiliate.getNationality()); + sysUserMapper.insertUser(user); + affiliate.setUserId(user.getUserId()); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY + user.getUserId(), user); + // 查询该角色是否存在申请人角色 + List roleIds = userRoleMapper.selectRoleIdsByUserId(user.getUserId()); + for (Long roleId : roleIdList) { + if(roleId==null){ + continue; + } + if (CollectionUtil.isEmpty(roleIds) && !roleIds.contains(roleId)) { + userRoleMapper.insertUserRole(user.getUserId(), roleId); + } + } + + } else { + // 存在的话将案件人员信息同步到用户表,更新用户表 + user.setPosition(affiliate.getPosition()); + user.setHome(affiliate.getHome()); + user.setNickName(affiliate.getName()); + user.setSex(affiliate.getSex()); + user.setIdCard(affiliate.getIdCard()); + user.setBirth(affiliate.getBirth()); + user.setPhonenumber(affiliate.getPhone()); + user.setAddress(affiliate.getAddress()); + user.setIdType(affiliate.getIdType()); + user.setNationality(affiliate.getNationality()); + user.setEmail(affiliate.getEmail()); + sysUserMapper.updateUser(user); + affiliate.setUserId(user.getUserId()); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY + user.getUserId(), user); + // 查询该角色是否存在申请人角色 + List roleIds = userRoleMapper.selectRoleIdsByUserId(user.getUserId()); + for (Long roleId : roleIdList) { + if(roleId==null){ + continue; + } + if (CollectionUtil.isEmpty(roleIds) || !roleIds.contains(roleId)) { + userRoleMapper.insertUserRole(user.getUserId(), roleId); + } + } + + } + } + + @Transactional + @Override + public void insertCaseAfflicate(CaseAffiliateVO caseAffiliateVO, List affliates, CaseApplicationDTO caseApplication) { + // 组装案件相关人员 + int appOperatorCount = 0; + int resOperatorCount = 0; + // 保存案件相关人员 + List applicant = caseAffiliateVO.getApplicant(); + List res = caseAffiliateVO.getRes(); + + if (CollectionUtil.isNotEmpty(applicant)) { + for (int i = 0; i < applicant.size(); i++) { + // 申请人 + appOperatorCount = setCaseAfflicate(affliates, caseApplication, applicant.get(i).getApplicant(), i, appOperatorCount, false); + // 申请人代理人 + appOperatorCount = setCaseAfflicate(affliates, caseApplication, applicant.get(i).getApplicantAgent(), i, appOperatorCount, false); + } + } + if (CollectionUtil.isNotEmpty(res)) { + for (int i = 0; i < res.size(); i++) { + // 申请人 + resOperatorCount = setCaseAfflicate(affliates, caseApplication, res.get(i).getRes(), i, resOperatorCount, false); + // 申请人代理人 + resOperatorCount = setCaseAfflicate(affliates, caseApplication, res.get(i).getResAgent(), i, resOperatorCount, false); + } + } + if (appOperatorCount < 1 && resOperatorCount < 1) { + throw new ServiceException("未设置申请操作人和被申请操作人"); + } else if (appOperatorCount < 1) { + throw new ServiceException("未设置申请操作人"); + } else if (resOperatorCount < 1) { + throw new ServiceException("未设置被申请操作人"); + } + } + + @Override + public List selectAfflicatesByCaseId(Long id) { + CaseAffiliateEntity affiliateEntity = new CaseAffiliateEntity(); + affiliateEntity.setCaseAppliId(id); + return caseAffiliateMapper.selectCaseAffiliate(affiliateEntity); + } + + @Override + public SysUser getUserInfo() { + SysUser sysUser = new SysUser(); + + if (SecurityUtils.getUserId() != null) { + sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId()); + + } + return sysUser; + } + + /** + * 获取批号 + * + * @return + */ + private Integer generateBatchNumber() { + + Integer batchNumber = caseApplicationMapper.selectMaxBatchNumber(); + AtomicInteger maxBatchNumber = new AtomicInteger(); + if (batchNumber == null) { + maxBatchNumber.set(1); + + } else { + maxBatchNumber.set(batchNumber + 1); + + } + return maxBatchNumber.get(); + } + + /** + * 计算仲裁费用 + * + * @param caseSubjectAmount 案件标的 + * @return + */ + private BigDecimal calculateFee(BigDecimal caseSubjectAmount) { + if (caseSubjectAmount.equals(BigDecimal.ZERO)) { + return BigDecimal.ZERO; + } + BigDecimal feeRate = new BigDecimal(0.01); + return caseSubjectAmount.multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP); + + } + + /** + * 修改案件 + * + * @param caseApplication + */ + @Transactional + + @Override + public void update(CaseApplicationDTO caseApplication) { + caseApplication.setFeePayable(calculateFee(caseApplication.getCaseSubjectAmount())); + caseApplication.setPaidExpenses(caseApplication.getFeePayable()); + caseApplication.setUpdateBy(SecurityUtils.getUsername()); + caseApplication.setUpdateTime(new Date()); + Integer updateSubmitStatus = 0; + // 立案申请状态直接修改主表信息 + if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) { + // 修改内置字段 + caseApplicationMapper.update(caseApplication); + if (CollectionUtil.isNotEmpty(caseApplication.getColumnValueList())) { + // 修改自定义字段 + for (ColumnValue columnValue : caseApplication.getColumnValueList()) { + if (StrUtil.isNotEmpty(columnValue.getValue())) { + columnValueMapper.updateColumnValue(columnValue); + } + } + } + } else { + // 修改记录表状态为已提交修改的内容 + updateSubmitStatus = UpdateSubmitStatus.COMMITTED.getCode(); + } + CaseApplication application = new CaseApplication(); + BeanUtil.copyProperties(caseApplication, application); + application.setUpdateSubmitStatus(updateSubmitStatus); + CaseAffiliateVO caseAffiliateVO = caseApplication.getAffiliate(); + List affliates = new ArrayList<>(); + // 删除已存在的人员 + caseAffiliateMapper.deleteByCaseId(caseApplication.getId()); + // 新增案件相关人员 + caseApplicationService.insertCaseAfflicate(caseAffiliateVO, affliates, caseApplication); + // 保存附件 + if (CollectionUtil.isNotEmpty(caseApplication.getCaseAttachList())) { + for (CaseAttach caseAttach : caseApplication.getCaseAttachList()) { + if(caseAttach==null){ + continue; + } + caseAttach.setCaseAppliId(caseApplication.getId()); + caseAttachMapper.updateCaseAttach(caseAttach); + } + } + // 修改自定义字段 + if (CollectionUtil.isNotEmpty(caseApplication.getColumnValueList())) { + columnValueMapper.batchUpdate(caseApplication.getColumnValueList()); + } + + // 根据案件id查询最新版本号 + Integer maxVersion = caseApplicationLogMapper.selectMaxVersionByCaseId(caseApplication.getId()); + if (maxVersion == null) { + maxVersion = 1; + } + caseApplication.setVersion(maxVersion + 1); + LoginUser loginUser = getLoginUser(); + // 异步新增案件日志 + List columnValueList = caseApplication.getColumnValueList(); + ThreadPoolUtil.execute(() -> { + //新增案件日志记录 + insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_EDIT, "", loginUser); + + // 批量新增columnValue自定义字段 + if (CollectionUtil.isNotEmpty(columnValueList)) { + columnValueList.forEach(columnValue -> columnValue.setCaseId(caseApplication.getId())); + columnValueMapper.batchSave(columnValueList); + } + // 新增案件日志表 + application.setCaseAppliId(caseApplication.getId()); + // application.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode()); + application.setCaseLogId(IdWorkerUtil.getId()); + int insertRow = caseApplicationLogMapper.insert(application); + // 插入案件相关人员表日志 + if (insertRow != 0 && CollectionUtil.isNotEmpty(affliates)) { + affliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(application.getCaseLogId())); + + caseAffiliateLogMapper.batchCaseAffiliate(affliates); + } + // 插入附件表日志 + if (CollectionUtil.isNotEmpty(caseApplication.getCaseAttachList())) { + List filterList = caseApplication.getCaseAttachList().stream().filter(c -> c!=null && c.getAnnexType().equals(2)).collect(Collectors.toList()); + // 插入日志附件表 + if (CollectionUtil.isNotEmpty(filterList)) { + for (CaseAttach caseAttach : filterList) { + // 查询附件表 + CaseAttach attach = caseAttachMapper.queryAnnexById(caseAttach.getAnnexId()); + attach.setCaseAppliLogId(application.getCaseLogId()); + caseAttachLogMapper.save(attach); + } + } + + } + // 插入columnValueLog自定义字段日志表 + if (CollectionUtil.isNotEmpty(columnValueList)) { + columnValueList.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(application.getCaseLogId())); + columnValueLogMapper.batchSave(columnValueList); + + } + + + }); + } + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java index fc4b082..1d8cbdc 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.wisdomarbitrate.service.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; import com.deepoove.poi.data.PictureRenderData; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.AjaxResult; @@ -8,6 +9,7 @@ import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.WordUtil; import com.ruoyi.wisdomarbitrate.domain.*; +import com.ruoyi.wisdomarbitrate.domain.entity.CaseAffiliateEntity; import com.ruoyi.wisdomarbitrate.mapper.*; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; @@ -56,6 +58,8 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { private RedisCache redisCache; @Autowired private ICaseApplicationService caseApplicationService; + @Autowired + private ICaseArbitrateService caseArbitrateService; @Override @Transactional @@ -65,8 +69,11 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { if (caseApplication1 == null) { return AjaxResult.success(); } - Integer currentStatus = caseApplication1.getCaseStatus(); + // Integer currentStatus = caseApplication1.getCaseStatus(); Integer arbitratMethodOriral = caseApplication.getArbitratMethod(); + if (arbitratMethodOriral == null) { + return AjaxResult.error("请选择仲裁方式"); + } String caseNum = caseApplication1.getCaseNum(); if (opinion == 0) { //拒绝 @@ -77,46 +84,41 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { //修改案件状态为待修改开庭时间 // caseApplication1.setCaseStatus(CaseApplicationConstants.MODIFY_HEARDATE); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus, ""); + } else { caseApplication1.setArbitratMethod(2); //修改案件状态为待书面审理 caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus, ""); + } - } else if (opinion == 1 ) { + } else if (opinion == 1) { if (arbitratMethodOriral == 2) { //修改案件状态为待书面审理 caseApplication1.setArbitratMethod(2); caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus, ""); + } else { //修改案件状态为待修改开庭时间 caseApplication1.setArbitratMethod(1); caseApplication1.setCaseStatus(CaseApplicationConstants.MODIFY_HEARDATE); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),currentStatus, ""); + } - }else if (opinion == 2) { + } else if (opinion == 2) { if (arbitratMethodNow == 2) { //修改案件状态为待书面审理 caseApplication1.setArbitratMethod(2); caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus, ""); + } else { //修改案件状态为待修改开庭时间 caseApplication1.setArbitratMethod(1); caseApplication1.setCaseStatus(CaseApplicationConstants.MODIFY_HEARDATE); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus, ""); + } } @@ -126,14 +128,22 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { String arbitratMethodStr = caseApplication1.getArbitratMethod() == 1 ? "开庭审理" : "书面审理"; //发送短信通知 SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseApplication1.getId()); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); //获取案件关联人信息 + //获取案件关联人信息 + List caseAffiliates = caseApplicationService.selectAfflicatesByCaseId(caseApplication1.getId()); if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { + ArrayList operatorList = new ArrayList<>(); + // 申请操作人 + Optional applicantAffiliateOpt = caseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst(); + // 被申请操作人 + Optional resAffiliateOpt = caseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); + if (!applicantAffiliateOpt.isPresent() || !resAffiliateOpt.isPresent()) { + throw new ServiceException("未找到案件操作人员"); + } + operatorList.add(applicantAffiliateOpt.get()); + operatorList.add(resAffiliateOpt.get()); + for (CaseAffiliateEntity affiliate : operatorList) { request.setTemplateId("1931000"); - request.setPhone(affiliate.getContactTelphone()); + request.setPhone(affiliate.getPhone()); // 这个值,要看你的模板中是否预留了占位符,如果没有则不需要设置 // 1931000 尊敬的{1}用户,您的{2}仲裁案件,仲裁方式已确定为{3},请知晓,如非本人操作,请忽略本短信。 String name = affiliate.getName(); @@ -148,17 +158,17 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { String content = "尊敬的" + name + "用户,您的" + caseNum + "仲裁案件,仲裁方式已确定为" + arbitratMethodStr + ",请知晓,如非本人操作,请忽略本短信。"; smsSendRecord.setSendContent(content); smsSendRecord.setCreateBy(getUsername()); - if (aBoolean){ + if (aBoolean) { smsSendRecord.setSendStatus(1); - }else { + } else { smsSendRecord.setSendStatus(0); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); } } - - return AjaxResult.success("审核成功"); } + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CHECK_ARBITRATION_METHOD, ""); return AjaxResult.success(); } @@ -170,68 +180,13 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { caseApplicationsel.setCaseStatus(CaseApplicationConstants.CHECK_ARBITRATION_METHOD); List caseApplications1 = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel); if (caseApplications1 != null && caseApplications1.size() > 0) { - for(CaseApplication caseApplicationse:caseApplications1){ - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplicationse.getId()); - String caseNum = caseApplicationse.getCaseNum(); - Integer arbitratMethod = caseApplication.getArbitratMethod(); - if (arbitratMethod == 1) { - caseApplicationse.setArbitratMethod(1); - caseApplicationse.setCaseStatus(CaseApplicationConstants.MODIFY_HEARDATE); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus, ""); - - }else if (arbitratMethod == 2) { - //修改案件状态为待书面审理 - caseApplicationse.setArbitratMethod(2); - caseApplicationse.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus, ""); - - } - int i = caseApplicationMapper.submitCaseApplication(caseApplicationse); - - if (i > 0) { - String arbitratMethodStr = caseApplicationse.getArbitratMethod() == 1 ? "开庭审理" : "书面审理"; - //发送短信通知 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseApplicationse.getId()); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); //获取案件关联人信息 - if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - request.setTemplateId("1931000"); - request.setPhone(affiliate.getContactTelphone()); - // 这个值,要看你的模板中是否预留了占位符,如果没有则不需要设置 - // 1931000 尊敬的{1}用户,您的{2}仲裁案件,仲裁方式已确定为{3},请知晓,如非本人操作,请忽略本短信。 - String name = affiliate.getName(); - request.setTemplateParamSet(new String[]{name, caseNum, arbitratMethodStr}); - Boolean aBoolean = SmsUtils.sendSms(request); - //保存短信发送记录 - SmsSendRecord smsSendRecord = new SmsSendRecord(); - smsSendRecord.setCaseId(caseApplicationse.getId()); - smsSendRecord.setCaseNum(caseApplicationse.getCaseNum()); - smsSendRecord.setPhone(request.getPhone()); - smsSendRecord.setSendTime(new Date()); - String content = "尊敬的" + name + "用户,您的" + caseNum + "仲裁案件,仲裁方式已确定为" + arbitratMethodStr + ",请知晓,如非本人操作,请忽略本短信。"; - smsSendRecord.setSendContent(content); - smsSendRecord.setCreateBy(getUsername()); - if (aBoolean){ - smsSendRecord.setSendStatus(1); - }else { - smsSendRecord.setSendStatus(0); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - } - } - - - } + for (CaseApplication caseApplicationse : caseApplications1) { + caseArbitrateService.examineArbitrateMethod(caseApplicationse, caseApplication.getOpinion(), caseApplication.getArbitratMethod()); } - }else{ + } else { throw new ServiceException("这个批号没有批量审核仲裁方式的案件"); } @@ -254,7 +209,7 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); //案件日志表里添加数据 // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), caseApplication1.getCaseStatus(), ""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_WRIITEN_HEAR, ""); // 生成裁决书 CaseApplication application = new CaseApplication(); @@ -266,7 +221,7 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { } - }else{ + } else { throw new ServiceException("这个批号没有批量书面审理的案件"); } return AjaxResult.success(); @@ -276,7 +231,7 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { @Override @Transactional public AjaxResult writtenHear(CaseIds caseIds) { - if (caseIds!=null){ + if (caseIds != null) { List ids = caseIds.getIds(); for (Long caseId : ids) { //查询案件详情 @@ -289,321 +244,28 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord); if (arbitrateRecord1 != null) { int i = arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord); - if (i > 0) { - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), caseApplication1.getCaseStatus(), ""); - - } } else { //提交仲裁结果 int i = arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord); - if (i > 0) { - - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), caseApplication1.getCaseStatus(), ""); - } } // 生成裁决书 CaseApplication application = new CaseApplication(); application.setId(caseId); adjudicationService.createDocument(application); - //修改案件状态 - caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION); - int i = caseApplicationMapper.submitCaseApplication(caseApplication1); - + //修改案件状态 + caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION); + int i = caseApplicationMapper.submitCaseApplication(caseApplication1); +// 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_WRIITEN_HEAR, ""); } + + return AjaxResult.success("审理成功"); } return AjaxResult.error("请检查参数"); } - //生成裁决书 - private Boolean generateAward(Long id) { - try { - Map datas = new HashMap<>(); - if (id == null) { - return null; - } - //获取案件详细信息 - CaseApplication caseApplication = new CaseApplication(); - caseApplication.setId(id); - CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); - //生成编码 - String equipmentNo = getNewEquipmentNo(); - datas.put("num", equipmentNo); - //获取仲裁记录表里的相关信息 - ArbitrateRecord arbitrateRecord = new ArbitrateRecord(); - arbitrateRecord.setCaseAppliId(id); - ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord); - //获取案件关联人信息 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(id); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - List nameAgentList = new ArrayList<>(); - if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - //获取身份类型 - int identityType = affiliate.getIdentityType(); - if (identityType == 1) { //申请人 - datas.put("appName", affiliate.getName()); - datas.put("appAddress", affiliate.getResidenAffili()); - datas.put("appContactAddress", affiliate.getContactAddress()); - datas.put("appLegalPerson", affiliate.getCompLegalPerson()); - datas.put("appLegalPersonTitle", affiliate.getCompLegalperPost()); - datas.put("appAgentName", affiliate.getNameAgent()); - datas.put("appAgentTitle", affiliate.getAppliAgentTitle()); - nameAgentList.add(affiliate.getNameAgent()); - } else if (identityType == 2) { //被申请人 - datas.put("resName", affiliate.getName()); - datas.put("resAddress", affiliate.getResidenAffili()); - String responSex = affiliate.getResponSex(); - if (responSex.equals("0")) { - datas.put("resSex", "男"); - } else if (responSex.equals("1")){ - datas.put("resSex", "女"); - }else { - datas.put("resSex", "未知"); - } - Date responBirth = affiliate.getResponBirth(); - if (responBirth != null) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - String responBirthStr = sdf.format(responBirth); - datas.put("resDateOfBirth", responBirthStr); - - } - - datas.put("resContactAddress", affiliate.getContactAddress()); - nameAgentList.add(affiliate.getNameAgent()); - } - } - } - Date createTime = caseApplication1.getCreateTime(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - // 将日期格式化为字符串 - String createTimeStr = sdf.format(createTime); - datas.put("submissionDate", createTimeStr); - Date registerDate = caseApplication1.getRegisterDate(); - String registerDateStr = sdf.format(registerDate); - datas.put("acceptDate", registerDateStr); - //反请求 - Integer adjudicaCounter = caseApplication1.getAdjudicaCounter(); - String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" + - "《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" + - "仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。"; - if (adjudicaCounter == null) { - datas.put("counterclaim", null); - } else if (adjudicaCounter == 1) { - datas.put("counterclaim", counterclaim); - } else { - datas.put("counterclaim", null); - } - //财产保全 - Integer properPreser = caseApplication1.getProperPreser(); - String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" + - "第二十八条之规定,将该申请提交至法院。"; - if (properPreser == null) { - datas.put("preservation", null); - } else if (properPreser == 1) { - datas.put("preservation", preservation); - } else { - datas.put("preservation", null); - } - //管辖权异议 - Integer objectiJuris = caseApplication1.getObjectiJuris(); - String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《XX管辖异议申请书》,认为XXXXXX" + - ",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。"; - if (objectiJuris == null) { - datas.put("jurisdictionalObjection", null); - } else if (objectiJuris == 1) { - datas.put("jurisdictionalObjection", jurisdictionalObjection); - } else { - datas.put("jurisdictionalObjection", null); - } - String arbitratorName = caseApplication1.getArbitratorName(); - datas.put("arbitratorName", arbitratorName); - Integer arbitratMethod = caseApplication1.getArbitratMethod(); - Date hearDate = caseApplication1.getHearDate(); - if (hearDate != null) { - String hearDateStr = sdf.format(hearDate); - //线上开庭时 - if (arbitratMethod == 1) { - String onLine1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"; - String onLine2 = "通过仲裁委智慧仲裁平台开庭审理了本案。"; - datas.put("onLine1", onLine1); - datas.put("hearDate", hearDateStr); - datas.put("onLine2", onLine2); - } else { - //书面仲裁时 - String written1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"; - String written2 = "在仲裁委所在地开庭审理了本案。"; - datas.put("written1", written1); - datas.put("hearDate1", hearDateStr); - datas.put("written2", written2); - } - } - Integer isAbsence = caseApplication1.getIsAbsence(); - if (isAbsence == null) { - datas.put("absent1", null); - datas.put("absent2", null); - datas.put("absent3", null); - datas.put("absent4", null); - datas.put("absent5", null); - datas.put("attend1", null); - datas.put("attend2", null); - datas.put("attend3", null); - datas.put("attend4", null); - datas.put("attend5", null); - datas.put("attend6", null); - datas.put("attend7", null); - datas.put("appAgentName1", null); - datas.put("appAgentName2", null); - datas.put("resAgentName", null); - } else if (isAbsence == 1) { - //缺席审理 - String absent1 = "申请人的特别授权委托代理人"; - String absent2 = "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" + - "《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。"; - String absent3 = "庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明," + - "发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。"; - String absent4 = "(二/三)当事人提供的证据材料\n" + - "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:"; - String absent5 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + - "第四十条第(二)项、第五十一条的规定,缺席裁决如下:"; - datas.put("absent1", absent1); - datas.put("absent2", absent2); - datas.put("absent3", absent3); - datas.put("absent4", absent4); - datas.put("absent5", absent5); - datas.put("appAgentName1", nameAgentList.get(0)); - } else { - //出席审理 - String attend1 = "申请人的特别授权委托代理人"; - String attend2 = "和被申请人本人/的特别授权委托代理人"; - String attend3 = "出席了庭审。"; - String attend4 = "庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;" + - "双方当事人均出示了证据材料并对对方的证据材料进行了质证;申请人出示了证据材料," + - "被申请人对对方的证据材料进行了质证;双方当事人均回答了仲裁庭的提问,进行了辩论," + - "并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。"; - String attend5 = "(二)被申请人的答辩意见"; - String attend6 = "(二/三)当事人提供的证据材料及对方的质证意见\n" + - "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:"; - String attend7 = "被申请人对上述材料的质证意见为:"; - datas.put("attend1", attend1); - datas.put("attend2", attend2); - datas.put("attend3", attend3); - datas.put("attend4", attend4); - datas.put("attend5", attend5); - datas.put("attend6", attend6); - datas.put("attend7", attend7); - datas.put("responCrossOpin", caseApplication1.getResponCrossOpin()); - datas.put("appAgentName2", nameAgentList.get(0)); - datas.put("resAgentName", nameAgentList.get(1)); - if (arbitratMethod == 1) { - //被申出席+开庭 - String attend8 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + - "第五十一条的规定,裁决如下:"; - datas.put("attend8", attend8); - } else { - //被申出席+书面 - String attend9 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + - "第五十一条、第五十八条的规定,裁决如下:"; - datas.put("attend9", attend9); - } - } - datas.put("claims", caseApplication1.getArbitratClaims()); - datas.put("request", caseApplication1.getRequestRule()); - CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication); - List caseAttachList1 = caseApplication2.getCaseAttachList(); - if (caseAttachList1 != null && caseAttachList1.size() > 0) { - for (CaseAttach caseAttach : caseAttachList1) { - if (caseAttach.getAnnexType() == 6) { //被申请人证据材料 - String annexName = caseAttach.getAnnexName(); - boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName); - if (isImageFile) { - String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath(); - System.out.println("路径是===========" + annexPath); - PictureRenderData pictureRenderData = WordUtil - .rebuildImageContent(100, 100, null, annexPath); - datas.put("resEvidenceMaterial", pictureRenderData); - } - } else if (caseAttach.getAnnexType() == 2) { //申请人证据材料 - String annexName = caseAttach.getAnnexName(); - boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName); - if (isImageFile) { - String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath(); - System.out.println("路径是===========" + annexPath); - PictureRenderData pictureRenderData = WordUtil - .rebuildImageContent(100, 100, null, annexPath); - //申请人证据材料 - datas.put("appEvidenceMaterial", pictureRenderData); - } - } - } - } - datas.put("applicaCrossOpin", "被申请人证据不足,无法说明事实"); - datas.put("factDetermi", "被申请人欠款属实"); - datas.put("arbitrateThink", " 被申请人应按约定还款"); - datas.put("rulingFollows", "被申请人依法偿还申请人欠款"); - LocalDate now = LocalDate.now(); - String year = Integer.toString(now.getYear()); - datas.put("year", year); - String month = String.format("%02d", now.getMonthValue()); - String day = String.format("%02d", now.getDayOfMonth()); - String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx"; - //String modalFilePath = "D:/develop/新裁决书模板.docx"; - String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; - //String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day; - String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx"; - String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; - String resultFilePath = saveFolderPath + "/" + fileName; - // 创建日期目录 - File saveFolder = new File(saveFolderPath); - if (!saveFolder.exists()) { - saveFolder.mkdirs(); - } - Path sourcePath = new File(modalFilePath).toPath(); - Path destinationPath = new File(resultFilePath).toPath(); - Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING); - String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath); - File file = new File(docFilePath); - if (file.exists()) { - InputStream in = new FileInputStream(file); - XWPFDocument xwpfDocument = new XWPFDocument(in); - WordUtil.changeText(xwpfDocument); - } - String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8); - CaseAttach caseAttach = CaseAttach.builder() - .caseAppliId(id) - .annexName(saveName) - .annexPath(savePath) - .annexType(3) - .build(); - //保存到附件表里,先判断之前有没有,有的话更新,没有的话新增 - CaseAttach caseAttach1 = new CaseAttach(); - caseAttach1.setAnnexType(3); - caseAttach1.setCaseAppliId(id); - List caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach1); - if (caseAttachList != null && caseAttachList.size() > 0) { - //之前已经生成过了,更新 - caseAttachMapper.updateCaseAttachBycaseid(caseAttach); - } else { - //之前没生成过,新增 - int i = caseAttachMapper.save(caseAttach); - if (i > 0) { - if (arbitrateRecord1 != null) { - Long annexId = caseAttach.getAnnexId(); - //将附件id保存到仲裁记录表里面 - arbitrateRecord1.setAnnexId(annexId); - arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1); - } - } - } - return Boolean.TRUE; - } catch (IOException e) { - return Boolean.FALSE; - } - } public String getNewEquipmentNo() { Object awardNum = redisCache.getCacheObject("awardNum"); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java index afce097..b787d12 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java @@ -59,77 +59,77 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { @Autowired private ICaseApplicationService caseApplicationService; - @Override - @Transactional - public AjaxResult getCaseDetailsById(Long id, String userName) { - CaseApplication caseApplication = new CaseApplication(); - caseApplication.setId(id); - CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); - if (caseApplication1 != null) { - CaseDetailVO caseDetailVO = new CaseDetailVO(); - BeanUtils.copyProperties(caseApplication1, caseDetailVO); - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(id); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - for (CaseAffiliate affiliate : caseAffiliates) { - if (affiliate.getName() != null) { - String name = affiliate.getName(); - //判断当前登录人和案件关联人姓名是否一致 - if (name.equals(userName)) { //一致,将案件关联人的身份类型赋给当前登录人 - caseDetailVO.setIdentityType(affiliate.getIdentityType()); - } - } - if (affiliate.getIdentityType() == 1) { //申请人 - caseDetailVO.setApplicantName(affiliate.getName()); - } else { - caseDetailVO.setRespondentName(affiliate.getName()); - } - //根据案件id查询案件证据材料 - List evidenceMaterialList = caseAttachMapper.queryAnnexPathByCaseId(id); - if (evidenceMaterialList != null && evidenceMaterialList.size() > 0) { -// for (CaseAttach caseAttach : evidenceMaterialList) { -// //根据附件类型决定返回的路径 -// Integer annexType = caseAttach.getAnnexType(); -// if (annexType != 1){ -// String path = caseAttach.getAnnexName(); -// String prefix = "/profile"; -// int startIndex = path.indexOf(prefix); -// startIndex += prefix.length(); -// String extractedPath = "/uploadPath" + path.substring(startIndex); -// caseAttach.setAnnexPath(extractedPath); -// }else { -// String annexPath = caseAttach.getAnnexPath(); -// String result = annexPath.replace("/home/ruoyi", ""); -// caseAttach.setAnnexPath(result); -// } +// @Override +// @Transactional +// public AjaxResult getCaseDetailsById(Long id, String userName) { +// CaseApplication caseApplication = new CaseApplication(); +// caseApplication.setId(id); +// CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); +// if (caseApplication1 != null) { +// CaseDetailVO caseDetailVO = new CaseDetailVO(); +// BeanUtils.copyProperties(caseApplication1, caseDetailVO); +// CaseAffiliate caseAffiliate = new CaseAffiliate(); +// caseAffiliate.setCaseAppliId(id); +// List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); +// for (CaseAffiliate affiliate : caseAffiliates) { +// if (affiliate.getName() != null) { +// String name = affiliate.getName(); +// //判断当前登录人和案件关联人姓名是否一致 +// if (name.equals(userName)) { //一致,将案件关联人的身份类型赋给当前登录人 +// caseDetailVO.setIdentityType(affiliate.getIdentityType()); // } - - for (CaseAttach caseAttach : evidenceMaterialList) { - String annexName = caseAttach.getAnnexName(); - String prefix = "/profile"; - int startIndex = annexName.indexOf(prefix); - if(startIndex!=-1) { - startIndex += prefix.length(); - - String annexPath = "/uploadPath" + annexName.substring(startIndex); - caseAttach.setAnnexPath(annexPath); - } - int startIndexnew = annexName.lastIndexOf("/"); - if (startIndexnew != -1) { - String annexNamenew = annexName.substring(startIndexnew + 1); - caseAttach.setAnnexName(annexNamenew); - } - - - } - - } - caseDetailVO.setEvidenceMaterialList(evidenceMaterialList); - } - return AjaxResult.success(caseDetailVO); - } - return null; - } +// } +// if (affiliate.getIdentityType() == 1) { //申请人 +// caseDetailVO.setApplicantName(affiliate.getName()); +// } else { +// caseDetailVO.setRespondentName(affiliate.getName()); +// } +// //根据案件id查询案件证据材料 +// List evidenceMaterialList = caseAttachMapper.queryAnnexPathByCaseId(id); +// if (evidenceMaterialList != null && evidenceMaterialList.size() > 0) { +//// for (CaseAttach caseAttach : evidenceMaterialList) { +//// //根据附件类型决定返回的路径 +//// Integer annexType = caseAttach.getAnnexType(); +//// if (annexType != 1){ +//// String path = caseAttach.getAnnexName(); +//// String prefix = "/profile"; +//// int startIndex = path.indexOf(prefix); +//// startIndex += prefix.length(); +//// String extractedPath = "/uploadPath" + path.substring(startIndex); +//// caseAttach.setAnnexPath(extractedPath); +//// }else { +//// String annexPath = caseAttach.getAnnexPath(); +//// String result = annexPath.replace("/home/ruoyi", ""); +//// caseAttach.setAnnexPath(result); +//// } +//// } +// +// for (CaseAttach caseAttach : evidenceMaterialList) { +// String annexName = caseAttach.getAnnexName(); +// String prefix = "/profile"; +// int startIndex = annexName.indexOf(prefix); +// if(startIndex!=-1) { +// startIndex += prefix.length(); +// +// String annexPath = "/uploadPath" + annexName.substring(startIndex); +// caseAttach.setAnnexPath(annexPath); +// } +// int startIndexnew = annexName.lastIndexOf("/"); +// if (startIndexnew != -1) { +// String annexNamenew = annexName.substring(startIndexnew + 1); +// caseAttach.setAnnexName(annexNamenew); +// } +// +// +// } +// +// } +// caseDetailVO.setEvidenceMaterialList(evidenceMaterialList); +// } +// return AjaxResult.success(caseDetailVO); +// } +// return null; +// } @Override @Transactional @@ -138,10 +138,12 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { if (file.isEmpty()) { return AjaxResult.error("请选择要上传的文件"); } + AjaxResult success = AjaxResult.success(); try { String filePath = RuoYiConfig.getUploadPath(); // 上传 String fileName = FileUploadUtils.upload(filePath, file); + String name = file.getOriginalFilename(); String suffix = getFileExtension(fileName); if(StrUtil.isNotEmpty(suffix)&& suffix.contains("doc")){ // 上传到onlyoffice @@ -149,30 +151,47 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { if(jsonArray!=null && jsonArray.size() > 0) { for (Object obj : jsonArray) { JSONObject jsonObject = (JSONObject) obj; - CaseAttach caseAttach = CaseAttach.builder() + String path = jsonObject.get("filePath")!=null?jsonObject.getString("filePath"):""; + path=path.replace("/home/ruoyi/uploadPath/","/profile/"); + name = jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):""; + CaseAttach caseAttach = CaseAttach.builder() .caseAppliId(id) .annexType(annexType) - .annexName(jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):"") + .annexName(name) .onlyOfficeFileId(jsonObject.getString("fileId")) + .annexPath(path) .build(); - if(jsonObject.get("filePath")!=null){ - String officePath = jsonObject.getString("filePath"); - String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); - caseAttach.setAnnexPath(replace); - +// if(jsonObject.get("filePath")!=null){ +// String officePath = jsonObject.getString("filePath"); +// String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); +// caseAttach.setAnnexPath(replace); +// +// } + if(annexType!=null && annexType.equals(8)){ + // 缴费单,先删除 + caseAttachMapper.deleteCaseAttachByCasedIdAndType(id,annexType); } caseAttachMapper.save(caseAttach); + success.put("annexId", caseAttach.getAnnexId()); + success.put("annexType", caseAttach.getAnnexType()); } } }else { + filePath=fileName.replace("/home/ruoyi/uploadPath/","/profile/"); + if(annexType!=null && annexType.equals(8)){ + // 缴费单,先删除 + caseAttachMapper.deleteCaseAttachByCasedIdAndType(id,annexType); + } CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id) - .annexName(fileName) + .annexName(name) .annexPath(filePath) .annexType(annexType) .userId(userId) .userName(userName) .build(); int count = caseAttachMapper.save(caseAttach); + success.put("annexId", caseAttach.getAnnexId()); + success.put("annexType", caseAttach.getAnnexType()); } if ( annexType != null && annexType != 8) { if (id != null) { @@ -183,7 +202,7 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { caseApplicationMapper.submitCaseApplication(caseApplication); } } - return AjaxResult.success(); + return success; } catch (IOException e) { e.printStackTrace(); } @@ -195,49 +214,49 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { @Autowired IdentityAuthenticationMapper identityAuthenticationMapper; - @Override - public List getCaseListAll(Integer caseStatus) { - // 是否为超级管理员 - int adMinFlag=0; - String identityNum = ""; - IdentityAuthentication authentication = new IdentityAuthentication(); - LoginUser loginUser = SecurityUtils.getLoginUser(); - // 查询该用户的角色 - // 查询登录人手机号 - SysUser sysUser = sysUserMapper.selectUserById(loginUser.getUserId()); - String username = sysUser.getUserName(); - List roles = sysUser.getRoles(); - if(CollectionUtil.isNotEmpty(roles)){ - for (SysRole role : roles) { - if(role.getRoleName().equals("超级管理员") - ){ - // 超级管理员可查看所有待案件质证的案件 - adMinFlag=1; - break; - } - } - } -// if(adMinFlag!=1) { -// authentication.setUserName(username); -// IdentityAuthentication authentication1 = identityAuthenticationMapper.selectIdentityAuthentication(authentication); -// if (authentication1 != null) { -// identityNum = authentication1.getIdentityNo(); -// } -// } - String phone=sysUser.getPhonenumber(); - List caseStatusList = Arrays.asList(caseStatus); -// return getCaseEvidenceVOList(identityNum, caseStatusList, 2); - return getCaseEvidenceVOListByPhone(phone, caseStatusList, 2); - } +// @Override +// public List getCaseListAll(Integer caseStatus) { +// // 是否为超级管理员 +// int adMinFlag=0; +// String identityNum = ""; +// IdentityAuthentication authentication = new IdentityAuthentication(); +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// // 查询该用户的角色 +// // 查询登录人手机号 +// SysUser sysUser = sysUserMapper.selectUserById(loginUser.getUserId()); +// String username = sysUser.getUserName(); +// List roles = sysUser.getRoles(); +// if(CollectionUtil.isNotEmpty(roles)){ +// for (SysRole role : roles) { +// if(role.getRoleName().equals("超级管理员") +// ){ +// // 超级管理员可查看所有待案件质证的案件 +// adMinFlag=1; +// break; +// } +// } +// } +//// if(adMinFlag!=1) { +//// authentication.setUserName(username); +//// IdentityAuthentication authentication1 = identityAuthenticationMapper.selectIdentityAuthentication(authentication); +//// if (authentication1 != null) { +//// identityNum = authentication1.getIdentityNo(); +//// } +//// } +// String phone=sysUser.getPhonenumber(); +// List caseStatusList = Arrays.asList(caseStatus); +//// return getCaseEvidenceVOList(identityNum, caseStatusList, 2); +// return getCaseEvidenceVOListByPhone(phone, caseStatusList, 2); +// } @Override public AjaxResult evidenceConfirmation(CaseApplication caseApplication) { - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); + // Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseApplication.getId()); caseApplication.setCaseStatus(CaseApplicationConstants.PENDING_TRIAL); int i = caseApplicationMapper.submitCaseApplication(caseApplication); if (i > 0) { // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(),currentStatus, ""); +// CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants., ""); return AjaxResult.success("证据确认成功"); } @@ -275,7 +294,7 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { int i = caseApplicationMapper.submitCaseApplication(caseApplication1); if (i > 0) { // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), caseStatus, ""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_CROSSEXAMI, ""); return AjaxResult.success("提交成功"); } @@ -291,6 +310,7 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { for (MultipartFile file : files) { // 上传 String fileName = FileUploadUtils.upload(filePath, file); + String name=file.getOriginalFilename(); String suffix = getFileExtension(fileName); if (StrUtil.isNotEmpty(suffix) && suffix.contains("doc")) { // 上传onlyoffice @@ -298,25 +318,24 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { if(jsonArray!=null && jsonArray.size() > 0) { for (Object obj : jsonArray) { JSONObject jsonObject = (JSONObject) obj; + String path = jsonObject.get("filePath")!=null?jsonObject.getString("filePath"):""; + // name = jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):""; + path=path.replace("/home/ruoyi/uploadPath/","/profile/"); + CaseAttach caseAttach = CaseAttach.builder() .caseAppliId(id) .annexType(annexType) - .annexName(jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):"") - + .annexName(name) + .annexPath(path) .onlyOfficeFileId(jsonObject.getString("fileId")) .build(); - if(jsonObject.get("filePath")!=null){ - String officePath = jsonObject.getString("filePath"); - String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); - caseAttach.setAnnexPath(replace); - - } caseAttachMapper.save(caseAttach); } } }else { + filePath=fileName.replace("/home/ruoyi/uploadPath/","/profile/"); CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id) - .annexName(fileName) + .annexName(name) .annexPath(filePath) .annexType(annexType) .userId(userId) @@ -334,10 +353,11 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { } // 给秘书发送短信 // 根据caseid查询该案件的法律顾问,根据案件id查申请表,查到申请机构id,然后拿申请机构id查询在哪个人下并且角色要是法律顾问 - CaseAffiliate caseAffiliate = caseAffiliateMapper.selectCaseAffiliateByIdentityType(id, 1); - if(caseAffiliate!= null && StrUtil.isNotEmpty(caseAffiliate.getApplicationOrganId())){ - List userList= sysUserMapper.selectByDeptIdAndRole(caseAffiliate.getApplicationOrganId(),"法律顾问"); - if(CollectionUtil.isNotEmpty(userList)){ +// CaseAffiliate caseAffiliate = caseAffiliateMapper.selectCaseAffiliateByIdentityType(id, 1); +// if(caseAffiliate!= null && StrUtil.isNotEmpty(caseAffiliate.getApplicationOrganId())){ +// List userList= sysUserMapper.selectByDeptIdAndRole(caseAffiliate.getApplicationOrganId(),"法律顾问"); + SysUser user= sysUserMapper.selectUserByRole("法律顾问"); + if(user!=null){ // 新增短信记录 SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); // 1992106 普通短信 修改证据资料通知 尊敬的{1}用户,您的{2}仲裁案件,有新的证据上传,请知晓,如非本人操作,请忽略本短信。 @@ -345,13 +365,13 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { CaseApplication caseApplication = new CaseApplication(); caseApplication.setId(id); caseApplication = caseApplicationMapper.selectCaseApplication(caseApplication); - for (SysUser user : userList) { + request.setPhone(user.getPhonenumber()); request.setTemplateParamSet(new String[]{user.getNickName(),caseApplication.getCaseNum()}); Boolean aBoolean = SmsUtils.sendSms(request); //保存短信发送记录 SmsSendRecord smsSendRecord = new SmsSendRecord(); - smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId()); + smsSendRecord.setCaseId(id); smsSendRecord.setCaseNum(caseApplication.getCaseNum()); smsSendRecord.setPhone(request.getPhone()); @@ -365,10 +385,10 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { smsSendRecord.setSendStatus(0); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); - } + } - } + return AjaxResult.success("上传成功"); @@ -383,17 +403,13 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { List caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication); if (CollectionUtil.isNotEmpty(caseAttachList)) { for (CaseAttach caseAttach : caseAttachList) { - String annexName = caseAttach.getAnnexName(); - String prefix = "/profile"; - int startIndex = annexName.indexOf(prefix); - startIndex += prefix.length(); - String annexPath = "/uploadPath" + annexName.substring(startIndex); - caseAttach.setAnnexPath(annexPath); - int startIndexnew = annexName.lastIndexOf("/"); - if (startIndexnew != -1) { - String annexNamenew = annexName.substring(startIndexnew + 1); - caseAttach.setAnnexName(annexNamenew); + String annexPath = caseAttach.getAnnexPath(); + if(StrUtil.isEmpty(annexPath)){ + continue; } + caseAttach.setAnnexPath(annexPath); + caseAttach.setAnnexName(caseAttach.getAnnexName()); + } return AjaxResult.success(caseAttachList); } @@ -463,9 +479,10 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { String filePath = RuoYiConfig.getUploadPath(); // 上传 String fileName = FileUploadUtils.upload(filePath, file); + fileName=fileName.replace("/home/ruoyi/uploadPath/","/profile/"); CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id) - .annexName(fileName) - .annexPath(filePath) + .annexName(file.getOriginalFilename()) + .annexPath(fileName) .annexType(annexType) .userId(userId) .userName(username) @@ -517,44 +534,44 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { return getChildList(list, t).size() > 0; } - private List getCaseEvidenceVOList(String identityNum, List caseStatusList, Integer identityType) { - List caseListByRespondent = caseEvidenceMapper.getCaseListByRespondent(identityNum, caseStatusList, identityType,null,SecurityUtils.getUsername()); - if (caseListByRespondent != null && caseListByRespondent.size() > 0) { - for (CaseEvidenceVO caseEvidenceVO : caseListByRespondent) { - //根据案件id查询姓名 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseEvidenceVO.getId()); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - for (CaseAffiliate affiliate : caseAffiliates) { - if (affiliate.getIdentityType() == 1) { //申请人 - caseEvidenceVO.setApplicantName(affiliate.getName()); - } else { - caseEvidenceVO.setRespondentName(affiliate.getName()); - } - } - } - return caseListByRespondent; - } - return null; - } - private List getCaseEvidenceVOListByPhone(String phone, List caseStatusList, Integer identityType) { - List caseListByRespondent = caseEvidenceMapper.getCaseListByRespondent(null, caseStatusList, identityType,phone,SecurityUtils.getUsername()); - if (caseListByRespondent != null && caseListByRespondent.size() > 0) { - for (CaseEvidenceVO caseEvidenceVO : caseListByRespondent) { - //根据案件id查询姓名 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseEvidenceVO.getId()); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - for (CaseAffiliate affiliate : caseAffiliates) { - if (affiliate.getIdentityType() == 1) { //申请人 - caseEvidenceVO.setApplicantName(affiliate.getName()); - } else { - caseEvidenceVO.setRespondentName(affiliate.getName()); - } - } - } - return caseListByRespondent; - } - return null; - } +// private List getCaseEvidenceVOList(String identityNum, List caseStatusList, Integer identityType) { +// List caseListByRespondent = caseEvidenceMapper.getCaseListByRespondent(identityNum, caseStatusList, identityType,null,SecurityUtils.getUsername()); +// if (caseListByRespondent != null && caseListByRespondent.size() > 0) { +// for (CaseEvidenceVO caseEvidenceVO : caseListByRespondent) { +// //根据案件id查询姓名 +// CaseAffiliate caseAffiliate = new CaseAffiliate(); +// caseAffiliate.setCaseAppliId(caseEvidenceVO.getId()); +// List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); +// for (CaseAffiliate affiliate : caseAffiliates) { +// if (affiliate.getIdentityType() == 1) { //申请人 +// caseEvidenceVO.setApplicantName(affiliate.getName()); +// } else { +// caseEvidenceVO.setRespondentName(affiliate.getName()); +// } +// } +// } +// return caseListByRespondent; +// } +// return null; +// } +// private List getCaseEvidenceVOListByPhone(String phone, List caseStatusList, Integer identityType) { +// List caseListByRespondent = caseEvidenceMapper.getCaseListByRespondent(null, caseStatusList, identityType,phone,SecurityUtils.getUsername()); +// if (caseListByRespondent != null && caseListByRespondent.size() > 0) { +// for (CaseEvidenceVO caseEvidenceVO : caseListByRespondent) { +// //根据案件id查询姓名 +// CaseAffiliate caseAffiliate = new CaseAffiliate(); +// caseAffiliate.setCaseAppliId(caseEvidenceVO.getId()); +// List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); +// for (CaseAffiliate affiliate : caseAffiliates) { +// if (affiliate.getIdentityType() == 1) { //申请人 +// caseEvidenceVO.setApplicantName(affiliate.getName()); +// } else { +// caseEvidenceVO.setRespondentName(affiliate.getName()); +// } +// } +// } +// return caseListByRespondent; +// } +// return null; +// } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java index 71764bf..2b8f7a1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java @@ -13,6 +13,7 @@ import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.wisdomarbitrate.domain.*; import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO; +import com.ruoyi.wisdomarbitrate.domain.entity.CaseAffiliateEntity; import com.ruoyi.wisdomarbitrate.domain.vo.CasePayListVO; import com.ruoyi.wisdomarbitrate.mapper.*; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; @@ -31,6 +32,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import static com.ruoyi.common.utils.SecurityUtils.getUsername; @@ -47,6 +49,7 @@ public class CasePaymentServiceImpl implements ICasePaymentService { private SmsRecordMapper smsRecordMapper; @Autowired private ArbitrateRecordMapper arbitrateRecordMapper; + private ICasePaymentService casePaymentService; @Autowired public CasePaymentServiceImpl(ElegentPay elegentPay @@ -118,8 +121,14 @@ public class CasePaymentServiceImpl implements ICasePaymentService { for (Long id : batchCaseApplication.getIds()) { CaseApplication caseApplication = new CaseApplication(); caseApplication.setId(id); + //查询案件详细信息 + CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); + if (caseApplication1 == null) { + continue; + } + // 查询当前案件节点 - Integer currentStatus= caseApplicationMapper.selectCaseApplicationCaseStatus(id); + // Integer currentStatus= caseApplicationMapper.selectCaseApplicationCaseStatus(id); if(batchCaseApplication.getAgreeOrNotCheck().equals(1)){ // 同意,更新案件状态为案件质证 caseApplication.setCaseStatus(CaseApplicationConstants.CASE_CROSSEXAMI); @@ -146,23 +155,23 @@ public class CasePaymentServiceImpl implements ICasePaymentService { caseApplicationMapper.submitCaseApplication(caseApplication); //发送短信通知 SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseApplication.getId()); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); //获取案件关联人信息 + List caseAffiliates = caseApplicationService.selectAfflicatesByCaseId(caseApplication.getId()); if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - //获取身份类型 - int identityType = affiliate.getIdentityType(); - //查询案件详细信息 - CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); - if (caseApplication1 == null) { - continue; - } + // 申请操作人 + Optional applicantAffiliateOpt = caseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst(); + // 被申请操作人 + Optional resAffiliateOpt = caseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); + if (!applicantAffiliateOpt.isPresent() || !resAffiliateOpt.isPresent()) { + throw new ServiceException("未找到案件操作人员"); + } + String caseName = "仲裁"; //这里案件名称表里未定义,暂时写死 String caseNum = caseApplication1.getCaseNum(); - if (identityType == 1) { //申请人 - String name = affiliate.getName(); - request.setPhone(affiliate.getContactTelphone()); + CaseAffiliateEntity app = applicantAffiliateOpt.get(); + CaseAffiliateEntity res = resAffiliateOpt.get(); + //申请人 + String name = app.getName(); + request.setPhone(app.getPhone()); Boolean aBoolean = SmsUtils.sendSms(request); //保存短信发送记录 SmsSendRecord smsSendRecord = new SmsSendRecord(); @@ -189,17 +198,17 @@ public class CasePaymentServiceImpl implements ICasePaymentService { smsSendRecord.setSendStatus(0); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); - } else { //被申请人 + //被申请人 if(batchCaseApplication.getAgreeOrNotCheck().equals(1)) { - request.setPhone(affiliate.getContactTelphone()); + request.setPhone(res.getPhone()); request.setTemplateId("1952840"); // 1952840 尊敬的{1}用户,您的{2}案件{3}已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信 - String name = affiliate.getName(); + name = res.getName(); request.setTemplateParamSet(new String[]{name, caseName, caseNum}); - Boolean aBoolean = SmsUtils.sendSms(request); + aBoolean = SmsUtils.sendSms(request); //保存短信发送记录 - SmsSendRecord smsSendRecord = new SmsSendRecord(); + smsSendRecord = new SmsSendRecord(); smsSendRecord.setCaseId(caseApplication.getId()); smsSendRecord.setCaseNum(caseNum); smsSendRecord.setPhone(request.getPhone()); @@ -214,8 +223,8 @@ public class CasePaymentServiceImpl implements ICasePaymentService { } smsRecordMapper.saveSmsSendRecord(smsSendRecord); } - } - } + + //更改记录表里的支付状态和支付时间 CasePaymentRecord casePaymentRecord = new CasePaymentRecord(); casePaymentRecord.setPaymentStatus(1); @@ -224,9 +233,9 @@ public class CasePaymentServiceImpl implements ICasePaymentService { casePaymentRecordMapper.update(casePaymentRecord); // 新增日志 if(batchCaseApplication.getAgreeOrNotCheck().equals(1)) { - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus, ""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_PAYMENT_CONFIRM, ""); }else { - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus, "拒绝原因:"+batchCaseApplication.getCaseCheckReject()); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_PAYMENT_CONFIRM, "拒绝原因:"+batchCaseApplication.getCaseCheckReject()); } } } @@ -271,7 +280,7 @@ public class CasePaymentServiceImpl implements ICasePaymentService { paymentRecord.setPaymentStatus(1); casePaymentRecordMapper.saveRecord(paymentRecord); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus ,""); + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_PAYMENT ,""); } } @@ -403,90 +412,10 @@ public class CasePaymentServiceImpl implements ICasePaymentService { if (caseApplications != null && caseApplications.size() > 0) { List caseIds = caseApplications.stream().map(CaseApplication::getId).collect(Collectors.toList()); - for (Long caseId : caseIds) { - Integer currentStatus = caseApplicationMapper.selectCaseApplicationCaseStatus(caseId); - CaseApplication caseApplication = new CaseApplication(); - caseApplication.setId(caseId); - caseApplication.setCaseStatus(CaseApplicationConstants.CASE_CROSSEXAMI); - caseApplicationMapper.submitCaseApplication(caseApplication); - //发送短信通知 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseApplication.getId()); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); //获取案件关联人信息 - if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - //获取身份类型 - int identityType = affiliate.getIdentityType(); - //查询案件详细信息 - CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); - if (caseApplication1 == null) { - continue; - } - String caseName = "仲裁"; //这里案件名称表里未定义,暂时写死 - String caseNum = caseApplication1.getCaseNum(); - if (identityType == 1) { //申请人 - request.setPhone(affiliate.getContactTelphone()); - request.setTemplateId("1928003"); //传入申请人模板id - // 这个值,要看你的模板中是否预留了占位符,如果没有则不需要设置 - // 模板id:1928003 普通短信 案件受理通知 - String name = affiliate.getName(); - request.setTemplateParamSet(new String[]{name, caseName, caseNum}); - Boolean aBoolean = SmsUtils.sendSms(request); - //保存短信发送记录 - SmsSendRecord smsSendRecord = new SmsSendRecord(); - smsSendRecord.setCaseId(caseApplication.getId()); - smsSendRecord.setCaseNum(caseNum); - smsSendRecord.setPhone(request.getPhone()); - smsSendRecord.setSendTime(new Date()); - String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理。"; - smsSendRecord.setSendContent(content); - smsSendRecord.setCreateBy(getUsername()); - if (aBoolean) { - smsSendRecord.setSendStatus(1); - } else { - smsSendRecord.setSendStatus(0); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - } else { //被申请人 - - request.setPhone(affiliate.getContactTelphone()); - request.setTemplateId("1952840"); - // 1952840 尊敬的{1}用户,您的{2}案件{3}已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信 - String name = affiliate.getName(); - request.setTemplateParamSet(new String[]{name, caseName, caseNum}); - Boolean aBoolean = SmsUtils.sendSms(request); - //保存短信发送记录 - SmsSendRecord smsSendRecord = new SmsSendRecord(); - smsSendRecord.setCaseId(caseApplication.getId()); - smsSendRecord.setCaseNum(caseNum); - smsSendRecord.setPhone(request.getPhone()); - smsSendRecord.setSendTime(new Date()); - String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信"; - smsSendRecord.setSendContent(content); - smsSendRecord.setCreateBy(getUsername()); - if (aBoolean) { - smsSendRecord.setSendStatus(1); - } else { - smsSendRecord.setSendStatus(0); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - } - } - //更改记录表里的支付状态和支付时间 - CasePaymentRecord casePaymentRecord = new CasePaymentRecord(); - casePaymentRecord.setPaymentStatus(1); - casePaymentRecord.setCaseId(caseId); - casePaymentRecord.setPaymentTime(new Date()); - casePaymentRecord.setUpdateTime(new Date()); - casePaymentRecordMapper.update(casePaymentRecord); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentStatus, ""); - - - } - - } + BatchCaseApplication batchCaseApplication = new BatchCaseApplication(); + batchCaseApplication.setIds(caseIds); + casePaymentService.confirmPayment(batchCaseApplication); + }else{ throw new ServiceException("这个批号没有批量缴费确认的案件"); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java index c904ec1..b8744ca 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java @@ -50,6 +50,7 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import static com.google.common.io.Files.getFileExtension; +import static com.ruoyi.common.constant.FileTransformation.getFileName; import static com.ruoyi.common.core.domain.AjaxResult.error; import static com.ruoyi.common.core.domain.AjaxResult.success; import static com.ruoyi.common.utils.SecurityUtils.getUsername; @@ -209,7 +210,7 @@ public class CaseZipImportImpl { public CaseApplication buildCaseInfo(File file, Long templateId, List fatchRuleList, Map> fatchRuleMap, Map userMap, List dictDataList, Map deptMap,LoginUser loginUser) { // fileMap> Map fatchMap = new HashMap<>(); - Integer batchNumber = caseApplicationMapper.selectBatchNumberLike(); + Integer batchNumber = caseApplicationMapper.selectMaxBatchNumber(); AtomicInteger maxBatchNumber = new AtomicInteger(); if (batchNumber == null) { maxBatchNumber.set(1); @@ -268,7 +269,7 @@ public class CaseZipImportImpl { // 需要新增的用户 List addUsers = new ArrayList<>(); - caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); + // caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); caseApplication.setCaseLogId(IdWorkerUtil.getId()); caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode()); caseApplication.setCaseAppliId(caseApplication.getId()); @@ -290,6 +291,8 @@ public class CaseZipImportImpl { if (StrUtil.isEmpty(fileUrl)) { continue; } + // 根据路径获取文件名 + String name = getFileName(fileUrl); String suffix = getFileExtension(fileUrl); if (StrUtil.isNotEmpty(suffix) && suffix.contains("doc")) { // 上传onlyoffice @@ -297,18 +300,21 @@ public class CaseZipImportImpl { if(jsonArray!=null && jsonArray.size() > 0) { for (Object obj : jsonArray) { JSONObject jsonObject = (JSONObject) obj; - CaseAttach caseAttach = CaseAttach.builder() + String path = jsonObject.get("filePath")!=null?jsonObject.getString("filePath"):""; + path=path.replace("/home/ruoyi/uploadPath/","/profile/"); + // String name = jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):""; + CaseAttach caseAttach = CaseAttach.builder() .caseAppliId(caseApplication.getId()) - .annexName(jsonObject.get("fileName")!=null?jsonObject.getString("fileName"):"") - + .annexName(name) + .annexPath(path) .onlyOfficeFileId(jsonObject.getString("fileId")) .build(); - if(jsonObject.get("filePath")!=null){ - String officePath = jsonObject.getString("filePath"); - String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); - caseAttach.setAnnexPath(replace); - - } +// if(jsonObject.get("filePath")!=null){ +// String officePath = jsonObject.getString("filePath"); +// String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); +// caseAttach.setAnnexPath(replace); +// +// } if(fileUrl.contains("申请书")){ CaseAttach applyFile = new CaseAttach(); BeanUtil.copyProperties(caseAttach, applyFile); @@ -326,11 +332,11 @@ public class CaseZipImportImpl { CaseAttach caseAttach = new CaseAttach(); caseAttach.setCaseAppliId(caseApplication.getId()); + filePath=filePath.replace("home/ruoyi/uploadPath/","profile/"); caseAttach.setAnnexPath(filePath); - if (StrUtil.isNotEmpty(fileUrl)) { - String fileName = fileUrl.replace(filePath, "/profile/upload"); - caseAttach.setAnnexName(fileName); - } + + caseAttach.setAnnexName(name); + // 申请人提供的证据材料 caseAttach.setAnnexType(2); caseAttachs.add(caseAttach); @@ -359,7 +365,7 @@ public class CaseZipImportImpl { caseApplicationMapper.insertCaseApplication(caseApplication); // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser); + // CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_INSERT, "",loginUser); caseApplicationLogMapper.insert(caseApplication); // 多线程执行 if (CollectionUtil.isNotEmpty(addUsers)) { @@ -374,12 +380,13 @@ public class CaseZipImportImpl { sysDeptMapper.batchSave(sysDepts); } - - if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) { - - caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates()); - caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates()); - } +// todo +// if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) { +// +// caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates()); +// //todo +//// caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates()); +// } if (CollectionUtil.isNotEmpty(caseAttachs)) { caseAttachMapper.batchSave(caseAttachs); caseAttachLogMapper.batchSave(caseAttachs); @@ -772,7 +779,8 @@ public class CaseZipImportImpl { if (ObjectUtil.isNotEmpty(debtorAffiliate)) { caseAffiliates.add(debtorAffiliate); } - caseApplication.setCaseAffiliates(caseAffiliates); + // todo +// caseApplication.setCaseAffiliates(caseAffiliates); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java index 8741ab4..043d0e5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java @@ -248,8 +248,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { if (downLoadFile) { CaseAttach caseAttach = new CaseAttach(); caseAttach.setAnnexType(10); //10代表印章图片 - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); + caseAttach.setAnnexPath(saveName); + caseAttach.setAnnexName(fileName); int i1 = caseAttachMapper.save(caseAttach); if (i1 > 0) { //将附件id保存到公章管理表里 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/MsSignSealServiceImpl.java index a73e243..438499c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/MsSignSealServiceImpl.java @@ -8,6 +8,7 @@ import com.google.gson.JsonObject; import com.ruoyi.common.constant.FileTransformation; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.EsignHttpResponse; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.utils.EmailOutUtil; import com.ruoyi.common.utils.SecurityUtils; @@ -48,6 +49,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { private SealManageMapper sealManageMapper; @Autowired private CaseLogRecordMapper caseLogRecordMapper; + @Autowired + private SysUserMapper sysUserMapper; /** * 签署流程回调,即签名用印回调 @@ -85,10 +88,11 @@ public class MsSignSealServiceImpl implements MsSignSealService { Long caseAppliId = sealSignRecordsel.getCaseAppliId(); CaseApplication req = new CaseApplication(); req.setId(caseAppliId); - + // 根据电话查询用户名 + SysUser sysUser = sysUserMapper.selectUserByPhone(accountMobile); if ("SIGN_MISSON_COMPLETE".equals(action) && signResult == 2) { if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(pensonAccount)) { - //申请人签名 + //调解员签名 sealSignRecordsel.setSignStatusArbitor(1); sealSignRecordMapper.updataSealSignRecord(sealSignRecordsel); CaseLogRecord operLog = new CaseLogRecord(); @@ -96,6 +100,9 @@ public class MsSignSealServiceImpl implements MsSignSealService { operLog.setCaseAppliId(caseAppliId); operLog.setCaseNode(13); operLog.setCreateTime(dateOperate); + if(sysUser!=null){ + operLog.setCreateBy(sysUser.getUserName()); + } caseLogRecordMapper.insertCaseLogRecord(operLog); CaseApplication application = new CaseApplication(); @@ -158,8 +165,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseAttach.setAnnexType(3); caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); - caseAttach.setUserName(SecurityUtils.getUsername()); - caseAttach.setUserId(SecurityUtils.getUserId()); + //caseAttach.setUserName(SecurityUtils.getUsername()); + //caseAttach.setUserId(SecurityUtils.getUserId()); // 删除已存在的 caseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, 3); caseAttachMapper.save(caseAttach); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java index 352b0a8..ed9e521 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java @@ -27,9 +27,11 @@ import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.domain.CaseAttach; import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication; +import com.ruoyi.wisdomarbitrate.domain.entity.CaseAffiliateEntity; import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO; import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO; import com.ruoyi.wisdomarbitrate.mapper.*; +import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; import com.ruoyi.wisdomarbitrate.service.VideoService; import com.ruoyi.wisdomarbitrate.service.WeChatUserService; import com.tencentcloudapi.common.Credential; @@ -96,6 +98,8 @@ public class VideoServiceImpl implements VideoService { private SysRoleMapper roleMapper; @Autowired private SysUserMapper userMapper; + @Autowired + private ICaseApplicationService caseApplicationService; /** * 功能:第三方回调sign校验 * 参数: @@ -179,17 +183,11 @@ public class VideoServiceImpl implements VideoService { return success(); } for (CaseAttach caseAttach : caseAttachList) { - String annexName = caseAttach.getAnnexName(); - String prefix = "/profile"; - int startIndex = annexName.indexOf(prefix); - startIndex += prefix.length(); - String annexPath = "/uploadPath" + annexName.substring(startIndex); - caseAttach.setAnnexPath(annexPath); - int startIndexnew = annexName.lastIndexOf("/"); - if (startIndexnew != -1) { - String annexNamenew = annexName.substring(startIndexnew + 1); - caseAttach.setAnnexName(annexNamenew); - } + + caseAttach.setAnnexPath(caseAttach.getAnnexPath()); + + caseAttach.setAnnexName(caseAttach.getAnnexName()); + } return success(caseAttachList); } @@ -374,9 +372,10 @@ public class VideoServiceImpl implements VideoService { // 绑定案件 if(convertFlag){ +// String path=fileName.replace("") CaseAttach caseAttach = CaseAttach.builder().caseAppliId(reservedConferenceVO.getCaseId()) - .annexName(fileName) - .annexPath(RuoYiConfig.getHtml2PDFPath()) + .annexName(currentFileName) + .annexPath(fileName) .annexType(7) .build(); caseAttachMapper.save(caseAttach); @@ -400,16 +399,10 @@ public class VideoServiceImpl implements VideoService { if (caseAttachList != null && caseAttachList.size() > 0) { for (CaseAttach caseAttach : caseAttachList) { String annexName = caseAttach.getAnnexName(); - String prefix = "/profile"; - int startIndex = annexName.indexOf(prefix); - startIndex += prefix.length(); - String annexPath = "/uploadPath" + annexName.substring(startIndex); - caseAttach.setAnnexPath(annexPath); - int startIndexnew = annexName.lastIndexOf("/"); - if (startIndexnew != -1) { - String annexNamenew = annexName.substring(startIndexnew + 1); - caseAttach.setAnnexName(annexNamenew); - } + + caseAttach.setAnnexPath(caseAttach.getAnnexPath()); + caseAttach.setAnnexName(annexName); + } @@ -497,8 +490,8 @@ public class VideoServiceImpl implements VideoService { String annexName = getPathFileName(RuoYiConfig.getVideoUploadPath(), fileName); // 存入数据库 CaseAttach caseAttach = CaseAttach.builder().caseAppliId(caseId) - .annexName(annexName) - .annexPath(RuoYiConfig.getVideoUploadPath()) + .annexName(fileName) + .annexPath(annexName) .annexType(9) .build(); caseAttachMapper.save(caseAttach); @@ -517,10 +510,7 @@ public class VideoServiceImpl implements VideoService { @Override public AjaxResult selectRoleMenuByCaseId(Long caseId) { AjaxResult result = success(); - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(caseId); - // 根据案件id查询相关人员 - List msCaseAffiliates = affiliateMapper.selectCaseAffiliate(caseAffiliate); + List msCaseAffiliates = caseApplicationService.selectAfflicatesByCaseId(caseId); if (CollectionUtil.isEmpty(msCaseAffiliates)) { return error("未找到案件相关人员"); } @@ -532,27 +522,16 @@ public class VideoServiceImpl implements VideoService { if (sysUser == null) { return error("未找到当前登录用户"); } - for (CaseAffiliate affiliate : msCaseAffiliates) { - if (StrUtil.isEmpty(sysUser.getPhonenumber())) { - continue; - } - // 申请人,根据电话判断用户在该案件是否为申请人 - if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent()) && sysUser.getPhonenumber().equals(affiliate.getContactTelphoneAgent())) { - if (affiliate.getIdentityType() == 1) { - result.put("appFlag", "1"); - } else if (affiliate.getIdentityType() == 2) { - // 申请人代理人 - result.put("resFlag", "1"); + for (CaseAffiliateEntity affiliate : msCaseAffiliates) { + if(affiliate.getOperatorFlag()!=null && affiliate.getOperatorFlag()==1 && affiliate.getUserId()!=null&&affiliate.getUserId().equals(userId)&&affiliate.getRoleType()!=null){ + if(affiliate.getRoleType().equals(1)||affiliate.getRoleType().equals(2)){ + // 申请人操作人 + result.put("appFlag","1"); } - } else if (StrUtil.isNotEmpty(affiliate.getContactTelphone()) && sysUser.getPhonenumber().equals(affiliate.getContactTelphone())) { - if (affiliate.getIdentityType() == 1) { - // 在该案件中为申请人或者申请代理人 - result.put("appFlag", "1"); - } else if (affiliate.getIdentityType() == 2) { - // 在该案件中为被申请人或者被申请代理人 - result.put("resFlag", "1"); + if(affiliate.getRoleType().equals(3)||affiliate.getRoleType().equals(4)){ + // 被申请人操作人 + result.put("resFlag","1"); } - } } return result; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java index 913e297..191e879 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java @@ -236,8 +236,8 @@ public class FixSelectFlowDetailUtils { if (downLoadFile) { CaseAttach caseAttach = new CaseAttach(); caseAttach.setAnnexType(10); //10代表印章图片 - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); + caseAttach.setAnnexPath(saveName); + caseAttach.setAnnexName(fileName); int i1 = caseAttachMapper.save(caseAttach); if (i1 > 0) { //将印章信息保存到公章管理表里 diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index 588b191..eed8294 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -105,6 +105,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" email, status, create_by, + code, + comp_legal_person, + home, + address, + nationality, create_time )values( #{deptId}, @@ -118,6 +123,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{email}, #{status}, #{createBy}, + #{code}, + #{compLegalPerson}, + #{home}, + #{address}, + #{nationality}, sysdate() ); @@ -168,6 +178,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" email = #{email}, status = #{status}, update_by = #{updateBy}, + code = #{code}, + comp_legal_person = #{compLegalPerson}, + home = #{home}, + address = #{address}, + nationality = #{nationality}, update_time = sysdate() where dept_id = #{deptId} @@ -196,5 +211,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update sys_dept set del_flag = '2' where dept_id = #{deptId} - + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 20cdafe..5dc6817 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -49,9 +49,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, + select u.*, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, - r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.id_card + r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status from sys_user u left join sys_dept d on u.dept_id = d.dept_id left join sys_user_role ur on u.user_id = ur.user_id @@ -217,11 +217,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into sys_user( + position, user_id, dept_id, user_name, nick_name, id_card, + id_type, + nationality, + birth, + home, + address, email, avatar, phonenumber, @@ -232,11 +238,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark, create_time )values( + #{position}, #{userId}, #{deptId}, #{userName}, #{nickName}, #{idCard}, + #{idType}, + #{nationality}, + #{birth}, + #{home}, + #{address}, #{email}, #{avatar}, #{phonenumber}, @@ -250,6 +262,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into sys_user( + position, user_id, dept_id, user_name, @@ -267,6 +280,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" )values ( + #{item.position}, #{item.userId}, #{item.deptId}, #{item.userName}, @@ -292,6 +306,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" user_name = #{userName}, nick_name = #{nickName}, id_card = #{idCard}, + position = #{position}, + id_type = #{idType}, + nationality = #{nationality}, + birth = #{birth}, + home = #{home}, + address = #{address}, email = #{email}, phonenumber = #{phonenumber}, sex = #{sex}, @@ -335,5 +355,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" INNER JOIN sys_dept d ON u.dept_id = d.dept_id WHERE ur.role_id = #{roleId} AND d.dept_id = #{deptId}; - + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml index dd72689..1dc018e 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml @@ -16,8 +16,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - + + + delete from sys_user_role where user_id in #{userId} @@ -41,4 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{userId} + + insert into sys_user_role(user_id, role_id) values(#{userId}, #{roleId}) + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitrateRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitrateRecordMapper.xml index 190abf9..2a6f912 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitrateRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitrateRecordMapper.xml @@ -102,6 +102,7 @@ AND a.case_appli_id = #{caseAppliId} + limit 1 diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateLogMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateLogMapper.xml index 6c8dab1..8405582 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateLogMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateLogMapper.xml @@ -63,22 +63,11 @@ - insert into case_affiliate_log(case_appli_log_id, identity_type,application_organ_id,application_organ_name,name,identity_num,contact_telphone, - contact_address,work_address,work_telphone ,name_agent,identity_num_agent,contact_telphone_agent, - comp_legal_person,comp_legalper_post,respon_sex ,respon_birth, - residen_affili,appli_agent_title, - contact_address_agent,email , send_email,track_num,applicant_agent_user_id,agent_email) values + + insert into case_affiliate_log(case_appli_log_id, user_id,applicant_dept_id,role_type,group_order,operator_flag,organize_flag) values - (#{item.caseAppliLogId},#{item.identityType},#{item.applicationOrganId},#{item.applicationOrganName},#{item.name},#{item.identityNum},#{item.contactTelphone}, - #{item.contactAddress},#{item.workAddress},#{item.workTelphone}, #{item.nameAgent},#{item.identityNumAgent},#{item.contactTelphoneAgent}, - #{item.compLegalPerson},#{item.compLegalperPost},#{item.responSex}, #{item.responBirth}, - #{item.residenAffili},#{item.appliAgentTitle}, - #{item.contactAddressAgent}, - #{item.email}, - #{item.sendEmail}, - #{item.trackNum}, - #{item.applicantAgentUserId}, - #{item.agentEmail} + (#{item.caseAppliLogId},#{item.userId},#{item.applicantDeptId},#{item.roleType},#{item.groupOrder},#{item.operatorFlag},#{item.organizeFlag} + ) ; diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml index 74d3df0..90d791a 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml @@ -3,188 +3,152 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + select c.id caseAppliId,a.id,a.role_type roleType,a.group_order groupOrder,a.operator_flag operatorFlag,d.code,d.comp_legal_person compLegalPerson,u.id_card idCard,u.phonenumber phone, + u.email, + (case when a.user_id is null then d.dept_name else u.nick_name end) name, + (case when a.user_id is null then d.home else u.home end) home, + (case when a.user_id is null then d.address else u.address end) address, + (case when a.user_id is null then d.nationality else u.nationality end) nationality, + u.sex,u.id_type idType,u.birth,r.role_name roleName,d.dept_name applicantOrgName,a.user_id userId,a.applicant_dept_id applicantDeptId,a.organize_flag organizeFlag + FROM + case_application c + JOIN case_affiliate a ON c.id = a.case_appli_id + LEFT JOIN sys_user u ON u.user_id = a.user_id + LEFT JOIN sys_user_role ur ON u.user_id = ur.user_id + LEFT JOIN sys_role r ON r.role_id = ur.role_id + LEFT JOIN sys_dept d ON d.dept_id = a.applicant_dept_id - - AND c.case_appli_id = #{caseAppliId} + + c.id=#{ caseAppliId} + GROUP BY a.id,r.role_id order by a.id asc - + + select c.id caseAppliId,a.id,a.role_type roleType,a.group_order groupOrder,a.operator_flag operatorFlag,d.code,d.comp_legal_person compLegalPerson,u.id_card idCard,u.phonenumber phone, + u.email, + (case when a.user_id is null then d.dept_name else u.nick_name end) name, + (case when a.user_id is null then d.home else u.home end) home, + (case when a.user_id is null then d.address else u.address end) address, + (case when a.user_id is null then d.nationality else u.nationality end) nationality, + u.sex,u.id_type idType,u.birth,r.role_name roleName,d.dept_name applicantOrgName,a.user_id userId,a.applicant_dept_id applicantDeptId,a.organize_flag organizeFlag + FROM + case_application c + JOIN case_affiliate a ON c.id = a.case_appli_id + LEFT JOIN sys_user u ON u.user_id = a.user_id + LEFT JOIN sys_user_role ur ON u.user_id = ur.user_id + LEFT JOIN sys_role r ON r.role_id = ur.role_id + LEFT JOIN sys_dept d ON d.dept_id = a.applicant_dept_id - - case_appli_id in - - #{item} + + and a.case_appli_id in + + #{caseId} - + select a.*,u.email + from case_affiliate a + left join sys_user u on u.user_id=a.user_id - - - - insert into case_affiliate(case_appli_id, identity_type,application_organ_id,application_organ_name,name,identity_num,contact_telphone, - contact_address,work_address,work_telphone ,name_agent,identity_num_agent,contact_telphone_agent, - comp_legal_person,comp_legalper_post,respon_sex ,respon_birth, - residen_affili,appli_agent_title, - contact_address_agent,email, send_email,track_num,applicant_agent_user_id,agent_email) values + insert into case_affiliate(case_appli_id, user_id,applicant_dept_id,role_type,group_order,operator_flag,organize_flag) values - (#{item.caseAppliId},#{item.identityType},#{item.applicationOrganId},#{item.applicationOrganName},#{item.name},#{item.identityNum},#{item.contactTelphone}, - #{item.contactAddress},#{item.workAddress},#{item.workTelphone}, #{item.nameAgent},#{item.identityNumAgent},#{item.contactTelphoneAgent}, - #{item.compLegalPerson},#{item.compLegalperPost},#{item.responSex}, #{item.responBirth}, - #{item.residenAffili},#{item.appliAgentTitle}, - #{item.contactAddressAgent}, - #{item.email}, - #{item.sendEmail}, - #{item.trackNum}, - #{item.applicantAgentUserId}, - #{item.agentEmail} + (#{item.caseAppliId},#{item.userId},#{item.applicantDeptId},#{item.roleType},#{item.groupOrder},#{item.operatorFlag},#{item.organizeFlag} + ) + + INSERT INTO case_affiliate + + + case_appli_id, + + + user_id, + + + applicant_dept_id, + + + role_type, + + + group_order, + + + operator_flag, + + + organize_flag + + + + + #{caseAppliId}, + + + #{userId}, + + + #{applicantDeptId}, + + + #{roleType}, + + + #{groupOrder}, + + + #{operatorFlag}, + + + #{organizeFlag} + + + - - - update case_affiliate - set - case_appli_id=#{caseAppliId}, - identity_type= #{identityType}, - application_organ_id= #{applicationOrganId}, - application_organ_name= #{applicationOrganName}, - name = #{name}, - identity_num = #{identityNum}, - contact_telphone = #{contactTelphone}, - contact_address = #{contactAddress}, - work_address = #{workAddress}, - work_telphone = #{workTelphone}, - name_agent = #{nameAgent}, - identity_num_agent = #{identityNumAgent}, - contact_telphone_agent = #{contactTelphoneAgent}, - contact_address_agent = #{contactAddressAgent}, - send_email = #{sendEmail}, - residen_affili = #{residenAffili}, - email= #{email}, - track_num = #{trackNum}, - comp_legal_person=#{compLegalPerson}, - comp_legalper_post=#{compLegalperPost}, - applicant_agent_user_id=#{applicantAgentUserId}, - respon_sex=#{responSex}, - respon_birth=#{responBirth}, - residen_affili=#{residenAffili}, - appli_agent_title=#{appliAgentTitle} - - - ,agent_email=#{agentEmail} - - where id = #{id} - - - - - - update case_affiliate - - - application_organ_id= #{item.applicationOrganId}, - application_organ_name= #{item.applicationOrganName}, - name = #{item.name}, - identity_num = #{item.identityNum}, - contact_telphone = #{item.contactTelphone}, - contact_address = #{item.contactAddress}, - work_address = #{item.workAddress}, - work_telphone = #{item.workTelphone}, - - name_agent = #{item.nameAgent}, - identity_num_agent = #{item.identityNumAgent}, - contact_telphone_agent = #{item.contactTelphoneAgent}, - contact_address_agent = #{item.contactAddressAgent}, - send_email = #{item.sendEmail}, - residen_affili = #{item.residenAffili}, - email= #{item.email}, - track_num = #{item.trackNum}, - comp_legal_person=#{item.compLegalPerson}, - comp_legalper_post=#{item.compLegalperPost}, - applicant_agent_user_id=#{item.applicantAgentUserId}, - respon_sex=#{item.responSex}, - respon_birth=#{item.responBirth}, - residen_affili=#{item.residenAffili}, - appli_agent_title=#{item.appliAgentTitle} - - - ,agent_email=#{agentEmail} - - - where case_appli_id = #{caseAppliId} and identity_type= #{item.identityType}; - - - delete from case_affiliate where case_appli_id = #{id} diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index aa3e30a..8480962 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -19,10 +19,9 @@ + - - @@ -56,509 +55,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + from case_application c + JOIN case_affiliate a ON c.id = a.case_appli_id + LEFT JOIN sys_user u ON u.user_id = a.user_id + LEFT JOIN sys_user u1 ON u1.user_id = c.arbitrator_id + LEFT JOIN sys_user u2 ON u2.user_name = c.create_by + LEFT JOIN sys_user_role ur ON u.user_id = ur.user_id OR u1.user_id = ur.user_id or u2.user_id = ur.user_id + LEFT JOIN sys_role r ON r.role_id = ur.role_id + LEFT JOIN sys_dept d ON d.dept_id = a.applicant_dept_id - - + + + AND (a.user_id=#{caseApplication.userId} ) + + + + or (c.create_by = #{caseApplication.createBy}) + - + + + id, + case_num, + case_subject_amount, + register_date, + arbitrat_method, + case_status, + hear_date, + arbitrat_claims, + loan_start_date, + loan_end_date, + claim_princi_owed, + claim_interest_owed, + claim_liquid_damag, + fee_payable, + contract_number, + create_time, + update_by, + update_time, + create_by, + arbitrator_id, + case_name, + case_result, + is_agree_pend_tral, + objection_add_eviden, + open_court_hear, + paid_expenses, + filearbitra_url, + pay_type, + request_rule, + adjudica_counter, + adjudica_counter_reason, + proper_preser, + objecti_juris, + is_absence, + respon_cross_opin, + applica_cross_opin, + respon_defen_opini, + appli_is_absen, + lock_status, + room_id, + import_flag, + version, + facts, + batch_number, + template_id, + mediation_agreement, + appli_iswrit_hear, + respon_isWrit_hear + + - - - - - - - - select c.id ,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method , + select c.id ,c.room_id,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method , CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理' - ELSE '无审理方式' + ELSE '' END arbitratMethodName, c.case_name, c.case_status , @@ -1102,21 +888,19 @@ when 31 then '待修改开庭时间' ELSE '无案件状态' END caseStatusName, - c.hear_date ,c.arbitrat_claims , + c.hear_date ,c.arbitrat_claims ,c.create_time, c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable , - c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time - ,c.request_rule,c.adjudica_counter,c.proper_preser, + c.contract_number , + c.request_rule,c.adjudica_counter,c.proper_preser, c.is_absence ,c.respon_cross_opin ,c.applica_cross_opin ,c.respon_defen_opini , - c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,ca.application_organ_id applicationOrganId - ,ca.application_organ_name as applicantName, + c.update_by ,c.update_time,c.arbitrator_id,u.nick_name arbitrator_name, c.batch_number, c.facts, c.appli_iswrit_hear,c.respon_isWrit_hear, c.mediation_agreement,c.template_id templateId,c.appli_iswrit_hear,c.respon_isWrit_hear from case_application c - LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1 - + left join sys_user u on u.user_id = c.arbitrator_id AND c.id = #{id} @@ -1128,9 +912,9 @@ order by c.create_time desc limit 1 - - + select max(batch_number) as maxBatchNumber from case_application ; - - - - - and c.case_status in - - #{caseStatus} - - - - and ca.identity_type=1 - - - - and ca.identity_type=1 - and ( ca.contact_telphone=#{caseApplication.loginUserPhone} - or ca.contact_telphone_agent=#{caseApplication.loginUserPhone} - ) - - - - and ca.identity_type=2 - and ( ca.contact_telphone=#{caseApplication.loginUserPhone} - or ca.contact_telphone_agent=#{caseApplication.loginUserPhone} - ) - - - - and c.arbitrator_id=#{caseApplication.arbitratorId} - - - and ca.identity_type=1 - - - - - select t.* from( - select c.id id,c.create_time, c.case_num,c.case_status, - CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费' - when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核' - when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理' - when 9 then '待书面审理' when 10 then '待生成裁决书' when 11 then '待核验裁决书' - when 12 then '待部门长审核裁决书' when 13 then '待裁决书签名' when 14 then '待裁决书用印' - when 15 then '待裁决书送达' when 16 then '待案件归档' when 17 then '已归档' - when 18 then '待仲裁员审核裁决书' - when 31 then '待修改开庭时间' - ELSE '' - END caseStatusName, - rc.room_id,rc.schedule_start_time - from case_application as c join case_affiliate as d on c.id = d.case_appli_id - left join reserved_conference rc on rc.case_id=c.id - where c.id = d.case_appli_id - - and d.identity_num = #{identityNum} - - - and d.identity_type = #{identityType} - - - and (d.contact_telphone = #{phone} or d.contact_telphone_agent=#{phone}) - - - and c.case_status in - - #{caseStatus} - - - union - - select c.id id, c.create_time,c.case_num,c.case_status, - CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费' - when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核' - when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理' - when 9 then '待书面审理' when 10 then '待生成裁决书' when 11 then '待核验裁决书' - when 12 then '待部门长审核裁决书' when 13 then '待裁决书签名' when 14 then '待裁决书用印' - when 15 then '待裁决书送达' when 16 then '待案件归档' when 17 then '已归档' - when 18 then '待仲裁员审核裁决书' - when 31 then '待修改开庭时间' - ELSE '' - END caseStatusName, - rc.room_id,rc.schedule_start_time - from case_log_record r - join case_application c on r.case_appli_id=c.id - JOIN case_affiliate ca ON ca.case_appli_id = c.id - left join reserved_conference rc on rc.case_id=c.id - WHERE - r.create_by=#{loginUserName} AND ca.identity_type=2 - and c.id not in( - select c.id - from case_application c - JOIN case_affiliate ca ON ca.case_appli_id = c.id - where c.id = ca.case_appli_id - - and ca.identity_num = #{identityNum} - - - and ca.identity_type = #{identityType} - - - and (ca.contact_telphone = #{phone} or ca.contact_telphone_agent=#{phone}) - - - and c.case_status in - - #{caseStatus} - - - ) - ) t order by t.create_time desc - \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml index 4fb0e78..25ebe69 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml @@ -31,26 +31,26 @@