工单详情
This commit is contained in:
parent
d0cd1b7bad
commit
8ad8a18eec
@ -3,6 +3,7 @@ package com.cdzy.operations.controller;
|
||||
import com.cdzy.common.model.request.PageParam;
|
||||
import com.cdzy.common.model.response.JsonResult;
|
||||
import com.cdzy.operations.enums.BikeOrderHandleState;
|
||||
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
||||
import com.cdzy.operations.model.dto.EbikeBikeOrderPageDto;
|
||||
import com.cdzy.operations.model.vo.InspectionSwapOrderVo;
|
||||
import com.cdzy.operations.service.EbikeBikeOrderService;
|
||||
@ -55,19 +56,13 @@ public class EbikeBikeOrderController {
|
||||
/**
|
||||
* 工单详情。
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param orderId 工单ID
|
||||
* @return 分页对象
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
public JsonResult<?> getInfo(PageParam page, Integer orderType,String bikeCode) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.select(EBIKE_BIKE_INFO.LOCATION,EBIKE_BIKE_ORDER.ALL_COLUMNS)
|
||||
.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.like(bikeCode, StringUtil.hasText(bikeCode)))
|
||||
.leftJoin(EBIKE_BIKE_INFO).on(EBIKE_BIKE_INFO.BIKE_CODE.eq(EBIKE_BIKE_ORDER.BIKE_CODE));
|
||||
Page<EbikeBikeOrderPageDto> orderPage = ebikeBikeOrderService.pageAs(page.getPage(), queryWrapper, EbikeBikeOrderPageDto.class);
|
||||
return JsonResult.success(orderPage);
|
||||
public JsonResult<?> getInfo(Long orderId) {
|
||||
EbikeBikeOrderInfoDto infoDto = ebikeBikeOrderService.getInfo(orderId);
|
||||
return JsonResult.success(infoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
package com.cdzy.operations.model.dto;
|
||||
|
||||
import com.cdzy.operations.handler.PGpointDeserializer;
|
||||
import com.cdzy.operations.handler.PGpointSerializer;
|
||||
import com.cdzy.operations.handler.PGpointTypeHandler;
|
||||
import com.cdzy.operations.model.entity.EbikeOrderPart;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.RelationOneToMany;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.postgresql.geometric.PGpoint;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工单信息 实体类。
|
||||
*
|
||||
* @author attiya
|
||||
* @since 2025-11-24
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EbikeBikeOrderInfoDto implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 工单ID
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 车辆编号
|
||||
*/
|
||||
private String bikeCode;
|
||||
|
||||
/**
|
||||
* 定位
|
||||
*/
|
||||
@Column(typeHandler = PGpointTypeHandler.class)
|
||||
@JsonSerialize(using = PGpointSerializer.class)
|
||||
@JsonDeserialize(using = PGpointDeserializer.class)
|
||||
private PGpoint location;
|
||||
|
||||
|
||||
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 故障内容
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* SN
|
||||
*/
|
||||
private String ecuSn;
|
||||
|
||||
/**
|
||||
* 电量
|
||||
*/
|
||||
private Integer soc;
|
||||
|
||||
/**
|
||||
* 故障部位
|
||||
*/
|
||||
@RelationOneToMany(selfField = "orderId", targetField = "orderId")
|
||||
private List<EbikeOrderPart> parts;
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class EbikeBikeOrder implements Serializable {
|
||||
private Long receiverId;
|
||||
|
||||
/**
|
||||
* 处理状态
|
||||
* 处理状态: 0-未处理 1-已接单 2-已处理 3-作废
|
||||
*/
|
||||
@Column(onInsertValue = "0")
|
||||
private Integer handleState;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.cdzy.operations.service;
|
||||
|
||||
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
||||
import com.cdzy.operations.model.vo.InspectionSwapOrderVo;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cdzy.operations.model.entity.EbikeBikeOrder;
|
||||
@ -31,4 +32,11 @@ public interface EbikeBikeOrderService extends IService<EbikeBikeOrder> {
|
||||
* @param siteId 站点ID(目的地站点)
|
||||
*/
|
||||
void createDispatchSwapOrder(String bikeCode,Long siteId);
|
||||
|
||||
/**
|
||||
* 工单详情
|
||||
* @param orderId 订单ID
|
||||
* @return 详情
|
||||
*/
|
||||
EbikeBikeOrderInfoDto getInfo(Long orderId);
|
||||
}
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
package com.cdzy.operations.service.impl;
|
||||
|
||||
import com.cdzy.common.ex.EbikeException;
|
||||
import com.cdzy.common.model.dto.ResGPSDto;
|
||||
import com.cdzy.operations.enums.BikeOrderType;
|
||||
import com.cdzy.operations.enums.BikeStatus;
|
||||
import com.cdzy.operations.enums.BikeUsageStatus;
|
||||
import com.cdzy.operations.enums.RegionStatus;
|
||||
import com.cdzy.operations.mapper.*;
|
||||
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
||||
import com.cdzy.operations.model.entity.*;
|
||||
import com.cdzy.operations.model.vo.InspectionSwapOrderVo;
|
||||
import com.cdzy.operations.service.EbikeBikeOrderService;
|
||||
import com.cdzy.operations.utils.RedisUtil;
|
||||
import com.mybatisflex.core.keygen.impl.SnowFlakeIDKeyGenerator;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
@ -18,6 +21,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cdzy.operations.model.entity.table.EbikeBikeInfoTableDef.EBIKE_BIKE_INFO;
|
||||
import static com.cdzy.operations.model.entity.table.EbikeBikeOrderTableDef.EBIKE_BIKE_ORDER;
|
||||
@ -53,6 +57,9 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
||||
@Resource
|
||||
EbikeOrderFileMapper orderFileMapper;
|
||||
|
||||
@Resource
|
||||
RedisUtil redisUtil;
|
||||
|
||||
@Override
|
||||
public void createBatterySwapOrder(String ecuSn) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
@ -150,6 +157,21 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
||||
bikeInfoMapper.update(bikeInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EbikeBikeOrderInfoDto getInfo(Long orderId) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.select(EBIKE_BIKE_INFO.LOCATION,EBIKE_BIKE_ORDER.ORDER_ID,EBIKE_BIKE_ORDER.BIKE_CODE,EBIKE_BIKE_ORDER.REMARKS,EBIKE_BIKE_ORDER.CREATED_AT,EBIKE_BIKE_ORDER.REMARKS,EBIKE_ECU_INFO.ECU_SN)
|
||||
.where(EBIKE_BIKE_ORDER.ORDER_ID.eq(orderId))
|
||||
.leftJoin(EBIKE_BIKE_INFO).on(EBIKE_BIKE_INFO.BIKE_CODE.eq(EBIKE_BIKE_ORDER.BIKE_CODE))
|
||||
.leftJoin(EBIKE_ECU_INFO).on(EBIKE_ECU_INFO.ECU_ID.eq(EBIKE_BIKE_INFO.ECU_ID));
|
||||
EbikeBikeOrderInfoDto infoDto = this.mapper.selectOneWithRelationsByQueryAs(queryWrapper, EbikeBikeOrderInfoDto.class);
|
||||
ResGPSDto resGPSDto = (ResGPSDto)redisUtil.get(RedisUtil.Database.DB2, infoDto.getEcuSn());
|
||||
if (Objects.nonNull(resGPSDto)) {
|
||||
infoDto.setSoc(resGPSDto.getSoc());
|
||||
}
|
||||
return infoDto;
|
||||
}
|
||||
|
||||
EbikeBikeInfo checkBikeCode(String bikeCode) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_BIKE_INFO.BIKE_CODE.eq(bikeCode))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user