| | |
| | | |
| | | import cn.huge.base.common.exception.ServiceException; |
| | | import cn.huge.base.common.utils.*; |
| | | import cn.huge.module.cases.domain.bo.CaseAgentBO; |
| | | import cn.huge.module.cases.domain.bo.CasePersonBO; |
| | | import cn.huge.module.cases.domain.bo.CasePersonCountBO; |
| | | import cn.huge.module.cases.domain.dto.*; |
| | | |
| | | import cn.huge.module.cases.domain.po.CaseAgent; |
| | | import cn.huge.module.cases.domain.po.CaseInfoUnfold; |
| | | import cn.huge.module.cases.domain.po.CasePerson; |
| | | import cn.huge.module.cases.domain.dto.CaseAreaDTO; |
| | | import cn.huge.module.cases.domain.po.*; |
| | | import cn.huge.module.client.api.impl.CustClientImpl; |
| | | import cn.huge.module.client.api.impl.SysClientImpl; |
| | | import cn.huge.module.client.api.impl.UtilsClientImpl; |
| | | import cn.huge.module.cases.dao.mapper.CaseInfoMapper; |
| | | import cn.huge.module.cases.domain.po.CaseInfo; |
| | | import cn.huge.module.constant.BaseConsts; |
| | | import cn.huge.module.cust.dto.CtUnitDTO; |
| | | import cn.huge.module.cust.dto.PaUserDTO; |
| | | import cn.huge.module.mediate.constant.*; |
| | | import cn.huge.module.cust.dto.CtUserDTO; |
| | |
| | | import cn.huge.module.mediate.dto.WechatBindCaseDTO; |
| | | import cn.huge.module.sys.dto.FileIdTypeInfoBaseDTO; |
| | | import cn.huge.module.sys.dto.QueAddrBaseDTO; |
| | | import cn.huge.module.sys.dto.QueAreaDTO; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.data.domain.Page; |
| | |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.net.URL; |
| | | import java.nio.file.Files; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author wangwh |
| | | * @version 1.0.0 |
| | | * @title: 纠纷信息主表业务逻辑处理 |
| | | * @Description 纠纷信息主表业务逻辑处理 |
| | | * @company hugeinfo |
| | | * @author wangwh |
| | | * @Time 2024-08-27 10:00:57 |
| | | * @version 1.0.0 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class CaseInfoService extends ServiceImpl<CaseInfoMapper, CaseInfo>{ |
| | | public class CaseInfoService extends ServiceImpl<CaseInfoMapper, CaseInfo> { |
| | | |
| | | @Autowired |
| | | private CaseInfoMapper mapper; |
| | |
| | | |
| | | |
| | | /** |
| | | * 更新对象 |
| | | * @param entity 对象 |
| | | */ |
| | | public void updateCaseInfo(CaseInfo entity){ |
| | | try{ |
| | | * 更新对象 |
| | | * |
| | | * @param entity 对象 |
| | | */ |
| | | public void updateCaseInfo(CaseInfo entity) { |
| | | try { |
| | | mapper.updateCaseInfo(entity); |
| | | }catch (Exception e){ |
| | | log.error("[CaseInfoService.updateCaseInfo]调用失败,异常信息:"+e, e); |
| | | } catch (Exception e) { |
| | | log.error("[CaseInfoService.updateCaseInfo]调用失败,异常信息:" + e, e); |
| | | throw new ServiceException("CaseInfoService.updateCaseInfo", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 条件更新对象 |
| | | * @param entity 对象 |
| | | * @param terms 条件 |
| | | */ |
| | | public void updateCaseInfoTerms(CaseInfo entity, Map<String, Object> terms){ |
| | | try{ |
| | | * 批量更新对象 |
| | | * |
| | | * @param entity 对象 |
| | | * @param caseIdList |
| | | */ |
| | | public void updateCaseInfoList(CaseInfo entity, List<String> caseIdList) { |
| | | try { |
| | | mapper.updateCaseInfoList(entity, caseIdList); |
| | | } catch (Exception e) { |
| | | log.error("[CaseInfoService.updateCaseInfoList]调用失败,异常信息:" + e, e); |
| | | throw new ServiceException("CaseInfoService.updateCaseInfoList", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 条件更新对象 |
| | | * |
| | | * @param entity 对象 |
| | | * @param terms 条件 |
| | | */ |
| | | public void updateCaseInfoTerms(CaseInfo entity, Map<String, Object> terms) { |
| | | try { |
| | | mapper.updateCaseInfoTerms(entity, terms); |
| | | }catch (Exception e){ |
| | | log.error("[CaseInfoService.updateCaseInfoTerms]调用失败,异常信息:"+e, e); |
| | | } catch (Exception e) { |
| | | log.error("[CaseInfoService.updateCaseInfoTerms]调用失败,异常信息:" + e, e); |
| | | throw new ServiceException("CaseInfoService.updateCaseInfoTerms", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据编号物理删除 |
| | | * @param id 查询条件集合 |
| | | */ |
| | | public void deleteCaseInfo(String id){ |
| | | try{ |
| | | * 根据编号物理删除 |
| | | * |
| | | * @param id 查询条件集合 |
| | | */ |
| | | public void deleteCaseInfo(String id) { |
| | | try { |
| | | mapper.deleteCaseInfo(id); |
| | | }catch (Exception e){ |
| | | log.error("[CaseInfoService.deleteCaseInfo]调用失败,异常信息:"+e, e); |
| | | } catch (Exception e) { |
| | | log.error("[CaseInfoService.deleteCaseInfo]调用失败,异常信息:" + e, e); |
| | | throw new ServiceException("CaseInfoService.deleteCaseInfo", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 按条件查询 |
| | | * @param terms 条件 |
| | | * @return List |
| | | */ |
| | | public List<CaseInfo> listTerms(Map<String, Object> terms){ |
| | | * 按条件查询 |
| | | * |
| | | * @param terms 条件 |
| | | * @return List |
| | | */ |
| | | public List<CaseInfo> listTerms(Map<String, Object> terms) { |
| | | return mapper.listTerms(terms); |
| | | } |
| | | |
| | | /** |
| | | * 按条件统计 |
| | | * @param terms 条件 |
| | | * @return long |
| | | */ |
| | | public long countTerms(Map<String, Object> terms){ |
| | | * 按条件统计 |
| | | * |
| | | * @param terms 条件 |
| | | * @return long |
| | | */ |
| | | public long countTerms(Map<String, Object> terms) { |
| | | return mapper.countTerms(terms); |
| | | } |
| | | |
| | | /** |
| | | * 按条件分页查询 |
| | | * @param page 分页对象 |
| | | * @param terms 条件 |
| | | * @return Page |
| | | */ |
| | | public Page<CaseInfo> pageQuery(PageRequest page, Map<String, Object> terms){ |
| | | * 按条件分页查询 |
| | | * |
| | | * @param page 分页对象 |
| | | * @param terms 条件 |
| | | * @return Page |
| | | */ |
| | | public Page<CaseInfo> pageQuery(PageRequest page, Map<String, Object> terms) { |
| | | long total = mapper.countTerms(terms); |
| | | List<CaseInfo> content = mapper.pageTerms(page, terms); |
| | | return new PageImpl<CaseInfo>(content, page, total); |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @param caseInfo 实体对象 |
| | | */ |
| | | public void saveCaseInfo(CaseInfo caseInfo){ |
| | | try{ |
| | | * 按条件分页查询 |
| | | * |
| | | * @param page 分页对象 |
| | | * @param terms 条件 |
| | | * @return Page |
| | | */ |
| | | public Page<CaseRegisterDTO> pageQueryRegister(PageRequest page, Map<String, Object> terms) { |
| | | long total = mapper.countTermsCaseRegister(terms); |
| | | List<CaseRegisterDTO> content = mapper.pageTermsCaseRegister(page, terms); |
| | | return new PageImpl<CaseRegisterDTO>(content, page, total); |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * |
| | | * @param caseInfo 实体对象 |
| | | */ |
| | | public void saveCaseInfo(CaseInfo caseInfo) { |
| | | try { |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | // 判断是否新增 |
| | | if (IdUtils.checkNewId(caseInfo.getId())){ |
| | | if (IdUtils.checkNewId(caseInfo.getId())) { |
| | | caseInfo.setId(utilsClient.getNewTimeId()); |
| | | caseInfo.setCreateTime(nowDate); |
| | | } |
| | | caseInfo.setUpdateTime(nowDate); |
| | | this.saveOrUpdate(caseInfo); |
| | | }catch (Exception e){ |
| | | log.error("[CaseInfoService.saveCaseInfo]调用失败,异常信息:"+e, e); |
| | | } catch (Exception e) { |
| | | log.error("[CaseInfoService.saveCaseInfo]调用失败,异常信息:" + e, e); |
| | | throw new ServiceException("CaseInfoService.saveCaseInfo", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * PC端-纠纷登记-保存纠纷信息-正常案件 |
| | | * |
| | | * @param registerSaveDTO 纠纷信息 |
| | | * @param userId 用户编号 |
| | | * @param userId 用户编号 |
| | | * @return String 纠纷编号 |
| | | */ |
| | | public String caseRegister(RegisterSaveDTO registerSaveDTO, String userId){ |
| | | public String caseRegister(RegisterSaveDTO registerSaveDTO, String userId) { |
| | | try { |
| | | // 获取当前登录用户 |
| | | CtUserDTO loginUser = custClient.clientGetUserAll(userId); |
| | |
| | | //复制填装案件表 |
| | | CaseInfo caseInfo = new CaseInfo(); |
| | | BeanUtils.copyProperties(registerSaveDTO, caseInfo); |
| | | // 是否自行受理 |
| | | if (1 == registerSaveDTO.getIsSelfAccept()) { |
| | | // 是 |
| | | caseInfo.setZxslStatus(CaseBaseConsts.ZXSL_STATUS_1); |
| | | }else { |
| | | // 否 |
| | | caseInfo.setZxslStatus(CaseBaseConsts.ZXSL_STATUS_0); |
| | | } |
| | | caseInfo.setUpdateTime(nowDate); |
| | | |
| | | // 常规登记-保存当事人 |
| | |
| | | caseInfo.setDefendants(defendants.toString()); |
| | | caseInfo.setDagents(dagents.toString()); |
| | | caseInfo.setCaseRef(utilsClient.createCaseRef()); |
| | | caseInfo.setCanal(CaseBaseConstsEnum.CASE_CANAL_1.getIndex()); |
| | | caseInfo.setCanalName(CaseBaseConstsEnum.CASE_CANAL_1.getDes()); |
| | | caseInfo.setVisitWay(CaseBaseConstsEnum.VISIT_WAY_1.getIndex()); |
| | | caseInfo.setVisitWayName(CaseBaseConstsEnum.VISIT_WAY_1.getDes()); |
| | | caseInfo.setVisitWay(CaseBaseConstsEnum.getVisitWayByCanal(caseInfo.getCanal()).getIndex()); |
| | | caseInfo.setVisitWayName(CaseBaseConstsEnum.getVisitWayByCanal(caseInfo.getCanal()).getDes()); |
| | | //默认小程序可见 |
| | | if(ObjectUtils.isNotEmpty(caseInfo.getCanal())){ |
| | | if(CaseBaseConstsEnum.CASE_CANAL_1.getIndex().equals(caseInfo.getCanal())){ |
| | | caseInfo.setPartyShow(1); |
| | | } |
| | | } |
| | | |
| | | //todo case_title生成、经纬度转换 |
| | | if(0 == registerSaveDTO.getOperateType()){ |
| | | if (0 == registerSaveDTO.getOperateType()) { |
| | | caseInfo.setInputUnitId(loginUser.getUnitId()); |
| | | caseInfo.setInputUnitName(loginUser.getUnitName()); |
| | | caseInfo.setInputUserId(loginUser.getId()); |
| | |
| | | caseInfo.setInputWay(CaseBaseConsts.INPUT_WAY_1); |
| | | caseInfo.setCreateTime(nowDate); |
| | | caseInfo.setDeleteStatus(BaseConsts.DELETE_STATUS_0); |
| | | //默认添加省市 |
| | | caseInfo.setQueProv("19"); |
| | | caseInfo.setQueProvName("广东省"); |
| | | caseInfo.setQueCity("440100"); |
| | | caseInfo.setQueCityName("广州市"); |
| | | // 删除草稿案件 |
| | | if(1 == registerSaveDTO.getIsDraft() ){ |
| | | if (1 == registerSaveDTO.getIsDraft()) { |
| | | draftInfoService.removeDraftInfo(registerSaveDTO.getId()); |
| | | } |
| | | // 新增纠纷信息 |
| | |
| | | caseInfoUnfoldService.save(caseInfoUnfold); |
| | | // 启动工作流 |
| | | // 判断是否自行受理 |
| | | if(1 == registerSaveDTO.getIsSelfAccept()){ |
| | | if (1 == registerSaveDTO.getIsSelfAccept()) { |
| | | // 自行受理流程 |
| | | caseTaskService.webStartFlowZXSL(caseInfo, loginUser); |
| | | }else { |
| | | return caseTaskService.webStartFlowZXSL(caseInfo, loginUser); |
| | | } else { |
| | | // 自动调度流程 |
| | | caseTaskService.webStartFlowLFDJ(caseInfo); |
| | | } |
| | | }else if(1 == registerSaveDTO.getOperateType()){ |
| | | } else if (1 == registerSaveDTO.getOperateType()) { |
| | | this.updateById(caseInfo); |
| | | } |
| | | return registerSaveDTO.getId(); |
| | | }catch (Exception e){ |
| | | log.error("service方法[CaseInfoService.caseRegister]调用异常:"+e, e); |
| | | } catch (Exception e) { |
| | | log.error("service方法[CaseInfoService.caseRegister]调用异常:" + e, e); |
| | | throw new ServiceException("CaseInfoService.caseRegister", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * pc端-常规登记-保存正式案件-保存人员信息 |
| | | * |
| | | * @param registerSaveDTO 纠纷信息 |
| | | * @param plaintiffs 申请人 |
| | | * @param pagents 申请人代理人 |
| | | * @param defendants 被申请人 |
| | | * @param dagents 被申请人代理人 |
| | | * @param plaintiffs 申请人 |
| | | * @param pagents 申请人代理人 |
| | | * @param defendants 被申请人 |
| | | * @param dagents 被申请人代理人 |
| | | * @return int |
| | | */ |
| | | private void saveCasePerson(RegisterSaveDTO registerSaveDTO, StringBuffer plaintiffs, StringBuffer pagents, |
| | | StringBuffer defendants, StringBuffer dagents){ |
| | | StringBuffer defendants, StringBuffer dagents) { |
| | | |
| | | Date now = DateUtils.getNowDate(); |
| | | |
| | |
| | | List<String> newPersonIdList = new ArrayList<>(); |
| | | List<String> newAgentIdList = new ArrayList<>(); |
| | | |
| | | if(CollectionUtils.isNotEmpty(personList)){ |
| | | for(CasePerson casePerson: personList){ |
| | | if (CollectionUtils.isNotEmpty(personList)) { |
| | | for (CasePerson casePerson : personList) { |
| | | newPersonIdList.add(casePerson.getId()); |
| | | casePerson.setCaseId(registerSaveDTO.getId()); |
| | | casePerson.setCustId(registerSaveDTO.getCustId()); |
| | |
| | | //绑定当事人小程序 |
| | | this.setPartyUserId(casePerson); |
| | | //添加申请方和被申请方人名组合 |
| | | if(CaseBaseConstsEnum.PERSON_TYPE_1.getIndex().equals(casePerson.getPerType())){ |
| | | if (CaseBaseConstsEnum.PERSON_TYPE_1.getIndex().equals(casePerson.getPerType())) { |
| | | //申请方 |
| | | if (StringUtils.isNotEmpty(plaintiffs.toString())) { |
| | | plaintiffs.append(BaseConsts.COMMA); |
| | | } |
| | | plaintiffs.append(casePerson.getTrueName()); |
| | | }else if(CaseBaseConstsEnum.PERSON_TYPE_2.getIndex().equals(casePerson.getPerType())){ |
| | | } else if (CaseBaseConstsEnum.PERSON_TYPE_2.getIndex().equals(casePerson.getPerType())) { |
| | | //被申请方 |
| | | if (StringUtils.isNotEmpty(defendants.toString())) { |
| | | defendants.append(BaseConsts.COMMA); |
| | |
| | | } |
| | | |
| | | //判断是否为更新(用原有的Id对比性的Id) |
| | | if(oldPersonIds.contains(casePerson.getId())){ |
| | | if (oldPersonIds.contains(casePerson.getId())) { |
| | | personService.updateById(casePerson); |
| | | }else{ |
| | | } else { |
| | | casePerson.setCreateTime(now); |
| | | personService.save(casePerson); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | if(CollectionUtils.isNotEmpty(agentList)) { |
| | | if (CollectionUtils.isNotEmpty(agentList)) { |
| | | for (CaseAgent caseAgent : agentList) { |
| | | newAgentIdList.add(caseAgent.getId()); |
| | | caseAgent.setCaseId(registerSaveDTO.getId()); |
| | |
| | | caseAgent.setUpdateTime(now); |
| | | //绑定当事人小程序 |
| | | this.setPartyUserId(caseAgent); |
| | | if(CaseBaseConstsEnum.PERSON_TYPE_3.getIndex().equals(caseAgent.getPerType())) { |
| | | if (CaseBaseConstsEnum.PERSON_TYPE_3.getIndex().equals(caseAgent.getPerType())) { |
| | | if (StringUtils.isNotEmpty(pagents.toString())) { |
| | | pagents.append(BaseConsts.COMMA); |
| | | } |
| | | pagents.append(caseAgent.getTrueName()); |
| | | }else if(CaseBaseConstsEnum.PERSON_TYPE_4.getIndex().equals(caseAgent.getPerType())) { |
| | | } else if (CaseBaseConstsEnum.PERSON_TYPE_4.getIndex().equals(caseAgent.getPerType())) { |
| | | if (StringUtils.isNotEmpty(dagents.toString())) { |
| | | dagents.append(BaseConsts.COMMA); |
| | | } |
| | |
| | | } |
| | | |
| | | //判断是否为更新(用原有的Id对比性的Id) |
| | | if(oldAgentIds.contains(caseAgent.getId())){ |
| | | if (oldAgentIds.contains(caseAgent.getId())) { |
| | | agentService.updateById(caseAgent); |
| | | }else{ |
| | | } else { |
| | | caseAgent.setCreateTime(now); |
| | | agentService.save(caseAgent); |
| | | } |
| | |
| | | for (String oldPersonId : oldPersonIdList) { |
| | | if (!newPersonIdList.contains(oldPersonId)) { |
| | | personService.removeById(oldPersonId); |
| | | }else{ |
| | | } else { |
| | | |
| | | } |
| | | } |
| | | }else{ |
| | | } else { |
| | | QueryWrapper<CasePerson> casePersonQueryWrapper = new QueryWrapper<>(); |
| | | casePersonQueryWrapper.eq("case_id", registerSaveDTO.getId()); |
| | | personService.remove(casePersonQueryWrapper); |
| | | } |
| | | //删除冗余的代理人 |
| | | if(CollectionUtils.isNotEmpty(newAgentIdList)){ |
| | | for(String oldAgentId: oldAgentIdList){ |
| | | if(!newAgentIdList.contains(oldAgentId)){ |
| | | if (CollectionUtils.isNotEmpty(newAgentIdList)) { |
| | | for (String oldAgentId : oldAgentIdList) { |
| | | if (!newAgentIdList.contains(oldAgentId)) { |
| | | agentService.removeById(oldAgentId); |
| | | } |
| | | } |
| | | }else{ |
| | | } else { |
| | | QueryWrapper<CaseAgent> caseAgentQueryWrapper = new QueryWrapper<>(); |
| | | caseAgentQueryWrapper.eq("case_id", registerSaveDTO.getId()); |
| | | agentService.remove(caseAgentQueryWrapper); |
| | |
| | | |
| | | /** |
| | | * PC端-查询纠纷信息 |
| | | * |
| | | * @param caseId 纠纷编号 |
| | | * @return CaseInfo 纠纷信息 |
| | | */ |
| | | public CaseInfoDTO getCaseInfo(String caseId){ |
| | | public CaseInfoDTO getCaseInfo(String caseId) { |
| | | CaseInfo caseInfo = mapper.selectById(caseId); |
| | | CaseInfoDTO caseInfoDTO = new CaseInfoDTO(); |
| | | if (ObjectUtils.isNotEmpty(caseInfo)) { |
| | |
| | | idList.addAll(casePersonList.stream().map(CasePerson::getId).collect(Collectors.toList())); |
| | | idList.addAll(caseAgentList.stream().map(CaseAgent::getId).collect(Collectors.toList())); |
| | | String ids = idList.stream().map(String::valueOf).collect(Collectors.joining("','")); |
| | | ids = "'"+ ids + "'"; |
| | | ids = "'" + ids + "'"; |
| | | Map<String, Object> term = new HashMap<>(); |
| | | term.put("mainId", caseId); |
| | | term.put("ownerIds", ids); |
| | | //查询所有附件 |
| | | List<FileIdTypeInfoBaseDTO> fileInfoList = sysClient.listIdTypeInfoByOwnerIdList(term); |
| | | for(FileIdTypeInfoBaseDTO fileInfo: fileInfoList){ |
| | | if(caseId.equals(fileInfo.getOwnerId())){ |
| | | for (FileIdTypeInfoBaseDTO fileInfo : fileInfoList) { |
| | | if (caseId.equals(fileInfo.getOwnerId())) { |
| | | caseInfoDTO.setFileInfoList(fileInfo.getFileList()); |
| | | } |
| | | } |
| | | for(CasePerson casePerson: casePersonList){ |
| | | for (CasePerson casePerson : casePersonList) { |
| | | //把附件根据编号放入 |
| | | for(FileIdTypeInfoBaseDTO fileInfo: fileInfoList){ |
| | | if(casePerson.getId().equals(fileInfo.getOwnerId())){ |
| | | for (FileIdTypeInfoBaseDTO fileInfo : fileInfoList) { |
| | | if (casePerson.getId().equals(fileInfo.getOwnerId())) { |
| | | casePerson.setFileInfoList(fileInfo.getFileList()); |
| | | } |
| | | } |
| | | } |
| | | for(CaseAgent caseAgent: caseAgentList){ |
| | | for(FileIdTypeInfoBaseDTO fileInfo: fileInfoList){ |
| | | if(caseAgent.getId().equals(fileInfo.getOwnerId())){ |
| | | for (CaseAgent caseAgent : caseAgentList) { |
| | | for (FileIdTypeInfoBaseDTO fileInfo : fileInfoList) { |
| | | if (caseAgent.getId().equals(fileInfo.getOwnerId())) { |
| | | caseAgent.setFileInfoList(fileInfo.getFileList()); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * PC端-查询纠纷信息 |
| | | * |
| | | * @param caseId 纠纷编号 |
| | | * @return CaseInfo 纠纷信息 |
| | | */ |
| | | public CaseInfoDTO getCaseArchivesInfo(String caseId){ |
| | | public CaseInfoDTO getCaseArchivesInfo(String caseId) { |
| | | CaseInfo caseInfo = mapper.selectById(caseId); |
| | | CaseInfoDTO caseInfoDTO = new CaseInfoDTO(); |
| | | if (ObjectUtils.isNotEmpty(caseInfo)) { |
| | |
| | | idList.addAll(casePersonList.stream().map(CasePerson::getId).collect(Collectors.toList())); |
| | | idList.addAll(caseAgentList.stream().map(CaseAgent::getId).collect(Collectors.toList())); |
| | | String ids = idList.stream().map(String::valueOf).collect(Collectors.joining("','")); |
| | | ids = "'"+ ids + "'"; |
| | | ids = "'" + ids + "'"; |
| | | Map<String, Object> term = new HashMap<>(); |
| | | term.put("mainId", caseId); |
| | | term.put("ownerIds", ids); |
| | | //查询所有附件 |
| | | List<FileIdTypeInfoBaseDTO> fileInfoList = sysClient.listIdTypeInfoByOwnerIdList(term); |
| | | for(FileIdTypeInfoBaseDTO fileInfo: fileInfoList){ |
| | | if(caseId.equals(fileInfo.getOwnerId())){ |
| | | for (FileIdTypeInfoBaseDTO fileInfo : fileInfoList) { |
| | | if (caseId.equals(fileInfo.getOwnerId())) { |
| | | caseInfoDTO.setFileInfoList(fileInfo.getFileList()); |
| | | } |
| | | } |
| | | for(CasePerson casePerson: casePersonList){ |
| | | for (CasePerson casePerson : casePersonList) { |
| | | //把附件根据编号放入 |
| | | for(FileIdTypeInfoBaseDTO fileInfo: fileInfoList){ |
| | | if(casePerson.getId().equals(fileInfo.getOwnerId())){ |
| | | for (FileIdTypeInfoBaseDTO fileInfo : fileInfoList) { |
| | | if (casePerson.getId().equals(fileInfo.getOwnerId())) { |
| | | casePerson.setFileInfoList(fileInfo.getFileList()); |
| | | } |
| | | } |
| | | } |
| | | for(CaseAgent caseAgent: caseAgentList){ |
| | | for(FileIdTypeInfoBaseDTO fileInfo: fileInfoList){ |
| | | if(caseAgent.getId().equals(fileInfo.getOwnerId())){ |
| | | for (CaseAgent caseAgent : caseAgentList) { |
| | | for (FileIdTypeInfoBaseDTO fileInfo : fileInfoList) { |
| | | if (caseAgent.getId().equals(fileInfo.getOwnerId())) { |
| | | caseAgent.setFileInfoList(fileInfo.getFileList()); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 绑定当事人小程序 |
| | | * |
| | | * @param casePerson 当事人信息 |
| | | */ |
| | | public void setPartyUserId(CasePerson casePerson) { |
| | |
| | | |
| | | /** |
| | | * 绑定当事人小程序 |
| | | * |
| | | * @param caseAgent 代理人人信息 |
| | | */ |
| | | public void setPartyUserId(CaseAgent caseAgent){ |
| | | public void setPartyUserId(CaseAgent caseAgent) { |
| | | if (StringUtils.isEmpty(caseAgent.getPartyUserId())) { |
| | | if (CaseBaseConstsEnum.CARD_TYPE_1.getIndex().equals(caseAgent.getCertiType())) { |
| | | if (StringUtils.isNotEmpty(caseAgent.getCertiNo())) { |
| | |
| | | |
| | | /** |
| | | * PC端-纠纷登记-保存纠纷信息-正常案件 |
| | | * |
| | | * @param registerSaveDTO 纠纷信息 |
| | | * @param userId 用户编号 |
| | | * @param userId 用户编号 |
| | | * @return String 纠纷编号 |
| | | */ |
| | | public String caseRegisterWechat(RegisterSaveDTO registerSaveDTO, String userId){ |
| | | try { |
| | | // 获取当前登录用户 |
| | | PaUserDTO loginUser = custClient.paclientGetUser(userId); |
| | | if(ObjectUtils.isEmpty(registerSaveDTO.getCustId())){ |
| | | registerSaveDTO.setCustId(loginUser.getCustId()); |
| | | } |
| | | public String caseRegisterWechat(RegisterSaveDTO registerSaveDTO, String userId) { |
| | | // 获取当前登录用户 |
| | | PaUserDTO loginUser = custClient.paclientGetUser(userId); |
| | | if (ObjectUtils.isEmpty(registerSaveDTO.getCustId())) { |
| | | registerSaveDTO.setCustId(loginUser.getCustId()); |
| | | } |
| | | |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | registerSaveDTO.setUpdateTime(nowDate); |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | registerSaveDTO.setUpdateTime(nowDate); |
| | | |
| | | CaseInfo caseInfo = new CaseInfo(); |
| | | CaseInfoUnfold caseInfoUnfold = new CaseInfoUnfold(); |
| | | BeanUtils.copyProperties(registerSaveDTO, caseInfo); |
| | | if(ObjectUtils.isEmpty(caseInfo.getId())){ |
| | | caseInfo.setId(utilsClient.getNewTimeCaseId()); |
| | | } |
| | | CaseInfo caseInfo = new CaseInfo(); |
| | | CaseInfoUnfold caseInfoUnfold = new CaseInfoUnfold(); |
| | | BeanUtils.copyProperties(registerSaveDTO, caseInfo); |
| | | if (ObjectUtils.isEmpty(caseInfo.getId())) { |
| | | caseInfo.setId(utilsClient.getNewTimeCaseId()); |
| | | } |
| | | // caseInfo.setInputUnitId(loginUser.getUnitId()); |
| | | // caseInfo.setInputUnitName(loginUser.getUnitName()); |
| | | caseInfo.setInputUserId(loginUser.getId()); |
| | | caseInfo.setInputUserName(loginUser.getTrueName()); |
| | | caseInfo.setInputWay(CaseBaseConsts.INPUT_WAY_1); |
| | | caseInfo.setCreateTime(nowDate); |
| | | caseInfo.setUpdateTime(nowDate); |
| | | caseInfo.setVisitTime(nowDate); |
| | | caseInfo.setDeleteStatus(BaseConsts.DELETE_STATUS_0); |
| | | //坐标转换 |
| | | if(ObjectUtils.isNotEmpty(caseInfo.getLat()) && ObjectUtils.isNotEmpty(caseInfo.getLng())){ |
| | | PointXY pointXY = MapUtils.gcj02tobd09(Double.valueOf(caseInfo.getLng()), Double.valueOf(caseInfo.getLat())); |
| | | caseInfo.setLat(pointXY.getLat()+""); |
| | | caseInfo.setLng(pointXY.getLon()+""); |
| | | } |
| | | //todo case_title生成 |
| | | caseInfo.setCaseRef(utilsClient.createCaseRef()); |
| | | caseInfo.setInputUserId(loginUser.getId()); |
| | | caseInfo.setInputUserName(loginUser.getTrueName()); |
| | | caseInfo.setInputWay(CaseBaseConsts.INPUT_WAY_1); |
| | | caseInfo.setPartyShow(1); |
| | | if(ObjectUtils.isEmpty(registerSaveDTO.getPeopleNum())){ |
| | | caseInfo.setPeopleNum(0); |
| | | } |
| | | if(ObjectUtils.isEmpty(registerSaveDTO.getAmount())){ |
| | | caseInfo.setAmount(0.0); |
| | | } |
| | | //默认添加省市 |
| | | caseInfo.setQueProv("19"); |
| | | caseInfo.setQueProvName("广东省"); |
| | | caseInfo.setQueCity("1601"); |
| | | caseInfo.setQueCityName("广州市"); |
| | | |
| | | // 为了演示先兼容小程序没属地问题,写死属地 |
| | | if (ObjectUtils.isEmpty(caseInfo.getQueProv())) { |
| | | caseInfo.setCreateTime(nowDate); |
| | | caseInfo.setUpdateTime(nowDate); |
| | | caseInfo.setVisitTime(nowDate); |
| | | caseInfo.setDeleteStatus(BaseConsts.DELETE_STATUS_0); |
| | | //坐标转换 |
| | | if (ObjectUtils.isNotEmpty(caseInfo.getLat()) && ObjectUtils.isNotEmpty(caseInfo.getLng())) { |
| | | PointXY pointXY = MapUtils.gcj02tobd09(Double.valueOf(caseInfo.getLng()), Double.valueOf(caseInfo.getLat())); |
| | | caseInfo.setLat(pointXY.getLat() + ""); |
| | | caseInfo.setLng(pointXY.getLon() + ""); |
| | | } |
| | | //todo case_title生成 |
| | | caseInfo.setCaseRef(utilsClient.createCaseRef()); |
| | | |
| | | // 为了演示先兼容小程序没属地问题,写死属地 |
| | | // caseInfo.setQueProv("19"); |
| | | // caseInfo.setQueProvName("广东"); |
| | | // caseInfo.setQueCity("1601"); |
| | |
| | | // caseInfo.setQueAreaName("白云区"); |
| | | // caseInfo.setQueRoad("62857"); |
| | | // caseInfo.setQueRoadName("新市街道"); |
| | | // 根据经纬度查询问题属地 |
| | | QueAddrBaseDTO queAddrBaseDTO = sysClient.getQueAddrByBaiduiLngLat(caseInfo.getLng(), caseInfo.getLat()); |
| | | log.info("xsdqueAddrBaseDTO:{}", queAddrBaseDTO); |
| | | caseInfo.setQueProv(queAddrBaseDTO.getQueProv()); |
| | | caseInfo.setQueProvName(queAddrBaseDTO.getQueProvName()); |
| | | caseInfo.setQueCity(queAddrBaseDTO.getQueCity()); |
| | | caseInfo.setQueCityName(queAddrBaseDTO.getQueCityName()); |
| | | caseInfo.setQueArea(queAddrBaseDTO.getQueArea()); |
| | | caseInfo.setQueAreaName(queAddrBaseDTO.getQueAreaName()); |
| | | caseInfo.setQueRoad(queAddrBaseDTO.getQueRoad()); |
| | | caseInfo.setQueRoadName(queAddrBaseDTO.getQueRoadName()); |
| | | log.info("xsdcaseInfo:{}", caseInfo); |
| | | caseInfoUnfold.setId(caseInfo.getId()); |
| | | caseInfoUnfold.setCreateTime(nowDate); |
| | | caseInfoUnfold.setUpdateTime(nowDate); |
| | | |
| | | // 根据经纬度查询问题属地 |
| | | QueAddrBaseDTO queAddrBaseDTO = sysClient.getQueAddrByBaiduiLngLat(caseInfo.getLng(), caseInfo.getLat()); |
| | | caseInfo.setQueProv(queAddrBaseDTO.getQueProv()); |
| | | caseInfo.setQueProvName(queAddrBaseDTO.getQueProvName()); |
| | | caseInfo.setQueCity(queAddrBaseDTO.getQueCity()); |
| | | caseInfo.setQueCityName(queAddrBaseDTO.getQueCityName()); |
| | | caseInfo.setQueArea(queAddrBaseDTO.getQueArea()); |
| | | caseInfo.setQueAreaName(queAddrBaseDTO.getQueAreaName()); |
| | | caseInfo.setQueRoad(queAddrBaseDTO.getQueRoad()); |
| | | caseInfo.setQueRoadName(queAddrBaseDTO.getQueRoadName()); |
| | | } |
| | | caseInfoUnfold.setId(caseInfo.getId()); |
| | | caseInfoUnfold.setCreateTime(nowDate); |
| | | caseInfoUnfold.setUpdateTime(nowDate); |
| | | StringBuffer plaintiffs = new StringBuffer(); |
| | | StringBuffer defendants = new StringBuffer(); |
| | | StringBuffer pagents = new StringBuffer(); |
| | | StringBuffer dagents = new StringBuffer(); |
| | | // 常规登记-保存当事人 |
| | | int peopleNum = this.saveCasePersonWechat(registerSaveDTO, plaintiffs, pagents, defendants, dagents, loginUser); |
| | | caseInfo.setVisitPeopleNum(peopleNum); |
| | | caseInfo.setPlaintiffs(plaintiffs.toString()); |
| | | caseInfo.setPagents(pagents.toString()); |
| | | caseInfo.setDefendants(defendants.toString()); |
| | | caseInfo.setDagents(dagents.toString()); |
| | | |
| | | StringBuffer plaintiffs = new StringBuffer(); |
| | | StringBuffer defendants = new StringBuffer(); |
| | | StringBuffer pagents = new StringBuffer(); |
| | | StringBuffer dagents = new StringBuffer(); |
| | | // 常规登记-保存当事人 |
| | | int peopleNum = this.saveCasePersonWechat(registerSaveDTO, plaintiffs, pagents, defendants, dagents,loginUser); |
| | | caseInfo.setVisitPeopleNum(peopleNum); |
| | | caseInfo.setPlaintiffs(plaintiffs.toString()); |
| | | caseInfo.setPagents(pagents.toString()); |
| | | caseInfo.setDefendants(defendants.toString()); |
| | | caseInfo.setDagents(dagents.toString()); |
| | | |
| | | //todo case_title生成 |
| | | //todo case_title生成 |
| | | // caseInfo.setCaseTitle(this.createCaseTitle(plaintiffs.toString(), defendants.toString(), caseInfo.getCaseTypeName())); |
| | | |
| | | caseInfo.setInfoProcess(CaseInfoProcessBaseConstsEnum.CASE_INFO_PROCESS_1.getIndex()); |
| | | caseInfo.setInfoProcessName(CaseInfoProcessBaseConstsEnum.CASE_INFO_PROCESS_1.getDes()); |
| | | caseInfo.setProcess(CaseProcessBaseConstsEnum.CASE_PROCESS_1.getIndex()); |
| | | caseInfo.setProcessName(CaseProcessBaseConstsEnum.CASE_PROCESS_1.getDes()); |
| | | caseInfo.setStatus(CaseStatusBaseConstsEnum.CASE_STATUS_1.getIndex()); |
| | | caseInfo.setStatusName(CaseStatusBaseConstsEnum.CASE_STATUS_1.getDes()); |
| | | caseInfo.setCaseLevel(3); |
| | | caseInfo.setCanal(CaseBaseConstsEnum.CASE_CANAL_2.getIndex()); |
| | | caseInfo.setCanalName(CaseBaseConstsEnum.CASE_CANAL_2.getDes()); |
| | | caseInfo.setInfoProcess(CaseInfoProcessBaseConstsEnum.CASE_INFO_PROCESS_1.getIndex()); |
| | | caseInfo.setInfoProcessName(CaseInfoProcessBaseConstsEnum.CASE_INFO_PROCESS_1.getDes()); |
| | | caseInfo.setProcess(CaseProcessBaseConstsEnum.CASE_PROCESS_1.getIndex()); |
| | | caseInfo.setProcessName(CaseProcessBaseConstsEnum.CASE_PROCESS_1.getDes()); |
| | | caseInfo.setStatus(CaseStatusBaseConstsEnum.CASE_STATUS_1.getIndex()); |
| | | caseInfo.setStatusName(CaseStatusBaseConstsEnum.CASE_STATUS_1.getDes()); |
| | | caseInfo.setCaseLevel(3); |
| | | caseInfo.setCanal(CaseBaseConstsEnum.CASE_CANAL_2.getIndex()); |
| | | caseInfo.setCanalName(CaseBaseConstsEnum.CASE_CANAL_2.getDes()); |
| | | |
| | | caseInfo.setCaseRef(utilsClient.createCaseRef()); |
| | | caseInfo.setVisitWay(CaseBaseConstsEnum.VISIT_WAY_2.getIndex()); |
| | | caseInfo.setVisitWayName(CaseBaseConstsEnum.VISIT_WAY_2.getDes()); |
| | | // 临时加上一级纠纷类型 |
| | | caseInfo.setCaseTypeFirst("24_01-2"); |
| | | caseInfo.setCaseTypeFirstName("劳动社保"); |
| | | this.saveOrUpdate(caseInfo); |
| | | caseInfo.setCaseRef(utilsClient.createCaseRef()); |
| | | caseInfo.setVisitWay(CaseBaseConstsEnum.VISIT_WAY_2.getIndex()); |
| | | caseInfo.setVisitWayName(CaseBaseConstsEnum.VISIT_WAY_2.getDes()); |
| | | // 临时加上一级纠纷类型 |
| | | caseInfo.setCaseTypeFirst("24_01-2"); |
| | | caseInfo.setCaseTypeFirstName("劳动社保"); |
| | | //小程序是否查看 |
| | | caseInfo.setPartyShow(1); |
| | | |
| | | caseInfoUnfoldService.saveOrUpdate(caseInfoUnfold); |
| | | // 启动工作流-自动调度流程 |
| | | caseTaskService.webStartFlowLFDJ(caseInfo); |
| | | return registerSaveDTO.getId(); |
| | | }catch (Exception e){ |
| | | log.error("service方法[CaseInfoService.caseRegisterWechat]调用异常:"+e, e); |
| | | throw new ServiceException("CaseInfoService.caseRegisterWechat", e); |
| | | } |
| | | this.saveOrUpdate(caseInfo); |
| | | |
| | | caseInfoUnfoldService.saveOrUpdate(caseInfoUnfold); |
| | | // 启动工作流-自动调度流程 |
| | | caseTaskService.webStartFlowLFDJ(caseInfo); |
| | | return registerSaveDTO.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 生成调解案件标题 |
| | | * @param plaintiffs 申请人 |
| | | * @param defendants 被申请人 |
| | | * |
| | | * @param plaintiffs 申请人 |
| | | * @param defendants 被申请人 |
| | | * @param caseTypeName 纠纷类型 |
| | | * @return String |
| | | */ |
| | | public String createCaseTitle(String plaintiffs, String defendants, String caseTypeName){ |
| | | public String createCaseTitle(String plaintiffs, String defendants, String caseTypeName) { |
| | | StringBuffer caseTitle = new StringBuffer(); |
| | | if (plaintiffs.indexOf(BaseConsts.COMMA) != -1){ |
| | | if (plaintiffs.indexOf(BaseConsts.COMMA) != -1) { |
| | | caseTitle.append(plaintiffs.split(BaseConsts.COMMA)[0]).append("等"); |
| | | }else { |
| | | } else { |
| | | caseTitle.append(plaintiffs.split(BaseConsts.COMMA)[0]); |
| | | } |
| | | if (StringUtils.isNotEmpty(defendants)) { |
| | |
| | | } |
| | | } |
| | | caseTitle.append("的"); |
| | | if (StringUtils.isNotEmpty(caseTypeName)){ |
| | | if (StringUtils.isNotEmpty(caseTypeName)) { |
| | | caseTitle.append(caseTypeName); |
| | | } |
| | | caseTitle.append("案件"); |
| | |
| | | |
| | | /** |
| | | * pc端-常规登记-保存正式案件-保存人员信息 |
| | | * |
| | | * @param registerSaveDTO 纠纷信息 |
| | | * @param plaintiffs 申请人 |
| | | * @param pagents 申请人代理人 |
| | | * @param defendants 被申请人 |
| | | * @param dagents 被申请人代理人 |
| | | * @param plaintiffs 申请人 |
| | | * @param pagents 申请人代理人 |
| | | * @param defendants 被申请人 |
| | | * @param dagents 被申请人代理人 |
| | | * @return int |
| | | */ |
| | | private int saveCasePersonWechat(RegisterSaveDTO registerSaveDTO, StringBuffer plaintiffs, StringBuffer pagents, |
| | | StringBuffer defendants, StringBuffer dagents,PaUserDTO loginUser){ |
| | | StringBuffer defendants, StringBuffer dagents, PaUserDTO loginUser) { |
| | | int peopleNum = 0; |
| | | // 保存申请人 |
| | | List<CasePerson> personList = registerSaveDTO.getPersonList(); |
| | | Map<String,String> personIdMap = new HashMap<>(); |
| | | if (CollectionUtils.isNotEmpty(personList)) { |
| | | for (CasePerson casePerson : personList) { |
| | | casePerson.setId(utilsClient.getNewTimeCaseId()); |
| | | String newTimeCaseId = utilsClient.getNewTimeCaseId(); |
| | | personIdMap.put(casePerson.getAgentCode(), newTimeCaseId); |
| | | casePerson.setId(newTimeCaseId); |
| | | casePerson.setCaseId(registerSaveDTO.getId()); |
| | | casePerson.setPartyUserId(loginUser.getId()); |
| | | casePerson.setCustId(registerSaveDTO.getCustId()); |
| | |
| | | personService.saveOrUpdate(casePerson); |
| | | |
| | | //添加申请方和被申请方人名组合 |
| | | if(CaseBaseConstsEnum.PERSON_TYPE_1.getIndex().equals(casePerson.getPerType())){ |
| | | if (CaseBaseConstsEnum.PERSON_TYPE_1.getIndex().equals(casePerson.getPerType())) { |
| | | //申请方 |
| | | if (StringUtils.isNotEmpty(plaintiffs.toString())) { |
| | | plaintiffs.append(BaseConsts.COMMA); |
| | | } |
| | | plaintiffs.append(casePerson.getTrueName()); |
| | | }else if(CaseBaseConstsEnum.PERSON_TYPE_2.getIndex().equals(casePerson.getPerType())){ |
| | | } else if (CaseBaseConstsEnum.PERSON_TYPE_2.getIndex().equals(casePerson.getPerType())) { |
| | | //被申请方 |
| | | if (StringUtils.isNotEmpty(defendants.toString())) { |
| | | defendants.append(BaseConsts.COMMA); |
| | |
| | | //保存代理人 |
| | | List<CaseAgent> agentList = registerSaveDTO.getAgentList(); |
| | | if (CollectionUtils.isNotEmpty(agentList)) { |
| | | for(CaseAgent caseAgent: agentList){ |
| | | for (CaseAgent caseAgent : agentList) { |
| | | caseAgent.setId(utilsClient.getNewTimeCaseId()); |
| | | caseAgent.setPersonId(personIdMap.get(caseAgent.getAgentCode())); |
| | | caseAgent.setPartyUserId(loginUser.getId()); |
| | | caseAgent.setCaseId(registerSaveDTO.getId()); |
| | | caseAgent.setAgentTypeName(CaseBaseConstsEnum.getDes(caseAgent.getAgentType())); |
| | |
| | | caseAgent.setCreateTime(registerSaveDTO.getUpdateTime()); |
| | | caseAgent.setUpdateTime(registerSaveDTO.getUpdateTime()); |
| | | agentService.saveOrUpdate(caseAgent); |
| | | if(CaseBaseConstsEnum.PERSON_TYPE_3.getIndex().equals(caseAgent.getPerType())){ |
| | | if (CaseBaseConstsEnum.PERSON_TYPE_3.getIndex().equals(caseAgent.getPerType())) { |
| | | if (StringUtils.isNotEmpty(pagents.toString())) { |
| | | pagents.append(BaseConsts.COMMA); |
| | | } |
| | | pagents.append(caseAgent.getTrueName()); |
| | | }else if(CaseBaseConstsEnum.PERSON_TYPE_4.getIndex().equals(caseAgent.getPerType())){ |
| | | } else if (CaseBaseConstsEnum.PERSON_TYPE_4.getIndex().equals(caseAgent.getPerType())) { |
| | | if (StringUtils.isNotEmpty(dagents.toString())) { |
| | | dagents.append(BaseConsts.COMMA); |
| | | } |
| | |
| | | return peopleNum; |
| | | } |
| | | |
| | | public RegisterSaveDTO getCaseInfoWechat(String id){ |
| | | public RegisterSaveDTO getCaseInfoWechat(String id) { |
| | | RegisterSaveDTO registerSaveDTO = new RegisterSaveDTO(); |
| | | CaseInfo caseInfo = this.getById(id); |
| | | if(ObjectUtils.isNotEmpty(caseInfo)){ |
| | | if (ObjectUtils.isNotEmpty(caseInfo)) { |
| | | BeanUtils.copyProperties(caseInfo, registerSaveDTO); |
| | | } |
| | | QueryWrapper<CasePerson> casePersonQueryWrapper = new QueryWrapper<>(); |
| | | casePersonQueryWrapper.eq("case_id", registerSaveDTO.getId()); |
| | | List<CasePerson> personList = personService.list(casePersonQueryWrapper); |
| | | List<CasePerson> personList = personService.list(casePersonQueryWrapper); |
| | | Map<String,String> personNameMap = new HashMap<>(); |
| | | if(ObjectUtils.isNotEmpty(personList)){ |
| | | for (CasePerson casePerson : personList) { |
| | | personNameMap.put(casePerson.getId(),casePerson.getTrueName()); |
| | | } |
| | | } |
| | | registerSaveDTO.setPersonList(personList); |
| | | |
| | | QueryWrapper<CaseAgent> caseAgentQueryWrapper = new QueryWrapper<>(); |
| | | caseAgentQueryWrapper.eq("case_id", registerSaveDTO.getId()); |
| | | List<CaseAgent> agentList = agentService.list(caseAgentQueryWrapper); |
| | | if(ObjectUtils.isNotEmpty(agentList)){ |
| | | for (CaseAgent caseAgent : agentList) { |
| | | caseAgent.setAgentPersonName(personNameMap.get(caseAgent.getPersonId())); |
| | | } |
| | | } |
| | | registerSaveDTO.setAgentList(agentList); |
| | | |
| | | return registerSaveDTO; |
| | |
| | | |
| | | /** |
| | | * 按条件分页查询-小程序查询 |
| | | * @param page 分页对象 |
| | | * |
| | | * @param page 分页对象 |
| | | * @param terms 条件 |
| | | * @return Page |
| | | */ |
| | | public Page<CaseInfoWeChatDTO> pageQueryWechat(String userId, PageRequest page, Map<String, Object> terms){ |
| | | public Page<CaseInfoWeChatDTO> pageQueryWechat(String userId, PageRequest page, Map<String, Object> terms) { |
| | | PaUserDTO loginUser = custClient.paclientGetUser(userId); |
| | | List<CaseInfoWeChatDTO> list = new ArrayList<>(); |
| | | String personType = terms.get("personType")+""; |
| | | if(ObjectUtils.isEmpty(personType)){ |
| | | String personType = terms.get("personType") + ""; |
| | | if (ObjectUtils.isEmpty(personType)) { |
| | | throw new RuntimeException("请选择人员类型"); |
| | | } |
| | | if(ObjectUtils.isEmpty(loginUser.getIdcard())){ |
| | | if (ObjectUtils.isEmpty(loginUser.getIdcard())) { |
| | | return new PageImpl<CaseInfoWeChatDTO>(list, page, 0); |
| | | } |
| | | QueryWrapper<CasePerson> personWrapper = new QueryWrapper<>(); |
| | | personWrapper.select("case_id"); |
| | | personWrapper.eq("certi_no", loginUser.getIdcard()); |
| | | if("1".equals(personType)){ |
| | | personWrapper.eq("per_type",CaseBaseConstsEnum.PERSON_TYPE_1.getIndex()); |
| | | }else { |
| | | personWrapper.eq("per_type",CaseBaseConstsEnum.PERSON_TYPE_2.getIndex()); |
| | | if ("1".equals(personType)) { |
| | | personWrapper.eq("per_type", CaseBaseConstsEnum.PERSON_TYPE_1.getIndex()); |
| | | } else { |
| | | personWrapper.eq("per_type", CaseBaseConstsEnum.PERSON_TYPE_2.getIndex()); |
| | | } |
| | | List<CasePerson> casePersonList = personService.list(personWrapper); |
| | | if(ObjectUtils.isEmpty(casePersonList)){ |
| | | if (ObjectUtils.isEmpty(casePersonList)) { |
| | | return new PageImpl<CaseInfoWeChatDTO>(list, page, 0); |
| | | } |
| | | List<String> ids = casePersonList.stream().map(CasePerson::getCaseId).collect(Collectors.toList()); |
| | | terms.put("ids",ids); |
| | | terms.put("ids", ids); |
| | | terms.put("partyShow",1); |
| | | long total = mapper.countTerms(terms); |
| | | List<CaseInfo> content = mapper.pageTerms(page, terms); |
| | | if(ObjectUtils.isNotEmpty(content)){ |
| | | for(CaseInfo caseInfo: content){ |
| | | if (ObjectUtils.isNotEmpty(content)) { |
| | | for (CaseInfo caseInfo : content) { |
| | | CaseInfoWeChatDTO caseInfoWeChatDTO = new CaseInfoWeChatDTO(); |
| | | BeanUtils.copyProperties(caseInfo, caseInfoWeChatDTO); |
| | | caseInfoWeChatDTO.setProcessStatus(caseInfo.getInfoProcess()); |
| | | caseInfoWeChatDTO.setProcessStatusName(caseInfo.getInfoProcessName()); |
| | | //扩展信息 |
| | | CaseInfoUnfold caseInfoUnfold = caseInfoUnfoldService.getById(caseInfo.getId()); |
| | | if(ObjectUtils.isNotEmpty(caseInfoUnfold)){ |
| | | if (ObjectUtils.isNotEmpty(caseInfoUnfold)) { |
| | | caseInfoWeChatDTO.setMediResult(caseInfoUnfold.getMediResult()); |
| | | caseInfoWeChatDTO.setMediResultName(caseInfoUnfold.getMediResultName()); |
| | | caseInfoWeChatDTO.setMediateDeptId(caseInfoUnfold.getMediateDeptId()); |
| | | caseInfoWeChatDTO.setMediateDeptName(caseInfoUnfold.getMediateDeptName()); |
| | | caseInfoWeChatDTO.setMediateDeptId(caseInfoUnfold.getMediateUnitId()); |
| | | caseInfoWeChatDTO.setMediateDeptName(caseInfoUnfold.getMediateUnitName()); |
| | | caseInfoWeChatDTO.setAgreeType(caseInfoUnfold.getAgreeType()); |
| | | caseInfoWeChatDTO.setAgreeTypeName(caseInfoUnfold.getAgreeTypeName()); |
| | | caseInfoWeChatDTO.setAgreeContent(caseInfoUnfold.getAgreeContent()); |
| | | } |
| | | |
| | | QueryWrapper<CasePerson> personWrapper1 = new QueryWrapper<>(); |
| | |
| | | for (CasePerson casePerson : casePersonList1) { |
| | | CasePersonWechatDTO casePersonWechatDTO = new CasePersonWechatDTO(); |
| | | BeanUtils.copyProperties(casePerson, casePersonWechatDTO); |
| | | if(CaseBaseConstsEnum.PERSON_TYPE_1.getIndex().equals(casePerson.getPerType())){ |
| | | if (CaseBaseConstsEnum.PERSON_TYPE_1.getIndex().equals(casePerson.getPerType())) { |
| | | plaintiffList.add(casePersonWechatDTO); |
| | | }else if(CaseBaseConstsEnum.PERSON_TYPE_2.getIndex().equals(casePerson.getPerType())){ |
| | | } else if (CaseBaseConstsEnum.PERSON_TYPE_2.getIndex().equals(casePerson.getPerType())) { |
| | | defendantList.add(casePersonWechatDTO); |
| | | } |
| | | } |
| | |
| | | evaluateTerms.put("deleteStatus", BaseConsts.DELETE_STATUS_0); |
| | | evaluateTerms.put("evaluateUserId", loginUser.getId()); |
| | | long evaluateCount = caseEvaluateService.countTerms(evaluateTerms); |
| | | if(evaluateCount > 0){ |
| | | if (evaluateCount > 0) { |
| | | caseInfoWeChatDTO.setIsEvaluate("1"); |
| | | }else{ |
| | | } else { |
| | | caseInfoWeChatDTO.setIsEvaluate("0"); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 按条件分页查询-综合查询 |
| | | * @param page 分页对象 |
| | | * |
| | | * @param page 分页对象 |
| | | * @param terms 条件 |
| | | * @return Page |
| | | */ |
| | | public Page<CasePageDTO> pageQueryAll(PageRequest page, Map<String, Object> terms){ |
| | | public Page<CasePageDTO> pageQueryAll(PageRequest page, Map<String, Object> terms) { |
| | | long total = mapper.countTermsAll(terms); |
| | | List<CasePageDTO> content = mapper.pageTermsAll(page, terms); |
| | | if(ObjectUtils.isNotEmpty(content)){ |
| | | if (ObjectUtils.isNotEmpty(content)) { |
| | | for (CasePageDTO casePageDTO : content) { |
| | | QueryWrapper<CasePerson> personWrapper1 = new QueryWrapper<>(); |
| | | personWrapper1.eq("case_id", casePageDTO.getId()); |
| | | List<CasePerson> casePersonList1 = personService.list(personWrapper1); |
| | | if(ObjectUtils.isNotEmpty(casePageDTO.getQueRoadName())){ |
| | | casePageDTO.setAreaName(casePageDTO.getQueRoadName()); |
| | | }else if(ObjectUtils.isNotEmpty(casePageDTO.getAreaName())){ |
| | | casePageDTO.setAreaName(casePageDTO.getAreaName()); |
| | | }else if(ObjectUtils.isNotEmpty(casePageDTO.getQueCityName())){ |
| | | casePageDTO.setAreaName(casePageDTO.getQueCityName()); |
| | | } |
| | | if(ObjectUtils.isNotEmpty(casePageDTO.getCaseLevel())){ |
| | | switch (casePageDTO.getCaseLevel()){ |
| | | case "1": |
| | | casePageDTO.setCaseLevel("一级"); |
| | | break; |
| | | case "2": |
| | | casePageDTO.setCaseLevel("二级"); |
| | | break; |
| | | case "3": |
| | | casePageDTO.setCaseLevel("三级"); |
| | | break; |
| | | } |
| | | } |
| | | //申请人集合 |
| | | List<CasePersonWeDTO> plaintiffList = new ArrayList<>(); |
| | | //被申请人集合 |
| | | List<CasePersonWeDTO> defendantList = new ArrayList<>(); |
| | | for (CasePerson casePerson : casePersonList1) { |
| | | CasePersonWeDTO casePersonWechatDTO = new CasePersonWeDTO(); |
| | | BeanUtils.copyProperties(casePerson, casePersonWechatDTO); |
| | | if(CaseBaseConstsEnum.PERSON_TYPE_1.getIndex().equals(casePerson.getPerType())){ |
| | | plaintiffList.add(casePersonWechatDTO); |
| | | }else if(CaseBaseConstsEnum.PERSON_TYPE_2.getIndex().equals(casePerson.getPerType())){ |
| | | defendantList.add(casePersonWechatDTO); |
| | | //如果是导出调用,不查询extend信息 |
| | | if(ObjectUtils.isEmpty(terms.get("report"))){ |
| | | QueryWrapper<CasePerson> personWrapper1 = new QueryWrapper<>(); |
| | | personWrapper1.eq("case_id", casePageDTO.getId()); |
| | | List<CasePerson> casePersonList1 = personService.list(personWrapper1); |
| | | for (CasePerson casePerson : casePersonList1) { |
| | | CasePersonWeDTO casePersonWechatDTO = new CasePersonWeDTO(); |
| | | BeanUtils.copyProperties(casePerson, casePersonWechatDTO); |
| | | if (CaseBaseConstsEnum.PERSON_TYPE_1.getIndex().equals(casePerson.getPerType())) { |
| | | plaintiffList.add(casePersonWechatDTO); |
| | | } else if (CaseBaseConstsEnum.PERSON_TYPE_2.getIndex().equals(casePerson.getPerType())) { |
| | | defendantList.add(casePersonWechatDTO); |
| | | } |
| | | } |
| | | } |
| | | casePageDTO.setDefendantList(defendantList); |
| | |
| | | } |
| | | return new PageImpl<CasePageDTO>(content, page, total); |
| | | } |
| | | |
| | | /** |
| | | * 纠纷态势 |
| | | * 筛选范围:如果已经有承办部门,就按承办部门的区域筛选。如果没有承办部门按问题归属区域筛选 |
| | | * */ |
| | | public CaseStatisticsBaseDTO statistics(Map<String, Object> terms,String userId) throws IOException { |
| | | Object canal = null; |
| | | if(ObjectUtils.isNotEmpty(terms.get("canal"))){ |
| | | canal = terms.get("canal"); |
| | | } |
| | | terms.put("statistics", "1"); |
| | | //根据用户筛选区域范围 |
| | | CtUnitDTO ctUnitDTO = custClient.getUnitByUserId(userId); |
| | | String areaCode = null; |
| | | //目前没有村居数据,所以单位等级是4的也归集到3里面 |
| | | if(ctUnitDTO.getUnitGrade().equals(1)){ |
| | | terms.put("queCity", ctUnitDTO.getCity()); |
| | | }else if(ctUnitDTO.getUnitGrade().equals(2)){ |
| | | terms.put("queArea", ctUnitDTO.getArea()); |
| | | }else if(ctUnitDTO.getUnitGrade().equals(3) || ctUnitDTO.getUnitGrade().equals(4)){ |
| | | terms.put("queRoad", ctUnitDTO.getRoad()); |
| | | } |
| | | |
| | | //目前没有村居,所以区和街道进来都是按街道展示 |
| | | String areaType = null;//兼容白云数据 |
| | | List<Integer> unitGrades = new ArrayList<>(); |
| | | if(ObjectUtils.isNotEmpty(terms.get("queRoad"))){ |
| | | terms.put("areaType","2"); |
| | | areaType = "2"; |
| | | areaCode = terms.get("queRoad")+""; |
| | | unitGrades.add(3); |
| | | unitGrades.add(4); |
| | | }else if(ObjectUtils.isNotEmpty(terms.get("queArea"))){ |
| | | terms.put("areaType","2"); |
| | | areaType = "2"; |
| | | areaCode = terms.get("queArea")+""; |
| | | unitGrades.add(2); |
| | | }else{ |
| | | areaType = "1"; |
| | | unitGrades.add(1); |
| | | areaCode = ctUnitDTO.getCity(); |
| | | } |
| | | //基础数据统计 |
| | | CaseStatisticsBaseDTO caseStatisticsBaseDTO = mapper.statisticsBase(terms); |
| | | Integer baseTotalNum = dellNull(caseStatisticsBaseDTO.getResolveNum()) + dellNull(caseStatisticsBaseDTO.getUnResolveNum()) + dellNull(caseStatisticsBaseDTO.getResolveingNum()); |
| | | Integer resolveTotalNum = dellNull(caseStatisticsBaseDTO.getResolveNum()) + dellNull(caseStatisticsBaseDTO.getUnResolveNum()); |
| | | caseStatisticsBaseDTO.setResolveRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getResolveNum() * 100, resolveTotalNum, 1)); |
| | | caseStatisticsBaseDTO.setUnResolveRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getUnResolveNum() * 100, resolveTotalNum, 1)); |
| | | caseStatisticsBaseDTO.setResolveingRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getResolveingNum() * 100, baseTotalNum, 1)); |
| | | Integer levelTotalNum = caseStatisticsBaseDTO.getOneLevelNum() + caseStatisticsBaseDTO.getTwoLevelNum() + caseStatisticsBaseDTO.getThreeLevelNum(); |
| | | caseStatisticsBaseDTO.setOneLevelRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getOneLevelNum() * 100, levelTotalNum, 1)); |
| | | caseStatisticsBaseDTO.setTwoLevelRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getTwoLevelNum() * 100, levelTotalNum, 1)); |
| | | caseStatisticsBaseDTO.setThreeLevelRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getThreeLevelNum() * 100, levelTotalNum, 1)); |
| | | //区域数据统计 |
| | | List<CaseStatisticsAreaDTO> caseStatisticsAreaDTOS = mapper.statisticsArea(terms); |
| | | if (ObjectUtils.isEmpty(caseStatisticsAreaDTOS)) { |
| | | caseStatisticsAreaDTOS = new ArrayList<>(); |
| | | } |
| | | CaseStatisticsAreaDTO allArea = new CaseStatisticsAreaDTO(); |
| | | allArea.setAreaName("本级"); |
| | | allArea.setAreaCode("1"); |
| | | List<String> areaCodeList = new ArrayList<>(); |
| | | List<CaseStatisticsAreaDTO> areaList = new ArrayList<>(); |
| | | List<String> areaNames = new ArrayList<>();//为兼容白云区数据 |
| | | for (CaseStatisticsAreaDTO caseStatisticsAreaDTO : caseStatisticsAreaDTOS) { |
| | | areaNames.add(caseStatisticsAreaDTO.getAreaName()); |
| | | //本及:承办单位是本及和没有承办单位并且没有下级区域编码 |
| | | if(ObjectUtils.isEmpty(caseStatisticsAreaDTO.getAreaCode()) || unitGrades.contains(caseStatisticsAreaDTO.getUnitGrade())){ |
| | | allArea.setCaseNum(dellNull(caseStatisticsAreaDTO.getCaseNum()) + dellNull(allArea.getCaseNum())); |
| | | allArea.setResolveNum(dellNull(caseStatisticsAreaDTO.getResolveNum()) + dellNull(allArea.getResolveNum())); |
| | | allArea.setUnResolveNum(dellNull(caseStatisticsAreaDTO.getUnResolveNum()) + dellNull(allArea.getUnResolveNum())); |
| | | allArea.setResolveingNum(dellNull(caseStatisticsAreaDTO.getResolveingNum()) + dellNull(allArea.getResolveingNum())); |
| | | }else{ |
| | | areaList.add(caseStatisticsAreaDTO); |
| | | areaCodeList.add(caseStatisticsAreaDTO.getAreaCode()); |
| | | } |
| | | } |
| | | areaList.add(allArea); |
| | | if("1".equals(areaType)){ |
| | | Map<String, String> area = getArea(); |
| | | for (String areaName : area.keySet()) { |
| | | if(!areaNames.contains(areaName)){ |
| | | CaseStatisticsAreaDTO areaChild = new CaseStatisticsAreaDTO(); |
| | | areaChild.setAreaCode(area.get(areaName)); |
| | | areaChild.setAreaName(areaName); |
| | | areaList.add(areaChild); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<QueAreaDTO> queArea = listAreaByType(areaCode); |
| | | log.info("listAreaByType {}", JSON.toJSONString(queArea)); |
| | | for (QueAreaDTO caseAreaDTO : queArea) { |
| | | if (!areaCodeList.contains(caseAreaDTO.getAreaCode())) { |
| | | CaseStatisticsAreaDTO areaChild = new CaseStatisticsAreaDTO(); |
| | | areaChild.setAreaCode(caseAreaDTO.getAreaCode()); |
| | | areaChild.setAreaName(caseAreaDTO.getAreaName()); |
| | | areaChild.setCaseNum(0); |
| | | areaChild.setResolveNum(0); |
| | | areaChild.setUnResolveNum(0); |
| | | areaChild.setResolveingNum(0); |
| | | areaList.add(areaChild); |
| | | } |
| | | } |
| | | |
| | | if (ObjectUtils.isNotEmpty(areaList)) { |
| | | sortArea(areaList); |
| | | } |
| | | caseStatisticsBaseDTO.setAreaList(areaList); |
| | | //纠纷类型统计 |
| | | List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsTypeFirst(terms); |
| | | if (ObjectUtils.isNotEmpty(caseStatisticsTypeDTOS)) { |
| | | sortType(caseStatisticsTypeDTOS); |
| | | } |
| | | Integer typeTotalNum = 0; |
| | | Integer otherCaseNum = 0; |
| | | int i = 1; |
| | | List<CaseStatisticsTypeDTO> typeList = new ArrayList<>(); |
| | | for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) { |
| | | typeTotalNum = typeTotalNum + dellNull(caseStatisticsTypeDTO.getCaseNum()); |
| | | if (i > 5) { |
| | | otherCaseNum = otherCaseNum + dellNull(caseStatisticsTypeDTO.getCaseNum()); |
| | | } else { |
| | | typeList.add(caseStatisticsTypeDTO); |
| | | } |
| | | i++; |
| | | } |
| | | for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : typeList) { |
| | | caseStatisticsTypeDTO.setCaseRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsTypeDTO.getCaseNum() * 100, typeTotalNum, 1)); |
| | | } |
| | | CaseStatisticsTypeDTO caseStatisticsTypeDTO = new CaseStatisticsTypeDTO(); |
| | | caseStatisticsTypeDTO.setCaseTypeName("其他"); |
| | | caseStatisticsTypeDTO.setCaseNum(otherCaseNum); |
| | | caseStatisticsTypeDTO.setCaseRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsTypeDTO.getCaseNum() * 100, typeTotalNum, 1)); |
| | | typeList.add(caseStatisticsTypeDTO); |
| | | caseStatisticsBaseDTO.setTypeList(typeList); |
| | | //事项来源 |
| | | terms.put("canal", CaseBaseConstsEnum.CASE_CANAL_1.getIndex()); |
| | | CaseStatisticsSourceDTO oneSource = mapper.statisticsSource(terms); |
| | | if(ObjectUtils.isEmpty(oneSource)){ |
| | | oneSource = new CaseStatisticsSourceDTO(); |
| | | } |
| | | oneSource.setCanalName(CaseBaseConstsEnum.CASE_CANAL_1.getDes()); |
| | | terms.put("canal", CaseBaseConstsEnum.CASE_CANAL_2.getIndex()); |
| | | CaseStatisticsSourceDTO twoSource = mapper.statisticsSource(terms); |
| | | if(ObjectUtils.isEmpty(twoSource)){ |
| | | twoSource = new CaseStatisticsSourceDTO(); |
| | | } |
| | | twoSource.setCanalName(CaseBaseConstsEnum.CASE_CANAL_2.getDes()); |
| | | |
| | | terms.put("canal", CaseBaseConstsEnum.CASE_CANAL_3.getIndex()); |
| | | CaseStatisticsSourceDTO threeSource = mapper.statisticsSource(terms); |
| | | if(ObjectUtils.isEmpty(threeSource)){ |
| | | threeSource = new CaseStatisticsSourceDTO(); |
| | | } |
| | | |
| | | terms.put("canal", CaseBaseConstsEnum.CASE_CANAL_4.getIndex()); |
| | | CaseStatisticsSourceDTO fourSource = mapper.statisticsSource(terms); |
| | | if(ObjectUtils.isEmpty(fourSource)){ |
| | | fourSource = new CaseStatisticsSourceDTO(); |
| | | } |
| | | |
| | | Integer sourceTotalNum = dellNull(oneSource.getCaseNum()) + dellNull(twoSource.getCaseNum()) + dellNull(threeSource.getCaseNum()) + dellNull(fourSource.getCaseNum()); |
| | | Integer oneTotalNum = dellNull(oneSource.getResolveNum()) + dellNull(oneSource.getUnResolveNum()); |
| | | Integer twoTotalNum = dellNull(twoSource.getResolveNum()) + dellNull(twoSource.getUnResolveNum()); |
| | | Integer threeTotalNum = dellNull(threeSource.getResolveNum()) + dellNull(threeSource.getUnResolveNum()); |
| | | Integer fourTotalNum = dellNull(fourSource.getResolveNum()) + dellNull(fourSource.getUnResolveNum()); |
| | | oneSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(oneSource.getCaseNum() * 100, sourceTotalNum, 1)); |
| | | oneSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(oneSource.getResolveNum() * 100, oneTotalNum, 1)); |
| | | |
| | | twoSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(twoSource.getCaseNum() * 100, sourceTotalNum, 1)); |
| | | twoSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(twoSource.getResolveNum() * 100, twoTotalNum, 1)); |
| | | |
| | | |
| | | threeSource.setCanalName(CaseBaseConstsEnum.CASE_CANAL_3.getDes()); |
| | | threeSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(threeSource.getCaseNum() * 100, sourceTotalNum, 1)); |
| | | threeSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(threeSource.getResolveNum() * 100, threeTotalNum, 1)); |
| | | |
| | | fourSource.setCanalName(CaseBaseConstsEnum.CASE_CANAL_4.getDes()); |
| | | fourSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(fourSource.getCaseNum() * 100, sourceTotalNum, 1)); |
| | | fourSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(fourSource.getResolveNum() * 100, fourTotalNum, 1)); |
| | | |
| | | caseStatisticsBaseDTO.setOneSource(oneSource); |
| | | caseStatisticsBaseDTO.setTwoSource(twoSource); |
| | | caseStatisticsBaseDTO.setThreeSource(threeSource); |
| | | caseStatisticsBaseDTO.setFourSource(fourSource); |
| | | |
| | | //案件集合 |
| | | if(ObjectUtils.isEmpty(canal)){ |
| | | terms.remove("canal"); |
| | | }else{ |
| | | terms.put("canal", canal); |
| | | } |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "a.create_time"); |
| | | PageRequest pageRequest = PageRequest.of(0, 30, sort); |
| | | terms.remove("statistics"); |
| | | Page<CasePageDTO> casePageDTOS = pageQueryAll(pageRequest, terms); |
| | | if (ObjectUtils.isNotEmpty(casePageDTOS.getContent())) { |
| | | caseStatisticsBaseDTO.setCaseList(casePageDTOS.getContent()); |
| | | } else { |
| | | caseStatisticsBaseDTO.setCaseList(new ArrayList<>()); |
| | | } |
| | | return caseStatisticsBaseDTO; |
| | | } |
| | | |
| | | public List<CaseStatisticsTypeDTO> sortType(List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS) { |
| | | caseStatisticsTypeDTOS.sort((o1, o2) -> { |
| | | Integer totalScore1 = o1.getCaseNum(); |
| | | Integer totalScore2 = o2.getCaseNum(); |
| | | if (totalScore1 < totalScore2) { |
| | | return 1; |
| | | } else if (totalScore1.equals(totalScore2)) { |
| | | return 0; |
| | | } else { |
| | | return -1; |
| | | } |
| | | }); |
| | | return caseStatisticsTypeDTOS; |
| | | } |
| | | |
| | | public Map<String, String> getArea(){ |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("越秀区","2"); |
| | | map.put("海珠区","3"); |
| | | map.put("荔湾区","4"); |
| | | map.put("天河区","5"); |
| | | map.put("白云区","6"); |
| | | map.put("黄埔区","7"); |
| | | map.put("花都区","8"); |
| | | map.put("番禺区","9"); |
| | | map.put("南沙区","10"); |
| | | map.put("从化区","11"); |
| | | map.put("增城区","12"); |
| | | return map; |
| | | } |
| | | |
| | | public List<CaseStatisticsAreaDTO> sortArea(List<CaseStatisticsAreaDTO> caseStatisticsAreaDTOS) { |
| | | Map<String, String> map = getArea(); |
| | | for (CaseStatisticsAreaDTO caseStatisticsAreaDTO : caseStatisticsAreaDTOS) { |
| | | caseStatisticsAreaDTO.setAreaCode(caseStatisticsAreaDTO.getAreaCode().replace("-","")); |
| | | if(map.containsKey(caseStatisticsAreaDTO.getAreaName())){ |
| | | caseStatisticsAreaDTO.setAreaCode(map.get(caseStatisticsAreaDTO.getAreaName())); |
| | | } |
| | | } |
| | | caseStatisticsAreaDTOS.sort((o1, o2) -> { |
| | | Long totalScore1 = Long.valueOf(o1.getAreaCode()); |
| | | Long totalScore2 = Long.valueOf(o2.getAreaCode()); |
| | | if (totalScore1 > totalScore2) { |
| | | return 1; |
| | | } else if (totalScore1.equals(totalScore2)) { |
| | | return 0; |
| | | } else { |
| | | return -1; |
| | | } |
| | | }); |
| | | return caseStatisticsAreaDTOS; |
| | | } |
| | | |
| | | public Integer dellNull(Integer number) { |
| | | if (ObjectUtils.isEmpty(number)) { |
| | | return 0; |
| | | } |
| | | return number; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据不同的等级获取不同区域子集合 |
| | | */ |
| | | public List<QueAreaDTO> listAreaByType(Object areaCode) { |
| | | log.info("listAreaByType {},{}", areaCode); |
| | | String parentId = "1601"; |
| | | if (ObjectUtils.isNotEmpty(areaCode)) { |
| | | parentId = String.valueOf(areaCode); |
| | | } |
| | | List<QueAreaDTO> queAreaDTOS = sysClient.listByParentId(parentId); |
| | | return queAreaDTOS; |
| | | } |
| | | |
| | | public Page<CasePageDTO> pagePerson(PageRequest page, Map<String, Object> terms,String certiNo) { |
| | | QueryWrapper<CasePerson> personWrapper = new QueryWrapper<>(); |
| | | personWrapper.select("case_id,certi_no"); |
| | | personWrapper.eq("certi_no", certiNo); |
| | | List<CasePerson> personList = personService.list(personWrapper); |
| | | List<String> ids = new ArrayList<>(); |
| | | if(ObjectUtils.isNotEmpty(personList)){ |
| | | for (CasePerson casePerson : personList) { |
| | | ids.add(casePerson.getCaseId()); |
| | | } |
| | | } |
| | | QueryWrapper<CaseAgent> agentWrapper = new QueryWrapper<>(); |
| | | agentWrapper.select("case_id,certi_no"); |
| | | agentWrapper.in("certi_no", certiNo); |
| | | List<CaseAgent> agentList = agentService.list(agentWrapper); |
| | | if(ObjectUtils.isNotEmpty(agentList)){ |
| | | for (CaseAgent caseAgent : agentList) { |
| | | ids.add(caseAgent.getCaseId()); |
| | | } |
| | | } |
| | | if(ObjectUtils.isEmpty(ids)){ |
| | | return new PageImpl<CasePageDTO>(new ArrayList<>(), page, 0); |
| | | } |
| | | terms.put("ids", ids); |
| | | long total = mapper.countTermsAll(terms); |
| | | List<CasePageDTO> content = mapper.pageTermsAll(page, terms); |
| | | if (ObjectUtils.isNotEmpty(content)) { |
| | | for (CasePageDTO casePageDTO : content) { |
| | | if(ObjectUtils.isNotEmpty(casePageDTO.getQueRoadName())){ |
| | | casePageDTO.setAreaName(casePageDTO.getQueRoadName()); |
| | | }else if(ObjectUtils.isNotEmpty(casePageDTO.getAreaName())){ |
| | | casePageDTO.setAreaName(casePageDTO.getAreaName()); |
| | | }else if(ObjectUtils.isNotEmpty(casePageDTO.getQueCityName())){ |
| | | casePageDTO.setAreaName(casePageDTO.getQueCityName()); |
| | | } |
| | | if(ObjectUtils.isNotEmpty(casePageDTO.getCaseLevel())){ |
| | | switch (casePageDTO.getCaseLevel()){ |
| | | case "1": |
| | | casePageDTO.setCaseLevel("一级"); |
| | | break; |
| | | case "2": |
| | | casePageDTO.setCaseLevel("二级"); |
| | | break; |
| | | case "3": |
| | | casePageDTO.setCaseLevel("三级"); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return new PageImpl<CasePageDTO>(content, page, total); |
| | | } |
| | | |
| | | public CasePersonCountBO countPerson(String certiNo){ |
| | | CasePersonCountBO casePersonCountBO = new CasePersonCountBO(); |
| | | |
| | | Integer plaintiffNum = 0;//申请方当事人数 |
| | | Integer defendantNum = 0;//被申请方当事人数 |
| | | Integer pagentsNum = 0;//申请方代理人数 |
| | | Integer dagentsNum = 0;//被申请方代理人数 |
| | | |
| | | List<CasePerson> personList = personService.listByCertiNo(certiNo); |
| | | List<String> ids = new ArrayList<>(); |
| | | if(ObjectUtils.isNotEmpty(personList)){ |
| | | for (CasePerson casePerson : personList) { |
| | | ids.add(casePerson.getCaseId()); |
| | | if(CaseBaseConstsEnum.PERSON_TYPE_1.getIndex().equals(casePerson.getPerType())){ |
| | | plaintiffNum++; |
| | | } |
| | | if(CaseBaseConstsEnum.PERSON_TYPE_2.getIndex().equals(casePerson.getPerType())){ |
| | | defendantNum++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<CaseAgent> agentList = agentService.listByCertiNo(certiNo); |
| | | if(ObjectUtils.isNotEmpty(agentList)){ |
| | | for (CaseAgent caseAgent : agentList) { |
| | | ids.add(caseAgent.getCaseId()); |
| | | if(CaseBaseConstsEnum.PERSON_TYPE_3.getIndex().equals(caseAgent.getPerType())){ |
| | | pagentsNum++; |
| | | } |
| | | if(CaseBaseConstsEnum.PERSON_TYPE_4.getIndex().equals(caseAgent.getPerType())){ |
| | | dagentsNum++; |
| | | } |
| | | } |
| | | } |
| | | casePersonCountBO.setDagentsNum(dagentsNum); |
| | | casePersonCountBO.setPagentsNum(pagentsNum); |
| | | casePersonCountBO.setDefendantNum(defendantNum); |
| | | casePersonCountBO.setPlaintiffNum(plaintiffNum); |
| | | casePersonCountBO.setTotalNum(ids.size()); |
| | | casePersonCountBO.setZzzxNum(ids.size()); |
| | | return casePersonCountBO; |
| | | } |
| | | |
| | | public List<CaseStatisticsTypeDTO> statisticsCaseType(Map<String, Object> terms,String userId){ |
| | | //根据用户筛选区域范围 |
| | | CtUnitDTO ctUnitDTO = custClient.getUnitByUserId(userId); |
| | | if(ctUnitDTO.getUnitGrade().equals(2)){ |
| | | terms.put("queArea", ctUnitDTO.getArea()); |
| | | }else if(ctUnitDTO.getUnitGrade().equals(3) || ctUnitDTO.getUnitGrade().equals(4)){ |
| | | terms.put("queRoad", ctUnitDTO.getRoad()); |
| | | } |
| | | if(ObjectUtils.isEmpty(terms.get("caseTypeFirst"))){ |
| | | //筛选一级为其他的纠纷类型 |
| | | List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsTypeFirst(terms); |
| | | if (ObjectUtils.isNotEmpty(caseStatisticsTypeDTOS)) { |
| | | sortType(caseStatisticsTypeDTOS); |
| | | } |
| | | int i = 1; |
| | | List<String> caseTypeList = new ArrayList<>(); |
| | | for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) { |
| | | if (i > 5) { |
| | | caseTypeList.add(caseStatisticsTypeDTO.getCaseType()); |
| | | } |
| | | i++; |
| | | } |
| | | if(ObjectUtils.isEmpty(caseTypeList)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | terms.put("caseTypeFirstList", caseTypeList); |
| | | } |
| | | List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsType(terms); |
| | | if (ObjectUtils.isNotEmpty(caseStatisticsTypeDTOS)) { |
| | | sortType(caseStatisticsTypeDTOS); |
| | | } |
| | | Integer typeTotalNum = 0; |
| | | for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) { |
| | | typeTotalNum = typeTotalNum + dellNull(caseStatisticsTypeDTO.getCaseNum()); |
| | | } |
| | | for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) { |
| | | caseStatisticsTypeDTO.setCaseRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsTypeDTO.getCaseNum() * 100, typeTotalNum, 1)); |
| | | } |
| | | return caseStatisticsTypeDTOS; |
| | | } |
| | | } |