|
@@ -25,7 +25,10 @@ import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.ZoneId;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
import java.util.concurrent.ThreadLocalRandom;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -57,7 +60,15 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
@Resource
|
|
|
private AppInsureMapper appInsureMapper;
|
|
|
@Resource
|
|
|
- private AppOrderProInfoMapper appOrderProInfoMapper;
|
|
|
+ private AppOrderProInfoMapper appOrderProInfoMapper;
|
|
|
+ @Resource
|
|
|
+ private AppContractInfoMapper appContractInfoMapper;
|
|
|
+ @Resource
|
|
|
+ private AppGamePriceRulesMapper appGamePriceRulesMapper;
|
|
|
+ @Resource
|
|
|
+ private AppGameMapper appGameMapper;
|
|
|
+ @Resource
|
|
|
+ private AppGameScheduleMapper appGameScheduleMapper;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -199,7 +210,8 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
* @return 支付订单对象
|
|
|
*/
|
|
|
@Override
|
|
|
- public UserPayForm schoolPlaceOrder(CreateOrderForm createOrderForm) {
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public UserPayForm createOrder(CreateOrderForm createOrderForm) {
|
|
|
//获取登录用户
|
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
|
@@ -210,83 +222,259 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
appOrder
|
|
|
.setOrderCode(orderCode)
|
|
|
.setUserId(user.getId())
|
|
|
- .setOrgCode(user.getOrgCode())
|
|
|
.setUserPhone(user.getPhone())
|
|
|
- .setPayTime(new Date())
|
|
|
.setOrderStatus(0)
|
|
|
- .setProductIds(createOrderForm.getProductId())
|
|
|
+ .setProductIds(createOrderForm.getProductIds())
|
|
|
.setAmount(createOrderForm.getAmount())
|
|
|
;
|
|
|
|
|
|
- //合同编号
|
|
|
-
|
|
|
-
|
|
|
List<AppOrderProInfo> proInfoList = new ArrayList<>();
|
|
|
|
|
|
//订单内容
|
|
|
switch (createOrderForm.getType()) {
|
|
|
- //场地
|
|
|
+ //场地(学校,包场,无固定场)
|
|
|
case 0:
|
|
|
- AppSitePriceRules priceRule = appSitePriceRulesMapper.selectById(createOrderForm.getProductId());
|
|
|
- //订单金额
|
|
|
- BigDecimal totalPrice = priceRule.getSellingPrice().setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
-
|
|
|
- if (priceRule.getType() == 0) {
|
|
|
- if (totalPrice.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
- appOrder.setPayType(3)
|
|
|
+ //学校
|
|
|
+ if (createOrderForm.getOrderType() == 0) {
|
|
|
+ AppSitePriceRules priceRule = appSitePriceRulesMapper.selectById(createOrderForm.getProductIds());
|
|
|
+ AppSitePlace appSitePlace = appSitePlaceMapper.selectById(priceRule.getSitePlaceId());
|
|
|
+ AppSite appSite = appSiteMapper.selectById(appSitePlace.getSiteId());
|
|
|
+ appOrder
|
|
|
+ .setPayType(3)
|
|
|
+ .setOrderStatus(2)
|
|
|
+ .setOrgCode(appSite.getOrgCode())
|
|
|
+ .setTenantId(appSite.getTenantId())
|
|
|
+ .setType(CommonConstant.ORDER_TYPE_0)
|
|
|
+ //使用人IDs
|
|
|
+ .setFamilyIds(createOrderForm.getFamilyIds())
|
|
|
+ .setOriginalPrice(priceRule.getSellingPrice())
|
|
|
+ .setPrice(priceRule.getSellingPrice())
|
|
|
+ .setCreateTime(new Date())
|
|
|
+ .setUpdateTime(new Date())
|
|
|
+ .setCreateBy(user.getId())
|
|
|
+ .setUpdateBy(user.getId())
|
|
|
+ .setStatus(CommonConstant.STATUS_NORMAL)
|
|
|
+ .setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
+ //使用人
|
|
|
+ List<String> ids = Arrays.stream(createOrderForm.getFamilyIds().split(",")).collect(Collectors.toList());
|
|
|
+ for (String id : ids) {
|
|
|
+ FamilyMembers familyMembers = familyMembersMapper.selectById(id);
|
|
|
+
|
|
|
+ AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
|
+ appOrderProInfo
|
|
|
+ .setProductId(priceRule.getId())
|
|
|
+ .setProductName("学校场地预约")
|
|
|
+ .setType(CommonConstant.ORDER_PRO_INFO_TYPE_1)
|
|
|
+ .setUseDateStr(DateUtil.format(priceRule.getDateOfSale(), "yyyy-MM-dd"))
|
|
|
+ .setFrameTimeStr(priceRule.getStartTime() + "-" + priceRule.getEndTime())
|
|
|
+ .setPrice(priceRule.getSellingPrice())
|
|
|
.setOrderStatus(2)
|
|
|
- .setPayTime(new Date());
|
|
|
- } else {
|
|
|
- appOrder.setPayType(2)
|
|
|
- .setOrderStatus(0);
|
|
|
+ .setQuantity(1)
|
|
|
+ .setFamilyUserId(id)
|
|
|
+ .setUserName(familyMembers.getFullName())
|
|
|
+ .setUserPhone(familyMembers.getPhone())
|
|
|
+ .setStatus(CommonConstant.STATUS_0_INT)
|
|
|
+ .setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
+
|
|
|
+ proInfoList.add(appOrderProInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //包场
|
|
|
+ if (createOrderForm.getOrderType() == 1) {
|
|
|
+
|
|
|
+ List<String> list = Arrays.stream(createOrderForm.getProductIds().split(",")).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //订单总价(商品的售价总和)
|
|
|
+ BigDecimal sumPrice = new BigDecimal(0);
|
|
|
+
|
|
|
+ for (String id : list) {
|
|
|
+ AppSitePriceRules priceRule = appSitePriceRulesMapper.selectById(list.get(0));
|
|
|
+ AppSitePlace appSitePlace = appSitePlaceMapper.selectById(priceRule.getSitePlaceId());
|
|
|
+
|
|
|
+ AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
|
+ appOrderProInfo.setProductId(id);
|
|
|
+ appOrderProInfo.setProductName(priceRule.getDateOfSale()+" "+priceRule.getStartTime()+"-"+priceRule.getEndTime()+"|"+appSitePlace.getName());
|
|
|
+ appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_2);
|
|
|
+ appOrderProInfo.setPrice(priceRule.getSellingPrice());
|
|
|
+ appOrderProInfo.setOrderStatus(0);
|
|
|
+ appOrderProInfo.setQuantity(1);
|
|
|
+ appOrderProInfo.setStatus(CommonConstant.STATUS_0_INT);
|
|
|
+ appOrderProInfo.setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
+
|
|
|
+ proInfoList.add(appOrderProInfo);
|
|
|
+ appOrder.setOrgCode(appSitePlace.getOrgCode())
|
|
|
+ .setTenantId(appSitePlace.getTenantId());
|
|
|
+
|
|
|
+ sumPrice = sumPrice.add(priceRule.getSellingPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
+
|
|
|
+ appOrder
|
|
|
+ .setType(CommonConstant.ORDER_TYPE_0)
|
|
|
+ .setOriginalPrice(sumPrice)
|
|
|
+ .setCreateTime(new Date())
|
|
|
+ .setUpdateTime(new Date())
|
|
|
+ .setCreateBy(user.getId())
|
|
|
+ .setUpdateBy(user.getId())
|
|
|
+ .setStatus(CommonConstant.STATUS_NORMAL)
|
|
|
+ .setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
+ }
|
|
|
+
|
|
|
+ //无固定场
|
|
|
+ if (createOrderForm.getOrderType() == 2) {
|
|
|
+ AppSitePriceRules priceRule = appSitePriceRulesMapper.selectById(createOrderForm.getProductIds());
|
|
|
+ AppSitePlace appSitePlace = appSitePlaceMapper.selectById(priceRule.getSitePlaceId());
|
|
|
+ AppSite appSite = appSiteMapper.selectById(appSitePlace.getSiteId());
|
|
|
+
|
|
|
+ //订单总价(商品的售价总和)
|
|
|
+ BigDecimal sumPrice = new BigDecimal(0);
|
|
|
+ //团购优惠
|
|
|
+ BigDecimal tDiscounts = new BigDecimal(0);
|
|
|
+
|
|
|
+ for (int i = 1; i <= createOrderForm.getAmount(); i++) {
|
|
|
+
|
|
|
+ AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
|
+ appOrderProInfo.setProductId(createOrderForm.getProductIds());
|
|
|
+ appOrderProInfo.setProductName(appSitePlace.getName());
|
|
|
+ appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_3);
|
|
|
+ appOrderProInfo.setFrameTimeStr(appSite.getStartTime() + "-" + appSite.getEndTime());
|
|
|
+ appOrderProInfo.setPrice(priceRule.getSellingPrice());
|
|
|
+ appOrderProInfo.setOrderStatus(0);
|
|
|
+ appOrderProInfo.setQuantity(1);
|
|
|
+ appOrderProInfo.setStatus(CommonConstant.STATUS_0_INT);
|
|
|
+ appOrderProInfo.setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
+
|
|
|
+ proInfoList.add(appOrderProInfo);
|
|
|
+
|
|
|
+ tDiscounts = tDiscounts.add(priceRule.getOriginalPrice().subtract(priceRule.getSellingPrice())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ sumPrice = sumPrice.add(priceRule.getSellingPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+
|
|
|
+ appOrder
|
|
|
+ .setOrgCode(appSite.getOrgCode())
|
|
|
+ .setTenantId(appSite.getTenantId())
|
|
|
+ .setType(CommonConstant.ORDER_TYPE_0)
|
|
|
+ .setTDiscounts(tDiscounts)
|
|
|
+ .setOriginalPrice(sumPrice)
|
|
|
+ .setCreateTime(new Date())
|
|
|
+ .setUpdateTime(new Date())
|
|
|
+ .setCreateBy(user.getId())
|
|
|
+ .setUpdateBy(user.getId())
|
|
|
+ .setStatus(CommonConstant.STATUS_NORMAL)
|
|
|
+ .setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
}
|
|
|
- appOrder
|
|
|
- .setProductIds(priceRule.getSitePlaceId())
|
|
|
- .setType(0)
|
|
|
- .setOriginalPrice(totalPrice)
|
|
|
- .setPrice(totalPrice)
|
|
|
- .setCreateTime(new Date())
|
|
|
- .setUpdateTime(new Date())
|
|
|
- .setCreateBy(user.getId())
|
|
|
- .setUpdateBy(user.getId());
|
|
|
break;
|
|
|
//赛事
|
|
|
case 1:
|
|
|
+ //个人赛
|
|
|
+
|
|
|
+ AppGamePriceRules appGamePriceRules = appGamePriceRulesMapper.selectById(createOrderForm.getProductIds());
|
|
|
+ AppGame appGame = appGameMapper.selectById(appGamePriceRules.getGameId());
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ proInfoList.add(appOrderProInfo);
|
|
|
+
|
|
|
+ sumPrice = sumPrice.add(appGamePriceRules.getSellingPrice()).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);
|
|
|
break;
|
|
|
//课程
|
|
|
case 2:
|
|
|
- //如果当前课程商品类目是第一次购买,触发免费政策
|
|
|
- //优惠金额
|
|
|
+ //课程
|
|
|
+ AppCourses appCourse = appCoursesMapper.selectById(appOrder.getProductIds());
|
|
|
+
|
|
|
+ appOrder.setType(CommonConstant.ORDER_TYPE_2);
|
|
|
+ appOrder.setOrgCode(appCourse.getOrgCode());
|
|
|
+ appOrder.setTenantId(appCourse.getTenantId());
|
|
|
+
|
|
|
+ //合同编号
|
|
|
+ AppContractInfo appContractInfo = appContractInfoMapper.selectOne(Wrappers.<AppContractInfo>lambdaQuery().eq(AppContractInfo::getOrgCode, appOrder.getOrgCode()));
|
|
|
+ appOrder.setContractNo(appContractInfo.getId());
|
|
|
+
|
|
|
+ //订单总价(商品的售价总和)
|
|
|
+ BigDecimal sumCoursePrice = new BigDecimal(0);
|
|
|
+
|
|
|
+ //优惠金额,如果当前课程商品类目是第一次购买,触发免费政策
|
|
|
BigDecimal sDiscounts = new BigDecimal(0);
|
|
|
BigDecimal tDiscounts = 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();
|
|
|
-
|
|
|
- AppCourses appCours = appCoursesMapper.selectById(appOrder.getProductIds());
|
|
|
- Boolean flag = checkOrderOrFree(user.getId(), appCours.getCategoryId());
|
|
|
- if (!flag && i==1){
|
|
|
+ appOrderProInfo.setProductId(createOrderForm.getProductIds());
|
|
|
+ appOrderProInfo.setProductName(appCourse.getName());
|
|
|
+ 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.setPrice(appCourse.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);
|
|
|
+
|
|
|
+ Boolean flag = checkOrderOrFree(user.getId(), appCourse.getCategoryId());
|
|
|
+ if (!flag && i == 1) {
|
|
|
//订单中的多个商品中的第一个商品触发免费,将金额设置为优惠金额
|
|
|
- sDiscounts = sDiscounts.add(appCours.getSellingPrice());
|
|
|
+ sDiscounts = sDiscounts.add(appCourse.getSellingPrice());
|
|
|
appOrderProInfo.setOrFreePro(CommonConstant.STATUS_1_INT);
|
|
|
+ appOrder.setContractNo(null);
|
|
|
+ //试听优惠
|
|
|
+ appOrder.setSDiscounts(sDiscounts);
|
|
|
}
|
|
|
proInfoList.add(appOrderProInfo);
|
|
|
- tDiscounts = tDiscounts.add(appCours.getOriginalPrice().subtract(appCours.getSellingPrice())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ tDiscounts = tDiscounts.add(appCourse.getOriginalPrice().subtract(appCourse.getSellingPrice())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ sumCoursePrice = sumCoursePrice.add(appCourse.getSellingPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
- appOrder.setSDiscounts(sDiscounts);
|
|
|
- appOrder.setTDiscounts(tDiscounts);
|
|
|
|
|
|
+ //团购优惠
|
|
|
+ appOrder.setTDiscounts(tDiscounts);
|
|
|
+ //原订单总价
|
|
|
+ appOrder.setOriginalPrice(sumCoursePrice);
|
|
|
+ //使用人IDs
|
|
|
+ appOrder.setFamilyIds(createOrderForm.getFamilyIds());
|
|
|
break;
|
|
|
-
|
|
|
- }
|
|
|
- appOrderMapper.insert(appOrder);
|
|
|
-
|
|
|
- //保存订单商品信息
|
|
|
- for (AppOrderProInfo appOrderProInfo : proInfoList) {
|
|
|
- appOrderProInfo.setOrderId(appOrder.getId());
|
|
|
- appOrderProInfoMapper.insert(appOrderProInfo);
|
|
|
}
|
|
|
|
|
|
//构建保单内容
|
|
@@ -299,7 +487,7 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
InsureOrderInfo insureOrderInfo = new InsureOrderInfo();
|
|
|
insureOrderInfo
|
|
|
.setOrderId(appOrder.getId())
|
|
|
- .setBdOrderNo("0000000000")
|
|
|
+ .setBdOrderNo(generateOrderNumber(2))
|
|
|
.setInsureName(appInsure.getInsuranceType_dictText())
|
|
|
.setInsureCompany(appInsure.getInsuranceName_dictText())
|
|
|
.setInsureId(appInsure.getId())
|
|
@@ -310,7 +498,31 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
.setIsEnterSystem(CommonConstant.STATUS_0_INT)
|
|
|
;
|
|
|
insureOrderInfoMapper.insert(insureOrderInfo);
|
|
|
+
|
|
|
+ AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
|
+ appOrderProInfo.setProductId(insureOrderInfo.getId());
|
|
|
+ appOrderProInfo.setProductName(insureOrderInfo.getInsureName());
|
|
|
+ appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_7);
|
|
|
+
|
|
|
+ appOrderProInfo.setPrice(insureOrderInfo.getMoney());
|
|
|
+ appOrderProInfo.setQuantity(1);
|
|
|
+ FamilyMembers familyMembers = familyMembersMapper.selectById(id);
|
|
|
+ appOrderProInfo.setFamilyUserId(id);
|
|
|
+ appOrderProInfo.setUserName(familyMembers.getFullName());
|
|
|
+ appOrderProInfo.setUserPhone(familyMembers.getPhone());
|
|
|
+ appOrderProInfo.setStatus(CommonConstant.STATUS_0_INT);
|
|
|
+ appOrderProInfo.setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
}
|
|
|
+ //计算总价 = 订单金额 + 保单金额
|
|
|
+ appOrder.setPrice(appOrder.getPrice().add(insureOrderInfoForm.getMoney()));
|
|
|
+ }
|
|
|
+
|
|
|
+ appOrderMapper.insert(appOrder);
|
|
|
+
|
|
|
+ //保存订单商品信息
|
|
|
+ for (AppOrderProInfo appOrderProInfo : proInfoList) {
|
|
|
+ appOrderProInfo.setOrderId(appOrder.getId());
|
|
|
+ appOrderProInfoMapper.insert(appOrderProInfo);
|
|
|
}
|
|
|
|
|
|
//构建支付表单返回给前端支撑支付调用
|
|
@@ -319,7 +531,6 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
.setOrderCode(orderCode)
|
|
|
;
|
|
|
return payForm;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -409,10 +620,12 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
* @Author SheepHy
|
|
|
* @Description 订单编号生成逻辑
|
|
|
* @Date 17:18 2025/7/15
|
|
|
+ * @params 类型:0-(D:订单) 1-(T:退单) 2-(B:保单)
|
|
|
**/
|
|
|
private String generateOrderNumber(int type) {
|
|
|
String format = DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
|
|
int nextInt = ThreadLocalRandom.current().nextInt(1000, 10000);
|
|
|
+
|
|
|
if (type == 0) {
|
|
|
return "D" + format + nextInt;
|
|
|
} else {
|