| | |
| | | package com.gkhy.safePlatform.targetDuty.service.impl; |
| | | import java.sql.Timestamp; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.metadata.OrderItem; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepInfoRPCRespDTO; |
| | | import com.gkhy.safePlatform.targetDuty.entity.ExamineItem; |
| | | import com.gkhy.safePlatform.targetDuty.entity.TargetDutyWorkApprove; |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.req.TargetCheckAndSubmitQueryCriteria; |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.req.TargetDivideDetailQueryCriteria; |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.resp.TargetCheckAndSubmitDto; |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.resp.TargetDivideDetailDto; |
| | | import com.gkhy.safePlatform.targetDuty.repository.TargetDutyWorkApproveRepository; |
| | | import com.gkhy.safePlatform.targetDuty.repository.TargetMngRepository; |
| | | import com.gkhy.safePlatform.targetDuty.entity.TargetMng; |
| | | import com.gkhy.safePlatform.targetDuty.service.CommonService; |
| | |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.resp.TargetMngDto; |
| | | import com.gkhy.safePlatform.targetDuty.utils.QueryHelpPlus; |
| | | import com.gkhy.safePlatform.commons.utils.BeanCopyUtils; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | |
| | | private TargetDivideDetailService targetDivideDetailService; |
| | | |
| | | @Resource |
| | | private TargetDutyWorkApproveRepository targetDutyWorkApproveRepository; |
| | | |
| | | @Resource |
| | | private CommonService commonService; |
| | | |
| | | |
| | | @Override |
| | | public ResultVO queryAll(PageQuery<TargetMngQueryCriteria> pageQuery) { |
| | | Long pageIndex = pageQuery.getPageIndex(); |
| | |
| | | page = baseMapper.selectPage(page, |
| | | QueryHelpPlus.getPredicate(TargetMng.class, pageQuery.getSearchParams())); |
| | | List<TargetMngDto> respList = BeanCopyUtils.copyBeanList(page.getRecords(), TargetMngDto.class); |
| | | respList.forEach(dto->{ |
| | | //查询关联分解信息 |
| | | TargetDivideDetailQueryCriteria criteria = new TargetDivideDetailQueryCriteria(); |
| | | criteria.setTargetId(dto.getId()); |
| | | List<TargetDivideDetailDto> respList1 = BeanCopyUtils.copyBeanList(targetDivideDetailService.queryAll(criteria), TargetDivideDetailDto.class); |
| | | |
| | | // --------------------------- 获取部门信息----------------------- |
| | | //收集所用到的部门ID |
| | | Set<Long> collectDepIdSet = new HashSet(); |
| | | respList1.forEach(f->{ |
| | | collectDepIdSet.add(f.getDutyDepartmentId()); |
| | | collectDepIdSet.add(f.getMakerDepartmentId()); |
| | | }); |
| | | //获取部门名集合 |
| | | Map<Long,String> depNameMap = commonService.getDepName(collectDepIdSet); |
| | | |
| | | respList1.forEach(f->{ |
| | | f.setDutyDepartmentName(depNameMap.get(f.getDutyDepartmentId())); |
| | | f.setMakerDepartmentName(depNameMap.get(f.getMakerDepartmentId())); |
| | | }); |
| | | |
| | | |
| | | dto.setTargetDivideDetailList(respList1); |
| | | }); |
| | | |
| | | return new SearchResultVO<>( |
| | | true, |
| | |
| | | return targetMngDto; |
| | | } |
| | | |
| | | @Override |
| | | public ResultVO queryAll(Long uid, PageQuery<TargetCheckAndSubmitQueryCriteria> pageQuery) { |
| | | Long pageIndex = pageQuery.getPageIndex(); |
| | | Long pageSize = pageQuery.getPageSize(); |
| | | Page<TargetMng> page = new Page<>(pageIndex, pageSize); |
| | | |
| | | } |
| | | page = baseMapper.selectPage(page, |
| | | QueryHelpPlus.getPredicate(TargetMng.class, pageQuery.getSearchParams())); |
| | | List<TargetCheckAndSubmitDto> respList = BeanCopyUtils.copyBeanList(page.getRecords(), TargetCheckAndSubmitDto.class); |
| | | |
| | | // 判断审批人 |
| | | respList.forEach(dto->{ |
| | | List<TargetDutyWorkApprove> list = targetDutyWorkApproveRepository.selectList( |
| | | new QueryWrapper<TargetDutyWorkApprove>().eq("del_flag",0) |
| | | .eq("relate_type",pageQuery.getSearchParams().getTargetType()) |
| | | .eq("relate_id",dto.getId()) |
| | | .orderByDesc("sort")); |
| | | |
| | | if (!CollectionUtils.isEmpty(list)) { |
| | | dto.setApproveId(list.get(0).getId()); |
| | | dto.setApproveStatus(list.get(0).getApproveStatus()); |
| | | dto.setApprovePersonId(list.get(0).getApprovePersonId()); |
| | | // 审批中 判断审批人是否人与当前登录人 |
| | | if (dto.getApproveStatus()!=null && dto.getApproveStatus()==2){ |
| | | dto.setCheckApprove(dto.getApprovePersonId().equals(uid)); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return new SearchResultVO<>( |
| | | true, |
| | | pageIndex, |
| | | pageSize,page.getPages(), |
| | | page.getTotal(), |
| | | respList, |
| | | ResultCodes.OK |
| | | ); |
| | | } |
| | | |
| | | |
| | | } |