yujian
2020-05-17 b3a6bcd40f24f0c2a73c655ba2b14ccf7e927810
发圈多图
2个文件已修改
98 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
@@ -12,6 +12,7 @@
import javax.annotation.Resource;
import org.apache.commons.beanutils.PropertyUtils;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -621,11 +622,61 @@
            } else if (cid == TYPE_SUCAI) {
                type = 2;
            }
            List<GoodsEvaluate> listNew = new ArrayList<GoodsEvaluate>();
            List<GoodsEvaluate> list = goodsEvaluateService.queryMaterialsCache((page - 1) * Constant.PAGE_SIZE,
                    Constant.PAGE_SIZE, type);
            if (list == null) {
                list = new ArrayList<>();
            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;
                    }
                    GoodsEvaluate evaluateNew = new GoodsEvaluate();
                    try {
                        PropertyUtils.copyProperties(evaluateNew, goodsEvaluate);
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                    // 跳转过渡页
                    String jumpLink = configService.get(ConfigKeyEnum.activityDetailLink.getKey()) + "?type=%s&id=%s";
                    jumpLink = String.format(jumpLink, "circle", evaluateNew.getId());
                    evaluateNew.setJumpLink(jumpLink);
                    // 图片数量
                    if (evaluateNew.getImgList() != null && evaluateNew.getImgList().size() > 0) {
                        int size = evaluateNew.getImgList().size();
                        List<ImgInfo> listInfoNew = new ArrayList<ImgInfo>();
                        for (ImgInfo imgInfo : goodsEvaluate.getImgList()) {
                            if (imgInfo.getType() != ImgEnum.activity) {
                                listInfoNew.add(imgInfo);
                                continue;
                            }
                            ImgInfo infoNew = new ImgInfo();
                            try {
                                PropertyUtils.copyProperties(infoNew, imgInfo);
                            } catch (Exception e) {
                                e.printStackTrace();
                                continue;
                            }
                            infoNew.setType(ImgEnum.img);
                            // 图片大于一张时 显示九宫格图
                            if (size > 1) {
                                infoNew.setW(1);
                                infoNew.setH(1);
                            }
                            listInfoNew.add(infoNew);
                        }
                        evaluateNew.setImgList(listInfoNew);
                    }
                    listNew.add(evaluateNew);
                }
            }
            GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
@@ -706,7 +757,7 @@
            JSONArray jsonArray = new JSONArray();
            String listStr = gson.toJson(list);
            String listStr = gson.toJson(listNew);
            JSONArray array = JSONArray.fromObject(listStr);
            for (int i = 0; i < array.size(); i++) {
                Object object = array.get(i);
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -1152,6 +1152,7 @@
            }
        }
        
        int lineNum = 0;
        int totalImg = tempList.size();
        if (totalImg > 0) {
@@ -1631,46 +1632,6 @@
            // 按照发布显示时间段起始时间为准。
            evaluateNew.setPublishTime(evaluateNew.getStartTime());
            // 活动链接跳转过渡页
            EvaluateEnum evaluateEnum = evaluateNew.getType();
            if (evaluateEnum != null && evaluateEnum == EvaluateEnum.activity) {
                if (evaluateNew.getComments() != null && evaluateNew.getComments().size() > 0) {
                    String jumpLink = configService.get(ConfigKeyEnum.activityDetailLink.getKey()) + "?type=%s&id=%s";
                    jumpLink = String.format(jumpLink, "circle", evaluateNew.getId());
                    if (!StringUtil.isNullOrEmpty(evaluateNew.getJumpLink())) {
                        evaluateNew.setJumpLink(jumpLink);
                    }
                    List<ImgInfo> imgListNew = new ArrayList<>();
                    List<ImgInfo> imgList = evaluateNew.getImgList();
                    if (imgList != null && imgList.size() > 0) {
                        for (ImgInfo imgInfo: imgList) {
                            if (imgInfo.getType() != ImgEnum.img || imgInfo.getType() == ImgEnum.activity) {
                                ImgInfo imgInfoNew = new ImgInfo();
                                try {
                                    PropertyUtils.copyProperties(imgInfoNew, imgInfo);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    continue;
                                }
                                if (!StringUtil.isNullOrEmpty(imgInfoNew.getActivityUrl())) {
                                    imgInfoNew.setActivityUrl(jumpLink);
                                }
                                imgListNew.add(imgInfoNew);
                                continue;
                            }
                            imgListNew.add(imgInfo);
                        }
                    }
                    evaluateNew.setImgList(imgListNew);
                }
            }
            List<CommentInfo> comments = evaluateNew.getComments();
            if (comments != null && comments.size() > 0) {
                EvaluateEnum typeEnum = evaluateNew.getType();