From 5a172022077bd2df438d2ef6409c4061b141e116 Mon Sep 17 00:00:00 2001
From: yanghui <2536613402@qq.com>
Date: 星期二, 06 十二月 2022 14:43:36 +0800
Subject: [PATCH] #feat 销量的问题
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopFlowerOrderServiceImpl.java | 42 ++++++++++++++++++++++++++++++------------
1 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopFlowerOrderServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopFlowerOrderServiceImpl.java
index d3849f7..890219e 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopFlowerOrderServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopFlowerOrderServiceImpl.java
@@ -3,6 +3,7 @@
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
+import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
@@ -21,12 +22,14 @@
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.*;
import com.panzhihua.common.utlis.wx.WXPayUtil;
+import com.panzhihua.service_community.config.RabbitmqConfig;
import com.panzhihua.service_community.dao.*;
import com.panzhihua.service_community.model.dos.*;
import com.panzhihua.service_community.service.ComShopFlowerOrderService;
import com.panzhihua.service_community.util.WxMaConfiguration;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -81,6 +84,8 @@
private WxMaConfiguration wxMaConfiguration;
@Resource
private UserService userService;
+ @Resource
+ private RabbitTemplate rabbitTemplate;
@Value("${hcMin.app.isTest}")
@@ -336,6 +341,12 @@
} catch (Exception e) {
log.error("调用微信支付异常,异常原因:" + e.getMessage());
}
+ //发送消息到mq
+ rabbitTemplate.convertAndSend("huacheng.shop.order.exchange", "huacheng.shop.order.key", shopOrderVO, message -> {
+ //30分钟后
+ message.getMessageProperties().setHeader("x-delay", 1800*1000);
+ return message;
+ });
return R.ok(shopOrderVO);
}
@@ -360,10 +371,10 @@
ComShopFlowerOrderGoodsVO orderGoodsVO = new ComShopFlowerOrderGoodsVO();
BeanUtils.copyProperties(orderGoods, orderGoodsVO);
// 根据商品规格id查询商品规格
- ComShopFlowerGoodsAttrDO goodsAttrDO = comShopFlowerGoodsAttrDAO.selectById(orderGoods.getGoodsAttrId());
- if (goodsAttrDO != null) {
- orderGoodsVO.setGoodsAttr(goodsAttrDO.getGoodsAttrName());
- }
+// ComShopFlowerGoodsAttrDO goodsAttrDO = comShopFlowerGoodsAttrDAO.selectById(orderGoods.getGoodsAttrId());
+// if (goodsAttrDO != null) {
+ orderGoodsVO.setGoodsAttr(orderGoods.getGoodsAttrName());
+// }
orderGoodsVO.setNum(orderGoods.getAmount());
orderGoodsVO.setGoodsPic(orderGoods.getGoodsAttrPic());
orderGoodsVO.setPrice(orderGoods.getGoodsAttrPrice());
@@ -461,7 +472,7 @@
orderGoodsVO.setGoodsPic(orderGoods.getGoodsAttrPic());
orderGoodsVO.setPrice(orderGoods.getGoodsAttrPrice());
// 查询商品信息判断商品状态
- ComShopFlowerGoodsDO goodsDO = comShopFlowerGoodsDAO.selectById(orderGoods.getGoodsId());
+ /* ComShopFlowerGoodsDO goodsDO = comShopFlowerGoodsDAO.selectById(orderGoods.getGoodsId());
if (goodsDO == null || goodsDO.getDeleteStatus().equals(ComShopFlowerGoodsDO.deleteStatus.yes)
|| goodsDO.getDeleteStatus().equals(ComShopFlowerGoodsDO.status.recovery)) {
orderGoodsVO.setGoodsStatus(ComShopFlowerOrderGoodsVO.goodsStatus.ysc);
@@ -469,13 +480,11 @@
orderGoodsVO.setGoodsStatus(ComShopFlowerOrderGoodsVO.goodsStatus.yxj);
} else if (goodsDO.getStatus().equals(ComShopFlowerGoodsDO.status.sell)) {
orderGoodsVO.setGoodsStatus(ComShopFlowerOrderGoodsVO.goodsStatus.csz);
- }
+ }*/
// 根据商品规格id查询商品规格
- ComShopFlowerGoodsAttrDO goodsAttrDO = comShopFlowerGoodsAttrDAO.selectById(orderGoods.getGoodsAttrId());
- if (goodsAttrDO != null) {
- orderGoodsVO.setGoodsAttr(goodsAttrDO.getGoodsAttrName());
- }
+// ComShopFlowerGoodsAttrDO goodsAttrDO = comShopFlowerGoodsAttrDAO.selectById(orderGoods.getGoodsAttrId());
+ orderGoodsVO.setGoodsAttr(orderGoods.getGoodsAttrName());
orderGoodsVOS.add(orderGoodsVO);
sbr.append(orderGoods.getGoodsName()).append(" ");
});
@@ -495,7 +504,7 @@
}
// 操作日志
- List<ComShopFlowerOrderOperateDO> listOperLog =
+/* List<ComShopFlowerOrderOperateDO> listOperLog =
comShopFlowerOrderOperateDAO.selectList(new LambdaQueryWrapper<ComShopFlowerOrderOperateDO>()
.eq(ComShopFlowerOrderOperateDO::getOrderNo, shopOrderDO.getOrderNo()));
List<ComShopFlowerOrderOperateVO> listOperLogVO = new ArrayList<>(listOperLog.size());
@@ -504,7 +513,7 @@
BeanUtils.copyProperties(logDO, copyVO);
listOperLogVO.add(copyVO);
});
- orderVO.setLogs(listOperLogVO);
+ orderVO.setLogs(listOperLogVO);*/
Long pointId = shopOrderDO.getPointId();
if (null != pointId) {
ConvenientElevatingPointDO convenientElevatingPointDO = convenientElevatingPointDAO.selectById(pointId);
@@ -695,6 +704,14 @@
orderOperateDO.setOperationBy("用户");
}
comShopFlowerOrderOperateDAO.insert(orderOperateDO);
+
+ //一个自提订单算一个货
+ if (ComShopFlowerOrderDO.deliveryType.store == shopOrderDO.getDeliveryType()){
+ ConvenientElevatingPointDO convenientElevatingPointDO = convenientElevatingPointDAO.selectById(shopOrderDO.getPointId());
+ convenientElevatingPointDO.setPrepareGoodsNum(convenientElevatingPointDO.getPrepareGoodsNum() - 1);
+ convenientElevatingPointDO.setAlreadyGoodsNum(convenientElevatingPointDO.getAlreadyGoodsNum() + 1);
+ convenientElevatingPointDAO.updateById(convenientElevatingPointDO);
+ }
return R.ok();
} else {
return R.fail("确认收货失败");
@@ -1198,4 +1215,5 @@
comShopFlowerOrderDeliveryNoListVO.setPage(orderPageVOIPage);
return R.ok(comShopFlowerOrderDeliveryNoListVO);
}
+
}
--
Gitblit v1.7.1