Browse Source

完成政策,修改html

liliang4869 7 years ago
parent
commit
93cdf0ac39

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

@@ -543,4 +543,61 @@
       release_date = #{releaseDate,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=BIGINT}
   </update>
+  <select id="findPolicyByPageAndPublishPages" resultType="com.goafanti.common.model.Policy">
+  select 
+  p.title,
+  p.author,
+  p.audit_status as auditStatus,
+  p.id,
+  p.source,
+  p.release_date as releaseDate,
+  p.title_img as titleImg 
+  from policy p
+  <if test="publishPage!=null">
+  left join policy_publish pp on pp.policy_id=p.id
+  </if>
+  where 1=1
+  <if test="publishPage!=null">
+  and pp.publish_page =#{publishPage,jdbcType=VARCHAR}
+  </if>
+  <if test="title!=null">
+  and p.title like concat('%',#{title,jdbcType=VARCHAR},'%')
+  </if>
+  <if test="auditStatus!=null">
+  and p.audit_status =#{auditStatus,jdbcType=INTEGER}
+  </if>
+  <if test="startDate!=null">
+   and	p.release_date <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
+  </if>
+  <if test="endDate !=null">
+    and	p.release_date <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
+  </if>
+  <if test="page_sql!=null">
+  ${page_sql}
+  </if>
+  </select>
+  <select id="findPolicyCountByPageAndPublishPages" resultType="java.lang.Integer">
+   select 
+ count(0)
+  from policy p
+  <if test="publishPage!=null">
+  left join policy_publish pp on pp.policy_id=p.id
+  </if>
+  where 1=1
+  <if test="publishPage!=null">
+  and pp.publish_page =#{publishPage,jdbcType=VARCHAR}
+  </if>
+  <if test="title!=null">
+  and p.title like concat('%',#{title,jdbcType=VARCHAR},'%')
+  </if>
+  <if test="auditStatus!=null">
+  and p.audit_status =#{auditStatus,jdbcType=INTEGER}
+  </if>
+  <if test="startDate!=null">
+   and	p.release_date <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
+  </if>
+  <if test="endDate !=null">
+    and	p.release_date <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
+  </if>
+  </select>
 </mapper>

+ 47 - 0
src/main/java/com/goafanti/news/controller/AdminPolicyApiController.java

@@ -2,7 +2,9 @@ package com.goafanti.news.controller;
 
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.annotation.Resource;
 
@@ -145,6 +147,51 @@ public class AdminPolicyApiController extends BaseApiController {
 	
 				return result;
 			}
+			
+			
+			/*
+			 * 变更发布状态、发布时间
+			 * */
+				@RequestMapping(value="/updateStatus",method=RequestMethod.POST)
+				public Result updateStatus(Long id,Integer auditStatus,Integer refresh) {
+					Result result=new Result();
+					if(id==null) {
+						result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","未找到该政策,"));
+						return result;
+					}
+					Policy policy=policyService.getPolicyDetail(id);
+					if(policy==null) {
+						result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","未找到该政策,"));
+						return result;
+					}
+					if(refresh!=null &&refresh==1)
+						{
+						if( auditStatus!=2 && policy.getAuditStatus()!=2) {
+							result.getError().add(buildError("","","当前未发布"));
+							return result;
+						}
+						policy.setReleaseDate(new Date());}
+					if(auditStatus!=null) {policy.setAuditStatus(auditStatus); 
+					if(auditStatus ==2)policy.setReleaseDate(new Date());}
+					
+					result.setData(policyService.updateSelectivelyWithoutPages(policy));  
+					return result;
+					
+				}
+				
+				/*
+				 * 政策搜索
+				 * */
+				@RequestMapping(value="/list",method=RequestMethod.GET)
+				public Result searchPolicy(String title,Integer auditStatus,String startReleaseDate,String endReleaseDate,String publishPage,Integer pageNo,Integer pageSize) {
+					Result result=new Result();
+					if(pageNo==null || pageNo<1)pageNo=1;
+					if(pageSize==null || pageSize<1)pageSize=10;
+					result.setData(policyService.searchPolicy(title,auditStatus,startReleaseDate,endReleaseDate,publishPage,pageNo,pageSize));
+					return result;
+				}
+				
+				
 		
 		
 }

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

@@ -1,18 +1,22 @@
 package com.goafanti.news.service;
 
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.UUID;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.IdGenerator;
+import org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor;
 
 import com.goafanti.common.dao.PolicyMapper;
 import com.goafanti.common.dao.PolicyPublishMapper;
 import com.goafanti.common.model.Policy;
 import com.goafanti.common.model.PolicyPublish;
 import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.news.bo.PolicyResult;
 
 @Service
@@ -114,5 +118,23 @@ public int updateSelectively(Policy policy, List<String> webPages, List<String>
 	return policyMapper.updateByPrimaryKeySelective(policy);
 }
 
+public int updateSelectivelyWithoutPages(Policy policy)
+{
+	if(policy==null || policy.getId() ==null )
+return 	-1;
+	else return policyMapper.updateByPrimaryKeySelective(policy);
+}
 
+@SuppressWarnings("unchecked")
+public Pagination<Policy>searchPolicy(String title,Integer auditStatus,String startReleaseDate,String endReleaseDate,String publishPage,Integer pageNo,Integer pageSize){
+	Map<String, Object> params = new HashMap<>();
+	if(title!=null)params.put("title", title);
+	if(auditStatus!=null &&auditStatus>=0 && auditStatus<=4)params.put("auditStatus", auditStatus);
+	if(startReleaseDate!=null) {
+		params.put("startDate", startReleaseDate);  
+	}
+	if(endReleaseDate!=null)params.put("endDate", endReleaseDate); 
+	if(publishPage!=null)params.put("publishPages", publishPage);
+	return (Pagination<Policy>) findPage("findPolicyByPageAndPublishPages","findPolicyCountByPageAndPublishPages",params, pageNo, pageSize); 
+}
 }

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

