增加租电订单查询

This commit is contained in:
2025-08-24 12:24:12 +08:00
parent d23f504095
commit b4dce9f195
8 changed files with 139 additions and 1 deletions

View File

@ -39,6 +39,14 @@ public class ClientOrderController {
return Result.ok(orderService.pageCustOrder(pageNo, pageSize, orderQueryReq));
}
@ApiOperation(value = "查询用户租电订单列表")
@PostMapping("/pageCustRentBatteyOrder")
public Result<IPage<RentBatteySplOrderDTO>> pageCustRentBatteyOrder(@RequestParam(name = "pageNo", required = false, defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", required = false, defaultValue = "10") Integer pageSize,
@RequestBody OrderQueryReq orderQueryReq){
return Result.ok(orderService.pageRentBatteySplOrder(pageNo, pageSize, orderQueryReq));
}
@ApiOperation(value = "生成租车订单")
@PostMapping("/confirmRentalCarOrder")
public Result<RentCarOrderResultDTO> confirmRentalCarOrder(@Valid @RequestBody RentCarOrderReq rentCarOrderReq){

View File

@ -0,0 +1,43 @@
package com.sczx.order.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@ApiModel(value = "租电订单订单列表dto", description = "租电订单订单列表dto")
public class RentBatteySplOrderDTO {
@ApiModelProperty("租电平台订单号")
private String zdOrderId;
@ApiModelProperty("租车平台子订单号")
private String suborderNo;
@ApiModelProperty("订单状态:下单未提车、租赁中、已结束-自动、已结束-手动")
private String orderStatus;
@ApiModelProperty("图标")
private String icon;
@ApiModelProperty("电压")
private String voltage;
@ApiModelProperty("电容")
private String ah;
@ApiModelProperty("电池类型名称")
private String categoryName;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("首次下单时间")
private LocalDateTime firstOrderTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("还车时间")
private LocalDateTime endRentTime;
}

View File

@ -3,6 +3,7 @@ package com.sczx.order.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sczx.order.dto.OrderSimpleDTO;
import com.sczx.order.dto.RentBatteySplOrderDTO;
import com.sczx.order.dto.StoreOrderStatisticsDTO;
import com.sczx.order.po.OrderMainPO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -22,4 +23,6 @@ public interface OrderMainMapper extends BaseMapper<OrderMainPO> {
StoreOrderStatisticsDTO storeOrderStatistics(@Param("storeId") Long storeId);
IPage<OrderSimpleDTO> pageQueryOrder(Page<OrderSimpleDTO> page, @Param("customerId") Long customerId, @Param("storeId") Long storeId, @Param("orderStatusList") List<String> orderStatusList, String queryBrandName);
IPage<RentBatteySplOrderDTO> pageQueryRentBatteyOrder(Page<RentBatteySplOrderDTO> page, @Param("customerId") Long customerId, @Param("storeId") Long storeId, @Param("orderStatusList") List<String> orderStatusList, String queryBrandName);
}

View File

@ -2,6 +2,7 @@ package com.sczx.order.repository;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sczx.order.dto.OrderSimpleDTO;
import com.sczx.order.dto.RentBatteySplOrderDTO;
import com.sczx.order.dto.StoreOrderStatisticsDTO;
import com.sczx.order.po.OrderMainPO;
import com.baomidou.mybatisplus.extension.service.IService;
@ -31,4 +32,16 @@ public interface OrderMainRepo extends IService<OrderMainPO> {
* @return
*/
IPage<OrderSimpleDTO> pageQueryOrder(Integer pageNo, Integer pageSize, Long customerId, Long storeId, List<String> orderStatusList, String queryBrandName);
/**
* 分页查询租电订单列表
*
* @param pageNo 页码
* @param pageSize 每页条数
* @param customerId 客户ID
* @param storeId 门店ID
* @param orderStatusList 订单状态
* @return
*/
IPage<RentBatteySplOrderDTO> pageQueryRentBatteyOrder(Integer pageNo, Integer pageSize, Long customerId, Long storeId, List<String> orderStatusList, String queryBrandName);
}

View File

@ -3,6 +3,7 @@ package com.sczx.order.repository.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sczx.order.dto.OrderSimpleDTO;
import com.sczx.order.dto.RentBatteySplOrderDTO;
import com.sczx.order.dto.StoreOrderStatisticsDTO;
import com.sczx.order.po.OrderMainPO;
import com.sczx.order.mapper.OrderMainMapper;
@ -33,4 +34,10 @@ public class OrderMainRepoImpl extends ServiceImpl<OrderMainMapper, OrderMainPO>
Page<OrderSimpleDTO> page = new Page<>(pageNo, pageSize);
return this.getBaseMapper().pageQueryOrder(page, customerId, storeId, orderStatusList, queryBrandName);
}
@Override
public IPage<RentBatteySplOrderDTO> pageQueryRentBatteyOrder(Integer pageNo, Integer pageSize, Long customerId, Long storeId, List<String> orderStatusList, String queryBrandName) {
Page<RentBatteySplOrderDTO> page = new Page<>(pageNo, pageSize);
return this.getBaseMapper().pageQueryRentBatteyOrder(page, customerId, storeId, orderStatusList, queryBrandName);
}
}

