Browse Source

Merge branch 'dev/2024/0822/update-app-Y' of Harper/feifan-backend-zx-app into master

补漏定时查询支付订单3
Yangzw 2 months ago
parent
commit
1d64c020c0

+ 3 - 3
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/app/usertopupconsumptionpointsorder/vo/UserTopUpConsumptionPointsOrderSaveReqVO.java

@@ -30,7 +30,7 @@ public class UserTopUpConsumptionPointsOrderSaveReqVO {
 
     @Schema(description = "充值消费分", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotNull(message = "充值消费分不能为空")
-    private Long topUpConsumptionPoints;
+    private Double topUpConsumptionPoints;
 
     @Schema(description = "到账消费分", requiredMode = Schema.RequiredMode.REQUIRED)
     private Long practicalConsumptionPoints;
@@ -59,8 +59,8 @@ public class UserTopUpConsumptionPointsOrderSaveReqVO {
     @Schema(description = "应付金额(总),单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "5880")
     @NotNull(message = "应付金额(总),单位:分不能为空")
     @Max(value = 99999999, message = "金额不能超过 99999999")
-    @Min(value = 1, message = "金额不能小于 1")
-    private Long payPrice;
+//    @Min(value = 1, message = "金额不能小于 1")
+    private Double payPrice;
 
     @Schema(description = "计算百分比模板")
     private String percentTemplate;

+ 10 - 8
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/usertopupconsumptionpointsorder/UserTopUpConsumptionPointsOrderServiceImpl.java

@@ -18,6 +18,7 @@ import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderDO;
 import cn.newfeifan.mall.module.pay.dal.mysql.order.PayOrderMapper;
 import cn.newfeifan.mall.module.pay.service.app.PayAppService;
 import com.alibaba.fastjson.JSON;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -45,6 +46,7 @@ import static cn.newfeifan.mall.module.distri.enums.ErrorCodeConstants.*;
  */
 @Service
 @Validated
+@Slf4j
 public class UserTopUpConsumptionPointsOrderServiceImpl implements UserTopUpConsumptionPointsOrderService {
 
     @Resource
@@ -66,13 +68,9 @@ public class UserTopUpConsumptionPointsOrderServiceImpl implements UserTopUpCons
 
     @Override
     public UserTopUpConsumptionPointsOrderInfoRespVO createUserTopUpConsumptionPointsOrder(UserTopUpConsumptionPointsOrderSaveReqVO createReqVO) {
-        // 计算百分比
-        OrderPercentageDO orderPercentageDO = orderPercentageService.queryStatus();
-
         // 初始化订单
-        orderInit(createReqVO, orderPercentageDO);
+        orderInit(createReqVO);
 
-        createReqVO.setPercentTemplate(JSON.toJSONString(orderPercentageDO));
         UserTopUpConsumptionPointsOrderDO userTopUpConsumptionPointsOrder = BeanUtils.toBean(createReqVO, UserTopUpConsumptionPointsOrderDO.class);
         userTopUpConsumptionPointsOrderMapper.insert(userTopUpConsumptionPointsOrder);
 
@@ -110,11 +108,12 @@ public class UserTopUpConsumptionPointsOrderServiceImpl implements UserTopUpCons
      * 订单转换
      *
      * @param createReqVO       订单信息
-     * @param orderPercentageDO 百分比计算规则
      */
-    private void orderInit(UserTopUpConsumptionPointsOrderSaveReqVO createReqVO, OrderPercentageDO orderPercentageDO) {
+    private void orderInit(UserTopUpConsumptionPointsOrderSaveReqVO createReqVO) {
+        // 计算百分比
+        OrderPercentageDO orderPercentageDO = orderPercentageService.queryStatus();
 
-        if(createReqVO.getPayPrice() < Long.parseLong(orderPercentageDO.getUserTopUpConsumptionPoints())){
+        if(createReqVO.getPayPrice() < Double.parseDouble(orderPercentageDO.getUserTopUpConsumptionPoints())){
             ErrorCode ERROR = new ErrorCode(1_002_030_038, "用户充值金额不得小于:" + orderPercentageDO.getUserTopUpConsumptionPoints());
             throw exception(ERROR);
         }
@@ -130,6 +129,7 @@ public class UserTopUpConsumptionPointsOrderServiceImpl implements UserTopUpCons
         createReqVO.setPayPrice(createReqVO.getPayPrice() * DistriConstants.ONE_HUNDRED);
         createReqVO.setTopUpConsumptionPoints(createReqVO.getPayPrice() * DistriConstants.PERCENT);
         createReqVO.setPracticalConsumptionPoints((long) (createReqVO.getTopUpConsumptionPoints() * Double.parseDouble(orderPercentageDO.getConsumptionMagnification())));
+        createReqVO.setPercentTemplate(JSON.toJSONString(orderPercentageDO));
     }
 
     @Override
@@ -169,7 +169,9 @@ public class UserTopUpConsumptionPointsOrderServiceImpl implements UserTopUpCons
     public void topUpConsumptionPoints(PayOrderDO payOrderDO) {
         UserTopUpConsumptionPointsOrderDO topUpOrder = userTopUpConsumptionPointsOrderMapper.selectById(payOrderDO.getMerchantOrderId());
 
+        log.info("充值订单对象:{}", topUpOrder);
         if(topUpOrder.getPayStatus()){
+            log.info("充值订单状态为已支付,return结束!");
             return;
         }