| | |
| | | package com.gkhy.safePlatform.targetDuty.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gkhy.safePlatform.commons.co.ContextCacheUser; |
| | | import com.gkhy.safePlatform.targetDuty.entity.ExamineItem; |
| | | import com.gkhy.safePlatform.targetDuty.entity.TargetDivideDetail; |
| | | import com.gkhy.safePlatform.targetDuty.enums.TargetDutyResultCodes; |
| | | import com.gkhy.safePlatform.targetDuty.excepiton.TargetDutyException; |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.resp.ListCheckDataDto; |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.resp.TargetApproveDivideDetailDto; |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.resp.WorkApproveRelateDesc; |
| | | import com.gkhy.safePlatform.targetDuty.repository.TargetDivideDetailRepository; |
| | | import com.gkhy.safePlatform.targetDuty.repository.TargetDutyWorkApproveRepository; |
| | | import com.gkhy.safePlatform.targetDuty.entity.TargetDutyWorkApprove; |
| | | import com.gkhy.safePlatform.targetDuty.service.CommonService; |
| | |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.resp.TargetDutyWorkApproveDto; |
| | | import com.gkhy.safePlatform.targetDuty.utils.QueryHelpPlus; |
| | | import com.gkhy.safePlatform.commons.utils.BeanCopyUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.sql.Timestamp; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 目标责任管理工作流审批表(TargetDutyWorkApprove)表服务实现类 |
| | |
| | | |
| | | @Resource |
| | | private CommonService commonService; |
| | | |
| | | @Autowired |
| | | private TargetDivideDetailRepository targetDivideDetailRepository; |
| | | |
| | | |
| | | @Override |
| | |
| | | if (targetDutyWorkApprove.getRelateId()==null){ |
| | | throw new TargetDutyException(TargetDutyResultCodes.APPROVE_RELATE_TYPE_NULL); |
| | | } |
| | | // 关联业务json |
| | | if (!StringUtils.hasText(targetDutyWorkApprove.getRelateDesc())){ |
| | | throw new TargetDutyException("参数错误"); |
| | | } |
| | | // 审批人 |
| | | if (targetDutyWorkApprove.getApprovePersonId()==null){ |
| | | throw new TargetDutyException(TargetDutyResultCodes.APPROVE_PERSON_NULL); |
| | |
| | | ResultCodes.OK |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public TargetDutyWorkApproveDto selectOne(Serializable id) { |
| | | TargetDutyWorkApprove targetDutyWorkApprove = this.getById(id); |
| | | if(targetDutyWorkApprove == null){ |
| | | return new TargetDutyWorkApproveDto(); |
| | | } |
| | | |
| | | TargetDutyWorkApproveDto dto = BeanCopyUtils.copyBean(targetDutyWorkApprove, TargetDutyWorkApproveDto.class); |
| | | |
| | | List<WorkApproveRelateDesc> relateDescList = JSONObject.parseArray(targetDutyWorkApprove.getRelateDesc(),WorkApproveRelateDesc.class); |
| | | Map<Long,WorkApproveRelateDesc> relateDescMap = relateDescList.stream() |
| | | .collect(Collectors.toMap(WorkApproveRelateDesc::getId, Function.identity(),(k1, k2)->k1)); |
| | | |
| | | // |
| | | List<TargetDivideDetail> dList = targetDivideDetailRepository.selectBatchIds(relateDescMap.keySet()); |
| | | List<TargetApproveDivideDetailDto> divideDetailList = BeanCopyUtils.copyBeanList(dList, TargetApproveDivideDetailDto.class); |
| | | |
| | | divideDetailList.forEach(f->{ |
| | | WorkApproveRelateDesc relateDesc = relateDescMap.get(f.getId()); |
| | | if(relateDesc != null){ |
| | | f.setPersonId(relateDesc.getPersonId()); |
| | | f.setPersonName(relateDesc.getPersonName()); |
| | | f.setCommitValue(relateDesc.getValue()); |
| | | } |
| | | }); |
| | | |
| | | // --------------------------- 获取部门信息----------------------- |
| | | //收集所用到的部门ID |
| | | Set<Long> collectDepIdSet = new HashSet(); |
| | | divideDetailList.forEach(f->{ |
| | | collectDepIdSet.add(f.getDutyDepartmentId()); |
| | | collectDepIdSet.add(f.getMakerDepartmentId()); |
| | | }); |
| | | //获取部门名集合 |
| | | Map<Long,String> depNameMap = commonService.getDepName(collectDepIdSet); |
| | | |
| | | divideDetailList.forEach(f->{ |
| | | f.setDutyDepartmentName(depNameMap.get(f.getDutyDepartmentId())); |
| | | f.setMakerDepartmentName(depNameMap.get(f.getMakerDepartmentId())); |
| | | }); |
| | | |
| | | dto.setTargetDivideDetailList(divideDetailList); |
| | | return dto; |
| | | } |
| | | } |