增加租车详情页面的相关接口

This commit is contained in:
2025-07-13 20:17:51 +08:00
parent 5a83189579
commit f4b46b4fcd
21 changed files with 733 additions and 8 deletions

View File

@ -3,6 +3,7 @@ package com.sczx.car.controller;
import com.sczx.car.common.Result;
import com.sczx.car.dto.CarRentalDetailDTO;
import com.sczx.car.dto.RentBatteyRuleDTO;
import com.sczx.car.service.CarRentalService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 车型表 前端控制器
@ -28,10 +31,16 @@ public class CarRentalController {
@Autowired
private CarRentalService carRentalService;
@ApiOperation(value = "分页查询门店车型列表")
@ApiOperation(value = "租车详情信息")
@GetMapping("/queryCarRentalDetail")
public Result<CarRentalDetailDTO> queryCarRentalDetail(@RequestParam(name = "storeId") Integer storeId,
@RequestParam(name = "carModelId") Integer carModelId){
return Result.ok(carRentalService.queryCarRentalDetail(storeId, carModelId));
}
@ApiOperation(value = "根据租车套餐id查询租店套餐列表")
@GetMapping("/listRentBatteyRuleByCarRuleId")
public Result<List<RentBatteyRuleDTO>> listRentBatteyRuleByCarRuleId(@RequestParam(name = "carRuleId") Integer carRuleId){
return Result.ok(carRentalService.queryRentBatteyRuleByCarRuleId(carRuleId));
}
}

View File

@ -0,0 +1,14 @@
package com.sczx.car.convert;
import com.sczx.car.dto.CarModelSimpleDTO;
import com.sczx.car.po.CarModelPO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface CarModelConvert {
CarModelConvert INSTANCE = Mappers.getMapper(CarModelConvert.class);
CarModelPO simpleDtoToPO(CarModelSimpleDTO dto);
CarModelSimpleDTO poToSimpleDTO(CarModelPO po);
}

View File

@ -0,0 +1,14 @@
package com.sczx.car.convert;
import com.sczx.car.dto.RentBatteyRuleDTO;
import com.sczx.car.po.RentBatteyRulePO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface RentBatteyRuleConvert {
RentBatteyRuleConvert INSTANCE = Mappers.getMapper(RentBatteyRuleConvert.class);
RentBatteyRulePO dtoToPo(RentBatteyRuleDTO dto);
RentBatteyRuleDTO poToDto(RentBatteyRulePO po);
}

View File

@ -31,4 +31,7 @@ public class CarModelSimpleDTO {
@ApiModelProperty("是否支持代扣(0不支持 1支持)")
private String autoDeduct;
@ApiModelProperty("电池类型")
private String batteryType;
}

View File

@ -5,10 +5,18 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "租车详情对象")
public class CarRentalDetailDTO {
@ApiModelProperty("门店信息")
private CompanyStoreDTO storeInfo;
@ApiModelProperty("车型信息")
private CarModelSimpleDTO carModelInfo;
@ApiModelProperty("租车套餐列表")
private List<RentCarRuleDTO> rentCarRuleList;
}

View File

@ -0,0 +1,88 @@
package com.sczx.car.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@ApiModel(value = "租电套餐计费规则")
@Data
public class RentBatteyRuleDTO {
@ApiModelProperty("租电套餐id")
private Integer id;
@ApiModelProperty("商品标题")
private String title;
@ApiModelProperty("商品描述")
private String detail;
@ApiModelProperty("图标")
private String icon;
@ApiModelProperty("电压")
private String voltage;
@ApiModelProperty("电容")
private String ah;
@ApiModelProperty("最大里程")
private Integer maxMileage;
@ApiModelProperty("最小里程 默认0")
private Integer minMileage;
@ApiModelProperty("押金 ")
private BigDecimal depositPrice;
@ApiModelProperty("租金")
private BigDecimal rentPrice;
@ApiModelProperty("计时方式")
private Integer durationType;
@ApiModelProperty("租赁时长")
private Integer duration;
@ApiModelProperty("盗抢险")
private BigDecimal insurancePrice;
@ApiModelProperty("是否强制投保 默认0 false")
private Boolean compulsoryInsurance;
@ApiModelProperty("保险有效时长 默认12个月")
private Integer insuranceDuration;
@ApiModelProperty("换电次数")
private Integer changeNum;
@ApiModelProperty("1、有限次数 2无限次数")
private Integer changeType;
private Boolean isDelete;
private Integer cityId;
private Integer operatorId;
private Integer provinceId;
@ApiModelProperty("电池类型")
private Integer categoryId;
@ApiModelProperty("套餐类型 换电/租电")
private Integer mealType;
@ApiModelProperty("套餐排序规则")
private Integer mealSort;
private Boolean isJoinInvite;
@ApiModelProperty("套餐渠道租车默认 id号待定")
private Integer mealChannel;
@ApiModelProperty("购买限制类型")
private Integer buyLimitType;
}

