TRX 1 éve
szülő
commit
8694b1540c
24 módosított fájl, 589 hozzáadás és 26 törlés
  1. 28 0
      PaymentClient/src/main/java/com/zhongshu/payment/client/annotation/PayAnnotationService.java
  2. 1 1
      PaymentClient/src/main/java/com/zhongshu/payment/client/model/RechargeRecordModel.java
  3. 1 1
      PaymentClient/src/main/java/com/zhongshu/payment/client/model/param/RechargeParam.java
  4. 2 2
      PaymentClient/src/main/java/com/zhongshu/payment/client/model/param/RecordSearchParam.java
  5. 74 0
      PaymentClient/src/main/java/com/zhongshu/payment/client/payModel/unionFrictionlessPay/config/UnionFrictionlessPayApiConfig.java
  6. 19 0
      PaymentClient/src/main/java/com/zhongshu/payment/client/payModel/unionFrictionlessPay/config/UnionFrictionlessPayConfig.java
  7. 26 0
      PaymentClient/src/main/java/com/zhongshu/payment/client/payModel/unionFrictionlessPay/model/ApiConfParam.java
  8. 24 0
      PaymentClient/src/main/java/com/zhongshu/payment/client/payModel/unionFrictionlessPay/model/PayResponseModel.java
  9. 22 0
      PaymentClient/src/main/java/com/zhongshu/payment/client/payModel/unionFrictionlessPay/model/UnionPayApi.java
  10. 0 17
      PaymentClient/src/main/java/com/zhongshu/payment/client/types/PaymentType.java
  11. 18 0
      PaymentClient/src/main/java/com/zhongshu/payment/client/types/unionFrictionlessPayType/UnionUserOpenType.java
  12. 15 0
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/dao/ExecuteMethodInfoDao.java
  13. 29 0
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/domain/unionFrictionlessPay/ExecuteMethodInfo.java
  14. 45 0
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/domain/unionFrictionlessPay/UnionUserOpenInfo.java
  15. 1 1
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/domain/wallet/RechargeRecord.java
  16. 32 0
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/init/ScanMqttEventExecuteRunner.java
  17. 14 4
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/base/SuperService.java
  18. 50 0
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/common/ScanExecuteService.java
  19. 97 0
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/other/ScanSupport.java
  20. 3 0
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/pay/impl/WeChatPayService.java
  21. 18 0
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/unionFrictionlessPay/UnionFrictionlessPayService.java
  22. 59 0
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/unionFrictionlessPay/UnionUserOpenRequestService.java
  23. 4 0
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/unionFrictionlessPay/package-info.java
  24. 7 0
      PaymentServer/src/main/java/com/zhongshu/payment/server/core/utils/CommonUtil.java

+ 28 - 0
PaymentClient/src/main/java/com/zhongshu/payment/client/annotation/PayAnnotationService.java

@@ -0,0 +1,28 @@
+package com.zhongshu.payment.client.annotation;
+
+import com.github.microservice.models.type.PaymentType;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+public @interface PayAnnotationService {
+
+    /**
+     * @return
+     */
+    String remark() default "";
+
+    /**
+     * 对应支付方式
+     *
+     * @return
+     */
+    PaymentType paymentType();
+
+    /**
+     * @return
+     */
+    Class<?> serviceName() default Void.class;
+}

+ 1 - 1
PaymentClient/src/main/java/com/zhongshu/payment/client/model/RechargeRecordModel.java

@@ -1,7 +1,7 @@
 package com.zhongshu.payment.client.model;
 
 
-import com.zhongshu.payment.client.types.PaymentType;
+import com.github.microservice.models.type.PaymentType;
 import com.zhongshu.payment.client.types.RechargeState;
 import com.zhongshu.payment.client.types.TradeType;
 import io.swagger.v3.oas.annotations.media.Schema;

+ 1 - 1
PaymentClient/src/main/java/com/zhongshu/payment/client/model/param/RechargeParam.java

@@ -1,6 +1,6 @@
 package com.zhongshu.payment.client.model.param;
 
-import com.zhongshu.payment.client.types.PaymentType;
+import com.github.microservice.models.type.PaymentType;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 

+ 2 - 2
PaymentClient/src/main/java/com/zhongshu/payment/client/model/param/RecordSearchParam.java

@@ -1,6 +1,6 @@
 package com.zhongshu.payment.client.model.param;
 
