shenyijian
2024-10-10 af2a7128e2c74689f3728233842bbaea69417354
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/service/impl/SgProgressReportServiceImpl.java
@@ -64,6 +64,9 @@
   @Autowired
   private SgProjectInfoServiceImpl sgProjectInfoService;
   @Autowired
   private SgGxMapper sgGxMapper;
   ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
@@ -106,6 +109,10 @@
   }
   @Override
   public IPage<SgProgressReportVO> queryPageListAll(IPage<SgProgressReportVO> page, ProjectSearchDTO searchDTO) {
      if (StringUtils.isNotBlank(searchDTO.getTypeName())){
         List<String> childType = sgGxMapper.childType(searchDTO.getTypeName());
         searchDTO.setChildTypeList(childType);
      }
      List<SgProgressReportVO> list = sgProgressReportMapper.queryPageListAll(page,searchDTO);
      if(list != null){
         list.forEach(s ->{
@@ -187,22 +194,24 @@
      }
      if (sgProgressReportDOS1!= null && sgProgressReportDOS1.size() > 0) {
         for (SgProgressReportDO sgProgressReportDO1 : sgProgressReportDOS1) {
            if (sgProgressReportDO1.getStatus()!= 2 && sgProgressReportDO1.getStatus()!= 3)  {
               throw new ServiceException("请先完成施工准备的审批!");
            }
         }
      } else if (sgProgressReportDOS1 == null || (!sgProgressReportDO.getGxStepName().equals("施工准备"))) {
         throw new ServiceException("请先发起施工准备的审批!");
      }
//      if (sgProgressReportDOS1!= null && sgProgressReportDOS1.size() > 0) {
//         for (SgProgressReportDO sgProgressReportDO1 : sgProgressReportDOS1) {
//            if (sgProgressReportDO1.getStatus()!= 2 && sgProgressReportDO1.getStatus()!= 3)  {
//               throw new ServiceException("请先完成施工准备的审批!");
//            }
//         }
//      } else if (sgProgressReportDOS1 == null || (!sgProgressReportDO.getGxStepName().equals("施工准备"))) {
//         throw new ServiceException("请先发起施工准备的审批!");
//      }
      Long gxDeviceId = sgProgressReportDO.getGxDeviceId();
      Long gxStepId = sgProgressReportDO.getGxStepId();
      SgGxStepDO sgGxStepDO = sgGxStepMapper.selectById(gxStepId);
      List<SgGxStepDO> list = sgGxStepMapper.selectByGxInfoId(sgGxStepDO.getGxInfoId());
      QueryWrapper<SgProgressReportDO> wrapper = new QueryWrapper<>();
      wrapper.in("status",Arrays.asList(0,1,2,3));
      if(sgProgressReportDO.getGxDeviceId()==998 || sgProgressReportDO.getGxDeviceId()==999){
      if(sgProgressReportDO.getGxDeviceId()==998
         //|| sgProgressReportDO.getGxDeviceId()==999
      ){
         wrapper.eq("gx_step_id", gxStepId).eq("gx_device_id",gxDeviceId).ne("status",4).eq("profram_id",sgProgressReportDO.getProframId());
      }else {
         wrapper.eq("gx_step_id", gxStepId).eq("gx_device_id",gxDeviceId).ne("status",4);
@@ -237,10 +246,11 @@
      sgProgressReportMapper.insert(sgProgressReportDO);
      String deviceType ="";
      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){
//      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 {
@@ -275,7 +285,8 @@
      }
      //加个项目及设备的状态判断 方便统计计算
      if(gxStepId != 25 && gxStepId != 26 ) {
      if(//gxStepId != 25 &&
         gxStepId != 26 ) {
         if (sgDeviceDO != null && sgDeviceDO.getStatus() == 0) {
            sgDeviceDO.setStatus(1);
            sgDeviceMapper.updateById(sgDeviceDO);
@@ -577,6 +588,10 @@
   @Override
   public Map<String, Long> countListAll(ProjectSearchDTO searchDTO) {
      if (StringUtils.isNotBlank(searchDTO.getTypeName())){
         List<String> childType = sgGxMapper.childType(searchDTO.getTypeName());
         searchDTO.setChildTypeList(childType);
      }
      List<SgProgressReportVO> list = sgProgressReportMapper.queryPageListAll(null, searchDTO);
      Map<String, Long> map = new HashMap<>();
      getStatusCountByList(list, map);