fuck rentordercreate

This commit is contained in:
2025-09-07 02:51:45 +08:00
parent d9935428fe
commit b60b0c58a5
26 changed files with 1374 additions and 4 deletions

11
pom.xml
View File

@ -92,6 +92,17 @@
<version>1.18.30</version> <version>1.18.30</version>
</dependency> </dependency>
<!-- OpenFeign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!-- Hystrix 熔断器 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<!-- Spring Retry --> <!-- Spring Retry -->
<dependency> <dependency>

View File

@ -1,11 +1,14 @@
package com.sczx.pay; package com.sczx.pay;
import com.sczx.pay.common.constant.SystemConstants;
import com.sczx.pay.utils.ComputerInfo; import com.sczx.pay.utils.ComputerInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.retry.annotation.EnableRetry; import org.springframework.retry.annotation.EnableRetry;
@ -17,7 +20,9 @@ import java.io.IOException;
@SpringBootApplication @SpringBootApplication
@EnableDiscoveryClient // 启用服务注册与发现 @EnableDiscoveryClient // 启用服务注册与发现
@EnableRetry @EnableRetry
@EnableFeignClients(basePackages = SystemConstants.FEIGN_CLIENT_BASE_PACKAGE )
@EnableTransactionManagement @EnableTransactionManagement
@EnableHystrix
@MapperScan("com.sczx.pay.mapper") // 扫描 Mapper 接口 @MapperScan("com.sczx.pay.mapper") // 扫描 Mapper 接口
public class Application { public class Application {

View File

@ -0,0 +1,32 @@
package com.sczx.pay.alipay.controller;
import com.alipay.api.AlipayApiException;
import com.sczx.pay.alipay.service.RentOrderService;
import com.sczx.pay.alipay.vo.RentOrderCreateRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@Api(value = "租赁订单接口", tags = "租赁订单接口")
@Slf4j
@RestController
@RequestMapping("/rentorder")
public class ItemOrderController {
@Autowired
private RentOrderService rentOrderService;
@ApiOperation(value = "创建租赁订单")
@PostMapping("/create")
public String rentOrderCreate(RentOrderCreateRequest request) throws AlipayApiException {
return rentOrderService.rentOrderCreate(request).getBody();
}
}

View File

@ -0,0 +1,11 @@
package com.sczx.pay.alipay.service;
import com.alipay.api.AlipayApiException;
import com.alipay.api.request.AlipayCommerceRentOrderCreateRequest;
import com.alipay.api.response.AlipayCommerceRentOrderCreateResponse;
import com.sczx.pay.alipay.vo.RentOrderCreateRequest;
public interface RentOrderService {
AlipayCommerceRentOrderCreateResponse rentOrderCreate(RentOrderCreateRequest request) throws AlipayApiException;
}

View File

@ -12,8 +12,6 @@ import com.sczx.pay.alipay.po.RentCommodityConfig;
import com.sczx.pay.alipay.po.RentRuleItem; import com.sczx.pay.alipay.po.RentRuleItem;
import com.sczx.pay.alipay.service.ImageUploadService; import com.sczx.pay.alipay.service.ImageUploadService;
import com.sczx.pay.alipay.service.ItemService; import com.sczx.pay.alipay.service.ItemService;
import com.sczx.pay.alipay.vo.AppItemSkuAttrVo;
import com.sczx.pay.alipay.vo.ItemCreateRequest;
import com.sczx.pay.alipay.vo.OpenResponse; import com.sczx.pay.alipay.vo.OpenResponse;
import com.sczx.pay.mapper.RentRuleItemMapper; import com.sczx.pay.mapper.RentRuleItemMapper;
import com.sczx.pay.utils.AlipayApiCallback; import com.sczx.pay.utils.AlipayApiCallback;
@ -587,7 +585,8 @@ public class ItemServiceImpl implements ItemService {
// 创建时段价格列表根据基础价格创建3个时段价格 // 创建时段价格列表根据基础价格创建3个时段价格
List<RentCommodityConfig.DurationPrice> durationPriceList = new ArrayList<>(); List<RentCommodityConfig.DurationPrice> durationPriceList = new ArrayList<>();
for(int i = 1; i < 4; i++){ //暂时设置为只保留一个时段价格
for(int i = 1; i < 2; i++){
RentCommodityConfig.DurationPrice durationPrice = new RentCommodityConfig.DurationPrice(); RentCommodityConfig.DurationPrice durationPrice = new RentCommodityConfig.DurationPrice();
String val = i*100 + ""; String val = i*100 + "";
durationPrice.setDuration(i*rentalDays+""); durationPrice.setDuration(i*rentalDays+"");
@ -601,10 +600,15 @@ public class ItemServiceImpl implements ItemService {
} }
config.setDurationPriceList(durationPriceList); config.setDurationPriceList(durationPriceList);
rentCommodityAttr.setAttrValue(JSON.toJSONString(config)); rentCommodityAttr.setAttrValue(JSON.toJSONString(config));
rentCommodityAttr.setAttrKey("收货方式");
rentCommodityAttr.setAttrValue("到店自提");
// 根据实际情况设置 // 根据实际情况设置
skuAttrs.add(rentCommodityAttr); skuAttrs.add(rentCommodityAttr);
sku.setSkuAttrs(skuAttrs); sku.setSkuAttrs(skuAttrs);
itemSkus.add(sku); itemSkus.add(sku);
return itemSkus; return itemSkus;
} }
@ -667,7 +671,7 @@ public class ItemServiceImpl implements ItemService {
// 创建时段价格列表根据基础价格创建3个时段价格 // 创建时段价格列表根据基础价格创建3个时段价格
List<RentCommodityConfig.DurationPrice> durationPriceList = new ArrayList<>(); List<RentCommodityConfig.DurationPrice> durationPriceList = new ArrayList<>();
for(int i = 1; i < 4; i++){ for(int i = 1; i < 2; i++){
RentCommodityConfig.DurationPrice durationPrice = new RentCommodityConfig.DurationPrice(); RentCommodityConfig.DurationPrice durationPrice = new RentCommodityConfig.DurationPrice();
String val = i*100 + ""; String val = i*100 + "";
durationPrice.setDuration(i*rentalDays+""); durationPrice.setDuration(i*rentalDays+"");

View File

@ -0,0 +1,146 @@
package com.sczx.pay.alipay.service.impl;
import com.alipay.api.AlipayApiException;
import com.alipay.api.domain.*;
import com.alipay.api.request.AlipayCommerceRentOrderCreateRequest;
import com.alipay.api.response.AlipayCommerceRentOrderCreateResponse;
import com.sczx.pay.alipay.po.RentRuleItem;
import com.sczx.pay.alipay.service.RentOrderService;
import com.sczx.pay.alipay.vo.RentOrderCreateRequest;
import com.sczx.pay.mapper.RentRuleItemMapper;
import com.sczx.pay.thirdpart.dto.req.OrderDetailDTO;
import com.sczx.pay.thirdpart.integration.OrderInteg;
import com.sczx.pay.utils.AlipaySdkUtil;
import org.mapstruct.ap.shaded.freemarker.template.utility.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
@Service
public class RentOrderServiceImpl implements RentOrderService {
@Autowired
private AlipaySdkUtil alipaySdkUtil;
@Autowired
private RentRuleItemMapper rentRuleItemMapper;
@Autowired
private OrderInteg orderInteg;
@Override
public AlipayCommerceRentOrderCreateResponse rentOrderCreate(RentOrderCreateRequest reqData) throws AlipayApiException {
AlipayCommerceRentOrderCreateRequest request = new AlipayCommerceRentOrderCreateRequest();
AlipayCommerceRentOrderCreateModel model = new AlipayCommerceRentOrderCreateModel();
RentRuleItem rentRuleItem = rentRuleItemMapper.selectItemByOutItemId(reqData.getOutItemId());
OrderDetailDTO orderDetailDTO = orderInteg.getOrderDetailByOrderNo(reqData.getOutOrderid());
// 设置商户订单号
model.setOutOrderId(reqData.getOutOrderid());
// 设置订单类型
model.setOrderType(reqData.getRentType());
// 设置订单标题
model.setTitle(rentRuleItem.getItemDesc());
// 设置租赁订单页面地址信息
RentPathInfoDTO pathInfo = new RentPathInfoDTO();
pathInfo.setDetailPath("pages/rentGoodsDetail/index?outItemId="+reqData.getOutOrderid());
ArrayList<RentServiceProtocolDTO> serviceProtocolList = new ArrayList<>();
RentServiceProtocolDTO serviceProtocol = new RentServiceProtocolDTO();
serviceProtocol.setProtocolName("两轮电动车租赁协议");
serviceProtocol.setProtocolPath("pages_order/rentDeal");
serviceProtocolList.add(serviceProtocol);
model.setPathInfo(pathInfo);
model.setPathInfo(pathInfo);
// 设置订单金额信息
RentOrderPriceInfoDTO priceInfo = new RentOrderPriceInfoDTO();
// 可小于等于原订单租赁计划中buyout_price金额
priceInfo.setOrderPrice(orderDetailDTO.getRentalPrice().toString());
priceInfo.setDepositPrice(orderDetailDTO.getDepositPrice().toString());
model.setPriceInfo(priceInfo);
model.setSourceId(reqData.getSourceId());
// 设置买家支付宝用户唯一标识
model.setBuyerOpenId(reqData.getOpenId());
RentPlanInfoDTO planInfo = new RentPlanInfoDTO();
planInfo.setRentStartTime(Date.from(orderDetailDTO.getStartRentTime().atZone(ZoneId.systemDefault()).toInstant()));
planInfo.setRentEndTime(Date.from(orderDetailDTO.getEndRentTime().atZone(ZoneId.systemDefault()).toInstant()));
ArrayList<RentInstallmentInfo> planItemList = new ArrayList<>();
RentInstallmentInfo planItem = new RentInstallmentInfo();
planItem.setInstallmentNo(1L);
planItem.setInstallmentPrice(orderDetailDTO.getRentalPrice().toString());
planItem.setPlanPayTime(new Date());
planItemList.add(planItem);
planInfo.setInstallments(planItemList);
model.setRentPlanInfo(planInfo);
RentSignInfoDTO signInfo = new RentSignInfoDTO();
RentDeductInfoDTO deductInfo = new RentDeductInfoDTO();
deductInfo.setSignScene("RENT_DEDUCT");
deductInfo.setServiceName(rentRuleItem.getItemDesc());
signInfo.setRentDeductInfo(deductInfo);
RentFundAuthFreezeInfoDTO fundAuthFreezeInfo = new RentFundAuthFreezeInfoDTO();
//需要实现回调监听
fundAuthFreezeInfo.setFreezeNotifyUrl("https://www.alipay.com");
signInfo.setFundAuthFreezeInfo(fundAuthFreezeInfo);
//需要确认
RentCreditInfoDTO creditInfo = new RentCreditInfoDTO();
creditInfo.setZmServiceId("2025061101502300000000760095243636");
creditInfo.setCategoryId("RENT_PHONE");
signInfo.setCreditInfo(creditInfo);
model.setRentSignInfo(signInfo);
ArrayList<RentGoodsDetailInfoDTO> goodsDetailList = new ArrayList<>();
RentGoodsDetailInfoDTO goodsDetail = new RentGoodsDetailInfoDTO();
goodsDetail.setItemName(rentRuleItem.getItemDesc());
goodsDetail.setOutItemId(rentRuleItem.getOutItemId());
goodsDetail.setOutSkuId(rentRuleItem.getOutSkuId());
goodsDetail.setItemCnt("1");
if (rentRuleItem.getRentalDays() != null) {
BigDecimal rentalPrice = rentRuleItem.getRentalPrice();
BigDecimal rentalDays = new BigDecimal(rentRuleItem.getRentalDays());
BigDecimal salePrice = rentalPrice.divide(rentalDays, 2, RoundingMode.HALF_UP);
goodsDetail.setSalePrice(salePrice.toString());
}else {
goodsDetail.setSalePrice(rentRuleItem.getRentalPrice().toString());
}
goodsDetail.setItemFineness("secondHand");
goodsDetail.setItemFinenessGrade("99new");
goodsDetail.setItemValue("5000.00");
goodsDetail.setRentModel("R00001");
goodsDetailList.add(goodsDetail);
model.setItemInfos(goodsDetailList);
//TODO 续租
RentOrderDeliveryInfoDTO deliveryInfo = new RentOrderDeliveryInfoDTO();
deliveryInfo.setDeliveryType("SELFPICK");
RentPickupShopInfoDTO pickupShopInfo = new RentPickupShopInfoDTO();
pickupShopInfo.setName("当前门店");
pickupShopInfo.setAddress("门店地址");
model.setDeliveryInfo(deliveryInfo);
request.setBizModel(model);
AlipayCommerceRentOrderCreateResponse response =alipaySdkUtil.execute(request);
return response;
}
}

View File

@ -0,0 +1,15 @@
package com.sczx.pay.alipay.vo;
import lombok.Data;
@Data
public class RentOrderCreateRequest {
private String outOrderid;
private String outItemId;
private Long storeId;
private String rentType;
private String openId;
private String sourceId;
}

View File

@ -0,0 +1,54 @@
package com.sczx.pay.aspect;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
/**
* @Author Huang Kai
* @Date 2023/1/18 17:01
* @Version 1.0
*/
@Aspect
@Component
@Slf4j
public class FacadeAspect {
/** 以 controller 包下定义的所有请求为切入点 */
@Pointcut("execution(public * com..facade.*.*(..))")
public void facadeLog() {}
/**
* 在切点之前织入
* @param joinPoint
*/
@Before("facadeLog()")
public void doBefore(JoinPoint joinPoint) {
// 打印请求相关参数
log.info("******** remote Start *********");
// 打印 Http method
//log.info("HTTP Method : {}", request.getMethod());
// 打印调用 controller 的全路径以及执行方法
log.info("Class Method:{}.{}, facadeAspect_Request:{}", joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(),JSON.toJSONString(joinPoint.getArgs()));
}
@Around("facadeLog()")
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
long startTime = System.currentTimeMillis();
Object result = proceedingJoinPoint.proceed();
// 打印出参
log.info("facadeAspect_Response:{}", JSON.toJSONString(result));
// 执行耗时
log.info("Time-Consuming : {} ms", System.currentTimeMillis() - startTime);
log.info("**************remote End ****************");
return result;
}
}

View File

@ -0,0 +1,12 @@
package com.sczx.pay.common;
/**
* @Author: 张黎
* @Date: 2025/07/09/20:20
* @Description:
*/
public interface IApiCode {
String getCode();
String getMsg();
}

View File

@ -0,0 +1,121 @@
package com.sczx.pay.common;
import com.sczx.pay.common.enums.ApiErrorCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @Author: 张黎
* @Date: 2025/07/09/20:25
* @Description:
*/
@ApiModel(value = "公共返回结果")
@Builder
@Data
public class Result<T> implements Serializable {
private static final long serialVersionUID = 1331134667810352183L;
@ApiModelProperty(value = "成功标识")
private boolean success;
@ApiModelProperty(value = "返回编码")
private String code;
@ApiModelProperty(value = "返回信息说明")
private String msg;
private String issue;
@ApiModelProperty(value = "返回数据")
private T data;
public Result(boolean success, String code, String msg, String issue, T data) {
this.success = success;
this.code = code;
this.msg = msg;
this.issue = issue;
this.data = data;
}
public static Result result(IApiCode apiCode) {
return result(apiCode, (Object)null);
}
public static Result result(IApiCode apiCode, Object data) {
return result(apiCode, apiCode.getMsg(), data);
}
public static Result result(IApiCode apiCode, String issue, Object data) {
return result((IApiCode)apiCode, (String)null, issue, data);
}
public static Result result(IApiCode apiCode, String msg, String issue, Object data) {
String message = apiCode.getMsg();
if (StringUtils.isNotBlank(msg)) {
message = msg;
}
return result(apiCode.getCode(), message, issue, data);
}
public static Result result(String code, String msg, String issue, Object data) {
return builder().code(code).success("0".equals(code)).msg(msg).issue(issue).data(data).build();
}
public static Result ok() {
return ok((Object)null);
}
public static Result ok(Object data) {
return result(ApiErrorCode.SUCCESS, data);
}
public static Result ok(String key, Object value) {
Map<String, Object> map = new HashMap(1);
map.put(key, value);
return ok(map);
}
public static Result fail(String msg) {
return result((IApiCode)ApiErrorCode.FAIL, msg, msg, (Object)null);
}
public static Result fail(IApiCode apiCode) {
return result(apiCode, (Object)null);
}
public static Result fail(IApiCode apiCode, String issue) {
return result(apiCode, issue, (Object)null);
}
public static Result fail(String code, String msg) {
return result((String)code, msg, msg, (Object)null);
}
public static Result fail(String code, String msg, String issue) {
return result((String)code, msg, issue, (Object)null);
}
public static Result fail(String code, String msg, String issue, Object data) {
return result(code, msg, issue, data);
}
public static Result fail(IApiCode apiCode, String issue, Object data) {
if (ApiErrorCode.SUCCESS == apiCode) {
throw new RuntimeException("失败结果状态码不能为" + ApiErrorCode.SUCCESS.getCode());
} else {
return result(apiCode, issue, data);
}
}
public static Result fail(String key, Object value) {
Map<String, Object> map = new HashMap();
map.put(key, value);
return result(ApiErrorCode.FAIL, map);
}
public Result() {
}
}

View File

@ -0,0 +1,11 @@
package com.sczx.pay.common.constant;
public interface SystemConstants {
/***
* feign客户端所在包路径
*/
String FEIGN_CLIENT_BASE_PACKAGE = "com.sczx.pay.thirdpart.facade";
}

View File

@ -0,0 +1,55 @@
package com.sczx.pay.common.enums;
import com.sczx.pay.common.IApiCode;
/**
* @Author: 张黎
* @Date: 2025/07/09/20:22
* @Description:
*/
public enum ApiErrorCode implements IApiCode {
SUCCESS("0", "操作成功"),
ARG_ERROR("401000", "参数错误"),
NOT_PERMISSION("401001", "没有权限"),
HTTP_MEDIA_TYPE_NOT_SUPPORTED_ERROR("401002", "media类型出错"),
HTTP_METHOD_NOT_ALLOW_ERROR("401003", "http请求method错误"),
BODY_NOT_MATCH("401004", "请求的数据格式不符!"),
NOT_FOUND("404000", "你请求的路径不存在"),
UNAUTHORIZED("404001", "非法访问"),
FAIL("500000", "操作失败"),
INNER_ERROR("500001", "服务器内部异常");
private final String code;
private final String msg;
private ApiErrorCode(String code, String msg) {
this.code = code;
this.msg = msg;
}
public static ApiErrorCode getApiCode(String code) {
ApiErrorCode[] ecs = values();
ApiErrorCode[] var2 = ecs;
int var3 = ecs.length;
for(int var4 = 0; var4 < var3; ++var4) {
ApiErrorCode ec = var2[var4];
if (ec.getCode().equals(code)) {
return ec;
}
}
return SUCCESS;
}
@Override
public String getCode() {
return this.code;
}
@Override
public String getMsg() {
return this.msg;
}
}

View File

@ -0,0 +1,86 @@
package com.sczx.pay.exception;
import com.sczx.pay.common.IApiCode;
import com.sczx.pay.common.enums.ApiErrorCode;
/**
*
* @author zhangli
*/
public class InnerException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* 错误码
*/
protected String errorCode;
/**
* 错误信息
*/
protected String errorMsg;
public InnerException() {
super();
}
public InnerException(IApiCode apiCode) {
super(apiCode.getCode());
this.errorCode = apiCode.getCode();
this.errorMsg = apiCode.getMsg();
}
public InnerException(IApiCode apiCode, Throwable cause) {
super(apiCode.getCode(), cause);
this.errorCode = apiCode.getCode();
this.errorMsg = apiCode.getMsg();
}
public InnerException(String errorMsg) {
super(errorMsg);
this.errorCode = ApiErrorCode.INNER_ERROR.getCode();
this.errorMsg = errorMsg;
}
public InnerException(String errorCode, String errorMsg) {
super(errorCode);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public InnerException(String errorCode, String errorMsg, Throwable cause) {
super(errorCode, cause);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
@Override
public String getMessage() {
return errorMsg;
}
@Override
public Throwable fillInStackTrace() {
return this;
}
}

View File

@ -17,6 +17,7 @@ public interface RentRuleItemMapper {
RentRuleItem selectItemByFourIds(@Param("batteryRuleId") Long batteryRuleId, @Param("carRuleId") Long carRuleId, @Param("carModelId") Long carModelId,@Param("brandId") Long brandId); RentRuleItem selectItemByFourIds(@Param("batteryRuleId") Long batteryRuleId, @Param("carRuleId") Long carRuleId, @Param("carModelId") Long carModelId,@Param("brandId") Long brandId);
RentRuleItem selectItemByOutItemId(@Param("outItemId") String outItemId);
int insertByFourId(RentRuleItem zcRentRuleItem); int insertByFourId(RentRuleItem zcRentRuleItem);

View File

@ -0,0 +1,132 @@
package com.sczx.pay.thirdpart.dto.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
* 电动车信息表
* </p>
*
* @author zhangli
* @since 2025-07-30 17:05:03
*/
@Data
@ApiModel(value = "CarDTO对象", description = "电动车信息表")
public class CarDTO {
@ApiModelProperty("主键ID")
private Long id;
@ApiModelProperty("车架号(VIN)")
private String vin;
@ApiModelProperty("车牌号码")
private String licensePlate;
@ApiModelProperty("车辆品牌ID")
private Long brandId;
@ApiModelProperty("车辆品牌名称")
private String brandName;
@ApiModelProperty("车辆型号ID")
private Long modelId;
@ApiModelProperty("车辆型号名称")
private String modelName;
@ApiModelProperty("支持电池类型(48V标准版/100km,48V超长版/200km等)")
private String batteryType;
@ApiModelProperty("整车重量(kg)")
private String weight;
@ApiModelProperty("最高时速(km/h)")
private String maxSpeed;
@ApiModelProperty("LOT识别号")
private String lotNumber;
@ApiModelProperty("采购日期")
private LocalDateTime purchaseDate;
@ApiModelProperty("采购价格(元)")
private BigDecimal purchasePrice;
@ApiModelProperty("车辆归属(0归属于合,1归属运营商)")
private String belongType;
@ApiModelProperty("车辆图片(多个图片用逗号分隔)")
private String images;
@ApiModelProperty("BRS车辆状态(空闲/使用中/维修中/丢失报损等)")
private String brsStatus;
@ApiModelProperty("IoT设备状态")
private String iotStatus;
@ApiModelProperty("IoT识别码")
private String iotCode;
@ApiModelProperty("所属运营商ID")
private Long operatorId;
@ApiModelProperty("所属运营商名称")
private String operatorName;
@ApiModelProperty("所属门店ID")
private Long storeId;
@ApiModelProperty("所属门店名称")
private String storeName;
@ApiModelProperty("应用套餐ID")
private Long packageId;
@ApiModelProperty("应用套餐名称")
private String packageName;
@ApiModelProperty("状态0正常 1停用")
private String status;
@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,40 @@
package com.sczx.pay.thirdpart.dto.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "车型简单对象")
public class CarModelSimpleDTO {
@ApiModelProperty("车型ID")
private Long carModelId;
@ApiModelProperty("门店id")
private Integer storeId;
@ApiModelProperty("门店编号")
private String storeNumber;
@ApiModelProperty("车型名称")
private String modelName;
@ApiModelProperty("品牌名称")
private String brandName;
@ApiModelProperty("租赁类型(时租/日租/按天数/以租代售),用逗号分隔")
private String batteryTypes;
@ApiModelProperty("是否支持免押(0不支持 1支持)")
private String depositFree;
@ApiModelProperty("是否支持代扣(0不支持 1支持)")
private String autoDeduct;
@ApiModelProperty("电池类型")
private String batteryType;
@ApiModelProperty("车型照片")
private String image;
}

View File

@ -0,0 +1,68 @@
package com.sczx.pay.thirdpart.dto.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(value = "CompanyStoreDTO对象", description = "门店信息")
public class CompanyStoreDTO {
@ApiModelProperty("主键id")
private Integer id;
@ApiModelProperty("门店名称")
private String name;
@ApiModelProperty("联系人")
private String contactPerson;
@ApiModelProperty("手机号码")
private String phone;
@ApiModelProperty("联系人2")
private String contactPerson2;
@ApiModelProperty("手机号码2")
private String phone2;
@ApiModelProperty("详细地址")
private String detailedAddress;
@ApiModelProperty("门店logo")
private String image;
@ApiModelProperty("纬度")
private Double latitude;
@ApiModelProperty("经度")
private Double longitude;
@ApiModelProperty("标签 1.可租车 2.可换电 3.二手车多个用号隔开例如1,2,3")
private String label;
@ApiModelProperty("运营公司id")
private Integer operatingCompanyId;
@ApiModelProperty("运营性质 1.直营 0.合作")
private Boolean operatingNature;
@ApiModelProperty("简介")
private String introduction;
@ApiModelProperty("门店编号")
private String storeNumber;
@ApiModelProperty("租车分成比例")
private BigDecimal zucheRatio;
@ApiModelProperty("租电分成比例")
private BigDecimal zudianRatio;
@ApiModelProperty("以租代售分成比例")
private BigDecimal daishouRatio;
}

View File

@ -0,0 +1,16 @@
package com.sczx.pay.thirdpart.dto.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "OrderCarImgDTO对象", description = "订单租车车辆图片信息")
@Data
public class OrderCarImgDTO {
@ApiModelProperty("图片类型:RENT租车RETURN还车")
private String imgType;
@ApiModelProperty("图片地址")
private String imgUrl;
}

View File

@ -0,0 +1,144 @@
package com.sczx.pay.thirdpart.dto.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
* @Author: 张黎
* @Date: 2025/07/25/17:18
* @Description:
*/
@Data
@ApiModel(value = "订单dto", description = "租车订单信息")
public class OrderDTO {
@ApiModelProperty("订单ID主键")
private Long orderId;
@ApiModelProperty("订单编号")
private String orderNo;
@ApiModelProperty("订单状态:下单未提车、租赁中、已结束-自动、已结束-手动")
private String orderStatus;
@ApiModelProperty("所属运营商ID")
private Long operatorId;
@ApiModelProperty("门店信息")
private CompanyStoreDTO companyStoreDTO;
@ApiModelProperty("所属门店ID")
private Long storeId;
@ApiModelProperty("车辆ID")
private Long vehicleId;
@ApiModelProperty("车辆信息")
private CarDTO carDTO;
@ApiModelProperty("车型ID")
private Long carModelId;
@ApiModelProperty("车型信息")
private CarModelSimpleDTO carModelSimpleDTO;
@ApiModelProperty("客户id")
private Long customerId;
@ApiModelProperty("客户姓名")
private String customerName;
@ApiModelProperty("客户联系电话")
private String customerPhone;
@ApiModelProperty("选择的电池类型")
private String batteryType;
@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("是否开通免押")
private Boolean isDepositFree;
@ApiModelProperty("是否开通代扣")
private Boolean isAutoDeduct;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("首次下单时间")
private LocalDateTime firstOrderTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("开始计费时间")
private LocalDateTime startRentTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("还车时间")
private LocalDateTime endRentTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("申请还车时间")
private LocalDateTime reqEndRentTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("实际还车时间")
private LocalDateTime actEndRentTime;
@ApiModelProperty("逾期天数")
private Integer overdueDays;
@ApiModelProperty("续租次数")
private Integer renewalTimes;
@ApiModelProperty("充电次数")
private Integer chargeTimes;
@ApiModelProperty("租车套餐id")
private Long rentCarRuleId;
@ApiModelProperty("租电套餐id")
private Long rentBatteyRuleId;
@ApiModelProperty("订单结束时间")
private LocalDateTime endOrderTime;
@ApiModelProperty("订单总金额")
private BigDecimal orderAmount;
@ApiModelProperty("租电套餐信息")
private RentBatteyRuleDTO rentBatteyRule;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("租车子订单信息")
private List<OrderSubDTO> orderSubDTOList;
@ApiModelProperty("订单车辆图片")
private List<String> orderCarImgList;
}

View File

@ -0,0 +1,176 @@
package com.sczx.pay.thirdpart.dto.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@ApiModel(value = "订单详情dto", description = "租车订单详情信息")
@Data
public class OrderDetailDTO {
@ApiModelProperty("订单ID主键")
private Long orderId;
@ApiModelProperty("订单编号")
private String orderNo;
@ApiModelProperty("订单状态:下单未提车、租赁中、已结束-自动、已结束-手动")
private String orderStatus;
@ApiModelProperty("门店名称")
private String storeName;
@ApiModelProperty("详细地址")
private String detailedAddress;
@ApiModelProperty("纬度")
private Double latitude;
@ApiModelProperty("经度")
private Double longitude;
@ApiModelProperty("车型名称")
private String modelName;
@ApiModelProperty("品牌名称")
private String brandName;
@ApiModelProperty("车型图片")
private String image;
@ApiModelProperty("车辆id")
private String carId;
@ApiModelProperty("车架号(VIN)")
private String vin;
@ApiModelProperty("车牌号码")
private String licensePlate;
@ApiModelProperty("客户id")
private Long customerId;
@ApiModelProperty("客户姓名")
private String customerName;
@ApiModelProperty("客户联系电话")
private String customerPhone;
@ApiModelProperty("租赁类型(时租/日租/按天数/以租代售)")
private String rentalType;
@ApiModelProperty("租赁类型标签")
private String rentalTypeLabel;
@ApiModelProperty("租赁天数(当类型为\"按天数\"时使用)")
private Integer rentalDays;
@ApiModelProperty("租车价格(元)")
private BigDecimal rentalPrice;
@ApiModelProperty("逾期金额(元)")
private BigDecimal overdueFee;
@ApiModelProperty("逾期计费类型(按日计费/按月计费)")
private String overdueType;
@ApiModelProperty("押金价格(元)")
private BigDecimal depositPrice;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("首次下单时间")
private LocalDateTime firstOrderTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("取车时间")
private LocalDateTime pickCarTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("开始计费时间")
private LocalDateTime startRentTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("预计还车时间")
private LocalDateTime endRentTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("申请还车时间")
private LocalDateTime reqEndRentTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("实际还车时间")
private LocalDateTime actEndRentTime;
@ApiModelProperty("电池订单号")
private String rentBatteyOrderNo;
@ApiModelProperty("电池类型名称")
private String categoryName;
@ApiModelProperty("电池编码")
private String batteyNo;
@ApiModelProperty("计时方式")
private Integer durationType;
@ApiModelProperty("电池计时方式标签")
private String durationTypeLabel;
@ApiModelProperty("租点套餐名称")
private String rentBatteyTitle;
@ApiModelProperty("逾期天数")
private Integer overdueDays;
@ApiModelProperty("逾期金额")
private BigDecimal overdueAmount;
@ApiModelProperty("续租金额")
private BigDecimal rerentAmount;
@ApiModelProperty("续租次数")
private Integer renewalTimes;
@ApiModelProperty("充电次数")
private Integer chargeTimes;
@ApiModelProperty("订单总金额")
private BigDecimal orderAmount;
@ApiModelProperty("是否开通免押")
private Boolean isDepositFree;
@ApiModelProperty("是否开通代扣")
private Boolean isAutoDeduct;
@ApiModelProperty("车损金额")
private BigDecimal damageAmount;
@ApiModelProperty("车损说明")
private String damageDesc;
@ApiModelProperty("预计到期间隔天数")
private Integer expectedDays;
@ApiModelProperty("订单车辆图片-租车")
private List<OrderCarImgDTO> orderCarImgRentList;
@ApiModelProperty("订单车辆图片-还车")
private List<OrderCarImgDTO> orderCarImgReturnList;
@ApiModelProperty("订单车辆图片-车损")
private List<OrderCarImgDTO> orderCarImgDamageList;
@ApiModelProperty("最新支付单号")
private String lastPayOrderNo;
@ApiModelProperty("支付订单信息")
private List<PayOrderDTO> payOrderDTOList;
}

View File

@ -0,0 +1,49 @@
package com.sczx.pay.thirdpart.dto.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@ApiModel(value = "租车订单子表dto", description = "租车订单子表信息")
public class OrderSubDTO {
@ApiModelProperty("子订单ID主键")
private Long suborderId;
@ApiModelProperty("关联的订单ID外键")
private Long orderId;
@ApiModelProperty("子订单编号")
private String suborderNo;
@ApiModelProperty("子订单类型(首租、续租、逾期、押金、租电等)")
private String suborderType;
@ApiModelProperty("订单金额")
private BigDecimal amount;
@ApiModelProperty("支付方式")
private String paymentMethod;
@ApiModelProperty("车架/电池编号")
private String vinBatteryNo;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("订单产生时间")
private LocalDateTime createdAt;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("支付ID")
private String paymentId;
@ApiModelProperty("实际支付时间")
private LocalDateTime paidAt;
@ApiModelProperty("备注")
private String remark;
}

View File

@ -0,0 +1,30 @@
package com.sczx.pay.thirdpart.dto.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@ApiModel(value = "支付订单dto", description = "支付订单信息")
public class PayOrderDTO {
@ApiModelProperty("订单金额")
private BigDecimal amount;
@ApiModelProperty("支付方式")
private String paymentMethod;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("订单产生时间")
private LocalDateTime createdAt;
@ApiModelProperty("支付ID")
private String paymentId;
@ApiModelProperty("支付状态")
private String payStatus;
}

View File

@ -0,0 +1,91 @@
package com.sczx.pay.thirdpart.dto.req;
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 String categoryName;
@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,18 @@
package com.sczx.pay.thirdpart.facade;
import com.sczx.pay.common.Result;
import com.sczx.pay.thirdpart.dto.req.CarModelSimpleDTO;
import com.sczx.pay.thirdpart.dto.req.OrderDetailDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@FeignClient(name = "sczx-order", url = "${sczx-order.ribbon.listOfServers:}")
public interface OrderFacade {
@GetMapping("/pubOrder/getOrderDetailByOrderNo")
Result<OrderDetailDTO> getOrderDetailByOrderNo(@RequestParam("orderNo") String orderNo);
}

View File

@ -0,0 +1,35 @@
package com.sczx.pay.thirdpart.integration;
import com.sczx.pay.common.Result;
import com.sczx.pay.exception.InnerException;
import com.sczx.pay.thirdpart.dto.req.OrderDetailDTO;
import com.sczx.pay.thirdpart.facade.OrderFacade;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class OrderInteg {
@Autowired
private OrderFacade orderFacade;
public OrderDetailDTO getOrderDetailByOrderNo(String orderNo){
try{
Result<OrderDetailDTO> result = orderFacade.getOrderDetailByOrderNo(orderNo);
if(result.isSuccess()){
return result.getData();
}
} catch (Exception e){
log.error("根据租车套餐id获取套餐信息失败",e);
throw new InnerException("根据租车套餐id获取套餐信息失败");
}
return null;
}
}

View File

@ -96,6 +96,13 @@
WHERE ali_item_id = #{aliItemId} WHERE ali_item_id = #{aliItemId}
</select> </select>
<select id="selectItemByOutItemId" parameterType="Long" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM zc_rent_rule_item
WHERE out_item_id = #{outItemId}
</select>
<!-- 插入数据 --> <!-- 插入数据 -->
<insert id="insert" parameterType="com.sczx.pay.alipay.po.RentRuleItem"> <insert id="insert" parameterType="com.sczx.pay.alipay.po.RentRuleItem">
insert into zc_rent_rule_item insert into zc_rent_rule_item