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

This commit was merged in pull request #107.
This commit is contained in:
2024-03-06 17:06:17 +08:00
committed by Gitea
14 changed files with 867 additions and 54 deletions
@@ -48,10 +48,18 @@ public class MsCaseApplicationController extends BaseController {
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo page(MsCaseApplicationReq req) public TableDataInfo page(MsCaseApplicationReq req)
{ {
//startPage();
List<MsCaseApplicationVO> list = caseApplicationService.list(req); List<MsCaseApplicationVO> list = caseApplicationService.list(req);
return getDataTable(list); return getDataTable(list);
} }
/**
* 首页待办数量
*/
@GetMapping("/todoCount")
public AjaxResult todoCount()
{
CaseToDoCountVO vo= caseApplicationService.todoCount();
return success(vo);
}
/** /**
* 根据登录人返回用户信息 * 根据登录人返回用户信息
*/ */
@@ -79,10 +87,10 @@ public class MsCaseApplicationController extends BaseController {
* 根据身份证号获取性别和出生日期 * 根据身份证号获取性别和出生日期
*/ */
@GetMapping("/getInfoByIdCard") @GetMapping("/getInfoByIdCard")
public AjaxResult getInfoByIdCard(@RequestParam("idCard") String idCard) public AjaxResult getInfoByIdCard(@RequestParam(value = "idCard" ,required = false) String idCard)
{ {
if(StrUtil.isEmpty(idCard)){ if(StrUtil.isEmpty(idCard)){
error("参数校验失败"); error("身份证号不能为空");
} }
if(!IdcardUtil.isValidCard(idCard)){ if(!IdcardUtil.isValidCard(idCard)){
error("身份证不合法,请输入正确的身份证号"); error("身份证不合法,请输入正确的身份证号");
@@ -145,6 +153,7 @@ public class MsCaseApplicationController extends BaseController {
* @return * @return
* @throws IOException * @throws IOException
*/ */
@PostMapping("/uploadCaseZipFile") @PostMapping("/uploadCaseZipFile")
public AjaxResult uploadCaseZipFile(@RequestParam("file") MultipartFile file, @RequestParam("templateId") Long templateId) throws IOException { public AjaxResult uploadCaseZipFile(@RequestParam("file") MultipartFile file, @RequestParam("templateId") Long templateId) throws IOException {
if(file.isEmpty()||templateId==null){ if(file.isEmpty()||templateId==null){
@@ -152,6 +161,20 @@ public class MsCaseApplicationController extends BaseController {
} }
return caseApplicationService.uploadCaseZipFile(file,templateId); return caseApplicationService.uploadCaseZipFile(file,templateId);
} }
/**
* 用户信息压缩包导入
* @param file
* @return
* @throws IOException
*/
@Anonymous
@PostMapping("/userIdentify")
public AjaxResult userIdentify(@RequestParam("file") MultipartFile file) throws IOException {
if(file.isEmpty()){
return error("参数不能为空");
}
return caseApplicationService.userIdentify(file);
}
/** /**
* 生成调解申请书 * 生成调解申请书
@@ -218,8 +241,8 @@ public class MsCaseApplicationController extends BaseController {
* @return * @return
*/ */
@GetMapping("/listMediator") @GetMapping("/listMediator")
public AjaxResult listMediator( ) { public AjaxResult listMediator( @RequestParam(value = "caseAppliId",required = false) Long caseAppliId) {
return caseApplicationService.listMediator(); return caseApplicationService.listMediator(caseAppliId);
} }
/** /**
* 保存预约 * 保存预约
@@ -20,6 +20,7 @@ public enum AnnexTypeEnum implements EnumsInterface {
MEDIATION_FILES(8, "调解资料"), MEDIATION_FILES(8, "调解资料"),
RES_PAYMENT_RECEIPT(9, "被申请人缴费单"), RES_PAYMENT_RECEIPT(9, "被申请人缴费单"),
SEAL_PICTURE(10, "印章图片"), SEAL_PICTURE(10, "印章图片"),
FLOW_SVG(11, "流程节点SVG"),
; ;
@@ -16,8 +16,9 @@ public class MimeTypeUtils
public static final String IMAGE_BMP = "image/bmp"; public static final String IMAGE_BMP = "image/bmp";
public static final String IMAGE_GIF = "image/gif"; public static final String IMAGE_GIF = "image/gif";
public static final String IMAGE_SVG = "image/svg";
public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" };
public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png","svg" };
public static final String[] FLASH_EXTENSION = { "swf", "flv" }; public static final String[] FLASH_EXTENSION = { "swf", "flv" };
@@ -28,7 +29,7 @@ public class MimeTypeUtils
public static final String[] DEFAULT_ALLOWED_EXTENSION = { public static final String[] DEFAULT_ALLOWED_EXTENSION = {
// 图片 // 图片
"bmp", "gif", "jpg", "jpeg", "png", "bmp", "gif", "jpg", "jpeg", "png","svg",
// word excel powerpoint // word excel powerpoint
"doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
// 压缩文件 // 压缩文件
@@ -52,6 +53,8 @@ public class MimeTypeUtils
return "bmp"; return "bmp";
case IMAGE_GIF: case IMAGE_GIF:
return "gif"; return "gif";
case IMAGE_SVG:
return "svg";
default: default:
return ""; return "";
} }
@@ -1,10 +1,11 @@
package com.ruoyi.system.domain.entity.flow; package com.ruoyi.system.domain.entity.flow;
import javax.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import javax.persistence.*;
@Getter @Getter
@Setter @Setter
@ToString @ToString
@@ -51,4 +52,9 @@ public class MsCaseFlow {
*/ */
@Column(name = "button_auth_flag") @Column(name = "button_auth_flag")
private String buttonAuthFlag; private String buttonAuthFlag;
/**
* svg路径
*/
@Column(name = "file_name")
private String fileName;
} }
@@ -5,7 +5,6 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.persistence.Column;
import java.util.List; import java.util.List;
@@ -57,6 +56,13 @@ public class MsCaseFlowVO {
* 按钮权限标识符 * 按钮权限标识符
*/ */
private String buttonAuthFlag; private String buttonAuthFlag;
/**
* 角色名
*/
private String roleName; private String roleName;
/**
* svg图片路径
*/
private String fileName;
} }
@@ -4,7 +4,6 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated; import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated;
import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO; import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO;
@@ -14,12 +13,15 @@ import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper;
import com.ruoyi.system.util.NewStringUtil; import com.ruoyi.system.util.NewStringUtil;
import com.ruoyi.system.util.TableDataUtil; import com.ruoyi.system.util.TableDataUtil;
import org.bouncycastle.crypto.DataLengthException;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -40,15 +42,12 @@ public class CaseFlowServiceImpl implements CaseFlowService {
*/ */
@Override @Override
public Object queryCaseFlowInfo(MsCaseFlowSearchVO caseFlowSearchVO) { public Object queryCaseFlowInfo(MsCaseFlowSearchVO caseFlowSearchVO) {
//查询某个案件流程节点信息 if (caseFlowSearchVO == null || caseFlowSearchVO.getPageNum() == null || caseFlowSearchVO.getPageSize() == null) {
if (caseFlowSearchVO.getId() != null) { //查询所有案件流程节点信息
return msCaseFlowMapper.selectAll();
} else if (caseFlowSearchVO.getId() != null) {
//查询某个案件流程节点信息
return msCaseFlowMapper.selectByPrimaryKey(caseFlowSearchVO.getId()); return msCaseFlowMapper.selectByPrimaryKey(caseFlowSearchVO.getId());
} else if (caseFlowSearchVO == null) {
//查询所有案件流程节点信息
return msCaseFlowMapper.selectAll();
} else if (caseFlowSearchVO.getPageNum() == null || caseFlowSearchVO.getPageSize() == null) {
//查询所有案件流程节点信息
return msCaseFlowMapper.selectAll();
} else { } else {
//分页查询案件流程节点信息 //分页查询案件流程节点信息
Map<Integer, List<SysRole>> sysRoleMap = queryRoleByFlowId(null); Map<Integer, List<SysRole>> sysRoleMap = queryRoleByFlowId(null);
@@ -125,6 +124,27 @@ public class CaseFlowServiceImpl implements CaseFlowService {
return map; return map;
} }
/**
* 本地图片装64
* @param imgPath
* @return
* @throws Exception
*/
public static String convertToBase64( String imgPath) {
byte[] data = null;
// 读取图片字节数组
try {
imgPath=imgPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload/");
InputStream in = Files.newInputStream(Paths.get(imgPath));
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
// 返回Base64编码过的字节数组字符串
return Base64.getEncoder().encodeToString(Objects.requireNonNull(data));
}
/** /**
* 新增或编辑案件流程节点信息 * 新增或编辑案件流程节点信息
* *
@@ -133,6 +153,7 @@ public class CaseFlowServiceImpl implements CaseFlowService {
*/ */
@Override @Override
public Boolean saveCaseFlow(MsCaseFlowVO caseFlowVO) { public Boolean saveCaseFlow(MsCaseFlowVO caseFlowVO) {
if (caseFlowVO.getId() != null) { if (caseFlowVO.getId() != null) {
//更新案件流程信息 //更新案件流程信息
MsCaseFlow msCaseFlow = new MsCaseFlow(); MsCaseFlow msCaseFlow = new MsCaseFlow();
@@ -228,6 +249,8 @@ public class CaseFlowServiceImpl implements CaseFlowService {
return false; return false;
} }
/** /**
* 排序案件流程节点 * 排序案件流程节点
* *
@@ -64,5 +64,6 @@ public class MsCaseAudit {
/** /**
* 拒绝原因 * 拒绝原因
*/ */
@Column(name = "reason")
private String reason; private String reason;
} }
@@ -0,0 +1,30 @@
package com.ruoyi.wisdomarbitrate.domain.vo.mscase;
import lombok.Data;
/**
* @Classname CaseToDoCount
* @Description 代办案件数量
* @Version 1.0.0
* @Date 2024/1/15 15:48
* @Created wangqiong
*/
@Data
public class CaseToDoCount {
/**
* 流程表id
*/
private Integer caseFlowId;
/**
* 流程状态
*/
private String caseStatusName;
/**
* 数量
*/
private Long caseCount;
/**
* base64
*/
private String fileName;
}
@@ -0,0 +1,21 @@
package com.ruoyi.wisdomarbitrate.domain.vo.mscase;
import lombok.Data;
import java.util.List;
/**
* @Classname CaseToDoCountVO
* @Description 代办案件数量返回VO
* @Version 1.0.0
* @Date 2024/1/15 15:48
* @Created wangqiong
*/
@Data
public class CaseToDoCountVO {
/**
* 待办数量
*/
private List<CaseToDoCount> toDoCountList;
}
@@ -31,4 +31,8 @@ public class MediatorVO {
* 已办数量 * 已办数量
*/ */
private Long completeAmount; private Long completeAmount;
/**
* 是否回显,true为回显,false为不回显
*/
private Boolean EchoFlag=false;
} }
@@ -1,6 +1,7 @@
package com.ruoyi.wisdomarbitrate.mapper.mscase; package com.ruoyi.wisdomarbitrate.mapper.mscase;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.CaseToDoCount;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -160,4 +161,47 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
*/ */
@Select("select max(room_id) maxRoomId from ms_reserved_conference") @Select("select max(room_id) maxRoomId from ms_reserved_conference")
Long selectMaxRoomId(); Long selectMaxRoomId();
/**
* 待办数量
* @param o
* @return
*/
@Select(" <script> SELECT c.case_flow_id caseFlowId,count(c.id) caseCount " +
"FROM ms_case_application c " +
"join ms_case_affiliate a on c.id=a.case_appli_id <where> " +
"<if test=\"req.mediatorId != null \">" +
" AND c.mediator_id = #{req.mediatorId} " +
"</if> "
+
"<if test='req.applicantFlag != null and req.applicationOrganIds != null and req.applicationOrganIds.size() > 0 '> and (a.application_id in" +
"<foreach item='organId' index='index' collection='req.applicationOrganIds' open='(' separator=',' close=')'>" +
"#{organId}" +
"</foreach> or a.contact_telphone_agent=#{req.contactTelphoneAgent} )" +
"</if> "
+
"<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.mediationMethod != null \">" +
" AND c.mediation_method = #{req.mediationMethod} " +
"</if> "
+ "<if test=\"req.respondentIdentityNum != null and req.respondentIdentityNum != ''\">" +
" AND a.respondent_identity_num = #{req.respondentIdentityNum} " +
"</if> "
+
" </where> " +
"group by c.case_flow_id,c.case_status_name"+
" </script>"
)
List<CaseToDoCount> todoCount(@Param("req")MsCaseApplicationReq req, @Param("caseStatusNames") List<String> caseStatusNames);
} }
@@ -9,10 +9,7 @@ import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.BookingVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseAttachVO;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
@@ -32,6 +29,11 @@ public interface MsCaseApplicationService {
* @return * @return
*/ */
List<MsCaseApplicationVO> list(MsCaseApplicationReq req); List<MsCaseApplicationVO> list(MsCaseApplicationReq req);
/**
* 首页待办数量
* @return
*/
CaseToDoCountVO todoCount();
/** /**
* 根据id查询案件 * 根据id查询案件
@@ -74,6 +76,13 @@ public interface MsCaseApplicationService {
*/ */
AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId); AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId);
/**
* 用户信息压缩包导入
* @param file
* @return
*/
AjaxResult userIdentify(MultipartFile file);
/** /**
* 生成调解申请书 * 生成调解申请书
* @param req * @param req
@@ -138,7 +147,7 @@ public interface MsCaseApplicationService {
* 查询调解员 * 查询调解员
* @return * @return
*/ */
AjaxResult listMediator(); AjaxResult listMediator(Long caseAppliId);
/** /**
* 保存预约 * 保存预约
* @param * @param
@@ -234,5 +243,4 @@ public interface MsCaseApplicationService {
*/ */
List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord); List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord);
} }
@@ -161,7 +161,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// admin查询所有案件 // admin查询所有案件
if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) { if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) {
startPage(); startPage();
return msCaseApplicationMapper.list(req, null); List<MsCaseApplicationVO> list = msCaseApplicationMapper.list(req, null);
for (MsCaseApplicationVO vo : list) {
vo.setSignButtonFlag(0);
}
return list;
} }
// 根据用户查询角色 // 根据用户查询角色
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
@@ -244,6 +248,111 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
return list; return list;
} }
/**
* 首页代办数量
* @return
*/
@Override
public CaseToDoCountVO todoCount() {
CaseToDoCountVO vo = new CaseToDoCountVO();
List<CaseToDoCount> selectTodoList=null;
// 根据用户查询角色
LoginUser loginUser = SecurityUtils.getLoginUser();
// 根据id查询用户
SysUser sysUser = sysUserMapper.selectUserById(loginUser.getUserId());
List<SysRole> roles = loginUser.getUser().getRoles();
// 根据角色查询关联的案件状态
Example example = new Example(MsCaseFlowRoleRelated.class);
// 如果是admin,查询所有案件流程
if (CollectionUtil.isNotEmpty(roles)) {
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()));
List<MsCaseFlow> caseFlows = caseFlowMapper.selectByExample(flowExample);
if (CollectionUtil.isEmpty(caseFlows)) {
throw new ServiceException("该角色为绑定案件流程");
}
MsCaseApplicationReq req=new MsCaseApplicationReq();
if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) {
selectTodoList= msCaseApplicationMapper.todoCount( req,null);
}else {
req.setUserName(SecurityUtils.getUsername());
req.setContactTelphoneAgent(sysUser.getPhonenumber());
List<String> caseStatusNames = caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList());
// 如果是申请人,可以看见申请人为自己(即自然人)或者委托代理人为自己的案件(即机构)
for (SysRole role : roles) {
if (StrUtil.isNotEmpty(role.getRoleName())) {
if (StrUtil.equals(role.getRoleName(), "申请人")) {
List<Long> applicationOrganIds = new ArrayList<>();
applicationOrganIds.add(sysUser.getUserId());
caseStatusNames.add("待调解");
req.setApplicantFlag(1);
// 根据用户查询部门ids
List<SysDept> deptList = sysDeptMapper.selectDeptByUserId(loginUser.getUserId());
if (CollectionUtil.isNotEmpty(deptList)) {
List<Long> deptIds = deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList());
applicationOrganIds.addAll(deptIds);
}
req.setApplicationOrganIds(applicationOrganIds);
break;
}
if (StrUtil.equals(role.getRoleName(), "被申请人")) {
caseStatusNames.add("待调解");
req.setRespondentIdentityNum(sysUser.getIdCard());
break;
}
if (StrUtil.equals(role.getRoleName(), "调解员")) {
req.setMediatorId(String.valueOf(sysUser.getUserId()));
break;
}
}
}
if (req.getMediationMethod() != null) {
// 查询视频审理
req.setCaseFlowId(9);
}
// 查询案件列表
selectTodoList = msCaseApplicationMapper.todoCount(req, caseStatusNames);
}
// 设置每个案件节点的数量
List<CaseToDoCount> toDoCountList = new ArrayList<>();
Map<Integer, Long> todoMap =null;
if(CollectionUtil.isNotEmpty(selectTodoList)){
todoMap = selectTodoList.stream().collect(Collectors.toMap(CaseToDoCount::getCaseFlowId, CaseToDoCount::getCaseCount, (n1, n2) -> n2));
}
for (MsCaseFlow caseFlow : caseFlows) {
if(StrUtil.isEmpty(caseFlow.getCaseStatusName())||StrUtil.equals(caseFlow.getCaseStatusName(),"结束")){
continue;
}
CaseToDoCount caseToDoCount = new CaseToDoCount();
caseToDoCount.setCaseFlowId(caseFlow.getId());
caseToDoCount.setCaseStatusName(caseFlow.getCaseStatusName());
caseToDoCount.setFileName(caseFlow.getFileName());
if(null==todoMap){
caseToDoCount.setCaseCount(0L);
}else {
caseToDoCount.setCaseCount(todoMap.getOrDefault(caseFlow.getId(), 0L));
}
toDoCountList.add(caseToDoCount);
}
vo.setToDoCountList(toDoCountList);
return vo;
}
@Override @Override
public MsCaseApplicationVO selectById(Long id) { public MsCaseApplicationVO selectById(Long id) {
MsCaseApplicationVO vo = new MsCaseApplicationVO(); MsCaseApplicationVO vo = new MsCaseApplicationVO();
@@ -322,25 +431,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
// 压缩包导入,则根据身份证号获取性别和出生日期 // 压缩包导入,则根据身份证号获取性别和出生日期
String identityNum = affiliate.getRespondentIdentityNum(); if (caseApplication.isImportFlag() && StrUtil.isNotEmpty(affiliate.getRespondentIdentityNum())) {
if (caseApplication.isImportFlag() && StrUtil.isNotEmpty(identityNum)) { setBirthByIdentityNum(affiliate);
identityNum = identityNum.replace("\n", "");
Map<String, String> identityNumMap = IdCardUtils.getBirAgeSex(identityNum);
if (identityNumMap != null) {
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())) { if (StrUtil.isNotEmpty(affiliate.getAgentEmail())) {
affiliate.setAgentEmail(affiliate.getAgentEmail().replace("\n", "").replaceAll("\\s", "")); affiliate.setAgentEmail(affiliate.getAgentEmail().replace("\n", "").replaceAll("\\s", ""));
@@ -563,7 +655,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode()); req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode());
} }
req.setTemplateId(String.valueOf(selectByPrimaryKey.getTemplateId())); req.setTemplateId(String.valueOf(selectByPrimaryKey.getTemplateId()));
caseApplicationService.generateApplication(req); caseApplicationService.generateApplication(req);
// 新增日志 // 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), 0, "修改案件",null); CaseLogUtils.insertCaseLog(caseApplication.getId(), 0, "修改案件",null);
@@ -707,6 +798,533 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
return AjaxResult.error("请检查压缩包!"); return AjaxResult.error("请检查压缩包!");
} }
} }
/**
* 用户信息压缩包导入
* @param file
* @return
*/
@Override
public AjaxResult userIdentify(MultipartFile file) {
UUID uuid = UUID.randomUUID();
// 压缩包解压路径
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + uuid + "/";
File zipFile = null;
InputStream ins = null;
try {
ins = file.getInputStream();
//上传的压缩包保存的路径
String savePath = "/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("解压失败");
}
// 根据机构代码查询模板id
Long templateId = templateManageMapper.selectByCreditCode(creditCode);
if(templateId==null){
return AjaxResult.error("未找到模板");
}
// 查询抓取规则
List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(templateId);
if (CollectionUtil.isEmpty(fatchRuleList)) {
return AjaxResult.error("未设置抓取规则");
}
// 判断解压后的文件夹是否存在
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("未找到案件内置字段");
}
// 组装案件信息
MsCaseApplicationVO caseApplicationVO = new MsCaseApplicationVO();
for (File outFile : files) {
if (outFile==null || !outFile.isDirectory() || outFile.listFiles() == null) {
continue;
}
MsCaseApplication caseApplication=new MsCaseApplication();
// 抓取内容
Map<String, String> fatchMap = new HashMap<>();
Map<String, String> fileMap=new HashMap<>();
// 一个infile对应一个案件
for (File inFile : outFile.listFiles()) {
// 所有的文件,fileMap<fileName,filePath>
fileMap.put(inFile.getName(), inFile.getAbsolutePath());
}
if (!fileMap.isEmpty()) {
// 根据抓取规则设置字段值
for (Map.Entry<String, List<FatchRule>> entry : fatchRuleMap.entrySet()) {
getFatchContent(fileMap, entry.getKey(), fatchMap, entry.getValue());
}
if (fatchMap.size() > 0) {
MsCaseAffiliate affiliate = new MsCaseAffiliate();
// 组装案件内置字段
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()));
}
}
// 识别身份证回显性别和出生年月日
setBirthByIdentityNum(affiliate);
BeanUtil.copyProperties(caseApplication, caseApplicationVO);
caseApplicationVO.setAffiliate(affiliate);
}
}
}
return AjaxResult.success(caseApplicationVO);
}
/**
* 根据身份证设置被申性别和生日
* @param affiliate
*/
private void setBirthByIdentityNum(MsCaseAffiliate affiliate) {
String identityNum = affiliate.getRespondentIdentityNum();
if(StrUtil.isNotEmpty(identityNum)){
// 识别身份证回显性别和出生年月日
identityNum = identityNum.replace("\n", "");
Map<String, String> identityNumMap = IdCardUtils.getBirAgeSex(identityNum);
if (identityNumMap != null) {
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"));
}
}
}
/** /**
* 生成调解申请书 * 生成调解申请书
@@ -1045,13 +1663,16 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
* @return * @return
*/ */
@Override @Override
public AjaxResult listMediator() { public AjaxResult listMediator(Long caseAppliId) {
// 已选择的调解员
List<Long> selectedMediatorIds =new ArrayList<>();
List<MediatorVO> mediatorVOS = new ArrayList<MediatorVO>(); List<MediatorVO> mediatorVOS = new ArrayList<MediatorVO>();
// 查出所有调解员 // 查出所有调解员
List<SysUser> users = userMapper.selectUserByRole("调解员"); List<SysUser> users = userMapper.selectUserByRole("调解员");
if (CollectionUtil.isEmpty(users)) { if (CollectionUtil.isEmpty(users)) {
return AjaxResult.error("暂无调解员"); return AjaxResult.error("暂无调解员");
} }
// todo 根据角色查询是否已经选择了调解员进行回显
List<Long> userIds = users.stream().map(SysUser::getUserId).collect(Collectors.toList()); List<Long> userIds = users.stream().map(SysUser::getUserId).collect(Collectors.toList());
// 状态为未结束的是待办数量,结束的是已办数量 // 状态为未结束的是待办数量,结束的是已办数量
Map<Long, List<MsCaseApplication>> caseMap=null; Map<Long, List<MsCaseApplication>> caseMap=null;
@@ -1059,13 +1680,35 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(userIds); List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(userIds);
if (CollectionUtil.isNotEmpty(caseApplicationList)) { if (CollectionUtil.isNotEmpty(caseApplicationList)) {
caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList())); caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
}
if(caseAppliId!=null) {
// 根据案件id和用户id查询已选择的调解员进行回显
Example example = new Example(MsCaseMediator.class);
Example.Criteria criteria = example.createCriteria();
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUser() != null && CollectionUtil.isNotEmpty(loginUser.getUser().getRoles())) {
for (SysRole role : loginUser.getUser().getRoles()) {
if (role.getRoleName().equals("被申请人")) {
criteria.andEqualTo("type", YesOrNoEnum.YES.getCode());
} else if (role.getRoleName().equals("申请人")) {
criteria.andEqualTo("type", YesOrNoEnum.NO.getCode());
}
}
}
criteria.andEqualTo("caseAppliId", caseAppliId);
// 已选择的调解员
List<MsCaseMediator> selectedMediators = msCaseMediatorMapper.selectByExample(example);
selectedMediatorIds = selectedMediators.stream().map(MsCaseMediator::getMediatorId).collect(Collectors.toList());
} }
for (SysUser user : users) { for (SysUser user : users) {
MediatorVO mediatorVO = new MediatorVO(); MediatorVO mediatorVO = new MediatorVO();
mediatorVO.setMediatorId(user.getUserId()); mediatorVO.setMediatorId(user.getUserId());
mediatorVO.setMediatorName(user.getNickName()); mediatorVO.setMediatorName(user.getNickName());
mediatorVO.setSpecialty(user.getSpecialty()); mediatorVO.setSpecialty(user.getSpecialty());
if(selectedMediatorIds.contains(user.getUserId())){
mediatorVO.setEchoFlag(true);
}
if(caseMap==null){ if(caseMap==null){
mediatorVO.setTodoAmount(0L); mediatorVO.setTodoAmount(0L);
mediatorVO.setCompleteAmount(0L); mediatorVO.setCompleteAmount(0L);
@@ -1078,6 +1721,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
mediatorVOS.add(mediatorVO); mediatorVOS.add(mediatorVO);
} }
return AjaxResult.success(mediatorVOS); return AjaxResult.success(mediatorVOS);
} }
@@ -1362,7 +2006,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if(StrUtil.isEmpty(caseId)){ if(StrUtil.isEmpty(caseId)){
return; return;
} }
// todo
Long id = Long.valueOf(caseId); Long id = Long.valueOf(caseId);
// 根据案件id查询案件 // 根据案件id查询案件
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(id); MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(id);
@@ -696,9 +696,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
SendMailRecord sendMailRecord = new SendMailRecord(); SendMailRecord sendMailRecord = new SendMailRecord();
sendMailRecord.setCaseId(id); sendMailRecord.setCaseId(id);
sendMailRecord.setMailAddress(appEmail); sendMailRecord.setMailAddress(appEmail);
sendMailRecord.setMailContent("您好,审核后的裁决书在附件中请查阅"); sendMailRecord.setMailContent("您好,审核后的调解书在附件中请查阅");
// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅"); // sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
sendMailRecord.setMailName("签署后的裁决书"); sendMailRecord.setMailName("签署后的调解书");
sendMailRecord.setSendTime(new Date()); sendMailRecord.setSendTime(new Date());
sendMailRecord.setCreateBy(SecurityUtils.getUsername()); sendMailRecord.setCreateBy(SecurityUtils.getUsername());
if (appEmailFlag) { if (appEmailFlag) {
@@ -714,8 +714,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sendMailRecord1.setCaseId(id); sendMailRecord1.setCaseId(id);
sendMailRecord1.setMailAddress(resEmail); sendMailRecord1.setMailAddress(resEmail);
// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅"); // sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
sendMailRecord1.setMailContent("您好,审核后的裁决书在附件中请查阅"); sendMailRecord1.setMailContent("您好,审核后的调解书在附件中请查阅");
sendMailRecord1.setMailName("签署后的裁决书"); sendMailRecord1.setMailName("签署后的调解书");
sendMailRecord1.setSendTime(new Date()); sendMailRecord1.setSendTime(new Date());
sendMailRecord1.setCreateBy(SecurityUtils.getUsername()); sendMailRecord1.setCreateBy(SecurityUtils.getUsername());
if (resEmailFlag) { if (resEmailFlag) {