| | |
| | | |
| | | 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; |
| | |
| | | @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()); |
| | |
| | | order.setArrears(0); |
| | | int i = sysOrderDao.insert(order); |
| | | // 创建订单明细,并计算总价与折扣总价 |
| | | // 总价 |
| | | double total = 0; |
| | | double zkTotal = 0; |
| | | int count = 0; |
| | | // 设置订单条目 |
| | | for (ShopOrderDetails orderItemDto : orderDto.getDetails()) { |
| | |
| | | ShopSku shopSku = shopSkuDao.selectById(orderItemDto.getsId()); |
| | | |
| | | if (StringUtils.isBlank(shopSku.getStockCode())) { |
| | | throw new GlobleException("销售产品未绑定erp中的产品,无法进行同步"); |
| | | LogUtil.warn("销售产品未绑定erp中的产品,无法进行同步"); |
| | | } |
| | | |
| | | String goodsCode =shopSku.getStockCode(); |
| | |
| | | flow.setShopId(sourceOrder.getShopId()); |
| | | flow.setCompanyId(sourceOrder.getCompanyId()); |
| | | sysOrderFlowDao.insert(flow); |
| | | }else{ |
| | | LogUtil.info("不存在需要同步的产品"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |