| | |
| | | package com.yeshi.fanli.service.impl.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderHongBaoMapMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.order.OrderHongBaoMap;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMapService;
|
| | |
|
| | | @Service
|
| | | public class OrderHongBaoMapServiceImpl implements OrderHongBaoMapService {
|
| | |
|
| | | @Resource
|
| | | private OrderHongBaoMapMapper orderHongBaoMapMapper;
|
| | |
|
| | | @Override
|
| | | public void addOrderHongBaoMap(HongBaoV2 hongBao, Order order) {
|
| | | if (hongBao == null)
|
| | | return;
|
| | | if (order == null)
|
| | | return;
|
| | | OrderHongBaoMap map = new OrderHongBaoMap();
|
| | | map.setCreateTime(new Date());
|
| | | map.setHongBao(hongBao);
|
| | | map.setOrder(order);
|
| | | orderHongBaoMapMapper.insertSelective(map);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public Map<String,BigDecimal> getCouponHongbaoByOrderNo(String orderNo, Long uid) {
|
| | | return orderHongBaoMapMapper.getCouponHongbaoByOrderNo(orderNo, uid);
|
| | | }
|
| | | }
|
| | | package com.yeshi.fanli.service.impl.order; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.order.OrderHongBaoMapMapper; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | | import com.yeshi.fanli.entity.bus.user.Order; |
| | | import com.yeshi.fanli.entity.order.OrderHongBaoMap; |
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMapService; |
| | | import com.yeshi.fanli.service.inter.order.OrderService; |
| | | |
| | | @Service |
| | | public class OrderHongBaoMapServiceImpl implements OrderHongBaoMapService { |
| | | |
| | | @Resource |
| | | private OrderHongBaoMapMapper orderHongBaoMapMapper; |
| | | |
| | | @Resource |
| | | private OrderService orderService; |
| | | |
| | | @Override |
| | | public void addOrderHongBaoMap(HongBaoV2 hongBao, Order order) { |
| | | if (hongBao == null) |
| | | return; |
| | | if (order == null) |
| | | return; |
| | | OrderHongBaoMap map = new OrderHongBaoMap(); |
| | | map.setCreateTime(new Date()); |
| | | map.setHongBao(hongBao); |
| | | map.setOrder(order); |
| | | orderHongBaoMapMapper.insertSelective(map); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getCouponHongbaoByOrderNo(String orderNo, Long uid) { |
| | | return orderHongBaoMapMapper.getCouponHongbaoByOrderNo(orderNo, uid); |
| | | } |
| | | |
| | | @Override |
| | | public OrderHongBaoMap selectByOrderIdAndSourceType(String orderId, int sourceType) { |
| | | Order order = orderService.findOrderByOrderIdAndType(orderId, sourceType); |
| | | if (order != null) { |
| | | List<OrderHongBaoMap> mapList = orderHongBaoMapMapper.listByOrderId(order.getId()); |
| | | if (mapList != null && mapList.size() > 0) |
| | | return mapList.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | } |