mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
占桩订单逻辑
This commit is contained in:
@@ -2,6 +2,7 @@ package com.jsowell.pile.domain;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -24,7 +25,7 @@ public class OrderPileOccupy {
|
||||
private String occupyCode;
|
||||
|
||||
/**
|
||||
* 状态(0-占桩中;1-订单完成)
|
||||
* 状态(0-占桩中;1-订单完成; 2-订单挂起)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
@@ -33,6 +34,11 @@ public class OrderPileOccupy {
|
||||
*/
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 充电站id
|
||||
*/
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@@ -58,6 +64,11 @@ public class OrderPileOccupy {
|
||||
*/
|
||||
private String payStatus;
|
||||
|
||||
/**
|
||||
* 占桩订单金额
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
/**
|
||||
* 充电桩编号
|
||||
*/
|
||||
|
||||
@@ -68,4 +68,12 @@ public interface OrderPileOccupyMapper {
|
||||
OrderPileOccupy queryByOccupyCode(@Param("occupyCode") String occupyCode);
|
||||
|
||||
List<OrderPileOccupy> queryOccupyOrderList(@Param("dto") QueryOccupyOrderDTO dto);
|
||||
|
||||
/**
|
||||
* 根据桩号和枪号查询占桩中的订单
|
||||
*
|
||||
* @param pileSn
|
||||
* @param connectorCode
|
||||
*/
|
||||
OrderPileOccupy queryOccupiedOrder(@Param("pileSn") String pileSn, @Param("connectorCode") String connectorCode);
|
||||
}
|
||||
@@ -36,5 +36,6 @@ public interface OrderPileOccupyService{
|
||||
*/
|
||||
void generateOccupyPileOrder(String memberId, String pileSn, String connectorCode);
|
||||
|
||||
void stopOccupyPileOrder(String occupyCode);
|
||||
void stopOccupyPileOrder(String pileSn, String connectorCode);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,15 +3,25 @@ package com.jsowell.pile.service.impl;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.enums.DelFlagEnum;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.id.IdUtils;
|
||||
import com.jsowell.pile.domain.OrderPileOccupy;
|
||||
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||
import com.jsowell.pile.mapper.OrderPileOccupyMapper;
|
||||
import com.jsowell.pile.service.IOrderBasicInfoService;
|
||||
import com.jsowell.pile.service.IPileBasicInfoService;
|
||||
import com.jsowell.pile.service.IPileBillingTemplateService;
|
||||
import com.jsowell.pile.service.OrderPileOccupyService;
|
||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||
import com.jsowell.pile.vo.web.OrderListVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@@ -21,6 +31,15 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
||||
@Resource
|
||||
private OrderPileOccupyMapper orderPileOccupyMapper;
|
||||
|
||||
@Resource
|
||||
private IPileBasicInfoService pileBasicInfoService;
|
||||
|
||||
@Resource
|
||||
private IOrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Resource
|
||||
private IPileBillingTemplateService pileBillingTemplateService;
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(Integer id) {
|
||||
return orderPileOccupyMapper.deleteByPrimaryKey(id);
|
||||
@@ -83,6 +102,9 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
||||
*/
|
||||
@Override
|
||||
public OrderPileOccupy queryByOccupyCode(String occupyCode) {
|
||||
if (StringUtils.isBlank(occupyCode)) {
|
||||
return null;
|
||||
}
|
||||
return orderPileOccupyMapper.queryByOccupyCode(occupyCode);
|
||||
}
|
||||
|
||||
@@ -113,6 +135,10 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
||||
orderPileOccupy.setStatus(Constants.ZERO); // 占桩中
|
||||
orderPileOccupy.setPayStatus(Constants.ZERO); // 未支付
|
||||
orderPileOccupy.setPileSn(pileSn);
|
||||
PileInfoVO pileInfoVO = pileBasicInfoService.selectPileInfoBySn(pileSn);
|
||||
if (pileInfoVO != null) {
|
||||
orderPileOccupy.setStationId(pileInfoVO.getStationId());
|
||||
}
|
||||
orderPileOccupy.setConnectorCode(connectorCode);
|
||||
orderPileOccupy.setPileConnectorCode(pileSn + connectorCode);
|
||||
orderPileOccupy.setStartTime(DateUtils.getNowDate());
|
||||
@@ -121,16 +147,34 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
||||
}
|
||||
|
||||
/**
|
||||
* 收到地锁升起指令,调用这个方法,停止计时
|
||||
* 占桩订单停止计费/停止占桩订单计费
|
||||
* @param pileSn
|
||||
* @param connectorCode
|
||||
*/
|
||||
@Override
|
||||
public void stopOccupyPileOrder(String occupyCode) {
|
||||
OrderPileOccupy orderPileOccupy = queryByOccupyCode(occupyCode);
|
||||
public void stopOccupyPileOrder(String pileSn, String connectorCode) {
|
||||
// 根据充电站sn和枪口号,查询占桩中的占桩订单
|
||||
OrderPileOccupy orderPileOccupy = orderPileOccupyMapper.queryOccupiedOrder(pileSn, connectorCode);
|
||||
if (orderPileOccupy == null) {
|
||||
log.error("根据占桩订单编号:{}, 查询为空", occupyCode);
|
||||
return;
|
||||
}
|
||||
// 设置结束时间
|
||||
orderPileOccupy.setEndTime(DateUtils.getNowDate());
|
||||
|
||||
// 计算金额
|
||||
BigDecimal orderAmount = calculateOccupyPileOrderAmount(orderPileOccupy);
|
||||
|
||||
if (orderAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
// 需要支付金额,订单挂起
|
||||
orderPileOccupy.setStatus(Constants.TWO); // 2-订单挂起
|
||||
} else {
|
||||
// 订单金额为0
|
||||
orderPileOccupy.setPayStatus(Constants.TWO); // 2-无需支付
|
||||
orderPileOccupy.setStatus(Constants.ONE); // 1-订单完成
|
||||
}
|
||||
orderPileOccupy.setOrderAmount(orderAmount);
|
||||
// 更新数据库
|
||||
orderPileOccupyMapper.updateByPrimaryKeySelective(orderPileOccupy);
|
||||
}
|
||||
|
||||
@@ -138,8 +182,74 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
||||
* 计算占桩订单金额
|
||||
* calculateTheAmountOfTheOccupancyOrder
|
||||
*/
|
||||
public void calculateOccupyPileOrderAmount(String occupyCode) {
|
||||
private BigDecimal calculateOccupyPileOrderAmount(OrderPileOccupy orderPileOccupy) {
|
||||
BigDecimal resultAmount = BigDecimal.ZERO;
|
||||
String occupyCode = orderPileOccupy.getOccupyCode();
|
||||
Date startTime = orderPileOccupy.getStartTime(); // 占桩开始时间
|
||||
Date endTime = orderPileOccupy.getEndTime(); // 占桩结束时间
|
||||
|
||||
/*
|
||||
查新站点计费模板
|
||||
*/
|
||||
BillingTemplateVO billingTemplate = pileBillingTemplateService.queryUsedBillingTemplate(orderPileOccupy.getStationId());
|
||||
if (billingTemplate == null) {
|
||||
log.info("计算占桩订单金额-查询站点:{}计费模板为空, 不收取占桩费用", orderPileOccupy.getStationId());
|
||||
return resultAmount;
|
||||
}
|
||||
Integer freeTime = billingTemplate.getFreeTime(); // 免费时长
|
||||
BigDecimal occupyFee = billingTemplate.getOccupyFee(); // 占桩费率
|
||||
if (freeTime == null || occupyFee == null) {
|
||||
log.info("计算占桩订单金额-站点:{}计费模板未设置免费时长和占桩费率, 不收取占桩费用", orderPileOccupy.getStationId());
|
||||
return resultAmount;
|
||||
}
|
||||
|
||||
// 占桩时长
|
||||
long occupyTime = DateUtils.intervalTime(startTime, endTime);
|
||||
if (freeTime > occupyTime) {
|
||||
log.info("计算占桩订单金额-站点:{}的占桩订单:{}, 免费时长:{}大于占桩时长:{}, 不收取占桩费用", orderPileOccupy.getStationId(), occupyCode, freeTime, occupyTime);
|
||||
return resultAmount;
|
||||
}
|
||||
|
||||
/*
|
||||
查询会员在占用时段内有没有充电订单
|
||||
*/
|
||||
QueryOrderDTO dto = new QueryOrderDTO();
|
||||
dto.setMemberId(orderPileOccupy.getMemberId());
|
||||
dto.setStationId(orderPileOccupy.getStationId());
|
||||
// 查询在占桩期间创建的订单
|
||||
dto.setStartTime(DateUtils.formatDateTime(startTime));
|
||||
dto.setEndTime(DateUtils.formatDateTime(endTime));
|
||||
List<OrderListVO> orderListVOS = orderBasicInfoService.selectOrderBasicInfoList(dto);
|
||||
|
||||
/*
|
||||
计算充电时长
|
||||
*/
|
||||
long sumChargingTime = 0;
|
||||
for (OrderListVO orderListVO : orderListVOS) {
|
||||
String chargeStartTime = orderListVO.getChargeStartTime();
|
||||
String chargeEndTime = orderListVO.getChargeEndTime();
|
||||
// 如果没有开始时间或者结束时间,就不计入充电时长
|
||||
if (StringUtils.isBlank(chargeStartTime) || StringUtils.isNotBlank(chargeEndTime)) {
|
||||
continue;
|
||||
}
|
||||
long l = DateUtils.intervalTime(chargeStartTime, chargeEndTime);
|
||||
sumChargingTime = sumChargingTime + l;
|
||||
}
|
||||
|
||||
/*
|
||||
计算应收金额
|
||||
应收金额 = (总占用时长 - (免费时长 + 充电时长)) * 占桩费率
|
||||
*/
|
||||
BigDecimal totalOccupyTime = new BigDecimal(occupyTime + "");
|
||||
BigDecimal totalFreeTime = new BigDecimal(freeTime).add(new BigDecimal(sumChargingTime));
|
||||
if (totalFreeTime.compareTo(totalOccupyTime) >= 0) {
|
||||
log.info("计算占桩订单金额-站点:{}的占桩订单:{}, 总免费时长:{}大于占桩时长:{}, 不收取占桩费用", orderPileOccupy.getStationId(), occupyCode, totalFreeTime, totalOccupyTime);
|
||||
return resultAmount;
|
||||
}
|
||||
// 需要计费的时间
|
||||
BigDecimal time = totalOccupyTime.subtract(totalFreeTime);
|
||||
resultAmount = time.multiply(occupyFee);
|
||||
return resultAmount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,6 +43,12 @@ public class BillingTemplateVO {
|
||||
// 设备类型 1-电动汽车桩;2-电动自行车桩
|
||||
private String deviceType;
|
||||
|
||||
// 免费时长(单位:分钟)
|
||||
private Integer freeTime;
|
||||
|
||||
// 占桩费率(单位:元/分钟)
|
||||
private BigDecimal occupyFee;
|
||||
|
||||
// 尖时段电费
|
||||
private BigDecimal sharpElectricityPrice;
|
||||
// 尖时段服务费
|
||||
|
||||
@@ -8,11 +8,13 @@
|
||||
<result column="occupy_code" jdbcType="VARCHAR" property="occupyCode" />
|
||||
<result column="status" jdbcType="CHAR" property="status" />
|
||||
<result column="member_id" jdbcType="VARCHAR" property="memberId" />
|
||||
<result column="station_id" jdbcType="VARCHAR" property="stationId" />
|
||||
<result column="order_code" jdbcType="VARCHAR" property="orderCode" />
|
||||
<result column="transaction_code" jdbcType="VARCHAR" property="transactionCode" />
|
||||
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
|
||||
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
|
||||
<result column="pay_status" jdbcType="VARCHAR" property="payStatus" />
|
||||
<result column="order_amount" jdbcType="DECIMAL" property="orderAmount" />
|
||||
<result column="pile_sn" jdbcType="VARCHAR" property="pileSn" />
|
||||
<result column="connector_code" jdbcType="VARCHAR" property="connectorCode" />
|
||||
<result column="pile_connector_code" jdbcType="VARCHAR" property="pileConnectorCode" />
|
||||
@@ -24,9 +26,9 @@
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, occupy_code, `status`, member_id, order_code, transaction_code, start_time, end_time,
|
||||
pay_status, pile_sn, connector_code, pile_connector_code, create_time, create_by,
|
||||
update_time, update_by, del_flag
|
||||
id, occupy_code, `status`, member_id, station_id, order_code, transaction_code, start_time,
|
||||
end_time, pay_status, order_amount, pile_sn, connector_code, pile_connector_code,
|
||||
create_time, create_by, update_time, update_by, del_flag
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
@@ -43,17 +45,19 @@
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderPileOccupy" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into order_pile_occupy (occupy_code, `status`, member_id,
|
||||
order_code, transaction_code, start_time,
|
||||
end_time, pay_status, pile_sn,
|
||||
connector_code, pile_connector_code, create_time,
|
||||
create_by, update_time, update_by,
|
||||
del_flag)
|
||||
station_id, order_code, transaction_code,
|
||||
start_time, end_time, pay_status,
|
||||
order_amount, pile_sn, connector_code,
|
||||
pile_connector_code, create_time, create_by,
|
||||
update_time, update_by, del_flag
|
||||
)
|
||||
values (#{occupyCode,jdbcType=VARCHAR}, #{status,jdbcType=CHAR}, #{memberId,jdbcType=VARCHAR},
|
||||
#{orderCode,jdbcType=VARCHAR}, #{transactionCode,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP},
|
||||
#{endTime,jdbcType=TIMESTAMP}, #{payStatus,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR},
|
||||
#{connectorCode,jdbcType=VARCHAR}, #{pileConnectorCode,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
|
||||
#{delFlag,jdbcType=CHAR})
|
||||
#{stationId,jdbcType=VARCHAR}, #{orderCode,jdbcType=VARCHAR}, #{transactionCode,jdbcType=VARCHAR},
|
||||
#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{payStatus,jdbcType=VARCHAR},
|
||||
#{orderAmount,jdbcType=DECIMAL}, #{pileSn,jdbcType=VARCHAR}, #{connectorCode,jdbcType=VARCHAR},
|
||||
#{pileConnectorCode,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR},
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=CHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderPileOccupy" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
@@ -68,6 +72,9 @@
|
||||
<if test="memberId != null">
|
||||
member_id,
|
||||
</if>
|
||||
<if test="stationId != null">
|
||||
station_id,
|
||||
</if>
|
||||
<if test="orderCode != null">
|
||||
order_code,
|
||||
</if>
|
||||
@@ -83,6 +90,9 @@
|
||||
<if test="payStatus != null">
|
||||
pay_status,
|
||||
</if>
|
||||
<if test="orderAmount != null">
|
||||
order_amount,
|
||||
</if>
|
||||
<if test="pileSn != null">
|
||||
pile_sn,
|
||||
</if>
|
||||
@@ -118,6 +128,9 @@
|
||||
<if test="memberId != null">
|
||||
#{memberId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stationId != null">
|
||||
#{stationId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderCode != null">
|
||||
#{orderCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -133,6 +146,9 @@
|
||||
<if test="payStatus != null">
|
||||
#{payStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderAmount != null">
|
||||
#{orderAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="pileSn != null">
|
||||
#{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -172,6 +188,9 @@
|
||||
<if test="memberId != null">
|
||||
member_id = #{memberId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stationId != null">
|
||||
station_id = #{stationId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderCode != null">
|
||||
order_code = #{orderCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -187,6 +206,9 @@
|
||||
<if test="payStatus != null">
|
||||
pay_status = #{payStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderAmount != null">
|
||||
order_amount = #{orderAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="pileSn != null">
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -220,11 +242,13 @@
|
||||
set occupy_code = #{occupyCode,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=CHAR},
|
||||
member_id = #{memberId,jdbcType=VARCHAR},
|
||||
station_id = #{stationId,jdbcType=VARCHAR},
|
||||
order_code = #{orderCode,jdbcType=VARCHAR},
|
||||
transaction_code = #{transactionCode,jdbcType=VARCHAR},
|
||||
start_time = #{startTime,jdbcType=TIMESTAMP},
|
||||
end_time = #{endTime,jdbcType=TIMESTAMP},
|
||||
pay_status = #{payStatus,jdbcType=VARCHAR},
|
||||
order_amount = #{orderAmount,jdbcType=DECIMAL},
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
connector_code = #{connectorCode,jdbcType=VARCHAR},
|
||||
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
@@ -254,6 +278,11 @@
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.memberId,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="station_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.stationId,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="order_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.orderCode,jdbcType=VARCHAR}
|
||||
@@ -279,6 +308,11 @@
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.payStatus,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="order_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.orderAmount,jdbcType=DECIMAL}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="pile_sn = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.pileSn,jdbcType=VARCHAR}
|
||||
@@ -350,6 +384,13 @@
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="station_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.stationId != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.stationId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="order_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.orderCode != null">
|
||||
@@ -385,6 +426,13 @@
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="order_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.orderAmount != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.orderAmount,jdbcType=DECIMAL}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="pile_sn = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.pileSn != null">
|
||||
@@ -450,17 +498,18 @@
|
||||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into order_pile_occupy
|
||||
(occupy_code, `status`, member_id, order_code, transaction_code, start_time, end_time,
|
||||
pay_status, pile_sn, connector_code, pile_connector_code, create_time, create_by,
|
||||
update_time, update_by, del_flag)
|
||||
(occupy_code, `status`, member_id, station_id, order_code, transaction_code, start_time,
|
||||
end_time, pay_status, order_amount, pile_sn, connector_code, pile_connector_code,
|
||||
create_time, create_by, update_time, update_by, del_flag)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.occupyCode,jdbcType=VARCHAR}, #{item.status,jdbcType=CHAR}, #{item.memberId,jdbcType=VARCHAR},
|
||||
#{item.orderCode,jdbcType=VARCHAR}, #{item.transactionCode,jdbcType=VARCHAR}, #{item.startTime,jdbcType=TIMESTAMP},
|
||||
#{item.endTime,jdbcType=TIMESTAMP}, #{item.payStatus,jdbcType=VARCHAR}, #{item.pileSn,jdbcType=VARCHAR},
|
||||
#{item.connectorCode,jdbcType=VARCHAR}, #{item.pileConnectorCode,jdbcType=VARCHAR},
|
||||
#{item.createTime,jdbcType=TIMESTAMP}, #{item.createBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
|
||||
#{item.updateBy,jdbcType=VARCHAR}, #{item.delFlag,jdbcType=CHAR})
|
||||
#{item.stationId,jdbcType=VARCHAR}, #{item.orderCode,jdbcType=VARCHAR}, #{item.transactionCode,jdbcType=VARCHAR},
|
||||
#{item.startTime,jdbcType=TIMESTAMP}, #{item.endTime,jdbcType=TIMESTAMP}, #{item.payStatus,jdbcType=VARCHAR},
|
||||
#{item.orderAmount,jdbcType=DECIMAL}, #{item.pileSn,jdbcType=VARCHAR}, #{item.connectorCode,jdbcType=VARCHAR},
|
||||
#{item.pileConnectorCode,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
|
||||
#{item.createBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR},
|
||||
#{item.delFlag,jdbcType=CHAR})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderPileOccupy" useGeneratedKeys="true">
|
||||
@@ -473,15 +522,19 @@
|
||||
occupy_code,
|
||||
`status`,
|
||||
member_id,
|
||||
station_id,
|
||||
order_code,
|
||||
transaction_code,
|
||||
start_time,
|
||||
end_time,
|
||||
pay_status,
|
||||
order_amount,
|
||||
pile_sn,
|
||||
connector_code,
|
||||
pile_connector_code,
|
||||
create_time,
|
||||
create_by,
|
||||
update_time,
|
||||
update_by,
|
||||
del_flag,
|
||||
</trim>
|
||||
@@ -493,15 +546,19 @@
|
||||
#{occupyCode,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=CHAR},
|
||||
#{memberId,jdbcType=VARCHAR},
|
||||
#{stationId,jdbcType=VARCHAR},
|
||||
#{orderCode,jdbcType=VARCHAR},
|
||||
#{transactionCode,jdbcType=VARCHAR},
|
||||
#{startTime,jdbcType=TIMESTAMP},
|
||||
#{endTime,jdbcType=TIMESTAMP},
|
||||
#{payStatus,jdbcType=VARCHAR},
|
||||
#{orderAmount,jdbcType=DECIMAL},
|
||||
#{pileSn,jdbcType=VARCHAR},
|
||||
#{connectorCode,jdbcType=VARCHAR},
|
||||
#{pileConnectorCode,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{createBy,jdbcType=VARCHAR},
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
#{updateBy,jdbcType=VARCHAR},
|
||||
#{delFlag,jdbcType=CHAR},
|
||||
</trim>
|
||||
@@ -513,15 +570,19 @@
|
||||
occupy_code = #{occupyCode,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=CHAR},
|
||||
member_id = #{memberId,jdbcType=VARCHAR},
|
||||
station_id = #{stationId,jdbcType=VARCHAR},
|
||||
order_code = #{orderCode,jdbcType=VARCHAR},
|
||||
transaction_code = #{transactionCode,jdbcType=VARCHAR},
|
||||
start_time = #{startTime,jdbcType=TIMESTAMP},
|
||||
end_time = #{endTime,jdbcType=TIMESTAMP},
|
||||
pay_status = #{payStatus,jdbcType=VARCHAR},
|
||||
order_amount = #{orderAmount,jdbcType=DECIMAL},
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
connector_code = #{connectorCode,jdbcType=VARCHAR},
|
||||
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
del_flag = #{delFlag,jdbcType=CHAR},
|
||||
</trim>
|
||||
@@ -542,6 +603,9 @@
|
||||
<if test="memberId != null">
|
||||
member_id,
|
||||
</if>
|
||||
<if test="stationId != null">
|
||||
station_id,
|
||||
</if>
|
||||
<if test="orderCode != null">
|
||||
order_code,
|
||||
</if>
|
||||
@@ -557,6 +621,9 @@
|
||||
<if test="payStatus != null">
|
||||
pay_status,
|
||||
</if>
|
||||
<if test="orderAmount != null">
|
||||
order_amount,
|
||||
</if>
|
||||
<if test="pileSn != null">
|
||||
pile_sn,
|
||||
</if>
|
||||
@@ -596,6 +663,9 @@
|
||||
<if test="memberId != null">
|
||||
#{memberId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stationId != null">
|
||||
#{stationId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderCode != null">
|
||||
#{orderCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -611,6 +681,9 @@
|
||||
<if test="payStatus != null">
|
||||
#{payStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderAmount != null">
|
||||
#{orderAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="pileSn != null">
|
||||
#{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -650,6 +723,9 @@
|
||||
<if test="memberId != null">
|
||||
member_id = #{memberId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stationId != null">
|
||||
station_id = #{stationId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderCode != null">
|
||||
order_code = #{orderCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -665,6 +741,9 @@
|
||||
<if test="payStatus != null">
|
||||
pay_status = #{payStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderAmount != null">
|
||||
order_amount = #{orderAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="pileSn != null">
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -715,4 +794,15 @@
|
||||
and pile_sn = #{dto.pileSn,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryOccupiedOrder" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from order_pile_occupy
|
||||
where del_flag = '0'
|
||||
and status = '0'
|
||||
and pay_status = '0'
|
||||
and pile_sn = #{pileSn,jdbcType=VARCHAR}
|
||||
and connector_code = #{connectorCode,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -495,6 +495,8 @@
|
||||
t2.name as templateName,
|
||||
t2.remark as remark,
|
||||
t2.type as deviceType,
|
||||
t2.free_time as freeTime,
|
||||
t2.occupy_fee as occupyFee,
|
||||
t2.publish_time as publishTime,
|
||||
t3.electricity_price AS sharpElectricityPrice,
|
||||
t3.service_price AS sharpServicePrice,
|
||||
|
||||
Reference in New Issue
Block a user