shenyijian
2024-09-14 2d7e6f8dcfc803b2a018d1437e9c47f35a47f0d2
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/service/impl/SgProgressReportServiceImpl.java
@@ -238,8 +238,10 @@
      SgDeviceDO sgDeviceDO = new SgDeviceDO();
      if (gxDeviceId == 999){
          deviceType = "sgzb";
         sgReportUserMapper.insert(SgReportUserDO.builder().reportId(sgProgressReportDO.getId()).roleId(Long.parseLong("1811657352658042882")).approvalStatus(0).approvalOrder(1).build());
      }else if(gxDeviceId == 998){
         deviceType = "sgys";
         sgReportUserMapper.insert(SgReportUserDO.builder().reportId(sgProgressReportDO.getId()).roleId(Long.parseLong("1811657352658042882")).approvalStatus(0).approvalOrder(1).build());
      }else {
          sgDeviceDO = sgDeviceMapper.selectById(gxDeviceId);
         deviceType = sgDeviceDO.getDeviceType();
@@ -329,12 +331,14 @@
      SgProgressReportDO sgProgressReportDOS1 = sgProgressReportMapper.selectOne(wrappers);
      //判断当前用户的角色是不是   工序配置的审核的角色
      List<SgGxConfigDO> sgGxConfigDOS = new LambdaQueryChainWrapper<>(sgGxConfigMapper)
         .eq(SgGxConfigDO::getGxDeviceType, sgProgressReportDOS1.getDeviceType()).eq(SgGxConfigDO::getGxStepId, sgProgressReportDOS1.getGxStepId()).orderByAsc(SgGxConfigDO::getSgOrder).list();
      List<String> roIds = sgGxConfigDOS.stream().map(SgGxConfigDO::getRoleId).collect(Collectors.toList());
      if (CollectionUtils.isEmpty(roIds)){
         throw new ServiceException("请完成工序角色配置!");
      Long gxDeviceId = sgProgressReportDOS1.getGxDeviceId();
      if (gxDeviceId != 998 && gxDeviceId != 999) {
         List<SgGxConfigDO> sgGxConfigDOS = new LambdaQueryChainWrapper<>(sgGxConfigMapper)
            .eq(SgGxConfigDO::getGxDeviceType, sgProgressReportDOS1.getDeviceType()).eq(SgGxConfigDO::getGxStepId, sgProgressReportDOS1.getGxStepId()).orderByAsc(SgGxConfigDO::getSgOrder).list();
         List<String> roIds = sgGxConfigDOS.stream().map(SgGxConfigDO::getRoleId).collect(Collectors.toList());
         if (CollectionUtils.isEmpty(roIds)){
            throw new ServiceException("请完成工序角色配置!");
         }
      }
      SgProgressReportDO sgProgressReportDO = sgProgressReportMapper.selectById(id);
      List<SgReportUserDO> sgReportUserDOS = new LambdaQueryChainWrapper<>(sgReportUserMapper).eq(SgReportUserDO::getReportId, id).ne(SgReportUserDO::getApprovalOrder,0).eq(SgReportUserDO::getIsHis,0)
@@ -498,19 +502,56 @@
   @Override
   public List<SgProgressReportVO> queryList(ProjectSearchDTO searchDTO) {
      BladeUser user = AuthUtil.getUser();
      //Long userId = user.getUserId();
      searchDTO.setUserUnit(Long.parseLong(user.getDeptId()));
      if(!user.getRoleId().equals("1811657352658042882")){
         searchDTO.setUserUnit(Long.parseLong(user.getDeptId()));
      }
      searchDTO.setRoleUnit(Long.parseLong(user.getRoleId()));
      //searchDTO.setUserId(userId);
      List<SgProgressReportVO> list = sgProgressReportMapper.queryList(searchDTO);
      if(list != null){
         list.forEach(s ->{
            List<String> resultUsers=new ArrayList<>();
            if(s.getControlUnit()!=null){
               String controlUnit = s.getControlUnit();
               List<String> users=sgProjectInfoMapper.getUserS(controlUnit);
               resultUsers.addAll(users);
            }
//            if(s.getSelfUnit()!=null){
//               String selfUnit = s.getSelfUnit().toString();
//               List<String> selfUnitusers=sgProjectInfoMapper.getUserS(selfUnit);
//               resultUsers.addAll(selfUnitusers);
//            }
            s.setUserIDs(resultUsers);
            String gxStepName = s.getGxStepName();
            String countyCd = s.getCountyCd();
            if("测量定位".equals(gxStepName)){
               if(countyCd!=null){
                  List<String> xbUnitIDs=sgProjectInfoMapper.getUserS(countyCd);
                  s.setXbUnitIDs(xbUnitIDs);
               }
            }
         });
      }
      return list;
   }
   @Override
   public Map<String, Long> countList(ProjectSearchDTO searchDTO) {
      BladeUser user = AuthUtil.getUser();
      //Long userId = user.getUserId();
      searchDTO.setUserUnit(Long.parseLong(user.getDeptId()));
      if(!user.getRoleId().equals("1811657352658042882")){
         searchDTO.setUserUnit(Long.parseLong(user.getDeptId()));
      }
      searchDTO.setRoleUnit(Long.parseLong(user.getRoleId()));
      //searchDTO.setUserId(userId);
      //searchDTO.setAuditPerson(userId.toString());
@@ -587,13 +628,47 @@
   @Override
   public IPage<SgProgressReportVO> progressPage(IPage<SgProgressReportVO> page, ProjectSearchDTO searchDTO) {
      BladeUser user = AuthUtil.getUser();
      //Long userId = user.getUserId();
      searchDTO.setUserUnit(Long.parseLong(user.getDeptId()));
      //判断是不是县级建办  否的话就是监理单位下人员进行
      if(!user.getRoleId().equals("1811657352658042882")){
         searchDTO.setUserUnit(Long.parseLong(user.getDeptId()));
      }
      searchDTO.setRoleUnit(Long.parseLong(user.getRoleId()));
//      if (searchDTO.getApprovalStatus()!=null && searchDTO.getApprovalStatus() ==0){
//         searchDTO.setAuditPerson(String.valueOf(userId));
//      }
      List<SgProgressReportVO> list = sgProgressReportMapper.queryList(page, searchDTO);
      if(list != null){
         list.forEach(s ->{
            List<String> resultUsers=new ArrayList<>();
            if(s.getControlUnit()!=null){
               String controlUnit = s.getControlUnit();
               List<String> users=sgProjectInfoMapper.getUserS(controlUnit);
               resultUsers.addAll(users);
            }
//            if(s.getSelfUnit()!=null){
//               String selfUnit = s.getSelfUnit().toString();
//               List<String> selfUnitusers=sgProjectInfoMapper.getUserS(selfUnit);
//               resultUsers.addAll(selfUnitusers);
//            }
            s.setUserIDs(resultUsers);
            String gxStepName = s.getGxStepName();
            String countyCd = s.getCountyCd();
            if("测量定位".equals(gxStepName)){
               if(countyCd!=null){
                  List<String> xbUnitIDs=sgProjectInfoMapper.getUserS(countyCd);
                  s.setXbUnitIDs(xbUnitIDs);
               }
            }
         });
      }
      return page.setRecords(list);
   }