From a8b490d601759566e8f7c921d856b668eb2345ee Mon Sep 17 00:00:00 2001
From: gongzuming <gongzuming>
Date: 星期二, 08 十月 2024 13:50:36 +0800
Subject: [PATCH] 注释微信发货代码
---
src/main/java/com/mzl/flower/service/payment/OrderService.java | 49 +++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 43 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/mzl/flower/service/payment/OrderService.java b/src/main/java/com/mzl/flower/service/payment/OrderService.java
index e1aebd0..3bdc188 100644
--- a/src/main/java/com/mzl/flower/service/payment/OrderService.java
+++ b/src/main/java/com/mzl/flower/service/payment/OrderService.java
@@ -12,8 +12,10 @@
import com.mzl.flower.config.security.SecurityUtils;
import com.mzl.flower.constant.Constants;
import com.mzl.flower.dto.PriceDTO;
+import com.mzl.flower.dto.request.comment.QueryFlowerCommentDTO;
import com.mzl.flower.dto.request.menber.MemberGrowthRecordDTO;
import com.mzl.flower.dto.request.payment.*;
+import com.mzl.flower.dto.response.comment.FlowerCommentVO;
import com.mzl.flower.dto.response.coupon.CouponRecordVO;
import com.mzl.flower.dto.response.flower.FlowerCartListDTO;
import com.mzl.flower.dto.response.flower.FlowerCartListWrapDTO;
@@ -43,6 +45,7 @@
import com.mzl.flower.mapper.system.UserWechatMapper;
import com.mzl.flower.mapper.warehouse.WarehouseLocationMapper;
import com.mzl.flower.service.BaseService;
+import com.mzl.flower.service.comment.FlowerCommentService;
import com.mzl.flower.service.coupon.CouponRecordService;
import com.mzl.flower.service.flower.FlowerService;
import com.mzl.flower.service.menber.MemberGrowthRecordService;
@@ -164,6 +167,9 @@
@Autowired
private CouponRecordService couponRecordService;
+ @Autowired
+ private FlowerCommentService flowerCommentService;
+
public void changeFlower2Cart(CartSaveDTO dto) {
String userId = SecurityUtils.getUserId();
@@ -196,7 +202,7 @@
Integer completeNumToday=getFlowerCompleteNumToday(userId,c.getFlowerId());
Integer tmp=completeNumToday+c.getNum();
if(null!=tmp && null!=flowerDetail.getLimited()
- && tmp.compareTo(flowerDetail.getLimited())>0){
+ && tmp.compareTo(flowerDetail.getLimited())>0){
throw new ValidationException("当天的订单的花数量加上购物车的数量不能超过限售数量!");
}
@@ -208,7 +214,7 @@
// 限购 1.首先查看购物车中的数量是否已经超过限售数量
if(null!=c.getNum() && null!=flowerDetail.getLimited()
- && c.getNum().compareTo(flowerDetail.getLimited())>0){
+ && c.getNum().compareTo(flowerDetail.getLimited())>0){
throw new ValidationException("数量不能超过限售数量!");
}
@@ -216,7 +222,7 @@
Integer completeNumToday=getFlowerCompleteNumToday(userId,c.getFlowerId());
Integer tmp=completeNumToday+c.getNum();
if(null!=tmp && null!=flowerDetail.getLimited()
- && tmp.compareTo(flowerDetail.getLimited())>0){
+ && tmp.compareTo(flowerDetail.getLimited())>0){
throw new ValidationException("当天的订单的花数量加上购物车的数量不能超过限售数量!");
}
@@ -769,6 +775,7 @@
if(orders == null || orders.size() == 0){
return;
}
+ /*
for (Order o : orders) {
//set status_backend = 'RECEIVE', status = 'RECEIVE'
o.setStatusBackend("RECEIVE");
@@ -785,7 +792,8 @@
orderMapper.updateById(o);
}
- //orderMapper.setPartnerOrderReceive();
+ */
+ orderMapper.setPartnerOrderReceive();
}
/**
@@ -806,6 +814,7 @@
o.setStatusBackend(Constants.ORDER_STATUS_BACKEND.RECEIVE.name());
o.update(SecurityUtils.getUserId());
+ /*
//发送微信发货请求
JSONObject jsonObject = sendWxDeliveryGood(o);
if (jsonObject != null && (int) jsonObject.get("errcode") == 0) {
@@ -815,7 +824,7 @@
o.setWxDeliveryGood(false);
o.setWxDeliveryMsg(GsonUtil.toJson(jsonObject));
}
-
+ */
orderMapper.updateById(o);
}
@@ -1135,6 +1144,7 @@
new QueryWrapper<OrderItem>().eq("order_id", id));
Map<Long, String> stationMap = prepareStationMap();
+ Map<String, FlowerCommentVO> commentMap=prepareCommentMap(id);
List<OrderItemListDTO> result = new ArrayList<>();
for (OrderItem oi : ls) {
@@ -1143,10 +1153,35 @@
dto.setStationName(stationMap.get(oi.getStationId()));
+ // 评论
+ final FlowerCommentVO flowerCommentVO = commentMap.get(oi.getId());
+ copyCommentInfo(dto,flowerCommentVO);
+
result.add(dto);
}
return result;
+ }
+
+ private Map<String, FlowerCommentVO> prepareCommentMap(String orderId) {
+ QueryFlowerCommentDTO queryFlowerCommentDTO = new QueryFlowerCommentDTO();
+ queryFlowerCommentDTO.setOrderId(orderId);
+ final List<FlowerCommentVO> list = flowerCommentService.getList(queryFlowerCommentDTO);
+ if (list == null || list.isEmpty()) {
+ return Collections.emptyMap();
+ }
+ // 将 List 转换为 Map,其中 key 为 FlowerCommentVO 的 id
+ return list.stream().collect(Collectors.toMap(FlowerCommentVO::getOrderItemId, item -> item));
+ }
+
+
+ private void copyCommentInfo(OrderItemListDTO dto,FlowerCommentVO flowerCommentVO){
+ if(null != dto && null!=flowerCommentVO){
+ dto.setCommentGrade(flowerCommentVO.getCommentGrade());
+ dto.setComment(flowerCommentVO.getComment());
+ dto.setCommentImages(flowerCommentVO.getCommentImages());
+ dto.setAnonymityFalg(flowerCommentVO.getAnonymityFalg());
+ }
}
public List<Order> autoReceive() {
@@ -1203,6 +1238,7 @@
customerPointService.consumptionPoint(totalAmount, o.getOrderNo(), o.getCreateBy());
}
+ /*
public JSONObject sendWxDeliveryGood(Order o) {
JSONObject json = new JSONObject();
List<OrderItem> items = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItem>()
@@ -1241,6 +1277,7 @@
return json;
}
}
+ */
public Order confirmOrderReceive(String id) {
Order o = orderMapper.selectById(id);
@@ -1678,7 +1715,7 @@
// 新增
cartMapper.updateById(cart);
}else{
- // 更新
+ // 更新
cartMapper.insert(cart);
}
}
--
Gitblit v1.9.3