Browse Source

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

hym 4 years ago
parent
commit
e51e98f951
17 changed files with 68 additions and 52 deletions
  1. 9 0
      smart-city-platform/src/main/java/com/bz/smart_city/async/AsyncInstallPlanDownloadTask.java
  2. 1 0
      smart-city-platform/src/main/java/com/bz/smart_city/commom/model/CommonQueryCondition.java
  3. 2 2
      smart-city-platform/src/main/java/com/bz/smart_city/commom/util/HttpClientUtils.java
  4. 2 2
      smart-city-platform/src/main/java/com/bz/smart_city/controller/water/WaterMeterReadController.java
  5. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/excel/download/column/DeviceColumnTranslator.java
  6. 1 0
      smart-city-platform/src/main/java/com/bz/smart_city/excel/resolver/BuildingResolverExcelTemplate.java
  7. 15 13
      smart-city-platform/src/main/java/com/bz/smart_city/kafka/consumer/ValveStatusReceiver.java
  8. 2 2
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/BPMNServiceImpl.java
  9. 2 2
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/ChenHuiSyncWaterMeterInfoServiceImpl.java
  10. 1 1
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/DeviceDataPushServiceImpl.java
  11. 2 1
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/GeneralRabbitSyncService.java
  12. 2 1
      smart-city-platform/src/main/resources/application-prd.properties
  13. 2 1
      smart-city-platform/src/main/resources/json/deviceAllColumn.json
  14. 3 0
      smart-city-platform/src/main/resources/mapper/MeterReadRecordMapper.xml
  15. 9 9
      smart-city-platform/src/main/resources/mapper/PayBaseCustomerandmeterrelaMapper.xml
  16. 6 12
      smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml
  17. 6 6
      smart-city-platform/src/main/resources/mapper/pay/payFeeMapper.xml

+ 9 - 0
smart-city-platform/src/main/java/com/bz/smart_city/async/AsyncInstallPlanDownloadTask.java

