Browse Source

修复评测异常及单独处理拼团订单未支付时间

sj
1304317391@qq.com 2 years ago
parent
commit
7f0a0a43a8
  1. 2
      yudao-server/src/main/resources/application-local.yaml
  2. 2
      zsw-bxg/src/main/java/co/yixiang/enums/OrderInfoEnum.java
  3. 3
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java
  4. 60
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java

2
yudao-server/src/main/resources/application-local.yaml

@ -270,7 +270,7 @@ dubbo:
bxg:
shop:
# API_URL: http://192.168.10.113:48080/bxgApp
API_URL: http://1cbbf622.r5.cpolar.top
API_URL: http://16a9b0c.r5.cpolar.top
SITE_URL: http://192.168.10.113:48080/bxgApp
UNI_SITE_URL: http://192.168.10.113:48080/bxgApp
ADMIN_API_URL: http://192.168.10.113:48080/bxg

2
zsw-bxg/src/main/java/co/yixiang/enums/OrderInfoEnum.java

@ -25,7 +25,7 @@ public enum OrderInfoEnum {
STATUS_1(1,"待收货"),
STATUS_2(2,"已收货"),
STATUS_3(3,"已完成"),
STATUS_8(3,"已取消"),
STATUS_8(8,"已取消"),
PAY_STATUS_0(0,"未支付"),
PAY_STATUS_1(1,"已支付"),

3
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java

@ -177,7 +177,8 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper,
})
public EvaluationDTO getEvaluationById(Long uid,int id) {
EvaluationDTO evaluationDTO=generator.convert(this.baseMapper.selectById(id), EvaluationDTO.class);
YxStoreProduct yxStoreProduct = yxStoreProductService.getProductInfo(Long.valueOf(evaluationDTO.getProduct()));
// YxStoreProduct yxStoreProduct = yxStoreProductService.getProductInfo(Long.valueOf(evaluationDTO.getProduct()));
YxStoreProduct yxStoreProduct=yxStoreProductService.getById(evaluationDTO.getProduct());
evaluationDTO.setProductInfo(yxStoreProduct);
//是否收藏
boolean isCollect = yxEvaluationRelationService.isEvaluationRelation(id, uid);

60
zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java

@ -29,12 +29,10 @@ import co.yixiang.event.TemplateListenEnum;
import co.yixiang.exception.BadRequestException;
import co.yixiang.exception.EntityExistException;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.activity.domain.YxStoreCombination;
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
import co.yixiang.modules.activity.domain.YxStorePink;
import co.yixiang.modules.activity.service.YxStoreBargainService;
import co.yixiang.modules.activity.service.YxStoreBargainUserService;
import co.yixiang.modules.activity.service.YxStoreCouponUserService;
import co.yixiang.modules.activity.service.YxStorePinkService;
import co.yixiang.modules.activity.service.*;
import co.yixiang.modules.activity.vo.StoreCouponUserVo;
import co.yixiang.modules.cart.domain.YxStoreBrandCart;
import co.yixiang.modules.cart.domain.YxStoreCart;
@ -180,6 +178,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
private StoreOrderMapper yxStoreOrderMapper;
@Autowired
private StoreCartMapper storeCartMapper;
@Autowired
private YxStoreCombinationService yxStoreCombinationService;
@Autowired
@ -576,12 +576,30 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
OrderLogEnum.CREATE_ORDER.getDesc());
//加入redis,30分钟自动取消
// 加入redis,30分钟自动取消
String redisKey = String.valueOf(StrUtil.format("{}{}",
ShopConstants.REDIS_ORDER_OUTTIME_UNPAY, storeOrder.getId()));
stringRedisTemplate.opsForValue().set(redisKey, storeOrder.getOrderId(),
ShopConstants.ORDER_OUTTIME_UNPAY, TimeUnit.MINUTES);
// 这里对拼团订单进行特殊处理(拼团订单不固定为30分钟)
if (combinationId != null && combinationId > 0){ //判断为拼团订单
YxStoreCombination yxStoreCombination=yxStoreCombinationService.getById(combinationId);
// long nd = 1000 * 24 * 60 * 60;
// long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
long outTime=ShopConstants.ORDER_OUTTIME_UNPAY*2*yxStoreCombination.getEffectiveTime();//拼团订单时间
long endTime=yxStoreCombination.getStopTime().getTime()-new Date().getTime();
long endTimeMin=endTime % nm;
if (outTime<endTimeMin){ //开团的时效小于拼团的截至时间
stringRedisTemplate.opsForValue().set(redisKey, storeOrder.getOrderId(),
outTime,TimeUnit.MINUTES);
}else {
stringRedisTemplate.opsForValue().set(redisKey, storeOrder.getOrderId(),
endTimeMin,TimeUnit.MINUTES);
}
}else {
stringRedisTemplate.opsForValue().set(redisKey, storeOrder.getOrderId(),
ShopConstants.ORDER_OUTTIME_UNPAY, TimeUnit.MINUTES);
}
//使用MQ延时消息
// TemplateBean templateBean = TemplateBean.builder()
// .orderId(storeOrder.getId()+"")
@ -1179,7 +1197,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
.eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue());
break;
case STATUS_8:
case STATUS_8://已取消订单
wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue())
.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
.eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_8.getValue());
@ -1188,7 +1206,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
case STATUS_1:
wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
.eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue());
.between(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue(),OrderInfoEnum.STATUS_5.getValue()); //待审核/代发货都为代发货
break;
//待收货
case STATUS_2:
@ -1402,7 +1420,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
}
wrapperThree.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
.eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue());
.between(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue(),OrderInfoEnum.STATUS_5.getValue());
// .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue());
Long unshippedCount = yxStoreOrderMapper.selectCount(wrapperThree);
//订单待收货 数量
@ -1483,8 +1502,23 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
StatusDto statusDTO = new StatusDto();
if (OrderStatusEnum.STATUS_0.getValue().equals(order.getPaid())) {
//计算未支付到自动取消订 时间
int offset = Integer.valueOf(String.valueOf(ShopConstants.ORDER_OUTTIME_UNPAY));
//计算未支付到自动取消订单时间
int offset;
if (order.getCombinationId() != null && order.getCombinationId() > 0){ //判断为拼团订单
YxStoreCombination yxStoreCombination=yxStoreCombinationService.getById(order.getCombinationId());
long nm = 1000 * 60;
long outTime=ShopConstants.ORDER_OUTTIME_UNPAY*2*yxStoreCombination.getEffectiveTime();//拼团的团的成团时效
long endTime=yxStoreCombination.getStopTime().getTime()-order.getCreateTime().getTime();
long endTimeMin=endTime % nm;
if (outTime<endTimeMin){ //开团的时效小于拼团的截至时间
offset=Integer.valueOf(String.valueOf(outTime));
}else {
offset=Integer.valueOf(String.valueOf(endTimeMin));
}
}else {
offset = Integer.valueOf(String.valueOf(ShopConstants.ORDER_OUTTIME_UNPAY));//普通订单30分钟
}
// int offset = Integer.valueOf(String.valueOf(ShopConstants.ORDER_OUTTIME_UNPAY));
Date time = DateUtil.offsetMinute(order.getCreateTime(), offset);
statusDTO.set_class("nobuy");
statusDTO.set_msg(StrUtil.format("请在{}前完成支付", DateUtil.formatDateTime(time)));
@ -1500,7 +1534,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
statusDTO.set_msg("已为您退款,感谢您的支持");
statusDTO.set_type("-2");
statusDTO.set_title("已退款");
} else if (OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())) {
} else if (OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())|OrderInfoEnum.STATUS_5.getValue().equals(order.getStatus())) {
// 拼团
if (order.getPinkId() > 0) {
if (pinkService.pinkIngCount(order.getPinkId()) > 0) {

Loading…
Cancel
Save