Browse Source

Merge branch 'master' of https://git.coding.net/aft/AFT

wubb 8 years ago
parent
commit
ecbe19755f

+ 2 - 2
src/main/java/com/goafanti/activity/service/ActivityService.java

@@ -21,8 +21,8 @@ public interface ActivityService {
 
 	Activity findActivityDetail(Long id);
 
-	List<Activity> findPortalList();
+	List<Activity> findPortalList(Integer pageNo, Integer pageSize, Integer form);
 
-	void cleanActivityIndexList();
+	void cleanActivityPortalList();
 
 }

+ 10 - 7
src/main/java/com/goafanti/activity/service/impl/ActivityServiceImpl.java

@@ -11,6 +11,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.activity.bo.ActivityListBo;
@@ -83,7 +84,6 @@ public class ActivityServiceImpl extends BaseMybatisDao<ActivityMapper> implemen
 		a.setId(idGenerator.generateId());
 		activityMapper
 				.insert(disposeActivity(a, startTimeFormattedDate, endTimeFormattedDate, enrollDeadlineFormattedDate));
-
 	}
 
 	@Override
@@ -120,15 +120,18 @@ public class ActivityServiceImpl extends BaseMybatisDao<ActivityMapper> implemen
 		return activityMapper.selectByPrimaryKey(id);
 	}
 
