增加租车详情页面的相关接口
This commit is contained in:
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
14
src/main/java/com/sczx/car/convert/CarModelConvert.java
Normal file
14
src/main/java/com/sczx/car/convert/CarModelConvert.java
Normal 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);
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
@ -31,4 +31,7 @@ public class CarModelSimpleDTO {
|
||||
|
||||
@ApiModelProperty("是否支持代扣(0不支持 1支持)")
|
||||
private String autoDeduct;
|
||||
|
||||
@ApiModelProperty("电池类型")
|
||||
private String batteryType;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
88
src/main/java/com/sczx/car/dto/RentBatteyRuleDTO.java
Normal file
88
src/main/java/com/sczx/car/dto/RentBatteyRuleDTO.java
Normal 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;
|
||||
}
|
||||
76
src/main/java/com/sczx/car/dto/RentCarRuleDTO.java
Normal file
76
src/main/java/com/sczx/car/dto/RentCarRuleDTO.java
Normal 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;
|
||||
|
||||
}
|
||||
27
src/main/java/com/sczx/car/mapper/RentBatteyRuleMapper.java
Normal file
27
src/main/java/com/sczx/car/mapper/RentBatteyRuleMapper.java
Normal 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);
|
||||
|
||||
}
|
||||
28
src/main/java/com/sczx/car/mapper/RentCarRuleMapper.java
Normal file
28
src/main/java/com/sczx/car/mapper/RentCarRuleMapper.java
Normal 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);
|
||||
}
|
||||
@ -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;
|
||||
|
||||
|
||||
107
src/main/java/com/sczx/car/po/RentBatteyRulePO.java
Normal file
107
src/main/java/com/sczx/car/po/RentBatteyRulePO.java
Normal 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;
|
||||
|
||||
|
||||
}
|
||||
108
src/main/java/com/sczx/car/po/RentCarRulePO.java
Normal file
108
src/main/java/com/sczx/car/po/RentCarRulePO.java
Normal 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;
|
||||
|
||||
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
20
src/main/java/com/sczx/car/repository/RentCarRuleRepo.java
Normal file
20
src/main/java/com/sczx/car/repository/RentCarRuleRepo.java
Normal 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);
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,4 +168,52 @@ CREATE TABLE `zc_car_model_package` (
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `car_model_id` (`car_model_id`,`car_rule_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='车型与租车规则关联表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='车型与租车规则关联表';
|
||||
|
||||
/**租电套餐计费规则*/
|
||||
CREATE TABLE `zc_rent_battey_rule` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(50) NOT NULL COMMENT '商品标题',
|
||||
`detail` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '商品描述',
|
||||
`icon` varchar(50) DEFAULT NULL COMMENT '图标',
|
||||
`voltage` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '电压',
|
||||
`ah` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '电容',
|
||||
`max_mileage` smallint DEFAULT NULL COMMENT '最大里程',
|
||||
`min_mileage` smallint DEFAULT NULL COMMENT '最小里程 默认0',
|
||||
`deposit_price` decimal(6,2) DEFAULT NULL COMMENT '押金 ',
|
||||
`rent_price` decimal(7,2) DEFAULT NULL COMMENT '租金',
|
||||
`duration_type` smallint DEFAULT NULL COMMENT '计时方式',
|
||||
`duration` smallint DEFAULT NULL COMMENT '租赁时长',
|
||||
`insurance_price` decimal(6,2) DEFAULT NULL COMMENT '盗抢险',
|
||||
`compulsory_insurance` tinyint(1) DEFAULT NULL COMMENT '是否强制投保 默认0 false',
|
||||
`insurance_duration` smallint DEFAULT NULL COMMENT '保险有效时长 默认12个月',
|
||||
`change_num` smallint DEFAULT NULL COMMENT '换电次数',
|
||||
`change_type` smallint DEFAULT NULL COMMENT '1、有限次数 2无限次数',
|
||||
`is_delete` tinyint(1) DEFAULT NULL,
|
||||
`city_id` int DEFAULT NULL,
|
||||
`operator_id` int DEFAULT NULL,
|
||||
`province_id` int DEFAULT NULL,
|
||||
`category_id` int DEFAULT NULL COMMENT '电池类型',
|
||||
`meal_type` smallint NOT NULL DEFAULT '1' COMMENT '套餐类型 换电/租电',
|
||||
`meal_sort` int DEFAULT '999' COMMENT '套餐排序规则',
|
||||
`is_join_invite` tinyint(1) DEFAULT '1',
|
||||
`meal_channel` tinyint DEFAULT '0' COMMENT '套餐渠道租车默认 id号待定',
|
||||
`buy_limit_type` tinyint DEFAULT '0' COMMENT '购买限制类型',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='租电套餐计费规则';
|
||||
|
||||
/**租车规则租电规则关联表*/
|
||||
CREATE TABLE `zc_rent_car_rule_battery` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '规则ID',
|
||||
`car_rule_id` bigint NOT NULL,
|
||||
`battery_rule_id` bigint NOT NULL,
|
||||
`sort_order` int DEFAULT NULL,
|
||||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
||||
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `car_rule_id` (`car_rule_id`,`battery_rule_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='租车规则租电规则关联表';
|
||||
16
src/main/resources/mapper/RentBatteyRuleMapper.xml
Normal file
16
src/main/resources/mapper/RentBatteyRuleMapper.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sczx.car.mapper.RentBatteyRuleMapper">
|
||||
|
||||
<select id="queryRentBatteyRuleByCarRuleId" resultType="com.sczx.car.dto.RentBatteyRuleDTO">
|
||||
SELECT
|
||||
b.*
|
||||
FROM
|
||||
zc_rent_car_rule_battery rcb
|
||||
JOIN
|
||||
zc_rent_battey_rule b ON rcb.battery_rule_id = b.id
|
||||
WHERE
|
||||
rcb.car_rule_id = #{carRuleId}
|
||||
AND b.is_delete = 0
|
||||
</select>
|
||||
</mapper>
|
||||
43
src/main/resources/mapper/RentCarRuleMapper.xml
Normal file
43
src/main/resources/mapper/RentCarRuleMapper.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sczx.car.mapper.RentCarRuleMapper">
|
||||
|
||||
<select id="queryRentCarRulebyCarModelId" resultType="com.sczx.car.dto.RentCarRuleDTO">
|
||||
SELECT
|
||||
r.id AS id,
|
||||
r.rule_name AS rule_name,
|
||||
r.rule_code AS rule_code,
|
||||
r.rental_type AS rental_type,
|
||||
r.rental_days AS rental_days,
|
||||
r.rental_price AS rental_price,
|
||||
r.deposit_price AS deposit_price,
|
||||
r.overdue_fee AS overdue_fee,
|
||||
r.overdue_type AS overdue_type,
|
||||
r.deposit_free AS deposit_free,
|
||||
r.auto_deduct AS auto_deduct,
|
||||
r.operating_company_id AS operating_company_id,
|
||||
r.status AS status,
|
||||
r.is_default AS is_default,
|
||||
r.del_flag AS del_flag,
|
||||
r.remark AS remark,
|
||||
r.extend1 AS extend1,
|
||||
r.extend2 AS extend2,
|
||||
r.extend3 AS extend3,
|
||||
r.extend4 AS extend4,
|
||||
r.extend5 AS extend5
|
||||
FROM (
|
||||
SELECT DISTINCT mp.car_rule_id
|
||||
FROM zc_car_model cm
|
||||
JOIN zc_car c ON cm.id = c.model_id
|
||||
JOIN zc_company_store s ON c.store_id = s.id
|
||||
JOIN zc_car_model_package mp ON cm.id = mp.car_model_id
|
||||
WHERE
|
||||
s.id = #{storeId}
|
||||
AND cm.id = #{carModelId}
|
||||
AND cm.del_flag = '0'
|
||||
AND cm.status = '0'
|
||||
) tmp
|
||||
JOIN zc_rent_car_rule r ON tmp.car_rule_id = r.id
|
||||
WHERE r.del_flag = '0' AND r.status = '0'
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user