jyy
2021-03-09 9c58fa43f71bf2345f18b41620fb1d6dc6aa7796
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java
@@ -3,7 +3,6 @@
import com.matrix.biz.bean.BizUser;
import com.matrix.biz.service.BizUserService;
import com.matrix.core.exception.GlobleException;
import com.matrix.core.tools.LogUtil;
import com.matrix.core.tools.StringUtils;
import com.matrix.system.common.constance.AppConstance;
@@ -82,6 +81,16 @@
    @Transactional(rollbackFor = Exception.class)
    public void createOrder(ShopOrder orderDto) {
        //判断是否存在需要同步的产品,只有绑定了erp中产品的才同步
        boolean needTb=false;
        for (ShopOrderDetails orderItemDto : orderDto.getDetails()) {
            ShopSku shopSku = shopSkuDao.selectById(orderItemDto.getsId());
            if (StringUtils.isNotBlank(shopSku.getStockCode())) {
                needTb=true;
            }
        }
        if(needTb){
        BizUser bizUser = bizUserService.findByOpenId(orderDto.getUserId());
        SysOrder order = new SysOrder();
        SysVipInfo vipInfo = vipDao.selectByPhone(bizUser.getPhoneNumber());
@@ -110,9 +119,6 @@
        order.setArrears(0);
        int i = sysOrderDao.insert(order);
        // 创建订单明细,并计算总价与折扣总价
        // 总价
        double total = 0;
        double zkTotal = 0;
        int count = 0;
        // 设置订单条目
        for (ShopOrderDetails orderItemDto : orderDto.getDetails()) {
@@ -121,7 +127,7 @@
            ShopSku shopSku = shopSkuDao.selectById(orderItemDto.getsId());
            if (StringUtils.isBlank(shopSku.getStockCode())) {
                throw new GlobleException("销售产品未绑定erp中的产品,无法进行同步");
                    LogUtil.warn("销售产品未绑定erp中的产品,无法进行同步");
            }
            String goodsCode =shopSku.getStockCode();
@@ -210,6 +216,10 @@
        flow.setShopId(sourceOrder.getShopId());
        flow.setCompanyId(sourceOrder.getCompanyId());
        sysOrderFlowDao.insert(flow);
        }else{
            LogUtil.info("不存在需要同步的产品");
        }
    }