| | |
| | | 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 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.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.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;
|
| | |
| | | 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);
|