记损比率
This commit is contained in:
parent
fbfbad7708
commit
d00966b1fc
@ -107,14 +107,13 @@ public class ChargingController {
|
|||||||
if (!stationRateModelId.equals(pileRateModelId)) {
|
if (!stationRateModelId.equals(pileRateModelId)) {
|
||||||
CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:".concat(stationRateModelId.toString()));
|
CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:".concat(stationRateModelId.toString()));
|
||||||
String rateModel = RateModelRequestLogic.translate(cacheRateModel);
|
String rateModel = RateModelRequestLogic.translate(cacheRateModel);
|
||||||
String gunkey = "gun:".concat(pileNo).concat(startChargingData.getGunId());
|
String skey = pkey.concat(".seqhex");
|
||||||
String skey = gunkey.concat(".seqhex");
|
String rateModelMsg = "68C2".concat(seqHex(skey)).concat("0058").concat(pileNo)
|
||||||
String seq = seqHex(skey);
|
|
||||||
String rateModelMsg = "685E".concat(seq).concat("0058").concat(pileNo)
|
|
||||||
.concat(String.format("%04X", stationRateModelId))
|
.concat(String.format("%04X", stationRateModelId))
|
||||||
.concat(rateModel);
|
.concat(rateModel);
|
||||||
rateModelMsg = rateModelMsg.concat(CRCCalculator.calcCrc(rateModel));
|
rateModelMsg = rateModelMsg.concat(CRCCalculator.calcCrc(rateModelMsg.substring(4)));
|
||||||
String response = HttpUtils.post(fmt(svcSrv).concat("/native/pile/".concat(pileNo).concat("/rateModel")), rateModelMsg);
|
String response = HttpUtils.post(fmt(svcSrv).concat("/native/pile/".concat(pileNo).concat("/rateModel")),
|
||||||
|
rateModelMsg);
|
||||||
JSONObject responseJson = (JSONObject) JSON.parse(response);
|
JSONObject responseJson = (JSONObject) JSON.parse(response);
|
||||||
assert responseJson != null;
|
assert responseJson != null;
|
||||||
int code = responseJson.getInteger("code");
|
int code = responseJson.getInteger("code");
|
||||||
|
|||||||
@ -67,7 +67,7 @@ public class PileController {
|
|||||||
R r;
|
R r;
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
try {
|
try {
|
||||||
log.info("server send msg >>>> ({}) |{}|", pileNo, msg);
|
log.info("[{}] - server send msg >>>> ({}) |{}|", handler.getName(), pileNo, msg);
|
||||||
handler.sendClientBinary(HexUtils.toBytes(msg));
|
handler.sendClientBinary(HexUtils.toBytes(msg));
|
||||||
r = R.ok(null, "费率模型已下发,请再次启动充电");
|
r = R.ok(null, "费率模型已下发,请再次启动充电");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@ -35,7 +35,7 @@ public class PileTimeConfigReplyDataLogic implements ServiceLogic {
|
|||||||
Map<String, Object> cachePile = REDIS.getCacheMap(pk);
|
Map<String, Object> cachePile = REDIS.getCacheMap(pk);
|
||||||
cachePile.put("configTime", configTime);
|
cachePile.put("configTime", configTime);
|
||||||
REDIS.setCacheMap(pk, cachePile);
|
REDIS.setCacheMap(pk, cachePile);
|
||||||
log.info("({}) set time success: √[{}]", pileNo, configTime);
|
log.info("({}) set time success√: [{}]", pileNo, configTime);
|
||||||
return new ServiceResult(false);
|
return new ServiceResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public class RateModelRequestLogic implements ServiceLogic {
|
|||||||
.concat(toHexInt(cacheRateModel.getT3SvcPrice()))
|
.concat(toHexInt(cacheRateModel.getT3SvcPrice()))
|
||||||
.concat(toHexInt(cacheRateModel.getT4Price()))
|
.concat(toHexInt(cacheRateModel.getT4Price()))
|
||||||
.concat(toHexInt(cacheRateModel.getT4SvcPrice()))
|
.concat(toHexInt(cacheRateModel.getT4SvcPrice()))
|
||||||
.concat(toHexInt(cacheRateModel.getLossRate()))
|
.concat(String.format("%02X", cacheRateModel.getLossRate()))
|
||||||
.concat(String.join("", cacheRateModel.getTfPricesSeq()));
|
.concat(String.join("", cacheRateModel.getTfPricesSeq()));
|
||||||
return rateModel;
|
return rateModel;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,8 @@ package com.xhpc.pp.server;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.nacos.api.exception.NacosException;
|
import com.alibaba.nacos.api.exception.NacosException;
|
||||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||||
import com.xhpc.common.data.redis.CacheRateModel;
|
|
||||||
import com.xhpc.pp.domain.ServiceField;
|
import com.xhpc.pp.domain.ServiceField;
|
||||||
import com.xhpc.pp.logic.FieldLogic;
|
import com.xhpc.pp.logic.FieldLogic;
|
||||||
import com.xhpc.pp.logic.RateModelRequestLogic;
|
|
||||||
import com.xhpc.pp.logic.ServiceMainLogic;
|
import com.xhpc.pp.logic.ServiceMainLogic;
|
||||||
import com.xhpc.pp.tx.ServiceParameter;
|
import com.xhpc.pp.tx.ServiceParameter;
|
||||||
import com.xhpc.pp.tx.ServiceResult;
|
import com.xhpc.pp.tx.ServiceResult;
|
||||||
@ -103,7 +101,7 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
|
|||||||
REDIS.setCacheMap(pilekey, cachePile);
|
REDIS.setCacheMap(pilekey, cachePile);
|
||||||
regHandler(handler, pileNo, req);
|
regHandler(handler, pileNo, req);
|
||||||
}
|
}
|
||||||
if (SERVICE_RMCR.equals(serviceName) && OK.equals(resultCode)) {
|
if (SERVICE_RMR.equals(serviceName) && OK.equals(resultCode)) {
|
||||||
setCachePileRM(pilekey);
|
setCachePileRM(pilekey);
|
||||||
}
|
}
|
||||||
if (result.getBinary() != null) {
|
if (result.getBinary() != null) {
|
||||||
@ -129,18 +127,6 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
|
|||||||
}
|
}
|
||||||
cachePile.put("tcfg", true);
|
cachePile.put("tcfg", true);
|
||||||
REDIS.setCacheMap(pilekey, cachePile);
|
REDIS.setCacheMap(pilekey, cachePile);
|
||||||
Thread.sleep(500);
|
|
||||||
Long stationId = (Long) cachePile.get("stationId");
|
|
||||||
ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(stationId.toString()));
|
|
||||||
Long stationRateModelId = cacheStation.getRateModelId();
|
|
||||||
CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:".concat(stationRateModelId.toString()));
|
|
||||||
String rateModel = RateModelRequestLogic.translate(cacheRateModel);
|
|
||||||
String rateModelMsg = "685E".concat(seqHex(skey)).concat("0058").concat(pileNo)
|
|
||||||
.concat(String.format("%04X", stationRateModelId))
|
|
||||||
.concat(rateModel);
|
|
||||||
rateModelMsg = rateModelMsg.concat(CRCCalculator.calcCrc(rateModel));
|
|
||||||
log.info("server send msg >>>> ({}) |{}|", pileNo, rateModelMsg);
|
|
||||||
handler.sendClientBinary(HexUtils.toBytes(rateModelMsg));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +151,7 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
|
|||||||
ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(cachePile.get("stationId").toString()));
|
ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(cachePile.get("stationId").toString()));
|
||||||
cachePile.put("rateModelId", cacheStation.getRateModelId());
|
cachePile.put("rateModelId", cacheStation.getRateModelId());
|
||||||
REDIS.setCacheMap(pilekey, cachePile);
|
REDIS.setCacheMap(pilekey, cachePile);
|
||||||
log.info("rate model responds success √");
|
log.info("rate model responds success√");
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<byte[]> parseDataList(byte[] data) {
|
private List<byte[]> parseDataList(byte[] data) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user