|
|
@@ -1,20 +1,101 @@
|
|
|
package com.goafanti.common.controller;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
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.common.enums.UserType;
|
|
|
+import com.goafanti.demand.service.DemandService;
|
|
|
+import com.goafanti.portal.bo.AchievementPortalDetailBo;
|
|
|
+import com.goafanti.portal.bo.AchievementPortalSimilarListBo;
|
|
|
+import com.goafanti.portal.bo.DemandPortalDetailBo;
|
|
|
+import com.goafanti.portal.bo.DemandPortalSimilarListBo;
|
|
|
+
|
|
|
@Controller
|
|
|
public class PortalController extends BaseController {
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private AchievementService achievementService;
|
|
|
+ @Resource
|
|
|
+ private DemandService demandService;
|
|
|
+
|
|
|
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
|
|
public String index(ModelAndView modelview) {
|
|
|
return "/index";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@RequestMapping(value = "/", method = RequestMethod.GET)
|
|
|
public String home(ModelAndView modelview) {
|
|
|
return "/index";
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技需求详情
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/portal/detail/demandDetail", method = RequestMethod.GET)
|
|
|
+ public ModelAndView portalDemandDetail(String id, Integer type) {
|
|
|
+ ModelAndView mv = new ModelAndView();
|
|
|
+ DemandPortalDetailBo demand = null;
|
|
|
+ if (UserType.PERSONAL.getCode().equals(type)) {
|
|
|
+ demand = demandService.findUserPortalDemandDetail(id);
|
|
|
+ } else if (UserType.ORGANIZATION.getCode().equals(type)) {
|
|
|
+ demand = demandService.findOrgPortalDemandDetail(id);
|
|
|
+ }
|
|
|
+ if (null != demand) {
|
|
|
+ String keyword = demand.getKeyword();
|
|
|
+ if (StringUtils.isNotBlank(keyword)) {
|
|
|
+ demand.setKeywordList(Arrays.asList(keyword.trim().split(",|,")));
|
|
|
+ }
|
|
|
+ Integer industryCategoryA = demand.getIndustryCategoryA();
|
|
|
+ if (null != industryCategoryA) {
|
|
|
+ List<DemandPortalSimilarListBo> similarList = demandService.findByIndustryCategoryA(industryCategoryA,
|
|
|
+ demand.getId());
|
|
|
+ mv.addObject("similarList", similarList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mv.setViewName("/portal/detail/demandDetail");
|
|
|
+ mv.addObject("demand", demand);
|
|
|
+
|
|
|
+ return mv;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技成果详情
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/portal/detail/achievementDetail", method = RequestMethod.GET)
|
|
|
+ public ModelAndView portalAchievementDetail(String id, Integer type) {
|
|
|
+ ModelAndView mv = new ModelAndView();
|
|
|
+ AchievementPortalDetailBo achievement = null;
|
|
|
+ if (UserType.PERSONAL.getCode().equals(type)) {
|
|
|
+ achievement = achievementService.findUserPortalAchievementDetail(id);
|
|
|
+ } else if (UserType.ORGANIZATION.getCode().equals(type)) {
|
|
|
+ achievement = achievementService.findOrgPortalAchievementDetail(id);
|
|
|
+ }
|
|
|
+ if (null != achievement) {
|
|
|
+ String keyword = achievement.getKeyword();
|
|
|
+ if (StringUtils.isNotBlank(keyword)) {
|
|
|
+ achievement.setKeywordList(Arrays.asList(keyword.trim().split(",|,")));
|
|
|
+ }
|
|
|
+ Integer fieldA = achievement.getFieldA();
|
|
|
+ if (null != fieldA) {
|
|
|
+ List<AchievementPortalSimilarListBo> similarList = achievementService.findByFieldA(fieldA,
|
|
|
+ achievement.getId(), type);
|
|
|
+ mv.addObject("similarList", similarList);
|
|
|
+ }
|
|
|
+ String technicalPictureUrl = achievement.getTechnicalPictureUrl();
|
|
|
+ if (StringUtils.isNotBlank(technicalPictureUrl)) {
|
|
|
+ achievement.setPictureList(Arrays.asList(technicalPictureUrl.trim().split(",|,")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mv.setViewName("/portal/detail/achievementDetail");
|
|
|
+ mv.addObject("achievement", achievement);
|
|
|
+ return mv;
|
|
|
+ }
|
|
|
}
|