Compare commits
21 Commits
ed03d3c52d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 33c5e9db82 | |||
| 8becda9ebd | |||
| 465d3e4a70 | |||
| 3ffa514857 | |||
| e372a8bb97 | |||
| 80551b7e23 | |||
| 7d0eb80c9c | |||
| 8a38b9b414 | |||
| 1e09c1b271 | |||
| ba44e6c9ef | |||
| 0441587c7b | |||
| 9a5cc3f127 | |||
| e244b23280 | |||
| fa7bc30756 | |||
| 57b21d7312 | |||
| f4316daa0e | |||
| 533120d5aa | |||
| 64a2bea8c6 | |||
| 75a93f4ed7 | |||
| 819da6d1e1 | |||
| 538fdd8552 |
@ -7,4 +7,7 @@ WORKDIR /app
|
||||
# 复制 jar 包
|
||||
COPY target/*.jar app.jar
|
||||
# 设置 JVM 参数和启动命令
|
||||
ENTRYPOINT ["java", "-jar", "-Xms128m", "-Xmx256m", "app.jar"]
|
||||
# 设置默认的 JAVA_OPTS
|
||||
# ENV JAVA_OPTS="-Xms128m -Xmx256m"
|
||||
# 设置 JVM 参数和启动命令
|
||||
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar app.jar"]
|
||||
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@ -7,6 +7,7 @@ pipeline {
|
||||
APP_NAME = "sczx_car"
|
||||
DOCKER_IMAGE = "${APP_NAME}:latest"
|
||||
CONTAINER_NAME = "${APP_NAME}-container"
|
||||
NACOS_ADDR = "115.190.8.52:8848"
|
||||
}
|
||||
|
||||
stages {
|
||||
@ -60,7 +61,8 @@ pipeline {
|
||||
--network sczx-net \
|
||||
-p 8083:8083 \
|
||||
-e SPRING_PROFILES_ACTIVE=test \
|
||||
-e JAVA_OPTS="-Xms256m -Xmx512m -Duser.timezone=Asia/Shanghai" \
|
||||
-e NACOS_SERVER_ADDR=\${NACOS_ADDR} \
|
||||
-e JAVA_OPTS="-Xms128m -Xmx256m -Duser.timezone=Asia/Shanghai" \
|
||||
-e TZ=Asia/Shanghai \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
--restart always \
|
||||
|
||||
@ -3,6 +3,7 @@ package com.sczx.car.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
@ -15,6 +16,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Profile("!prod")
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig {
|
||||
|
||||
@ -3,6 +3,7 @@ package com.sczx.car.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.sczx.car.common.Result;
|
||||
import com.sczx.car.dto.CarModelPackageDTO;
|
||||
import com.sczx.car.dto.CarModelSimpleDTO;
|
||||
import com.sczx.car.dto.req.StoreCarModelReq;
|
||||
import com.sczx.car.service.CarModelService;
|
||||
@ -41,4 +42,10 @@ public class CarModelController {
|
||||
return Result.ok(carModelService.getCarModelByModelId(modelId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据美团抖音id查询车型套餐")
|
||||
@GetMapping("/getCarModelByThireId")
|
||||
public Result<CarModelPackageDTO> getCarModelByThireId(@RequestParam(name = "mtId") String mtId,
|
||||
@RequestParam(name = "dyId") String dyId){
|
||||
return Result.ok(carModelService.getCarModelByThireId(mtId, dyId));
|
||||
}
|
||||
}
|
||||
|
||||
23
src/main/java/com/sczx/car/dto/CarModelPackageDTO.java
Normal file
23
src/main/java/com/sczx/car/dto/CarModelPackageDTO.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.sczx.car.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "车型套餐对象")
|
||||
public class CarModelPackageDTO {
|
||||
|
||||
@ApiModelProperty("车型ID")
|
||||
private Long carModelId;
|
||||
|
||||
@ApiModelProperty("套餐ID")
|
||||
private Long carRuleId;
|
||||
|
||||
@ApiModelProperty("美团商品ID")
|
||||
private String mtProductId;
|
||||
|
||||
@ApiModelProperty("抖音商品ID")
|
||||
private String dyProductId;
|
||||
|
||||
}
|
||||
@ -32,9 +32,6 @@ public class CarModelSimpleDTO {
|
||||
@ApiModelProperty("是否支持免押(0不支持 1支持)")
|
||||
private String depositFree;
|
||||
|
||||
@ApiModelProperty("是否支持代扣(0不支持 1支持)")
|
||||
private String autoDeduct;
|
||||
|
||||
@ApiModelProperty("电池类型")
|
||||
private String batteryType;
|
||||
|
||||
|
||||
@ -26,6 +26,9 @@ public class StoreCarDTO {
|
||||
@ApiModelProperty("IoT识别码")
|
||||
private String iotCode;
|
||||
|
||||
@ApiModelProperty("IoT识别号")
|
||||
private String lotNumber;
|
||||
|
||||
@ApiModelProperty("车辆品牌ID")
|
||||
private Long brandId;
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ package com.sczx.car.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sczx.car.dto.CarModelPackageDTO;
|
||||
import com.sczx.car.dto.CarModelSimpleDTO;
|
||||
import com.sczx.car.dto.req.StoreCarModelReq;
|
||||
import com.sczx.car.po.CarModelPO;
|
||||
@ -20,4 +21,5 @@ public interface CarModelMapper extends BaseMapper<CarModelPO> {
|
||||
|
||||
IPage<CarModelSimpleDTO> pageCarModelSimpleDTO(Page<CarModelSimpleDTO> page, @Param("storeCarModelReq") StoreCarModelReq storeCarModelReq);
|
||||
|
||||
CarModelPackageDTO getCarModelByThireId(@Param("mtId") String mtId,@Param("dyId") String dyId);
|
||||
}
|
||||
|
||||
@ -24,4 +24,11 @@ public interface RentBatteyRuleMapper extends BaseMapper<RentBatteyRulePO> {
|
||||
*/
|
||||
List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(@Param("carRuleId") Integer carRuleId);
|
||||
|
||||
/**
|
||||
* 根据 id 查询 租电套餐计费规则
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
RentBatteyRuleDTO getRentBatteyRuleById(@Param("id") Integer id);
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.sczx.car.repository;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.sczx.car.dto.CarModelPackageDTO;
|
||||
import com.sczx.car.dto.CarModelSimpleDTO;
|
||||
import com.sczx.car.dto.req.StoreCarModelReq;
|
||||
import com.sczx.car.po.CarModelPO;
|
||||
@ -26,4 +27,6 @@ public interface CarModelRepo extends IService<CarModelPO> {
|
||||
*/
|
||||
IPage<CarModelSimpleDTO> pageCarModelSimpleDTO(StoreCarModelReq storeCarModelReq, Integer pageNo, Integer pageSize);
|
||||
|
||||
CarModelPackageDTO getCarModelByThireId(String mtId, String dyId);
|
||||
|
||||
}
|
||||
|
||||
@ -16,4 +16,5 @@ import java.util.List;
|
||||
*/
|
||||
public interface RentBatteyRuleRepo extends IService<RentBatteyRulePO> {
|
||||
List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId);
|
||||
RentBatteyRuleDTO getRentBatteyRuleById(Integer id);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.sczx.car.repository.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sczx.car.dto.CarModelPackageDTO;
|
||||
import com.sczx.car.dto.CarModelSimpleDTO;
|
||||
import com.sczx.car.dto.req.StoreCarModelReq;
|
||||
import com.sczx.car.po.CarModelPO;
|
||||
@ -26,4 +27,9 @@ public class CarModelRepoImpl extends ServiceImpl<CarModelMapper, CarModelPO> im
|
||||
Page<CarModelSimpleDTO> page = new Page<>(pageNo, pageSize);
|
||||
return this.getBaseMapper().pageCarModelSimpleDTO(page, storeCarModelReq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarModelPackageDTO getCarModelByThireId(String mtId, String dyId) {
|
||||
return this.getBaseMapper().getCarModelByThireId(mtId, dyId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,4 +24,9 @@ public class RentBatteyRuleRepoImpl extends ServiceImpl<RentBatteyRuleMapper, Re
|
||||
public List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId) {
|
||||
return this.getBaseMapper().queryRentBatteyRuleByCarRuleId(carRuleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RentBatteyRuleDTO getRentBatteyRuleById(Integer id) {
|
||||
return this.getBaseMapper().getRentBatteyRuleById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.sczx.car.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.sczx.car.dto.CarModelPackageDTO;
|
||||
import com.sczx.car.dto.CarModelSimpleDTO;
|
||||
import com.sczx.car.dto.req.StoreCarModelReq;
|
||||
|
||||
@ -19,4 +20,7 @@ public interface CarModelService {
|
||||
* @return
|
||||
*/
|
||||
CarModelSimpleDTO getCarModelByModelId(Long modelId);
|
||||
|
||||
|
||||
CarModelPackageDTO getCarModelByThireId(String mtId, String dyId);
|
||||
}
|
||||
|
||||
@ -2,8 +2,10 @@ package com.sczx.car.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.sczx.car.convert.CarModelConvert;
|
||||
import com.sczx.car.dto.CarModelPackageDTO;
|
||||
import com.sczx.car.dto.CarModelSimpleDTO;
|
||||
import com.sczx.car.dto.req.StoreCarModelReq;
|
||||
import com.sczx.car.mapper.CarModelMapper;
|
||||
import com.sczx.car.po.CarModelPO;
|
||||
import com.sczx.car.repository.CarModelRepo;
|
||||
import com.sczx.car.service.CarModelService;
|
||||
@ -49,4 +51,10 @@ public class CarModelServiceImpl implements CarModelService {
|
||||
CarModelPO carModelPO = carModelRepo.getById(modelId);
|
||||
return CarModelConvert.INSTANCE.poToSimpleDTO(carModelPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarModelPackageDTO getCarModelByThireId(String mtId, String dyId) {
|
||||
CarModelPackageDTO carModelPackageDTO = carModelRepo.getCarModelByThireId(mtId, dyId);
|
||||
return carModelPackageDTO;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@ import com.sczx.car.convert.CarModelConvert;
|
||||
import com.sczx.car.dto.CarRentalDetailDTO;
|
||||
import com.sczx.car.dto.RentBatteyRuleDTO;
|
||||
import com.sczx.car.dto.RentBatteyRuleRsp;
|
||||
import com.sczx.car.exception.BizException;
|
||||
import com.sczx.car.po.CarModelPO;
|
||||
import com.sczx.car.repository.CarModelRepo;
|
||||
import com.sczx.car.repository.RentBatteyRuleRepo;
|
||||
@ -55,7 +54,7 @@ public class CarRentalServiceImpl implements CarRentalService {
|
||||
|
||||
List<RentBatteyRuleDTO> rentBatteyRuleList = rentBatteyRuleRepo.queryRentBatteyRuleByCarRuleId(carRuleId);
|
||||
if(CollectionUtils.isEmpty(rentBatteyRuleList)){
|
||||
throw new BizException("无对应租电套餐,请重新选择租车套餐");
|
||||
return null;
|
||||
}else {
|
||||
RentBatteyRuleRsp rentBatteyRuleRsp = new RentBatteyRuleRsp();
|
||||
rentBatteyRuleRsp.setRentBatteyRuleList(rentBatteyRuleList);
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
package com.sczx.car.service.impl;
|
||||
|
||||
import com.sczx.car.convert.RentBatteyRuleConvert;
|
||||
import com.sczx.car.dto.RentBatteyRuleDTO;
|
||||
import com.sczx.car.po.RentBatteyRulePO;
|
||||
import com.sczx.car.repository.RentBatteyRuleRepo;
|
||||
import com.sczx.car.service.RentBatteyRuleService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -17,8 +15,7 @@ public class RentBatteyRuleServiceImpl implements RentBatteyRuleService {
|
||||
private RentBatteyRuleRepo rentBatteyRuleRepo;
|
||||
|
||||
@Override
|
||||
public RentBatteyRuleDTO getRentBatteyRuleByBatteyRuleId(Long carRuleId) {
|
||||
RentBatteyRulePO rentBatteyRulePO = rentBatteyRuleRepo.getById(carRuleId);
|
||||
return RentBatteyRuleConvert.INSTANCE.poToDto(rentBatteyRulePO);
|
||||
public RentBatteyRuleDTO getRentBatteyRuleByBatteyRuleId(Long batteyRuleId) {
|
||||
return rentBatteyRuleRepo.getRentBatteyRuleById(batteyRuleId.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ spring:
|
||||
name: sczx-car # 应用名称,对应 Nacos 配置的 dataId
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 115.190.8.52:8848 # Nacos 服务器地址
|
||||
server-addr: ${NACOS_SERVER_ADDR} # Nacos 服务器地址
|
||||
config:
|
||||
group: DEFAULT_GROUP # 配置分组
|
||||
file-extension: yaml # 配置文件格式
|
||||
|
||||
@ -13,18 +13,19 @@
|
||||
zc.license_plate,
|
||||
zc.brand_name,
|
||||
zc.model_name,
|
||||
zc.battery_type ,
|
||||
zcm.battery_type ,
|
||||
ifnull(zom.overdue_days, 0) overdue_days,
|
||||
(case
|
||||
when ifnull(zc.package_id, 0)>0 then 'NON_PACKAGE'
|
||||
when zc.brs_status = '9'
|
||||
and ifnull(zom.overdue_days, 0) > 0
|
||||
and zom.order_status = 'RENT_OVERDUE' then 'OVERDUE'
|
||||
when zc.brs_status = '9'
|
||||
and ifnull(zom.overdue_days, 0) = 0
|
||||
and zom.order_status = 'RENT_ING' then 'RENTING'
|
||||
when zc.brs_status = '0' then 'FREE'
|
||||
when zc.brs_status = '1' then 'REMOVED'
|
||||
WHEN ifnull(zcmp.car_rule_num, 0)= 0 THEN 'NON_PACKAGE'
|
||||
WHEN zc.brs_status = '9'
|
||||
AND ifnull(zom.overdue_days, 0) > 0
|
||||
AND zom.order_status = 'RENT_OVERDUE' THEN 'OVERDUE'
|
||||
WHEN zc.brs_status = '9'
|
||||
AND ifnull(zom.overdue_days, 0) = 0
|
||||
AND zom.order_status = 'RENT_ING' THEN 'RENTING'
|
||||
WHEN zc.brs_status = '9' THEN 'RENTING'
|
||||
WHEN zc.brs_status = '0' THEN 'FREE'
|
||||
WHEN zc.brs_status = '1' THEN 'REMOVED'
|
||||
END ) store_car_status,
|
||||
zc.brs_status,
|
||||
zcm.image,
|
||||
@ -33,12 +34,19 @@
|
||||
zom.pick_car_time,
|
||||
zc.update_time,
|
||||
zc.store_id,
|
||||
zc.iot_code,
|
||||
zc.lot_number,
|
||||
zc.iot_status,
|
||||
zcm.max_speed,
|
||||
zcm.weight
|
||||
from
|
||||
zc_car zc
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
car_model_id,
|
||||
count(car_rule_id) AS car_rule_num FROM zc_car_model_package
|
||||
GROUP BY
|
||||
car_model_id) zcmp ON
|
||||
zc.model_id = zcmp.car_model_id
|
||||
left join (
|
||||
select
|
||||
*
|
||||
|
||||
@ -14,8 +14,7 @@
|
||||
cm.brand_name AS brand_name,
|
||||
cm.image AS image,
|
||||
GROUP_CONCAT(DISTINCT r.rental_type SEPARATOR ',') AS rental_types,
|
||||
MAX(r.deposit_free) AS deposit_free,
|
||||
MAX(r.auto_deduct) AS auto_deduct
|
||||
MAX(r.deposit_free) AS deposit_free
|
||||
FROM
|
||||
zc_car_model cm
|
||||
JOIN
|
||||
@ -26,13 +25,12 @@
|
||||
zc_car_model_package mp ON cm.id = mp.car_model_id
|
||||
JOIN
|
||||
zc_rent_car_rule r ON mp.car_rule_id = r.id AND r.del_flag = '0' AND r.status = '0'
|
||||
JOIN
|
||||
zc_company zc ON r.operating_company_id = zc.id and zc.id = s.operating_company_id and zc.status = '0'
|
||||
<where>
|
||||
s.id = #{storeCarModelReq.storeId}
|
||||
<if test="storeCarModelReq.depositFree != null and storeCarModelReq.depositFree != ''">
|
||||
AND r.deposit_free = #{storeCarModelReq.depositFree}
|
||||
</if>
|
||||
<if test="storeCarModelReq.autoDeduct != null and storeCarModelReq.autoDeduct != ''">
|
||||
AND r.auto_deduct = #{storeCarModelReq.autoDeduct}
|
||||
and r.deposit_free = #{storeCarModelReq.depositFree}
|
||||
</if>
|
||||
AND cm.del_flag = '0' AND cm.status = '0'
|
||||
</where>
|
||||
@ -40,4 +38,20 @@
|
||||
cm.id, s.id, s.store_number, cm.model_name, cm.brand_name
|
||||
</select>
|
||||
|
||||
<select id="getCarModelByThireId" resultType="com.sczx.car.dto.CarModelPackageDTO">
|
||||
SELECT
|
||||
car_rule_id,
|
||||
car_model_id
|
||||
FROM
|
||||
zc_car_model_package
|
||||
<where>
|
||||
<if test="mtId != null and mtId != ''">
|
||||
and mt_product_id = #{mtId}
|
||||
</if>
|
||||
<if test="dyId != null and dyId != ''">
|
||||
and dy_product_id = #{dyId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -15,4 +15,16 @@
|
||||
rcb.car_rule_id = #{carRuleId}
|
||||
AND b.is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="getRentBatteyRuleById" resultType="com.sczx.car.dto.RentBatteyRuleDTO">
|
||||
SELECT
|
||||
b.*,c.category_name
|
||||
FROM
|
||||
zc_rent_battey_rule b
|
||||
JOIN
|
||||
zc_battery_category c ON b.category_id = c.id
|
||||
WHERE
|
||||
b.id = #{id}
|
||||
AND b.is_delete = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
r.extend4 AS extend4,
|
||||
r.extend5 AS extend5
|
||||
FROM (
|
||||
SELECT DISTINCT mp.car_rule_id
|
||||
SELECT DISTINCT mp.car_rule_id,s.operating_company_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
|
||||
@ -37,7 +37,7 @@
|
||||
AND cm.del_flag = '0'
|
||||
AND cm.status = '0'
|
||||
) tmp
|
||||
JOIN zc_rent_car_rule r ON tmp.car_rule_id = r.id
|
||||
JOIN zc_rent_car_rule r ON tmp.car_rule_id = r.id and r.operating_company_id = tmp.operating_company_id
|
||||
WHERE r.del_flag = '0' AND r.status = '0'
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user