update 占桩订单逻辑

This commit is contained in:
2023-08-18 16:03:19 +08:00
parent 29a60ec560
commit d82ece35ca
3 changed files with 40 additions and 38 deletions

View File

@@ -70,14 +70,6 @@ public interface OrderPileOccupyMapper {
List<OrderPileOccupy> queryOccupyOrderList(@Param("dto") QueryOccupyOrderDTO dto); List<OrderPileOccupy> queryOccupyOrderList(@Param("dto") QueryOccupyOrderDTO dto);
/**
* 根据桩号和枪号查询占桩中的订单
*
* @param pileSn
* @param connectorCode
*/
OrderPileOccupy queryOccupiedOrder(@Param("pileSn") String pileSn, @Param("connectorCode") String connectorCode);
/** /**
* 通过memberId查询挂起状态订单 * 通过memberId查询挂起状态订单
* @param memberId * @param memberId
@@ -93,12 +85,18 @@ public interface OrderPileOccupyMapper {
List<OrderPileOccupyVO> getOccupyOrderInfo(String memberId); List<OrderPileOccupyVO> getOccupyOrderInfo(String memberId);
/** /**
* 根据桩编号、枪口号查询最近一条占桩订单 * 根据桩号和枪号 查询占桩状态的占桩订单
*
* @param pileSn
* @param connectorCode
*/
List<OrderPileOccupy> queryOccupiedOrder(@Param("pileSn") String pileSn, @Param("connectorCode") String connectorCode);
/**
* 根据桩号和枪号 查询草稿状态的占桩订单
* @param pileSn * @param pileSn
* @param connectorCode * @param connectorCode
* @return * @return
*/ */
OrderPileOccupy getOrderInfoByPile(@Param("pileSn") String pileSn, @Param("connectorCode") String connectorCode); List<OrderPileOccupy> queryDraftOccupyOrder(@Param("pileSn") String pileSn, @Param("connectorCode") String connectorCode);
List<OrderPileOccupy> getDraftOccupyOrder(@Param("pileSn") String pileSn, @Param("connectorCode") String connectorCode);
} }

View File

@@ -187,7 +187,7 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
@Override @Override
public void stopOccupyPileOrder(String pileSn, String connectorCode) { public void stopOccupyPileOrder(String pileSn, String connectorCode) {
// 根据充电站sn和枪口号查询占桩中的占桩订单 // 根据充电站sn和枪口号查询占桩中的占桩订单
OrderPileOccupy orderPileOccupy = orderPileOccupyMapper.queryOccupiedOrder(pileSn, connectorCode); OrderPileOccupy orderPileOccupy = getOccupiedOrder(pileSn, connectorCode);
if (orderPileOccupy == null) { if (orderPileOccupy == null) {
return; return;
} }
@@ -321,13 +321,31 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
*/ */
@Override @Override
public OrderPileOccupy getDraftOccupyOrder(String pileSn, String connectorCode) { public OrderPileOccupy getDraftOccupyOrder(String pileSn, String connectorCode) {
List<OrderPileOccupy> list = orderPileOccupyMapper.getDraftOccupyOrder(pileSn, connectorCode); List<OrderPileOccupy> list = orderPileOccupyMapper.queryDraftOccupyOrder(pileSn, connectorCode);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return null; return null;
} }
if (list.size() > 1) { if (list.size() > 1) {
List<Integer> collect = list.stream().map(OrderPileOccupy::getId).collect(Collectors.toList()); List<Integer> collect = list.stream().map(OrderPileOccupy::getId).collect(Collectors.toList());
log.info("根据pileSn:{}, connectorCode:{}, 查询出多条占桩订单, ids:{}", pileSn, connectorCode, collect); log.info("根据pileSn:{}, connectorCode:{}, 查询出多条草稿状态的占桩订单, ids:{}", pileSn, connectorCode, collect);
}
return list.get(0);
}
/**
* 查询占桩中的订单
* @param pileSn
* @param connectorCode
* @return
*/
public OrderPileOccupy getOccupiedOrder(String pileSn, String connectorCode) {
List<OrderPileOccupy> list = orderPileOccupyMapper.queryOccupiedOrder(pileSn, connectorCode);
if (CollectionUtils.isEmpty(list)) {
return null;
}
if (list.size() > 1) {
List<Integer> collect = list.stream().map(OrderPileOccupy::getId).collect(Collectors.toList());
log.info("根据pileSn:{}, connectorCode:{}, 查询出多条占桩中的占桩订单, ids:{}", pileSn, connectorCode, collect);
} }
return list.get(0); return list.get(0);
} }

View File

@@ -818,17 +818,6 @@
</if> </if>
</select> </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>
<select id="queryUnPayOrderByMemberId" resultMap="BaseResultMap"> <select id="queryUnPayOrderByMemberId" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
@@ -855,21 +844,18 @@
member_id = #{memberId,jdbcType=VARCHAR} member_id = #{memberId,jdbcType=VARCHAR}
</select> </select>
<select id="getOrderInfoByPile" resultMap="BaseResultMap"> <select id="queryOccupiedOrder" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from from order_pile_occupy
order_pile_occupy where del_flag = '0'
where and status = '0'
pile_sn = #{pileSn,jdbcType=VARCHAR} and pile_sn = #{pileSn,jdbcType=VARCHAR}
and and connector_code = #{connectorCode,jdbcType=VARCHAR}
connector_code = #{connectorCode,jdbcType=VARCHAR} order by create_time DESC
order by
create_time DESC
limit 1
</select> </select>
<select id="getDraftOccupyOrder" resultMap="BaseResultMap"> <select id="queryDraftOccupyOrder" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from from