| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.QRCodeUtil;
|
| | | import org.yeshi.utils.entity.FileUploadResult;
|
| | | import org.yeshi.utils.exception.HttpException;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoManageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.exception.ShareGoodsException;
|
| | | import com.yeshi.fanli.exception.goods.CommonGoodsException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FileUtil;
|
| | | import com.yeshi.fanli.util.ImageUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.QRCodeUtil;
|
| | | import org.yeshi.utils.entity.FileUploadResult;
|
| | | import org.yeshi.utils.exception.HttpException;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | @Service
|
| | | public class ShareGoodsServiceImpl implements ShareGoodsService {
|
| | |
| | | @Resource
|
| | | private UserAccountService userAccountService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private UserShareGoodsRecordService userShareGoodsRecordService;
|
| | |
|
| | | @Resource
|
| | | private CommonGoodsService commonGoodsService;
|
| | |
|
| | | @Override
|
| | | public void addShareGoodsHistory(UserShareGoodsHistory history) {
|
| | | UserShareGoodsHistory userShareGoodsHistory = userShareGoodsHistoryMapper
|
| | |
| | | userShareGoodsHistoryMapper.updateByPrimaryKeySelective(userShareGoodsHistory);
|
| | | } else
|
| | | userShareGoodsHistoryMapper.insertSelective(history);
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | if (StringUtil.isNullOrEmpty(goods.getCouponLink()) && StringUtil.isNullOrEmpty(goods.getAuctionUrl())) {
|
| | | throw new ShareGoodsException(10, "转链失败");
|
| | | }
|
| | | BigDecimal rate = new BigDecimal(hongBaoManageMapper.selectByKey("hongbao_goods_proportion").getValue());
|
| | |
|
| | | BigDecimal rate = hongBaoManageService.getShareRate();
|
| | |
|
| | | // 创建淘口令
|
| | | TaoBaoLink tbLink = new TaoBaoLink(); // TaoBaoUtil.getTbLinkForShare(goods.getAuctionId(),
|
| | |
| | | goods.setAuctionUrl(taoBaoLink.getClickUrl());
|
| | | }
|
| | |
|
| | | // 保存商品详情
|
| | |
|
| | | // 创建淘口令
|
| | | TaoBaoLink tbLink = new TaoBaoLink();
|
| | | tbLink.setAuctionId(goods.getAuctionId());
|
| | |
| | |
|
| | | tbLink.setGoods(goods);
|
| | |
|
| | | // 存储分享商品的信息,用于加快分享网页接口请求速度
|
| | | if (Constant.IS_OUTNET)
|
| | | redisManager.saveTaoBaoGoodsBriefTemp(goods);
|
| | |
|
| | | return tbLink;
|
| | | }
|
| | |
|