Przeglądaj źródła

fix(order): 优化订单相关功能

- 在 AppOrderInfoDTO 中添加 orderType 字段,用于表示订单类型
- 在处理课程订单时,增加对课程不存在的判断和异常处理
- 在 OrderServiceImpl 中设置 AppOrderInfoDTO 的 orderType 属性
- 在 payController 中添加证书下载测试方法
- 修改 WeChatProfitSharingService 中的证书文件路径
wzq 1 tydzień temu
rodzic
commit
4253e465b5

+ 3 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/dto/AppOrderInfoDTO.java

@@ -40,6 +40,9 @@ public class AppOrderInfoDTO implements Serializable {
     @Schema(description = "订单类型")
     private Integer type;
 
+    @Schema(description = "订单类型")
+    private Integer orderType;
+
     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "下单时间")

+ 5 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/OrderServiceImpl.java

@@ -861,6 +861,10 @@ public class OrderServiceImpl implements IOrderService {
             case 2:
                 //课程
                 AppCourses appCourse = appCoursesMapper.selectById(appOrder.getProductIds());
+                if (ObjectUtil.isEmpty(appCourse)){
+                    log.error("当前课程不存在!");
+                    throw new JeecgBootException("当前课程已下架!");
+                }
                 List<AppCoursesPriceRules> priceRulesList = appCoursesPriceRulesMapper.selectList(Wrappers.<AppCoursesPriceRules>lambdaQuery().eq(AppCoursesPriceRules::getCoursesId, appCourse.getId()));
                 AppSite appSite = appSiteMapper.selectById(appCourse.getAddressSiteId());
                 appOrder.setOrderOrFree(appCourse.getPriceType());
@@ -1329,6 +1333,7 @@ public class OrderServiceImpl implements IOrderService {
         appOrderInfoDTO.setId(appOrder.getId());
         appOrderInfoDTO.setOrderCode(appOrder.getOrderCode());
         appOrderInfoDTO.setOrderStatus(appOrder.getOrderStatus());
+        appOrderInfoDTO.setOrderType(appOrder.getOrderType());
         appOrderInfoDTO.setType(appOrder.getType());
         appOrderInfoDTO.setCreateTime(appOrder.getCreateTime());
         appOrderInfoDTO.setPayTime(appOrder.getPayTime());

+ 22 - 4
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/pay/paytest/payController.java

@@ -6,6 +6,7 @@ import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.wechat.pay.java.core.certificate.CertificateDownloader;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -176,10 +177,27 @@ public class payController {
         }
         return null;
     }
-
-    //获取 获取平台证书列表  测试成功
-    public static void main(String[] args) throws Exception {
-
+    @GetMapping(value = "/test2")
+    public void CertificateDownloaderTest() {
+        //用于证书解密的密钥
+        String apiV3key = "4b64e17419689527b256f07cdf6bd60c";
+        // 商户号
+        String mchId = "1725845681";
+        // 商户证书序列号
+        String mchSerialNo = "65E9559D81ADA0BDA0CD3CF484A59A8DFB5610BE";
+        // 商户私钥
+        String mchPrivateKeyFilePath = "E:\\wzq\\sss";
+        // 微信支付平台证书
+        //private static String wechatpayCertificateFilePath = "wxpayplatformcert.pem";
+        //下载成功后保存证书的路径
+        String outputFilePath = "E:\\wzq\\sss";
+
+
+        String[] args = {"-k", apiV3key, "-m", mchId, "-f", mchPrivateKeyFilePath,
+                    "-s", mchSerialNo, "-o", outputFilePath};
+
+//            CommandLine.run(new CertificateDownloader(), args);
     }
+
 }
  

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/pay/routing/WeChatProfitSharingService.java

@@ -32,7 +32,7 @@ public class WeChatProfitSharingService {
      *  添加分账账号
      */
     public JSONObject receiversAdd(ReceiverAddForm receiverAddForm) throws Exception {
-        ClassPathResource classPathResource = new ClassPathResource("cert/apiclient_cert.pem");
+        ClassPathResource classPathResource = new ClassPathResource("cert/platform_cert.pem");
         InputStream certStream = classPathResource.getInputStream();
         X509Certificate x509Certificate = getCertificate(certStream);