| | |
| | | package com.yeshi.fanli.service.impl.dynamic;
|
| | |
|
| | | import java.io.InputStream;
|
| | | import java.lang.reflect.InvocationTargetException;
|
| | | import java.math.BigDecimal;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateLunarUtil;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.dynamic.DynamicInfoDao;
|
| | | import com.yeshi.fanli.dto.ConfigParamsDTO;
|
| | | import com.yeshi.fanli.dto.taobao.TaoBaoShopDTO;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityRuleUser;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShop;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityUserService;
|
| | |
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.InviteMaterialService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.user.QrCodeService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
| | | private RedisManager redisManager;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsService daTaoKeGoodsService;
|
| | | private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
| | | buffer.append(" ");
|
| | | buffer.append("早安~\n");
|
| | | buffer.append("我的邀请码:【邀请码】\n");
|
| | | buffer.append("购物省钱返利券App:【邀请链接】");
|
| | | buffer.append("购物省钱板栗快省App:【邀请链接】");
|
| | |
|
| | | content = content.replaceAll("\\,", "\\,").replaceAll("\\.", "\\。").replaceAll("\\;", "\\;")
|
| | | .replaceAll("\\!", "\\!").replaceAll("\\?", "\\?").replaceAll("\\:", "\\:");
|
| | |
| | | if (StringUtil.isNullOrEmpty(shopLink)) {
|
| | | taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId()));
|
| | | }
|
| | | |
| | | if(StringUtil.isNullOrEmpty(taoBaoShop.getShopIcon())) |
| | | taoBaoShop.setShopIcon(dynamicShopInfo.getShopIcon());
|
| | |
|
| | | DynamicInfo dynamicVO = new DynamicInfo();
|
| | | dynamicVO.setId(brandId);
|
| | |
| | | count = 4;
|
| | | }
|
| | |
|
| | | List<DaTaoKeDetail> listDaTaoKe = daTaoKeGoodsService.getGoodsNotInList(subclassId, null, count);
|
| | | List<DaTaoKeDetailV2> listDaTaoKe = daTaoKeGoodsDetailV2Service.getGoodsNotInList(subclassId, null, count);
|
| | |
|
| | | DaTaoKeDetail daTaoKeDetail = null;
|
| | | DaTaoKeDetailV2 daTaoKeDetail = null;
|
| | | // 商品列表
|
| | | List<GoodsPicture> listPicture = new ArrayList<GoodsPicture>();
|
| | | // 商品列表
|
| | |
| | | BigDecimal shareMoney = new BigDecimal(0);
|
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | for (DaTaoKeDetail daTaoKe : listDaTaoKe) {
|
| | | for (DaTaoKeDetailV2 daTaoKe : listDaTaoKe) {
|
| | | if (daTaoKeDetail == null) {
|
| | | daTaoKeDetail = daTaoKe;
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | | // 大淘客数据
|
| | | DaTaoKeDetail daTaoKe = daTaoKeGoodsService.getGoodsNotInList(subclassId, listId, 1).get(0);
|
| | | DaTaoKeDetailV2 daTaoKe = daTaoKeGoodsDetailV2Service.getGoodsNotInList(subclassId, listId, 1).get(0);
|
| | | if (daTaoKe == null) {
|
| | | return addSuccess;
|
| | | }
|
| | |
| | | TaoBaoGoodsBrief taoBaoGoodsBrief2 = TaoKeApiUtil.getSimpleGoodsInfo(daTaoKe.getGoodsId());
|
| | | List<String> imgList = taoBaoGoodsBrief2.getImgList();
|
| | | List<String> listimgs = new ArrayList<String>();
|
| | | String pic = daTaoKe.getPic();
|
| | | String pic = daTaoKe.getMainPic();
|
| | | listimgs.add(TbImgUtil.getTBSize320Img(pic));
|
| | | if (imgList != null && imgList.size() > 0) {
|
| | | for (String img : imgList) {
|
| | |
| | | * @param subclassId
|
| | | * @throws TaobaoGoodsDownException
|
| | | */
|
| | | public DynamicInfo getDynamicInfo(DaTaoKeDetail daTaoKe, Long classId, Long subclassId) {
|
| | | public DynamicInfo getDynamicInfo(DaTaoKeDetailV2 daTaoKe, Long classId, Long subclassId) {
|
| | | DynamicInfo dynamicInfo = new DynamicInfo();
|
| | | dynamicInfo.setId(UUID.randomUUID().toString().replace("-", ""));
|
| | | dynamicInfo.setClassId(classId);
|
| | |
| | | * @param daTaoKe
|
| | | * @return
|
| | | */
|
| | | public GoodsPicture getGoodsPicture(DaTaoKeDetail daTaoKe) {
|
| | | public GoodsPicture getGoodsPicture(DaTaoKeDetailV2 daTaoKe) {
|
| | | GoodsPicture goodsPicture = new GoodsPicture();
|
| | | goodsPicture.setH(100);
|
| | | goodsPicture.setW(100);
|
| | | goodsPicture.setUrl(TbImgUtil.getTBSize320Img(daTaoKe.getPic()));
|
| | | goodsPicture.setUrl(TbImgUtil.getTBSize320Img(daTaoKe.getMainPic()));
|
| | | goodsPicture.setJumpDetail(jumpDetailV2Service.getByTypeCache("goodsdetail"));
|
| | |
|
| | | String goodsId = daTaoKe.getGoodsId().toString();
|
| | |
| | | size = inviteInfo.getSize();
|
| | | }
|
| | |
|
| | | InputStream asInputStream = HttpUtil.getAsInputStream(picUrl);
|
| | | |
| | | int index = picUrl.lastIndexOf("/");
|
| | | String newUrl = picUrl.substring(index + 1);
|
| | | String urlMd5 = newUrl.substring(0, newUrl.lastIndexOf("."));
|
| | | |
| | | // 图片
|
| | | String imgLink = qrCodeService.drawInviteQrCodeNew(picUrl, null, null, pX, pY, size, null);
|
| | | String imgLink = qrCodeService.drawInviteQrCodeNew(asInputStream, urlMd5, null, null, pX, pY, size, null);
|
| | | GoodsPicture p2 = new GoodsPicture();
|
| | | p2.setW(100);
|
| | | p2.setH(100);
|
| | |
| | | return list;
|
| | | }
|
| | |
|
| | | private Map<Long, TaoBaoGoodsBrief> getFilterGoodsMap(List<DynamicInfo> list) {
|
| | | // 提取过滤商品
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | for (DynamicInfo dynamicInfo : list) {
|
| | | List<GoodsPicture> gpList = dynamicInfo.getImgs();
|
| | | if (gpList != null)
|
| | | for (GoodsPicture gp : gpList) {
|
| | | if (gp != null && gp.getGoods() != null) {
|
| | | TaoBaoGoodsBriefExtra newGoods = new TaoBaoGoodsBriefExtra();
|
| | | try {
|
| | | PropertyUtils.copyProperties(newGoods, gp.getGoods());
|
| | | goodsList.add(newGoods);
|
| | | } catch (IllegalAccessException e) {
|
| | | e.printStackTrace();
|
| | | } catch (InvocationTargetException e) {
|
| | | e.printStackTrace();
|
| | | } catch (NoSuchMethodException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | goodsList = taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(goodsList);
|
| | | Map<Long, TaoBaoGoodsBrief> map = new HashMap<>();
|
| | | if (goodsList != null)
|
| | | for (TaoBaoGoodsBrief goods : goodsList)
|
| | | map.put(goods.getAuctionId(), goods);
|
| | | return map;
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Cacheable(value = "dynamicCache", key = "'queryV2-'+#platform+'-'+#version+'-'+#start+'-'+#count+'-'+#cid+'-'+#subId")
|
| | | public List<DynamicInfo> queryV2(int platform, int version, int start, int count, Long cid, Long subId) {
|
| | |
| | | // 需要更新的商品
|
| | | List<TaoBaoGoodsBrief> taoBaoGoodsUpdateList = new ArrayList<>();
|
| | | if (list != null && list.size() > 0) {
|
| | | // 提取商品
|
| | | Map<Long, TaoBaoGoodsBrief> goodsMap = getFilterGoodsMap(list);
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,hongBaoManageService.getVIPFanLiRate());
|
| | |
|
| | | for (DynamicInfo dynamicInfo : list) {
|
| | | DynamicInfo dynamicNew = new DynamicInfo();
|
| | | try {
|
| | |
| | | continue;
|
| | | }
|
| | |
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBaoGoodsBriefExtra(goods, fanLiRate,
|
| | | shareRate);
|
| | | // 过滤券信息与资金信息
|
| | | goods.setCouponAmount(goodsMap.get(goods.getAuctionId()).getCouponAmount());
|
| | | goods.setZkPrice(goodsMap.get(goods.getAuctionId()).getZkPrice());
|
| | | goods.setCouponStartFee(goodsMap.get(goods.getAuctionId()).getCouponStartFee());
|
| | | goods.setTkRate(goodsMap.get(goods.getAuctionId()).getTkRate());
|
| | |
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBaoGoodsBriefExtra(goods, paramsDTO);
|
| | |
|
| | | goodsNew.setGoodsVO(detailVO);
|
| | | goodsNew.setGoods(null);
|
| | |
|
| | |
| | | continue;
|
| | | }
|
| | |
|
| | | Integer state = oldExtra.getState();
|
| | | if (state != null && state == 1) {
|
| | | continue;
|
| | | }
|
| | | /*
|
| | | * Integer state = oldExtra.getState(); if (state != null && state == 1) {
|
| | | * continue; }
|
| | | */
|
| | |
|
| | | TaoBaoGoodsBrief goodsBrief = null;
|
| | | try {
|