View File

@ -0,0 +1,76 @@
package com.sczx.car.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@ApiModel(value = "租车计费规则对象")
@Data
public class RentCarRuleDTO {
@ApiModelProperty("规则ID")
private Long id;
@ApiModelProperty("套餐名称")
private String ruleName;
@ApiModelProperty("套餐编码")
private String ruleCode;
@ApiModelProperty("租赁类型(时租/日租/按天数/以租代售)")
private String rentalType;
@ApiModelProperty("租赁天数(当类型为\"按天数\"时使用)")
private Integer rentalDays;
@ApiModelProperty("租车价格(元)")
private BigDecimal rentalPrice;
@ApiModelProperty("押金价格(元)")
private BigDecimal depositPrice;
@ApiModelProperty("逾期金额(元)")
private BigDecimal overdueFee;
@ApiModelProperty("逾期计费类型(按日计费/按月计费)")
private String overdueType;
@ApiModelProperty("是否支持免押(0不支持 1支持)")
private String depositFree;
@ApiModelProperty("是否支持代扣(0不支持 1支持)")
private String autoDeduct;
@ApiModelProperty("所属运营商")
private Integer operatingCompanyId;
@ApiModelProperty("状态0正常 1停用")
private String status;
@ApiModelProperty("是否默认套餐0否 1是")
private String isDefault;
@ApiModelProperty("删除标志0代表存在 2代表删除")
private String delFlag;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("扩展字段1")
private String extend1;
@ApiModelProperty("扩展字段2")
private String extend2;
@ApiModelProperty("扩展字段3")
private String extend3;
@ApiModelProperty("扩展字段4")
private String extend4;
@ApiModelProperty("扩展字段5")
private String extend5;
}

View File

@ -0,0 +1,27 @@
package com.sczx.car.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sczx.car.dto.RentBatteyRuleDTO;
import com.sczx.car.po.RentBatteyRulePO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 租电套餐计费规则 Mapper 接口
* </p>
*
* @author zhangli
* @since 2025-07-13 19:14:04
*/
public interface RentBatteyRuleMapper extends BaseMapper<RentBatteyRulePO> {
/**
* 根据 租车套餐id 查询 租电套餐计费规则
* @param carRuleId
* @return
*/
List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(@Param("carRuleId") Integer carRuleId);
}

View File

@ -0,0 +1,28 @@
package com.sczx.car.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sczx.car.dto.RentCarRuleDTO;
import com.sczx.car.po.RentCarRulePO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 租车计费规则表 Mapper 接口
* </p>
*
* @author zhangli
* @since 2025-07-13 17:58:18
*/
public interface RentCarRuleMapper extends BaseMapper<RentCarRulePO> {
/**
* 根据门店以及车型ID查询租车计费规则
*
* @param carModelId 车型ID
* @param storeId 门店ID
* @return 租车计费规则列表
*/
List<RentCarRuleDTO> queryRentCarRulebyCarModelId(@Param("carModelId") Integer carModelId, @Param("storeId") Integer storeId);
}

View File

@ -3,22 +3,21 @@ package com.sczx.car.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
* 车型表
* </p>
*
* @author zhangli
* @since 2025-07-12 19:55:31
* @since 2025-07-13 17:53:00
*/
@Getter
@Setter
@ -50,6 +49,9 @@ public class CarModelPO implements Serializable {
@ApiModelProperty("整车重量(kg)")
private BigDecimal weight;
@ApiModelProperty("车型照片")
private String image;
@ApiModelProperty("状态0正常 1停用")
private String status;

View File

@ -0,0 +1,107 @@
package com.sczx.car.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* <p>
* 租电套餐计费规则
* </p>
*
* @author zhangli
* @since 2025-07-13 19:14:04
*/
@Getter
@Setter
@TableName("zc_rent_battey_rule")
@ApiModel(value = "RentBatteyRulePO对象", description = "租电套餐计费规则")
public class RentBatteyRulePO implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty("商品标题")
private String title;
@ApiModelProperty("商品描述")
private String detail;
@ApiModelProperty("图标")
private String icon;
@ApiModelProperty("电压")
private String voltage;
@ApiModelProperty("电容")
private String ah;
@ApiModelProperty("最大里程")
private Integer maxMileage;
@ApiModelProperty("最小里程 默认0")
private Integer minMileage;
@ApiModelProperty("押金 ")
private BigDecimal depositPrice;
@ApiModelProperty("租金")
private BigDecimal rentPrice;
@ApiModelProperty("计时方式")
private Integer durationType;
@ApiModelProperty("租赁时长")
private Integer duration;
@ApiModelProperty("盗抢险")
private BigDecimal insurancePrice;
@ApiModelProperty("是否强制投保 默认0 false")
private Boolean compulsoryInsurance;
@ApiModelProperty("保险有效时长 默认12个月")
private Integer insuranceDuration;
@ApiModelProperty("换电次数")
private Integer changeNum;
@ApiModelProperty("1、有限次数 2无限次数")
private Integer changeType;
private Boolean isDelete;
private Integer cityId;
private Integer operatorId;
private Integer provinceId;
@ApiModelProperty("电池类型")
private Integer categoryId;
@ApiModelProperty("套餐类型 换电/租电")
private Integer mealType;
@ApiModelProperty("套餐排序规则")
private Integer mealSort;
private Boolean isJoinInvite;
@ApiModelProperty("套餐渠道租车默认 id号待定")
private Integer mealChannel;
@ApiModelProperty("购买限制类型")
private Integer buyLimitType;
}

View File

@ -0,0 +1,108 @@
package com.sczx.car.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
* 租车计费规则表
* </p>
*
* @author zhangli
* @since 2025-07-13 17:58:18
*/
@Getter
@Setter
@TableName("zc_rent_car_rule")
@ApiModel(value = "RentCarRulePO对象", description = "租车计费规则表")
public class RentCarRulePO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("规则ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty("套餐名称")
private String ruleName;
@ApiModelProperty("套餐编码")
private String ruleCode;
@ApiModelProperty("租赁类型(时租/日租/按天数/以租代售)")
private String rentalType;
@ApiModelProperty("租赁天数(当类型为\"按天数\"时使用)")
private Integer rentalDays;
@ApiModelProperty("租车价格(元)")
private BigDecimal rentalPrice;
@ApiModelProperty("押金价格(元)")
private BigDecimal depositPrice;
@ApiModelProperty("逾期金额(元)")
private BigDecimal overdueFee;
@ApiModelProperty("逾期计费类型(按日计费/按月计费)")
private String overdueType;
@ApiModelProperty("是否支持免押(0不支持 1支持)")
private String depositFree;
@ApiModelProperty("是否支持代扣(0不支持 1支持)")
private String autoDeduct;
@ApiModelProperty("所属运营商")
private Integer operatingCompanyId;
@ApiModelProperty("状态0正常 1停用")
private String status;
@ApiModelProperty("是否默认套餐0否 1是")
private String isDefault;
@ApiModelProperty("删除标志0代表存在 2代表删除")
private String delFlag;
@ApiModelProperty("创建者")
private String createBy;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("更新者")
private String updateBy;
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("扩展字段1")
private String extend1;
@ApiModelProperty("扩展字段2")
private String extend2;
@ApiModelProperty("扩展字段3")
private String extend3;
@ApiModelProperty("扩展字段4")
private String extend4;
@ApiModelProperty("扩展字段5")
private String extend5;
}

View File

@ -0,0 +1,19 @@
package com.sczx.car.repository;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sczx.car.dto.RentBatteyRuleDTO;
import com.sczx.car.po.RentBatteyRulePO;
import java.util.List;
/**
* <p>
* 租电套餐计费规则 服务类
* </p>
*
* @author zhangli
* @since 2025-07-13 19:14:04
*/
public interface RentBatteyRuleRepo extends IService<RentBatteyRulePO> {
List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId);
}

View File

