| | |
| | | package com.yeshi.fanli.service.impl.goods;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.goods.PullNewGoodsDao;
|
| | | import com.yeshi.fanli.entity.goods.PullNewGoods;
|
| | | import com.yeshi.fanli.entity.taobao.haodanku.HDKGoodsDetail;
|
| | | import com.yeshi.fanli.service.inter.goods.PullNewGoodsService;
|
| | | import com.yeshi.fanli.util.taobao.HaoDanKuApiUtil;
|
| | |
|
| | | @Service
|
| | | public class PullNewGoodsServiceImpl implements PullNewGoodsService {
|
| | | |
| | | @Resource
|
| | | private PullNewGoodsDao pullNewGoodsDao;
|
| | | |
| | | @Override
|
| | | public void saveGoods(PullNewGoods pullNewGoods) {
|
| | | if (pullNewGoods == null) {
|
| | | return;
|
| | | }
|
| | | pullNewGoodsDao.save(pullNewGoods);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<PullNewGoods> listQuery(int start, int count) {
|
| | | return pullNewGoodsDao.listQuery(start, count);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countQuery() {
|
| | | return pullNewGoodsDao.countQuery();
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void updateGoods(HDKGoodsDetail goods) {
|
| | | if (goods == null)
|
| | | return;
|
| | | |
| | | List<PullNewGoods> list = pullNewGoodsDao.getByItemid(goods.getItemid());
|
| | | if (list == null || list.size() == 0)
|
| | | return;
|
| | | |
| | | // 佣金比例大于50%
|
| | | if (goods.getTkrates() == null || goods.getTkrates() < 50)
|
| | | return;
|
| | | // 是否存在券
|
| | | if (goods.getCouponmoney() == null || goods.getCouponmoney() <= 0)
|
| | | return;
|
| | | // 商品券后价大于9.9元
|
| | | if (goods.getItemendprice() == null || goods.getItemendprice() <= 9.9)
|
| | | return;
|
| | | |
| | | PullNewGoods pullNewGoods = new PullNewGoods();
|
| | | try {
|
| | | PropertyUtils.copyProperties(pullNewGoods, goods);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | return;
|
| | | }
|
| | | pullNewGoodsDao.save(pullNewGoods);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void deleteGoods(List<Long> list) {
|
| | | if (list == null || list.size() == 0)
|
| | | return;
|
| | | |
| | | for (Long itemid: list) {
|
| | | pullNewGoodsDao.deleteByItemid(itemid);
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | package com.yeshi.fanli.service.impl.goods; |
| | | |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.apache.commons.beanutils.PropertyUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.fanli.dao.goods.PullNewGoodsDao; |
| | | import com.yeshi.fanli.entity.goods.PullNewGoods; |
| | | import com.yeshi.goods.facade.entity.taobao.haodanku.HDKGoodsDetail; |
| | | import com.yeshi.fanli.service.inter.goods.PullNewGoodsService; |
| | | import com.yeshi.fanli.service.inter.redpack.RedPackConfigService; |
| | | |
| | | @Service |
| | | public class PullNewGoodsServiceImpl implements PullNewGoodsService { |
| | | |
| | | @Resource |
| | | private PullNewGoodsDao pullNewGoodsDao; |
| | | |
| | | @Resource |
| | | private RedPackConfigService redPackConfigService; |
| | | |
| | | |
| | | @Override |
| | | public void saveGoods(PullNewGoods pullNewGoods) { |
| | | if (pullNewGoods == null) { |
| | | return; |
| | | } |
| | | pullNewGoodsDao.save(pullNewGoods); |
| | | } |
| | | |
| | | @Override |
| | | public List<PullNewGoods> listQuery(int start, int count) { |
| | | return pullNewGoodsDao.listQuery(start, count); |
| | | } |
| | | |
| | | @Override |
| | | public long countQuery() { |
| | | return pullNewGoodsDao.countQuery(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateGoods(HDKGoodsDetail goods) { |
| | | if (goods == null) |
| | | return; |
| | | |
| | | List<PullNewGoods> list = pullNewGoodsDao.getByItemid(goods.getItemid()); |
| | | if (list == null || list.size() == 0) |
| | | return; |
| | | |
| | | double limitRate = Double.valueOf(redPackConfigService.getValueByKey("goods_reate_limit")); |
| | | double limitPrice = Double.valueOf(redPackConfigService.getValueByKey("goods_pay_ment_limit")); |
| | | |
| | | // 佣金比例大于50% |
| | | if (goods.getTkrates() == null || goods.getTkrates() < limitRate) |
| | | return; |
| | | // 是否存在券 |
| | | if (goods.getCouponmoney() == null || goods.getCouponmoney() <= 0) |
| | | return; |
| | | // 商品券后价大于9.9元 |
| | | if (goods.getItemendprice() == null || goods.getItemendprice() < limitPrice) |
| | | return; |
| | | |
| | | PullNewGoods pullNewGoods = new PullNewGoods(); |
| | | try { |
| | | PropertyUtils.copyProperties(pullNewGoods, goods); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return; |
| | | } |
| | | pullNewGoodsDao.save(pullNewGoods); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void deleteGoods(List<Long> list) { |
| | | if (list == null || list.size() == 0) |
| | | return; |
| | | |
| | | for (Long itemid: list) { |
| | | pullNewGoodsDao.deleteByItemid(itemid); |
| | | } |
| | | } |
| | | |
| | | } |