Antiloveg 8 years ago
parent
commit
bb33031e31

+ 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

+ 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;
 	}

+ 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