2025-11-24 16:02:55 +08:00
|
|
|
package com.cdzy.operations.controller;
|
|
|
|
|
|
2025-11-25 10:37:06 +08:00
|
|
|
import com.cdzy.common.model.request.PageParam;
|
|
|
|
|
import com.cdzy.common.model.response.JsonResult;
|
|
|
|
|
import com.cdzy.operations.enums.BikeOrderHandleState;
|
2025-11-24 16:02:55 +08:00
|
|
|
import com.cdzy.operations.model.entity.EbikeBikeOrder;
|
|
|
|
|
import com.cdzy.operations.service.EbikeBikeOrderService;
|
|
|
|
|
import com.mybatisflex.core.paginate.Page;
|
2025-11-25 10:37:06 +08:00
|
|
|
import com.mybatisflex.core.query.QueryWrapper;
|
|
|
|
|
import com.mybatisflex.core.util.StringUtil;
|
2025-11-24 16:02:55 +08:00
|
|
|
import jakarta.annotation.Resource;
|
2025-11-25 10:37:06 +08:00
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
2025-11-24 16:02:55 +08:00
|
|
|
|
2025-11-25 10:37:06 +08:00
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
import static com.cdzy.operations.model.entity.table.EbikeBikeOrderTableDef.EBIKE_BIKE_ORDER;
|
2025-11-24 16:02:55 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工单信息 控制层。
|
|
|
|
|
*
|
|
|
|
|
* @author attiya
|
|
|
|
|
* @since 2025-11-24
|
|
|
|
|
*/
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/ebikeBikeOrder")
|
2025-11-25 10:37:06 +08:00
|
|
|
@Validated
|
2025-11-24 16:02:55 +08:00
|
|
|
public class EbikeBikeOrderController {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private EbikeBikeOrderService ebikeBikeOrderService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2025-11-25 10:37:06 +08:00
|
|
|
* 分页查询工单信息。
|
2025-11-24 16:02:55 +08:00
|
|
|
*
|
2025-11-25 10:37:06 +08:00
|
|
|
* @param page 分页对象
|
|
|
|
|
* @return 分页对象
|
2025-11-24 16:02:55 +08:00
|
|
|
*/
|
2025-11-25 10:37:06 +08:00
|
|
|
@GetMapping("page")
|
|
|
|
|
public JsonResult<?> page(PageParam page, Integer orderType,String bikeCode) {
|
|
|
|
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
|
|
|
|
.where(EBIKE_BIKE_ORDER.HANDLE_STATE.eq(BikeOrderHandleState.UNPROCESSED))
|
|
|
|
|
.where(EBIKE_BIKE_ORDER.ORDER_TYPE.eq(orderType, Objects.nonNull(orderType)))
|
|
|
|
|
.where(EBIKE_BIKE_ORDER.BIKE_CODE.eq(bikeCode, StringUtil.hasText(bikeCode)));
|
|
|
|
|
Page<EbikeBikeOrder> orderPage = ebikeBikeOrderService.page(page.getPage(), queryWrapper);
|
|
|
|
|
return JsonResult.success(orderPage);
|
2025-11-24 16:02:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2025-11-25 10:37:06 +08:00
|
|
|
* 生成换电工单。
|
2025-11-24 16:02:55 +08:00
|
|
|
*
|
2025-11-25 10:37:06 +08:00
|
|
|
* @param ecuSn 中控编码
|
|
|
|
|
* @return 结果
|
2025-11-24 16:02:55 +08:00
|
|
|
*/
|
2025-11-25 10:37:06 +08:00
|
|
|
@GetMapping("batterySwapOrder")
|
|
|
|
|
public JsonResult<?> batterySwapOrder(String ecuSn) {
|
|
|
|
|
ebikeBikeOrderService.createBatterySwapOrder(ecuSn);
|
|
|
|
|
return JsonResult.success();
|
2025-11-24 16:02:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|