Browse Source

水表同步修改

hym 4 years ago
parent
commit
9609525d4f

+ 5 - 0
smart-city-platform/src/main/java/com/bz/smart_city/controller/SyncDataApi.java

@@ -3,12 +3,14 @@ package com.bz.smart_city.controller;
 import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.model.ListObjectWrapper;
 import com.bz.smart_city.commom.model.ResultStatus;
+import com.bz.smart_city.dao.CustomerMapper;
 import com.bz.smart_city.dto.ClearingDataDTO;
 import com.bz.smart_city.dto.assistant.InstallPlanInputDTO;
 import com.bz.smart_city.dto.sync.*;
 import com.bz.smart_city.dto.CommunityDto;
 import com.bz.smart_city.dto.syncdata.*;
 import com.bz.smart_city.entity.Community;
+import com.bz.smart_city.entity.Customer;
 import com.bz.smart_city.service.CommunityService;
 import com.bz.smart_city.service.SyncDataService;
 import com.bz.smart_city.service.assistant.InstallPlanService;
@@ -35,6 +37,7 @@ public class SyncDataApi {
     CommunityService communityService;
     @Autowired
     private InstallPlanService installPlanService;
+    private CustomerMapper customerMapper;
 
 
     @ResponseBody
@@ -122,6 +125,8 @@ public class SyncDataApi {
     public AjaxMessage syncPlan(
             @ApiParam(value = "安装计划", required = true) @RequestBody(required = true) InstallPlanInputDTO installPlanInput
     ) {
+        Integer customerId = customerMapper.findByCustomerNo(installPlanInput.getCustomerNo());
+        installPlanInput.setCustomerId(customerId);
         installPlanService.syncPlan(installPlanInput);
         return new AjaxMessage(ResultStatus.OK);
     }

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/assistant/InstallListMapper.java

@@ -70,4 +70,7 @@ public interface InstallListMapper {
     int updateByDeviceId(@Param("deviceId") Long deviceId, @Param("newDeviceNo") String newDeviceNo, @Param("newWaterMeterNo") String newWaterMeterNo);
 
     List<MeterAcceptDto> meterAccept(@Param("createDate") String createDate, @Param("customerId") Integer customerId, @Param("fileNo") List<String> fileNo);
+
+    void updateMeterNo(@Param("meterNo") String meterNo, @Param("meterCode") String meterCode,
+                       @Param("customerId")int customerId);
 }

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/assistant/InstallPlanInputDTO.java

@@ -26,4 +26,7 @@ public class InstallPlanInputDTO extends InstallPlan {
 
     @ApiModelProperty(value = "用水性质id",position = 105,example = "1")
     private BigInteger waterproperty_id;
+    @ApiModelProperty(value = "客户no",position = 105,example = "1")
+    private Integer customerNo;
+
 }

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

@@ -29,7 +29,8 @@ public class SyncServiceImpl implements SyncService {
     public List<MeterSyncDto> meterSync(MeterSyncInputDto meterSync) {
 
         Integer customerId = customerMapper.findByCustomerNo(meterSync.getCustomerNo());
-        return deviceMapper.meterSync(meterSync.getCreateDate(),customerId,meterSync.getFileNo());
+        List<MeterSyncDto> meterSyncDtos = deviceMapper.meterSync(meterSync.getCreateDate(), customerId, meterSync.getFileNo());
+        return meterSyncDtos;
     }
 
     @Override

+ 7 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/sync/PlatformAapiServiceImpl.java

@@ -3,9 +3,12 @@ package com.bz.smart_city.service.sync;
 import com.bz.smart_city.dao.CustomerMapper;
 import com.bz.smart_city.dao.DeviceMapper;
 import com.bz.smart_city.dao.OperatingValveRecordMapper;
+import com.bz.smart_city.dao.assistant.InstallListMapper;
+import com.bz.smart_city.dao.assistant.InstallPlanMapper;
 import com.bz.smart_city.entity.Customer;
 import com.bz.smart_city.entity.Device;
 import com.bz.smart_city.entity.OperatingValveRecord;
+import com.bz.smart_city.entity.assistant.InstallPlan;
 import com.bz.smart_city.service.DeviceService;
 import com.bz.smart_city.service.PlatformAapiService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,11 +29,14 @@ public class PlatformAapiServiceImpl implements PlatformAapiService {
     private DeviceService deviceService;
     @Autowired
     private OperatingValveRecordMapper operatingValveRecordMapper;
+    @Autowired
+    private InstallListMapper installListMapper;
     @Override
     public void updateMeterNo(String meterNo, String meterCode, String customerNo) {
         Customer customer = customerMapper.findBySiteIdAndCustomerNo(null, customerNo);
         if(customer!=null){
-           deviceMapper.updateMeterNo(meterNo,meterCode,customer.getId());
+            installListMapper.updateMeterNo(meterNo,meterCode,customer.getId());
+            deviceMapper.updateMeterNo(meterNo,meterCode,customer.getId());
         }
 
     }

+ 5 - 4
smart-city-platform/src/main/resources/mapper/DeviceMapper.xml

@@ -1198,7 +1198,7 @@
         sd.customer_id,
         sd.water_meter_no,
         sd.water_meter_file_no as file_no,
-        sd.metercode as meterCode,
+        sil.metercode as meterCode,
         sd.status,
         sd.date_create,
         sd.date_update,
@@ -1210,12 +1210,13 @@
         left join sc_device_manufacturer sdm on(sdm.id = sdt.manufacturer_id)
         where sd.status = 1
         and sd.customer_id = #{customerId}
+        and sil.is_installed=1
         <if test="createDate != null and createDate != ''"> and DATE_FORMAT(sd.date_create, '%Y%m%d' ) = #{createDate}</if>
-        and sd.metercode in <foreach collection="fileNo" item="item" open="(" separator="," close=")">#{item}</foreach>
+        and sil.metercode in <foreach collection="fileNo" item="item" open="(" separator="," close=")">#{item}</foreach>
     </select>
     <update id="updateMeterNo">
-        update sc_device set metercode=#{meterCode}
-        where water_meter_file_no=#{meterNo} and customer_id=#{customerId}
+        update sc_device set metercode=#{meterNo}
+        where metercode=#{meterNo} and customer_id=#{customerId}
     </update>
 </mapper>
 

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

@@ -912,8 +912,12 @@
         status = 1
         and device_id = #{deviceId}
     </update>
+    <update id="updateMeterNo">
+      update sc_install_list set metercode=#{meterNo}
+      where metercode=#{meterCode} and customer_id=#{customerId}
+    </update>
 
-  <select id="meterAccept" resultType="com.bz.smart_city.dto.sync.MeterAcceptDto">
+    <select id="meterAccept" resultType="com.bz.smart_city.dto.sync.MeterAcceptDto">
     select
     sd.water_meter_file_no as file_no,
     sil.is_installed as status