Explorar o código

Merge remote-tracking branch 'origin/patch' into test

anderx %!s(int64=7) %!d(string=hai) anos
pai
achega
900ca50211

+ 43 - 1
src/main/java/com/goafanti/app/controller/OpenAppHomeController.java

@@ -3,9 +3,14 @@ package com.goafanti.app.controller;
 import java.util.HashMap;
 import java.util.Map;
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
 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.bind.annotation.RestController;
+
+import com.goafanti.achievement.service.AchievementService;
 import com.goafanti.banners.service.BannersService;
 import com.goafanti.business.service.JtBusinessService;
 import com.goafanti.business.service.JtTagService;
@@ -14,7 +19,9 @@ import com.goafanti.comment.service.CommentService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.common.service.GlobalSearchService;
 import com.goafanti.common.utils.StringUtils;
+import com.goafanti.demand.service.DemandService;
 
 @RestController
 @RequestMapping(path = "/open/app/home")
@@ -28,7 +35,12 @@ public class OpenAppHomeController extends BaseApiController{
 	private JtTagService	jtTagService;
 	@Resource
 	private BannersService	bannersService;
-	
+	@Resource
+	private AchievementService	 achievementService;
+	@Resource
+	private DemandService demandService;
+	@Resource
+	private GlobalSearchService	globalSearchService;
 	
 	
 	/**技淘推荐*//*
@@ -155,6 +167,36 @@ public class OpenAppHomeController extends BaseApiController{
 		result.setData(map);
 		return result;
 	}
+	/**
+	 * 交易首页
+	 * @return
+	 */
+	@RequestMapping(value = "/getTransactionData" , method = RequestMethod.GET)
+	public Result getTransactionData(String apiUrl,Integer pageNo,Integer pageSize,HttpServletRequest request) {
+		Result result=new Result();
+		if (null==pageNo)pageNo=1;
+		if (null==pageSize)pageSize=3;
+		Map<String, Object> map=new HashMap<>();
+		String url = com.goafanti.common.utils.StringUtils.getDomainByHttpRequest(request);
+		map.put("homeImg", bannersService.findBannersList( apiUrl,1, 1, 1));
+//		map.put("achievement", achievementService.getHotAchievements(3, url,"app_achievement_trading_index"));
+//		map.put("demand", demandService.getHotDemand(3, url, "app_demand_trading_index",0));
+		map.put("achievement", achievementService.getHotAchievements(3, url,"web_index"));
+		map.put("demand", demandService.getHotDemand(3, url, "web_index",0));
+		result.setData(map);
+		return result;
+	}
+	
+	/**
+	 * 全局搜索
+	 */
+	@RequestMapping(value = "/AchievementsDemandSearch", method = RequestMethod.GET)
+	@ResponseBody
+	public Result AchievementsDemandSearch(String  name,Integer pageSize,Integer pageNo) {
+		Result res = new Result();
+		res.setData(globalSearchService.AchievementsDemandSearchList(name,pageNo,pageSize));
+		return res;
+	}
 
 	
 	

+ 1 - 1
src/main/java/com/goafanti/banners/service/BannersService.java

@@ -62,7 +62,7 @@ public class BannersService extends BaseMybatisDao<BannersMapper> {
 			params.put("apiUrl", apiUrl);
 		}
 		int pSize=(pageNo - 1) * pageSize;
-		params.put("pS", pSize<1?10:pSize);
+		params.put("pS", pSize+pageSize);
 		params.put("pN", pSize);
 		return bannersMapper.findBannerList(params);
 	}

+ 21 - 5
src/main/java/com/goafanti/common/mapper/JtCollectSearchMapper.xml

@@ -304,13 +304,21 @@
   </delete>
   <select id="globalSearchList" parameterType="String" resultType="com.goafanti.common.model.JtCollectSearch">
   	  select id,from_table as fromTable,row_id as rowId,title,keyword,summary from jt_collect_search
+    where 1=1
   	  <if test="name !=null">
-    where title like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+    and title like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+    </if>
+    <if test="AchievementDemand == 1">
+    and from_table in ('achievement','demand')
     </if>
     union 
     select id,from_table,row_id,title,keyword,summary from jt_collect_search
+    where 1=1
     <if test="name !=null">
-    where keyword like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+    and keyword like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+    </if>
+    <if test="AchievementDemand == 1">
+    and from_table in ('achievement','demand')
     </if>
     order by id desc
     <if test="page_sql!=null">
@@ -319,13 +327,21 @@
   </select>
   <select id="globalSearchCount" parameterType="String" resultType="java.lang.Integer">
   select count(*) from ( select id,from_table,row_id,title,keyword from jt_collect_search
-  <if test="name !=null">
-    where title like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+ where 1=1
+  	  <if test="name !=null">
+    and title like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+    </if>
+    <if test="AchievementDemand == 1">
+    and from_table in ('achievement','demand')
     </if>
     union 
     select id,from_table,row_id,title,keyword from jt_collect_search
+    where 1=1
     <if test="name !=null">
-    where keyword like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+    and keyword like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+    </if>
+    <if test="AchievementDemand == 1">
+    and from_table in ('achievement','demand')
     </if>
     ) a
   </select>

+ 11 - 0
src/main/java/com/goafanti/common/service/GlobalSearchService.java

@@ -25,4 +25,15 @@ public class GlobalSearchService  extends BaseMybatisDao<JtCollectSearchMapper>
 		
 	}
 
+	@SuppressWarnings("unchecked")
+	public Object AchievementsDemandSearchList(String name, Integer pageNo, Integer pageSize) {
+		Map<String, Object> params = new HashMap<>();
+		if(StringUtils.isNotBlank(name))params.put("name", name);
+		params.put("AchievementDemand", 1);
+		if(pageNo==null||pageNo<1)pageNo=1;
+		if(pageSize==null||pageSize<1)pageSize=10;
+		return (Pagination<JtCollectSearch>) findPage("globalSearchList", "globalSearchCount", params, pageNo,
+				pageSize);
+	}
+
 }