瀏覽代碼

refactor: remove dead code from VehicleSyncTask

- Remove unused service fields (sysWorkorderService, sysIndicatorsService, sysCompanyService)
- Remove commented-out insertIndicators() method
- Remove unused imports (SysCompany, LocalDate, DateTimeFormatter, @Autowired)
- Clean constructor to only keep actively used dependencies
mqy20260511
humanleft 3 天之前
父節點
當前提交
ebc7ce0564
共有 1 個檔案被更改,包括 0 行新增52 行删除
  1. 0
    52
      iot-platform/src/main/java/com/iot/platform/task/VehicleSyncTask.java

+ 0
- 52
iot-platform/src/main/java/com/iot/platform/task/VehicleSyncTask.java 查看文件

@@ -1,14 +1,12 @@
1 1
 package com.iot.platform.task;
2 2
 
3 3
 import com.iot.platform.domain.SysCar;
4
-import com.iot.platform.domain.SysCompany;
5 4
 import com.iot.platform.domain.SysDevice;
6 5
 import com.iot.platform.domain.SysDeviceControl;
7 6
 import com.iot.platform.config.IotProperties;
8 7
 import com.iot.platform.service.*;
9 8
 import org.slf4j.Logger;
10 9
 import org.slf4j.LoggerFactory;
11
-import org.springframework.beans.factory.annotation.Autowired;
12 10
 import org.springframework.dao.DataAccessException;
13 11
 import org.springframework.data.redis.RedisConnectionFailureException;
14 12
 import org.springframework.data.redis.core.RedisCallback;
@@ -19,8 +17,6 @@ import org.springframework.stereotype.Component;
19 17
 import org.springframework.web.client.RestClientException;
20 18
 import org.springframework.web.client.RestTemplate;
21 19
 
22
-import java.time.LocalDate;
23
-import java.time.format.DateTimeFormatter;
24 20
 import java.util.*;
25 21
 import java.util.concurrent.TimeUnit;
26 22
 
@@ -35,13 +31,9 @@ public class VehicleSyncTask {
35 31
     private final SysrealtimeService sysrealtimeService;
36 32
     private final SysDeviceVoService sysDeviceVoService;
37 33
     private final SysDeviceControlService sysDeviceControlService;
38
-    private final SysWorkorderService sysWorkorderService;
39
-    private final SysIndicatorsService sysIndicatorsService;
40
-    private final SysCompanyService sysCompanyService;
41 34
     private final RestTemplate restTemplate;
42 35
     private final IotProperties iotProperties;
43 36
 
44
-    @Autowired
45 37
     public VehicleSyncTask(SysCarService sysCarService,
46 38
                            SysDeviceService sysDeviceService,
47 39
                            StringRedisTemplate stringRedisTemplate,
@@ -59,9 +51,6 @@ public class VehicleSyncTask {
59 51
         this.sysrealtimeService = sysrealtimeService;
60 52
         this.sysDeviceVoService = sysDeviceVoService;
61 53
         this.sysDeviceControlService = sysDeviceControlService;
62
-        this.sysWorkorderService = sysWorkorderService;
63
-        this.sysIndicatorsService = sysIndicatorsService;
64
-        this.sysCompanyService = sysCompanyService;
65 54
         this.restTemplate = restTemplate;
66 55
         this.iotProperties = iotProperties;
67 56
     }
@@ -338,45 +327,4 @@ public class VehicleSyncTask {
338 327
         Object val = map.get(key);
339 328
         return val == null ? null : val.toString().trim();
340 329
     }
341
-
342
-    /**
343
-     * 更新指标信息
344
-     * 根据公司去查询
345
-     */
346
-//    @Scheduled(fixedDelay = 30000)
347
-//    public void insertIndicators() {
348
-//        String lockKey = "lock:vehicle-sync:insertIndicators";
349
-//        if (!tryLock(lockKey, 60)) {
350
-//            log.debug("获取锁失败,跳过本次执行: {}", lockKey);
351
-//            return;
352
-//        }
353
-//        try {
354
-//            doInsertIndicators();
355
-//        } finally {
356
-//            unlock(lockKey);
357
-//        }
358
-//    }
359
-
360
-//    private void doInsertIndicators() {
361
-//        try {
362
-//            LocalDate today = LocalDate.now();
363
-//            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
364
-//            String day = today.format(formatter);
365
-//            List<SysCompany> sysCompanyList = sysCompanyService.selectcompany();
366
-//            for (SysCompany sysCompany : sysCompanyList) {
367
-//                Integer countworkorder = sysWorkorderService.selectworkordercount(sysCompany.getCompanyId(), day);
368
-//                Double countprofit = sysWorkorderService.selectwokroderprofit(sysCompany.getCompanyId(), day);
369
-//                Integer count = sysIndicatorsService.selectcarcount(sysCompany.getCompanyId(), day);
370
-//                if (count <= 0) {
371
-//                    sysIndicatorsService.insertindicators(countworkorder, countprofit, sysCompany.getCompanyId(), day);
372
-//                } else {
373
-//                    sysIndicatorsService.updateindicators(countworkorder, countprofit, sysCompany.getCompanyId(), day);
374
-//                }
375
-//            }
376
-//        } catch (DataAccessException e) {
377
-//            log.error("数据库操作失败: {}", e.getMessage(), e);
378
-//        } catch (Exception e) {
379
-//            log.error("更新指标信息失败: {}", e.getMessage(), e);
380
-//        }
381
-//    }
382 330
 }

Loading…
取消
儲存