-import com.zhongshu.payment.client.types.PaymentType;
+import com.github.microservice.models.type.PaymentType;
 import com.zhongshu.payment.client.types.RechargeState;
 import com.zhongshu.payment.client.types.TradeType;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -11,7 +11,7 @@ import lombok.Data;
  * @date 2024/7/31
  */
 @Data
-    public class RecordSearchParam {
+public class RecordSearchParam {
 
     @Schema(description = "项目oid")
     private String projectOid;

+ 74 - 0
PaymentClient/src/main/java/com/zhongshu/payment/client/payModel/unionFrictionlessPay/config/UnionFrictionlessPayApiConfig.java

@@ -0,0 +1,74 @@
+package com.zhongshu.payment.client.payModel.unionFrictionlessPay.config;
+
+import com.zhongshu.payment.client.payModel.unionFrictionlessPay.model.UnionPayApi;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * 无感支付API配置
+ * 新购物车无感支付
+ *
+ * @author TRX
+ * @date 2024/8/21
+ */
+@Component
+public class UnionFrictionlessPayApiConfig {
+
+    @Autowired
+    UnionFrictionlessPayConfig payConfig;
+
+    // 申请扣款
+    public static String pay = "pay";
+
+    // 支付并签约
+    public static String payOpen = "payOpen";
+
+    // 申请退款
+    public static String refund = "refund";
+
+    // 退款查询
+    public static String refundQuery = "refundQuery";
+
+    // 交易查询
+    public static String payQuery = "payQuery";
+
+    private static List<UnionPayApi> apis = new ArrayList<>();
+
+    static {
+        // 申请扣款
+        apis.add(UnionPayApi.builder().apiKey(pay)
+                .devUrl("https://test-api-open.chinaums.com/v1/inip/upsp/shop/senseless/pay")
+                .prodUrl("https://api-mop.chinaums.com/v1/inip/upsp/shop/senseless/pay")
+                .build());
+
+        // 支付并签约
+        apis.add(UnionPayApi.builder().apiKey(payOpen)
+                .devUrl("https://test-api-open.chinaums.com/v1/inip/upsp/shop/senseless/pay-open")
+                .prodUrl("https://api-mop.chinaums.com/v1/inip/upsp/shop/senseless/pay-open")
+                .build());
+
+        // 申请退款
+        apis.add(UnionPayApi.builder().apiKey(refund)
+                .devUrl("https://test-api-open.chinaums.com/v1/inip/upsp/shop/senseless/refund")
+                .prodUrl("https://api-mop.chinaums.com/v1/inip/upsp/shop/senseless/refund")
+                .build());
+
+        // 退款查询
+        apis.add(UnionPayApi.builder().apiKey(refundQuery)
+                .devUrl("https://test-api-open.chinaums.com/v1/inip/upsp/shop/senseless/refund-query")
+                .prodUrl("https://api-mop.chinaums.com/v1/inip/upsp/shop/senseless/refund-query")
+                .build());
+
+        // 交易查询
+        apis.add(UnionPayApi.builder().apiKey(payQuery)
+                .devUrl("https://test-api-open.chinaums.com/v1/inip/upsp/shop/senseless/pay-query")
+                .prodUrl("https://api-mop.chinaums.com/v1/inip/upsp/shop/senseless/pay-query")
+                .build());
+
+    }
+
+}

+ 19 - 0
PaymentClient/src/main/java/com/zhongshu/payment/client/payModel/unionFrictionlessPay/config/UnionFrictionlessPayConfig.java

@@ -0,0 +1,19 @@
+package com.zhongshu.payment.client.payModel.unionFrictionlessPay.config;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author TRX
+ * @date 2024/8/21
+ */
+@Data
+@Configuration
+@ConfigurationProperties(prefix = "unionfrictionless")
+public class UnionFrictionlessPayConfig {
+    private String evn = "";
+}

+ 26 - 0
PaymentClient/src/main/java/com/zhongshu/payment/client/payModel/unionFrictionlessPay/model/ApiConfParam.java

@@ -0,0 +1,26 @@
+package com.zhongshu.payment.client.payModel.unionFrictionlessPay.model;
+
+import com.github.microservice.core.util.net.apache.MethodType;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author TRX
+ * @date 2024/6/25
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class ApiConfParam {
+
+    @Schema(description = "API名称")
+    private String apiName;
+
+    @Schema(description = "方式")
+    private MethodType methodType;
+
+}

+ 24 - 0
PaymentClient/src/main/java/com/zhongshu/payment/client/payModel/unionFrictionlessPay/model/PayResponseModel.java

@@ -0,0 +1,24 @@
+package com.zhongshu.payment.client.payModel.unionFrictionlessPay.model;
+
+import com.github.microservice.models.requestModel.SuperResponseModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 无感支付 申请扣款 返回
+ *
+ * @author TRX
+ * @date 2024/8/21
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class PayResponseModel extends SuperResponseModel {
+
+    @Schema(description = "商户号")
+    private String vaMchntNo;
+
+
+}

+ 22 - 0
PaymentClient/src/main/java/com/zhongshu/payment/client/payModel/unionFrictionlessPay/model/UnionPayApi.java

@@ -0,0 +1,22 @@
+package com.zhongshu.payment.client.payModel.unionFrictionlessPay.model;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * @author TRX
+ * @date 2024/8/21
+ */
+@Data
+@Builder
+public class UnionPayApi {
+    @Schema(description = "api标识")
+    private String apiKey;
+
+    @Schema(description = "测试地址")
+    private String devUrl;
+
+    @Schema(description = "正式环境地址")
+    private String prodUrl;
+}

+ 0 - 17
PaymentClient/src/main/java/com/zhongshu/payment/client/types/PaymentType.java

@@ -1,17 +0,0 @@
-package com.zhongshu.payment.client.types;
-
-import lombok.Getter;
-
-public enum PaymentType {
-    WeChat("微信"),
-    UnionFrictionlessPay("银联无感支付"),
-
-    ;
-
-    @Getter
-    private String remark;
-
-    PaymentType(String remark) {
-        this.remark = remark;
-    }
-}

+ 18 - 0
PaymentClient/src/main/java/com/zhongshu/payment/client/types/unionFrictionlessPayType/UnionUserOpenType.java

@@ -0,0 +1,18 @@
+package com.zhongshu.payment.client.types.unionFrictionlessPayType;
+
+/**
+ *
+ */
+public enum UnionUserOpenType {
+
+    WeChat("微信支付"),//
+    UnionFrictionlessPay("银联无感支付"),//
+    ;
+
+    // 名称
+    private String name;
+
+    UnionUserOpenType(String name) {
+        this.name = name;
+    }
+}

+ 15 - 0
PaymentServer/src/main/java/com/zhongshu/payment/server/core/dao/ExecuteMethodInfoDao.java

@@ -0,0 +1,15 @@
+package com.zhongshu.payment.server.core.dao;
+
+import com.github.microservice.components.data.mongo.mongo.dao.MongoDao;
+import com.github.microservice.models.type.PaymentType;
+import com.zhongshu.payment.server.core.domain.unionFrictionlessPay.ExecuteMethodInfo;
+
+/**
+ * @author wjf
+ * @date 2024/7/25
+ */
+public interface ExecuteMethodInfoDao extends MongoDao<ExecuteMethodInfo> {
+
+    ExecuteMethodInfo findTopByPaymentType(PaymentType paymentType);
+
+}

+ 29 - 0
PaymentServer/src/main/java/com/zhongshu/payment/server/core/domain/unionFrictionlessPay/ExecuteMethodInfo.java

@@ -0,0 +1,29 @@
+package com.zhongshu.payment.server.core.domain.unionFrictionlessPay;
+
+import com.github.microservice.models.type.PaymentType;
+import com.zhongshu.payment.server.core.domain.base.SuperMain;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.data.mongodb.core.mapping.Document;
+
+/**
+ * @author TRX
+ * @date 2024/6/27
+ */
+@Data
+@Document
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class ExecuteMethodInfo extends SuperMain {
+
+    @Schema(description = "对应的service bean名称")
+    private String beanName;
+
+    @Schema(description = "支付方式")
+    private PaymentType paymentType;
+
+}

+ 45 - 0
PaymentServer/src/main/java/com/zhongshu/payment/server/core/domain/unionFrictionlessPay/UnionUserOpenInfo.java

@@ -0,0 +1,45 @@
+package com.zhongshu.payment.server.core.domain.unionFrictionlessPay;
+
+import com.zhongshu.payment.server.core.domain.base.SuperMain;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.data.mongodb.core.mapping.Document;
+
+/**
+ * 用户银联无感支付签约信息
+ *
+ * @author TRX
+ * @date 2024/8/21
+ */
+@Data
+@Document
+public class UnionUserOpenInfo extends SuperMain {
+
+    @Schema(description = "用户ID")
+    private String userId;
+
+    @Schema(description = "商户代码")
+    private String mid;
+
+    @Schema(description = "商户oid")
+    private String shopOid;
+
+    @Schema(description = "商户签约协议号")
+    private String contractNo;
+
+    @Schema(description = "银商免密支付签约协议号")
+    private String contractId;
+
+    @Schema(description = "签约状态,通知商户,必传。UNSIGNED-未签约 SIGNED-已签约 RESCISSION-已解约 ELETING_CONTRACT-解约中 UNKNOWN-未知")
+    private String contractState;
+
+    private Long signedTime;
+
+    @Schema(description = "协议签约时间,格式:yyyy-MM-dd HH:mm:ss")
+    private String contractSignedTime;
+
+    @Schema(description = "协议到期时间,格式:yyyy-MM-dd HH:mm:ss")
+    private String contractExpiredTime;
+
+    private Long expiredTime;
+}

+ 1 - 1
PaymentServer/src/main/java/com/zhongshu/payment/server/core/domain/wallet/RechargeRecord.java

@@ -1,11 +1,11 @@
 package com.zhongshu.payment.server.core.domain.wallet;
 
 import com.github.microservice.components.data.mongo.mongo.domain.SuperEntity;
+import com.github.microservice.models.type.PaymentType;
 import com.zhongshu.card.client.model.org.OrganizationUserModel;
 import com.zhongshu.card.client.utils.DateUtils;
 import com.zhongshu.payment.client.model.PrePayModel;
 import com.zhongshu.payment.client.model.TransferModel;
-import com.zhongshu.payment.client.types.PaymentType;
 import com.zhongshu.payment.client.types.RechargeState;
 import com.zhongshu.payment.client.types.TradeType;
 import io.swagger.v3.oas.annotations.media.Schema;

+ 32 - 0
PaymentServer/src/main/java/com/zhongshu/payment/server/core/init/ScanMqttEventExecuteRunner.java

@@ -0,0 +1,32 @@
+package com.zhongshu.payment.server.core.init;
+
+import com.zhongshu.payment.server.core.service.common.ScanExecuteService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.stereotype.Component;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * 扫描记录 mqtt event 对应的执行方法
+ *
+ * @author TRX
+ * @date 2024/6/27
+ */
+@Slf4j
+@Component
+public class ScanMqttEventExecuteRunner implements ApplicationRunner {
+
+    @Autowired
+    ScanExecuteService scanExecuteService;
+
+    @Override
+    public void run(ApplicationArguments args) throws Exception {
+        CompletableFuture.runAsync(() -> {
+            scanExecuteService.scanPayExecuteService();
+        });
+    }
+
+}

+ 14 - 4
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/base/SuperService.java

@@ -5,6 +5,7 @@ import com.zhongshu.card.client.model.base.SuperParam;
 import com.zhongshu.card.client.model.base.SuperSearch;
 import com.zhongshu.payment.server.core.domain.base.SuperMain;
 import com.zhongshu.payment.server.core.utils.DateUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +17,7 @@ import java.util.List;
  * @author TRX
  * @date 2024/6/3
  */
+@Slf4j
 public abstract class SuperService {
 
     @Autowired
@@ -27,8 +29,12 @@ public abstract class SuperService {
      * @return
      */
     public String getCurrentUserId() {
-        if (authHelper != null && authHelper.getCurrentUser() != null) {
-            return authHelper.getCurrentUser().getUserId();
+        try {
+            if (authHelper != null && authHelper.getCurrentUser() != null) {
+                return authHelper.getCurrentUser().getUserId();
+            }
+        } catch (Exception e) {
+            log.error("getCurrentUserId error {}", e.getMessage());
         }
         return null;
     }
@@ -39,8 +45,12 @@ public abstract class SuperService {
      * @return
      */
     public String getCurrentOid() {
-        if (authHelper != null && authHelper.getCurrentUser() != null) {
-            return authHelper.getOrgId();
+        try {
+            if (authHelper != null && authHelper.getCurrentUser() != null) {
+                return authHelper.getOrgId();
+            }
+        } catch (Exception e) {
+            log.error("getCurrentOid error {}", e.getMessage());
         }
         return null;
     }

+ 50 - 0
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/common/ScanExecuteService.java

@@ -0,0 +1,50 @@
+package com.zhongshu.payment.server.core.service.common;
+
+import com.zhongshu.payment.client.annotation.PayAnnotationService;
+import com.zhongshu.payment.server.core.dao.ExecuteMethodInfoDao;
+import com.zhongshu.payment.server.core.domain.unionFrictionlessPay.ExecuteMethodInfo;
+import com.zhongshu.payment.server.core.service.other.ScanSupport;
+import com.zhongshu.payment.server.core.utils.CommonUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.stereotype.Service;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * @author TRX
+ * @date 2024/8/21
+ */
+@Slf4j
+@Service
+public class ScanExecuteService {
+
+    ExecuteMethodInfoDao executeMethodInfoDao;
+
+    /**
+     * 扫描支付渠道服务
+     */
+    public void scanPayExecuteService() {
+        Set<Class<?>> domainClasses = ScanSupport.classInfos();
+        List<Class> standardClasses = domainClasses.stream().filter(cls -> cls.isAnnotationPresent(PayAnnotationService.class)).collect(Collectors.toList());
+        executeMethodInfoDao.deleteAll();
+
+        List<ExecuteMethodInfo> list = new ArrayList<>();
+        if (ObjectUtils.isNotEmpty(standardClasses)) {
+            for (Class cls : standardClasses) {
+                String className = CommonUtil.toFirstCharLowerCase(cls.getSimpleName());
+                PayAnnotationService annotation = (PayAnnotationService) cls.getAnnotation(PayAnnotationService.class);
+                list.add(ExecuteMethodInfo.builder()
+                        .beanName(className)
+                        .paymentType(annotation.paymentType())
+                        .build());
+            }
+        }
+        executeMethodInfoDao.saveAll(list);
+        log.info("scanPayExecuteService size: {} ", list.size());
+    }
+}

+ 97 - 0
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/other/ScanSupport.java

@@ -0,0 +1,97 @@
+package com.zhongshu.payment.server.core.service.other;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.ResourceLoaderAware;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.ResourceLoader;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternUtils;
+import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
+import org.springframework.core.type.classreading.MetadataReader;
+import org.springframework.core.type.classreading.MetadataReaderFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.util.ClassUtils;
+import org.springframework.util.SystemPropertyUtils;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+
+@Slf4j
+@Component
+public class ScanSupport implements ResourceLoaderAware {
+    /**
+     * Spring容器注入
+     */
+    private ResourceLoader resourceLoader;
+
+    private ResourcePatternResolver resolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
+
+    private MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resourceLoader);
+
+    private static final String FULLTEXT_SACN_PACKAGE_PATH = "com.zhongshu.payment.server.core";
+
+    /**
+     * set注入对象
+     */
+    @Override
+    public void setResourceLoader(ResourceLoader resourceLoader) {
+        this.resourceLoader = resourceLoader;
+    }
+
+    /**
+     * 利用spring提供的扫描包下面的类信息,再通过classfrom反射获得类信息
+     *
+     * @param scanPath
+     * @return
+     * @throws IOException
+     */
+    public Set<Class<?>> doScan(String scanPath) {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+                .concat(ClassUtils.convertClassNameToResourcePath(SystemPropertyUtils.resolvePlaceholders(scanPath))
+                        .concat("/**/*.class"));
+        Resource[] resources = new Resource[0];
+        try {
+            resources = resolver.getResources(packageSearchPath);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        MetadataReader metadataReader = null;
+        for (Resource resource : resources) {
+            if (resource.isReadable()) {
+                try {
+                    metadataReader = metadataReaderFactory.getMetadataReader(resource);
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
+                }
+                try {
+                    if (metadataReader.getClassMetadata().isConcrete()) {// 当类型不是抽象类或接口在添加到集合
+                        classes.add(Class.forName(metadataReader.getClassMetadata().getClassName()));
+                    }
+                } catch (ClassNotFoundException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return classes;
+    }
+
+    /**
+     * 指定包下面的类信息
+     *
+     * @return 多个类信息
+     */
+    public static Set<Class<?>> classInfos() {
+        try {
+//            String scanPath = ApplicationContextHolder.getContext().getEnvironment()
+//                    .getProperty(FULLTEXT_SACN_PACKAGE_PATH);
+//            scanPath = FULLTEXT_SACN_PACKAGE_PATH;
+            return new ScanSupport().doScan(FULLTEXT_SACN_PACKAGE_PATH);
+        } catch (Exception e) {
+            log.error("扫描包类信息错误", e);
+        }
+        return null;
+    }
+}

+ 3 - 0
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/pay/impl/WeChatPayService.java

@@ -1,5 +1,6 @@
 package com.zhongshu.payment.server.core.service.pay.impl;
 
+import com.github.microservice.models.type.PaymentType;
 import com.wechat.pay.java.core.Config;
 import com.wechat.pay.java.core.RSAAutoCertificateConfig;
 import com.wechat.pay.java.core.exception.HttpException;
@@ -10,6 +11,7 @@ import com.wechat.pay.java.core.util.PemUtil;
 import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
 import com.wechat.pay.java.service.payments.jsapi.model.PrepayResponse;
 import com.zhongshu.card.client.model.payment.paySetting.WxPayConfigModel;
+import com.zhongshu.payment.client.annotation.PayAnnotationService;
 import com.zhongshu.payment.client.model.PrePayModel;
 import com.github.microservice.net.ResultContent;
 import com.zhongshu.payment.server.core.service.pay.SuperPayService;
@@ -28,6 +30,7 @@ import java.util.Base64;
  */
 @Slf4j
 @Component
+@PayAnnotationService(paymentType = PaymentType.WeChat, remark = "微信支付方式")
 public class WeChatPayService extends SuperPayService {
 
     public static com.wechat.pay.java.service.payments.jsapi.JsapiService service;

+ 18 - 0
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/unionFrictionlessPay/UnionFrictionlessPayService.java

@@ -0,0 +1,18 @@
+package com.zhongshu.payment.server.core.service.unionFrictionlessPay;
+
+import com.github.microservice.core.util.JsonUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+/**
+ * 银联无感支付服务
+ *
+ * @author TRX
+ * @date 2024/8/21
+ */
+@Slf4j
+@Service
+public class UnionFrictionlessPayService {
+
+
+}

+ 59 - 0
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/unionFrictionlessPay/UnionUserOpenRequestService.java

@@ -0,0 +1,59 @@
+package com.zhongshu.payment.server.core.service.unionFrictionlessPay;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.github.microservice.core.util.net.apache.HttpClientUtil;
+import com.github.microservice.core.util.net.apache.HttpModel;
+import com.github.microservice.core.util.net.apache.MethodType;
+import com.github.microservice.core.util.net.apache.ResponseModel;
+import com.github.microservice.models.requestModel.SuperResponseModel;
+import com.zhongshu.payment.client.payModel.unionFrictionlessPay.model.ApiConfParam;
+import com.zhongshu.payment.server.core.service.base.SuperService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StopWatch;
+
+/**
+ * 银联无感支付的请求
+ *
+ * @author TRX
+ * @date 2024/8/15
+ */
+@Slf4j
+@Service
+public class UnionUserOpenRequestService extends SuperService {
+
+
+    public SuperResponseModel requestAPI(String url,
+            Object data,
+            Class<? extends SuperResponseModel> cls) {
+        SuperResponseModel responseModel = new SuperResponseModel();
+        try {
+            ApiConfParam apiConfParam = new ApiConfParam();
+            apiConfParam.setApiName(url);
+            apiConfParam.setMethodType(MethodType.Json);
+            StopWatch stopWatch = new StopWatch();
+            stopWatch.start();
+            ResponseModel request = HttpClientUtil.request(HttpModel.builder()
+                    .url(url).method(apiConfParam.getMethodType()).charset("utf-8").body(data).build());
+            int code = request.getCode();
+            if (code == 200) {
+                responseModel = BeanUtil.copyProperties(request.getBody(), cls.getClass().newInstance());
+            } else if (code == 404) {
+                responseModel.setFailed("404 not found");
+            } else {
+                responseModel = BeanUtil.copyProperties(request.getBody(), cls.getClass().newInstance());
+            }
+            stopWatch.stop();
+            responseModel.setMillis(stopWatch.getTotalTimeMillis());
+        } catch (Exception e) {
+            e.printStackTrace();
+            responseModel.setFailed(String.format("请求出错:%s", e.getMessage()));
+            return responseModel;
+        }
+        // 记录请求日志
+//        requestInfoService.addRequestInfo(data, responseModel);
+        return responseModel;
+    }
+
+}
+

+ 4 - 0
PaymentServer/src/main/java/com/zhongshu/payment/server/core/service/unionFrictionlessPay/package-info.java

@@ -0,0 +1,4 @@
+package com.zhongshu.payment.server.core.service.unionFrictionlessPay;
+/**
+ * 银联无感支付
+ */

+ 7 - 0
PaymentServer/src/main/java/com/zhongshu/payment/server/core/utils/CommonUtil.java

@@ -447,4 +447,11 @@ public class CommonUtil {
         return month;
     }
 
+    public static String toFirstCharLowerCase(String str) {
+        if (str == null || str.isEmpty()) {
+            return str;
+        }
+        return Character.toLowerCase(str.charAt(0)) + str.substring(1);
+    }
+
 }