Compare commits

...

22 Commits

Author SHA1 Message Date
8becda9ebd 车辆状态查询修改 2025-09-30 15:36:34 +08:00
465d3e4a70 lotnumber 2025-09-28 22:54:45 +08:00
3ffa514857 lot_number 2025-09-28 22:26:31 +08:00
e372a8bb97 电池类型 2025-09-28 22:03:49 +08:00
80551b7e23 swagger 2025-09-27 23:19:06 +08:00
7d0eb80c9c 过滤状态 2025-09-27 20:53:29 +08:00
8a38b9b414 过滤非本门店运营商套餐 2025-09-27 17:21:00 +08:00
1e09c1b271 去掉租车套餐校验 2025-09-25 00:51:21 +08:00
ba44e6c9ef 去掉免押 2025-09-23 23:52:09 +08:00
0441587c7b 修正根据租电套餐查询电池信息的接口问题 2025-09-18 23:47:14 +08:00
9a5cc3f127 显示电池信息 2025-09-18 22:22:53 +08:00
e244b23280 重新修改一下 2025-09-15 01:24:00 +08:00
fa7bc30756 修改jenkinsfile文件 2025-09-15 01:22:14 +08:00
57b21d7312 全部参数从外部命令取 2025-09-15 01:13:38 +08:00
f4316daa0e 去掉默认地址,看是否生效 2025-09-15 01:04:16 +08:00
533120d5aa 再试一次 2025-09-15 01:01:27 +08:00
64a2bea8c6 再试一下 2025-09-15 00:57:04 +08:00
75a93f4ed7 试一下启动命令 2025-09-15 00:53:53 +08:00
819da6d1e1 nacos地址设置 2025-09-15 00:45:41 +08:00
538fdd8552 查询车辆改成or 2025-09-13 22:41:21 +08:00
ed03d3c52d Merge branch 'main' of http://115.190.8.52:3000/sczx_group/sczx_car 2025-09-10 23:35:48 +08:00
cca852f148 配置文件改成nacos配置 2025-09-10 23:35:42 +08:00
20 changed files with 90 additions and 116 deletions

View File

@ -7,4 +7,7 @@ WORKDIR /app
# 复制 jar 包 # 复制 jar 包
COPY target/*.jar app.jar COPY target/*.jar app.jar
# 设置 JVM 参数和启动命令 # 设置 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"]

5
Jenkinsfile vendored
View File

@ -7,6 +7,7 @@ pipeline {
APP_NAME = "sczx_car" APP_NAME = "sczx_car"
DOCKER_IMAGE = "${APP_NAME}:latest" DOCKER_IMAGE = "${APP_NAME}:latest"
CONTAINER_NAME = "${APP_NAME}-container" CONTAINER_NAME = "${APP_NAME}-container"
NACOS_ADDR = "115.190.8.52:8848"
} }
stages { stages {
@ -59,7 +60,9 @@ pipeline {
--name \${CONTAINER_NAME} \ --name \${CONTAINER_NAME} \
--network sczx-net \ --network sczx-net \
-p 8083:8083 \ -p 8083:8083 \
-e JAVA_OPTS="-Xms256m -Xmx512m -Duser.timezone=Asia/Shanghai" \ -e SPRING_PROFILES_ACTIVE=test \
-e NACOS_SERVER_ADDR=\${NACOS_ADDR} \
-e JAVA_OPTS="-Xms128m -Xmx256m -Duser.timezone=Asia/Shanghai" \
-e TZ=Asia/Shanghai \ -e TZ=Asia/Shanghai \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
--restart always \ --restart always \

View File

@ -75,6 +75,11 @@
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId> <artifactId>spring-cloud-commons</artifactId>

View File

@ -3,6 +3,7 @@ package com.sczx.car.config;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder; import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.PathSelectors;
@ -15,6 +16,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.Arrays; import java.util.Arrays;
@Profile("!prod")
@Configuration @Configuration
@EnableSwagger2 @EnableSwagger2
public class SwaggerConfig { public class SwaggerConfig {

View File

@ -32,9 +32,6 @@ public class CarModelSimpleDTO {
@ApiModelProperty("是否支持免押(0不支持 1支持)") @ApiModelProperty("是否支持免押(0不支持 1支持)")
private String depositFree; private String depositFree;
@ApiModelProperty("是否支持代扣(0不支持 1支持)")
private String autoDeduct;
@ApiModelProperty("电池类型") @ApiModelProperty("电池类型")
private String batteryType; private String batteryType;

View File

@ -26,6 +26,9 @@ public class StoreCarDTO {
@ApiModelProperty("IoT识别码") @ApiModelProperty("IoT识别码")
private String iotCode; private String iotCode;
@ApiModelProperty("IoT识别号")
private String lotNumber;
@ApiModelProperty("车辆品牌ID") @ApiModelProperty("车辆品牌ID")
private Long brandId; private Long brandId;

View File

@ -24,4 +24,11 @@ public interface RentBatteyRuleMapper extends BaseMapper<RentBatteyRulePO> {
*/ */
List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(@Param("carRuleId") Integer carRuleId); List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(@Param("carRuleId") Integer carRuleId);
/**
* 根据 id 查询 租电套餐计费规则
* @param id
* @return
*/
RentBatteyRuleDTO getRentBatteyRuleById(@Param("id") Integer id);
} }