@ -0,0 +1,20 @@
package com.sczx.car.repository;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sczx.car.dto.RentCarRuleDTO;
import com.sczx.car.po.RentCarRulePO;
import java.util.List;
/**
* <p>
* 租车计费规则表 服务类
* </p>
*
* @author zhangli
* @since 2025-07-13 17:58:18
*/
public interface RentCarRuleRepo extends IService<RentCarRulePO> {
List<RentCarRuleDTO> queryRentCarRulebyCarModelId(Integer carModelId, Integer storeId);
}

View File

@ -0,0 +1,27 @@
package com.sczx.car.repository.impl;
import com.sczx.car.dto.RentBatteyRuleDTO;
import com.sczx.car.po.RentBatteyRulePO;
import com.sczx.car.mapper.RentBatteyRuleMapper;
import com.sczx.car.repository.RentBatteyRuleRepo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 租电套餐计费规则 服务实现类
* </p>
*
* @author zhangli
* @since 2025-07-13 19:14:04
*/
@Service
public class RentBatteyRuleRepoImpl extends ServiceImpl<RentBatteyRuleMapper, RentBatteyRulePO> implements RentBatteyRuleRepo {
@Override
public List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId) {
return this.getBaseMapper().queryRentBatteyRuleByCarRuleId(carRuleId);
}
}

View File

@ -0,0 +1,27 @@
package com.sczx.car.repository.impl;
import com.sczx.car.dto.RentCarRuleDTO;
import com.sczx.car.po.RentCarRulePO;
import com.sczx.car.mapper.RentCarRuleMapper;
import com.sczx.car.repository.RentCarRuleRepo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 租车计费规则表 服务实现类
* </p>
*
* @author zhangli
* @since 2025-07-13 17:58:18
*/
@Service
public class RentCarRuleRepoImpl extends ServiceImpl<RentCarRuleMapper, RentCarRulePO> implements RentCarRuleRepo {
@Override
public List<RentCarRuleDTO> queryRentCarRulebyCarModelId(Integer carModelId, Integer storeId) {
return this.getBaseMapper().queryRentCarRulebyCarModelId(carModelId, storeId);
}
}

View File

@ -1,6 +1,9 @@
package com.sczx.car.service;
import com.sczx.car.dto.CarRentalDetailDTO;
import com.sczx.car.dto.RentBatteyRuleDTO;
import java.util.List;
public interface CarRentalService {
@ -12,4 +15,12 @@ public interface CarRentalService {
* @return
*/
CarRentalDetailDTO queryCarRentalDetail(Integer storeId, Integer carModelId);
/**
* 根据租车套餐id查询租电套餐列表
*
* @param carRuleId
* @return
*/
List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId);
}

View File

@ -1,23 +1,53 @@
package com.sczx.car.service.impl;
import com.sczx.car.convert.CarModelConvert;
import com.sczx.car.dto.CarRentalDetailDTO;
import com.sczx.car.dto.RentBatteyRuleDTO;
import com.sczx.car.po.CarModelPO;
import com.sczx.car.repository.CarModelRepo;
import com.sczx.car.repository.RentBatteyRuleRepo;
import com.sczx.car.repository.RentCarRuleRepo;
import com.sczx.car.service.CarRentalService;
import com.sczx.car.thirdpart.integration.StoreInteg;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
public class CarRentalServiceImpl implements CarRentalService {
@Autowired
private StoreInteg storeInteg;
@Autowired
private RentCarRuleRepo rentCarRuleRepo;
@Autowired
private CarModelRepo carModelRepo;
@Autowired
private RentBatteyRuleRepo rentBatteyRuleRepo;
@Override
public CarRentalDetailDTO queryCarRentalDetail(Integer storeId, Integer carModelId) {
CarRentalDetailDTO carRentalDetailDTO = new CarRentalDetailDTO();
//查询门店信息
carRentalDetailDTO.setStoreInfo(storeInteg.getStoreById(storeId));
// carRentalDetailDTO.setStoreInfo(storeInteg.getStoreById(storeId));
//查询车型信息
CarModelPO carModelPO = carModelRepo.getById(carModelId);
carRentalDetailDTO.setCarModelInfo(CarModelConvert.INSTANCE.poToSimpleDTO(carModelPO));
//获取租车套餐列表
carRentalDetailDTO.setRentCarRuleList(rentCarRuleRepo.queryRentCarRulebyCarModelId(carModelId, storeId));
return carRentalDetailDTO;
}
@Override
public List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId) {
return rentBatteyRuleRepo.queryRentBatteyRuleByCarRuleId(carRuleId);
}
}