| | |
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.transaction.Transactional;
|
| | |
| | | import org.hibernate.Session;
|
| | | import org.springframework.orm.hibernate4.HibernateCallback;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.config.AddEveryDayTaskDao;
|
| | | import com.yeshi.fanli.dao.goods.RecommendSectionGoodsDao;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper;
|
| | | import com.yeshi.fanli.dao.taobao.TaoBaoGoodsBriefDao;
|
| | | import com.yeshi.fanli.entity.admin.EveryDayTask;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSection;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | |
|
| | | @Service
|
| | | public class TaoBaoGoodsBriefServiceImpl implements TaoBaoGoodsBriefService {
|
| | |
| | | @Resource
|
| | | private GoodsClassService goodsClassService;
|
| | |
|
| | | @Resource
|
| | | private AddEveryDayTaskDao addEveryDayTaskDao;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
| | | recommendSectionGoodsService.addRecommendSectionGoods(recommendSection, taobao);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 添加商品到每日任务
|
| | | */
|
| | | @Override
|
| | | public void addEveryDayTask(long tbid) throws NotExistObjectException, ExistObjectException {
|
| | | TaoBaoGoodsBrief taobao = taoBaoGoodsBriefDao.find(TaoBaoGoodsBrief.class, tbid);
|
| | | if (taobao == null) {
|
| | | throw new NotExistObjectException("不存在该淘宝商品");
|
| | | }
|
| | | EveryDayTask everyDaoTask = new EveryDayTask();
|
| | | everyDaoTask.setEtGoods(taobao);
|
| | | everyDaoTask.setEtCreateTime(new Date());
|
| | | addEveryDayTaskDao.create(everyDaoTask);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public void addClassRecommendGoods(long gcid, long tbid) throws NotExistObjectException, ExistObjectException {
|
| | |
| | |
|
| | | @Override
|
| | | public String getGoodsUserHongBao(TaoBaoGoodsBrief goods) {
|
| | | Map<String, String> convertMap = hongBaoManageService.convertMap();
|
| | | String proportion = convertMap.get("hongbao_goods_proportion");
|
| | | return TaoBaoUtil.getGoodsHongBaoInfo(goods, new BigDecimal(proportion));
|
| | | BigDecimal rate = hongBaoManageService.getFanLiRate();
|
| | | return TaoBaoUtil.getGoodsHongBaoInfo(goods, rate);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getShareGoodsUserHongBao(TaoBaoGoodsBrief goods) {
|
| | | Map<String, String> convertMap = hongBaoManageService.convertMap();
|
| | | String proportion = convertMap.get("hongbao_goods_proportion");
|
| | | return TaoBaoUtil.getShareGoodsHongBaoInfo(goods, new BigDecimal(proportion));
|
| | | BigDecimal rate = hongBaoManageService.getShareRate();
|
| | | return TaoBaoUtil.getShareGoodsHongBaoInfo(goods, rate);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> queryByAuctionId(Long auctionId) {
|
| | | return taoBaoGoodsBriefMapper.queryByAuctionId(auctionId);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listQueryByAuctionId(List<Long> list) {
|
| | | return taoBaoGoodsBriefMapper.queryGoodsByAuctionId(list);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public int insertSelective(TaoBaoGoodsBrief taoBaoGoodsBrief) {
|
| | |
|
| | | return taoBaoGoodsBriefMapper.insertSelective(taoBaoGoodsBrief);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public int insertBatch(List<TaoBaoGoodsBrief> list) {
|
| | |
|
| | |
| | | return taoBaoGoodsBriefMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(TaoBaoGoodsBrief taoBaoGoodsBrief) {
|
| | | return taoBaoGoodsBriefMapper.updateByPrimaryKey(taoBaoGoodsBrief);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void updateTBGoodsWithNewInfo(TaoBaoGoodsBrief tb) throws NotExistObjectException {
|
| | | if (tb == null)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateTaoBaoGoodsByMybatis(TaoBaoGoodsBrief taoBaoGoodsBrief) throws TaobaoGoodsDownException {
|
| | |
|
| | | SearchFilter filter = new SearchFilter();
|
| | | filter.setKey("https://item.taobao.com/item.htm?id=" + taoBaoGoodsBrief.getAuctionId());
|
| | | TaoBaoGoodsBrief tb = TaoKeApiUtil.searchGoodsDetail(taoBaoGoodsBrief.getAuctionId());
|
| | | if (tb == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | taoBaoGoodsBrief.setCouponLink(tb.getCouponLink());
|
| | | taoBaoGoodsBrief.setCouponActivityId(tb.getCouponActivityId());
|
| | | taoBaoGoodsBrief.setCouponAmount(tb.getCouponAmount());
|
| | | taoBaoGoodsBrief.setCouponEffectiveStartTime(tb.getCouponEffectiveStartTime());
|
| | | taoBaoGoodsBrief.setCouponEffectiveEndTime(tb.getCouponEffectiveEndTime());
|
| | | taoBaoGoodsBrief.setCouponInfo(tb.getCouponInfo());
|
| | | taoBaoGoodsBrief.setCouponLeftCount(tb.getCouponLeftCount());
|
| | | taoBaoGoodsBrief.setCouponLinkTaoToken(tb.getCouponLinkTaoToken());
|
| | | taoBaoGoodsBrief.setCouponOriLink(tb.getCouponOriLink());
|
| | | taoBaoGoodsBrief.setCouponShortLink(tb.getCouponShortLink());
|
| | | taoBaoGoodsBrief.setCouponStartFee(tb.getCouponStartFee());
|
| | | taoBaoGoodsBrief.setCouponTotalCount(tb.getCouponTotalCount());
|
| | | taoBaoGoodsBrief.setBiz30day(tb.getBiz30day());
|
| | | taoBaoGoodsBrief.setTkRate(tb.getTkRate());
|
| | | taoBaoGoodsBrief.setZkPrice(tb.getZkPrice());
|
| | | taoBaoGoodsBrief.setEventRate(tb.getEventRate());
|
| | | taoBaoGoodsBrief.setTkMktStatus(tb.getTkMktStatus());
|
| | | taoBaoGoodsBrief.setReservePrice(tb.getReservePrice());
|
| | | taoBaoGoodsBrief.setCreatetime(new Date());
|
| | |
|
| | | setGoodsBriefDefault(taoBaoGoodsBrief);
|
| | |
|
| | | taoBaoGoodsBriefMapper.updateByPrimaryKeySelective(taoBaoGoodsBrief);
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateByPrimaryKeySelective(TaoBaoGoodsBrief taoBaoGoodsBrief) throws TaobaoGoodsDownException {
|
| | | setGoodsBriefDefault(taoBaoGoodsBrief);
|
| | | taoBaoGoodsBriefMapper.updateByPrimaryKeySelective(taoBaoGoodsBrief);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | | if (goodsBrief.getZkPrice() == null)
|
| | | goodsBrief.setZkPrice(defaultZero);
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | return taoBaoGoodsBrief;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void updateBatchSelective(List<TaoBaoGoodsBrief> list) {
|
| | | taoBaoGoodsBriefMapper.updateBatchSelective(list);
|
| | | }
|
| | | |
| | | }
|