预约充电

This commit is contained in:
Guoqs
2024-06-20 13:54:38 +08:00
parent d632555869
commit af96ae4a1c
10 changed files with 413 additions and 288 deletions

View File

@@ -575,6 +575,7 @@ public class PileService {
PileReservedInfo reservedInfo = new PileReservedInfo(); PileReservedInfo reservedInfo = new PileReservedInfo();
reservedInfo.setMemberId(dto.getMemberId()); reservedInfo.setMemberId(dto.getMemberId());
reservedInfo.setPileSn(dto.getPileSn()); reservedInfo.setPileSn(dto.getPileSn());
reservedInfo.setPileConnectorCode(dto.getPileConnectorCode());
reservedInfo.setStatus(Constants.ZERO); // 默认未生效 reservedInfo.setStatus(Constants.ZERO); // 默认未生效
// reservedInfo.setStartTime(DateUtils.parseDate(dto.getStartTime())); // reservedInfo.setStartTime(DateUtils.parseDate(dto.getStartTime()));
reservedInfo.setStartTime(Time.valueOf(dto.getStartTime())); reservedInfo.setStartTime(Time.valueOf(dto.getStartTime()));

View File

@@ -27,9 +27,15 @@ public class CacheConstants {
// 缓存时间 12小时 // 缓存时间 12小时
public static final int cache_expire_time_12h = cache_expire_time_1h * 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; 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天 // 缓存时间 10天
public static final int cache_expire_time_10d = cache_expire_time_1d * 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 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:"; public static final String GET_PILE_MODEL_INFO_BY_MODEL_ID = "get_pile_model_info_by_model_id:";

View File

@@ -9,6 +9,7 @@ import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.enums.ykc.PileConnectorStatusEnum; import com.jsowell.common.enums.ykc.PileConnectorStatusEnum;
import com.jsowell.common.enums.ykc.YKCPileFaultReasonEnum; import com.jsowell.common.enums.ykc.YKCPileFaultReasonEnum;
import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils; import com.jsowell.common.util.YKCUtils;
import com.jsowell.netty.factory.YKCOperateFactory; import com.jsowell.netty.factory.YKCOperateFactory;
@@ -88,10 +89,13 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
// 枪号 // 枪号
startIndex += length; startIndex += length;
length = 1; length = 1;
byte[] pileConnectorCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length); byte[] connectorCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String connectorCode = BytesUtil.bcd2Str(pileConnectorCodeByteArr); String connectorCode = BytesUtil.bcd2Str(connectorCodeByteArr);
realTimeMonitorData.setConnectorCode(connectorCode); realTimeMonitorData.setConnectorCode(connectorCode);
// 枪口编号
String pileConnectorCode = pileSn + connectorCode;
// 枪口状态 0x00:离线 0x01:故障 0x02:空闲 0x03:充电 0x04 预约中 // 枪口状态 0x00:离线 0x01:故障 0x02:空闲 0x03:充电 0x04 预约中
startIndex += length; startIndex += length;
length = 1; length = 1;
@@ -109,9 +113,9 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
// 是否插枪 0x00:否 0x01:是 // 是否插枪 0x00:否 0x01:是
startIndex += length; startIndex += length;
length = 1; length = 1;
byte[] putGunTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length); byte[] isChargerPluggedInByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String putGunType = BytesUtil.bcd2Str(putGunTypeByteArr); String isChargerPluggedIn = BytesUtil.bcd2Str(isChargerPluggedInByteArr);
realTimeMonitorData.setPutGunType(putGunType); realTimeMonitorData.setPutGunType(isChargerPluggedIn);
// 输出电压 精确到小数点后一位;待机置零 // 输出电压 精确到小数点后一位;待机置零
startIndex += length; startIndex += length;
@@ -232,27 +236,43 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
} }
} }
faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode); faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
// log.info("故障码:{}, 故障原因:{}", faultCode, faultReason);
} }
realTimeMonitorData.setHardwareFault(faultReason); realTimeMonitorData.setHardwareFault(faultReason);
// if (!StringUtils.equals(connectorStatus, "02")) {
if (!StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FREE.getValue())) { if (!StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FREE.getValue())) {
log.info("0x13上传实时监测数据==交易流水号:{}, 桩编号:{}, 枪口号:{}, 枪口状态:{}, 枪口状态描述:{}, 枪是否归位(00-否;01-是;02-未知):{}, 是否插枪(00-否;01-是):{}, 输出电压:{}, 输出电流:{}, 枪线温度:{}, " + log.info("0x13上传实时监测数据==交易流水号:{}, 桩编号:{}, 枪口号:{}, 枪口状态:{}, 枪口状态描述:{}, 枪是否归位(00-否;01-是;02-未知):{}, 是否插枪(00-否;01-是):{}, 输出电压:{}, 输出电流:{}, 枪线温度:{}, " +
"枪线编码:{}, SOC:{}, 电池组最高温度:{}, 累计充电时间:{}, 剩余时间:{}, 充电度数:{}, 记损充电度数:{}, 已充金额:{}, " + "枪线编码:{}, SOC:{}, 电池组最高温度:{}, 累计充电时间:{}, 剩余时间:{}, 充电度数:{}, 记损充电度数:{}, 已充金额:{}, " +
"硬件故障:{}, 故障码转换结果:{}", transactionCode, pileSn, connectorCode, connectorStatus, PileConnectorStatusEnum.getLabelByValue(connectorStatus), homingFlag, putGunType, outputVoltage, "硬件故障:{}, 故障码转换结果:{}", transactionCode, pileSn, connectorCode, connectorStatus, PileConnectorStatusEnum.getLabelByValue(connectorStatus), homingFlag, isChargerPluggedIn, outputVoltage,
outputCurrent, gunLineTemperature, gunLineCode, SOC, batteryMaxTemperature, sumChargingTime, timeRemaining, outputCurrent, gunLineTemperature, gunLineCode, SOC, batteryMaxTemperature, sumChargingTime, timeRemaining,
chargingDegree, lossDegree, chargingAmount, hardwareFaultTemp, faultReason chargingDegree, lossDegree, chargingAmount, hardwareFaultTemp, faultReason
); );
} }
// 插枪状态
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);
}
}
// 公共方法修改状态 // 公共方法修改状态
pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, connectorCode, connectorStatus, putGunType); pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, connectorCode, connectorStatus, isChargerPluggedIn);
// 01表示故障 // 01表示故障
if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FAULT.getValue())) { if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FAULT.getValue())) {
// 故障原因存入缓存 // 故障原因存入缓存
String redisKey = CacheConstants.PILE_HARDWARE_FAULT + pileSn + connectorCode; String redisKey = CacheConstants.PILE_HARDWARE_FAULT + pileConnectorCode;
redisCache.setCacheObject(redisKey, faultReason, 5, TimeUnit.MINUTES); redisCache.setCacheObject(redisKey, faultReason, 5, TimeUnit.MINUTES);
} }

