|
@@ -11,6 +11,7 @@ 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.pay.AmountWaterUsedAmountMapper;
|
|
|
+import com.bz.smart_city.dao.pay.PayBaseAccountMapper;
|
|
|
import com.bz.smart_city.dto.LoginUser;
|
|
|
import com.bz.smart_city.dto.MeterSyncDto;
|
|
|
import com.bz.smart_city.dto.MeterSyncInputDto;
|
|
@@ -18,6 +19,7 @@ import com.bz.smart_city.dto.pay.PayBaseConfigDto;
|
|
|
import com.bz.smart_city.entity.Customer;
|
|
|
import com.bz.smart_city.entity.Device;
|
|
|
import com.bz.smart_city.entity.SyncValveResult;
|
|
|
+import com.bz.smart_city.entity.pay.PayBaseAccount;
|
|
|
import com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela;
|
|
|
import com.bz.smart_city.quartz.entity.QuartzEntity;
|
|
|
import com.bz.smart_city.quartz.job.DeviceSyncJob;
|
|
@@ -48,6 +50,8 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
|
|
|
private JobAndTriggerService jobAndTriggerService;
|
|
|
@Autowired
|
|
|
private PayBaseConfigService payBaseConfigService;
|
|
|
+ @Resource
|
|
|
+ PayBaseAccountMapper payBaseAccountMapper;
|
|
|
@Value("${Sync.Data.Url}")
|
|
|
String SyncUrl;
|
|
|
|
|
@@ -90,9 +94,9 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
|
|
|
|
|
|
@Override
|
|
|
public void start(){
|
|
|
- List<PayBaseCustomerandmeterrela> payBaseCustomerandmeterrelas = amountWaterUsedAmountMapper.getCustIdAndSiteId();
|
|
|
- for (PayBaseCustomerandmeterrela payBaseCustomerandmeterrela: payBaseCustomerandmeterrelas){
|
|
|
- this.upMeters(payBaseCustomerandmeterrela.getSiteId().intValue(),payBaseCustomerandmeterrela.getCustomerId().intValue());
|
|
|
+ List<PayBaseAccount> payBaseAccounts = payBaseAccountMapper.getCustIdAndSiteId();
|
|
|
+ for (PayBaseAccount payBaseAccount: payBaseAccounts){
|
|
|
+ this.upMeters(payBaseAccount.getSiteId().intValue(),payBaseAccount.getCustomerId().intValue());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -138,38 +142,31 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
|
|
|
if(meterSyncDtoList != null){
|
|
|
for(MeterSyncDto meterSyncDto:meterSyncDtoList){
|
|
|
//水表档案号变更
|
|
|
- if(!meterSyncDto.getMeterCode().equals(meterSyncDto.getFileNo())){
|
|
|
- //修改计费系统水表档案号
|
|
|
- if(deviceMapper.updateMeterCode(null,meterSyncDto.getMeterCode(),meterSyncDto.getFileNo()) > 0){
|
|
|
- try {
|
|
|
- meterSyncDto.setMeterCode(meterSyncDto.getFileNo());
|
|
|
- //更改营业系统水表档案号
|
|
|
- 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 ,"");
|
|
|
- SyncValveResult syncValveResult = JacksonUtil.string2Obj(postResult, SyncValveResult.class);
|
|
|
- Integer getResult = Integer.parseInt(syncValveResult.getStatus());
|
|
|
- }
|
|
|
- catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
+ if(StringUtils.isNotBlank(meterSyncDto.getFileNo()) && !meterSyncDto.getMeterCode().equals(meterSyncDto.getFileNo())){
|
|
|
+ try {
|
|
|
+ //更改营业系统水表档案号
|
|
|
+ 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 ,"");
|
|
|
+ SyncValveResult syncValveResult = JacksonUtil.string2Obj(postResult, SyncValveResult.class);
|
|
|
+ Integer getResult = Integer.parseInt(syncValveResult.getStatus());
|
|
|
+ if(getResult == null || getResult != 0){
|
|
|
+ continue; //失败
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
- continue;
|
|
|
+ catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- String strList = JacksonUtil.obj2String(meterSyncDto);
|
|
|
- MeterSyncDto resultMeterSyncDto = JacksonUtil.string2Obj(strList,MeterSyncDto.class);
|
|
|
- resultMeterSyncDto.setCurrStatus(1);
|
|
|
-
|
|
|
- if(StringUtils.isBlank(resultMeterSyncDto.getInitialData()))
|
|
|
- resultMeterSyncDto.setInitialData("0");
|
|
|
- deviceMapper.updateSync(resultMeterSyncDto);
|
|
|
+ meterSyncDto.setCurrStatus(1);
|
|
|
+ if(StringUtils.isBlank(meterSyncDto.getInitialData()))
|
|
|
+ meterSyncDto.setInitialData("0");
|
|
|
+ deviceMapper.updateSync(meterSyncDto);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|