From d814831822445439a1fcd679475e8086a9c334e6 Mon Sep 17 00:00:00 2001
From: eric <465889110@qq.com>
Date: Mon, 8 Sep 2025 03:04:04 +0800
Subject: [PATCH] no message
---
.gitignore | 35 +
Dockerfile | 10 +
Dockerfile.buildagent | 15 +
Jenkinsfile | 88 +++
pom.xml | 320 ++++++++
settings.xml | 12 +
src/main/java/com/sczx/pay/Application.java | 34 +
.../pay/alipay/controller/ItemController.java | 131 ++++
.../controller/ItemOrderController.java | 32 +
.../pay/alipay/dto/RentItemCreateRequest.java | 291 +++++++
.../pay/alipay/po/RentCommodityConfig.java | 163 ++++
.../com/sczx/pay/alipay/po/RentRuleItem.java | 314 ++++++++
.../alipay/service/ImageUploadService.java | 47 ++
.../sczx/pay/alipay/service/ItemService.java | 44 ++
.../pay/alipay/service/RentOrderService.java | 11 +
.../alipay/service/RentRuleItemService.java | 8 +
.../service/impl/ImageUploadServiceImpl.java | 348 +++++++++
.../alipay/service/impl/ItemServiceImpl.java | 735 ++++++++++++++++++
.../service/impl/RentOrderServiceImpl.java | 146 ++++
.../service/impl/RentRuleItemServiceImpl.java | 64 ++
.../sczx/pay/alipay/vo/AppItemSkuAttrVo.java | 39 +
.../pay/alipay/vo/ImageDirectoryRequest.java | 83 ++
.../sczx/pay/alipay/vo/ItemCreateRequest.java | 164 ++++
.../com/sczx/pay/alipay/vo/OpenResponse.java | 136 ++++
.../pay/alipay/vo/RentOrderCreateRequest.java | 15 +
.../com/sczx/pay/aspect/FacadeAspect.java | 54 ++
.../com/sczx/pay/aspect/WebLogAspect.java | 127 +++
.../java/com/sczx/pay/common/IApiCode.java | 12 +
src/main/java/com/sczx/pay/common/Result.java | 121 +++
.../pay/common/constant/SystemConstants.java | 11 +
.../sczx/pay/common/enums/ApiErrorCode.java | 55 ++
.../java/com/sczx/pay/config/AlipayConf.java | 114 +++
.../sczx/pay/config/DynamicWXPayConfig.java | 83 ++
.../com/sczx/pay/config/SwaggerConfig.java | 47 ++
.../com/sczx/pay/config/WXPayConfigImpl.java | 85 ++
.../controller/AliPayNotifyController.java | 144 ++++
.../AliPayOrderCloseController.java | 38 +
.../AliPayOrderFulfillmentController.java | 49 ++
.../pay/controller/AliPaymentController.java | 70 ++
.../pay/controller/AlipayRentController.java | 29 +
.../AlipayRentNotifyController.java | 84 ++
.../pay/controller/PaymentController.java | 244 ++++++
.../com/sczx/pay/dto/AlipayCloseRequest.java | 14 +
.../com/sczx/pay/dto/AlipayCreateRequest.java | 14 +
.../sczx/pay/dto/AlipayCreateResponse.java | 14 +
.../com/sczx/pay/dto/AlipayQueryRequest.java | 11 +
.../com/sczx/pay/dto/AlipayQueryResponse.java | 14 +
.../com/sczx/pay/dto/AlipayRefundRequest.java | 14 +
.../java/com/sczx/pay/dto/AlipayResponse.java | 10 +
.../java/com/sczx/pay/dto/PaymentRequest.java | 74 ++
.../com/sczx/pay/dto/PaymentResponse.java | 38 +
.../java/com/sczx/pay/dto/RefundRequest.java | 65 ++
.../pay/dto/ali/rent/AlipayRentPayReq.java | 13 +
.../dto/ali/rent/AlipayRentPayResponse.java | 17 +
.../sczx/pay/entity/CompanyAlipayConfig.java | 44 ++
.../sczx/pay/entity/CompanyWechatConfig.java | 44 ++
.../java/com/sczx/pay/entity/OrderMain.java | 48 ++
.../java/com/sczx/pay/entity/OrderSub.java | 29 +
.../java/com/sczx/pay/entity/PayStatus.java | 113 +++
.../sczx/pay/entity/PaymentNotifyRecord.java | 169 ++++
.../com/sczx/pay/entity/PaymentRecord.java | 177 +++++
.../java/com/sczx/pay/entity/ReasonCodes.java | 165 ++++
.../com/sczx/pay/entity/RefundRecord.java | 158 ++++
.../com/sczx/pay/entity/RefundStatus.java | 110 +++
.../sczx/pay/exception/InnerException.java | 86 ++
.../pay/mapper/CompanyAlipayConfigMapper.java | 22 +
.../pay/mapper/CompanyWechatConfigMapper.java | 22 +
.../com/sczx/pay/mapper/OrderPayMapper.java | 73 ++
.../pay/mapper/PaymentNotifyRecordMapper.java | 28 +
.../sczx/pay/mapper/PaymentRecordMapper.java | 62 ++
.../sczx/pay/mapper/RefundRecordMapper.java | 39 +
.../sczx/pay/mapper/RentRuleItemMapper.java | 30 +
src/main/java/com/sczx/pay/sdk/WXPay.java | 315 ++++++++
.../java/com/sczx/pay/sdk/WXPayConfig.java | 54 ++
.../pay/service/AliPayOrderCloseService.java | 15 +
.../AliPayOrderFulfillmentService.java | 25 +
.../sczx/pay/service/AlipayRentService.java | 23 +
.../com/sczx/pay/service/AlipayService.java | 47 ++
.../sczx/pay/service/WechatPayService.java | 564 ++++++++++++++
.../impl/AliPayOrderCloseServiceImpl.java | 66 ++
.../AliPayOrderFulfillmentServiceImpl.java | 82 ++
.../service/impl/AlipayRentServiceImpl.java | 196 +++++
.../pay/service/impl/AlipayServiceImpl.java | 469 +++++++++++
.../sczx/pay/thirdpart/dto/req/CarDTO.java | 132 ++++
.../thirdpart/dto/req/CarModelSimpleDTO.java | 40 +
.../thirdpart/dto/req/CompanyStoreDTO.java | 68 ++
.../pay/thirdpart/dto/req/OrderCarImgDTO.java | 16 +
.../sczx/pay/thirdpart/dto/req/OrderDTO.java | 144 ++++
.../pay/thirdpart/dto/req/OrderDetailDTO.java | 176 +++++
.../pay/thirdpart/dto/req/OrderSubDTO.java | 49 ++
.../pay/thirdpart/dto/req/PayOrderDTO.java | 30 +
.../thirdpart/dto/req/RentBatteyRuleDTO.java | 91 +++
.../pay/thirdpart/facade/OrderFacade.java | 18 +
.../pay/thirdpart/integration/OrderInteg.java | 35 +
.../com/sczx/pay/utils/AlipayApiCallback.java | 21 +
.../com/sczx/pay/utils/AlipayApiTemplate.java | 50 ++
.../com/sczx/pay/utils/AlipaySdkUtil.java | 242 ++++++
.../java/com/sczx/pay/utils/ComputerInfo.java | 159 ++++
src/main/java/com/sczx/pay/utils/IPUtils.java | 135 ++++
.../java/com/sczx/pay/utils/WXPayUtil.java | 243 ++++++
src/main/resources/application-dev.yml | 67 ++
src/main/resources/application-local.yml | 67 ++
src/main/resources/application.yml | 117 +++
src/main/resources/logback.xml | 53 ++
.../resources/mapper/RentRuleItemMapper.xml | 341 ++++++++
105 files changed, 10519 insertions(+)
create mode 100644 .gitignore
create mode 100644 Dockerfile
create mode 100644 Dockerfile.buildagent
create mode 100644 Jenkinsfile
create mode 100644 pom.xml
create mode 100644 settings.xml
create mode 100644 src/main/java/com/sczx/pay/Application.java
create mode 100644 src/main/java/com/sczx/pay/alipay/controller/ItemController.java
create mode 100644 src/main/java/com/sczx/pay/alipay/controller/ItemOrderController.java
create mode 100644 src/main/java/com/sczx/pay/alipay/dto/RentItemCreateRequest.java
create mode 100644 src/main/java/com/sczx/pay/alipay/po/RentCommodityConfig.java
create mode 100644 src/main/java/com/sczx/pay/alipay/po/RentRuleItem.java
create mode 100644 src/main/java/com/sczx/pay/alipay/service/ImageUploadService.java
create mode 100644 src/main/java/com/sczx/pay/alipay/service/ItemService.java
create mode 100644 src/main/java/com/sczx/pay/alipay/service/RentOrderService.java
create mode 100644 src/main/java/com/sczx/pay/alipay/service/RentRuleItemService.java
create mode 100644 src/main/java/com/sczx/pay/alipay/service/impl/ImageUploadServiceImpl.java
create mode 100644 src/main/java/com/sczx/pay/alipay/service/impl/ItemServiceImpl.java
create mode 100644 src/main/java/com/sczx/pay/alipay/service/impl/RentOrderServiceImpl.java
create mode 100644 src/main/java/com/sczx/pay/alipay/service/impl/RentRuleItemServiceImpl.java
create mode 100644 src/main/java/com/sczx/pay/alipay/vo/AppItemSkuAttrVo.java
create mode 100644 src/main/java/com/sczx/pay/alipay/vo/ImageDirectoryRequest.java
create mode 100644 src/main/java/com/sczx/pay/alipay/vo/ItemCreateRequest.java
create mode 100644 src/main/java/com/sczx/pay/alipay/vo/OpenResponse.java
create mode 100644 src/main/java/com/sczx/pay/alipay/vo/RentOrderCreateRequest.java
create mode 100644 src/main/java/com/sczx/pay/aspect/FacadeAspect.java
create mode 100644 src/main/java/com/sczx/pay/aspect/WebLogAspect.java
create mode 100644 src/main/java/com/sczx/pay/common/IApiCode.java
create mode 100644 src/main/java/com/sczx/pay/common/Result.java
create mode 100644 src/main/java/com/sczx/pay/common/constant/SystemConstants.java
create mode 100644 src/main/java/com/sczx/pay/common/enums/ApiErrorCode.java
create mode 100644 src/main/java/com/sczx/pay/config/AlipayConf.java
create mode 100644 src/main/java/com/sczx/pay/config/DynamicWXPayConfig.java
create mode 100644 src/main/java/com/sczx/pay/config/SwaggerConfig.java
create mode 100644 src/main/java/com/sczx/pay/config/WXPayConfigImpl.java
create mode 100644 src/main/java/com/sczx/pay/controller/AliPayNotifyController.java
create mode 100644 src/main/java/com/sczx/pay/controller/AliPayOrderCloseController.java
create mode 100644 src/main/java/com/sczx/pay/controller/AliPayOrderFulfillmentController.java
create mode 100644 src/main/java/com/sczx/pay/controller/AliPaymentController.java
create mode 100644 src/main/java/com/sczx/pay/controller/AlipayRentController.java
create mode 100644 src/main/java/com/sczx/pay/controller/AlipayRentNotifyController.java
create mode 100644 src/main/java/com/sczx/pay/controller/PaymentController.java
create mode 100644 src/main/java/com/sczx/pay/dto/AlipayCloseRequest.java
create mode 100644 src/main/java/com/sczx/pay/dto/AlipayCreateRequest.java
create mode 100644 src/main/java/com/sczx/pay/dto/AlipayCreateResponse.java
create mode 100644 src/main/java/com/sczx/pay/dto/AlipayQueryRequest.java
create mode 100644 src/main/java/com/sczx/pay/dto/AlipayQueryResponse.java
create mode 100644 src/main/java/com/sczx/pay/dto/AlipayRefundRequest.java
create mode 100644 src/main/java/com/sczx/pay/dto/AlipayResponse.java
create mode 100644 src/main/java/com/sczx/pay/dto/PaymentRequest.java
create mode 100644 src/main/java/com/sczx/pay/dto/PaymentResponse.java
create mode 100644 src/main/java/com/sczx/pay/dto/RefundRequest.java
create mode 100644 src/main/java/com/sczx/pay/dto/ali/rent/AlipayRentPayReq.java
create mode 100644 src/main/java/com/sczx/pay/dto/ali/rent/AlipayRentPayResponse.java
create mode 100644 src/main/java/com/sczx/pay/entity/CompanyAlipayConfig.java
create mode 100644 src/main/java/com/sczx/pay/entity/CompanyWechatConfig.java
create mode 100644 src/main/java/com/sczx/pay/entity/OrderMain.java
create mode 100644 src/main/java/com/sczx/pay/entity/OrderSub.java
create mode 100644 src/main/java/com/sczx/pay/entity/PayStatus.java
create mode 100644 src/main/java/com/sczx/pay/entity/PaymentNotifyRecord.java
create mode 100644 src/main/java/com/sczx/pay/entity/PaymentRecord.java
create mode 100644 src/main/java/com/sczx/pay/entity/ReasonCodes.java
create mode 100644 src/main/java/com/sczx/pay/entity/RefundRecord.java
create mode 100644 src/main/java/com/sczx/pay/entity/RefundStatus.java
create mode 100644 src/main/java/com/sczx/pay/exception/InnerException.java
create mode 100644 src/main/java/com/sczx/pay/mapper/CompanyAlipayConfigMapper.java
create mode 100644 src/main/java/com/sczx/pay/mapper/CompanyWechatConfigMapper.java
create mode 100644 src/main/java/com/sczx/pay/mapper/OrderPayMapper.java
create mode 100644 src/main/java/com/sczx/pay/mapper/PaymentNotifyRecordMapper.java
create mode 100644 src/main/java/com/sczx/pay/mapper/PaymentRecordMapper.java
create mode 100644 src/main/java/com/sczx/pay/mapper/RefundRecordMapper.java
create mode 100644 src/main/java/com/sczx/pay/mapper/RentRuleItemMapper.java
create mode 100644 src/main/java/com/sczx/pay/sdk/WXPay.java
create mode 100644 src/main/java/com/sczx/pay/sdk/WXPayConfig.java
create mode 100644 src/main/java/com/sczx/pay/service/AliPayOrderCloseService.java
create mode 100644 src/main/java/com/sczx/pay/service/AliPayOrderFulfillmentService.java
create mode 100644 src/main/java/com/sczx/pay/service/AlipayRentService.java
create mode 100644 src/main/java/com/sczx/pay/service/AlipayService.java
create mode 100644 src/main/java/com/sczx/pay/service/WechatPayService.java
create mode 100644 src/main/java/com/sczx/pay/service/impl/AliPayOrderCloseServiceImpl.java
create mode 100644 src/main/java/com/sczx/pay/service/impl/AliPayOrderFulfillmentServiceImpl.java
create mode 100644 src/main/java/com/sczx/pay/service/impl/AlipayRentServiceImpl.java
create mode 100644 src/main/java/com/sczx/pay/service/impl/AlipayServiceImpl.java
create mode 100644 src/main/java/com/sczx/pay/thirdpart/dto/req/CarDTO.java
create mode 100644 src/main/java/com/sczx/pay/thirdpart/dto/req/CarModelSimpleDTO.java
create mode 100644 src/main/java/com/sczx/pay/thirdpart/dto/req/CompanyStoreDTO.java
create mode 100644 src/main/java/com/sczx/pay/thirdpart/dto/req/OrderCarImgDTO.java
create mode 100644 src/main/java/com/sczx/pay/thirdpart/dto/req/OrderDTO.java
create mode 100644 src/main/java/com/sczx/pay/thirdpart/dto/req/OrderDetailDTO.java
create mode 100644 src/main/java/com/sczx/pay/thirdpart/dto/req/OrderSubDTO.java
create mode 100644 src/main/java/com/sczx/pay/thirdpart/dto/req/PayOrderDTO.java
create mode 100644 src/main/java/com/sczx/pay/thirdpart/dto/req/RentBatteyRuleDTO.java
create mode 100644 src/main/java/com/sczx/pay/thirdpart/facade/OrderFacade.java
create mode 100644 src/main/java/com/sczx/pay/thirdpart/integration/OrderInteg.java
create mode 100644 src/main/java/com/sczx/pay/utils/AlipayApiCallback.java
create mode 100644 src/main/java/com/sczx/pay/utils/AlipayApiTemplate.java
create mode 100644 src/main/java/com/sczx/pay/utils/AlipaySdkUtil.java
create mode 100644 src/main/java/com/sczx/pay/utils/ComputerInfo.java
create mode 100644 src/main/java/com/sczx/pay/utils/IPUtils.java
create mode 100644 src/main/java/com/sczx/pay/utils/WXPayUtil.java
create mode 100644 src/main/resources/application-dev.yml
create mode 100644 src/main/resources/application-local.yml
create mode 100644 src/main/resources/application.yml
create mode 100644 src/main/resources/logback.xml
create mode 100644 src/main/resources/mapper/RentRuleItemMapper.xml
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0d7f4db
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,35 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+logs/
+src/main/resources/rebel.xml
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..fd863fa
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,10 @@
+# 使用 OpenJDK 8 镜像构建
+FROM openjdk:8-jdk
+# 添加作者信息
+LABEL maintainer="123879394@qq.com"
+
+WORKDIR /app
+# 复制 jar 包
+COPY target/*.jar app.jar
+# 设置 JVM 参数和启动命令
+ENTRYPOINT ["java", "-jar", "-Xms64m", "-Xmx128m", "app.jar"]
\ No newline at end of file
diff --git a/Dockerfile.buildagent b/Dockerfile.buildagent
new file mode 100644
index 0000000..f893f6c
--- /dev/null
+++ b/Dockerfile.buildagent
@@ -0,0 +1,15 @@
+# 使用 JDK 8 作为构建环境
+FROM openjdk:8-jdk
+
+# 使用阿里云的 apt 镜像源(Debian 11 bullseye)
+RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
+ sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
+
+# 更新包列表并安装 Maven 和 Git
+RUN apt update && \
+ apt install -y maven git && \
+ mvn --version && \
+ git --version
+
+# 设置工作目录
+WORKDIR /home/jenkins/workspace
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..8aca357
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,88 @@
+pipeline {
+ agent any
+// tools {
+// maven 'M3' // 必须在 Jenkins → Manage Jenkins → Global Tool Configuration 中配置过
+// }
+ environment {
+ APP_NAME = "sczx_notify"
+ DOCKER_IMAGE = "${APP_NAME}:latest"
+ CONTAINER_NAME = "${APP_NAME}-container"
+ }
+
+ stages {
+// stage('Checkout') {
+// steps {
+// echo "📦 正在拉取代码..."
+// git branch: 'main', url: 'http://115.190.8.52:3000/sczx_group/sczx_order.git'
+// }
+// }
+
+ stage('Build with Maven in JDK 8') {
+ agent {
+ dockerfile {
+ filename "Dockerfile.buildagent"
+ }
+ }
+ steps {
+ echo "🛠️ 正在使用 Maven 构建..."
+ sh 'mvn clean package -s settings.xml'
+ }
+ }
+
+ stage('Check Jar File') {
+ agent any
+ steps {
+ sh 'ls -la target/' // 确保 jar 文件存在
+ }
+ }
+
+ stage('Build Docker Image') {
+ agent any
+ steps {
+ echo "🐋 正在构建 Docker 镜像..."
+ sh 'docker build -t "$DOCKER_IMAGE" .'
+ }
+ }
+
+ stage('Stop Old Container') {
+ agent any
+ steps {
+ echo "🛑 正在停止旧的容器(如果存在)..."
+ sh '''
+ if [ "$(docker ps -f 'name=sczx_notify-container' --format '{{.Status}}')" ]; then
+ docker stop sczx_notify-container
+ docker rm sczx_notify-container
+ fi
+ '''
+ }
+ }
+
+ stage('Run New Container') {
+ agent any
+ steps {
+ echo "🟢 正在运行新的容器..."
+ sh """
+ docker run -d \
+ --name \${CONTAINER_NAME} \
+ --network sczx-net \
+ -p 8019:8019 \
+ -e JAVA_OPTS="-Xms256m -Xmx512m -Duser.timezone=Asia/Shanghai" \
+ -e TZ=Asia/Shanghai \
+ -v /etc/localtime:/etc/localtime:ro \
+ -v /root/cert:/root/cert:ro \
+ --restart always \
+ \${DOCKER_IMAGE}
+ """
+ }
+ }
+ }
+
+ post {
+ success {
+ echo "🎉 构建成功!"
+ }
+ failure {
+ echo "❌ 构建失败,请检查日志!"
+ }
+ }
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..23578b5
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,320 @@
+
+
+ 4.0.0
+
+ com.sczx
+ sczx_notify
+ 1.0.0
+ jar
+
+ sczx_notify
+ sczx_notify service
+
+
+ 1.8
+ 2.3.12.RELEASE
+ Hoxton.SR12
+ 2.2.9.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.3.12.RELEASE
+
+
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-alibaba-dependencies
+ ${spring-cloud-alibaba.version}
+ pom
+ import
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+
+
+
+ org.springframework.cloud
+ spring-cloud-commons
+
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.30
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-openfeign
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-netflix-hystrix
+
+
+
+
+ org.springframework.retry
+ spring-retry
+ 1.3.1
+
+
+
+ org.springframework.boot
+ spring-boot-starter-aop
+
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 2.3.1
+
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.5.3.1
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+
+
+ mysql
+ mysql-connector-java
+ 8.0.33
+
+
+
+
+ io.springfox
+ springfox-swagger2
+ 2.9.2
+
+
+
+ io.springfox
+ springfox-swagger-ui
+ 2.9.2
+
+
+
+
+ javax.xml.bind
+ jaxb-api
+ 2.3.1
+
+
+
+ io.projectreactor
+ reactor-core
+ 3.2.2.RELEASE
+
+
+
+
+ org.mapstruct
+ mapstruct
+ 1.5.5.Final
+
+
+
+
+ org.mapstruct
+ mapstruct-processor
+ 1.5.5.Final
+ provided
+
+
+
+
+ com.alibaba
+ fastjson
+ 1.2.83
+
+
+
+
+ com.github.wechatpay-apiv3
+ wechatpay-java
+ 0.2.14
+
+
+ com.alipay.sdk
+ alipay-sdk-java
+ 4.39.79.ALL
+
+
+ com.alipay.sdk
+ alipay-sdk-java-v3
+ 2.9.0.ALL
+
+
+
+ com.github.xiaoymin
+ knife4j-spring-boot-starter
+ 2.0.2
+
+
+
+ commons-codec
+ commons-codec
+ 1.15
+
+
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.13
+
+
+
+
+ org.apache.httpcomponents
+ httpcore
+ 4.4.14
+
+
+
+
+ org.apache.httpcomponents
+ httpmime
+ 4.5.13
+
+
+
+
+
+
+
+
+ com.alipay.sdk
+ alipay-sdk-java
+ 4.40.427.ALL
+
+
+
+ net.coobird
+ thumbnailator
+ 0.4.17
+
+
+
+
+
+
+ sczx_singlepay
+
+
+ src/main/resources
+
+ *.yml
+
+ true
+
+
+ src/main/resources
+
+ *.yml
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ ${java.version}
+ ${java.version}
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 2.3.12.RELEASE
+
+
+
+ repackage
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+ true
+
+
+
+
+
+
\ No newline at end of file
diff --git a/settings.xml b/settings.xml
new file mode 100644
index 0000000..06004f8
--- /dev/null
+++ b/settings.xml
@@ -0,0 +1,12 @@
+
+
+
+ aliyun-maven
+ *
+ Aliyun Maven
+ https://maven.aliyun.com/repository/public
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/sczx/pay/Application.java b/src/main/java/com/sczx/pay/Application.java
new file mode 100644
index 0000000..19037b3
--- /dev/null
+++ b/src/main/java/com/sczx/pay/Application.java
@@ -0,0 +1,34 @@
+package com.sczx.pay;
+
+import com.sczx.pay.common.constant.SystemConstants;
+import com.sczx.pay.utils.ComputerInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+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.core.env.Environment;
+import org.springframework.retry.annotation.EnableRetry;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import java.io.IOException;
+
+@Slf4j
+@SpringBootApplication
+@EnableDiscoveryClient // 启用服务注册与发现
+@EnableRetry
+@EnableFeignClients(basePackages = SystemConstants.FEIGN_CLIENT_BASE_PACKAGE )
+@EnableTransactionManagement
+@EnableHystrix
+@MapperScan("com.sczx.pay.mapper") // 扫描 Mapper 接口
+public class Application {
+
+ public static void main(String[] args) throws IOException {
+ ConfigurableApplicationContext context = SpringApplication.run(Application.class, args);
+ Environment environment = context.getBean(Environment.class);
+ log.info("启动成功,后端服务API地址:http://{}:{}/swagger-ui.html", ComputerInfo.getIpAddr(), environment.getProperty("server.port"));
+ }
+}
diff --git a/src/main/java/com/sczx/pay/alipay/controller/ItemController.java b/src/main/java/com/sczx/pay/alipay/controller/ItemController.java
new file mode 100644
index 0000000..f05c0d4
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/controller/ItemController.java
@@ -0,0 +1,131 @@
+package com.sczx.pay.alipay.controller;
+
+import com.alipay.api.domain.AppxCategoryVO;
+import com.alipay.api.internal.util.StringUtils;
+import com.alipay.api.response.AlipayOpenAppItemListQueryResponse;
+import com.alipay.api.response.AlipayOpenAppItemQueryResponse;
+import com.alipay.api.response.AlipayOpenAppItemTemplateQueryResponse;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.sczx.pay.alipay.po.RentRuleItem;
+import com.sczx.pay.alipay.service.ItemService;
+import com.sczx.pay.alipay.service.RentRuleItemService;
+import com.sczx.pay.alipay.vo.ItemCreateRequest;
+import com.sczx.pay.alipay.vo.OpenResponse;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+import java.util.List;
+import java.util.Map;
+
+
+@Api(tags = "普通商品模块")
+@RestController
+@RequestMapping(value = "/item")
+public class ItemController {
+
+ @Autowired
+ private ItemService itemService;
+
+ @Autowired
+ private RentRuleItemService rentRuleItemService;
+
+ /**
+ * 类目查询
+ * 获取叶子节点商品类目列表
+ */
+ @ApiOperationSupport(order = 1)
+ @ApiOperation(value = "类目查询", notes = "获取叶子节点商品类目列表")
+ @GetMapping(value = "/category/list")
+ public OpenResponse> categoryList(
+ @ApiParam(value = "商品类型:1-售卖类(实物),2-租赁类(实物),3-付费充值/兑换类(虚拟)") @RequestParam String itemType,
+ @ApiParam(value = "类目状态,默认AUDIT_PASSED", example = "AUDIT_PASSED") @RequestParam(required = false) String catStatus) {
+ return itemService.getCategories(itemType, catStatus);
+ }
+
+ /**
+ * 普通商品模板信息查询
+ */
+ @ApiOperationSupport(order = 2)
+ @ApiOperation(value = "普通商品模板信息查询")
+ @GetMapping(value = "/template/query")
+ public OpenResponse queryTemplate(
+ @ApiParam(value = "类目ID", required = true) @RequestParam String categoryId,
+ @ApiParam(value = "商品类型:1-售卖类(实物),2-租赁类(实物),3-付费充值/兑换类(虚拟)") @RequestParam(required = false) String itemType) {
+ return itemService.queryTemplate(categoryId, itemType);
+ }
+
+
+
+ /**
+ * 租赁类(实物)商品创建
+ */
+ @ApiOperation(value = "租赁类(实物)商品创建")
+ @ApiOperationSupport(order = 4)
+ @PostMapping(value = "/rent/create")
+ public OpenResponse rentCreate(@RequestBody RentRuleItem request) {
+ return itemService.createRentItem(request);
+ }
+
+
+ @PostMapping(value = "/rent/modify")
+ public OpenResponse modifyCreate(@RequestBody RentRuleItem request) {
+ return itemService.modifyItem(request);
+ }
+
+ @ApiOperation(value = "商品详情查询")
+ @ApiOperationSupport(order = 7)
+ @GetMapping(value = "/query")
+ public OpenResponse query(@ApiParam(value = "支付平台侧商品ID") @RequestParam(required = false) String itemId,
+ @ApiParam(value = "商家侧商品ID") @RequestParam(required = false) String outItemId,
+ @ApiParam(value = "是否查询编辑版本,默认为0", defaultValue = "0") @RequestParam(required = false) String needEditSpu) {
+ return itemService.queryItemDetail(itemId, outItemId,
+ StringUtils.isNumeric(needEditSpu) ? Long.parseLong(needEditSpu) : 0);
+ }
+
+ /**
+ * 租赁类(实物)履约模板创建
+ */
+ @ApiOperation(value = "租赁类(实物)履约模板创建")
+ @ApiOperationSupport(order = 4)
+ @PostMapping(value = "/template/create")
+ public OpenResponse templateCreate() {
+ return itemService.syncDeliveryInfo();
+ }
+
+ /**
+ * 租赁类(实物)履约模板创建
+ */
+ @ApiOperation(value = "租赁类(实物)履约模板创建")
+ @ApiOperationSupport(order = 4)
+ @PostMapping(value = "/delivery/query")
+ public OpenResponse deliveryQuery() {
+ return itemService.deliveryInfoQuery();
+ }
+
+ @ApiOperation(value = "租赁类(实物)履约模板创建")
+ @ApiOperationSupport(order = 4)
+ @PostMapping(value = "/deliverytemplate/query")
+ public OpenResponse deliveryTemplateQuery() {
+ return itemService.deliveryTemplateQuery();
+ }
+
+ @ApiOperation(value = "租赁类(实物)履约模板创建")
+ @ApiOperationSupport(order = 4)
+ @PostMapping(value = "/shop/query")
+ public OpenResponse shopQuery() {
+ return itemService.shopQuery();
+ }
+
+
+ @ApiOperation(value = "接收套餐数据并记录商品")
+ @GetMapping(value = "/sync/item")
+ public Map syncItem(@RequestParam(required = false) String brandId,@RequestParam(required = false) String carModelId,
+ @RequestParam(required = false) String carRuleId,@RequestParam(required = false) String batteryRuleId) {
+ return rentRuleItemService.syncItem(brandId, carModelId,carRuleId,batteryRuleId);
+ }
+
+}
diff --git a/src/main/java/com/sczx/pay/alipay/controller/ItemOrderController.java b/src/main/java/com/sczx/pay/alipay/controller/ItemOrderController.java
new file mode 100644
index 0000000..48c8f77
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/controller/ItemOrderController.java
@@ -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();
+
+ }
+}
diff --git a/src/main/java/com/sczx/pay/alipay/dto/RentItemCreateRequest.java b/src/main/java/com/sczx/pay/alipay/dto/RentItemCreateRequest.java
new file mode 100644
index 0000000..dbbf111
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/dto/RentItemCreateRequest.java
@@ -0,0 +1,291 @@
+package com.sczx.pay.alipay.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 实物租赁商品创建请求实体类
+ */
+public class RentItemCreateRequest implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ // 基本商品信息
+ private String outItemId;
+
+ @ApiModelProperty(value = "商品名称,最少不低于3个字,最长不超过60个字", required = true, example = "实物租赁商品创建示例")
+ private String title;
+
+ @ApiModelProperty(value = "商品主图,图片宽高为750px*750px,宽高比1:1,800kb以内", required = true,
+ example = "A*pHfaSaEsF_0AAAAAAAAAAAAAATcnAQ")
+ private String headImg;
+
+ @ApiModelProperty(value = "平台类目ID,多级类目只填最后一级", required = true, example = "C001375054")
+ private String categoryId;
+
+ @ApiModelProperty(value = "商品类型,租赁类(实物): 2", required = true, example = "2")
+ private String itemType;
+
+ @ApiModelProperty(value = "商品详情页URL,请填写您的小程序侧商品详情页链接")
+ private String path;
+
+ @ApiModelProperty(value = "商品子图,作为平台详情页组件的轮播图,最多3张")
+ private List imageList;
+
+ // SKU信息
+
+ @ApiModelProperty(value = "SKU数组")
+ private List skus;
+
+ // 商品属性
+
+ @ApiModelProperty(value = "商品属性")
+ private List attrs;
+
+ // Getters and Setters
+
+ public String getOutItemId() {
+ return outItemId;
+ }
+
+ public void setOutItemId(String outItemId) {
+ this.outItemId = outItemId;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getHeadImg() {
+ return headImg;
+ }
+
+ public void setHeadImg(String headImg) {
+ this.headImg = headImg;
+ }
+
+ public String getCategoryId() {
+ return categoryId;
+ }
+
+ public void setCategoryId(String categoryId) {
+ this.categoryId = categoryId;
+ }
+
+ public String getItemType() {
+ return itemType;
+ }
+
+ public void setItemType(String itemType) {
+ this.itemType = itemType;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public List getImageList() {
+ return imageList;
+ }
+
+ public void setImageList(List imageList) {
+ this.imageList = imageList;
+ }
+
+ public List getSkus() {
+ return skus;
+ }
+
+ public void setSkus(List skus) {
+ this.skus = skus;
+ }
+
+ public List getAttrs() {
+ return attrs;
+ }
+
+ public void setAttrs(List attrs) {
+ this.attrs = attrs;
+ }
+
+ /**
+ * 租赁SKU请求实体类
+ */
+ @ApiModel(value = "RentSkuRequest", description = "租赁SKU信息")
+ public static class RentSkuRequest {
+
+ @ApiModelProperty(value = "商家侧SKU ID,要求APPID下全局唯一", required = true)
+ private String outSkuId;
+
+ @ApiModelProperty(value = "售卖状态")
+ private String saleStatus;
+
+ @ApiModelProperty(value = "商品销售属性")
+ private List skuAttrs;
+
+ @ApiModelProperty(value = "SKU类型,枚举值:RENT(租赁sku)、SALE(售卖sku)", example = "RENT")
+ private String skuType;
+
+ @ApiModelProperty(value = "SKU售价,如果有起租天数总租金,该字段不用填写")
+ private Long salePrice;
+
+ @ApiModelProperty(value = "SKU原价,如果有起租天数总租金,该字段不用填写")
+ private Long originalPrice;
+
+ @ApiModelProperty(value = "SKU库存")
+ private Long stockNum;
+
+ @ApiModelProperty(value = "价格单元,租赁sku:元/日,售卖sku:元", example = "元/日")
+ private String priceUnit;
+
+ // Getters and Setters
+
+ public String getOutSkuId() {
+ return outSkuId;
+ }
+
+ public void setOutSkuId(String outSkuId) {
+ this.outSkuId = outSkuId;
+ }
+
+ public String getSaleStatus() {
+ return saleStatus;
+ }
+
+ public void setSaleStatus(String saleStatus) {
+ this.saleStatus = saleStatus;
+ }
+
+ public List getSkuAttrs() {
+ return skuAttrs;
+ }
+
+ public void setSkuAttrs(List skuAttrs) {
+ this.skuAttrs = skuAttrs;
+ }
+
+ public String getSkuType() {
+ return skuType;
+ }
+
+ public void setSkuType(String skuType) {
+ this.skuType = skuType;
+ }
+
+ public Long getSalePrice() {
+ return salePrice;
+ }
+
+ public void setSalePrice(Long salePrice) {
+ this.salePrice = salePrice;
+ }
+
+ public Long getOriginalPrice() {
+ return originalPrice;
+ }
+
+ public void setOriginalPrice(Long originalPrice) {
+ this.originalPrice = originalPrice;
+ }
+
+ public Long getStockNum() {
+ return stockNum;
+ }
+
+ public void setStockNum(Long stockNum) {
+ this.stockNum = stockNum;
+ }
+
+ public String getPriceUnit() {
+ return priceUnit;
+ }
+
+ public void setPriceUnit(String priceUnit) {
+ this.priceUnit = priceUnit;
+ }
+ }
+
+ /**
+ * SKU属性请求实体类 (sku_attrs 销售属性)
+ */
+ @ApiModel(value = "SkuAttrRequest", description = "SKU销售属性信息")
+ public static class SkuAttrRequest {
+
+ @ApiModelProperty(value = "销售属性key", required = true)
+ private String attrKey;
+
+ @ApiModelProperty(value = "销售属性类型,枚举值:spec(规格)、custom(自定义属性)", example = "custom")
+ private String attrType;
+
+ @ApiModelProperty(value = "销售属性值", required = true)
+ private String attrValue;
+
+ // Getters and Setters
+
+ public String getAttrKey() {
+ return attrKey;
+ }
+
+ public void setAttrKey(String attrKey) {
+ this.attrKey = attrKey;
+ }
+
+ public String getAttrType() {
+ return attrType;
+ }
+
+ public void setAttrType(String attrType) {
+ this.attrType = attrType;
+ }
+
+ public String getAttrValue() {
+ return attrValue;
+ }
+
+ public void setAttrValue(String attrValue) {
+ this.attrValue = attrValue;
+ }
+ }
+
+ /**
+ * 商品属性请求实体类 (attrs 商品属性)
+ */
+ @ApiModel(value = "ItemAttrRequest", description = "商品属性信息")
+ public static class ItemAttrRequest {
+
+ @ApiModelProperty(value = "商品属性key", required = true)
+ private String attrKey;
+
+ @ApiModelProperty(value = "商品属性值", required = true)
+ private String attrValue;
+
+ // Getters and Setters
+
+ public String getAttrKey() {
+ return attrKey;
+ }
+
+ public void setAttrKey(String attrKey) {
+ this.attrKey = attrKey;
+ }
+
+ public String getAttrValue() {
+ return attrValue;
+ }
+
+ public void setAttrValue(String attrValue) {
+ this.attrValue = attrValue;
+ }
+ }
+}
diff --git a/src/main/java/com/sczx/pay/alipay/po/RentCommodityConfig.java b/src/main/java/com/sczx/pay/alipay/po/RentCommodityConfig.java
new file mode 100644
index 0000000..437eb35
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/po/RentCommodityConfig.java
@@ -0,0 +1,163 @@
+package com.sczx.pay.alipay.po;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 租赁商品配置实体类
+ */
+public class RentCommodityConfig {
+
+ /**
+ * 商品名称
+ */
+ private String name;
+
+ /**
+ * 商品描述
+ */
+ private String description;
+
+ /**
+ * 是否自定义租赁 (0:否, 1:是)
+ */
+ private String customLease;
+
+ /**
+ * 斜率公式
+ */
+ private String slopeFormula;
+
+ /**
+ * 时间单位
+ */
+ private String durationUnit;
+
+ /**
+ * 买断价格
+ */
+ private String buyoutPrice;
+
+ /**
+ * 价格单位
+ */
+ private String priceUnit;
+
+ /**
+ * 时段价格列表
+ */
+ private List durationPriceList;
+
+ // Getters and Setters
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getCustomLease() {
+ return customLease;
+ }
+
+ public void setCustomLease(String customLease) {
+ this.customLease = customLease;
+ }
+
+ public String getSlopeFormula() {
+ return slopeFormula;
+ }
+
+ public void setSlopeFormula(String slopeFormula) {
+ this.slopeFormula = slopeFormula;
+ }
+
+ public String getDurationUnit() {
+ return durationUnit;
+ }
+
+ public void setDurationUnit(String durationUnit) {
+ this.durationUnit = durationUnit;
+ }
+
+ public String getBuyoutPrice() {
+ return buyoutPrice;
+ }
+
+ public void setBuyoutPrice(String buyoutPrice) {
+ this.buyoutPrice = buyoutPrice;
+ }
+
+ public String getPriceUnit() {
+ return priceUnit;
+ }
+
+ public void setPriceUnit(String priceUnit) {
+ this.priceUnit = priceUnit;
+ }
+
+ public List getDurationPriceList() {
+ return durationPriceList;
+ }
+
+ public void setDurationPriceList(List durationPriceList) {
+ this.durationPriceList = durationPriceList;
+ }
+
+ /**
+ * 时段价格实体类
+ */
+ public static class DurationPrice {
+
+ /**
+ * 时段
+ */
+ private String duration;
+
+ /**
+ * 总原价
+ */
+ private String totalOriginalPrice;
+
+ /**
+ * 总售价
+ */
+ private String totalSalePrice;
+
+ // Getters and Setters
+
+ public String getDuration() {
+ return duration;
+ }
+
+ public void setDuration(String duration) {
+ this.duration = duration;
+ }
+
+ public String getTotalOriginalPrice() {
+ return totalOriginalPrice;
+ }
+
+ public void setTotalOriginalPrice(String totalOriginalPrice) {
+ this.totalOriginalPrice = totalOriginalPrice;
+ }
+
+ public String getTotalSalePrice() {
+ return totalSalePrice;
+ }
+
+ public void setTotalSalePrice(String totalSalePrice) {
+ this.totalSalePrice = totalSalePrice;
+ }
+ }
+}
diff --git a/src/main/java/com/sczx/pay/alipay/po/RentRuleItem.java b/src/main/java/com/sczx/pay/alipay/po/RentRuleItem.java
new file mode 100644
index 0000000..e41cfcb
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/po/RentRuleItem.java
@@ -0,0 +1,314 @@
+package com.sczx.pay.alipay.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 车型租赁规则项实体类
+ */
+@Data
+public class RentRuleItem implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 车型ID
+ */
+ private Long id;
+
+ /**
+ * 外部商品ID
+ */
+ private String outItemId;
+
+ /**
+ * 阿里商品ID
+ */
+ private String aliItemId;
+
+ /**
+ * 外部SKU ID
+ */
+ private String outSkuId;
+
+ /**
+ * 商品描述
+ */
+ private String itemDesc;
+
+ /**
+ * 品牌名称
+ */
+ private String brandName;
+
+ /**
+ * 车型名称
+ */
+ private String modelName;
+
+ /**
+ * 电池类别名称
+ */
+ private String categoryName;
+
+ /**
+ * 租赁天数(当类型为"按天数"时使用)
+ */
+ private Integer rentalDays;
+
+ /**
+ * 套餐类型
+ */
+ private String rentType;
+
+ /**
+ * 套餐名称
+ */
+ private String ruleName;
+
+
+ private String pagePath;
+ /**
+ * 车型照片
+ */
+ private String image;
+
+ /**
+ * 车型照片列表1
+ */
+ private String imageList1;
+
+ /**
+ * 车型照片列表2
+ */
+ private String imageList2;
+
+ /**
+ * 车型照片列表3
+ */
+ private String imageList3;
+
+ /**
+ * 是否支持免押(0不支持 1支持)
+ */
+ private String depositFree;
+
+ /**
+ * 押金价格(元)
+ */
+ private BigDecimal depositPrice;
+
+ /**
+ * 租车价格(元)
+ */
+ private BigDecimal rentalPrice;
+
+ /**
+ * 电池规则ID
+ */
+ private Long batteryRuleId;
+
+ /**
+ * 车辆规则ID
+ */
+ private Long carRuleId;
+
+ /**
+ * 车型ID
+ */
+ private Long carModelId;
+
+ /**
+ * 品牌ID
+ */
+ private Long brandId;
+
+ // Getters and Setters
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getOutItemId() {
+ return outItemId;
+ }
+
+ public void setOutItemId(String outItemId) {
+ this.outItemId = outItemId;
+ }
+
+ public String getAliItemId() {
+ return aliItemId;
+ }
+
+ public void setAliItemId(String aliItemId) {
+ this.aliItemId = aliItemId;
+ }
+
+ public String getOutSkuId() {
+ return outSkuId;
+ }
+
+ public void setOutSkuId(String outSkuId) {
+ this.outSkuId = outSkuId;
+ }
+
+ public String getItemDesc() {
+ return itemDesc;
+ }
+
+ public void setItemDesc(String itemDesc) {
+ this.itemDesc = itemDesc;
+ }
+
+ public String getBrandName() {
+ return brandName;
+ }
+
+ public void setBrandName(String brandName) {
+ this.brandName = brandName;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getCategoryName() {
+ return categoryName;
+ }
+
+ public void setCategoryName(String categoryName) {
+ this.categoryName = categoryName;
+ }
+
+ public Integer getRentalDays() {
+ return rentalDays;
+ }
+
+ public void setRentalDays(Integer rentalDays) {
+ this.rentalDays = rentalDays;
+ }
+
+ public String getRentType() {
+ return rentType;
+ }
+
+ public void setRentType(String rentType) {
+ this.rentType = rentType;
+ }
+
+ public String getRuleName() {
+ return ruleName;
+ }
+
+ public void setRuleName(String ruleName) {
+ this.ruleName = ruleName;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ public String getImageList1() {
+ return imageList1;
+ }
+
+ public void setImageList1(String imageList1) {
+ this.imageList1 = imageList1;
+ }
+
+ public String getImageList2() {
+ return imageList2;
+ }
+
+ public void setImageList2(String imageList2) {
+ this.imageList2 = imageList2;
+ }
+
+ public String getImageList3() {
+ return imageList3;
+ }
+
+ public void setImageList3(String imageList3) {
+ this.imageList3 = imageList3;
+ }
+
+ public String getDepositFree() {
+ return depositFree;
+ }
+
+ public void setDepositFree(String depositFree) {
+ this.depositFree = depositFree;
+ }
+
+ public BigDecimal getDepositPrice() {
+ return depositPrice;
+ }
+
+ public void setDepositPrice(BigDecimal depositPrice) {
+ this.depositPrice = depositPrice;
+ }
+
+ public BigDecimal getRentalPrice() {
+ return rentalPrice;
+ }
+
+ public void setRentalPrice(BigDecimal rentalPrice) {
+ this.rentalPrice = rentalPrice;
+ }
+
+ public Long getBatteryRuleId() {
+ return batteryRuleId;
+ }
+
+ public void setBatteryRuleId(Long batteryRuleId) {
+ this.batteryRuleId = batteryRuleId;
+ }
+
+ public Long getCarRuleId() {
+ return carRuleId;
+ }
+
+ public void setCarRuleId(Long carRuleId) {
+ this.carRuleId = carRuleId;
+ }
+
+ public Long getCarModelId() {
+ return carModelId;
+ }
+
+ public void setCarModelId(Long carModelId) {
+ this.carModelId = carModelId;
+ }
+
+ public Long getBrandId() {
+ return brandId;
+ }
+
+ public void setBrandId(Long brandId) {
+ this.brandId = brandId;
+ }
+
+ public String getPagePath() {
+ return pagePath;
+ }
+
+ public void setPagePath(String pagePath) {
+ this.pagePath = pagePath;
+ }
+
+
+}
diff --git a/src/main/java/com/sczx/pay/alipay/service/ImageUploadService.java b/src/main/java/com/sczx/pay/alipay/service/ImageUploadService.java
new file mode 100644
index 0000000..d24973e
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/service/ImageUploadService.java
@@ -0,0 +1,47 @@
+package com.sczx.pay.alipay.service;
+
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.response.AlipayMarketingImageListQueryResponse;
+import com.alipay.api.response.AlipayMarketingImagedirectoryListQueryResponse;
+import com.sczx.pay.alipay.vo.ImageDirectoryRequest;
+import com.sczx.pay.alipay.vo.OpenResponse;
+
+import java.util.List;
+
+
+public interface ImageUploadService {
+ /**
+ * 上传图片,返回imageId
+ */
+ String uploadAndReturnId(String imagePath, String uploadScene) throws AlipayApiException;
+
+ /**
+ * 创建图片空间目录
+ */
+ OpenResponse createImageDirectory(ImageDirectoryRequest createRequest);
+
+ /**
+ * 修改图片空间目录
+ */
+ OpenResponse updateImageDirectory(ImageDirectoryRequest updateRequest);
+
+ /**
+ * 分页查询图片空间目录
+ */
+ OpenResponse queryImageDirectoryList(Long pageNum, Long pageSize, ImageDirectoryRequest queryRequest);
+
+ /**
+ * 修改图片信息
+ */
+ OpenResponse updateImage(String imageIndexId, String fileName, String imageDirectoryId);
+
+ /**
+ * 分页查询图片
+ */
+ OpenResponse queryImageList(Long pageNum, Long pageSize, String imageIndexId, String fileName, String imageDirectoryId);
+
+ /**
+ * 删除图片
+ */
+ OpenResponse deleteImage(List imageIndexIdList);
+}
diff --git a/src/main/java/com/sczx/pay/alipay/service/ItemService.java b/src/main/java/com/sczx/pay/alipay/service/ItemService.java
new file mode 100644
index 0000000..4a55768
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/service/ItemService.java
@@ -0,0 +1,44 @@
+package com.sczx.pay.alipay.service;
+
+import com.alipay.api.domain.AppxCategoryVO;
+import com.alipay.api.response.AlipayOpenAppItemListQueryResponse;
+import com.alipay.api.response.AlipayOpenAppItemQueryResponse;
+import com.alipay.api.response.AlipayOpenAppItemTemplateQueryResponse;
+import com.sczx.pay.alipay.po.RentRuleItem;
+import com.sczx.pay.alipay.vo.ItemCreateRequest;
+import com.sczx.pay.alipay.vo.OpenResponse;
+
+import java.util.List;
+
+public interface ItemService {
+ /**
+ * 获取叶子节点商品类目列表(默认获取类目状态为资质已开通的)
+ */
+ OpenResponse> getCategories(String itemType, String catStatus);
+
+ /**
+ * 查询普通商品模板信息
+ */
+ OpenResponse queryTemplate(String categoryId, String itemType);
+
+ /**
+ * 创建租赁类(实物)商品
+ */
+ OpenResponse createRentItem(RentRuleItem param);
+
+ OpenResponse modifyItem(RentRuleItem param);
+
+ /**
+ * 根据业务属性写死自提履约信息
+ */
+ OpenResponse syncDeliveryInfo();
+
+ OpenResponse deliveryInfoQuery();
+
+ OpenResponse deliveryTemplateQuery();
+
+ OpenResponse shopQuery();
+
+ OpenResponse queryItemDetail(String itemId, String outItemId, long needEditSpu);
+
+}
diff --git a/src/main/java/com/sczx/pay/alipay/service/RentOrderService.java b/src/main/java/com/sczx/pay/alipay/service/RentOrderService.java
new file mode 100644
index 0000000..d5c2e7a
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/service/RentOrderService.java
@@ -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;
+}
diff --git a/src/main/java/com/sczx/pay/alipay/service/RentRuleItemService.java b/src/main/java/com/sczx/pay/alipay/service/RentRuleItemService.java
new file mode 100644
index 0000000..4c28450
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/service/RentRuleItemService.java
@@ -0,0 +1,8 @@
+package com.sczx.pay.alipay.service;
+
+import java.util.Map;
+
+public interface RentRuleItemService {
+
+ Map syncItem(String brandId,String carModelId,String carRuleId,String batteryRuleId);
+}
diff --git a/src/main/java/com/sczx/pay/alipay/service/impl/ImageUploadServiceImpl.java b/src/main/java/com/sczx/pay/alipay/service/impl/ImageUploadServiceImpl.java
new file mode 100644
index 0000000..011d791
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/service/impl/ImageUploadServiceImpl.java
@@ -0,0 +1,348 @@
+package com.sczx.pay.alipay.service.impl;
+
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.FileItem;
+import com.alipay.api.domain.*;
+import com.alipay.api.internal.util.file.IOUtils;
+import com.alipay.api.request.*;
+import com.alipay.api.response.*;
+import com.sczx.pay.alipay.service.ImageUploadService;
+import com.sczx.pay.alipay.vo.ImageDirectoryRequest;
+import com.sczx.pay.alipay.vo.OpenResponse;
+import com.sczx.pay.utils.AlipayApiCallback;
+import com.sczx.pay.utils.AlipayApiTemplate;
+import com.sczx.pay.utils.AlipaySdkUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Base64;
+import java.util.List;
+import net.coobird.thumbnailator.Thumbnails;
+
+
+@Service
+public class ImageUploadServiceImpl implements ImageUploadService {
+ private static final Logger logger = LogManager.getLogger(ImageUploadServiceImpl.class);
+
+ @Autowired
+ private AlipaySdkUtil alipaySdkUtil;
+
+ @Override
+ public String uploadAndReturnId(String imagePath, String uploadScene) throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayMarketingImageEnhanceUploadRequest request = new AlipayMarketingImageEnhanceUploadRequest();
+
+ // 设置图片是否需要优化
+ request.setNeedEnhance(true);
+
+ // 设置图片上传场景
+ request.setUploadScene(uploadScene);
+
+ // 设置图片内容
+ try {
+ //String imageBase64 = getImageFromUrlAndConvertToBase64(imagePath);
+ String imageBase64 = getImageFromUrlAndConvertToBase64WithResize(imagePath, 750, 750);
+ FileItem imageContent = new FileItem("imageContent.jpg",Base64.getDecoder().decode(imageBase64));
+ request.setImageContent(imageContent);
+ } catch (IOException e) {
+ throw new AlipayApiException("alipay.marketing.image.enhance.upload调用失败:" + e);
+ }
+
+ try {
+ AlipayMarketingImageEnhanceUploadResponse response = alipaySdkUtil.execute(request);
+ logger.info(response.getBody());
+
+ if (response.isSuccess()) {
+ logger.info("alipay.marketing.image.enhance.upload调用成功");
+ return response.getImageId();
+ } else {
+ logger.error("alipay.marketing.image.enhance.upload调用失败");
+ throw new AlipayApiException("alipay.marketing.image.enhance.upload调用失败:" + response.getBody());
+ }
+ } catch (Exception e) {
+ logger.error("alipay.marketing.image.enhance.upload调用失败", e);
+ throw new AlipayApiException("alipay.marketing.image.enhance.upload调用失败:" + e);
+ }
+ }
+
+ @Override
+ public OpenResponse createImageDirectory(ImageDirectoryRequest createRequest) {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AlipayMarketingImagedirectoryCreateResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayMarketingImagedirectoryCreateRequest request = new AlipayMarketingImagedirectoryCreateRequest();
+ AlipayMarketingImagedirectoryCreateModel model = new AlipayMarketingImagedirectoryCreateModel();
+
+ // 设置目录名
+ model.setImageDirectoryName(createRequest.getImageDirectoryName());
+
+ // 设置归属父目录id
+ model.setParentDirectoryId(createRequest.getParentDirectoryId());
+
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public String getData(AlipayMarketingImagedirectoryCreateResponse response) {
+ return response.getImageDirectoryId();
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.marketing.imagedirectory.create";
+ }
+ });
+ }
+
+ @Override
+ public OpenResponse updateImageDirectory(ImageDirectoryRequest updateRequest) {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AlipayMarketingImagedirectoryModifyResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayMarketingImagedirectoryModifyRequest request = new AlipayMarketingImagedirectoryModifyRequest();
+ AlipayMarketingImagedirectoryModifyModel model = new AlipayMarketingImagedirectoryModifyModel();
+
+ // 设置目录id
+ model.setImageDirectoryId(updateRequest.getImageDirectoryId());
+
+ if (StringUtils.isNotBlank(updateRequest.getImageDirectoryName())) {
+ // 设置目录名
+ model.setImageDirectoryName(updateRequest.getImageDirectoryName());
+ }
+
+ if (StringUtils.isNotBlank(updateRequest.getParentDirectoryId())) {
+ // 设置父目录id
+ model.setParentDirectoryId(updateRequest.getParentDirectoryId());
+ }
+
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public Void getData(AlipayMarketingImagedirectoryModifyResponse response) {
+ return null;
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.marketing.imagedirectory.modify";
+ }
+ });
+ }
+
+ @Override
+ public OpenResponse queryImageDirectoryList(Long pageNum, Long pageSize, ImageDirectoryRequest queryRequest) {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AlipayMarketingImagedirectoryListQueryResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayMarketingImagedirectoryListQueryRequest request = new AlipayMarketingImagedirectoryListQueryRequest();
+ AlipayMarketingImagedirectoryListQueryModel model = new AlipayMarketingImagedirectoryListQueryModel();
+
+ // 设置页码
+ model.setPageNum(pageNum == null ? 1L : pageNum);
+
+ // 设置单页条数
+ model.setPageSize(pageSize == null ? 10L : pageSize);
+
+ if (StringUtils.isNotBlank(queryRequest.getImageDirectoryName())) {
+ // 设置目录名
+ model.setImageDirectoryName(queryRequest.getImageDirectoryName());
+ }
+
+ if (StringUtils.isNotBlank(queryRequest.getImageDirectoryId())) {
+ // 设置目录id
+ model.setImageDirectoryId(queryRequest.getImageDirectoryId());
+ }
+
+ if (StringUtils.isNotBlank(queryRequest.getParentDirectoryId())) {
+ // 设置父目录id
+ model.setParentDirectoryId(queryRequest.getParentDirectoryId());
+ }
+
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public AlipayMarketingImagedirectoryListQueryResponse getData(AlipayMarketingImagedirectoryListQueryResponse response) {
+ return response;
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.marketing.imagedirectory.list.query";
+ }
+ });
+ }
+
+ @Override
+ public OpenResponse updateImage(String imageIndexId, String fileName, String imageDirectoryId) {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AlipayMarketingImageModifyResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayMarketingImageModifyRequest request = new AlipayMarketingImageModifyRequest();
+ AlipayMarketingImageModifyModel model = new AlipayMarketingImageModifyModel();
+
+ // 设置图索引id
+ model.setImageIndexId(imageIndexId);
+
+ if (StringUtils.isNotBlank(fileName)) {
+ // 设置修改后新文件名
+ model.setFileName(fileName);
+ }
+
+ if (StringUtils.isNotBlank(imageDirectoryId)) {
+ // 设置修改后新目录id
+ model.setImageDirectoryId(imageDirectoryId);
+ }
+
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public Void getData(AlipayMarketingImageModifyResponse response) {
+ return null;
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.marketing.image.modify";
+ }
+ });
+ }
+
+ @Override
+ public OpenResponse queryImageList(Long pageNum, Long pageSize, String imageIndexId, String fileName, String imageDirectoryId) {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AlipayMarketingImageListQueryResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayMarketingImageListQueryRequest request = new AlipayMarketingImageListQueryRequest();
+ AlipayMarketingImageListQueryModel model = new AlipayMarketingImageListQueryModel();
+
+ // 设置页码
+ model.setPageNum(pageNum == null ? 1L : pageNum);
+
+ // 设置单页条数
+ model.setPageSize(pageSize == null ? 10L : pageSize);
+
+ if (StringUtils.isNotBlank(imageIndexId)) {
+ // 设置图索引id
+ model.setImageIndexId(imageIndexId);
+ }
+
+ if (StringUtils.isNotBlank(fileName)) {
+ // 设置图文件名
+ model.setFileName(fileName);
+ }
+
+ if (StringUtils.isNotBlank(imageDirectoryId)) {
+ // 设置图归属目录id
+ model.setImageDirectoryId(imageDirectoryId);
+ }
+
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public AlipayMarketingImageListQueryResponse getData(AlipayMarketingImageListQueryResponse response) {
+ return response;
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.marketing.image.list.query";
+ }
+ });
+ }
+
+ @Override
+ public OpenResponse deleteImage(List imageIndexIdList) {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AlipayMarketingImageDeleteResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayMarketingImageDeleteRequest request = new AlipayMarketingImageDeleteRequest();
+ AlipayMarketingImageDeleteModel model = new AlipayMarketingImageDeleteModel();
+
+ model.setImageIndexIdList(imageIndexIdList);
+
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public Void getData(AlipayMarketingImageDeleteResponse response) {
+ return null;
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.marketing.image.delete";
+ }
+ });
+ }
+
+ public String getImageFromUrlAndConvertToBase64(String imageUrl) throws IOException {
+ if (StringUtils.isBlank(imageUrl)) {
+ throw new IllegalArgumentException("图片URL不能为空");
+ }
+
+ URL url = new URL(imageUrl);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod("GET");
+ connection.setConnectTimeout(5000);
+ connection.setReadTimeout(5000);
+
+ try (InputStream inputStream = connection.getInputStream()) {
+ byte[] imageBytes = IOUtils.toByteArray(inputStream);
+ return Base64.getEncoder().encodeToString(imageBytes);
+ } finally {
+ connection.disconnect();
+ }
+ }
+
+ public String getImageFromUrlAndConvertToBase64WithResize(String imageUrl, int width, int height) throws IOException {
+ if (StringUtils.isBlank(imageUrl)) {
+ throw new IllegalArgumentException("图片URL不能为空");
+ }
+
+ URL url = new URL(imageUrl);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod("GET");
+ connection.setConnectTimeout(5000);
+ connection.setReadTimeout(5000);
+
+ try (InputStream inputStream = connection.getInputStream()) {
+ // 使用Thumbnailator调整图片尺寸
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ Thumbnails.of(inputStream)
+ .size(width, height)
+ .outputFormat("jpg")
+ .toOutputStream(outputStream);
+
+ byte[] imageBytes = outputStream.toByteArray();
+ return Base64.getEncoder().encodeToString(imageBytes);
+ } finally {
+ connection.disconnect();
+ }
+ }
+
+
+}
diff --git a/src/main/java/com/sczx/pay/alipay/service/impl/ItemServiceImpl.java b/src/main/java/com/sczx/pay/alipay/service/impl/ItemServiceImpl.java
new file mode 100644
index 0000000..8571411
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/service/impl/ItemServiceImpl.java
@@ -0,0 +1,735 @@
+package com.sczx.pay.alipay.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.domain.*;
+import com.alipay.api.internal.util.StringUtils;
+import com.alipay.api.request.*;
+import com.alipay.api.response.*;
+import com.sczx.pay.alipay.po.RentCommodityConfig;
+import com.sczx.pay.alipay.po.RentRuleItem;
+import com.sczx.pay.alipay.service.ImageUploadService;
+import com.sczx.pay.alipay.service.ItemService;
+import com.sczx.pay.alipay.vo.OpenResponse;
+import com.sczx.pay.mapper.RentRuleItemMapper;
+import com.sczx.pay.utils.AlipayApiCallback;
+import com.sczx.pay.utils.AlipayApiTemplate;
+import com.sczx.pay.utils.AlipaySdkUtil;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+import org.springframework.stereotype.Service;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.ArrayList;
+
+
+@Service
+public class ItemServiceImpl implements ItemService {
+
+ private static final Logger logger = LogManager.getLogger(ItemServiceImpl.class);
+
+ @Autowired
+ private AlipaySdkUtil alipaySdkUtil;
+
+ @Autowired
+ private ImageUploadService imageUploadService;
+
+ @Autowired
+ private RentRuleItemMapper rentRuleItemMapper;
+
+ @Override
+ public OpenResponse> getCategories(String itemType, String catStatus) {
+ return AlipayApiTemplate.execute(new AlipayApiCallback, AlipayOpenAppItemAllcategoryQueryResponse>() {
+ @Override
+ public AlipayOpenAppItemAllcategoryQueryResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayOpenAppItemAllcategoryQueryRequest request = new AlipayOpenAppItemAllcategoryQueryRequest();
+ AlipayOpenAppItemAllcategoryQueryModel model = new AlipayOpenAppItemAllcategoryQueryModel();
+
+ // 设置商品类型
+ model.setItemType(itemType);
+
+ model.setCatStatus(StringUtils.isEmpty(catStatus) ? "AUDIT_PASSED" : catStatus);
+
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public List getData(AlipayOpenAppItemAllcategoryQueryResponse response) {
+ List cats = response.getCats();
+ if (CollectionUtils.isEmpty(cats)) {
+ return null;
+ }
+ List childs = new ArrayList<>();
+ for (CategoryAndParentVO cat : cats) {
+ if (CollectionUtils.isEmpty(cat.getCatAndParent())) {
+ continue;
+ }
+ // 获取叶子节点(cat_status不为空的是叶子结点)
+ Optional categoryVO = cat.getCatAndParent().stream().filter(Objects::nonNull)
+ .filter(child -> StringUtils.areNotEmpty(child.getCatStatus())).findFirst();
+ categoryVO.ifPresent(childs::add);
+ }
+ return childs;
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.open.app.item.allcategory.query";
+ }
+ });
+ }
+
+ @Override
+ public OpenResponse queryTemplate(String categoryId, String itemType) {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AlipayOpenAppItemTemplateQueryResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayOpenAppItemTemplateQueryRequest request = new AlipayOpenAppItemTemplateQueryRequest();
+ AlipayOpenAppItemTemplateQueryModel model = new AlipayOpenAppItemTemplateQueryModel();
+
+ // 设置类目id
+ model.setCategoryId(categoryId);
+
+ model.setItemType(itemType);
+
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public AlipayOpenAppItemTemplateQueryResponse getData(AlipayOpenAppItemTemplateQueryResponse response) {
+ return response;
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.open.app.item.template.query";
+ }
+ });
+ }
+
+
+ @Override
+ public OpenResponse createRentItem(RentRuleItem rentRuleItem) {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+
+ @Override
+ public AlipayOpenAppItemCreateResponse process() throws AlipayApiException {
+
+ //RentRuleItem rentRuleItem = rentRuleItemMapper.selectByIds(param.getBatteryRuleId(), param.getCarRuleId(), param.getCarModelId(), param.getBrandId());
+ RentRuleItem rentRuleItemvo = rentRuleItem;
+ // 构造请求参数以调用接口
+ AlipayOpenAppItemCreateRequest request = new AlipayOpenAppItemCreateRequest();
+ AlipayOpenAppItemCreateModel model = new AlipayOpenAppItemCreateModel();
+
+
+ // 设置平台类目
+ model.setCategoryId("C001684401");
+ // 设置商品名称由品牌、型号、电池规格、租赁类型、套餐名称拼接
+ String title = rentRuleItem.getBrandName() + rentRuleItem.getModelName() +"_"+ rentRuleItem.getCategoryName() + "_" + rentRuleItem.getRentType()+rentRuleItem.getRuleName();
+ rentRuleItemvo.setItemDesc(title);
+ // 设置商品名称
+ model.setTitle(title);
+ // 设置导购描述
+ model.setDesc(title);
+ // 设置平台类目
+ model.setCategoryId("C001684401");
+ // 设置商品主图
+ String imgStr = imageUploadService.uploadAndReturnId(rentRuleItem.getImage(), "ITEM_HEAD_IMG");
+ model.setHeadImg(imgStr);
+ rentRuleItemvo.setImage(imgStr);
+ // 设置商品模版类型
+ model.setItemType("2");
+ //sku_attrs
+
+ // 设置价格单元
+ model.setPriceUnit("元/日");
+
+ //设置商品ID
+ String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
+ String uuidSuffix = UUID.randomUUID().toString().replace("-", "").substring(0, 6).toUpperCase();
+ String outItemId = "OI"+timestamp + uuidSuffix;
+ model.setOutItemId(outItemId);
+ rentRuleItemvo.setOutItemId(outItemId);
+ rentRuleItemvo.setOutSkuId(outItemId+"_sku");
+ //设置商品详情页路径
+ model.setPath("alipays://platformapi/startapp?appId=2021004169641281&page=pages/rentGoodsDetail/index?outItemId="+outItemId);
+ rentRuleItemvo.setPagePath("alipays://platformapi/startapp?appId=2021004169641281&page=pages/rentGoodsDetail/index?outItemId="+outItemId);
+
+ //设置商品状态
+ model.setSaleStatus("AVAILABLE");
+ //sku_attrs
+ model.setSkus(getItemSkus(rentRuleItem, model.getImageList(), model.getItemType()));
+
+ // 设置属性列表
+ model.setAttrs(getItemAttrs(rentRuleItem, model.getImageList(), model.getItemType()));
+
+ RentRuleItem res = rentRuleItemMapper.selectItemByFourIds(rentRuleItem.getBatteryRuleId(), rentRuleItem.getCarRuleId(), rentRuleItem.getCarModelId(), rentRuleItem.getBrandId());
+
+ if(res != null ){
+ rentRuleItemMapper.updateItemIdByOutItemId(rentRuleItemvo);
+ }else {
+ rentRuleItemMapper.insertByFourId(rentRuleItemvo);
+ }
+ logger.info("属性列表:" + JSON.toJSONString(model));
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public String getData(AlipayOpenAppItemCreateResponse response) {
+ rentRuleItemMapper.updateByOutItemId(response.getOutItemId(), response.getItemId());
+ return response.getItemId();
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.open.app.item.create";
+ }
+ });
+ }
+
+
+
+ @Override
+ public OpenResponse modifyItem(RentRuleItem rentRuleItem) {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+
+ @Override
+ public AlipayOpenAppItemModifyResponse process() throws AlipayApiException {
+
+ // 构造请求参数以调用接口
+ AlipayOpenAppItemModifyRequest request = new AlipayOpenAppItemModifyRequest();
+ AlipayOpenAppItemModifyModel model = new AlipayOpenAppItemModifyModel();
+
+ RentRuleItem rentRuleItemvo = rentRuleItem;
+ // 设置平台类目
+ model.setCategoryId("C001684401");
+ // 设置商品名称由品牌、型号、电池规格、租赁类型、套餐名称拼接
+ String title = rentRuleItem.getBrandName() + rentRuleItem.getModelName() +"_"+ rentRuleItem.getCategoryName() + "_" + rentRuleItem.getRentType()+rentRuleItem.getRuleName();
+ rentRuleItemvo.setItemDesc(title);
+ // 设置商品名称
+ model.setTitle(title);
+ // 设置导购描述
+ model.setDesc(title);
+ // 设置平台类目
+ model.setCategoryId("C001684401");
+ // 设置商品主图
+ String imgStr = imageUploadService.uploadAndReturnId(rentRuleItem.getImage(), "ITEM_HEAD_IMG");
+ model.setHeadImg(imgStr);
+ rentRuleItemvo.setImage(imgStr);
+ // 设置商品模版类型
+ model.setItemType("2");
+ //sku_attrs
+
+ // 设置价格单元
+ model.setPriceUnit("元/日");
+
+ //设置商品ID
+ model.setOutItemId(rentRuleItem.getOutItemId());
+ rentRuleItemvo.setOutItemId(rentRuleItem.getOutItemId());
+ rentRuleItemvo.setOutSkuId(rentRuleItem.getOutSkuId());
+ //设置商品详情页路径
+ model.setPath("alipays://platformapi/startapp?appId=2021004169641281&page=pages/rentGoodsDetail/index?outItemId="+rentRuleItem.getOutItemId());
+ rentRuleItemvo.setPagePath("alipays://platformapi/startapp?appId=2021004169641281&page=pages/rentGoodsDetail/index?outItemId="+rentRuleItem.getOutItemId());
+
+ //设置商品状态
+ model.setSaleStatus("AVAILABLE");
+ //sku_attrs
+ model.setSkus(modifyItemSkus(rentRuleItem));
+
+ // 设置属性列表
+ model.setAttrs(getItemAttrs(rentRuleItem, model.getImageList(), model.getItemType()));
+
+ RentRuleItem res = rentRuleItemMapper.selectItemByFourIds(rentRuleItem.getBatteryRuleId(), rentRuleItem.getCarRuleId(), rentRuleItem.getCarModelId(), rentRuleItem.getBrandId());
+
+ if(res != null ){
+ rentRuleItemMapper.updateItemIdByOutItemId(rentRuleItemvo);
+ }else {
+ rentRuleItemMapper.insertByFourId(rentRuleItemvo);
+ }
+
+ logger.info("属性列表:" + JSON.toJSONString(model));
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public String getData(AlipayOpenAppItemModifyResponse response) {
+ //rentRuleItemMapper.updateItemIdByOutItemId(response.getOutItemId(), response.getItemId());
+ return response.getItemId();
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.open.app.item.modify";
+ }
+ });
+ }
+
+ @Override
+ public OpenResponse syncDeliveryInfo() {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AlipayOpenAppDeliveryInfoSyncResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayOpenAppDeliveryInfoSyncRequest request = new AlipayOpenAppDeliveryInfoSyncRequest();
+ AlipayOpenAppDeliveryInfoSyncModel model = new AlipayOpenAppDeliveryInfoSyncModel();
+ // 设置履约类型
+ model.setDeliveryType("PICKUP");
+ model.setDeliveryName("电动车租赁自提履约");
+
+ // 设置履约信息ID
+ model.setDeliveryId("2025090124000116301610");
+
+ // 设置履约属性
+ List attrs = new ArrayList();
+ AppItemAttrVO attrs0 = new AppItemAttrVO();
+ attrs0.setAttrKey("delivery_name");
+ attrs0.setAttrValue("同城门店自提");
+ attrs.add(attrs0);
+ model.setAttrs(attrs);
+
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public String getData(AlipayOpenAppDeliveryInfoSyncResponse response) {
+ return response.getDeliveryId();
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.open.app.delivery.info.sync";
+ }
+ });
+ }
+
+
+ @Override
+ public OpenResponse deliveryInfoQuery() {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AlipayOpenAppDeliveryInfoQueryResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayOpenAppDeliveryInfoQueryRequest request = new AlipayOpenAppDeliveryInfoQueryRequest();
+ AlipayOpenAppDeliveryInfoQueryModel model = new AlipayOpenAppDeliveryInfoQueryModel();
+ // 设置履约类型
+ model.setDeliveryType("PICKUP");
+
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public String getData(AlipayOpenAppDeliveryInfoQueryResponse response) {
+ return response.getBody();
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.open.app.delivery.info.query";
+ }
+ });
+ }
+
+
+ @Override
+ public OpenResponse deliveryTemplateQuery() {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AlipayOpenAppDeliveryTemplateQueryResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayOpenAppDeliveryTemplateQueryRequest request = new AlipayOpenAppDeliveryTemplateQueryRequest();
+ AlipayOpenAppDeliveryTemplateQueryModel model = new AlipayOpenAppDeliveryTemplateQueryModel();
+ // 设置履约类型
+ model.setDeliveryType("PICKUP");
+ //ST1000000000000010
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public String getData(AlipayOpenAppDeliveryTemplateQueryResponse response) {
+ return response.getBody();
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.open.app.delivery.template.query";
+ }
+ });
+ }
+
+
+ @Override
+ public OpenResponse shopQuery() {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AntMerchantExpandShopPageQueryResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AntMerchantExpandShopPageQueryRequest request = new AntMerchantExpandShopPageQueryRequest();
+ AntMerchantExpandShopPageQueryModel model = new AntMerchantExpandShopPageQueryModel();
+ // 设置履约类型
+ // 设置外部门店编号
+ //model.setStoreId("No.0731101");
+ model.setIpRoleId("2021004169641281");
+
+ // 设置页码
+ model.setPageNum(1L);
+
+ // 设置每页查询大小
+ model.setPageSize(10L);
+ //ST1000000000000010
+ request.setBizModel(model);
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public String getData(AntMerchantExpandShopPageQueryResponse response) {
+ return response.getBody();
+ }
+
+ @Override
+ public String getApiName() {
+ return "ant.merchant.expand.shop.page.query";
+ }
+ });
+ }
+
+
+ private AlipayOpenAppItemCreateModel getAlipayOpenAppItemCreateModel(RentRuleItem rentRuleItem) throws AlipayApiException {
+ AlipayOpenAppItemCreateModel model = new AlipayOpenAppItemCreateModel();
+
+ // 设置商家侧商品ID
+ model.setOutItemId(rentRuleItem.getOutItemId());
+
+
+
+
+ // 设置类目ID
+ model.setCategoryId("C001684401");
+
+
+
+
+
+ // 设置商品图片的文件id列表
+// List imageList = new ArrayList<>();
+// imageList.add(imageUploadService.uploadAndReturnId("file/head.jpg", "ITEM_IMAGE_LIST"));
+// model.setImageList(imageList);
+
+ //model.setItemDetailsPageModel("1");
+
+ // 设置商品详情页URL,需要先完成商品详情页组件开发接入
+// try {
+// String url = "plugin-private://2021003177653028/pages/goodsDetail/goodsDetail?outItemId=" + param.getOutItemId();
+// model.setPath("alipays://platformapi/startApp?appId=" + alipaySdkUtil.getAppId()
+// + "&page=" + URLEncoder.encode(url, "utf-8"));
+// } catch (UnsupportedEncodingException e) {
+// throw new AlipayApiException("url解析失败");
+// }
+
+
+
+ // 设置商品售价
+ Long rentalPriceInCents = rentRuleItem.getRentalPrice().multiply(new BigDecimal(100)).setScale(0, java.math.RoundingMode.HALF_UP).longValue();
+ model.setSalePrice(rentalPriceInCents);
+
+ // 设置商品原价
+ model.setOriginalPrice(rentalPriceInCents);
+
+ // 设置库存
+ model.setStockNum(100L);
+
+ // 设置商品售卖状态
+ model.setSaleStatus("AVAILABLE");
+
+ return model;
+ }
+
+ private List getTemplateItemAttrs(String categoryId, String itemType) throws AlipayApiException {
+ OpenResponse templateResponse = queryTemplate(categoryId, itemType);
+ if (!"10000".equals(templateResponse.getCode())) {
+ throw new AlipayApiException("查询普通商品模板失败");
+ }
+
+ if (templateResponse.getData().getAttr() == null) {
+ return null;
+ }
+
+ return templateResponse.getData().getAttr().getItemAttrList();
+ }
+
+ private List getItemAttrs(RentRuleItem param, List imageList, String itemType) throws AlipayApiException {
+ List attributes = getTemplateItemAttrs("C001684401", itemType);
+ if (CollectionUtils.isEmpty(attributes)) {
+ return null;
+ }
+ List attrs = new ArrayList<>();
+ for (AttributeVO attr : attributes) {
+ AppItemAttrVO appItemAttrVO = new AppItemAttrVO();
+ appItemAttrVO.setAttrKey(attr.getKey());
+
+ switch (attr.getKey()) {
+ // -----BEGIN 普通实物类商品可传入以下属性 -----
+// case "delivery_info":
+// // 商品履约信息
+// JSONObject jsonObject = new JSONObject();
+// jsonObject.put("delivery_id", "2025090124000116301610");
+// //jsonObject.put("shop_ids", param.getShopIds());
+// JSONArray jsonArray = new JSONArray();
+// jsonArray.add(jsonObject);
+// appItemAttrVO.setAttrValue(JSONArray.toJSONString(jsonArray));
+// break;
+ case "rent_from_numbers_of_day":
+ // 起租天数
+ appItemAttrVO.setAttrValue("1");
+ break;
+ case "lease_term_type":
+ appItemAttrVO.setAttrValue("短租");
+ break;
+ case "item_fineness":
+ // 商品成色
+ appItemAttrVO.setAttrValue("secondHand");
+ break;
+ case "item_fineness_grade":
+ appItemAttrVO.setAttrValue("99new");
+ break;
+ case "whether_support_free_deposit":
+ // 是否支持免押
+ appItemAttrVO.setAttrValue("1");
+ break;
+ case "whether_continue_rent":
+ // 是否可续租
+ appItemAttrVO.setAttrValue("1");
+ break;
+ case "whether_buyout":
+ // 是否可买断
+ appItemAttrVO.setAttrValue("1");
+ break;
+ case "收货方式":
+ appItemAttrVO.setAttrValue("自提");
+ break ;
+ }
+ if (!StringUtils.isEmpty(appItemAttrVO.getAttrValue())) {
+ attrs.add(appItemAttrVO);
+ }
+ }
+ return attrs;
+ }
+ private List getItemSkus(RentRuleItem param, List imageList, String itemType) throws AlipayApiException {
+ List itemSkus = new ArrayList<>();
+
+ ItemSkuCreateVO sku = new ItemSkuCreateVO();
+
+ // 设置商家侧SKU ID,需要全局唯一
+ sku.setOutSkuId(param.getOutItemId() + "_sku");
+
+ // 设置售卖状态
+ sku.setSaleStatus("AVAILABLE");
+
+ // 设置SKU类型为租赁
+ sku.setSkuType("RENT");
+
+ // 设置价格相关字段
+ Long rentalPriceInCents = param.getRentalPrice().multiply(new BigDecimal(100)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
+// sku.setSalePrice(rentalPriceInCents.toString());
+// // 设置原价为租赁价格的1.2倍
+// Long originalPriceInCents = new BigDecimal(rentalPriceInCents)
+// .multiply(new BigDecimal("1.2"))
+// .setScale(0, BigDecimal.ROUND_HALF_UP)
+// .longValue();
+// sku.setOriginalPrice(originalPriceInCents);
+
+ // 设置库存
+ sku.setStockNum(String.valueOf(999999));
+
+ // 设置价格单元
+ sku.setPriceUnit("元/日");
+
+ // 设置销售属性
+ List skuAttrs = new ArrayList<>();
+
+ // 添加租赁商品属性
+ ItemSkuAttrVO rentCommodityAttr = new ItemSkuAttrVO();
+ rentCommodityAttr.setAttrKey("rent_commodity");
+ rentCommodityAttr.setAttrType("custom");
+
+ RentCommodityConfig config = new RentCommodityConfig();
+ config.setName("门店自提,租完归还");
+ config.setDescription("套餐说明");
+ config.setCustomLease("0");
+ config.setSlopeFormula("DEFAULT_SLOPE_FORMULA");
+ config.setDurationUnit("日");
+
+ //买断价10000元*100 单位分
+ config.setBuyoutPrice("1000000");
+ config.setPriceUnit("元");
+
+ int rentalDays = 1;
+ if(param.getRentalDays() != null && param.getRentalDays() > 0){
+ rentalDays = param.getRentalDays();
+ }
+
+ // 创建时段价格列表根据基础价格创建3个时段价格
+ List durationPriceList = new ArrayList<>();
+
+ //暂时设置为只保留一个时段价格
+ for(int i = 1; i < 2; i++){
+ RentCommodityConfig.DurationPrice durationPrice = new RentCommodityConfig.DurationPrice();
+ String val = i*100 + "";
+ durationPrice.setDuration(i*rentalDays+"");
+ durationPrice.setTotalSalePrice(param.getRentalPrice()
+ .multiply(new BigDecimal(val))
+ .setScale(0, BigDecimal.ROUND_HALF_UP).toString());
+ durationPrice.setTotalOriginalPrice(param.getRentalPrice()
+ .multiply(new BigDecimal(val))
+ .setScale(0, BigDecimal.ROUND_HALF_UP).toString());
+ durationPriceList.add(durationPrice);
+ }
+ config.setDurationPriceList(durationPriceList);
+ rentCommodityAttr.setAttrValue(JSON.toJSONString(config));
+
+ rentCommodityAttr.setAttrKey("收货方式");
+ rentCommodityAttr.setAttrValue("到店自提");
+ // 根据实际情况设置
+ skuAttrs.add(rentCommodityAttr);
+ sku.setSkuAttrs(skuAttrs);
+
+
+
+ itemSkus.add(sku);
+ return itemSkus;
+ }
+
+
+ private List modifyItemSkus(RentRuleItem param) throws AlipayApiException {
+ List itemSkus = new ArrayList<>();
+
+ ItemSkuVO sku = new ItemSkuVO();
+
+ // 设置商家侧SKU ID,需要全局唯一
+ sku.setOutSkuId(param.getOutSkuId());
+
+ // 设置售卖状态
+ sku.setSaleStatus("AVAILABLE");
+
+ // 设置SKU类型为租赁
+ sku.setSkuType("RENT");
+
+ // 设置价格相关字段
+ Long rentalPriceInCents = param.getRentalPrice().multiply(new BigDecimal(100)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
+// sku.setSalePrice(rentalPriceInCents.toString());
+// // 设置原价为租赁价格的1.2倍
+// Long originalPriceInCents = new BigDecimal(rentalPriceInCents)
+// .multiply(new BigDecimal("1.2"))
+// .setScale(0, BigDecimal.ROUND_HALF_UP)
+// .longValue();
+// sku.setOriginalPrice(originalPriceInCents);
+
+ // 设置库存
+ sku.setStockNum(999999L);
+
+ // 设置价格单元
+ sku.setPriceUnit("元/日");
+
+ // 设置销售属性
+ List skuAttrs = new ArrayList<>();
+
+ // 添加租赁商品属性
+ ItemSkuAttrVO rentCommodityAttr = new ItemSkuAttrVO();
+ rentCommodityAttr.setAttrKey("rent_commodity");
+ rentCommodityAttr.setAttrType("custom");
+
+ RentCommodityConfig config = new RentCommodityConfig();
+ config.setName("门店自提,租完归还");
+ config.setDescription("套餐说明");
+ config.setCustomLease("0");
+ config.setSlopeFormula("DEFAULT_SLOPE_FORMULA");
+ config.setDurationUnit("日");
+
+ //买断价10000元*100 单位分
+ config.setBuyoutPrice("1000000");
+ config.setPriceUnit("元");
+
+ int rentalDays = 1;
+ if(param.getRentalDays() != null && param.getRentalDays() > 0){
+ rentalDays = param.getRentalDays();
+ }
+
+ // 创建时段价格列表根据基础价格创建3个时段价格
+ List durationPriceList = new ArrayList<>();
+
+ for(int i = 1; i < 2; i++){
+ RentCommodityConfig.DurationPrice durationPrice = new RentCommodityConfig.DurationPrice();
+ String val = i*100 + "";
+ durationPrice.setDuration(i*rentalDays+"");
+ durationPrice.setTotalSalePrice(param.getRentalPrice()
+ .multiply(new BigDecimal(val))
+ .setScale(0, BigDecimal.ROUND_HALF_UP).toString());
+ durationPrice.setTotalOriginalPrice(param.getRentalPrice()
+ .multiply(new BigDecimal(val))
+ .setScale(0, BigDecimal.ROUND_HALF_UP).toString());
+ durationPriceList.add(durationPrice);
+ }
+ config.setDurationPriceList(durationPriceList);
+ rentCommodityAttr.setAttrValue(JSON.toJSONString(config));
+ // 根据实际情况设置
+ skuAttrs.add(rentCommodityAttr);
+ sku.setSkuAttrs(skuAttrs);
+
+ itemSkus.add(sku);
+ return itemSkus;
+ }
+
+
+ @Override
+ public OpenResponse queryItemDetail(String itemId, String outItemId, long needEditSpu) {
+ return AlipayApiTemplate.execute(new AlipayApiCallback() {
+ @Override
+ public AlipayOpenAppItemQueryResponse process() throws AlipayApiException {
+ // 构造请求参数以调用接口
+ AlipayOpenAppItemQueryRequest request = new AlipayOpenAppItemQueryRequest();
+ AlipayOpenAppItemQueryModel model = new AlipayOpenAppItemQueryModel();
+ if (!StringUtils.isEmpty(itemId)) {
+ // 设置支付宝侧商品id
+ model.setItemId(itemId);
+ }
+
+ if (!StringUtils.isEmpty(outItemId)) {
+ // 设置商家侧商品id
+ model.setOutItemId(outItemId);
+ }
+
+ // 设置是否查询编辑版本
+ model.setNeedEditSpu(needEditSpu);
+
+ request.setBizModel(model);
+
+ return alipaySdkUtil.execute(request);
+ }
+
+ @Override
+ public AlipayOpenAppItemQueryResponse getData(AlipayOpenAppItemQueryResponse response) {
+ return response;
+ }
+
+ @Override
+ public String getApiName() {
+ return "alipay.open.app.item.query";
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/com/sczx/pay/alipay/service/impl/RentOrderServiceImpl.java b/src/main/java/com/sczx/pay/alipay/service/impl/RentOrderServiceImpl.java
new file mode 100644
index 0000000..59c4abc
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/service/impl/RentOrderServiceImpl.java
@@ -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 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 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 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;
+ }
+
+
+}
diff --git a/src/main/java/com/sczx/pay/alipay/service/impl/RentRuleItemServiceImpl.java b/src/main/java/com/sczx/pay/alipay/service/impl/RentRuleItemServiceImpl.java
new file mode 100644
index 0000000..ad83668
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/service/impl/RentRuleItemServiceImpl.java
@@ -0,0 +1,64 @@
+package com.sczx.pay.alipay.service.impl;
+
+
+import com.alibaba.fastjson.JSON;
+import com.sczx.pay.alipay.po.RentRuleItem;
+import com.sczx.pay.alipay.service.ItemService;
+import com.sczx.pay.alipay.service.RentRuleItemService;
+import com.sczx.pay.alipay.vo.OpenResponse;
+import com.sczx.pay.mapper.RentRuleItemMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+
+@Slf4j
+@Service
+public class RentRuleItemServiceImpl implements RentRuleItemService {
+
+ @Autowired
+ private RentRuleItemMapper rentRuleItemMapper;
+
+ @Autowired
+ private ItemService itemService;
+
+ @Override
+ public Map syncItem(String brandId, String carModelId, String carRuleId, String batteryRuleId) {
+ RentRuleItem rentRuleItem = rentRuleItemMapper.selectByFourId(Long.valueOf(batteryRuleId), Long.valueOf(carRuleId), Long.valueOf(carModelId), Long.valueOf(brandId));
+ log.info("rentRuleItem:{}", JSON.toJSONString(rentRuleItem));
+ Map map = new HashMap<>();
+ if (rentRuleItem == null){
+ map.put("msg","未找到此套餐信息");
+ map.put("code","500");
+ return map;
+ }
+ RentRuleItem ruleRes = rentRuleItemMapper.selectItemByFourIds(Long.valueOf(batteryRuleId), Long.valueOf(carRuleId), Long.valueOf(carModelId), Long.valueOf(brandId));
+ OpenResponse response = new OpenResponse<>();
+ if(ruleRes == null){
+ response = itemService.createRentItem(rentRuleItem);
+ }else{
+ response = itemService.modifyItem(ruleRes);
+ }
+
+
+
+
+
+
+
+ map.put("code",response.getCode());
+ map.put("msg",response.getMsg());
+ map.put("subCode",response.getSubCode());
+ map.put("subMsg",response.getSubMsg());
+ map.put("data",response.getData());
+
+ return map;
+
+ }
+}
diff --git a/src/main/java/com/sczx/pay/alipay/vo/AppItemSkuAttrVo.java b/src/main/java/com/sczx/pay/alipay/vo/AppItemSkuAttrVo.java
new file mode 100644
index 0000000..0ce54d0
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/vo/AppItemSkuAttrVo.java
@@ -0,0 +1,39 @@
+package com.sczx.pay.alipay.vo;
+
+import com.alipay.api.AlipayObject;
+import com.alipay.api.internal.mapping.ApiField;
+
+public class AppItemSkuAttrVo
+ extends AlipayObject
+{
+ private static final long serialVersionUID = 8193327886322884429L;
+ @ApiField("attr_key")
+ private String attrKey;
+ @ApiField("attr_value")
+ private String attrValue;
+
+ public String getAttrType() {
+ return attrType;
+ }
+
+ public void setAttrType(String attrType) {
+ this.attrType = attrType;
+ }
+
+ @ApiField("attr_type")
+ private String attrType;
+
+ public String getAttrKey() {
+ return this.attrKey;
+ }
+ public void setAttrKey(String attrKey) {
+ this.attrKey = attrKey;
+ }
+
+ public String getAttrValue() {
+ return this.attrValue;
+ }
+ public void setAttrValue(String attrValue) {
+ this.attrValue = attrValue;
+ }
+}
diff --git a/src/main/java/com/sczx/pay/alipay/vo/ImageDirectoryRequest.java b/src/main/java/com/sczx/pay/alipay/vo/ImageDirectoryRequest.java
new file mode 100644
index 0000000..414a608
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/vo/ImageDirectoryRequest.java
@@ -0,0 +1,83 @@
+/**
+ * Alipay.com Inc.
+ * Copyright (c) 2004-2024 All Rights Reserved.
+ */
+package com.sczx.pay.alipay.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @author jishupei.jsp
+ * @version : ImageDirectoryRequest, v0.1 2024年05月21日 11:38 上午 jishupei.jsp Exp $
+ */
+@ApiModel(description = "图片空间目录创建模型")
+public class ImageDirectoryRequest implements Serializable {
+
+ private static final long serialVersionUID = -6703393134790409650L;
+
+ @ApiModelProperty(value = "目录名,创建时必填")
+ private String imageDirectoryName;
+
+ @ApiModelProperty(value = "归属父目录ID,创建时必填", example = "0")
+ private String parentDirectoryId;
+
+ @ApiModelProperty(value = "目录ID,更新时必填")
+ private String imageDirectoryId;
+
+ /**
+ * Getter method for property imageDirectoryName.
+ *
+ * @return property value of imageDirectoryName
+ */
+ public String getImageDirectoryName() {
+ return imageDirectoryName;
+ }
+
+ /**
+ * Setter method for property imageDirectoryName.
+ *
+ * @param imageDirectoryName value to be assigned to property imageDirectoryName
+ */
+ public void setImageDirectoryName(String imageDirectoryName) {
+ this.imageDirectoryName = imageDirectoryName;
+ }
+
+ /**
+ * Getter method for property parentDirectoryId.
+ *
+ * @return property value of parentDirectoryId
+ */
+ public String getParentDirectoryId() {
+ return parentDirectoryId;
+ }
+
+ /**
+ * Setter method for property parentDirectoryId.
+ *
+ * @param parentDirectoryId value to be assigned to property parentDirectoryId
+ */
+ public void setParentDirectoryId(String parentDirectoryId) {
+ this.parentDirectoryId = parentDirectoryId;
+ }
+
+ /**
+ * Getter method for property imageDirectoryId.
+ *
+ * @return property value of imageDirectoryId
+ */
+ public String getImageDirectoryId() {
+ return imageDirectoryId;
+ }
+
+ /**
+ * Setter method for property imageDirectoryId.
+ *
+ * @param imageDirectoryId value to be assigned to property imageDirectoryId
+ */
+ public void setImageDirectoryId(String imageDirectoryId) {
+ this.imageDirectoryId = imageDirectoryId;
+ }
+}
diff --git a/src/main/java/com/sczx/pay/alipay/vo/ItemCreateRequest.java b/src/main/java/com/sczx/pay/alipay/vo/ItemCreateRequest.java
new file mode 100644
index 0000000..fbf1773
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/vo/ItemCreateRequest.java
@@ -0,0 +1,164 @@
+/**
+ * Alipay.com Inc.
+ * Copyright (c) 2004-2024 All Rights Reserved.
+ */
+package com.sczx.pay.alipay.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author jishupei.jsp
+ * @version : ItemCreateRequest, v0.1 2024年05月11日 3:31 下午 jishupei.jsp Exp $
+ */
+@ApiModel(description = "普通商品创建模型")
+public class ItemCreateRequest implements Serializable {
+ private static final long serialVersionUID = 89765465465L;
+
+ /**
+ * 类目ID
+ */
+ @ApiModelProperty(value = "类目ID", example = "C001375478", required = true)
+ private String categoryId;
+
+ /**
+ * 商品名称
+ */
+ @ApiModelProperty(value = "商品名称", example = "测试xxx", required = true)
+ private String productName;
+
+ /**
+ * 商家侧商品ID
+ */
+ @ApiModelProperty(value = "商家侧商品ID", example = "10001", required = true)
+ private String outItemId;
+
+ /**
+ * 商家名称
+ */
+ @ApiModelProperty(value = "商家名称")
+ private String merchantName = "测试商家";
+
+ /**
+ * 履约信息ID
+ */
+ @ApiModelProperty(value = "履约信息ID,从履约信息同步接口中返回")
+ private String deliveryId;
+
+ /**
+ * 门店ID列表
+ */
+ @ApiModelProperty(value = "履约信息ID关联的门店ID列表")
+ private List shopIds;
+
+ /**
+ * Getter method for property categoryId.
+ *
+ * @return property value of categoryId
+ */
+ public String getCategoryId() {
+ return categoryId;
+ }
+
+ /**
+ * Setter method for property categoryId.
+ *
+ * @param categoryId value to be assigned to property categoryId
+ */
+ public void setCategoryId(String categoryId) {
+ this.categoryId = categoryId;
+ }
+
+ /**
+ * Getter method for property productName.
+ *
+ * @return property value of productName
+ */
+ public String getProductName() {
+ return productName;
+ }
+
+ /**
+ * Setter method for property productName.
+ *
+ * @param productName value to be assigned to property productName
+ */
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ /**
+ * Getter method for property outItemId.
+ *
+ * @return property value of outItemId
+ */
+ public String getOutItemId() {
+ return outItemId;
+ }
+
+ /**
+ * Setter method for property outItemId.
+ *
+ * @param outItemId value to be assigned to property outItemId
+ */
+ public void setOutItemId(String outItemId) {
+ this.outItemId = outItemId;
+ }
+
+ /**
+ * Getter method for property merchantName.
+ *
+ * @return property value of merchantName
+ */
+ public String getMerchantName() {
+ return merchantName;
+ }
+
+ /**
+ * Setter method for property merchantName.
+ *
+ * @param merchantName value to be assigned to property merchantName
+ */
+ public void setMerchantName(String merchantName) {
+ this.merchantName = merchantName;
+ }
+
+ /**
+ * Getter method for property deliveryId.
+ *
+ * @return property value of deliveryId
+ */
+ public String getDeliveryId() {
+ return deliveryId;
+ }
+
+ /**
+ * Setter method for property deliveryId.
+ *
+ * @param deliveryId value to be assigned to property deliveryId
+ */
+ public void setDeliveryId(String deliveryId) {
+ this.deliveryId = deliveryId;
+ }
+
+ /**
+ * Getter method for property shopIds.
+ *
+ * @return property value of shopIds
+ */
+ public List getShopIds() {
+ return shopIds;
+ }
+
+ /**
+ * Setter method for property shopIds.
+ *
+ * @param shopIds value to be assigned to property shopIds
+ */
+ public void setShopIds(List shopIds) {
+ this.shopIds = shopIds;
+ }
+}
diff --git a/src/main/java/com/sczx/pay/alipay/vo/OpenResponse.java b/src/main/java/com/sczx/pay/alipay/vo/OpenResponse.java
new file mode 100644
index 0000000..161df23
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/vo/OpenResponse.java
@@ -0,0 +1,136 @@
+/**
+ * Alipay.com Inc.
+ * Copyright (c) 2004-2024 All Rights Reserved.
+ */
+package com.sczx.pay.alipay.vo;
+
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.AlipayResponse;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.Serializable;
+
+/**
+ * @author jishupei.jsp
+ * @version : OpenResponse, v0.1 2024年03月26日 7:59 下午 jishupei.jsp Exp $
+ */
+public class OpenResponse implements Serializable {
+ private static final long serialVersionUID = 8943991234L;
+
+ private String code;
+
+ private String msg;
+
+ private String subCode;
+
+ private String subMsg;
+
+ private E data;
+
+ public OpenResponse() {
+ }
+
+ public OpenResponse(AlipayResponse response) {
+ this.code = response.getCode();
+ this.msg = response.getMsg();
+ this.subCode = response.getSubCode();
+ this.subMsg = response.getSubMsg();
+ }
+
+ public OpenResponse(AlipayApiException e) {
+ this.code = "ALIPAY_SDK_ERROR";
+ this.msg = "支付宝SDK调用异常";
+ this.subCode = e.getErrCode();
+ this.subMsg = StringUtils.defaultIfBlank(e.getErrMsg(), e.getMessage());
+ }
+
+ /**
+ * Getter method for property code.
+ *
+ * @return property value of code
+ */
+ public String getCode() {
+ return code;
+ }
+
+ /**
+ * Setter method for property code.
+ *
+ * @param code value to be assigned to property code
+ */
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ /**
+ * Getter method for property msg.
+ *
+ * @return property value of msg
+ */
+ public String getMsg() {
+ return msg;
+ }
+
+ /**
+ * Setter method for property msg.
+ *
+ * @param msg value to be assigned to property msg
+ */
+ public void setMsg(String msg) {
+ this.msg = msg;
+ }
+
+ /**
+ * Getter method for property subCode.
+ *
+ * @return property value of subCode
+ */
+ public String getSubCode() {
+ return subCode;
+ }
+
+ /**
+ * Setter method for property subCode.
+ *
+ * @param subCode value to be assigned to property subCode
+ */
+ public void setSubCode(String subCode) {
+ this.subCode = subCode;
+ }
+
+ /**
+ * Getter method for property subMsg.
+ *
+ * @return property value of subMsg
+ */
+ public String getSubMsg() {
+ return subMsg;
+ }
+
+ /**
+ * Setter method for property subMsg.
+ *
+ * @param subMsg value to be assigned to property subMsg
+ */
+ public void setSubMsg(String subMsg) {
+ this.subMsg = subMsg;
+ }
+
+ /**
+ * Getter method for property data.
+ *
+ * @return property value of data
+ */
+ public E getData() {
+ return data;
+ }
+
+ /**
+ * Setter method for property data.
+ *
+ * @param data value to be assigned to property data
+ */
+ public void setData(E data) {
+ this.data = data;
+ }
+}
diff --git a/src/main/java/com/sczx/pay/alipay/vo/RentOrderCreateRequest.java b/src/main/java/com/sczx/pay/alipay/vo/RentOrderCreateRequest.java
new file mode 100644
index 0000000..0277e7b
--- /dev/null
+++ b/src/main/java/com/sczx/pay/alipay/vo/RentOrderCreateRequest.java
@@ -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;
+
+}
diff --git a/src/main/java/com/sczx/pay/aspect/FacadeAspect.java b/src/main/java/com/sczx/pay/aspect/FacadeAspect.java
new file mode 100644
index 0000000..61e7d5b
--- /dev/null
+++ b/src/main/java/com/sczx/pay/aspect/FacadeAspect.java
@@ -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;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/sczx/pay/aspect/WebLogAspect.java b/src/main/java/com/sczx/pay/aspect/WebLogAspect.java
new file mode 100644
index 0000000..25e85b2
--- /dev/null
+++ b/src/main/java/com/sczx/pay/aspect/WebLogAspect.java
@@ -0,0 +1,127 @@
+package com.sczx.pay.aspect;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.*;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
+
+/**
+ * @Author Huang Kai
+ * @Date 2023/1/18 17:01
+ * @Version 1.0
+ */
+@Aspect
+@Component
+@Slf4j
+public class WebLogAspect {
+
+
+
+ /** 以 controller 包下定义的所有请求为切入点 */
+ @Pointcut("execution(public * com.sczx.*.controller.*.*(..))")
+ public void webLog() {}
+
+ /**
+ * 在切点之前织入
+ * @param joinPoint
+ */
+ @Before("webLog()")
+ public void doBefore(JoinPoint joinPoint) {
+ // 检查是否是支付宝回调控制器
+ String className = joinPoint.getTarget().getClass().getSimpleName();
+ if ("AliPayNotifyController".equals(className)) {
+ // 对于支付宝回调,简化日志处理
+ log.info("========================= Start =========================");
+ ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ if (attributes != null) {
+ HttpServletRequest request = attributes.getRequest();
+ log.info("URL:{}", request.getRequestURL().toString());
+ }
+ String requestId = UUID.randomUUID().toString();
+ // 使用 requestId 的一部分作为日志标识
+ MDC.put("requestId", requestId.substring(Math.max(0, requestId.length() - 12)));
+ return;
+ }
+ ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ HttpServletRequest request = null;
+ String requestId = null;
+
+ if (attributes != null) {
+ request = attributes.getRequest();
+ // 从请求头中获取 requestId
+ requestId = request.getHeader("requestId");
+ }
+
+ // 如果请求头中没有 requestId,则生成新的
+ if (StringUtils.isBlank(requestId)) {
+ requestId = UUID.randomUUID().toString();
+ }
+
+ // 使用 requestId 的一部分作为日志标识
+ MDC.put("requestId", requestId.substring(Math.max(0, requestId.length() - 12)));
+ // 打印请求相关参数
+ log.info("========================= Start =========================");
+ // 打印请求入参
+ try{
+ Object[] args = joinPoint.getArgs();
+ List