View File

@ -102,7 +102,7 @@ public interface OrderService {
StoreOrderStatisticsDTO storeOrderStatistics(Long storeId);
/**
* 查询门店订单列表
* 查询用户租车订单列表
* @param orderQueryReq
* @return
*/
@ -114,4 +114,11 @@ public interface OrderService {
* @return
*/
IPage<OrderSimpleDTO> pageStoreOrder(Integer pageNo, Integer pageSize, OrderQueryReq orderQueryReq);
/**
* 查询用户租电订单列表
* @param orderQueryReq
* @return
*/
IPage<RentBatteySplOrderDTO> pageRentBatteySplOrder(Integer pageNo, Integer pageSize, OrderQueryReq orderQueryReq);
}

View File

@ -861,6 +861,19 @@ public class OrderServiceImpl implements OrderService {
return orderMainRepo.pageQueryOrder(pageNo, pageSize, orderQueryReq.getCustomerId(), orderQueryReq.getStoreId(), orderStatusList, orderQueryReq.getQueryBrandName());
}
@Override
public IPage<RentBatteySplOrderDTO> pageRentBatteySplOrder(Integer pageNo, Integer pageSize, OrderQueryReq orderQueryReq) {
if(Objects.isNull(orderQueryReq.getCustomerId())){
orderQueryReq.setCustomerId(Long.valueOf(jwtUtil.getUserInfoFromToken().getUserId().toString()));
}
List<String> orderStatusList = null;
if(!CollectionUtils.isEmpty(orderQueryReq.getOrderStatusList())){
orderStatusList = orderQueryReq.getOrderStatusList().stream().map(OrderStatusEnum::getCode).collect(Collectors.toList());
}
return orderMainRepo.pageQueryRentBatteyOrder(pageNo, pageSize, orderQueryReq.getCustomerId(), orderQueryReq.getStoreId(), orderStatusList, orderQueryReq.getQueryBrandName());
}
/**
* 支付成功更新订单状态
* @param orderMainPO

View File

@ -59,4 +59,48 @@
</select>
<select id="pageQueryRentBatteyOrder" resultType="com.sczx.order.dto.RentBatteySplOrderDTO">
select
zos.b_order_id AS zd_order_id,
zos.suborder_no,
zom.order_status,
zrbr.icon,
zrbr.voltage,
zrbr.ah,
zbc.category_name,
zom.first_order_time,
zom.end_rent_time
from
zc_order_sub zos
left join zc_order_main zom on
zos.order_id = zom.order_id
left join zc_rent_battey_rule zrbr on
zom.rent_battey_rule_id = zrbr.id
left join zc_battery_category zbc on
zrbr.category_id = zbc.id
<where>
zos.del_flag = '0'
and zom.del_flag = '0'
<if test="customerId != null">
and zom.customer_id = #{customerId}
</if>
<if test="storeId != null">
and zom.store_id = #{storeId}
</if>
<if test="orderStatusList != null and orderStatusList.size() > 0">
and zom.order_status in
<foreach collection="orderStatusList" item="orderStatus" open="(" separator="," close=")">
#{orderStatus}
</foreach>
</if>
<if test="queryBrandName != null and queryBrandName != ''">
and zrbr.category_name like concat('%', #{queryBrandName}, '%')
</if>
</where>
order by zos.create_time desc
</select>
</mapper>