浏览代码

档案同步修改

oppadmin 4 年之前
父节点
当前提交
717cca5e90

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

@@ -42,6 +42,6 @@ public class PayMeter {
     @ApiModelProperty(example = "1",value = "水表ID")
     public BigInteger deviceId;
     @ApiModelProperty(example = "1",value = "阀门状态: 0关阀 1开阀  2 无阀,3异常")
-    public int controlStatus;
+    public Integer controlStatus;
 
 }

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

@@ -118,11 +118,11 @@ public class ControlDayServiceImpl implements ControlDayService, InitializingBea
 
                                     String params = String.format("?customerNo=%s&meterNo=%s&type=%s",customerNo.getCustomerNo(),payControlRecord.getMeterId().toString(),payControlRecord.getType().toString());
                                     url += params;
-                                    SyncValveSend syncValveSend = new SyncValveSend();
+                                    /*SyncValveSend syncValveSend = new SyncValveSend();
                                     syncValveSend.setMeterNo(payControlRecord.getMeterId().toString());
                                     syncValveSend.setType(payControlRecord.getType().toString());
                                     syncValveSend.setCustomerNo(customerNo.getCustomerNo());
-                                    String json = JacksonUtil.obj2String(syncValveSend);
+                                    String json = JacksonUtil.obj2String(syncValveSend);*/
                                     String postResult = HttpRequest.doPost(url ,"");
                                     SyncValveResult syncValveResult = JacksonUtil.string2Obj(postResult, SyncValveResult.class);
                                     Integer getResult = Integer.parseInt(syncValveResult.getStatus());

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

@@ -1,6 +1,10 @@
 package com.bz.smart_city.service.impl.pay;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.bz.smart_city.commom.model.AjaxMessage;
+import com.bz.smart_city.commom.util.HttpClientUtils;
 import com.bz.smart_city.commom.util.HttpRequest;
 import com.bz.smart_city.commom.util.JacksonUtil;
 import com.bz.smart_city.commom.util.UserUtil;
@@ -121,15 +125,16 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
                 meterSyncInputDto.setFileNo(fileNos);
 
                 //调用接口同步
-                String json = JacksonUtil.obj2String(meterSyncInputDto);
+                String json= JSON.toJSON(meterSyncInputDto).toString();
                 try {
-                    String result = HttpRequest.doPost(url,json);
-                    AjaxMessage<List<MeterSyncDto>> ajaxMessage = JacksonUtil.string2Obj(result,AjaxMessage.class);
-
-                    if(ajaxMessage != null){
+                    String result = HttpClientUtils.doPostWithJson(url,json);
+                    JSONObject jsonObject= JSON.parseObject(result);
+                    Integer status= jsonObject.getInteger("status");
+                    if(status.equals(0)){
                         //更新水表信息
-                        if(ajaxMessage.getStatus() == 0){
-                            List<MeterSyncDto> meterSyncDtoList = ajaxMessage.getData();
+                        if(1==1){
+                            JSONArray datas = jsonObject.getJSONArray("data");
+                            List<MeterSyncDto> meterSyncDtoList = datas.toJavaList(MeterSyncDto.class);
                             if(meterSyncDtoList != null){
                                 for(MeterSyncDto meterSyncDto:meterSyncDtoList){
                                     //水表档案号变更
@@ -139,7 +144,7 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
                                             try {
                                                 meterSyncDto.setMeterCode(meterSyncDto.getFileNo());
                                                 //更改营业系统水表档案号
-                                                String updateMeterNoUrl = url + "/api/platform/updateMeterNo";
+                                                String updateMeterNoUrl = SyncUrl + "/api/platform/updateMeterNo";
                                                 String params = String.format("?customerNo=%s&meterNo=%s&meterCode=%s",customerNo,meterSyncDto.getFileNo(),meterSyncDto.getMeterCode());
                                                 updateMeterNoUrl += params;
                                                 String postResult = HttpRequest.doPost(updateMeterNoUrl ,"");
@@ -164,29 +169,14 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
                                     deviceMapper.updateSync(resultMeterSyncDto);
                                 }
                             }
-
-                            for(int i=0;i<meterSyncDtoList.size();i++){
-
-                                //水表档案号变更
-                                if(!meterSyncDtoList.get(i).getMeterCode().equals(meterSyncDtoList.get(i).getFileNo())){
-                                    //修改计费系统水表档案号
-
-
-                                }
-
-                                String strList = JacksonUtil.obj2String(meterSyncDtoList.get(i));
-                                MeterSyncDto meterSyncDto = JacksonUtil.string2Obj(strList,MeterSyncDto.class);
-                                meterSyncDto.setCurrStatus(1);
-
-                                if(StringUtils.isBlank(meterSyncDto.getInitialData()))
-                                    meterSyncDto.setInitialData("0");
-                                deviceMapper.updateSync(meterSyncDto);
-                            }
+                            
                         }
                     }
 
                 } catch (IOException e) {
                     log.error(e.getMessage());
+                } catch (Exception e) {
+                    e.printStackTrace();
                 }
             }
         }

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

@@ -279,6 +279,7 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
             //调用接口
             String url = SyncUrl + "/api/syncData/syncPlan";
             try {
+                installPlanInput.setCustomerId(null);
                 installPlanInput.setCustomerNo(new Integer(customerNo)); //传客户编号
                 String json = JacksonUtil.obj2String(installPlanInput);
                 String result = HttpRequest.doPost(url,json);