Pārlūkot izejas kodu

Merge branch 'test' of ssh://git@git.jishutao.com:55555/jishutao/jitao-server.git into test

limin 7 gadi atpakaļ
vecāks
revīzija
86471fa87f

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

@@ -137,16 +137,16 @@ public class OpenAppHomeController extends BaseApiController{
 	 * @return
 	 */
 	@RequestMapping(value = "/recommendedApplication" , method = RequestMethod.GET)
-	public Result recommendedApplication(Integer pageNo,Integer pageSize) {
+	public Result recommendedApplication(String apiUrl,Integer pageNo,Integer pageSize) {
 		Result result=new Result();
 		if (null==pageNo)pageNo=1;
 		if (null==pageSize)pageSize=3;
 		Map<String, Object> map=new HashMap<>();
 		//1 赚钱数据    2首页数据
-		map.put("recommended", jtBusinessService.recommendedApplication(1,pageNo,pageSize));
+		map.put("recommended", jtBusinessService.recommendedApplication(null,pageNo,pageSize));
 		map.put("tag", jtTagService.selectListJtTag(null, 1, 99));
 		
-		map.put("homeImg", bannersService.findBannersList( BannersStatus.HOME.getDesc(),1, 1, 1));
+		map.put("homeImg", bannersService.findAppBannersList( apiUrl,1, 1, 1));
 		result.setData(map);
 		return result;
 	}
@@ -155,14 +155,14 @@ public class OpenAppHomeController extends BaseApiController{
 	 * @return
 	 */
 	@RequestMapping(value = "/getHomeData" , method = RequestMethod.GET)
-	public Result getHomeData(Integer pageNo,Integer pageSize) {
+	public Result getHomeData(String apiUrl,Integer pageNo,Integer pageSize) {
 		Result result=new Result();
 		if (null==pageNo)pageNo=1;
 		if (null==pageSize)pageSize=3;
 		Map<String, Object> map=new HashMap<>();
 		//1 赚钱数据    2首页数据
-		map.put("recommended", jtBusinessService.recommendedApplication(1,pageNo,pageSize));
-		map.put("homeImg", bannersService.findBannersList( BannersStatus.HOME.getDesc(),1, 3, 1));
+		map.put("recommended", jtBusinessService.recommendedApplication(null,pageNo,pageSize));
+		map.put("homeImg", bannersService.findAppBannersList( apiUrl,1, 3, 1));
 		result.setData(map);
 		return result;
 	}

+ 24 - 1
src/main/java/com/goafanti/banners/controller/AdminBannersApiController.java

@@ -8,6 +8,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
 
+import org.junit.runner.Request;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.util.Assert;
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 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.BaseApiController;
 import com.goafanti.common.enums.AttachmentType;
 import com.goafanti.common.model.Banners;
@@ -105,11 +107,32 @@ public class AdminBannersApiController extends BaseApiController {
 		return result;
 	}
 	@RequestMapping(value="/list" ,method=RequestMethod.GET)
-	public Result list(String apiUrl,Integer client,Integer pageSize,Integer pageNo){
+	public Result list(String apiUrl,Integer client,Integer pageSize,Integer pageNo,HttpServletRequest request){
 		Result result=new Result();
 		result.setData(bannersService.findBannersList( apiUrl,client, pageSize, pageNo));
 		return result;
 	}
+	@RequestMapping(value="/appList" ,method=RequestMethod.GET)
+	public Result appList(String apiUrl,Integer client,Integer pageSize,Integer pageNo,HttpServletRequest request){
+		Result result=new Result();
+		result.setData(bannersService.findAppBannersList( apiUrl,client, pageSize, pageNo));
+		return result;
+	}
 	
 
+    /**
+     * 图片上传
+     */
+    @RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
+    public Result uploadPicture(HttpServletRequest req, String sign) {
+        Result res = new Result();
+        AttachmentType attachmentType = AttachmentType.getField(sign);
+        if (attachmentType == AttachmentType.BANNERS_PIC) {
+            res.setData(handleFiles(res, "/banners", false, req, sign, "banners"));
+        } else {
+            res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "图片标示"));
+        }
+        return res;
+    }
+
 }

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

@@ -14,10 +14,13 @@ import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import com.alibaba.druid.sql.visitor.functions.If;
+import com.goafanti.common.bo.MyCollection;
 import com.goafanti.common.dao.BannersMapper;
 import com.goafanti.common.model.Banners;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.shiro.token.TokenManager;
 
 @Service
 public class BannersService extends BaseMybatisDao<BannersMapper> {
@@ -39,7 +42,7 @@ public class BannersService extends BaseMybatisDao<BannersMapper> {
 		return bannersMapper.deleteByPrimaryKey(id);
 	}
 
-	public List<Banners> findBannersList(String apiUrl,Integer client,Integer pageSize,Integer pageNo) {
+	public List<Banners> findAppBannersList(String apiUrl,Integer client,Integer pageSize,Integer pageNo) {
 		return portalBanners(apiUrl, client, pageNo, pageSize);
 	}
 	
@@ -65,5 +68,15 @@ public class BannersService extends BaseMybatisDao<BannersMapper> {
 	public void cleanList(String key) {
 		LoggerUtils.debug(logger, "清除广告图列表缓存:[%s]", key);
 	}
-
+	
+	@SuppressWarnings("unchecked")
+	public Pagination<Banners> findBannersList(String apiUrl,Integer client,Integer pageSize,Integer pageNo) {
+		if(pageNo==null ||pageNo<1)pageNo=1;
+		if(pageSize== null ||pageSize<1)pageSize=10;
+		 Map<String, Object> params=new HashMap<String,Object>();
+		if(StringUtils.isNotBlank(apiUrl)) params.put("apiUrl", apiUrl);
+		if(client != null) params.put("client", client);
+		return (Pagination<Banners>) findPage("findAdminBannersList", "findAdminBannersCount", params, pageNo, pageSize);
+	}
+	
 }

+ 13 - 25
src/main/java/com/goafanti/common/enums/BannersStatus.java

@@ -3,49 +3,37 @@ package com.goafanti.common.enums;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.lang3.StringUtils;
 
 public enum BannersStatus {
 	
-	HOME( 1,"home"),
-	OTHER(0, "other");
+	HOME( "home","首页"),
+	MAKEMONEY( "makeMoney","赚钱首页"),
+	OTHER( "other","其他");
 
-	private BannersStatus(Integer code, String desc) {
-		this.code = code;
+	private BannersStatus(String key, String desc) {
+		this.key = key;
 		this.desc = desc;
 	}
 
-	private static Map<Integer, BannersStatus> status = new HashMap<Integer, BannersStatus>();
+	private static Map<String, BannersStatus> status = new HashMap<String, BannersStatus>();
 
 	static {
 		for (BannersStatus value : BannersStatus.values()) {
-			status.put(value.getCode(), value);
+			status.put(value.getKey(), value);
 		}
 	}
 
-	public static BannersStatus getStatus(Integer code) {
-		if (containsType(code)) {
-			return status.get(code);
-		}
-		return OTHER;
-	}
-
-	public static BannersStatus getStatus(String code) {
-		if (StringUtils.isNumeric(code)) {
-			return getStatus(Integer.parseInt(code));
-		}
-		return OTHER;
-	}
+	
 
-	public static boolean containsType(Integer code) {
-		return status.containsKey(code);
+	public static boolean containsType(String	key) {
+		return status.containsKey(key);
 	}
 
-	private Integer	code;
+	private String	key;
 	private String	desc;
 
-	public Integer getCode() {
-		return code;
+	public String getKey() {
+		return key;
 	}
 
 	public String getDesc() {

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

@@ -1432,7 +1432,7 @@ where
   		a.id, a.name, a.introduction, b.name as fieidA, ai.uid, a.maturity as textA
   	from achievement a
   	left join achievement_interest ai on ai.achievement_id=a.id
-  	left join field_glossory b on a.field_a= b.id
+  	left join industry_category b on a.field_a= b.id
   	where  a.deleted_sign=0
   	and ai.uid= #{uid,jdbcType=VARCHAR}
   	order by ai.create_time desc

+ 27 - 0
src/main/java/com/goafanti/common/mapper/BannersMapper.xml

@@ -362,4 +362,31 @@
 	limit #{pN,jdbcType=INTEGER},#{pS,jdbcType=INTEGER}
 	</if>
   </select>
+  <select id="findAdminBannersList" resultMap="BaseResultMap">
+  	select
+  <include refid="Base_Column_List" /> 
+ 	from banners
+ 	where delete_sign=0
+	<if test="apiUrl != null">
+	and api_url= #{apiUrl,jdbcType=VARCHAR}
+	</if>
+	<if test="client != null">
+	and client= #{client,jdbcType=INTEGER}
+	</if>
+	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  <select id="findAdminBannersCount" resultType="java.lang.Integer">
+  	select
+  	count(*)
+ 	from banners
+ 	where delete_sign=0
+	<if test="apiUrl != null">
+	and api_url= #{apiUrl,jdbcType=VARCHAR}
+	</if>
+	<if test="client != null">
+	and client= #{client,jdbcType=INTEGER}
+	</if>
+  </select>
 </mapper>

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

@@ -1192,7 +1192,7 @@ order by release_date desc limit #{0}
   	a.is_urgent as textA
    from demand a
    left join demand_interest di on di.demand_id=a.id
-   left join field_glossory b on a.industry_category_a= b.id
+   left join industry_category b on a.industry_category_a= b.id
      where a.deleted_sign=0 
    and di.uid= #{uid,jdbcType=VARCHAR}
    order by di.create_time desc