@@ -55,7 +55,7 @@
             <div class="nav">
                 <ul>
                     <li>
-                        <a th:href="@{/portal/service/serviceIndex}">科技服务首页</a>
+                        <a th:href="@{/portal/service/serviceIndex}">科技服务</a>
                         <img th:src="${portalHost+'/img/hot.png'}">
                        
                     </li>

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


+ 9 - 29
src/main/webapp/WEB-INF/views/portal/technologyTrading/achievement.html

@@ -70,30 +70,8 @@
         </div>
     </div>
     <!-- banner -->
-    <div id="myCarousel" class="carousel slide">
-        <!-- 轮播(Carousel)指标 -->
-        <ol class="carousel-indicators">
-            <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
-            <li data-target="#myCarousel" data-slide-to="1"></li>
-            <li data-target="#myCarousel" data-slide-to="2"></li>
-        </ol>
-        <!-- 轮播(Carousel)项目 -->
-        <div class="carousel-inner">
-            <div class="item active">
-                <img th:src="${portalHost+'/img/index_banner01.jpg'}" alt="First slide">
-            </div>
-            <div class="item">
-                <img th:src="${portalHost+'/img/index_banner02.jpg'}" alt="Second slide">
-            </div>
-            <div class="item">
-                <img th:src="${portalHost+'/img/index_banner03.jpg'}" alt="Third slide">
-            </div>
-        </div>
-        <!-- 轮播(Carousel)导航 -->
-        <!-- <a class="carousel-control left" href="#myCarousel" 
-               data-slide="prev">&lsaquo;</a>
-            <a class="carousel-control right" href="#myCarousel" 
-               data-slide="next">&rsaquo;</a> -->
+  <div class="carousel">
+        <img th:src="${portalHost+'/img/technology_trading_banner01.jpg'}" alt="First slide">
     </div>
     <!-- 主体内容区域 -->
     <div class="container">
@@ -262,7 +240,7 @@
                 <div th:each="policy,policyStat:${policyList}" th:if="${policyStat.index}==0">
                   <a th:href="@{/portal/news/newsDetail(id=${policy.id},type=0)}">
                     <address><img th:src="${portalHost+'/img/newMenu/achievement_28.jpg'}" alt="">
