| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "setShareGoods", method = RequestMethod.GET)
|
| | | public void setShareGoods(String callback, AcceptData acceptData, String ids, PrintWriter out) {
|
| | | public void setShareGoods(String callback, AcceptData acceptData, String ids, String day, PrintWriter out) {
|
| | | // 大淘客数据,更新
|
| | | JSONArray array = JSONArray.fromObject(ids);
|
| | |
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd");
|
| | | if (StringUtil.isNullOrEmpty(day)) {
|
| | | day = TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd");
|
| | | }
|
| | | int count = 0;
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | // 获取商品详情
|
| | |
| | | day = TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd");
|
| | | }
|
| | |
|
| | | List<ShareHotGoods> listGoods = shareHotGoodsService.listByDay(day);
|
| | | // 最多30个商品
|
| | | List<ShareHotGoods> listGoods = shareHotGoodsService.listByDay(day, 30);
|
| | | BigDecimal rate = hongBaoManageService.getFanLiRate();
|
| | | JSONArray array = new JSONArray();
|
| | | for (ShareHotGoods sh : listGoods) {
|
| | |
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity;
|
| | | import com.yeshi.fanli.entity.taobao.ShareHotGoods;
|
| | | import com.yeshi.fanli.exception.ActivityException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.LabelService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFlashSaleService;
|
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsActivityService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | /**
|
| | | * 淘宝商品更细
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsActivityService taoBaoGoodsActivityService;
|
| | |
|
| | | @Resource
|
| | | private ShareHotGoodsService shareHotGoodsService;
|
| | |
|
| | | // 动态商品更新 ,1个小时更新
|
| | | @Scheduled(cron = "0 0 */1 * * ?")
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 每小时更新一次
|
| | | * 每天凌晨过5分钟验证
|
| | | */
|
| | | @Scheduled(cron = "0 0 0/1 * * ?")
|
| | | @Scheduled(cron = "0 5 0 * * ? *")
|
| | | public void update618() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | LogHelper.test("更新618商品");
|
| | | taoBaoGoodsActivityService.sysncS618Goods();
|
| | | LogHelper.test("验证爆款商品库商品");
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
|
| | | List<ShareHotGoods> list = shareHotGoodsService.listByDay(day, 15);
|
| | | int count = 0;
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (count >= 10)
|
| | | break;
|
| | | boolean success = shareHotGoodsService.verifyCanCreateTLJ(list.get(i).getGoods().getAuctionId());
|
| | | if (success) {
|
| | | count++;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Override
|
| | | @Cacheable(value = "qualityCache", key = "'listQueryByClassId-'+#start+'-'+#cid")
|
| | | public List<QualityFactory> listQueryByClassId(long start, int count, Long cid) {
|
| | | return qualityFactoryMapper.listQuery(start, count, null, cid, null, null, 1);
|
| | | List<QualityFactory> list = qualityFactoryMapper.listQuery(start, count, null, cid, null, null, 1);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | for (QualityFactory qf : list)
|
| | | goodsList.add(qf.getTaoBaoGoodsBrief());
|
| | | goodsList = daTaoKeGoodsDetailService.filterTaoBaoGoods(goodsList);// 过滤大淘客标题
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (i < goodsList.size())
|
| | | list.get(i).setTaoBaoGoodsBrief(goodsList.get(i));
|
| | |
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | package com.yeshi.fanli.service.impl.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.taobao.ShareHotGoodsDao;
|
| | | import com.yeshi.fanli.dto.taobao.TaoLiJinDTO;
|
| | | import com.yeshi.fanli.entity.taobao.ShareHotGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | @Service
|
| | | public class ShareHotGoodsServiceImpl implements ShareHotGoodsService {
|
| | |
| | |
|
| | | @Override
|
| | | public List<ShareHotGoods> listByDay(String day) {
|
| | | return shareHotGoodsDao.listByDayOrderByUpdateTime(day, 1, 10);
|
| | | return listByDay(day, 10);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ShareHotGoods> listByDay(String day, int count) {
|
| | | return shareHotGoodsDao.listByDayOrderByUpdateTime(day, 1, count);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | public void deleteByGoodsId(Long goodsId) {
|
| | | shareHotGoodsDao.deleteByGoodsId(goodsId);
|
| | | } |
| | |
|
| | | @Override
|
| | | public boolean verifyCanCreateTLJ(Long auctionId) {
|
| | | TaoLiJinDTO taoLiJinDTO = null;
|
| | | try {
|
| | | taoLiJinDTO = TaoKeApiUtil.createTaoLiJin(auctionId, "淘礼金验证", new BigDecimal("1.00"), 1, new Date(),
|
| | | new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 6), new Date(),
|
| | | new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 6),
|
| | | TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT);
|
| | | } catch (TaoKeApiException e) {
|
| | | if (e.getCode() == TaoKeApiException.CODE_TLJ_FORBIDDEN) {
|
| | | // 该商品不支持创建淘礼金红包
|
| | | deleteByGoodsId(auctionId);
|
| | | return false;
|
| | | } else if (e.getCode() == TaoKeApiException.CODE_TLJ_NO_MONEY) {
|
| | | // 官方玩法钱包余额不足 TODO
|
| | | }
|
| | | }
|
| | | return true;
|
| | | }
|
| | | } |
| | |
| | | */
|
| | | public List<ShareHotGoods> listByDay(String day);
|
| | |
|
| | | |
| | | public List<ShareHotGoods> listByDay(String day,int count);
|
| | |
|
| | | /**
|
| | | * 根据主键删除
|
| | | *
|
| | |
| | | */
|
| | | public void deleteByGoodsId(Long goodsId);
|
| | |
|
| | | /**
|
| | | * 验证是否可以创建淘礼金
|
| | | * |
| | | * @param auctionId
|
| | | * @return
|
| | | */
|
| | | public boolean verifyCanCreateTLJ(Long auctionId);
|
| | |
|
| | | }
|