|
@@ -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);
|