jyy
2021-06-12 393d296e43f0e5f11e524cab5446bcd3eee94e89
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderDingDingNoticeTask.java
@@ -7,10 +7,11 @@
import com.matrix.system.common.bean.BusParameterSettings;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.system.hive.dao.SysVipInfoDao;
import com.matrix.system.shopXcx.bean.ShopDeliveryInfo;
import com.matrix.system.shopXcx.bean.ShopOrder;
import com.matrix.system.shopXcx.bean.ShopOrderDetails;
import com.matrix.system.shopXcx.dao.ShopDeliveryInfoDao;
import com.matrix.system.shopXcx.dao.ShopOrderDao;
import com.matrix.system.shopXcx.dao.ShopOrderDetailsDao;
import com.rabbitmq.client.DeliverCallback;
@@ -41,11 +42,15 @@
    @Autowired
    SysVipInfoDao sysVipInfoDao;
    @Autowired
    ShopDeliveryInfoDao shopDeliveryInfoDao;
    @Override
    public void handle(String consumerTag, Delivery message) throws IOException {
        String orderId = new String(message.getBody(), "UTF-8");
        String orderIdStr = new String(message.getBody(), "UTF-8");
        Integer orderId=Integer.valueOf(orderIdStr);
        //获取订单信息
        ShopOrder order = shopOrderDao.selectById(Integer.valueOf(orderId));
        ShopOrder order = shopOrderDao.selectById(orderId);
        LogUtil.debug("收到创建订单通知任务orderId={}", orderId);
        BusParameterSettings wxOrderNoticeDingdingToken = parameterSettingsDao.selectCompanyParamByCode(AppConstance.WX_ORDER_NOTICE_DINGDING_TOKEN, order.getCompanyId());
        if (wxOrderNoticeDingdingToken != null && StringUtils.isNotBlank(wxOrderNoticeDingdingToken.getParamValue())) {
@@ -54,8 +59,19 @@
            StringBuilder content = new StringBuilder();
            orderDetails.stream().forEach(i -> content.append(i.getsTitle()).append("*").append(
                    i.getCount()).append(";"));
            ShopDeliveryInfo addInfo = shopDeliveryInfoDao.selectByOrderId(orderId);
            DingDingRobotUtil.sendText(wxOrderNoticeDingdingToken.getParamValue(),"微商城订单 ("+order.getUserName()+") | 订单金额:¥"+order.getOrderMoney()+",订单内容:"+ content.toString(),"");
            String shippingMethod="物流配送";
            if(AppConstance.SHIPPING_METHOD_SELF .equals(order.getShippingMethod())){
                shippingMethod="门店自提";
            }
            DingDingRobotUtil.sendText(wxOrderNoticeDingdingToken.getParamValue(),
                    "新订单,微商城订单编号 "+order.getOrderNo()
                            +"; 订单金额:¥"+order.getOrderMoney()
                            +";订单内容:"+ content.toString()
                            +";收货电话:"+ order.getUserTel()+",收货人:"+ order.getUserName()+",收货地址:"+ addInfo.getReceiveAddress()
                        +"配送方式:"+shippingMethod
                    ,"");
        }else{
            LogUtil.debug("未配置订单钉钉提醒");
        }