|
@@ -218,7 +218,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
Date settleTime = DateUtil.offsetHour(date, effectiveTime1);
|
|
Date settleTime = DateUtil.offsetHour(date, effectiveTime1);
|
|
storePinkSummary.setStopTime(settleTime);
|
|
storePinkSummary.setStopTime(settleTime);
|
|
storePinkSummary.setIsRefund(0);
|
|
storePinkSummary.setIsRefund(0);
|
|
- storePinkSummary.setIsVirtual(Boolean.TRUE); //初始化时直接锁定,防止团长还没支付这个团就暴露出来了。等团长支付时会重新计算是否锁定
|
|
|
|
|
|
+ storePinkSummary.setIsVirtual(Boolean.TRUE); // 初始化时直接锁定,防止团长还没支付这个团就暴露出来了。等团长支付时会重新计算是否锁定
|
|
storePinkSummary.setPeopleCount(1);
|
|
storePinkSummary.setPeopleCount(1);
|
|
storePinkSummary.setStatus(1);
|
|
storePinkSummary.setStatus(1);
|
|
|
|
|
|
@@ -314,7 +314,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
throw new ServiceException(I18nUtil.get("group.buying.is.full"));
|
|
throw new ServiceException(I18nUtil.get("group.buying.is.full"));
|
|
}
|
|
}
|
|
|
|
|
|
- //记得将重复拼团校验放开
|
|
|
|
|
|
+ // 记得将重复拼团校验放开
|
|
List<Long> uidList = pinkList.stream().map(StorePink::getUid).collect(Collectors.toList());
|
|
List<Long> uidList = pinkList.stream().map(StorePink::getUid).collect(Collectors.toList());
|
|
if (uidList.contains(dto.getUserId())) {
|
|
if (uidList.contains(dto.getUserId())) {
|
|
throw new ServiceException(I18nUtil.get("duplicate.group.buying"));
|
|
throw new ServiceException(I18nUtil.get("duplicate.group.buying"));
|
|
@@ -324,18 +324,18 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
}
|
|
}
|
|
|
|
|
|
private void joinGroup(StorePink teamPink, GoPinkDTO dto, int count, int pinkSize) {
|
|
private void joinGroup(StorePink teamPink, GoPinkDTO dto, int count, int pinkSize) {
|
|
- //拼团剩余人数
|
|
|
|
|
|
+ // 拼团剩余人数
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
|
|
|
|
- //修改拼团汇总表 这块得上分布式锁 这块不需要了,会去 maintainQuantityStatusOfTheStorePinkSummary幂等时时维护 汇总表的拼团状态和拼团数量的
|
|
|
|
-// StorePinkSummary storePinkSummary = new StorePinkSummary();
|
|
|
|
-// storePinkSummary.setId(dto.getSpsId());
|
|
|
|
-// storePinkSummary.setPeopleCount(pinkSize+1);
|
|
|
|
-// EasyToUseUtil.appCreateAssignment(date,storePinkSummary);
|
|
|
|
-// if (count == 1) {
|
|
|
|
-// storePinkSummary.setStatus(1);
|
|
|
|
-// }
|
|
|
|
-// storePinkSummaryService.update(storePinkSummary);
|
|
|
|
|
|
+ // 修改拼团汇总表 这块得上分布式锁 这块不需要了,会去 maintainQuantityStatusOfTheStorePinkSummary幂等时时维护 汇总表的拼团状态和拼团数量的
|
|
|
|
+ // StorePinkSummary storePinkSummary = new StorePinkSummary();
|
|
|
|
+ // storePinkSummary.setId(dto.getSpsId());
|
|
|
|
+ // storePinkSummary.setPeopleCount(pinkSize+1);
|
|
|
|
+ // EasyToUseUtil.appCreateAssignment(date,storePinkSummary);
|
|
|
|
+ // if (count == 1) {
|
|
|
|
+ // storePinkSummary.setStatus(1);
|
|
|
|
+ // }
|
|
|
|
+ // storePinkSummaryService.update(storePinkSummary);
|
|
|
|
|
|
// 加入拼团
|
|
// 加入拼团
|
|
StorePink storePink = new StorePink();
|
|
StorePink storePink = new StorePink();
|
|
@@ -388,7 +388,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
if (ObjectUtil.isNull(storeCombination) || storeCombination.getIsDelete().equals(1)) {
|
|
if (ObjectUtil.isNull(storeCombination) || storeCombination.getIsDelete().equals(1)) {
|
|
throw new ServiceException(I18nUtil.get("the.corresponding.group.buying.product.does.not.exist"));
|
|
throw new ServiceException(I18nUtil.get("the.corresponding.group.buying.product.does.not.exist"));
|
|
}
|
|
}
|
|
- //这里要排除掉团长未付款的拼团
|
|
|
|
|
|
+ // 这里要排除掉团长未付款的拼团
|
|
|
|
|
|
PageHelper.startPage(1, 10);
|
|
PageHelper.startPage(1, 10);
|
|
Condition pinkSummaryCondition = new Condition(StorePinkSummary.class);
|
|
Condition pinkSummaryCondition = new Condition(StorePinkSummary.class);
|
|
@@ -420,7 +420,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
Map<Long, List<StorePink>> collect = pinkList.stream().collect(Collectors.groupingBy(StorePink::getSpsId));
|
|
Map<Long, List<StorePink>> collect = pinkList.stream().collect(Collectors.groupingBy(StorePink::getSpsId));
|
|
log.info("collect:" + collect.toString());
|
|
log.info("collect:" + collect.toString());
|
|
-//记得将重复拼团校验放开
|
|
|
|
|
|
+ // 记得将重复拼团校验放开
|
|
List<List<StorePink>> availableGroups = collect.values().stream()
|
|
List<List<StorePink>> availableGroups = collect.values().stream()
|
|
.filter(list -> !list.stream().map(StorePink::getUid).collect(Collectors.toList()).contains(dto.getUserId()))
|
|
.filter(list -> !list.stream().map(StorePink::getUid).collect(Collectors.toList()).contains(dto.getUserId()))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
@@ -447,14 +447,14 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
log.info("maxPinkList:" + maxPinkList.toString());
|
|
log.info("maxPinkList:" + maxPinkList.toString());
|
|
if (CollectionUtils.isNotEmpty(maxPinkList)) {
|
|
if (CollectionUtils.isNotEmpty(maxPinkList)) {
|
|
List<Long> uidList = maxPinkList.stream().map(StorePink::getUid).collect(Collectors.toList());
|
|
List<Long> uidList = maxPinkList.stream().map(StorePink::getUid).collect(Collectors.toList());
|
|
- //记得将重复拼团校验放开
|
|
|
|
|
|
+ // 记得将重复拼团校验放开
|
|
if (!uidList.contains(dto.getUserId())) {
|
|
if (!uidList.contains(dto.getUserId())) {
|
|
- //团长
|
|
|
|
|
|
+ // 团长
|
|
StorePink pink = maxPinkList.stream().filter(i -> i.getKId().equals(0)).collect(Collectors.toList()).get(0);
|
|
StorePink pink = maxPinkList.stream().filter(i -> i.getKId().equals(0)).collect(Collectors.toList()).get(0);
|
|
int count = pink.getPeople() - (CollUtil.isEmpty(maxPinkList) ? 0 : maxPinkList.size());
|
|
int count = pink.getPeople() - (CollUtil.isEmpty(maxPinkList) ? 0 : maxPinkList.size());
|
|
log.info("count:" + count);
|
|
log.info("count:" + count);
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
- dto.setSpsId(pink.getSpsId()); //拼团汇总表id
|
|
|
|
|
|
+ dto.setSpsId(pink.getSpsId()); // 拼团汇总表id
|
|
joinGroup(pink, dto, count, pinkList.size());
|
|
joinGroup(pink, dto, count, pinkList.size());
|
|
} else {
|
|
} else {
|
|
throw new ServiceException(I18nUtil.get("the.number.of.group.buying.participants.exceeds.the.limit.please.initiate.group.buying.again.pinkid") + pink.getId());
|
|
throw new ServiceException(I18nUtil.get("the.number.of.group.buying.participants.exceeds.the.limit.please.initiate.group.buying.again.pinkid") + pink.getId());
|
|
@@ -495,9 +495,12 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
storeOrderInfo.getSku(),
|
|
storeOrderInfo.getSku(),
|
|
storeOrderInfo.getPayNum(),
|
|
storeOrderInfo.getPayNum(),
|
|
|
|
|
|
- vo.getRealName(),
|
|
|
|
- vo.getUserPhone(),
|
|
|
|
- vo.getUserAddress(),
|
|
|
|
|
|
+ (orderAddressVO == null || StringUtils.isBlank(orderAddressVO.getRealName())) ? "" : orderAddressVO.getRealName(),
|
|
|
|
+ (orderAddressVO == null || StringUtils.isBlank(orderAddressVO.getPhone())) ? "" : orderAddressVO.getPhone(),
|
|
|
|
+ (orderAddressVO == null || StringUtils.isBlank(orderAddressVO.getDetail())) ? "" : orderAddressVO.getProvince() + orderAddressVO.getCity() + orderAddressVO.getDistrict() + orderAddressVO.getDetail(),
|
|
|
|
+ // vo.getRealName(),
|
|
|
|
+ // vo.getUserPhone(),
|
|
|
|
+ // vo.getUserAddress(),
|
|
(orderAddressVO == null || StringUtils.isBlank(orderAddressVO.getPostCode())) ? "" : orderAddressVO.getPostCode(),
|
|
(orderAddressVO == null || StringUtils.isBlank(orderAddressVO.getPostCode())) ? "" : orderAddressVO.getPostCode(),
|
|
vo.getDeliveryName(),
|
|
vo.getDeliveryName(),
|
|
vo.getDeliveryId()
|
|
vo.getDeliveryId()
|
|
@@ -562,7 +565,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
StoreOrder storeOrderForUpdate = new StoreOrder();
|
|
StoreOrder storeOrderForUpdate = new StoreOrder();
|
|
storeOrderForUpdate.setStatus(pinkOrderStatusEnum.getKey());
|
|
storeOrderForUpdate.setStatus(pinkOrderStatusEnum.getKey());
|
|
storeOrderForUpdate.setDeliveryName(storeOrderDeliveryDTO.getDeliveryName());
|
|
storeOrderForUpdate.setDeliveryName(storeOrderDeliveryDTO.getDeliveryName());
|
|
- storeOrderForUpdate.setDeliveryCode(storeOrderDeliveryDTO.getDeliveryNo());
|
|
|
|
|
|
+ storeOrderForUpdate.setDeliveryId(storeOrderDeliveryDTO.getDeliveryNo());
|
|
storeOrderForUpdate.setDeliveryTime(date);
|
|
storeOrderForUpdate.setDeliveryTime(date);
|
|
|
|
|
|
Example example = new Example(StoreOrder.class);
|
|
Example example = new Example(StoreOrder.class);
|
|
@@ -570,7 +573,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
storeOrderMapper.updateByConditionSelective(storeOrderForUpdate, example);
|
|
storeOrderMapper.updateByConditionSelective(storeOrderForUpdate, example);
|
|
storeOrderStatusService.createLog(storeOrder.getId(), Constants.ORDER_STATUS_DELIVERY_ORDER, "订单发货");
|
|
storeOrderStatusService.createLog(storeOrder.getId(), Constants.ORDER_STATUS_DELIVERY_ORDER, "订单发货");
|
|
|
|
|
|
- //维护拼团订单状态
|
|
|
|
|
|
+ // 维护拼团订单状态
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
Example exampleStorePink = new Example(StorePink.class);
|
|
Example exampleStorePink = new Example(StorePink.class);
|
|
@@ -626,10 +629,10 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
}
|
|
}
|
|
// 实际支付金额
|
|
// 实际支付金额
|
|
orderInfoVo.setPayFee(orderInfoVo.getProTotalFee().add(orderInfoVo.getFreightFee()));
|
|
orderInfoVo.setPayFee(orderInfoVo.getProTotalFee().add(orderInfoVo.getFreightFee()));
|
|
-// orderInfoVo.setUserIntegral(user.getIntegral());
|
|
|
|
-// orderInfoVo.setUserBalance(user.getNowMoney());
|
|
|
|
|
|
+ // orderInfoVo.setUserIntegral(user.getIntegral());
|
|
|
|
+ // orderInfoVo.setUserBalance(user.getNowMoney());
|
|
// 缓存订单
|
|
// 缓存订单
|
|
-// String key = user.getUid() + DateUtil.getNowTime().toString() + CrmebUtil.getUuid();
|
|
|
|
|
|
+ // String key = user.getUid() + DateUtil.getNowTime().toString() + CrmebUtil.getUuid();
|
|
String key = OrderUtils.getOrderCode();
|
|
String key = OrderUtils.getOrderCode();
|
|
redisUtil.set("user_order:" + key, JSONObject.toJSONString(orderInfoVo), Constants.ORDER_CASH_CONFIRM);
|
|
redisUtil.set("user_order:" + key, JSONObject.toJSONString(orderInfoVo), Constants.ORDER_CASH_CONFIRM);
|
|
return key;
|
|
return key;
|
|
@@ -639,114 +642,114 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
* 计算订单运费
|
|
* 计算订单运费
|
|
*/
|
|
*/
|
|
private void getFreightFee(OrderInfoVO orderInfoVo, UserAddress userAddress) {
|
|
private void getFreightFee(OrderInfoVO orderInfoVo, UserAddress userAddress) {
|
|
-// // 判断是否满额包邮 type=1按件数 2按重量 3按体积
|
|
|
|
-// // 全场满额包邮开关
|
|
|
|
-// String postageSwitchString = systemConfigService.getValueByKey(SysConfigConstants.STORE_FEE_POSTAGE_SWITCH);
|
|
|
|
-// // 全场满额包邮金额
|
|
|
|
-// String storeFreePostageString = systemConfigService.getValueByKey(SysConfigConstants.STORE_FEE_POSTAGE);
|
|
|
|
|
|
+ // // 判断是否满额包邮 type=1按件数 2按重量 3按体积
|
|
|
|
+ // // 全场满额包邮开关
|
|
|
|
+ // String postageSwitchString = systemConfigService.getValueByKey(SysConfigConstants.STORE_FEE_POSTAGE_SWITCH);
|
|
|
|
+ // // 全场满额包邮金额
|
|
|
|
+ // String storeFreePostageString = systemConfigService.getValueByKey(SysConfigConstants.STORE_FEE_POSTAGE);
|
|
BigDecimal storePostage = BigDecimal.ZERO;
|
|
BigDecimal storePostage = BigDecimal.ZERO;
|
|
-// if ("true".equals(postageSwitchString) && ("0".equals(storeFreePostageString) || orderInfoVo.getProTotalFee().compareTo(new BigDecimal(storeFreePostageString)) >= 0)) {
|
|
|
|
-// storePostage = BigDecimal.ZERO;
|
|
|
|
-// } else if (ObjectUtil.isNull(userAddress) || userAddress.getCityId() <= 0) {
|
|
|
|
-// // 用户地址不存在,默认运费为0元
|
|
|
|
-// storePostage = BigDecimal.ZERO;
|
|
|
|
-// } else {
|
|
|
|
-// // 有用户地址的情况下
|
|
|
|
-// // 运费根据商品计算
|
|
|
|
-// Map<Integer, MyRecord> proMap = CollUtil.newHashMap();
|
|
|
|
-// orderInfoVo.getOrderDetailList().forEach(e -> {
|
|
|
|
-// Integer proId = e.getProductId();
|
|
|
|
-// if (proMap.containsKey(proId)) {
|
|
|
|
-// MyRecord record = proMap.get(proId);
|
|
|
|
-// record.set("totalPrice", record.getBigDecimal("totalPrice").add(e.getPrice().multiply(BigDecimal.valueOf(e.getPayNum()))));
|
|
|
|
-// record.set("totalNum", record.getInt("totalNum") + e.getPayNum());
|
|
|
|
-// BigDecimal weight = e.getWeight().multiply(BigDecimal.valueOf(e.getPayNum()));
|
|
|
|
-// record.set("weight", record.getBigDecimal("weight").add(weight));
|
|
|
|
-// BigDecimal volume = e.getVolume().multiply(BigDecimal.valueOf(e.getPayNum()));
|
|
|
|
-// record.set("volume", record.getBigDecimal("volume").add(volume));
|
|
|
|
-// } else {
|
|
|
|
-// MyRecord record = new MyRecord();
|
|
|
|
-// record.set("totalPrice", e.getPrice().multiply(BigDecimal.valueOf(e.getPayNum())));
|
|
|
|
-// record.set("totalNum", e.getPayNum());
|
|
|
|
-// record.set("tempId", e.getTempId());
|
|
|
|
-// record.set("proId", proId);
|
|
|
|
-// BigDecimal weight = e.getWeight().multiply(BigDecimal.valueOf(e.getPayNum()));
|
|
|
|
-// record.set("weight", weight);
|
|
|
|
-// BigDecimal volume = e.getVolume().multiply(BigDecimal.valueOf(e.getPayNum()));
|
|
|
|
-// record.set("volume", volume);
|
|
|
|
-//
|
|
|
|
-// proMap.put(proId, record);
|
|
|
|
-// }
|
|
|
|
-// });
|
|
|
|
-//
|
|
|
|
-// // 指定包邮(单品运费模板)> 指定区域配送(单品运费模板)
|
|
|
|
-// int cityId = userAddress.getCityId();
|
|
|
|
-//
|
|
|
|
-// for (Map.Entry<Integer, MyRecord> m : proMap.entrySet()) {
|
|
|
|
-// MyRecord value = m.getValue();
|
|
|
|
-// Integer tempId = value.getInt("tempId");
|
|
|
|
-// ShippingTemplates shippingTemplate = shippingTemplatesService.getById(tempId);
|
|
|
|
-// if (shippingTemplate.getAppoint()) {// 指定包邮
|
|
|
|
-// // 判断是否在指定包邮区域内
|
|
|
|
-// // 必须满足件数 + 金额 才能包邮
|
|
|
|
-// ShippingTemplatesFree shippingTemplatesFree = shippingTemplatesFreeService.getByTempIdAndCityId(tempId, cityId);
|
|
|
|
-// if (ObjectUtil.isNotNull(shippingTemplatesFree)) { // 在包邮区域内
|
|
|
|
-// BigDecimal freeNum = shippingTemplatesFree.getNumber();
|
|
|
|
-// BigDecimal multiply = value.getBigDecimal("totalPrice");
|
|
|
|
-// if (new BigDecimal(value.getInt("totalNum")).compareTo(freeNum) >= 0 && multiply.compareTo(shippingTemplatesFree.getPrice()) >= 0) {
|
|
|
|
-// // 满足件数 + 金额 = 包邮
|
|
|
|
-// continue;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// // 不满足指定包邮条件,走指定区域配送
|
|
|
|
-// ShippingTemplatesRegion shippingTemplatesRegion = shippingTemplatesRegionService.getByTempIdAndCityId(tempId, cityId);
|
|
|
|
-// if (ObjectUtil.isNull(shippingTemplatesRegion)) {
|
|
|
|
-// throw new ServiceException("计算运费时,未找到全国运费配置");
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// // 判断计费方式:件数、重量、体积
|
|
|
|
-// switch (shippingTemplate.getType()) {
|
|
|
|
-// case 1: // 件数
|
|
|
|
-// // 判断件数是否超过首件
|
|
|
|
-// Integer num = value.getInt("totalNum");
|
|
|
|
-// if (num <= shippingTemplatesRegion.getFirst().intValue()) {
|
|
|
|
-// storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice());
|
|
|
|
-// } else {// 超过首件的需要计算续件
|
|
|
|
-// int renewalNum = num - shippingTemplatesRegion.getFirst().intValue();
|
|
|
|
-// // 剩余件数/续件 = 需要计算的续件费用的次数
|
|
|
|
-// BigDecimal divide = new BigDecimal(renewalNum).divide(shippingTemplatesRegion.getRenewal(), 0, BigDecimal.ROUND_UP);
|
|
|
|
-// BigDecimal renewalPrice = shippingTemplatesRegion.getRenewalPrice().multiply(divide);
|
|
|
|
-// storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice()).add(renewalPrice);
|
|
|
|
-// }
|
|
|
|
-// break;
|
|
|
|
-// case 2: // 重量
|
|
|
|
-// BigDecimal weight = value.getBigDecimal("weight");
|
|
|
|
-// if (weight.compareTo(shippingTemplatesRegion.getFirst()) <= 0) {
|
|
|
|
-// storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice());
|
|
|
|
-// } else {// 超过首件的需要计算续件
|
|
|
|
-// BigDecimal renewalNum = weight.subtract(shippingTemplatesRegion.getFirst());
|
|
|
|
-// // 剩余件数/续件 = 需要计算的续件费用的次数
|
|
|
|
-// BigDecimal divide = renewalNum.divide(shippingTemplatesRegion.getRenewal(), 0, BigDecimal.ROUND_UP);
|
|
|
|
-// BigDecimal renewalPrice = shippingTemplatesRegion.getRenewalPrice().multiply(divide);
|
|
|
|
-// storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice()).add(renewalPrice);
|
|
|
|
-// }
|
|
|
|
-// break;
|
|
|
|
-// case 3: // 体积
|
|
|
|
-// BigDecimal volume = value.getBigDecimal("volume");
|
|
|
|
-// if (volume.compareTo(shippingTemplatesRegion.getFirst()) <= 0) {
|
|
|
|
-// storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice());
|
|
|
|
-// } else {// 超过首件的需要计算续件
|
|
|
|
-// BigDecimal renewalNum = volume.subtract(shippingTemplatesRegion.getFirst());
|
|
|
|
-// // 剩余件数/续件 = 需要计算的续件费用的次数
|
|
|
|
-// BigDecimal divide = renewalNum.divide(shippingTemplatesRegion.getRenewal(), 0, BigDecimal.ROUND_UP);
|
|
|
|
-// BigDecimal renewalPrice = shippingTemplatesRegion.getRenewalPrice().multiply(divide);
|
|
|
|
-// storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice()).add(renewalPrice);
|
|
|
|
-// }
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+ // if ("true".equals(postageSwitchString) && ("0".equals(storeFreePostageString) || orderInfoVo.getProTotalFee().compareTo(new BigDecimal(storeFreePostageString)) >= 0)) {
|
|
|
|
+ // storePostage = BigDecimal.ZERO;
|
|
|
|
+ // } else if (ObjectUtil.isNull(userAddress) || userAddress.getCityId() <= 0) {
|
|
|
|
+ // // 用户地址不存在,默认运费为0元
|
|
|
|
+ // storePostage = BigDecimal.ZERO;
|
|
|
|
+ // } else {
|
|
|
|
+ // // 有用户地址的情况下
|
|
|
|
+ // // 运费根据商品计算
|
|
|
|
+ // Map<Integer, MyRecord> proMap = CollUtil.newHashMap();
|
|
|
|
+ // orderInfoVo.getOrderDetailList().forEach(e -> {
|
|
|
|
+ // Integer proId = e.getProductId();
|
|
|
|
+ // if (proMap.containsKey(proId)) {
|
|
|
|
+ // MyRecord record = proMap.get(proId);
|
|
|
|
+ // record.set("totalPrice", record.getBigDecimal("totalPrice").add(e.getPrice().multiply(BigDecimal.valueOf(e.getPayNum()))));
|
|
|
|
+ // record.set("totalNum", record.getInt("totalNum") + e.getPayNum());
|
|
|
|
+ // BigDecimal weight = e.getWeight().multiply(BigDecimal.valueOf(e.getPayNum()));
|
|
|
|
+ // record.set("weight", record.getBigDecimal("weight").add(weight));
|
|
|
|
+ // BigDecimal volume = e.getVolume().multiply(BigDecimal.valueOf(e.getPayNum()));
|
|
|
|
+ // record.set("volume", record.getBigDecimal("volume").add(volume));
|
|
|
|
+ // } else {
|
|
|
|
+ // MyRecord record = new MyRecord();
|
|
|
|
+ // record.set("totalPrice", e.getPrice().multiply(BigDecimal.valueOf(e.getPayNum())));
|
|
|
|
+ // record.set("totalNum", e.getPayNum());
|
|
|
|
+ // record.set("tempId", e.getTempId());
|
|
|
|
+ // record.set("proId", proId);
|
|
|
|
+ // BigDecimal weight = e.getWeight().multiply(BigDecimal.valueOf(e.getPayNum()));
|
|
|
|
+ // record.set("weight", weight);
|
|
|
|
+ // BigDecimal volume = e.getVolume().multiply(BigDecimal.valueOf(e.getPayNum()));
|
|
|
|
+ // record.set("volume", volume);
|
|
|
|
+ //
|
|
|
|
+ // proMap.put(proId, record);
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ //
|
|
|
|
+ // // 指定包邮(单品运费模板)> 指定区域配送(单品运费模板)
|
|
|
|
+ // int cityId = userAddress.getCityId();
|
|
|
|
+ //
|
|
|
|
+ // for (Map.Entry<Integer, MyRecord> m : proMap.entrySet()) {
|
|
|
|
+ // MyRecord value = m.getValue();
|
|
|
|
+ // Integer tempId = value.getInt("tempId");
|
|
|
|
+ // ShippingTemplates shippingTemplate = shippingTemplatesService.getById(tempId);
|
|
|
|
+ // if (shippingTemplate.getAppoint()) {// 指定包邮
|
|
|
|
+ // // 判断是否在指定包邮区域内
|
|
|
|
+ // // 必须满足件数 + 金额 才能包邮
|
|
|
|
+ // ShippingTemplatesFree shippingTemplatesFree = shippingTemplatesFreeService.getByTempIdAndCityId(tempId, cityId);
|
|
|
|
+ // if (ObjectUtil.isNotNull(shippingTemplatesFree)) { // 在包邮区域内
|
|
|
|
+ // BigDecimal freeNum = shippingTemplatesFree.getNumber();
|
|
|
|
+ // BigDecimal multiply = value.getBigDecimal("totalPrice");
|
|
|
|
+ // if (new BigDecimal(value.getInt("totalNum")).compareTo(freeNum) >= 0 && multiply.compareTo(shippingTemplatesFree.getPrice()) >= 0) {
|
|
|
|
+ // // 满足件数 + 金额 = 包邮
|
|
|
|
+ // continue;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // // 不满足指定包邮条件,走指定区域配送
|
|
|
|
+ // ShippingTemplatesRegion shippingTemplatesRegion = shippingTemplatesRegionService.getByTempIdAndCityId(tempId, cityId);
|
|
|
|
+ // if (ObjectUtil.isNull(shippingTemplatesRegion)) {
|
|
|
|
+ // throw new ServiceException("计算运费时,未找到全国运费配置");
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ // // 判断计费方式:件数、重量、体积
|
|
|
|
+ // switch (shippingTemplate.getType()) {
|
|
|
|
+ // case 1: // 件数
|
|
|
|
+ // // 判断件数是否超过首件
|
|
|
|
+ // Integer num = value.getInt("totalNum");
|
|
|
|
+ // if (num <= shippingTemplatesRegion.getFirst().intValue()) {
|
|
|
|
+ // storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice());
|
|
|
|
+ // } else {// 超过首件的需要计算续件
|
|
|
|
+ // int renewalNum = num - shippingTemplatesRegion.getFirst().intValue();
|
|
|
|
+ // // 剩余件数/续件 = 需要计算的续件费用的次数
|
|
|
|
+ // BigDecimal divide = new BigDecimal(renewalNum).divide(shippingTemplatesRegion.getRenewal(), 0, BigDecimal.ROUND_UP);
|
|
|
|
+ // BigDecimal renewalPrice = shippingTemplatesRegion.getRenewalPrice().multiply(divide);
|
|
|
|
+ // storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice()).add(renewalPrice);
|
|
|
|
+ // }
|
|
|
|
+ // break;
|
|
|
|
+ // case 2: // 重量
|
|
|
|
+ // BigDecimal weight = value.getBigDecimal("weight");
|
|
|
|
+ // if (weight.compareTo(shippingTemplatesRegion.getFirst()) <= 0) {
|
|
|
|
+ // storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice());
|
|
|
|
+ // } else {// 超过首件的需要计算续件
|
|
|
|
+ // BigDecimal renewalNum = weight.subtract(shippingTemplatesRegion.getFirst());
|
|
|
|
+ // // 剩余件数/续件 = 需要计算的续件费用的次数
|
|
|
|
+ // BigDecimal divide = renewalNum.divide(shippingTemplatesRegion.getRenewal(), 0, BigDecimal.ROUND_UP);
|
|
|
|
+ // BigDecimal renewalPrice = shippingTemplatesRegion.getRenewalPrice().multiply(divide);
|
|
|
|
+ // storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice()).add(renewalPrice);
|
|
|
|
+ // }
|
|
|
|
+ // break;
|
|
|
|
+ // case 3: // 体积
|
|
|
|
+ // BigDecimal volume = value.getBigDecimal("volume");
|
|
|
|
+ // if (volume.compareTo(shippingTemplatesRegion.getFirst()) <= 0) {
|
|
|
|
+ // storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice());
|
|
|
|
+ // } else {// 超过首件的需要计算续件
|
|
|
|
+ // BigDecimal renewalNum = volume.subtract(shippingTemplatesRegion.getFirst());
|
|
|
|
+ // // 剩余件数/续件 = 需要计算的续件费用的次数
|
|
|
|
+ // BigDecimal divide = renewalNum.divide(shippingTemplatesRegion.getRenewal(), 0, BigDecimal.ROUND_UP);
|
|
|
|
+ // BigDecimal renewalPrice = shippingTemplatesRegion.getRenewalPrice().multiply(divide);
|
|
|
|
+ // storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice()).add(renewalPrice);
|
|
|
|
+ // }
|
|
|
|
+ // break;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
orderInfoVo.setFreightFee(storePostage);
|
|
orderInfoVo.setFreightFee(storePostage);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -754,31 +757,32 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
* 校验预下单商品信息
|
|
* 校验预下单商品信息
|
|
*
|
|
*
|
|
* @param request 预下单请求参数
|
|
* @param request 预下单请求参数
|
|
|
|
+ *
|
|
* @return OrderInfoVo
|
|
* @return OrderInfoVo
|
|
*/
|
|
*/
|
|
private OrderInfoVO validatePreOrderRequest(PreOrderRequest request, UserDTO user) {
|
|
private OrderInfoVO validatePreOrderRequest(PreOrderRequest request, UserDTO user) {
|
|
OrderInfoVO orderInfoVo = new OrderInfoVO();
|
|
OrderInfoVO orderInfoVo = new OrderInfoVO();
|
|
List<OrderInfoDetailVO> detailVoList = CollUtil.newArrayList();
|
|
List<OrderInfoDetailVO> detailVoList = CollUtil.newArrayList();
|
|
-// if ("shoppingCart".equals(request.getPreOrderType())) {
|
|
|
|
-// // 购物车购买
|
|
|
|
-// detailVoList = validatePreOrderShopping(request, user);
|
|
|
|
-// List<Long> cartIdList = request.getOrderDetails().stream().map(PreOrderDetailRequest::getShoppingCartId).distinct().collect(Collectors.toList());
|
|
|
|
-// orderInfoVo.setCartIdList(cartIdList);
|
|
|
|
-// }
|
|
|
|
|
|
+ // if ("shoppingCart".equals(request.getPreOrderType())) {
|
|
|
|
+ // // 购物车购买
|
|
|
|
+ // detailVoList = validatePreOrderShopping(request, user);
|
|
|
|
+ // List<Long> cartIdList = request.getOrderDetails().stream().map(PreOrderDetailRequest::getShoppingCartId).distinct().collect(Collectors.toList());
|
|
|
|
+ // orderInfoVo.setCartIdList(cartIdList);
|
|
|
|
+ // }
|
|
if ("buyNow".equals(request.getPreOrderType())) {
|
|
if ("buyNow".equals(request.getPreOrderType())) {
|
|
// 立即购买
|
|
// 立即购买
|
|
// 立即购买只会有一条详情
|
|
// 立即购买只会有一条详情
|
|
PreOrderDetailRequest detailRequest = request.getOrderDetails().get(0);
|
|
PreOrderDetailRequest detailRequest = request.getOrderDetails().get(0);
|
|
-// if (detailRequest.getSeckillId() > 0) {
|
|
|
|
-// // 秒杀
|
|
|
|
-// detailVoList.add(validatePreOrderSeckill(detailRequest, user));
|
|
|
|
-// orderInfoVo.setSeckillId(detailRequest.getSeckillId());
|
|
|
|
-// } else if (detailRequest.getBargainId() > 0) {
|
|
|
|
-// // 砍价
|
|
|
|
-// detailVoList.add(validatePreOrderBargain(detailRequest, user));
|
|
|
|
-// orderInfoVo.setBargainId(detailRequest.getBargainId());
|
|
|
|
-// orderInfoVo.setBargainUserId(detailRequest.getBargainUserId());
|
|
|
|
-// } else
|
|
|
|
|
|
+ // if (detailRequest.getSeckillId() > 0) {
|
|
|
|
+ // // 秒杀
|
|
|
|
+ // detailVoList.add(validatePreOrderSeckill(detailRequest, user));
|
|
|
|
+ // orderInfoVo.setSeckillId(detailRequest.getSeckillId());
|
|
|
|
+ // } else if (detailRequest.getBargainId() > 0) {
|
|
|
|
+ // // 砍价
|
|
|
|
+ // detailVoList.add(validatePreOrderBargain(detailRequest, user));
|
|
|
|
+ // orderInfoVo.setBargainId(detailRequest.getBargainId());
|
|
|
|
+ // orderInfoVo.setBargainUserId(detailRequest.getBargainUserId());
|
|
|
|
+ // } else
|
|
if (detailRequest.getCId() > 0) {
|
|
if (detailRequest.getCId() > 0) {
|
|
// 拼团
|
|
// 拼团
|
|
detailVoList.add(validatePreOrderCombination(detailRequest, user));
|
|
detailVoList.add(validatePreOrderCombination(detailRequest, user));
|
|
@@ -815,12 +819,12 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
throw new ServiceException(I18nUtil.get("product.specification.information.does.not.exist.please.refresh.and.reselect"));
|
|
throw new ServiceException(I18nUtil.get("product.specification.information.does.not.exist.please.refresh.and.reselect"));
|
|
}
|
|
}
|
|
if (attrValue.getStock() < detailRequest.getProductNum()) {
|
|
if (attrValue.getStock() < detailRequest.getProductNum()) {
|
|
- throw new ServiceException(I18nUtil.get("insufficient.product.specification.inventory.please.refresh.and.reselect"));
|
|
|
|
|
|
+ throw new ServiceException("商品规格库存不足,请刷新后重新选择");
|
|
}
|
|
}
|
|
-// SystemUserLevel userLevel = null;
|
|
|
|
-// if (user.getLevel() > 0) {
|
|
|
|
-// userLevel = systemUserLevelService.getByLevelId(user.getLevel());
|
|
|
|
-// }
|
|
|
|
|
|
+ // SystemUserLevel userLevel = null;
|
|
|
|
+ // if (user.getLevel() > 0) {
|
|
|
|
+ // userLevel = systemUserLevelService.getByLevelId(user.getLevel());
|
|
|
|
+ // }
|
|
OrderInfoDetailVO detailVo = new OrderInfoDetailVO();
|
|
OrderInfoDetailVO detailVo = new OrderInfoDetailVO();
|
|
detailVo.setProductId(storeProduct.getId());
|
|
detailVo.setProductId(storeProduct.getId());
|
|
detailVo.setProductName(storeProduct.getStoreName());
|
|
detailVo.setProductName(storeProduct.getStoreName());
|
|
@@ -854,6 +858,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
* 拼团预下单校验
|
|
* 拼团预下单校验
|
|
*
|
|
*
|
|
* @param detailRequest 请求参数
|
|
* @param detailRequest 请求参数
|
|
|
|
+ *
|
|
* @return OrderInfoDetailVo
|
|
* @return OrderInfoDetailVo
|
|
*/
|
|
*/
|
|
private OrderInfoDetailVO validatePreOrderCombination(PreOrderDetailRequest detailRequest, UserDTO user) {
|
|
private OrderInfoDetailVO validatePreOrderCombination(PreOrderDetailRequest detailRequest, UserDTO user) {
|
|
@@ -891,6 +896,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
* @param storeCombination 砍价商品
|
|
* @param storeCombination 砍价商品
|
|
* @param combinationAttrValue 砍价商品规格属性
|
|
* @param combinationAttrValue 砍价商品规格属性
|
|
* @param productNum 购买数量
|
|
* @param productNum 购买数量
|
|
|
|
+ *
|
|
* @return MyRecord
|
|
* @return MyRecord
|
|
*/
|
|
*/
|
|
private MyRecord commonValidateCombination(StoreCombination storeCombination, ProductAttrValue combinationAttrValue, UserDTO user, Integer productNum) {
|
|
private MyRecord commonValidateCombination(StoreCombination storeCombination, ProductAttrValue combinationAttrValue, UserDTO user, Integer productNum) {
|
|
@@ -962,17 +968,17 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
if (CollUtil.isNotEmpty(storeOrderList)) {
|
|
if (CollUtil.isNotEmpty(storeOrderList)) {
|
|
// 判断是否有待支付订单
|
|
// 判断是否有待支付订单
|
|
-// List<StoreOrder> unPayOrders = userCombinationOrders.stream().filter(e -> e.getStatus().equals(PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey())).collect(Collectors.toList());
|
|
|
|
-// if (!unPayOrders.isEmpty()) {
|
|
|
|
-// throw new ServiceException("您有拼团待支付订单,请支付后再购买");
|
|
|
|
-// }
|
|
|
|
|
|
+ // List<StoreOrder> unPayOrders = userCombinationOrders.stream().filter(e -> e.getStatus().equals(PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey())).collect(Collectors.toList());
|
|
|
|
+ // if (!unPayOrders.isEmpty()) {
|
|
|
|
+ // throw new ServiceException("您有拼团待支付订单,请支付后再购买");
|
|
|
|
+ // }
|
|
int payNum = storeOrderList.stream().mapToInt(StoreOrder::getTotalNum).sum();
|
|
int payNum = storeOrderList.stream().mapToInt(StoreOrder::getTotalNum).sum();
|
|
if (configByLevel.getJoinedGroupsNo() < payNum) {
|
|
if (configByLevel.getJoinedGroupsNo() < payNum) {
|
|
throw new ServiceException(I18nUtil.get("you.have.reached.the.upper.limit.of.the.group.buying.activity.for.this.product"));
|
|
throw new ServiceException(I18nUtil.get("you.have.reached.the.upper.limit.of.the.group.buying.activity.for.this.product"));
|
|
}
|
|
}
|
|
-// if ((payNum + productNum) > storeCombination.getNum()) {
|
|
|
|
-// throw new ServiceException("超过该商品拼团活动您的购买上限");
|
|
|
|
-// }
|
|
|
|
|
|
+ // if ((payNum + productNum) > storeCombination.getNum()) {
|
|
|
|
+ // throw new ServiceException("超过该商品拼团活动您的购买上限");
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
|
|
|
|
MyRecord record = new MyRecord();
|
|
MyRecord record = new MyRecord();
|
|
@@ -1183,6 +1189,12 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
if (dto.getId() != null) {
|
|
if (dto.getId() != null) {
|
|
criteria.andEqualTo("id", dto.getId());
|
|
criteria.andEqualTo("id", dto.getId());
|
|
}
|
|
}
|
|
|
|
+ if (StrUtil.isNotBlank(dto.getDeliveryName())) {
|
|
|
|
+ criteria.andEqualTo("deliveryName", dto.getDeliveryName());
|
|
|
|
+ }
|
|
|
|
+ if (StrUtil.isNotBlank(dto.getRealName())) {
|
|
|
|
+ criteria.andEqualTo("realName", dto.getRealName());
|
|
|
|
+ }
|
|
if (dto.getOrderId() != null) {
|
|
if (dto.getOrderId() != null) {
|
|
criteria.andEqualTo("orderId", dto.getOrderId());
|
|
criteria.andEqualTo("orderId", dto.getOrderId());
|
|
}
|
|
}
|
|
@@ -1207,6 +1219,15 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
if (dto.getStartTime() != null && dto.getEndTime() != null) {
|
|
if (dto.getStartTime() != null && dto.getEndTime() != null) {
|
|
criteria.andBetween("createTime", dto.getStartTime(), dto.getEndTime());
|
|
criteria.andBetween("createTime", dto.getStartTime(), dto.getEndTime());
|
|
}
|
|
}
|
|
|
|
+ if (dto.getPayStartTime() != null && dto.getPayEndTime() != null) {
|
|
|
|
+ criteria.andBetween("payTime", dto.getPayStartTime(), dto.getPayEndTime());
|
|
|
|
+ }
|
|
|
|
+ if (dto.getDeliveryStartTime() != null && dto.getDeliveryEndTime() != null) {
|
|
|
|
+ criteria.andBetween("deliveryTime", dto.getDeliveryStartTime(), dto.getDeliveryEndTime());
|
|
|
|
+ }
|
|
|
|
+ if (dto.getFinishStartTime() != null && dto.getFinishEndTime() != null) {
|
|
|
|
+ criteria.andBetween("signingTime", dto.getFinishStartTime(), dto.getFinishEndTime());
|
|
|
|
+ }
|
|
PageHelper.startPage(dto.getPage(), dto.getSize());
|
|
PageHelper.startPage(dto.getPage(), dto.getSize());
|
|
List<StoreOrder> list = findByCondition(condition);
|
|
List<StoreOrder> list = findByCondition(condition);
|
|
PageInfo storeOrderPageInfo = new PageInfo<>(list);
|
|
PageInfo storeOrderPageInfo = new PageInfo<>(list);
|
|
@@ -1314,9 +1335,9 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
list = findByCondition(condition);
|
|
list = findByCondition(condition);
|
|
break;
|
|
break;
|
|
case 2:
|
|
case 2:
|
|
-// pinkCriteria.andEqualTo("status", 2);
|
|
|
|
|
|
+ // pinkCriteria.andEqualTo("status", 2);
|
|
pinkCriteria.andEqualTo("lId", 1);
|
|
pinkCriteria.andEqualTo("lId", 1);
|
|
-// pinkCriteria.andIn("orderStatus", Arrays.asList(3));
|
|
|
|
|
|
+ // pinkCriteria.andIn("orderStatus", Arrays.asList(3));
|
|
pinkList = storePinkService.findByCondition(pinkCondition);
|
|
pinkList = storePinkService.findByCondition(pinkCondition);
|
|
if (CollUtil.isNotEmpty(pinkList)) {
|
|
if (CollUtil.isNotEmpty(pinkList)) {
|
|
criteria.andIn("id", pinkList.stream().map(StorePink::getOrderIdKey).collect(Collectors.toList()));
|
|
criteria.andIn("id", pinkList.stream().map(StorePink::getOrderIdKey).collect(Collectors.toList()));
|
|
@@ -1471,8 +1492,10 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
preOrderResponse.setYuePayStatus(1);
|
|
preOrderResponse.setYuePayStatus(1);
|
|
return preOrderResponse;
|
|
return preOrderResponse;
|
|
}
|
|
}
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
private CreateSequenceService createSequenceService;
|
|
private CreateSequenceService createSequenceService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public MyRecord createOrder(CreateOrderRequest request) {
|
|
public MyRecord createOrder(CreateOrderRequest request) {
|
|
UserDTO user = userDubboServiceClient.getUser(request.getUserId());
|
|
UserDTO user = userDubboServiceClient.getUser(request.getUserId());
|
|
@@ -1530,7 +1553,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
Long id = createSequence.getId();
|
|
Long id = createSequence.getId();
|
|
String orderNo = "DD" + id;
|
|
String orderNo = "DD" + id;
|
|
// 生成订单号
|
|
// 生成订单号
|
|
- // String orderNo = OrderUtils.getOrderCode();
|
|
|
|
|
|
+ // String orderNo = OrderUtils.getOrderCode();
|
|
|
|
|
|
// 购买赠送的积分
|
|
// 购买赠送的积分
|
|
List<StoreOrderInfo> storeOrderInfos = new ArrayList<>();
|
|
List<StoreOrderInfo> storeOrderInfos = new ArrayList<>();
|
|
@@ -1662,14 +1685,14 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-// // 生成订单日志
|
|
|
|
|
|
+ // // 生成订单日志
|
|
storeOrderStatusService.createLog(storeOrder.getId(), Constants.ORDER_STATUS_CREATE_ORDER, "订单生成");
|
|
storeOrderStatusService.createLog(storeOrder.getId(), Constants.ORDER_STATUS_CREATE_ORDER, "订单生成");
|
|
-//
|
|
|
|
-// // 清除购物车数据
|
|
|
|
-// if (CollUtil.isNotEmpty(orderInfoVo.getCartIdList())) {
|
|
|
|
-// storeCartService.deleteCartByIds(orderInfoVo.getCartIdList());
|
|
|
|
-// }
|
|
|
|
-// return Boolean.TRUE;
|
|
|
|
|
|
+ //
|
|
|
|
+ // // 清除购物车数据
|
|
|
|
+ // if (CollUtil.isNotEmpty(orderInfoVo.getCartIdList())) {
|
|
|
|
+ // storeCartService.deleteCartByIds(orderInfoVo.getCartIdList());
|
|
|
|
+ // }
|
|
|
|
+ // return Boolean.TRUE;
|
|
|
|
|
|
|
|
|
|
// 删除缓存订单
|
|
// 删除缓存订单
|
|
@@ -1762,27 +1785,27 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
@Resource
|
|
@Resource
|
|
private NoticeService noticeService;
|
|
private NoticeService noticeService;
|
|
|
|
|
|
- //这是由pc端发起端针对个人的主动退款 不是定时任务扫描活动超时导致的退款,所以这个退款是不影响其他拼团成员的。拼团汇总表也不会上锁,拼团状态仍然是进行中
|
|
|
|
|
|
+ // 这是由pc端发起端针对个人的主动退款 不是定时任务扫描活动超时导致的退款,所以这个退款是不影响其他拼团成员的。拼团汇总表也不会上锁,拼团状态仍然是进行中
|
|
@Override
|
|
@Override
|
|
public void refund(Long id) {
|
|
public void refund(Long id) {
|
|
StoreOrder storeOrder = findById(id);
|
|
StoreOrder storeOrder = findById(id);
|
|
-//// if (storeOrder.getPaid().equals(Constants.ORDER_STATUS_H5_UNPAID)) {
|
|
|
|
-//// throw new ServiceException("当前状态不支持退款");
|
|
|
|
-//// }
|
|
|
|
-//
|
|
|
|
-// PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_APPLY_REFUND, null);
|
|
|
|
-//
|
|
|
|
-// if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
|
-// throw new ServiceException("当前状态不支持退款");
|
|
|
|
-// }
|
|
|
|
-// updateOrderStatus(storeOrder.getId(), PinkOrderStatusEnum.GROUP_ORDER_REFUND.getKey());
|
|
|
|
-//
|
|
|
|
-// // 归还用户余额
|
|
|
|
|
|
+ //// if (storeOrder.getPaid().equals(Constants.ORDER_STATUS_H5_UNPAID)) {
|
|
|
|
+ //// throw new ServiceException("当前状态不支持退款");
|
|
|
|
+ //// }
|
|
|
|
+ //
|
|
|
|
+ // PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_APPLY_REFUND, null);
|
|
|
|
+ //
|
|
|
|
+ // if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
|
+ // throw new ServiceException("当前状态不支持退款");
|
|
|
|
+ // }
|
|
|
|
+ // updateOrderStatus(storeOrder.getId(), PinkOrderStatusEnum.GROUP_ORDER_REFUND.getKey());
|
|
|
|
+ //
|
|
|
|
+ // // 归还用户余额
|
|
// accountDubboServiceClient.refund(id.toString(), storeOrder.getOrderId(), storeOrder.getPayPrice());
|
|
// accountDubboServiceClient.refund(id.toString(), storeOrder.getOrderId(), storeOrder.getPayPrice());
|
|
-// // 库存增加
|
|
|
|
-// storeCombinationService.operationStock(storeOrder.getCombinationId(), storeOrder.getTotalNum(), "add");
|
|
|
|
-//
|
|
|
|
-//
|
|
|
|
|
|
+ // // 库存增加
|
|
|
|
+ // storeCombinationService.operationStock(storeOrder.getCombinationId(), storeOrder.getTotalNum(), "add");
|
|
|
|
+ //
|
|
|
|
+ //
|
|
if (ObjectUtils.isEmpty(storeOrder)) {
|
|
if (ObjectUtils.isEmpty(storeOrder)) {
|
|
throw new ServiceException(I18nUtil.get("order.does.not.exist.when.initiating.active.refund.id") + id);
|
|
throw new ServiceException(I18nUtil.get("order.does.not.exist.when.initiating.active.refund.id") + id);
|
|
}
|
|
}
|
|
@@ -1794,7 +1817,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
Integer status = 0;
|
|
Integer status = 0;
|
|
- //团长在未成团时不能退款
|
|
|
|
|
|
+ // 团长在未成团时不能退款
|
|
if (storePink.getKId().equals(status) && storePink.getStatus().equals(StorePinkStatusEnum.NOT_DRAWN.getKey())) {
|
|
if (storePink.getKId().equals(status) && storePink.getStatus().equals(StorePinkStatusEnum.NOT_DRAWN.getKey())) {
|
|
throw new ServiceException(I18nUtil.get("current.member.is.the.group.leader.and.the.group.has.not.drawn.a.prize.refund.is.temporarily.not.supported") + id);
|
|
throw new ServiceException(I18nUtil.get("current.member.is.the.group.leader.and.the.group.has.not.drawn.a.prize.refund.is.temporarily.not.supported") + id);
|
|
}
|
|
}
|
|
@@ -1805,7 +1828,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
}
|
|
}
|
|
|
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
- //主动退款
|
|
|
|
|
|
+ // 主动退款
|
|
CancelParam param = new CancelParam();
|
|
CancelParam param = new CancelParam();
|
|
param.setBizNo(storeOrder.getOrderId());
|
|
param.setBizNo(storeOrder.getOrderId());
|
|
param.setBizId(storeOrder.getId().toString());
|
|
param.setBizId(storeOrder.getId().toString());
|
|
@@ -1819,17 +1842,17 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
throw new ServiceException(I18nUtil.get("refund.failed.please.initiate.again"));
|
|
throw new ServiceException(I18nUtil.get("refund.failed.please.initiate.again"));
|
|
}
|
|
}
|
|
updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
- //订单状态回退
|
|
|
|
- //拼团状态回退
|
|
|
|
|
|
+ // 订单状态回退
|
|
|
|
+ // 拼团状态回退
|
|
|
|
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
storePinkForUpdate.setId(storeOrder.getPinkId());
|
|
storePinkForUpdate.setId(storeOrder.getPinkId());
|
|
// storePinkForUpdate.setStatus(StorePinkStatusEnum.LOTTERY_FAILED.getKey()); //定时任务触发的拼团失败导致的订单退款需要设置这个状态为拼团失败状态
|
|
// storePinkForUpdate.setStatus(StorePinkStatusEnum.LOTTERY_FAILED.getKey()); //定时任务触发的拼团失败导致的订单退款需要设置这个状态为拼团失败状态
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
storePinkService.update(storePinkForUpdate);
|
|
storePinkService.update(storePinkForUpdate);
|
|
- //拼团汇总数量维护以及锁单标识维护
|
|
|
|
|
|
+ // 拼团汇总数量维护以及锁单标识维护
|
|
Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsId());
|
|
Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsId());
|
|
- //拼团商品数量以及m_store_combination
|
|
|
|
|
|
+ // 拼团商品数量以及m_store_combination
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
// 拼团商品规格扣库存
|
|
// 拼团商品规格扣库存
|
|
// productAttrValueService.operationStock(skuRecord.getInt("activityAttrValueId"), skuRecord.getInt("num"), "sub", Constants.PRODUCT_TYPE_PINGTUAN);
|
|
// productAttrValueService.operationStock(skuRecord.getInt("activityAttrValueId"), skuRecord.getInt("num"), "sub", Constants.PRODUCT_TYPE_PINGTUAN);
|
|
@@ -1847,9 +1870,9 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
|
|
|
|
// PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_FAIL, null);
|
|
// PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_FAIL, null);
|
|
-// if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
|
-// throw new ServiceException("当前状态不支持关闭");
|
|
|
|
-// }
|
|
|
|
|
|
+ // if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
|
+ // throw new ServiceException("当前状态不支持关闭");
|
|
|
|
+ // }
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
|
|
@@ -1859,17 +1882,17 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
}
|
|
}
|
|
|
|
|
|
if (PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey().equals(storeOrder.getStatus())) {
|
|
if (PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey().equals(storeOrder.getStatus())) {
|
|
- //如果是待支付状态 状态推到取消状态
|
|
|
|
|
|
+ // 如果是待支付状态 状态推到取消状态
|
|
// cancel(id);
|
|
// cancel(id);
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_CANCEL, null);
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_CANCEL, null);
|
|
|
|
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
throw new ServiceException(I18nUtil.get("current.status.does.not.support.cancellation"));
|
|
throw new ServiceException(I18nUtil.get("current.status.does.not.support.cancellation"));
|
|
}
|
|
}
|
|
- //订单状态回退
|
|
|
|
|
|
+ // 订单状态回退
|
|
updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
|
|
|
|
- //拼团状态回退
|
|
|
|
|
|
+ // 拼团状态回退
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
throw new ServiceException(I18nUtil.get("group.buying.information.does.not.exist.when.canceling.the.order.id") + storeOrder.getPinkId());
|
|
throw new ServiceException(I18nUtil.get("group.buying.information.does.not.exist.when.canceling.the.order.id") + storeOrder.getPinkId());
|
|
@@ -1879,9 +1902,9 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
storePinkForUpdate.setStatus(StorePinkStatusEnum.LOTTERY_FAILED.getKey());
|
|
storePinkForUpdate.setStatus(StorePinkStatusEnum.LOTTERY_FAILED.getKey());
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
storePinkService.update(storePinkForUpdate);
|
|
storePinkService.update(storePinkForUpdate);
|
|
- //拼团汇总数量维护以及锁单标识维护
|
|
|
|
|
|
+ // 拼团汇总数量维护以及锁单标识维护
|
|
Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsId());
|
|
Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsId());
|
|
- //拼团商品数量以及m_store_combination
|
|
|
|
|
|
+ // 拼团商品数量以及m_store_combination
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
// 拼团商品规格扣库存
|
|
// 拼团商品规格扣库存
|
|
// productAttrValueService.operationStock(skuRecord.getInt("activityAttrValueId"), skuRecord.getInt("num"), "sub", Constants.PRODUCT_TYPE_PINGTUAN);
|
|
// productAttrValueService.operationStock(skuRecord.getInt("activityAttrValueId"), skuRecord.getInt("num"), "sub", Constants.PRODUCT_TYPE_PINGTUAN);
|
|
@@ -1896,8 +1919,8 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
throw new ServiceException(I18nUtil.get("current.status.does.not.support.refund.cancellation"));
|
|
throw new ServiceException(I18nUtil.get("current.status.does.not.support.refund.cancellation"));
|
|
}
|
|
}
|
|
|
|
|
|
- //订单状态回退
|
|
|
|
- //拼团状态回退
|
|
|
|
|
|
+ // 订单状态回退
|
|
|
|
+ // 拼团状态回退
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
|
|
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
@@ -1905,7 +1928,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
}
|
|
}
|
|
|
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
- //主动退款
|
|
|
|
|
|
+ // 主动退款
|
|
CancelParam param = new CancelParam();
|
|
CancelParam param = new CancelParam();
|
|
param.setBizNo(storeOrder.getOrderId());
|
|
param.setBizNo(storeOrder.getOrderId());
|
|
param.setBizId(storeOrder.getId().toString());
|
|
param.setBizId(storeOrder.getId().toString());
|
|
@@ -1923,12 +1946,12 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
storePinkForUpdate.setId(storeOrder.getPinkId());
|
|
storePinkForUpdate.setId(storeOrder.getPinkId());
|
|
- storePinkForUpdate.setStatus(StorePinkStatusEnum.LOTTERY_FAILED.getKey()); //定时任务触发的拼团失败导致的订单退款需要设置这个状态为拼团失败状态
|
|
|
|
|
|
+ storePinkForUpdate.setStatus(StorePinkStatusEnum.LOTTERY_FAILED.getKey()); // 定时任务触发的拼团失败导致的订单退款需要设置这个状态为拼团失败状态
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
storePinkService.update(storePinkForUpdate);
|
|
storePinkService.update(storePinkForUpdate);
|
|
- //拼团汇总数量维护以及锁单标识维护
|
|
|
|
|
|
+ // 拼团汇总数量维护以及锁单标识维护
|
|
Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsId());
|
|
Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsId());
|
|
- //拼团商品数量以及m_store_combination
|
|
|
|
|
|
+ // 拼团商品数量以及m_store_combination
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
// 拼团商品规格扣库存
|
|
// 拼团商品规格扣库存
|
|
// productAttrValueService.operationStock(skuRecord.getInt("activityAttrValueId"), skuRecord.getInt("num"), "sub", Constants.PRODUCT_TYPE_PINGTUAN);
|
|
// productAttrValueService.operationStock(skuRecord.getInt("activityAttrValueId"), skuRecord.getInt("num"), "sub", Constants.PRODUCT_TYPE_PINGTUAN);
|
|
@@ -1943,14 +1966,14 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
log.error(I18nUtil.get("scheduled.task.failed.to.close.the.order.order.id") + id, e);
|
|
log.error(I18nUtil.get("scheduled.task.failed.to.close.the.order.order.id") + id, e);
|
|
}
|
|
}
|
|
|
|
|
|
- //如果是已支付状态状态推到拼团失败退款状态
|
|
|
|
|
|
+ // 如果是已支付状态状态推到拼团失败退款状态
|
|
|
|
|
|
|
|
|
|
-// if (storeOrder.getStatus().equals(Constants.ORDER_STATUS_H5_COMPLETE)) {
|
|
|
|
-// updateOrderStatus(storeOrder.getId(), PinkOrderStatusEnum.CLOSE.getKey());
|
|
|
|
-// } else {
|
|
|
|
-// throw new ServiceException("当前状态不支持关闭");
|
|
|
|
-// }
|
|
|
|
|
|
+ // if (storeOrder.getStatus().equals(Constants.ORDER_STATUS_H5_COMPLETE)) {
|
|
|
|
+ // updateOrderStatus(storeOrder.getId(), PinkOrderStatusEnum.CLOSE.getKey());
|
|
|
|
+ // } else {
|
|
|
|
+ // throw new ServiceException("当前状态不支持关闭");
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
@@ -1968,7 +1991,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
pinkSummaryCriteria.andLessThanOrEqualTo("stopTime", date);
|
|
pinkSummaryCriteria.andLessThanOrEqualTo("stopTime", date);
|
|
List<StorePinkSummary> byCondition = storePinkSummaryService.findByCondition(pinkSummaryCondition);
|
|
List<StorePinkSummary> byCondition = storePinkSummaryService.findByCondition(pinkSummaryCondition);
|
|
- //先锁定汇总表防止有新的成员加入进来,
|
|
|
|
|
|
+ // 先锁定汇总表防止有新的成员加入进来,
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(byCondition)) {
|
|
if (!CollectionUtils.isEmpty(byCondition)) {
|
|
@@ -1979,7 +2002,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
criteria.andIn("spsId", storePinkSummaryidList);
|
|
criteria.andIn("spsId", storePinkSummaryidList);
|
|
|
|
|
|
criteria.andEqualTo("isDelete", 0);
|
|
criteria.andEqualTo("isDelete", 0);
|
|
- //找出拼团待支付 和 拼团已支付的数据进行 关闭
|
|
|
|
|
|
+ // 找出拼团待支付 和 拼团已支付的数据进行 关闭
|
|
List<Integer> statusList = CollUtil.newArrayList(
|
|
List<Integer> statusList = CollUtil.newArrayList(
|
|
PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey()
|
|
PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey()
|
|
, PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey()
|
|
, PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey()
|
|
@@ -2009,11 +2032,11 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
throw new ServiceException(I18nUtil.get("current.status.does.not.support.cancellation"));
|
|
throw new ServiceException(I18nUtil.get("current.status.does.not.support.cancellation"));
|
|
}
|
|
}
|
|
|
|
|
|
- //订单状态回退
|
|
|
|
|
|
+ // 订单状态回退
|
|
updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
|
|
|
|
|
|
|
|
- //拼团状态回退
|
|
|
|
|
|
+ // 拼团状态回退
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
throw new ServiceException(I18nUtil.get("group.buying.information.does.not.exist.when.canceling.the.order.id") + storeOrder.getPinkId());
|
|
throw new ServiceException(I18nUtil.get("group.buying.information.does.not.exist.when.canceling.the.order.id") + storeOrder.getPinkId());
|
|
@@ -2023,11 +2046,11 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
storePinkService.update(storePinkForUpdate);
|
|
storePinkService.update(storePinkForUpdate);
|
|
|
|
|
|
- //拼团汇总数量维护以及锁单标识维护
|
|
|
|
|
|
+ // 拼团汇总数量维护以及锁单标识维护
|
|
|
|
|
|
Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsId());
|
|
Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsId());
|
|
|
|
|
|
- //拼团商品数量以及m_store_combination
|
|
|
|
|
|
+ // 拼团商品数量以及m_store_combination
|
|
|
|
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
// 拼团商品规格扣库存
|
|
// 拼团商品规格扣库存
|
|
@@ -2036,13 +2059,13 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
storeProductService.operationStock(storePink.getPid(), storePink.getTotalNum(), "add");
|
|
storeProductService.operationStock(storePink.getPid(), storePink.getTotalNum(), "add");
|
|
|
|
|
|
noticeService.addOrderNotice(NoticeEnum.ORDER_GROUP_BUY_FAIL, storeOrder.getOrderId(), storeOrder.getUid());
|
|
noticeService.addOrderNotice(NoticeEnum.ORDER_GROUP_BUY_FAIL, storeOrder.getOrderId(), storeOrder.getUid());
|
|
- //库存数量回退
|
|
|
|
|
|
+ // 库存数量回退
|
|
|
|
|
|
-// if (storeOrder.getPaid().equals(0)) {
|
|
|
|
-// updateOrderStatus(storeOrder.getId(), PinkOrderStatusEnum.CANCEL.getKey());
|
|
|
|
-// } else {
|
|
|
|
-// throw new ServiceException("当前状态不支持取消");
|
|
|
|
-// }
|
|
|
|
|
|
+ // if (storeOrder.getPaid().equals(0)) {
|
|
|
|
+ // updateOrderStatus(storeOrder.getId(), PinkOrderStatusEnum.CANCEL.getKey());
|
|
|
|
+ // } else {
|
|
|
|
+ // throw new ServiceException("当前状态不支持取消");
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
|
|
|
|
// @Override
|
|
// @Override
|
|
@@ -2116,10 +2139,17 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (StrUtil.isBlank(po.getUserAddress()) || StrUtil.isBlank(po.getPhone()) || StrUtil.isBlank(po.getRealName())) {
|
|
|
|
+ po.setErrorMsg("地址未填写");
|
|
|
|
+ errors.add(po);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
storeOrder.setId(po.getId());
|
|
storeOrder.setId(po.getId());
|
|
storeOrder.setDeliveryId(po.getDeliveryId());
|
|
storeOrder.setDeliveryId(po.getDeliveryId());
|
|
storeOrder.setDeliveryName(po.getDeliveryName());
|
|
storeOrder.setDeliveryName(po.getDeliveryName());
|
|
storeOrder.setStatus(pinkOrderStatusEnum.getKey());
|
|
storeOrder.setStatus(pinkOrderStatusEnum.getKey());
|
|
|
|
+ storeOrder.setDeliveryTime(new Date());
|
|
|
|
|
|
update(storeOrder);
|
|
update(storeOrder);
|
|
|
|
|
|
@@ -2202,11 +2232,11 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
}
|
|
}
|
|
update(storeOrder);
|
|
update(storeOrder);
|
|
|
|
|
|
-// StorePink storePink = new StorePink();
|
|
|
|
-// Example example = new Example(StorePink.class);
|
|
|
|
-// example.createCriteria().andEqualTo("orderIdKey",id);
|
|
|
|
-// storePink.setOrderStatus(status);
|
|
|
|
-// int i = storePinkMapper.updateByConditionSelective(storePink, example);
|
|
|
|
|
|
+ // StorePink storePink = new StorePink();
|
|
|
|
+ // Example example = new Example(StorePink.class);
|
|
|
|
+ // example.createCriteria().andEqualTo("orderIdKey",id);
|
|
|
|
+ // storePink.setOrderStatus(status);
|
|
|
|
+ // int i = storePinkMapper.updateByConditionSelective(storePink, example);
|
|
|
|
|
|
// storeOrderStatusService.createLog(id, "", PinkOrderStatusEnum.getEnum(status).getValue());
|
|
// storeOrderStatusService.createLog(id, "", PinkOrderStatusEnum.getEnum(status).getValue());
|
|
|
|
|
|
@@ -2217,6 +2247,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
* 校验商品库存(生成订单)
|
|
* 校验商品库存(生成订单)
|
|
*
|
|
*
|
|
* @param orderInfoVo 订单详情Vo
|
|
* @param orderInfoVo 订单详情Vo
|
|
|
|
+ *
|
|
* @return List<MyRecord>
|
|
* @return List<MyRecord>
|
|
* skuRecord 扣减库存对象
|
|
* skuRecord 扣减库存对象
|
|
* ——activityId 活动商品id
|
|
* ——activityId 活动商品id
|
|
@@ -2389,36 +2420,38 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
* -拼团成功:拼团成功&中奖订单,Paid状态订单;中奖状态:中奖;
|
|
* -拼团成功:拼团成功&中奖订单,Paid状态订单;中奖状态:中奖;
|
|
* -拼团失败:拼团成功&未中奖订单,Paid状态订单;
|
|
* -拼团失败:拼团成功&未中奖订单,Paid状态订单;
|
|
* -拼团奖励:拼团成功&中奖订单&选择收货订单,包含To Ship、To Recevie2个订单状态;
|
|
* -拼团奖励:拼团成功&中奖订单&选择收货订单,包含To Ship、To Recevie2个订单状态;
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* 只给1、2、4项订单状态进行中订单数量红点
|
|
* 只给1、2、4项订单状态进行中订单数量红点
|
|
|
|
+ *
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public Map<Integer, Integer> pendingRedDots() {
|
|
|
|
- Map<Integer,Integer> resultMap = new HashMap<>();
|
|
|
|
|
|
+ public PendingRedDotsVO pendingRedDots() {
|
|
|
|
+ // Map<Integer, Integer> resultMap = new HashMap<>();
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
|
+
|
|
if(ObjectUtils.isEmpty(tokenUserId)){
|
|
if(ObjectUtils.isEmpty(tokenUserId)){
|
|
throw new ServiceException("user not exist tokenUserId:"+tokenUserId);
|
|
throw new ServiceException("user not exist tokenUserId:"+tokenUserId);
|
|
}
|
|
}
|
|
- //待支付数量
|
|
|
|
|
|
+ // 待支付数量
|
|
Condition conditionStoreStorePinkToPay = new Condition(StorePink.class);
|
|
Condition conditionStoreStorePinkToPay = new Condition(StorePink.class);
|
|
Example.Criteria criteriaStorePinkToPay = conditionStoreStorePinkToPay.createCriteria();
|
|
Example.Criteria criteriaStorePinkToPay = conditionStoreStorePinkToPay.createCriteria();
|
|
criteriaStorePinkToPay.andEqualTo("orderStatus", PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey());
|
|
criteriaStorePinkToPay.andEqualTo("orderStatus", PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey());
|
|
criteriaStorePinkToPay.andEqualTo("isDelete", 0);
|
|
criteriaStorePinkToPay.andEqualTo("isDelete", 0);
|
|
criteriaStorePinkToPay.andEqualTo("uid", tokenUserId);
|
|
criteriaStorePinkToPay.andEqualTo("uid", tokenUserId);
|
|
- int i = storePinkMapper.selectCountByCondition(conditionStoreStorePinkToPay);
|
|
|
|
- resultMap.put(1,i);
|
|
|
|
|
|
+ int toPayNum = storePinkMapper.selectCountByCondition(conditionStoreStorePinkToPay);
|
|
|
|
+ // resultMap.put(1, i);
|
|
|
|
|
|
- //中奖未填写收获地址数量
|
|
|
|
|
|
+ // 中奖未填写收获地址数量
|
|
Condition conditionStoreStorePinkPaid = new Condition(StorePink.class);
|
|
Condition conditionStoreStorePinkPaid = new Condition(StorePink.class);
|
|
Example.Criteria criteriaStorePinkPaid = conditionStoreStorePinkPaid.createCriteria();
|
|
Example.Criteria criteriaStorePinkPaid = conditionStoreStorePinkPaid.createCriteria();
|
|
criteriaStorePinkPaid.andEqualTo("orderStatus", PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey());
|
|
criteriaStorePinkPaid.andEqualTo("orderStatus", PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey());
|
|
criteriaStorePinkPaid.andEqualTo("isDelete", 0);
|
|
criteriaStorePinkPaid.andEqualTo("isDelete", 0);
|
|
criteriaStorePinkPaid.andEqualTo("uid", tokenUserId);
|
|
criteriaStorePinkPaid.andEqualTo("uid", tokenUserId);
|
|
- int ii = storePinkMapper.selectCountByCondition(conditionStoreStorePinkPaid);
|
|
|
|
- resultMap.put(2,ii);
|
|
|
|
|
|
+ int successNum = storePinkMapper.selectCountByCondition(conditionStoreStorePinkPaid);
|
|
|
|
+ // resultMap.put(2, ii);
|
|
|
|
|
|
- //中奖未填写收获地址数量
|
|
|
|
|
|
+ // 中奖未填写收获地址数量
|
|
Condition conditionStoreStorePinkToShip = new Condition(StorePink.class);
|
|
Condition conditionStoreStorePinkToShip = new Condition(StorePink.class);
|
|
Example.Criteria criteriaStorePinkToShip = conditionStoreStorePinkToShip.createCriteria();
|
|
Example.Criteria criteriaStorePinkToShip = conditionStoreStorePinkToShip.createCriteria();
|
|
|
|
|
|
@@ -2426,13 +2459,15 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
criteriaStorePinkToShip.andIn("orderStatus", integers);
|
|
criteriaStorePinkToShip.andIn("orderStatus", integers);
|
|
criteriaStorePinkToShip.andEqualTo("isDelete", 0);
|
|
criteriaStorePinkToShip.andEqualTo("isDelete", 0);
|
|
criteriaStorePinkToShip.andEqualTo("uid", tokenUserId);
|
|
criteriaStorePinkToShip.andEqualTo("uid", tokenUserId);
|
|
- int iii = storePinkMapper.selectCountByCondition(conditionStoreStorePinkToShip);
|
|
|
|
- resultMap.put(4,iii);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ int rewardNum = storePinkMapper.selectCountByCondition(conditionStoreStorePinkToShip);
|
|
|
|
+ // resultMap.put(4, iii);
|
|
|
|
|
|
|
|
|
|
- return resultMap;
|
|
|
|
|
|
+ return PendingRedDotsVO.builder()
|
|
|
|
+ .toPayNum(toPayNum)
|
|
|
|
+ .successNum(successNum)
|
|
|
|
+ .rewardNum(rewardNum)
|
|
|
|
+ .build();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|