瀏覽代碼

'优化产品信息-分页接口中的条件判断逻辑'

james 1 年之前
父節點
當前提交
2e01a44f82

+ 13 - 1
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/TaskController.java

@@ -4,18 +4,23 @@ import com.usky.iot.service.BaseAlarmService;
 import com.usky.iot.service.CrmCustomInfoService;
 import com.usky.iot.service.DmpDeviceStatusService;
 import com.usky.iot.service.job.DmpDataOverviewJob;
+import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import java.beans.Beans;
+
 /**
  * @author zyj
  * @since 2023-06-05
  */
 @EnableScheduling
 @Component
-public class TaskController {
+public class TaskController implements ApplicationContextAware {
     @Autowired
     private DmpDataOverviewJob dmpDataOverviewJob;
 
@@ -25,6 +30,13 @@ public class TaskController {
     @Autowired
     private CrmCustomInfoService crmCustomInfoService;
 
+    private static ApplicationContext context;
+
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException{
+        context = applicationContext;
+    }
+
     @Scheduled(cron = "0 0 1 * * ? ") //每天凌晨1点执行
     public void task() {
         System.out.println(Thread.currentThread().getName() + "定时任务执行中");

+ 2 - 2
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpProductInfoServiceImpl.java

@@ -155,7 +155,7 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
             for(int i=0;i<records.size();i++){
                 if(maps.size()>0){
                     for(int j=0;j<maps.size();j++){
-                        if(maps.get(j).get("productId")==(records.get(i).getId())){
+                        if(Integer.parseInt(maps.get(j).get("productId").toString())==(records.get(i).getId())){
                             String coun = maps.get(j).get("count").toString();
                             Integer it = Integer.parseInt(maps.get(j).get("count").toString());
                             records.get(i).setDeviceCount(Integer.parseInt(maps.get(j).get("count").toString()));
@@ -166,7 +166,7 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
                 }
                 if(collectByProduct.size()>0){
                     for(int j=0;j<collectByProduct.size();j++){
-                        if(collectByProduct.get(j).get("productId")==(records.get(i).getId())){
+                        if(Integer.parseInt(collectByProduct.get(j).get("productId").toString())==(records.get(i).getId())){
                             records.get(i).setDeviceStatusCount(Integer.parseInt(collectByProduct.get(j).get("deviceCount").toString()));
                             continue;
                         }