Эх сурвалжийг харах

fix(app):
1.订单表单修改

wzq 1 өдөр өмнө
parent
commit
75cff6dc34

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

@@ -15,7 +15,9 @@ public class CertificationDTO implements Serializable {
     private static final long serialVersionUID = 1L;
 
     //资质名称
+    @Schema(description = "资质名称")
     private  String name;
     //图片(多个逗号分割)
+    @Schema(description = "图片(多个逗号分割)")
     private  String certificationImg;
 }

+ 13 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/form/CreateOrderForm.java

@@ -5,6 +5,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
+import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 
@@ -17,25 +18,37 @@ public class CreateOrderForm implements Serializable {
     private static final long serialVersionUID = 1L;
 
     //订单类型;0场地1赛事2课程
+    @Schema(description = "订单类型;0场地1赛事2课程", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotNull(message = "订单类型不能为空")
     public Integer type;
 
+    @Schema(description = "场地类型;0-学校 1-包场 2-无固定场 3-个人赛 4-团队赛")
     //场地类型;0-学校 1-包场 2-无固定场 3-个人赛 4-团队赛
     public Integer orderType;
 
     //商品IDs
+    @NotBlank(message = "商品IDs不能为空")
+    @Schema(description = "商品IDs", requiredMode = Schema.RequiredMode.REQUIRED)
     private String productIds;
 
+    //是否试听课程(0-否 1是)
+    @Schema(description = "是否试听课程下单(0-否 1是)")
+    private Integer orFreeOrder;
+
     //数量
+    @Schema(description = "数量")
     private Integer amount;
 
     //使用人IDs
+    @Schema(description = "使用人IDs")
     private String familyIds;
 
     //保险表单
+    @Schema(description = "保险表单",type = "object")
     private InsureOrderInfoForm insureOrderInfoForm;
 
     //参赛资质
+    @Schema(description = "参赛资质")
     private String gameCertificationForm;
 
 }

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

@@ -17,11 +17,14 @@ public class GameCertificationForm implements Serializable {
     private static final long serialVersionUID = 1L;
 
     //队名
+    @Schema(description = "队名")
     private String teamName;
 
     //队徽
+    @Schema(description = "队徽")
     private String teamEmblemImg;
 
     //资质
+    @Schema(description = "资质",type = "array")
     private List<CertificationDTO> certificationDTOS;
 }

+ 7 - 6
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/form/InsureOrderInfoForm.java

@@ -6,7 +6,6 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
 import java.io.Serializable;
-import java.math.BigDecimal;
 import java.util.Date;
 
 @Data
@@ -18,19 +17,21 @@ public class InsureOrderInfoForm implements Serializable {
     private static final long serialVersionUID = 1L;
 
     //保险ID
-    private Integer insureId;
+    @Schema(description = "保险ID")
+    private String insureId;
 
     //生效时间
+    @Schema(description = "生效时间-起")
     private Date assertStartTime;
 
+    @Schema(description = "生效时间-止")
     private Date assertEndTime;
 
     //保单费用(单价)
-    private BigDecimal money;
+    @Schema(description = "保单费用(单价)")
+    private String insurePriceId;
 
     //保险用户编号
+    @Schema(description = "保险用户编号")
     private String familyMembersIds;
-
-    //保单总金额
-    private BigDecimal amount;
 }

+ 1 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/form/UserPayForm.java

@@ -15,5 +15,6 @@ public class UserPayForm implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    @Schema(description = "订单号")
     private String orderCode;
 }

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

@@ -1,6 +1,7 @@
 package org.jeecg.modules.app.service.impl;
 
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.extern.log4j.Log4j2;
 import org.apache.commons.lang3.ObjectUtils;
