|
@@ -3,6 +3,7 @@ package com.txz.mall.service.impl;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
+import cn.hutool.core.lang.Snowflake;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -65,6 +66,7 @@ import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import static com.txz.mall.util.OrderUtils.getDateTime;
|
|
import static com.txz.mall.util.OrderUtils.getDateTime;
|
|
|
|
|
+import static org.springframework.data.jpa.domain.AbstractPersistable_.id;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -179,6 +181,9 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
// storeOrder.setPinkId(storePink.getId());
|
|
// storeOrder.setPinkId(storePink.getId());
|
|
|
// update(storeOrder);
|
|
// update(storeOrder);
|
|
|
// }
|
|
// }
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private DailySalesSummaryOfProductsService dailySalesSummaryOfProductsService;
|
|
|
@Override
|
|
@Override
|
|
|
public void goOpen(String orderId) {
|
|
public void goOpen(String orderId) {
|
|
|
StoreOrder storeOrder = findBy("orderId", orderId);
|
|
StoreOrder storeOrder = findBy("orderId", orderId);
|
|
@@ -188,6 +193,8 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
}
|
|
}
|
|
|
UserDTO user = userDubboServiceClient.getUser(storeOrder.getUid());
|
|
UserDTO user = userDubboServiceClient.getUser(storeOrder.getUid());
|
|
|
StorePink storePink = new StorePink();
|
|
StorePink storePink = new StorePink();
|
|
|
|
|
+ long storePinkId = IdUtil.getSnowflake(1, 3).nextId();
|
|
|
|
|
+ storePink.setId(storePinkId);
|
|
|
if (!ObjectUtils.isEmpty(user)) {
|
|
if (!ObjectUtils.isEmpty(user)) {
|
|
|
storePink.setAvatar(user.getHeadPic());
|
|
storePink.setAvatar(user.getHeadPic());
|
|
|
storePink.setNickname(user.getName());
|
|
storePink.setNickname(user.getName());
|
|
@@ -203,11 +210,12 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
storePink.setPid(storeCombination.getProductId());
|
|
storePink.setPid(storeCombination.getProductId());
|
|
|
storePink.setPeople(storeCombination.getPeople());
|
|
storePink.setPeople(storeCombination.getPeople());
|
|
|
storePink.setPrice(storeCombination.getPrice());
|
|
storePink.setPrice(storeCombination.getPrice());
|
|
|
- Date date = new Date();
|
|
|
|
|
|
|
+ Date date = storeOrder.getCreateTime();
|
|
|
Integer effectiveTime = storeCombination.getEffectiveTime();
|
|
Integer effectiveTime = storeCombination.getEffectiveTime();
|
|
|
storePink.setAddTime(date);
|
|
storePink.setAddTime(date);
|
|
|
storePink.setStopTime(DateUtils.addMinutes(date, effectiveTime));
|
|
storePink.setStopTime(DateUtils.addMinutes(date, effectiveTime));
|
|
|
storePink.setKId(0);
|
|
storePink.setKId(0);
|
|
|
|
|
+ storePink.setLId(0);
|
|
|
storePink.setUid(storeOrder.getUid());
|
|
storePink.setUid(storeOrder.getUid());
|
|
|
storePink.setIsRefund(0);
|
|
storePink.setIsRefund(0);
|
|
|
storePink.setStatus(1);
|
|
storePink.setStatus(1);
|
|
@@ -215,7 +223,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
|
|
// 插入拼团汇总表
|
|
// 插入拼团汇总表
|
|
|
StorePinkSummary storePinkSummary = new StorePinkSummary();
|
|
StorePinkSummary storePinkSummary = new StorePinkSummary();
|
|
|
- long storePinkSummaryId = IdUtil.getSnowflake(1, 1).nextId();
|
|
|
|
|
|
|
+ long storePinkSummaryId = IdUtil.getSnowflake(1, 2).nextId();
|
|
|
storePinkSummary.setId(storePinkSummaryId);
|
|
storePinkSummary.setId(storePinkSummaryId);
|
|
|
storePinkSummary.setTotalPrice(storeOrder.getTotalPrice());
|
|
storePinkSummary.setTotalPrice(storeOrder.getTotalPrice());
|
|
|
storePinkSummary.setCid(storeCombination.getId());
|
|
storePinkSummary.setCid(storeCombination.getId());
|
|
@@ -245,12 +253,15 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
// 插入拼团详情表
|
|
// 插入拼团详情表
|
|
|
storePink.setSpsId(storePinkSummary.getId());
|
|
storePink.setSpsId(storePinkSummary.getId());
|
|
|
storePink.setSpsCode(storePinkSummary.getCode());
|
|
storePink.setSpsCode(storePinkSummary.getCode());
|
|
|
|
|
+ EasyToUseUtil.appCreateAssignment(date, storePink);
|
|
|
storePinkService.save(storePink);
|
|
storePinkService.save(storePink);
|
|
|
|
|
|
|
|
|
|
+ //插入每日统计表
|
|
|
|
|
+ dailySalesSummaryOfProductsService.saveDailySalesSummaryOfProducts(storePink);
|
|
|
|
|
+
|
|
|
// 如果是开团,需要更新订单数据
|
|
// 如果是开团,需要更新订单数据
|
|
|
storeOrder.setPinkId(storePink.getId());
|
|
storeOrder.setPinkId(storePink.getId());
|
|
|
|
|
|
|
|
-
|
|
|
|
|
Example exampleStoreOrder = new Example(StoreOrder.class);
|
|
Example exampleStoreOrder = new Example(StoreOrder.class);
|
|
|
exampleStoreOrder.createCriteria().andEqualTo("orderId", orderId);
|
|
exampleStoreOrder.createCriteria().andEqualTo("orderId", orderId);
|
|
|
storeOrder.setOrderId(null);
|
|
storeOrder.setOrderId(null);
|
|
@@ -370,6 +381,8 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
StorePink storePink = new StorePink();
|
|
StorePink storePink = new StorePink();
|
|
|
BeanUtils.copyProperties(teamPink, storePink);
|
|
BeanUtils.copyProperties(teamPink, storePink);
|
|
|
storePink.setId(null);
|
|
storePink.setId(null);
|
|
|
|
|
+ long l = IdUtil.getSnowflake(1, 3).nextId();
|
|
|
|
|
+ storePink.setId(l);
|
|
|
storePink.setSpsId(dto.getSpsId());
|
|
storePink.setSpsId(dto.getSpsId());
|
|
|
storePink.setOrderId(dto.getOrderId());
|
|
storePink.setOrderId(dto.getOrderId());
|
|
|
storePink.setOrderIdKey(dto.getOrderIdKey());
|
|
storePink.setOrderIdKey(dto.getOrderIdKey());
|
|
@@ -388,15 +401,21 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
|
|
storePink.setCreateTime(date);
|
|
storePink.setCreateTime(date);
|
|
|
storePinkService.save(storePink);
|
|
storePinkService.save(storePink);
|
|
|
-
|
|
|
|
|
- Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(teamPink.getSpsId());
|
|
|
|
|
|
|
+ //插入每日统计表s
|
|
|
|
|
+ dailySalesSummaryOfProductsService.saveDailySalesSummaryOfProducts(storePink);
|
|
|
|
|
+ //**分库整改
|
|
|
|
|
+ Boolean b1 = storePinkSummaryService.maintainOrderNoSetOfTheStorePinkSummary(teamPink.getSpsCode(), dto.getOrderId());
|
|
|
|
|
+ Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(teamPink.getSpsCode());
|
|
|
|
|
|
|
|
StoreOrder storeOrder = new StoreOrder();
|
|
StoreOrder storeOrder = new StoreOrder();
|
|
|
- storeOrder.setId(dto.getOrderIdKey());
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // storeOrder.setId(dto.getOrderIdKey());
|
|
|
// 需要更新订单数据
|
|
// 需要更新订单数据
|
|
|
storeOrder.setPinkId(storePink.getId());
|
|
storeOrder.setPinkId(storePink.getId());
|
|
|
- update(storeOrder);
|
|
|
|
|
|
|
+ Condition storeOrderCondition = new Condition(StoreOrder.class);
|
|
|
|
|
+ storeOrderCondition.createCriteria().andEqualTo("orderId",dto.getOrderId());
|
|
|
|
|
+ storeOrderMapper.updateByConditionSelective(storeOrder,storeOrderCondition);
|
|
|
|
|
+ //**分库整改
|
|
|
|
|
+ // update(storeOrder);
|
|
|
// if(!b){
|
|
// if(!b){
|
|
|
// throw new ServiceException("拼团超员请选择新的拼团");
|
|
// throw new ServiceException("拼团超员请选择新的拼团");
|
|
|
// }
|
|
// }
|
|
@@ -436,15 +455,32 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
throw new ServiceException(I18nUtil.get("there.is.no.group.to.join.temporarily"));
|
|
throw new ServiceException(I18nUtil.get("there.is.no.group.to.join.temporarily"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ List<String> orderNoSetListStr = pinkSummaryList.stream().map(StorePinkSummary::getOrderNoSet).filter(orderNoSet ->!ObjectUtils.isEmpty(orderNoSet)).collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ List<String> allOrderNo = new ArrayList<>();
|
|
|
|
|
+ if(!ObjectUtils.isEmpty(orderNoSetListStr)){
|
|
|
|
|
+ for (String s : orderNoSetListStr) {
|
|
|
|
|
+ List<String> orderNoSet = JSONObject.parseArray(s, String.class);
|
|
|
|
|
+ allOrderNo.addAll(orderNoSet);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("allOrderNo:" + JSONObject.toJSONString(allOrderNo));
|
|
|
|
|
+ if(ObjectUtils.isEmpty(allOrderNo)){
|
|
|
|
|
+ throw new ServiceException(I18nUtil.get("cid.store.pink.summary.order.no.set.not.exist")+dto.getCid());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
List<Long> storePinkSummaryId = pinkSummaryList.stream().map(StorePinkSummary::getId).collect(Collectors.toList());
|
|
List<Long> storePinkSummaryId = pinkSummaryList.stream().map(StorePinkSummary::getId).collect(Collectors.toList());
|
|
|
log.info("storePinkSummaryId:" + storePinkSummaryId.toString());
|
|
log.info("storePinkSummaryId:" + storePinkSummaryId.toString());
|
|
|
Condition pinkCondition = new Condition(StorePink.class);
|
|
Condition pinkCondition = new Condition(StorePink.class);
|
|
|
Example.Criteria pinkCriteria = pinkCondition.createCriteria();
|
|
Example.Criteria pinkCriteria = pinkCondition.createCriteria();
|
|
|
pinkCriteria.andEqualTo("isDelete", 0);
|
|
pinkCriteria.andEqualTo("isDelete", 0);
|
|
|
- pinkCriteria.andEqualTo("cid", dto.getCid());
|
|
|
|
|
|
|
+ //这个条件应该是没啥用的,因为下面已经有spsId了
|
|
|
|
|
+ // pinkCriteria.andEqualTo("cid", dto.getCid());
|
|
|
List<Integer> orderStatusList = CollUtil.newArrayList(PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey(), PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey());
|
|
List<Integer> orderStatusList = CollUtil.newArrayList(PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey(), PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey());
|
|
|
|
|
+ pinkCriteria.andIn("orderId", allOrderNo);
|
|
|
pinkCriteria.andIn("orderStatus", orderStatusList);
|
|
pinkCriteria.andIn("orderStatus", orderStatusList);
|
|
|
- pinkCriteria.andIn("spsId", storePinkSummaryId);
|
|
|
|
|
|
|
+ //**分库整改
|
|
|
|
|
+ // pinkCriteria.andIn("spsId", storePinkSummaryId);
|
|
|
List<StorePink> pinkList = storePinkService.findByCondition(pinkCondition);
|
|
List<StorePink> pinkList = storePinkService.findByCondition(pinkCondition);
|
|
|
log.info("pinkList:" + pinkList.toString());
|
|
log.info("pinkList:" + pinkList.toString());
|
|
|
|
|
|
|
@@ -610,7 +646,8 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
Example exampleStorePink = new Example(StorePink.class);
|
|
Example exampleStorePink = new Example(StorePink.class);
|
|
|
exampleStorePink.createCriteria().andEqualTo("orderId", storeOrder.getOrderId());
|
|
exampleStorePink.createCriteria().andEqualTo("orderId", storeOrder.getOrderId());
|
|
|
storePinkMapper.updateByConditionSelective(storePinkForUpdate, exampleStorePink);
|
|
storePinkMapper.updateByConditionSelective(storePinkForUpdate, exampleStorePink);
|
|
|
-
|
|
|
|
|
|
|
+ //维护每日统计表
|
|
|
|
|
+ dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(storeOrder.getOrderId(),storePinkForUpdate);
|
|
|
noticeService.addOrderNotice(NoticeEnum.ORDER_SHIPPED_SUCCESS, storeOrder.getOrderId(), storeOrder.getUid());
|
|
noticeService.addOrderNotice(NoticeEnum.ORDER_SHIPPED_SUCCESS, storeOrder.getOrderId(), storeOrder.getUid());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1342,13 +1379,19 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
Condition condition = new Condition(StoreOrder.class);
|
|
Condition condition = new Condition(StoreOrder.class);
|
|
|
Example.Criteria criteria = condition.createCriteria();
|
|
Example.Criteria criteria = condition.createCriteria();
|
|
|
criteria.andEqualTo("isDelete", 0);
|
|
criteria.andEqualTo("isDelete", 0);
|
|
|
- condition.setOrderByClause("create_time DESC");
|
|
|
|
|
criteria.andEqualTo("uid", dto.getUserId());
|
|
criteria.andEqualTo("uid", dto.getUserId());
|
|
|
|
|
+ // criteria.andBetween("createTime",)
|
|
|
|
|
+ criteria.andGreaterThanOrEqualTo("createTime",dto.getStartDate());
|
|
|
|
|
+ criteria.andLessThanOrEqualTo("createTime",dto.getEndDate());
|
|
|
|
|
+
|
|
|
|
|
+ condition.setOrderByClause("create_time DESC");
|
|
|
|
|
|
|
|
Condition pinkCondition = new Condition(StorePink.class);
|
|
Condition pinkCondition = new Condition(StorePink.class);
|
|
|
Example.Criteria pinkCriteria = pinkCondition.createCriteria();
|
|
Example.Criteria pinkCriteria = pinkCondition.createCriteria();
|
|
|
pinkCriteria.andEqualTo("isDelete", 0);
|
|
pinkCriteria.andEqualTo("isDelete", 0);
|
|
|
pinkCriteria.andEqualTo("uid", dto.getUserId());
|
|
pinkCriteria.andEqualTo("uid", dto.getUserId());
|
|
|
|
|
+ pinkCriteria.andGreaterThanOrEqualTo("createTime",dto.getStartDate());
|
|
|
|
|
+ pinkCriteria.andLessThanOrEqualTo("createTime",dto.getEndDate());
|
|
|
|
|
|
|
|
List<StorePink> pinkList = new ArrayList<>();
|
|
List<StorePink> pinkList = new ArrayList<>();
|
|
|
|
|
|
|
@@ -1371,7 +1414,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
pinkCriteria.andIn("orderStatus", Arrays.asList(PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey()));
|
|
pinkCriteria.andIn("orderStatus", Arrays.asList(PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey()));
|
|
|
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("orderId", pinkList.stream().map(StorePink::getOrderId).collect(Collectors.toList()));
|
|
|
list = findByCondition(condition);
|
|
list = findByCondition(condition);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
@@ -1381,7 +1424,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
// 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("orderId", pinkList.stream().map(StorePink::getOrderId).collect(Collectors.toList()));
|
|
|
list = findByCondition(condition);
|
|
list = findByCondition(condition);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
@@ -1390,7 +1433,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
pinkCriteria.andIn("orderStatus", Arrays.asList(PinkOrderStatusEnum.GROUP_ORDER_TO_SHIP.getKey(), PinkOrderStatusEnum.GROUP_ORDER_TO_RECEIVE.getKey(), PinkOrderStatusEnum.GROUP_ORDER_COMPLETED.getKey()));
|
|
pinkCriteria.andIn("orderStatus", Arrays.asList(PinkOrderStatusEnum.GROUP_ORDER_TO_SHIP.getKey(), PinkOrderStatusEnum.GROUP_ORDER_TO_RECEIVE.getKey(), PinkOrderStatusEnum.GROUP_ORDER_COMPLETED.getKey()));
|
|
|
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("orderId", pinkList.stream().map(StorePink::getOrderId).collect(Collectors.toList()));
|
|
|
list = findByCondition(condition);
|
|
list = findByCondition(condition);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
@@ -1406,12 +1449,12 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
Condition infoCondition = new Condition(StoreOrderInfo.class);
|
|
Condition infoCondition = new Condition(StoreOrderInfo.class);
|
|
|
Example.Criteria infoCriteria = infoCondition.createCriteria();
|
|
Example.Criteria infoCriteria = infoCondition.createCriteria();
|
|
|
infoCriteria.andEqualTo("isDelete", 0);
|
|
infoCriteria.andEqualTo("isDelete", 0);
|
|
|
- infoCriteria.andIn("orderId", list.stream().map(StoreOrder::getId).collect(Collectors.toList()));
|
|
|
|
|
|
|
+ infoCriteria.andIn("orderNo", list.stream().map(StoreOrder::getOrderId).collect(Collectors.toList()));
|
|
|
infoArrayList = storeOrderInfoService.findByCondition(infoCondition);
|
|
infoArrayList = storeOrderInfoService.findByCondition(infoCondition);
|
|
|
|
|
|
|
|
Condition statusCondition = new Condition(StoreOrderStatus.class);
|
|
Condition statusCondition = new Condition(StoreOrderStatus.class);
|
|
|
Example.Criteria statusCriteria = statusCondition.createCriteria();
|
|
Example.Criteria statusCriteria = statusCondition.createCriteria();
|
|
|
- statusCriteria.andIn("oid", list.stream().map(StoreOrder::getId).collect(Collectors.toList()));
|
|
|
|
|
|
|
+ statusCriteria.andIn("orderId", list.stream().map(StoreOrder::getOrderId).collect(Collectors.toList()));
|
|
|
statusList = storeOrderStatusService.findByCondition(statusCondition);
|
|
statusList = storeOrderStatusService.findByCondition(statusCondition);
|
|
|
|
|
|
|
|
Condition addressCondition = new Condition(UserAddress.class);
|
|
Condition addressCondition = new Condition(UserAddress.class);
|
|
@@ -1817,9 +1860,9 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
if (!result1.getCode().equals("200")) {
|
|
if (!result1.getCode().equals("200")) {
|
|
|
throw new ServiceException(I18nUtil.get("payment.failed") + result1.getMessage());
|
|
throw new ServiceException(I18nUtil.get("payment.failed") + result1.getMessage());
|
|
|
}
|
|
}
|
|
|
- updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
|
|
|
|
|
+ updateOrderStatus(storeOrder.getOrderId(), pinkOrderStatusEnum.getKey());
|
|
|
log.info("pinkSuccess storeOrder1" + storeOrder);
|
|
log.info("pinkSuccess storeOrder1" + storeOrder);
|
|
|
- storePinkService.pinkSuccess(storeOrder.getPinkId(), storeOrder);
|
|
|
|
|
|
|
+ storePinkService.pinkSuccess(storeOrder.getOrderId(), storeOrder);
|
|
|
log.info("pinkSuccess storeOrder2" + storeOrder);
|
|
log.info("pinkSuccess storeOrder2" + storeOrder);
|
|
|
// goOpen(dto.getOrderId());
|
|
// goOpen(dto.getOrderId());
|
|
|
}
|
|
}
|
|
@@ -1837,9 +1880,9 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
if (!result1.getCode().equals("200")) {
|
|
if (!result1.getCode().equals("200")) {
|
|
|
throw new ServiceException(I18nUtil.get("payment.failed") + result1.getMessage());
|
|
throw new ServiceException(I18nUtil.get("payment.failed") + result1.getMessage());
|
|
|
}
|
|
}
|
|
|
- updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
|
|
|
|
|
+ updateOrderStatus(storeOrder.getOrderId(), pinkOrderStatusEnum.getKey());
|
|
|
log.info("storePinkService.pinkSuccess1 :" + storeOrder);
|
|
log.info("storePinkService.pinkSuccess1 :" + storeOrder);
|
|
|
- storePinkService.pinkSuccess(storeOrder.getPinkId(), storeOrder);
|
|
|
|
|
|
|
+ storePinkService.pinkSuccess(storeOrder.getOrderId(), storeOrder);
|
|
|
log.info("storePinkService.pinkSuccess2 :" + storeOrder);
|
|
log.info("storePinkService.pinkSuccess2 :" + storeOrder);
|
|
|
// goPink(dto);
|
|
// goPink(dto);
|
|
|
}
|
|
}
|
|
@@ -1905,7 +1948,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
if (!equals) {
|
|
if (!equals) {
|
|
|
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.getOrderId(), pinkOrderStatusEnum.getKey());
|
|
|
// 订单状态回退
|
|
// 订单状态回退
|
|
|
// 拼团状态回退
|
|
// 拼团状态回退
|
|
|
|
|
|
|
@@ -1915,7 +1958,7 @@ 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.getSpsCode());
|
|
|
// 拼团商品数量以及m_store_combination
|
|
// 拼团商品数量以及m_store_combination
|
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
|
// 拼团商品规格扣库存
|
|
// 拼团商品规格扣库存
|
|
@@ -1930,7 +1973,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
|
|
// 关闭指系统层面的自动结束 如活动时间超时或者拼团超时由定时任务触发 不暴露给客户端
|
|
// 关闭指系统层面的自动结束 如活动时间超时或者拼团超时由定时任务触发 不暴露给客户端
|
|
|
@Override
|
|
@Override
|
|
|
- public void close(Long id) {
|
|
|
|
|
|
|
+ public void close(String orderNo) {
|
|
|
|
|
|
|
|
|
|
|
|
|
// PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_FAIL, null);
|
|
// PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_FAIL, null);
|
|
@@ -1940,9 +1983,9 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
- StoreOrder storeOrder = findById(id);
|
|
|
|
|
|
|
+ StoreOrder storeOrder = findBy("orderId",orderNo);
|
|
|
if (ObjectUtils.isEmpty(storeOrder)) {
|
|
if (ObjectUtils.isEmpty(storeOrder)) {
|
|
|
- throw new ServiceException("订单不存在id:" + id);
|
|
|
|
|
|
|
+ throw new ServiceException(I18nUtil.get("order.is.empty.orderid") + orderNo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey().equals(storeOrder.getStatus())) {
|
|
if (PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey().equals(storeOrder.getStatus())) {
|
|
@@ -1954,20 +1997,26 @@ 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.getOrderId(), pinkOrderStatusEnum.getKey());
|
|
|
|
|
|
|
|
// 拼团状态回退
|
|
// 拼团状态回退
|
|
|
- StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
|
|
|
|
|
+ StorePink storePink = storePinkService.findBy("orderId",orderNo);
|
|
|
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") + orderNo);
|
|
|
}
|
|
}
|
|
|
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);
|
|
|
|
|
|
|
+ Condition condition = new Condition(StorePink.class);
|
|
|
|
|
+ condition.createCriteria().andEqualTo("orderId",orderNo);
|
|
|
|
|
+ storePinkMapper.updateByConditionSelective(storePinkForUpdate,condition);
|
|
|
|
|
+ //维护每日统计表
|
|
|
|
|
+ dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(orderNo,storePinkForUpdate);
|
|
|
|
|
+ //**分库整改
|
|
|
|
|
+ //storePinkService.update(storePinkForUpdate);
|
|
|
// 拼团汇总数量维护以及锁单标识维护
|
|
// 拼团汇总数量维护以及锁单标识维护
|
|
|
- Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsId());
|
|
|
|
|
|
|
+ Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsCode());
|
|
|
// 拼团商品数量以及m_store_combination
|
|
// 拼团商品数量以及m_store_combination
|
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
|
// 拼团商品规格扣库存
|
|
// 拼团商品规格扣库存
|
|
@@ -1985,10 +2034,10 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
|
|
// 订单状态回退
|
|
// 订单状态回退
|
|
|
// 拼团状态回退
|
|
// 拼团状态回退
|
|
|
- StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
|
|
|
|
|
+ StorePink storePink = storePinkService.findBy("orderId",orderNo);
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
|
- throw new ServiceException(I18nUtil.get("group.buying.information.does.not.exist.when.initiating.active.refund.id") + storeOrder.getPinkId());
|
|
|
|
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.information.does.not.exist.when.initiating.active.refund.id") + orderNo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
@@ -2006,15 +2055,20 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
throw new ServiceException(I18nUtil.get("refund.failed.please.initiate.again.orderid") + storeOrder.getOrderId());
|
|
throw new ServiceException(I18nUtil.get("refund.failed.please.initiate.again.orderid") + storeOrder.getOrderId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
|
|
|
|
|
+ updateOrderStatus(storeOrder.getOrderId(), 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);
|
|
|
|
|
|
|
+ Condition condition = new Condition(StorePink.class);
|
|
|
|
|
+ condition.createCriteria().andEqualTo("orderId",orderNo);
|
|
|
|
|
+ storePinkMapper.updateByConditionSelective(storePinkForUpdate,condition);
|
|
|
|
|
+ //维护每日统计表
|
|
|
|
|
+ dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(orderNo,storePinkForUpdate);
|
|
|
|
|
+ //storePinkService.update(storePinkForUpdate);
|
|
|
// 拼团汇总数量维护以及锁单标识维护
|
|
// 拼团汇总数量维护以及锁单标识维护
|
|
|
- Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsId());
|
|
|
|
|
|
|
+ Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsCode());
|
|
|
// 拼团商品数量以及m_store_combination
|
|
// 拼团商品数量以及m_store_combination
|
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
storeCombinationService.operationStock(storePink.getCid(), storePink.getTotalNum(), "add");
|
|
|
// 拼团商品规格扣库存
|
|
// 拼团商品规格扣库存
|
|
@@ -2024,10 +2078,10 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
noticeService.addOrderNotice(NoticeEnum.ORDER_GROUP_BUY_FAIL, storeOrder.getOrderId(), storeOrder.getUid());
|
|
noticeService.addOrderNotice(NoticeEnum.ORDER_GROUP_BUY_FAIL, storeOrder.getOrderId(), storeOrder.getUid());
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
- throw new ServiceException(I18nUtil.get("current.status.does.not.support.refund.cancellationid") + id);
|
|
|
|
|
|
|
+ throw new ServiceException(I18nUtil.get("current.status.does.not.support.refund.cancellationid") + orderNo);
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- 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") + orderNo, e);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 如果是已支付状态状态推到拼团失败退款状态
|
|
// 如果是已支付状态状态推到拼团失败退款状态
|
|
@@ -2047,7 +2101,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
public void scheduledTaskStorePinkSummaryClose() {
|
|
public void scheduledTaskStorePinkSummaryClose() {
|
|
|
|
|
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
|
- PageHelper.startPage(1, 10);
|
|
|
|
|
|
|
+ PageHelper.startPage(1, 50);
|
|
|
Condition pinkSummaryCondition = new Condition(StorePinkSummary.class);
|
|
Condition pinkSummaryCondition = new Condition(StorePinkSummary.class);
|
|
|
Example.Criteria pinkSummaryCriteria = pinkSummaryCondition.createCriteria();
|
|
Example.Criteria pinkSummaryCriteria = pinkSummaryCondition.createCriteria();
|
|
|
pinkSummaryCriteria.andEqualTo("isDelete", 0);
|
|
pinkSummaryCriteria.andEqualTo("isDelete", 0);
|
|
@@ -2059,34 +2113,45 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(byCondition)) {
|
|
if (!CollectionUtils.isEmpty(byCondition)) {
|
|
|
- List<Long> storePinkSummaryidList = byCondition.stream().map(StorePinkSummary::getId).collect(Collectors.toList());
|
|
|
|
|
-
|
|
|
|
|
- Condition condition = new Condition(StorePink.class);
|
|
|
|
|
- Example.Criteria criteria = condition.createCriteria();
|
|
|
|
|
- criteria.andIn("spsId", storePinkSummaryidList);
|
|
|
|
|
|
|
+ // List<Long> storePinkSummaryidList = byCondition.stream().map(StorePinkSummary::getId).collect(Collectors.toList());
|
|
|
|
|
+ List<String> getOrderNoSetList = byCondition.stream().map(StorePinkSummary::getOrderNoSet).filter(a -> !ObjectUtils.isEmpty(a)).collect(Collectors.toList());
|
|
|
|
|
+ if(!CollectionUtils.isEmpty(getOrderNoSetList)) {
|
|
|
|
|
+ for (String s : getOrderNoSetList) {
|
|
|
|
|
+ List<String> strings = JSONObject.parseArray(s, String.class);
|
|
|
|
|
+ if(!CollectionUtils.isEmpty(strings)) {
|
|
|
|
|
+ Condition condition = new Condition(StorePink.class);
|
|
|
|
|
+ Example.Criteria criteria = condition.createCriteria();
|
|
|
|
|
+ criteria.andIn("orderId", strings);
|
|
|
|
|
+
|
|
|
|
|
+ criteria.andEqualTo("isDelete", 0);
|
|
|
|
|
+ // 找出拼团待支付 和 拼团已支付的数据进行 关闭
|
|
|
|
|
+ List<Integer> statusList = CollUtil.newArrayList(
|
|
|
|
|
+ PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey()
|
|
|
|
|
+ , PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey()
|
|
|
|
|
+ );
|
|
|
|
|
+ criteria.andIn("orderStatus", statusList);
|
|
|
|
|
+
|
|
|
|
|
+ List<StorePink> storePinkListForUpdate = storePinkService.findByCondition(condition);
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(storePinkListForUpdate)) {
|
|
|
|
|
+ storePinkListForUpdate.forEach(a ->
|
|
|
|
|
+ close(a.getOrderId())
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- criteria.andEqualTo("isDelete", 0);
|
|
|
|
|
- // 找出拼团待支付 和 拼团已支付的数据进行 关闭
|
|
|
|
|
- List<Integer> statusList = CollUtil.newArrayList(
|
|
|
|
|
- PinkOrderStatusEnum.GROUP_ORDER_TO_PAY.getKey()
|
|
|
|
|
- , PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey()
|
|
|
|
|
- );
|
|
|
|
|
- criteria.andIn("orderStatus", statusList);
|
|
|
|
|
-
|
|
|
|
|
- List<StorePink> storePinkListForUpdate = storePinkService.findByCondition(condition);
|
|
|
|
|
- if (!CollectionUtils.isEmpty(storePinkListForUpdate)) {
|
|
|
|
|
- storePinkListForUpdate.forEach(a ->
|
|
|
|
|
- close(a.getOrderIdKey())
|
|
|
|
|
- );
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private StorePinkMapper storePinkMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
- public void cancel(Long id) {
|
|
|
|
|
- StoreOrder storeOrder = findById(id);
|
|
|
|
|
|
|
+ public void cancel(String orderNo) {
|
|
|
|
|
+ StoreOrder storeOrder = findBy("orderId",orderNo);
|
|
|
if (ObjectUtils.isEmpty(storeOrder)) {
|
|
if (ObjectUtils.isEmpty(storeOrder)) {
|
|
|
throw new ServiceException(I18nUtil.get("order.does.not.exist.when.canceling.the.order.id") + id);
|
|
throw new ServiceException(I18nUtil.get("order.does.not.exist.when.canceling.the.order.id") + id);
|
|
|
}
|
|
}
|
|
@@ -2097,22 +2162,30 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 订单状态回退
|
|
// 订单状态回退
|
|
|
- updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
|
|
|
|
|
+ updateOrderStatus(storeOrder.getOrderId(), pinkOrderStatusEnum.getKey());
|
|
|
|
|
|
|
|
|
|
|
|
|
// 拼团状态回退
|
|
// 拼团状态回退
|
|
|
- StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
|
|
|
|
|
+ StorePink storePink = storePinkService.findBy("orderId",storeOrder.getOrderId());
|
|
|
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.getOrderId());
|
|
|
}
|
|
}
|
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
|
- storePinkForUpdate.setId(storeOrder.getPinkId());
|
|
|
|
|
|
|
+ // storePinkForUpdate.setId(storeOrder.getPinkId());
|
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
|
- storePinkService.update(storePinkForUpdate);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ Condition storePinkCondition = new Condition(StorePink.class);
|
|
|
|
|
+ storePinkCondition.createCriteria().andEqualTo("orderId",storeOrder.getOrderId());
|
|
|
|
|
+ storePinkMapper.updateByConditionSelective(storePinkForUpdate,storePinkCondition);
|
|
|
|
|
+
|
|
|
|
|
+ //维护每日统计
|
|
|
|
|
+ dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(storeOrder.getOrderId(),storePinkForUpdate);
|
|
|
|
|
+
|
|
|
|
|
+ // storePinkService.update(storePinkForUpdate);
|
|
|
|
|
|
|
|
// 拼团汇总数量维护以及锁单标识维护
|
|
// 拼团汇总数量维护以及锁单标识维护
|
|
|
|
|
|
|
|
- Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsId());
|
|
|
|
|
|
|
+ Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(storePink.getSpsCode());
|
|
|
|
|
|
|
|
// 拼团商品数量以及m_store_combination
|
|
// 拼团商品数量以及m_store_combination
|
|
|
|
|
|
|
@@ -2157,7 +2230,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
if (!org.springframework.util.CollectionUtils.isEmpty(byCondition)) {
|
|
if (!org.springframework.util.CollectionUtils.isEmpty(byCondition)) {
|
|
|
try {
|
|
try {
|
|
|
for (StoreOrder storeOrder : byCondition) {
|
|
for (StoreOrder storeOrder : byCondition) {
|
|
|
- cancel(storeOrder.getId());
|
|
|
|
|
|
|
+ cancel(storeOrder.getOrderId());
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error(I18nUtil.get("failed.to.process.ordertimeoutautomaticcancel"), e);
|
|
log.error(I18nUtil.get("failed.to.process.ordertimeoutautomaticcancel"), e);
|
|
@@ -2282,19 +2355,31 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Resource
|
|
|
|
|
- private StorePinkMapper storePinkMapper;
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void updateOrderStatus(Long id, Integer status) {
|
|
|
|
|
- StoreOrder storeOrder = findById(id);
|
|
|
|
|
- storeOrder.setStatus(status);
|
|
|
|
|
|
|
+ public void updateOrderStatus(String orderNo, Integer status) {
|
|
|
|
|
+ //**分库整改
|
|
|
|
|
+ if(ObjectUtils.isEmpty(orderNo)){
|
|
|
|
|
+ throw new ServiceException(I18nUtil.get("order.code.is.empty")+orderNo);
|
|
|
|
|
+ }
|
|
|
|
|
+ StoreOrder storeOrderOri = findBy("orderId", orderNo);
|
|
|
|
|
+ if(ObjectUtils.isEmpty(storeOrderOri)){
|
|
|
|
|
+ throw new ServiceException(I18nUtil.get("order.does.not.exist")+orderNo);
|
|
|
|
|
+ }
|
|
|
|
|
+ StoreOrder storeOrderForUpdate = new StoreOrder();
|
|
|
|
|
+ storeOrderForUpdate.setStatus(status);
|
|
|
if (PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey().equals(status)) {
|
|
if (PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey().equals(status)) {
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
|
- storeOrder.setPayTime(date);
|
|
|
|
|
|
|
+ storeOrderForUpdate.setPayTime(date);
|
|
|
}
|
|
}
|
|
|
- update(storeOrder);
|
|
|
|
|
|
|
+ Condition storeOrderCondition = new Condition(StoreOrder.class);
|
|
|
|
|
+ storeOrderCondition.createCriteria().andEqualTo("orderId",orderNo);
|
|
|
|
|
+
|
|
|
|
|
+ int i = storeOrderMapper.updateByConditionSelective(storeOrderForUpdate, storeOrderCondition);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// StorePink storePink = new StorePink();
|
|
// StorePink storePink = new StorePink();
|
|
|
// Example example = new Example(StorePink.class);
|
|
// Example example = new Example(StorePink.class);
|
|
@@ -2398,11 +2483,11 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
|
|
Condition conditionStorePink = new Condition(StorePink.class);
|
|
Condition conditionStorePink = new Condition(StorePink.class);
|
|
|
Example.Criteria criteriaStorePink = conditionStorePink.createCriteria();
|
|
Example.Criteria criteriaStorePink = conditionStorePink.createCriteria();
|
|
|
- criteriaStorePink.andEqualTo("orderIdKey", storeOrderOri.getId());
|
|
|
|
|
|
|
+ criteriaStorePink.andEqualTo("orderId", storeOrderOri.getOrderId());
|
|
|
criteriaStorePink.andEqualTo("isDelete", 0);
|
|
criteriaStorePink.andEqualTo("isDelete", 0);
|
|
|
List<StorePink> storePinks = storePinkMapper.selectByCondition(conditionStorePink);
|
|
List<StorePink> storePinks = storePinkMapper.selectByCondition(conditionStorePink);
|
|
|
if (CollectionUtils.isEmpty(storePinks)) {
|
|
if (CollectionUtils.isEmpty(storePinks)) {
|
|
|
- throw new ServiceException(I18nUtil.get("group.buying.data.does.not.exist") + storeOrder.getId());
|
|
|
|
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.data.does.not.exist") + storeOrderOri.getOrderId());
|
|
|
}
|
|
}
|
|
|
StorePink storePink = storePinks.get(0);
|
|
StorePink storePink = storePinks.get(0);
|
|
|
Integer winner = 1;
|
|
Integer winner = 1;
|
|
@@ -2411,14 +2496,19 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
if (equals1 && equals) {
|
|
if (equals1 && equals) {
|
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrderOri, OrderEventsEnum.GROUP_PURCHASE_WIN, null);
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrderOri, OrderEventsEnum.GROUP_PURCHASE_WIN, null);
|
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
- throw new ServiceException(I18nUtil.get("current.order.status.does.not.allow.progression.to.pending.shipment.orderid") + storeOrder.getId());
|
|
|
|
|
|
|
+ throw new ServiceException(I18nUtil.get("current.order.status.does.not.allow.progression.to.pending.shipment.orderid") + storeOrder.getOrderId());
|
|
|
}
|
|
}
|
|
|
storeOrder.setStatus(pinkOrderStatusEnum.getKey());
|
|
storeOrder.setStatus(pinkOrderStatusEnum.getKey());
|
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
|
- storePinkForUpdate.setId(storePink.getId());
|
|
|
|
|
|
|
+ // storePinkForUpdate.setId(storePink.getId());
|
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
storePinkForUpdate.setOrderStatus(pinkOrderStatusEnum.getKey());
|
|
|
-
|
|
|
|
|
- storePinkMapper.updateByPrimaryKeySelective(storePinkForUpdate);
|
|
|
|
|
|
|
+ Condition storePinkUpdateCondition = new Condition(StorePink.class);
|
|
|
|
|
+ storePinkUpdateCondition.createCriteria().andEqualTo("orderId",storePink.getOrderId());
|
|
|
|
|
+ //**分库整改
|
|
|
|
|
+ storePinkMapper.updateByConditionSelective(storePinkForUpdate,storePinkUpdateCondition);
|
|
|
|
|
+ //维护每日统计
|
|
|
|
|
+ dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(storePink.getOrderId(),storePinkForUpdate);
|
|
|
|
|
+ // storePinkMapper.updateByPrimaryKeySelective(storePinkForUpdate);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2467,7 +2557,8 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
Example exampleStorePink = new Example(StorePink.class);
|
|
Example exampleStorePink = new Example(StorePink.class);
|
|
|
exampleStorePink.createCriteria().andEqualTo("orderId", storeOrder.getOrderId());
|
|
exampleStorePink.createCriteria().andEqualTo("orderId", storeOrder.getOrderId());
|
|
|
storePinkMapper.updateByConditionSelective(storePinkForUpdate, exampleStorePink);
|
|
storePinkMapper.updateByConditionSelective(storePinkForUpdate, exampleStorePink);
|
|
|
-
|
|
|
|
|
|
|
+ //维护每日统计表
|
|
|
|
|
+ dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(storeOrder.getOrderId(),storePinkForUpdate);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|