feat:修改评论状态

This commit is contained in:
luluyuyu 2024-12-06 19:37:23 +08:00
parent eb59f37688
commit 12ad90cbe8

View file

@ -140,7 +140,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
List<String> normsIdList = orderItemList.stream().map(OrderItem::getNormsId).collect(Collectors.toList());
List<Map<String, Object>> normsListMap = iShopMaterialNormsService.queryShopMaterialByNormsIdList(Joiner.on(CommonCharConstants.COMMA_MARK).join(normsIdList));
Map<String, String> normsPriceMap = normsListMap.stream()
.collect(Collectors.toMap(map -> map.get("normsId").toString(), map -> map.get("salePrice").toString()));
.collect(Collectors.toMap(map -> map.get("normsId").toString(), map -> map.get("salePrice").toString()));
for (OrderItem orderItem : orderItemList) {// 计算每一个子单的总价
if (!normsPriceMap.containsKey(orderItem.getNormsId())) {
throw new CustomException("商城不存在normsId: " + orderItem.getNormsId());
@ -192,7 +192,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
setOrderAndOrderItem(couponUse, order, orderItem);// 操作订单和子单的优惠券
} else if (Objects.equals(couponUse.getProductScope(), PromotionMaterialScope.SPU.getKey())) {// 指定商品
List<String> couponUseMaterialIds = couponUseMaterialService.queryListByCouponIds(Collections.singletonList(couponUseId))
.stream().map(CouponUseMaterial::getMaterialId).collect(Collectors.toList());// 收集子单商品id
.stream().map(CouponUseMaterial::getMaterialId).collect(Collectors.toList());// 收集子单商品id
List<OrderItem> newOrderItemList = new ArrayList<>();
for (OrderItem item : orderItemList) {// 筛选出优惠券可用的商品
if (couponUseMaterialIds.contains(item.getMaterialId())) {
@ -283,33 +283,35 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
break;
case "2": // 待收货
stateList = Arrays.asList(new Integer[]{
ShopOrderState.UNDELIVERED.getKey(),// 待发货
ShopOrderState.DELIVERED.getKey(), // 已发货
ShopOrderState.TRANSPORTING.getKey()});//运输中
ShopOrderState.UNDELIVERED.getKey(),// 待发货
ShopOrderState.DELIVERED.getKey(), // 已发货
ShopOrderState.TRANSPORTING.getKey()});//运输中
break;
case "3":// 已完成
stateList = Arrays.asList(new Integer[]{
ShopOrderState.SIGN.getKey(), // 已签收
ShopOrderState.COMPLETED.getKey(), // 已完成
ShopOrderState.UNEVALUATE.getKey(), // 待评价
ShopOrderState.EVALUATED.getKey()});// 已评价
ShopOrderState.SIGN.getKey(), // 已签收
ShopOrderState.COMPLETED.getKey(), // 已完成
ShopOrderState.UNEVALUATE.getKey(), // 待评价
ShopOrderState.EVALUATED.getKey(),// 已评价
ShopOrderState.PARTIALLYDONE.getKey(),//部分完成
ShopOrderState.PARTIALEVALUATION.getKey()});//部分评价
break;
case "4":// 已取消
stateList = Arrays.asList(new Integer[]{ShopOrderState.CANCELED.getKey()});
break;
case "5":// 处理中
stateList = Arrays.asList(new Integer[]{
ShopOrderState.REFUNDING.getKey(), // 退款中
ShopOrderState.REFUNDING.getKey(), // 退款中
ShopOrderState.SALESRETURNING.getKey(),//退货中
ShopOrderState.SALESRETURNING.getKey(),//退货中
ShopOrderState.EXCHANGEING.getKey()});//换货中
ShopOrderState.EXCHANGEING.getKey()});//换货中
break;
case "6": // 申请记录
stateList = Arrays.asList(new Integer[]{
ShopOrderState.REFUND.getKey(), // 已退款
ShopOrderState.SALESRETURNED.getKey(),//已退货
ShopOrderState.EXCHANGED.getKey()});//已换货
ShopOrderState.REFUND.getKey(), // 已退款
ShopOrderState.SALESRETURNED.getKey(),//已退货
ShopOrderState.EXCHANGED.getKey()});//已换货
}
QueryWrapper<Order> wrapper = super.getQueryWrapper(commonPageInfo);
if (CollectionUtil.isNotEmpty(stateList)) { // 状态列表为空时则查询全部订单
@ -346,32 +348,33 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
break;
case "2": // 待收货
stateList = Arrays.asList(new Integer[]{
ShopOrderState.UNDELIVERED.getKey(),// 待发货
ShopOrderState.DELIVERED.getKey(), // 已发货
ShopOrderState.TRANSPORTING.getKey()});//运输中
ShopOrderState.UNDELIVERED.getKey(),// 待发货
ShopOrderState.DELIVERED.getKey(), // 已发货
ShopOrderState.TRANSPORTING.getKey()});//运输中
break;
case "3":// 已完成
stateList = Arrays.asList(new Integer[]{
ShopOrderState.SIGN.getKey(), // 已签收
ShopOrderState.COMPLETED.getKey(), // 已完成
ShopOrderState.UNEVALUATE.getKey(), // 待评价
ShopOrderState.EVALUATED.getKey()});// 已评价
ShopOrderState.PARTIALLYDONE.getKey();//部分完成
ShopOrderState.SIGN.getKey(), // 已签收
ShopOrderState.COMPLETED.getKey(), // 已完成
ShopOrderState.UNEVALUATE.getKey(), // 待评价
ShopOrderState.EVALUATED.getKey(),// 已评价
ShopOrderState.PARTIALLYDONE.getKey(),//部分完成
ShopOrderState.PARTIALEVALUATION.getKey()});//部分评价
break;
case "4":// 已取消
stateList = Arrays.asList(new Integer[]{ShopOrderState.CANCELED.getKey()});
break;
case "5":// 处理中
stateList = Arrays.asList(new Integer[]{
ShopOrderState.REFUNDING.getKey(), // 退款中
ShopOrderState.SALESRETURNING.getKey(),//退货中
ShopOrderState.EXCHANGEING.getKey()});//换货中
ShopOrderState.REFUNDING.getKey(), // 退款中
ShopOrderState.SALESRETURNING.getKey(),//退货中
ShopOrderState.EXCHANGEING.getKey()});//换货中
break;
case "6": // 申请记录
stateList = Arrays.asList(new Integer[]{
ShopOrderState.REFUND.getKey(), // 已退款
ShopOrderState.SALESRETURNED.getKey(),//已退货
ShopOrderState.EXCHANGED.getKey()});//已换货
ShopOrderState.REFUND.getKey(), // 已退款
ShopOrderState.SALESRETURNED.getKey(),//已退货
ShopOrderState.EXCHANGED.getKey()});//已换货
}
QueryWrapper<Order> wrapper = new QueryWrapper<>();
if (CollectionUtil.isNotEmpty(stateList)) { // 状态列表为空时则查询全部订单
@ -480,9 +483,9 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
}
// 可取消的订单状态未提交(0)已提交(1)待支付(2)待发货(5)
if (Objects.equals(one.getState(), ShopOrderState.UNSUBMIT.getKey()) ||
Objects.equals(one.getState(), ShopOrderState.SUBMIT.getKey()) ||
Objects.equals(one.getState(), ShopOrderState.UNPAID.getKey()) ||
Objects.equals(one.getState(), ShopOrderState.UNDELIVERED.getKey())) {
Objects.equals(one.getState(), ShopOrderState.SUBMIT.getKey()) ||
Objects.equals(one.getState(), ShopOrderState.UNPAID.getKey()) ||
Objects.equals(one.getState(), ShopOrderState.UNDELIVERED.getKey())) {
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getState), ShopOrderState.CANCELED.getKey());
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getCancelType), params.get("cancelType"));
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getCancelTime), DateUtil.getTimeAndToString());
@ -537,7 +540,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getPayTime), payOrderRespDTO.get("successTime").toString());
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getChannelFeeRate), payChannel.get("feeRate").toString());
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getChannelFeePrice), CalculationUtil.multiply(
one.getPayPrice(), payChannel.get("feeRate").toString()));
one.getPayPrice(), payChannel.get("feeRate").toString()));
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getExtensionId), payOrderRespDTO.get("id").toString());
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getExtensionNo), payOrderRespDTO.get("no").toString());
update(updateWrapper);
@ -594,8 +597,8 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq(CommonConstants.ID, orderId);
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getState), ShopOrderState.CANCELED.getKey())
.set(MybatisPlusUtil.toColumns(Order::getCancelType), ShopOrderCancelType.PAY_TIMEOUT.getKey())
.set(MybatisPlusUtil.toColumns(Order::getCancelTime), DateUtil.getTimeAndToString());
.set(MybatisPlusUtil.toColumns(Order::getCancelType), ShopOrderCancelType.PAY_TIMEOUT.getKey())
.set(MybatisPlusUtil.toColumns(Order::getCancelTime), DateUtil.getTimeAndToString());
update(updateWrapper);
refreshCache(orderId);
}
@ -608,7 +611,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
orderItemService.UpdateOrderItemState(orderItemId);
List<OrderItem> orderItemList = orderItemService.queryOrderItemByParentId(orderId);
boolean allTwo = orderItemList.stream().map(OrderItem::getOrderItemState)
.allMatch(orderItemState -> orderItemState == CommonNumConstants.NUM_TWO);
.allMatch(orderItemState -> orderItemState == CommonNumConstants.NUM_TWO);
if (allTwo) {
Integer partiallydoneKey = ShopOrderState.COMPLETED.getKey();
updateOrderState(orderId, partiallydoneKey);