@@ -68,6 +69,9 @@ public class OrderServiceImpl implements IOrderService {
     private AppGameMapper appGameMapper;
     @Resource
     private AppGameScheduleMapper appGameScheduleMapper;
+    @Resource
+    private InsurePriceMapper insurePriceMapper;
+
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -413,6 +417,9 @@ public class OrderServiceImpl implements IOrderService {
                             .setUpdateBy(user.getId())
                             .setStatus(CommonConstant.STATUS_NORMAL)
                             .setDelFlag(CommonConstant.DEL_FLAG_0);
+                    if (StrUtil.isNotBlank(createOrderForm.getGameCertificationForm())) {
+                        appOrder.setGameCertification(createOrderForm.getGameCertificationForm());
+                    }
                 break;
             //课程
             case 2:
@@ -452,15 +459,18 @@ public class OrderServiceImpl implements IOrderService {
                     appOrderProInfo.setStatus(CommonConstant.STATUS_0_INT);
                     appOrderProInfo.setDelFlag(CommonConstant.DEL_FLAG_0);
 
-                    Boolean flag = checkOrderOrFree(user.getId(), appCourse.getCategoryId());
-                    if (!flag && i == 1) {
-                        //订单中的多个商品中的第一个商品触发免费,将金额设置为优惠金额
-                        sDiscounts = sDiscounts.add(appCourse.getSellingPrice());
-                        appOrderProInfo.setOrFreePro(CommonConstant.STATUS_1_INT);
-                        appOrder.setContractNo(null);
-                        //试听优惠
-                        appOrder.setSDiscounts(sDiscounts);
+                    if (createOrderForm.getOrFreeOrder()== 1){
+                        Boolean flag = checkOrderOrFree(user.getId(), appCourse.getCategoryId());
+                        if (!flag && i == 1) {
+                            //订单中的多个商品中的第一个商品触发免费,将金额设置为优惠金额
+                            sDiscounts = sDiscounts.add(appCourse.getSellingPrice());
+                            appOrderProInfo.setOrFreePro(CommonConstant.STATUS_1_INT);
+                            appOrder.setContractNo(null);
+                            //试听优惠
+                            appOrder.setSDiscounts(sDiscounts);
+                        }
                     }
+
                     proInfoList.add(appOrderProInfo);
 
                     tDiscounts = tDiscounts.add(appCourse.getOriginalPrice().subtract(appCourse.getSellingPrice())).setScale(2, BigDecimal.ROUND_HALF_UP);
@@ -481,7 +491,13 @@ public class OrderServiceImpl implements IOrderService {
         if (ObjectUtils.isNotEmpty(insureOrderInfoForm)) {
             List<String> ids = Arrays.stream(insureOrderInfoForm.getFamilyMembersIds().split(",")).collect(Collectors.toList());
             AppInsure appInsure = appInsureMapper.selectById(insureOrderInfoForm.getInsureId());
+            //保单总价
+            BigDecimal sumPrice = new BigDecimal(0);
             for (String id : ids) {
+
+                //查询保单价格
+                InsurePrice insurePrice = insurePriceMapper.selectById(insureOrderInfoForm.getInsureId());
+
                 //创建保单
                 InsureOrderInfo insureOrderInfo = new InsureOrderInfo();
                 insureOrderInfo
@@ -490,7 +506,7 @@ public class OrderServiceImpl implements IOrderService {
                         .setInsureName(appInsure.getInsuranceType_dictText())
                         .setInsureCompany(appInsure.getInsuranceName_dictText())
                         .setInsureId(appInsure.getId())
-                        .setMoney(insureOrderInfoForm.getMoney())
+                        .setMoney(insurePrice.getInsurePrice())
                         .setUserId(id)
                         .setAssertStartTime(insureOrderInfoForm.getAssertStartTime())
                         .setAssertEndTime(insureOrderInfoForm.getAssertEndTime())
@@ -498,6 +514,8 @@ public class OrderServiceImpl implements IOrderService {
                 ;
                 insureOrderInfoMapper.insert(insureOrderInfo);
 
+                sumPrice = sumPrice.add(insurePrice.getInsurePrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
+
                 AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
                 appOrderProInfo.setProductId(insureOrderInfo.getId());
                 appOrderProInfo.setProductName(insureOrderInfo.getInsureName());
@@ -513,7 +531,7 @@ public class OrderServiceImpl implements IOrderService {
                 appOrderProInfo.setDelFlag(CommonConstant.DEL_FLAG_0);
             }
             //计算总价 = 订单金额 + 保单金额
-            appOrder.setPrice(appOrder.getPrice().add(insureOrderInfoForm.getMoney()));
+            appOrder.setPrice(appOrder.getPrice().add(sumPrice));
         }
 
         appOrderMapper.insert(appOrder);

+ 4 - 4
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppOrder.java

@@ -98,10 +98,10 @@ public class AppOrder implements Serializable {
 	@Excel(name = "订单状态", width = 15)
     @Schema(description = "订单状态0初始 1、支付中 2、待使用 3、已使用 4、待评价 5、退款中 6、已退款")
     private int orderStatus;
-	/**保单id;保单列表*/
-	@Excel(name = "保单id;保单列表", width = 15)
-    @Schema(description = "保单id;保单列表")
-    private String insureNumberIds;
+	/**参赛资质*/
+	@Excel(name = "参赛资质", width = 15)
+    @Schema(description = "参赛资质")
+    private String gameCertification;
     /**合同编号*/
     @Excel(name = "合同编号", width = 15)
     @Schema(description = "合同编号")