|
@@ -1,6 +1,8 @@
|
|
|
package org.jeecg.modules.app.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -12,6 +14,7 @@ import org.jeecg.common.constant.CommonConstant;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.DictAnnotationUtil;
|
|
|
+import org.jeecg.modules.app.dto.AppOrderInfoDTO;
|
|
|
import org.jeecg.modules.app.form.CreateOrderForm;
|
|
|
import org.jeecg.modules.app.form.InsureOrderInfoForm;
|
|
|
import org.jeecg.modules.app.form.UserPayForm;
|
|
@@ -73,7 +76,10 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
private AppGameScheduleMapper appGameScheduleMapper;
|
|
|
@Resource
|
|
|
private InsurePriceMapper insurePriceMapper;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private AppCoursesPriceRulesMapper appCoursesPriceRulesMapper;
|
|
|
+ @Resource
|
|
|
+ private AppCoursesVerificationRecordMapper appCoursesVerificationRecordMapper;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -129,17 +135,17 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
previewOrderPlaceSchool.setName(appSitePlace.getName())
|
|
|
.setId(appSitePlace.getId())
|
|
|
.setTimeSlot(timeSlot);
|
|
|
- if (StringUtils.isNotEmpty(appSitePlace.getInsureIds())){
|
|
|
+ if (StringUtils.isNotEmpty(appSitePlace.getInsureIds())) {
|
|
|
List<String> aptitudesList = new ArrayList<>();
|
|
|
- if (appSitePlace.getInsureIds().indexOf(",")>0){
|
|
|
- aptitudesList = Arrays.asList(appSitePlace.getInsureIds().split(","));
|
|
|
- }else {
|
|
|
+ if (appSitePlace.getInsureIds().indexOf(",") > 0) {
|
|
|
+ aptitudesList = Arrays.asList(appSitePlace.getInsureIds().split(","));
|
|
|
+ } else {
|
|
|
aptitudesList.add(appSitePlace.getInsureIds());
|
|
|
}
|
|
|
LambdaQueryWrapper<AppInsure> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.in(AppInsure::getId, aptitudesList)
|
|
|
- .eq(AppInsure::getStatus,0)
|
|
|
- .eq(AppInsure::getDelFlag,0); // 方法引用 + 集合
|
|
|
+ .eq(AppInsure::getStatus, 0)
|
|
|
+ .eq(AppInsure::getDelFlag, 0); // 方法引用 + 集合
|
|
|
List<AppInsure> appInsureList = appInsureMapper.selectList(wrapper);
|
|
|
DictAnnotationUtil.translateDictList(appInsureList);
|
|
|
for (AppInsure appInsure : appInsureList) {
|
|
@@ -162,7 +168,7 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
List<String> list = Arrays.asList(appCourses.getCover().split(","));
|
|
|
boolean checkCourseDiscount = checkCourseDiscount(appCourses.getCategoryId(), user.getId());
|
|
|
previousOrderCourse.setId(appCourses.getId())
|
|
|
- .setCover(list.get(0).split( ",")[0])
|
|
|
+ .setCover(list.get(0).split(",")[0])
|
|
|
.setName(appCourses.getName())
|
|
|
.setSellingPrice(appCourses.getSellingPrice())
|
|
|
.setReminder(appCourses.getReminder())
|
|
@@ -179,17 +185,17 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
previousOrderCourse.setTotalPrice(appCourses.getSellingPrice());
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(appCourses.getInsureIds())){
|
|
|
+ if (StringUtils.isNotEmpty(appCourses.getInsureIds())) {
|
|
|
List<String> aptitudesList = new ArrayList<>();
|
|
|
- if (appCourses.getInsureIds().indexOf(",")>0){
|
|
|
- aptitudesList = Arrays.asList(appCourses.getInsureIds().split(","));
|
|
|
- }else {
|
|
|
+ if (appCourses.getInsureIds().indexOf(",") > 0) {
|
|
|
+ aptitudesList = Arrays.asList(appCourses.getInsureIds().split(","));
|
|
|
+ } else {
|
|
|
aptitudesList.add(appCourses.getInsureIds());
|
|
|
}
|
|
|
LambdaQueryWrapper<AppInsure> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.in(AppInsure::getId, aptitudesList)
|
|
|
- .eq(AppInsure::getStatus,0)
|
|
|
- .eq(AppInsure::getDelFlag,0); // 方法引用 + 集合
|
|
|
+ .eq(AppInsure::getStatus, 0)
|
|
|
+ .eq(AppInsure::getDelFlag, 0); // 方法引用 + 集合
|
|
|
List<AppInsure> appInsureList = appInsureMapper.selectList(wrapper);
|
|
|
DictAnnotationUtil.translateDictList(appInsureList);
|
|
|
for (AppInsure appInsure : appInsureList) {
|
|
@@ -277,6 +283,8 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
|
|
|
List<InsureOrderInfo> insureOrderInfoList = new ArrayList<>();
|
|
|
|
|
|
+ List<AppCoursesVerificationRecord> appCoursesVerificationRecordList = new ArrayList<>();
|
|
|
+
|
|
|
//订单内容
|
|
|
switch (createOrderForm.getType()) {
|
|
|
//场地(学校,包场,无固定场)
|
|
@@ -295,7 +303,7 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
//使用人IDs
|
|
|
.setFamilyIds(createOrderForm.getFamilyIds())
|
|
|
.setOriginalPrice(priceRule.getSellingPrice())
|
|
|
- .setPrice(priceRule.getSellingPrice())
|
|
|
+ .setPrice(totalPrice)
|
|
|
.setCreateTime(new Date())
|
|
|
.setUpdateTime(new Date())
|
|
|
.setCreateBy(user.getId())
|
|
@@ -314,6 +322,7 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
.setType(CommonConstant.ORDER_PRO_INFO_TYPE_1)
|
|
|
.setUseDateStr(DateUtil.format(priceRule.getDateOfSale(), "yyyy-MM-dd"))
|
|
|
.setFrameTimeStr(priceRule.getStartTime() + "-" + priceRule.getEndTime())
|
|
|
+ .setOriginalPrice(priceRule.getOriginalPrice())
|
|
|
.setPrice(priceRule.getSellingPrice())
|
|
|
.setOrderStatus(2)
|
|
|
.setQuantity(1)
|
|
@@ -338,11 +347,14 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
for (String id : list) {
|
|
|
AppSitePriceRules priceRule = appSitePriceRulesMapper.selectById(list.get(0));
|
|
|
AppSitePlace appSitePlace = appSitePlaceMapper.selectById(priceRule.getSitePlaceId());
|
|
|
+ AppSite appSite = appSiteMapper.selectById(appSitePlace.getSiteId());
|
|
|
|
|
|
AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
|
appOrderProInfo.setProductId(id);
|
|
|
- appOrderProInfo.setProductName(priceRule.getDateOfSale()+" "+priceRule.getStartTime()+"-"+priceRule.getEndTime()+"|"+appSitePlace.getName());
|
|
|
+ appOrderProInfo.setProductName(priceRule.getDateOfSale() + " " + priceRule.getStartTime() + "-" + priceRule.getEndTime() + "|" + appSitePlace.getName());
|
|
|
+ appOrderProInfo.setAddress(appSite.getAddress());
|
|
|
appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_2);
|
|
|
+ appOrderProInfo.setOriginalPrice(priceRule.getOriginalPrice());
|
|
|
appOrderProInfo.setPrice(priceRule.getSellingPrice());
|
|
|
appOrderProInfo.setOrderStatus(0);
|
|
|
appOrderProInfo.setQuantity(1);
|
|
@@ -356,6 +368,9 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
sumPrice = sumPrice.add(priceRule.getSellingPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
|
|
|
+ //计算订单总价
|
|
|
+ totalPrice = totalPrice.add(sumPrice).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
appOrder
|
|
|
.setType(CommonConstant.ORDER_TYPE_0)
|
|
|
.setOriginalPrice(sumPrice)
|
|
@@ -383,8 +398,10 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
|
appOrderProInfo.setProductId(createOrderForm.getProductIds());
|
|
|
appOrderProInfo.setProductName(appSitePlace.getName());
|
|
|
+ appOrderProInfo.setAddress(appSite.getAddress());
|
|
|
appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_3);
|
|
|
appOrderProInfo.setFrameTimeStr(appSite.getStartTime() + "-" + appSite.getEndTime());
|
|
|
+ appOrderProInfo.setOriginalPrice(priceRule.getOriginalPrice());
|
|
|
appOrderProInfo.setPrice(priceRule.getSellingPrice());
|
|
|
appOrderProInfo.setOrderStatus(0);
|
|
|
appOrderProInfo.setQuantity(1);
|
|
@@ -397,6 +414,9 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
sumPrice = sumPrice.add(priceRule.getSellingPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
|
|
|
+ //计算订单总价
|
|
|
+ totalPrice = totalPrice.add(sumPrice).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
appOrder
|
|
|
.setOrgCode(appSite.getOrgCode())
|
|
|
.setTenantId(appSite.getTenantId())
|
|
@@ -414,61 +434,66 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
//赛事
|
|
|
case 1:
|
|
|
//个人赛
|
|
|
+ AppGamePriceRules appGamePriceRules = appGamePriceRulesMapper.selectById(createOrderForm.getProductIds());
|
|
|
+ AppGame appGame = appGameMapper.selectById(appGamePriceRules.getGameId());
|
|
|
|
|
|
- AppGamePriceRules appGamePriceRules = appGamePriceRulesMapper.selectById(createOrderForm.getProductIds());
|
|
|
- AppGame appGame = appGameMapper.selectById(appGamePriceRules.getGameId());
|
|
|
-
|
|
|
- appOrder.setOrgCode(appGamePriceRules.getOrgCode());
|
|
|
- appOrder.setTenantId(appGamePriceRules.getTenantId());
|
|
|
+ appOrder.setOrgCode(appGamePriceRules.getOrgCode());
|
|
|
+ appOrder.setTenantId(appGamePriceRules.getTenantId());
|
|
|
|
|
|
- //订单总价(商品的售价总和)
|
|
|
- BigDecimal sumPrice = new BigDecimal(0);
|
|
|
-
|
|
|
- for (int i = 1; i <= createOrderForm.getAmount(); i++) {
|
|
|
-
|
|
|
- String familyUserId = createOrderForm.getFamilyIds().split(",")[i - 1];
|
|
|
- FamilyMembers familyMembers = familyMembersMapper.selectById(familyUserId);
|
|
|
- AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
|
- appOrderProInfo.setProductId(createOrderForm.getProductIds());
|
|
|
- appOrderProInfo.setProductName(appGame.getName());
|
|
|
- if (createOrderForm.getOrderType() == 3) {
|
|
|
- appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_4);
|
|
|
- }
|
|
|
- if (createOrderForm.getOrderType() == 4) {
|
|
|
- appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_5);
|
|
|
- }
|
|
|
- appOrderProInfo.setFrameTimeStr(appGame.getStartTime() + "-" + appGame.getEndTime());
|
|
|
- appOrderProInfo.setPrice(appGamePriceRules.getSellingPrice());
|
|
|
- appOrderProInfo.setOrderStatus(0);
|
|
|
- appOrderProInfo.setQuantity(1);
|
|
|
- appOrderProInfo.setFamilyUserId(familyUserId);
|
|
|
- appOrderProInfo.setUserName(familyMembers.getFullName());
|
|
|
- appOrderProInfo.setUserPhone(familyMembers.getPhone());
|
|
|
- appOrderProInfo.setStatus(CommonConstant.STATUS_0_INT);
|
|
|
- appOrderProInfo.setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
+ //订单总价(商品的售价总和)
|
|
|
+ BigDecimal sumPrice = new BigDecimal(0);
|
|
|
|
|
|
- proInfoList.add(appOrderProInfo);
|
|
|
+ for (int i = 1; i <= createOrderForm.getAmount(); i++) {
|
|
|
|
|
|
- sumPrice = sumPrice.add(appGamePriceRules.getSellingPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ String familyUserId = createOrderForm.getFamilyIds().split(",")[i - 1];
|
|
|
+ FamilyMembers familyMembers = familyMembersMapper.selectById(familyUserId);
|
|
|
+ AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
|
+ appOrderProInfo.setProductId(createOrderForm.getProductIds());
|
|
|
+ appOrderProInfo.setProductName(appGame.getName());
|
|
|
+ appOrderProInfo.setAddress(appGame.getAddress());
|
|
|
+ if (createOrderForm.getOrderType() == 3) {
|
|
|
+ appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_4);
|
|
|
}
|
|
|
+ if (createOrderForm.getOrderType() == 4) {
|
|
|
+ appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_5);
|
|
|
+ }
|
|
|
+ appOrderProInfo.setFrameTimeStr(appGame.getStartTime() + "-" + appGame.getEndTime());
|
|
|
+ appOrderProInfo.setOriginalPrice(appGamePriceRules.getSellingPrice());
|
|
|
+ appOrderProInfo.setPrice(appGamePriceRules.getSellingPrice());
|
|
|
+ appOrderProInfo.setOrderStatus(0);
|
|
|
+ appOrderProInfo.setQuantity(1);
|
|
|
+ appOrderProInfo.setFamilyUserId(familyUserId);
|
|
|
+ appOrderProInfo.setUserName(familyMembers.getFullName());
|
|
|
+ appOrderProInfo.setUserPhone(familyMembers.getPhone());
|
|
|
+ appOrderProInfo.setStatus(CommonConstant.STATUS_0_INT);
|
|
|
+ appOrderProInfo.setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
|
|
|
- appOrder
|
|
|
- .setType(CommonConstant.ORDER_TYPE_1)
|
|
|
- .setOriginalPrice(sumPrice)
|
|
|
- .setCreateTime(new Date())
|
|
|
- .setUpdateTime(new Date())
|
|
|
- .setCreateBy(user.getId())
|
|
|
- .setUpdateBy(user.getId())
|
|
|
- .setStatus(CommonConstant.STATUS_NORMAL)
|
|
|
- .setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
-// if (StrUtil.isNotBlank(createOrderForm.getGameCertificationForm())) {
|
|
|
-// appOrder.setGameCertification(createOrderForm.getGameCertificationForm());
|
|
|
-// }
|
|
|
+ proInfoList.add(appOrderProInfo);
|
|
|
+
|
|
|
+ sumPrice = sumPrice.add(appGamePriceRules.getSellingPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ //计算订单总价
|
|
|
+ totalPrice = totalPrice.add(sumPrice).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ appOrder
|
|
|
+ .setType(CommonConstant.ORDER_TYPE_1)
|
|
|
+ .setOriginalPrice(sumPrice)
|
|
|
+ .setCreateTime(new Date())
|
|
|
+ .setUpdateTime(new Date())
|
|
|
+ .setCreateBy(user.getId())
|
|
|
+ .setUpdateBy(user.getId())
|
|
|
+ .setStatus(CommonConstant.STATUS_NORMAL)
|
|
|
+ .setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
+ if (StrUtil.isNotBlank(createOrderForm.getGameCertificationForm())) {
|
|
|
+ appOrder.setGameCertification(createOrderForm.getGameCertificationForm());
|
|
|
+ }
|
|
|
break;
|
|
|
//课程
|
|
|
case 2:
|
|
|
//课程
|
|
|
AppCourses appCourse = appCoursesMapper.selectById(appOrder.getProductIds());
|
|
|
+ List<AppCoursesPriceRules> priceRulesList = appCoursesPriceRulesMapper.selectList(Wrappers.<AppCoursesPriceRules>lambdaQuery().eq(AppCoursesPriceRules::getCoursesId, appCourse.getId()));
|
|
|
+ AppSite appSite = appSiteMapper.selectById(appCourse.getAddressSiteId());
|
|
|
|
|
|
appOrder.setType(CommonConstant.ORDER_TYPE_2);
|
|
|
appOrder.setOrgCode(appCourse.getOrgCode());
|
|
@@ -492,8 +517,10 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
|
appOrderProInfo.setProductId(createOrderForm.getProductIds());
|
|
|
appOrderProInfo.setProductName(appCourse.getName());
|
|
|
+ appOrderProInfo.setAddress(appSite.getAddress());
|
|
|
appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_6);
|
|
|
- appOrderProInfo.setFrameTimeStr(DateUtil.format(appCourse.getStartTime(),"yyyy-MM-dd") + "-" + DateUtil.format(appCourse.getEndTime(),"yyyy-MM-dd"));
|
|
|
+ appOrderProInfo.setFrameTimeStr(DateUtil.format(appCourse.getStartTime(), "yyyy-MM-dd") + "-" + DateUtil.format(appCourse.getEndTime(), "yyyy-MM-dd"));
|
|
|
+ appOrderProInfo.setOriginalPrice(appCourse.getOriginalPrice());
|
|
|
appOrderProInfo.setPrice(appCourse.getSellingPrice());
|
|
|
appOrderProInfo.setOrderStatus(0);
|
|
|
appOrderProInfo.setQuantity(1);
|
|
@@ -503,7 +530,23 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
appOrderProInfo.setStatus(CommonConstant.STATUS_0_INT);
|
|
|
appOrderProInfo.setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
|
|
|
- if (createOrderForm.getOrFreeOrder()== 1){
|
|
|
+ //创建核销记录
|
|
|
+ for (AppCoursesPriceRules appCoursesPriceRules : priceRulesList) {
|
|
|
+ AppCoursesVerificationRecord appCoursesVerificationRecord = new AppCoursesVerificationRecord();
|
|
|
+ appCoursesVerificationRecord.setCoursesId(appCourse.getId());
|
|
|
+ appCoursesVerificationRecord.setCoursesPriceRuleId(appCoursesPriceRules.getId());
|
|
|
+ appCoursesVerificationRecord.setCoursesName(appCourse.getName());
|
|
|
+ appCoursesVerificationRecord.setCoursesStartTime(appCoursesPriceRules.getStartTime());
|
|
|
+ appCoursesVerificationRecord.setCoursesEndTime(appCoursesPriceRules.getEndTime());
|
|
|
+ appCoursesVerificationRecord.setUseUserId(familyUserId);
|
|
|
+ appCoursesVerificationRecord.setUseUserName(familyMembers.getFullName());
|
|
|
+ appCoursesVerificationRecord.setVerifyStatus(0);
|
|
|
+ appCoursesVerificationRecord.setOrPostpone(0);
|
|
|
+ appCoursesVerificationRecord.setCoursesType(0);
|
|
|
+ appCoursesVerificationRecordList.add(appCoursesVerificationRecord);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (createOrderForm.getOrFreeOrder() == 1) {
|
|
|
Boolean flag = checkOrderOrFree(user.getId(), appCourse.getCategoryId());
|
|
|
if (!flag && i == 1) {
|
|
|
//订单中的多个商品中的第一个商品触发免费,将金额设置为优惠金额
|
|
@@ -521,6 +564,9 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
sumCoursePrice = sumCoursePrice.add(appCourse.getSellingPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
|
|
|
+ //计算订单总价
|
|
|
+ totalPrice = totalPrice.add(sumCoursePrice).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
//团购优惠
|
|
|
appOrder.setTDiscounts(tDiscounts);
|
|
|
//原订单总价
|
|
@@ -576,14 +622,31 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
appOrderProInfo.setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
}
|
|
|
//计算总价 = 订单金额 + 保单金额
|
|
|
+ totalPrice = totalPrice.add(sumPrice);
|
|
|
}
|
|
|
-
|
|
|
+ appOrder.setPrice(totalPrice);
|
|
|
appOrderMapper.insert(appOrder);
|
|
|
|
|
|
- //保存订单商品信息
|
|
|
+ //todo 优化异步执行 -> 保存订单商品信息
|
|
|
for (AppOrderProInfo appOrderProInfo : proInfoList) {
|
|
|
- appOrderProInfo.setOrderId(appOrder.getId());
|
|
|
+ appOrderProInfo
|
|
|
+ .setOrderId(appOrder.getId())
|
|
|
+ .setOrderCode(appOrder.getOrderCode())
|
|
|
+ //生成10位随机券号
|
|
|
+ .setTicketNo(RandomUtil.randomNumbers(10))
|
|
|
+ ;
|
|
|
appOrderProInfoMapper.insert(appOrderProInfo);
|
|
|
+ //订单券号记录
|
|
|
+ AppIsin appIsin = new AppIsin();
|
|
|
+ appIsin
|
|
|
+ .setOrderId(appOrder.getId())
|
|
|
+ .setOrderCode(appOrder.getOrderCode())
|
|
|
+ .setOrderProInfoId(appOrderProInfo.getId())
|
|
|
+ .setFamilyId(appOrderProInfo.getFamilyUserId())
|
|
|
+ .setUseAddress(StrUtil.isBlank(appOrderProInfo.getAddress()) ? null : appOrderProInfo.getAddress())
|
|
|
+ //生成10位随机券号
|
|
|
+ .setIsinCode(appOrderProInfo.getTicketNo())
|
|
|
+ .setIsinStatus(CommonConstant.STATUS_0_INT);
|
|
|
}
|
|
|
|
|
|
//保存保险
|
|
@@ -592,9 +655,17 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
insureOrderInfoMapper.insert(insureOrderInfo);
|
|
|
}
|
|
|
|
|
|
+ //保存核销记录
|
|
|
+ for (AppCoursesVerificationRecord appCoursesVerificationRecord : appCoursesVerificationRecordList) {
|
|
|
+ appCoursesVerificationRecord.setOrderId(appOrder.getId());
|
|
|
+ appCoursesVerificationRecord.setOrderCode(appOrder.getOrderCode());
|
|
|
+ appCoursesVerificationRecordMapper.insert(appCoursesVerificationRecord);
|
|
|
+ }
|
|
|
+
|
|
|
//构建支付表单返回给前端支撑支付调用
|
|
|
UserPayForm payForm = new UserPayForm();
|
|
|
payForm
|
|
|
+ .setOrderId(appOrder.getId())
|
|
|
.setOrderCode(orderCode)
|
|
|
;
|
|
|
return payForm;
|
|
@@ -605,6 +676,51 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
return appSitePlaceMapper.previewOrderPlaceGymnasiumNoFixation(placeId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public AppOrderInfoDTO queryOrderInfo(String orderId) {
|
|
|
+
|
|
|
+ AppOrderInfoDTO appOrderInfoDTO = new AppOrderInfoDTO();
|
|
|
+
|
|
|
+ AppOrder appOrder = appOrderMapper.selectById(orderId);
|
|
|
+ appOrderInfoDTO.setId(appOrder.getId());
|
|
|
+ appOrderInfoDTO.setOrderCode(appOrder.getOrderCode());
|
|
|
+ appOrderInfoDTO.setOrderStatus(appOrder.getOrderStatus());
|
|
|
+ appOrderInfoDTO.setCreateTime(appOrder.getCreateTime());
|
|
|
+ appOrderInfoDTO.setPayTime(appOrder.getPayTime());
|
|
|
+ appOrderInfoDTO.setPhoneNumber(appOrder.getUserPhone());
|
|
|
+ appOrderInfoDTO.setTotalPrice(appOrder.getOriginalPrice());
|
|
|
+ appOrderInfoDTO.setPrice(appOrder.getPrice());
|
|
|
+ if (appOrder.getType().equals(CommonConstant.ORDER_TYPE_2)) {
|
|
|
+ appOrderInfoDTO.setSDiscounts(appOrder.getSDiscounts());
|
|
|
+ appOrderInfoDTO.setTDiscounts(appOrder.getTDiscounts());
|
|
|
+ }
|
|
|
+
|
|
|
+ //子订单
|
|
|
+ List<AppOrderProInfo> proInfoList = appOrderProInfoMapper.selectList(Wrappers.<AppOrderProInfo>lambdaQuery().eq(AppOrderProInfo::getOrderId, orderId));
|
|
|
+ appOrderInfoDTO.setProInfoList(proInfoList);
|
|
|
+
|
|
|
+ //商品信息
|
|
|
+ String productIds = appOrder.getProductIds();
|
|
|
+ AppCourses appCourses = appCoursesMapper.selectById(productIds);
|
|
|
+ appOrderInfoDTO.setAppCourses(appCourses);
|
|
|
+ //使用须知
|
|
|
+ if (ObjectUtils.isNotEmpty(appCourses.getReminder())) {
|
|
|
+ appOrderInfoDTO.setReminder(appCourses.getReminder());
|
|
|
+ }
|
|
|
+ //门店信息
|
|
|
+ AppSite site = appSiteMapper.selectById(appCourses.getSiteId());
|
|
|
+ appOrderInfoDTO.setSiteName(site.getName());
|
|
|
+ appOrderInfoDTO.setRunStatus(site.getRunStatus());
|
|
|
+ //上课地点(经纬度)
|
|
|
+ AppSite courseSite = appSiteMapper.selectById(appCourses.getAddressSiteId());
|
|
|
+ appOrderInfoDTO.setCourseSiteAddress(courseSite.getAddress());
|
|
|
+ appOrderInfoDTO.setLatitude(courseSite.getLatitude());
|
|
|
+ appOrderInfoDTO.setLongitude(courseSite.getLongitude());
|
|
|
+ appOrderInfoDTO.setPhone(courseSite.getPhone());
|
|
|
+
|
|
|
+ return appOrderInfoDTO;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* @return boolean
|