车辆上/下架

This commit is contained in:
attiya 2025-11-05 16:34:54 +08:00
parent 73f7447849
commit a4f712893b
4 changed files with 149 additions and 11 deletions

View File

@ -2,7 +2,7 @@ package com.cdzy.operations.controller;
import com.cdzy.common.model.request.PageParam;
import com.cdzy.common.model.response.JsonResult;
import com.cdzy.operations.model.entity.EbikeBikeInfo;
import com.cdzy.operations.model.dto.EbikeBikeInfoDto;
import com.cdzy.operations.model.vo.EbikeBatchLaunchVo;
import com.cdzy.operations.model.vo.EbikeBatchUnLaunchVo;
import com.cdzy.operations.model.vo.EbikeBikeBindVo;
@ -46,7 +46,7 @@ public class EbikeBikeInfoController {
*/
@GetMapping("unLaunchPage")
public JsonResult<?> unLaunchPage(PageParam pageParam) {
Page<EbikeBikeInfo> page = ebikeBikeInfoService.unLaunchPage(pageParam);
Page<EbikeBikeInfoDto> page = ebikeBikeInfoService.unLaunchPage(pageParam);
return JsonResult.success(page);
}
@ -58,7 +58,7 @@ public class EbikeBikeInfoController {
*/
@GetMapping("launchPage")
public JsonResult<?> launchPage(PageParam pageParam) {
Page<EbikeBikeInfo> page = ebikeBikeInfoService.launchPage(pageParam);
Page<EbikeBikeInfoDto> page = ebikeBikeInfoService.launchPage(pageParam);
return JsonResult.success(page);
}

View File

@ -0,0 +1,133 @@
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.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
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 org.postgresql.geometric.PGpoint;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 实体类
*
* @author attiya
* @since 2025-10-21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("ebike_bike_info")
public class EbikeBikeInfoDto implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 车辆详情ID
*/
@Id
private Long bikeInfoId;
/**
* 运营商ID
*/
private Long operatorId;
/**
* 运营区ID
*/
private Long regionId;
/**
* 运营区名称
*/
private String regionName;
/**
* 车辆编号与车辆二维码编号相同
*/
private String bikeCode;
/**
* 电池ID
*/
private Long batteryId;
/**
* 中控ID
*/
private Long ecuId;
/**
* 头盔ID
*/
private Long helmetId;
/**
* 定位
*/
@Column(typeHandler = PGpointTypeHandler.class)
@JsonSerialize(using = PGpointSerializer.class)
@JsonDeserialize(using = PGpointDeserializer.class)
private PGpoint location;
/**
* 备注
*/
private String remarks;
/**
* 车辆状态
*/
private Integer status;
/**
* 车辆使用状态
*/
private Integer usageStatus;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createdAt;
/**
* 创建人
*/
private Long createdBy;
/**
* 修改时间
*/
@Column(onUpdateValue = "now()")
private LocalDateTime updatedAt;
/**
* 修改人
*/
private Long updatedBy;
/**
* 删除与否
*/
private Boolean isDeleted;
/**
* 是否包含头盔
*/
private Boolean hasHelme;
}

View File

@ -1,6 +1,7 @@
package com.cdzy.operations.service;
import com.cdzy.common.model.request.PageParam;
import com.cdzy.operations.model.dto.EbikeBikeInfoDto;
import com.cdzy.operations.model.entity.EbikeBikeInfo;
import com.cdzy.operations.model.vo.EbikeBatchLaunchVo;
import com.cdzy.operations.model.vo.EbikeBatchUnLaunchVo;
@ -37,14 +38,14 @@ public interface EbikeBikeInfoService extends IService<EbikeBikeInfo> {
* @param pageParam 分页参数
* @return 结果
*/
Page<EbikeBikeInfo> launchPage(PageParam pageParam);
Page<EbikeBikeInfoDto> launchPage(PageParam pageParam);
/**
* 未上架车辆分页查询
* @param pageParam 分页参数
* @return 结果
*/
Page<EbikeBikeInfo> unLaunchPage(PageParam pageParam);
Page<EbikeBikeInfoDto> unLaunchPage(PageParam pageParam);
/**
* 批量上架

View File

@ -5,6 +5,7 @@ import com.cdzy.common.ex.EbikeException;
import com.cdzy.common.model.request.PageParam;
import com.cdzy.operations.enums.*;
import com.cdzy.operations.mapper.*;
import com.cdzy.operations.model.dto.EbikeBikeInfoDto;
import com.cdzy.operations.model.entity.*;
import com.cdzy.operations.model.vo.EbikeBatchLaunchVo;
import com.cdzy.operations.model.vo.EbikeBatchUnLaunchVo;
@ -31,6 +32,7 @@ import static com.cdzy.operations.model.entity.table.EbikeBatteryInfoTableDef.EB
import static com.cdzy.operations.model.entity.table.EbikeBikeInfoTableDef.EBIKE_BIKE_INFO;
import static com.cdzy.operations.model.entity.table.EbikeBikeQrTableDef.EBIKE_BIKE_QR;
import static com.cdzy.operations.model.entity.table.EbikeEcuInfoTableDef.EBIKE_ECU_INFO;
import static com.cdzy.operations.model.entity.table.EbikeRegionTableDef.EBIKE_REGION;
/**
* 服务层实现
@ -201,21 +203,23 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
}
@Override
public Page<EbikeBikeInfo> launchPage(PageParam pageParam) {
public Page<EbikeBikeInfoDto> launchPage(PageParam pageParam) {
QueryWrapper query = QueryWrapper.create()
.select(EBIKE_BIKE_INFO.ALL_COLUMNS)
.select(EBIKE_BIKE_INFO.ALL_COLUMNS,EBIKE_REGION.REGION_NAME)
.from(EBIKE_BIKE_INFO)
.leftJoin(EBIKE_REGION).on(EBIKE_BIKE_INFO.REGION_ID.eq(EBIKE_REGION.REGION_ID))
.where(EBIKE_BIKE_INFO.STATUS.eq(BikeStatus.LAUNCH));
return this.mapper.paginate(pageParam.getPage(),query);
return this.mapper.paginateAs(pageParam.getPage(),query, EbikeBikeInfoDto.class);
}
@Override
public Page<EbikeBikeInfo> unLaunchPage(PageParam pageParam) {
public Page<EbikeBikeInfoDto> unLaunchPage(PageParam pageParam) {
QueryWrapper query = QueryWrapper.create()
.select(EBIKE_BIKE_INFO.ALL_COLUMNS)
.select(EBIKE_BIKE_INFO.ALL_COLUMNS,EBIKE_REGION.REGION_NAME)
.from(EBIKE_BIKE_INFO)
.leftJoin(EBIKE_REGION).on(EBIKE_BIKE_INFO.REGION_ID.eq(EBIKE_REGION.REGION_ID))
.where(EBIKE_BIKE_INFO.STATUS.eq(BikeStatus.UN_LAUNCH));
return this.mapper.paginate(pageParam.getPage(),query);
return this.mapper.paginateAs(pageParam.getPage(),query, EbikeBikeInfoDto.class);
}
@Override