|
@@ -32,10 +32,7 @@ import com.txz.mall.enums.PinkOrderStatusEnum;
|
|
|
import com.txz.mall.enums.StorePinkStatusEnum;
|
|
|
import com.txz.mall.model.*;
|
|
|
import com.txz.mall.service.*;
|
|
|
-import com.txz.mall.util.EasyExcelUtil;
|
|
|
-import com.txz.mall.util.EasyToUseUtil;
|
|
|
-import com.txz.mall.util.OrderStateMachine;
|
|
|
-import com.txz.mall.util.OrderUtils;
|
|
|
+import com.txz.mall.util.*;
|
|
|
import dto.*;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -119,7 +116,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
// public void goOpen(String orderId) {
|
|
|
// StoreOrder storeOrder = findBy("orderId", orderId);
|
|
|
// if (storeOrder == null) {
|
|
|
- // throw new ServiceException("订单不存在");
|
|
|
+ // throw new ServiceException(I18nUtil.get("order.does.not.exist"));
|
|
|
// }
|
|
|
// StorePink storePink = new StorePink();
|
|
|
|
|
@@ -177,7 +174,8 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
public void goOpen(String orderId) {
|
|
|
StoreOrder storeOrder = findBy("orderId", orderId);
|
|
|
if (storeOrder == null) {
|
|
|
- throw new ServiceException("订单不存在");
|
|
|
+ String s = I18nUtil.get("order.does.not.exist");
|
|
|
+ throw new ServiceException(s);
|
|
|
}
|
|
|
UserDTO user = userDubboServiceClient.getUser(storeOrder.getUid());
|
|
|
StorePink storePink = new StorePink();
|
|
@@ -246,7 +244,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
// if (dto.getPinkId() != null) {
|
|
|
// StorePink teamPink = storePinkService.findById(dto.getPinkId());
|
|
|
// if (ObjectUtil.isNull(teamPink) || teamPink.getIsRefund().equals(1)) {
|
|
|
- // throw new ServiceException("对应的拼团不存在");
|
|
|
+ // throw new ServiceException(I18nUtil.get("the.corresponding.group.buying.does.not.exist"));
|
|
|
// }
|
|
|
// Condition condition = new Condition(StoreCombination.class);
|
|
|
// Example.Criteria criteria = condition.createCriteria();
|
|
@@ -258,7 +256,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
//
|
|
|
// List<StoreCombination> combinationList = storeCombinationService.findByCondition(condition);
|
|
|
// if (CollUtil.isEmpty(combinationList)) {
|
|
|
- // throw new ServiceException("拼团商品不存在或未开启");
|
|
|
+ // throw new ServiceException(I18nUtil.get("group.buying.product.does.not.exist.or.is.not.activated"));
|
|
|
// }
|
|
|
//
|
|
|
// Condition pinkCondition = new Condition(StorePink.class);
|
|
@@ -269,7 +267,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
// List<StorePink> pinkList = storePinkService.findByCondition(pinkCondition);
|
|
|
// int count = teamPink.getPeople() - (CollUtil.isEmpty(pinkList) ? 0 : pinkList.size());
|
|
|
// if (count < 1) {
|
|
|
- // throw new ServiceException("拼团已满");
|
|
|
+ // throw new ServiceException(I18nUtil.get("group.buying.is.full"));
|
|
|
// }
|
|
|
// List<Long> uidList = pinkList.stream().map(StorePink::getUid).collect(Collectors.toList());
|
|
|
// if (uidList.contains(dto.getUserId())) {
|
|
@@ -290,7 +288,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
if (dto.getPinkId() != null) {
|
|
|
StorePink teamPink = storePinkService.findById(dto.getPinkId());
|
|
|
if (ObjectUtil.isNull(teamPink) || teamPink.getIsRefund().equals(1)) {
|
|
|
- throw new ServiceException("对应的拼团不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("the.corresponding.group.buying.does.not.exist"));
|
|
|
}
|
|
|
Condition condition = new Condition(StoreCombination.class);
|
|
|
Example.Criteria criteria = condition.createCriteria();
|
|
@@ -302,7 +300,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
List<StoreCombination> combinationList = storeCombinationService.findByCondition(condition);
|
|
|
if (CollUtil.isEmpty(combinationList)) {
|
|
|
- throw new ServiceException("拼团商品不存在或未开启");
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.product.does.not.exist.or.is.not.activated"));
|
|
|
}
|
|
|
|
|
|
Condition pinkCondition = new Condition(StorePink.class);
|
|
@@ -313,13 +311,13 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
List<StorePink> pinkList = storePinkService.findByCondition(pinkCondition);
|
|
|
int count = teamPink.getPeople() - (CollUtil.isEmpty(pinkList) ? 0 : pinkList.size());
|
|
|
if (count < 1) {
|
|
|
- throw new ServiceException("拼团已满");
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.is.full"));
|
|
|
}
|
|
|
|
|
|
//记得将重复拼团校验放开
|
|
|
List<Long> uidList = pinkList.stream().map(StorePink::getUid).collect(Collectors.toList());
|
|
|
if (uidList.contains(dto.getUserId())) {
|
|
|
- throw new ServiceException("重复拼团");
|
|
|
+ throw new ServiceException(I18nUtil.get("duplicate.group.buying"));
|
|
|
}
|
|
|
joinGroup(teamPink, dto, count, pinkList.size());
|
|
|
}
|
|
@@ -388,7 +386,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
// 找一个最快能成团的
|
|
|
StoreCombination storeCombination = storeCombinationService.findById(dto.getCid());
|
|
|
if (ObjectUtil.isNull(storeCombination) || storeCombination.getIsDelete().equals(1)) {
|
|
|
- throw new ServiceException("对应拼团商品不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("the.corresponding.group.buying.product.does.not.exist"));
|
|
|
}
|
|
|
//这里要排除掉团长未付款的拼团
|
|
|
|
|
@@ -405,7 +403,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(pinkSummaryList)) {
|
|
|
- throw new ServiceException("暂时没有可加入的团");
|
|
|
+ throw new ServiceException(I18nUtil.get("there.is.no.group.to.join.temporarily"));
|
|
|
}
|
|
|
|
|
|
List<Long> storePinkSummaryId = pinkSummaryList.stream().map(StorePinkSummary::getId).collect(Collectors.toList());
|
|
@@ -435,7 +433,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
log.info("availableGroups:" + availableGroups.toString());
|
|
|
// 如果没有用户未参与的拼团,直接返回,让调用方处理创建新团的逻辑
|
|
|
if (CollUtil.isEmpty(availableGroups)) {
|
|
|
- throw new ServiceException("所有的团均已参加");
|
|
|
+ throw new ServiceException(I18nUtil.get("all.groups.have.been.joined"));
|
|
|
}
|
|
|
// 找出最多value对应的key
|
|
|
// List<StorePink> maxPinkList = availableGroups.stream()
|
|
@@ -459,7 +457,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
dto.setSpsId(pink.getSpsId()); //拼团汇总表id
|
|
|
joinGroup(pink, dto, count, pinkList.size());
|
|
|
} else {
|
|
|
- throw new ServiceException("拼团人数超员请重新发起拼团 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());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -535,14 +533,14 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
@Override
|
|
|
public void batchDelivery(List<StoreOrderDeliveryDTO> dto) {
|
|
|
if (CollectionUtils.isEmpty(dto)) {
|
|
|
- throw new ServiceException("批量发货入参为空dto:" + dto);
|
|
|
+ throw new ServiceException(I18nUtil.get("batch.delivery.input.parameter.is.empty.dto") + dto);
|
|
|
}
|
|
|
List<String> orderIdList = dto.stream().map(StoreOrderDeliveryDTO::getOrderId).collect(Collectors.toList());
|
|
|
if (CollectionUtils.isEmpty(orderIdList)) {
|
|
|
- throw new ServiceException("批量发货订单orderid为空orderIdList:" + orderIdList);
|
|
|
+ throw new ServiceException(I18nUtil.get("batch.delivery.order.orderid.is.empty.orderidlist") + orderIdList);
|
|
|
}
|
|
|
if (dto.size() > 500) {
|
|
|
- throw new ServiceException("1次批量发货订单不要超过500条");
|
|
|
+ throw new ServiceException(I18nUtil.get("do.not.exceed.500.orders.for.one.batch.delivery"));
|
|
|
}
|
|
|
|
|
|
Condition condition = new Condition(StoreOrder.class);
|
|
@@ -551,14 +549,14 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
criteria.andEqualTo("isDelete", 0);
|
|
|
List<StoreOrder> storeOrderList = findByCondition(condition);
|
|
|
if (CollectionUtils.isEmpty(storeOrderList)) {
|
|
|
- throw new ServiceException("批量发货订单订单列表不存在:" + storeOrderList);
|
|
|
+ throw new ServiceException(I18nUtil.get("order.list.for.batch.shipment.does.not.exist") + storeOrderList);
|
|
|
}
|
|
|
Map<String, StoreOrderDeliveryDTO> storeOrderDeliveryMap = dto.stream().collect(Collectors.toMap(StoreOrderDeliveryDTO::getOrderId, a -> a, (b, c) -> b));
|
|
|
for (StoreOrder storeOrder : storeOrderList) {
|
|
|
StoreOrderDeliveryDTO storeOrderDeliveryDTO = storeOrderDeliveryMap.get(storeOrder.getOrderId());
|
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_DELIVER, null);
|
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
- throw new ServiceException("当前状态不支持发货storeOrder:" + storeOrder.toString());
|
|
|
+ throw new ServiceException(I18nUtil.get("the.current.status.does.not.support.delivery.storeorder") + storeOrder.toString());
|
|
|
}
|
|
|
Date date = DateUtil.date();
|
|
|
StoreOrder storeOrderForUpdate = new StoreOrder();
|
|
@@ -587,15 +585,15 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
@Override
|
|
|
public String preOrder(PreOrderRequest request) {
|
|
|
if (CollUtil.isEmpty(request.getOrderDetails())) {
|
|
|
- throw new ServiceException("预下单订单详情列表不能为空");
|
|
|
+ throw new ServiceException(I18nUtil.get("the.pre-order.details.list.cannot.be.empty"));
|
|
|
}
|
|
|
Long userId = request.getUserId();
|
|
|
if (userId == null) {
|
|
|
- throw new ServiceException("用户id不能为空");
|
|
|
+ throw new ServiceException(I18nUtil.get("user.id.cannot.be.empty"));
|
|
|
}
|
|
|
UserDTO user = userDubboServiceClient.getUser(userId);
|
|
|
if (ObjectUtils.isEmpty(user)) {
|
|
|
- throw new ServiceException("用户为空userId:" + userId);
|
|
|
+ throw new ServiceException(I18nUtil.get("user.is.empty.userid") + userId);
|
|
|
}
|
|
|
// 校验预下单商品信息
|
|
|
OrderInfoVO orderInfoVo = validatePreOrderRequest(request, user);
|
|
@@ -789,35 +787,35 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
} else {
|
|
|
// 普通商品
|
|
|
if (ObjectUtil.isNull(detailRequest.getProductId())) {
|
|
|
- throw new ServiceException("商品编号不能为空");
|
|
|
+ throw new ServiceException(I18nUtil.get("product.number.cannot.be.empty"));
|
|
|
}
|
|
|
if (ObjectUtil.isNull(detailRequest.getAttrValueId())) {
|
|
|
- throw new ServiceException("商品规格属性值不能为空");
|
|
|
+ throw new ServiceException(I18nUtil.get("product.specification.attribute.value.cannot.be.empty"));
|
|
|
}
|
|
|
if (ObjectUtil.isNull(detailRequest.getProductNum()) || detailRequest.getProductNum() < 0) {
|
|
|
- throw new ServiceException("购买数量必须大于0");
|
|
|
+ throw new ServiceException(I18nUtil.get("the.purchase.quantity.must.be.greater.than.0"));
|
|
|
}
|
|
|
// 查询商品信息
|
|
|
StoreProduct storeProduct = storeProductService.findById(detailRequest.getProductId());
|
|
|
if (ObjectUtil.isNull(storeProduct)) {
|
|
|
- throw new ServiceException("商品信息不存在,请刷新后重新选择");
|
|
|
+ throw new ServiceException(I18nUtil.get("product.information.does.not.exist.please.refresh.and.reselect"));
|
|
|
}
|
|
|
if (storeProduct.getIsDelete().equals(1)) {
|
|
|
- throw new ServiceException("商品已删除,请刷新后重新选择");
|
|
|
+ throw new ServiceException(I18nUtil.get("the.product.has.been.deleted.please.refresh.and.reselect"));
|
|
|
}
|
|
|
if (storeProduct.getIsShow().equals(0)) {
|
|
|
- throw new ServiceException("商品已下架,请刷新后重新选择");
|
|
|
+ throw new ServiceException(I18nUtil.get("the.product.has.been.removed.from.the.shelves.please.refresh.and.reselect"));
|
|
|
}
|
|
|
if (storeProduct.getStock() < detailRequest.getProductNum()) {
|
|
|
- throw new ServiceException("商品库存不足,请刷新后重新选择");
|
|
|
+ throw new ServiceException(I18nUtil.get("insufficient.product.inventory.please.refresh.and.reselect"));
|
|
|
}
|
|
|
// 查询商品规格属性值信息
|
|
|
ProductAttrValue attrValue = productAttrValueService.getByIdAndProductIdAndType(detailRequest.getAttrValueId(), detailRequest.getProductId(), Constants.PRODUCT_TYPE_NORMAL);
|
|
|
if (ObjectUtil.isNull(attrValue)) {
|
|
|
- throw new ServiceException("商品规格信息不存在,请刷新后重新选择");
|
|
|
+ throw new ServiceException(I18nUtil.get("product.specification.information.does.not.exist.please.refresh.and.reselect"));
|
|
|
}
|
|
|
if (attrValue.getStock() < detailRequest.getProductNum()) {
|
|
|
- throw new ServiceException("商品规格库存不足,请刷新后重新选择");
|
|
|
+ throw new ServiceException(I18nUtil.get("insufficient.product.specification.inventory.please.refresh.and.reselect"));
|
|
|
}
|
|
|
// SystemUserLevel userLevel = null;
|
|
|
// if (user.getLevel() > 0) {
|
|
@@ -863,11 +861,11 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
Long combinationId = detailRequest.getCId();
|
|
|
StoreCombination storeCombination = storeCombinationService.getByIdException(combinationId);
|
|
|
if (storeCombination.getStock().equals(0) || detailRequest.getProductNum() > storeCombination.getStock()) {
|
|
|
- throw new ServiceException("拼团商品库存不足");
|
|
|
+ throw new ServiceException(I18nUtil.get("insufficient.group.buying.product.inventory"));
|
|
|
}
|
|
|
ProductAttrValue combinationAttrValue = productAttrValueService.getByIdAndProductIdAndType(detailRequest.getAttrValueId(), detailRequest.getProductId(), Constants.PRODUCT_TYPE_PINGTUAN);
|
|
|
if (ObjectUtil.isNull(combinationAttrValue)) {
|
|
|
- throw new ServiceException("拼团商品规格不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.product.specification.does.not.exist"));
|
|
|
}
|
|
|
commonValidateCombination(storeCombination, combinationAttrValue, user, detailRequest.getProductNum());
|
|
|
|
|
@@ -899,10 +897,10 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
// 判断拼团时间段
|
|
|
Date date = new Date();
|
|
|
if (date.before(storeCombination.getStartTime())) {
|
|
|
- throw new ServiceException("拼团商品活动未开始");
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.product.activity.has.not.started"));
|
|
|
}
|
|
|
if (date.after(storeCombination.getStopTime())) {
|
|
|
- throw new ServiceException("拼团商品已过期");
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.product.has.expired"));
|
|
|
}
|
|
|
// 判断购买数量
|
|
|
// if (productNum > storeCombination.getOnceNum()) {
|
|
@@ -910,23 +908,23 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
// }
|
|
|
|
|
|
if (combinationAttrValue.getStock() <= 0 || productNum > combinationAttrValue.getStock()) {
|
|
|
- throw new ServiceException("拼团商品规格库存不足");
|
|
|
+ throw new ServiceException(I18nUtil.get("insufficient.inventory.of.group.buying.product.specifications"));
|
|
|
}
|
|
|
// 普通商品部分判断
|
|
|
StoreProduct product = storeProductService.findById(storeCombination.getProductId());
|
|
|
if (ObjectUtil.isNull(product) || product.getIsDelete().equals(1)) {
|
|
|
- throw new ServiceException("拼团主商品不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("main.group.buying.product.does.not.exist"));
|
|
|
}
|
|
|
if (product.getStock().equals(0) || productNum > product.getStock()) {
|
|
|
- throw new ServiceException("拼团主商品库存不足");
|
|
|
+ throw new ServiceException(I18nUtil.get("insufficient.inventory.of.group.buying.main.product"));
|
|
|
}
|
|
|
// 主商品sku
|
|
|
ProductAttrValue productAttrValue = productAttrValueService.getByProductIdAndSkuAndType(storeCombination.getProductId(), combinationAttrValue.getSuk(), Constants.PRODUCT_TYPE_PINGTUAN);
|
|
|
if (ObjectUtil.isNull(productAttrValue)) {
|
|
|
- throw new ServiceException("拼团主商品规格不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.main.product.specification.does.not.exist"));
|
|
|
}
|
|
|
if (productAttrValue.getStock() <= 0 || productNum > productAttrValue.getStock()) {
|
|
|
- throw new ServiceException("拼团主商品规格库存不足");
|
|
|
+ throw new ServiceException(I18nUtil.get("insufficient.inventory.of.group.buying.main.product.specifications"));
|
|
|
}
|
|
|
|
|
|
// 用户参与活动的次数
|
|
@@ -959,7 +957,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
ConfigMemberDTO configByLevel = userDubboServiceClient.getConfigByLevel(user.getVipLevel());
|
|
|
if (ObjectUtils.isEmpty(configByLevel)) {
|
|
|
- throw new ServiceException("用户等级对应的购买次数配置不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("the.purchase.times.configuration.corresponding.to.the.user.level.does.not.exist"));
|
|
|
}
|
|
|
|
|
|
if (CollUtil.isNotEmpty(storeOrderList)) {
|
|
@@ -970,7 +968,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
// }
|
|
|
int payNum = storeOrderList.stream().mapToInt(StoreOrder::getTotalNum).sum();
|
|
|
if (configByLevel.getJoinedGroupsNo() < payNum) {
|
|
|
- throw new ServiceException("您已达到该商品拼团活动上限");
|
|
|
+ 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("超过该商品拼团活动您的购买上限");
|
|
@@ -989,7 +987,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
String key = "user_order:" + request.getPreOrderNo();
|
|
|
boolean exists = redisUtil.hasKey(key);
|
|
|
if (!exists) {
|
|
|
- throw new ServiceException("预下单订单不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("pre-order.does.not.exist"));
|
|
|
}
|
|
|
String orderVoString = redisUtil.get(key).toString();
|
|
|
OrderInfoVO orderInfoVo = JSONObject.parseObject(orderVoString, OrderInfoVO.class);
|
|
@@ -1464,7 +1462,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
String key = "user_order:" + preOrderNo;
|
|
|
boolean exists = redisUtil.hasKey(key);
|
|
|
if (!exists) {
|
|
|
- throw new ServiceException("预下单订单不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("pre-order.does.not.exist"));
|
|
|
}
|
|
|
String orderVoString = redisUtil.get(key).toString();
|
|
|
OrderInfoVO orderInfoVo = JSONObject.parseObject(orderVoString, OrderInfoVO.class);
|
|
@@ -1482,7 +1480,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
String key = "user_order:" + request.getPreOrderNo();
|
|
|
boolean exists = redisUtil.hasKey(key);
|
|
|
if (!exists) {
|
|
|
- throw new ServiceException("预下单订单不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("pre-order.does.not.exist"));
|
|
|
}
|
|
|
String orderVoString = redisUtil.get(key).toString();
|
|
|
OrderInfoVO orderInfoVo = JSONObject.parseObject(orderVoString, OrderInfoVO.class);
|
|
@@ -1505,11 +1503,11 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
String userAddressStr = "";
|
|
|
if (request.getAddressId() != null) {
|
|
|
if (request.getAddressId() <= 0) {
|
|
|
- throw new ServiceException("请选择收货地址");
|
|
|
+ throw new ServiceException(I18nUtil.get("please.select.a.delivery.address"));
|
|
|
}
|
|
|
UserAddress userAddress = userAddressService.findById(request.getAddressId());
|
|
|
if (ObjectUtil.isNull(userAddress) || userAddress.getIsDelete().equals(1)) {
|
|
|
- throw new ServiceException("收货地址有误");
|
|
|
+ throw new ServiceException(I18nUtil.get("delivery.address.is.incorrect"));
|
|
|
}
|
|
|
}
|
|
|
// UserAddress userAddress = userAddressService.getDefaultByUid(user.getId());
|
|
@@ -1692,16 +1690,16 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
public Boolean goPay(GoPinkDTO dto) {
|
|
|
StoreOrder storeOrder = findBy("orderId", dto.getOrderId());
|
|
|
if (ObjectUtils.isEmpty(storeOrder)) {
|
|
|
- throw new ServiceException("订单为空orderId:" + dto.getOrderId());
|
|
|
+ throw new ServiceException(I18nUtil.get("order.is.empty.orderid") + dto.getOrderId());
|
|
|
}
|
|
|
if (storeOrder.getStatus().equals(PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey())) {
|
|
|
- throw new ServiceException("订单已支付orderId:" + dto.getOrderId());
|
|
|
+ throw new ServiceException(I18nUtil.get("order.has.been.paid.orderid") + dto.getOrderId());
|
|
|
}
|
|
|
|
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_PAY, null);
|
|
|
|
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
- throw new ServiceException("当前状态不支持去支持去支付orderId:" + dto.getOrderId());
|
|
|
+ throw new ServiceException(I18nUtil.get("current.status.does.not.support.payment.orderid") + dto.getOrderId());
|
|
|
}
|
|
|
|
|
|
log.info("accountDubboServiceClient.getWalletAccount");
|
|
@@ -1714,7 +1712,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
throw new ServiceException(ResultCode.INSUFFICIENT_BALANCE);
|
|
|
}
|
|
|
} else {
|
|
|
- throw new ServiceException("获取用户钱包账户失败");
|
|
|
+ throw new ServiceException(I18nUtil.get("failed.to.obtain.user.wallet.account"));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1730,7 +1728,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
Result result1 = accountDubboServiceClient.openGroup(openParam);
|
|
|
log.info("accountDubboServiceClient.openGroup result1" + result1);
|
|
|
if (!result1.getCode().equals("200")) {
|
|
|
- throw new ServiceException("支付失败" + result1.getMessage());
|
|
|
+ throw new ServiceException(I18nUtil.get("payment.failed") + result1.getMessage());
|
|
|
}
|
|
|
updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
|
log.info("pinkSuccess storeOrder1" + storeOrder);
|
|
@@ -1750,7 +1748,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
Result result1 = accountDubboServiceClient.joinGroup(joinParam);
|
|
|
log.info("accountDubboServiceClient.joinGroup2 result1:" + result1);
|
|
|
if (!result1.getCode().equals("200")) {
|
|
|
- throw new ServiceException("支付失败" + result1.getMessage());
|
|
|
+ throw new ServiceException(I18nUtil.get("payment.failed") + result1.getMessage());
|
|
|
}
|
|
|
updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
|
log.info("storePinkService.pinkSuccess1 :" + storeOrder);
|
|
@@ -1786,24 +1784,24 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
//
|
|
|
//
|
|
|
if (ObjectUtils.isEmpty(storeOrder)) {
|
|
|
- throw new ServiceException("订单主动退款时订单不存在id:" + id);
|
|
|
+ throw new ServiceException(I18nUtil.get("order.does.not.exist.when.initiating.active.refund.id") + id);
|
|
|
}
|
|
|
|
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_FAIL, null);
|
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
- throw new ServiceException("当前状态不支持退款关闭id:" + id);
|
|
|
+ throw new ServiceException(I18nUtil.get("current.status.does.not.support.refund.cancellation.id") + id);
|
|
|
}
|
|
|
|
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
|
Integer status = 0;
|
|
|
//团长在未成团时不能退款
|
|
|
if (storePink.getKId().equals(status) && storePink.getStatus().equals(StorePinkStatusEnum.NOT_DRAWN.getKey())) {
|
|
|
- throw new ServiceException("当前成员是团长,且该团未开奖,暂时不支持退款:" + 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);
|
|
|
}
|
|
|
|
|
|
// 批量退款接口调用 这块要前置,退款成功后再去改状态
|
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
|
- throw new ServiceException("拼团时间过期关闭时时拼团信息不存在ID:" + storeOrder.getPinkId());
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.information.does.not.exist.when.closing.due.to.group.buying.timeout.id") + storeOrder.getPinkId());
|
|
|
}
|
|
|
|
|
|
Date date = new Date();
|
|
@@ -1818,7 +1816,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
Result result = accountDubboServiceClient.cancelGroup(param);
|
|
|
boolean equals = result.getCode().equals("200");
|
|
|
if (!equals) {
|
|
|
- throw new ServiceException("退款失败请重新发起");
|
|
|
+ throw new ServiceException(I18nUtil.get("refund.failed.please.initiate.again"));
|
|
|
}
|
|
|
updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
|
//订单状态回退
|
|
@@ -1866,7 +1864,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_CANCEL, null);
|
|
|
|
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
- throw new ServiceException("当前状态不支持取消");
|
|
|
+ throw new ServiceException(I18nUtil.get("current.status.does.not.support.cancellation"));
|
|
|
}
|
|
|
//订单状态回退
|
|
|
updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
@@ -1874,7 +1872,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
//拼团状态回退
|
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
|
- throw new ServiceException("订单取消时拼团信息不存在ID:" + storeOrder.getPinkId());
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.information.does.not.exist.when.canceling.the.order.id") + storeOrder.getPinkId());
|
|
|
}
|
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
|
storePinkForUpdate.setId(storeOrder.getPinkId());
|
|
@@ -1895,7 +1893,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_FAIL, null);
|
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
- throw new ServiceException("当前状态不支持退款关闭");
|
|
|
+ throw new ServiceException(I18nUtil.get("current.status.does.not.support.refund.cancellation"));
|
|
|
}
|
|
|
|
|
|
//订单状态回退
|
|
@@ -1903,7 +1901,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
|
|
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
|
- throw new ServiceException("主动发起退款时拼团信息不存在ID:" + storeOrder.getPinkId());
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.information.does.not.exist.when.initiating.active.refund.id") + storeOrder.getPinkId());
|
|
|
}
|
|
|
|
|
|
Date date = new Date();
|
|
@@ -1918,7 +1916,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
Result result = accountDubboServiceClient.cancelGroup(param);
|
|
|
boolean equals = result.getCode().equals("200");
|
|
|
if (!equals) {
|
|
|
- throw new ServiceException("退款失败请重新发起orderId:" + storeOrder.getOrderId());
|
|
|
+ throw new ServiceException(I18nUtil.get("refund.failed.please.initiate.again.orderid") + storeOrder.getOrderId());
|
|
|
}
|
|
|
|
|
|
updateOrderStatus(storeOrder.getId(), pinkOrderStatusEnum.getKey());
|
|
@@ -1939,10 +1937,10 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
noticeService.addOrderNotice(NoticeEnum.ORDER_GROUP_BUY_FAIL, storeOrder.getOrderId(), storeOrder.getUid());
|
|
|
|
|
|
} else {
|
|
|
- throw new ServiceException("当前状态不支持退款关闭:id" + id);
|
|
|
+ throw new ServiceException(I18nUtil.get("current.status.does.not.support.refund.cancellationid") + id);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- log.error("定时任务关单处理失败订单id:" + id, e);
|
|
|
+ log.error(I18nUtil.get("scheduled.task.failed.to.close.the.order.order.id") + id, e);
|
|
|
}
|
|
|
|
|
|
//如果是已支付状态状态推到拼团失败退款状态
|
|
@@ -2003,12 +2001,12 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
public void cancel(Long id) {
|
|
|
StoreOrder storeOrder = findById(id);
|
|
|
if (ObjectUtils.isEmpty(storeOrder)) {
|
|
|
- throw new ServiceException("订单取消时订单不存在id:" + id);
|
|
|
+ throw new ServiceException(I18nUtil.get("order.does.not.exist.when.canceling.the.order.id") + id);
|
|
|
}
|
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_CANCEL, null);
|
|
|
|
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
- throw new ServiceException("当前状态不支持取消");
|
|
|
+ throw new ServiceException(I18nUtil.get("current.status.does.not.support.cancellation"));
|
|
|
}
|
|
|
|
|
|
//订单状态回退
|
|
@@ -2018,7 +2016,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
//拼团状态回退
|
|
|
StorePink storePink = storePinkService.findById(storeOrder.getPinkId());
|
|
|
if (ObjectUtils.isEmpty(storePink)) {
|
|
|
- throw new ServiceException("订单取消时拼团信息不存在ID:" + storeOrder.getPinkId());
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.information.does.not.exist.when.canceling.the.order.id") + storeOrder.getPinkId());
|
|
|
}
|
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
|
storePinkForUpdate.setId(storeOrder.getPinkId());
|
|
@@ -2075,7 +2073,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
cancel(storeOrder.getId());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- log.error("orderTimeoutAutomaticCancel处理失败", e);
|
|
|
+ log.error(I18nUtil.get("failed.to.process.ordertimeoutautomaticcancel"), e);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -2090,7 +2088,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
String suffix = FileUtil.extName(name);
|
|
|
log.info("获取到的文件名为----->{},后缀为----->{},入参------->{}", name, suffix);
|
|
|
if (!"xlsx".equals(suffix) && !"xls".equals(suffix)) {
|
|
|
- throw new ServiceException("请传入xlsx或xls文档格式文件");
|
|
|
+ throw new ServiceException(I18nUtil.get("please.upload.files.in.xlsx.or.xls.format"));
|
|
|
}
|
|
|
try {
|
|
|
List<StoreOrderExportPO> list = EasyExcelUtil.syncReadModel(file.getInputStream(),
|
|
@@ -2099,7 +2097,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
1);
|
|
|
|
|
|
if (CollUtil.isEmpty(list)) {
|
|
|
- throw new ServiceException("请填写内容后再提交!");
|
|
|
+ throw new ServiceException(I18nUtil.get("please.fill.in.the.content.before.submitting"));
|
|
|
}
|
|
|
|
|
|
List<StoreOrderExportPO> errors = new ArrayList<>();
|
|
@@ -2107,13 +2105,13 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
StoreOrder storeOrder = this.findById(po.getId());
|
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_DELIVER, null);
|
|
|
if (ObjectUtil.isEmpty(pinkOrderStatusEnum)) {
|
|
|
- po.setErrorMsg("当前状态不支持发货");
|
|
|
+ po.setErrorMsg(I18nUtil.get("current.status.does.not.support.shipment"));
|
|
|
errors.add(po);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.isBlank(po.getDeliveryId()) || StrUtil.isBlank(po.getDeliveryName())) {
|
|
|
- po.setErrorMsg("快递单号或快递公司不能为空");
|
|
|
+ po.setErrorMsg(I18nUtil.get("courier.tracking.number.or.courier.company.cannot.be.empty"));
|
|
|
errors.add(po);
|
|
|
continue;
|
|
|
}
|
|
@@ -2236,7 +2234,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
StoreCombination storeCombination = storeCombinationService.getByIdException(combinationId);
|
|
|
ProductAttrValue combinationAttrValue = productAttrValueService.getByIdAndProductIdAndType(detailVo.getAttrValueId(), detailVo.getProductId(), Constants.PRODUCT_TYPE_PINGTUAN);
|
|
|
if (ObjectUtil.isNull(combinationAttrValue)) {
|
|
|
- throw new ServiceException("拼团商品规格不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.product.specification.does.not.exist"));
|
|
|
}
|
|
|
MyRecord combinationRecord = commonValidateCombination(storeCombination, combinationAttrValue, user, detailVo.getPayNum());
|
|
|
ProductAttrValue productAttrValue = combinationRecord.get("productAttrValue");
|
|
@@ -2256,24 +2254,24 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
// 查询商品信息
|
|
|
StoreProduct storeProduct = storeProductService.findById(e.getProductId());
|
|
|
if (ObjectUtil.isNull(storeProduct)) {
|
|
|
- throw new ServiceException("购买的商品信息不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("purchased.product.information.does.not.exist"));
|
|
|
}
|
|
|
if (storeProduct.getIsDelete().equals(1)) {
|
|
|
- throw new ServiceException("购买的商品已删除");
|
|
|
+ throw new ServiceException(I18nUtil.get("purchased.product.has.been.deleted"));
|
|
|
}
|
|
|
if (storeProduct.getIsShow().equals(0)) {
|
|
|
- throw new ServiceException("购买的商品已下架");
|
|
|
+ throw new ServiceException(I18nUtil.get("purchased.product.has.been.removed.from.shelves"));
|
|
|
}
|
|
|
if (storeProduct.getStock().equals(0) || e.getPayNum() > storeProduct.getStock()) {
|
|
|
- throw new ServiceException("购买的商品库存不足");
|
|
|
+ throw new ServiceException(I18nUtil.get("insufficient.inventory.for.the.purchased.product"));
|
|
|
}
|
|
|
// 查询商品规格属性值信息
|
|
|
ProductAttrValue attrValue = productAttrValueService.getByIdAndProductIdAndType(e.getAttrValueId(), e.getProductId(), Constants.PRODUCT_TYPE_NORMAL);
|
|
|
if (ObjectUtil.isNull(attrValue)) {
|
|
|
- throw new ServiceException("购买的商品规格信息不存在");
|
|
|
+ throw new ServiceException(I18nUtil.get("specification.information.of.the.purchased.product.does.not.exist"));
|
|
|
}
|
|
|
if (attrValue.getStock() < e.getPayNum()) {
|
|
|
- throw new ServiceException("购买的商品库存不足");
|
|
|
+ throw new ServiceException(I18nUtil.get("insufficient.inventory.for.the.purchased.product"));
|
|
|
}
|
|
|
MyRecord record = new MyRecord();
|
|
|
record.set("productId", e.getProductId());
|
|
@@ -2299,7 +2297,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
List<StoreOrder> byCondition = findByCondition(conditionStoreOrder);
|
|
|
|
|
|
if (org.springframework.util.CollectionUtils.isEmpty(byCondition)) {
|
|
|
- throw new ServiceException("订单不存在OrderId:" + storeOrder.getOrderId());
|
|
|
+ throw new ServiceException(I18nUtil.get("order.does.not.exist.orderid") + storeOrder.getOrderId());
|
|
|
}
|
|
|
StoreOrder storeOrderOri = byCondition.get(0);
|
|
|
|
|
@@ -2310,7 +2308,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
criteriaStorePink.andEqualTo("isDelete", 0);
|
|
|
List<StorePink> storePinks = storePinkMapper.selectByCondition(conditionStorePink);
|
|
|
if (CollectionUtils.isEmpty(storePinks)) {
|
|
|
- throw new ServiceException("拼团数据不存在:" + storeOrder.getId());
|
|
|
+ throw new ServiceException(I18nUtil.get("group.buying.data.does.not.exist") + storeOrder.getId());
|
|
|
}
|
|
|
StorePink storePink = storePinks.get(0);
|
|
|
Integer winner = 1;
|
|
@@ -2319,7 +2317,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
if (equals1 && equals) {
|
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrderOri, OrderEventsEnum.GROUP_PURCHASE_WIN, null);
|
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
- throw new ServiceException("当前订单状态不允许推进到待发货order.id:" + storeOrder.getId());
|
|
|
+ throw new ServiceException(I18nUtil.get("current.order.status.does.not.allow.progression.to.pending.shipment.orderid") + storeOrder.getId());
|
|
|
}
|
|
|
storeOrder.setStatus(pinkOrderStatusEnum.getKey());
|
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
@@ -2357,7 +2355,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
for (StoreOrder storeOrder : storeOrderList) {
|
|
|
PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_CONFIRM_RECEIPT, null);
|
|
|
if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
|
|
|
- throw new ServiceException("当前状态不支持签收storeOrder:" + storeOrder.toString());
|
|
|
+ throw new ServiceException(I18nUtil.get("current.status.does.not.support.receipt.confirmation.storeorder") + storeOrder.toString());
|
|
|
}
|
|
|
StoreOrder storeOrderForUpdate = new StoreOrder();
|
|
|
storeOrderForUpdate.setStatus(pinkOrderStatusEnum.getKey());
|
|
@@ -2367,7 +2365,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
storeOrderMapper.updateByConditionSelective(storeOrderForUpdate, example);
|
|
|
|
|
|
|
|
|
- storeOrderStatusService.createLog(storeOrder.getId(), Constants.ORDER_STATUS_RECEIVE_ORDER, "订单自动签收");
|
|
|
+ storeOrderStatusService.createLog(storeOrder.getId(), Constants.ORDER_STATUS_RECEIVE_ORDER, I18nUtil.get("automatic.order.receipt.confirmation"));
|
|
|
|
|
|
//维护拼团订单状态
|
|
|
StorePink storePinkForUpdate = new StorePink();
|
|
@@ -2400,7 +2398,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
Map<Integer,Integer> resultMap = new HashMap<>();
|
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
if(ObjectUtils.isEmpty(tokenUserId)){
|
|
|
- throw new ServiceException("登陆用户不存在tokenUserId:"+tokenUserId);
|
|
|
+ throw new ServiceException("user not exist tokenUserId:"+tokenUserId);
|
|
|
}
|
|
|
//待支付数量
|
|
|
Condition conditionStoreStorePinkToPay = new Condition(StorePink.class);
|