Browse Source

Merge branch '20200908' of http://114.135.61.188:53000/ZONIOT/water-iot into 20200908

oppadmin 4 years ago
parent
commit
6b952aec0f

+ 21 - 4
meter-reading-sishui/read-sqlSever/src/main/java/com/zcxk/job/SyncMeterDataJob.java

@@ -70,11 +70,28 @@ public class SyncMeterDataJob implements Job {
             meterReadRecords.forEach(meterReadRecord -> {
                 MeterDataEntity meterDataEntity=new MeterDataEntity();
                 String relationId = meterReadRecordRelationId.get(meterReadRecord.getDeviceNo());
-                if(relationId!=null){
+                if(relationId!=null&&meterReadRecord.getReadData()!=null){
                     meterDataEntity.setReleationId(StringUtils.upperCase(relationId));
-                    meterDataEntity.setCurrentReading(Float.parseFloat(meterReadRecord.getReadData()));
-                    meterDataEntity.setCurrentReadDate(simpleDateFormat.format(meterReadRecord.getReadTime()));
-                    datas.add(meterDataEntity);
+                        float readData=0;
+                        if (meterReadRecord.getReadData()!=null){
+                            readData=Float.parseFloat(meterReadRecord.getReadData());
+                        }else if(meterReadRecord.getReadData()==null&&meterReadRecord.getLastValid()!=null){
+                            readData=Float.parseFloat(meterReadRecord.getLastValid());
+                        }
+                        if(readData!=0){
+                            meterDataEntity.setCurrentReading(readData);
+                            Date currentDate= meterReadRecord.getReadTime();
+                            if( currentDate==null){
+                                currentDate=uploadDate;
+                            }
+
+                            meterDataEntity.setCurrentReadDate(simpleDateFormat.format(currentDate));
+                            datas.add(meterDataEntity);
+                        }
+
+
+
+
                 }
 
             });

+ 13 - 10
meter-reading-sishui/read-sqlSever/src/main/java/com/zcxk/service/SyncService.java

@@ -43,8 +43,8 @@ public class SyncService {
     @Autowired
     private SyncMeterDataJob syncMeterDataJob;
 
-    //@Scheduled(cron = "0 0 * * * ?")
-    public void countPlanDevice(){
+    //@Scheduled(cron = "10 0 0 * * ?")
+    /*public void countPlanDevice(){
 
         WaterMeterBaseEntity waterMeterBaseEntity=new WaterMeterBaseEntity();
 
@@ -64,13 +64,15 @@ public class SyncService {
 
 
 
-    }
+    }*/
+    @Scheduled(cron = "10 0 0 * * ?")
     public void uploadRelationId(){
         WaterMeterBaseEntity waterMeterBaseEntity=new WaterMeterBaseEntity();
 
-        log.info("获取泗水水表列表");
+
         List<Map<String, Object>> meterInfor = receiveDao.getMeterInfor(waterMeterBaseEntity);
         Sets.SetView<String> meterNoIntersection = needSyncMeterNo(meterInfor);
+        log.info("获取泗水水表列表,数量={}",meterInfor.size());
         meterInfor.forEach(meter->{
             String meterNo = (String) meter.get("meterNo");
             if(meterNoIntersection.contains(meterNo)){
@@ -185,19 +187,20 @@ public class SyncService {
         Sets.SetView<String> difference = Sets.difference(allDeviceNos, hasDeviceNos);
         return difference;
     }
-    //@Scheduled(cron = "* 0/30 * * * ?")
+    @Scheduled(cron = "* 0/30 * * * ?")
     public void uploadData(){
         Map<String,Object>args2=new HashMap<>();
+        log.info("获取泗水上传计划");
         List<Map<String, Object>> uploadPlan = receiveDao.getUploadPlan(args2);
         uploadPlan.forEach(map->{
             String planId=(String) map.get("PlanId");
-            log.info("获取泗水上传计划");
-            //syncMeterDataJob.sendTask(map);
-            if(!quartzManager.checkExists(planId)){
 
-                quartzManager.addJob(planId, SyncMeterDataJob.class,setCron((Date) map.get("UploadTime")),map);
+           // syncMeterDataJob.sendTask(map);
+            if(!quartzManager.checkExists(planId)){
+                Date date=(Date) map.get("UploadTime");
+                quartzManager.addJob(planId, SyncMeterDataJob.class,setCron(date),map);
                 //quartzManager.addJob(planId, SyncMeterDataJob.class,"15 41 15 * * ?", map);
-                log.info("设置泗水上传计划定时任务");
+                log.info("设置泗水上传计划定时任务={}",date.toString());
             }
 
         });

+ 1 - 1
meter-reading-sishui/read-sqlSever/src/main/resources/application-dev.properties

@@ -1,4 +1,4 @@
-server.port=9080
+server.port=9085
 spring.application.name=sishui-meter-reading
 logging.file.path=./logs/sishui-meter-reading
 logging.level.root=info

+ 1 - 1
meter-reading-sishui/read-sqlSever/src/main/resources/application-prd.properties

@@ -16,7 +16,7 @@ mybatis.configuration.map-underscore-to-camel-case=true
 mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
 mybatis.configuration.use-column-label=true
 
-customerId=137
+customerId=76
 siteId=1
 sysId=58
 buildingId=1

+ 1 - 1
meter-reading-sishui/read-sqlSever/src/main/resources/application.properties

@@ -1 +1 @@
-spring.profiles.active=prd
+spring.profiles.active=dev

+ 1 - 1
meter-reading-sishui/read-sqlSever/src/main/resources/logback-spring.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
-    <springProperty scope="context" name="LOG_PATH" source="logging.path" defaultValue="/tmp" />
+    <springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="D:/db/泗水/logs" />
     <include resource="org/springframework/boot/logging/logback/defaults.xml" />
     <include resource="org/springframework/boot/logging/logback/console-appender.xml" />
     <appender name="TIME_FILE"

+ 7 - 5
meter-reading-sishui/read-sqlSever/src/main/resources/mysql-mapper/SendDao.xml

@@ -128,7 +128,7 @@
     </insert>
     <update id="updateRelationId">
         update sc_device set relation_id=#{relationId} where
-        relation_id is null and water_meter_no=#{waterMeterNo} and customer_id=#{customerId}
+        relation_id is null and water_meter_no=#{waterMeterNo} and customer_id=#{customerId} and status=1
     </update>
     <select id="getBuilding" resultType="com.zcxk.entity.Building">
         select
@@ -147,7 +147,7 @@
         where sb.status = 1 and sb.id = #{buildingId}
     </select>
     <select id="selectDeviceMeterReader" resultType="com.zcxk.entity.MeterReadRecord">
-      select device_no, read_time ,read_data
+      select device_no, read_time ,last_valid ,read_data,customer_id
       from sc_meter_read_record where customer_id=#{customerId}
       and read_date=#{readDate}
     </select>
@@ -159,13 +159,15 @@
     </select>
     <select id="selectRelationIdsByDeviceNo" resultType="java.util.Map">
         select device_no deviceNo ,relation_id relationId from sc_device
-        where
-        <foreach collection="list" item="item" index="index" separator=",">
-            device_no=#{item.deviceNo}
+        where device_no in
+       <foreach collection="list" item="item" open="(" separator="," close=")">
+            #{item.deviceNo}
         </foreach>
+        and relation_id is not null and status=1
     </select>
     <select id="selectMeterNo" resultType="java.lang.String">
           select water_meter_no from sc_device where customer_id=#{customerId} and   relation_id is null
+          and status=1
     </select>
 
 

+ 7 - 7
smart-city-platform/src/main/java/com/bz/smart_city/commom/security/smsCode/SmsCodeCheckUserFilter.java

@@ -53,25 +53,25 @@ public class SmsCodeCheckUserFilter extends OncePerRequestFilter {
         if(StringUtils.equals("dev",active)){
             return;
         }
-        if(StringUtils.equals("sit",active)){
+        if(StringUtils.equals("sit",active) && StringUtils.equals(smsCode,"8090")){
             return;
         }
-        if (StringUtils.equals(mobile, "18800000001") && StringUtils.equals(smsCode,"2020")) {
+        if (StringUtils.equals(mobile, "18800000001") && StringUtils.equals(smsCode,"8090")) {
             return;
         }
-        if (StringUtils.equals(mobile, "18800000008") && StringUtils.equals(smsCode,"2020")) {
+        if (StringUtils.equals(mobile, "18800000008") && StringUtils.equals(smsCode,"8090")) {
             return;
         }
-        if (StringUtils.equals(mobile, "18800000009") && StringUtils.equals(smsCode,"2020")) {
+        if (StringUtils.equals(mobile, "18800000009") && StringUtils.equals(smsCode,"8090")) {
             return;
         }
-        if (StringUtils.equals(mobile, "13265537610") && StringUtils.equals(smsCode,"2020")) {
+        if (StringUtils.equals(mobile, "13265537610") && StringUtils.equals(smsCode,"8090")) {
             return;
         }
-        if (StringUtils.equals(mobile, "13476218930") && StringUtils.equals(smsCode,"2020")) {
+        if (StringUtils.equals(mobile, "13476218930") && StringUtils.equals(smsCode,"8090")) {
             return;
         }
-        if (StringUtils.equals(mobile, "17796348920") && StringUtils.equals(smsCode,"2020")) {
+        if (StringUtils.equals(mobile, "17796348920") && StringUtils.equals(smsCode,"8090")) {
             return;
         }
         /*if (StringUtils.equals(mobile, "18665941776") && StringUtils.equals(smsCode,"9999")) {

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/quartz/job/InvoicePrintResultJob.java

@@ -27,7 +27,7 @@ public class InvoicePrintResultJob {
     @Autowired
     private PrintInvoiceQueryResultServiceImpl printInvoiceQueryResultService;
 
-    @Scheduled(cron = "0 0 0/1 * * ?")
+    //@Scheduled(cron = "0 0 0/1 * * ?")
     //@Scheduled(cron = "0 42 13 ? * *")   //定时执行,秒分时日月年
     private void queryResult() {
         List<PayInvoiceprinted> payInvoiceprinteds = printInvoicePrintService.findListByState();

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

@@ -174,7 +174,10 @@ sync.data.limit=50
 
 #银行代收客户id
 payfee.bank.customerId=47
+#武汉长江客户
+sync.customer.wuhan.id=136
 
 #mongodb url
-spring.data.mongodb.uri=mongodb://114.135.61.188:17017/meter-reading-database
+#spring.data.mongodb.uri=mongodb://114.135.61.188:17017/meter-reading-database
+spring.data.mongodb.uri=mongodb://water:zcxk100@114.135.61.189:27071/meter-reading-database?authSource=meter-reading-database
 logging.level.org.springframework.data.mongodb.core=DEBUG

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

@@ -179,6 +179,8 @@ sync.data.limit=100
 
 #银行代收客户id
 payfee.bank.customerId=47
+#武汉长江客户
+sync.customer.wuhan.id=26
 
 #mongodb url
 spring.data.mongodb.uri=mongodb://water:zcxk100@114.135.61.189:27071/meter-reading-database?authSource=meter-reading-database

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

@@ -177,6 +177,8 @@ sync.data.limit=100
 
 #银行代收客户id
 payfee.bank.customerId=47
+#武汉长江客户
+sync.customer.wuhan.id=136
 
 #mongodb url
 spring.data.mongodb.uri=mongodb://114.135.61.188:17017/meter-reading-database

+ 1 - 1
smart-city-platform/src/main/resources/mapper/MeterReadRecordMapper.xml

@@ -1851,7 +1851,7 @@
         now() as mrinputdate,
         '' as mrinputper,
         if(read_status = 2,'Y','N') as mrreadok,
-        1 as mrface
+        0 as mrface
         from sc_meter_read_record r
         where status = 1
         and customer_id = #{customerId} and read_date = #{date}