Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/dev' into dev

7 mesiacov pred
rodič
commit
26b3f29af3
22 zmenil súbory, kde vykonal 366 pridanie a 798 odobranie
  1. 1 1
      08.src/Xingxi/pom.xml
  2. 41 9
      08.src/Xingxi/xingxi-miniprogram-api/src/main/java/com/xingxi/api/configuration/security/SpringWebSecurityConfiguration.java
  3. 1 0
      08.src/Xingxi/xingxi-miniprogram-api/src/main/java/com/xingxi/api/service/impl/OrderApiServiceImpl.java
  4. 27 0
      08.src/Xingxi/xingxi-miniprogram-api/src/main/java/com/xingxi/api/service/impl/XingxiUnifiedpayCallbackServiceImpl.java
  5. 25 0
      08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/META-INF/apiclient_cert.pem
  6. 28 0
      08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/META-INF/apiclient_key.pem
  7. 3 3
      08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/application-local.yml
  8. 3 3
      08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/application-release.yml
  9. 3 3
      08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/application-test.yml
  10. 1 1
      08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/logback-local.xml
  11. 1 1
      08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/logback-release.xml
  12. 1 1
      08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/logback-test.xml
  13. 1 1
      08.src/Xingxi/xingxi-pay-utils/xingxi-unifiedpay-spring-boot-starter/src/main/java/com/xingxi/unifiedpay/open/XingxiUnifiedpayCallbackServiceI.java
  14. 0 515
      08.src/Xingxi/xingxi-pay-utils/xingxi-unifiedpay-spring-boot-starter/src/main/java/com/xingxi/unifiedpay/service/EcommerceWXPayUnifiedpayServiceImpl.java
  15. 0 41
      08.src/Xingxi/xingxi-pay-utils/xingxi-unifiedpay-spring-boot-starter/src/main/java/com/xingxi/unifiedpay/service/OtherUnifiedpayServiceImpl.java
  16. 0 154
      08.src/Xingxi/xingxi-pay-utils/xingxi-unifiedpay-spring-boot-starter/src/main/java/com/xingxi/unifiedpay/service/XingxiUnifiedpayRepositoryImpl.java
  17. 43 35
      08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/business/Order/domain/Order.java
  18. 45 30
      08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/business/Order/domain/OrderDetail.java
  19. 14 0
      08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/common/mapper/XingxiUnifiedpayExtMapper.java
  20. 104 0
      08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/common/service/DefaultXingxiUnifiedpayCallbackClient.java
  21. 6 0
      08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/common/service/XingxiUnifiedpayCallbackClient.java
  22. 18 0
      08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/common/service/XingxiUnifiedpayCallbackDTO.java

+ 1 - 1
08.src/Xingxi/pom.xml

@@ -28,7 +28,7 @@
         <pagehelper.boot.version>1.4.7</pagehelper.boot.version>
         <fastjson.version>1.2.83</fastjson.version>
         <oshi.version>6.6.5</oshi.version>
-        <lombok.version>1.18.22</lombok.version>
+        <lombok.version>1.18.26</lombok.version>
         <commons.io.version>2.16.1</commons.io.version>
         <poi.version>4.1.2</poi.version>
         <velocity.version>2.3</velocity.version>

+ 41 - 9
08.src/Xingxi/xingxi-miniprogram-api/src/main/java/com/xingxi/api/configuration/security/SpringWebSecurityConfiguration.java

@@ -1,7 +1,9 @@
 package com.xingxi.api.configuration.security;
 
+import cn.binarywang.wx.miniapp.api.WxMaService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import me.chanjar.weixin.mp.api.WxMpService;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -10,6 +12,7 @@ import org.springframework.security.config.annotation.web.builders.WebSecurity;
 import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
 import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
 import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
 import org.springframework.web.cors.CorsConfiguration;
 import org.springframework.web.cors.CorsConfigurationSource;
 import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
