manual config time n rate model altered
This commit is contained in:
parent
75b6fbd078
commit
e7502be831
@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT;
|
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT;
|
||||||
import static cn.hutool.core.util.NumberUtil.isInteger;
|
import static cn.hutool.core.util.NumberUtil.isInteger;
|
||||||
@ -123,6 +124,8 @@ public class PileController {
|
|||||||
try {
|
try {
|
||||||
handler.sendClientBinary(HexUtils.toBytes(rsmsg));
|
handler.sendClientBinary(HexUtils.toBytes(rsmsg));
|
||||||
log.info("pile[{}] rate model[{}] sent ⚪ {}", pileNo, rateModelIdStation, rsmsg);
|
log.info("pile[{}] rate model[{}] sent ⚪ {}", pileNo, rateModelIdStation, rsmsg);
|
||||||
|
String configRmReply = pk.concat(".configRmReply");
|
||||||
|
REDIS.setCacheObject(configRmReply, "已下发", 30L, TimeUnit.MINUTES);
|
||||||
String skey = pk.concat(".seqhex");
|
String skey = pk.concat(".seqhex");
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
Date date = Calendar.getInstance().getTime();
|
Date date = Calendar.getInstance().getTime();
|
||||||
@ -130,6 +133,8 @@ public class PileController {
|
|||||||
handler.sendClientBinary(HexUtils.toBytes(timebin));
|
handler.sendClientBinary(HexUtils.toBytes(timebin));
|
||||||
REDIS.setCacheMapValue(pk, "manConfTime", DateUtil.format(date,
|
REDIS.setCacheMapValue(pk, "manConfTime", DateUtil.format(date,
|
||||||
NORM_DATETIME_FORMAT));
|
NORM_DATETIME_FORMAT));
|
||||||
|
String configTimeReply = pk.concat(".configTimeReply");
|
||||||
|
REDIS.setCacheObject(configTimeReply, "已下发", 30L, TimeUnit.MINUTES);
|
||||||
r = R.fail("校时校费下发成功.");
|
r = R.fail("校时校费下发成功.");
|
||||||
} catch (IOException | InterruptedException e) {
|
} catch (IOException | InterruptedException e) {
|
||||||
r = R.fail("校时|校费下发失败,请重试.");
|
r = R.fail("校时|校费下发失败,请重试.");
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT;
|
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT;
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||||
@ -39,9 +40,8 @@ public class PileTimeConfigReplyDataLogic implements ServiceLogic {
|
|||||||
String pileNo = (String) req.get("pileNo");
|
String pileNo = (String) req.get("pileNo");
|
||||||
String pk = "pile:".concat(pileNo);
|
String pk = "pile:".concat(pileNo);
|
||||||
String configTime = DateUtil.format(cp56toDate(pileTimeConfigReplyData.getSetTime()), NORM_DATETIME_FORMAT);
|
String configTime = DateUtil.format(cp56toDate(pileTimeConfigReplyData.getSetTime()), NORM_DATETIME_FORMAT);
|
||||||
Map<String, Object> cachePile = REDIS.getCacheMap(pk);
|
String configTimeReply = pk.concat(".configTimeReply");
|
||||||
cachePile.put("configTimeReply", configTime);
|
REDIS.setCacheObject(configTimeReply, "校时设置成功:".concat(configTime), 30L, TimeUnit.MINUTES);
|
||||||
REDIS.setCacheMap(pk, cachePile);
|
|
||||||
log.debug("({}) set time success√: [{}]", pileNo, configTime);
|
log.debug("({}) set time success√: [{}]", pileNo, configTime);
|
||||||
String remark = "充电桩同步时钟";
|
String remark = "充电桩同步时钟";
|
||||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.xhpc.pp.logic;
|
package com.xhpc.pp.logic;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||||
import com.xhpc.common.data.up.PileConfigReplyData;
|
import com.xhpc.common.data.up.PileConfigReplyData;
|
||||||
@ -16,10 +15,9 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT;
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||||
import static com.xhpc.pp.tx.ServiceResult.*;
|
import static com.xhpc.pp.tx.ServiceResult.*;
|
||||||
|
|
||||||
@ -42,13 +40,14 @@ public class RateModelConfigReplyDataLogic implements ServiceLogic {
|
|||||||
|
|
||||||
String result = FAIL;
|
String result = FAIL;
|
||||||
if (HEX_01.equals(configResult)) {
|
if (HEX_01.equals(configResult)) {
|
||||||
final String pkey = "pile:".concat(pileRateModelConfigReplyData.getPileNo());
|
final String pk = "pile:".concat(pileRateModelConfigReplyData.getPileNo());
|
||||||
Map<String, Object> cachePile = REDIS.getCacheMap(pkey);
|
Map<String, Object> cachePile = REDIS.getCacheMap(pk);
|
||||||
ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(cachePile.get("stationId").toString()));
|
ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(cachePile.get("stationId").toString()));
|
||||||
String version = (String) cachePile.get("version");
|
String version = (String) cachePile.get("version");
|
||||||
|
Integer rateModelId = pileRateModelConfigReplyData.getRateModelId();
|
||||||
if (!"0A".equals(version) && !"0B".equals(version)) {
|
if (!"0A".equals(version) && !"0B".equals(version)) {
|
||||||
Long stationRateModelId = cacheStation.getRateModelId();
|
Long stationRateModelId = cacheStation.getRateModelId();
|
||||||
if (stationRateModelId.intValue() == pileRateModelConfigReplyData.getRateModelId()) {
|
if (stationRateModelId.intValue() == rateModelId) {
|
||||||
cachePile.put("rateModelId", cacheStation.getRateModelId());
|
cachePile.put("rateModelId", cacheStation.getRateModelId());
|
||||||
result = OK;
|
result = OK;
|
||||||
}
|
}
|
||||||
@ -56,9 +55,9 @@ public class RateModelConfigReplyDataLogic implements ServiceLogic {
|
|||||||
cachePile.put("rateModelId", cacheStation.getRateModelId());
|
cachePile.put("rateModelId", cacheStation.getRateModelId());
|
||||||
result = OK;
|
result = OK;
|
||||||
}
|
}
|
||||||
String configTime = DateUtil.format(Calendar.getInstance().getTime(), NORM_DATETIME_FORMAT);
|
REDIS.setCacheMap(pk, cachePile);
|
||||||
cachePile.put("configRmReply", configTime);
|
String configTimeReply = pk.concat(".configTimeReply");
|
||||||
REDIS.setCacheMap(pkey, cachePile);
|
REDIS.setCacheObject(configTimeReply, "校费设置成功,费率模型:".concat(String.valueOf(rateModelId)), 30L, TimeUnit.MINUTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
String remark = "充电桩收到计费模型应答";
|
String remark = "充电桩收到计费模型应答";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user