View File

@@ -32,6 +32,11 @@ public class PileReservedInfo {
*/ */
private String pileSn; private String pileSn;
/**
* 充电桩枪口编号
*/
private String pileConnectorCode;
/** /**
* 状态0-未生效1-生效) * 状态0-未生效1-生效)
*/ */

View File

@@ -20,6 +20,11 @@ public class CreateReservedDTO {
*/ */
private String pileSn; private String pileSn;
/**
* 充电桩枪口编号
*/
private String pileConnectorCode;
/** /**
* 预约开始时间 * 预约开始时间
*/ */

View File

@@ -116,6 +116,16 @@ public interface PileBasicInfoService {
*/ */
List<PileDetailVO> selectPileListByStationIds(List<Long> stationIdList); List<PileDetailVO> selectPileListByStationIds(List<Long> stationIdList);
/**
* 首次插枪
*/
public void firstPlugInCharger(String pileConnectorCode);
/**
* 首次拔枪
*/
public void firstUnplugCharger(String pileConnectorCode);
/** /**
* 通过桩编号查询站点id * 通过桩编号查询站点id
* @param sn 桩编号 * @param sn 桩编号

View File

@@ -32,9 +32,24 @@ public interface PileReservedInfoService {
List<PileReservedInfo> getReservationsByMemberIdAndPileSn(String memberId, String pileSn); List<PileReservedInfo> getReservationsByMemberIdAndPileSn(String memberId, String pileSn);
/**
* 启动预约
* @param dto
*/
void activateReserved(PileReservedDTO dto); void activateReserved(PileReservedDTO dto);
/**
* 关闭预约
* @param dto
*/
void deactivateReserved(PileReservedDTO dto); void deactivateReserved(PileReservedDTO dto);
/**
* 根据充电枪口编号发送预约指令
* @param pileConnectorCode
*/
void pushReservedByPileConnectorCode(String pileConnectorCode);
void cancelOneTimeReservation(String pileConnectorCode);
} }

View File

@@ -82,18 +82,15 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
@Autowired @Autowired
private SimCardService simCardService; private SimCardService simCardService;
@Autowired
private PileSimInfoMapper pileSimInfoMapper;
@Autowired
private PileMerchantInfoMapper pileMerchantInfoMapper;
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Value("${baseurl.prefix}") @Value("${baseurl.prefix}")
private String BASE_URL_PREFIX; private String BASE_URL_PREFIX;
@Autowired
private PileReservedInfoService pileReservedInfoService;
/** /**
* 查询设备管理 * 查询设备管理
* *
@@ -460,6 +457,28 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
return pileInfoVOS; 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-占用(充电中)】 * 7.上传实时数据枪状态传0x03充电设置为【3-占用(充电中)】
*/ */
@Override @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); cleanRedisCache(pileSn);
// log.info("updateStatus传参帧类型:{}, 桩编号:{}, 枪口号:{}, 状态:{}, 插拔枪:{}", "0x" + frameType, pileSn, connectorCode, status, putGunType); // log.info("updateStatus传参帧类型:{}, 桩编号:{}, 枪口号:{}, 状态:{}, 插拔枪:{}", "0x" + frameType, pileSn, connectorCode, status, isChargerPluggedIn);
/* /*
0x01 登陆认证 0x01 登陆认证
登陆成功,把充电桩和枪口的状态都更新为【在线】 登陆成功,把充电桩和枪口的状态都更新为【在线】
@@ -522,7 +541,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
*/ */
if (StringUtils.equals(frameType, BytesUtil.bcd2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_CODE.getBytes())) 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()))) { || 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充电 * connectorStatus 桩传过来的枪口状态: 0x00离线 0x01故障 0x02空闲 0x03充电
@@ -535,7 +554,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
statusDataBase = PileConnectorDataBaseStatusEnum.FAULT.getValue(); statusDataBase = PileConnectorDataBaseStatusEnum.FAULT.getValue();
} else if (StringUtils.equals(status, PileConnectorStatusEnum.FREE.getValue())) { // 空闲 } else if (StringUtils.equals(status, PileConnectorStatusEnum.FREE.getValue())) { // 空闲
//是否插枪 0x00否 0x01 //是否插枪 0x00否 0x01
if (StringUtils.equals(putGunType, Constants.ZERO_ONE)) { if (StringUtils.equals(isChargerPluggedIn, Constants.ZERO_ONE)) {
// 空闲并插枪 设置为【占用(未充电)】 // 空闲并插枪 设置为【占用(未充电)】
statusDataBase = PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue(); statusDataBase = PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue();
} else { } else {

View File

@@ -3,7 +3,6 @@ package com.jsowell.pile.service.impl;
import com.jsowell.common.constant.Constants; import com.jsowell.common.constant.Constants;
import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException; import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.dto.PileReservedDTO; import com.jsowell.pile.dto.PileReservedDTO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -11,7 +10,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.sql.Time; import java.sql.Time;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.Date;
import java.util.List; import java.util.List;
import com.jsowell.pile.mapper.PileReservedInfoMapper; import com.jsowell.pile.mapper.PileReservedInfoMapper;
@@ -118,7 +116,6 @@ public class PileReservedInfoServiceImpl implements PileReservedInfoService {
pileReservedInfoMapper.updateByPrimaryKeySelective(pileReservedInfo); pileReservedInfoMapper.updateByPrimaryKeySelective(pileReservedInfo);
} }
/** /**
* 校验时间是否重叠 * 校验时间是否重叠
* @param memberId * @param memberId
@@ -154,5 +151,14 @@ public class PileReservedInfoServiceImpl implements PileReservedInfoService {
throw new BusinessException(ReturnCodeEnum.CODE_UPDATE_RESERVED_STATUS_REFUSED); throw new BusinessException(ReturnCodeEnum.CODE_UPDATE_RESERVED_STATUS_REFUSED);
} }
} }
/**
* 根据充电枪口编号发送指令
* @param pileConnectorCode
*/
@Override
public void pushReservedByPileConnectorCode(String pileConnectorCode) {
// 根据充电枪口编号查询正在生效中的预约
}
} }

