From c9cbad5f5d18c6b2ac5a063e41007933d7028329 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 07 七月 2020 15:24:17 +0800 Subject: [PATCH] 返利配置文件加入系统区分 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java | 103 +++++++++++++++++++++++++++------------------------ 1 files changed, 55 insertions(+), 48 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java index f0469f7..db30b9f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java @@ -16,6 +16,10 @@ import javax.annotation.Resource; +import com.yeshi.fanli.entity.SystemEnum; +import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException; +import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager; +import com.yeshi.fanli.util.*; import org.apache.commons.beanutils.PropertyUtils; import org.springframework.core.task.TaskExecutor; import org.springframework.stereotype.Controller; @@ -55,7 +59,6 @@ import com.yeshi.fanli.entity.taobao.TaoBaoLink; import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException; import com.yeshi.fanli.exception.share.ShareGoodsException; -import com.yeshi.fanli.exception.user.cloud.UserCloudException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; import com.yeshi.fanli.service.inter.config.ConfigService; @@ -75,13 +78,6 @@ import com.yeshi.fanli.service.inter.user.cloud.UserCloudService; import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; -import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.FilePathEnum; -import com.yeshi.fanli.util.ImageUtil; -import com.yeshi.fanli.util.MoneyBigDecimalUtil; -import com.yeshi.fanli.util.StringUtil; -import com.yeshi.fanli.util.TimeUtil; -import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.cache.JDGoodsCacheUtil; import com.yeshi.fanli.util.jd.JDApiUtil; import com.yeshi.fanli.util.jd.JDUtil; @@ -109,10 +105,7 @@ public class DynamicControllerV2 { @Resource - private HongBaoManageService hongBaoManageService; - - @Resource - private TaoBaoGoodsBriefService taoBaoGoodsBriefService; + private TaoBaoLinkManager taoBaoLinkManager; @Resource private JumpDetailV2Service jumpDetailV2Service; @@ -229,7 +222,6 @@ * 鏌ヨ椤堕儴鍒嗙被 * * @param acceptData - * @param page * @param cid * @param out */ @@ -386,7 +378,7 @@ } List<SpecialVO> list = specialService.listByPlaceKeyHasLabel((page - 1) * Constant.PAGE_SIZE, - Constant.PAGE_SIZE, listKey, platformCode, Integer.parseInt(acceptData.getVersion())); + Constant.PAGE_SIZE, listKey, platformCode, Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); long time = System.currentTimeMillis(); @@ -420,7 +412,7 @@ } long count = specialService.countByPlaceKeyList(listKey, platformCode, - Integer.parseInt(acceptData.getVersion())); + Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation(); Gson gson = gsonBuilder.create(); @@ -545,13 +537,13 @@ JSONObject data = new JSONObject(); if (page == 1 && !search) { List<BannerVO> banners = swiperPictureService.getByBannerCardAndVersion("article_banners", - acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion())); + acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); if (banners == null) banners = new ArrayList<>(); data.put("banners", gson.toJson(banners)); List<SpecialVO> listSpecial = specialService.listByVersion(0, Integer.MAX_VALUE, "article_specials", - acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion())); + acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); if (listSpecial == null) listSpecial = new ArrayList<>(); @@ -574,8 +566,7 @@ * 鏂囩珷鎼滅储 * * @param acceptData - * @param page - * @param key + * @param id * @param out */ @RequestMapping(value = "readArticle", method = RequestMethod.POST) @@ -605,14 +596,12 @@ * 鏂囩珷鎼滅储 * * @param acceptData - * @param page - * @param key * @param out */ @RequestMapping(value = "getArticleHot", method = RequestMethod.POST) public void getArticleHot(AcceptData acceptData, PrintWriter out) { JSONObject data = new JSONObject(); - data.put("words", configService.get(ConfigKeyEnum.articleHotWords.getKey())); + data.put("words", configService.getValue(ConfigKeyEnum.articleHotWords.getKey(), SystemInfoUtil.getSystem(acceptData))); out.print(JsonUtil.loadTrueResult(data)); } @@ -626,7 +615,7 @@ * @param out */ @RequestMapping(value = "getDynamicList", method = RequestMethod.POST) - public void getDynamicListNew(AcceptData acceptData, Integer page, Long cid, String subId, PrintWriter out) { + public void getDynamicListNew(AcceptData acceptData, Integer page, Long cid, String subId, Long uid, PrintWriter out) { try { int type = 1; if (cid == TYPE_FAQUAN) { @@ -637,17 +626,22 @@ List<GoodsEvaluate> listNew = new ArrayList<GoodsEvaluate>(); List<GoodsEvaluate> list = goodsEvaluateService.queryMaterialsCache((page - 1) * Constant.PAGE_SIZE, - Constant.PAGE_SIZE, type); + Constant.PAGE_SIZE, type,acceptData.getSystem()); if (!VersionUtil.greaterThan_2_1_1(acceptData.getPlatform(), acceptData.getVersion())) { listNew.addAll(list); } else if (list.size() > 0) { // 娲诲姩鍥剧墖涓嶅厑璁歌烦杞� - for (GoodsEvaluate goodsEvaluate : list) { - if (goodsEvaluate.getType() != EvaluateEnum.activity) { - listNew.add(goodsEvaluate); - continue; + + // 浜戝彂鍗曟槸鍚﹀紑鍚� + boolean cloudOpen = configService.isRobotCloudOpen(ConfigKeyEnum.robotCloudOpenCircle.getKey(),acceptData.getPlatform(), acceptData.getVersion(),SystemInfoUtil.getSystem(acceptData)); + if (!cloudOpen && uid != null) { + List<String> testUsers = configService.getTestUsers(SystemInfoUtil.getSystem(acceptData)); + if (testUsers != null && testUsers.contains(uid+"")) { + cloudOpen = true; } - + } + + for (GoodsEvaluate goodsEvaluate : list) { GoodsEvaluate evaluateNew = new GoodsEvaluate(); try { PropertyUtils.copyProperties(evaluateNew, goodsEvaluate); @@ -655,6 +649,19 @@ e.printStackTrace(); continue; } + + EvaluateEnum evaluateEnum = evaluateNew.getType(); + // 鍗曞搧 娲诲姩鍙互涓�閿簯鍙戝崟 + if (evaluateEnum == EvaluateEnum.activity || evaluateEnum == EvaluateEnum.single) { + evaluateNew.setCloud(cloudOpen); + } + + if (evaluateEnum != EvaluateEnum.activity) { + listNew.add(evaluateNew); + continue; + } + + // 璺宠浆杩囨浮椤� // String jumpLink = // configService.get(ConfigKeyEnum.activityDetailLink.getKey()) @@ -768,7 +775,7 @@ } }); Gson gson = gsonBuilder.create(); - long count = goodsEvaluateService.countValidMaterials(type); + long count = goodsEvaluateService.countValidMaterials(type,acceptData.getSystem()); JSONArray jsonArray = new JSONArray(); @@ -818,8 +825,8 @@ * @param out */ @RequestMapping(value = "evaluateShare", method = RequestMethod.POST) - public void evaluateShare(AcceptData acceptData, Long uid, String id, Integer type, Long goodsId, Integer goodsType, - PrintWriter out) { + public void evaluateShare(AcceptData acceptData, Long uid, String id, Integer type, String goodsId, + Integer goodsType, PrintWriter out) { try { if (uid == null) { out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�")); @@ -831,7 +838,7 @@ return; } - if (type == 1 && (goodsId == null || goodsType == null)) { + if (type == 1 && (StringUtil.isNullOrEmpty(goodsId) || goodsType == null)) { out.print(JsonUtil.loadFalseResult("鍟嗗搧鍙傛暟涓嶈兘涓虹┖")); return; } @@ -903,7 +910,7 @@ continue; } - String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode, imgInfo.getUrl()); + String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode, imgInfo.getUrl(),SystemInfoUtil.getSystem(acceptData)); if (!StringUtil.isNullOrEmpty(jumpLink)) { list.add(jumpLink); } @@ -913,10 +920,10 @@ if (type == 1) { for (ImgInfo imgInfo : imgs) { if (imgInfo.getGoodsVO() != null) - if (imgInfo.getGoodsVO().getGoodsId().longValue() == goodsId.longValue() + if (imgInfo.getGoodsVO().getGoodsId().equalsIgnoreCase(goodsId) && imgInfo.getGoodsVO().getGoodsType() == goodsType.intValue()) { String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode, - imgInfo.getUrl()); + imgInfo.getUrl(),SystemInfoUtil.getSystem(acceptData)); if (!StringUtil.isNullOrEmpty(jumpLink)) { list.add(jumpLink); } @@ -927,7 +934,7 @@ for (ImgInfo imgInfo : imgs) { if (imgInfo.getGoodsVO() != null) { String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode, - imgInfo.getUrl()); + imgInfo.getUrl(),SystemInfoUtil.getSystem(acceptData)); if (!StringUtil.isNullOrEmpty(jumpLink)) { list.add(jumpLink); } @@ -985,20 +992,21 @@ } private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user, String relationId, String inviteCode, - String mainPic) { + String mainPic, SystemEnum system) { String jumpLink = null; if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { TaoBaoLink taoBaoLink = null; try { - taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(user.getId(), goodsVO.getGoodsId(), relationId); - } catch (ShareGoodsException e) { + taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(user.getId(), Long.parseLong(goodsVO.getGoodsId()), + relationId,null); + } catch (TaoBaoConvertLinkException e) { e.printStackTrace(); } jumpLink = ShareControllerV2.getERCodeContentNew( - configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), taoBaoLink.getGoods(), + configService.getValue(ConfigKeyEnum.taobaoShareQrcodeText.getKey(),system), taoBaoLink.getGoods(), TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken())); } else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_JD) { - JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsVO.getGoodsId()); + JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(Long.parseLong(goodsVO.getGoodsId())); if (jdGoods == null) { return null; } @@ -1012,8 +1020,8 @@ jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", user.getId() + ""); } else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_PDD) { - jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsVO.getGoodsId(), PinDuoDuoApiUtil.PID_SHARE + "", - user.getId() + ""); + jumpLink = PinDuoDuoApiUtil.getPromotionUrl(Long.parseLong(goodsVO.getGoodsId()), + PinDuoDuoApiUtil.PID_SHARE + "", user.getId() + ""); } FileUploadResult uploadResult = qrCodeService.drawDynamicGoodsPoster(jumpLink, user.getPortrait(), inviteCode, @@ -1385,9 +1393,8 @@ * 娲诲姩鍒嗕韩缁樺浘 * @Title: createActivityShareImg * @Description: - * @param title - * @param desc - * @param imgUrl + * @param type + * @param id * @param erCodeContent * @return * String 杩斿洖绫诲瀷 @@ -1502,7 +1509,7 @@ if (tokenList != null && tokenList.size() > 0) { // 鏋勯�犲垎浜摼鎺� erCodeContent = ShareControllerV2.getTaoBaoActiivtyERCodeContentNew( - configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), tokenList.get(0)); + configService.getValue(ConfigKeyEnum.taobaoShareQrcodeText.getKey(),SystemInfoUtil.getSystem(acceptData)), tokenList.get(0)); } else { // 鑾峰彇閾炬帴 List<String> urlList = JDUtil.getJDShortLinksFromText(newText); -- Gitblit v1.8.0