@@ -103,6 +103,15 @@ public class AsyncInstallPlanDownloadTask {
         Customer customer = customerService.findById(installPlan.getCustomerId());
         //4、获取水表类型数据
         List<Integer> deviceTypeIds = installPlanDeviceTypeMapper.getDeviceIdByPlanId(installPlan.getId());
+        int deviceTypeCount = 0;
+        while (deviceTypeIds.size() == 0){
+            if(deviceTypeCount == 100){
+                break;
+            }
+            log.info("installBuildingList while deviceTypeCount={}",deviceTypeCount);
+            deviceTypeIds = installPlanDeviceTypeMapper.getDeviceIdByPlanId(installPlan.getId());
+            deviceTypeCount++;
+        }
         List<DeviceTypeDto> deviceTypeList = deviceTypeMapper.findByIds(deviceTypeIds);
         ChannelDeviceTypeUse use =  channelDeviceTypeUseMapper.findByDeviceId(deviceTypeIds.get(0));
 

+ 1 - 0
smart-city-platform/src/main/java/com/bz/smart_city/commom/model/CommonQueryCondition.java

@@ -62,4 +62,5 @@ public class CommonQueryCondition {
 	private List<Integer> regions;
 	private List<Integer> communities;
 	private List<Integer> customerIds;
+	private Boolean  isAccept;
 }

+ 2 - 2
smart-city-platform/src/main/java/com/bz/smart_city/commom/util/HttpClientUtils.java

@@ -115,7 +115,7 @@ public class HttpClientUtils {
     }
  
     public static String doPostWithJson(String url, String context) throws Exception {
-    	log.info("request url = {}, content = {}",url,context);
+    	log.debug("request url = {}, content = {}",url,context);
         HttpPost post = new HttpPost(url);
         HttpEntity requestEntity = new StringEntity(context, ContentType.APPLICATION_JSON);
         post.setEntity(requestEntity);
@@ -123,7 +123,7 @@ public class HttpClientUtils {
     }
     
     public static String doPostWithJsonWithHeader(String url, String context,String headerKey ,String headerValue) throws Exception {
-    	log.info("request url = {}, content = {}",url,context);
+    	log.debug("request url = {}, content = {}",url,context);
         HttpPost post = new HttpPost(url);
         post.setHeader(headerKey,headerValue);
         HttpEntity requestEntity = new StringEntity(context, ContentType.APPLICATION_JSON);

+ 2 - 2
smart-city-platform/src/main/java/com/bz/smart_city/controller/water/WaterMeterReadController.java

@@ -194,7 +194,7 @@ public class WaterMeterReadController {
 			@ApiParam(value = "结束日期", required = true) @RequestParam(required = true) int endDate,
 			@ApiParam(value = "抄表状态,1未抄,2已抄", required = false) @RequestParam(required = false) String readStatus,
 			@ApiParam(value = "设备编号", required = false) @RequestParam(required = false) String deviceNo,
-			@ApiParam(value = "客户", required = false) @RequestParam(required = false) Integer custormerId,
+			@ApiParam(value = "客户", required = false) @RequestParam(required = false) Integer customerId,
             @ApiParam(value = "集中器id", required = false) @RequestParam(required = false) Integer concentratorId,
             @ApiParam(value = "通道号id", required = false) @RequestParam(required = false) Integer channelNumberId,
 			@ApiParam(value = "集中器编码", required = false) @RequestParam(required = false) String concentratorCode,
@@ -219,7 +219,7 @@ public class WaterMeterReadController {
 		condition.setReadStatus(readStatus);
 		condition.setBuildingId(buildingId);
 		condition.setCommunityId(communityId);
-		condition.setCustormerId(custormerId);
+		condition.setCustormerId(customerId);
 		condition.setConcentratorId(concentratorId);
 		condition.setChannelNumberId(channelNumberId);
 

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/excel/download/column/DeviceColumnTranslator.java

@@ -154,6 +154,9 @@ public class DeviceColumnTranslator {
         if (StringUtils.equals("channelNumberName",columnName)) {
             return device.getChannelNumberName();
         }
+        if (StringUtils.equals("portName",columnName)) {
+            return device.getPort();
+        }
         return null;
     }
 }

+ 1 - 0
smart-city-platform/src/main/java/com/bz/smart_city/excel/resolver/BuildingResolverExcelTemplate.java

@@ -48,6 +48,7 @@ public class BuildingResolverExcelTemplate extends AbstractResolverExcelTemplate
             if (hssfSheet == null || !StringUtils.equals(executeSheetName, hssfSheet.getSheetName())) {
                 continue;
             }
+            invalidTemplate = true;
             // 循环行Row
             for (int rowNum = 1; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                 Row row = hssfSheet.getRow(rowNum);

+ 15 - 13
smart-city-platform/src/main/java/com/bz/smart_city/kafka/consumer/ValveStatusReceiver.java

@@ -50,20 +50,22 @@ public class ValveStatusReceiver {
 
                 operatingValveRecordMapper.updateStatus(operatingValveRecordMessage);
             }
-            if(operatingValveRecordMessage==null){
-                operatingValveRecordMessage=new OperatingValveRecord();
-                operatingValveRecordMessage.setWaterNo(valveControlDataDto.getMeterNo());
-                operatingValveRecordMessage.setCustomerId(valveControlDataDto.getCustomerId());
-            }
-            Device device=operatingValveRecordMapper.getDevice(operatingValveRecordMessage);
-            if(device!=null){
-                log.info("同步水表阀门状态 电子号={}",device.getMetercode());
-                Map<String,Object>valveMessage=new HashMap<>();
-                valveMessage.put("meterNo",device.getMetercode());
-                valveMessage.put("meterStatus",Integer.parseInt(valveControlDataDto.getValve()));
-                kafkaTemplate.send(billingValveStatusReceiving, JSONUtils.obj2json(valveMessage));
-            }
 
         }
+
+        if(operatingValveRecordMessage==null){
+            operatingValveRecordMessage=new OperatingValveRecord();
+            operatingValveRecordMessage.setWaterNo(valveControlDataDto.getMeterNo());
+            operatingValveRecordMessage.setCustomerId(valveControlDataDto.getCustomerId());
+        }
+        Device device=operatingValveRecordMapper.getDevice(operatingValveRecordMessage);
+        if(device!=null){
+            log.info("同步水表阀门状态 电子号={}",device.getMetercode());
+            Map<String,Object>valveMessage=new HashMap<>();
+            valveMessage.put("meterNo",device.getMetercode());
+            valveMessage.put("meterStatus",Integer.parseInt(valveControlDataDto.getValve()));
+            kafkaTemplate.send(billingValveStatusReceiving, JSONUtils.obj2json(valveMessage));
+        }
+
     }
 }

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

@@ -91,7 +91,7 @@ public class BPMNServiceImpl implements BPMNService {
                  return null;
              }
          }
-         logger.info("end findProccessDefByAlarm ,ProcessDef = " + JSON.toJSONString(pd));
+         //logger.info("end findProccessDefByAlarm ,ProcessDef = " + JSON.toJSONString(pd));
          return pd;
 	}
 	/**
@@ -113,7 +113,7 @@ public class BPMNServiceImpl implements BPMNService {
 				return null;
 			}
 		}
-		logger.info("end findProccessDefByAlarm ,ProcessDef = " + JSON.toJSONString(pd));
+		//logger.info("end findProccessDefByAlarm ,ProcessDef = " + JSON.toJSONString(pd));
 		return pd;
 	}
 

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

@@ -54,9 +54,9 @@ public class ChenHuiSyncWaterMeterInfoServiceImpl implements SyncWaterMeterInfoS
 		String jsonReq = buildJSONRequestContent(fromDate,toDate);
 		String resp  = null ; 
 		try {
-			log.info("begin http request , url = {} , content = {}",batchQueryUrl,jsonReq);
+			log.debug("begin http request , url = {} , content = {}",batchQueryUrl,jsonReq);
 			resp = HttpClientUtils.doPostWithJson(batchQueryUrl, jsonReq);
-			log.info("end http request , url = {} , response = {}",batchQueryUrl,resp);
+			log.debug("end http request , url = {} , response = {}",batchQueryUrl,resp);
 			
 			
 		} catch (Exception e) {

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/DeviceDataPushServiceImpl.java

@@ -320,7 +320,7 @@ public class DeviceDataPushServiceImpl implements DeviceDataPushService , Initia
 		jsonMap.put("dataList",dataMapList);
 		
 		String jsonString = JSON.toJSONString(jsonMap);
-		log.info("Push Content = {}",jsonString);
+		//log.info("Push Content = {}",jsonString);
 		return jsonString;
 	}
 	

+ 2 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/GeneralRabbitSyncService.java

@@ -65,7 +65,8 @@ public class GeneralRabbitSyncService {
             condition.setEndDate(20201113);
         }
         // 只传已验收上线的
-        condition.setChannelId(40);
+        //condition.setChannelId(40);
+        condition.setIsAccept(true);
         log.info("begin query meter read records ,condition = {}",JSON.toJSONString(condition));
         List<MeterReadRecord> meterReadRecords = meterReadRecordMapper.queryMeterReadRecordWithCondtion(condition);
         log.info("end query meter read records ,result size is = {}",meterReadRecords.size());

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

@@ -184,4 +184,5 @@ 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
-logging.level.org.springframework.data.mongodb.core=INFO
+logging.level.org.springframework.data.mongodb.core=INFO
+account_userInfo_url=http://114.135.61.188:58084/api/pay/getAccountInfoByMetercode

+ 2 - 1
smart-city-platform/src/main/resources/json/deviceAllColumn.json

@@ -24,5 +24,6 @@
   {"lastReceiveTime":"最后上报时间"},
   {"oldMeterEnd":"旧表止度"},
   {"userName":"用户名称"},
-  {"channelNumberName":"通道号"}
+  {"channelNumberName":"通道号"},
+  {"portName":"测量点号"}
 ]

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

@@ -813,6 +813,9 @@
             left join sc_water_related_device wrd on (wrd.device_id = m.device_id)
             left join sc_channel_number scn on (scn.id = wrd.channel_number_id)
 		WHERE m.STATUS = 1
+            <if test="param.isAccept != null and param.isAccept">
+                and m.sys_id != -99
+            </if>
 			<!-- 数据权限 -->
 			<if test="param.siteId != null and param.siteId != 0">
 				and m.site_id = #{param.siteId}

+ 9 - 9
smart-city-platform/src/main/resources/mapper/PayBaseCustomerandmeterrelaMapper.xml

@@ -253,27 +253,27 @@
             account.email,
             customer.vatno,
             customer.businessstate as "businessstate",
-            (select label from pay_sys_dict where type = '开户状态' and value = customer.businessstate and site_id = #{siteId} and customer_id =#{customerId}) as "businessName",
+            (select label from pay_sys_dict where type = '开户状态' and value = customer.businessstate and customer_id =#{customerId} and site_id = #{siteId}) as "businessName",
             customer.calculateway as "calculateway",
-            (select label from pay_sys_dict where type = '结算方式' and value = customer.calculateway and site_id = #{siteId} and customer_id =#{customerId}) as "calculatewayName",
+            (select label from pay_sys_dict where type = '结算方式' and value = customer.calculateway and customer_id =#{customerId} and site_id = #{siteId}) as "calculatewayName",
             account.idtype as "idtype",
-            (select label from pay_sys_dict where type = '证件类型' and value = account.idtype and site_id = #{siteId} and customer_id =#{customerId}) as "idtypeName",
+            (select label from pay_sys_dict where type = '证件类型' and value = account.idtype and customer_id =#{customerId}  and site_id = #{siteId}) as "idtypeName",
             account.idcardno as "idcardno",
             customer.housetype as "housetype",
-            (select label from pay_sys_dict where type = '住房类型' and value = customer.housetype and site_id = #{siteId} and customer_id =#{customerId}) as "housetypeName",
+            (select label from pay_sys_dict where type = '住房类型' and value = customer.housetype and customer_id =#{customerId} and site_id = #{siteId}) as "housetypeName",
             customer.customergroup as "customergroup",
-            (select label from pay_sys_dict where type = '开户分组' and value = customer.customergroup and site_id = #{siteId} and customer_id =#{customerId}) as "customergroupName"
+            (select label from pay_sys_dict where type = '开户分组' and value = customer.customergroup and customer_id =#{customerId} and site_id = #{siteId}) as "customergroupName"
         from pay_base_customerandmeterrela customer
         left join sc_device device on customer.watermeter_id = device.id
         left join pay_base_account account on account.id = customer.account_id
         left join pay_base_waterproperty property on property.id = customer.waterproperty_id
         <where>
-            <if test="siteId != null">
-                and  customer.site_id = #{siteId}
-            </if>
             <if test="customerId != null">
                 and customer.customer_id = #{customerId}
             </if>
+            <if test="siteId != null">
+                and  customer.site_id = #{siteId}
+            </if>
             <if test="condition != null">
                 and
                 (
@@ -312,7 +312,7 @@
             account.telephone as "telephone",
             customer.metercode as "metercode",
             property.name as "propertyName",
-            device.loc_desc as "address",
+            account.address as "address",
             customer.opendate as "opendate",
             customer.businessstate as "businessstate",
             customer.calculateway as "calculateway",

+ 6 - 12
smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml

@@ -273,10 +273,10 @@
         IFNULL(cust.waterNumber,0) AS waterNumber,
         IFNULL(paw.sum_payamount,0) sumPayamount,
         pba.state as state,
-        (select label from pay_sys_dict where value = pba.state and type='客户状态' and site_id = #{siteId} and customer_id = #{customerId}) stateName,
+        (select label from pay_sys_dict where value = pba.state and type='客户状态' and customer_id = #{customerId} and site_id = #{siteId}) stateName,
 
         dt.remaining ,
-        (select label from pay_sys_dict where value = pba.idtype and type='证件类型' and site_id = #{siteId} and customer_id = #{customerId}) idTypeName,
+        (select label from pay_sys_dict where value = pba.idtype and type='证件类型' and customer_id = #{customerId} and site_id = #{siteId}) idTypeName,
         pba.accountnumber,
         pba.name,
         pba.telephone,
@@ -288,7 +288,7 @@
             account_id,
             ifnull(sum(payamount),0) sum_payamount
             from pay_amount_waterusedamount
-            where  site_id = #{siteId} and customer_id = #{customerId}  and year=#{year} and month=#{month}
+            where  customer_id = #{customerId}  and site_id = #{siteId} and year=#{year} and month=#{month}
             group by account_id
         ) paw on paw.account_id = pba.id
         left join (
@@ -421,9 +421,9 @@
             pba.email,
             pbc.vatno
         from pay_base_account pba
-        left join pay_sys_dict psd on pba.idtype=psd.`value` and psd.type='证件类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
+        left join pay_sys_dict psd on pba.idtype=psd.`value` and psd.type='证件类型' and psd.customer_id=#{customerId} and psd.site_id=#{siteId}
         left join pay_pay_rechargeaccount ppr on pba.accountnumber=ppr.accountnumber and ppr.site_id=#{siteId} and ppr.customer_id=#{customerId}
-        left join pay_sys_dict psd2 on pba.state = psd2.`value` and psd2.type='客户状态' and psd2.site_id=#{siteId} and psd2.customer_id=#{customerId}
+        left join pay_sys_dict psd2 on pba.state = psd2.`value` and psd2.type='客户状态' and psd2.customer_id=#{customerId} and psd2.site_id=#{siteId}
         left join pay_base_customerandmeterrela pbc on pbc.account_id = pba.id
         where pba.accountnumber = #{queryInfo} and pba.site_id=#{siteId} and pba.customer_id=#{customerId}
 
@@ -556,19 +556,13 @@
             scd.id as deviceId,
             scinstall.is_accepted state,
             (case scinstall.is_accepted  WHEN  2 then '已开户' when 1 then '待开户' else '待验收' end) stateName,
-            IFNULL(rd.reading,0) as CurrData
+            (select IFNULL(max(reading),0) from pay_amount_waterusedamount_day d where d.watermeter_id = scd.id) as CurrData
         from  sc_device scd
         left join sc_install_list scinstall on scd.id = scinstall.device_id  and scinstall.customer_id=#{customerId}
         left JOIN sc_device_type sdt on sdt.id = scd.device_type
         left join sc_device_manufacturer sdm on sdm.id = sdt.manufacturer_id and sdm.`status`=1
         left join pay_base_account pba on pba.id = scd.account_id  and pba.site_id=#{siteId} and pba.customer_id=#{customerId}
         left join pay_base_customerandmeterrela ppr on ppr.metercode = scd.metercode and ppr.site_id=#{siteId} and ppr.customer_id=#{customerId}
-        left join
-        (SELECT a.watermeter_id,a.reading FROM pay_amount_waterusedamount_day AS a,
-        (SELECT b.watermeter_id, MAX(b.read_date) AS read_date FROM pay_amount_waterusedamount_day AS b
-        where b.reading is not null and b.customer_id=#{customerId}
-        GROUP BY b.watermeter_id)
-        AS c WHERE a.watermeter_id=c.watermeter_id AND a.read_date = c.read_date)  rd on rd.watermeter_id = scd.id
         where  scd.customer_id = #{customerId} and scd.account_id is not null
         <if test="queryInfo != null and queryInfo != ''">
             and (

+ 6 - 6
smart-city-platform/src/main/resources/mapper/pay/payFeeMapper.xml

@@ -106,19 +106,19 @@
             c.opendate,
             c.metercode,
             c.watermeter_id as "watermeterId",
-            (select label from pay_sys_dict where type='住房类型' and `value`=c.housetype and site_id=#{siteId}
-            and customer_id=#{customerId}) as "housetype",
-            (select label from pay_sys_dict where type='结算方式' and `value`=c.calculateway and  site_id=#{siteId}
-            and customer_id=#{customerId}) as "calculateway",
+            (select label from pay_sys_dict where type='住房类型' and `value`=c.housetype and customer_id=#{customerId}
+            and site_id=#{siteId} ) as "housetype",
+            (select label from pay_sys_dict where type='结算方式' and `value`=c.calculateway and  customer_id=#{customerId}
+            and  site_id=#{siteId}) as "calculateway",
             p.id as "waterPropertyId",
             p.name as "waterPropertyName",
             device.water_meter_no as "metereleno"
         from pay_base_customerandmeterrela c
         left join pay_base_account a on c.account_id=a.id
         left join pay_base_waterproperty p on c.waterProperty_id=p.id
-        inner join sc_device device on device.metercode = c.metercode and device.customer_id =#{customerId}
+        inner join sc_device device on device.id = c.watermeter_id and device.customer_id =#{customerId}
         <where>
-            c.businessstate=1 and c.site_id=#{siteId}
+            c.businessstate=1 and c.customer_id =#{customerId} and c.site_id=#{siteId}
             <if test="id != null and id != ''">
                and  c.id= #{id}
             </if>