Преглед изворни кода

Merge branch 'master' of jishutao/jitao-server into test

liliang4869 пре 7 година
родитељ
комит
9700d9acd1
1 измењених фајлова са 99 додато и 0 уклоњено
  1. 99 0
      src/main/java/com/goafanti/common/controller/WebpageController.java

+ 99 - 0
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -8,10 +8,12 @@ import java.util.List;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.commons.lang3.time.DateFormatUtils;
 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.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.goafanti.achievement.service.AchievementInterestService;
@@ -24,6 +26,7 @@ import com.goafanti.business.bo.JtBusinessCategoryTree;
 import com.goafanti.business.bo.JtBusinessProjectResult;
 import com.goafanti.business.service.JtBusinessService;
 import com.goafanti.common.bo.PolicyEntity;
+import com.goafanti.common.bo.Result;
 import com.goafanti.common.bo.fieldGlossoryBo;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.PageConstants;
@@ -42,6 +45,7 @@ import com.goafanti.common.model.ProjectInterest;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.LimitLengthUtil;
 import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.demand.bo.DemandListBo;
 import com.goafanti.demand.service.DemandInterestService;
@@ -910,5 +914,100 @@ public class WebpageController extends BaseController {
 			modelAndView.setViewName("/portal/technologyTrading/shopList");
 			return modelAndView;
 		}
+		
+		/*
+		-	 * 
+		-	 * type 0-政策  1-新闻
+		-	 * */
+			@RequestMapping(value = "/portal/news/newsDetail", method = RequestMethod.GET)
+			public ModelAndView portalHighTechEvaluateIprInfo(HttpServletRequest request, ModelAndView modelview, Long id,Integer type) {
+				modelview.setViewName("/portal/news/newsDetail");
+				modelview.addObject("type",type); 
+				if(type ==null )type=1;
+				if(type ==1) {
+				Pagination<NewsPortalList> newsList = newsService.portalNewsList(6, 1, 5, null, null, null,2);
+				News newsDetail = newsService.findNewsDetail(id);
+				Object news =null;
+				if(newsList!=null && newsList.getList().size()>0)news= newsList.getList().get(0);
+				if (null != newsDetail) {
+					newsDetail.setCreateTimeS(newsDetail.getCreateTime() != null
+							? DateFormatUtils.format(newsDetail.getCreateTime(), AFTConstants.MMDDYYYY) : "");
+					String summary = newsDetail.getSummary();
+					modelview.addObject("hasHighTech",
+							summary != null && (summary.indexOf("高新") > -1 || summary.indexOf("高企") > -1));
+					modelview.addObject("hasPatent",
+							summary != null && (summary.indexOf("专利") > -1 || summary.indexOf("知识产权") > -1));
+					modelview.addObject("hasCopyright",
+							summary != null && (summary.indexOf("软著") > -1 || summary.indexOf("知识产权") > -1));
+					modelview.addObject("hasTechProj",
+							summary != null && (summary.indexOf("科技") > -1 || summary.indexOf("项目") > -1));
+				}
+				@SuppressWarnings("unchecked")
+				List<NewsPortalList> la = (List<NewsPortalList>) newsList.getList();
+				for (NewsPortalList n : la) {
+					String createTimeFormattedDate = n.getCreateTimeFormattedDate();
+					n.setDataS(createTimeFormattedDate);
+				}
+				if(newsDetail.getTitleImg()!=null) {
+					String[] imgs=newsDetail.getTitleImg().split(",");
+					if(imgs[0]==null || imgs[0].length()<1)modelview.addObject("imgs",null);
+					else
+					modelview.addObject("imgs",imgs[0]);
+				}
+			modelview.addObject("newsDetail", newsDetail);
+				modelview.addObject("newsList", newsList.getList());
+				if(news!=null)
+				modelview.addObject("news", news);
+				
+				}
+				else {
+					List<PolicyEntity> newsList = achievementService.getIntellectualProperty(6);
+					PolicyEntity newsDetail = newsService.getPolicyDetail(id+"");
+					if (null != newsDetail) {
+			
+						String summary = newsDetail.getSummary();
+						modelview.addObject("hasHighTech",
+								summary != null && (summary.indexOf("高新") > -1 || summary.indexOf("高企") > -1));
+						modelview.addObject("hasPatent",
+								summary != null && (summary.indexOf("专利") > -1 || summary.indexOf("知识产权") > -1));
+						modelview.addObject("hasCopyright",
+							summary != null && (summary.indexOf("软著") > -1 || summary.indexOf("知识产权") > -1));
+						modelview.addObject("hasTechProj",
+								summary != null && (summary.indexOf("科技") > -1 || summary.indexOf("项目") > -1));
+					}
+					@SuppressWarnings("unchecked")
+					List<PolicyEntity> la = (List<PolicyEntity>) newsList;
+					if(newsDetail.getTitleImg()!=null) {
+						String[] imgs=newsDetail.getTitleImg().split(",");
+						if(imgs[0]==null || imgs[0].length()<1)modelview.addObject("imgs",null);
+						else
+						modelview.addObject("imgs",imgs[0]);
+				}
+					modelview.addObject("newsDetail", newsDetail);
+					modelview.addObject("newsList", newsList);
+					if(newsList!=null && newsList.size()>0)
+					modelview.addObject("news", newsList.get(0));
+				}
+				return modelview;
+			}
+			
+				/**
+				 * 新闻详情列表
+				 */
+				@RequestMapping(value = "/portal/news/list", method = RequestMethod.GET)
+				@ResponseBody
+				public Result portalNewsList(Integer type, String pageSize, String pageNo, Integer hot, Integer provinceId,
+						String keyword) {
+					Result res = new Result();
+				Integer pNo = 1, pSize = 4;
+					if (StringUtils.isNumeric(pageNo)) {
+					pNo = Integer.parseInt(pageNo);
+					}
+					if (StringUtils.isNumeric(pageSize)) {
+						pSize = Integer.parseInt(pageSize);
+					}
+					res.setData(newsService.portalNewsList(pSize, pNo, type, hot, provinceId, keyword,null));
+					return res;
+				}
 
 }