-	@Override
-	public List<Activity> findPortalList() {
-		// TODO Auto-generated method stub
-		return null;
+	//@Cacheable(value = "ActivityPortalListCache", key = "'ActivityPortalList:Page:'+#pageNo+'Size:'+#pageSize+'Form:'+#form")
+	public List<Activity> findPortalList(Integer pageNo, Integer pageSize, Integer form) {
+		Map<String, Object> params = new HashMap<String, Object>();
+		params.put("pageSize", pageSize);
+		params.put("pageNo", pageNo);
+		params.put("form", form);
+		return activityMapper.findPortalList(params);
 	}
 
 	@CacheEvict(value = "ActivityPortalListCache", allEntries = true)
-	public void cleanActivityIndexList() {
-		LoggerUtils.debug(logger, "清除门户端新闻列表缓存:[%s]");
+	public void cleanActivityPortalList() {
+		LoggerUtils.debug(logger, "清除门户端科技活动列表缓存:[%s]");
 		
 	}
 

+ 3 - 0
src/main/java/com/goafanti/common/dao/ActivityMapper.java

@@ -1,6 +1,7 @@
 package com.goafanti.common.dao;
 
 import java.util.List;
+import java.util.Map;
 
 import com.goafanti.common.model.Activity;
 
@@ -20,4 +21,6 @@ public interface ActivityMapper {
     int updateByPrimaryKey(Activity record);
 
 	int batchDeleteByPrimaryKey(List<String> id);
+
+	List<Activity> findPortalList(Map<String, Object> params);
 }

+ 23 - 12
src/main/java/com/goafanti/common/mapper/ActivityMapperExt.xml

@@ -14,22 +14,22 @@
 		from activity
 		where 1=1
 		<if test="sTime != null">
-			start_time <![CDATA[ >= ]]> #{sTime,jdbcType=TIMESTAMP}
+			and start_time <![CDATA[ >= ]]> #{sTime,jdbcType=TIMESTAMP}
 		</if>
 		<if test="eTime != null">
-			start_time <![CDATA[ < ]]> #{eTime,jdbcType=TIMESTAMP}
+			and start_time <![CDATA[ < ]]> #{eTime,jdbcType=TIMESTAMP}
 		</if>
 		<if test="name != null">
-			name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+			and name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
 		</if>
 		<if test="host != null">
-			host like CONCAT('%',#{host,jdbcType=VARCHAR},'%')
+			and host like CONCAT('%',#{host,jdbcType=VARCHAR},'%')
 		</if>
 		<if test="type != null">
-			type = #{type,jdbcType=INTEGER}
+			and type = #{type,jdbcType=INTEGER}
 		</if>
 		<if test="form != null">
-			form = #{form,jdbcType=INTEGER}
+			and form = #{form,jdbcType=INTEGER}
 		</if>
 		order by start_time desc
 		<if test="page_sql!=null">
@@ -43,22 +43,22 @@
 		from activity
 		where 1=1
 		<if test="sTime != null">
-			start_time <![CDATA[ >= ]]> #{sTime,jdbcType=TIMESTAMP}
+			and start_time <![CDATA[ >= ]]> #{sTime,jdbcType=TIMESTAMP}
 		</if>
 		<if test="eTime != null">
-			start_time <![CDATA[ < ]]> #{eTime,jdbcType=TIMESTAMP}
+			and start_time <![CDATA[ < ]]> #{eTime,jdbcType=TIMESTAMP}
 		</if>
 		<if test="name != null">
-			name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+			and name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
 		</if>
 		<if test="host != null">
-			host like CONCAT('%',#{host,jdbcType=VARCHAR},'%')
+			and host like CONCAT('%',#{host,jdbcType=VARCHAR},'%')
 		</if>
 		<if test="type != null">
-			type = #{type,jdbcType=INTEGER}
+			and type = #{type,jdbcType=INTEGER}
 		</if>
 		<if test="form != null">
-			form = #{form,jdbcType=INTEGER}
+			and form = #{form,jdbcType=INTEGER}
 		</if>
 	</select>
 	
@@ -71,4 +71,15 @@
 			#{item}
 	</foreach>
   </delete>
+  
+  <select id="findPortalList" resultMap="BaseResultMap">
+	select
+		<include refid="Base_Column_List" />
+	from activity
+	<if test="form != null">
+		form = #{form,jdbcType=INTEGER}
+	</if>
+	order by start_time desc
+	limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
+</select>
 </mapper>

+ 1 - 0
src/main/java/com/goafanti/core/cache/serializer/FastJsonRedisSerializer.java

@@ -21,6 +21,7 @@ public class FastJsonRedisSerializer implements RedisSerializer<Object> {
 		pc.addAccept("com.goafanti.lecture.bo.LectureListBo");
 		pc.addAccept("com.goafanti.lecture.bo.BigShotLectureListBo");
 		pc.addAccept("com.goafanti.news.bo.NewsPortalList");
+		pc.addAccept("com.goafanti.common.model.Activity");
 	}
 
 	@Override

+ 0 - 7
src/main/java/com/goafanti/lecture/service/impl/LectureServiceImpl.java

@@ -159,13 +159,6 @@ public class LectureServiceImpl extends BaseMybatisDao<LectureMapper> implements
 
 	@Override
 	public List<LectureListBo> loadMore(Integer pageSize, Integer pageNo) {
-		if (pageNo == null || pageNo < 0) {
-			pageNo = 2;
-		}
-
-		if (pageSize == null || pageSize < 0 || pageSize > 10) {
-			pageSize = 10;
-		}
 		Map<String, Object> params = new HashMap<String, Object>();
 		params.put("pageSize", pageSize);
 		params.put("pageNo", pageNo);

+ 8 - 21
src/main/java/com/goafanti/news/controller/NewsController.java

@@ -15,14 +15,14 @@ import com.goafanti.banners.enums.BannersType;
 import com.goafanti.banners.service.BannersService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
-import com.goafanti.common.controller.BaseController;
+import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.model.Banners;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.news.enums.NewsType;
 import com.goafanti.news.service.NewsService;
 
 @Controller
-public class NewsController extends BaseController {
+public class NewsController extends BaseApiController {
 	@Resource
 	NewsService newsService;
 	@Resource
@@ -55,7 +55,7 @@ public class NewsController extends BaseController {
 	@RequestMapping(value = "/portal/news/newsDetails", method = RequestMethod.GET)
 	public ModelAndView portalNewsNewsDetails(HttpServletRequest request, ModelAndView modelview, String noCache) {
 		modelview.setViewName("/portal/news/newsDetails");
-		if (StringUtils.equals(noCache, "clear")) {
+		/*if (StringUtils.equals(noCache, "clear")) {
 			newsService.cleanPortalList();
 		}
 		modelview.addObject("complete", newsService.findPortalList(5, 0, NewsType.ALL.getCode()));
@@ -63,12 +63,12 @@ public class NewsController extends BaseController {
 		modelview.addObject("jtdt", newsService.findPortalList(5, 0, NewsType.JTDT.getCode()));
 		modelview.addObject("zfwl", newsService.findPortalList(5, 0, NewsType.ZFWL.getCode()));
 		modelview.addObject("gjzc", newsService.findPortalList(5, 0, NewsType.GJZC.getCode()));
-		modelview.addObject("dfzc", newsService.findPortalList(5, 0, NewsType.DFZC.getCode()));
+		modelview.addObject("dfzc", newsService.findPortalList(5, 0, NewsType.DFZC.getCode()));*/
 		return modelview;
 	}
 
 	/**
-	 * 新闻列表
+	 * 新闻详情列表
 	 */
 	@RequestMapping(value = "/portal/news/list", method = RequestMethod.GET)
 	@ResponseBody
@@ -77,22 +77,9 @@ public class NewsController extends BaseController {
 		if (StringUtils.equals(noCache, "clear")) {
 			newsService.cleanPortalList();
 		}
-		Integer pSize = null;
-		Integer pNo = null;
-		if (StringUtils.isNumeric(pageSize)) {
-			pSize = Integer.parseInt(pageSize);
-		}
-		if (StringUtils.isNumeric(pageNo)) {
-			pNo = Integer.parseInt(pageNo);
-		}
-		if (pNo == null || pNo < 0) {
-			pNo = 0;
-		}
-
-		if (pSize == null || pSize < 0 || pSize > 5) {
-			pSize = 5;
-		}
-		res.setData(newsService.findPortalList(pSize, pNo, type));
+		Integer pN = getPageNo(pageNo);
+		Integer pS = getPageSize(pageSize);
+		res.setData(newsService.findPortalList(pS, (pN - 1) * pS, type));
 		return res;
 	}
 

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

@@ -126,7 +126,7 @@ public class NewsService extends BaseMybatisDao<NewsMapper> {
 		return newsMapper.batchDeleteByPrimaryKey(id);
 	}
 	
-	//@Cacheable(value = "NewsPortalListCache", key = "'NewsPortalList:Page:'+#pageNo+'Type:'+#type+'Size:'+#pageSize")
+	@Cacheable(value = "NewsPortalListCache", key = "'NewsPortalList:Page:'+#pageNo+'Type:'+#type+'Size:'+#pageSize")
 	public List<NewsPortalList> findPortalList(Integer pSize, Integer pNo, Integer type) {
 		Map<String, Object> params = new HashMap<String, Object>();
 		params.put("type", type);
@@ -138,7 +138,7 @@ public class NewsService extends BaseMybatisDao<NewsMapper> {
 	
 	@CacheEvict(value = "NewsPortalListCache", allEntries = true)
 	public void cleanPortalList() {
-		LoggerUtils.debug(logger, "清除门户端新闻列表缓存:[%s]");
+		LoggerUtils.debug(logger, "清除门户端新闻列表缓存");
 		
 	}
 

+ 2 - 2
src/main/java/com/goafanti/portal/controller/PortalActivityController.java

@@ -32,9 +32,9 @@ public class PortalActivityController extends BaseController {
 			String noCache) {
 		modelview.setViewName("/portal/activity/activityIndex");
 		if (StringUtils.equals(noCache, "clear")) {
-			activityService.cleanActivityIndexList();
+			activityService.cleanActivityPortalList();
 		}
-		modelview.addObject("activityList", activityService.findPortalList());
+		modelview.addObject("activityList", activityService.findPortalList(0, 3, null));
 		handleBanners(modelview, BannersType.HUO_DONG_QUAN);
 		return modelview;
 	}

+ 5 - 12
src/main/java/com/goafanti/portal/controller/PortalLectureController.java

@@ -5,7 +5,6 @@ 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;
@@ -16,7 +15,7 @@ import com.goafanti.banners.enums.BannersType;
 import com.goafanti.banners.service.BannersService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.controller.BaseController;
+import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.model.Banners;
 import com.goafanti.lecture.bo.LectureListBo;
 import com.goafanti.lecture.service.LectureService;
@@ -25,7 +24,7 @@ import com.goafanti.lecture.service.LectureService;
  * 科技讲堂
  */
 @Controller
-public class PortalLectureController extends BaseController {
+public class PortalLectureController extends BaseApiController {
 	@Resource
 	private LectureService lectureService;
 	@Resource
@@ -51,15 +50,9 @@ public class PortalLectureController extends BaseController {
 	@ResponseBody
 	public Result loadMore(String pageSize, String pageNo) {
 		Result res = new Result();
-		Integer pNo = 2;
-		Integer pSize = 5;
-		if (StringUtils.isNumeric(pageSize)) {
-			pSize = Integer.parseInt(pageSize);
-		}
-		if (StringUtils.isNumeric(pageNo)) {
-			pNo = Integer.parseInt(pageNo);
-		}
-		res.setData(lectureService.loadMore(pSize, pNo));
+		Integer pN = getPageNo(pageNo);
+		Integer pS = getPageSize(pageSize);
+		res.setData(lectureService.loadMore(pS, (pN - 1) * pS));
 		return res;
 	}
 	

+ 1 - 0
src/main/webapp/WEB-INF/views/common.html

@@ -218,6 +218,7 @@
 			globalConfig.avatarHost =  /*[[${avatarHost}]]*/'';
 			globalConfig.avatarUploadHost =  /*[[${avatarUploadHost}]]*/'';
 			globalConfig.csrfToken =  /*[[${csrf}]]*/'';
+			globalConfig.kfqq = '2035994611';
 			window.userData = {};
 			window.adminData = {};
 	/*]]>*/

+ 6 - 34
src/main/webapp/WEB-INF/views/portal/activity/activityIndex.html

@@ -45,9 +45,7 @@
                 <div class="qimo">
                     <div id="active_notice_ul1">
                         <ul>
-                            <li><a href='#'>· 华南理工大学技术成果对接会</a></li>
-                            <li><a href='#'>· 北京理工大学技术成果对接会</a></li>
-                            <li><a href='#'>· 中国科交会</a></li>
+                            <li th:each="it : ${activityList}"><a href='#' th:text="${it.name}"></a></li>
                         </ul>
                     </div>
                     <div id="active_notice_ul2"></div>
@@ -82,41 +80,15 @@
 		</div>
 		<div class="active_content_list">
 			<ul>
-				<li>
-					<a href="details.html">
-						<div class="active_content_img">
-							<img th:src="${portalHost + '/img/internationalCase_img_1.jpg'}">
-						</div>
-						<div class="active_content_info">
-							<h4>华南理工大学技术成果对接会</h4>
-							<p class="mt18"><label>时间: </label> 时间: 2017年06月01日 11:00-11:30</p>
-							<p><label>主办单位: </label> 长沙市科技局主办</p>
-							<span class="end">已结束</span>
-						</div>
-					</a>
-				</li>
-				<li>
-					<a href="details.html">
-						<div class="active_content_img">
-							<img th:src="${portalHost + '/img/internationalCase_img_2.jpg'}">
-						</div>
-						<div class="active_content_info">
-							<h4>北京理工大学技术成果对接会</h4>
-							<p class="mt18"><label>时间: </label> 时间: 2017年06月14日 14:00-14:30</p>
-							<p><label>主办单位: </label> 长沙市科技局主办</p>
-							<span class="end">已结束</span>
-						</div>
-					</a>
-				</li>
-				<li>
+				<li th:each="it : ${activityList}">
 					<a href="details.html">
 						<div class="active_content_img">
-							<img th:src="${portalHost + '/img/internationalCase_img_3.jpg'}">
+							<img th:if="${it.titleUrl} != null" th:src="${avatarUploadHost + it.titleUrl}">
 						</div>
 						<div class="active_content_info">
-							<h4>2016年中国科交会</h4>
-							<p class="mt18"><label>时间: </label> 时间: 2016年10月24日 14:00-17:00</p>
-							<p><label>主办单位: </label> 湖南省人民政府</p>
+							<h4 th:text="${it.name}"></h4>
+							<p class="mt18" th:text="${'时间:' + it.startTimeFormattedDate}"></p>
+							<p th:text="${'主办单位:' + it.host}"></p>
 							<span class="end">已结束</span>
 						</div>
 					</a>

File diff suppressed because it is too large
+ 1 - 1
src/main/webapp/WEB-INF/views/portal/activity/details.html