|
|
|
@ -84,6 +84,7 @@ import co.yixiang.tools.service.AlipayConfigService;
|
|
|
|
|
import co.yixiang.utils.FileUtil; |
|
|
|
|
import co.yixiang.utils.OrderUtil; |
|
|
|
|
import co.yixiang.utils.RedisUtils; |
|
|
|
|
import co.yixiang.utils.StringUtils; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
@ -518,6 +519,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
storeOrder.setPinkId(Long.valueOf(param.getPinkId())); |
|
|
|
|
storeOrder.setSeckillId(seckillId); |
|
|
|
|
storeOrder.setBargainId(bargainId); |
|
|
|
|
storeOrder.setUserDel(0); //用户可见
|
|
|
|
|
storeOrder.setCost(cacheDTO.getPriceGroup().getCostPrice()); |
|
|
|
|
if (AppFromEnum.ROUNTINE.getValue().equals(param.getFrom())) { |
|
|
|
|
storeOrder.setIsChannel(OrderInfoEnum.PAY_CHANNEL_1.getValue()); |
|
|
|
@ -589,7 +591,6 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
// .build();
|
|
|
|
|
// publisher.publishEvent(new TemplateEvent(this,templateBean));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return storeOrder; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -741,6 +742,21 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 订单审核 |
|
|
|
|
* @param orderId 订单号 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void orderCheck(String orderId) { |
|
|
|
|
if (StringUtils.isEmpty(orderId)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
YxStoreOrder storeOrder=yxStoreOrderService.lambdaQuery() |
|
|
|
|
.eq(YxStoreOrder::getOrderId,orderId).one(); |
|
|
|
|
storeOrder.setStatus(OrderInfoEnum.STATUS_5.getValue()); |
|
|
|
|
yxStoreOrderService.update(storeOrder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 订单发货 |
|
|
|
@ -757,7 +773,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!OrderInfoEnum.STATUS_0.getValue().equals(orderQueryVo.getStatus()) || |
|
|
|
|
if (!OrderInfoEnum.STATUS_5.getValue().equals(orderQueryVo.getStatus()) || |
|
|
|
|
OrderInfoEnum.PAY_STATUS_0.getValue().equals(orderQueryVo.getPaid())) { |
|
|
|
|
throw new YshopException("订单状态错误"); |
|
|
|
|
} |
|
|
|
@ -908,6 +924,28 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 用户删除订单(仅用户自己不可见) |
|
|
|
|
* |
|
|
|
|
* @param orderId 订单号 |
|
|
|
|
* @param uid 用户id |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void deleteOrder(String orderId, Long uid) { |
|
|
|
|
YxStoreOrderQueryVo order = this.getOrderInfo(orderId, uid); |
|
|
|
|
if (ObjectUtil.isNull(order)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
//更新订单状态
|
|
|
|
|
LambdaQueryWrapper<YxStoreOrder> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(YxStoreOrder::getOrderId, orderId); |
|
|
|
|
YxStoreOrder storeOrder = new YxStoreOrder(); |
|
|
|
|
storeOrder.setUserDel(OrderStatusEnum.STATUS_1.getValue());//仅把user_del变为1
|
|
|
|
|
yxStoreOrderMapper.update(storeOrder, wrapper); |
|
|
|
|
// yxStoreOrderMapper.deleteById(order.getId());
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 未付款取消订单 |
|
|
|
|
* |
|
|
|
@ -1126,6 +1164,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
@Override |
|
|
|
|
public Map<String, Object> orderList(Long uid, int type, int page, int limit) { |
|
|
|
|
LambdaQueryWrapper<YxStoreOrder> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(YxStoreOrder::getUserDel,0);//用户删除后则用户不可见
|
|
|
|
|
if (uid != null) { |
|
|
|
|
wrapper.eq(YxStoreOrder::getUid, uid); |
|
|
|
|
} |
|
|
|
@ -1401,8 +1440,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
if (uid != null) { |
|
|
|
|
wrapperSeven.eq(YxStoreOrder::getUid, uid); |
|
|
|
|
} |
|
|
|
|
String[] strArr = {"1", "2"}; |
|
|
|
|
String[] strArr = {"0", "1"}; |
|
|
|
|
wrapperSeven.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) |
|
|
|
|
.eq(YxStoreOrder::getCombinationId,0) |
|
|
|
|
.in(YxStoreOrder::getRefundStatus, Arrays.asList(strArr)); |
|
|
|
|
Long refundCount = yxStoreOrderMapper.selectCount(wrapperSeven); |
|
|
|
|
|
|
|
|
@ -1707,6 +1747,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 奖励积分 |
|
|
|
|
* |
|
|
|
@ -2293,6 +2334,83 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
this.regressionCoupon(order, 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Map<String, Object> queryManyType(String[] typeList, Pageable pageable,YxStoreOrderQueryCriteria criteria) { |
|
|
|
|
LambdaQueryWrapper<YxStoreOrder> queryWrapper =new LambdaQueryWrapper<>(); |
|
|
|
|
if(StringUtils.isNotBlank(criteria.getOrderId())){ |
|
|
|
|
queryWrapper.and(wrapper->{ |
|
|
|
|
wrapper.like(YxStoreOrder::getOrderId,criteria.getOrderId()); |
|
|
|
|
}); |
|
|
|
|
// queryWrapper.like(YxStoreOrder::getOrderId,criteria.getOrderId());
|
|
|
|
|
} |
|
|
|
|
if(StringUtils.isNotBlank(criteria.getUserPhone())){ |
|
|
|
|
queryWrapper.and(wrapper->{ |
|
|
|
|
wrapper.like(YxStoreOrder::getUserPhone,criteria.getUserPhone()); |
|
|
|
|
}); |
|
|
|
|
// queryWrapper.like(YxStoreOrder::getUserPhone,criteria.getUserPhone());
|
|
|
|
|
} |
|
|
|
|
if(StringUtils.isNotBlank(criteria.getUserAddress())){ |
|
|
|
|
queryWrapper.like(YxStoreOrder::getUserAddress,criteria.getUserAddress()); |
|
|
|
|
} |
|
|
|
|
for (String orderType:typeList){ |
|
|
|
|
switch (orderType) { |
|
|
|
|
case "1": //普通
|
|
|
|
|
// criteria.setBargainId(0);
|
|
|
|
|
// criteria.setCombinationId(0);
|
|
|
|
|
// criteria.setSeckillId(0);
|
|
|
|
|
queryWrapper .or((wrapper)->{ |
|
|
|
|
wrapper.eq(YxStoreOrder::getBargainId,0) |
|
|
|
|
.eq(YxStoreOrder::getCombinationId,0) |
|
|
|
|
.eq(YxStoreOrder::getSeckillId,0); |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
case "2": //拼团
|
|
|
|
|
// criteria.setNewCombinationId(0);
|
|
|
|
|
queryWrapper.or((wrapper)->{ |
|
|
|
|
wrapper.ne(YxStoreOrder::getCombinationId,0); |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
case "3": //秒杀
|
|
|
|
|
// criteria.setNewSeckillId(0);
|
|
|
|
|
queryWrapper.or((wrapper)->{ |
|
|
|
|
wrapper.ne(YxStoreOrder::getSeckillId,0); |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
case "4": //砍价
|
|
|
|
|
// criteria.setNewBargainId(0);
|
|
|
|
|
queryWrapper.or((wrapper)->{ |
|
|
|
|
wrapper.ne(YxStoreOrder::getBargainId,0); |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
case "5": //核销
|
|
|
|
|
// criteria.setShippingType(2);
|
|
|
|
|
queryWrapper.or((wrapper)->{ |
|
|
|
|
wrapper.ne(YxStoreOrder::getShippingType,2); |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
case "6": //积分
|
|
|
|
|
// criteria.setPayIntegral(new BigDecimal("0.00"));
|
|
|
|
|
queryWrapper.or((wrapper)->{ |
|
|
|
|
wrapper.gt(YxStoreOrder::getPayIntegral,new BigDecimal("0.00")); |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
getPage(pageable); |
|
|
|
|
PageInfo<YxStoreOrder> page = new PageInfo<>(storeOrderMapper.selectList(queryWrapper)); |
|
|
|
|
List<YxStoreOrderDto> storeOrderDTOS = new ArrayList<>(); |
|
|
|
|
for (YxStoreOrder yxStoreOrder : page.getList()) { |
|
|
|
|
this.orderList(storeOrderDTOS, yxStoreOrder); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
Map<String, Object> map = new LinkedHashMap<>(2); |
|
|
|
|
map.put("content", storeOrderDTOS); |
|
|
|
|
map.put("totalElements", page.getTotal()); |
|
|
|
|
return map; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Map<String, Object> queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable) { |
|
|
|
|
getPage(pageable); |
|
|
|
|