|
@@ -127,51 +127,51 @@ public class AfterSalesServiceImpl extends ServiceImpl<AfterSalesMapper, AfterSa
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public void submit(AfterSalesRequest request) {
|
|
public void submit(AfterSalesRequest request) {
|
|
- Order order = orderService.getById(request.getOrderId());
|
|
|
|
- Assert.notNull(order, "订单数据不存在");
|
|
|
|
|
|
+ Order order = orderService.getById(request.getOrderId());
|
|
|
|
+ Assert.notNull(order, "订单数据不存在");
|
|
|
|
|
|
- order.setIsAftersales(YesOrNoEnum.YES.getValue());
|
|
|
|
- orderService.updateById(order);
|
|
|
|
|
|
+ order.setIsAftersales(YesOrNoEnum.YES.getValue());
|
|
|
|
+ orderService.updateById(order);
|
|
// OrderGroupon orderGroupon = orderGrouponService.lambdaQuery().eq(OrderGroupon::getOrderId, request.getOrderId()).one();
|
|
// OrderGroupon orderGroupon = orderGrouponService.lambdaQuery().eq(OrderGroupon::getOrderId, request.getOrderId()).one();
|
|
// Assert.notNull(orderGroupon, "orderGroupon数据不存在");
|
|
// Assert.notNull(orderGroupon, "orderGroupon数据不存在");
|
|
// Groupon groupon = grouponService.getById(orderGroupon.getGrouponId());
|
|
// Groupon groupon = grouponService.getById(orderGroupon.getGrouponId());
|
|
// Assert.notNull(orderGroupon, "groupon数据不存在");
|
|
// Assert.notNull(orderGroupon, "groupon数据不存在");
|
|
|
|
|
|
- int afterSalesDays = Integer.parseInt(ParamCache.getValueDefault(CacheBizConstant.ORDER_AFTER_SALES_DAYS, "3"));
|
|
|
|
- // 校验是否能申请售后
|
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
|
- calendar.setTime(order.getCreateTime());
|
|
|
|
- calendar.add(Calendar.DAY_OF_MONTH,afterSalesDays);
|
|
|
|
- Date time = calendar.getTime();
|
|
|
|
|
|
+ int afterSalesDays = Integer.parseInt(ParamCache.getValueDefault(CacheBizConstant.ORDER_AFTER_SALES_DAYS, "3"));
|
|
|
|
+ // 校验是否能申请售后
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ calendar.setTime(order.getCreateTime());
|
|
|
|
+ calendar.add(Calendar.DAY_OF_MONTH,afterSalesDays);
|
|
|
|
+ Date time = calendar.getTime();
|
|
// LocalDateTime time = groupon.getTakeStartTime().plusDays(afterSalesDays);
|
|
// LocalDateTime time = groupon.getTakeStartTime().plusDays(afterSalesDays);
|
|
- if (time.compareTo(new Date()) <= 0) {
|
|
|
|
- throw new ServiceException("已过售后期");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 校验商品是否已经申请过售后
|
|
|
|
- List<Long> goodsIds = request.getAfterGoodsList().stream().map(OrderGoods::getGoodsId).collect(Collectors.toList());
|
|
|
|
- List<OrderGoods> list = orderGoodsService.lambdaQuery()
|
|
|
|
- .eq(OrderGoods::getOrderId,request.getOrderId())
|
|
|
|
- .in(OrderGoods::getGoodsId, goodsIds).list();
|
|
|
|
- for (OrderGoods orderGoods : list) {
|
|
|
|
- if (YesOrNoEnum.YES.getValue().equals(orderGoods.getIsAfterSales())) {
|
|
|
|
- throw new ServiceException("商品【"+orderGoods.getGoodsName()+"】已申请过售后");
|
|
|
|
- }
|
|
|
|
- orderGoods.setIsAfterSales(YesOrNoEnum.YES.getValue());
|
|
|
|
- }
|
|
|
|
- // 更新售后状态
|
|
|
|
- orderGoodsService.updateBatchById(list);
|
|
|
|
- AfterSales afterSales = init();
|
|
|
|
- afterSales.setOrderId(request.getOrderId());
|
|
|
|
- afterSales.setType(request.getAfterSalesType());
|
|
|
|
- afterSales.setReason(request.getReason());
|
|
|
|
- afterSales.setReasonId(request.getReasonId());
|
|
|
|
- afterSales.setAfterSaleDescribe(request.getAfterSaleDescribe());
|
|
|
|
- afterSales.setImgListStr(JSON.toJSONString(request.getImages()));
|
|
|
|
- afterSales.setIsArrived(YesOrNoEnum.NO.getValue());
|
|
|
|
- afterSales.setUserId(AuthUtil.getUserId());
|
|
|
|
- afterSales.setReturnGoodsNum(request.getAfterGoodsList().get(0).getRefundGoodsNum());
|
|
|
|
- this.save(afterSales);
|
|
|
|
|
|
+ if (time.compareTo(new Date()) <= 0) {
|
|
|
|
+ throw new ServiceException("已过售后期");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 校验商品是否已经申请过售后
|
|
|
|
+ List<Long> goodsIds = request.getAfterGoodsList().stream().map(OrderGoods::getGoodsId).collect(Collectors.toList());
|
|
|
|
+ List<OrderGoods> list = orderGoodsService.lambdaQuery()
|
|
|
|
+ .eq(OrderGoods::getOrderId,request.getOrderId())
|
|
|
|
+ .in(OrderGoods::getGoodsId, goodsIds).list();
|
|
|
|
+ for (OrderGoods orderGoods : list) {
|
|
|
|
+ if (YesOrNoEnum.YES.getValue().equals(orderGoods.getIsAfterSales())) {
|
|
|
|
+ throw new ServiceException("商品【"+orderGoods.getGoodsName()+"】已申请过售后");
|
|
|
|
+ }
|
|
|
|
+ orderGoods.setIsAfterSales(YesOrNoEnum.YES.getValue());
|
|
|
|
+ }
|
|
|
|
+ // 更新售后状态
|
|
|
|
+ orderGoodsService.updateBatchById(list);
|
|
|
|
+ AfterSales afterSales = init();
|
|
|
|
+ afterSales.setOrderId(request.getOrderId());
|
|
|
|
+ afterSales.setType(request.getAfterSalesType());
|
|
|
|
+ afterSales.setReason(request.getReason());
|
|
|
|
+ afterSales.setReasonId(request.getReasonId());
|
|
|
|
+ afterSales.setAfterSaleDescribe(request.getAfterSaleDescribe());
|
|
|
|
+ afterSales.setImgListStr(JSON.toJSONString(request.getImages()));
|
|
|
|
+ afterSales.setIsArrived(YesOrNoEnum.NO.getValue());
|
|
|
|
+ afterSales.setUserId(AuthUtil.getUserId());
|
|
|
|
+ afterSales.setReturnGoodsNum(request.getAfterGoodsList().get(0).getRefundGoodsNum());
|
|
|
|
+ this.save(afterSales);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|