/** * 根据编号预览 * * @param model * @param id * @return */ @RequestMapping("/preview") public String DsFinish(Model model, String id) { DemandSupplyInfo info = demandSupplyInfoService.getById(id); DemandSupplyVO vo = convertVO(info); model.addAttribute("vo", vo); List<FeedBack> list = new ArrayList<FeedBack>(); list = feedBackService.getByDemondInfoId(id); model.addAttribute("list", list); // 根据用户编号查询 String userId = info.getUserId(); if (StringUtils.isNoneBlank(userId)) { // 判断此消息其关注否 PraiseType attention = praiseInfoService.getTypeByUserId(userId, id); if (attention != null) { if (attention.equals(PraiseType.addPraise)) { model.addAttribute("att", attention); } } List<DemandSupplyInfo> ListThree = demandSupplyInfoService.getThreeByUserId(userId, id); if (ListThree != null && !ListThree.isEmpty()) { List<DemandSupplyVO> voThree = new ArrayList<DemandSupplyVO>(); for (DemandSupplyInfo vt : ListThree) { voThree.add(convertVO(vt)); } model.addAttribute("voThree", voThree); // for each convertVO // exclude first value object // order top 3 // top 4 } } return "DsFinish"; }