View File

@@ -7,6 +7,7 @@
<id column="id" jdbcType="INTEGER" property="id" /> <id column="id" jdbcType="INTEGER" property="id" />
<result column="member_id" jdbcType="VARCHAR" property="memberId" /> <result column="member_id" jdbcType="VARCHAR" property="memberId" />
<result column="pile_sn" jdbcType="VARCHAR" property="pileSn" /> <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="status" jdbcType="VARCHAR" property="status" />
<result column="reserved_type" jdbcType="VARCHAR" property="reservedType" /> <result column="reserved_type" jdbcType="VARCHAR" property="reservedType" />
<result column="start_time" jdbcType="TIME" property="startTime" /> <result column="start_time" jdbcType="TIME" property="startTime" />
@@ -20,8 +21,8 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
id, member_id, pile_sn, `status`, reserved_type, start_time, end_time, freq, create_by, id, member_id, pile_sn, pile_connector_code, `status`, reserved_type, start_time,
create_time, update_by, update_time, del_flag end_time, freq, create_by, create_time, update_by, update_time, del_flag
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated--> <!--@mbg.generated-->
@@ -37,16 +38,16 @@
</delete> </delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true"> <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into pile_reserved_info (member_id, pile_sn, `status`, insert into pile_reserved_info (member_id, pile_sn, pile_connector_code,
reserved_type, start_time, end_time, `status`, reserved_type, start_time,
freq, create_by, create_time, end_time, freq, create_by,
update_by, update_time, del_flag create_time, update_by, update_time,
) del_flag)
values (#{memberId,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, values (#{memberId,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR}, #{pileConnectorCode,jdbcType=VARCHAR},
#{reservedType,jdbcType=VARCHAR}, #{startTime,jdbcType=TIME}, #{endTime,jdbcType=TIME}, #{status,jdbcType=VARCHAR}, #{reservedType,jdbcType=VARCHAR}, #{startTime,jdbcType=TIME},
#{freq,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIME}, #{freq,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=CHAR} #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
) #{delFlag,jdbcType=CHAR})
</insert> </insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true"> <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
@@ -58,6 +59,9 @@
<if test="pileSn != null"> <if test="pileSn != null">
pile_sn, pile_sn,
</if> </if>
<if test="pileConnectorCode != null">
pile_connector_code,
</if>
<if test="status != null"> <if test="status != null">
`status`, `status`,
</if> </if>
@@ -96,6 +100,9 @@
<if test="pileSn != null"> <if test="pileSn != null">
#{pileSn,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR},
</if> </if>
<if test="pileConnectorCode != null">
#{pileConnectorCode,jdbcType=VARCHAR},
</if>
<if test="status != null"> <if test="status != null">
#{status,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
</if> </if>
@@ -138,6 +145,9 @@
<if test="pileSn != null"> <if test="pileSn != null">
pile_sn = #{pileSn,jdbcType=VARCHAR}, pile_sn = #{pileSn,jdbcType=VARCHAR},
</if> </if>
<if test="pileConnectorCode != null">
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
</if>
<if test="status != null"> <if test="status != null">
`status` = #{status,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR},
</if> </if>
@@ -176,6 +186,7 @@
update pile_reserved_info update pile_reserved_info
set member_id = #{memberId,jdbcType=VARCHAR}, set member_id = #{memberId,jdbcType=VARCHAR},
pile_sn = #{pileSn,jdbcType=VARCHAR}, pile_sn = #{pileSn,jdbcType=VARCHAR},
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR},
reserved_type = #{reservedType,jdbcType=VARCHAR}, reserved_type = #{reservedType,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIME}, start_time = #{startTime,jdbcType=TIME},
@@ -202,6 +213,11 @@
when id = #{item.id,jdbcType=INTEGER} then #{item.pileSn,jdbcType=VARCHAR} when id = #{item.id,jdbcType=INTEGER} then #{item.pileSn,jdbcType=VARCHAR}
</foreach> </foreach>
</trim> </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,"> <trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=VARCHAR} when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=VARCHAR}
@@ -276,6 +292,13 @@
</if> </if>
</foreach> </foreach>
</trim> </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,"> <trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
<if test="item.status != null"> <if test="item.status != null">
@@ -355,15 +378,15 @@
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true"> <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into pile_reserved_info insert into pile_reserved_info
(member_id, pile_sn, `status`, reserved_type, start_time, end_time, freq, create_by, (member_id, pile_sn, pile_connector_code, `status`, reserved_type, start_time, end_time,
create_time, update_by, update_time, del_flag) freq, create_by, create_time, update_by, update_time, del_flag)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.memberId,jdbcType=VARCHAR}, #{item.pileSn,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR}, (#{item.memberId,jdbcType=VARCHAR}, #{item.pileSn,jdbcType=VARCHAR}, #{item.pileConnectorCode,jdbcType=VARCHAR},
#{item.reservedType,jdbcType=VARCHAR}, #{item.startTime,jdbcType=TIME}, #{item.endTime,jdbcType=TIME}, #{item.status,jdbcType=VARCHAR}, #{item.reservedType,jdbcType=VARCHAR}, #{item.startTime,jdbcType=TIME},
#{item.freq,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.endTime,jdbcType=TIME}, #{item.freq,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
#{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.delFlag,jdbcType=CHAR} #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
) #{item.delFlag,jdbcType=CHAR})
</foreach> </foreach>
</insert> </insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true"> <insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true">
@@ -375,6 +398,7 @@
</if> </if>
member_id, member_id,
pile_sn, pile_sn,
pile_connector_code,
`status`, `status`,
reserved_type, reserved_type,
start_time, start_time,
@@ -393,6 +417,7 @@
</if> </if>
#{memberId,jdbcType=VARCHAR}, #{memberId,jdbcType=VARCHAR},
#{pileSn,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR},
#{pileConnectorCode,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{reservedType,jdbcType=VARCHAR}, #{reservedType,jdbcType=VARCHAR},
#{startTime,jdbcType=TIME}, #{startTime,jdbcType=TIME},
@@ -411,6 +436,7 @@
</if> </if>
member_id = #{memberId,jdbcType=VARCHAR}, member_id = #{memberId,jdbcType=VARCHAR},
pile_sn = #{pileSn,jdbcType=VARCHAR}, pile_sn = #{pileSn,jdbcType=VARCHAR},
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR},
reserved_type = #{reservedType,jdbcType=VARCHAR}, reserved_type = #{reservedType,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIME}, start_time = #{startTime,jdbcType=TIME},
@@ -436,6 +462,9 @@
<if test="pileSn != null"> <if test="pileSn != null">
pile_sn, pile_sn,
</if> </if>
<if test="pileConnectorCode != null">
pile_connector_code,
</if>
<if test="status != null"> <if test="status != null">
`status`, `status`,
</if> </if>
@@ -478,6 +507,9 @@
<if test="pileSn != null"> <if test="pileSn != null">
#{pileSn,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR},
</if> </if>
<if test="pileConnectorCode != null">
#{pileConnectorCode,jdbcType=VARCHAR},
</if>
<if test="status != null"> <if test="status != null">
#{status,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
</if> </if>
@@ -520,6 +552,9 @@
<if test="pileSn != null"> <if test="pileSn != null">
pile_sn = #{pileSn,jdbcType=VARCHAR}, pile_sn = #{pileSn,jdbcType=VARCHAR},
</if> </if>
<if test="pileConnectorCode != null">
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
</if>
<if test="status != null"> <if test="status != null">
`status` = #{status,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR},
</if> </if>