| | |
| | | package com.yeshi.fanli.service.impl.goods;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.goods.FreeGoodsCouponDao;
|
| | | import com.yeshi.fanli.entity.goods.FreeGoodsCoupon;
|
| | | import com.yeshi.fanli.service.inter.goods.FreeGoodsCouponService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | |
|
| | | @Service
|
| | | public class FreeGoodsCouponServiceImpl implements FreeGoodsCouponService {
|
| | | |
| | | @Resource
|
| | | private FreeGoodsCouponDao freeGoodsCouponDao;
|
| | | |
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | |
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
|
| | |
|
| | | |
| | | @Override
|
| | | public boolean saveFreeGoods(GoodsDetailVO detailVO) {
|
| | | if (detailVO == null) {
|
| | | return false;
|
| | | }
|
| | | |
| | | String id = detailVO.getGoodsType() + "#_#" + detailVO.getGoodsId();
|
| | | FreeGoodsCoupon freeGoods = new FreeGoodsCoupon();
|
| | | freeGoods.setId(id);
|
| | | freeGoods.setGoodsId(detailVO.getGoodsId());
|
| | | freeGoods.setGoodsType(detailVO.getGoodsType());
|
| | | freeGoods.setGoods(detailVO);
|
| | | freeGoods.setCreateTime(new Date());
|
| | | freeGoods.setUpdateTime(new Date());
|
| | | freeGoodsCouponDao.save(freeGoods);
|
| | | return true;
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void delete(String goodsId, Integer goodsType) {
|
| | | freeGoodsCouponDao.delete(goodsId + "#_#" + goodsType);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<FreeGoodsCoupon> listByType(int start, int count, Integer goodsType) {
|
| | | return freeGoodsCouponDao.listByType(start,count, goodsType);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countByType(Integer goodsType) {
|
| | | return freeGoodsCouponDao.countByType(goodsType);
|
| | | }
|
| | | |
| | | }
|
| | | package com.yeshi.fanli.service.impl.goods; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.fanli.dao.goods.FreeGoodsCouponDao; |
| | | import com.yeshi.fanli.entity.goods.FreeGoodsCoupon; |
| | | import com.yeshi.fanli.service.inter.goods.FreeGoodsCouponService; |
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO; |
| | | |
| | | @Service |
| | | public class FreeGoodsCouponServiceImpl implements FreeGoodsCouponService { |
| | | |
| | | @Resource |
| | | private FreeGoodsCouponDao freeGoodsCouponDao; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @Resource |
| | | private HongBaoManageService hongBaoManageService; |
| | | |
| | | @Resource |
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; |
| | | |
| | | |
| | | @Override |
| | | public boolean saveFreeGoods(GoodsDetailVO detailVO) { |
| | | if (detailVO == null) { |
| | | return false; |
| | | } |
| | | |
| | | String id = detailVO.getGoodsType() + "#_#" + detailVO.getGoodsId(); |
| | | FreeGoodsCoupon freeGoods = new FreeGoodsCoupon(); |
| | | freeGoods.setId(id); |
| | | freeGoods.setGoodsId(detailVO.getGoodsId()); |
| | | freeGoods.setGoodsType(detailVO.getGoodsType()); |
| | | freeGoods.setGoods(detailVO); |
| | | freeGoods.setCreateTime(new Date()); |
| | | freeGoods.setUpdateTime(new Date()); |
| | | freeGoodsCouponDao.save(freeGoods); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void delete(String goodsId, Integer goodsType) { |
| | | freeGoodsCouponDao.delete(goodsId + "#_#" + goodsType); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<FreeGoodsCoupon> listByType(int start, int count, Integer goodsType) { |
| | | return freeGoodsCouponDao.listByType(start,count, goodsType); |
| | | } |
| | | |
| | | @Override |
| | | public long countByType(Integer goodsType) { |
| | | return freeGoodsCouponDao.countByType(goodsType); |
| | | } |
| | | |
| | | } |