mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
预约充电
This commit is contained in:
@@ -575,6 +575,7 @@ public class PileService {
|
||||
PileReservedInfo reservedInfo = new PileReservedInfo();
|
||||
reservedInfo.setMemberId(dto.getMemberId());
|
||||
reservedInfo.setPileSn(dto.getPileSn());
|
||||
reservedInfo.setPileConnectorCode(dto.getPileConnectorCode());
|
||||
reservedInfo.setStatus(Constants.ZERO); // 默认未生效
|
||||
// reservedInfo.setStartTime(DateUtils.parseDate(dto.getStartTime()));
|
||||
reservedInfo.setStartTime(Time.valueOf(dto.getStartTime()));
|
||||
|
||||
@@ -27,9 +27,15 @@ public class CacheConstants {
|
||||
// 缓存时间 12小时
|
||||
public static final int cache_expire_time_12h = cache_expire_time_1h * 12;
|
||||
|
||||
// 缓存时间 24小时
|
||||
// 缓存时间 1天 24小时
|
||||
public static final int cache_expire_time_1d = cache_expire_time_1h * 24;
|
||||
|
||||
// 缓存时间 3天
|
||||
public static final int cache_expire_time_3d = cache_expire_time_1d * 3;
|
||||
|
||||
// 缓存时间 7天
|
||||
public static final int cache_expire_time_7d = cache_expire_time_1d * 7;
|
||||
|
||||
// 缓存时间 10天
|
||||
public static final int cache_expire_time_10d = cache_expire_time_1d * 10;
|
||||
|
||||
@@ -61,6 +67,9 @@ public class CacheConstants {
|
||||
// 平台测试员
|
||||
public static final String PLATFORM_TESTER = "platform_tester:";
|
||||
|
||||
// 枪口插枪状态 缓存前缀
|
||||
public static final String CHARGER_PLUGGED_IN_STATUS = "charger_plugged_in_status:";
|
||||
|
||||
// 查询桩型号信息
|
||||
public static final String GET_PILE_MODEL_INFO_BY_MODEL_ID = "get_pile_model_info_by_model_id:";
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.YKCPileFaultReasonEnum;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||
@@ -37,303 +38,322 @@ import java.util.concurrent.TimeUnit;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UploadRealTimeMonitorHandler extends AbstractHandler {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_CODE.getBytes());
|
||||
private final String oldVersionType = YKCUtils.frameType2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_OLD_VERSION_CODE.getBytes());
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_CODE.getBytes());
|
||||
private final String oldVersionType = YKCUtils.frameType2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_OLD_VERSION_CODE.getBytes());
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
YKCOperateFactory.register(type, this);
|
||||
YKCOperateFactory.register(oldVersionType, this);
|
||||
}
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
YKCOperateFactory.register(type, this);
|
||||
YKCOperateFactory.register(oldVersionType, this);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PileBasicInfoService pileBasicInfoService;
|
||||
@Autowired
|
||||
private PileBasicInfoService pileBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
||||
// log.info("[===获取桩上传的实时监测数据===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||
RealTimeMonitorData realTimeMonitorData = new RealTimeMonitorData();
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
||||
// log.info("[===获取桩上传的实时监测数据===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||
RealTimeMonitorData realTimeMonitorData = new RealTimeMonitorData();
|
||||
|
||||
// 获取消息体
|
||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||
// log.info("上传实时数据msgBody:{}", BytesUtil.bcd2Str(msgBody));
|
||||
int startIndex = 0;
|
||||
int length = 16;
|
||||
// 获取消息体
|
||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||
// log.info("上传实时数据msgBody:{}", BytesUtil.bcd2Str(msgBody));
|
||||
int startIndex = 0;
|
||||
int length = 16;
|
||||
|
||||
// 交易流水号
|
||||
byte[] orderCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String transactionCode = BytesUtil.bcd2Str(orderCodeByteArr);
|
||||
realTimeMonitorData.setTransactionCode(transactionCode);
|
||||
// 交易流水号
|
||||
byte[] orderCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String transactionCode = BytesUtil.bcd2Str(orderCodeByteArr);
|
||||
realTimeMonitorData.setTransactionCode(transactionCode);
|
||||
|
||||
// 桩编码
|
||||
startIndex += length;
|
||||
length = 7;
|
||||
byte[] pileSnByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
realTimeMonitorData.setPileSn(pileSn);
|
||||
// 桩编码
|
||||
startIndex += length;
|
||||
length = 7;
|
||||
byte[] pileSnByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
realTimeMonitorData.setPileSn(pileSn);
|
||||
|
||||
// 保存时间
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
// 保存时间
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] pileConnectorCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String connectorCode = BytesUtil.bcd2Str(pileConnectorCodeByteArr);
|
||||
realTimeMonitorData.setConnectorCode(connectorCode);
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] connectorCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String connectorCode = BytesUtil.bcd2Str(connectorCodeByteArr);
|
||||
realTimeMonitorData.setConnectorCode(connectorCode);
|
||||
|
||||
// 枪口编号
|
||||
String pileConnectorCode = pileSn + connectorCode;
|
||||
|
||||
// 枪口状态 0x00:离线 0x01:故障 0x02:空闲 0x03:充电 0x04 预约中
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] connectorStatusByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String connectorStatus = BytesUtil.bcd2Str(connectorStatusByteArr);
|
||||
realTimeMonitorData.setConnectorStatus(connectorStatus);
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] connectorStatusByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String connectorStatus = BytesUtil.bcd2Str(connectorStatusByteArr);
|
||||
realTimeMonitorData.setConnectorStatus(connectorStatus);
|
||||
|
||||
// 是否归位 0x00:否 0x01:是 0x02:未知(无法检测到枪是否插回枪座即 未知)
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] homingFlagByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String homingFlag = BytesUtil.bcd2Str(homingFlagByteArr);
|
||||
realTimeMonitorData.setHomingFlag(homingFlag);
|
||||
// 是否归位 0x00:否 0x01:是 0x02:未知(无法检测到枪是否插回枪座即 未知)
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] homingFlagByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String homingFlag = BytesUtil.bcd2Str(homingFlagByteArr);
|
||||
realTimeMonitorData.setHomingFlag(homingFlag);
|
||||
|
||||
// 是否插枪 0x00:否 0x01:是
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] putGunTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String putGunType = BytesUtil.bcd2Str(putGunTypeByteArr);
|
||||
realTimeMonitorData.setPutGunType(putGunType);
|
||||
// 是否插枪 0x00:否 0x01:是
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] isChargerPluggedInByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String isChargerPluggedIn = BytesUtil.bcd2Str(isChargerPluggedInByteArr);
|
||||
realTimeMonitorData.setPutGunType(isChargerPluggedIn);
|
||||
|
||||
// 输出电压 精确到小数点后一位;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] outputVoltageByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String outputVoltage = YKCUtils.convertVoltageCurrent(outputVoltageByteArr);
|
||||
realTimeMonitorData.setOutputVoltage(outputVoltage);
|
||||
// 输出电压 精确到小数点后一位;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] outputVoltageByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String outputVoltage = YKCUtils.convertVoltageCurrent(outputVoltageByteArr);
|
||||
realTimeMonitorData.setOutputVoltage(outputVoltage);
|
||||
|
||||
// 输出电流 精确到小数点后一位;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] outputCurrentByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String outputCurrent = YKCUtils.convertVoltageCurrent(outputCurrentByteArr);
|
||||
realTimeMonitorData.setOutputCurrent(outputCurrent);
|
||||
// 输出电流 精确到小数点后一位;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] outputCurrentByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String outputCurrent = YKCUtils.convertVoltageCurrent(outputCurrentByteArr);
|
||||
realTimeMonitorData.setOutputCurrent(outputCurrent);
|
||||
|
||||
// 枪线温度 整形, 偏移量-50;待机置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] gunLineTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String gunLineTemperature = YKCUtils.transitionTemperature(gunLineTemperatureByteArr);
|
||||
realTimeMonitorData.setGunLineTemperature(gunLineTemperature);
|
||||
// 枪线温度 整形, 偏移量-50;待机置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] gunLineTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String gunLineTemperature = YKCUtils.transitionTemperature(gunLineTemperatureByteArr);
|
||||
realTimeMonitorData.setGunLineTemperature(gunLineTemperature);
|
||||
|
||||
// 枪线编码 没有置零
|
||||
startIndex += length;
|
||||
length = 8;
|
||||
byte[] gunLineCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String gunLineCode = BytesUtil.bcd2Str(gunLineCodeByteArr);
|
||||
realTimeMonitorData.setGunLineCode(gunLineCode);
|
||||
// 枪线编码 没有置零
|
||||
startIndex += length;
|
||||
length = 8;
|
||||
byte[] gunLineCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String gunLineCode = BytesUtil.bcd2Str(gunLineCodeByteArr);
|
||||
realTimeMonitorData.setGunLineCode(gunLineCode);
|
||||
|
||||
// SOC 待机置零;交流桩置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] SOCByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String SOC = String.valueOf(SOCByteArr[0]);
|
||||
realTimeMonitorData.setSOC(SOC);
|
||||
// SOC 待机置零;交流桩置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] SOCByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String SOC = String.valueOf(SOCByteArr[0]);
|
||||
realTimeMonitorData.setSOC(SOC);
|
||||
|
||||
// 电池组最高温度 整形, 偏移量-50 ºC;待机置零; 交流桩置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] batteryMaxTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String batteryMaxTemperature = YKCUtils.transitionTemperature(batteryMaxTemperatureByteArr);
|
||||
realTimeMonitorData.setBatteryMaxTemperature(batteryMaxTemperature);
|
||||
// 电池组最高温度 整形, 偏移量-50 ºC;待机置零; 交流桩置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] batteryMaxTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String batteryMaxTemperature = YKCUtils.transitionTemperature(batteryMaxTemperatureByteArr);
|
||||
realTimeMonitorData.setBatteryMaxTemperature(batteryMaxTemperature);
|
||||
|
||||
// 累计充电时间 单位: min;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] sumChargingTimeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
int sumChargingTime = BytesUtil.bytesToIntLittle(sumChargingTimeByteArr);
|
||||
realTimeMonitorData.setSumChargingTime(String.valueOf(sumChargingTime));
|
||||
// 累计充电时间 单位: min;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] sumChargingTimeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
int sumChargingTime = BytesUtil.bytesToIntLittle(sumChargingTimeByteArr);
|
||||
realTimeMonitorData.setSumChargingTime(String.valueOf(sumChargingTime));
|
||||
|
||||
// 剩余时间 单位: min;待机置零、交流桩置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] timeRemainingByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
int timeRemaining = BytesUtil.bytesToIntLittle(timeRemainingByteArr);
|
||||
realTimeMonitorData.setTimeRemaining(String.valueOf(timeRemaining));
|
||||
// 剩余时间 单位: min;待机置零、交流桩置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] timeRemainingByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
int timeRemaining = BytesUtil.bytesToIntLittle(timeRemainingByteArr);
|
||||
realTimeMonitorData.setTimeRemaining(String.valueOf(timeRemaining));
|
||||
|
||||
// 充电度数 精确到小数点后四位;待机置零
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] chargingDegreeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String chargingDegree = YKCUtils.convertDecimalPoint(chargingDegreeByteArr, 4);
|
||||
realTimeMonitorData.setChargingDegree(chargingDegree);
|
||||
// 充电度数 精确到小数点后四位;待机置零
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] chargingDegreeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String chargingDegree = YKCUtils.convertDecimalPoint(chargingDegreeByteArr, 4);
|
||||
realTimeMonitorData.setChargingDegree(chargingDegree);
|
||||
|
||||
// 计损充电度数 精确到小数点后四位;待机置零 未设置计损比例时等于充电度数
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] lossDegreeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String lossDegree = YKCUtils.convertDecimalPoint(lossDegreeByteArr, 4);
|
||||
realTimeMonitorData.setLossDegree(lossDegree);
|
||||
// 计损充电度数 精确到小数点后四位;待机置零 未设置计损比例时等于充电度数
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] lossDegreeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String lossDegree = YKCUtils.convertDecimalPoint(lossDegreeByteArr, 4);
|
||||
realTimeMonitorData.setLossDegree(lossDegree);
|
||||
|
||||
// 已充金额 精确到小数点后四位;待机置零 (电费+服务费) *计损充电度数
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] chargingAmountByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String chargingAmount = YKCUtils.convertDecimalPoint(chargingAmountByteArr, 4);
|
||||
realTimeMonitorData.setChargingAmount(chargingAmount);
|
||||
// 已充金额 精确到小数点后四位;待机置零 (电费+服务费) *计损充电度数
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] chargingAmountByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String chargingAmount = YKCUtils.convertDecimalPoint(chargingAmountByteArr, 4);
|
||||
realTimeMonitorData.setChargingAmount(chargingAmount);
|
||||
|
||||
/**
|
||||
* 硬件故障
|
||||
*
|
||||
* Bit 位表示(0 否 1 是), 低位到高位顺序
|
||||
* Bit1:急停按钮动作故障;
|
||||
* Bit2:无可用整流模块;
|
||||
* Bit3:出风口温度过高;
|
||||
* Bit4:交流防雷故障;
|
||||
* Bit5:交直流模块 DC20 通信中断;
|
||||
* Bit6:绝缘检测模块 FC08 通信中断;
|
||||
* Bit7:电度表通信中断;
|
||||
* Bit8:读卡器通信中断;
|
||||
* Bit9: RC10 通信中断;
|
||||
* Bit10:风扇调速板故障;
|
||||
* Bit11:直流熔断器故障;
|
||||
* Bit12:高压接触器故障;
|
||||
* Bit13:门打开;
|
||||
*/
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] hardwareFaultTempByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String hardwareFaultTemp = BytesUtil.bcd2Str(hardwareFaultTempByteArr);
|
||||
String faultReason = "无";
|
||||
/**
|
||||
* 硬件故障
|
||||
*
|
||||
* Bit 位表示(0 否 1 是), 低位到高位顺序
|
||||
* Bit1:急停按钮动作故障;
|
||||
* Bit2:无可用整流模块;
|
||||
* Bit3:出风口温度过高;
|
||||
* Bit4:交流防雷故障;
|
||||
* Bit5:交直流模块 DC20 通信中断;
|
||||
* Bit6:绝缘检测模块 FC08 通信中断;
|
||||
* Bit7:电度表通信中断;
|
||||
* Bit8:读卡器通信中断;
|
||||
* Bit9: RC10 通信中断;
|
||||
* Bit10:风扇调速板故障;
|
||||
* Bit11:直流熔断器故障;
|
||||
* Bit12:高压接触器故障;
|
||||
* Bit13:门打开;
|
||||
*/
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] hardwareFaultTempByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String hardwareFaultTemp = BytesUtil.bcd2Str(hardwareFaultTempByteArr);
|
||||
String faultReason = "无";
|
||||
|
||||
if (!StringUtils.equals(hardwareFaultTemp, "0000")) {
|
||||
// 不等于0000说明有故障
|
||||
StringBuffer sb = new StringBuffer(hardwareFaultTemp);
|
||||
String lowOrder = sb.substring(0, 2);
|
||||
String highOrder = sb.substring(2, 4);
|
||||
if (!StringUtils.equals(hardwareFaultTemp, "0000")) {
|
||||
// 不等于0000说明有故障
|
||||
StringBuffer sb = new StringBuffer(hardwareFaultTemp);
|
||||
String lowOrder = sb.substring(0, 2);
|
||||
String highOrder = sb.substring(2, 4);
|
||||
|
||||
// String hardwareFault = highOrder + lowOrder;
|
||||
byte[] hardwareFaultByteArr = BytesUtil.str2Bcd(highOrder + lowOrder);
|
||||
String binStr = BytesUtil.bytes2BinStr(hardwareFaultByteArr);
|
||||
// log.info("binStr:{}", binStr); // 0000 0000 0000 0001
|
||||
int faultCode = 0;
|
||||
for (int i = 0; i < binStr.length(); i++) {
|
||||
if (binStr.charAt(i) == '1') {
|
||||
faultCode = 15 - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
|
||||
// log.info("故障码:{}, 故障原因:{}", faultCode, faultReason);
|
||||
}
|
||||
realTimeMonitorData.setHardwareFault(faultReason);
|
||||
// String hardwareFault = highOrder + lowOrder;
|
||||
byte[] hardwareFaultByteArr = BytesUtil.str2Bcd(highOrder + lowOrder);
|
||||
String binStr = BytesUtil.bytes2BinStr(hardwareFaultByteArr);
|
||||
// log.info("binStr:{}", binStr); // 0000 0000 0000 0001
|
||||
int faultCode = 0;
|
||||
for (int i = 0; i < binStr.length(); i++) {
|
||||
if (binStr.charAt(i) == '1') {
|
||||
faultCode = 15 - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
|
||||
}
|
||||
realTimeMonitorData.setHardwareFault(faultReason);
|
||||
|
||||
// if (!StringUtils.equals(connectorStatus, "02")) {
|
||||
if (!StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FREE.getValue())) {
|
||||
log.info("0x13上传实时监测数据==交易流水号:{}, 桩编号:{}, 枪口号:{}, 枪口状态:{}, 枪口状态描述:{}, 枪是否归位(00-否;01-是;02-未知):{}, 是否插枪(00-否;01-是):{}, 输出电压:{}, 输出电流:{}, 枪线温度:{}, " +
|
||||
"枪线编码:{}, SOC:{}, 电池组最高温度:{}, 累计充电时间:{}, 剩余时间:{}, 充电度数:{}, 记损充电度数:{}, 已充金额:{}, " +
|
||||
"硬件故障:{}, 故障码转换结果:{}", transactionCode, pileSn, connectorCode, connectorStatus, PileConnectorStatusEnum.getLabelByValue(connectorStatus), homingFlag, putGunType, outputVoltage,
|
||||
outputCurrent, gunLineTemperature, gunLineCode, SOC, batteryMaxTemperature, sumChargingTime, timeRemaining,
|
||||
chargingDegree, lossDegree, chargingAmount, hardwareFaultTemp, faultReason
|
||||
);
|
||||
}
|
||||
if (!StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FREE.getValue())) {
|
||||
log.info("0x13上传实时监测数据==交易流水号:{}, 桩编号:{}, 枪口号:{}, 枪口状态:{}, 枪口状态描述:{}, 枪是否归位(00-否;01-是;02-未知):{}, 是否插枪(00-否;01-是):{}, 输出电压:{}, 输出电流:{}, 枪线温度:{}, " +
|
||||
"枪线编码:{}, SOC:{}, 电池组最高温度:{}, 累计充电时间:{}, 剩余时间:{}, 充电度数:{}, 记损充电度数:{}, 已充金额:{}, " +
|
||||
"硬件故障:{}, 故障码转换结果:{}", transactionCode, pileSn, connectorCode, connectorStatus, PileConnectorStatusEnum.getLabelByValue(connectorStatus), homingFlag, isChargerPluggedIn, outputVoltage,
|
||||
outputCurrent, gunLineTemperature, gunLineCode, SOC, batteryMaxTemperature, sumChargingTime, timeRemaining,
|
||||
chargingDegree, lossDegree, chargingAmount, hardwareFaultTemp, faultReason
|
||||
);
|
||||
}
|
||||
|
||||
// 公共方法修改状态
|
||||
pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, connectorCode, connectorStatus, putGunType);
|
||||
// 插枪状态
|
||||
String plugRedisKey = CacheConstants.CHARGER_PLUGGED_IN_STATUS + pileConnectorCode;
|
||||
if (StringUtils.equals("01", isChargerPluggedIn)) {
|
||||
// 插枪状态
|
||||
if (redisCache.setnx(plugRedisKey, pileConnectorCode, CacheConstants.cache_expire_time_30d)) {
|
||||
log.info("时间:{}, 枪口号:{}, 首次插入充电枪", DateUtils.getDateTime(), pileConnectorCode);
|
||||
// 设置成功说明 第一次插枪
|
||||
pileBasicInfoService.firstPlugInCharger(pileConnectorCode);
|
||||
}
|
||||
} else {
|
||||
// 未插枪状态
|
||||
if (redisCache.hasKey(plugRedisKey) && redisCache.deleteObject(plugRedisKey)) {
|
||||
log.info("时间:{}, 枪口号:{}, 首次拔出充电枪", DateUtils.getDateTime(), pileConnectorCode);
|
||||
// redis有值,并且删除成功,说明首次拔枪
|
||||
pileBasicInfoService.firstUnplugCharger(pileConnectorCode);
|
||||
}
|
||||
}
|
||||
|
||||
// 01表示故障
|
||||
if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FAULT.getValue())) {
|
||||
// 故障原因存入缓存
|
||||
String redisKey = CacheConstants.PILE_HARDWARE_FAULT + pileSn + connectorCode;
|
||||
redisCache.setCacheObject(redisKey, faultReason, 5, TimeUnit.MINUTES);
|
||||
}
|
||||
// 公共方法修改状态
|
||||
pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, connectorCode, connectorStatus, isChargerPluggedIn);
|
||||
|
||||
// 03表示充电中
|
||||
if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.OCCUPIED_CHARGING.getValue())) {
|
||||
// 默认保存到redis
|
||||
boolean saveRedisFlag = true;
|
||||
// 01表示故障
|
||||
if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FAULT.getValue())) {
|
||||
// 故障原因存入缓存
|
||||
String redisKey = CacheConstants.PILE_HARDWARE_FAULT + pileConnectorCode;
|
||||
redisCache.setCacheObject(redisKey, faultReason, 5, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
// 查询数据库中该订单当前信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
||||
if (Objects.nonNull(orderInfo)) {
|
||||
if (StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.ORDER_COMPLETE.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.STAY_SETTLEMENT.getValue())) {
|
||||
// 在订单状态为 订单完成或待结算,不保存
|
||||
saveRedisFlag = false;
|
||||
}
|
||||
// 03表示充电中
|
||||
if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.OCCUPIED_CHARGING.getValue())) {
|
||||
// 默认保存到redis
|
||||
boolean saveRedisFlag = true;
|
||||
|
||||
boolean updateFlag = false;
|
||||
if (StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.NOT_START.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.ABNORMAL.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.STAY_SETTLEMENT.getValue())) {
|
||||
updateFlag = true;
|
||||
// 如果是未启动状态或者异常状态, 修改这个订单状态为充电中 2023年7月7日新增 如果是待结算状态,也改为充电中
|
||||
orderInfo.setOrderStatus(OrderStatusEnum.IN_THE_CHARGING.getValue());
|
||||
}
|
||||
// 查询数据库中该订单当前信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
||||
if (Objects.nonNull(orderInfo)) {
|
||||
if (StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.ORDER_COMPLETE.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.STAY_SETTLEMENT.getValue())) {
|
||||
// 在订单状态为 订单完成或待结算,不保存
|
||||
saveRedisFlag = false;
|
||||
}
|
||||
|
||||
// 如果原来没有开始充电时间就保存当前时间为开始充电时间
|
||||
if (orderInfo.getChargeStartTime() == null) {
|
||||
updateFlag = true;
|
||||
orderInfo.setChargeStartTime(new Date());
|
||||
}
|
||||
boolean updateFlag = false;
|
||||
if (StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.NOT_START.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.ABNORMAL.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.STAY_SETTLEMENT.getValue())) {
|
||||
updateFlag = true;
|
||||
// 如果是未启动状态或者异常状态, 修改这个订单状态为充电中 2023年7月7日新增 如果是待结算状态,也改为充电中
|
||||
orderInfo.setOrderStatus(OrderStatusEnum.IN_THE_CHARGING.getValue());
|
||||
}
|
||||
|
||||
if (updateFlag) {
|
||||
orderBasicInfoService.updateOrderBasicInfo(orderInfo);
|
||||
}
|
||||
}
|
||||
// 如果原来没有开始充电时间就保存当前时间为开始充电时间
|
||||
if (orderInfo.getChargeStartTime() == null) {
|
||||
updateFlag = true;
|
||||
orderInfo.setChargeStartTime(new Date());
|
||||
}
|
||||
|
||||
// 充电时保存实时数据到redis
|
||||
if (saveRedisFlag) {
|
||||
pileBasicInfoService.saveRealTimeMonitorData2Redis(realTimeMonitorData);
|
||||
}
|
||||
}
|
||||
if (updateFlag) {
|
||||
orderBasicInfoService.updateOrderBasicInfo(orderInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// 异步推送第三方平台实时数据
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
commonService.pushRealTimeInfo(pileSn, connectorCode, connectorStatus, realTimeMonitorData, transactionCode);
|
||||
} catch (Exception e) {
|
||||
log.error("统一推送第三方平台实时数据 error, ", e);
|
||||
}
|
||||
});
|
||||
// 充电时保存实时数据到redis
|
||||
if (saveRedisFlag) {
|
||||
pileBasicInfoService.saveRealTimeMonitorData2Redis(realTimeMonitorData);
|
||||
}
|
||||
}
|
||||
|
||||
// 异步推送第三方平台实时数据V2
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
commonService.pushRealTimeInfoV2(pileSn, connectorCode, connectorStatus, realTimeMonitorData, transactionCode);
|
||||
} catch (Exception e) {
|
||||
log.error("统一推送第三方平台实时数据V2 error, ", e);
|
||||
}
|
||||
});
|
||||
// 异步推送第三方平台实时数据
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
commonService.pushRealTimeInfo(pileSn, connectorCode, connectorStatus, realTimeMonitorData, transactionCode);
|
||||
} catch (Exception e) {
|
||||
log.error("统一推送第三方平台实时数据 error, ", e);
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
// 异步推送第三方平台实时数据V2
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
commonService.pushRealTimeInfoV2(pileSn, connectorCode, connectorStatus, realTimeMonitorData, transactionCode);
|
||||
} catch (Exception e) {
|
||||
log.error("统一推送第三方平台实时数据V2 error, ", e);
|
||||
}
|
||||
});
|
||||
|
||||
public static void main(String[] args) {
|
||||
StringBuffer sb = new StringBuffer("0100");
|
||||
String lowOrder = sb.substring(0, 2);
|
||||
String highOrder = sb.substring(2, 4);
|
||||
return null;
|
||||
}
|
||||
|
||||
// String hardwareFault = highOrder + lowOrder;
|
||||
byte[] hardwareFaultByteArr = BytesUtil.str2Bcd(highOrder + lowOrder);
|
||||
String binStr = BytesUtil.bytes2BinStr(hardwareFaultByteArr);
|
||||
// log.info("binStr:{}", binStr); // 0000 0000 0000 0001
|
||||
int faultCode = 0;
|
||||
for (int i = 0; i < binStr.length(); i++) {
|
||||
if (binStr.charAt(i) == '1') {
|
||||
faultCode = 16 - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
|
||||
System.out.println(faultReason);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
StringBuffer sb = new StringBuffer("0100");
|
||||
String lowOrder = sb.substring(0, 2);
|
||||
String highOrder = sb.substring(2, 4);
|
||||
|
||||
// String hardwareFault = highOrder + lowOrder;
|
||||
byte[] hardwareFaultByteArr = BytesUtil.str2Bcd(highOrder + lowOrder);
|
||||
String binStr = BytesUtil.bytes2BinStr(hardwareFaultByteArr);
|
||||
// log.info("binStr:{}", binStr); // 0000 0000 0000 0001
|
||||
int faultCode = 0;
|
||||
for (int i = 0; i < binStr.length(); i++) {
|
||||
if (binStr.charAt(i) == '1') {
|
||||
faultCode = 16 - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
|
||||
System.out.println(faultReason);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,11 @@ public class PileReservedInfo {
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 充电桩枪口编号
|
||||
*/
|
||||
private String pileConnectorCode;
|
||||
|
||||
/**
|
||||
* 状态(0-未生效;1-生效)
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,11 @@ public class CreateReservedDTO {
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 充电桩枪口编号
|
||||
*/
|
||||
private String pileConnectorCode;
|
||||
|
||||
/**
|
||||
* 预约开始时间
|
||||
*/
|
||||
|
||||
@@ -116,6 +116,16 @@ public interface PileBasicInfoService {
|
||||
*/
|
||||
List<PileDetailVO> selectPileListByStationIds(List<Long> stationIdList);
|
||||
|
||||
/**
|
||||
* 首次插枪
|
||||
*/
|
||||
public void firstPlugInCharger(String pileConnectorCode);
|
||||
|
||||
/**
|
||||
* 首次拔枪
|
||||
*/
|
||||
public void firstUnplugCharger(String pileConnectorCode);
|
||||
|
||||
/**
|
||||
* 通过桩编号查询站点id
|
||||
* @param sn 桩编号
|
||||
|
||||
@@ -32,9 +32,24 @@ public interface PileReservedInfoService {
|
||||
|
||||
List<PileReservedInfo> getReservationsByMemberIdAndPileSn(String memberId, String pileSn);
|
||||
|
||||
/**
|
||||
* 启动预约
|
||||
* @param dto
|
||||
*/
|
||||
void activateReserved(PileReservedDTO dto);
|
||||
|
||||
/**
|
||||
* 关闭预约
|
||||
* @param dto
|
||||
*/
|
||||
void deactivateReserved(PileReservedDTO dto);
|
||||
|
||||
/**
|
||||
* 根据充电枪口编号发送预约指令
|
||||
* @param pileConnectorCode
|
||||
*/
|
||||
void pushReservedByPileConnectorCode(String pileConnectorCode);
|
||||
|
||||
void cancelOneTimeReservation(String pileConnectorCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,18 +82,15 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
@Autowired
|
||||
private SimCardService simCardService;
|
||||
|
||||
@Autowired
|
||||
private PileSimInfoMapper pileSimInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private PileMerchantInfoMapper pileMerchantInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Value("${baseurl.prefix}")
|
||||
private String BASE_URL_PREFIX;
|
||||
|
||||
@Autowired
|
||||
private PileReservedInfoService pileReservedInfoService;
|
||||
|
||||
/**
|
||||
* 查询设备管理
|
||||
*
|
||||
@@ -460,6 +457,28 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
return pileInfoVOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 首次插枪
|
||||
*
|
||||
* @param pileConnectorCode
|
||||
*/
|
||||
@Override
|
||||
public void firstPlugInCharger(String pileConnectorCode) {
|
||||
// 下发预约指令
|
||||
pileReservedInfoService.pushReservedByPileConnectorCode(pileConnectorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 首次拔枪
|
||||
*
|
||||
* @param pileConnectorCode
|
||||
*/
|
||||
@Override
|
||||
public void firstUnplugCharger(String pileConnectorCode) {
|
||||
// 关闭仅执行一次的预约
|
||||
pileReservedInfoService.cancelOneTimeReservation(pileConnectorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* 用于登陆协议,心跳包协议,上传实时数据协议 更新状态的方法
|
||||
@@ -476,10 +495,10 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
* 7.上传实时数据,枪状态传0x03充电,设置为【3-占用(充电中)】
|
||||
*/
|
||||
@Override
|
||||
public void updateStatus(String frameType, String pileSn, String connectorCode, String status, String putGunType) {
|
||||
public void updateStatus(String frameType, String pileSn, String connectorCode, String status, String isChargerPluggedIn) {
|
||||
// 清缓存
|
||||
cleanRedisCache(pileSn);
|
||||
// log.info("updateStatus传参:帧类型:{}, 桩编号:{}, 枪口号:{}, 状态:{}, 插拔枪:{}", "0x" + frameType, pileSn, connectorCode, status, putGunType);
|
||||
// log.info("updateStatus传参:帧类型:{}, 桩编号:{}, 枪口号:{}, 状态:{}, 插拔枪:{}", "0x" + frameType, pileSn, connectorCode, status, isChargerPluggedIn);
|
||||
/*
|
||||
0x01 登陆认证
|
||||
登陆成功,把充电桩和枪口的状态都更新为【在线】
|
||||
@@ -522,7 +541,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
*/
|
||||
if (StringUtils.equals(frameType, BytesUtil.bcd2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_CODE.getBytes()))
|
||||
|| StringUtils.equals(frameType, BytesUtil.bcd2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_OLD_VERSION_CODE.getBytes()))) {
|
||||
// log.info("上传实时数据中的修改状态逻辑 桩号:{}, 枪号:{}, 枪状态{}, 是否插枪:{}", pileSn, connectorCode, status, putGunType);
|
||||
// log.info("上传实时数据中的修改状态逻辑 桩号:{}, 枪号:{}, 枪状态{}, 是否插枪:{}", pileSn, connectorCode, status, isChargerPluggedIn);
|
||||
/**
|
||||
* 更新枪状态
|
||||
* connectorStatus 桩传过来的枪口状态: 0x00:离线 0x01:故障 0x02:空闲 0x03:充电
|
||||
@@ -535,7 +554,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
statusDataBase = PileConnectorDataBaseStatusEnum.FAULT.getValue();
|
||||
} else if (StringUtils.equals(status, PileConnectorStatusEnum.FREE.getValue())) { // 空闲
|
||||
//是否插枪 0x00:否 0x01:是
|
||||
if (StringUtils.equals(putGunType, Constants.ZERO_ONE)) {
|
||||
if (StringUtils.equals(isChargerPluggedIn, Constants.ZERO_ONE)) {
|
||||
// 空闲并插枪 设置为【占用(未充电)】
|
||||
statusDataBase = PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue();
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.jsowell.pile.service.impl;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.dto.PileReservedDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -11,7 +10,6 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.mapper.PileReservedInfoMapper;
|
||||
@@ -118,7 +116,6 @@ public class PileReservedInfoServiceImpl implements PileReservedInfoService {
|
||||
pileReservedInfoMapper.updateByPrimaryKeySelective(pileReservedInfo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验时间是否重叠
|
||||
* @param memberId
|
||||
@@ -154,5 +151,14 @@ public class PileReservedInfoServiceImpl implements PileReservedInfoService {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_UPDATE_RESERVED_STATUS_REFUSED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据充电枪口编号发送指令
|
||||
* @param pileConnectorCode
|
||||
*/
|
||||
@Override
|
||||
public void pushReservedByPileConnectorCode(String pileConnectorCode) {
|
||||
// 根据充电枪口编号查询正在生效中的预约
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="member_id" jdbcType="VARCHAR" property="memberId" />
|
||||
<result column="pile_sn" jdbcType="VARCHAR" property="pileSn" />
|
||||
<result column="pile_connector_code" jdbcType="VARCHAR" property="pileConnectorCode" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="reserved_type" jdbcType="VARCHAR" property="reservedType" />
|
||||
<result column="start_time" jdbcType="TIME" property="startTime" />
|
||||
@@ -20,8 +21,8 @@
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, member_id, pile_sn, `status`, reserved_type, start_time, end_time, freq, create_by,
|
||||
create_time, update_by, update_time, del_flag
|
||||
id, member_id, pile_sn, pile_connector_code, `status`, reserved_type, start_time,
|
||||
end_time, freq, create_by, create_time, update_by, update_time, del_flag
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
@@ -37,16 +38,16 @@
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into pile_reserved_info (member_id, pile_sn, `status`,
|
||||
reserved_type, start_time, end_time,
|
||||
freq, create_by, create_time,
|
||||
update_by, update_time, del_flag
|
||||
)
|
||||
values (#{memberId,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{reservedType,jdbcType=VARCHAR}, #{startTime,jdbcType=TIME}, #{endTime,jdbcType=TIME},
|
||||
#{freq,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=CHAR}
|
||||
)
|
||||
insert into pile_reserved_info (member_id, pile_sn, pile_connector_code,
|
||||
`status`, reserved_type, start_time,
|
||||
end_time, freq, create_by,
|
||||
create_time, update_by, update_time,
|
||||
del_flag)
|
||||
values (#{memberId,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR}, #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{reservedType,jdbcType=VARCHAR}, #{startTime,jdbcType=TIME},
|
||||
#{endTime,jdbcType=TIME}, #{freq,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
|
||||
#{delFlag,jdbcType=CHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
@@ -58,6 +59,9 @@
|
||||
<if test="pileSn != null">
|
||||
pile_sn,
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
pile_connector_code,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
</if>
|
||||
@@ -96,6 +100,9 @@
|
||||
<if test="pileSn != null">
|
||||
#{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
#{pileConnectorCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -138,6 +145,9 @@
|
||||
<if test="pileSn != null">
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -176,6 +186,7 @@
|
||||
update pile_reserved_info
|
||||
set member_id = #{memberId,jdbcType=VARCHAR},
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
reserved_type = #{reservedType,jdbcType=VARCHAR},
|
||||
start_time = #{startTime,jdbcType=TIME},
|
||||
@@ -202,6 +213,11 @@
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.pileSn,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="pile_connector_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.pileConnectorCode,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="`status` = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=VARCHAR}
|
||||
@@ -276,6 +292,13 @@
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="pile_connector_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.pileConnectorCode != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.pileConnectorCode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="`status` = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.status != null">
|
||||
@@ -355,15 +378,15 @@
|
||||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into pile_reserved_info
|
||||
(member_id, pile_sn, `status`, reserved_type, start_time, end_time, freq, create_by,
|
||||
create_time, update_by, update_time, del_flag)
|
||||
(member_id, pile_sn, pile_connector_code, `status`, reserved_type, start_time, end_time,
|
||||
freq, create_by, create_time, update_by, update_time, del_flag)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.memberId,jdbcType=VARCHAR}, #{item.pileSn,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR},
|
||||
#{item.reservedType,jdbcType=VARCHAR}, #{item.startTime,jdbcType=TIME}, #{item.endTime,jdbcType=TIME},
|
||||
#{item.freq,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
|
||||
#{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.delFlag,jdbcType=CHAR}
|
||||
)
|
||||
(#{item.memberId,jdbcType=VARCHAR}, #{item.pileSn,jdbcType=VARCHAR}, #{item.pileConnectorCode,jdbcType=VARCHAR},
|
||||
#{item.status,jdbcType=VARCHAR}, #{item.reservedType,jdbcType=VARCHAR}, #{item.startTime,jdbcType=TIME},
|
||||
#{item.endTime,jdbcType=TIME}, #{item.freq,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
|
||||
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
|
||||
#{item.delFlag,jdbcType=CHAR})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true">
|
||||
@@ -375,6 +398,7 @@
|
||||
</if>
|
||||
member_id,
|
||||
pile_sn,
|
||||
pile_connector_code,
|
||||
`status`,
|
||||
reserved_type,
|
||||
start_time,
|
||||
@@ -393,6 +417,7 @@
|
||||
</if>
|
||||
#{memberId,jdbcType=VARCHAR},
|
||||
#{pileSn,jdbcType=VARCHAR},
|
||||
#{pileConnectorCode,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR},
|
||||
#{reservedType,jdbcType=VARCHAR},
|
||||
#{startTime,jdbcType=TIME},
|
||||
@@ -411,6 +436,7 @@
|
||||
</if>
|
||||
member_id = #{memberId,jdbcType=VARCHAR},
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
reserved_type = #{reservedType,jdbcType=VARCHAR},
|
||||
start_time = #{startTime,jdbcType=TIME},
|
||||
@@ -436,6 +462,9 @@
|
||||
<if test="pileSn != null">
|
||||
pile_sn,
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
pile_connector_code,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
</if>
|
||||
@@ -478,6 +507,9 @@
|
||||
<if test="pileSn != null">
|
||||
#{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
#{pileConnectorCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -520,6 +552,9 @@
|
||||
<if test="pileSn != null">
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user