| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Propagation;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | |
|
| | | @Service
|
| | | public class OrderServiceImpl implements OrderService {
|
| | |
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | |
|
| | | @Transactional(propagation = Propagation.NESTED, rollbackFor = Exception.class)
|
| | | // @Transactional(propagation = Propagation.NESTED, rollbackFor =
|
| | | // Exception.class)
|
| | | public boolean addOrder(Order order) throws Exception {
|
| | | order.setVersion(2);
|
| | | WriteLock writeLock = orderLock.writeLock();
|
| | |
| | | if (find != null) {
|
| | | return false;
|
| | | }
|
| | |
|
| | | Integer orderType = order.getOrderType();
|
| | | if (orderType == null) {
|
| | | orderType = Order.ORDER_TYPE_TAOBAO;
|
| | | }
|
| | | // 查找是否存在分享赚订单
|
| | | if (hongBaoOrderService.countByOrderNoAndHongBaoType(order.getOrderId(), HongBaoV2.TYPE_SHARE_GOODS) > 0)
|
| | | if (hongBaoOrderService.countByOrderNoAndHongBaoType(order.getOrderId(), HongBaoV2.TYPE_SHARE_GOODS, orderType) > 0)
|
| | | return false;
|
| | | orderMapper.insertSelective(order);
|
| | | } finally {
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public List<Order> setOrderState(final String orderid, final int orderType) {
|
| | | List<Order> orderList = orderMapper.selectOrderByOrderIdAndOrderType(orderid, orderType);
|
| | | if (orderList != null)
|
| | | for (Order order : orderList) {
|
| | | if (order.getDrawbackTime() == null || order.getDrawbackTime() <= 0) {
|
| | | Order updateOrder = new Order();
|
| | | updateOrder.setId(order.getId());
|
| | | updateOrder.setDrawbackTime(java.lang.System.currentTimeMillis());
|
| | | updateOrder.setState(Order.STATE_SHIXIAO);
|
| | | orderMapper.updateByPrimaryKeySelective(updateOrder);
|
| | | order.setDrawbackTime(updateOrder.getDrawbackTime());
|
| | | order.setState(updateOrder.getState());
|
| | | }
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Order findOrderByOrderIdAndType(String orderId, int type) {
|
| | | List<Order> list = orderMapper.selectOrderByOrderIdAndOrderType(orderId, type);
|
| | | if (list.size() > 0) {
|
| | | return list.get(0);
|
| | | }
|
| | | return null;
|
| | | Order order = orderMapper.selectOrderByOrderIdAndOrderType(orderId, type);
|
| | | return order;
|
| | | }
|
| | |
|
| | | @Override
|