Переглянути джерело

Merge branch '20200908' into 20201014

# Conflicts:
#	smart-city-platform/src/main/java/com/bz/smart_city/service/impl/DeviceServiceImpl.java
lin 4 роки тому
батько
коміт
ea89779a04

+ 9 - 3
smart-city-platform/src/main/java/com/bz/smart_city/dto/AcceptListData.java

@@ -18,14 +18,20 @@ public class AcceptListData {
     @ApiModelProperty(value = "电子号",position = 2)
     private String waterMeterNo;
 
-    @ApiModelProperty(value = "安装地址",position = 3)
+    @ApiModelProperty(value = "小区名称",position = 3)
+    private String communityName;
+
+    @ApiModelProperty(value = "建筑名称",position = 4)
+    private String buildingName;
+
+    @ApiModelProperty(value = "安装地址",position = 5)
     private String location;
 
-    @ApiModelProperty(value = "本期读数",position = 4)
+    @ApiModelProperty(value = "本期读数",position = 6)
     private BigDecimal readData;
 
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
-    @ApiModelProperty(value = "安装时间",position = 5)
+    @ApiModelProperty(value = "安装时间",position = 7)
     private Date installTime;
 }

+ 51 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/WaterMeterReplaceData.java

@@ -0,0 +1,51 @@
+package com.bz.smart_city.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+
+@Data
+public class WaterMeterReplaceData {
+
+    @ApiModelProperty(value = "active")
+    private String active;
+
+    @ApiModelProperty(value="参考sc_device表id")
+    private Long deviceId;
+
+    @ApiModelProperty(value = "客户id")
+    private Integer customerId;
+
+    @ApiModelProperty(value = "客户Code")
+    private String customerCode;
+
+    @ApiModelProperty(value="新表表号(电子号)")
+    private String newWaterNo;
+
+    @ApiModelProperty(value="旧表表号(电子号)")
+    private String oldWaterNo;
+
+    @ApiModelProperty(value="新表起度")
+    private String newBeginWsv;
+
+    @ApiModelProperty(value="旧表止度")
+    private String oldEndWsv;
+
+    @ApiModelProperty(value="新节点编号")
+    private String newDeviceNo;
+
+    @ApiModelProperty(value="旧节点编号")
+    private String oldDeviceNo;
+
+    @ApiModelProperty(value="备注")
+    private String remark;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date dateCreate;
+}

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PrintInvoiceData.java

@@ -99,6 +99,6 @@ public class PrintInvoiceData {
     private String livingareaName;
 
     @ApiModelProperty("结算水量")
-    private String payamount;
+    private BigDecimal payamount;
 
 }

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

@@ -466,8 +466,6 @@ public  class DeviceServiceImpl implements DeviceService {
         }else {
             device.setSyncStatus(0);
         }
-
-
         //device.setUdipId(udipId);
         int result = this.insert(device);
 

+ 27 - 10
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/WaterMeterMaintenanceLogServiceImpl.java

@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
+import java.util.Date;
 import java.util.List;
 
 import com.bz.smart_city.service.WaterMeterMaintenanceLogService;
@@ -66,6 +67,8 @@ public class WaterMeterMaintenanceLogServiceImpl implements WaterMeterMaintenanc
 
     @Value("${com.zcxk.kafka.accept_meter_replace.topic}")
     private String acceptMeterReplaceTopic;
+    @Value("${spring.profiles.active}")
+    private String active;
 
     @Override
     public int insert(WaterMeterMaintenanceLog waterMeterMaintenanceLog) {
@@ -208,14 +211,6 @@ public class WaterMeterMaintenanceLogServiceImpl implements WaterMeterMaintenanc
                 newDevice.setWaterMeterNo(waterMeterMaintenanceLog.getNewWaterNo());
             }
             if (waterMeterMaintenanceLog.getNewDeviceTypeId() != null && waterMeterMaintenanceLog.getNewDeviceTypeId()!=0) {
-                DeviceTypeDto deviceTypeDto = deviceTypeMapper.getById(waterMeterMaintenanceLog.getNewDeviceTypeId());
-                if(!device.getDeviceType().equals(waterMeterMaintenanceLog.getNewDeviceTypeId())){
-                    if (deviceTypeDto != null && deviceTypeDto.getIsRegister() == 1) {
-                        String udipId = udipUnitService.updateUdipUnit(device.getUdipId(),waterMeterReplaceLog.getNewDeviceNo(),device.getCustomerId(),deviceTypeDto);
-                        newDevice.setUdipId(udipId);
-                        newDevice.setRegisterStatus(1);
-                    }
-                }
                 if(device.getSysId()!=-99){
                     ChannelDeviceTypeUse use = channelDeviceTypeUseMapper.findByDeviceId(waterMeterMaintenanceLog.getNewDeviceTypeId());
                     if (use != null) {
@@ -224,14 +219,36 @@ public class WaterMeterMaintenanceLogServiceImpl implements WaterMeterMaintenanc
                 }
                 newDevice.setDeviceType(waterMeterMaintenanceLog.getNewDeviceTypeId());
 
+            }
+
+            if (device.getRegisterStatus() != null && device.getRegisterStatus() == 1) {
+                DeviceTypeDto deviceTypeDto = deviceTypeMapper.getById(device.getDeviceType());
+                String udipId = udipUnitService.updateUdipUnit(device.getUdipId(),waterMeterReplaceLog.getNewDeviceNo(),device.getCustomerId(),deviceTypeDto);
+                if (udipId != null) {
+                    newDevice.setUdipId(udipId);
+                    newDevice.setRegisterStatus(1);
+                }
+
             }
             newDevice.setDateUpdate(LocalDateTime.now());
             deviceMapper.updateByPrimaryKeySelective(newDevice);
 
 
             // 3、推送换表信息
-            String json = JacksonUtil.obj2String(waterMeterReplaceLog);
-            log.info("acceptData:" + json);
+            WaterMeterReplaceData waterMeterReplaceData = new WaterMeterReplaceData();
+            waterMeterReplaceData.setActive(active);
+            waterMeterReplaceData.setDeviceId(waterMeterReplaceLog.getDeviceId());
+            waterMeterReplaceData.setCustomerId(device.getCustomerId());
+            waterMeterReplaceData.setCustomerCode("");
+            waterMeterReplaceData.setNewWaterNo(waterMeterReplaceLog.getNewWaterNo());
+            waterMeterReplaceData.setOldWaterNo(waterMeterReplaceLog.getOldWaterNo());
+            waterMeterReplaceData.setNewBeginWsv(waterMeterReplaceLog.getNewBeginWsv());
+            waterMeterReplaceData.setOldEndWsv(waterMeterReplaceLog.getOldEndWsv());
+            waterMeterReplaceData.setNewDeviceNo(waterMeterReplaceLog.getNewDeviceNo());
+            waterMeterReplaceData.setOldDeviceNo(waterMeterReplaceLog.getOldDeviceNo());
+            waterMeterReplaceData.setDateCreate(new Date());
+
+            String json = JacksonUtil.obj2String(waterMeterReplaceData);
             kafkaTemplate.send(acceptMeterReplaceTopic,json);
         } else {
             throw new ServiceException(-900, "该工单已经处理");

+ 27 - 10
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/WaterMeterReplaceLogServiceImpl.java

@@ -30,6 +30,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Date;
 import java.util.List;
 import com.bz.smart_city.entity.WaterMeterReplaceLog;
 import com.bz.smart_city.dao.WaterMeterReplaceLogMapper;
@@ -63,6 +64,8 @@ public class WaterMeterReplaceLogServiceImpl implements WaterMeterReplaceLogServ
 
     @Value("${com.zcxk.kafka.accept_meter_replace.topic}")
     private String acceptMeterReplaceTopic;
+    @Value("${spring.profiles.active}")
+    private String active;
 
 
     @Override
@@ -229,14 +232,6 @@ public class WaterMeterReplaceLogServiceImpl implements WaterMeterReplaceLogServ
             newDevice.setWaterMeterNo(waterMeterReplaceInputDto.getNewElectronicNo());
         }
         if (waterMeterReplaceInputDto.getNewDeviceTypeId() != null && waterMeterReplaceInputDto.getNewDeviceTypeId()!=0) {
-            DeviceTypeDto deviceTypeDto = deviceTypeMapper.getById(waterMeterReplaceInputDto.getNewDeviceTypeId());
-            if(!device.getDeviceType().equals(waterMeterReplaceInputDto.getNewDeviceTypeId())){
-                if (deviceTypeDto != null && deviceTypeDto.getIsRegister() == 1) {
-                    String udipId = udipUnitService.updateUdipUnit(device.getUdipId(),waterMeterReplaceLog.getNewDeviceNo(),device.getCustomerId(),deviceTypeDto);
-                    newDevice.setUdipId(udipId);
-                    newDevice.setRegisterStatus(1);
-                }
-            }
             if(device.getSysId()!=-99){
                 ChannelDeviceTypeUse use = channelDeviceTypeUseMapper.findByDeviceId(waterMeterReplaceInputDto.getNewDeviceTypeId());
                 if (use != null) {
@@ -245,13 +240,35 @@ public class WaterMeterReplaceLogServiceImpl implements WaterMeterReplaceLogServ
             }
             newDevice.setDeviceType(waterMeterReplaceInputDto.getNewDeviceTypeId());
 
+        }
+        if (device.getRegisterStatus() != null && device.getRegisterStatus() == 1) {
+            DeviceTypeDto deviceTypeDto = deviceTypeMapper.getById(device.getDeviceType());
+            String udipId = udipUnitService.updateUdipUnit(device.getUdipId(),waterMeterReplaceLog.getNewDeviceNo(),device.getCustomerId(),deviceTypeDto);
+            if (udipId != null) {
+                newDevice.setUdipId(udipId);
+                newDevice.setRegisterStatus(1);
+            }
+
         }
         newDevice.setDateUpdate(LocalDateTime.now());
         deviceMapper.updateByPrimaryKeySelective(newDevice);
 
         // 3、推送换表信息
-        String json = JacksonUtil.obj2String(waterMeterReplaceLog);
-        log.info("acceptData:" + json);
+        WaterMeterReplaceData waterMeterReplaceData = new WaterMeterReplaceData();
+        waterMeterReplaceData.setActive(active);
+        waterMeterReplaceData.setDeviceId(waterMeterReplaceLog.getDeviceId());
+        waterMeterReplaceData.setCustomerId(device.getCustomerId());
+        waterMeterReplaceData.setCustomerCode("");
+        waterMeterReplaceData.setNewWaterNo(waterMeterReplaceLog.getNewWaterNo());
+        waterMeterReplaceData.setOldWaterNo(waterMeterReplaceLog.getOldWaterNo());
+        waterMeterReplaceData.setNewBeginWsv(waterMeterReplaceLog.getNewBeginWsv());
+        waterMeterReplaceData.setOldEndWsv(waterMeterReplaceLog.getOldEndWsv());
+        waterMeterReplaceData.setNewDeviceNo(waterMeterReplaceLog.getNewDeviceNo());
+        waterMeterReplaceData.setOldDeviceNo(waterMeterReplaceLog.getOldDeviceNo());
+        waterMeterReplaceData.setDateCreate(new Date());
+
+        String json = JacksonUtil.obj2String(waterMeterReplaceData);
+        log.info("waterMeterReplaceData:" + json);
         kafkaTemplate.send(acceptMeterReplaceTopic,json);
 
         log.info("end submitWaterMeterReplace");

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

@@ -173,7 +173,9 @@ public class AcceptManagerServiceImpl implements AcceptManagerService,Initializi
 			AcceptListData acceptListData = new AcceptListData();
 			acceptListData.setDeviceNo(install.getDeviceNo());
 			acceptListData.setWaterMeterNo(install.getElectronicNo());
-			acceptListData.setLocation(install.getBuildingName()+install.getDoorNo());
+			acceptListData.setCommunityName(install.getCommunityName());
+			acceptListData.setBuildingName(install.getBuildingName());
+			acceptListData.setLocation(install.getDoorNo());
 			if (install.getMeterReading() != null) {
 				acceptListData.setReadData(new BigDecimal(install.getMeterReading()));
 			}else {

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

@@ -81,7 +81,9 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
         BigDecimal defc = new BigDecimal("0.0");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//格式化为年月日
         BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
-        BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
+        BigInteger customerId = null;
+        Integer cus = loginUser.getCustomerId() != null ? loginUser.getCustomerId() : null;
+        customerId = BigInteger.valueOf(cus);
         try {
             //1.获取客户总数跟较上月比率
             /***********************************时间计算*****************************************/
@@ -109,7 +111,13 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
             String endPeriod = list.get(0).getYear()+"-"+String.format("%02d", list.get(0).getMonth())+"-31";
 
             //上一账期汇总
-            String lastDate = list.get(1).getYear() +"-"+String.format("%02d", list.get(1).getMonth())+"-01";
+            String lastDate = "";
+            if(list.size() > 1){
+                lastDate = list.get(1).getYear() +"-"+String.format("%02d", list.get(1).getMonth())+"-01";
+            }else{
+                lastDate = list.get(0).getYear() +"-"+String.format("%02d", list.get(0).getMonth())+"-01";
+            }
+
             PayAccountSurvey accountSurvey = payChargeSurveyMapper.getlastAccount(lastDate,siteId,customerId);
 
             //客户总数计算
@@ -264,7 +272,9 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
         PayTransactionSurveyDto payTransactionSurveyDto = new PayTransactionSurveyDto();
         LoginUser loginUser = UserUtil.getCurrentUser();
         BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
-        BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
+        BigInteger customerId = null;
+        Integer cus = loginUser.getCustomerId() != null ? loginUser.getCustomerId() : null;
+        customerId = BigInteger.valueOf(cus);
         BigDecimal defc = new BigDecimal("0.0");
         try {
             List<BaseClosingAccountInfoDto> list = baseClosingAccountInfoMapper.getList(null,null,

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

@@ -243,12 +243,19 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
         PrintInvoiceData printInvoiceDataAccountBaseInfo=payInvoiceMapper.getAccountBaseInfo(accountId);
 
         //拼装数据
-        printInvoiceDataAccountBaseInfo.setReading(printInvoiceDataReceivablefee.getReading());
-        printInvoiceDataAccountBaseInfo.setRecorddate(printInvoiceDataReceivablefee.getRecorddate());
-        printInvoiceDataAccountBaseInfo.setLastreading(printInvoiceDataReceivablefee.getLastreading());
-        printInvoiceDataAccountBaseInfo.setLastrecorddate(printInvoiceDataReceivablefee.getLastrecorddate());
-        printInvoiceDataAccountBaseInfo.setPayamount(printInvoiceDataReceivablefee.getPayamount());
-        printInvoiceDataAccountBaseInfo.setReceivablefee(printInvoiceDataReceivablefee.getReceivablefee());
+        if(printInvoiceDataReceivablefee != null){
+            printInvoiceDataAccountBaseInfo.setReading(printInvoiceDataReceivablefee.getReading());
+            printInvoiceDataAccountBaseInfo.setRecorddate(printInvoiceDataReceivablefee.getRecorddate());
+            printInvoiceDataAccountBaseInfo.setLastreading(printInvoiceDataReceivablefee.getLastreading());
+            printInvoiceDataAccountBaseInfo.setLastrecorddate(printInvoiceDataReceivablefee.getLastrecorddate());
+            printInvoiceDataAccountBaseInfo.setPayamount(printInvoiceDataReceivablefee.getPayamount());
+            printInvoiceDataAccountBaseInfo.setReceivablefee(printInvoiceDataReceivablefee.getReceivablefee());
+        }else{
+            printInvoiceDataAccountBaseInfo.setReading(BigDecimal.ZERO);
+            printInvoiceDataAccountBaseInfo.setLastreading(BigDecimal.ZERO);
+            printInvoiceDataAccountBaseInfo.setPayamount(BigDecimal.ZERO);
+            printInvoiceDataAccountBaseInfo.setReceivablefee(BigDecimal.ZERO);
+        }
         if(printInvoiceData.getRemaining().compareTo(BigDecimal.ZERO) == 1 ){
             printInvoiceDataAccountBaseInfo.setRemaining(printInvoiceData.getRemaining());
         }

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

@@ -451,7 +451,7 @@
 			n.remark as remark,
 			n.floor as floor,
 			com.id as community_id,
-			com.name as community_namae,
+			com.name as community_name,
             swmed.meter_reading,
             n.metercode as metercode,
             n.account_id as account_id,

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

@@ -403,7 +403,7 @@
             from sc_water_meter_replace_log rl
             left join sc_device sd on(sd.id = rl.device_id)
             <if test="isAccepted != null">left join sc_install_list sil on(sil.device_id = rl.device_id)</if>
-            <if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = d.id and sdd.status = 1)</if>
+            <if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = sd.id and sdd.status = 1)</if>
             where rl.status = 1 and sd.status = 1
             <if test="siteId != null"> and sd.site_id = #{siteId}</if>
             <if test="deviceId != null"> and rl.device_id = #{deviceId}</if>