| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.MoneyBigDecimalUtil; |
| | | import org.yeshi.utils.NumberUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.PrintWriter; |
| | |
| | | @RequestMapping("api/lijin/goods") |
| | | public class GoodsControllerLijin { |
| | | Logger userGoodsScanLogger = LoggerFactory.getLogger("userGoodsScanLog"); |
| | | |
| | | |
| | | |
| | | |
| | | @Resource |
| | |
| | | |
| | | } |
| | | |
| | | TaoBaoGoodsBrief goods = getTaoBaoGoods(Long.parseLong(goodsId)); |
| | | TaoBaoGoodsBrief goods = getTaoBaoGoods(goodsId); |
| | | |
| | | //加载资金信息 |
| | | com.yeshi.fanli.vo.goods.GoodsDetailVO goodsDetailVO1 = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); |
| | |
| | | GoodsDetailVOLijinFactory.fillRights(goodsDetailVO.getGoods()); |
| | | |
| | | // 店铺信息 |
| | | TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(goods.getId(), goods.getSellerId()); |
| | | TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(goods.getAuctionId(), goods.getSellerId()); |
| | | if (shop != null) { |
| | | String shopLink = shop.getShopLink(); |
| | | if (StringUtil.isNullOrEmpty(shopLink)) { |
| | |
| | | |
| | | case Constant |
| | | .SOURCE_TYPE_JD: |
| | | JDGoods jdGoods = getJDGoods(Long.parseLong(goodsId)); |
| | | JDGoods jdGoods = getJDGoods(goodsId); |
| | | goodsDetailVO.setGoods(GoodsDetailVOLijinFactory.convertJDGoods(jdGoods, paramsDTO)); |
| | | extraVO.setDetailUrl("https://in.m.jd.com/product/jieshao/video/" + goodsId + ".html"); |
| | | ThreadUtil.run(new Runnable() { |
| | |
| | | |
| | | case Constant |
| | | .SOURCE_TYPE_PDD: |
| | | PDDGoodsDetail pddGoodsDetail = getPDDGoods(acceptData.getSystem(), Long.parseLong(goodsId), uid); |
| | | PDDGoodsDetail pddGoodsDetail = getPDDGoods(acceptData.getSystem(), goodsId, uid); |
| | | goodsDetailVO.setGoods(GoodsDetailVOLijinFactory.convertPDDGoods(pddGoodsDetail, paramsDTO)); |
| | | extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_pdd.html?id=" + goodsId); |
| | | ThreadUtil.run(new Runnable() { |
| | |
| | | break; |
| | | } |
| | | |
| | | userGoodsScanLogger.info("{}", new Gson().toJson(UserGoodsScanLog.UserGoodsScanLogFactory.create(goodsDetailVO.getGoods(), uid, acceptData.getUtdid(), acceptData.getDevice()))); |
| | | ThreadUtil.run(new Runnable() { |
| | | |
| | | |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | userGoodsScanLogger.info("{}", new Gson().toJson(UserGoodsScanLog.UserGoodsScanLogFactory.create(goodsDetailVO.getGoods(), uid, acceptData.getUtdid(), acceptData.getDevice()))); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | //是否收藏 |
| | | extraVO.setCollected(false); |
| | | if (uid != null) { |
| | | CollectionGoodsV2 collectionGoodsV2 = collectionGoodsV2Service.findByUidAndAuctionId(uid, goodsType == Constant.SOURCE_TYPE_SUNING ? goodsIdSuning : Long.parseLong(goodsDetailVO.getGoods().getGoodsId()), goodsType); |
| | | CollectionGoodsV2 collectionGoodsV2 = collectionGoodsV2Service.findByUidAndAuctionId(uid, goodsType == Constant.SOURCE_TYPE_SUNING ? goodsIdSuning + "" : goodsDetailVO.getGoods().getGoodsId(), goodsType); |
| | | if (collectionGoodsV2 != null) { |
| | | extraVO.setCollected(true); |
| | | } |
| | |
| | | extraVO.setBuyValid(true); |
| | | extraVO.setListCouponUser(listCouponUser); |
| | | goodsDetailVO.setExtra(extraVO); |
| | | loadLijinInfo(uid, acceptData.getSystem(), goodsDetailVO); |
| | | try { |
| | | loadLijinInfo(uid, acceptData.getSystem(), goodsDetailVO); |
| | | } catch (Exception e) { |
| | | if (goodsDetailVO.getGoods().getMoneyInfo() != null) { |
| | | goodsDetailVO.getGoods().getMoneyInfo().setHongBaoMoney("0.00"); |
| | | } |
| | | } |
| | | //清除临时信息 |
| | | goodsDetailVO.getGoods().setTempCoupon(null); |
| | | if (goodsDetailVO.getGoods().getLabels() == null) |
| | |
| | | |
| | | |
| | | try { |
| | | LiJinExpendRecord record = goodsLijinMnager.createTBLijin(Long.parseLong(goodsId), uid, new Date(user.getCreatetime())); |
| | | LiJinExpendRecord record = goodsLijinMnager.createTBLijin(goodsId, uid, new Date(user.getCreatetime())); |
| | | String sendUrl = record.getSendUrl(); |
| | | if (StringUtil.isNullOrEmpty(sendUrl)) { |
| | | out.print(JsonUtil.loadFalseResult("礼金创建失败")); |
| | |
| | | } |
| | | |
| | | |
| | | private TaoBaoGoodsBrief getTaoBaoGoods(Long id) { |
| | | private TaoBaoGoodsBrief getTaoBaoGoods(String id) { |
| | | try { |
| | | TaoBaoGoodsBrief goods = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(id); |
| | | if (goods != null) { |
| | | return goods; |
| | | } |
| | | TaoKeAppInfo app = new TaoKeAppInfo(); |
| | | app.setAppKey(TaoBaoConstant.TAOBAO_COMMON_APPKEY); |
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_COMMON_APPSECRET); |
| | | app.setPid(TaoBaoConstant.TAOBAO_COMMON_PID); |
| | | app.setAdzoneId(TaoBaoConstant.TAOBAO_COMMON_PID.split("_")[3]); |
| | | if (NumberUtil.isNumeric(id)) { |
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); |
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); |
| | | app.setPid(TaoBaoConstant.TAOBAO_PID_DEFAULT); |
| | | } else { |
| | | app.setAppKey(TaoBaoConstant.TAOBAO_COMMON_APPKEY); |
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_COMMON_APPSECRET); |
| | | app.setPid(TaoBaoConstant.TAOBAO_COMMON_PID); |
| | | } |
| | | app.setAdzoneId(app.getPid().split("_")[3]); |
| | | goods = TaoKeApiUtil.searchGoodsDetail(id, app); |
| | | |
| | | final TaoBaoGoodsBrief finalGoods = goods; |
| | |
| | | return null; |
| | | } |
| | | |
| | | private JDGoods getJDGoods(Long id) { |
| | | private JDGoods getJDGoods(String id) { |
| | | JDGoods jdGoods = JDApiUtil.queryGoodsDetail(id); // 高级接口 |
| | | if (jdGoods == null) { |
| | | jdGoods = JDUtil.getGoodsDetail(id); // 爬取网页 |
| | | // jdGoods = JDUtil.getGoodsDetail(id); // 爬取网页 |
| | | // jdGoods = JDApiUtil.getGoodsDetail(id); // 普通接口 |
| | | } |
| | | return jdGoods; |
| | | } |
| | | |
| | | private PDDGoodsDetail getPDDGoods(SystemEnum system, Long id, Long uid) { |
| | | private PDDGoodsDetail getPDDGoods(SystemEnum system, String id, Long uid) { |
| | | String pid = pidManager.getPidCache(system, Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli); |
| | | PDDGoodsDetail pddGoods = null; |
| | | try { |