Преглед на файлове

定时任务并发处理

wangli преди 4 години
родител
ревизия
77ec697f5d

+ 0 - 5
smart-city-platform/src/main/java/com/bz/smart_city/quartz/job/OpenAccountValveInspection.java

@@ -41,13 +41,9 @@ public class OpenAccountValveInspection  implements InitializingBean, Job, Seria
     @Autowired
     private PayFeeService payFeeService;
 
-    @Resource
-    private PayControlRecordMapper payControlRecordMapper;
-
     @Override
     public void execute(JobExecutionContext context) throws JobExecutionException {
         log.info("巡检开户开阀操作开始:"+ LocalDateTime.now());
-        synchronized (this){
             try {
                 List<PayValveStateInfoDto> payValveStateInfos = payFeeMapper.getDeviceValveStateByRecord();
                 if(payValveStateInfos.size() > 0){
@@ -61,7 +57,6 @@ public class OpenAccountValveInspection  implements InitializingBean, Job, Seria
             } catch (Exception e){
                 e.printStackTrace();
             }
-        }
         log.info("巡检开户开阀操作结束:"+ LocalDateTime.now());
     }
 

+ 2 - 8
smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/impl/ControlDayServiceImpl.java

@@ -40,16 +40,10 @@ import java.util.List;
 @Slf4j
 @Component
 public class ControlDayServiceImpl implements ControlDayService {
-    @Resource
-    private AmountWaterUsedAmountMapper amountWaterUsedAmountMapper;
-    @Resource
-    PayBaseCustomerandmeterrelaMapper payBaseCustomerandmeterrelaMapper;
+
     @Resource
     PayControlRecordMapper payControlRecordMapper;
-    @Resource
-    private JobAndTriggerService jobAndTriggerService;
-    @Resource
-    CustomerMapper  customerMapper;
+
     @Autowired
     PayControlRecordService payControlRecordService;
 

+ 1 - 0
smart-city-platform/src/main/resources/application-dev.properties

@@ -126,6 +126,7 @@ spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThre
 spring.quartz.properties.org.quartz.threadPool.threadCount=10
 spring.quartz.properties.org.quartz.threadPool.threadPriority=5
 spring.quartz.properties.org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
+spring.quartz.properties.org.quartz.jobStore.acquireTriggersWithinLock=true
 
 service.domain=http:/127.0.0.1
 

+ 1 - 0
smart-city-platform/src/main/resources/application-prd.properties

@@ -108,6 +108,7 @@ spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThre
 spring.quartz.properties.org.quartz.threadPool.threadCount=10
 spring.quartz.properties.org.quartz.threadPool.threadPriority=5
 spring.quartz.properties.org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
+spring.quartz.properties.org.quartz.jobStore.acquireTriggersWithinLock=true
 
 #netty
 #不能用localhost,否则启动报异常:Unresolved address

+ 1 - 1
smart-city-platform/src/main/resources/application-sit.properties

@@ -124,7 +124,7 @@ spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThre
 spring.quartz.properties.org.quartz.threadPool.threadCount=100
 spring.quartz.properties.org.quartz.threadPool.threadPriority=5
 spring.quartz.properties.org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
-
+spring.quartz.properties.org.quartz.jobStore.acquireTriggersWithinLock=true
 
 system.water.meter.lora.code=LORAWM
 

+ 1 - 0
smart-city-platform/src/main/resources/application-uat.properties

@@ -102,6 +102,7 @@ spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThre
 spring.quartz.properties.org.quartz.threadPool.threadCount=10
 spring.quartz.properties.org.quartz.threadPool.threadPriority=5
 spring.quartz.properties.org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
+spring.quartz.properties.org.quartz.jobStore.acquireTriggersWithinLock=true
 
 #netty
 #不能用localhost,否则启动报异常:Unresolved address