mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-11 17:48:09 +08:00
占桩订单表 实体类update
This commit is contained in:
@@ -92,7 +92,7 @@ public class IdUtils {
|
|||||||
id /= 10;
|
id /= 10;
|
||||||
}
|
}
|
||||||
// Integer num = Integer.parseInt(id + "");
|
// Integer num = Integer.parseInt(id + "");
|
||||||
return "C" + id;
|
return String.valueOf(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.jsowell.pile.dto;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class QueryOccupyOrderDTO {
|
||||||
|
// 充电桩编号
|
||||||
|
private String pileSn;
|
||||||
|
|
||||||
|
// 会员id
|
||||||
|
private String memberId;
|
||||||
|
|
||||||
|
// 充电桩枪口编号
|
||||||
|
private String pileConnectorCode;
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.jsowell.pile.mapper;
|
package com.jsowell.pile.mapper;
|
||||||
|
|
||||||
import com.jsowell.pile.domain.OrderPileOccupy;
|
import com.jsowell.pile.domain.OrderPileOccupy;
|
||||||
|
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -63,4 +64,8 @@ public interface OrderPileOccupyMapper {
|
|||||||
int updateBatchSelective(List<OrderPileOccupy> list);
|
int updateBatchSelective(List<OrderPileOccupy> list);
|
||||||
|
|
||||||
int batchInsert(@Param("list") List<OrderPileOccupy> list);
|
int batchInsert(@Param("list") List<OrderPileOccupy> list);
|
||||||
|
|
||||||
|
OrderPileOccupy queryByOccupyCode(@Param("occupyCode") String occupyCode);
|
||||||
|
|
||||||
|
List<OrderPileOccupy> queryOccupyOrderList(@Param("dto") QueryOccupyOrderDTO dto);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.jsowell.pile.service;
|
package com.jsowell.pile.service;
|
||||||
|
|
||||||
import com.jsowell.pile.domain.OrderPileOccupy;
|
import com.jsowell.pile.domain.OrderPileOccupy;
|
||||||
|
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
public interface OrderPileOccupyService{
|
public interface OrderPileOccupyService{
|
||||||
@@ -26,6 +27,10 @@ public interface OrderPileOccupyService{
|
|||||||
|
|
||||||
int batchInsert(List<OrderPileOccupy> list);
|
int batchInsert(List<OrderPileOccupy> list);
|
||||||
|
|
||||||
|
OrderPileOccupy queryByOccupyCode(String occupyCode);
|
||||||
|
|
||||||
|
List<OrderPileOccupy> queryOccupyOrderList(QueryOccupyOrderDTO dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成占桩订单
|
* 生成占桩订单
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1327,7 +1327,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
*/
|
*/
|
||||||
private String generateNewOrderCode() {
|
private String generateNewOrderCode() {
|
||||||
while (true) {
|
while (true) {
|
||||||
String orderCode = IdUtils.getOrderCode();
|
String orderCode = "C" + IdUtils.getOrderCode();
|
||||||
// 通过orderCode查询是否已经存在
|
// 通过orderCode查询是否已经存在
|
||||||
OrderBasicInfo orderBasicInfo = getOrderInfoByOrderCode(orderCode);
|
OrderBasicInfo orderBasicInfo = getOrderInfoByOrderCode(orderCode);
|
||||||
if (orderBasicInfo == null) {
|
if (orderBasicInfo == null) {
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
package com.jsowell.pile.service.impl;
|
package com.jsowell.pile.service.impl;
|
||||||
|
|
||||||
|
import com.jsowell.common.constant.Constants;
|
||||||
|
import com.jsowell.common.util.DateUtils;
|
||||||
|
import com.jsowell.common.util.id.IdUtils;
|
||||||
import com.jsowell.pile.domain.OrderPileOccupy;
|
import com.jsowell.pile.domain.OrderPileOccupy;
|
||||||
|
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
|
||||||
import com.jsowell.pile.mapper.OrderPileOccupyMapper;
|
import com.jsowell.pile.mapper.OrderPileOccupyMapper;
|
||||||
import com.jsowell.pile.service.OrderPileOccupyService;
|
import com.jsowell.pile.service.OrderPileOccupyService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
||||||
|
|
||||||
@@ -68,6 +75,26 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
|||||||
return orderPileOccupyMapper.batchInsert(list);
|
return orderPileOccupyMapper.batchInsert(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据占桩订单编号查询占桩订单
|
||||||
|
* @param occupyCode 占桩订单编号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OrderPileOccupy queryByOccupyCode(String occupyCode) {
|
||||||
|
return orderPileOccupyMapper.queryByOccupyCode(occupyCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询占桩订单列表
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OrderPileOccupy> queryOccupyOrderList(QueryOccupyOrderDTO dto) {
|
||||||
|
return orderPileOccupyMapper.queryOccupyOrderList(dto);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成占桩订单
|
* 生成占桩订单
|
||||||
* 在会员操作降地锁后,就生成占桩订单
|
* 在会员操作降地锁后,就生成占桩订单
|
||||||
@@ -77,11 +104,30 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void generateOccupyPileOrder(String memberId, String pileSn, String connectorCode) {
|
public void generateOccupyPileOrder(String memberId, String pileSn, String connectorCode) {
|
||||||
|
// 创建占桩订单
|
||||||
OrderPileOccupy orderPileOccupy = new OrderPileOccupy();
|
OrderPileOccupy orderPileOccupy = new OrderPileOccupy();
|
||||||
|
String occupyCode = "OP" + IdUtils.getOrderCode();
|
||||||
|
orderPileOccupy.setOccupyCode(occupyCode);
|
||||||
orderPileOccupy.setMemberId(memberId);
|
orderPileOccupy.setMemberId(memberId);
|
||||||
|
orderPileOccupy.setStatus(Constants.ZERO);
|
||||||
orderPileOccupy.setPileSn(pileSn);
|
orderPileOccupy.setPileSn(pileSn);
|
||||||
orderPileOccupy.setConnectorCode(connectorCode);
|
orderPileOccupy.setConnectorCode(connectorCode);
|
||||||
orderPileOccupy.setPileConnectorCode(pileSn + connectorCode);
|
orderPileOccupy.setPileConnectorCode(pileSn + connectorCode);
|
||||||
|
orderPileOccupy.setStartTime(DateUtils.getNowDate());
|
||||||
|
orderPileOccupyMapper.insertOrUpdate(orderPileOccupy);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 占桩订单停止计费
|
||||||
|
*/
|
||||||
|
public void stopOccupyPileOrder(String occupyCode) {
|
||||||
|
OrderPileOccupy orderPileOccupy = queryByOccupyCode(occupyCode);
|
||||||
|
if (orderPileOccupy == null) {
|
||||||
|
log.error("根据占桩订单编号:{}, 查询为空", occupyCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
orderPileOccupy.setEndTime(DateUtils.getNowDate());
|
||||||
|
orderPileOccupyMapper.insertOrUpdate(orderPileOccupy);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -662,4 +662,28 @@
|
|||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="queryByOccupyCode" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from order_pile_occupy
|
||||||
|
where del_flag = '0'
|
||||||
|
and occupy_code = #{occupyCode,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryOccupyOrderList" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from order_pile_occupy
|
||||||
|
where del_flag = '0'
|
||||||
|
<if test="dto.memberId != null and dto.memberId != ''">
|
||||||
|
and member_id = #{dto.memberId,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
|
<if test="dto.pileConnectorCode != null and dto.pileConnectorCode != ''">
|
||||||
|
and pile_connector_code = #{dto.pileConnectorCode,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
|
<if test="dto.pileSn != null and dto.pileSn != ''">
|
||||||
|
and pile_sn = #{dto.pileSn,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user