Explorar el Código

全局搜索开发其余接口影响修改

anderx hace 7 años
padre
commit
f7129f5aa6

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

@@ -1323,5 +1323,15 @@ public class WebpageController extends BaseController {
 		modelview.setViewName("/portal/adviser/adviserList");
 		return modelview;
 	}
+	/**
+	 * 顾问首页
+	 * @param modelview
+	 * @return
+	 */
+	@RequestMapping(value = "/portal/adviser", method = RequestMethod.GET)
+	public ModelAndView portalAdviser(ModelAndView modelview){
+		modelview.setViewName("/portal/adviser");
+		return modelview;
+	}
 	
 }

+ 4 - 3
src/main/java/com/goafanti/common/enums/collectType.java

@@ -7,14 +7,15 @@ import org.apache.commons.lang3.StringUtils;
 
 public enum collectType {
 	
-	ACHIEVEMENT(0, "achievement"),//0成果,1需求,2专利,3政策,4项目,5专家,6顾问
+	ACHIEVEMENT(0, "achievement"),//0成果,1需求,2专利,3政策,4项目,5专家,6顾问,7新闻
 	DMAND(1, "demand"),
-	PATENT(2,"patent"),
+	PATENT(2,"jt_business_project"),
 	POLICY(3,"policy"),
 	PROJECT(4,"jt_business_project"),
 	EXPERT(5,"user"),//expert
 	ADVISER(6,"user"),//adviser
-	OTHER(7, "");
+	NEWS(7,"news"),
+	OTHER(8, "");
 	
 	private collectType(Integer code, String desc) {
 		this.code=code;

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

@@ -14,14 +14,15 @@
     <result column="source_url" jdbcType="VARCHAR" property="sourceUrl" />
     <result column="summary" jdbcType="VARCHAR" property="summary" />
     <result column="jmrh_flag" jdbcType="INTEGER" property="jmrhFlag" />
-    <result column="province_id" jdbcType="INTEGER" property="provinceId" /> 
+    <result column="province_id" jdbcType="INTEGER" property="provinceId" />
+    <result column="keyword" jdbcType="VARCHAR" property="keyword" /> 
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.News">
     <result column="content" jdbcType="LONGVARCHAR" property="content" />
   </resultMap>
   <sql id="Base_Column_List">
     id, create_time, edit_time, title, title_img, author, type, hot, source, source_url, 
-    summary,jmrh_flag,province_id
+    summary,jmrh_flag,province_id,keyword
   </sql>
   <sql id="Blob_Column_List">
     content
@@ -57,14 +58,14 @@
     insert into news (id, create_time, edit_time, 
       title, title_img, author, 
       type, hot, source, 
-      source_url, summary, content,province_id,top_number,hotspot,audit_status,release_status,release_date
+      source_url, summary, content,province_id,top_number,hotspot,audit_status,release_status,release_date,keyword
       )
     values (#{id,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{editTime,jdbcType=TIMESTAMP}, 
       #{title,jdbcType=VARCHAR}, #{titleImg,jdbcType=VARCHAR}, #{author,jdbcType=VARCHAR}, 
       #{type,jdbcType=INTEGER}, #{hot,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR}, 
       #{sourceUrl,jdbcType=VARCHAR}, #{summary,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR},
       #{provinceId,jdbcType=INTEGER}, #{topNumber,jdbcType=INTEGER}, #{hotspot,jdbcType=INTEGER},#{auditStatus,jdbcType=INTEGER},
-      #{releaseStatus,jdbcType=INTEGER},#{releaseDate,jdbcType=TIMESTAMP}
+      #{releaseStatus,jdbcType=INTEGER},#{releaseDate,jdbcType=TIMESTAMP},#{keyword,jdbcType=VARCHAR}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.News">
@@ -112,6 +113,9 @@
       <if test="provinceId != null">
       	province_id,
       </if>
+      <if test="keyword != null">
+        keyword,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -156,6 +160,9 @@
       <if test="provinceId != null">
         #{provinceId,jdbcType=INTEGER},
       </if>
+      <if test="keyword != null">
+      #{keyword,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.News">
@@ -212,6 +219,9 @@
       <if test="hotspot!=null">
       hotspot=#{hotspot,jdbcType=INTEGER},
       </if>
+      <if test="keyword != null">
+        keyword= #{keyword,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -233,7 +243,8 @@
       audit_status = #{auditStatus,jdbcType=INTEGER},
       release_status = #{releaseStatus,jdbcType=INTEGER},
       top_number = #{topNumber,jdbcType=INTEGER},
-      hotspot = #{hotspot,jdbcType=INTEGER}
+      hotspot = #{hotspot,jdbcType=INTEGER},
+        keyword= #{keyword,jdbcType=VARCHAR},
     where id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.News">
@@ -249,7 +260,8 @@
       source_url = #{sourceUrl,jdbcType=VARCHAR},
       summary = #{summary,jdbcType=VARCHAR},
       jmrh_flag = #{jmrhFlag,jdbcType=INTEGER},
-      province_id = #{provinceId,jdbcType=INTEGER}
+      province_id = #{provinceId,jdbcType=INTEGER},
+        keyword= #{keyword,jdbcType=VARCHAR},
     where id = #{id,jdbcType=BIGINT}
   </update>
   <select id="portalNewsList" resultType="com.goafanti.news.bo.NewsPortalList">

+ 2 - 1
src/main/java/com/goafanti/common/mapper/NewsMapperExt.xml

@@ -12,9 +12,10 @@
 		<result column="source" jdbcType="VARCHAR" property="source" />
 		<result column="audit_status" jdbcType="INTEGER" property="auditStatus" />
 		<result column="release_status" jdbcType="INTEGER" property="releaseStatus" />
+		<result column="keyword" jdbcType="VARCHAR" property="keyword" />
 	</resultMap>
 	<sql id="Summary_Column_List">
-		id, create_time, title, title_img, type, hot, summary, source,audit_status,release_status
+		id, create_time, title, title_img, type, hot, summary, source,audit_status,release_status,keyword
 	</sql>
 	<select id="findList" resultType="com.goafanti.news.bo.NewsSummary">
 		select

+ 24 - 7
src/main/java/com/goafanti/common/mapper/PolicyMapper.xml

@@ -22,6 +22,7 @@
     <result column="province" jdbcType="INTEGER" property="province" />
     <result column="city" jdbcType="INTEGER" property="city" />
     <result column="release_date" jdbcType="TIMESTAMP" property="releaseDate" />
+    <result column="keyword" jdbcType="VARCHAR" property="keyword" />
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.Policy">
     <!--
@@ -106,7 +107,7 @@
       This element was generated on Thu Jun 28 16:23:43 CST 2018.
     -->
     id, create_time as createTime, edit_time as editTime, title, title_img as titleImg, author, type, source, source_url as sourceUrl, summary, 
-    audit_status as auditStatus, hot, province, city, release_date as releaseDate
+    audit_status as auditStatus, hot, province, city, release_date as releaseDate,keyword
   </sql>
   <sql id="Blob_Column_List">
     <!--
@@ -199,13 +200,13 @@
       type, source, source_url, 
       summary, audit_status, hot, 
       province, city, release_date, 
-      content)
+      content,keyword)
     values (#{id,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{editTime,jdbcType=TIMESTAMP}, 
       #{title,jdbcType=VARCHAR}, #{titleImg,jdbcType=VARCHAR}, #{author,jdbcType=VARCHAR}, 
       #{type,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR}, #{sourceUrl,jdbcType=VARCHAR}, 
       #{summary,jdbcType=VARCHAR}, #{auditStatus,jdbcType=INTEGER}, #{hot,jdbcType=INTEGER}, 
       #{province,jdbcType=INTEGER}, #{city,jdbcType=INTEGER}, #{releaseDate,jdbcType=TIMESTAMP}, 
-      #{content,jdbcType=LONGVARCHAR})
+      #{content,jdbcType=LONGVARCHAR},#{keyword,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.Policy">
     <!--
@@ -263,6 +264,9 @@
       <if test="content != null">
         content,
       </if>
+      <if test="keyword != null">
+        keyword,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -313,6 +317,9 @@
       <if test="content != null">
         #{content,jdbcType=LONGVARCHAR},
       </if>
+      <if test="keyword != null">
+        #{keyword,jdbcType=VARHCAR},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.goafanti.common.model.PolicyExample" resultType="java.lang.Long">
@@ -382,6 +389,9 @@
       <if test="record.content != null">
         content = #{record.content,jdbcType=LONGVARCHAR},
       </if>
+      <if test="keyword != null">
+        keyword= #{keyword,jdbcType=VARCHAR},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -409,7 +419,8 @@
       province = #{record.province,jdbcType=INTEGER},
       city = #{record.city,jdbcType=INTEGER},
       release_date = #{record.releaseDate,jdbcType=TIMESTAMP},
-      content = #{record.content,jdbcType=LONGVARCHAR}
+      content = #{record.content,jdbcType=LONGVARCHAR},
+       keyword= #{keyword,jdbcType=VARCHAR}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -435,7 +446,8 @@
       hot = #{record.hot,jdbcType=INTEGER},
       province = #{record.province,jdbcType=INTEGER},
       city = #{record.city,jdbcType=INTEGER},
-      release_date = #{record.releaseDate,jdbcType=TIMESTAMP}
+      release_date = #{record.releaseDate,jdbcType=TIMESTAMP},
+       keyword= #{keyword,jdbcType=VARCHAR}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -493,6 +505,9 @@
       <if test="content != null">
         content = #{content,jdbcType=LONGVARCHAR},
       </if>
+      <if test="keyword != null">
+        keyword= #{keyword,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -517,7 +532,8 @@
       province = #{province,jdbcType=INTEGER},
       city = #{city,jdbcType=INTEGER},
       release_date = #{releaseDate,jdbcType=TIMESTAMP},
-      content = #{content,jdbcType=LONGVARCHAR}
+      content = #{content,jdbcType=LONGVARCHAR},
+      keyword= #{keyword,jdbcType=VARCHAR},
     where id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Policy">
@@ -540,7 +556,8 @@
       hot = #{hot,jdbcType=INTEGER},
       province = #{province,jdbcType=INTEGER},
       city = #{city,jdbcType=INTEGER},
-      release_date = #{releaseDate,jdbcType=TIMESTAMP}
+      release_date = #{releaseDate,jdbcType=TIMESTAMP},
+       keyword= #{keyword,jdbcType=VARCHAR}
     where id = #{id,jdbcType=BIGINT}
   </update>
   <select id="findPolicyByPageAndPublishPages" resultType="com.goafanti.news.bo.PolicyResult">

+ 11 - 1
src/main/java/com/goafanti/common/model/News.java

@@ -105,7 +105,9 @@ public class News {
 	 * 热门
 	 */
 	private Integer hotspot;
-	String publishPage;
+	private String publishPage;
+	
+	private String keyword;
 	
 	
 	public String getPublishPage() {
@@ -289,6 +291,14 @@ public class News {
 	public void setHotspot(Integer hotspot) {
 		this.hotspot = hotspot;
 	}
+
+	public String getKeyword() {
+		return keyword;
+	}
+
+	public void setKeyword(String keyword) {
+		this.keyword = keyword;
+	}
 	
 	
 }

+ 10 - 0
src/main/java/com/goafanti/common/model/Policy.java

@@ -88,6 +88,8 @@ public class Policy {
 	 * @mbg.generated  Thu Jun 28 16:23:43 CST 2018
 	 */
 	private String content;
+	
+	private String keyword;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column policy.id
@@ -376,4 +378,12 @@ public class Policy {
 	public void setContent(String content) {
 		this.content = content;
 	}
+
+	public String getKeyword() {
+		return keyword;
+	}
+
+	public void setKeyword(String keyword) {
+		this.keyword = keyword;
+	}
 }

+ 10 - 2
src/main/java/com/goafanti/news/controller/AdminNewsApiController.java

@@ -166,8 +166,16 @@ public Result apply(InputNews news,BindingResult bindingResult,String[] publishP
 					return result;
 				}
 				news.setReleaseDate(new Date());}
-			if(auditStatus!=null) {news.setAuditStatus(auditStatus); 
-			if(auditStatus ==2)news.setReleaseDate(new Date());}
+			if(auditStatus!=null) {
+				news.setAuditStatus(auditStatus); 
+			if(auditStatus ==2){
+				news.setReleaseDate(new Date());
+				newsService.addJtCollectSearch(news);
+				}
+			if(auditStatus ==4){
+				newsService.updateJtCollectSearch(news);
+				}
+			}
 			
 			result.setData(newsService.updateSelectivelyWithoutPages(news));  
 			return result;

+ 10 - 2
src/main/java/com/goafanti/news/controller/AdminPolicyApiController.java

@@ -174,8 +174,16 @@ public class AdminPolicyApiController extends BaseApiController {
 							return result;
 						}
 						policy.setReleaseDate(new Date());}
-					if(auditStatus!=null) {policy.setAuditStatus(auditStatus); 
-					if(auditStatus ==2)policy.setReleaseDate(new Date());}
+					if(auditStatus!=null) {
+						policy.setAuditStatus(auditStatus); 
+					if(auditStatus ==2){
+						policy.setReleaseDate(new Date());
+						policyService.addJtCollectSearch(policy);
+						}
+					if (auditStatus==4) {
+						policyService.updateJtCollectSearch(policy);
+					}
+					}
 					
 					result.setData(policyService.updateSelectivelyWithoutPages(policy));  
 					return result;

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

@@ -22,8 +22,11 @@ import org.springframework.transaction.annotation.Transactional;
 import com.goafanti.app.bo.AppDiscoveryBo;
 import com.goafanti.common.bo.PolicyEntity;
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.JtCollectSearchMapper;
 import com.goafanti.common.dao.NewsMapper;
 import com.goafanti.common.dao.NewsPublishMapper;
+import com.goafanti.common.enums.collectType;
+import com.goafanti.common.model.JtCollectSearch;
 import com.goafanti.common.model.News;
 import com.goafanti.common.model.NewsPublish;
 import com.goafanti.common.model.NewsPublishExample;
@@ -43,8 +46,13 @@ public class NewsService extends BaseMybatisDao<NewsMapper> {
 	NewsMapper newsMapper;
 	@Autowired
 	NewsPublishMapper newsPublishMapper;
+	@Autowired
+	JtCollectSearchMapper	jtCollectSearchMapper;
 	@Value("${spring.profiles.active}")
 	private String env;
+	@Value(value="${collect_flag}")
+	private Boolean collectFlag ;
+	
 	private static final Logger logger = LoggerFactory.getLogger(NewsService.class);
 
 	@Cacheable(value = "IndexNewsListCache", key = "'NewsList:Page:'+#pageNo+'Type:'+#type+'Size:'+#pageSize")
@@ -356,6 +364,23 @@ public class NewsService extends BaseMybatisDao<NewsMapper> {
 		return newsMapper.selectByPrimaryKey(id);
 	}
 
+	public void addJtCollectSearch(News news) {
+		if(collectFlag){
+			JtCollectSearch r=new JtCollectSearch();
+			r.setFromTable(collectType.NEWS.getDesc());
+			r.setKeyword(news.getKeyword());
+			r.setTitle(news.getTitle());
+			r.setRowId(news.getId().toString());
+			jtCollectSearchMapper.insertSelective(r);
+		}
+		
+	}
+
+	public void updateJtCollectSearch(News news) {
+		if(collectFlag)jtCollectSearchMapper.deleteByrowId(news.getId().toString());
+		
+	}
+
 	
 
 	

+ 24 - 0
src/main/java/com/goafanti/news/service/PolicyService.java

@@ -7,13 +7,17 @@ import java.util.Map;
 import java.util.UUID;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.IdGenerator;
 import org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor;
 
 import com.goafanti.app.bo.AppDiscoveryBo;
+import com.goafanti.common.dao.JtCollectSearchMapper;
 import com.goafanti.common.dao.PolicyMapper;
 import com.goafanti.common.dao.PolicyPublishMapper;
+import com.goafanti.common.enums.collectType;
+import com.goafanti.common.model.JtCollectSearch;
 import com.goafanti.common.model.Policy;
 import com.goafanti.common.model.PolicyPublish;
 import com.goafanti.core.mybatis.BaseMybatisDao;
@@ -26,6 +30,10 @@ public class PolicyService extends BaseMybatisDao<PolicyMapper> {
 PolicyMapper policyMapper;
 @Autowired
 PolicyPublishMapper policyPublishMapper;
+@Autowired
+JtCollectSearchMapper	jtCollectSearchMapper;
+@Value(value="${collect_flag}")
+private Boolean collectFlag ;
 
 public Policy saveNewPolicy(Policy policy,List<String>webPages,List<String>appPages) {
 policyMapper.insertSelective(policy);
@@ -155,4 +163,20 @@ public Pagination<AppDiscoveryBo> appListPolicy(Integer pageNo, Integer pageSize
 public PolicyResult policyDetail(String id) {
 	return policyMapper.selectPolicyDetail(id);
 }
+
+public void addJtCollectSearch(Policy policy) {
+	if(collectFlag){
+		JtCollectSearch r=new JtCollectSearch();
+		r.setFromTable(collectType.POLICY.getDesc());
+		r.setKeyword(policy.getKeyword());
+		r.setTitle(policy.getTitle());
+		r.setRowId(policy.getId().toString());
+		jtCollectSearchMapper.insertSelective(r);
+	}
+	
+}
+
+public void updateJtCollectSearch(Policy policy) {
+	if(collectFlag)jtCollectSearchMapper.deleteByrowId(policy.getId().toString());
+	}
 }

+ 63 - 0
src/main/webapp/WEB-INF/views/portal/adviser.html

@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>知识产权顾问首页</title>
+<link th:href="${portalHost+'/vendors.css'}" rel="stylesheet">
+<link th:href="${portalHost+'/newMenu/adviser.css'}" rel="stylesheet"></head>
+<body>
+     <div th:replace="common::nav('','adviserDetail')"></div>  
+    <!-- 公共头部  省略 -->
+    <div class="banner">
+        <img th:src="${portalHost+'/img/newMenu/adviserBanner.png'}" alt="">
+    </div>
+    <!-- 中间内容开始 -->
+    <div class="container">
+        <div class="indexSearch">
+            <div class="search-inp">
+                <div class="input-group">
+                    <input type="text" class="form-control demandSearch" placeholder="搜索您要找的顾问。。">
+                    <span class="input-group-btn">
+                        <button class="btn btn-default searchBtn" type="button">
+                            <img th:src="${portalHost+'/img/newMenu/search-icon.jpg'}" alt=""> 搜索
+                        </button>
+                    </span>
+                </div>
+            </div>
+        </div>
+        <div class="adviserIndexList">
+            <div class="listHead listOne">
+                <ul>
+                   
+                </ul>
+            </div>
+            <div class="listMid">
+                <div class="listMidLeft" onclick="openZoosUrl('chatwin');"></div>
+                <div class="listHead listMidRight">
+                    <ul>
+                        
+                    </ul>
+                </div>
+            </div>
+            <div class="listHead listBottom">
+                <ul>
+                    
+                </ul>
+            </div>
+            <a href="/portal/adviser/adviserList">查看更多</a>
+        </div>
+    </div>
+    <!-- 中间内容结束 -->
+    <!-- 公共底部  省略 -->
+    <footer>
+        <div th:replace="common::copyright"></div>
+		<div th:replace="common::login"></div>
+    </footer>
+    <div th:replace="common::footer(~{::script})">
+	<script type="text/javascript" th:src="${portalHost+'/vendors.js'}"></script>
+	<script type="text/javascript" th:src="${portalHost+'/newMenu/adviser.js'}"></script>
+	</div>
+	</body>
+</html>