package com.goafanti.common.controller; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import com.goafanti.achievement.service.AchievementService; import com.goafanti.app.bo.consultantListBo; import com.goafanti.banners.enums.BannersType; import com.goafanti.banners.service.BannersService; import com.goafanti.business.bo.JtBusinessCategoryTree; import com.goafanti.business.service.JtBusinessService; import com.goafanti.common.bo.PolicyEntity; import com.goafanti.common.bo.fieldGlossoryBo; import com.goafanti.common.constant.PageConstants; import com.goafanti.common.model.Banners; import com.goafanti.common.model.JtBusinessCategory; import com.goafanti.common.model.JtBusinessProject; import com.goafanti.common.model.News; import com.goafanti.common.utils.LimitLengthUtil; import com.goafanti.common.utils.StringUtils; import com.goafanti.core.shiro.token.TokenManager; import com.goafanti.demand.bo.DemandListBo; import com.goafanti.demand.service.DemandService; import com.goafanti.user.bo.UserIdentityBo; import com.goafanti.user.service.OrganizationIdentityService; import com.goafanti.user.service.UserIdentityService; import com.goafanti.news.bo.NewsPortalList; import com.goafanti.news.enums.NewsType; import com.goafanti.news.service.NewsService; import com.goafanti.portal.bo.AchievementObject; @Controller public class WebpageController extends BaseController { @Resource private DemandService demandService; @Resource private AchievementService achievementService; @Resource private BannersService bannersService; @Resource private UserIdentityService userIdentityService; @Resource private OrganizationIdentityService organizationIdentityService; @Resource private NewsService newsService; @Resource private JtBusinessService jtBusinessService; @RequestMapping(value = "/user/account/index", method = RequestMethod.GET) public ModelAndView index(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/user/account/index"); return modelview; } @RequestMapping(value = "/user/account/evaluateInfo", method = RequestMethod.GET) public ModelAndView evaluateInfo(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/user/account/evaluateInfo"); return modelview; } @RequestMapping(value = "/user/account/set", method = RequestMethod.GET) public ModelAndView userSet(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/user/account/set"); return modelview; } @RequestMapping(value = "/user/account/achievement", method = RequestMethod.GET) public ModelAndView userAchievement(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/user/account/achievement"); return modelview; } @RequestMapping(value = "/user/account/demand", method = RequestMethod.GET) public ModelAndView userDemand(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/user/account/demand"); return modelview; } @RequestMapping(value = "/user/login", method = RequestMethod.GET) public String userLogin(HttpServletRequest request, ModelAndView modelview) { return "/user/login"; } @RequestMapping(value = "/user/logout", method = RequestMethod.GET) public String userLogout(HttpServletRequest request, ModelAndView modelview) { TokenManager.logout(); // return userLogin(request, modelview); return "redirect:/portal/index"; } @RequestMapping(value = "/user/signIn", method = RequestMethod.GET) public String userSignin(HttpServletRequest request, ModelAndView modelview) { return "/user/signIn"; } @RequestMapping(value = "/user/msignIn", method = RequestMethod.GET) public String mSignin(HttpServletRequest request, ModelAndView modelview) { return "/user/msignIn"; } @RequestMapping(value = "/user/certify", method = RequestMethod.GET) public ModelAndView userCertify(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/user/certify"); return modelview; } @RequestMapping(value = "/user/groupCertify", method = RequestMethod.GET) public ModelAndView userGroupCertify(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/user/groupCertify"); return modelview; } @RequestMapping(value = "/user/account/services", method = RequestMethod.GET) public ModelAndView userServices(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/user/account/services"); return modelview; } @RequestMapping(value = "/admin/login", method = RequestMethod.GET) public String adminLogin(HttpServletRequest request, ModelAndView modelview) { return "/admin/login"; } @RequestMapping(value = "/admin/demand", method = RequestMethod.GET) public String adminDemand(HttpServletRequest request, ModelAndView modelview) { return "/admin/demand"; } @RequestMapping(value = "/admin/achievement", method = RequestMethod.GET) public String adminAchievement(HttpServletRequest request, ModelAndView modelview) { return "/admin/achievement"; } @RequestMapping(value = "/admin/set", method = RequestMethod.GET) public String adminSet(HttpServletRequest request, ModelAndView modelview) { return "/admin/set"; } @RequestMapping(value = "/admin/userManage", method = RequestMethod.GET) public ModelAndView adminUserManage(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/userManage"); return modelview; } @RequestMapping(value = "/admin/customer", method = RequestMethod.GET) public ModelAndView adminCustomer(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/customer"); return modelview; } @RequestMapping(value = "/admin/servicesManage/technology", method = RequestMethod.GET) public ModelAndView adminServicesManageTechnology(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/servicesManage/technology"); return modelview; } @RequestMapping(value = "/admin/servicesManage/patent", method = RequestMethod.GET) public ModelAndView adminServicesManagePatent(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/servicesManage/patent"); return modelview; } @RequestMapping(value = "/admin/servicesManage/contract", method = RequestMethod.GET) public ModelAndView adminServicesManageContract(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/servicesManage/contract"); return modelview; } @RequestMapping(value = "/admin/servicesManage/highTech", method = RequestMethod.GET) public ModelAndView adminServicesManageHighTech(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/servicesManage/highTech"); return modelview; } @RequestMapping(value = "/admin/servicesManage/copyright", method = RequestMethod.GET) public ModelAndView adminServicesManageCopyright(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/servicesManage/copyright"); return modelview; } @RequestMapping(value = "/admin/servicesManage/projectOrder", method = RequestMethod.GET) public ModelAndView adminServiceManageProjectOrder(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/servicesManage/projectOrder"); return modelview; } @RequestMapping(value = "/admin/index", method = RequestMethod.GET) public ModelAndView adminHome(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/index"); return modelview; } @RequestMapping(value = "/admin/idea", method = RequestMethod.GET) public ModelAndView adminIdea(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/idea"); return modelview; } @RequestMapping(value = "/admin/userOrder", method = RequestMethod.GET) public ModelAndView adminUserOrder(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/userOrder"); return modelview; } @RequestMapping(value = "/admin/order", method = RequestMethod.GET) public ModelAndView adminOrder(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/order"); return modelview; } @RequestMapping(value = "/admin/operate", method = RequestMethod.GET) public ModelAndView adminOperate(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/admin/operate"); return modelview; } @RequestMapping(value = "/portal/membership", method = RequestMethod.GET) public ModelAndView membership(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/membership"); return modelview; } @RequestMapping(value = "/portal/search/subscriberUser", method = RequestMethod.GET) public ModelAndView portalSearchSubscriberUser(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/search/subscriberUser"); return modelview; } @RequestMapping(value = "/portal/search/subscriberOrg", method = RequestMethod.GET) public ModelAndView portalSearchSubscriberOrg(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/search/subscriberOrg"); return modelview; } /** * 评估页 */ @RequestMapping(value = "/portal/evaluation/index", method = RequestMethod.GET) public ModelAndView evaluation(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/evaluation/index"); handleBanners(modelview, BannersType.JI_SHU_PING_GU); return modelview; } /** * 服务汇 */ @RequestMapping(value = "/portal/service/serviceIndex", method = RequestMethod.GET) public ModelAndView portalServiceServiceIndex(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/service/serviceIndex"); //政策 ListpolicyEntities=achievementService.getIntellectualProperty(8); modelview.addObject("policyList",policyEntities); //新闻 Listnews=newsService.getNewsList(5); modelview.addObject("newsList",news); //高企服务 JtBusinessCategory gaoqi=jtBusinessService.getBusinessCategoryByLayerAndName(1, "高企服务"); JtBusinessCategory gaoqi2=jtBusinessService.getBusinessCategoryByLayerAndName(2, "高企服务"); ListgaoqiList=jtBusinessService.getBusinessProjectByCategoryId(gaoqi2.getId(),6); modelview.addObject("gaoqiList",gaoqiList); //知识产权贯标 JtBusinessCategory zscqgb=jtBusinessService.getBusinessCategoryByLayerAndName(1, "知识产权"); List zscqgbCategories=jtBusinessService.getBusinessCategoryBySuperId(zscqgb.getId(), 4); int[]zscqsizes= {1,2,4,10}; businessHelper(modelview, "zscqgb", zscqgbCategories, zscqsizes); //企业认证 JtBusinessCategory qiyerenzheng=jtBusinessService.getBusinessCategoryByLayerAndName(1, "企业认证"); ListqyrzCategories=jtBusinessService.getBusinessCategoryBySuperId(qiyerenzheng.getId(), 2); int []qyrzsizes= {8,8}; businessHelper(modelview, "qyrz", qyrzCategories, qyrzsizes); //管理体系 JtBusinessCategory manageSys=jtBusinessService.getBusinessCategoryByLayerAndName(1, "管理体系"); JtBusinessCategory manageSys2=jtBusinessService.getBusinessCategoryByLayerAndName(2, "管理体系"); ListmanageSysPro=jtBusinessService.getBusinessProjectByCategoryId(manageSys2.getId(), 18); modelview.addObject("manageSystemList",manageSysPro); //科技项目 JtBusinessCategory scienceProject=jtBusinessService.getBusinessCategoryByLayerAndName(1, "科技项目"); JtBusinessCategory scienceProject2=jtBusinessService.getBusinessCategoryByLayerAndName(2, "科技项目"); ListscienceProjects=jtBusinessService.getBusinessProjectByCategoryId(scienceProject2.getId(), 12); modelview.addObject("scienceProjectList",scienceProjects); //咨询师 ListuserIdentityBos=userIdentityService.getConsultantList(8); modelview.addObject("consultants",userIdentityBos); return modelview; } /* * 服务详情 * * @param id String * */ @RequestMapping(value = "/portal/service/serviceDetail", method = RequestMethod.GET) public ModelAndView portalServiceServiceDetail(HttpServletRequest request, ModelAndView modelview,String id) { modelview.setViewName("/portal/service/serviceDetails"); JtBusinessProject jtBusinessProject=jtBusinessService.getBusinessProjectDetail(id); modelview.addObject("project",jtBusinessProject); if(jtBusinessProject!=null) { JtBusinessCategoryTree tree=jtBusinessService.getCategoryTree(jtBusinessProject.getCategoryId()); modelview.addObject("tree",tree);} return modelview; } @RequestMapping(value="/portal/service/serviceList",method=RequestMethod.GET) public ModelAndView serviceList(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/service/serviceList"); return modelview; } /** * 知识产权 * * @param request * @param modelview * @return */ @RequestMapping(value = "/portal/service/propertyRight", method = RequestMethod.GET) public ModelAndView propertyRight(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/service/propertyRight"); return modelview; } /** * 高企认定 * * @param request * @param modelview * @return */ @RequestMapping(value = "/portal/service/highTechCognizance", method = RequestMethod.GET) public ModelAndView highTechCognizance(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/service/highTechCognizance"); return modelview; } /** * 技术交易 */ @RequestMapping(value = "/portal/technologyTrading/index", method = RequestMethod.GET) public ModelAndView portalTechnologyTradingIndex(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/technologyTrading/index"); handleBanners(modelview, BannersType.JI_SHU_JIAO_YI); List newsPortalList = newsService.portalNewsPolicy(); modelview.addObject("newsPortalList", newsPortalList); List portalNewsQuestion = newsService.portalNewsQuestion(); modelview.addObject("portalNewsQuestion", portalNewsQuestion); return modelview; } /** * * 智库咨询 * * @param request * @param modelview * @return */ @RequestMapping(value = "/portal/thinkTank/index", method = RequestMethod.GET) public ModelAndView thinkTank(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/thinkTank/index"); return modelview; } /** * 政策列表 * * @return */ @SuppressWarnings("unchecked") @RequestMapping(value = "/portal/thinkTank/policyList", method = RequestMethod.GET) public ModelAndView policyList(ModelAndView modelview) { modelview.setViewName("/portal/thinkTank/policyList"); List newsList = (List) newsService.portalNewsList(5, 1, null, null, null, null) .getList(); modelview.addObject("newsList", newsList); return modelview; } /** * 会员介绍 * * @param request * @param modelview * @return */ @RequestMapping(value = "/portal/member") public ModelAndView member(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/member"); return modelview; } /** * 技术评估 * * @param request * @param modelview * @return */ @RequestMapping(value = "/portal/technologyTrading/assessMent") public ModelAndView assessMent(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/technologyTrading/assessMent"); modelview.addObject("zcfg", newsService.findIndexNewsList(0, NewsType.KJZX.getCode(), 4)); return modelview; } /** * 关于我们 * * @param request * @param modelview * @return */ @RequestMapping(value = "/portal/aboutUs", method = RequestMethod.GET) public ModelAndView aboutUs(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/aboutUs"); return modelview; } /** * 联系我们 * * @param request * @param modelview * @return */ @RequestMapping(value = "/portal/contactUs", method = RequestMethod.GET) public ModelAndView contactUs(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/contactUs"); return modelview; } private void handleBanners(ModelAndView modelview, BannersType bannersType) { List banners = bannersService.findPortalBanners(bannersType.getKey()); if (!banners.isEmpty()) { modelview.addObject("banners", banners); } } /** * 服务-推荐 * * @param request * @param modelview * @return */ @RequestMapping(value = "/portal/service/recommended") public ModelAndView recommended(HttpServletRequest request, ModelAndView modelview) { modelview.setViewName("/portal/service/recommended"); return modelview; } /* * 首页 * * */ @RequestMapping(value = "/portal/index") public ModelAndView mainIndex(HttpServletRequest request, ModelAndView modelview) { String url =com.goafanti.common.utils.StringUtils.getDomainByHttpRequest(request); modelview.setViewName("/portal/index"); List jtBusinessProjects=jtBusinessService.getProjectsLimit(5); modelview.addObject("projects",jtBusinessProjects); List achievementObjects=achievementService.getHotAchievements(9, url, "web_index"); modelview.addObject("achievements",achievementObjects); List policyEntities=achievementService.getIntellectualProperty(4); modelview.addObject("policys",policyEntities); List demandListBos=demandService.getHotDemand(9, url, "web_index"); for(DemandListBo demandListBo:demandListBos) { if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null); else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]); } //专家 ListaExperts=userIdentityService.getExperts(8); modelview.addObject("experts",aExperts); modelview.addObject("demands",demandListBos); return modelview; } /* * 技淘3.0-科技需求页 * @param request * @param modelview * @return * * */ //需求首页 @RequestMapping(value = "/portal/technologyTrading/demand") public ModelAndView demand(HttpServletRequest request, ModelAndView modelview) { String showLocation="web_demand_main"; String url =com.goafanti.common.utils.StringUtils.getDomainByHttpRequest(request); modelview.setViewName("/portal/technologyTrading/demand"); //行业 List industryList = userIdentityService.industryList(); modelview.addObject("industryList", industryList); //最新需求 List recentDemandList=demandService.recentDemand(5,url,showLocation); LimitLengthUtil.limiteDemandCompanyAndName(recentDemandList, 18, 18); modelview.addObject("recentDemandList",recentDemandList); // // //加急需求 List urgentDemand=demandService.getUrgentDemand(5,url,showLocation); List urgentDemand2=urgentDemand.subList(0, Math.min(2, urgentDemand.size())); List urgentDemand3=urgentDemand.subList( Math.min(2, urgentDemand.size()), Math.min(5, urgentDemand.size())); System.out.print("u2:"+urgentDemand2.size()+" u3:"+urgentDemand3.size()); LimitLengthUtil.limiteDemandLength(urgentDemand2,13,30); LimitLengthUtil.limiteDemandLength(urgentDemand3,13,33); modelview.addObject("urgentDemand2",urgentDemand2); modelview.addObject("urgentDemand3",urgentDemand3); //热点需求 List hotDemand=demandService.getHotDemand(5,url,showLocation); List hotDemand2=hotDemand.subList(0, Math.min(2, hotDemand.size())); List hotDemand3=hotDemand.subList( Math.min(2, hotDemand.size()), Math.min(5, hotDemand.size())); System.out.print("u2:"+hotDemand2.size()+" u3:"+hotDemand3.size()); LimitLengthUtil.limiteDemandLength(hotDemand2,13,30); LimitLengthUtil.limiteDemandLength(hotDemand3,13,33); modelview.addObject("hotDemand2",hotDemand2); modelview.addObject("hotDemand3",hotDemand3); //企业技术需求 List eightMaxCompanyDemand=demandService.companyDemand(8,url,showLocation); for(DemandListBo demandListBo:eightMaxCompanyDemand) { if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null); else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]); } modelview.addObject("companyDemandList",eightMaxCompanyDemand); //地区产业需求 最多4个 List fourMaxareaDemand=demandService.areaDemand(4,url,showLocation); for(DemandListBo demandListBo:fourMaxareaDemand) { if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null); else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]); } LimitLengthUtil.limiteDemandLength(fourMaxareaDemand,10,208); modelview.addObject("areaDemandList",fourMaxareaDemand); //产学研需求 最多9个 List nightMaxProLearnStudyDemand=demandService.proLearnStudyDemand(9,url,showLocation); for(DemandListBo demandListBo:nightMaxProLearnStudyDemand) { if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null); else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]); } LimitLengthUtil.limiteDemandLength(nightMaxProLearnStudyDemand,10,208); LimitLengthUtil.limiteDemandCompanyAndName(nightMaxProLearnStudyDemand, 10, 208); modelview.addObject("proLearnStudyDemandList",nightMaxProLearnStudyDemand); //研产资金需求 最多4个 List fourMaxFundDemand=demandService.getFundCrowdDemand(4,url,showLocation); for(DemandListBo demandListBo:fourMaxFundDemand) { if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null); else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]); } LimitLengthUtil.limiteDemandLength(fourMaxFundDemand,9,30); modelview.addObject("fundDemandList",fourMaxFundDemand); //技术人才需求 List sixMaxPersonnelDemand=demandService.getPersonnelDemand(6,url,showLocation); // List fourMaxPersonnelDemand=personnelDemand.subList(0,Math.min(6, personnelDemand.size())); for(DemandListBo demandListBo:sixMaxPersonnelDemand) { if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null); else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]); } LimitLengthUtil.limiteDemandLength(sixMaxPersonnelDemand,7,30); modelview.addObject("personnelDemandList",sixMaxPersonnelDemand); return modelview; } //需求详情 @RequestMapping(value = "/portal/technologyTrading/demandDetail") public ModelAndView DemandDetail(HttpServletRequest request, ModelAndView modelAndView,String id, Integer type) { String url=StringUtils.getDomainByHttpRequest(request); //详情 DemandListBo demand=demandService.getDemandDetail(id, type); int countInterest=demandService.getInterestCount(id); demand.setCountInterest(countInterest+""); modelAndView.addObject("demand",demand); //精品需求 ListboutiqueDemandList=LimitLengthUtil.LimitListLengthRandomly(demandService.getBoutiqueDemandList(10,url,""),3,10); modelAndView.addObject("reboutiquedemand",boutiqueDemandList); //猜你喜欢 ListguessYouLikeList=LimitLengthUtil.LimitListLengthRandomly(demandService.recentDemand(10, url,""), 4, 10); modelAndView.addObject("redemandlist",guessYouLikeList); //view modelAndView.setViewName("/portal/technologyTrading/demandDetail"); return modelAndView; } //成果首页 @RequestMapping(value = "/portal/technologyTrading/achievement", method = RequestMethod.GET) public ModelAndView portalSearchAchievement(HttpServletRequest request, ModelAndView modelview) { String showLocation="web_achievement_main"; String url =com.goafanti.common.utils.StringUtils.getDomainByHttpRequest(request); modelview.setViewName("/portal/technologyTrading/achievement"); //行业 List industryList = userIdentityService.industryList(); modelview.addObject("industryList", industryList); //最新成果 ListrecentAchievements=achievementService.recentAchievements(5,url,showLocation); modelview.addObject("recentAchievements",recentAchievements); //热门关注 List hotAchievements=achievementService.getHotAchievements(6,url,showLocation); modelview.addObject("hotAchievements",hotAchievements); //专利 ListpatentAchievements=achievementService.getPatentList(9,url,showLocation); modelview.addObject("patents",patentAchievements); //实用技术 ListpracticalTechnology=achievementService.getPracticalTechnologys(8,url,showLocation); modelview.addObject("practicalTechnology",practicalTechnology); ListintellectualPropertyPolicyList=achievementService.getIntellectualProperty(5); modelview.addObject("policyList",intellectualPropertyPolicyList); return modelview; } @RequestMapping(value = "/portal/technologyTrading/achievementDetail") public ModelAndView achievementDetail(HttpServletRequest request, ModelAndView modelAndView,String id, Integer type) { //详情 AchievementObject achievementObject=achievementService.getAchievementDetail(id,type); modelAndView.addObject("achievementdetail",achievementObject); //精品 Listboutiques=LimitLengthUtil.LimitListLengthRandomly(achievementService.getBoutiquePatent(10),3,10); modelAndView.addObject("reboutiqueachievement",boutiques); //猜你喜欢 List guess =LimitLengthUtil.LimitListLengthRandomly(achievementService.guessYouLike(10), 4, 10); modelAndView.addObject("guess",guess); //view modelAndView.setViewName("/portal/technologyTrading/achievementDetail"); return modelAndView; } private void businessHelper(ModelAndView modelAndView,String categoryName,List jtBusinessCategories,int[] sizes) { for(int i=0;iprojects=jtBusinessService.getBusinessProjectByCategoryId(jtBusinessCategories.get(i).getId(), sizes[i]); modelAndView.addObject(categoryName+i,jtBusinessCategories.get(i)); modelAndView.addObject(categoryName+"List"+i,projects); } } }