|
|
@@ -343,40 +343,40 @@ public class VehicleSyncTask {
|
|
343
|
343
|
* 更新指标信息
|
|
344
|
344
|
* 根据公司去查询
|
|
345
|
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
|
|
- }
|
|
|
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
|
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
|
|
- }
|
|
|
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
|
382
|
}
|