소스 검색

政策新闻列表修改

liliang4869 7 년 전
부모
커밋
2493c42826

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

@@ -279,7 +279,7 @@ public class WebpageController extends BaseController {
 		List<PolicyResult>policies=(List<PolicyResult>) policyService.searchPolicy("", 2, null, null, "web_tech_service_index", 1, 8).getList();
 		modelview.addObject("policyList",policies); 
 		//新闻
-		List<News>news=(List<News>) newsService.portalNewsList(5, 1, null, null, null, null).getList();
+		List<News>news=(List<News>) newsService.portalNewsList(5, 1, null, null, null, null,2).getList();
 		modelview.addObject("newsList",news);
 		//高企服务
 		JtBusinessCategory gaoqi=jtBusinessService.getBusinessCategoryByLayerAndName(1, "高企服务");
@@ -427,7 +427,7 @@ public class WebpageController extends BaseController {
 	@RequestMapping(value = "/portal/thinkTank/policyList", method = RequestMethod.GET)
 	public ModelAndView policyList(ModelAndView modelview) {
 		modelview.setViewName("/portal/thinkTank/policyList");
-		List<NewsPortalList> newsList = (List<NewsPortalList>) newsService.portalNewsList(5, 1, null, null, null, null)
+		List<NewsPortalList> newsList = (List<NewsPortalList>) newsService.portalNewsList(5, 1, null, null, null, null,2)
 				.getList();
 		modelview.addObject("newsList", newsList);
 		return modelview;

+ 6 - 1
src/main/java/com/goafanti/common/mapper/NewsMapper.xml

@@ -270,7 +270,6 @@
 		<if test="provinceId != null">
 			and a.province_id = #{provinceId,jdbcType=INTEGER}
 		</if>
-
 		<if test="type != null and type != 0 " >
 			and a.type = #{type,jdbcType=INTEGER}
 		</if>
@@ -281,6 +280,9 @@
 		-->
 		<if test="keyword != null">
 			and a.title like concat('%',#{keyword},'%')
+		</if>
+		<if test="auditStatus!=null">
+		and a.audit_status=#{auditStatus,jdbcType=INTEGER}
 		</if>	
 		order by create_time desc
 		<if test="page_sql != null">
@@ -308,6 +310,9 @@
 		<if test="keyword != null">
 			and a.title like concat('%',#{keyword},'%')
 		</if>
+		<if test="auditStatus!=null">
+		and a.audit_status=#{auditStatus,jdbcType=INTEGER}
+		</if>	
 	</select>
 	<select id="portalNewsPolicy" resultType="com.goafanti.news.bo.NewsPortalList">
 		select

+ 1 - 0
src/main/java/com/goafanti/common/mapper/PolicyMapper.xml

@@ -576,6 +576,7 @@
   <if test="endDate !=null">
     and	p.release_date <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
   </if>
+  order by p.release_date desc
   <if test="page_sql!=null">
   ${page_sql}
   </if>

+ 4 - 1
src/main/java/com/goafanti/news/service/NewsService.java

@@ -256,7 +256,7 @@ public class NewsService extends BaseMybatisDao<NewsMapper> {
 
 	@SuppressWarnings("unchecked")
 	public Pagination<NewsPortalList> portalNewsList(Integer pSize, Integer pNo, Integer type, Integer hot,
-			Integer provinceId, String keyword) {
+			Integer provinceId, String keyword,Integer auditStatus) {
 		Map<String, Object> params = new HashMap<String, Object>();
 		if (null != hot) {
 			params.put("hot", hot);
@@ -276,6 +276,9 @@ public class NewsService extends BaseMybatisDao<NewsMapper> {
 		if (pSize == null || pSize < 0 || pSize > 10) {
 			pSize = 10;
 		}
+		if(auditStatus!=null) {
+			params.put("auditStatus", auditStatus);
+		}
 		return (Pagination<NewsPortalList>) findPage("portalNewsList", "portalNewsCount", params, pNo, pSize);
 	}
 

+ 216 - 216
src/main/java/com/goafanti/portal/controller/PortalNewsController.java

@@ -1,217 +1,217 @@
-package com.goafanti.portal.controller;
-
-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.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.AchievementService;
-import com.goafanti.app.bo.ProjectDetailBo;
-import com.goafanti.banners.enums.BannersType;
-import com.goafanti.banners.service.BannersService;
-import com.goafanti.business.service.BusinessProjectService;
-import com.goafanti.common.bo.PolicyEntity;
-import com.goafanti.common.bo.Result;
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.constant.ErrorConstants;
-import com.goafanti.common.controller.BaseController;
-import com.goafanti.common.dao.AchievementMapper;
-import com.goafanti.common.model.Banners;
-import com.goafanti.common.model.News;
-import com.goafanti.common.utils.StringUtils;
-import com.goafanti.core.mybatis.page.Pagination;
-import com.goafanti.news.bo.NewsPortalList;
-import com.goafanti.news.enums.NewsType;
-import com.goafanti.news.service.NewsService;
-
-@Controller
-public class PortalNewsController extends BaseController {
-	@Resource
-	NewsService				newsService;
-	@Resource
-	private BannersService	bannersService;
-	@Resource
-	private BusinessProjectService	businessProjectService;
-	
-	@Resource
-	private AchievementService achievementService;
-	/**
-	 * 策源地
-	 * 
-	 * @param request
-	 * @param modelview
-	 * @return
-	 */
-	@RequestMapping(value = "/portal/news/newsIndex", method = RequestMethod.GET)
-	public ModelAndView portalNewsNewsIndex(HttpServletRequest request, ModelAndView modelview, String noCache) {
-		modelview.setViewName("/portal/news/newsIndex");
-		if (StringUtils.equals(noCache, "clear")) {
-			newsService.cleanList();
-		}
-		String domainName = request.getServerName();
-		modelview.addObject("kjkx", newsService.findNewsList(0, NewsType.KJZX.getCode(), 2, domainName, false));
-		modelview.addObject("jtdt", newsService.findNewsList(0, NewsType.JTDT.getCode(), 2, domainName, false));
-		modelview.addObject("zfwl", newsService.findNewsList(0, NewsType.ZFWL.getCode(), 3, domainName, false));
-		modelview.addObject("gjzc", newsService.findNewsList(0, NewsType.GJZC.getCode(), 3, domainName, false));
-		modelview.addObject("dfzc", newsService.findNewsList(0, NewsType.DFZC.getCode(), 3, domainName, false));
-		handleBanners(modelview, BannersType.CE_YUAN_DI);
-		return modelview;
-	}
-
-	/**
-	 * 新闻详情
-	 */
-	@RequestMapping(value = "/portal/news/newsDetails", method = RequestMethod.GET)
-	public ModelAndView portalNewsNewsDetails(HttpServletRequest request, ModelAndView modelview) {
-		modelview.setViewName("/portal/news/newsDetails");
-		return modelview;
-	}
-
-	/**
-	 * 新闻详情APP
-	 */
-	@RequestMapping(value = "/portal/news/newsDetailApp", method = RequestMethod.GET)
-	public ModelAndView portalNewsNewsDetailApp(HttpServletRequest request, ModelAndView modelview) {
-		modelview.setViewName("/portal/news/newsDetailApp");
-		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));
-		return res;
-	}
-
-	/**
-	 * 新闻详情
-	 */
-	@RequestMapping(value = "/portal/news/detailInfo", method = RequestMethod.GET)
-	@ResponseBody
-	public Result portalNewsDetail(Long id) {
-		Result res = new Result();
-		if (null == id) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "新闻ID"));
-			return res;
-		}
-
-		/* newsService.portalNewsList(6,1, type,hot,provinceId,keyword) */
-
-		res.setData(newsService.findNewsDetail(id));
-		return res;
-	}
-
-	/*
-	 * 
-	 * 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);
-		News newsDetail = newsService.findNewsDetail(id);
-		Object 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);
-		}
-		modelview.addObject("newsDetail", newsDetail);
-		modelview.addObject("newsList", newsList.getList());
-		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;
-			
-			modelview.addObject("newsDetail", newsDetail);
-			modelview.addObject("newsList", newsList);
-			if(newsList!=null && newsList.size()>0)
-			modelview.addObject("news", newsList.get(0));
-		}
-		return modelview;
-	}
-
-	private void handleBanners(ModelAndView modelview, BannersType bannersType) {
-		List<Banners> banners = bannersService.findPortalBanners(bannersType.getKey());
-		if (!banners.isEmpty()) {
-			modelview.addObject("banners", banners);
-		}
-	}
-
-	/**
-	 * 高新认定APP
-	 */
-	@RequestMapping(value = "/portal/news/appCognizance", method = RequestMethod.GET)
-	public ModelAndView appCognizance(HttpServletRequest request, ModelAndView modelview,String id) {
-		ProjectDetailBo bo = businessProjectService.orgProject(id);
-		if (StringUtils.isNotBlank(bo.getIntroduce())) 
-			bo.setIntroduce(bo.getIntroduce().replace("\n", "</br>"));
-		if (StringUtils.isNotBlank(bo.getValueEffect())) 
-		bo.setValueEffect(bo.getValueEffect().replace("\n", "</br>"));
-		if (StringUtils.isNotBlank(bo.getClientSize())) 
-		bo.setClientSize(bo.getClientSize().replace("\n", "</br>"));
-		modelview.addObject("bo", bo);
-		modelview.setViewName("/portal/news/appCognizance");
-		return modelview;
-	}
-	
-	/**
-	 * APP注册协议
-	 */
-	@RequestMapping(value = "/portal/news/agreement", method = RequestMethod.GET)
-	public ModelAndView agreement(HttpServletRequest request, ModelAndView modelview) {
-		modelview.setViewName("/portal/news/agreement");
-		return modelview;
-	}
-	
+package com.goafanti.portal.controller;
+
+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.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.AchievementService;
+import com.goafanti.app.bo.ProjectDetailBo;
+import com.goafanti.banners.enums.BannersType;
+import com.goafanti.banners.service.BannersService;
+import com.goafanti.business.service.BusinessProjectService;
+import com.goafanti.common.bo.PolicyEntity;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.BaseController;
+import com.goafanti.common.dao.AchievementMapper;
+import com.goafanti.common.model.Banners;
+import com.goafanti.common.model.News;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.news.bo.NewsPortalList;
+import com.goafanti.news.enums.NewsType;
+import com.goafanti.news.service.NewsService;
+
+@Controller
+public class PortalNewsController extends BaseController {
+	@Resource
+	NewsService				newsService;
+	@Resource
+	private BannersService	bannersService;
+	@Resource
+	private BusinessProjectService	businessProjectService;
+	
+	@Resource
+	private AchievementService achievementService;
+	/**
+	 * 策源地
+	 * 
+	 * @param request
+	 * @param modelview
+	 * @return
+	 */
+	@RequestMapping(value = "/portal/news/newsIndex", method = RequestMethod.GET)
+	public ModelAndView portalNewsNewsIndex(HttpServletRequest request, ModelAndView modelview, String noCache) {
+		modelview.setViewName("/portal/news/newsIndex");
+		if (StringUtils.equals(noCache, "clear")) {
+			newsService.cleanList();
+		}
+		String domainName = request.getServerName();
+		modelview.addObject("kjkx", newsService.findNewsList(0, NewsType.KJZX.getCode(), 2, domainName, false));
+		modelview.addObject("jtdt", newsService.findNewsList(0, NewsType.JTDT.getCode(), 2, domainName, false));
+		modelview.addObject("zfwl", newsService.findNewsList(0, NewsType.ZFWL.getCode(), 3, domainName, false));
+		modelview.addObject("gjzc", newsService.findNewsList(0, NewsType.GJZC.getCode(), 3, domainName, false));
+		modelview.addObject("dfzc", newsService.findNewsList(0, NewsType.DFZC.getCode(), 3, domainName, false));
+		handleBanners(modelview, BannersType.CE_YUAN_DI);
+		return modelview;
+	}
+
+	/**
+	 * 新闻详情
+	 */
+	@RequestMapping(value = "/portal/news/newsDetails", method = RequestMethod.GET)
+	public ModelAndView portalNewsNewsDetails(HttpServletRequest request, ModelAndView modelview) {
+		modelview.setViewName("/portal/news/newsDetails");
+		return modelview;
+	}
+
+	/**
+	 * 新闻详情APP
+	 */
+	@RequestMapping(value = "/portal/news/newsDetailApp", method = RequestMethod.GET)
+	public ModelAndView portalNewsNewsDetailApp(HttpServletRequest request, ModelAndView modelview) {
+		modelview.setViewName("/portal/news/newsDetailApp");
+		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;
+	}
+
+	/**
+	 * 新闻详情
+	 */
+	@RequestMapping(value = "/portal/news/detailInfo", method = RequestMethod.GET)
+	@ResponseBody
+	public Result portalNewsDetail(Long id) {
+		Result res = new Result();
+		if (null == id) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "新闻ID"));
+			return res;
+		}
+
+		/* newsService.portalNewsList(6,1, type,hot,provinceId,keyword) */
+
+		res.setData(newsService.findNewsDetail(id));
+		return res;
+	}
+
+	/*
+	 * 
+	 * 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 = 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);
+		}
+		modelview.addObject("newsDetail", newsDetail);
+		modelview.addObject("newsList", newsList.getList());
+		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;
+			
+			modelview.addObject("newsDetail", newsDetail);
+			modelview.addObject("newsList", newsList);
+			if(newsList!=null && newsList.size()>0)
+			modelview.addObject("news", newsList.get(0));
+		}
+		return modelview;
+	}
+
+	private void handleBanners(ModelAndView modelview, BannersType bannersType) {
+		List<Banners> banners = bannersService.findPortalBanners(bannersType.getKey());
+		if (!banners.isEmpty()) {
+			modelview.addObject("banners", banners);
+		}
+	}
+
+	/**
+	 * 高新认定APP
+	 */
+	@RequestMapping(value = "/portal/news/appCognizance", method = RequestMethod.GET)
+	public ModelAndView appCognizance(HttpServletRequest request, ModelAndView modelview,String id) {
+		ProjectDetailBo bo = businessProjectService.orgProject(id);
+		if (StringUtils.isNotBlank(bo.getIntroduce())) 
+			bo.setIntroduce(bo.getIntroduce().replace("\n", "</br>"));
+		if (StringUtils.isNotBlank(bo.getValueEffect())) 
+		bo.setValueEffect(bo.getValueEffect().replace("\n", "</br>"));
+		if (StringUtils.isNotBlank(bo.getClientSize())) 
+		bo.setClientSize(bo.getClientSize().replace("\n", "</br>"));
+		modelview.addObject("bo", bo);
+		modelview.setViewName("/portal/news/appCognizance");
+		return modelview;
+	}
+	
+	/**
+	 * APP注册协议
+	 */
+	@RequestMapping(value = "/portal/news/agreement", method = RequestMethod.GET)
+	public ModelAndView agreement(HttpServletRequest request, ModelAndView modelview) {
+		modelview.setViewName("/portal/news/agreement");
+		return modelview;
+	}
+	
 }