@@ -30,6 +33,15 @@ class SpringWebSecurityConfiguration extends WebSecurityConfigurerAdapter {
     @Value("${spring.application.cors.allowedHeaders}")
     private String[] allowedHeaders;
 
+    private final JwtAuthenticationManager jwtAuthenticationManager;
+    private final WxLoginAuthenticationManager wxLoginAuthenticationManager;
+    private final WxAuthenticationSuccessHandler wxAuthenticationSuccessHandler;
+    private final WxAuthenticationFailureHandler wxAuthenticationFailureHandler;
+    private final WxAuthenticationEntryPoint wxAuthenticationEntryPoint;
+    private final WxAccessDeniedHandler wxAccessDeniedHandler;
+    private final WxMaService wxMaService;
+    private final WxMpService wxMpService;
+
     // cors
     @Bean("corsConfigurationSource")
     public CorsConfigurationSource corsConfigurationSource() {
@@ -41,7 +53,6 @@ class SpringWebSecurityConfiguration extends WebSecurityConfigurerAdapter {
         source.registerCorsConfiguration(pathPattern, configuration);
         return source;
     }
-
     @Override
     protected void configure(HttpSecurity http) throws Exception {
         http.csrf()
@@ -52,16 +63,37 @@ class SpringWebSecurityConfiguration extends WebSecurityConfigurerAdapter {
                 .cors()
                 .and()
                 .authorizeRequests()
-                .antMatchers("/error/**", "/unifiedpay/**", "/api/store/wxlogin", "/wxpay/**").permitAll()
+                .antMatchers("/error/**", "/unifiedpay/**").permitAll()
                 .anyRequest().authenticated()
                 .and()
                 .exceptionHandling()
-                .authenticationEntryPoint(null)
-                .accessDeniedHandler(null);
+                .authenticationEntryPoint(wxAuthenticationEntryPoint)
+                .accessDeniedHandler(wxAccessDeniedHandler);
+        // 使用WxAppletAuthenticationFilter替换默认的认证过滤器UsernamePasswordAuthenticationFilter
+
+
+        http.addFilterAt(wxLoginAuthenticationProcessingFilter(), UsernamePasswordAuthenticationFilter.class)
+                // 在WxAppletAuthenticationFilter前面添加用于验证jwt,识别用户是否登录的过滤器
+                .addFilterBefore(jwtAuthenticationTokenFilter(), WxLoginAuthenticationProcessingFilter.class);
+    }
+
+    @Bean
+    public JwtAuthenticationFilter jwtAuthenticationTokenFilter() {
+        log.debug("JwtAuthenticationFilter created.");
+        return new JwtAuthenticationFilter(jwtAuthenticationManager);
+    }
+
+    @Bean
+    public WxLoginAuthenticationProcessingFilter wxLoginAuthenticationProcessingFilter() {
+        log.debug("WxLoginAuthenticationProcessingFilter created.");
+        WxLoginAuthenticationProcessingFilter filter = new WxLoginAuthenticationProcessingFilter(wxLoginAuthenticationManager, wxMaService, wxMpService);
+        filter.setAuthenticationSuccessHandler(wxAuthenticationSuccessHandler);
+        filter.setAuthenticationFailureHandler(wxAuthenticationFailureHandler);
+        return filter;
+    }
+
+    @Override
+    public void configure(WebSecurity web) throws Exception {
+        web.ignoring().antMatchers("/api/store/wxlogin", "/wxpay/**");
     }
-//
-//    @Override
-//    public void configure(WebSecurity web) throws Exception {
-//
-//    }
 }

+ 1 - 0
08.src/Xingxi/xingxi-miniprogram-api/src/main/java/com/xingxi/api/service/impl/OrderApiServiceImpl.java

@@ -37,6 +37,7 @@ import com.xingxi.common.enums.EOrderStatus;
 import com.xingxi.common.exception.BusinessException;
 import com.xingxi.common.mq.bo.order.OrderBO;
 import com.xingxi.common.mq.publisher.order.OrderCreatedMqPublisher;
+import com.xingxi.common.mq.publisher.order.OrderPayedMqPublisher;
 import com.xingxi.common.utils.DateUtils;
 import com.xingxi.common.utils.PageUtils;
 import com.xingxi.common.utils.StringUtils;

+ 27 - 0
08.src/Xingxi/xingxi-miniprogram-api/src/main/java/com/xingxi/api/service/impl/XingxiUnifiedpayCallbackServiceImpl.java

@@ -0,0 +1,27 @@
+package com.xingxi.api.service.impl;
+
+
+import com.xingxi.common.service.XingxiUnifiedpayCallbackClient;
+import com.xingxi.common.service.XingxiUnifiedpayCallbackDTO;
+import com.xingxi.unifiedpay.domain.XingxiUnifiedpayCallbackResultDTO;
+import com.xingxi.unifiedpay.open.XingxiUnifiedpayCallbackServiceI;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Component;
+
+
+@Slf4j
+@Component
+@RequiredArgsConstructor
+class XingxiUnifiedpayCallbackServiceImpl implements XingxiUnifiedpayCallbackServiceI {
+    private final XingxiUnifiedpayCallbackClient xingxiUnifiedpayCallbackClient;
+
+    @Override
+    public void callbackFollowUpProcessing(XingxiUnifiedpayCallbackResultDTO xingxiUnifiedpayCallbackResultDTO) {
+        XingxiUnifiedpayCallbackDTO xingxiUnifiedpayCallbackDTO = new XingxiUnifiedpayCallbackDTO();
+        BeanUtils.copyProperties(xingxiUnifiedpayCallbackResultDTO, xingxiUnifiedpayCallbackDTO);
+        xingxiUnifiedpayCallbackClient.execute(xingxiUnifiedpayCallbackDTO);
+    }
+
+}

+ 25 - 0
08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/META-INF/apiclient_cert.pem

@@ -0,0 +1,25 @@
+-----BEGIN CERTIFICATE-----
+MIIEITCCAwmgAwIBAgIUT74STeWq1T4f9S50ATGmBy/mkvEwDQYJKoZIhvcNAQEL
+BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
+FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
+Q0EwHhcNMjUwNTA2MTI0MTQ5WhcNMzAwNTA1MTI0MTQ5WjB7MRMwEQYDVQQDDAox
+NzA5MzM3MjEwMRswGQYDVQQKDBLlvq7kv6HllYbmiLfns7vnu58xJzAlBgNVBAsM
+HuS4iua1t+mmqOemp+WVhui0uOaciemZkOWFrOWPuDELMAkGA1UEBhMCQ04xETAP
+BgNVBAcMCFNoZW5aaGVuMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
+vwu+mxVg80S1sLasQt9tJXSiP6y6EvBqA+I+ILsjcjvNhLyklUR8heh4bZII7laF
+Z1865HZvQFy6gMM8cHAY29gYtGAHJpmMaDRstQUhZsUB0V3SJexGdJMXFJzDcTEG
+pwKC1V+nKo8oLYu0Z1Qp8qRRMfnxZRTHpsGxS3urrIvuxjUYT4MtP5LfpFgGyzzA
+KkESxazNNF/tmSPcFsJ4Avvi0185pk0ywUteI1v1X6TNwveSoVEsTCQkCY+xHQ8s
+wgXKzsWltND7izxV9v160l0lDm+BE6WlCIOkpgpg4NvCUMs09XJqIKJ5WTpZZ7KS
+e8ZNsu0710DkIaaRyKqsywIDAQABo4G5MIG2MAkGA1UdEwQCMAAwCwYDVR0PBAQD
+AgP4MIGbBgNVHR8EgZMwgZAwgY2ggYqggYeGgYRodHRwOi8vZXZjYS5pdHJ1cy5j
+b20uY24vcHVibGljL2l0cnVzY3JsP0NBPTFCRDQyMjBFNTBEQkMwNEIwNkFEMzk3
+NTQ5ODQ2QzAxQzNFOEVCRDImc2c9SEFDQzQ3MUI2NTQyMkUxMkIyN0E5RDMzQTg3
+QUQxQ0RGNTkyNkUxNDAzNzEwDQYJKoZIhvcNAQELBQADggEBAJbIWrtDSomABA61
+5X4FgVC4M9WIjiZJDgPgf3W8ztVnXTMuk5uD1Lxb/W5Dx04ZXfbcb/ALz00MnbyK
+JOvY0w34p0ye8wsHAUlxhXOMOjiNSIQrzbMeeO4IicD6bFIFfVS7iS1WkH4MuiC0
+qrt3+UPWVBa3e8BAca+8TohM+HJpSWxpy9vxRNi5ESWR1DSupPykJEJiRquQ3eXT
+z00lQuuqxgldT2qioGoxcjCn891UedKtViE3PXgkU34YWLqrMu5O0PvcDyVb9/fT
+6IbG9C4Z4AyN91oYwpeXph5WQApgiOLl9LLwUN1IDzYvbXGbRudYbvypSHy88+Yf
+6y1/s3w=
+-----END CERTIFICATE-----

+ 28 - 0
08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/META-INF/apiclient_key.pem

@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC/C76bFWDzRLWw
+tqxC320ldKI/rLoS8GoD4j4guyNyO82EvKSVRHyF6HhtkgjuVoVnXzrkdm9AXLqA
+wzxwcBjb2Bi0YAcmmYxoNGy1BSFmxQHRXdIl7EZ0kxcUnMNxMQanAoLVX6cqjygt
+i7RnVCnypFEx+fFlFMemwbFLe6usi+7GNRhPgy0/kt+kWAbLPMAqQRLFrM00X+2Z
+I9wWwngC++LTXzmmTTLBS14jW/VfpM3C95KhUSxMJCQJj7EdDyzCBcrOxaW00PuL
+PFX2/XrSXSUOb4ETpaUIg6SmCmDg28JQyzT1cmogonlZOllnspJ7xk2y7TvXQOQh
+ppHIqqzLAgMBAAECggEBAIHa98nt9CImd+EPqXMi7stgxc/GFgw9gbH2HAifau6A
+m6c3mh8jmAhlBUZk1tE52h9zaVJU9jWnUdWn3vMGHr9/2PrxsqqYAAnsaF96h0OV
+cTDgNrE0MoeWWz/Vdjr/+eeXG1rxU2zoNYUPyqXZXVHiQpZXr67nOvWr/liyTPRQ
+Ue2d/mHYFXlWfEURPcBsyL8Tk33Ehz4Q2QYykn71q002qgb91vnvyjMaQsUsuQZ6
+OZVlvbte3p74MWDLv/XNd2LbesWosyRs6BXxMauckXcK1WVKCV5C5feWu76daHOv
+7Q5jOuN4KgCDlZ0Q+I9tA0T4HYqNSaD1FufZdKAeAWECgYEA+5X9ZGeiAbYoKOR4
+A9srNhLEkEKko8dVUvtomnV0WAaZ2tuiWzOBmTyZFrdQkQV9P8oxad0X5pl7tdKF
+Vm5RLtb1LWcodf4f2KZiqQOPpoDAYvCJ14EfLdFo3K/HJXMeNdcCYHyTN0cCJuYz
+zLFeUolVt4nPN7B+w+q6pWLQVMMCgYEAwmXWGRMX5UpW5qKOrVWW8MQe1STi9lgo
+IvjJhB/CITXruA3Cskpvt8yZPCB/w9Lgpjy6mf8UZoB+nUPB7Yd1uVJdmh9bHaOW
+zRx+4JZujBsbeWUsTJMn58g4c0SzZLU3weKj5KyfQxNK7zJ5MLm+xQ5ckrJ5YP8T
+6oKpySYmp1kCgYANhjOX6SZBV0xzXkzBUE/TWVDtvFdjYnzIuDEYVIYLkVdF95aT
+toIZ/bLxEKupEBV6j2D2oub9A3UuAgIe8lE05mNJrIj1RtLpb5BQK5vWRIeTCgEu
+74cAjIhJjL102upd1JARJcE4MH4CH0/bihFa+Hz+H89e3AMEfyLHbzdpxwKBgHt0
+WOdLrN08vLtzeNCzjkwRANOzvT9c9QBgpvl1gb+9kpksg/zeMNy03ovEx98AyRJJ
+dufdioMeD0qogTvrzuOGX1NFnoPQJDDWa+0NG992R5hsnBl1St5z1QW/F35ZZ7OF
+zzemOO5MDkah8zzyeSiD2l5/YX4r/+XqXREVXW7hAoGAPCCPTfM5wFBPejI5SUDS
+Bs1FPvRY0nDJrTQ9JlYdcaSHDHy3nLukJKrl9JoApFTgyUQFllP4JpniFPqGKh/x
+xs8u2xvzxwcePbliTRHnfkjTf0paez7QGkJf7PJ1qPzH3f5+btmIsS+utB5v29LJ
+TbctUOY6P/kh2C518AmGOq8=
+-----END PRIVATE KEY-----

+ 3 - 3
08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/application-local.yml

@@ -10,9 +10,9 @@ spring:
         wxpay:
           enabled: "true"
           app-id: "wx12e34630814e5d30"
-          mch-id: "1662657667"
-          apiv3-key: "Xiangmai20231225Xiangmai20231225"
-          cert-serial-no: 6BAA04DCBF80E735518219CC8BCD196BE039F713
+          mch-id: "1709337210"
+          apiv3-key: "mF9oH1oV9wY3gL8iW3kU4fJ7fE1dW4vK"
+          cert-serial-no: 4FBE124DE5AAD53E1FF52E740131A6072FE692F1
           private-key-path: "classpath:META-INF/apiclient_key.pem"
           private-cert-path: "classpath:META-INF/apiclient_cert.pem"
     request:

+ 3 - 3
08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/application-release.yml

@@ -10,9 +10,9 @@ spring:
         wxpay:
           enabled: "true"
           app-id: "wx12e34630814e5d30"
-          mch-id: "1662657667"
-          apiv3-key: "Xiangmai20231225Xiangmai20231225"
-          cert-serial-no: 6BAA04DCBF80E735518219CC8BCD196BE039F713
+          mch-id: "1709337210"
+          apiv3-key: "mF9oH1oV9wY3gL8iW3kU4fJ7fE1dW4vK"
+          cert-serial-no: 4FBE124DE5AAD53E1FF52E740131A6072FE692F1
           private-key-path: "classpath:META-INF/apiclient_key.pem"
           private-cert-path: "classpath:META-INF/apiclient_cert.pem"
     request:

+ 3 - 3
08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/application-test.yml

@@ -10,9 +10,9 @@ spring:
         wxpay:
           enabled: "true"
           app-id: "wx12e34630814e5d30"
-          mch-id: "1662657667"
-          apiv3-key: "Xiangmai20231225Xiangmai20231225"
-          cert-serial-no: 6BAA04DCBF80E735518219CC8BCD196BE039F713
+          mch-id: "1709337210"
+          apiv3-key: "mF9oH1oV9wY3gL8iW3kU4fJ7fE1dW4vK"
+          cert-serial-no: 4FBE124DE5AAD53E1FF52E740131A6072FE692F1
           private-key-path: "classpath:META-INF/apiclient_key.pem"
           private-cert-path: "classpath:META-INF/apiclient_cert.pem"
     request:

+ 1 - 1
08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/logback-local.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <!-- 日志存放路径 -->
-	<property name="log.path" value="/home/appuser/server/dev/xingxi-miniprogram-store-api/logs/" />
+	<property name="log.path" value="/home/appuser/server/dev/xingxi-miniprogram-api/logs/" />
     <!-- 日志输出格式 -->
 	<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 

+ 1 - 1
08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/logback-release.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <!-- 日志存放路径 -->
-	<property name="log.path" value="/home/appuser/server/xingxi-miniprogram-store-api/logs/" />
+	<property name="log.path" value="/home/appuser/server/xingxi-miniprogram-api/logs/" />
     <!-- 日志输出格式 -->
 	<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 

+ 1 - 1
08.src/Xingxi/xingxi-miniprogram-api/src/main/resources/logback-test.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <!-- 日志存放路径 -->
-	<property name="log.path" value="/home/appuser/server/xingxi-miniprogram-store-api/logs/" />
+	<property name="log.path" value="/home/appuser/server/xingxi-miniprogram-api/logs/" />
     <!-- 日志输出格式 -->
 	<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 

+ 1 - 1
08.src/Xingxi/xingxi-pay-utils/xingxi-unifiedpay-spring-boot-starter/src/main/java/com/xingxi/unifiedpay/open/XingxiUnifiedpayCallbackServiceI.java

@@ -4,5 +4,5 @@ import com.xingxi.unifiedpay.domain.XingxiUnifiedpayCallbackResultDTO;
 
 public interface XingxiUnifiedpayCallbackServiceI {
 
-    void callbackFollowUpProcessing(XingxiUnifiedpayCallbackResultDTO biandanUnifiedpayCallbackResultDTO);
+    void callbackFollowUpProcessing(XingxiUnifiedpayCallbackResultDTO xingxiUnifiedpayCallbackResultDTO);
 }

+ 0 - 515
08.src/Xingxi/xingxi-pay-utils/xingxi-unifiedpay-spring-boot-starter/src/main/java/com/xingxi/unifiedpay/service/EcommerceWXPayUnifiedpayServiceImpl.java

@@ -1,515 +0,0 @@
-package com.xingxi.unifiedpay.service;
-
-import com.xingxi.unifiedpay.bean.*;
-import com.xingxi.unifiedpay.configuration.XingxiUnifiedpayProperties;
-import com.xingxi.unifiedpay.domain.XingxiUnifiedPaymentInfoDTO;
-import com.xingxi.unifiedpay.domain.XingxiUnifiedpayCallbackResultDTO;
-import com.xingxi.unifiedpay.domain.MercUnifiedpayDTO;
-import com.xingxi.unifiedpay.open.XingxiUnifiedpayCallbackServiceI;
-import com.github.binarywang.wxpay.bean.ecommerce.*;
-import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum;
-import com.github.binarywang.wxpay.config.WxPayConfig;
-import com.github.binarywang.wxpay.service.EcommerceService;
-import com.github.binarywang.wxpay.service.WxPayService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
-import org.springframework.util.StreamUtils;
-import org.springframework.util.StringUtils;
-
-import javax.servlet.http.HttpServletRequest;
-import java.nio.charset.Charset;
-import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-@Slf4j
-@XingxiUnifiedpay(name = "EcommerceWXPay", dependsOn = {"wxPayService"})
-@RequiredArgsConstructor
-class EcommerceWXPayUnifiedpayServiceImpl implements UnifiedpayServiceI {
-    private final XingxiUnifiedpayCallbackServiceI biandanUnifiedpayCallbackServiceI;
-    private final XingxiUnifiedpayProperties biandanUnifiedpayProperties;
-    private final WxPayService wxPayService;
-
-    @Override
-    public BiandanUnifiedpayOrderResponse unifiedpay(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayOrderRequest request) throws Exception {
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        WxPayConfig wxPayConfig = wxPayService.getConfig();
-
-        PartnerTransactionsRequest partnerTransactionsRequest = requestToPartnerTransactionsRequest(mercUnifiedpayDTO, request);
-        TransactionsResult transactionsResult = ecommerceService.partner(TradeTypeEnum.JSAPI, partnerTransactionsRequest);
-
-        XingxiUnifiedPaymentInfoDTO biandanUnifiedPaymentInfoDTO = buildBiandanUnifiedPaymentInfoDTO(wxPayConfig, request, partnerTransactionsRequest, transactionsResult);
-        biandanUnifiedPaymentInfoDTO.setCallUnifiedPayMercRole(mercUnifiedpayDTO.getCallUnifiedPayMercRole());
-        biandanUnifiedPaymentInfoDTO.setCallUnifiedpayMercId(mercUnifiedpayDTO.getCallUnifiedpayMercId());
-
-        Object payInfo = transactionsResult.getPayInfo(TradeTypeEnum.JSAPI, wxPayConfig.getAppId(), wxPayConfig.getMchId(), wxPayConfig.getPrivateKey());
-        BiandanUnifiedpayOrderResponse response = new BiandanUnifiedpayOrderResponse();
-        response.setPaySign(payInfo);
-        response.setOriginalResponseObj(transactionsResult);
-        response.setBiandanUnifiedPaymentInfoDTO(biandanUnifiedPaymentInfoDTO);
-        return response;
-    }
-
-    @Override
-    public BiandanUnifiedpayContinue2payResponse continue2pay(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayContinue2payRequest request) throws Exception {
-
-        WxPayConfig wxPayConfig = wxPayService.getConfig();
-        String prepayId = request.getPrepayId();
-
-        TransactionsResult transactionsResult = new TransactionsResult();
-        transactionsResult.setPrepayId(prepayId);
-        Object payInfo = transactionsResult.getPayInfo(
-                TradeTypeEnum.JSAPI,
-                wxPayConfig.getAppId(),
-                wxPayConfig.getMchId(),
-                wxPayConfig.getPrivateKey()
-        );
-
-        BiandanUnifiedpayContinue2payResponse response = new BiandanUnifiedpayContinue2payResponse();
-        response.setPaySign(payInfo);
-        response.setOriginalResponseObj(transactionsResult);
-        return response;
-    }
-
-
-
-
-    @Override
-    public BiandanUnifiedpayCallbackResponse callback(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayCallbackRequest request) throws Exception{
-
-        HttpServletRequest httpServletRequest = request.getHttpServletRequest();
-        SignatureHeader signatureHeader = httpRequestToSignatureHeader(httpServletRequest);
-        String s = StreamUtils.copyToString(httpServletRequest.getInputStream(), Charset.defaultCharset());
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        PartnerTransactionsNotifyResult partnerTransactionsNotifyResult = ecommerceService.parsePartnerNotifyResult(s, signatureHeader);
-        PartnerTransactionsResult partnerTransactionsResult = partnerTransactionsNotifyResult.getResult();
-
-        XingxiUnifiedpayCallbackResultDTO biandanUnifiedpayCallbackResultDTO = partnerTransactionsResultToBiandanUnifiedpayCallbackResultDTO(partnerTransactionsResult);
-        biandanUnifiedpayCallbackServiceI.callbackFollowUpProcessing(biandanUnifiedpayCallbackResultDTO);
-
-        return null;
-    }
-
-
-    @Override
-    public BiandanUnifiedpayAddProfitsharingReceiversResponse addProfitsharingReceivers(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayAddProfitsharingReceiversRequest request) throws Exception{
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        WxPayConfig wxPayConfig = wxPayService.getConfig();
-        String appId = wxPayConfig.getAppId();
-
-        String account = request.getAccount();
-
-        ProfitSharingReceiverRequest receiverRequest = new ProfitSharingReceiverRequest();
-        receiverRequest.setAppid(appId);
-        receiverRequest.setAccount(account);
-        receiverRequest.setType("PERSONAL_OPENID");
-        receiverRequest.setRelationType("OTHERS");
-        ProfitSharingReceiverResult profitSharingReceiverResult = ecommerceService.addReceivers(receiverRequest);
-
-        BiandanUnifiedpayAddProfitsharingReceiversResponse response = new BiandanUnifiedpayAddProfitsharingReceiversResponse();
-        response.setType(profitSharingReceiverResult.getType());
-        response.setOriginalResponseObj(profitSharingReceiverResult);
-
-        return response;
-
-    }
-
-    @Override
-    public BiandanUnifiedpayDelProfitsharingReceiversResponse delProfitsharingReceivers(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayDelProfitsharingReceiversRequest request) throws Exception {
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        WxPayConfig wxPayConfig = wxPayService.getConfig();
-        String appId = wxPayConfig.getAppId();
-        String account = request.getAccount();
-
-        ProfitSharingReceiverRequest receiverRequest = new ProfitSharingReceiverRequest();
-        receiverRequest.setAppid(appId);
-        receiverRequest.setAccount(account);
-        receiverRequest.setType("PERSONAL_OPENID");
-        ProfitSharingReceiverResult profitSharingReceiverResult = ecommerceService.deleteReceivers(receiverRequest);
-
-        BiandanUnifiedpayDelProfitsharingReceiversResponse response = new BiandanUnifiedpayDelProfitsharingReceiversResponse();
-        response.setType(profitSharingReceiverResult.getType());
-        response.setOriginalResponseObj(profitSharingReceiverResult);
-        return response;
-
-    }
-
-    private XingxiUnifiedpayCallbackResultDTO partnerTransactionsResultToBiandanUnifiedpayCallbackResultDTO(PartnerTransactionsResult partnerTransactionsResult){
-
-        String tradeState = partnerTransactionsResult.getTradeState();
-        String outTradeNo = partnerTransactionsResult.getOutTradeNo();
-        String successTimeString = partnerTransactionsResult.getSuccessTime();
-        String tradeType = partnerTransactionsResult.getTradeType();
-        String bankType = partnerTransactionsResult.getBankType();
-        String attach = partnerTransactionsResult.getAttach();
-        String transactionId = partnerTransactionsResult.getTransactionId();
-
-        XingxiUnifiedpayCallbackResultDTO biandanUnifiedpayCallbackResultDTO = new XingxiUnifiedpayCallbackResultDTO();
-        biandanUnifiedpayCallbackResultDTO.setTradeState(tradeState);
-        biandanUnifiedpayCallbackResultDTO.setOutTradeNo(outTradeNo);
-        biandanUnifiedpayCallbackResultDTO.setSuccessTimeString(successTimeString);
-        biandanUnifiedpayCallbackResultDTO.setTradeType(tradeType);
-        biandanUnifiedpayCallbackResultDTO.setBankType(bankType);
-        biandanUnifiedpayCallbackResultDTO.setAttach(attach);
-        biandanUnifiedpayCallbackResultDTO.setTransactionId(transactionId);
-        biandanUnifiedpayCallbackResultDTO.setCallUnifiedpayComponent("EcommerceWXPayCallback");
-
-        biandanUnifiedpayCallbackResultDTO.setOriginalObj(partnerTransactionsResult);
-        return biandanUnifiedpayCallbackResultDTO;
-    }
-
-
-    @Override
-    public BiandanUnifiedpayRefundResponse refund(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayRefundRequest request) throws Exception {
-
-        String subMchid = mercUnifiedpayDTO.getSubMchid();
-        String outRefundNo = request.getOutRefundNo();
-        String transactionId = request.getTransactionId();
-        String currency = request.getCurrency();
-        Integer refundAmt = request.getRefundAmt();
-        Integer orderOriginalTotalAmt = request.getOrderOriginalTotalAmt();
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        WxPayConfig config = wxPayService.getConfig();
-
-        RefundsRequest refundsRequest = new RefundsRequest();
-        refundsRequest.setTransactionId(transactionId);
-        refundsRequest.setOutRefundNo(outRefundNo);
-        refundsRequest.setSubMchid(subMchid);
-        refundsRequest.setSpAppid(config.getAppId());
-
-        RefundsRequest.Amount amount = RefundsRequest.Amount.builder().build();
-        amount.setCurrency(currency);
-        amount.setRefund(refundAmt);
-        amount.setTotal(orderOriginalTotalAmt);
-        refundsRequest.setAmount(amount);
-        RefundsResult refundsResult = ecommerceService.refunds(refundsRequest);
-
-        BiandanUnifiedpayRefundResponse response = new BiandanUnifiedpayRefundResponse();
-        response.setRefundId(refundsResult.getRefundId());
-        return response;
-    }
-
-
-    @Override
-    public BiandanUnifiedpayQueryProfitSharingResponse queryProfitSharing(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayQueryProfitSharingRequest request) throws Exception {
-
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-
-        ProfitSharingQueryRequest profitSharingQueryRequest = new ProfitSharingQueryRequest();
-        profitSharingQueryRequest.setOutOrderNo(request.getOutOrderNo());
-        profitSharingQueryRequest.setTransactionId(request.getTransactionId());
-        profitSharingQueryRequest.setSubMchid(mercUnifiedpayDTO.getSubMchid());
-        ProfitSharingResult profitSharingResult = ecommerceService.queryProfitSharing(profitSharingQueryRequest);
-
-        List<ProfitSharingResult.Receiver> receivers = profitSharingResult.getReceivers();
-
-        BiandanUnifiedpayQueryProfitSharingResponse response = new BiandanUnifiedpayQueryProfitSharingResponse();
-        response.setOrderId(profitSharingResult.getOrderId());
-        response.setProfitSharingStatus(profitSharingResult.getStatus());
-        response.setReceivers(receivers.stream().map(this::toReceiver).collect(Collectors.toList()));
-        response.setOriginalResponseObj(profitSharingResult);
-
-        return response;
-    }
-
-
-
-    private BiandanUnifiedpayQueryProfitSharingResponse.Receiver toReceiver(ProfitSharingResult.Receiver receiver){
-        BiandanUnifiedpayQueryProfitSharingResponse.Receiver receivers = new BiandanUnifiedpayQueryProfitSharingResponse.Receiver();
-        BeanUtils.copyProperties(receiver, receivers);
-        return receivers;
-    }
-
-    @Override
-    public BiandanUnifiedpayCreateSubMchApplyResponse createSubMchApply(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayCreateSubMchApplyRequest request) throws Exception {
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        ApplymentsRequest applymentsRequest = new ApplymentsRequest();
-        BeanUtils.copyProperties(request, applymentsRequest);
-        ApplymentsResult applymentsResult = ecommerceService.createApply(applymentsRequest);
-        BiandanUnifiedpayCreateSubMchApplyResponse response = new BiandanUnifiedpayCreateSubMchApplyResponse();
-        response.setApplymentId(applymentsResult.getApplymentId());
-        response.setOriginalResponseObj(applymentsResult);
-
-        return response;
-    }
-
-    @Override
-    public BiandanUnifiedpayQueryApplyStatusResponse queryApplyStatusByApplymentId(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayQueryApplyStatusRequest request) throws Exception {
-
-        String applymentId = request.getApplymentId();
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        ApplymentsStatusResult applymentsStatusResult = ecommerceService.queryApplyStatusByApplymentId(applymentId);
-
-        BiandanUnifiedpayQueryApplyStatusResponse response = new BiandanUnifiedpayQueryApplyStatusResponse();
-        BeanUtils.copyProperties(applymentsStatusResult, response);
-        response.setOriginalResponseObj(applymentsStatusResult);
-
-        return response;
-    }
-
-    @Override
-    public BiandanUnifiedpayQueryRefundResponse queryRefund(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayQueryRefundRequest request) throws Exception {
-
-        String subMchid = mercUnifiedpayDTO.getSubMchid();
-        String outRefundNo = request.getOutRefundNo();
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        RefundQueryResult refundQueryResult = ecommerceService.queryRefundByOutRefundNo(subMchid, outRefundNo);
-
-        String refundId = refundQueryResult.getRefundId();
-        String status = refundQueryResult.getStatus();
-
-        BiandanUnifiedpayQueryRefundResponse response = new BiandanUnifiedpayQueryRefundResponse();
-        response.setRefundId(refundId);
-        response.setRefundStatus(status);
-        response.setOriginalResponseObj(refundQueryResult);
-
-        return response;
-    }
-
-    @Override
-    public BiandanUnifiedpayQuerySubMchCurrBalanceResponse querySubMchCurrBalance(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayQuerySubMchCurrBalanceRequest request) throws Exception {
-
-        String subMchid = request.getSubMchid();
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        WxPayConfig wxPayConfig = wxPayService.getConfig();
-
-        FundBalanceResult fundBalanceResult = ecommerceService.subNowBalance(subMchid);
-        BiandanUnifiedpayQuerySubMchCurrBalanceResponse response = new BiandanUnifiedpayQuerySubMchCurrBalanceResponse();
-        response.setOriginalResponseObj(fundBalanceResult);
-        response.setAvailableAmount(fundBalanceResult.getAvailableAmount());
-        response.setPendingAmount(fundBalanceResult.getPendingAmount());
-
-        return response;
-    }
-
-    @Override
-    public BiandanUnifiedpayQuerySubWithdrawResponse querySubWithdraw(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayQuerySubWithdrawRequest request) throws Exception {
-
-        String subMchid = request.getSubMchid();
-        String outRequestNo = request.getOutRequestNo();
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        WxPayConfig wxPayConfig = wxPayService.getConfig();
-
-        SubWithdrawStatusResult subWithdrawStatusResult = ecommerceService.querySubWithdrawByOutRequestNo(subMchid, outRequestNo);
-        String status = subWithdrawStatusResult.getStatus();
-
-        BiandanUnifiedpayQuerySubWithdrawResponse response = new BiandanUnifiedpayQuerySubWithdrawResponse();
-        response.setOriginalResponseObj(subWithdrawStatusResult);
-        response.setStatus(status);
-
-        return response;
-    }
-
-    @Override
-    public BiandanUnifiedpayProfitSharingOrdersUnSplitAmountResponse queryProfitSharingOrdersUnsplitAmount(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayProfitSharingOrdersUnSplitAmountRequest request) throws Exception {
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        WxPayConfig wxPayConfig = wxPayService.getConfig();
-
-        ProfitSharingOrdersUnSplitAmountRequest profitSharingOrdersUnSplitAmountRequest = new ProfitSharingOrdersUnSplitAmountRequest();
-        profitSharingOrdersUnSplitAmountRequest.setTransactionId(request.getTransactionId());
-        ProfitSharingOrdersUnSplitAmountResult profitSharingOrdersUnSplitAmountResult = ecommerceService.queryProfitSharingOrdersUnsplitAmount(profitSharingOrdersUnSplitAmountRequest);
-
-        BiandanUnifiedpayProfitSharingOrdersUnSplitAmountResponse response = new BiandanUnifiedpayProfitSharingOrdersUnSplitAmountResponse();
-        response.setUnsplitAmount(response.getUnsplitAmount());
-        response.setOriginalResponseObj(profitSharingOrdersUnSplitAmountResult);
-
-        return response;
-    }
-
-    @Override
-    public BiandanUnifiedpaySubWithdrawResponse subWithdraw(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpaySubWithdrawRequest request) throws Exception {
-
-        String subMchid = request.getSubMchid();
-        String outRequestNo = request.getOutRequestNo();
-        Integer txAmt = request.getTxAmt();
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        WxPayConfig wxPayConfig = wxPayService.getConfig();
-
-        SubWithdrawRequest subWithdrawRequest = new SubWithdrawRequest();
-        subWithdrawRequest.setSubMchid(subMchid);
-        subWithdrawRequest.setAmount(txAmt);
-        subWithdrawRequest.setOutRequestNo(outRequestNo);
-
-        SubWithdrawResult subWithdrawResult = ecommerceService.subWithdraw(subWithdrawRequest);
-        String withdrawId = subWithdrawResult.getWithdrawId();
-
-        BiandanUnifiedpaySubWithdrawResponse response = new BiandanUnifiedpaySubWithdrawResponse();
-        response.setSubMchid(subMchid);
-        response.setOutRequestNo(outRequestNo);
-        response.setWithdrawId(withdrawId);
-        response.setOriginalResponseObj(subWithdrawResult);
-
-        return response;
-    }
-
-    @Override
-    public BiandanUnifiedpayFinishProfitSharingResponse finishProfitSharing(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayFinishProfitSharingRequest request) throws Exception {
-
-        String description = request.getDescription();
-        String transactionId = request.getTransactionId();
-        String outOrderNo = request.getOutOrderNo();
-        String subMchid = request.getSubMchid();
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        WxPayConfig wxPayConfig = wxPayService.getConfig();
-
-        FinishOrderRequest finishOrderRequest = FinishOrderRequest.builder().build();
-        finishOrderRequest.setSubMchid(subMchid);
-        finishOrderRequest.setTransactionId(transactionId);
-        finishOrderRequest.setOutOrderNo(outOrderNo);
-        finishOrderRequest.setDescription(description);
-
-        ProfitSharingResult profitSharingResult = ecommerceService.finishOrder(finishOrderRequest);
-        String orderId = profitSharingResult.getOrderId();
-
-        BiandanUnifiedpayFinishProfitSharingResponse response = new BiandanUnifiedpayFinishProfitSharingResponse();
-        response.setOrderId(orderId);
-        response.setOriginalResponseObj(profitSharingResult);
-        return response;
-    }
-
-    @Override
-    public BiandanUnifiedpayProfitSharingResponse profitSharing(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayProfitSharingRequest request) throws Exception {
-
-        String subMchid = mercUnifiedpayDTO.getSubMchid();
-        String transactionId = request.getTransactionId();
-        String outOrderNo = request.getOutOrderNo();
-        List<BiandanUnifiedpayProfitSharingRequest.ProfitSharingReceiversDTO> profitSharingReceivers = request.getProfitSharingReceivers();
-
-        EcommerceService ecommerceService = wxPayService.getEcommerceService();
-        WxPayConfig wxPayConfig = wxPayService.getConfig();
-        String appId = wxPayConfig.getAppId();
-
-        List<ProfitSharingRequest.Receiver> receivers = new ArrayList<>();
-        for (BiandanUnifiedpayProfitSharingRequest.ProfitSharingReceiversDTO profitSharingReceiver : profitSharingReceivers) {
-            Integer amount = profitSharingReceiver.getAmount();
-            String description = profitSharingReceiver.getDescription();
-            String receiverAccount = profitSharingReceiver.getReceiverAccount();
-            ProfitSharingRequest.Receiver receiver = new ProfitSharingRequest.Receiver();
-            receiver.setType("PERSONAL_OPENID");
-            receiver.setAmount(amount);
-            receiver.setReceiverAccount(receiverAccount);
-            receiver.setDescription(description);
-            receivers.add(receiver);
-        }
-
-        ProfitSharingRequest profitSharingRequest = new ProfitSharingRequest();
-        profitSharingRequest.setAppid(appId);
-        profitSharingRequest.setSubMchid(subMchid);
-        profitSharingRequest.setOutOrderNo(outOrderNo);
-        profitSharingRequest.setTransactionId(transactionId);
-        profitSharingRequest.setReceivers(receivers);
-
-        ProfitSharingResult profitSharingResult = ecommerceService.profitSharing(profitSharingRequest);
-        String orderId = profitSharingResult.getOrderId();
-        String status = profitSharingResult.getStatus();
-
-        BiandanUnifiedpayProfitSharingResponse response = new BiandanUnifiedpayProfitSharingResponse();
-        response.setOrderId(orderId);
-        response.setProfitSharingStatus(status);
-        response.setOriginalResponseObj(profitSharingResult);
-
-        return response;
-    }
-
-    private XingxiUnifiedPaymentInfoDTO buildBiandanUnifiedPaymentInfoDTO(WxPayConfig wxPayConfig, BiandanUnifiedpayOrderRequest biandanUnifiedpayOrderRequest, PartnerTransactionsRequest request, TransactionsResult result) {
-
-        Long sellerId = biandanUnifiedpayOrderRequest.getSellerId();
-        Long orderId = biandanUnifiedpayOrderRequest.getOrderId();
-        String orderNo = biandanUnifiedpayOrderRequest.getOrderNo();
-        String orderStatus = biandanUnifiedpayOrderRequest.getOrderStatus();
-        Integer txAmt = biandanUnifiedpayOrderRequest.getTxAmt();
-        String openid = request.getPayer().getSpOpenid();
-        String appId = wxPayConfig.getAppId();
-        String mchId = wxPayConfig.getMchId();
-
-        XingxiUnifiedPaymentInfoDTO paymentInfo = new XingxiUnifiedPaymentInfoDTO();
-        paymentInfo.setProfitSharing("1");
-        paymentInfo.setSubCurrency("CNY");
-        paymentInfo.setPayKind("EcommerceWXPay");
-        paymentInfo.setSellerId(sellerId);
-        paymentInfo.setCombineAppid(appId);
-        paymentInfo.setCombineMchid(mchId);
-        paymentInfo.setMchid(mchId);
-        paymentInfo.setSubMchid(request.getSubMchid());
-        paymentInfo.setNotifyUrl(request.getNotifyUrl());
-        paymentInfo.setWxOpenId(openid);
-        paymentInfo.setOrderId(orderId);
-        paymentInfo.setOrderStatus(orderStatus);
-        paymentInfo.setOrderNo(orderNo);
-        paymentInfo.setOutTradeNo(request.getOutTradeNo());
-        paymentInfo.setPayAmount(txAmt);
-        paymentInfo.setTimeStart(LocalDateTime.now());
-        paymentInfo.setTimeExpire(parseTimeExpire(request.getTimeExpire()));
-        paymentInfo.setPrepayId(result.getPrepayId());
-
-        return paymentInfo;
-    }
-
-    private PartnerTransactionsRequest requestToPartnerTransactionsRequest(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayOrderRequest request){
-
-        String unifiedpayCallbackUrl = biandanUnifiedpayProperties.getUnifiedpayCallbackUrl();
-        if (!StringUtils.hasLength(unifiedpayCallbackUrl)){
-            log.debug("支付回调地址不能为空,格式列如[https://xxx.com/wxpay/%s/callback],域名自行替换");
-            throw new RuntimeException("支付回调地址不能为空");
-        }
-
-        String subMchid = mercUnifiedpayDTO.getSubMchid();
-        String unifiedpayOutTradeNo = request.getUnifiedpayOutTradeNo();
-        String payerOpenid = request.getPayerOpenid();
-        Integer txAmt = request.getTxAmt();
-        Long sellerId = request.getSellerId();
-        WxPayConfig config = wxPayService.getConfig();
-        log.debug("微信支付配置:" + config.toString());
-        PartnerTransactionsRequest partnerTransactionsRequest = new PartnerTransactionsRequest();
-        partnerTransactionsRequest.setDescription("恩瑞斯购物");
-        partnerTransactionsRequest.setSpAppid(config.getAppId());
-        partnerTransactionsRequest.setSpMchid(config.getMchId());
-        partnerTransactionsRequest.setSubMchid(subMchid);
-        partnerTransactionsRequest.setOutTradeNo(unifiedpayOutTradeNo);
-
-        PartnerTransactionsRequest.Payer payer = new PartnerTransactionsRequest.Payer();
-        payer.setSpOpenid(payerOpenid);
-        partnerTransactionsRequest.setPayer(payer);
-
-        PartnerTransactionsRequest.SettleInfo settleInfo = new PartnerTransactionsRequest.SettleInfo();
-        settleInfo.setProfitSharing(true);
-        partnerTransactionsRequest.setSettleInfo(settleInfo);
-
-        PartnerTransactionsRequest.Amount amount = new PartnerTransactionsRequest.Amount();
-        amount.setCurrency("CNY");
-        amount.setTotal(txAmt);
-        partnerTransactionsRequest.setAmount(amount);
-        partnerTransactionsRequest.setTimeExpire(timeExpire());
-        partnerTransactionsRequest.setNotifyUrl(String.format(unifiedpayCallbackUrl, sellerId));
-
-        return partnerTransactionsRequest;
-    }
-
-    private SignatureHeader httpRequestToSignatureHeader(HttpServletRequest request){
-        String serial = request.getHeader("Wechatpay-Serial");
-        String signature = request.getHeader("Wechatpay-Signature");
-        String timestamp = request.getHeader("Wechatpay-Timestamp");
-        String nonceStr = request.getHeader("Wechatpay-Nonce");
-        SignatureHeader signatureHeader = new SignatureHeader();
-        signatureHeader.setSerialNo(serial);
-        signatureHeader.setSigned(signature);
-        signatureHeader.setNonce(nonceStr);
-        signatureHeader.setTimeStamp(timestamp);
-        return signatureHeader;
-    }
-
-}

+ 0 - 41
08.src/Xingxi/xingxi-pay-utils/xingxi-unifiedpay-spring-boot-starter/src/main/java/com/xingxi/unifiedpay/service/OtherUnifiedpayServiceImpl.java

@@ -1,41 +0,0 @@
-package com.xingxi.unifiedpay.service;
-
-import com.xingxi.unifiedpay.bean.*;
-import com.xingxi.unifiedpay.domain.MercUnifiedpayDTO;
-
-@XingxiUnifiedpay(name = "OtherPayTest", dependsOn = {""})
-class OtherUnifiedpayServiceImpl implements UnifiedpayServiceI {
-
-    @Override
-    public BiandanUnifiedpayOrderResponse unifiedpay(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayOrderRequest request) {
-        throw new RuntimeException("商户不支持");
-    }
-
-    @Override
-    public BiandanUnifiedpayContinue2payResponse continue2pay(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayContinue2payRequest request) throws Exception {
-        throw new RuntimeException("商户不支持");
-    }
-
-    @Override
-    public BiandanUnifiedpayCallbackResponse callback(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayCallbackRequest request) {
-        throw new RuntimeException("商户不支持");
-    }
-
-    @Override
-    public BiandanUnifiedpayRefundResponse refund(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayRefundRequest request) throws Exception {
-        throw new RuntimeException("商户不支持");
-    }
-
-    @Override
-    public BiandanUnifiedpayQueryRefundResponse queryRefund(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpayQueryRefundRequest request) throws Exception {
-        throw new RuntimeException("商户不支持");
-    }
-
-    @Override
-    public BiandanUnifiedpaySubWithdrawResponse subWithdraw(MercUnifiedpayDTO mercUnifiedpayDTO, BiandanUnifiedpaySubWithdrawRequest request) throws Exception {
-        throw new RuntimeException("商户不支持");
-    }
-
-
-
-}

+ 0 - 154
08.src/Xingxi/xingxi-pay-utils/xingxi-unifiedpay-spring-boot-starter/src/main/java/com/xingxi/unifiedpay/service/XingxiUnifiedpayRepositoryImpl.java

@@ -1,154 +0,0 @@
-package com.xingxi.unifiedpay.service;
-
-import com.xingxi.common.aliyun.oss.AliyunOSSClient;
-
-import com.xingxi.unifiedpay.repository.XingxiUnifiedpayRepository;
-import com.aliyun.oss.model.OSSObject;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-import org.springframework.util.StreamUtils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-
-@Slf4j
-@Component
-@RequiredArgsConstructor
-class XingxiUnifiedpayRepositoryImpl implements XingxiUnifiedpayRepository {
-
-    private final AliyunOSSClient aliyunOSSClient;
-//    private final IMerchantService merchantService;
-//    private final IMercWxappService mercWxappService;
-//
-//    @Override
-//    public MercUnifiedpayDTO selectMercUnifiedpayDTOByMercId(Long mercId) {
-//        Merchant merchant = merchantService.selectMerchantByMercId(mercId);
-//        if (ObjectUtils.isEmpty(merchant)) {
-//            log.debug("商户[" + mercId + "]不存在");
-//            throw new BusinessException("商户不存在");
-//        }
-//        if (!"IN_COOPERATION".equals(merchant.getStatus())) {
-//            log.debug("商户[" + mercId + "]已停止合作");
-//            throw new BusinessException("已停止合作");
-//        }
-//        MercWxapp mercWxapp = new MercWxapp();
-//        mercWxapp.setMercId(mercId);
-//        if (EPaymentChannel.WX_PAY.getVal().equals(merchant.getPaymentChannel())) {
-//            mercWxapp.setAppOrgType(EAppOrgType.WXPAY.getVal());
-//        } else {
-//            mercWxapp.setCurFlag(EYesNo.YES.getVal());
-//        }
-//        mercWxapp.setDelFlag(EYesNo.NO.getVal());
-//
-//        mercWxapp = mercWxappService.selectMercWxappByCond(mercWxapp);
-//        if (ObjectUtils.isEmpty(mercWxapp)) {
-//            log.debug("商户[" + mercId + "]支付配置信息不存在");
-//            throw new BusinessException("商户支付配置信息不存在");
-//        }
-//        if (!EAppOrgType.XIAOWEI.getVal().equals(mercWxapp.getAppOrgType()) &&
-//                !EAppOrgType.ENTERPRISE.getVal().equals(mercWxapp.getAppOrgType()) &&
-//                !EAppOrgType.WXPAY.getVal().equals(mercWxapp.getAppOrgType())) {
-//            log.debug("商户[" + mercId + "]支付配置信息不正确");
-//            throw new BusinessException("支付配置信息不正确");
-//        }
-//        MercUnifiedpayDTO mercUnifiedpayDTO = new MercUnifiedpayDTO();
-//        mercUnifiedpayDTO.setMercId(mercId);
-//        mercUnifiedpayDTO.setPaymentChannel(merchant.getPaymentChannel());
-//        mercUnifiedpayDTO.setPaymentMethod(merchant.getPaymentMethod());
-//        if(EAppOrgType.WXPAY.getVal().equals(mercWxapp.getAppOrgType())){
-//            mercUnifiedpayDTO.setSubMchid(mercWxapp.getWxMchId());
-//        } else {
-//            mercUnifiedpayDTO.setSubMchid(mercWxapp.getSubMchid());
-//        }
-//        return mercUnifiedpayDTO;
-//    }
-//
-//    @Override
-//    public MercUnifiedpayConfigDTO selectMercUnifiedpayConfigDTOByCallUnifiedpayMercId(Long mercId) {
-//
-//        Merchant merchant = merchantService.selectMerchantByMercId(mercId);
-//        if (ObjectUtils.isEmpty(merchant)) {
-//            log.debug("商户[" + mercId + "]不存在");
-//            throw new BusinessException("商户不存在");
-//        }
-//        if (!"IN_COOPERATION".equals(merchant.getStatus())) {
-//            log.debug("商户[" + mercId + "]已停止合作");
-//            throw new BusinessException("已停止合作");
-//        }
-//        MercWxapp mercWxapp = new MercWxapp();
-//        mercWxapp.setMercId(mercId);
-//
-//        if (EPaymentChannel.WX_PAY.getVal().equals(merchant.getPaymentChannel())) {
-//            mercWxapp.setAppOrgType(EAppOrgType.WXPAY.getVal());
-//        } else {
-//            mercWxapp.setCurFlag(EYesNo.YES.getVal());
-//        }
-//        mercWxapp.setDelFlag(EYesNo.NO.getVal());
-//
-//        mercWxapp = mercWxappService.selectMercWxappByCond(mercWxapp);
-//        if (ObjectUtils.isEmpty(mercWxapp)) {
-//            log.debug("商户[" + mercId + "]支付配置信息不存在");
-//            throw new BusinessException("商户支付配置信息不存在");
-//        }
-//
-//        if (!EAppOrgType.XIAOWEI.getVal().equals(mercWxapp.getAppOrgType()) &&
-//                !EAppOrgType.ENTERPRISE.getVal().equals(mercWxapp.getAppOrgType()) &&
-//                !EAppOrgType.WXPAY.getVal().equals(mercWxapp.getAppOrgType())) {
-//            log.debug("商户[" + mercId + "]支付配置信息不正确");
-//            throw new BusinessException("支付配置信息不正确");
-//        }
-//
-//        MercUnifiedpayConfigDTO mercUnifiedpayConfigDTO = new MercUnifiedpayConfigDTO();
-//        mercUnifiedpayConfigDTO.setApiV3Key(mercWxapp.getWxApiV3key());
-//        mercUnifiedpayConfigDTO.setMchId(mercWxapp.getWxMchId());
-//        mercUnifiedpayConfigDTO.setAppId(mercWxapp.getWxPayId());
-//        mercUnifiedpayConfigDTO.setPrivateKeyContent(getCertBytesFromOSSByURL(mercWxapp.getWxKeyFile()));
-//        mercUnifiedpayConfigDTO.setPrivateCertContent(getCertBytesFromOSSByURL(mercWxapp.getWxCertFile()));
-//
-//        return mercUnifiedpayConfigDTO;
-//    }
-
-
-
-    private byte[] getCertBytesFromOSSByURL(String URL) {
-
-        for (String s : DOMAIN_LIST) {
-            URL = URL.replaceAll(s, "");
-        }
-
-        OSSObject ossObject = null;
-        byte[] bytes;
-        try {
-            ossObject = aliyunOSSClient.getObject(URL);
-            InputStream content = ossObject.getObjectContent();
-            bytes = StreamUtils.copyToByteArray(content);
-        } catch (Exception e) {
-            log.debug("商户证书[" + URL + "]取得失败", e);
-            throw new RuntimeException();
-        } finally {
-            if (ossObject != null) {
-                try {
-                    ossObject.close();
-                } catch (IOException e) {
-                }
-            }
-        }
-
-        return bytes;
-    }
-
-
-    private final static List<String> DOMAIN_LIST = new ArrayList<String>() {{
-        add("https://biandan-default.oss-cn-beijing.aliyuncs.com/");
-        add("https://res.njnet.vip/");
-        add("http://biandan-default.oss-cn-beijing.aliyuncs.com/");
-        add("http://res.njnet.vip/");
-        add("https://res.ysyd.cloud/");
-    }};
-
-
-}

+ 43 - 35
08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/business/Order/domain/Order.java

@@ -7,6 +7,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.ToString;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -21,77 +22,84 @@ import java.util.Date;
 public class Order extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 主键 */
+    // 订单ID
     private Long orderId;
 
-    /** 订单号 */
+    // 订单号
     @Excel(name = "订单号")
     private String orderNo;
 
-    /** 下单时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "下单时间", width = 30, dateFormat = "yyyy-MM-dd")
+    // 订单时间
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "订单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date orderTime;
 
-    /** 支付时间 */
-    @Excel(name = "支付时间")
-    private String payTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "订单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date payTime;
 
-    /** 订单状态 */
-    @Excel(name = "订单状态")
+    // 订单状态
+    @Excel(name = "订单状态", dictType = "orderStatus")
     private String orderStatus;
 
-    /** 订单总额 */
+    // 订单总额
     @Excel(name = "订单总额")
-    private Long orderAmount;
+    private BigDecimal orderAmount;
 
-    /** 支付金额 */
+    // 支付金额
     @Excel(name = "支付金额")
-    private Long payAmount;
+    private BigDecimal payAmount;
 
-    /** 采购方ID */
-    @Excel(name = "采购方ID")
+    // 商品数量
+    @Excel(name = "商品数量")
+    private Integer prodQuantity;
+
+    // 购方用户ID
+    @Excel(name = "购方用户ID")
     private Long buyerId;
 
-    /** 销售方ID */
-    @Excel(name = "销售方ID")
+    // 销方用户ID
+    @Excel(name = "销方用户ID")
     private Long sellerId;
 
-    /** 取消时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "取消时间", width = 30, dateFormat = "yyyy-MM-dd")
+    // 取消时间
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "取消时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date cancelTime;
 
-    /** 完成时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd")
+    // 完成时间
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date finishTime;
 
-    /** 收件人省 */
-    @Excel(name = "收件人省")
+    // 收件人省名称
+    @Excel(name = "收件人省名称")
     private String recProv;
 
-    /** 收件人市 */
-    @Excel(name = "收件人市")
+    // 收件人市名称
+    @Excel(name = "收件人市名称")
     private String recCity;
 
-    /** 收件人区 */
-    @Excel(name = "收件人区")
+    // 收件人区名称
+    @Excel(name = "收件人区名称")
     private String recDistrict;
 
-    /** 收件人地址 */
+    // 收件人地址
     @Excel(name = "收件人地址")
     private String recAddress;
 
-    /** 收件人姓名 */
+    // 收件人姓名
     @Excel(name = "收件人姓名")
     private String recName;
 
-    /** 收件人联系方式 */
+    // 收件人联系方式
     @Excel(name = "收件人联系方式")
     private String recMobile;
 
-    /** 删除标志 */
-    @Excel(name = "删除标志")
+    @Excel(name = "备注")
+    private String remark;
+
+    // 删除标志(0代表存在 2代表删除)
+    @Excel(name = "删除标志", readConverterExp = "0=代表存在,1=代表删除")
     private String delFlag;
 }

+ 45 - 30
08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/business/Order/domain/OrderDetail.java

@@ -1,11 +1,15 @@
 package com.xingxi.business.Order.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.xingxi.common.annotation.Excel;
 import com.xingxi.common.core.domain.BaseEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.ToString;
 
+import java.math.BigDecimal;
+import java.util.Date;
+
 /**
  * 订单明细对象 t_order_detail
  *
@@ -18,62 +22,73 @@ import lombok.ToString;
 public class OrderDetail extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 主键 */
+    // 订单明细ID
     private Long orderDetailId;
 
-    /** 订单ID */
+    // 订单ID
     @Excel(name = "订单ID")
     private Long orderId;
 
-    /** 订单详情状态 */
-    @Excel(name = "订单详情状态")
+    // 订单明细状态
+    @Excel(name = "订单明细状态")
     private String orderDetailStatus;
 
-    /** 商品ID */
+    // 商品ID
     @Excel(name = "商品ID")
     private Long prodId;
 
-    /** 商品名称 */
-    @Excel(name = "商品名")
+    // 商品名
+    @Excel(name = "商品名")
     private String prodName;
 
-    /** 商品属性ID */
-    @Excel(name = "商品属性ID")
+    // 属性组合编号
+    @Excel(name = "属性组合编号")
     private Long prodAttrId;
 
-    /** 商品属性名称 */
-    @Excel(name = "商品属性名称")
+    // 属性组合名称
+    @Excel(name = "属性组合名称")
     private String prodAttrName;
 
-    /** 供应商ID */
+    // 供应商ID
     @Excel(name = "供应商ID")
     private Long vendorId;
 
-    /** 数量 */
-    @Excel(name = "数量")
-    private Long quantity;
+    // 购买数量
+    @Excel(name = "购买数量")
+    private Integer quantity;
 
-    /** 售后数量 */
-    @Excel(name = "售后数量")
-    private Long afterSalesQty;
+    // 售后中数量
+    @Excel(name = "售后数量")
+    private Integer afterQty;
 
-    /** 退货数量 */
-    @Excel(name = "退货数量")
-    private Long refundQty;
+    // 已退货数量
+    @Excel(name = "退货数量")
+    private Integer returnQty;
 
-    /** 单价 */
-    @Excel(name = "单价")
-    private Long price;
+    // 购买单价
+    @Excel(name = "购买单价")
+    private BigDecimal price;
 
-    /** 总金额 */
+    // 总金额
     @Excel(name = "总金额")
-    private Long orderAmount;
+    private BigDecimal orderAmount;
 
-    /** 支付金额 */
+    // 支付金额
     @Excel(name = "支付金额")
-    private Long payAmount;
+    private BigDecimal payAmount;
+
+    // 确认收货时间
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "确认收货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date confirmTime;
 
-    /** 删除标志 */
-    @Excel(name = "删除标志")
+    // 完成时间
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date finishTime;
+
+    // 删除标志(0代表存在 1代表删除)
+    @Excel(name = "删除标志", readConverterExp = "0=代表存在,1=代表删除")
     private String delFlag;
+
 }

