...
|
...
|
@@ -6,9 +6,11 @@ import com.sunyo.energy.location.controller.response.ResultJson; |
|
|
import com.sunyo.energy.location.dao.LocationMapper;
|
|
|
import com.sunyo.energy.location.dao.PayRecordsMapper;
|
|
|
import com.sunyo.energy.location.dao.WaterMeterMapper;
|
|
|
import com.sunyo.energy.location.dao.WaterMeterSaccMapper;
|
|
|
import com.sunyo.energy.location.demopay.QrDemo;
|
|
|
import com.sunyo.energy.location.model.PayRecords;
|
|
|
import com.sunyo.energy.location.model.WaterMeter;
|
|
|
import com.sunyo.energy.location.model.WaterMeterSacc;
|
|
|
import com.sunyo.energy.location.service.WaterMeterService;
|
|
|
import com.sunyo.energy.location.utils.AllUtils;
|
|
|
import com.sunyo.energy.location.utils.HttpsUtils;
|
...
|
...
|
@@ -37,6 +39,9 @@ public class WaterMeterServiceImp implements WaterMeterService { |
|
|
@Autowired
|
|
|
private LocationMapper locationMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private WaterMeterSaccMapper waterMeterSaccMapper;
|
|
|
|
|
|
@Value("${payInfo.merchantid}")
|
|
|
private String MERCHANTIDS;
|
|
|
|
...
|
...
|
@@ -124,6 +129,10 @@ public class WaterMeterServiceImp implements WaterMeterService { |
|
|
waterMeter.setWmVoltage(map.get("wm_voltage").toString());
|
|
|
}
|
|
|
}
|
|
|
//查询累计充值量
|
|
|
String wmIds = AllUtils.wmIdUtils(wmId);
|
|
|
WaterMeterSacc waterMeterSacc = waterMeterSaccMapper.selectByPrimaryKey(wmIds);
|
|
|
waterMeter.setWmSacc(String.valueOf(waterMeterSacc.getWmSacc()));
|
|
|
return waterMeter;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
...
|
...
|
@@ -146,9 +155,22 @@ public class WaterMeterServiceImp implements WaterMeterService { |
|
|
// 得到请求接口 返回值 和总水量
|
|
|
Map<String, Object> map = allWater(payFees, wmId);
|
|
|
Map hashMap = JSON.parseObject(map.get("status").toString(), HashMap.class);
|
|
|
/**
|
|
|
* 外部充值水表成功
|
|
|
*/
|
|
|
if ("0".equals(hashMap.get("state").toString())) {
|
|
|
int update = waterMeterMapper.update(wmId, map.get("allSacc").toString());
|
|
|
WaterMeterSacc waterMeterSacc = new WaterMeterSacc();
|
|
|
waterMeterSacc.setWmId(AllUtils.wmIdUtils(wmId));
|
|
|
waterMeterSacc.setWmSacc(new BigDecimal(String.valueOf(map.get("Add_sacc"))));
|
|
|
/**
|
|
|
* 修改本地累计充值量
|
|
|
*/
|
|
|
int i = waterMeterSaccMapper.updateByPrimaryKeySelective(waterMeterSacc);
|
|
|
if (i > 0){
|
|
|
resultJson.setCode("200");
|
|
|
}else {
|
|
|
resultJson.setCode("203");
|
|
|
}
|
|
|
} else {
|
|
|
resultJson.setCode("203");
|
|
|
}
|
...
|
...
|
@@ -234,13 +256,14 @@ public class WaterMeterServiceImp implements WaterMeterService { |
|
|
// 充值最后立方水数值
|
|
|
String s = AllUtils.nubmerDivision(payFees);
|
|
|
// 查询累计充值量
|
|
|
WaterMeter realTime = findRealTime(wmId);
|
|
|
String allSacc = AllUtils.nubmerAdd(s, realTime.getWmSacc());
|
|
|
WaterMeterSacc waterMeterSacc = waterMeterSaccMapper.selectByPrimaryKey(AllUtils.wmIdUtils(wmId));
|
|
|
String allSacc = AllUtils.nubmerAdd(s, waterMeterSacc.getWmSacc());
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
datas.put("MtId", wmId);
|
|
|
datas.put("Add_sacc", allSacc);
|
|
|
datas.put("Add_addmode", "2");
|
|
|
String status = HttpsUtils.httpRequest(payUrl, datas);
|
|
|
|
|
|
datas.put("allSacc", allSacc);
|
|
|
datas.put("status", status);
|
|
|
|
...
|
...
|
|