| | |
| | | import cn.huge.base.common.exception.ServiceException; |
| | | import cn.huge.base.common.utils.DateUtils; |
| | | import cn.huge.base.common.utils.IdUtils; |
| | | import cn.huge.module.cases.domain.dto.QuiltUnitDTO; |
| | | 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.sys.dto.FileInfoBaseDTO; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | /** |
| | | * 添加督办 |
| | | * @param caseSupervise 实体对象 |
| | | * @param userId 用户信息编号 |
| | | */ |
| | | public void addCaseSupervise(CaseSupervise caseSupervise, String userId){ |
| | | try{ |
| | | // 获取当前登录用户 |
| | | CtUserDTO loginUser = custClient.clientGetUserAll(userId); |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | caseSupervise.setSupUserId(loginUser.getId()); |
| | | caseSupervise.setSupUserName(loginUser.getTrueName()); |
| | | caseSupervise.setSupTime(nowDate); |
| | | caseSupervise.setSupStatus(0); |
| | | caseSupervise.setCreateTime(nowDate); |
| | | caseSupervise.setUpdateTime(nowDate); |
| | | //todo 配置时限 |
| | | Integer timeTerm = sysClient.getTimeLimit("dyh_case_supervise", SyTimeEnum.SY_TIME_03.getIndex()); |
| | | caseSupervise.setReplyTerm(timeTerm); |
| | | this.save(caseSupervise); |
| | | List<QuiltUnitDTO> quiltUnitDTOList = caseSupervise.getQuiltUnitDTOList(); |
| | | Integer timeTerm = sysClient.getTimeLimit("dyh_case_supervise", SyTimeEnum.SY_TIME_5.getIndex()); |
| | | List<CaseSupervise> caseSuperviseList = new ArrayList<>(); |
| | | for(QuiltUnitDTO quiltUnitDTO: quiltUnitDTOList){ |
| | | CaseSupervise caseSuperviseNew = new CaseSupervise(); |
| | | BeanUtils.copyProperties(caseSupervise, caseSuperviseNew); |
| | | // 获取当前登录用户 |
| | | CtUserDTO loginUser = custClient.clientGetUserAll(userId); |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | caseSuperviseNew.setSupUserId(loginUser.getId()); |
| | | caseSuperviseNew.setSupUserName(loginUser.getTrueName()); |
| | | caseSuperviseNew.setSupUnitId(loginUser.getUnitId()); |
| | | caseSuperviseNew.setSupUnitId(loginUser.getUnitName()); |
| | | caseSuperviseNew.setSupTime(nowDate); |
| | | caseSuperviseNew.setQuiltUnitId(quiltUnitDTO.getQuiltUnitId()); |
| | | caseSuperviseNew.setQuiltUnitName(quiltUnitDTO.getQuiltUnitName()); |
| | | caseSuperviseNew.setSupStatus(0); |
| | | caseSuperviseNew.setCreateTime(nowDate); |
| | | caseSuperviseNew.setUpdateTime(nowDate); |
| | | caseSuperviseNew.setReplyTerm(timeTerm); |
| | | caseSuperviseList.add(caseSuperviseNew); |
| | | } |
| | | this.saveBatch(caseSuperviseList); |
| | | }catch (Exception e){ |
| | | log.error("[CaseSuperviseService.saveCaseSupervise]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("CaseSuperviseService.saveCaseSupervise", e); |
| | |
| | | * 流转办理-督办列表 |
| | | * @param caseId 事项Id |
| | | */ |
| | | public Map<String, Object> listCaseSupervise(String caseId){ |
| | | public Page<CaseSupervise> pageCaseSupervise(String caseId, PageRequest page, int supStatus, String userId){ |
| | | try{ |
| | | List<CaseSupervise> repliedList = new ArrayList<>(); |
| | | List<CaseSupervise> noReplyList = new ArrayList<>(); |
| | | QueryWrapper<CaseSupervise> caseSuperviseQueryWrapper = new QueryWrapper<>(); |
| | | caseSuperviseQueryWrapper.eq("case_id", caseId); |
| | | List<CaseSupervise> caseSuperviseList = mapper.selectList(caseSuperviseQueryWrapper); |
| | | CtUserDTO loginUser = custClient.clientGetUserAll(userId); |
| | | String quiltUnitId = loginUser.getUnitId(); |
| | | long countSuperviseList = mapper.countCaseSupervise(caseId, supStatus, quiltUnitId); |
| | | List<CaseSupervise> caseSuperviseList = mapper.pageCaseSupervise(caseId, page, supStatus, quiltUnitId); |
| | | |
| | | Map<String, Object>map = new HashMap<>(); |
| | | map.put("mainId", caseId); |
| | | map.put("ownerIds", caseSuperviseList.stream().map(CaseSupervise::getId).collect(Collectors.joining("','"))); |
| | | map.put("types", FileOwnerTypeBaseEnum.OWNER_TYPE_506.getIndex()); |
| | | List<FileIdTypeInfoBaseDTO> fileIdTypeInfoBaseDTOList = sysClient.listIdTypeInfoByOwnerIdList(map, caseId); |
| | | List<FileIdTypeInfoBaseDTO> fileIdTypeInfoBaseDTOList = sysClient.listIdTypeInfoByOwnerIdList(map); |
| | | for(CaseSupervise caseSupervise: caseSuperviseList){ |
| | | for(FileIdTypeInfoBaseDTO fileIdTypeInfoBaseDTO: fileIdTypeInfoBaseDTOList){ |
| | | if(caseSupervise.getId().equals(fileIdTypeInfoBaseDTO.getOwnerId())){ |
| | | caseSupervise.setFileInfoList(fileIdTypeInfoBaseDTO.getFileList()); |
| | | } |
| | | } |
| | | if(0 == caseSupervise.getSupStatus()){ |
| | | noReplyList.add(caseSupervise); |
| | | }else if(1 == caseSupervise.getSupStatus()){ |
| | | repliedList.add(caseSupervise); |
| | | } |
| | | } |
| | | int count = noReplyList.size(); |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("count", count); |
| | | result.put("noReplyList", noReplyList); |
| | | result.put("repliedList", repliedList); |
| | | return result; |
| | | return new PageImpl<CaseSupervise>(caseSuperviseList, page, countSuperviseList); |
| | | }catch (Exception e){ |
| | | log.error("[CaseSuperviseService.listCaseSupervise]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("CaseSuperviseService.listCaseSupervise", e); |
| | | log.error("[CaseSuperviseService.pageReplied]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("CaseSuperviseService.pageReplied", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 首页-督办 |
| | | * @param page |
| | | * @param terms |
| | | */ |
| | | public Page<CaseSupervise> pageMyTaskDb(PageRequest page, Map<String, Object> terms){ |
| | | try{ |
| | | long countSuperviseList = mapper.countMyTaskDb(terms); |
| | | List<CaseSupervise> caseSuperviseList = mapper.pageMyTaskDb(page, terms); |
| | | return new PageImpl<CaseSupervise>(caseSuperviseList, page, countSuperviseList); |
| | | }catch (Exception e){ |
| | | log.error("[CaseSuperviseService.pageReplied]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("CaseSuperviseService.pageReplied", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询督办数量 |
| | | * @param supStatus 回复状态 |
| | | * @param quiltUnitId 被督办组织编号 |
| | | * @return long |
| | | */ |
| | | public long countCaseSuperviseList(Integer supStatus, String quiltUnitId){ |
| | | return mapper.countCaseSuperviseList(supStatus, quiltUnitId); |
| | | } |
| | | } |