| | |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.SysOrderDao; |
| | | import com.matrix.system.hive.dao.SysOrderItemDao; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.service.CodeService; |
| | | import com.matrix.system.hive.service.ShoppingGoodsService; |
| | | import com.matrix.system.hive.service.SysOrderService; |
| | |
| | | import com.rabbitmq.client.DeliverCallback; |
| | | import com.rabbitmq.client.Delivery; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 微商城订单同步到erp系统 |
| | | */ |
| | | @Component |
| | | public class OrderTask implements DeliverCallback { |
| | | |
| | | |
| | |
| | | @Autowired |
| | | BusParameterSettingsDao parameterSettingsDao; |
| | | |
| | | @Autowired |
| | | private SysOrderFlowDao sysOrderFlowDao; |
| | | |
| | | @Autowired |
| | | private ShoppingGoodsDao shoppingGoodsDao; |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void createOrder(ShopOrder orderDto) { |
| | | |
| | |
| | | } |
| | | |
| | | //获取订单归属门店 |
| | | order.setCompanyId(bizUser.getCompanyId()); |
| | | order.setCompanyId(vipInfo.getCompanyId()); |
| | | order.setShopId(Long.parseLong(orderDto.getStoreId()+"")); |
| | | //同步的订单订单编号保持一致 |
| | | order.setOrderNo(orderDto.getOrderNo()); |
| | |
| | | order.setCashPay(orderDto.getOrderMoney().doubleValue()); |
| | | order.setTotal(orderDto.getOrderMoney().doubleValue()); |
| | | order.setZkTotal(orderDto.getOrderMoney().doubleValue()); |
| | | order.setArrears(0); |
| | | order.setPayTime(new Date()); |
| | | order.setArrears(0D); |
| | | int i = sysOrderDao.insert(order); |
| | | // 创建订单明细,并计算总价与折扣总价 |
| | | // 总价 |
| | |
| | | orderService.setShopSelCount(sourceOrder); |
| | | |
| | | SysOrderFlow flow = new SysOrderFlow(); |
| | | flow.setFlowNo(codeService.getFlowCode() + "-" + i); |
| | | Long goodsId = sourceOrder.getItems().get(0).getGoodsId(); |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(goodsId); |
| | | flow.setFlowContent(goods.getName() + "等" + sourceOrder.getItems().size() + "件产品"); |
| | | |
| | | flow.setOrderId(sourceOrder.getId()); |
| | | flow.setVipId(sourceOrder.getVipId()); |
| | | flow.setFlowType(SysOrderFlow.FLOW_TYPE_BUY); |
| | | |
| | | flow.setAmount(orderDto.getOrderMoney()); |
| | | flow.setPayMethod("微信"); |
| | | |
| | | List<SysOrderFlow> flows = new ArrayList<>(); |
| | | flows.add(flow); |
| | | sourceOrder.setFlows(flows); |
| | | orderService.updateAfterMoney(sourceOrder); |
| | | flow.setShopId(sourceOrder.getShopId()); |
| | | flow.setCompanyId(sourceOrder.getCompanyId()); |
| | | sysOrderFlowDao.insert(flow); |
| | | |
| | | } |
| | | |