换电工单附加功能
This commit is contained in:
parent
676720c65b
commit
5290567a5e
@ -7,6 +7,8 @@ import com.cdzy.common.model.response.JsonResult;
|
|||||||
import com.cdzy.operations.enums.BikeOrderHandleState;
|
import com.cdzy.operations.enums.BikeOrderHandleState;
|
||||||
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
||||||
import com.cdzy.operations.model.dto.EbikeBikeOrderPageDto;
|
import com.cdzy.operations.model.dto.EbikeBikeOrderPageDto;
|
||||||
|
import com.cdzy.operations.model.vo.EbikeBatteryChangeVo;
|
||||||
|
import com.cdzy.operations.model.vo.EbikeBatteryClaimReturnVo;
|
||||||
import com.cdzy.operations.model.vo.FaultOrderVo;
|
import com.cdzy.operations.model.vo.FaultOrderVo;
|
||||||
import com.cdzy.operations.model.vo.InspectionSwapOrderVo;
|
import com.cdzy.operations.model.vo.InspectionSwapOrderVo;
|
||||||
import com.cdzy.operations.service.EbikeBikeOrderService;
|
import com.cdzy.operations.service.EbikeBikeOrderService;
|
||||||
@ -151,6 +153,7 @@ public class EbikeBikeOrderController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传远程故障图片
|
* 上传远程故障图片
|
||||||
|
*
|
||||||
* @param file 文件
|
* @param file 文件
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
@ -159,4 +162,49 @@ public class EbikeBikeOrderController {
|
|||||||
String result = ebikeBikeOrderService.upload(file);
|
String result = ebikeBikeOrderService.upload(file);
|
||||||
return JsonResult.success(Message.SUCCESS, result);
|
return JsonResult.success(Message.SUCCESS, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池二维码检查(换电工单用,包含带电池中控二维码)
|
||||||
|
* @param code 电池二维码
|
||||||
|
*
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@GetMapping("checkCode")
|
||||||
|
public JsonResult<?> checkCode(@NotNull(message = "二维码不能为空")String code) {
|
||||||
|
ebikeBikeOrderService.checkCode(code);
|
||||||
|
return JsonResult.success(Message.SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领取电池(换电工单用)
|
||||||
|
*
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@PostMapping("batteryClaim")
|
||||||
|
public JsonResult<?> batteryClaim(@Validated @RequestBody EbikeBatteryClaimReturnVo batteryClaimVo) {
|
||||||
|
ebikeBikeOrderService.batteryClaim(batteryClaimVo);
|
||||||
|
return JsonResult.success(Message.SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 归还电池(换电工单用)
|
||||||
|
*
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@PostMapping("batteryReturn")
|
||||||
|
public JsonResult<?> batteryReturn(@Validated @RequestBody EbikeBatteryClaimReturnVo batteryClaimVo) {
|
||||||
|
ebikeBikeOrderService.batteryReturn(batteryClaimVo);
|
||||||
|
return JsonResult.success(Message.SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更换电池(换电工单用)
|
||||||
|
*
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@PostMapping("batteryChange")
|
||||||
|
public JsonResult<?> batteryChange(@Validated @RequestBody EbikeBatteryChangeVo changeVo) {
|
||||||
|
ebikeBikeOrderService.batteryChange(changeVo);
|
||||||
|
return JsonResult.success(Message.SUCCESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cdzy.operations.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.cdzy.operations.model.entity.EbikeBorrowBatteryRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池领取归还记录 映射层。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-11-28
|
||||||
|
*/
|
||||||
|
public interface EbikeBorrowBatteryRecordMapper extends BaseMapper<EbikeBorrowBatteryRecord> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cdzy.operations.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.cdzy.operations.model.entity.EbikeRecordCodes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池领取归还电池编号记录 映射层。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-11-28
|
||||||
|
*/
|
||||||
|
public interface EbikeRecordCodesMapper extends BaseMapper<EbikeRecordCodes> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
package com.cdzy.operations.model.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池领取归还记录 实体类。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-11-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("ebike_borrow_battery_record")
|
||||||
|
public class EbikeBorrowBatteryRecord implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池领取记录ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
private Long borrowBatteryRecordId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领取时间
|
||||||
|
*/
|
||||||
|
private Integer borrowNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private Long createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已归还
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "f")
|
||||||
|
private Boolean isReturn;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package com.cdzy.operations.model.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池领取归还电池编号记录 实体类。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-11-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("ebike_record_codes")
|
||||||
|
public class EbikeRecordCodes implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池领取详细ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
private Long ebikeRecordCodeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池编号(也可能是带电池中控编号)
|
||||||
|
*/
|
||||||
|
private String batteryCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型:1-领取 2-归还
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池领取记录ID
|
||||||
|
*/
|
||||||
|
private Long borrowBatteryRecordId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package com.cdzy.operations.model.vo;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池更换基本信息。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-09-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EbikeBatteryChangeVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆二维码
|
||||||
|
*/
|
||||||
|
@NotNull(message = "车辆二维码不能为空")
|
||||||
|
private String bikeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆二维码
|
||||||
|
*/
|
||||||
|
@NotNull(message = "电池二维码不能为空")
|
||||||
|
private String batteryCode;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.cdzy.operations.model.vo;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池领取基本信息。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-09-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EbikeBatteryClaimReturnVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码(包含电池和中控,主要是待电池部分中控)
|
||||||
|
*/
|
||||||
|
@NotNull(message = "二维码内容不能为空")
|
||||||
|
private List<String> codes;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,6 +2,8 @@ package com.cdzy.operations.service;
|
|||||||
|
|
||||||
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
||||||
import com.cdzy.operations.model.entity.EbikeBikeOrder;
|
import com.cdzy.operations.model.entity.EbikeBikeOrder;
|
||||||
|
import com.cdzy.operations.model.vo.EbikeBatteryChangeVo;
|
||||||
|
import com.cdzy.operations.model.vo.EbikeBatteryClaimReturnVo;
|
||||||
import com.cdzy.operations.model.vo.FaultOrderVo;
|
import com.cdzy.operations.model.vo.FaultOrderVo;
|
||||||
import com.cdzy.operations.model.vo.InspectionSwapOrderVo;
|
import com.cdzy.operations.model.vo.InspectionSwapOrderVo;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
@ -59,4 +61,29 @@ public interface EbikeBikeOrderService extends IService<EbikeBikeOrder> {
|
|||||||
* @param faultOrderVo 故障信息
|
* @param faultOrderVo 故障信息
|
||||||
*/
|
*/
|
||||||
void faultOrder(FaultOrderVo faultOrderVo);
|
void faultOrder(FaultOrderVo faultOrderVo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领取电池
|
||||||
|
* @param batteryClaimVo 领取电池
|
||||||
|
*/
|
||||||
|
void batteryClaim(EbikeBatteryClaimReturnVo batteryClaimVo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池二维码检查(换电工单用,包含带电池中控二维码)
|
||||||
|
* @param code 电池二维码
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void checkCode(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 归还电池
|
||||||
|
* @param batteryClaimVo 归还电池
|
||||||
|
*/
|
||||||
|
void batteryReturn(EbikeBatteryClaimReturnVo batteryClaimVo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更换电池
|
||||||
|
* @param changeVo 更换信息
|
||||||
|
*/
|
||||||
|
void batteryChange(EbikeBatteryChangeVo changeVo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,10 +7,9 @@ import com.cdzy.common.model.dto.ResGPSDto;
|
|||||||
import com.cdzy.operations.enums.*;
|
import com.cdzy.operations.enums.*;
|
||||||
import com.cdzy.operations.mapper.*;
|
import com.cdzy.operations.mapper.*;
|
||||||
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
import com.cdzy.operations.model.dto.EbikeBikeOrderInfoDto;
|
||||||
import com.cdzy.operations.model.entity.EbikeBikeInfo;
|
import com.cdzy.operations.model.entity.*;
|
||||||
import com.cdzy.operations.model.entity.EbikeBikeOrder;
|
import com.cdzy.operations.model.vo.EbikeBatteryChangeVo;
|
||||||
import com.cdzy.operations.model.entity.EbikeOrderFile;
|
import com.cdzy.operations.model.vo.EbikeBatteryClaimReturnVo;
|
||||||
import com.cdzy.operations.model.entity.EbikeOrderPart;
|
|
||||||
import com.cdzy.operations.model.vo.FaultOrderVo;
|
import com.cdzy.operations.model.vo.FaultOrderVo;
|
||||||
import com.cdzy.operations.model.vo.InspectionSwapOrderVo;
|
import com.cdzy.operations.model.vo.InspectionSwapOrderVo;
|
||||||
import com.cdzy.operations.service.EbikeBikeOrderService;
|
import com.cdzy.operations.service.EbikeBikeOrderService;
|
||||||
@ -31,6 +30,7 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static com.cdzy.operations.model.entity.table.EbikeBatteryInfoTableDef.EBIKE_BATTERY_INFO;
|
||||||
import static com.cdzy.operations.model.entity.table.EbikeBikeInfoTableDef.EBIKE_BIKE_INFO;
|
import static com.cdzy.operations.model.entity.table.EbikeBikeInfoTableDef.EBIKE_BIKE_INFO;
|
||||||
import static com.cdzy.operations.model.entity.table.EbikeBikeOrderTableDef.EBIKE_BIKE_ORDER;
|
import static com.cdzy.operations.model.entity.table.EbikeBikeOrderTableDef.EBIKE_BIKE_ORDER;
|
||||||
import static com.cdzy.operations.model.entity.table.EbikeEcuInfoTableDef.EBIKE_ECU_INFO;
|
import static com.cdzy.operations.model.entity.table.EbikeEcuInfoTableDef.EBIKE_ECU_INFO;
|
||||||
@ -55,6 +55,15 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
@Resource
|
@Resource
|
||||||
EbikeBikeInfoMapper bikeInfoMapper;
|
EbikeBikeInfoMapper bikeInfoMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
EbikeBatteryInfoMapper batteryInfoMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
EbikeBorrowBatteryRecordMapper batteryRecordMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
EbikeRecordCodesMapper recordCodesMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
EbikeOrderPartMapper orderPartMapper;
|
EbikeOrderPartMapper orderPartMapper;
|
||||||
|
|
||||||
@ -225,6 +234,60 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public void batteryClaim(EbikeBatteryClaimReturnVo batteryClaimVo) {
|
||||||
|
List<String> codes = batteryClaimVo.getCodes();
|
||||||
|
EbikeBorrowBatteryRecord batteryRecord = EbikeBorrowBatteryRecord.builder()
|
||||||
|
.borrowNum(codes.size())
|
||||||
|
.createBy(StpUtil.getLoginIdAsLong())
|
||||||
|
.build();
|
||||||
|
batteryRecordMapper.insert(batteryRecord);
|
||||||
|
Long batteryRecordId = batteryRecord.getBorrowBatteryRecordId();
|
||||||
|
List<EbikeRecordCodes> list = new ArrayList<>();
|
||||||
|
for (String code : codes) {
|
||||||
|
EbikeRecordCodes recordCodes = EbikeRecordCodes.builder()
|
||||||
|
.batteryCode(code)
|
||||||
|
.type(1)
|
||||||
|
.borrowBatteryRecordId(batteryRecordId)
|
||||||
|
.build();
|
||||||
|
list.add(recordCodes);
|
||||||
|
}
|
||||||
|
if (!list.isEmpty()){
|
||||||
|
recordCodesMapper.insertBatch(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkCode(String code) {
|
||||||
|
if (code.startsWith("B")){
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.where(EBIKE_BATTERY_INFO.BATTERY_CODE.eq(code));
|
||||||
|
EbikeBatteryInfo batteryInfo = batteryInfoMapper.selectOneByQuery(queryWrapper);
|
||||||
|
if (batteryInfo == null) {
|
||||||
|
throw new EbikeException("电池二维码错误");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.where(EBIKE_ECU_INFO.ECU_SN.eq(code));
|
||||||
|
EbikeEcuInfo ecuInfo = ebikeEcuInfoMapper.selectOneByQuery(queryWrapper);
|
||||||
|
if (ecuInfo == null) {
|
||||||
|
throw new EbikeException("电池二维码错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void batteryReturn(EbikeBatteryClaimReturnVo batteryClaimVo) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void batteryChange(EbikeBatteryChangeVo changeVo) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
EbikeBikeInfo checkBikeCode(String bikeCode) {
|
EbikeBikeInfo checkBikeCode(String bikeCode) {
|
||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
.where(EBIKE_BIKE_INFO.BIKE_CODE.eq(bikeCode))
|
.where(EBIKE_BIKE_INFO.BIKE_CODE.eq(bikeCode))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user