+ 14 - 0
08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/common/mapper/XingxiUnifiedpayExtMapper.java

@@ -0,0 +1,14 @@
+package com.xingxi.common.mapper;
+
+import com.xingxi.business.Order.domain.Order;
+import com.xingxi.business.Order.mapper.OrderDetailMapper;
+import com.xingxi.business.Order.mapper.OrderMapper;
+import com.xingxi.business.PaymentInfo.domain.PaymentInfo;
+import com.xingxi.business.PaymentInfo.mapper.PaymentInfoMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface XingxiUnifiedpayExtMapper extends PaymentInfoMapper, OrderMapper, OrderDetailMapper {
+    PaymentInfo selectLockPaymentInfoByOutTradeNo(String outTradeNo);
+    Order selectLockOrderByOrderId(Long orderId);
+}

+ 104 - 0
08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/common/service/DefaultXingxiUnifiedpayCallbackClient.java

@@ -0,0 +1,104 @@
+package com.xingxi.common.service;
+
+import com.xingxi.business.Order.domain.Order;
+import com.xingxi.business.Order.domain.OrderDetail;
+import com.xingxi.business.PaymentInfo.domain.PaymentInfo;
+import com.xingxi.common.enums.EOrderDetailStatus;
+import com.xingxi.common.enums.EOrderStatus;
+import com.xingxi.common.mapper.XingxiUnifiedpayExtMapper;
+import com.xingxi.common.mq.bo.order.OrderBO;
+import com.xingxi.common.mq.publisher.order.OrderPayedMqPublisher;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+@Component
+@RequiredArgsConstructor
+class DefaultXingxiUnifiedpayCallbackClient implements XingxiUnifiedpayCallbackClient {
+    private final OrderPayedMqPublisher orderPayedMqPublisher;
+    private final XingxiUnifiedpayExtMapper xingxiUnifiedpayExtMapper;
+
+    @Transactional
+    @Override
+    public void execute(XingxiUnifiedpayCallbackDTO biandanUnifiedpayCallbackDTO) {
+        String tradeState = biandanUnifiedpayCallbackDTO.getTradeState();
+        String outTradeNo = biandanUnifiedpayCallbackDTO.getOutTradeNo();
+        String callUnifiedpayComponent = biandanUnifiedpayCallbackDTO.getCallUnifiedpayComponent();
+
+        PaymentInfo dbPaymentInfo = xingxiUnifiedpayExtMapper.selectLockPaymentInfoByOutTradeNo(outTradeNo);
+        if (dbPaymentInfo != null && "SUCCESS".equals(tradeState)) {
+            dbPaymentInfo.setUpdateUser(callUnifiedpayComponent);
+            dbPaymentInfo.setUpdateTime(new Date());
+            updatePaymentInfo(dbPaymentInfo, biandanUnifiedpayCallbackDTO);
+            Long orderId = dbPaymentInfo.getOrderId();
+
+            // lock
+            Order dbOrder = xingxiUnifiedpayExtMapper.selectLockOrderByOrderId(orderId);
+            dbOrder.setUpdateTime(dbPaymentInfo.getUpdateTime());
+            dbOrder.setUpdateUser(dbPaymentInfo.getUpdateUser());
+
+            updateOrderStatus(dbOrder);
+            // 发送订单支付完成事件消息
+            orderPayedEvent(dbOrder);
+
+            // 发送微信订阅消息 mq异步处理
+//            WxMaMsgService msgService = wxMaService.getMsgService();
+//            msgService.sendSubscribeMsg(WxMaSubscribeMessage.builder().templateId("").build());
+        }
+    }
+
+    private void updatePaymentInfo(PaymentInfo dbPaymentInfo, XingxiUnifiedpayCallbackDTO biandanUnifiedpayCallbackDTO) {
+        String tradeState = biandanUnifiedpayCallbackDTO.getTradeState();
+        String tradeType = biandanUnifiedpayCallbackDTO.getTradeType();
+        String bankType = biandanUnifiedpayCallbackDTO.getBankType();
+        String transactionId = biandanUnifiedpayCallbackDTO.getTransactionId();
+        String callUnifiedpayComponent = biandanUnifiedpayCallbackDTO.getCallUnifiedpayComponent();
+
+        PaymentInfo updatePaymentInfo = new PaymentInfo();
+        updatePaymentInfo.setPayId(dbPaymentInfo.getPayId());
+        updatePaymentInfo.setTradeType(tradeType);
+        updatePaymentInfo.setTradeState(tradeState);
+        updatePaymentInfo.setTransactionId(transactionId);
+        updatePaymentInfo.setSuccessTime(new Date());
+        updatePaymentInfo.setPayTime(updatePaymentInfo.getSuccessTime());
+        updatePaymentInfo.setBankType(bankType);
+        updatePaymentInfo.setUpdateUser(callUnifiedpayComponent);
+        updatePaymentInfo.setUpdateTime(dbPaymentInfo.getUpdateTime());
+        xingxiUnifiedpayExtMapper.updatePaymentInfo(updatePaymentInfo);
+    }
+
+    private void updateOrderStatus(Order dbOrder) {
+        Order updateOrderStatus = new Order();
+        updateOrderStatus.setOrderId(dbOrder.getOrderId());
+        updateOrderStatus.setOrderStatus(EOrderStatus.PAYED.getVal());
+        updateOrderStatus.setUpdateUser(dbOrder.getUpdateUser());
+        updateOrderStatus.setUpdateTime(dbOrder.getUpdateTime());
+        xingxiUnifiedpayExtMapper.updateOrder(updateOrderStatus);
+
+        OrderDetail queryOrderDetail = new OrderDetail();
+        queryOrderDetail.setOrderId(dbOrder.getOrderId());
+        List<OrderDetail> orderDetails = xingxiUnifiedpayExtMapper.selectOrderDetailList(queryOrderDetail);
+        for (OrderDetail dbOrderDetail : orderDetails) {
+            OrderDetail updateOrderDetailStatus = new OrderDetail();
+            updateOrderDetailStatus.setOrderDetailId(dbOrderDetail.getOrderDetailId());
+            updateOrderDetailStatus.setOrderDetailStatus(EOrderDetailStatus.APPROVED.getVal());
+            updateOrderDetailStatus.setUpdateUser(dbOrder.getUpdateUser());
+            updateOrderDetailStatus.setUpdateTime(dbOrder.getUpdateTime());
+            xingxiUnifiedpayExtMapper.updateOrderDetail(updateOrderDetailStatus);
+        }
+    }
+
+    private void orderPayedEvent(Order orderDTO) {
+        // EDIT_ROUTE_FOR_PAYED
+        // EDIT_EXCHANGE
+        OrderBO orderBO = new OrderBO();
+        orderBO.setOrderId(orderDTO.getOrderId());
+        orderBO.setOrderNo(orderDTO.getOrderNo());
+        orderPayedMqPublisher.sendMessage(orderBO);
+    }
+}

+ 6 - 0
08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/common/service/XingxiUnifiedpayCallbackClient.java

@@ -0,0 +1,6 @@
+package com.xingxi.common.service;
+
+public interface XingxiUnifiedpayCallbackClient {
+
+    void execute(XingxiUnifiedpayCallbackDTO biandanUnifiedpayCallbackDTO);
+}

+ 18 - 0
08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/common/service/XingxiUnifiedpayCallbackDTO.java

@@ -0,0 +1,18 @@
+package com.xingxi.common.service;
+
+
+import lombok.Data;
+
+@Data
+public class XingxiUnifiedpayCallbackDTO {
+
+    private String tradeState;
+    private String outTradeNo;
+    private String successTimeString;
+    private String tradeType;
+    private String bankType;
+    private String attach;
+    private String transactionId;
+    private String callUnifiedpayComponent;
+    private Object originalObj;
+}