-                    <span th:text="${#strings.abbreviate(policy.provinceS+policy.cityS,8)}"></span>
+                    <span th:if="${policy.provinceS}!=null and ${policy.cityS}!=null" th:text="${#strings.abbreviate(policy.provinceS+policy.cityS,8)}"></span>
                     <time th:text="${#dates.format(policy.editTime,'yyyy-MM-dd')}"></time>
                     </address>
                     <h5>《<span th:text="${#strings.abbreviate(policy.title,12)}"></span>》</h5>
@@ -280,7 +258,7 @@
                     </div>
                     <div class="introduce">
                        <address><img th:src="${portalHost+'/img/newMenu/achievement_28.jpg'}" alt="">
-                       <span th:text="${#strings.abbreviate(policy.provinceS+policy.cityS,8)}"></span>
+                       <span  th:if="${policy.provinceS}!=null and ${policy.cityS}!=null" th:text="${#strings.abbreviate(policy.provinceS+policy.cityS,8)}"></span>
                        <span class="title" >《<span th:text="${#strings.abbreviate(policy.title,12)}"></span>》</span></address>
                         <p  th:text="${#strings.abbreviate(policy.summary,45)}"></p>
                     </div>
@@ -299,7 +277,7 @@
                     </div>
                     <div class="introduce">
                        <address><img th:src="${portalHost+'/img/newMenu/achievement_28.jpg'}" alt="">
-                       <span th:text="${#strings.abbreviate(policy.provinceS+policy.cityS,8)}"></span>
+                       <span  th:if="${policy.provinceS}!=null and ${policy.cityS}!=null" th:text="${#strings.abbreviate(policy.provinceS+policy.cityS,8)}"></span>
                        <span class="title">《<span th:text="${#strings.abbreviate(policy.title,12)}"></span>》</span></address>
                         <p th:text="${#strings.abbreviate(policy.summary,45)}"></p>
                     </div>
@@ -308,14 +286,16 @@
             </ol>
         </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/achievement.js'}">
-</script>
+<script type="text/javascript" th:src="${portalHost+'/vendors.js'}"></script>
+<script type="text/javascript" th:src="${portalHost+'/newMenu/achievement.js'}"></script>
 </div>
+
 </body>
 
 </html>

+ 4 - 28
src/main/webapp/WEB-INF/views/portal/technologyTrading/demand.html

@@ -66,34 +66,10 @@
 		</div>
 	</div>
 	<!-- banner -->
-	<div id="myCarousel" class="carousel slide">
-		<!-- 轮播(Carousel)指标 -->
-		<ol class="carousel-indicators">
-			<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
-			<li data-target="#myCarousel" data-slide-to="1"></li>
-			<li data-target="#myCarousel" data-slide-to="2"></li>
-		</ol>
-		<!-- 轮播(Carousel)项目 -->
-		<div class="carousel-inner">
-			<div class="item active">
-				<img th:src="${portalHost+'/img/index_banner01.jpg'}"
-					alt="First slide">
-			</div>
-			<div class="item">
-				<img th:src="${portalHost+'/img/index_banner02.jpg'}"
-					alt="Second slide">
-			</div>
-			<div class="item">
-				<img th:src="${portalHost+'/img/index_banner03.jpg'}"
-					alt="Third slide">
-			</div>
-		</div>
-		<!-- 轮播(Carousel)导航 -->
-		<!-- <a class="carousel-control left" href="#myCarousel" 
-               data-slide="prev">&lsaquo;</a>
-            <a class="carousel-control right" href="#myCarousel" 
-               data-slide="next">&rsaquo;</a> -->
-	</div>
+
+	<div class="carousel">
+        <img th:src="${portalHost+'/img/technology_trading_banner01.jpg'}" alt="First slide">
+    </div>
 	<!-- 主体内容区域 -->
 	<div class="container">
 		<div class="demand-marq">