8个文件已添加
52个文件已修改
1 文件已重命名
| | |
| | | return; |
| | | } |
| | | |
| | | if(SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.threeSale)) { |
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); |
| | | if (StringUtil.isNullOrEmpty(inviteCode)) { |
| | | out.print(JsonUtil.loadFalseResult(3, "请激活邀请码")); |
| | | return; |
| | | } |
| | | } |
| | | // 邀请码不必必须激活 |
| | | // if(SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.threeSale)) { |
| | | // String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); |
| | | // if (StringUtil.isNullOrEmpty(inviteCode)) { |
| | | // out.print(JsonUtil.loadFalseResult(3, "请激活邀请码")); |
| | | // return; |
| | | // } |
| | | // } |
| | | |
| | | |
| | | UserExtraTaoBaoInfo user = userExtraTaoBaoInfoService.getByUid(uid); |
| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import com.yeshi.fanli.util.goods.douyin.CSJCPSApiUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | return; |
| | | } |
| | | collectionGoodsV2Service.addSuningCollection(uid, suningGoods); |
| | | }else if (goodsType == Constant.SOURCE_TYPE_DY) { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(id)); |
| | | if (goods == null) { |
| | | out.print(JsonUtil.loadFalseResult(1, "商品已下架")); |
| | | return; |
| | | } |
| | | collectionGoodsV2Service.addDYCollection(uid, goods); |
| | | } else { |
| | | try { |
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = redisManager.getTaoBaoGoodsBrief(goodsId); |
| | |
| | | list.add(map.get(TYPE_FAQUAN)); |
| | | list.add(map.get(TYPE_HUODONG)); |
| | | // list.add(map.get(TYPE_XUEYUAN)); |
| | | list.add(map.get(TYPE_SUCAI)); |
| | | // 不返回素材了 |
| | | // list.add(map.get(TYPE_SUCAI)); |
| | | } else { |
| | | list.add(map.get(TYPE_FAQUAN)); |
| | | } |
| | |
| | | import java.io.PrintWriter; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | |
| | |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.util.goods.GoodsJumpUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.CSJCPSApiUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.*; |
| | | import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | | import com.yeshi.fanli.vo.goods.GoodsJumpLinkVO; |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "getDetailDY", method = RequestMethod.POST) |
| | | public void getDetailDY(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) { |
| | | // 系统验证 |
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), |
| | | acceptData.getPackages(), acceptData.getSystem()); |
| | | if (system == null) { |
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在")); |
| | | return; |
| | | } |
| | | |
| | | DYGoodsDetail dyGoodsDetail = CSJCPSApiUtil.goodsDetail(id); |
| | | if (dyGoodsDetail == null) { |
| | | out.print(JsonUtil.loadFalseResult(2, "商品不存在")); |
| | | return; |
| | | } |
| | | |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(acceptData.getSystem())); |
| | | |
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertDYGoods(dyGoodsDetail, paramsDTO); |
| | | if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { |
| | | goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); |
| | | goodsDetail.getMoneyInfo().setShareMoney("¥" + DYUtil.getGoodsFanLiMoney(dyGoodsDetail, |
| | | hongBaoManageService.getShareRate(UserLevelEnum.superVIP, acceptData.getSystem()))); |
| | | goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); |
| | | goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); |
| | | } |
| | | goodsDetail.getMoneyInfo() |
| | | .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(), acceptData.getSystem())); |
| | | |
| | | // 附加信息 |
| | | OtherInfo otherInfo = new OtherInfo(); |
| | | RewardCouponVO rewardCoupon = new RewardCouponVO(); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", acceptData.getSystem())); |
| | | JSONObject params1 = new JSONObject(); |
| | | if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) |
| | | params1.put("url", configService.getValue(ConfigKeyEnum.specialGuideRewardCouponLink.getKey(), acceptData.getSystem())); |
| | | else |
| | | params1.put("url", userVipConfigService.getValueByKey("vip_link")); |
| | | |
| | | rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney()); |
| | | rewardCoupon.setDesc("返"); |
| | | params1.put("url", userVipConfigService.getValueByKey("vip_link")); |
| | | rewardCoupon.getJumpDetail().setNeedLogin(true); |
| | | |
| | | rewardCoupon.setParams(params1.toString()); |
| | | otherInfo.setRewardCoupon(rewardCoupon); |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()), acceptData.getSystem())) |
| | | otherInfo.setRewardCoupon(null); |
| | | goodsDetail.setOtherInfo(otherInfo); |
| | | |
| | | ShopInfoVO shopInfo = goodsDetail.getShopInfo(); |
| | | if (shopInfo != null) { |
| | | if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null |
| | | || shopInfo.getScoreSeller() == null) { |
| | | goodsDetail.setShopInfo(null); |
| | | } |
| | | } |
| | | |
| | | GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); |
| | | extraVO.setIsNative(false); |
| | | // IOS是否正在上线 |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { |
| | | String version = acceptData.getVersion(); |
| | | extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version), acceptData.getSystem())); |
| | | } |
| | | |
| | | // TODO 图文详情 |
| | | extraVO.setDetailUrl(""); |
| | | |
| | | if (uid != null) { |
| | | // 是否加入收藏 |
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id + "", |
| | | Constant.SOURCE_TYPE_DY); |
| | | extraVO.setCollected(collectionGoods != null ? true : false); |
| | | // 是否加入选品库 |
| | | extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id + "", Constant.SOURCE_TYPE_DY)); |
| | | } |
| | | |
| | | extraVO.setIsNative(true); |
| | | |
| | | // 分享路径 |
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(acceptData.getSystem()), |
| | | Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + ""); |
| | | // try { |
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); |
| | | // } catch (Exception e) { |
| | | extraVO.setH5Url(h5Url); |
| | | // } |
| | | |
| | | String helpLink = null; |
| | | extraVO.setFanliValid(true); |
| | | extraVO.setShareValid(true); |
| | | |
| | | if (StringUtil.isNullOrEmpty(helpLink)) { |
| | | helpLink = configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(), acceptData.getSystem()); |
| | | } |
| | | |
| | | ShareVO shareInfoVO = new ShareVO(); |
| | | shareInfoVO.setHelpLink(helpLink); |
| | | extraVO.setShare(shareInfoVO); |
| | | |
| | | if (extraVO.getListShareUser() == null) { |
| | | extraVO.setListShareUser(new ArrayList<>()); |
| | | } |
| | | |
| | | if (extraVO.getListCouponUser() == null) { |
| | | extraVO.setListCouponUser(new ArrayList<>()); |
| | | } |
| | | |
| | | // 云发单文案信息 |
| | | getCloudInfo(acceptData, uid, goodsDetail, extraVO); |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); |
| | | object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); |
| | | out.print(JsonUtil.loadTrueResult(object.toString())); |
| | | |
| | | ThreadUtil.run(new Runnable() { |
| | | public void run() { |
| | | // 添加浏览记录 |
| | | try { |
| | | scanHistoryV2Service.addDYScanHistory(uid, acceptData.getDevice(), dyGoodsDetail); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | goodsEvaluateService.updateDYGoods(dyGoodsDetail); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * // 云发单文案信息 |
| | | * |
| | |
| | | |
| | | List<JDGoods> list = JDUtil.getRecommendGoodsById(Long.parseLong(id)); |
| | | if (list == null) { |
| | | list = new ArrayList<JDGoods>(); |
| | | list = new ArrayList<>(); |
| | | } else if (list.size() > 10) { |
| | | list = list.subList(0, 10); |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | if (goodsType == Constant.SOURCE_TYPE_DY) { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(id)); |
| | | //goods.getThird_cid() |
| | | DYGoodsSearchFilter searchFilter = new DYGoodsSearchFilter(); |
| | | searchFilter.setPageSize(10); |
| | | searchFilter.setPage(1); |
| | | searchFilter.setThird_cids(Arrays.asList(new Integer[]{goods.getThird_cid()})); |
| | | ListResult listResult = CSJCPSApiUtil.searchGoods(searchFilter); |
| | | |
| | | |
| | | |
| | | List<GoodsDetailVO> listDetailVO = new ArrayList<>(); |
| | | if (listResult != null) { |
| | | if (listResult.getDataList() != null && listResult.getDataList() .size() > 0) { |
| | | List<DYGoods> dyGoodsList=new ArrayList<>(); |
| | | for(Object o:listResult.getDataList()){ |
| | | dyGoodsList.add((DYGoods)o); |
| | | } |
| | | |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion(), acceptData.getSystem()); |
| | | listDetailVO = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, dyGoodsList, paramsDTO); |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO)); |
| | | data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | return; |
| | | } |
| | | |
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(id, 10); |
| | | // 初始化 |
| | | if (goodsList == null) { |
| | | goodsList = new ArrayList<>(); |
| | | } |
| | | |
| | | List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>(); |
| | | List<GoodsDetailVO> listExtra = new ArrayList<>(); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null, acceptData.getSystem()); |
| | | |
| | | listExtra = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO, false); |
| | |
| | | integralGetService.addCouponRebate(uid); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "getDYLink") |
| | | public void getDYLink(AcceptData acceptData, Long uid, String id, String source, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | out.print(JsonUtil.loadFalseResult(1, "商品ID不能为空")); |
| | | return; |
| | | } |
| | | |
| | | if (!SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.fanli)) { |
| | | uid = null; |
| | | } else { |
| | | if (uid == null) { |
| | | uid = null; |
| | | } else { |
| | | if (uid == null || uid <= 0) { |
| | | out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空")); |
| | | return; |
| | | } |
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid); |
| | | if (user != null && user.getState() != UserInfo.STATE_NORMAL) { |
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC)); |
| | | return; |
| | | } |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(id)); |
| | | if (goods == null) { |
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架")); |
| | | return; |
| | | } |
| | | |
| | | DYConvertResult link = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createFanLiExtraInfo(uid), |
| | | ""); |
| | | |
| | | GoodsJumpLinkVO vo = GoodsJumpUtil.getDYJumpInfo(link); |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | if (uid != null) |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | |
| | | // 获得金币 |
| | | integralGetService.addCouponRebate(uid); |
| | | } |
| | | |
| | | /** |
| | | * 是否在参与推广 |
| | | * |
| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | import com.yeshi.fanli.entity.bus.help.AppPageNotification; |
| | | import com.yeshi.fanli.entity.bus.search.HistorySearch; |
| | | import com.yeshi.fanli.entity.goods.BaseGoodsInfo; |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | |
| | | import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil; |
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory; |
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; |
| | | import com.yeshi.fanli.util.goods.douyin.CSJCPSApiUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoods; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsSearchFilter; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.ListResult; |
| | | import com.yeshi.fanli.util.jd.JDApiUtil; |
| | | import com.yeshi.fanli.util.jd.JDUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | |
| | | case Constant.SOURCE_TYPE_SUNING: |
| | | type = "goodsdetail_suning"; |
| | | break; |
| | | case Constant.SOURCE_TYPE_DY: |
| | | type = "goodsdetail_dy"; |
| | | break; |
| | | |
| | | } |
| | | |
| | |
| | | public void searchGoods(AcceptData acceptData, Integer goodsType, String key, Integer page, String filter, |
| | | Integer order, Long uid, String notifyType, HttpSession session, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | if (goodsType == null || goodsType < 1 || goodsType > 5) { |
| | | if (goodsType == null || goodsType < 1 || goodsType > 7) { |
| | | out.print(JsonUtil.loadFalseResult(1, "请传递正确平台参数")); |
| | | return; |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | /*-------- 抖音商品 ------*/ |
| | | if (goodsType.intValue() == Constant.SOURCE_TYPE_DY) { |
| | | searchDYGoods(acceptData, uid, searchkey, page, filter, order, ap, out); |
| | | return; |
| | | } |
| | | |
| | | /*-------- 淘宝商品 -------*/ |
| | | searchTaoBaoGoods(acceptData, uid, searchkey, page, filter, order, ap, out); |
| | | |
| | |
| | | searchSuningGoods(acceptData, uid, searchkey, page, filter, order, ap, out); |
| | | return; |
| | | } |
| | | |
| | | |
| | | /*-------- 抖音商品 ------*/ |
| | | if (goodsType.intValue() == Constant.SOURCE_TYPE_DY) { |
| | | searchDYGoods(acceptData, uid, searchkey, page, filter, order, ap, out); |
| | | return; |
| | | } |
| | | |
| | | |
| | | /*-------- 淘宝商品 -------*/ |
| | | searchTaoBaoGoods(acceptData, uid, searchkey, page, filter, order, ap, out); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 搜索唯品会商品 |
| | | * 搜索抖音商品 |
| | | * |
| | | * @param acceptData |
| | | * @param key |
| | |
| | | * @Title: searchVIPGoods |
| | | * @Description: |
| | | */ |
| | | private void searchDYGoods(AcceptData acceptData, Long uid, String key, Integer page, String filter, Integer order, |
| | | AppPageNotification ap, PrintWriter out) { |
| | | String goodsId = null; |
| | | if (page == 1) { |
| | | List<String> linkList = HttpUtil.getUrlListFromText(key); |
| | | if (linkList != null && linkList.size() > 0) { |
| | | String productId = DYUtil.parseProdectIdFromLink(linkList.get(0)); |
| | | if (!StringUtil.isNullOrEmpty(productId)) { |
| | | goodsId = productId; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | long count = 0; |
| | | List<BaseGoodsInfo> goodsList = new ArrayList<>(); |
| | | if (goodsId != null) { |
| | | DYGoodsDetail goodsInfo = CSJCPSApiUtil.goodsDetail(Long.parseLong(goodsId)); |
| | | if (goodsInfo != null) { |
| | | goodsList.add(goodsInfo); |
| | | count = 1; |
| | | } |
| | | } else { |
| | | DYGoodsSearchFilter searchFilter = new DYGoodsSearchFilter(); |
| | | searchFilter.setTitle(key); |
| | | searchFilter.setPage(page); |
| | | searchFilter.setPageSize(Constant.PAGE_SIZE); |
| | | |
| | | if (order != null) { |
| | | int sort = order.intValue(); |
| | | switch (sort) { |
| | | case 1: // 销量 desc |
| | | searchFilter.setSearch_type(1); |
| | | searchFilter.setOrder_type(1); |
| | | break; |
| | | case 2: // 价格—desc |
| | | searchFilter.setSearch_type(2); |
| | | searchFilter.setOrder_type(1); |
| | | break; |
| | | case 3: // 价格—asc |
| | | searchFilter.setSearch_type(2); |
| | | searchFilter.setOrder_type(0); |
| | | break; |
| | | case 4: // 返利比 |
| | | searchFilter.setSearch_type(4); |
| | | searchFilter.setOrder_type(1); |
| | | break; |
| | | default: // 综合排序 |
| | | searchFilter.setSearch_type(0); |
| | | searchFilter.setOrder_type(0); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(filter)) { |
| | | JSONObject jsonfilter = JSONObject.fromObject(filter); |
| | | String minPrice = jsonfilter.optString("minPrice"); |
| | | if (!StringUtil.isNullOrEmpty(minPrice)) { |
| | | searchFilter.setPrice_min(new BigDecimal(minPrice).min(new BigDecimal(100)).intValue()); |
| | | } |
| | | |
| | | String maxPrice = jsonfilter.optString("maxPrice"); |
| | | if (!StringUtil.isNullOrEmpty(maxPrice)) { |
| | | searchFilter.setPrice_max(new BigDecimal(maxPrice).min(new BigDecimal(100)).intValue()); |
| | | } |
| | | } |
| | | |
| | | |
| | | ListResult result = CSJCPSApiUtil.searchGoods(searchFilter); |
| | | if (result != null) { |
| | | count = result.getCount(); |
| | | List<Object> tempList = result.getDataList(); |
| | | if (tempList != null) { |
| | | for (Object o : tempList) { |
| | | goodsList.add((DYGoods) o); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | JSONArray array = new JSONArray(); |
| | | |
| | | if (goodsList != null && goodsList.size() > 0) { |
| | | Gson gson = JsonUtil.getApiCommonGson(); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion(), acceptData.getSystem()); |
| | | |
| | | List<GoodsDetailVO> voList = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO); |
| | | for (GoodsDetailVO goodsDetailVO : voList) { |
| | | array.add(gson.toJson(goodsDetailVO)); |
| | | } |
| | | } |
| | | |
| | | data.put("result", array); |
| | | data.put("count", count); |
| | | out.print(JsonUtil.loadTrueResult(buildSearchResult(data, ap))); |
| | | } |
| | | |
| | | |
| | | private void searchVIPGoods(AcceptData acceptData, Long uid, String key, Integer page, String filter, Integer order, |
| | | AppPageNotification ap, PrintWriter out) { |
| | | String goodsId = null; |
| | |
| | | import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.CSJCPSApiUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYConvertResult; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | // 苏宁 |
| | | if (goodsType == Constant.SOURCE_TYPE_SUNING) { |
| | | createSuningShare(acceptData, uid, goodsId, source, needGoods, out); |
| | | return; |
| | | } |
| | | |
| | | // 抖音 |
| | | if (goodsType == Constant.SOURCE_TYPE_DY) { |
| | | createDYShare(acceptData, uid,Long.parseLong( goodsId), source, needGoods, out); |
| | | return; |
| | | } |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 抖音分享 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param goodsId |
| | | * @param source |
| | | * @param needGoods |
| | | * @param out void 返回类型 |
| | | * @throws |
| | | * @Title: createSuningShare |
| | | * @Description: |
| | | */ |
| | | public void createDYShare(AcceptData acceptData, Long uid, Long goodsId, String source, boolean needGoods, |
| | | PrintWriter out) { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(goodsId); |
| | | if (goods == null) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该商品已下架")); |
| | | return; |
| | | } |
| | | |
| | | SystemEnum system = SystemInfoUtil.getSystem(acceptData); |
| | | |
| | | |
| | | DYConvertResult convertResult = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createShareExtraInfo(uid), ""); |
| | | |
| | | ShareInfoVO shareInfo = new ShareInfoVO(); |
| | | shareInfo.setClickUrl(convertResult.getQrCode()); |
| | | shareInfo.setWxErCode(convertResult.getQrCode()); |
| | | shareInfo.setCommentTexts(new ArrayList<>()); |
| | | shareInfo.setRule(configService.getValue(ConfigKeyEnum.shareRuleLinkDY.getKey(), system)); |
| | | shareInfo.setPictUrl(goods.getCover()); |
| | | if (needGoods) { |
| | | shareInfo |
| | | .setGoodsInfo(GoodsDetailVOFactory.convertDYGoods(goods, |
| | | new GoodsMoneyConfigParamsDTO(hongBaoManageService.getFanLiRate(acceptData.getSystem()), |
| | | hongBaoManageService.getShareRate(acceptData.getSystem()), Constant.MAX_REWARD_RATE, |
| | | hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP, acceptData.getSystem())))); |
| | | } |
| | | |
| | | String template = shareGoodsTextTemplateService.getTextTemplateBySuNing(uid); |
| | | String shareText = shareGoodsTextTemplateService.createCommonShareTextDY(template, goods, convertResult.getDeeplink()); |
| | | shareInfo.setShareText(shareText); |
| | | |
| | | String descText = shareText.replace(goods.getTitle(), "").trim(); |
| | | if (descText.startsWith("\\r\\n")) { |
| | | descText = descText.substring(0); |
| | | } |
| | | shareInfo.setDescText(descText); |
| | | |
| | | // |
| | | String imgs = configService.getByVersion(ConfigKeyEnum.goodsShareNotifyImgs.getKey(), acceptData.getPlatform(), |
| | | Integer.parseInt(acceptData.getVersion()), system); |
| | | JSONArray array = JSONArray.fromObject(imgs); |
| | | |
| | | shareInfo.setNotifyPicture(array.size() > 1 ? array.optString(1) : array.optString(0)); |
| | | |
| | | // 2.0.7版本后的提示图片 |
| | | imgs = configService.getValue(ConfigKeyEnum.goodsShareNotifyImgs207.getKey(), system); |
| | | array = JSONArray.fromObject(imgs); |
| | | shareInfo.setNotifyPictureNew(array.size() > 1 ? array.optString(1) : array.optString(0)); |
| | | |
| | | shareInfo.setNotifyDesc(configService.getValue(ConfigKeyEnum.goodsShareNotifyDY.getKey(), system)); |
| | | |
| | | // 添加分享记录 |
| | | BigDecimal shareRate = hongBaoManageService.getShareRate(acceptData.getSystem()); |
| | | BigDecimal shareMoney = DYUtil.getGoodsFanLiMoney(goods, shareRate); |
| | | shareInfo.setShareMoney("¥" + shareMoney.toString()); |
| | | |
| | | try { |
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, |
| | | goodsId + "", Constant.SOURCE_TYPE_DY, false); |
| | | shareInfo.setShareId(shareRecord.getRedisKey()); |
| | | } catch (Exception e) { |
| | | try { |
| | | LogHelper.errorDetailInfo(e); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); |
| | | |
| | | |
| | | String commentText = ""; |
| | | String recommendText = ""; |
| | | String qtemplate = configService.getValue(ConfigKeyEnum.quickShareGoodsText.getKey(), system); |
| | | recommendText = qtemplate.replace("[商品标题]", goods.getTitle()); |
| | | |
| | | recommendText = recommendText.replace("推荐理由:[推荐语]", ""); |
| | | |
| | | |
| | | String quickCommentText = configService.getValue(ConfigKeyEnum.quickShareDYCommentText.getKey(), system); |
| | | |
| | | commentText = quickCommentText.replace("[原价]", BigDecimalUtil.getWithNoZera(DYUtil.getPrice(goods.getPrice())).toString()); |
| | | //commentText = commentText.replace("[链接]", jumpLink); |
| | | commentText = commentText.replace("[口令]", convertResult.getPassword()); |
| | | |
| | | |
| | | String salesCountMidea = ""; |
| | | Integer count = goods.getSales(); |
| | | if (count < 10000) { |
| | | salesCountMidea = count + ""; |
| | | } else { |
| | | double sales = count; |
| | | salesCountMidea = String.format("%.1f", sales / 10000); |
| | | salesCountMidea = salesCountMidea + "万"; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(salesCountMidea) || salesCountMidea.equals("0")) { |
| | | recommendText = recommendText.replace("销量:[销量]", ""); |
| | | } else { |
| | | recommendText = recommendText.replace("[销量]", salesCountMidea.replace("万", "w")); |
| | | } |
| | | |
| | | commentText = commentText.replace("领券抢购", "抢购").replace("【券后价】[券后价]元", ""); |
| | | recommendText = recommendText.replace("优惠券:[券面额]元", ""); |
| | | |
| | | shareInfo.setRecommendText(deleteBlankLine(recommendText)); |
| | | shareInfo.setCommentText(deleteBlankLine(commentText)); |
| | | |
| | | // 设置评论文本选项 |
| | | shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode, |
| | | DYUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP, acceptData.getSystem())))); |
| | | |
| | | out.print(JsonUtil.loadTrueResult( |
| | | JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo))); |
| | | |
| | | // 异步操作 |
| | | com.yeshi.fanli.util.ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // 异步操作 添加分享记录 |
| | | UserShareGoodsHistory history = new UserShareGoodsHistory(); |
| | | history.setUser(new UserInfo(uid)); |
| | | history.setHongbao(shareMoney); |
| | | history.setCreateTime(new Date()); |
| | | history.setGoodsType(Constant.SOURCE_TYPE_DY); |
| | | history.setTkCode(null); |
| | | history.setLink(null); |
| | | history.setQuanLink(null); |
| | | history.setGoodsId(goodsId + ""); |
| | | history.setPostPicture(goods.getCover()); |
| | | history.setShareImg(convertResult.getQrCode()); |
| | | List<String> imgList = new ArrayList<>(); |
| | | if (goods.getImgs() != null) { |
| | | for (String gi : goods.getImgs()) |
| | | imgList.add(gi); |
| | | } |
| | | history.setPictures(JsonUtil.getGson().toJson(imgList)); |
| | | shareGoodsService.addShareGoodsHistory(history); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 预览分享模板 |
| | | * |
| | |
| | | |
| | | if (goodsType == Constant.SOURCE_TYPE_SUNING) { |
| | | createSuNingViewText(acceptData.getSystem(), goodsType, uid, template, goodsId, hasCoupon, out); |
| | | return; |
| | | } |
| | | |
| | | if (goodsType == Constant.SOURCE_TYPE_DY) { |
| | | createDYViewText(acceptData.getSystem(), goodsType, uid, template, goodsId, hasCoupon, out); |
| | | return; |
| | | } |
| | | } |
| | |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | |
| | | private void createDYViewText(SystemEnum system, Integer goodsType, Long uid, String template, String goodsId, Boolean hasCoupon, |
| | | PrintWriter out) { |
| | | |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(goodsId)); |
| | | if (goods == null) { |
| | | out.print(JsonUtil.loadFalseResult(4, "商品已下架")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(template)) { |
| | | template = getShareTemplate(goodsType, uid, hasCoupon, null); |
| | | } |
| | | |
| | | // 校验券模板是否正确 |
| | | try { |
| | | shareGoodsTextTemplateService.verifyRightDY(template); |
| | | } catch (ShareGoodsTextTemplateException e) { |
| | | out.print(JsonUtil.loadFalseResult(5, e.getMsg())); |
| | | return; |
| | | } |
| | | |
| | | DYConvertResult convertResult = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(),DYUtil.createShareExtraInfo(uid),""); |
| | | |
| | | |
| | | // 生成普通分享内容 |
| | | String content = shareGoodsTextTemplateService.createCommonShareTextDY(template, goods, convertResult.getPassword()); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("content", content); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取分享模板 |
| | | * |
| | |
| | | template = shareGoodsTextTemplateService.getTextTemplateByVIP(uid); |
| | | } else if (goodsType == Constant.SOURCE_TYPE_SUNING) { |
| | | template = shareGoodsTextTemplateService.getTextTemplateBySuNing(uid); |
| | | }else if (goodsType == Constant.SOURCE_TYPE_DY) { |
| | | template = shareGoodsTextTemplateService.getTextTemplateByDY(uid); |
| | | } |
| | | return template; |
| | | } |
| | |
| | | out.print(JsonUtil.loadTrueResult(configService.getValue(ConfigKeyEnum.shareGoodsTemplateRulesVIP.getKey(), system))); |
| | | } else if (goodsType == Constant.SOURCE_TYPE_SUNING) { |
| | | out.print(JsonUtil.loadTrueResult(configService.getValue(ConfigKeyEnum.shareGoodsTemplateRulesSuNing.getKey(), system))); |
| | | }else if (goodsType == Constant.SOURCE_TYPE_DY) { |
| | | out.print(JsonUtil.loadTrueResult(configService.getValue(ConfigKeyEnum.shareGoodsTemplateRulesDY.getKey(), system))); |
| | | } |
| | | } |
| | | |
| | |
| | | shareGoodsTextTemplateService.saveTemplateVIP(uid, template); |
| | | } else if (goodsType == Constant.SOURCE_TYPE_SUNING) { |
| | | shareGoodsTextTemplateService.saveTemplateSuNing(uid, template); |
| | | } else if (goodsType == Constant.SOURCE_TYPE_DY) { |
| | | shareGoodsTextTemplateService.saveTemplateDY(uid, template); |
| | | } |
| | | } catch (ShareGoodsTextTemplateException e) { |
| | | out.print(JsonUtil.loadFalseResult(5, e.getMsg())); |
| | |
| | | shareGoodsTextTemplateService.resetCommonTemplateVIP(uid); |
| | | } else if (goodsType == Constant.SOURCE_TYPE_SUNING) { |
| | | shareGoodsTextTemplateService.resetCommonTemplateSuNing(uid); |
| | | }else if (goodsType == Constant.SOURCE_TYPE_DY) { |
| | | shareGoodsTextTemplateService.resetCommonTemplateDY(uid); |
| | | } |
| | | |
| | | if (goodsId != null) { |
| | |
| | | if (goods != null) { |
| | | goodsDetail = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO); |
| | | } |
| | | }else if (goodsType == Constant.SOURCE_TYPE_DY) { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(goodsId)); |
| | | if (goods != null) { |
| | | goodsDetail = GoodsDetailVOFactory.convertDYGoods(goods, paramsDTO); |
| | | } |
| | | } |
| | | |
| | | if (goodsDetail == null) { |
New file |
| | |
| | | package com.yeshi.fanli.dao.dy; |
| | | |
| | | import com.yeshi.common.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.bus.search.HistorySearch; |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class DYOrderDao extends MongodbBaseDao<DYOrder> { |
| | | |
| | | |
| | | public List<DYOrder> listByOrderId(String orderId) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("order_id").is(orderId)); |
| | | return findList(query); |
| | | } |
| | | |
| | | public DYOrder selectByPrimaryKey(String id) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("_id").is(id)); |
| | | return findOne(query); |
| | | } |
| | | |
| | | public void updateByPrimaryKey(DYOrder order) { |
| | | if (order == null || order.getId() == null) { |
| | | return; |
| | | } |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("_id").is(order.getId())); |
| | | Update update = new Update(); |
| | | if (order.getOrder_id() != null) { |
| | | update.set("order_id", order.getOrder_id()); |
| | | } |
| | | if (order.getAfter_sales_status() != null) { |
| | | update.set("after_sales_status", order.getAfter_sales_status()); |
| | | } |
| | | if (order.getFlow_point() != null) { |
| | | update.set("flow_point", order.getFlow_point()); |
| | | } |
| | | if (order.getProduct_id() != null) { |
| | | update.set("product_id", order.getProduct_id()); |
| | | } |
| | | if (order.getEstimated_commission() != null) { |
| | | update.set("estimated_commission", order.getEstimated_commission()); |
| | | } |
| | | if (order.getPay_success_time() != null) { |
| | | update.set("pay_success_time", order.getPay_success_time()); |
| | | } |
| | | if (order.getTotal_pay_amount() != null) { |
| | | update.set("total_pay_amount", order.getTotal_pay_amount()); |
| | | } |
| | | |
| | | if (order.getApp_id() != null) { |
| | | update.set("app_id", order.getApp_id()); |
| | | } |
| | | if (order.getExternal_info() != null) { |
| | | update.set("external_info", order.getExternal_info()); |
| | | } |
| | | if (order.getPay_goods_amount() != null) { |
| | | update.set("pay_goods_amount", order.getPay_goods_amount()); |
| | | } |
| | | if (order.getProduct_img() != null) { |
| | | update.set("product_img", order.getProduct_img()); |
| | | } |
| | | if (order.getProduct_name() != null) { |
| | | update.set("product_name", order.getProduct_name()); |
| | | } |
| | | |
| | | if (order.getSettle_time() != null) { |
| | | update.set("settle_time", order.getSettle_time()); |
| | | } |
| | | if (order.getConfirm_time() != null) { |
| | | update.set("confirm_time", order.getConfirm_time()); |
| | | } |
| | | if (order.getEstimated_tech_service_fee() != null) { |
| | | update.set("estimated_tech_service_fee", order.getEstimated_tech_service_fee()); |
| | | } |
| | | if (order.getRefund_time() != null) { |
| | | update.set("refund_time", order.getRefund_time()); |
| | | } |
| | | |
| | | if (order.getSplit_rate() != null) { |
| | | update.set("split_rate", order.getSplit_rate()); |
| | | } |
| | | |
| | | if (order.getUpdateTime() != null) { |
| | | update.set("updateTime", order.getUpdateTime()); |
| | | } |
| | | update(query, update); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.order.body; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: CommonOrderMQMsg |
| | | * @description: 订单消息 |
| | | * @date 2022/10/8 15:24 |
| | | */ |
| | | public class CommonOrderMQMsg { |
| | | private String orderId; |
| | | private int sourceType; |
| | | |
| | | public CommonOrderMQMsg(String orderId, int sourceType) { |
| | | this.orderId = orderId; |
| | | this.sourceType = sourceType; |
| | | } |
| | | |
| | | public String getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(String orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public int getSourceType() { |
| | | return sourceType; |
| | | } |
| | | |
| | | public void setSourceType(int sourceType) { |
| | | this.sourceType = sourceType; |
| | | } |
| | | } |
File was renamed from fanli/src/main/java/com/yeshi/fanli/util/goods/douyin/vo/DYOrder.java |
| | |
| | | package com.yeshi.fanli.util.goods.douyin.vo; |
| | | package com.yeshi.fanli.entity.dy; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | |
| | | * @description: 抖音订单 |
| | | * @date 2022/9/30 16:00 |
| | | */ |
| | | @Document(collection = "dy_order") |
| | | public class DYOrder { |
| | | //支付成功 |
| | | public final static String FLOW_POINT_PAY_SUCCESS="PAY_SUCC"; |
| | |
| | | /** |
| | | * 订单id |
| | | **/ |
| | | @Id |
| | | private String id; |
| | | |
| | | |
| | | private String order_id; |
| | | /** |
| | | * 应⽤id |
| | |
| | | /** |
| | | * 总付款⾦额,单位分 |
| | | **/ |
| | | private int total_pay_amount; |
| | | private Integer total_pay_amount; |
| | | /** |
| | | * ⽀付成功时间 yyyy-MM-dd HH:mm:ss |
| | | **/ |
| | |
| | | * 预估结算⾦额,单位分。如果有⽀付优惠, |
| | | * pay_goods_amount会略⼤于total_pay_amount |
| | | **/ |
| | | private int pay_goods_amount; |
| | | private Integer pay_goods_amount; |
| | | /** |
| | | * 预估佣⾦收⼊,单位分 |
| | | **/ |
| | | private int estimated_commission; |
| | | private Integer estimated_commission; |
| | | /** |
| | | * 推⼴费率,10代表推⼴费率为0.10 |
| | | **/ |
| | | private int split_rate; |
| | | private Integer split_rate; |
| | | /** |
| | | * 售后状态,1-空,2-产⽣退款 |
| | | **/ |
| | | private int after_sales_status; |
| | | private Integer after_sales_status; |
| | | /** |
| | | * PAY_SUCC:⽀付完成 |
| | | * REFUND:退款 |
| | |
| | | * 预估技术服务费,为pay_goods_amount*0.1。此字段 |
| | | * 当前不准,仅供参考。 |
| | | **/ |
| | | private int estimated_tech_service_fee; |
| | | private Integer estimated_tech_service_fee; |
| | | |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | public String getOrder_id() { |
| | | return order_id; |
| | |
| | | this.product_img = product_img; |
| | | } |
| | | |
| | | public int getTotal_pay_amount() { |
| | | public Integer getTotal_pay_amount() { |
| | | return total_pay_amount; |
| | | } |
| | | |
| | | public void setTotal_pay_amount(int total_pay_amount) { |
| | | public void setTotal_pay_amount(Integer total_pay_amount) { |
| | | this.total_pay_amount = total_pay_amount; |
| | | } |
| | | |
| | |
| | | this.refund_time = refund_time; |
| | | } |
| | | |
| | | public int getPay_goods_amount() { |
| | | public Integer getPay_goods_amount() { |
| | | return pay_goods_amount; |
| | | } |
| | | |
| | | public void setPay_goods_amount(int pay_goods_amount) { |
| | | public void setPay_goods_amount(Integer pay_goods_amount) { |
| | | this.pay_goods_amount = pay_goods_amount; |
| | | } |
| | | |
| | | public int getEstimated_commission() { |
| | | public Integer getEstimated_commission() { |
| | | return estimated_commission; |
| | | } |
| | | |
| | | public void setEstimated_commission(int estimated_commission) { |
| | | public void setEstimated_commission(Integer estimated_commission) { |
| | | this.estimated_commission = estimated_commission; |
| | | } |
| | | |
| | | public int getSplit_rate() { |
| | | public Integer getSplit_rate() { |
| | | return split_rate; |
| | | } |
| | | |
| | | public void setSplit_rate(int split_rate) { |
| | | public void setSplit_rate(Integer split_rate) { |
| | | this.split_rate = split_rate; |
| | | } |
| | | |
| | | public int getAfter_sales_status() { |
| | | public Integer getAfter_sales_status() { |
| | | return after_sales_status; |
| | | } |
| | | |
| | | public void setAfter_sales_status(int after_sales_status) { |
| | | public void setAfter_sales_status(Integer after_sales_status) { |
| | | this.after_sales_status = after_sales_status; |
| | | } |
| | | |
| | |
| | | this.confirm_time = confirm_time; |
| | | } |
| | | |
| | | public int getEstimated_tech_service_fee() { |
| | | public Integer getEstimated_tech_service_fee() { |
| | | return estimated_tech_service_fee; |
| | | } |
| | | |
| | | public void setEstimated_tech_service_fee(int estimated_tech_service_fee) { |
| | | public void setEstimated_tech_service_fee(Integer estimated_tech_service_fee) { |
| | | this.estimated_tech_service_fee = estimated_tech_service_fee; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String toId() { |
| | | return order_id + "-" + product_id; |
| | | } |
| | | } |
| | |
| | | public static int GOODS_TYPE_VIP = 4;// 唯品会 |
| | | public static int GOODS_TYPE_SUNING = 5;// 苏宁 |
| | | |
| | | public static int GOODS_TYPE_DY = 7;// 抖音 |
| | | |
| | | public static int SHOP_TYPE_TB = 1;// 淘宝 |
| | | public static int SHOP_TYPE_TM = 2;// 天猫 |
| | | public static int SHOP_TYPE_JD = 20;// 京东 |
| | |
| | | public static int SHOP_TYPE_SUNING = 50;//苏宁 |
| | | public static int SHOP_TYPE_SUNING_SELF = 51;//苏宁自营 |
| | | |
| | | public static int SHOP_TYPE_DY = 70;//抖音 |
| | | |
| | | |
| | | public static int STATE_NORMAL = 0;// 正常 |
| | | public static int STATE_OFFLINE = 1;// 下线 |
| | |
| | | @Column(name = "st_share_suning_text_template_coupon") |
| | | private String shareSuNingTextTemplateCoupon;// 苏宁有券分享模板 |
| | | |
| | | @Column(name = "st_share_dy_text_template") |
| | | private String shareDYTextTemplate;// 抖音无券分享模板 |
| | | |
| | | public String getShareVIPTextTemplate() { |
| | | return shareVIPTextTemplate; |
| | | } |
| | |
| | | this.shareSuNingTextTemplateCoupon = shareSuNingTextTemplateCoupon; |
| | | } |
| | | |
| | | public String getShareDYTextTemplate() { |
| | | return shareDYTextTemplate; |
| | | } |
| | | |
| | | public void setShareDYTextTemplate(String shareDYTextTemplate) { |
| | | this.shareDYTextTemplate = shareDYTextTemplate; |
| | | } |
| | | } |
| | |
| | | jingDong("京东","京东","#E42219","#E42219", "http://img.flqapp.com/resource/icon/source_type_jd.png"), |
| | | pinDuoDuo("拼多多", "拼多多","#F51E25","#F51E25","http://img.flqapp.com/resource/icon/source_type_pdd.png"), |
| | | vip("唯品会","唯品会","#E30085", "#E30085", "http://img.flqapp.com/resource/icon/source_type_vip.png"), |
| | | suNing("苏宁","苏宁易购","#010101","#FFA600", "http://img.flqapp.com/resource/icon/source_type_suning.png"); |
| | | suNing("苏宁","苏宁易购","#010101","#FFA600", "http://img.flqapp.com/resource/icon/source_type_suning.png"), |
| | | dy("抖音","抖音","#180b1a", "#180b1a", "http://img.flqapp.com/resource/icon/source_type_dy.png"); |
| | | |
| | | private final String desc; // 数据存在名称 |
| | | private final String descShow; // 显示名称 |
| | |
| | | shareRuleLinkPDD("share_rule_link_pdd", "拼多多分享规则(帮助中心)"), |
| | | shareRuleLinkVIP("share_rule_link_vip", "唯品会分享规则(帮助中心)"), |
| | | shareRuleLinkSuning("share_rule_link_suning", "苏宁分享规则(帮助中心)"), |
| | | shareRuleLinkDY("share_rule_link_dy", "抖音分享规则(帮助中心)"), |
| | | shareSingleGoodsRule("share_single_goods_rule", "单品分享规则"), |
| | | shareGoodsTemplateRules("share_goods_template_rules", "分享模板规则"), // 存在2个相同 |
| | | // 内容不同、版本但一样 |
| | |
| | | shareGoodsTemplateRulesPDD("share_goods_template_rules_pdd", "拼多多模板规则"), |
| | | shareGoodsTemplateRulesVIP("share_goods_template_rules_vip", "唯品会模板规则"), |
| | | shareGoodsTemplateRulesSuNing("share_goods_template_rules_suning", "苏宁模板规则"), |
| | | shareGoodsTemplateRulesDY("share_goods_template_rules_dy", "苏宁模板规则"), |
| | | goodsShareNotifyImgs("goods_share_notify_imgs", "单个商品分享的券提示图片"), |
| | | goodsShareMultipleNotify("goods_share_multiple_notify", "多个商品分享提醒"), |
| | | goodsShareNotifyImgs207("goods_share_notify_imgs_207", "单个商品分享的券提示图片(2.0.7及以后)"), |
| | |
| | | goodsShareNotify("goods_share_notify", "单个商品分享提醒"), |
| | | goodsShareNotifyJD("goods_share_notify_jd", "京东分享提醒"), |
| | | goodsShareNotifyPDD("goods_share_notify_pdd", "拼多多分享提醒"), |
| | | goodsShareNotifyVIP("goods_share_notify_vip", "拼多多分享提醒"), |
| | | goodsShareNotifySuning("goods_share_notify_Suning", "拼多多分享提醒"), |
| | | goodsShareNotifyVIP("goods_share_notify_vip", "唯品会分享提醒"), |
| | | goodsShareNotifySuning("goods_share_notify_suning", "苏宁分享提醒"), |
| | | goodsShareNotifyDY("goods_share_notify_dy", "抖音分享提醒"), |
| | | |
| | | goodsShareTextCoupon("goods_share_text_coupon", "单个商品分享文案(有券)"), |
| | | goodsShareTextCouponJD("goods_share_text_coupon_jd", "京东单个商品分享模板-有券"), |
| | |
| | | quickSharePDDCommentText("quick_share_pdd_comment_text", "快捷分享商品文本"), |
| | | quickShareVIPCommentText("quick_share_vip_comment_text", "快捷分享商品文本"), |
| | | quickShareSuNingCommentText("quick_share_suning_comment_text", "快捷分享商品文本"), |
| | | |
| | | quickShareDYCommentText("quick_share_dy_comment_text", "快捷分享商品文本"), |
| | | |
| | | shareCommentTextTB("share_comment_text_tb", "淘宝单图多图分享商品文本"), |
| | | shareCommentTextJD("share_comment_text_jd", "京东单图多图分享商品文本"), |
| | | shareCommentTextPDD("share_comment_text_pdd", "拼多多单图多图分享商品文本"), |
| | | shareCommentTextVIP("share_comment_text_vip", "唯品会单图多图分享商品文本"), |
| | | shareCommentTextSuNing("share_comment_text_suning", "苏宁单图多图分享商品文本"), |
| | | shareCommentTextDY("share_comment_text_dy", "抖音单图多图分享商品文本"), |
| | | |
| | | |
| | | evaluateEmojis("evaluate_emojis", "发圈评论Emojis"), |
New file |
| | |
| | | package com.yeshi.fanli.exception.dy; |
| | | |
| | | import com.yeshi.fanli.exception.BaseException; |
| | | |
| | | public class DYOrderException extends BaseException { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public DYOrderException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
| | | public DYOrderException() { |
| | | super(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.job.order.dy; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.fanli.dto.mq.order.body.CommonOrderMQMsg; |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | import com.yeshi.fanli.exception.dy.DYOrderException; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.order.dy.DYOrderService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.RedisKeyEnum; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.CSJCPSApiUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYOrderFilter; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYOrderResult; |
| | | import com.yeshi.fanli.util.mq.cmq.order.OrdersCMQManager; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | //从抖音爬取订单更新 |
| | | @Component |
| | | public class UpdateDYOrderJob { |
| | | |
| | | @Resource |
| | | private DYOrderService dyOrderService; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | |
| | | /** |
| | | * 保存订单 |
| | | * |
| | | * @param dyOrderList |
| | | */ |
| | | public void saveDYOrders(List<DYOrder> dyOrderList) { |
| | | //5分钟不更新就报警 |
| | | try { |
| | | redisManager.cacheCommonString(RedisKeyEnum.monitor.getKey() + Constant.SOURCE_TYPE_DY, "1", 60 * 5); |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | for (DYOrder order : dyOrderList) { |
| | | LogHelper.orderInfo("抖音订单:" + order.getOrder_id() + "-" + order.getFlow_point()); |
| | | try { |
| | | dyOrderService.addOrder(order); |
| | | /** |
| | | * 做频率限制 |
| | | */ |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.DYOrder, order.getOrder_id() + ""); |
| | | String result = redisManager.getCommonString(key); |
| | | // 判断 |
| | | if (StringUtil.isNullOrEmpty(result)) { |
| | | OrdersCMQManager.getInstance().addOrder(new CommonOrderMQMsg(order.getOrder_id() + "", Constant.SOURCE_TYPE_DY)); |
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 2小时内不再更新 |
| | | } |
| | | } catch (DYOrderException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 快速订单更新(爬取本小时内的单,每分钟一次) |
| | | */ |
| | | @XxlJob("updateDYOrderHandler") |
| | | public ReturnT<String> updateDYOrder(String param) throws Exception { |
| | | if ("1".equalsIgnoreCase(param)) {// 更新5分钟内的订单 |
| | | LogHelper.job("开始爬取抖音订单"); |
| | | DYOrderFilter filter = new DYOrderFilter(); |
| | | filter.setCursor("0"); |
| | | filter.setEnd_time(System.currentTimeMillis() / 1000); |
| | | filter.setStart_time(filter.getEnd_time() - 60 * 5); |
| | | //商品分销订单 |
| | | filter.setOrder_type(DYOrderFilter.ORDER_TYPE_GOODS); |
| | | updateOrder(filter); |
| | | //直播分销订单 |
| | | filter.setOrder_type(DYOrderFilter.ORDER_TYPE_LIVE); |
| | | updateOrder(filter); |
| | | } else if ("1hour".equalsIgnoreCase(param)) {// 更新1小时内的订单 |
| | | DYOrderFilter filter = new DYOrderFilter(); |
| | | filter.setCursor("0"); |
| | | filter.setEnd_time(System.currentTimeMillis() / 1000); |
| | | filter.setStart_time(filter.getEnd_time() - 60 * 60); |
| | | //商品分销订单 |
| | | filter.setOrder_type(DYOrderFilter.ORDER_TYPE_GOODS); |
| | | updateOrder(filter); |
| | | //直播分销订单 |
| | | filter.setOrder_type(DYOrderFilter.ORDER_TYPE_LIVE); |
| | | updateOrder(filter); |
| | | } else if ("1day".equalsIgnoreCase(param)) {// 更新1天内的订单 |
| | | DYOrderFilter filter = new DYOrderFilter(); |
| | | filter.setCursor("0"); |
| | | filter.setEnd_time(System.currentTimeMillis() / 1000); |
| | | filter.setStart_time(filter.getEnd_time() - 60 * 60 * 24); |
| | | //商品分销订单 |
| | | filter.setOrder_type(DYOrderFilter.ORDER_TYPE_GOODS); |
| | | updateOrder(filter); |
| | | //直播分销订单 |
| | | filter.setOrder_type(DYOrderFilter.ORDER_TYPE_LIVE); |
| | | updateOrder(filter); |
| | | } else if ("3day".equalsIgnoreCase(param)) {// 更新最近3天更新的数据 |
| | | DYOrderFilter filter = new DYOrderFilter(); |
| | | filter.setCursor("0"); |
| | | filter.setEnd_time(System.currentTimeMillis() / 1000); |
| | | filter.setStart_time(filter.getEnd_time() - 60 * 60 * 24 * 10); |
| | | //商品分销订单 |
| | | filter.setOrder_type(DYOrderFilter.ORDER_TYPE_GOODS); |
| | | updateOrder(filter); |
| | | //直播分销订单 |
| | | filter.setOrder_type(DYOrderFilter.ORDER_TYPE_LIVE); |
| | | updateOrder(filter); |
| | | } |
| | | |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | private void updateOrder(DYOrderFilter filter) { |
| | | if (filter.getSize() == null) { |
| | | filter.setSize(50); |
| | | } |
| | | DYOrderResult result = CSJCPSApiUtil.orderList(filter); |
| | | if (result != null && result.getOrders() != null) { |
| | | saveDYOrders(result.getOrders()); |
| | | } |
| | | if (result != null && !StringUtil.isNullOrEmpty(result.getCursor())) { |
| | | filter.setCursor(result.getCursor()); |
| | | updateOrder(filter); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.job.order.jd; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.dao.jd.JDOrderBackUpDao; |
| | | import com.yeshi.fanli.dto.jd.JDOrderForBackUpResult; |
| | | import com.yeshi.fanli.dto.mq.order.body.CommonOrderMQMsg; |
| | | import com.yeshi.fanli.entity.jd.JDBackUpOrder; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.annotation.JobMonitor; |
| | | import com.yeshi.fanli.util.mq.cmq.order.OrdersCMQManager; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | |
| | | |
| | | @Resource |
| | | private JDOrderBackUpDao jdOrderBackUpDao; |
| | | |
| | | @Resource |
| | | private CommonOrderService commonOrderService; |
| | | |
| | | |
| | | /** |
| | |
| | | String result = redisManager.getCommonString(key); |
| | | // 判断 |
| | | if (StringUtil.isNullOrEmpty(result)) { |
| | | JDOrderCMQManager.getInstance().addJDOrder(order.getOrderId() + ""); |
| | | OrdersCMQManager.getInstance().addOrder(new CommonOrderMQMsg(order.getOrderId() + "", Constant.SOURCE_TYPE_JD)); |
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 2小时内不再更新 |
| | | } |
| | | } catch (JDOrderException e) { |
| | |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | //处理很久没处理的数据 |
| | | @JobMonitor(key = "", maxSpaceTime = 60 * 60 * 25) |
| | | @XxlJob("order-jd-process-outdate") |
| | | public ReturnT<String> processoutOfDate(String param) throws Exception { |
| | | //查询 1个月到5个月处于已付款状态的数据 |
| | | long maxTime = System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 30; |
| | | long minTime = maxTime - 1000 * 60 * 60 * 24L * 120; |
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndStateAndThirdCrateTime(Constant.SOURCE_TYPE_JD, CommonOrder.STATE_FK, minTime, maxTime, 1, 200); |
| | | Set<String> orderIds = new HashSet<>(); |
| | | for (CommonOrder co : orderList) { |
| | | orderIds.add(co.getOrderNo()); |
| | | } |
| | | for (String orderId : orderIds) { |
| | | OrdersCMQManager.getInstance().addOrder(new CommonOrderMQMsg(orderId, Constant.SOURCE_TYPE_JD)); |
| | | } |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | private List<JDBackUpOrder> getBackUpOrders(Date hourDate) { |
| | | List<JDBackUpOrder> jdOrderList = new ArrayList<>(); |
| | | int pageSize = 200; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.dto.mq.order.body.CommonOrderMQMsg; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.mq.cmq.order.OrdersCMQManager; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | |
| | | /** |
| | | * 保存订单 |
| | | * |
| | | * @param jdOrderList |
| | | * @param orderList |
| | | */ |
| | | public void savePDDOrders(List<PDDOrder> orderList) { |
| | | //5分钟不更新就报警 |
| | |
| | | String result = redisManager.getCommonString(key); |
| | | // if (!StringUtil.isNullOrEmpty(result)) |
| | | // continue; |
| | | PDDOrderCMQManager.getInstance().addPDDOrder(order.getOrderSn() + ""); |
| | | OrdersCMQManager.getInstance().addOrder(new CommonOrderMQMsg(order.getOrderSn() + "",Constant.SOURCE_TYPE_PDD)); |
| | | |
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 2小时内不再更新 |
| | | } catch (PDDOrderException e) { |
| | | e.printStackTrace(); |
| | |
| | | */ |
| | | // @Scheduled(cron = "0 0/30 * * * ? ") |
| | | public void updateUpdateOrder() { |
| | | |
| | | long endTime = System.currentTimeMillis() - 1000 * 60 * 60L; |
| | | long startTime = System.currentTimeMillis() - 1000 * 60 * 60 * 24L; |
| | | |
| | | updateUpdateOrder(startTime,endTime); |
| | | } |
| | | |
| | | public void updateUpdateOrder(long startTime,long endTime) { |
| | | int page = 1; |
| | | List<PDDOrder> pddOrderList = new ArrayList<>(); |
| | | PDDOrderResult result = PinDuoDuoApiUtil.getOrdersList(page++, 50, startTime, endTime); |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.dto.mq.order.body.CommonOrderMQMsg; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.mq.cmq.order.OrdersCMQManager; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | |
| | | String result = redisManager.getCommonString(key); |
| | | // 判断 |
| | | if (StringUtil.isNullOrEmpty(result)) { |
| | | SuningOrderCMQManager.getInstance().addSuningOrder(order.getOrderCode() + ""); |
| | | OrdersCMQManager.getInstance().addOrder(new CommonOrderMQMsg(order.getOrderCode() + "",Constant.SOURCE_TYPE_SUNING)); |
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 2小时内不再更新 |
| | | } |
| | | } catch (SuningOrderException e) { |
| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.vipshop.VipShopOrderMapper; |
| | | import com.yeshi.fanli.dto.mq.order.body.CommonOrderMQMsg; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.mq.cmq.order.OrdersCMQManager; |
| | | import com.yeshi.fanli.util.vipshop.DingDanXiaApiUtil; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | String result = redisManager.getCommonString(key); |
| | | // 判断 |
| | | // if (StringUtil.isNullOrEmpty(result)) { |
| | | VipShopOrderCMQManager.getInstance().addVipShopOrder(order.getOrderSn() + ""); |
| | | OrdersCMQManager.getInstance().addOrder(new CommonOrderMQMsg(order.getOrderSn() + "",Constant.SOURCE_TYPE_VIP)); |
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 2小时内不再更新 |
| | | LogHelper.test("唯品会订单消息发送成功"); |
| | | // }else{ |
| | |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.SystemInfoUtil; |
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoods; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import com.yeshi.fanli.util.jd.JDUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil; |
| | | import com.yeshi.fanli.util.suning.SuningUtil; |
| | |
| | | couponPrice = SuningUtil.getCouponPrice((SuningGoodsInfo) goods); |
| | | fanliMoney = SuningUtil.getGoodsFanLiMoney((SuningGoodsInfo) goods, fanliRate); |
| | | } |
| | | }else if (goods instanceof DYGoods) { |
| | | detailVO = GoodsDetailVOFactory.convertDYGoods((DYGoods) goods, paramsDTO); |
| | | if (fanliRate != null) { |
| | | couponPrice = DYUtil.getCouponPrice((DYGoods) goods); |
| | | fanliMoney = DYUtil.getGoodsFanLiMoney((DYGoods) goods, fanliRate); |
| | | } |
| | | }else if (goods instanceof DYGoodsDetail) { |
| | | detailVO = GoodsDetailVOFactory.convertDYGoods((DYGoodsDetail) goods, paramsDTO); |
| | | if (fanliRate != null) { |
| | | couponPrice = DYUtil.getCouponPrice((DYGoodsDetail) goods); |
| | | fanliMoney = DYUtil.getGoodsFanLiMoney((DYGoodsDetail) goods, fanliRate); |
| | | } |
| | | } else if (goods instanceof CommonGoods) { |
| | | detailVO = GoodsDetailVOFactory.convertCommonGoods((CommonGoods) goods, paramsDTO); |
| | | if (fanliRate != null) { |
| | |
| | | import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil; |
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory; |
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoods; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import com.yeshi.fanli.util.jd.JDApiUtil; |
| | | import com.yeshi.fanli.util.jd.JDUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateDYGoods(DYGoodsDetail goods) { |
| | | if (goods == null) { |
| | | return; |
| | | } |
| | | for (SystemEnum system : SystemEnum.values()) { |
| | | List<GoodsEvaluate> queryExist = goodsEvaluateDao.queryExist(Constant.SOURCE_TYPE_DY, |
| | | goods.getProduct_id()+"", system); |
| | | if (queryExist == null || queryExist.size() == 0) { |
| | | continue; |
| | | } |
| | | |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system)); |
| | | GoodsDetailVO goodsNew = GoodsDetailVOFactory.convertDYGoods(goods, paramsDTO); |
| | | updateGoods(queryExist, goodsNew); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateSuningGoods(SuningGoodsInfo goods) { |
| | | if (goods == null) { |
| | | return; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void addDYCollection(Long uid, DYGoodsDetail goods) throws CollectionGoodsException { |
| | | if (uid == null || uid == 0) |
| | | throw new CollectionGoodsException(1, "无用户ID"); |
| | | CommonGoods commonGoods = CommonGoodsFactory.create(goods); |
| | | addCollection(uid,commonGoods); |
| | | } |
| | | |
| | | @Override |
| | | public void addSuningCollection(Long uid, SuningGoodsInfo goods) throws CollectionGoodsException { |
| | | if (uid == null || uid == 0) |
| | | throw new CollectionGoodsException(1, "无用户ID"); |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.goods.ScanHistoryV2Mapper; |
| | |
| | | addScanHistory(commonGoods, device, uid); |
| | | } |
| | | |
| | | @Override |
| | | public void addDYScanHistory(Long uid, String device, DYGoodsDetail dyGoods) throws CommonGoodsException, ScanHistoryException { |
| | | if (uid == null && StringUtil.isNullOrEmpty(device)) |
| | | throw new ScanHistoryException(1, "设备或用户信息缺失"); |
| | | CommonGoods commonGoods = CommonGoodsFactory.create(dyGoods); |
| | | addScanHistory(commonGoods, device, uid); |
| | | } |
| | | |
| | | private void addScanHistory(CommonGoods commonGoods, String device, Long uid) |
| | | throws CommonGoodsException, ScanHistoryException { |
| | | commonGoods = commonGoodsService.addOrUpdateCommonGoods(commonGoods); |
| | |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.yeshi.utils.BigDecimalUtil; |
| | |
| | | * 分享商品模板 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Service |
| | | public class ShareGoodsTextTemplateServiceImpl implements ShareGoodsTextTemplateService { |
| | |
| | | return template; |
| | | } |
| | | |
| | | @Override |
| | | public void resetCommonTemplateDY(Long uid) { |
| | | ShareGoodsTextTemplate template = shareGoodsTextTemplateMapper.selectByUid(uid); |
| | | if (template != null) { |
| | | ShareGoodsTextTemplate update = new ShareGoodsTextTemplate(); |
| | | update.setId(template.getId()); |
| | | update.setShareDYTextTemplate(""); |
| | | update.setUpdateTime(new Date()); |
| | | shareGoodsTextTemplateMapper.updateByPrimaryKeySelective(update); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void resetCouponTemplateDY(Long uid) { |
| | | ShareGoodsTextTemplate template = shareGoodsTextTemplateMapper.selectByUid(uid); |
| | | if (template != null) { |
| | | ShareGoodsTextTemplate update = new ShareGoodsTextTemplate(); |
| | | update.setId(template.getId()); |
| | | update.setShareDYTextTemplate(""); |
| | | update.setUpdateTime(new Date()); |
| | | shareGoodsTextTemplateMapper.updateByPrimaryKeySelective(update); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getTextTemplateByDY(Long uid) { |
| | | String template = ""; |
| | | ShareGoodsTextTemplate objct = shareGoodsTextTemplateMapper.selectByUid(uid); |
| | | if (objct != null && !StringUtil.isNullOrEmpty(objct.getShareDYTextTemplate())) { |
| | | template = objct.getShareDYTextTemplate(); |
| | | } |
| | | if (StringUtil.isNullOrEmpty(template)) { |
| | | SystemEnum system = userInfoService.getUserSystem(uid); |
| | | template = configService.getValue(ConfigKeyEnum.shareCommentTextDY.getKey(), system); |
| | | } |
| | | |
| | | return template; |
| | | } |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void saveTemplateDY(Long uid, String template) throws ShareGoodsTextTemplateException { |
| | | verifyRightDY(template); |
| | | ShareGoodsTextTemplate old = shareGoodsTextTemplateMapper.selectByUid(uid); |
| | | if (old != null) { |
| | | ShareGoodsTextTemplate update = new ShareGoodsTextTemplate(); |
| | | update.setId(old.getId()); |
| | | update.setShareDYTextTemplate(template); |
| | | update.setUpdateTime(new Date()); |
| | | shareGoodsTextTemplateMapper.updateByPrimaryKeySelective(update); |
| | | } else { |
| | | ShareGoodsTextTemplate textTemplate = new ShareGoodsTextTemplate(); |
| | | textTemplate.setCreateTime(new Date()); |
| | | textTemplate.setShareDYTextTemplate(template); |
| | | textTemplate.setUid(uid); |
| | | shareGoodsTextTemplateMapper.insertSelective(textTemplate); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void verifyRightTB(String template) throws ShareGoodsTextTemplateException { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void verifyRightDY(String template) throws ShareGoodsTextTemplateException { |
| | | String[] keys = new String[]{"{原价}", "{券后价}", "{链接}"}; |
| | | int keysCount = 0; |
| | | for (String key : keys) |
| | | if (template != null && template.contains(key)) |
| | | keysCount++; |
| | | if (keysCount == 0) |
| | | throw new ShareGoodsTextTemplateException(1, "模板格式有误"); |
| | | } |
| | | |
| | | @Override |
| | | public String createContentTB(String template, TaoBaoGoodsBrief goods, String token, boolean coupon) { |
| | | String commentText = template.replace("{原价}", goods.getZkPrice().toString()); |
| | | commentText = commentText.replace("{淘口令}", TaoBaoUtil.filterTaoToken(token)); |
| | |
| | | commentText = commentText.replace("{折扣价}", "" +MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(goods.getVipPrice()))); |
| | | return deleteBlankLine(commentText); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public String createQuickShareTextSuNing(String template, SuningGoodsInfo goods, String jumpLink) { |
| | | String commodityPrice = goods.getCommodityInfo().getCommodityPrice(); |
| | |
| | | return deleteBlankLine(commentText); |
| | | } |
| | | |
| | | @Override |
| | | public String createCommonShareTextDY(String template, DYGoodsDetail goods, String jumpLink) { |
| | | String commentText = template.replace("{原价}", BigDecimalUtil.getWithNoZera(DYUtil.getPrice(goods.getPrice())).toString()); |
| | | commentText = commentText.replace("{链接}", jumpLink); |
| | | commentText = commentText.replace("领券抢购", "抢购"); |
| | | commentText = commentText.replace("【券后价】{券后价}元", ""); |
| | | return deleteBlankLine(commentText); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | record.setOrderWoman(resultObj.getOrderWoman()); |
| | | record.setCreatetime(resultObj.getCreatetime()); |
| | | record.setUpdatetime(new Date()); |
| | | if(record.getIsFixed()==null) { |
| | | record.setIsFixed(false);//目前无固定项 |
| | | } |
| | | homeNavbarMapper.updateByPrimaryKey(record); |
| | | } |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService; |
| | | import com.yeshi.fanli.util.goods.douyin.CSJCPSApiUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import org.apache.commons.beanutils.PropertyUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | return commonOrderList; |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonOrderAddResultDTO> addDYOrder(DYOrder order, Long uid) throws CommonOrderException { |
| | | List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>(); |
| | | |
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(order); |
| | | CommonOrderGoods cog = new CommonOrderGoods(); |
| | | cog.setGoodsId(order.getProduct_id()); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_DY); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | newCommonOrder.setStateWholeOrder(newCommonOrder.getState()); |
| | | // 订单商品插入 |
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(cog.getGoodsId(), |
| | | cog.getGoodsType()); |
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品 |
| | | { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(order.getProduct_id())); |
| | | if (goods == null) { |
| | | goods = new DYGoodsDetail(); |
| | | goods.setTitle(order.getProduct_name()); |
| | | goods.setPrice(0); |
| | | goods.setProduct_id(Long.parseLong(order.getProduct_id())); |
| | | goods.setCover(order.getProduct_img()); |
| | | } |
| | | |
| | | if (goods != null) { |
| | | cog = CommonOrderGoodsFactory.create(goods); |
| | | } |
| | | |
| | | cog.setCreateTime(new Date()); |
| | | cog.setUpdateTime(new Date()); |
| | | commonOrderGoodsMapper.insertSelective(cog); |
| | | } else { |
| | | |
| | | } |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | | commonOrderList.add(addCommonOrder(newCommonOrder)); |
| | | |
| | | addConfirmMQMsg(commonOrderList); |
| | | return commonOrderList; |
| | | } |
| | | |
| | | private boolean needUpdateCommonOrder(CommonOrder oldCommonOrder, CommonOrder newCommonOrder) { |
| | | // 非京东已经结算,已经失效,状态未改变的订单不处理 |
| | | if ((oldCommonOrder.getState() == CommonOrder.STATE_JS |
| | |
| | | inviteSettle(uid, sourceType, maxPregetTime); |
| | | } |
| | | |
| | | @Override |
| | | public void inviteSettleDY(Long uid, Date maxPregetTime) throws OrderMoneySettleException { |
| | | // 查询UID的一二级邀请赚 |
| | | int sourceType = Constant.SOURCE_TYPE_DY; |
| | | inviteSettle(uid, sourceType, maxPregetTime); |
| | | } |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | |
| | | shareSettle(Constant.SOURCE_TYPE_SUNING, uid, maxPregetTime); |
| | | } |
| | | |
| | | @Override |
| | | public void shareSettleDY(Long uid, Date maxPregetTime) throws OrderMoneySettleException { |
| | | shareSettle(Constant.SOURCE_TYPE_DY, uid, maxPregetTime); |
| | | } |
| | | |
| | | private void shareSettle(int sourceType, Long uid, Date maxPregetTime) throws OrderMoneySettleException { |
| | | /** |
| | | * 处理分享赚 |
| | |
| | | package com.yeshi.fanli.service.impl.order; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.service.manger.order.TeamRewardManager; |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | |
| | | } catch (OrderMoneySettleException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | orderMoneySettleService.inviteSettleDY(uid, maxPreGetTime); |
| | | } catch (OrderMoneySettleException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | try { |
| | | orderMoneySettleService.shareSettleSuning(uid, maxPreGetTime); |
| | | } catch (OrderMoneySettleException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | orderMoneySettleService.shareSettleDY(uid, maxPreGetTime); |
| | | } catch (OrderMoneySettleException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | public void processJDOrder(JDOrder order) { |
| | | if (order == null || order.getOrderItemList() == null || order.getOrderItemList().size() == 0) |
| | | return; |
| | | // 拆单的不做处理 |
| | | if (order.getValidCode() == 2) |
| | | // 拆单且不在commonorder中的不做处理 |
| | | if (order.getValidCode() == 2) { |
| | | List<CommonOrder> list= commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_JD,order.getOrderId()+""); |
| | | if(list==null||list.size()==0) { |
| | | return; |
| | | |
| | | } |
| | | } |
| | | // 根据ext1与subUnionId跟单 |
| | | String uidStr = order.getExt1(); |
| | | if (StringUtil.isNullOrEmpty(uidStr)) |
| | |
| | | } |
| | | |
| | | /** |
| | | * 处理京东返利订单 |
| | | * 处理唯品会返利订单 |
| | | * |
| | | * @param vipShopOrder |
| | | * @param uid |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理拼多多自购返利订单 |
| | | * 处理苏宁自购返利订单 |
| | | * |
| | | * @param suningOrder |
| | | * @param uid |
| | |
| | | } |
| | | |
| | | /** |
| | | * 处理拼多多分享订单 |
| | | * 处理苏宁分享订单 |
| | | * |
| | | * @param suningOrder |
| | | * @param uid |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void processDYOrder(DYOrder order) { |
| | | if (order == null) |
| | | return; |
| | | |
| | | |
| | | // 根据ext1与subUnionId跟单 |
| | | String extra_info = order.getExternal_info(); |
| | | |
| | | Long uid = DYUtil.getUid(extra_info); |
| | | String type = DYUtil.getTypeFromExtraInfo(extra_info); |
| | | if ("buy".equalsIgnoreCase(type))// 返利订单 |
| | | { |
| | | processFanLiDYOrder(order, uid); |
| | | lostOrderService.processSuceess(order.getOrder_id() + "", Constant.SOURCE_TYPE_DY); |
| | | } else if ("share".equalsIgnoreCase(type)) {// 分享订单 |
| | | if (uid == null)// 分享订单不允许找回 |
| | | return; |
| | | processShareDYOrder(order, uid); |
| | | } else {// 处理是否有订单找回的状态 |
| | | processFanLiDYOrder(order, null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理抖音返利订单 |
| | | * |
| | | * @param dyOrder |
| | | * @param uid |
| | | */ |
| | | private void processFanLiDYOrder(DYOrder dyOrder, Long uid) { |
| | | |
| | | BigDecimal totalMoney = new BigDecimal(dyOrder.getTotal_pay_amount()).divide(new BigDecimal(100),2, RoundingMode.FLOOR); |
| | | |
| | | // 加入订单 |
| | | Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(dyOrder.getOrder_id() + "", |
| | | Constant.SOURCE_TYPE_DY); |
| | | if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("补单")) |
| | | uid = oldOrder.getUserInfo().getId(); |
| | | |
| | | if (uid == null) |
| | | return; |
| | | |
| | | if (oldOrder == null)// 新增 |
| | | { |
| | | Order order = new Order(); |
| | | order.setBeizhu("抖音返利订单"); |
| | | order.setCreatetime(System.currentTimeMillis()); |
| | | order.setOrderId(dyOrder.getOrder_id() + ""); |
| | | order.setOrderType(Constant.SOURCE_TYPE_DY); |
| | | order.setState( |
| | | (dyOrder.getFlow_point().equalsIgnoreCase(DYOrder.FLOW_POINT_REFUND)) ? Order.STATE_SHIXIAO : Order.STATE_YIZHIFU); |
| | | order.setUserInfo(new UserInfo(uid)); |
| | | order.setVersion(2); |
| | | order.setThirdCreateTime(new Date(TimeUtil.convertToTimeTemp(dyOrder.getPay_success_time(),"yyyy-MM-dd HH:mm:ss"))); |
| | | order.setMoney(totalMoney); |
| | | // 加入到订单表 |
| | | orderMapper.insertSelective(order); |
| | | } else { |
| | | Order updateOrder = new Order(); |
| | | updateOrder.setId(oldOrder.getId()); |
| | | updateOrder.setMoney(totalMoney); |
| | | orderMapper.updateByPrimaryKeySelective(updateOrder); |
| | | } |
| | | |
| | | try { |
| | | List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addDYOrder(dyOrder, uid); |
| | | addHongBaoWithMQ(commonOrderList, dyOrder.getOrder_id() + "", uid, Constant.SOURCE_TYPE_DY, |
| | | HongBaoV2.TYPE_ZIGOU); |
| | | |
| | | if (isCommonOrderAllAdd(commonOrderList)) { |
| | | Order order = new Order(); |
| | | order.setOrderId(dyOrder.getOrder_id()); |
| | | order.setOrderType(Constant.SOURCE_TYPE_DY); |
| | | order.setUserInfo(new UserInfo(uid)); |
| | | try { |
| | | if (Constant.ENABLE_MQ) |
| | | PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); |
| | | } catch (Exception e) { |
| | | } |
| | | } |
| | | } catch (CommonOrderException e) { |
| | | try { |
| | | LogHelper.errorDetailInfo(e, "addDYOrder或addHongBao出错", "订单号:" + dyOrder.getOrder_id()); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理抖音分享订单 |
| | | * |
| | | * @param dyOrder |
| | | * @param uid |
| | | */ |
| | | private void processShareDYOrder(DYOrder dyOrder, Long uid) { |
| | | try { |
| | | List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addDYOrder(dyOrder, uid); |
| | | addHongBaoWithMQ(commonOrderList, dyOrder.getOrder_id() + "", uid, Constant.SOURCE_TYPE_DY, |
| | | HongBaoV2.TYPE_SHARE_GOODS); |
| | | if (isCommonOrderAllAdd(commonOrderList)) { |
| | | Order order = new Order(); |
| | | order.setOrderId(dyOrder.getOrder_id()); |
| | | order.setOrderType(Constant.SOURCE_TYPE_DY); |
| | | order.setUserInfo(new UserInfo(uid)); |
| | | try { |
| | | if (Constant.ENABLE_MQ) |
| | | PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); |
| | | } catch (Exception e) { |
| | | } |
| | | } |
| | | } catch (CommonOrderException e) { |
| | | try { |
| | | LogHelper.errorDetailInfo(e, "addDYOrder或addHongBao出错", "订单号:" + dyOrder.getOrder_id()); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void repairCommonOrderByByTaoBaoOrder(String orderId) { |
| | | // 根据订单号查询淘宝订单 |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.order.dy; |
| | | |
| | | import com.yeshi.fanli.dao.dy.DYOrderDao; |
| | | |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | |
| | | import com.yeshi.fanli.exception.dy.DYOrderException; |
| | | |
| | | import com.yeshi.fanli.service.inter.order.dy.DYOrderService; |
| | | |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class DYOrderServiceImpl implements DYOrderService { |
| | | |
| | | @Resource |
| | | private DYOrderDao dyOrderDao; |
| | | |
| | | |
| | | @Override |
| | | public void addOrder(DYOrder order) throws DYOrderException { |
| | | |
| | | if (order == null || StringUtil.isNullOrEmpty(order.getOrder_id())) { |
| | | throw new DYOrderException(1, "数据不完整"); |
| | | } |
| | | |
| | | // 查询是否添加过 |
| | | List<DYOrder> oldList = dyOrderDao.listByOrderId(order.getOrder_id()); |
| | | DYOrder old = null; |
| | | if (oldList != null && oldList.size() > 0) { |
| | | old = oldList.get(0); |
| | | } |
| | | if (old == null) {// 新增 |
| | | // 添加信息 |
| | | if (order.getCreateTime() == null) |
| | | order.setCreateTime(new Date()); |
| | | if (order.getId()==null){ |
| | | order.setId(order.toId()); |
| | | } |
| | | dyOrderDao.save(order); |
| | | } else {// 更新 |
| | | order.setOrder_id(old.getId()); |
| | | order.setUpdateTime(new Date()); |
| | | dyOrderDao.updateByPrimaryKey(order); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public DYOrder selectByPrimaryKey(String id) { |
| | | |
| | | return dyOrderDao.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<DYOrder> listByOrderId(String orderId) { |
| | | List<DYOrder> oldList = dyOrderDao.listByOrderId(orderId); |
| | | return oldList; |
| | | } |
| | | |
| | | @Override |
| | | public Long countOrderByDay(String preDay) { |
| | | // TODO Auto-generated method stub |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import com.yeshi.goods.facade.dto.taobao.dataoke.DaTaoKeListTopOffDTO; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | |
| | | |
| | | public void updateVIPGoods(VIPGoodsInfo goods); |
| | | |
| | | public void updateDYGoods(DYGoodsDetail goods); |
| | | |
| | | public void updateSuningGoods(SuningGoodsInfo goods); |
| | | |
| | | |
| | |
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo; |
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.fanli.exception.goods.CollectionGoodsException; |
| | | |
| | |
| | | */ |
| | | public void addVIPCollection(Long uid, VIPGoodsInfo goods) throws CollectionGoodsException; |
| | | |
| | | |
| | | /** |
| | | * 抖音收藏 |
| | | * @Title: addVIPCollection |
| | | * @Description: |
| | | * @param uid |
| | | * @param goods |
| | | * @throws CollectionGoodsException |
| | | * void 返回类型 |
| | | * @throws |
| | | */ |
| | | public void addDYCollection(Long uid, DYGoodsDetail goods) throws CollectionGoodsException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 苏宁收藏 |
| | | * @Title: addSuningCollection |
| | |
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo; |
| | | import com.yeshi.fanli.entity.goods.ScanHistoryV2; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.fanli.exception.goods.CommonGoodsException; |
| | | import com.yeshi.fanli.exception.goods.ScanHistoryException; |
| | |
| | | public void addSuningScanHistory(Long uid, String device, SuningGoodsInfo suningGoods) |
| | | throws CommonGoodsException, ScanHistoryException; |
| | | |
| | | |
| | | /** |
| | | * 抖音浏览记录 |
| | | * @Title: addSuningScanHistory |
| | | * @Description: |
| | | * @param uid |
| | | * @param device |
| | | * @param dyGoods |
| | | * @throws CommonGoodsException |
| | | * @throws ScanHistoryException |
| | | * void 返回类型 |
| | | * @throws |
| | | */ |
| | | public void addDYScanHistory(Long uid, String device, DYGoodsDetail dyGoods) |
| | | throws CommonGoodsException, ScanHistoryException; |
| | | |
| | | |
| | | /** |
| | | * 根据简版商品ID删除 |
| | | * @param uid |
| | |
| | | import com.yeshi.fanli.entity.goods.ShareGoodsTextTemplate; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.fanli.exception.goods.ShareGoodsTextTemplateException; |
| | | |
| | |
| | | |
| | | public String getTextTemplateBySuNing(Long uid); |
| | | |
| | | public void resetCommonTemplateDY(Long uid); |
| | | |
| | | public void resetCouponTemplateDY(Long uid); |
| | | |
| | | public String getTextTemplateByDY(Long uid); |
| | | |
| | | public void verifyRightVIP(String template) throws ShareGoodsTextTemplateException; |
| | | |
| | | public void verifyRightSuNing(String template) throws ShareGoodsTextTemplateException; |
| | | |
| | | public void verifyRightDY(String template) throws ShareGoodsTextTemplateException; |
| | | |
| | | /** |
| | | * 苏宁快捷分享 |
| | |
| | | */ |
| | | public String createCommonShareTextSuNing(String template, SuningGoodsInfo goods, String jumpLink); |
| | | |
| | | |
| | | /** |
| | | * 抖音普通分享 |
| | | * @param template |
| | | * @param goods |
| | | * @param jumpLink |
| | | * @return |
| | | */ |
| | | public String createCommonShareTextDY(String template, DYGoodsDetail goods, String jumpLink); |
| | | |
| | | public void saveTemplateVIP(Long uid, String template) throws ShareGoodsTextTemplateException; |
| | | |
| | | public void saveTemplateSuNing(Long uid, String template) throws ShareGoodsTextTemplateException; |
| | | |
| | | public void saveTemplateDY(Long uid, String template) throws ShareGoodsTextTemplateException; |
| | | |
| | | } |
| | |
| | | import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | import com.yeshi.fanli.entity.jd.JDOrder; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.entity.order.ESOrder; |
| | |
| | | /** |
| | | * 添加苏宁订单 |
| | | * |
| | | * @param order |
| | | * @param suningOrderList |
| | | * @param uid |
| | | * @return |
| | | * @throws CommonOrderException List<CommonOrderAddResultDTO> 返回类型 |
| | |
| | | */ |
| | | public List<CommonOrderAddResultDTO> addSuningOrder(List<SuningOrderInfo> suningOrderList, Long uid) throws CommonOrderException; |
| | | |
| | | /** |
| | | * 添加抖音订单 |
| | | * |
| | | * @param order |
| | | * @param uid |
| | | * @return |
| | | * @throws CommonOrderException List<CommonOrderAddResultDTO> 返回类型 |
| | | * @throws |
| | | * @Title: addVipShopOrder |
| | | * @Description: |
| | | */ |
| | | public List<CommonOrderAddResultDTO> addDYOrder(DYOrder order, Long uid) throws CommonOrderException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据用户ID,订单状态,结算时间统计订单数量 |
| | |
| | | |
| | | public void inviteSettleVipShop(Long uid, Date maxPregetTime) throws OrderMoneySettleException; |
| | | |
| | | public void inviteSettleDY(Long uid, Date maxPregetTime) throws OrderMoneySettleException; |
| | | |
| | | /** |
| | | * 分享赚结算 |
| | | * |
| | |
| | | |
| | | public void shareSettleSuning(Long uid, Date maxPregetTime) throws OrderMoneySettleException; |
| | | |
| | | public void shareSettleDY(Long uid, Date maxPregetTime) throws OrderMoneySettleException; |
| | | |
| | | /** |
| | | * 自购结算 |
| | | * |
| | |
| | | import java.util.Map; |
| | | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | import com.yeshi.fanli.entity.jd.JDOrder; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.entity.pdd.PDDOrder; |
| | |
| | | |
| | | |
| | | /** |
| | | * 处理抖音订单 |
| | | * |
| | | * @param dyOrder |
| | | */ |
| | | public void processDYOrder(DYOrder dyOrder); |
| | | |
| | | |
| | | /** |
| | | * 根据淘宝订单的排序值修复常规订单的排序值 |
| | | * |
| | | * @param orderId |
New file |
| | |
| | | package com.yeshi.fanli.service.inter.order.dy; |
| | | |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | import com.yeshi.fanli.exception.dy.DYOrderException; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface DYOrderService { |
| | | |
| | | /** |
| | | * 添加订单 |
| | | * |
| | | * @param order |
| | | * @throws DYOrderException |
| | | */ |
| | | public void addOrder(DYOrder order) throws DYOrderException; |
| | | |
| | | /** |
| | | * 根据主键ID查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public DYOrder selectByPrimaryKey(String id); |
| | | |
| | | /** |
| | | * 根据订单号查询 |
| | | * |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | public List<DYOrder> listByOrderId(String orderId); |
| | | |
| | | |
| | | public Long countOrderByDay(String preDay); |
| | | |
| | | |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.util.goods.douyin.CSJCPSApiUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.goods.facade.utils.taobao.DaTaoKeApiUtil; |
| | | import org.jsoup.Jsoup; |
| | |
| | | if (goods != null) { |
| | | commonGoods = CommonGoodsFactory.create(goods); |
| | | } |
| | | }else if (simpleGoods.getGoodsType() == Constant.SOURCE_TYPE_DY) { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong( simpleGoods.getGoodsId())); |
| | | if (goods != null) { |
| | | commonGoods = CommonGoodsFactory.create(goods); |
| | | } |
| | | } |
| | | |
| | | return commonGoods; |
| | |
| | | if (!StringUtil.isNullOrEmpty(vipId)) { |
| | | return new SimpleCommonGoods(vipId, Constant.SOURCE_TYPE_VIP); |
| | | } |
| | | String dyProductId= DYUtil.parseProdectIdFromLink(link); |
| | | if (!StringUtil.isNullOrEmpty(dyProductId)) { |
| | | return new SimpleCommonGoods(dyProductId, Constant.SOURCE_TYPE_DY); |
| | | } |
| | | |
| | | // 解析淘宝 |
| | | String auctionId = parseTBAuctionIdFromLink(link); |
| | |
| | | import com.yeshi.fanli.dto.ad.DouYinDeviceActiveQueueDTO; |
| | | import com.yeshi.fanli.dto.money.UserMoneyChangeDTO; |
| | | import com.yeshi.fanli.dto.mq.UidDateDTO; |
| | | import com.yeshi.fanli.dto.mq.order.body.CommonOrderMQMsg; |
| | | import com.yeshi.fanli.dto.push.PushContentDetailDTO; |
| | | import com.yeshi.fanli.entity.ad.DouYinClickEvent; |
| | | import com.yeshi.fanli.entity.bus.user.*; |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | import com.yeshi.fanli.entity.jd.JDOrder; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.entity.order.HongBaoOrder; |
| | |
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService; |
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service; |
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService; |
| | | import com.yeshi.fanli.service.inter.order.dy.DYOrderService; |
| | | import com.yeshi.fanli.service.inter.order.jd.JDOrderService; |
| | | import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService; |
| | | import com.yeshi.fanli.service.inter.order.suning.SuningOrderService; |
| | |
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce; |
| | | import com.yeshi.fanli.service.manger.money.TeamEincomeManager; |
| | | import com.yeshi.fanli.service.manger.order.TeamDividentsManager; |
| | | import com.yeshi.fanli.util.CMQManager; |
| | | import com.yeshi.fanli.util.RedisKeyEnum; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.util.ad.DouYinAdUtil; |
| | | import com.yeshi.fanli.util.mq.cmq.DouYinDeviceActiveCMQManager; |
| | | import com.yeshi.fanli.util.mq.cmq.HongBaoRecieveCMQManager; |
| | |
| | | private SuningOrderService suningOrderService; |
| | | |
| | | @Resource |
| | | private DYOrderService dyOrderService; |
| | | |
| | | @Resource |
| | | private HWPushService hwPushService; |
| | | |
| | | private Map<String, Long> latestRunTimeMap = new HashMap<>(); |
| | |
| | | doPDDOrderJob();// 拼多多订单处理 |
| | | doVipShopOrderJob();// 唯品会订单处理 |
| | | doSuningOrderJob();// 苏宁订单处理 |
| | | doAllOrderJob();//所有订单处理 |
| | | doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新 |
| | | doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加 |
| | | // doPlaceOrderIntegralJob();// 下单赠送金币任务 |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | public void doAllOrderJob() { |
| | | String methodName = getMethodName(Thread.currentThread()); |
| | | new JobThreadExecutorServiceImpl().run(new MyRunnable(methodName) { |
| | | @Override |
| | | public void run() { |
| | | super.run(); |
| | | try { |
| | | Map<String, CommonOrderMQMsg> map = OrdersCMQManager.getInstance().consumeOrders(16); |
| | | if (map != null) { |
| | | Iterator<String> its = map.keySet().iterator(); |
| | | while (its.hasNext()) { |
| | | String key = its.next(); |
| | | try { |
| | | CommonOrderMQMsg orderMQMsg = map.get(key); |
| | | LogHelper.test("订单消费:" + new Gson().toJson(orderMQMsg)); |
| | | if (orderMQMsg != null) { |
| | | String orderId = orderMQMsg.getOrderId(); |
| | | switch (orderMQMsg.getSourceType()) { |
| | | case Constant |
| | | .SOURCE_TYPE_JD: { |
| | | JDOrder order = jdOrderService.selectDetailByOrderId(Long.parseLong(orderId)); |
| | | orderProcessService.processJDOrder(order); |
| | | } |
| | | break; |
| | | case Constant |
| | | .SOURCE_TYPE_PDD: { |
| | | List<PDDOrder> orderList = pddOrderService.selectByOrderSn(orderId); |
| | | if (orderList != null) |
| | | for (PDDOrder order : orderList) |
| | | orderProcessService.processPDDOrder(order); |
| | | } |
| | | break; |
| | | case Constant |
| | | .SOURCE_TYPE_VIP: { |
| | | List<VipShopOrder> orderList = vipShopOrderService.listDetailByOrderSn(orderId); |
| | | if (orderList != null) |
| | | for (VipShopOrder order : orderList) |
| | | orderProcessService.processVipShopOrder(order); |
| | | } |
| | | break; |
| | | case Constant |
| | | .SOURCE_TYPE_SUNING: { |
| | | List<SuningOrderInfo> orderList = suningOrderService.listByOrderCode(orderId); |
| | | if (orderList != null) |
| | | for (SuningOrderInfo order : orderList) |
| | | orderProcessService.processSuningOrder(order); |
| | | } |
| | | break; |
| | | case Constant |
| | | .SOURCE_TYPE_DY: { |
| | | List<DYOrder> orderList = dyOrderService.listByOrderId(orderId); |
| | | if (orderList != null) |
| | | for (DYOrder order : orderList) |
| | | orderProcessService.processDYOrder(order); |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | OrdersCMQManager.getInstance().deleteOrder(key); |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 重要的淘宝商品信息更新 |
| | | */ |
| | |
| | | public static final int SOURCE_TYPE_SUNING = 5; |
| | | // 来源-饿了么 |
| | | public static final int SOURCE_TYPE_ELME = 6; |
| | | // 来源-抖音 |
| | | public static final int SOURCE_TYPE_DY = 7; |
| | | |
| | | // 自购-返利 |
| | | public static final int TYPE_REBATE = 1; |
| | |
| | | |
| | | public static ConstantConfig constantConfig; |
| | | |
| | | public static String PDD_SEARCH_CUSTOMER_PARAMS = "437032"; |
| | | public static String PDD_SEARCH_CUSTOMER_PARAMS = "437031"; |
| | | |
| | | /** |
| | | * 淘宝商品红包 |
| | |
| | | PDDOrder("pdd-order-", "拼多多订单"), |
| | | VIPShopOrder("vipshop-order-", "唯品会订单"), |
| | | SuningOrder("suning-order-", "苏宁订单"), |
| | | DYOrder("dy-order-", "抖音订单"), |
| | | hongBaoFanLi("hongbao-fanli-", "红包返利"), |
| | | |
| | | deviceSex("device_sex-", "设备性别版本"), |
| | |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.factory.goods.TaoBaoGoodsFactory; |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoods; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import com.yeshi.fanli.util.jd.JDUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HaoDanKuJDGoodsInfo; |
| | |
| | | return cg; |
| | | } |
| | | |
| | | |
| | | public static CommonGoods create(DYGoodsDetail goods) { |
| | | if (goods == null) |
| | | return null; |
| | | |
| | | CommonGoods cg = new CommonGoods(); |
| | | |
| | | // 折扣信息 |
| | | cg.setCouponLeftCount(0); |
| | | cg.setCouponTotalCount(0); |
| | | cg.setCouponAmount(new BigDecimal(0)); |
| | | |
| | | cg.setCouponTotalCount(0); |
| | | cg.setGoodsId(goods.getProduct_id()+""); |
| | | cg.setGoodsType(CommonGoods.GOODS_TYPE_DY); |
| | | cg.setPicture(goods.getCover()); |
| | | cg.setPictureWhite(null); |
| | | cg.setPrice(MoneyBigDecimalUtil.div(new BigDecimal(goods.getPrice()),new BigDecimal(100),2)); |
| | | |
| | | cg.setSales(goods.getSales()); |
| | | cg.setRate(DYUtil.getCosRatio(goods).multiply(new BigDecimal(100))); |
| | | cg.setSellerId((long)goods.getShop_id()); |
| | | cg.setSellerName(goods.getShop_name()); |
| | | cg.setShopType(CommonGoods.SHOP_TYPE_DY); |
| | | cg.setState(CommonGoods.STATE_NORMAL); |
| | | cg.setTitle(goods.getTitle()); |
| | | // 保留字段 |
| | | cg.setVideoCover(null); |
| | | cg.setVideoUrl(null); |
| | | cg.setMaterialLibType(1); |
| | | |
| | | // 分类信息 |
| | | CategoryInfoDTO categoryInfo = new CategoryInfoDTO(); |
| | | categoryInfo.setCid1((long)goods.getFirst_cid()); |
| | | categoryInfo.setCid1Name(""); |
| | | cg.setCategoryInfo(JSONObject.toJSON(categoryInfo).toString()); |
| | | return cg; |
| | | } |
| | | |
| | | |
| | | public static CommonGoods create(DYGoods goods) { |
| | | if (goods == null) |
| | | return null; |
| | | |
| | | CommonGoods cg = new CommonGoods(); |
| | | |
| | | // 折扣信息 |
| | | cg.setCouponLeftCount(0); |
| | | cg.setCouponTotalCount(0); |
| | | cg.setCouponAmount(new BigDecimal(0)); |
| | | |
| | | cg.setCouponTotalCount(0); |
| | | cg.setGoodsId(goods.getProduct_id()+""); |
| | | cg.setGoodsType(CommonGoods.GOODS_TYPE_DY); |
| | | cg.setPicture(goods.getCover()); |
| | | cg.setPictureWhite(null); |
| | | cg.setPrice(MoneyBigDecimalUtil.div(new BigDecimal(goods.getPrice()),new BigDecimal(100),2)); |
| | | |
| | | int totalSales = 0; |
| | | cg.setSales(totalSales); |
| | | cg.setRate(DYUtil.getCosRatio(goods)); |
| | | cg.setSellerId((long)goods.getShop_id()); |
| | | cg.setSellerName(goods.getShop_name()); |
| | | cg.setShopType(CommonGoods.SHOP_TYPE_DY); |
| | | cg.setState(CommonGoods.STATE_NORMAL); |
| | | cg.setTitle(goods.getTitle()); |
| | | // 保留字段 |
| | | cg.setVideoCover(null); |
| | | cg.setVideoUrl(null); |
| | | cg.setMaterialLibType(1); |
| | | |
| | | // 分类信息 |
| | | CategoryInfoDTO categoryInfo = new CategoryInfoDTO(); |
| | | categoryInfo.setCid1((long)goods.getFirst_cid()); |
| | | categoryInfo.setCid1Name(""); |
| | | cg.setCategoryInfo(JSONObject.toJSON(categoryInfo).toString()); |
| | | return cg; |
| | | } |
| | | |
| | | public static CommonGoods create(SuningGoodsInfo goods) { |
| | | if (goods == null) |
| | | return null; |
| | |
| | | package com.yeshi.fanli.util.factory; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Date; |
| | | |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | |
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoods; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import org.yeshi.utils.MoneyBigDecimalUtil; |
| | |
| | | return goods; |
| | | } |
| | | |
| | | |
| | | public static CommonOrderGoods create(DYGoodsDetail dyGoods) { |
| | | CommonOrderGoods goods = new CommonOrderGoods(); |
| | | goods.setGoodsId(dyGoods.getProduct_id() + ""); |
| | | goods.setCreateTime(new Date()); |
| | | goods.setGoodsType(Constant.SOURCE_TYPE_DY); |
| | | goods.setPicture(dyGoods.getCover()); |
| | | goods.setPrice(new BigDecimal(dyGoods.getPrice()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR)); |
| | | goods.setShopId((long) dyGoods.getShop_id()); |
| | | goods.setShopName(dyGoods.getShop_name()); |
| | | goods.setShopType("抖音"); |
| | | goods.setState(0); |
| | | goods.setTitle(dyGoods.getTitle()); |
| | | return goods; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.util.factory.goods; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Date; |
| | | |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | import com.yeshi.fanli.entity.jd.JDOrderItem; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.entity.pdd.PDDOrder; |
| | |
| | | commonOrder.setChildSourceType("苏宁"); |
| | | return commonOrder; |
| | | } |
| | | |
| | | public static CommonOrder create(DYOrder order) { |
| | | CommonOrder commonOrder = new CommonOrder(); |
| | | commonOrder.setCount(1); |
| | | commonOrder.setCreateTime(new Date()); |
| | | if (order.getFlow_point().equalsIgnoreCase(DYOrder.FLOW_POINT_SETTLE)) { |
| | | commonOrder.seteIncome(new BigDecimal(order.getEstimated_commission()).divide(new BigDecimal(100), 2, RoundingMode.DOWN)); |
| | | commonOrder.setSettlement(new BigDecimal(order.getPay_goods_amount()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR)); |
| | | commonOrder.setSettleTime( |
| | | new Date(TimeUtil.convertToTimeTemp(order.getSettle_time(), "yyyy-MM-dd HH:mm:ss"))); |
| | | } |
| | | commonOrder.setOrderNo(order.getOrder_id()); |
| | | commonOrder.setPayment(new BigDecimal(order.getTotal_pay_amount()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR)); |
| | | commonOrder.setSourcePosition(order.getApp_id()); |
| | | commonOrder.setSourceType(Constant.SOURCE_TYPE_DY); |
| | | int state = 0; |
| | | |
| | | //正常状态 |
| | | if (order.getFlow_point().equalsIgnoreCase(DYOrder.FLOW_POINT_SETTLE)) { |
| | | // 结算 |
| | | state = CommonOrder.STATE_JS; |
| | | } else if (order.getFlow_point().equalsIgnoreCase(DYOrder.FLOW_POINT_CONFIRM)) { |
| | | // 确认收货 |
| | | state = CommonOrder.STATE_FK; |
| | | } else if (order.getFlow_point().equalsIgnoreCase(DYOrder.FLOW_POINT_PAY_SUCCESS)) { |
| | | //支付成功 |
| | | state = CommonOrder.STATE_FK; |
| | | } else if (order.getFlow_point().equalsIgnoreCase(DYOrder.FLOW_POINT_REFUND)) { |
| | | //退款 |
| | | state = CommonOrder.STATE_SX; |
| | | } |
| | | |
| | | commonOrder.setOrderBy(1); |
| | | commonOrder.setState(state); |
| | | commonOrder.setThirdCreateTime( |
| | | new Date(TimeUtil.convertToTimeTemp(order.getPay_success_time(), "yyyy-MM-dd HH:mm:ss"))); |
| | | commonOrder.setUpdateTime(new Date()); |
| | | commonOrder.setTradeId(order.getOrder_id()); |
| | | commonOrder.setEstimate(new BigDecimal(order.getEstimated_commission()).divide(new BigDecimal(100), 2, RoundingMode.DOWN)); |
| | | commonOrder.setChildSourceType("抖音"); |
| | | return commonOrder; |
| | | } |
| | | |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoods; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import org.yeshi.utils.taobao.TbImgUtil; |
| | | |
| | | import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO; |
| | |
| | | return goodsInfo; |
| | | } |
| | | |
| | | |
| | | public static GoodsDetailVO convertDYGoods(DYGoodsDetail goods, GoodsMoneyConfigParamsDTO params) { |
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO(); |
| | | goodsInfo.setBaoyou(true); |
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_DY); |
| | | goodsInfo.setGoodsId(goods.getProduct_id() + ""); |
| | | goodsInfo.setTitle(goods.getTitle()); |
| | | goodsInfo.setSalesType(4); // 总销量 |
| | | goodsInfo.setPriceName("原价"); |
| | | goodsInfo.setPicUrl(goods.getCover()); // 缩略图 |
| | | |
| | | BigDecimal zkPrice = MoneyBigDecimalUtil.div(new BigDecimal(goods.getPrice()), new BigDecimal(100), 2); |
| | | if (goods.getCoupon_price() > 0) { |
| | | zkPrice = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCoupon_price()), new BigDecimal(100), 2); |
| | | } |
| | | |
| | | |
| | | goodsInfo.setZkPrice(MoneyBigDecimalUtil.getWithNoZera(zkPrice)); |
| | | goodsInfo.setShopType(CommonGoods.SHOP_TYPE_DY); |
| | | |
| | | List<String> imgList = new ArrayList<>(); |
| | | for (String img : goods.getImgs()) { |
| | | imgList.add(img); |
| | | } |
| | | |
| | | goodsInfo.setImgList(imgList); |
| | | goodsInfo.setState(0); |
| | | |
| | | String salesCountMidea = ""; |
| | | Integer count = goods.getSales(); |
| | | if (count < 10000) { |
| | | salesCountMidea = count + ""; |
| | | } else { |
| | | double sales = count; |
| | | salesCountMidea = String.format("%.1f", sales / 10000); |
| | | salesCountMidea = salesCountMidea + "万"; |
| | | } |
| | | goodsInfo.setSalesCount(salesCountMidea); |
| | | |
| | | // 券信息 |
| | | goodsInfo.setHasCoupon(false); |
| | | |
| | | // 资金信息 |
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); |
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 |
| | | BigDecimal commission = DYUtil.getGoodsFanLiMoney(goods, params.getFanLiRate()); |
| | | moneyInfoVO.setFanliMoney("¥" + commission); |
| | | moneyInfoVO.setShareMoney("¥" + commission); |
| | | |
| | | BigDecimal baseCommisstion = null; |
| | | if (params.getBaseFanliRate() != null) |
| | | baseCommisstion = DYUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate()); |
| | | |
| | | if (params.getMaxRewardRate() != null) |
| | | moneyInfoVO |
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); |
| | | else { |
| | | BigDecimal price = zkPrice; |
| | | BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price); |
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%"); |
| | | |
| | | BigDecimal maxCommission = DYUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate()); |
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); |
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); |
| | | |
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission); |
| | | |
| | | if (baseCommisstion != null) { |
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), |
| | | commission.subtract(baseCommisstion).setScale(2).toString()); |
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), |
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString()); |
| | | moneyInfoVO.setCompositionInfo(desc); |
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc); |
| | | } |
| | | } |
| | | goodsInfo.setMoneyInfo(moneyInfoVO); |
| | | |
| | | // 店铺信息 |
| | | String mallName = goods.getShop_name(); |
| | | if (!StringUtil.isMobile(mallName)) { |
| | | ShopInfoVO shop = new ShopInfoVO(); |
| | | shop.setShopName(mallName); |
| | | shop.setUserType(70); |
| | | goodsInfo.setShopInfo(shop); |
| | | } |
| | | |
| | | return goodsInfo; |
| | | } |
| | | |
| | | public static GoodsDetailVO convertDYGoods(DYGoods goods, GoodsMoneyConfigParamsDTO params) { |
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO(); |
| | | goodsInfo.setBaoyou(true); |
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_DY); |
| | | goodsInfo.setGoodsId(goods.getProduct_id() + ""); |
| | | goodsInfo.setTitle(goods.getTitle()); |
| | | goodsInfo.setSalesType(4); // 总销量 |
| | | goodsInfo.setPriceName("原价"); |
| | | goodsInfo.setPicUrl(goods.getCover()); // 缩略图 |
| | | |
| | | BigDecimal zkPrice = MoneyBigDecimalUtil.div(new BigDecimal(goods.getPrice()), new BigDecimal(100), 2); |
| | | // if (goods.getCoupon_price() > 0) { |
| | | // zkPrice = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCoupon_price()), new BigDecimal(100), 2); |
| | | // } |
| | | |
| | | |
| | | goodsInfo.setZkPrice(MoneyBigDecimalUtil.getWithNoZera(zkPrice)); |
| | | goodsInfo.setShopType(CommonGoods.SHOP_TYPE_DY); |
| | | |
| | | List<String> imgList = new ArrayList<>(); |
| | | goodsInfo.setImgList(imgList); |
| | | goodsInfo.setState(0); |
| | | |
| | | String salesCountMidea = ""; |
| | | Integer count = goods.getSales(); |
| | | if (count < 10000) { |
| | | salesCountMidea = count + ""; |
| | | } else { |
| | | double sales = count; |
| | | salesCountMidea = String.format("%.1f", sales / 10000); |
| | | salesCountMidea = salesCountMidea + "万"; |
| | | } |
| | | goodsInfo.setSalesCount(salesCountMidea); |
| | | |
| | | // 券信息 |
| | | goodsInfo.setHasCoupon(false); |
| | | |
| | | if (goods.getCoupon_price() > 0) { |
| | | goodsInfo.setCouponPrice(MoneyBigDecimalUtil.div(new BigDecimal(goods.getCoupon_price()), new BigDecimal(100), 2)); |
| | | } |
| | | |
| | | // 资金信息 |
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); |
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 |
| | | BigDecimal commission = DYUtil.getGoodsFanLiMoney(goods, params.getFanLiRate()); |
| | | moneyInfoVO.setFanliMoney("¥" + commission); |
| | | moneyInfoVO.setShareMoney("¥" + commission); |
| | | |
| | | BigDecimal baseCommisstion = null; |
| | | if (params.getBaseFanliRate() != null) |
| | | baseCommisstion = DYUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate()); |
| | | |
| | | if (params.getMaxRewardRate() != null) |
| | | moneyInfoVO |
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); |
| | | else { |
| | | BigDecimal price = zkPrice; |
| | | BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price); |
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%"); |
| | | |
| | | BigDecimal maxCommission = DYUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate()); |
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); |
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); |
| | | |
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission); |
| | | |
| | | if (baseCommisstion != null) { |
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), |
| | | commission.subtract(baseCommisstion).setScale(2).toString()); |
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), |
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString()); |
| | | moneyInfoVO.setCompositionInfo(desc); |
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc); |
| | | } |
| | | } |
| | | goodsInfo.setMoneyInfo(moneyInfoVO); |
| | | |
| | | // 店铺信息 |
| | | String mallName = goods.getShop_name(); |
| | | if (!StringUtil.isMobile(mallName)) { |
| | | ShopInfoVO shop = new ShopInfoVO(); |
| | | shop.setShopName(mallName); |
| | | shop.setUserType(70); |
| | | goodsInfo.setShopInfo(shop); |
| | | } |
| | | |
| | | return goodsInfo; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.fanli.dto.vip.VIPConvertResultDTO; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoLink; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYConvertResult; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil; |
| | | import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO; |
| | | import com.yeshi.fanli.vo.goods.GoodsJumpLinkVO; |
| | |
| | | */ |
| | | public static GoodsJumpLinkVO getPDDJumpInfo(PDDConvertLinkResultVO convertUrl) { |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | vo.setNativeJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); |
| | | vo.set_native(false); |
| | | vo.setNativeJumpLink(convertUrl.getSchema_url()); |
| | | // 暂时只能跳转微信 |
| | | // vo.setNativeJumpLink(""); |
| | | vo.setJumpLink(convertUrl.getUrl()); |
| | | if (convertUrl.getWe_app_info() != null) { |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | |
| | | } |
| | | |
| | | |
| | | public static GoodsJumpLinkVO getDYJumpInfo(DYConvertResult link) { |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | try { |
| | | vo.setNativeJumpLink(link.getDeeplink()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.*; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.HttpException; |
| | | import org.apache.commons.httpclient.methods.PostMethod; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import java.io.IOException; |
| | |
| | | * @date 2022/8/8 15:45 |
| | | */ |
| | | public class CSJCPSApiUtil { |
| | | private static Logger debugLog=LoggerFactory.getLogger("debugLog"); |
| | | |
| | | private static String post(String url, String entity) { |
| | | HttpClient client = new HttpClient(); |
| | | client.getHostConfiguration().setProxy("192.168.3.122", 8888); |
| | | //client.getHostConfiguration().setProxy("192.168.3.122", 8888); |
| | | PostMethod method = new PostMethod(url); |
| | | method.addRequestHeader("Content-Type", "application/json;charset=UTF-8"); |
| | | method.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); |
| | |
| | | |
| | | private static String baseRequest(String path, JSONObject data, CSJAppInfo appInfo) { |
| | | String url = "http://ecom.pangolin-sdk-toutiao.com" + path; |
| | | |
| | | debugLog.info("抖音请求开始:链接-{}",url); |
| | | |
| | | com.alibaba.fastjson.JSONObject params = new com.alibaba.fastjson.JSONObject(); |
| | | params.put("app_id", appInfo.getAppId()); |
| | | params.put("timestamp", System.currentTimeMillis() / 1000); |
| | |
| | | } |
| | | |
| | | if (filter.getThird_cids() != null) { |
| | | data.put("third_cids", JSONObject.fromObject(filter.getThird_cids())); |
| | | data.put("third_cids", new Gson().toJson(filter.getThird_cids())); |
| | | } |
| | | |
| | | if (filter.getPrice_min() != null) { |
| | |
| | | } |
| | | |
| | | |
| | | public static DYGoodsDetail goodsDetail(Long goodsId) { |
| | | List<DYGoodsDetail> list = goodsDetails(Arrays.asList(new Long[]{goodsId})); |
| | | if (list == null || list.size() == 0) { |
| | | return null; |
| | | } else { |
| | | return list.get(0); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static DYOrderResult orderList(DYOrderFilter filter) { |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson( filter)); |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * @return com.yeshi.fanli.util.goods.douyin.vo.DYAggregateH5Result |
| | | * @author hxh |
| | | * @description 聚合页H5 |
| | | * @date 15:48 2022/9/30 |
| | | * @param: filter |
| | | * @return com.yeshi.fanli.util.goods.douyin.vo.DYAggregateH5Result |
| | | **/ |
| | | public static DYAggregateH5Result aggregateH5(DYAggregateH5Filter filter) { |
| | | JSONObject data = new JSONObject(); |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | goodsDetails(Arrays.asList(new Long[]{3549871967593209780L})); |
| | | getOrderDetail("4984002890650177191",1); |
| | | getOrderDetail("4984015762658606759", 1); |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.yeshi.fanli.util.goods.douyin; |
| | | |
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoods; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import org.apache.commons.httpclient.Header; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.methods.PostMethod; |
| | | import org.yeshi.utils.BigDecimalUtil; |
| | | import org.yeshi.utils.HttpUtil; |
| | | import org.yeshi.utils.MoneyBigDecimalUtil; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.URLDecoder; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: DYUtil |
| | | * @description: 抖音帮助类 |
| | | * @date 2022/10/8 14:39 |
| | | */ |
| | | public class DYUtil { |
| | | |
| | | public static String createFanLiExtraInfo(Long uid) { |
| | | return "b_" + uid; |
| | | } |
| | | |
| | | public static String createShareExtraInfo(Long uid) { |
| | | return "s_" + uid; |
| | | } |
| | | |
| | | public static String getTypeFromExtraInfo(String extra_info) { |
| | | if (extra_info != null && extra_info.startsWith("s_")) { |
| | | return "share"; |
| | | } else { |
| | | return "buy"; |
| | | } |
| | | } |
| | | |
| | | public static Long getUid(String extra_info) { |
| | | if (extra_info == null || extra_info.indexOf("_") < 0) { |
| | | return null; |
| | | } |
| | | return Long.parseLong(extra_info.split("_")[1].trim()); |
| | | } |
| | | |
| | | |
| | | public static BigDecimal getCosRatio(DYGoods goods) { |
| | | return new BigDecimal(goods.getCos_ratio()).divide(new BigDecimal(10000), 4, RoundingMode.FLOOR); |
| | | } |
| | | |
| | | public static BigDecimal getCosRatio(DYGoodsDetail goods) { |
| | | return new BigDecimal(goods.getCos_ratio()).divide(new BigDecimal(10000), 4, RoundingMode.FLOOR); |
| | | } |
| | | |
| | | |
| | | public static BigDecimal getGoodsFanLiMoney(DYGoodsDetail goods, BigDecimal rate) { |
| | | |
| | | BigDecimal hundred = new BigDecimal(100); |
| | | rate = MoneyBigDecimalUtil.div(rate, hundred); |
| | | |
| | | BigDecimal afterUseCouponPrice = MoneyBigDecimalUtil.div(new BigDecimal(goods.getPrice()), hundred); |
| | | if (goods.getCoupon_price() > 0) { |
| | | afterUseCouponPrice = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCoupon_price()), hundred); |
| | | } |
| | | |
| | | BigDecimal commission = MoneyBigDecimalUtil.mul(afterUseCouponPrice, getCosRatio(goods)); |
| | | |
| | | BigDecimal money = MoneyBigDecimalUtil.mul(commission, |
| | | rate); |
| | | return BigDecimalUtil.getWithNoZera(money).setScale(2); |
| | | } |
| | | |
| | | public static BigDecimal getGoodsFanLiMoney(DYGoods goods, BigDecimal rate) { |
| | | |
| | | BigDecimal hundred = new BigDecimal(100); |
| | | rate = MoneyBigDecimalUtil.div(rate, hundred); |
| | | |
| | | BigDecimal afterUseCouponPrice = getCouponPrice(goods); |
| | | |
| | | BigDecimal commission = MoneyBigDecimalUtil.mul(afterUseCouponPrice, getCosRatio(goods)); |
| | | |
| | | BigDecimal money = MoneyBigDecimalUtil.mul(commission, |
| | | rate); |
| | | return BigDecimalUtil.getWithNoZera(money).setScale(2); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.math.BigDecimal |
| | | * @author hxh |
| | | * @description 获取券后价 |
| | | * @date 18:09 2022/10/8 |
| | | * @param: goods |
| | | **/ |
| | | public static BigDecimal getCouponPrice(DYGoods goods) { |
| | | BigDecimal price = new BigDecimal(goods.getPrice()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR); |
| | | if (goods.getCoupon_price() > 0) { |
| | | price = new BigDecimal(goods.getCoupon_price()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR); |
| | | } |
| | | return price; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.math.BigDecimal |
| | | * @author hxh |
| | | * @description 获取券后价 |
| | | * @date 18:09 2022/10/8 |
| | | * @param: goods |
| | | **/ |
| | | public static BigDecimal getCouponPrice(DYGoodsDetail goods) { |
| | | BigDecimal price = new BigDecimal(goods.getPrice()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR); |
| | | if (goods.getCoupon_price() > 0) { |
| | | price = new BigDecimal(goods.getCoupon_price()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR); |
| | | } |
| | | return price; |
| | | } |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 从抖音短链中解析商品ID |
| | | * @date 18:29 2022/10/8 |
| | | * @param: url |
| | | **/ |
| | | public static String parseProdectIdFromLink(String url) { |
| | | if (url == null || !url.startsWith("https://v.douyin.com/")) { |
| | | return null; |
| | | } |
| | | |
| | | HttpClient client = new HttpClient(); |
| | | client.getHttpConnectionManager().getParams().setConnectionTimeout(5000); |
| | | PostMethod pm = new PostMethod(url); |
| | | try { |
| | | client.executeMethod(pm); |
| | | Header header = pm.getResponseHeader("location"); |
| | | if (header == null) { |
| | | return null; |
| | | } |
| | | if (header.getValue() == null) { |
| | | return null; |
| | | } |
| | | if (!header.getValue().contains("detail/index.html")) { |
| | | return null; |
| | | } |
| | | String value = URLDecoder.decode(header.getValue(), "UTF-8"); |
| | | |
| | | String[] results = value.split("&"); |
| | | for (String r : results) { |
| | | if (!r.contains("product_id=")) { |
| | | continue; |
| | | } |
| | | return r.split("=")[1].trim(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | public static BigDecimal getPrice(int money) { |
| | | return new BigDecimal(money).divide(new BigDecimal(100), 2, RoundingMode.FLOOR); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | parseProdectIdFromLink("https://v.douyin.com/M8dkcv4"); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.util.goods.douyin.vo; |
| | | |
| | | import com.yeshi.fanli.entity.goods.BaseGoodsInfo; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: DYGoods |
| | | * @description: 抖音商品信息 |
| | | * @date 2022/9/28 10:14 |
| | | */ |
| | | public class DYGoods { |
| | | public class DYGoods extends BaseGoodsInfo { |
| | | /** |
| | | * product_id : 3566898027765626183 |
| | | * title : 千可净小白鞋专用去污膏不伤手带海绵擦去污渍膏 |
| | |
| | | /** |
| | | * 商品id |
| | | **/ |
| | | private long product_id; |
| | | private Long product_id; |
| | | /** |
| | | * 商品名称 |
| | | **/ |
| | |
| | | /** |
| | | * 在穿⼭甲上是否有达⼈特殊佣⾦ |
| | | **/ |
| | | private boolean is_kol_product; |
| | | private Boolean is_kol_product; |
| | | /** |
| | | * 商品价格,单位分 |
| | | **/ |
| | | private long price; |
| | | private Long price; |
| | | /** |
| | | * 商品⼀级类⽬ |
| | | **/ |
| | | private long first_cid; |
| | | private Long first_cid; |
| | | /** |
| | | * 商品⼆级类⽬ |
| | | **/ |
| | | private long second_cid; |
| | | private Long second_cid; |
| | | /** |
| | | * 商品三级类⽬ |
| | | **/ |
| | | private long third_cid; |
| | | private Long third_cid; |
| | | /** |
| | | * 有⽆库存 |
| | | **/ |
| | | private boolean in_stock; |
| | | private Boolean in_stock; |
| | | /** |
| | | * 商品历史销量 |
| | | **/ |
| | | private int sales; |
| | | private Integer sales; |
| | | /** |
| | | * 商品主图 |
| | | **/ |
| | |
| | | /** |
| | | * 商铺id |
| | | **/ |
| | | private long shop_id; |
| | | private Long shop_id; |
| | | /** |
| | | * 商铺名称 |
| | | **/ |
| | |
| | | * 券后价格,单位分(0或者没传则为 |
| | | * 原价) |
| | | **/ |
| | | private long coupon_price; |
| | | private Long coupon_price; |
| | | /** |
| | | * 分佣⽐例,百分⽐乘以 100,⽐如 |
| | | * 1% 返回 1*100 = 100 |
| | | **/ |
| | | private int cos_ratio; |
| | | private Integer cos_ratio; |
| | | /** |
| | | * 佣⾦⾦额,单位分 |
| | | **/ |
| | | private int cos_fee; |
| | | private Integer cos_fee; |
| | | /** |
| | | * ⼀个加密字段,需要在转链接⼝当 |
| | | * 中回传 |
| | | **/ |
| | | private String ext; |
| | | |
| | | public long getProduct_id() { |
| | | public Long getProduct_id() { |
| | | return product_id; |
| | | } |
| | | |
| | | public void setProduct_id(long product_id) { |
| | | public void setProduct_id(Long product_id) { |
| | | this.product_id = product_id; |
| | | } |
| | | |
| | |
| | | this.title = title; |
| | | } |
| | | |
| | | public boolean isIs_kol_product() { |
| | | public Boolean isIs_kol_product() { |
| | | return is_kol_product; |
| | | } |
| | | |
| | | public void setIs_kol_product(boolean is_kol_product) { |
| | | public void setIs_kol_product(Boolean is_kol_product) { |
| | | this.is_kol_product = is_kol_product; |
| | | } |
| | | |
| | | public long getPrice() { |
| | | public Long getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(long price) { |
| | | public void setPrice(Long price) { |
| | | this.price = price; |
| | | } |
| | | |
| | | public long getFirst_cid() { |
| | | public Long getFirst_cid() { |
| | | return first_cid; |
| | | } |
| | | |
| | | public void setFirst_cid(long first_cid) { |
| | | public void setFirst_cid(Long first_cid) { |
| | | this.first_cid = first_cid; |
| | | } |
| | | |
| | | public long getSecond_cid() { |
| | | public Long getSecond_cid() { |
| | | return second_cid; |
| | | } |
| | | |
| | | public void setSecond_cid(long second_cid) { |
| | | public void setSecond_cid(Long second_cid) { |
| | | this.second_cid = second_cid; |
| | | } |
| | | |
| | | public long getThird_cid() { |
| | | public Long getThird_cid() { |
| | | return third_cid; |
| | | } |
| | | |
| | | public void setThird_cid(long third_cid) { |
| | | public void setThird_cid(Long third_cid) { |
| | | this.third_cid = third_cid; |
| | | } |
| | | |
| | | public boolean isIn_stock() { |
| | | public Boolean isIn_stock() { |
| | | return in_stock; |
| | | } |
| | | |
| | | public void setIn_stock(boolean in_stock) { |
| | | public void setIn_stock(Boolean in_stock) { |
| | | this.in_stock = in_stock; |
| | | } |
| | | |
| | | public int getSales() { |
| | | public Integer getSales() { |
| | | return sales; |
| | | } |
| | | |
| | | public void setSales(int sales) { |
| | | public void setSales(Integer sales) { |
| | | this.sales = sales; |
| | | } |
| | | |
| | |
| | | this.detail_url = detail_url; |
| | | } |
| | | |
| | | public long getShop_id() { |
| | | public Long getShop_id() { |
| | | return shop_id; |
| | | } |
| | | |
| | | public void setShop_id(long shop_id) { |
| | | public void setShop_id(Long shop_id) { |
| | | this.shop_id = shop_id; |
| | | } |
| | | |
| | |
| | | this.shop_name = shop_name; |
| | | } |
| | | |
| | | public long getCoupon_price() { |
| | | public Long getCoupon_price() { |
| | | return coupon_price; |
| | | } |
| | | |
| | | public void setCoupon_price(long coupon_price) { |
| | | public void setCoupon_price(Long coupon_price) { |
| | | this.coupon_price = coupon_price; |
| | | } |
| | | |
| | | public int getCos_ratio() { |
| | | public Integer getCos_ratio() { |
| | | return cos_ratio; |
| | | } |
| | | |
| | | public void setCos_ratio(int cos_ratio) { |
| | | public void setCos_ratio(Integer cos_ratio) { |
| | | this.cos_ratio = cos_ratio; |
| | | } |
| | | |
| | | public int getCos_fee() { |
| | | public Integer getCos_fee() { |
| | | return cos_fee; |
| | | } |
| | | |
| | | public void setCos_fee(int cos_fee) { |
| | | public void setCos_fee(Integer cos_fee) { |
| | | this.cos_fee = cos_fee; |
| | | } |
| | | |
| | |
| | | package com.yeshi.fanli.util.goods.douyin.vo; |
| | | |
| | | import com.yeshi.fanli.entity.goods.BaseGoodsInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @description: 商品详情 |
| | | * @date 2022/9/28 13:52 |
| | | */ |
| | | public class DYGoodsDetail { |
| | | public class DYGoodsDetail extends BaseGoodsInfo { |
| | | |
| | | |
| | | /** |
| | |
| | | * products : [{}] |
| | | * lottery_products : [{}] |
| | | */ |
| | | |
| | | /** |
| | | * 直播间主播openid |
| | | **/ |
| | | private String author_openid; |
| | | /** |
| | | * 昵称 |
| | | **/ |
| | | private String author_name; |
| | | /** |
| | | * 头像 |
| | | **/ |
| | | private String author_pic; |
| | | /** |
| | | * 达⼈等级 |
| | | **/ |
| | | private int author_level; |
| | | /** |
| | | * 场均gmv |
| | | **/ |
| | | private String average_gmv; |
| | | /** |
| | | * 粉丝数量 |
| | | **/ |
| | | private int fans_num; |
| | | /** |
| | | * 平均佣⾦率 |
| | | **/ |
| | | private String average_commission_rate; |
| | | /** |
| | | * 直播间id |
| | | **/ |
| | | private String room_id; |
| | | /** |
| | | * 是否正在直播 |
| | | **/ |
| | | private boolean is_live; |
| | | /** |
| | | * |
| | | **/ |
| | | private boolean is_ecom; |
| | | /** |
| | | * 性别 male/ female/ |
| | | **/ |
| | | private String gender; |
| | | /** |
| | | * 内部⽣成的加密字段。直播间转 |
| | | * 链请求的live_ext应填此字段 |
| | | **/ |
| | | private String ext; |
| | | /** |
| | | * 查询时刻在线⼈数 |
| | | **/ |
| | | private int online_num; |
| | | /** |
| | | * 开播时间戳 |
| | | **/ |
| | | private int create_time; |
| | | /** |
| | | * 商品类别 |
| | | **/ |
| | | private List<String> product_category; |
| | | /** |
| | | * 直播间挂⻋的商品信息 |
| | | **/ |
| | | private List<ProductsBean> products; |
| | | /** |
| | | * |
| | | **/ |
| | | private List<LotteryProductsBean> lottery_products; |
| | | |
| | | public String getAuthor_openid() { |
| | |
| | | package com.yeshi.fanli.util.goods.douyin.vo; |
| | | |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | return jdOrderCMQManager; |
| | | } |
| | | |
| | | /** |
| | | * 添加京东订单到队列 |
| | | * |
| | | * @param orderId |
| | | */ |
| | | public void addJDOrder(String orderId) { |
| | | if (StringUtil.isNullOrEmpty(orderId)) |
| | | return; |
| | | TDMQUtil.getInstance().sendMsg(JD_ORDER, orderId); |
| | | } |
| | | |
| | | /** |
| | | * 消费队列消息 |
New file |
| | |
| | | package com.yeshi.fanli.util.mq.cmq.order; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.qcloud.cmq.Message; |
| | | import com.yeshi.fanli.dto.mq.order.body.CommonOrderMQMsg; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.mq.cmq.TDMQUtil; |
| | | import net.sf.json.JSONObject; |
| | | import org.yeshi.utils.JsonUtil; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class OrdersCMQManager { |
| | | |
| | | private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25"; |
| | | private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo"; |
| | | private static OrdersCMQManager jdOrderCMQManager; |
| | | |
| | | public static String ORDER_ALL = "order-all"; |
| | | |
| | | static { |
| | | TDMQUtil.getInstance().init(secretId, secretKey, Constant.TDMQ_PUBLIC); |
| | | |
| | | ORDER_ALL += "-" + Constant.systemCommonConfig.getProjectName(); |
| | | TDMQUtil.getInstance().createQueue(ORDER_ALL); |
| | | } |
| | | |
| | | public static OrdersCMQManager getInstance() { |
| | | if (jdOrderCMQManager == null) |
| | | jdOrderCMQManager = new OrdersCMQManager(); |
| | | return jdOrderCMQManager; |
| | | } |
| | | |
| | | /** |
| | | * 添加订单到队列 |
| | | * |
| | | * @param msg |
| | | */ |
| | | public void addOrder(CommonOrderMQMsg msg) { |
| | | TDMQUtil.getInstance().sendMsg(ORDER_ALL, new Gson().toJson(msg)); |
| | | } |
| | | |
| | | /** |
| | | * 消费队列消息 |
| | | * |
| | | * @param count |
| | | * @return |
| | | */ |
| | | public Map<String, CommonOrderMQMsg> consumeOrders(int count) { |
| | | List<Message> list = TDMQUtil.getInstance().recieveMsg(count, ORDER_ALL); |
| | | Map<String, CommonOrderMQMsg> map = new HashMap<>(); |
| | | if (list != null) |
| | | for (Message msg : list) { |
| | | String result = msg.msgBody; |
| | | map.put(msg.receiptHandle, JsonUtil.getSimpleGson().fromJson(result,CommonOrderMQMsg.class)); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 删除京东队列 |
| | | * |
| | | * @param receiptHandle |
| | | */ |
| | | public void deleteOrder(String receiptHandle) { |
| | | TDMQUtil.getInstance().deleteMsg(ORDER_ALL, receiptHandle); |
| | | } |
| | | |
| | | } |
| | |
| | | return pddOrderCMQManager; |
| | | } |
| | | |
| | | /** |
| | | * 添加京东订单到队列 |
| | | * |
| | | * @param orderId |
| | | */ |
| | | public void addPDDOrder(String orderId) { |
| | | if (StringUtil.isNullOrEmpty(orderId)) |
| | | return; |
| | | TDMQUtil.getInstance().sendMsg(PDD_ORDER, orderId); |
| | | } |
| | | |
| | | /** |
| | | * 消费队列消息 |
| | |
| | | return suningOrderCMQManager; |
| | | } |
| | | |
| | | /** |
| | | * 添加唯品会订单到队列 |
| | | * |
| | | * @param orderId |
| | | */ |
| | | public void addSuningOrder(String orderId) { |
| | | if (StringUtil.isNullOrEmpty(orderId)) |
| | | return; |
| | | TDMQUtil.getInstance().sendMsg(SUNING_ORDER, orderId); |
| | | } |
| | | |
| | | /** |
| | | * 消费队列消息 |
| | |
| | | return vipShopOrderCMQManager; |
| | | } |
| | | |
| | | /** |
| | | * 添加唯品会订单到队列 |
| | | * |
| | | * @param orderId |
| | | */ |
| | | public void addVipShopOrder(String orderId) { |
| | | if (StringUtil.isNullOrEmpty(orderId)) |
| | | return; |
| | | TDMQUtil.getInstance().sendMsg(VIPSHOP_ORDER, orderId); |
| | | } |
| | | |
| | | /** |
| | | * 消费队列消息 |
| | |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | |
| | | import com.google.gson.JsonObject; |
| | | import com.yeshi.fanli.exception.pdd.PDDApiException; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | | import org.yeshi.utils.HttpUtil; |
| | |
| | | return StringUtil.Md5(CLIENT_SECRET + org + CLIENT_SECRET).toUpperCase(); |
| | | } |
| | | |
| | | private static String getFormatCustomParameters(String customParameters){ |
| | | customParameters=customParameters.replace("_",""); |
| | | JSONObject data=new JSONObject(); |
| | | data.put("uid",customParameters); |
| | | String custom = data.toString(); |
| | | System.out.println("自定义参数:"+custom); |
| | | return custom; |
| | | } |
| | | |
| | | private static String baseRequest(Map<String, String> map) { |
| | | map.put("client_id", CLIENT_ID); |
| | | map.put("timestamp", System.currentTimeMillis() / 1000 + ""); |
| | |
| | | Gson gson = new GsonBuilder().disableHtmlEscaping().create(); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("type", "pdd.ddk.goods.search"); |
| | | map.put("custom_parameters", customerParamters); |
| | | map.put("custom_parameters", getFormatCustomParameters(customerParamters)); |
| | | if (sf.getOptId() != null) |
| | | map.put("opt_id", sf.getOptId() + ""); |
| | | if (sf.getPage() != null) |
| | |
| | | map.put("type", "pdd.ddk.goods.promotion.url.generate"); |
| | | map.put("p_id", pid); |
| | | map.put("multi_group", "true"); |
| | | map.put("generate_schema_url","true"); |
| | | map.put("generate_weapp_webview", "true"); |
| | | map.put("generate_we_app", "true"); |
| | | |
| | |
| | | array.add(goodsSign); |
| | | map.put("goods_sign_list", array.toString()); |
| | | if (!StringUtil.isNullOrEmpty(customParams)) { |
| | | map.put("custom_parameters", customParams); |
| | | map.put("custom_parameters", getFormatCustomParameters(customParams)); |
| | | } |
| | | |
| | | //是否生成带授权的单品链接 |
| | |
| | | public static PDDConvertLinkResultVO convertActivity(String resourceType, String url, String pid, String customParams) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("type", "pdd.ddk.resource.url.gen"); |
| | | map.put("generate_schema_url","true"); |
| | | map.put("pid", pid); |
| | | if (customParams != null) { |
| | | map.put("custom_parameters", customParams); |
| | | map.put("custom_parameters", getFormatCustomParameters(customParams)); |
| | | } |
| | | map.put("resource_type", resourceType); |
| | | if (url != null) { |
| | |
| | | map.put("type", "pdd.ddk.cms.prom.url.generate"); |
| | | map.put("p_id_list", "[\"" + pid + "\"]"); |
| | | if (customParams != null) { |
| | | map.put("custom_parameters", customParams); |
| | | map.put("custom_parameters", getFormatCustomParameters(customParams)); |
| | | } |
| | | map.put("channel_type", channelType); |
| | | map.put("generate_mobile", true+""); |
| | |
| | | array.add(goodsId); |
| | | map.put("goods_id_list", array.toString()); |
| | | if (!StringUtil.isNullOrEmpty(customParams)) { |
| | | map.put("custom_parameters", customParams); |
| | | map.put("custom_parameters", getFormatCustomParameters(customParams)); |
| | | } |
| | | |
| | | String result = baseRequest(map); |
| | |
| | | map.put("page_size", pageSize + ""); |
| | | String result = baseRequest(map); |
| | | System.out.println(result); |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | JSONObject root = json.optJSONObject("order_list_get_response"); |
| | | com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(result); |
| | | com.alibaba.fastjson.JSONObject root = json.getJSONObject("order_list_get_response"); |
| | | if (root != null) { |
| | | int totalCount = root.optInt("total_count"); |
| | | JSONArray array = root.optJSONArray("order_list"); |
| | | Type type = new TypeToken<List<PDDOrder>>() { |
| | | }.getType(); |
| | | List<PDDOrder> orderList = new Gson().fromJson(array.toString(), type); |
| | | int totalCount = root.getInteger("total_count"); |
| | | com.alibaba.fastjson.JSONArray array = root.getJSONArray("order_list"); |
| | | Type type=new TypeToken<List<PDDOrder>>(){}.getType(); |
| | | List<PDDOrder> orderList = new Gson().fromJson( array.toJSONString(), type); |
| | | // 处理custom_params |
| | | for(PDDOrder order:orderList){ |
| | | String params=order.getCustomParameters(); |
| | | if(params.contains("{")) { |
| | | JSONObject jsonp = JSONObject.fromObject(params); |
| | | order.setCustomParameters(jsonp.optString("uid")); |
| | | } |
| | | } |
| | | return new PDDOrderResult(totalCount, orderList); |
| | | } |
| | | return null; |
| | |
| | | map.put("type", "pdd.ddk.order.detail.get"); |
| | | map.put("order_sn", orderSn); |
| | | String result = baseRequest(map); |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | JSONObject root = json.optJSONObject("order_detail_response"); |
| | | com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(result); |
| | | com.alibaba.fastjson.JSONObject root = json.getJSONObject("order_detail_response"); |
| | | if (root != null) { |
| | | return new Gson().fromJson(root.toString(), PDDOrder.class); |
| | | PDDOrder order = new Gson().fromJson(root.toString(), PDDOrder.class); |
| | | String params=order.getCustomParameters(); |
| | | if(params.contains("{")) { |
| | | JSONObject jsonp = JSONObject.fromObject(params); |
| | | order.setCustomParameters(jsonp.optString("uid")); |
| | | } |
| | | return order; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | */ |
| | | public static PDDGoodsDetail getGoodsDetail(Long goodsId) { |
| | | try { |
| | | return getGoodsDetail(goodsId, PID_DEFAULT, "437032"); |
| | | return getGoodsDetail(goodsId, PID_DEFAULT, "437031"); |
| | | } catch (PDDApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(customParameters)) { |
| | | map.put("custom_parameters", customParameters); |
| | | map.put("custom_parameters", getFormatCustomParameters(customParameters)); |
| | | } |
| | | |
| | | String result = baseRequest(map); |
| | |
| | | * @return |
| | | */ |
| | | public static boolean isAuth(String pid, String customParameters) { |
| | | // customParameters=customParameters.replace("_",""); |
| | | |
| | | System.out.println("是否授权:"+pid+"-"+customParameters); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("type", "pdd.ddk.member.authority.query"); |
| | | map.put("pid", pid); |
| | | map.put("custom_parameters", customParameters); |
| | | map.put("custom_parameters", getFormatCustomParameters(customParameters)); |
| | | String result = baseRequest(map); |
| | | JSONObject resultJson = JSONObject.fromObject(result); |
| | | if (resultJson.optJSONObject("authority_query_response").optInt("bind") == 0) { |
| | |
| | | * @return |
| | | */ |
| | | public static PDDConvertLinkResultVO getAuthLink(String pid, String customParameters) { |
| | | // customParameters=customParameters.replace("_",""); |
| | | |
| | | System.out.println("获取授权链接:"+pid+"-"+customParameters); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("type", "pdd.ddk.rp.prom.url.generate"); |
| | | map.put("channel_type", 10 + ""); |
| | | map.put("generate_we_app", true + ""); |
| | | map.put("custom_parameters", customParameters); |
| | | map.put("custom_parameters",getFormatCustomParameters(customParameters)); |
| | | map.put("p_id_list", "[\"" + pid + "\"]"); |
| | | String result = baseRequest(map); |
| | | System.out.println(result); |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | PDDConvertLinkResultVO vo = getAuthLink("8590899_72067894", 437032+""); |
| | | // PDDConvertLinkResultVO vo = getAuthLink("8590899_72067894", 437031+""); |
| | | boolean isAuthed = isAuth(PID_DEFAULT, 437031+""); |
| | | System.out.println("是否授权:"+isAuthed); |
| | | // |
| | | System.out.println(vo); |
| | | // PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(227873724698L); |
| | | // System.out.println(vo); |
| | | PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(419563711836L); |
| | | |
| | | // PDDConvertLinkResultVO vo = convertChannel("0", PID_DEFAULT, null); |
| | | |
| | | // System.out.println(vo); |
| | | // PinDuoDuoApiUtil.convert(goods.getGoodsSign(), PID_DEFAULT + "", "437032", false); |
| | | PDDConvertLinkResultVO goodsc = PinDuoDuoApiUtil.convert(goods.getGoodsSign(), PID_DEFAULT + "", "437031", false); |
| | | |
| | | System.out.println(""); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | public static String getCustomParams(Long uid) { |
| | | return uid + "_" + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd"); |
| | | return uid + "" + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd"); |
| | | } |
| | | |
| | | public static String getUidFromCustomParams(String params) { |
| | | if (params.contains("_")) { |
| | | return params.split("_")[0]; |
| | | } else { |
| | | if(params.length()>12) { |
| | | return params.substring(0, params.length() - 8); |
| | | }else{ |
| | | return params; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | |
| | | private String url; |
| | | private String mobile_short_url; |
| | | private String short_url; |
| | | private String schema_url; |
| | | |
| | | |
| | | public String getMobile_short_url() { |
| | |
| | | this.url = url; |
| | | } |
| | | |
| | | public String getSchema_url() { |
| | | return schema_url; |
| | | } |
| | | |
| | | public void setSchema_url(String schema_url) { |
| | | this.schema_url = schema_url; |
| | | } |
| | | |
| | | public static class WeAppInfoBean { |
| | | /** |
| | | * we_app_icon_url : http://xcxcdn.yangkeduo.com/pdd_logo.png |
| | |
| | | </appender> |
| | | |
| | | |
| | | <appender name="KAFKA_DEBUG" class="com.tencentcloudapi.cls.LoghubAppender"> |
| | | <!--必选项--> |
| | | <endpoint>${tencent.log.endpoint}</endpoint> |
| | | <accessKeyId>${tencent.log.accesskey}</accessKeyId> |
| | | <accessKeySecret>${tencent.log.accessKeySecret}</accessKeySecret> |
| | | <topicId>47887e50-3464-4fb1-b495-309b12139e81</topicId> |
| | | |
| | | <!-- 可选项 设置时间格式 --> |
| | | <timeFormat>yyyy-MM-dd'T'HH:mm:ssZ</timeFormat> |
| | | <timeZone>Asia/Shanghai</timeZone> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <mdcFields>THREAD_ID,MDC_KEY</mdcFields> |
| | | </appender> |
| | | |
| | | |
| | | <!-- 用户商品浏览 --> |
| | | <appender name="KAFKA_USER_GOODS_SCAN" class="com.tencentcloudapi.cls.LoghubAppender"> |
| | | <!--必选项--> |
| | |
| | | </logger> |
| | | |
| | | |
| | | <logger name="debugLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="KAFKA_DEBUG"></appender-ref> |
| | | </logger> |
| | | |
| | | |
| | | |
| | | |
| | | |