| | |
| | | |
| | | import com.matrix.biz.bean.BizUser; |
| | | import com.matrix.biz.service.BizUserService; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanGradeDao; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanOrderDao; |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanGrade; |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanOrder; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.service.CodeService; |
| | |
| | | import com.matrix.system.shopXcx.dao.ShopSkuDao; |
| | | import com.rabbitmq.client.DeliverCallback; |
| | | import com.rabbitmq.client.Delivery; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @Autowired |
| | | private ShoppingGoodsDao shoppingGoodsDao; |
| | | |
| | | @Autowired |
| | | private ShopSalesmanOrderDao shopSalesmanOrderDao; |
| | | |
| | | @Autowired |
| | | private ShopSalesmanGradeDao shopSalesmanGradeDao; |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void createOrder(ShopOrder orderDto) { |
| | | public void synchronizationOrderToErp(ShopOrder orderDto) { |
| | | |
| | | //判断是否存在需要同步的产品,只有绑定了erp中产品的才同步 |
| | | boolean needTb=false; |
| | |
| | | |
| | | BizUser bizUser = bizUserService.findByOpenId(orderDto.getUserId()); |
| | | SysOrder order = new SysOrder(); |
| | | //TODO 根据公司id区分 |
| | | SysVipInfo vipInfo = vipDao.selectByPhone(bizUser.getPhoneNumber()); |
| | | if(SysVipInfo.UNDEAL_VIP==vipInfo.getIsDeal()){ |
| | | //非成交客户下单更新客户为成交客户 |
| | |
| | | } |
| | | |
| | | //获取订单归属门店 |
| | | order.setCompanyId(vipInfo.getCompanyId()); |
| | | order.setCompanyId(orderDto.getCompanyId()); |
| | | order.setShopId(Long.parseLong(orderDto.getStoreId()+"")); |
| | | //同步的订单订单编号保持一致 |
| | | order.setOrderNo(orderDto.getOrderNo()); |
| | |
| | | order.setTotal(orderDto.getOrderMoney().doubleValue()); |
| | | order.setZkTotal(orderDto.getOrderMoney().doubleValue()); |
| | | order.setPayTime(new Date()); |
| | | order.setArrears(0); |
| | | order.setArrears(0D); |
| | | int i = sysOrderDao.insert(order); |
| | | // 创建订单明细,并计算总价与折扣总价 |
| | | int count = 0; |
| | |
| | | //获取订单详情 |
| | | List<ShopOrderDetails> orderDetails = shopOrderDetailsDao.selectByOrderId(Integer.valueOf(orderId)); |
| | | order.setDetails(orderDetails); |
| | | createOrder(order); |
| | | //同步订单到erp |
| | | synchronizationOrderToErp(order); |
| | | |
| | | } |
| | | |
| | | } |