From 45b2b7c2723d19388980082420649da7f77f8836 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Thu, 11 Jan 2024 15:30:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=88=E4=BB=B6=E5=88=97=E8=A1=A8=E8=81=94?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/common/CommonController.java | 21 +- .../mscase/MsCaseApplicationController.java | 37 ++ .../com/ruoyi/common/utils/ThreadUtil.java | 23 + .../domain/entity/mscase/MsCaseAffiliate.java | 12 +- .../entity/mscase/MsCaseApplication.java | 5 + .../domain/entity/mscase/MsCaseLogRecord.java | 10 +- .../vo/mscase/MsCaseApplicationReq.java | 4 +- .../domain/vo/mscase/MsCaseApplicationVO.java | 25 + .../mscase/MsCaseApplicationMapper.java | 29 +- .../mscase/MsCaseApplicationService.java | 35 + .../impl/MsCaseApplicationServiceImpl.java | 613 +++++++++++++++--- .../wisdomarbitrate/utils/CaseLogUtils.java | 27 +- .../resources/mapper/system/SysUserMapper.xml | 12 +- 13 files changed, 714 insertions(+), 139 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/ThreadUtil.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index 204c5ba..2a4ade1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -77,7 +77,7 @@ public class CommonController * 通用上传请求(单个) */ @PostMapping("/upload") - public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("annexType") Integer annexType, @RequestParam("id") Long id) throws Exception + public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("annexType") Integer annexType) throws Exception { try { @@ -86,8 +86,10 @@ public class CommonController // 上传并返回新文件名称 String fileName = FileUploadUtils.upload(filePath, file); String url = serverConfig.getUrl() + fileName; - saveCaseAttach(id, annexType, fileName,file.getOriginalFilename()); + Long annexId = saveCaseAttach(annexType, fileName, file.getOriginalFilename()); AjaxResult ajax = AjaxResult.success(); + ajax.put("annexId", annexId); + ajax.put("annexType", annexType); ajax.put("url", url); ajax.put("fileName", fileName); ajax.put("newFileName", FileUtils.getName(fileName)); @@ -102,13 +104,13 @@ public class CommonController /** * 保存到案件附件表 - * @param id + * @param * @param annexType * @param fileName * @param originalFilename */ - private void saveCaseAttach(Long id, Integer annexType, String fileName, String originalFilename) { - MsCaseAttach caseAttach = MsCaseAttach.builder().caseAppliId(id) + private Long saveCaseAttach(Integer annexType, String fileName, String originalFilename) { + MsCaseAttach caseAttach = MsCaseAttach.builder() .annexName(originalFilename) .annexPath(fileName) .annexType(annexType) @@ -116,6 +118,7 @@ public class CommonController .useAccount(SecurityUtils.getUsername()) .build(); msCaseAttachMapper.save(caseAttach); + return caseAttach.getAnnexId(); } /** * 根据案件id获取附件 @@ -140,7 +143,7 @@ public class CommonController * 通用上传请求(多个) */ @PostMapping("/uploads") - public AjaxResult uploadFiles(@RequestParam("files") MultipartFile[] files, @RequestParam("annexType")Integer annexType, @RequestParam("id")Long id ) throws Exception + public AjaxResult uploadFiles(@RequestParam("files") MultipartFile[] files, @RequestParam("annexType")Integer annexType ) throws Exception { try { @@ -150,6 +153,7 @@ public class CommonController List fileNames = new ArrayList(); List newFileNames = new ArrayList(); List originalFilenames = new ArrayList(); + List annexIds = new ArrayList<>(); for (MultipartFile file : files) { // 上传并返回新文件名称 @@ -159,9 +163,12 @@ public class CommonController fileNames.add(fileName); newFileNames.add(FileUtils.getName(fileName)); originalFilenames.add(file.getOriginalFilename()); - saveCaseAttach(id, annexType, fileName,file.getOriginalFilename()); + Long annexId = saveCaseAttach(annexType, fileName, file.getOriginalFilename()); + annexIds.add(annexId); } AjaxResult ajax = AjaxResult.success(); + ajax.put("annexIds", annexIds); + ajax.put("annexType", annexType); ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER)); ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER)); ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java index bcc98c4..38b031b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java @@ -7,8 +7,10 @@ import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.io.IOException; import java.util.List; /** * 案件列表控制层 @@ -42,6 +44,41 @@ public class MsCaseApplicationController extends BaseController { return success(caseApplicationService.insert(caseApplication)); } + /** + * 修改案件 + */ + @PostMapping("/update") + public AjaxResult update(@RequestBody MsCaseApplicationVO caseApplication ) + { + if(caseApplication.getId()==null){ + error("id不能为空"); + } + return caseApplicationService.update(caseApplication); + } + /** + * 根据id查询案件 + */ + @GetMapping("/selectById") + public AjaxResult selectById(@RequestParam Long id ) + { + if(id==null){ + error("id不能为空"); + } + return success(caseApplicationService.selectById(id)); + } + /** + * 案件压缩包导入 + * @param file + * @return + * @throws IOException + */ + @PostMapping("/uploadCaseZipFile") + public AjaxResult uploadCaseZipFile(@RequestParam("file") MultipartFile file, @RequestParam("templateId") Long templateId) throws IOException { + if(file.isEmpty()||templateId==null){ + return error("参数不能为空"); + } + return caseApplicationService.uploadCaseZipFile(file,templateId); + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ThreadUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ThreadUtil.java new file mode 100644 index 0000000..f26e666 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ThreadUtil.java @@ -0,0 +1,23 @@ +package com.ruoyi.common.utils; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; + +import java.util.concurrent.*; + +/** + * @Author: ymbgy + * @Date: 2022-09-23 10:06 + */ +public class ThreadUtil { + public static ExecutorService createThreadPool() { + //获取系统处理器个数,作为线程池数量 + int nThreads = Runtime.getRuntime().availableProcessors(); + ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() + .setNameFormat("demo-pool-%d").build(); + //Thread Pool + ExecutorService executor = new ThreadPoolExecutor(nThreads, 200, + 0L, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); + return executor; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java index bc40108..cbce91b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java @@ -1,11 +1,14 @@ package com.ruoyi.wisdomarbitrate.domain.entity.mscase; -import java.util.Date; -import javax.persistence.*; import lombok.Getter; import lombok.Setter; import lombok.ToString; +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; + @Getter @Setter @ToString @@ -89,6 +92,11 @@ public class MsCaseAffiliate { */ @Column(name = "respondent_identity_num") private String respondentIdentityNum; + /** + * 被申请人联系电话 + */ + @Column(name = "respondent_phone") + private String respondentPhone; /** * 被申请人性别(0=男,女=1) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java index 3bfbe8d..82dab6b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java @@ -1,5 +1,7 @@ package com.ruoyi.wisdomarbitrate.domain.entity.mscase; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -15,6 +17,7 @@ import java.util.Date; @Setter @ToString @Table(name = "ms_case_application") +@Data public class MsCaseApplication { /** * id @@ -145,6 +148,7 @@ public class MsCaseApplication { /** * 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") @Column(name = "create_time") private Date createTime; @@ -157,6 +161,7 @@ public class MsCaseApplication { /** * 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") @Column(name = "update_time") private Date updateTime; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseLogRecord.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseLogRecord.java index 155bd0d..c99f660 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseLogRecord.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseLogRecord.java @@ -1,11 +1,15 @@ package com.ruoyi.wisdomarbitrate.domain.entity.mscase; -import java.util.Date; -import javax.persistence.*; import lombok.Getter; import lombok.Setter; import lombok.ToString; +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; + @Getter @Setter @ToString @@ -67,4 +71,6 @@ public class MsCaseLogRecord { * 备注 */ private String notes; + @Column(name = "case_status_name") + private String caseStatusName; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java index 383bfcc..cdf2a6f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java @@ -22,9 +22,9 @@ public class MsCaseApplicationReq { */ private String applicationOrganId; /** - * 案件状态 + * 案件状态ID */ - private String caseStatusName; + private Long caseFlowId; /** * 开始时间 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java index ee30baf..0487f35 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java @@ -16,10 +16,27 @@ import java.util.List; @AllArgsConstructor @Data public class MsCaseApplicationVO extends MsCaseApplication { + /** + * 案件日志id + */ + private Long caseAppliLogId; + /** + * 申请机构名称 + */ + private String applicationOrganName; + /** + * 被申请人姓名 + */ + private String respondentName; + /** * 案件相关人员 */ private MsCaseAffiliate affiliate; + /** + * 是否压缩包导入,默认false + */ + private boolean importFlag=false; /** * 案件附件相关表 */ @@ -28,5 +45,13 @@ public class MsCaseApplicationVO extends MsCaseApplication { * 附件类型 */ private List annexTypeList; + /** + * 附件类型 + */ + private Integer annexType; + /** + * 自定义字段 + */ + private List columnValueList; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java index 258fa15..6b39880 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java @@ -31,21 +31,24 @@ public interface MsCaseApplicationMapper extends Mapper { /** * 案件列表查询 * @param req - * @param caseStatusName + * @param caseStatusNames * @return */ - @Select("") - List list(@Param("req")MsCaseApplicationReq req, @Param("caseStatusName") List caseStatusName); + List list(@Param("req")MsCaseApplicationReq req, @Param("caseStatusNames") List caseStatusNames); } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java index b0977d0..f281c1c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java @@ -1,7 +1,10 @@ package com.ruoyi.wisdomarbitrate.service.mscase; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; +import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -20,5 +23,37 @@ public interface MsCaseApplicationService { */ List list(MsCaseApplicationReq req); + /** + * 根据id查询案件 + * @param id + * @return + */ + MsCaseApplicationVO selectById(Long id); + + /** + * 新增案件 + * @param caseApplication + * @return + */ int insert(MsCaseApplicationVO caseApplication); + /** + * 新增申请机构代理人 + * @param affiliate + */ + void insertAgentUser(MsCaseAffiliate affiliate); + + /** + * 修改案件 + * @param caseApplication + * @return + */ + AjaxResult update(MsCaseApplicationVO caseApplication); + + /** + * 案件压缩包导入 + * @param file 附件 + * @param templateId 模板id + * @return + */ + AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index fd1c020..4bdcadb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -1,38 +1,46 @@ package com.ruoyi.wisdomarbitrate.service.mscase.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.IdWorkerUtil; -import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.*; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated; -import com.ruoyi.system.mapper.SysDeptMapper; -import com.ruoyi.system.mapper.SysRoleMapper; -import com.ruoyi.system.mapper.SysUserMapper; -import com.ruoyi.system.mapper.SysUserRoleMapper; +import com.ruoyi.system.mapper.*; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper; +import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; +import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsColumnValueVO; import com.ruoyi.wisdomarbitrate.mapper.mscase.*; +import com.ruoyi.wisdomarbitrate.mapper.template.FatchRuleMapper; import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; +import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; +import com.ruoyi.wisdomarbitrate.utils.OCRUtils; +import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils; +import org.apache.pdfbox.pdmodel.PDDocument; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; import tk.mybatis.mapper.entity.Example; +import java.io.*; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import java.math.RoundingMode; +import java.text.SimpleDateFormat; +import java.util.*; import java.util.stream.Collectors; import static com.ruoyi.common.utils.SecurityUtils.getUsername; @@ -45,7 +53,7 @@ import static com.ruoyi.common.utils.SecurityUtils.getUsername; * @Created wangqiong */ @Service -public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { +public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Autowired MsCaseApplicationMapper msCaseApplicationMapper; @Autowired @@ -59,6 +67,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Autowired MsCaseAttachLogMapper msCaseAttachLogMapper; @Autowired + MsColumnValueMapper columnValueMapper; + @Autowired + MsColumnValueLogMapper columnValueLogMapper; + @Autowired MsCaseFlowMapper caseFlowMapper; @Autowired MsCaseFlowRoleRelatedMapper caseFlowRoleRelatedMapper; @@ -70,78 +82,109 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { SysUserMapper userMapper; @Autowired SysUserRoleMapper userRoleMapper; + @Autowired + FatchRuleMapper fatchRuleMapper; + @Autowired + SysDictDataMapper dictDataMapper; + // 案件基本字段 + public static final List CASE_BASE_COLUMN = Arrays.asList("caseSubjectAmount", "arbitratClaims", "facts", "requestRule"); + public static final SimpleDateFormat yyyymmddFormat = new SimpleDateFormat("yyyy-MM-dd"); /** * 案件列表查询 + * * @param req * @return */ @Override public List list(MsCaseApplicationReq req) { + // admin查询所有案件 + if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) { + return msCaseApplicationMapper.list(req, null); + } // 根据用户查询角色 LoginUser loginUser = SecurityUtils.getLoginUser(); List roles = loginUser.getUser().getRoles(); - if(CollectionUtil.isEmpty(roles)){ + if (CollectionUtil.isEmpty(roles)) { throw new ServiceException("该用户未指定角色"); } req.setUserName(SecurityUtils.getUsername()); // 根据角色查询关联的案件状态 Example example = new Example(MsCaseFlowRoleRelated.class); - example.createCriteria().andIn("roleid",roles.stream().map(SysRole::getRoleId).collect(Collectors.toList())); - List caseFlowRoleRelatedList= caseFlowRoleRelatedMapper.selectByExample(example); - if(CollectionUtil.isEmpty(caseFlowRoleRelatedList)){ + example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList())); + List caseFlowRoleRelatedList = caseFlowRoleRelatedMapper.selectByExample(example); + if (CollectionUtil.isEmpty(caseFlowRoleRelatedList)) { throw new ServiceException("该角色为绑定案件流程"); } Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andIn("id",caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList())); + flowExample.createCriteria().andIn("id", caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList())); List caseFlows = caseFlowMapper.selectByExample(flowExample); - if(CollectionUtil.isEmpty(caseFlows)){ + if (CollectionUtil.isEmpty(caseFlows)) { throw new ServiceException("该角色为绑定案件流程"); } // 查询案件列表 - List caseApplicationList=msCaseApplicationMapper.list(req,caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList())); + List caseApplicationList = msCaseApplicationMapper.list(req, caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList())); return caseApplicationList; } + @Override + public MsCaseApplicationVO selectById(Long id) { + MsCaseApplicationVO vo = new MsCaseApplicationVO(); + MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id); + BeanUtil.copyProperties(caseApplication, vo); + // 查询案件相关人员 + MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id); + vo.setAffiliate(caseAffiliate); + // 查询附件 + List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(id); + vo.setCaseAttachList(caseAttachList); + // 自定义字段 + List columnValueVOS = columnValueMapper.listByCaseId(id); + vo.setColumnValueList(columnValueVOS); + return vo; + } + /** * 新增案件 + * * @param caseApplication * @return */ @Transactional @Override public int insert(MsCaseApplicationVO caseApplication) { - caseApplication.setId(IdWorkerUtil.getId()); + if (caseApplication.getId() == null) { + caseApplication.setId(IdWorkerUtil.getId()); + } // 根据用户查询角色 LoginUser loginUser = SecurityUtils.getLoginUser(); List roles = loginUser.getUser().getRoles(); - if(CollectionUtil.isEmpty(roles)){ + if (CollectionUtil.isEmpty(roles)) { throw new ServiceException("该用户未指定角色"); } // 根据角色查询关联的案件状态 Example example = new Example(MsCaseFlowRoleRelated.class); - example.createCriteria().andIn("roleid",roles.stream().map(SysRole::getRoleId).collect(Collectors.toList())); - List caseFlowRoleRelatedList= caseFlowRoleRelatedMapper.selectByExample(example); - if(CollectionUtil.isEmpty(caseFlowRoleRelatedList)){ + example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList())); + List caseFlowRoleRelatedList = caseFlowRoleRelatedMapper.selectByExample(example); + if (CollectionUtil.isEmpty(caseFlowRoleRelatedList)) { throw new ServiceException("该角色为绑定案件流程"); } Example flowExample = new Example(MsCaseFlow.class); flowExample.setOrderByClause("sort asc"); - flowExample.createCriteria().andIn("id",caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList())); + flowExample.createCriteria().andIn("id", caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList())); List caseFlows = caseFlowMapper.selectByExample(flowExample); - if(CollectionUtil.isNotEmpty(caseFlows)){ - caseApplication.setCaseStatusName(caseFlows.get(0).getCaseStatusName()); - caseApplication.setCaseFlowId(caseFlows.get(0).getId()); + MsCaseFlow caseFlow = caseFlows.get(0); + if (CollectionUtil.isNotEmpty(caseFlows)) { + caseApplication.setCaseStatusName(caseFlow.getCaseStatusName()); + caseApplication.setCaseFlowId(caseFlow.getId()); } - + caseApplication.setCreateTime(new Date()); // 计算仲裁费用 - if( caseApplication.getCaseSubjectAmount()!=null) { - BigDecimal feeRate = new BigDecimal("0.01"); - BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP); - caseApplication.setFeePayable(feePayable); - } + setFeePayableMethod(caseApplication); // 设置批号 - caseApplication.setBatchNumber(getBatchNumber()); + if (StrUtil.isEmpty(caseApplication.getBatchNumber())) { + caseApplication.setBatchNumber(getBatchNumber()); + } // 设置编码 caseApplication.setCaseNum(getCaseNum()); caseApplication.setCreateBy(SecurityUtils.getUsername()); @@ -149,68 +192,62 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseApplication.setVersion(1); MsCaseAffiliate affiliate = caseApplication.getAffiliate(); // 保存案件基本信息 - if(msCaseApplicationMapper.insertSelective(caseApplication)>0){ + if (msCaseApplicationMapper.insertSelective(caseApplication) > 0) { List caseAttachList = caseApplication.getCaseAttachList(); // 保存案件相关人员 - if(affiliate !=null) { + if (affiliate != null) { // 设置申请人 - if( StrUtil.isNotEmpty(affiliate.getApplicationOrganName())){ + if (StrUtil.isNotEmpty(affiliate.getApplicationOrganName())) { // 组装申请机构 insertDept(affiliate); - // 查询申请人角色id - Long roleId = roleMapper.selectRoleIdByName("申请人"); - // 根据代理人手机号去用户表查询,有修改,么有新增 - SysUser agentUser = userMapper.selectUserByPhone(affiliate.getContactTelphoneAgent()); - // 代理人为空,新增代理人 - if(agentUser==null){ - agentUser = new SysUser(); - agentUser.setUserName(affiliate.getContactTelphoneAgent()); - agentUser.setNickName(affiliate.getNameAgent()); - agentUser.setPhonenumber(affiliate.getContactTelphoneAgent()); - agentUser.setPassword(SecurityUtils.encryptPassword("abc123456")); - agentUser.setDeptId(Long.valueOf(affiliate.getApplicationOrganId())); - userMapper.insertUser(agentUser); - userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); - }else if(null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())){ - if (null != agentUser.getDept() && StrUtil.isNotEmpty(agentUser.getDept().getDeptName())) { - throw new ServiceException( "该申请代理人已在【" + agentUser.getDept().getDeptName() + "】申请机构下存在,请检查填写信息是否正确"); - } else { - throw new ServiceException("该申请代理人已存在,与申请机构不匹配,请检查填写信息是否正确"); - } - }else if (null != agentUser.getDeptId() && String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) { - // 同步用户表和案件关联人表的手机号和名称 - affiliate.setContactTelphoneAgent(StrUtil.isNotEmpty(agentUser.getPhonenumber())?agentUser.getPhonenumber():affiliate.getContactTelphoneAgent()); - affiliate.setNameAgent(agentUser.getNickName()); - affiliate.setAgentEmail(StrUtil.isNotEmpty(agentUser.getEmail())?agentUser.getEmail():affiliate.getAgentEmail()); - List longList = new ArrayList<>(); - // 新增角色为申请人 - if (CollectionUtil.isNotEmpty(agentUser.getRoles())) { - longList = agentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()); - if (!longList.contains(roleId)) { - userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); - } - } else { - userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); - } + // 新增申请机构代理人 + insertAgentUser(affiliate); + } + // 压缩包导入,则根据身份证号获取性别和出生日期 + String identityNum = affiliate.getRespondentIdentityNum(); + if (caseApplication.isImportFlag() && StrUtil.isNotEmpty(identityNum)) { + identityNum = identityNum.replace("\n", ""); + Map identityNumMap = IdCardUtils.getBirAgeSex(identityNum); + String birthday = identityNumMap.get("birthday"); + if (StrUtil.isNotEmpty(birthday)) { + Date birthdayDate = null; + try { + birthdayDate = yyyymmddFormat.parse(birthday); + } catch (Exception e) { + e.printStackTrace(); + } + affiliate.setRespondentBirth(birthdayDate); } + //从身份证抓取性别 + affiliate.setRespondentSex(identityNumMap.get("sexCode")); + } + if (StrUtil.isNotEmpty(affiliate.getAgentEmail())) { + affiliate.setAgentEmail(affiliate.getAgentEmail().replace("\n", "").replaceAll("\\s", "")); + } + if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) { + affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", "")); } affiliate.setCaseAppliId(caseApplication.getId()); msCaseAffiliateMapper.insert(affiliate); } // 保存案件附件 - if(CollectionUtil.isNotEmpty(caseAttachList)){ + + if (CollectionUtil.isNotEmpty(caseAttachList) && !caseApplication.isImportFlag()) { for (MsCaseAttach caseAttach : caseAttachList) { caseAttach.setCaseAppliId(caseApplication.getId()); // 修改案件附件 msCaseAttachMapper.updateCaseAttach(caseAttach); } -// for(MsCaseAttach caseAttach:caseAttachList){ -// caseAttach.setCaseAppliId(caseApplication.getId()); -// -// } -// msCaseAttachMapper.batchSave(caseAttachList); } + List columnValueList = caseApplication.getColumnValueList(); + if (CollectionUtil.isNotEmpty(columnValueList)) { + for (MsColumnValueVO msColumnValueVO : columnValueList) { + msColumnValueVO.setCaseId(caseApplication.getId()); + } + columnValueMapper.batchSave(columnValueList); + } + CaseLogUtils.insertCaseLog(caseApplication.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), ""); return 1; } @@ -218,11 +255,415 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } /** - * 新增部门 + * 计算仲裁费用 + * + * @param caseApplication + */ + private void setFeePayableMethod(MsCaseApplicationVO caseApplication) { + if (caseApplication.getCaseSubjectAmount() != null) { + BigDecimal feeRate = new BigDecimal("0.01"); + BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, RoundingMode.HALF_UP); + caseApplication.setFeePayable(feePayable); + } + } + + /** + * 修改案件 + * + * @param caseApplication + * @return + */ + @Transactional + @Override + public AjaxResult update(MsCaseApplicationVO caseApplication) { + // 计算仲裁费用 + setFeePayableMethod(caseApplication); + caseApplication.setUpdateBy(SecurityUtils.getUsername()); + caseApplication.setUpdateTime(new Date()); + // 为null则不更新 + msCaseApplicationMapper.updateByPrimaryKeySelective(caseApplication); + MsCaseAffiliate affiliate = caseApplication.getAffiliate(); + if (affiliate != null) { + affiliate.setCaseAppliId(caseApplication.getId()); + // 设置申请人 + if (StrUtil.isNotEmpty(affiliate.getApplicationOrganName())) { + // 组装申请机构 + insertDept(affiliate); + // 新增申请机构代理人 + insertAgentUser(affiliate); + } + msCaseAffiliateMapper.updateByPrimaryKeySelective(affiliate); + } + if (CollectionUtil.isNotEmpty(caseApplication.getCaseAttachList())) { + for (MsCaseAttach caseAttach : caseApplication.getCaseAttachList()) { + caseAttach.setCaseAppliId(caseApplication.getId()); + msCaseAttachMapper.updateCaseAttach(caseAttach); + } + } + if (CollectionUtil.isNotEmpty(caseApplication.getColumnValueList())) { + columnValueMapper.batchUpdate(caseApplication.getColumnValueList()); + } + return AjaxResult.success("修改成功"); + } + + /** + * 压缩包导入 + * + * @param file 附件 + * @param templateId 模板id + * @return + */ + @Transactional + @Override + public AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId) { + UUID uuid = UUID.randomUUID(); + // todo 压缩包解压路径 + String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + uuid + "/"; +// String targetPath = "D:/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/"; + File zipFile = null; + InputStream ins = null; + try { + ins = file.getInputStream(); + //上传的压缩包保存的路径 + // todo + String savePath = "/home/ruoyi/uploadPath/upload/zipFile/"; +// String savePath = "D:/home/ruoyi/uploadPath/upload/zipFile/"; + String saveName = uuid + "_" + file.getOriginalFilename(); + zipFile = new File(savePath + saveName); + inputChangeToFile(ins, zipFile); + } catch (IOException e) { + e.printStackTrace(); + } + if (zipFile == null) { + return AjaxResult.error("压缩包上传失败"); + } + //解压缩上传的压缩包 + boolean unzipSuccess = UnZipFileUtils.unZipFile(zipFile, targetPath); + if (!unzipSuccess) { + // 解压失败 + return AjaxResult.error("解压失败"); + } + // 查询抓取规则 + List fatchRuleList = fatchRuleMapper.listByTemplateId(templateId); + if (CollectionUtil.isEmpty(fatchRuleList)) { + return AjaxResult.error("未设置抓取规则"); + } + Map> defaultRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getIsDefault)); + + // 判断解压后的文件夹是否存在 + File directory = new File(targetPath); + if (!directory.exists()) { + return AjaxResult.error("文件不存在"); + } + if (!directory.isDirectory() || directory.listFiles() == null) { + return AjaxResult.error("未找到文件夹"); + } + File[] files = directory.listFiles(); + if (files == null) { + return AjaxResult.error("压缩包格式不正确"); + } + // 抓取规则,0-内置字段,1-自定义字段 + Map> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getFileName)); + // 在系统表中查询案件内置字段 + SysDictData sysDictData = new SysDictData(); + sysDictData.setDictType("case_built_type"); + List dictDataList = dictDataMapper.selectDictDataList(sysDictData); + if (CollectionUtil.isEmpty(dictDataList)) { + return AjaxResult.error("未找到案件内置字段"); + } + //查询批次号 + String batchNumber = getBatchNumber(); + // 抓取内容 + Map fatchMap = new HashMap<>(); + for (File outFile : files) { + if (!outFile.isDirectory() || outFile.listFiles() == null) { + continue; + } + // 一个infile对应一个案件 + for (File inFile : outFile.listFiles()) { + // 所有的文件,fileMap + Map fileMap = findFile(inFile); + if (fileMap != null && !fileMap.isEmpty()) { + // 根据抓取规则设置字段值 + for (Map.Entry> entry : fatchRuleMap.entrySet()) { + getFatchContent(fileMap, entry.getKey(), fatchMap, entry.getValue()); + } + if (fatchMap.size() > 0) { + // 组装案件信息 + MsCaseApplicationVO caseApplicationVO = new MsCaseApplicationVO(); + MsCaseApplication caseApplication = new MsCaseApplication(); + MsCaseAffiliate affiliate = new MsCaseAffiliate(); + List attachList = new ArrayList<>(); + List columnValueList = new ArrayList<>(); + caseApplication.setId(IdWorkerUtil.getId()); + caseApplication.setTemplateId(templateId); + caseApplication.setBatchNumber(batchNumber); + // 组装案件内置字段 + for (SysDictData dictData : dictDataList) { + // 主表字段 + if (CASE_BASE_COLUMN.contains(dictData.getDictValue())) { + ObjectFieldUtils.setValue(caseApplication, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel())); + } else { + // 相关人员字段 + ObjectFieldUtils.setValue(affiliate, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel())); + } + } + // 自定义字段,组装columnValue表 + if (defaultRuleMap.size() > 0 && defaultRuleMap.containsKey(1)) { + List columnRules = defaultRuleMap.get(1); + columnRules.forEach(columnRule -> { + MsColumnValueVO columnValue = new MsColumnValueVO(); + columnValue.setColumn(columnRule.getColumn()); + columnValue.setName(columnRule.getColumnName()); + columnValue.setValue(fatchMap.get(columnRule.getColumnName())); + columnValue.setIsDefault(1); + columnValue.setCaseId(caseApplication.getId()); + columnValueList.add(columnValue); + }); + } + BeanUtil.copyProperties(caseApplication, caseApplicationVO); + // 组装附件 + buildAttach(fileMap, caseApplicationVO, attachList); + caseApplicationVO.setAffiliate(affiliate); + caseApplicationVO.setCaseAttachList(attachList); + caseApplicationVO.setColumnValueList(columnValueList); + caseApplicationVO.setImportFlag(true); + insert(caseApplicationVO); + + } + } + } + + } + return AjaxResult.success(); + } + + /** + * 组装附件 + * + * @param fileMap + * @param caseApplication + * @param attachList + */ + private void buildAttach(Map fileMap, MsCaseApplicationVO caseApplication, List attachList) { + for (Map.Entry entry : fileMap.entrySet()) { + String fileUrl = entry.getValue(); + if (StrUtil.isEmpty(fileUrl)) { + continue; + } + // 上传 + // String filePath = RuoYiConfig.getUploadPath(); + MsCaseAttach caseAttach = new MsCaseAttach(); + caseAttach.setCaseAppliId(caseApplication.getId()); + caseAttach.setAnnexPath(entry.getValue()); + caseAttach.setAnnexName(entry.getKey()); + // todo +// if (StrUtil.isNotEmpty(fileUrl)) { +// String fileName = fileUrl.replace(filePath, "/profile/upload"); +// caseAttach.setAnnexName(entry.getKey()); +// } + // 申请人提供的证据材料 + caseAttach.setAnnexType(2); + attachList.add(caseAttach); + if (fileUrl.contains("仲裁申请书")) { + MsCaseAttach applyFile = new MsCaseAttach(); + BeanUtil.copyProperties(caseAttach, applyFile); + applyFile.setAnnexType(1); + attachList.add(applyFile); + } + + } + } + + /** + * 获取抓取内容 + * + * @param andConvertPDF 文件路径map + * @param mapKey 文件名 + * @param map 抓取内容map + * @param fatchRules 抓取规则 + */ + private void getFatchContent(Map andConvertPDF, String mapKey, Map map, List fatchRules) { + String fileURL = null; + for (Map.Entry entry : andConvertPDF.entrySet()) { + if (entry.getKey().contains(mapKey)) { + fileURL = entry.getValue(); + } + } + if (StrUtil.isEmpty(fileURL)) { + return; + } + if (fileURL.endsWith("txt")) { + String readerFile = ReadFileUtils.readerTxtFile(fileURL); + OCRUtils.fatchRuleGetContent(readerFile, fatchRules, map); + } else if (fileURL.endsWith("doc") || fileURL.endsWith("docx")) { + // doc,docx,text识别内容 + String readerFile = null; + try { + readerFile = ReadFileUtils.readWord(fileURL); + } catch (Exception e) { + e.printStackTrace(); + } + OCRUtils.fatchRuleGetContent(readerFile, fatchRules, map); + + } else if (fileURL.endsWith("pdf")) { + //获取文件的页数 + int fileNumPage = getFileNumPage(fileURL); + //文件转成base64 + String base64 = OCRUtils.pdfConvertBase64(fileURL); + if (base64 == null) { + throw new ServiceException("pdf转base64失败"); + // return false; + } + StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象 + for (int i = 1; i <= fileNumPage; i++) { + //对接腾讯云接口.识别里面的数据 + String text = OCRUtils.pdfIdentifyText(base64, i, fatchRules); + ocrText.append(text); // 拼接当前的字符串 + + + } + // 根据抓取规则截取内容 + OCRUtils.fatchRuleGetContent(ocrText.toString(), fatchRules, map); + } + + + } + + /** + * 获取pdf页数 + * + * @param pdfUrl + * @return + */ + private static int getFileNumPage(String pdfUrl) { + File pdfFile = new File(pdfUrl); + int pageCount = 0; + try (PDDocument document = PDDocument.load(pdfFile)) { + pageCount = document.getNumberOfPages(); + } catch (IOException e) { + e.printStackTrace(); + } + return pageCount; + } + + /** + * 查找文件 + * + * @param directory + * @param + * @return + */ + private Map findFile(File directory) { + Map filePathMap = new HashMap<>(); + if (directory.isFile()) { + String path = ""; + // 如果传入的参数是一个文件 + path = directory.getAbsolutePath(); + filePathMap.put(directory.getName(), path); + + } else if (directory.isDirectory()) { + searchFile(directory, filePathMap); + } else { + return null; + } + return filePathMap; + } + + /** + * 递归查找文件夹 + * + * @param directory + * @param filePathMap + */ + public static void searchFile(File directory, Map filePathMap) { + File[] files = directory.listFiles(); + + if (files != null) { + for (File file : files) { + if (file.getName().contains("zip") || file.getName().contains("rar")) { + continue; + } + if (file.isFile()) { + + filePathMap.put(file.getName(), file.getAbsolutePath()); + } else if (file.isDirectory()) { + // 如果是目录,递归查找 + searchFile(file, filePathMap); + } + } + } + } + + public void inputChangeToFile(InputStream instream, File file) { + try { + OutputStream outStr = new FileOutputStream(file); + int bytesRead = 0; + byte[] buffer = new byte[8192]; + while ((bytesRead = instream.read(buffer, 0, 1024)) != -1) { + outStr.write(buffer, 0, bytesRead); + } + outStr.flush(); + outStr.close(); + instream.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 新增申请机构代理人 + * * @param affiliate */ @Transactional - void insertDept(MsCaseAffiliate affiliate) { + public void insertAgentUser(MsCaseAffiliate affiliate) { + // 查询申请人角色id + Long roleId = roleMapper.selectRoleIdByName("申请人"); + // 根据代理人手机号去用户表查询,有修改,么有新增 + SysUser agentUser = userMapper.selectUserByPhone(affiliate.getContactTelphoneAgent()); + // 代理人为空,新增代理人 + if (agentUser == null) { + agentUser = new SysUser(); + agentUser.setUserName(affiliate.getContactTelphoneAgent()); + agentUser.setNickName(affiliate.getNameAgent()); + agentUser.setPhonenumber(affiliate.getContactTelphoneAgent()); + agentUser.setPassword(SecurityUtils.encryptPassword("abc123456")); + agentUser.setDeptId(Long.valueOf(affiliate.getApplicationOrganId())); + userMapper.insertUser(agentUser); + userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); + } else if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) { + if (null != agentUser.getDept() && StrUtil.isNotEmpty(agentUser.getDept().getDeptName())) { + throw new ServiceException("该申请代理人已在【" + agentUser.getDept().getDeptName() + "】申请机构下存在,请检查填写信息是否正确"); + } else { + throw new ServiceException("该申请代理人已存在,与申请机构不匹配,请检查填写信息是否正确"); + } + } else if (null != agentUser.getDeptId() && String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) { + // 同步用户表和案件关联人表的手机号和名称 + affiliate.setContactTelphoneAgent(StrUtil.isNotEmpty(agentUser.getPhonenumber()) ? agentUser.getPhonenumber() : affiliate.getContactTelphoneAgent()); + affiliate.setNameAgent(agentUser.getNickName()); + affiliate.setAgentEmail(StrUtil.isNotEmpty(agentUser.getEmail()) ? agentUser.getEmail() : affiliate.getAgentEmail()); + List longList = new ArrayList<>(); + // 新增角色为申请人 + if (CollectionUtil.isNotEmpty(agentUser.getRoles())) { + longList = agentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()); + if (!longList.contains(roleId)) { + userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); + } + } else { + userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); + } + + } + } + + /** + * 新增部门 + * + * @param affiliate + */ + @Transactional + void insertDept(MsCaseAffiliate affiliate) { // 查询所有的组织机构,组装成map List deptList = sysDeptMapper.selectDeptList(new SysDept()); if (CollectionUtil.isEmpty(deptList)) { @@ -252,6 +693,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { /** * 获取案件编码 + * * @return */ private String getCaseNum() { @@ -265,7 +707,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (null == maxCaseNum) { caseNum = caseNum + "00001"; } else { - maxCaseNum=maxCaseNum+1; + maxCaseNum = maxCaseNum + 1; caseNum = caseNum + String.format("%05d", maxCaseNum); } return caseNum; @@ -273,14 +715,15 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { /** * 获取批次号 + * * @return */ private String getBatchNumber() { Integer batchNumber = msCaseApplicationMapper.selectMaxBatchNumber(); - if(batchNumber==null){ - return "000001"; - }else { - return String.format("%06d", batchNumber+1); + if (batchNumber == null) { + return "000001"; + } else { + return String.format("%06d", batchNumber + 1); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CaseLogUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CaseLogUtils.java index be08327..3d9dd73 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CaseLogUtils.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CaseLogUtils.java @@ -27,7 +27,7 @@ public class CaseLogUtils * @param caseNode 案件节点,不能为空 * @param notes 备注 */ - public static void insertCaseLog(@NotNull Long caseAppliId, @NotEmpty Integer caseNode, String notes ){ + public static void insertCaseLog(@NotNull Long caseAppliId, @NotEmpty Integer caseNode,String caseStatusName, String notes ){ MsCaseLogRecord operLog = new MsCaseLogRecord(); // 获取当前的用户 LoginUser loginUser = SecurityUtils.getLoginUser(); @@ -41,30 +41,7 @@ public class CaseLogUtils operLog.setCreateNickName("管理员"); operLog.setUpdateBy("admin"); } - operLog.setCaseAppliId(caseAppliId); - operLog.setCaseNode(caseNode); - operLog.setNotes(notes); - caseLogRecordMapper.insert(operLog); - } - /** - * 新增案件日志 - * @param caseAppliId 案件id,不能为空 - * @param caseNode 案件节点,不能为空 - * @param notes 备注 - */ - public static void insertCaseLog(@NotNull Long caseAppliId, @NotEmpty Integer caseNode, String notes ,LoginUser loginUser ){ - MsCaseLogRecord operLog = new MsCaseLogRecord(); - // 获取当前的用户 - if(loginUser!=null) { - SysUser sysUser = userMapper.selectUserById(loginUser.getUserId()); - operLog.setCreateBy(sysUser.getUserName()); - operLog.setCreateNickName(sysUser.getNickName()); - operLog.setUpdateBy(sysUser.getUserName()); - }else { - operLog.setCreateBy("admin"); - operLog.setCreateNickName("管理员"); - operLog.setUpdateBy("admin"); - } + operLog.setCaseStatusName(caseStatusName); operLog.setCaseAppliId(caseAppliId); operLog.setCaseNode(caseNode); operLog.setNotes(notes); diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 65dea05..99c2ee4 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -274,20 +274,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update ms_sys_user - dept_id = #{deptId}, + dept_id = #{deptId}, user_name = #{userName}, nick_name = #{nickName}, - id_card = #{idCard}, - email = #{email}, - phonenumber = #{phonenumber}, - sex = #{sex}, + id_card = #{idCard}, + email = #{email}, + phonenumber = #{phonenumber}, + sex = #{sex}, avatar = #{avatar}, password = #{password}, status = #{status}, login_ip = #{loginIp}, login_date = #{loginDate}, update_by = #{updateBy}, - remark = #{remark}, + remark = #{remark}, specialty = #{specialty}, update_time = sysdate()