Kaynağa Gözat

大屏定时任务相关接口开发

jichaobo 2 yıl önce
ebeveyn
işleme
84e3505cda

+ 9 - 10
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/BscEnterpriseScreenServiceImpl.java

@@ -109,7 +109,9 @@ public class BscEnterpriseScreenServiceImpl extends AbstractCrudService<BscEnter
             default:
                 throw new BusinessException("参数错误");
         }
-        queryWrapper.eq(BscEnterpriseScreen::getCompanyId, companyId);
+        queryWrapper.eq(BscEnterpriseScreen::getCompanyId, companyId)
+                .orderByDesc(BscEnterpriseScreen::getId)
+                .last(" limit 1");
         List<BscEnterpriseScreen> list = this.list(queryWrapper);
         Object data = null;
         if (CollectionUtils.isNotEmpty(list)) {
@@ -150,7 +152,7 @@ public class BscEnterpriseScreenServiceImpl extends AbstractCrudService<BscEnter
                 Object hiddenDangerStatistics = this.hiddenDangerStatistics(baseCompanies.get(i).getCompanyId());
                 Object buildScoreStatistics = this.buildScoreStatistics(baseCompanies.get(i).getCompanyId());
                 Object patrolInspectionStatistics = this.patrolInspectionStatistics(baseCompanies.get(i).getCompanyId());
-                List<BscEnterpriseScreen> list = this.bscEnterpriseScreenCount(baseCompanies.get(i).getCompanyId());
+//                List<BscEnterpriseScreen> list = this.bscEnterpriseScreenCount(baseCompanies.get(i).getCompanyId());
                 BscEnterpriseScreen bscEnterpriseScreen = new BscEnterpriseScreen();
                 bscEnterpriseScreen.setCompanyId(baseCompanies.get(i).getCompanyId());
                 bscEnterpriseScreen.setCreateTime(LocalDateTime.now());
@@ -160,12 +162,7 @@ public class BscEnterpriseScreenServiceImpl extends AbstractCrudService<BscEnter
                 bscEnterpriseScreen.setReservePlan(JSON.toJSONString(reservePlanStatistics));
                 bscEnterpriseScreen.setHiddenDanger(JSON.toJSONString(hiddenDangerStatistics));
                 bscEnterpriseScreen.setBuildScore(JSON.toJSONString(buildScoreStatistics));
-                if (CollectionUtils.isNotEmpty(list)) {
-                    bscEnterpriseScreen.setId(list.get(0).getId());
-                    this.updateById(bscEnterpriseScreen);
-                } else {
-                    this.save(bscEnterpriseScreen);
-                }
+                this.save(bscEnterpriseScreen);
             }
             SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
             long timeStamp = OnlineMethod.getLastPeroid(2, new Date());
@@ -196,7 +193,7 @@ public class BscEnterpriseScreenServiceImpl extends AbstractCrudService<BscEnter
     }
 
     @Override
-    public List<DataVo> Alarmlist(){
+    public List<DataVo> Alarmlist() {
         List<DataVo> list = new ArrayList<>();
         List<DataVo> alarmlist = alarmElectricalFireService.Alarmlist();
         List<DataVo> alarmlist1 = alarmFireService.Alarmlist();
@@ -236,7 +233,9 @@ public class BscEnterpriseScreenServiceImpl extends AbstractCrudService<BscEnter
     public List<BscEnterpriseScreen> bscEnterpriseScreenCount(String companyId) {
         LambdaQueryWrapper<BscEnterpriseScreen> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.select(BscEnterpriseScreen::getId, BscEnterpriseScreen::getBuildScore)
-                .eq(BscEnterpriseScreen::getCompanyId, companyId);
+                .eq(BscEnterpriseScreen::getCompanyId, companyId)
+                .orderByDesc(BscEnterpriseScreen::getId)
+                .last(" limit 1");
         List<BscEnterpriseScreen> list = this.list(queryWrapper);
         return list;
     }