Merge branch 'wq1' of SH-Arbitrate/Mediation-Backend into dev

This commit was merged in pull request #13.
This commit is contained in:
2024-01-11 15:32:27 +08:00
committed by Gitea
13 changed files with 714 additions and 139 deletions
@@ -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<String> fileNames = new ArrayList<String>();
List<String> newFileNames = new ArrayList<String>();
List<String> originalFilenames = new ArrayList<String>();
List<Long> 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));
@@ -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);
}
@@ -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<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
return executor;
}
}
@@ -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)
@@ -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;
@@ -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;
}
@@ -22,9 +22,9 @@ public class MsCaseApplicationReq {
*/
private String applicationOrganId;
/**
* 案件状态
* 案件状态ID
*/
private String caseStatusName;
private Long caseFlowId;
/**
* 开始时间
*/
@@ -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<Integer> annexTypeList;
/**
* 附件类型
*/
private Integer annexType;
/**
* 自定义字段
*/
private List<MsColumnValueVO> columnValueList;
}
@@ -31,21 +31,24 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
/**
* 案件列表查询
* @param req
* @param caseStatusName
* @param caseStatusNames
* @return
*/
@Select("<script> select t.* from (select c.id,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
@Select("<script> select t.* from (select c.id,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
"a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
"c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_application c " +
"join ms_case_affiliate a on c.id=a.case_appli_id <where> " +
"<if test='caseStatusName != null and caseStatusName.size() > 0 '> and c.case_status_name in" +
"<foreach item='caseStatus' index='index' collection='caseStatusName' open='(' separator=',' close=')'>" +
"<if test='caseStatusNames != null and caseStatusNames.size() > 0 '> and c.case_status_name in" +
"<foreach item='caseStatus' index='index' collection='caseStatusNames' open='(' separator=',' close=')'>" +
"#{caseStatus}" +
"</foreach>" +
"</if> " +
"<if test=\"req.batchNumber != null and req.batchNumber != ''\">" +
" AND c.batch_number = #{req.batchNumber} " +
"</if> " +
"<if test=\"req.caseFlowId != null \">" +
" AND c.case_flow_id = #{req.caseFlowId} " +
"</if> " +
"<if test=\"req.caseNum != null and req.caseNum != ''\">" +
" AND c.case_num = #{req.caseNum} " +
"</if> " +
@@ -58,20 +61,23 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"<if test=\"req.endTime != null and req.endTime != ''\">" +
"and c.create_time &lt;= #{req.endTime}</if>" +
" </where> " +
"union select c.id id,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
"union select c.id id,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
"a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
"c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_log_record r " +
"join ms_case_application c on r.case_appli_id=c.id and r.case_status_name!=c.case_status_name " +
"join ms_case_affiliate a on c.id=a.case_appli_id <where> r.create_by=#{req.userName} and c.id not in (" +
"select c1.id from ms_case_application c1 JOIN ms_case_affiliate a1 ON a1.case_appli_id = c1.id" +
"<if test='caseStatusName != null and caseStatusName.size() > 0 '> and c.case_status_name in" +
"<foreach item='caseStatus' index='index' collection='caseStatusName' open='(' separator=',' close=')'>" +
"<if test='caseStatusNames != null and caseStatusNames.size() > 0 '> and c.case_status_name in" +
"<foreach item='caseStatus' index='index' collection='caseStatusNames' open='(' separator=',' close=')'>" +
"#{caseStatus}" +
"</foreach>" +
"</if> " +
"<if test=\"req.batchNumber != null and req.batchNumber != ''\">" +
" AND c1.batch_number = #{req.batchNumber} " +
"</if> " +
"<if test=\"req.caseFlowId != null \">" +
" AND c1.case_flow_id = #{req.caseFlowId} " +
"</if> " +
"<if test=\"req.caseNum != null and req.caseNum != ''\">" +
" AND c1.case_num = #{req.caseNum} " +
"</if> " +
@@ -84,14 +90,17 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"and c1.create_time &lt;= #{req.endTime}</if>" +
" </where> " +
" ) " +
"<if test='caseStatusName != null and caseStatusName.size() > 0 '> and c.case_status_name in" +
"<foreach item='caseStatus' index='index' collection='caseStatusName' open='(' separator=',' close=')'>" +
"<if test='caseStatusNames != null and caseStatusNames.size() > 0 '> and c.case_status_name in" +
"<foreach item='caseStatus' index='index' collection='caseStatusNames' open='(' separator=',' close=')'>" +
"#{caseStatus}" +
"</foreach>" +
"</if> " +
"<if test=\"req.batchNumber != null and req.batchNumber != ''\">" +
" AND c.batch_number = #{req.batchNumber} " +
"</if> " +
"<if test=\"req.caseFlowId != null \">" +
" AND c.case_flow_id = #{req.caseFlowId} " +
"</if> " +
"<if test=\"req.caseNum != null and req.caseNum != ''\">" +
" AND c.case_num = #{req.caseNum} " +
"</if> " +
@@ -104,5 +113,5 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"and c.create_time &lt;= #{req.endTime}</if>" +
" ) t order by t.createTime desc,t.caseNum desc" +
" </script>")
List<MsCaseApplicationVO> list(@Param("req")MsCaseApplicationReq req, @Param("caseStatusName") List<String> caseStatusName);
List<MsCaseApplicationVO> list(@Param("req")MsCaseApplicationReq req, @Param("caseStatusNames") List<String> caseStatusNames);
}
@@ -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<MsCaseApplicationVO> 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);
}
@@ -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<String> 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<MsCaseApplicationVO> list(MsCaseApplicationReq req) {
// admin查询所有案件
if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) {
return msCaseApplicationMapper.list(req, null);
}
// 根据用户查询角色
LoginUser loginUser = SecurityUtils.getLoginUser();
List<SysRole> 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<MsCaseFlowRoleRelated> caseFlowRoleRelatedList= caseFlowRoleRelatedMapper.selectByExample(example);
if(CollectionUtil.isEmpty(caseFlowRoleRelatedList)){
example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
List<MsCaseFlowRoleRelated> 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<MsCaseFlow> caseFlows = caseFlowMapper.selectByExample(flowExample);
if(CollectionUtil.isEmpty(caseFlows)){
if (CollectionUtil.isEmpty(caseFlows)) {
throw new ServiceException("该角色为绑定案件流程");
}
// 查询案件列表
List<MsCaseApplicationVO> caseApplicationList=msCaseApplicationMapper.list(req,caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList()));
List<MsCaseApplicationVO> 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<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(id);
vo.setCaseAttachList(caseAttachList);
// 自定义字段
List<MsColumnValueVO> 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<SysRole> 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<MsCaseFlowRoleRelated> caseFlowRoleRelatedList= caseFlowRoleRelatedMapper.selectByExample(example);
if(CollectionUtil.isEmpty(caseFlowRoleRelatedList)){
example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
List<MsCaseFlowRoleRelated> 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<MsCaseFlow> 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<MsCaseAttach> 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<Long> 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<String, String> 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<MsColumnValueVO> 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<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(templateId);
if (CollectionUtil.isEmpty(fatchRuleList)) {
return AjaxResult.error("未设置抓取规则");
}
Map<Integer, List<FatchRule>> 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<String, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getFileName));
// 在系统表中查询案件内置字段
SysDictData sysDictData = new SysDictData();
sysDictData.setDictType("case_built_type");
List<SysDictData> dictDataList = dictDataMapper.selectDictDataList(sysDictData);
if (CollectionUtil.isEmpty(dictDataList)) {
return AjaxResult.error("未找到案件内置字段");
}
//查询批次号
String batchNumber = getBatchNumber();
// 抓取内容
Map<String, String> fatchMap = new HashMap<>();
for (File outFile : files) {
if (!outFile.isDirectory() || outFile.listFiles() == null) {
continue;
}
// 一个infile对应一个案件
for (File inFile : outFile.listFiles()) {
// 所有的文件,fileMap<fileName,filePath>
Map<String, String> fileMap = findFile(inFile);
if (fileMap != null && !fileMap.isEmpty()) {
// 根据抓取规则设置字段值
for (Map.Entry<String, List<FatchRule>> 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<MsCaseAttach> attachList = new ArrayList<>();
List<MsColumnValueVO> 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<FatchRule> 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<String, String> fileMap, MsCaseApplicationVO caseApplication, List<MsCaseAttach> attachList) {
for (Map.Entry<String, String> 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<String, String> andConvertPDF, String mapKey, Map<String, String> map, List<FatchRule> fatchRules) {
String fileURL = null;
for (Map.Entry<String, String> 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<String, String> findFile(File directory) {
Map<String, String> 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<String, String> 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<Long> 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<SysDept> 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);
}
}
@@ -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);
@@ -274,20 +274,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateUser" parameterType="com.ruoyi.common.core.domain.entity.SysUser">
update ms_sys_user
<set>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
dept_id = #{deptId},
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="idCard != null and idCard != ''">id_card = #{idCard},</if>
<if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
id_card = #{idCard},
email = #{email},
phonenumber = #{phonenumber},
sex = #{sex},
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
remark = #{remark},
specialty = #{specialty},
update_time = sysdate()
</set>