| | |
| | | |
| | | 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; |
| | |
| | | import com.yeshi.fanli.service.inter.user.QrCodeService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | 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; |
| | |
| | | public class DynamicControllerV2 { |
| | | |
| | | @Resource |
| | | private HongBaoManageService hongBaoManageService; |
| | | |
| | | @Resource |
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService; |
| | | private TaoBaoLinkManager taoBaoLinkManager; |
| | | |
| | | @Resource |
| | | private JumpDetailV2Service jumpDetailV2Service; |
| | |
| | | |
| | | @Resource |
| | | private CommonShareInfoService commonShareInfoService; |
| | | |
| | | @Resource |
| | | private UserCloudService userCloudService; |
| | | |
| | | @Resource(name = "taskExecutor") |
| | | private TaskExecutor executor; |
| | |
| | | * 查询顶部分类 |
| | | * |
| | | * @param acceptData |
| | | * @param page |
| | | * @param cid |
| | | * @param out |
| | | */ |
| | |
| | | } |
| | | |
| | | 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(); |
| | | |
| | |
| | | } |
| | | |
| | | 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(); |
| | |
| | | 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<>(); |
| | | |
| | |
| | | * 文章搜索 |
| | | * |
| | | * @param acceptData |
| | | * @param page |
| | | * @param key |
| | | * @param id |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "readArticle", method = RequestMethod.POST) |
| | |
| | | * 文章搜索 |
| | | * |
| | | * @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)); |
| | | } |
| | | |
| | |
| | | * @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) { |
| | |
| | | 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); |
| | |
| | | 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()) |
| | |
| | | } |
| | | }); |
| | | Gson gson = gsonBuilder.create(); |
| | | long count = goodsEvaluateService.countValidMaterials(type); |
| | | long count = goodsEvaluateService.countValidMaterials(type,acceptData.getSystem()); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | } |
| | | |
| | | 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(), Long.parseLong(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(Long.parseLong(goodsVO.getGoodsId())); |
| | |
| | | } else { |
| | | newText = newText.replace("[券后价]", MoneyBigDecimalUtil.getWithNoZera(goods.getCouponPrice()) + ""); |
| | | } |
| | | newText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n"); |
| | | newText = newText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n"); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | |
| | | * 活动分享绘图 |
| | | * @Title: createActivityShareImg |
| | | * @Description: |
| | | * @param title |
| | | * @param desc |
| | | * @param imgUrl |
| | | * @param type |
| | | * @param id |
| | | * @param erCodeContent |
| | | * @return |
| | | * String 返回类型 |
| | |
| | | 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); |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |