Преглед изворни кода

Merge remote-tracking branch 'origin/test'

limin пре 7 година
родитељ
комит
3d68e44a6c

+ 0 - 1
src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java

@@ -698,7 +698,6 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 				a.setOwnerName(u.getNickname());
 			}
 		}
-		a.setDataCategory(0);
 		a.setCreateTime(now.getTime());
 		disposeAchievementKeyword(keywords, a, false);
 		return achievementMapper.insert(a);

+ 35 - 0
src/main/java/com/goafanti/business/controller/AdminJtBusinessController.java

@@ -199,6 +199,7 @@ public class AdminJtBusinessController extends CertifyApiController{
 		return result;
 	}
 	
+	
 	@RequestMapping(value="/project/update",method=RequestMethod.POST)
 	private Result updateProject(JtBusinessProject jtBusinessProject) {
 		Result result=new Result();
@@ -329,6 +330,40 @@ public class AdminJtBusinessController extends CertifyApiController{
 		result.data(jtTagService.selectListJtTag(a,pageNo,pageSize));
 		return result;
 	}
+	/*
+	 * 上移品类
+	 * */
+	@RequestMapping(value="/project/moveUp",method=RequestMethod.POST)
+	private Result updateProjectMoveUp(String id) {
+		Result result=new Result();
+		if(StringUtils.isBlank(id)) {
+    		result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"品类ID","品类ID"));return result;
+    	}
+		int x=jtBusinessService.updateProjectMoveUp(id);
+		if(x==-1) {
+    		result.getError().add(buildError("上移失败","上移失败"));return result;
+    	}
+		result.data(x);
+		return result;
+	}
+	/*
+	 * 品类置顶
+	 * */
+	@RequestMapping(value="/project/setTop",method=RequestMethod.POST)
+	private Result updateProjectSetTop(String id) {
+		Result result=new Result();
+		if(StringUtils.isBlank(id)) {
+    		result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"品类ID","品类ID"));return result;
+    	}
+		int x=jtBusinessService.updateProjectSetTop(id);
+		if(x==-1) {
+    		result.getError().add(buildError("置顶失败","置顶失败"));return result;
+    	}
+		result.data(x);
+		return result;
+	}
+	
+	
 	
 	
 }

+ 14 - 0
src/main/java/com/goafanti/business/service/JtBusinessService.java

@@ -56,5 +56,19 @@ public interface JtBusinessService {
 	 * @return
 	 */
 	List<JtBusinessProject> getModuleByName(String  name, Integer isHost, Integer size);
+	/**
+	 * 品类上移
+	 * @param id
+	 * @return
+	 */
+	int updateProjectMoveUp(String id);
+	/**
+	 * 品类置顶
+	 * @param id
+	 * @return
+	 */
+	int updateProjectSetTop(String id);
+	
+	
 	
 }

+ 2 - 0
src/main/java/com/goafanti/business/service/JtTagService.java

@@ -16,4 +16,6 @@ public interface JtTagService {
 
 	Pagination<JtTagBo> selectListJtTag(JtTag a, Integer pageNo, Integer pageSize);
 
+	
+
 }

+ 37 - 0
src/main/java/com/goafanti/business/service/impl/JtBusinessServiceImpl.java

@@ -450,6 +450,43 @@ public class JtBusinessServiceImpl  extends BaseMybatisDao<JtBusinessProjectMapp
 			Integer size) {
 		return jtBusinessProjectMapper.getModuleByName(name, isHost, size);
 	}
+
+	@Override
+	public int updateProjectMoveUp(String id) {
+		JtBusinessCategory j1=jtBusinessCategoryMapper.selectByPrimaryKey(id);
+		JtBusinessCategory j2=jtBusinessCategoryMapper.selectFirstLevel(id,j1.getModule(),j1.getLayer(),0);
+		if(null==j1||null==j2){
+			return -1;
+		}
+		Integer i=j1.getSort();
+		JtBusinessCategory jtBusinessCategory=new JtBusinessCategory();
+		jtBusinessCategory.setId(j1.getId());
+		jtBusinessCategory.setSort(j2.getSort());
+		jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
+		jtBusinessCategory.setId(j2.getId());
+		jtBusinessCategory.setSort(i);
+		jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
+		
+		return 1;
+	}
+
+	@Override
+	public int updateProjectSetTop(String id) {
+		JtBusinessCategory j1=jtBusinessCategoryMapper.selectByPrimaryKey(id);
+		JtBusinessCategory j2=jtBusinessCategoryMapper.selectFirstLevel(id,j1.getModule(),j1.getLayer(),1);
+		if(null==j1||null==j2){
+			return -1;
+		}
+		Integer i=j1.getSort();
+		JtBusinessCategory jtBusinessCategory=new JtBusinessCategory();
+		jtBusinessCategory.setId(j1.getId());
+		jtBusinessCategory.setSort(j2.getSort());
+		jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
+		jtBusinessCategory.setId(j2.getId());
+		jtBusinessCategory.setSort(i);
+		jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
+		return 1;
+	}
 	
 
 }

