From b2fce0dc7dc4ea5dec9792a2bc3ceb9d33d6e07b Mon Sep 17 00:00:00 2001 From: lidongdong <1459917685@qq.com> Date: 星期一, 04 九月 2023 13:59:52 +0800 Subject: [PATCH] 修改后台社区动态加载不出来 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopFlowerOrderServiceImpl.java | 49 ++++++++++++++++++++++++++++++++----------------- 1 files changed, 32 insertions(+), 17 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 b24ecbd..89eab55 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; @@ -34,6 +37,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; +import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -81,6 +85,8 @@ private WxMaConfiguration wxMaConfiguration; @Resource private UserService userService; + @Resource + private RabbitTemplate rabbitTemplate; @Value("${hcMin.app.isTest}") @@ -336,6 +342,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 +372,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 +473,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 +481,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 +505,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 +514,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); @@ -697,10 +707,12 @@ comShopFlowerOrderOperateDAO.insert(orderOperateDO); //一个自提订单算一个货 - ConvenientElevatingPointDO convenientElevatingPointDO = convenientElevatingPointDAO.selectById(shopOrderDO.getPointId()); - convenientElevatingPointDO.setPrepareGoodsNum(convenientElevatingPointDO.getPrepareGoodsNum() - 1); - convenientElevatingPointDO.setAlreadyGoodsNum(convenientElevatingPointDO.getAlreadyGoodsNum() + 1); - convenientElevatingPointDAO.updateById(convenientElevatingPointDO); + 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("确认收货失败"); @@ -959,9 +971,11 @@ if (R.isOk(sysUserVOR)) { SysUserVO sysUserVO = JSONObject.parseObject(JSONObject.toJSONString(sysUserVOR.getData()), SysUserVO.class); try { + DecimalFormat df = new DecimalFormat("#.00"); WxUtil.sendNewOrderNotice(sysUserVO.getOpenid(),maService.getAccessToken(),shopOrderDO.getOrderNo(), shopOrderDO.getDeliveryType()==1?"拼单订单":"快递订单",orderGoodsList.get(0).getGoodsName(), - shopOrderDO.getTotalAmount().toString(),DateUtil.format(shopOrderDO.getCreateAt(),"yyyy-MM-dd HH:mm")); + df.format(shopOrderDO.getTotalAmount()), + DateUtil.format(shopOrderDO.getCreateAt(),"yyyy-MM-dd HH:mm")); } catch (WxErrorException e) { e.printStackTrace(); } @@ -1204,4 +1218,5 @@ comShopFlowerOrderDeliveryNoListVO.setPage(orderPageVOIPage); return R.ok(comShopFlowerOrderDeliveryNoListVO); } + } -- Gitblit v1.7.1