Browse Source

Merge remote-tracking branch 'origin/0617' into 0617

zhoujiangyuan 4 years ago
parent
commit
09f067de30

+ 2 - 1
smart-city-platform/src/main/java/com/bz/smart_city/commom/security/WebSecurityConfig.java

@@ -100,7 +100,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/apply/register","/apply/detail","/apply/approve")
                 .antMatchers("/payFee/payFee")
                 .antMatchers("/waterMeter/getMeterByDeviceNo")
-                .antMatchers("/device/synArchies");
+                .antMatchers("/device/synArchies")
+                .antMatchers("/druid/**");
     }
 
 

+ 7 - 7
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/MeterReadRecordServiceImpl.java

@@ -547,11 +547,11 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
                 }
                 // 保存抄表记录
                 meterReadRecordMapper.insertList(records);
-                Thread.sleep(10000L);
+                //Thread.currentThread().
             }
             log.info("end MeterReadRecordService createMeterReadRecord ,result = {} ", result);
         }catch (Exception e){
-            log.error("Execute Create MeterReadRecord Tast Failed !",e);
+            log.error("Execute Create MeterReadRecord Task Failed !",e);
         }
 		return total;
 	}
@@ -922,11 +922,11 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 			log.info("Begin Save Read Record List ,Size ={}",records.size());
 			meterReadRecordMapper.insertList(records);
 			log.info("End Save Read Record List !");
-			try {
-				Thread.sleep(10000L);
-			} catch (InterruptedException e) {
-				log.error("thread interrupted", e);
-			}
+//			try {
+//				Thread.sleep(10000L);
+//			} catch (InterruptedException e) {
+//				log.error("thread interrupted", e);
+//			}
 		}
 		log.info("End WaterMeterReadDataByType createMeterReadRecord ,Total = {}",total);
 		return total;

+ 10 - 6
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/AmountSynByDayServiceImpl.java

@@ -73,16 +73,20 @@ public class AmountSynByDayServiceImpl implements AmountSynByDayService, Initial
         entity.setJobGroup("水量每天同步");
         entity.setJobName("AmountSyncByDayJob" );
         entity.setDescription("AmountSyncByDayJob" );
-
-        String cron = "0 */5 * * * ?";
-        log.info("水量每天同步:" + cron);
-        entity.setCronExpression(cron);
-        entity.setJobClassName(AmountSyncByDayJob.class.getName());
+        // modify by pengdi ,判断定时任务是否存在,不存在才进行新增
+
+        boolean exists = jobAndTriggerService.isExists(entity);
+        if(!exists){
+            String cron = "0 */5 * * * ?";
+            log.info("水量每天同步:" + cron);
+            entity.setCronExpression(cron);
+            entity.setJobClassName(AmountSyncByDayJob.class.getName());
+            jobAndTriggerService.save(entity);
+        }
         /*HashMap<String, Object> jobData = new HashMap<String, Object>();
         jobData.put("siteId", payBaseConfigDto.getSiteId().intValue());
         jobData.put("customerId", payBaseConfigDto.getCustomerId().intValue());
         entity.setJobData(jobData);*/
-        jobAndTriggerService.save(entity);
     }
 
 

+ 13 - 10
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/AmountSynServiceImpl.java

@@ -80,16 +80,19 @@ public class AmountSynServiceImpl implements AmountSynService,InitializingBean {
         entity.setJobGroup("水量同步");
         entity.setJobName("AmountSyncJob"+payBaseConfigDto.getCustomerId());
         entity.setDescription("AmountSyncJob"+payBaseConfigDto.getCustomerId());
-        String[] values = value.split("_");
-        String cron = "0 */"+values[2]+" * "+values[0]+"-"+values[1]+" * ?";
-        log.info("水量同步cron:"+cron);
-        entity.setCronExpression(cron);
-        entity.setJobClassName(AmountSyncJob.class.getName());
-        HashMap<String, Object> jobData = new HashMap<String, Object>();
-        jobData.put("siteId", payBaseConfigDto.getSiteId().intValue());
-        jobData.put("customerId", payBaseConfigDto.getCustomerId().intValue());
-        entity.setJobData(jobData);
-        jobAndTriggerService.save(entity);
+        boolean exists = jobAndTriggerService.isExists(entity);
+        if(!exists){
+            String[] values = value.split("_");
+            String cron = "0 */"+values[2]+" * "+values[0]+"-"+values[1]+" * ?";
+            log.info("水量同步cron:"+cron);
+            entity.setCronExpression(cron);
+            entity.setJobClassName(AmountSyncJob.class.getName());
+            HashMap<String, Object> jobData = new HashMap<String, Object>();
+            jobData.put("siteId", payBaseConfigDto.getSiteId().intValue());
+            jobData.put("customerId", payBaseConfigDto.getCustomerId().intValue());
+            entity.setJobData(jobData);
+            jobAndTriggerService.save(entity);
+        }
     }
 
 

+ 17 - 14
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/ResetLadderServiceImpl.java

@@ -71,21 +71,24 @@ public class ResetLadderServiceImpl implements ResetLadderService,InitializingBe
         entity.setJobGroup("阶梯可用量重置");
         entity.setJobName("ResetLadderJob"+payBaseConfigDto.getCustomerId());
         entity.setDescription("ResetLadderJob"+payBaseConfigDto.getCustomerId());
-        Integer day = 1;
-        if(value.length()>2){
-             day = Integer.valueOf(value.substring(2));
+        boolean exists = jobAndTriggerService.isExists(entity);
+        if(!exists){
+            Integer day = 1;
+            if(value.length()>2){
+                day = Integer.valueOf(value.substring(2));
+            }
+            String cron = this.buildingCron();
+            //String cron = "0 */30 * 1-31 * ?";
+            log.info("阶梯可用量重置cron:"+cron);
+            entity.setCronExpression(cron);
+            entity.setJobClassName(ResetLadderJob.class.getName());
+            HashMap<String, Object> jobData = new HashMap<String, Object>();
+            jobData.put("siteId", payBaseConfigDto.getSiteId().intValue());
+            jobData.put("customerId", payBaseConfigDto.getCustomerId().intValue());
+            entity.setJobData(jobData);
+            entity.setStartDate(LocalDateTime.now());
+            jobAndTriggerService.addJob(entity);
         }
-        String cron = this.buildingCron();
-        //String cron = "0 */30 * 1-31 * ?";
-        log.info("阶梯可用量重置cron:"+cron);
-        entity.setCronExpression(cron);
-        entity.setJobClassName(ResetLadderJob.class.getName());
-        HashMap<String, Object> jobData = new HashMap<String, Object>();
-        jobData.put("siteId", payBaseConfigDto.getSiteId().intValue());
-        jobData.put("customerId", payBaseConfigDto.getCustomerId().intValue());
-        entity.setJobData(jobData);
-        entity.setStartDate(LocalDateTime.now());
-        jobAndTriggerService.addJob(entity);
     }
 
     /**