+ 5 - 3
src/main/java/com/goafanti/business/service/impl/JtBusinessServiceWithCategoryMapperImpl.java

@@ -18,21 +18,23 @@ public class JtBusinessServiceWithCategoryMapperImpl   extends BaseMybatisDao<Jt
 		@Override
 		public Pagination<JtBusinessCategory> getCategoryListByCondition(JtBusinessCategory jtBusinessCategory,Integer pageNo,Integer pageSize) {
 			
-			Map<String, Object>params=disposeCategoryParams(jtBusinessCategory.getName(), jtBusinessCategory.getLayer());
+			Map<String, Object>params=disposeCategoryParams(jtBusinessCategory.getName(), jtBusinessCategory.getLayer(),jtBusinessCategory.getModule());
 			if(pageNo==null ||pageNo<1)pageNo=1;
 			if(pageSize==null ||pageSize<1)pageSize=10;
 			// TODO Auto-generated method stub
 			return (Pagination<JtBusinessCategory>)findPage("getCategoryListByCondition", "getCategoryCountByCondition", params, pageNo, pageSize);
 		}
 		
-		private Map<String, Object> disposeCategoryParams(String name,Integer layer ) {
+		private Map<String, Object> disposeCategoryParams(String name,Integer layer ,Integer module) {
 			Map<String, Object> params = new HashMap<>();
 
 			if (layer!=null) {
 				params.put("layer", layer);
 			}
 
-		
+			if (module!=null) {
+				params.put("module", module);
+			}
 
 		
 			if (StringUtils.isNotBlank(name)) {

+ 1 - 1
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -675,7 +675,7 @@ public class PublicController extends BaseController {
 		}*/
 		User user = userService.selectByMobieAndType(mobile, type);
 		if (null == user) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户"));
+			res.getError().add(buildError( "用户未注册", "用户未注册"));
 			return res;
 		}
 		if (null!=user.getMobile()&&!user.getMobile().equals(mobile)) {

+ 2 - 0
src/main/java/com/goafanti/common/dao/JtBusinessCategoryMapper.java

@@ -96,5 +96,7 @@ public interface JtBusinessCategoryMapper {
     Integer updateNumberPrefix(JtBusinessCategory jtBusinessCategory);
     
     List<JtBusinessCategory> getCategoryByModule(Integer module);
+
+	JtBusinessCategory selectFirstLevel(String id, Integer module, Integer layer,@Param("type")Integer type);
     
 }

+ 2 - 0
src/main/java/com/goafanti/common/dao/JtBusinessProjectMapper.java

@@ -86,6 +86,8 @@ public interface JtBusinessProjectMapper {
   
 	List<JtBusinessProject> getKJListByIds(@Param("module")Integer module, @Param("isHot")Integer isHost, @Param("size")Integer size);
 	List<JtBusinessProject> getModuleByName(@Param("name")String name, @Param("isHot")Integer isHost, @Param("size")Integer size);
+
+	JtBusinessProject selectFirstLevel(String id);
      
   
 }

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

@@ -658,7 +658,7 @@
   	from achievement a
   	left join (select count(0)  as countInterest,achievement_id from achievement_interest 
   		group by achievement_id)b on a.id = b.achievement_id
-	left join (select achievement_id  from achievement_interest where uid=#{uid,jdbcType=VARCHAR})c
+	left join (select achievement_id  from achievement_interest where uid=#{uid,jdbcType=VARCHAR} group by achievement_id)c
 	on a.id=c.achievement_id
   	left join industry_category f on a.field_a=f.id
   	left join industry_category f2 on a.field_b=f2.id

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

@@ -73,7 +73,7 @@
 	GROUP by b.commodity_id) t on d.id=t.id
 	left join (select count(0) as y,demand_id from demand_interest
 		group by demand_id ) i on d.id=i.demand_id
-	left join (select demand_id from demand_interest where uid=#{uid,jdbcType=VARCHAR}) a on d.id=a.demand_id
+	left join (select demand_id from demand_interest where uid=#{uid,jdbcType=VARCHAR}  group by demand_id) a on d.id=a.demand_id
 	left join industry_category f on d.industry_category_a=f.id
   	left join industry_category f2 on d.industry_category_b=f2.id
 	where d.deleted_sign=0 and d.info_sources=1			
@@ -566,7 +566,7 @@
 	left join	industry_category g2 on d.industry_category_b=g2.id
 	left join (select count(0)  as countInterest ,demand_id from demand_interest 
 				group by demand_id) t on d.id=t.demand_id
-	left join (select demand_id from demand_interest where uid= #{uid,jdbcType=VARCHAR}) y on d.id=y.demand_id		
+	left join (select demand_id from demand_interest where uid= #{uid,jdbcType=VARCHAR} group by demand_id) y on d.id=y.demand_id		
 	where d.deleted_sign = 0 and d.audit_status=2 and d.info_sources=1  
 	<if test="employerId != null">
 	and d.employer_id = #{employerId, jdbcType=VARCHAR}
@@ -616,7 +616,7 @@
   <select id="findAppDemandCount" parameterType="String" resultType="java.lang.Integer">
   		select count(1)
 	from  demand d 
-	where d.deleted_sign = 0 and d.audit_status=2 and d.info_sources=1 and d.release_status=1
+	where d.deleted_sign = 0 and d.audit_status=2 and d.info_sources=1  
 	<if test="employerId != null">
 	and d.employer_id = #{employerId, jdbcType=VARCHAR}
 	</if>

+ 16 - 0
src/main/java/com/goafanti/common/mapper/JtBusinessCategoryMapper.xml

@@ -467,6 +467,7 @@ and layer=#{0}
     <if test="module !=null">
     and bc1.module =#{module,jdbcType=INTEGER}
     </if>
+    order by bc1.sort
    <if test="page_sql!=null">
 		${page_sql}
 	</if>
@@ -518,4 +519,19 @@ and layer=#{0}
     select id, name, summary, number, create_time, super_id, img_url, layer, sort, module
     from jt_business_category where module = #{module,jdbcType=INTEGER} order by layer,sort
     </select>
+    
+    <select id="selectFirstLevel" resultMap="BaseResultMap">
+  select
+   <include refid="Base_Column_List" /> 
+   from jt_business_category
+	where module=#{1} and layer=#{2}
+	and   sort &lt; (select sort from jt_business_category where id=#{0})
+	order by sort
+	
+	<if test="type ==0">
+	desc 
+	</if> 
+	limit 1
+  </select>
+  
 </mapper>

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

@@ -576,7 +576,7 @@
     from jt_business_project jtbp left join `user` u on jtbp.owner_id=u.id
     left join jt_business_category jtbc on jtbc.id =  jtbp.category_id
     left join (select project_id,count(*) as count from project_interest group by project_id) p on jtbp.id=p.project_id
-    left join (select project_id from project_interest <if test="uid != null"> where uid= #{uid,jdbcType=VARCHAR} </if>) x on jtbp.id=x.project_id
+    left join (select project_id from project_interest <if test="uid != null"> where uid= #{uid,jdbcType=VARCHAR} </if>group by project_id) x on jtbp.id=x.project_id
     where jtbp.id = #{id,jdbcType=VARCHAR}
   </select>
   
@@ -873,4 +873,5 @@
 	order by b.release_date desc 
 	limit #{size}
   </select>
+  
 </mapper>

+ 0 - 1
src/main/java/com/goafanti/user/controller/UserRegisterController.java

@@ -134,7 +134,6 @@ public class UserRegisterController extends BaseController {
 		if (res.getError().isEmpty()) {
 			User us = new User();
 			us.setId(UUID.randomUUID().toString());
-			us.setUsername(user.getUsername().trim());
 			us.setMobile(user.getMobile().trim());
 			us.setPassword(user.getPassword());
 			Calendar now = Calendar.getInstance();