View File

@ -16,4 +16,5 @@ import java.util.List;
*/ */
public interface RentBatteyRuleRepo extends IService<RentBatteyRulePO> { public interface RentBatteyRuleRepo extends IService<RentBatteyRulePO> {
List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId); List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId);
RentBatteyRuleDTO getRentBatteyRuleById(Integer id);
} }

View File

@ -24,4 +24,9 @@ public class RentBatteyRuleRepoImpl extends ServiceImpl<RentBatteyRuleMapper, Re
public List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId) { public List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId) {
return this.getBaseMapper().queryRentBatteyRuleByCarRuleId(carRuleId); return this.getBaseMapper().queryRentBatteyRuleByCarRuleId(carRuleId);
} }
@Override
public RentBatteyRuleDTO getRentBatteyRuleById(Integer id) {
return this.getBaseMapper().getRentBatteyRuleById(id);
}
} }

View File

@ -4,7 +4,6 @@ import com.sczx.car.convert.CarModelConvert;
import com.sczx.car.dto.CarRentalDetailDTO; import com.sczx.car.dto.CarRentalDetailDTO;
import com.sczx.car.dto.RentBatteyRuleDTO; import com.sczx.car.dto.RentBatteyRuleDTO;
import com.sczx.car.dto.RentBatteyRuleRsp; import com.sczx.car.dto.RentBatteyRuleRsp;
import com.sczx.car.exception.BizException;
import com.sczx.car.po.CarModelPO; import com.sczx.car.po.CarModelPO;
import com.sczx.car.repository.CarModelRepo; import com.sczx.car.repository.CarModelRepo;
import com.sczx.car.repository.RentBatteyRuleRepo; import com.sczx.car.repository.RentBatteyRuleRepo;
@ -55,7 +54,7 @@ public class CarRentalServiceImpl implements CarRentalService {
List<RentBatteyRuleDTO> rentBatteyRuleList = rentBatteyRuleRepo.queryRentBatteyRuleByCarRuleId(carRuleId); List<RentBatteyRuleDTO> rentBatteyRuleList = rentBatteyRuleRepo.queryRentBatteyRuleByCarRuleId(carRuleId);
if(CollectionUtils.isEmpty(rentBatteyRuleList)){ if(CollectionUtils.isEmpty(rentBatteyRuleList)){
throw new BizException("无对应租电套餐,请重新选择租车套餐"); return null;
}else { }else {
RentBatteyRuleRsp rentBatteyRuleRsp = new RentBatteyRuleRsp(); RentBatteyRuleRsp rentBatteyRuleRsp = new RentBatteyRuleRsp();
rentBatteyRuleRsp.setRentBatteyRuleList(rentBatteyRuleList); rentBatteyRuleRsp.setRentBatteyRuleList(rentBatteyRuleList);

View File

@ -1,8 +1,6 @@
package com.sczx.car.service.impl; package com.sczx.car.service.impl;
import com.sczx.car.convert.RentBatteyRuleConvert;
import com.sczx.car.dto.RentBatteyRuleDTO; import com.sczx.car.dto.RentBatteyRuleDTO;
import com.sczx.car.po.RentBatteyRulePO;
import com.sczx.car.repository.RentBatteyRuleRepo; import com.sczx.car.repository.RentBatteyRuleRepo;
import com.sczx.car.service.RentBatteyRuleService; import com.sczx.car.service.RentBatteyRuleService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -17,8 +15,7 @@ public class RentBatteyRuleServiceImpl implements RentBatteyRuleService {
private RentBatteyRuleRepo rentBatteyRuleRepo; private RentBatteyRuleRepo rentBatteyRuleRepo;
@Override @Override
public RentBatteyRuleDTO getRentBatteyRuleByBatteyRuleId(Long carRuleId) { public RentBatteyRuleDTO getRentBatteyRuleByBatteyRuleId(Long batteyRuleId) {
RentBatteyRulePO rentBatteyRulePO = rentBatteyRuleRepo.getById(carRuleId); return rentBatteyRuleRepo.getRentBatteyRuleById(batteyRuleId.intValue());
return RentBatteyRuleConvert.INSTANCE.poToDto(rentBatteyRulePO);
} }
} }

View File

@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
@FeignClient(name = "sczx-store") @FeignClient(name = "sczx-store", url = "${sczx-store.ribbon.listOfServers:}")
public interface StoreFacade { public interface StoreFacade {
@GetMapping("/pub/getStoreById") @GetMapping("/pub/getStoreById")

View File

@ -0,0 +1,3 @@
sczx-store:
ribbon:
listOfServers: http://115.190.8.52:8082

View File

View File

@ -1,87 +1,3 @@
server:
port: 8083
spring: spring:
application: application:
name: sczx-car # 微服务名称 name: sczx-car # 微服务名称
http:
encoding:
charset: UTF-8
enabled: true
force: true
mvc:
async:
request-timeout: -1
cloud:
nacos:
discovery:
server-addr: 115.190.8.52:8848 # Nacos 地址
group: DEFAULT_GROUP
metadata:
version: 1.0.0
env: dev
lifecycle:
timeout-per-shutdown-phase: 30s # 设置优雅停机时间
datasource:
url: jdbc:mysql://115.190.8.52:3306/sczx?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
username: sczx_user
password: Sczx123@
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
maximum-pool-size: 20 # 最大连接数
minimum-idle: 5 # 最小空闲连接数
connection-timeout: 30000 # 连接超时时间(毫秒)
idle-timeout: 600000 # 空闲连接超时时间(毫秒)
max-lifetime: 1800000 # 连接最大存活时间(毫秒)
leak-detection-threshold: 60000 # 连接泄漏检测阈值(毫秒)
auto-commit: true
connection_init_sql: SELECT 1
redis:
host: 115.190.8.52
port: 6379
lettuce:
pool:
max-active: 8
max-wait: 2000ms
max-idle: 4
min-idle: 1
max-life-time: 300000ms
management:
endpoints:
web:
exposure:
include: "*" # 暴露所有监控端点
endpoint:
health:
show-details: always
feign:
client:
config:
default:
connectTimeout: 5000
readTimeout: 5000
hystrix:
enabled: true # 启用 Feign 的 Hystrix 支持
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 10000 # 默认熔断超时时间
mybatis-plus:
mapper-locations: classpath*:mapper/**/*.xml
type-aliases-package: com.sczx.car.po # 实体类包路径
configuration:
mapUnderscoreToCamelCase: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 控制台打印 SQL调试用
auth:
secret-key: his-is-a-very-long-and-secure-secret-key-for-jwt-signing-please-dont-use-short-keys
token-expiration: 86400000 # 24小时

View File

@ -0,0 +1,15 @@
spring:
application:
name: sczx-car # 应用名称,对应 Nacos 配置的 dataId
cloud:
nacos:
server-addr: ${NACOS_SERVER_ADDR} # Nacos 服务器地址
config:
group: DEFAULT_GROUP # 配置分组
file-extension: yaml # 配置文件格式
timeout: 5000 # 配置读取超时时间
# 添加共享配置
shared-configs:
- data-id: shared-config.yaml
group: DEFAULT_GROUP
refresh: true # 是否支持动态刷新

View File

@ -13,18 +13,19 @@
zc.license_plate, zc.license_plate,
zc.brand_name, zc.brand_name,
zc.model_name, zc.model_name,
zc.battery_type , zcm.battery_type ,
ifnull(zom.overdue_days, 0) overdue_days, ifnull(zom.overdue_days, 0) overdue_days,
(case (case
when ifnull(zc.package_id, 0)>0 then 'NON_PACKAGE' WHEN ifnull(zcmp.car_rule_num, 0)= 0 THEN 'NON_PACKAGE'
when zc.brs_status = '9' WHEN zc.brs_status = '9'
and ifnull(zom.overdue_days, 0) > 0 AND ifnull(zom.overdue_days, 0) > 0
and zom.order_status = 'RENT_OVERDUE' then 'OVERDUE' AND zom.order_status = 'RENT_OVERDUE' THEN 'OVERDUE'
when zc.brs_status = '9' WHEN zc.brs_status = '9'
and ifnull(zom.overdue_days, 0) = 0 AND ifnull(zom.overdue_days, 0) = 0
and zom.order_status = 'RENT_ING' then 'RENTING' AND zom.order_status = 'RENT_ING' THEN 'RENTING'
when zc.brs_status = '0' then 'FREE' WHEN zc.brs_status = '9' THEN 'RENTING'
when zc.brs_status = '1' then 'REMOVED' WHEN zc.brs_status = '0' THEN 'FREE'
WHEN zc.brs_status = '1' THEN 'REMOVED'
END ) store_car_status, END ) store_car_status,
zc.brs_status, zc.brs_status,
zcm.image, zcm.image,
@ -33,12 +34,19 @@
zom.pick_car_time, zom.pick_car_time,
zc.update_time, zc.update_time,
zc.store_id, zc.store_id,
zc.iot_code, zc.lot_number,
zc.iot_status, zc.iot_status,
zcm.max_speed, zcm.max_speed,
zcm.weight zcm.weight
from from
zc_car zc 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 ( left join (
select select
* *

View File

@ -14,8 +14,7 @@
cm.brand_name AS brand_name, cm.brand_name AS brand_name,
cm.image AS image, cm.image AS image,
GROUP_CONCAT(DISTINCT r.rental_type SEPARATOR ',') AS rental_types, GROUP_CONCAT(DISTINCT r.rental_type SEPARATOR ',') AS rental_types,
MAX(r.deposit_free) AS deposit_free, MAX(r.deposit_free) AS deposit_free
MAX(r.auto_deduct) AS auto_deduct
FROM FROM
zc_car_model cm zc_car_model cm
JOIN JOIN
@ -26,13 +25,12 @@
zc_car_model_package mp ON cm.id = mp.car_model_id zc_car_model_package mp ON cm.id = mp.car_model_id
JOIN JOIN
zc_rent_car_rule r ON mp.car_rule_id = r.id AND r.del_flag = '0' AND r.status = '0' 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> <where>
s.id = #{storeCarModelReq.storeId} s.id = #{storeCarModelReq.storeId}
<if test="storeCarModelReq.depositFree != null and storeCarModelReq.depositFree != ''"> <if test="storeCarModelReq.depositFree != null and storeCarModelReq.depositFree != ''">
AND r.deposit_free = #{storeCarModelReq.depositFree} and r.deposit_free = #{storeCarModelReq.depositFree}
</if>
<if test="storeCarModelReq.autoDeduct != null and storeCarModelReq.autoDeduct != ''">
AND r.auto_deduct = #{storeCarModelReq.autoDeduct}
</if> </if>
AND cm.del_flag = '0' AND cm.status = '0' AND cm.del_flag = '0' AND cm.status = '0'
</where> </where>

View File

@ -15,4 +15,16 @@
rcb.car_rule_id = #{carRuleId} rcb.car_rule_id = #{carRuleId}
AND b.is_delete = 0 AND b.is_delete = 0
</select> </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> </mapper>

View File

@ -26,7 +26,7 @@
r.extend4 AS extend4, r.extend4 AS extend4,
r.extend5 AS extend5 r.extend5 AS extend5
FROM ( FROM (
SELECT DISTINCT mp.car_rule_id SELECT DISTINCT mp.car_rule_id,s.operating_company_id
FROM zc_car_model cm FROM zc_car_model cm
JOIN zc_car c ON cm.id = c.model_id JOIN zc_car c ON cm.id = c.model_id
JOIN zc_company_store s ON c.store_id = s.id JOIN zc_company_store s ON c.store_id = s.id
@ -37,7 +37,7 @@
AND cm.del_flag = '0' AND cm.del_flag = '0'
AND cm.status = '0' AND cm.status = '0'
) tmp ) 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' WHERE r.del_flag = '0' AND r.status = '0'
</select> </select>
</mapper> </mapper>