Преглед на файлове

档案同步接口使用客户编号

oppadmin преди 4 години
родител
ревизия
d9507b3ae7

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/dto/MeterSyncInputDto.java

@@ -14,7 +14,7 @@ import java.util.List;
 public class MeterSyncInputDto {
     @ApiModelProperty(value = "创建日期 格式:yyyyMMdd")
     private String createDate;
-    @ApiModelProperty(value = "客户编码,即抄表系统中的customer_id")
+    @ApiModelProperty(value = "客户编码,即抄表系统中的customer_no")
     private String customerNo;
     @ApiModelProperty(value = "水表档案号,即sc_device表中的metercode")
     private List<String> fileNo;

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/InstallPlan.java

@@ -46,7 +46,7 @@ public class InstallPlan {
     private Integer customerId;
 
     @ApiModelProperty(value="客户编号,参考sc_customer")
-    private String customerNo;
+    private Integer customerNo;
 
     @ApiModelProperty(value="设备类型id,参考sc_device_type",position = 12,example = "16")
     private Integer deviceTypeId;

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

@@ -103,15 +103,6 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
        }
         else
             return;
-        /*
-        List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigService.getPrintInfo("CUSTOMER_NO",siteId,customerId);
-        for (PayBaseConfigDto item : payBaseConfigDtos){
-            if("CUSTOMER_NO".equals(item.getName().trim())){
-                customerNo = item.getValue();
-            }
-        }
-        if(customerNo == "")
-            return;*/
 
         //查询未同步的数据
         String url = SyncUrl+"/api/syncData/meterSync";
@@ -149,7 +140,7 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
                                                 meterSyncDto.setMeterCode(meterSyncDto.getFileNo());
                                                 //更改营业系统水表档案号
                                                 String updateMeterNoUrl = url + "/api/platform/updateMeterNo";
-                                                String params = String.format("?customerNo=%s&meterNo=%s&meterCode=%s",customerId,meterSyncDto.getFileNo(),meterSyncDto.getMeterCode());
+                                                String params = String.format("?customerNo=%s&meterNo=%s&meterCode=%s",customerNo,meterSyncDto.getFileNo(),meterSyncDto.getMeterCode());
                                                 updateMeterNoUrl += params;
                                                 String postResult = HttpRequest.doPost(updateMeterNoUrl ,"");
                                                 SyncValveResult syncValveResult = JacksonUtil.string2Obj(postResult, SyncValveResult.class);

+ 12 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PaySyncDataServiceImpl.java

@@ -8,6 +8,7 @@ import com.bz.smart_city.commom.util.HttpRequest;
 import com.bz.smart_city.commom.util.JacksonUtil;
 import com.bz.smart_city.commom.util.SnowflakeIdWorker;
 import com.bz.smart_city.commom.util.UserUtil;
+import com.bz.smart_city.dao.CustomerMapper;
 import com.bz.smart_city.dao.DeviceMapper;
 import com.bz.smart_city.dao.WaterMeterReplaceLogMapper;
 import com.bz.smart_city.dto.AreaDto;
@@ -19,6 +20,7 @@ import com.bz.smart_city.dto.pay.InstallPlanInputDTO;
 import com.bz.smart_city.dto.pay.PayBaseAccountDto;
 import com.bz.smart_city.dto.pay.PayBaseConfigDto;
 import com.bz.smart_city.entity.Community;
+import com.bz.smart_city.entity.Customer;
 import com.bz.smart_city.entity.Device;
 import com.bz.smart_city.entity.WaterMeterReplaceLog;
 import com.bz.smart_city.service.CommunityService;
@@ -53,6 +55,8 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
     private PayBaseConfigService payBaseConfigService;
     @Resource
     DeviceMapper deviceMapper;
+    @Resource
+    private CustomerMapper customerMapper;
     @Value("${Sync.Data.Url}")
     String SyncUrl;
 
@@ -138,6 +142,13 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
         }
         installPlanInput.setPlatformType(2);
 
+        //取客户编号
+        String customerNo= "";
+        Customer customer= customerMapper.findById(loginUser.getCustomerId());
+        if(customer != null && customer.getCustomerNo() != null){
+            customerNo = customer.getCustomerNo();
+        }
+
 /*        //取客户编号
         String customerNo="";
         List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigService.getPrintInfo("CUSTOMER_NO",loginUser.getSiteId(),loginUser.getCustomerId());
@@ -268,6 +279,7 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
             //调用接口
             String url = SyncUrl + "/api/syncData/syncPlan";
             try {
+                installPlanInput.setCustomerNo(new Integer(customerNo)); //传客户编号
                 String json = JacksonUtil.obj2String(installPlanInput);
                 String result = HttpRequest.doPost(url,json);
                 AjaxMessage ajaxMessage = JacksonUtil.string2Obj(result,AjaxMessage.class);

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

@@ -99,7 +99,7 @@
     <update id="updateMeterCode">
         update sc_device
         set metercode=#{newMeterCode}
-        where metercode = #{newMeterCode}
+        where metercode = #{oldMeterCode}
         <if test="customerId != null and customerId != ''"> and customer_id=#{customerId}</if>
     </update>