| | |
| | | |
| | | 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; |
| | |
| | | } 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(); |
| | |
| | | |
| | | 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); |