| | |
| | | import com.yeshi.fanli.dao.mybatis.order.OrderItemMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.dao.order.OrderDao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.OrderItem;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleGift;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.ObjectStateException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleGiftService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.user.ShareManageService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | private ShareManageService shareManageService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoService hongBaoService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private OrderItemServcie orderItemService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleGiftService threeSaleGiftService;
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | @Transactional(propagation = Propagation.REQUIRED)
|
| | | public void failureOrder(final String orderid, final int orderType) throws ObjectStateException {
|
| | | // 失效的订单
|
| | | List<Order> orderList = orderService.setOrderState(orderid, orderType);
|
| | | if (orderList != null && orderList.size() > 0) {
|
| | | for (Order order : orderList) {
|
| | | // 找到这个失效订单以前发的红包
|
| | | List<HongBao> hongBaoList = hongBaoService.findHongBaoByOrderList(order.getId());
|
| | | if (hongBaoList != null)
|
| | | for (HongBao hongBao : hongBaoList)
|
| | | // 把红包搞成失效的,分销的红包也要搞失效
|
| | | hongBaoService.relevantInvalid(hongBao.getId());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public void failureOrderWithWeiQuan(final String orderid, final int orderType) throws ObjectStateException {
|
| | | // 失效的订单
|
| | | List<Order> orderList = orderService.setOrderState(orderid, orderType);
|
| | | if (orderList != null && orderList.size() > 0) {
|
| | | for (Order order : orderList) {
|
| | | // if (order.getState() == Order.STATE_SHIXIAO)
|
| | | // continue;
|
| | | // 找到这个失效订单以前发的红包
|
| | | List<HongBao> hongBaoList = hongBaoService.findHongBaoByOrderList(order.getId());
|
| | | if (hongBaoList != null)
|
| | | for (HongBao hongBao : hongBaoList)
|
| | | // 把红包搞成失效的,分销的红包也要搞失效
|
| | | hongBaoService.relevantInvalidVersion2(hongBao.getId());
|
| | |
|
| | | List<OrderItem> orderItremList = orderItemService.findByOrderId(order.getId());
|
| | | if (orderItremList != null)
|
| | | for (OrderItem orderItem : orderItremList) {
|
| | | OrderItem updateOrderItem = new OrderItem(orderItem.getId());
|
| | |
|
| | | updateOrderItem.setState(OrderItem.STATE_TUIKUAN);
|
| | | // 查询
|
| | | List<ThreeSaleGift> giftList = threeSaleGiftService.findThreeSaleGiftList(orderItem.getId());
|
| | | for (ThreeSaleGift tsg : giftList) {
|
| | | if (tsg.getState().intValue() != OrderItem.STATE_DAOZHANG
|
| | | && tsg.getState().intValue() != OrderItem.STATE_SHOUHOU) {
|
| | | ThreeSaleGift updateTsg = new ThreeSaleGift();
|
| | | updateTsg.setId(tsg.getId());
|
| | | updateTsg.setState(OrderItem.STATE_TUIKUAN);
|
| | | threeSaleGiftMapper.updateByPrimaryKeySelective(updateTsg);
|
| | | }
|
| | | }
|
| | | orderItemMapper.updateByPrimaryKeySelective(updateOrderItem);
|
| | | }
|
| | | Order updateOrder = new Order();
|
| | | updateOrder.setId(order.getId());
|
| | | updateOrder.setState(Order.STATE_SHIXIAO);
|
| | | orderMapper.updateByPrimaryKeySelective(updateOrder);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public List<Order> setOrderState(final String orderid, final int orderType) {
|
| | | List<Order> orderList = orderMapper.selectOrderByOrderIdAndOrderType(orderid, orderType);
|
| | |
| | | List<Order> list = orderDao.list("from Order or where or.version=1");
|
| | |
|
| | | return list;
|
| | | }
|
| | |
|
| | | // 处理维权订单
|
| | | @Override
|
| | | public void update(TaoBaoWeiQuanOrder order) {
|
| | | try {
|
| | | failureOrderWithWeiQuan(order.getOrderId(), Order.ORDER_TYPE_TAOBAO);
|
| | | } catch (ObjectStateException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|