瀏覽代碼

Merge branch 'master' of jishutao/jitao-server into test

liliang4869 7 年之前
父節點
當前提交
8c632df0a1
共有 19 個文件被更改,包括 980 次插入625 次删除
  1. 2 0
      src/main/java/com/goafanti/achievement/service/AchievementService.java
  2. 13 0
      src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java
  3. 2 0
      src/main/java/com/goafanti/business/service/JtBusinessService.java
  4. 27 0
      src/main/java/com/goafanti/business/service/impl/JtBusinessServiceImpl.java
  5. 1 1
      src/main/java/com/goafanti/common/controller/WebpageController.java
  6. 2 0
      src/main/java/com/goafanti/common/dao/JtBusinessProjectMapper.java
  7. 129 129
      src/main/java/com/goafanti/common/mapper/AchievementInterestMapper.xml
  8. 26 1
      src/main/java/com/goafanti/common/mapper/AchievementMapper.xml
  9. 18 0
      src/main/java/com/goafanti/common/mapper/DemandMapper.xml
  10. 37 1
      src/main/java/com/goafanti/common/mapper/JtBusinessProjectMapper.xml
  11. 17 0
      src/main/java/com/goafanti/common/mapper/UserIdentityMapper.xml
  12. 31 22
      src/main/java/com/goafanti/common/utils/RandomUtil.java
  13. 2 0
      src/main/java/com/goafanti/demand/service/DemandService.java
  14. 15 0
      src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java
  15. 354 192
      src/main/java/com/goafanti/portal/controller/PortalInterestApiController.java
  16. 2 1
      src/main/java/com/goafanti/user/service/UserIdentityService.java
  17. 62 58
      src/main/java/com/goafanti/user/service/UserService.java
  18. 14 0
      src/main/java/com/goafanti/user/service/impl/UserIdentityServiceImpl.java
  19. 226 220
      src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

+ 2 - 0
src/main/java/com/goafanti/achievement/service/AchievementService.java

@@ -92,5 +92,7 @@ public interface AchievementService {
 	
 	   /**查询智者的科技成果**/
     public List<AchievementPartnerListBo> findPartnerAchievementList(String uid);
+    
+    Pagination<AchievementObject>listInterestedAchievement(Integer pageNo,Integer pageSize);
 
 }

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

@@ -832,4 +832,17 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 			return achievementMapper.findPartnerAchievementListByPage(uid);
 		}
 
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<AchievementObject> listInterestedAchievement(Integer pageNo, Integer pageSize) {
+		if(pageNo==null ||pageNo<1)pageNo=1;
+		if(pageSize== null ||pageSize<1)pageSize=10;
+		 Map<String, Object> params=new HashMap<String,Object>();
+		 params.put("uid", TokenManager.getUserId());
+		return (Pagination<AchievementObject>) findPage("listInterestedAchievement", "listInterestedAchievementCount", params, pageNo, pageSize);
+	}
+	 
+	 
+	 
+
 }

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

@@ -24,4 +24,6 @@ public interface JtBusinessService {
 	int deleteProjectById(String id);
 	int updateProject(JtBusinessProject jtBusinessProject);
 	List<JtBusinessProject>getProjectsLimit(Integer size);
+	int deleteByIdAndUid(String id);
+	Pagination<JtBusinessProject>listProjectIInterestedIn(Integer pageNo,Integer pageSize);
 }

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

@@ -255,4 +255,31 @@ if(auditStatus!=null ) {
 		return jtBusinessProjectMapper.findProjectOrderByNumber();
 	}
 
+	@Override
+	public int deleteByIdAndUid(String id) {
+		// TODO Auto-generated method stub
+		if(TokenManager.getUserId()==null)return -1;
+		return jtBusinessProjectMapper.deleteByIdAndUid(id,TokenManager.getUserId());
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<JtBusinessProject> listProjectIInterestedIn(Integer pageNo,Integer pageSize) {
+		// TODO Auto-generated method stub
+
+		if (pageNo == null || pageNo < 0) {
+			pageNo = 1;
+		}
+
+		if (pageSize == null || pageSize < 0 || pageSize > 10) {
+			pageSize = 10;
+		}
+		Map<String,Object> params=new HashMap<String,Object>();
+		params.put("uid", TokenManager.getUserId());
+		return (Pagination<JtBusinessProject>) findPage("findInterestedProjcet", "findInterestedProjcetCount", params, pageNo, pageSize);
+	}
+	
+	
+	
+
 }

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

@@ -744,7 +744,7 @@ public class WebpageController extends BaseController {
 			modelAndView.addObject(categoryName+"List"+i,projects);
 		}
 		
-	}
+	} 
 	
 	 public static int differentDaysByMillisecond(Date date1,Date date2)
 	    {

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

@@ -79,6 +79,8 @@ public interface JtBusinessProjectMapper {
      
   List<JtBusinessProject> findProjectOrderByNumber();
   
+  int deleteByIdAndUid(String id,String uid);
+  
 
      
   

+ 129 - 129
src/main/java/com/goafanti/common/mapper/AchievementInterestMapper.xml

@@ -1,130 +1,130 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.goafanti.common.dao.AchievementInterestMapper" >
-  <resultMap id="BaseResultMap" type="com.goafanti.common.model.AchievementInterest" >
-    <id column="id" property="id" jdbcType="VARCHAR" />
-    <result column="achievement_id" property="achievementId" jdbcType="VARCHAR" />
-    <result column="uid" property="uid" jdbcType="VARCHAR" />
-    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
-  </resultMap>
-  <sql id="Base_Column_List" >
-    id, achievement_id, uid, create_time
-  </sql>
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
-    select 
-    <include refid="Base_Column_List" />
-    from achievement_interest
-    where id = #{id,jdbcType=VARCHAR}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
-    delete from achievement_interest
-    where id = #{id,jdbcType=VARCHAR}
-  </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.AchievementInterest" >
-    insert into achievement_interest (id, achievement_id, uid, 
-      create_time)
-    values (#{id,jdbcType=VARCHAR}, #{achievementId,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, 
-      #{createTime,jdbcType=TIMESTAMP})
-  </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.AchievementInterest" >
-    insert into achievement_interest
-    <trim prefix="(" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
-        id,
-      </if>
-      <if test="achievementId != null" >
-        achievement_id,
-      </if>
-      <if test="uid != null" >
-        uid,
-      </if>
-      <if test="createTime != null" >
-        create_time,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
-        #{id,jdbcType=VARCHAR},
-      </if>
-      <if test="achievementId != null" >
-        #{achievementId,jdbcType=VARCHAR},
-      </if>
-      <if test="uid != null" >
-        #{uid,jdbcType=VARCHAR},
-      </if>
-      <if test="createTime != null" >
-        #{createTime,jdbcType=TIMESTAMP},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AchievementInterest" >
-    update achievement_interest
-    <set >
-      <if test="achievementId != null" >
-        achievement_id = #{achievementId,jdbcType=VARCHAR},
-      </if>
-      <if test="uid != null" >
-        uid = #{uid,jdbcType=VARCHAR},
-      </if>
-      <if test="createTime != null" >
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-    </set>
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AchievementInterest" >
-    update achievement_interest
-    set achievement_id = #{achievementId,jdbcType=VARCHAR},
-      uid = #{uid,jdbcType=VARCHAR},
-      create_time = #{createTime,jdbcType=TIMESTAMP}
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
-  
-  <select id="findAchievementInterestListByPage" parameterType="String" resultType="com.goafanti.portal.bo.AchievementInterestListBo">
-  	select 
-  		ai.id, ai.achievement_id as achievementId, ai.create_time as createTime,
-  		a.name, a.serial_number as serialNumber, a.deleted_sign as deletedSign,
-  		a.audit_status as auditStatus, a.keyword
-  	from achievement_interest ai
-  	left join achievement a on a.id = ai.achievement_id
-  	where 1=1
-  	<if test="uid != null">
-  		and ai.uid = #{uid,jdbcType=VARCHAR}
-  	</if> 
-  	order by ai.create_time desc
-  	<if test="page_sql!=null">
-		${page_sql}
-	</if>
-  </select>
-  
-  <select id="findAchievementInterestCount" parameterType="String" resultType="java.lang.Integer">
-  	select 
-  		count(1)
-  	from achievement_interest ai
-  	where 1=1
-  	<if test="uid != null">
-  		and	ai.uid = #{uid,jdbcType=VARCHAR}
-  	</if> 
-  </select>
-  
-  <select id="selectAchievementInterestByUidAndAchievementId" resultMap="BaseResultMap">
-  	select  
-  	<include refid="Base_Column_List" />
-    from achievement_interest
-    where uid = #{0} and achievement_id = #{1}
-  </select>
-   <select id="checkUidAndDid" resultType="Integer">
-  		select count(0) from achievement_interest where 1=1
-  		<if test="uid != null">
-  	       and uid = #{uid,jdbcType=VARCHAR}
-  	    </if>
-  	    <if test="id != null">
-  	       and achievement_id = #{id,jdbcType=VARCHAR}
-  	    </if>
-  </select>
-  <delete id="deleteInterest" parameterType="java.lang.String" >
-    delete from achievement_interest
-    where uid = #{uid,jdbcType=VARCHAR}
-    and achievement_id=#{objectId,jdbcType=VARCHAR}
-  </delete>
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.goafanti.common.dao.AchievementInterestMapper" >
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.AchievementInterest" >
+    <id column="id" property="id" jdbcType="VARCHAR" />
+    <result column="achievement_id" property="achievementId" jdbcType="VARCHAR" />
+    <result column="uid" property="uid" jdbcType="VARCHAR" />
+    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    id, achievement_id, uid, create_time
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    select 
+    <include refid="Base_Column_List" />
+    from achievement_interest
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+    delete from achievement_interest
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.AchievementInterest" >
+    insert into achievement_interest (id, achievement_id, uid, 
+      create_time)
+    values (#{id,jdbcType=VARCHAR}, #{achievementId,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, 
+      #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.AchievementInterest" >
+    insert into achievement_interest
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        id,
+      </if>
+      <if test="achievementId != null" >
+        achievement_id,
+      </if>
+      <if test="uid != null" >
+        uid,
+      </if>
+      <if test="createTime != null" >
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="achievementId != null" >
+        #{achievementId,jdbcType=VARCHAR},
+      </if>
+      <if test="uid != null" >
+        #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null" >
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AchievementInterest" >
+    update achievement_interest
+    <set >
+      <if test="achievementId != null" >
+        achievement_id = #{achievementId,jdbcType=VARCHAR},
+      </if>
+      <if test="uid != null" >
+        uid = #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null" >
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AchievementInterest" >
+    update achievement_interest
+    set achievement_id = #{achievementId,jdbcType=VARCHAR},
+      uid = #{uid,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  
+  <select id="findAchievementInterestListByPage" parameterType="String" resultType="com.goafanti.portal.bo.AchievementInterestListBo">
+  	select 
+  		ai.id, ai.achievement_id as achievementId, ai.create_time as createTime,
+  		a.name, a.serial_number as serialNumber, a.deleted_sign as deletedSign,
+  		a.audit_status as auditStatus, a.keyword
+  	from achievement_interest ai
+  	left join achievement a on a.id = ai.achievement_id
+  	where 1=1
+  	<if test="uid != null">
+  		and ai.uid = #{uid,jdbcType=VARCHAR}
+  	</if> 
+  	order by ai.create_time desc
+  	<if test="page_sql!=null">
+		${page_sql}
+	</if>
+  </select>
+  
+  <select id="findAchievementInterestCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+  		count(1)
+  	from achievement_interest ai
+  	where 1=1
+  	<if test="uid != null">
+  		and	ai.uid = #{uid,jdbcType=VARCHAR}
+  	</if> 
+  </select>
+  
+  <select id="selectAchievementInterestByUidAndAchievementId" resultMap="BaseResultMap">
+  	select  
+  	<include refid="Base_Column_List" />
+    from achievement_interest
+    where uid = #{0} and achievement_id = #{1}
+  </select>
+   <select id="checkUidAndDid" resultType="Integer">
+  		select count(0) from achievement_interest where 1=1
+  		<if test="uid != null">
+  	       and uid = #{uid,jdbcType=VARCHAR}
+  	    </if>
+  	    <if test="id != null">
+  	       and achievement_id = #{id,jdbcType=VARCHAR}
+  	    </if>
+  </select>
+  <delete id="deleteInterest" parameterType="java.lang.String" >
+    delete from achievement_interest
+    where uid = #{uid,jdbcType=VARCHAR}
+    and achievement_id=#{objectId,jdbcType=VARCHAR}
+  </delete>
 </mapper>

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

@@ -1388,5 +1388,30 @@ left join industry_category fgg on
 where
 	a.id = #{0}
 </select>
-
+<select id="listInterestedAchievement" resultType="com.goafanti.portal.bo.AchievementObject">
+	select 
+  		a.id, 
+  		a.serial_number as serialNumber,
+  		a.category,
+  		a.data_category as dataCategory,
+  		a.name, 
+  		a.release_date as releaseDate, 
+  		a.audit_status as auditStatus,
+  		a.technical_picture_url as technicalPictureUrl,
+  		a.boutique,
+  		b.identify_name as ownerName
+  	from achievement a
+  	left join achievement_interest ai on ai.achievement_id=a.id
+  	where ai.uid=#{uid,jdbcType=VARCHAR}
+  	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  	</select>
+  	<select id="listInterestedAchievementCount" resultType="java.lang.Integer">
+	select 
+  		count(0)
+  	from achievement a
+  	left join achievement_interest ai on ai.achievement_id=a.id
+  	where ai.uid=#{uid,jdbcType=VARCHAR}
+  	</select>
 </mapper>

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

@@ -1156,4 +1156,22 @@ order by release_date desc limit #{0}
   and a.name like concat("%",#{name,jdbcType=VARCHAR},"%")
   </if>
   </select>
+  
+  
+  <select id="findInterestedDemand" resultType="com.goafanti.demand.bo.DemandListBo">
+   select a.name,a.id,create_time as createTime ,picture_url as pictureUrl,data_category as dataCategory,is_hot as isHot,demand_type as demandType,
+  industry_category_a as industryCategoryA,industry_category_b as industryCategoryB,ic.name as industryCategory1,icc.name as industryCategory2
+   from demand a
+   left join demand_interest di on di.demand_id=a.id
+   where di.uid=#{uid,jdbcType="VARCHAR"}
+     <if test="page_sql !=null">
+  	${page_sql}
+  </if>
+  </select>
+    <select id="findInterestedDemand" resultType="java.lang.Integer">
+   select count(0)
+   from demand a
+   left join demand_interest di on di.demand_id=a.id
+   where di.uid=#{uid,jdbcType="VARCHAR"}
+  </select>
   </mapper>

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

@@ -646,5 +646,41 @@
   where audit_status=2
   order by release_date desc
   </select>
-  
+  <select id="findInterestedProjcet" resultType="com.goafanti.common.model.JtBusinessProject">
+  select 
+  jtbp.id,  
+	  jtbp.name, 
+	  jtbp.category_id as categoryId,  
+	  jtbp.number,  
+	  jtbp.price,  
+	  jtbp.activity_price as activityPrice,  
+	  jtbp.member_price as memberPrice,  
+	  jtbp.offset, 
+	  jtbp.activity_flag as activityFlag, 
+	  jtbp.introduce,  
+	  jtbp.province, jtbp.city,  
+	  jtbp.create_time as createTime,
+	  jtbp.min_img_url as minImgUrl,
+	  jtbp.max_img_url as maxImgUrl, 
+	  jtbp.value,  
+	  jtbp.apply_conditions as applyConditions,
+	  jtbp.is_hot as isHot,
+	  jtbp.audit_status as auditStatus,
+	  jtbp.release_Date as releaseDate
+   from 
+  jt_business_project jtbp
+  left join project_interest pi on jtbp.id=pi.project_id
+  where pi.uid=#{uid,jdbcType=VARCHAR}
+ 	<if test="page_sql!=null">
+		${page_sql}
+	</if>
+  </select>
+    <select id="findInterestedProjcetCount" resultType="java.lang.Integer">
+  select 
+  count(0)
+   from 
+  jt_business_project jtbp
+  left join project_interest pi on jtbp.id=pi.project_id
+  where pi.uid=#{uid,jdbcType=VARCHAR}
+  </select>
 </mapper>

+ 17 - 0
src/main/java/com/goafanti/common/mapper/UserIdentityMapper.xml

@@ -1171,4 +1171,21 @@ order by
   where t.expert=2
   limit #{0}
   </select>
+  
+  <select id="listInterestedExpert" resultType="com.goafanti.user.bo.UserIdentityBo">
+	 	select 	t.id ,t.uid,u.identify_name as username,t.work_unit as workUnit,t.province,t.area,t.professional_title as professionalTitle,t.industry,t.city,
+		u.type,u.introduction,u.head_portrait_url as headPortraitUrl
+		from user_identity t left JOIN user u on t.uid = u.id
+		left join user_interest ui on ui.to_uid=u.id
+		where ui.from_uid=#{uid,jdbcType=VARCHAR}
+	<if test="page_sql!=null">
+        ${page_sql}
+    </if>
+</select>
+  <select id="listInterestedExpertCount" resultType="java.lang.Integer">
+	 	select count(0)
+		from user_identity t left JOIN user u on t.uid = u.id
+		left join user_interest ui on ui.to_uid=u.id
+		where ui.from_uid=#{uid,jdbcType=VARCHAR}
+</select>
 </mapper>

+ 31 - 22
src/main/java/com/goafanti/common/utils/RandomUtil.java

@@ -1,22 +1,31 @@
-package com.goafanti.common.utils;
-
-import java.util.Random;
-
-public class RandomUtil {
-	public static int[]generateRandomList(int maxNum,int count){
-		int[] res=new int[count];
-        Random rand = new Random();//新建一个随机类
-        boolean[]  bool = new boolean[maxNum];
-        int randInt = 0;
-        for(int i = 0; i < count ; i++) {
-             do {
-                 randInt  = rand.nextInt(maxNum);//产生一个随机数
-             }while(bool[randInt]);
-            bool[randInt] = true;
-//            System.out.println(randInt);
-            res[i]=randInt;
-       }
-        return res;
-	}
-
-}
+package com.goafanti.common.utils;
+
+import java.util.Random;
+
+public class RandomUtil {
+	public static int[] generateRandomList(int maxNum, int count) {
+		int[] res = new int[count];
+		Random rand = new Random();
+
+		boolean flag = false;
+		int randInt = 0;
+		for (int i = 0; i < count; i++) {
+			do {
+				randInt = rand.nextInt(maxNum);
+				for (int i1 = 0; i1 < count; i1++) {
+					if (res[i1] == randInt) {
+						flag = false;
+						break;
+					}
+					flag=true;
+				}
+			} while (!flag);
+			flag = false;
+			res[i] = randInt;
+		}
+		return res;
+	}
+	
+
+
+}

+ 2 - 0
src/main/java/com/goafanti/demand/service/DemandService.java

@@ -82,4 +82,6 @@ public interface DemandService {
 	
 	Pagination<DemandListBo>getDemandObjects(DemandListBo demandListBo,Integer pageNo,Integer pageSize);
 	
+	Pagination<DemandListBo>listInterestedAchievement(Integer pageNo,Integer pageSize);
+	
 }

+ 15 - 0
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -907,6 +907,21 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		}
 		return params;
 	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<DemandListBo> listInterestedAchievement(Integer pageNo, Integer pageSize) {
+		// TODO Auto-generated method stub
+		if(pageNo==null || pageNo<1) {
+			pageNo=1;
+		}
+		if(pageSize==null ||pageSize<1) {
+			pageSize=10; 
+		}
+		 Map<String, Object> params=new HashMap<String,Object>();
+		 params.put("uid", TokenManager.getUserId());
+		return (Pagination<DemandListBo>) findPage("findInterestedDemand", "findInterestedDemandCount", params, pageNo, pageSize);
+	}
 	
 	
 	}

+ 354 - 192
src/main/java/com/goafanti/portal/controller/PortalInterestApiController.java

@@ -1,192 +1,354 @@
-package com.goafanti.portal.controller;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.goafanti.achievement.service.AchievementInterestService;
-import com.goafanti.achievement.service.AchievementService;
-import com.goafanti.common.bo.Result;
-import com.goafanti.common.constant.ErrorConstants;
-import com.goafanti.common.controller.CertifyApiController;
-import com.goafanti.common.enums.AchievementAuditStatus;
-import com.goafanti.common.enums.AchievementReleaseStatus;
-import com.goafanti.common.enums.DeleteStatus;
-import com.goafanti.common.enums.DemandAuditStatus;
-import com.goafanti.common.enums.DemandReleaseStatus;
-import com.goafanti.common.model.Achievement;
-import com.goafanti.common.model.AchievementInterest;
-import com.goafanti.common.model.Demand;
-import com.goafanti.common.model.DemandInterest;
-import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.demand.service.DemandInterestService;
-import com.goafanti.demand.service.DemandService;
-
-@RestController
-@RequestMapping(value = "/api/user/portal")
-public class PortalInterestApiController extends CertifyApiController{
-	@Resource
-	private AchievementService			achievementService;
-	@Resource
-	private DemandService				demandService;
-	@Resource
-	private AchievementInterestService	achievementInterestService;
-	@Resource
-	private DemandInterestService		demandInterestService;
-	
-	/**
-	 * 科技需求"感兴趣列表"
-	 */
-	@RequestMapping(value = "/demandInterestList", method = RequestMethod.GET)
-	public Result demandInterestList(String pageNo, String pageSize){
-		Result res = new Result();
-		Integer pNo = 1;
-		Integer pSize = 10;
-		if (StringUtils.isNumeric(pageSize)) {
-			pSize = Integer.parseInt(pageSize);
-		}
-		if (StringUtils.isNumeric(pageNo)) {
-			pNo = Integer.parseInt(pageNo);
-		}
-		res.setData(demandInterestService.listDemandInterest(pNo, pSize));
-		return res;
-	}
-
-	/**
-	 * 科技成果"感兴趣列表"
-	 */
-	@RequestMapping(value = "/achievementInterestList", method = RequestMethod.GET)
-	private Result achievementInterestList(String pageNo, String pageSize) {
-		Result res = new Result();
-		Integer pNo = 1;
-		Integer pSize = 10;
-		if (StringUtils.isNumeric(pageSize)) {
-			pSize = Integer.parseInt(pageSize);
-		}
-		if (StringUtils.isNumeric(pageNo)) {
-			pNo = Integer.parseInt(pageNo);
-		}
-		res.setData(achievementInterestService.listAchievementInterest(pNo, pSize));
-		return res;
-	}
-
-	/**
-	 * 科技需求取消关注
-	 * 
-	 */
-	@RequestMapping(value = "/demandCancelInterest", method = RequestMethod.POST)
-	public Result demandCancelInterest(String id) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
-			return res;
-		}
-		res.setData(demandInterestService.saveCancelDemandInterest(id));
-		return res;
-	}
-
-	/**
-	 * 科技需求关注
-	 */
-	@RequestMapping(value = "/demandInterest", method = RequestMethod.POST)
-	public Result demandInterest(String id) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
-			return res;
-		}
-
-		DemandInterest di = demandInterestService.selectDemandInterestByUidAndDemandId(TokenManager.getUserId(), id);
-		if (null != di) {
-			res.getError().add(buildError("", "当前科技需求已关注!"));
-			return res;
-		}
-		Demand d = demandService.selectByPrimaryKey(id);
-		if (null == d || d.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
-				|| !d.getAuditStatus().equals(DemandAuditStatus.AUDITED.getCode())
-				|| !d.getReleaseStatus().equals(DemandReleaseStatus.RELEASED.getCode())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
-			return res;
-		}
-		res.setData(demandInterestService.saveAchievementInterest(id));
-		return res;
-	}
-
-	/**
-	 * 科技成果取消关注
-	 * 
-	 */
-	@RequestMapping(value = "/achievementCancelInterest", method = RequestMethod.POST)
-	public Result achievementCancelInterest(String id) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
-			return res;
-		}
-		res.setData(achievementInterestService.saveCancelAchievementInterest(id));
-		return res;
-	}
-
-	/**
-	 * 科技成果关注
-	 */
-	@RequestMapping(value = "/achievementInterest", method = RequestMethod.POST)
-	public Result achievementInterest(String id) {
-		Result res = new Result();
-
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "科技成果ID"));
-			return res;
-		}
-
-		AchievementInterest ai = achievementInterestService
-				.selectAchievementInterestByUidAndAchievementId(TokenManager.getUserId(), id);
-		if (null != ai) {
-			res.getError().add(buildError("", "当前科技成果已关注!"));
-			return res;
-		}
-
-		Achievement a = achievementService.selectByPrimaryKey(id);
-		if (null == a || a.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
-				|| !a.getAuditStatus().equals(AchievementAuditStatus.AUDITED.getCode())
-				|| !a.getReleaseStatus().equals(AchievementReleaseStatus.RELEASED.getCode())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "成果ID"));
-			return res;
-		}
-		res.setData(achievementInterestService.saveAchievementInterest(id));
-		return res;
-	}
-
-	
-	/**
-	 * 科技成果详情
-	 */
-	@RequestMapping(value = "/achievementDetail", method = RequestMethod.GET)
-	public Result achievementDetail(String id) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
-			return res;
-		}
-		res.setData(achievementService.selectAchievementDetail(TokenManager.getUserId(), id));
-		return res;
-	}
-
-	/**
-	 * 科技需求详情
-	 */
-	@RequestMapping(value = "/demandDetail", method = RequestMethod.GET)
-	public Result demandDetail(String id) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
-			return res;
-		}
-		res.setData(demandService.selectDemandDetail(TokenManager.getUserId(), id));
-		return res;
-	}
-
-}
+package com.goafanti.portal.controller;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.annotation.Resource;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.achievement.service.AchievementInterestService;
+import com.goafanti.achievement.service.AchievementService;
+import com.goafanti.business.service.JtBusinessService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.dao.ProjectInterestMapper;
+import com.goafanti.common.enums.AchievementAuditStatus;
+import com.goafanti.common.enums.AchievementReleaseStatus;
+import com.goafanti.common.enums.DeleteStatus;
+import com.goafanti.common.enums.DemandAuditStatus;
+import com.goafanti.common.enums.DemandReleaseStatus;
+import com.goafanti.common.model.Achievement;
+import com.goafanti.common.model.AchievementInterest;
+import com.goafanti.common.model.Demand;
+import com.goafanti.common.model.DemandInterest;
+import com.goafanti.common.model.JtBusinessProject;
+import com.goafanti.common.model.ProjectInterest;
+import com.goafanti.common.model.UserInterest;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.demand.service.DemandInterestService;
+import com.goafanti.demand.service.DemandService;
+import com.goafanti.user.bo.UserIdentityBo;
+import com.goafanti.user.service.UserIdentityService;
+import com.goafanti.user.service.UserInterestService;
+import com.goafanti.user.service.UserService;
+
+@RestController
+@RequestMapping(value = "/api/user/portal")
+public class PortalInterestApiController extends CertifyApiController{
+	@Resource
+	private AchievementService			achievementService;
+	@Resource
+	private DemandService				demandService;
+	@Resource
+	private AchievementInterestService	achievementInterestService;
+	@Resource
+	private DemandInterestService		demandInterestService;
+	@Resource
+	private JtBusinessService			jtBusinessService;
+	@Resource
+	private ProjectInterestMapper				projectInterestMapper;
+	@Resource
+	private UserInterestService					userInterestService;
+	@Resource UserIdentityService				userIdentityService ;
+	/**
+	 * 科技需求"感兴趣列表"
+	 */
+	@RequestMapping(value = "/demandInterestList", method = RequestMethod.GET)
+	public Result demandInterestList(String pageNo, String pageSize){
+		Result res = new Result();
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(demandInterestService.listDemandInterest(pNo, pSize));
+		return res;
+	}
+
+	/**
+	 * 科技成果"感兴趣列表"
+	 */
+	@RequestMapping(value = "/achievementInterestList", method = RequestMethod.GET)
+	private Result achievementInterestList(String pageNo, String pageSize) {
+		Result res = new Result();
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(achievementInterestService.listAchievementInterest(pNo, pSize));
+		return res;
+	}
+
+	/**
+	 * 科技需求取消关注
+	 * 
+	 */
+	@RequestMapping(value = "/demandCancelInterest", method = RequestMethod.POST)
+	public Result demandCancelInterest(String id) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+		res.setData(demandInterestService.saveCancelDemandInterest(id));
+		return res;
+	}
+
+	/**
+	 * 科技需求关注
+	 */
+	@RequestMapping(value = "/demandInterest", method = RequestMethod.POST)
+	public Result demandInterest(String id) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+
+		DemandInterest di = demandInterestService.selectDemandInterestByUidAndDemandId(TokenManager.getUserId(), id);
+		if (null != di) {
+			res.getError().add(buildError("", "当前科技需求已关注!"));
+			return res;
+		}
+		Demand d = demandService.selectByPrimaryKey(id);
+		if (null == d || d.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
+				|| !d.getAuditStatus().equals(DemandAuditStatus.AUDITED.getCode())
+				|| !d.getReleaseStatus().equals(DemandReleaseStatus.RELEASED.getCode())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
+			return res;
+		}
+		res.setData(demandInterestService.saveAchievementInterest(id));
+		return res;
+	}
+
+	/**
+	 * 科技成果取消关注
+	 * 
+	 */
+	@RequestMapping(value = "/achievementCancelInterest", method = RequestMethod.POST)
+	public Result achievementCancelInterest(String id) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
+			return res;
+		}
+		res.setData(achievementInterestService.saveCancelAchievementInterest(id));
+		return res;
+	}
+
+	/**
+	 * 科技成果关注
+	 */
+	@RequestMapping(value = "/achievementInterest", method = RequestMethod.POST)
+	public Result achievementInterest(String id) {
+		Result res = new Result();
+
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "科技成果ID"));
+			return res;
+		}
+
+		AchievementInterest ai = achievementInterestService
+				.selectAchievementInterestByUidAndAchievementId(TokenManager.getUserId(), id);
+		if (null != ai) {
+			res.getError().add(buildError("", "当前科技成果已关注!"));
+			return res;
+		}
+
+		Achievement a = achievementService.selectByPrimaryKey(id);
+		if (null == a || a.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
+				|| !a.getAuditStatus().equals(AchievementAuditStatus.AUDITED.getCode())
+				|| !a.getReleaseStatus().equals(AchievementReleaseStatus.RELEASED.getCode())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "成果ID"));
+			return res;
+		}
+		res.setData(achievementInterestService.saveAchievementInterest(id));
+		return res;
+	}
+
+	
+	/**
+	 * 科技成果详情
+	 */
+	@RequestMapping(value = "/achievementDetail", method = RequestMethod.GET)
+	public Result achievementDetail(String id) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
+			return res;
+		}
+		res.setData(achievementService.selectAchievementDetail(TokenManager.getUserId(), id));
+		return res;
+	}
+
+	/**
+	 * 科技需求详情
+	 */
+	@RequestMapping(value = "/demandDetail", method = RequestMethod.GET)
+	public Result demandDetail(String id) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+		res.setData(demandService.selectDemandDetail(TokenManager.getUserId(), id));
+		return res;
+	}
+	
+	/*
+	 * 服务项目取消关注
+	 * */
+	@RequestMapping(value="/projectCancelInterest",method=RequestMethod.POST)
+	public Result projectCancelInterest(String id) {
+		Result result=new Result();
+		if(StringUtils.isBlank(id)) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return result;
+		}
+		if(StringUtils.isBlank(TokenManager.getUserId())) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
+			return result;
+		}
+		result.setData(projectInterestMapper.deleteInterest(TokenManager.getUserId(), id));
+		return result;
+	}
+	
+	/*
+	 * 服务项目关注
+	 * */
+	@RequestMapping(value="/projectInterest",method=RequestMethod.POST)
+	public Result projectInterest(String id) {
+		Result result=new Result();
+		if(StringUtils.isBlank(id)) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return result;
+		}
+		if(StringUtils.isBlank(TokenManager.getUserId())) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
+			return result;
+		}
+		ProjectInterest projectInterest=new ProjectInterest();
+		projectInterest.setCreateTime(new Date());
+		projectInterest.setId(UUID.randomUUID().toString());
+		projectInterest.setProjectId(id);
+		projectInterest.setUid(TokenManager.getUserId());
+		result.setData(projectInterestMapper.insert(projectInterest));
+		return result;
+	}
+	
+	/*
+	 * 服务-关注列表
+	 * */
+	@RequestMapping(value="/listProjectIInterestedIn",method=RequestMethod.GET)
+	public Result listProjectIInterestedIn(Integer pageNo,Integer pageSize) {
+		Result result=new Result();
+		if(StringUtils.isBlank(TokenManager.getUserId())) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
+			return result;
+		}
+		result.setData(jtBusinessService.listProjectIInterestedIn(pageNo,pageSize));
+		return result;
+	}
+	
+	/*
+	 * 成果关注列表
+	 * */
+	@RequestMapping(value="/listAchievementIInterestedIn",method=RequestMethod.GET)
+	public Result listAchievementIInterestedIn(Integer pageNo,Integer pageSize) {
+		Result result=new Result();
+		if(StringUtils.isBlank(TokenManager.getUserId())) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
+			return result;
+		}
+
+		result.setData(achievementService.listInterestedAchievement(pageNo, pageSize));
+		return result;
+		
+	}
+	
+	/*
+	 * 需求关注列表
+	 * */
+	@RequestMapping(value="/listDemandIInterestedIn",method=RequestMethod.GET)
+	public Result listDemandIInterestedIn(Integer pageNo,Integer pageSize) {
+		Result result=new Result();
+		if(StringUtils.isBlank(TokenManager.getUserId())) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
+			return result;
+		}
+		result.setData(demandService.listInterestedAchievement(pageNo, pageSize));
+		return result;
+		
+	}
+	
+	/*
+	 * 关注专家
+	 * */
+	@RequestMapping(value="/expertInterest",method=RequestMethod.POST)
+	public Result expertInterest(String id) {
+		Result result=new Result();
+		if(StringUtils.isBlank(id)) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "专家ID"));
+			return result;
+		}
+		if(StringUtils.isBlank(TokenManager.getUserId())) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
+			return result;
+		}
+//		UserInterest userInterest=new UserInterest();
+//		userInterest.setCreateTime(new Date());
+//		userInterest.setId(UUID.randomUUID().toString());
+//		userInterest.setFromUid(TokenManager.getUserId());
+//		userInterest.setToUid(id);
+		userInterestService.insert(id);
+		return result;
+	}
+	
+	/*
+	 * 取消关注专家
+	 * */
+	@RequestMapping(value="/expertCancelInterest",method=RequestMethod.POST)
+	public Result expertCancelInterest(String id) {
+		Result result=new Result();
+		if(StringUtils.isBlank(id)) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "专家ID"));
+			return result;
+		}
+		if(StringUtils.isBlank(TokenManager.getUserId())) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
+			return result;
+		}
+		UserInterest userInterest=userInterestService.findByFromUidAndToUid(TokenManager.getUserId(), id);
+		if(userInterest!=null && userInterest.getId()!=null)
+		userInterestService.deleteByPrimaryKey(userInterest.getId());
+		return result;
+	}
+	
+	/*
+	 * 专家-关注列表
+	 * */
+	@RequestMapping(value="/listInterestedInExpert",method=RequestMethod.GET)
+	public Result listExpertIInterestedIn(Integer pageNo,Integer pageSize) {
+		Result result=new Result();
+		if(StringUtils.isBlank(TokenManager.getUserId())) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
+			return result;
+		}
+		result.setData(userIdentityService.listInterestedDemand(pageNo,pageSize));
+		return result;
+	}
+
+}

+ 2 - 1
src/main/java/com/goafanti/user/service/UserIdentityService.java

@@ -64,5 +64,6 @@ public interface UserIdentityService {
 	List<consultantListBo> getConsultantList(int size);
 	
 	List<ReletivelyIndustry>selectIndustryReletively();
-	
+
+	Pagination<UserIdentityBo>listInterestedDemand(Integer pageNo,Integer pageSize);
 }

+ 62 - 58
src/main/java/com/goafanti/user/service/UserService.java

@@ -1,58 +1,62 @@
-package com.goafanti.user.service;
-
-import java.util.List;
-import java.util.Map;
-
-import com.goafanti.app.bo.UserBasicInfo;
-import com.goafanti.common.model.User;
-import com.goafanti.user.bo.OrgUnitNames;
-import com.goafanti.user.bo.UserBaseBo;
-import com.goafanti.user.bo.UserDownLoadBo;
-import com.goafanti.user.bo.UserNames;
-import com.goafanti.user.bo.UserPageHomeBo;
-import com.goafanti.user.bo.UserPartnerDetailBo;
-
-public interface UserService {
-
-	User selectByPrimaryKey(String userId);
-
-	String selectNumberByPrimaryKey(String userId);
-
-	int updateByPrimaryKeySelective(User u);
-
-	User insert(User user);
-
-	User selectByMobieAndType(String mobile, Integer type);
-	
-	User selectByNameAndType(String username, Integer type);
-
-	User insertRegister(User user, String unitName, String contacts);
-
-	UserBaseBo selectUserBase(String userId);
-	
-	UserPageHomeBo selectUserPageHomeBoByUserId(String userId);
-
-	UserDownLoadBo selectUserDownLoadBoByUserId(String userId);
-
-	List<OrgUnitNames> selectDemandUnitNames();
-
-	List<UserNames> selectDemandUserNames();
-
-	Map<String, String> selectAchievementUserOwner(String name);
-
-	List<OrgUnitNames> selectAchievementOrgOwner(String name);
-
-	String findUserNameByNameAndMobile(String name, String mobile);
-
-	String findOrgNameByNameAndMobile(String name, String mobile);
-
-	UserBasicInfo selectBaseInfo();
-	
-	User selectByNumber(String easemobName);
-	
-	List<User> selectUserByRoleName(String roleName);
-	
-	UserPartnerDetailBo findUserPartnerDetail(String uid);
-	
-	List<UserPartnerDetailBo> findUserPartner();
-}
+package com.goafanti.user.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.goafanti.app.bo.UserBasicInfo;
+import com.goafanti.common.model.User;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.user.bo.OrgUnitNames;
+import com.goafanti.user.bo.UserBaseBo;
+import com.goafanti.user.bo.UserDownLoadBo;
+import com.goafanti.user.bo.UserIdentityBo;
+import com.goafanti.user.bo.UserNames;
+import com.goafanti.user.bo.UserPageHomeBo;
+import com.goafanti.user.bo.UserPartnerDetailBo;
+
+public interface UserService {
+
+	User selectByPrimaryKey(String userId);
+
+	String selectNumberByPrimaryKey(String userId);
+
+	int updateByPrimaryKeySelective(User u);
+
+	User insert(User user);
+
+	User selectByMobieAndType(String mobile, Integer type);
+	
+	User selectByNameAndType(String username, Integer type);
+
+	User insertRegister(User user, String unitName, String contacts);
+
+	UserBaseBo selectUserBase(String userId);
+	
+	UserPageHomeBo selectUserPageHomeBoByUserId(String userId);
+
+	UserDownLoadBo selectUserDownLoadBoByUserId(String userId);
+
+	List<OrgUnitNames> selectDemandUnitNames();
+
+	List<UserNames> selectDemandUserNames();
+
+	Map<String, String> selectAchievementUserOwner(String name);
+
+	List<OrgUnitNames> selectAchievementOrgOwner(String name);
+
+	String findUserNameByNameAndMobile(String name, String mobile);
+
+	String findOrgNameByNameAndMobile(String name, String mobile);
+
+	UserBasicInfo selectBaseInfo();
+	
+	User selectByNumber(String easemobName);
+	
+	List<User> selectUserByRoleName(String roleName);
+	
+	UserPartnerDetailBo findUserPartnerDetail(String uid);
+	
+	List<UserPartnerDetailBo> findUserPartner();
+	
+	
+}

+ 14 - 0
src/main/java/com/goafanti/user/service/impl/UserIdentityServiceImpl.java

@@ -475,6 +475,20 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 		return industryCategoryMapper.selectIndustryReletively();
 	}
 	
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<UserIdentityBo> listInterestedDemand(Integer pageNo, Integer pageSize) {
+		// TODO Auto-generated method stub
+		if(pageNo==null || pageNo<1) {
+			pageNo=1;
+		}
+		if(pageSize==null ||pageSize<1) {
+			pageSize=10; 
+		}
+		 Map<String, Object> params=new HashMap<String,Object>();
+		 params.put("uid", TokenManager.getUserId());
+		return (Pagination<UserIdentityBo>) findPage("listInterestedExpert", "listInterestedExpertCount", params, pageNo, pageSize);
+	}
 	
 
 }

+ 226 - 220
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -1,220 +1,226 @@
-package com.goafanti.user.service.impl;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.goafanti.app.bo.UserBasicInfo;
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.OrganizationIdentityMapper;
-import com.goafanti.common.dao.UserIdentityMapper;
-import com.goafanti.common.dao.UserMapper;
-import com.goafanti.common.model.User;
-import com.goafanti.core.mybatis.BaseMybatisDao;
-import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.user.bo.OrgUnitNames;
-import com.goafanti.user.bo.UserBaseBo;
-import com.goafanti.user.bo.UserDownLoadBo;
-import com.goafanti.user.bo.UserNames;
-import com.goafanti.user.bo.UserPageHomeBo;
-import com.goafanti.user.bo.UserPartnerDetailBo;
-import com.goafanti.user.service.UserService;
-
-@Service
-public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserService {
-	@Autowired
-	private UserMapper						userMapper;
-	@Autowired
-	private OrganizationIdentityMapper		organizationIdentityMapper;
-	@Autowired
-	private UserIdentityMapper				userIdentityMapper;
-	@Override
-	@Transactional
-	public User insertRegister(User user, String unitName, String userName) {
-		userMapper.insert(user);
-		/*if (null != user.getType() && UserType.ORGANIZATION.getCode().equals(user.getType())) {
-			OrganizationIdentity organizationIdentity = new OrganizationIdentity();
-			organizationIdentity.setUid(user.getId());
-			organizationIdentity.setUnitName(StringUtils.isBlank(unitName) ? "" : unitName);
-			organizationIdentity.setId(UUID.randomUUID().toString());
-			organizationIdentity.setIdentityType(0);
-			organizationIdentity.setAuditStatus(0);
-			organizationIdentity.setProcess(0);
-			organizationIdentity.setWrongCount(0);
-			organizationIdentity.setListed(0);
-			organizationIdentity.setListedType(0);
-			organizationIdentityMapper.insert(organizationIdentity);
-		}
-		if (null != user.getType() && UserType.PERSONAL.getCode().equals(user.getType())) {
-			UserIdentity ui = new UserIdentity();
-			ui.setId(UUID.randomUUID().toString());
-			ui.setUid(user.getId());
-			ui.setAuditStatus(0);
-			ui.setProcess(0);
-			ui.setWrongCount(0);
-			ui.setUsername(StringUtils.isBlank(userName) ? "" : userName);
-			userIdentityMapper.insert(ui);
-		}*/
-		return user;
-	}
-
-	@Override
-	public User selectByMobieAndType(String mobile, Integer type) {
-		return userMapper.selectByMobieAndType(mobile, type);
-	}
-
-	@Override
-	public User selectByNameAndType(String username, Integer type){
-		return userMapper.selectByNameAndType(username,type);
-	}
-	
-	@Override
-	public User selectByPrimaryKey(String id) {
-		return userMapper.selectByPrimaryKey(id);
-	}
-
-	@Override
-	public int updateByPrimaryKeySelective(User u) {
-		return userMapper.updateByPrimaryKeySelective(u);
-	}
-
-	@Override
-	public User insert(User user) {
-		userMapper.insert(user);
-		return user;
-	}
-
-	@Override
-	public UserPageHomeBo selectUserPageHomeBoByUserId(String uid) {
-		UserBaseBo baseBo = userMapper.selectUserBaseByUserId(uid);
-		UserPageHomeBo homeBo = new UserPageHomeBo();
-		/*homeBo.setPatentNum(patentInfoMapper.findPatentInfoNumByUid(uid));
-		homeBo.setCopyrightNum(copyrightInfoMapper.findCopyrightInfoNumByUid(uid));
-		homeBo.setTechProjectNum(techProjectMapper.findTechProjectNumByUid(uid));
-		homeBo.setIntellectualPropertyNum(orgIntellectualPropertyMapper.findIntellectualPropertyNum(uid));*/
-		BeanUtils.copyProperties(baseBo, homeBo);
-		return homeBo;
-	}
-
-	@Override
-	public UserDownLoadBo selectUserDownLoadBoByUserId(String id) {
-		return userMapper.selectUserDownLoadBoByUserId(id);
-	}
-
-	@Override
-	public List<OrgUnitNames> selectDemandUnitNames() {
-		String aid = TokenManager.getAdminId();
-		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
-			return organizationIdentityMapper.selectManagerUnitNames(aid);
-		} else {
-			if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
-				aid = null;
-			}
-			return organizationIdentityMapper.selectAllOrgIndentity(aid);
-		}
-	}
-
-	@Override
-	public List<UserNames> selectDemandUserNames() {
-		String aid = TokenManager.getAdminId();
-		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
-			return userIdentityMapper.selectManagerUserNames(aid);
-		} else {
-			if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
-				aid = null;
-			}
-			return userIdentityMapper.selectAllUserNames(aid);
-		}
-	}
-
-	@Override
-	public Map<String, String> selectAchievementUserOwner(String name) {
-		String aid = TokenManager.getAdminId();
-		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
-			return disposeAchievementUserOwner(userIdentityMapper.selectManagerAchievementUserOwner(aid, name));
-		} else {
-			if (TokenManager.hasRole(AFTConstants.SUPERADMIN) || TokenManager.hasRole(AFTConstants.TECHBROKER)
-					|| TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
-				aid = null;
-			}
-			return disposeAchievementUserOwner(userIdentityMapper.selectAchievementUserOwner(aid, name));
-		}
-	}
-
-	public List<OrgUnitNames> selectAchievementOrgOwner(String name) {
-		String aid = TokenManager.getAdminId();
-		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
-			return organizationIdentityMapper.selectManagerAchievementOrgOwner(aid, name);
-		} else {
-			if (TokenManager.hasRole(AFTConstants.SUPERADMIN) || TokenManager.hasRole(AFTConstants.TECHBROKER)
-					|| TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
-				aid = null;
-			}
-			return organizationIdentityMapper.selectAchievementOrgOwner(aid, name);
-		}
-	}
-
-	private Map<String, String> disposeAchievementUserOwner(List<UserNames> list) {
-		Map<String, String> map = new HashMap<>();
-		if (null != list && list.size() > 0) {
-			for (UserNames u : list) {
-				map.put(u.getUid(), u.getUsername() + " " + u.getMobile());
-			}
-		}
-		return map;
-	}
-
-	@Override
-	public String findUserNameByNameAndMobile(String name, String mobile) {
-		return userMapper.findUserByNameAndMobile(name, mobile);
-	}
-
-	@Override
-	public String findOrgNameByNameAndMobile(String name, String mobile) {
-		return userMapper.findOrgByNameAndMobile(name, mobile);
-	}
-
-
-	@Override
-	@Cacheable(value = "UserNumberCache", key = "'UserNumberCache:UID:'+#userId")
-	public String selectNumberByPrimaryKey(String userId) {
-		return String.valueOf(userMapper.selectNumberByPrimaryKey(userId));
-	}	
-
-	@Override
-	public UserBasicInfo selectBaseInfo() {
-		if(TokenManager.getToken() instanceof User)return userMapper.selectBaseInfo(TokenManager.getUserId());
-		return null;
-	}
-	@Override
-	public List<User> selectUserByRoleName(String roleName){
-		return userMapper.selectUserByRoleName(roleName);
-	}
-
-	@Override
-	public User selectByNumber(String easemobName) {
-		return userMapper.selectByNumber(easemobName);
-	}
-
-	@Override
-	public UserBaseBo selectUserBase(String userId) {
-		 
-		return userMapper.selectUserBaseByUserId(userId);
-	}
-	
-	@Override
-	public UserPartnerDetailBo findUserPartnerDetail(String uid) {
-		return userMapper.findUserPartnerDetail(uid);
-	}
-	
-	@Override
-	public List<UserPartnerDetailBo> findUserPartner() {
-		return userMapper.findUserPartner();
-	}
-}
+package com.goafanti.user.service.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.goafanti.app.bo.UserBasicInfo;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.OrganizationIdentityMapper;
+import com.goafanti.common.dao.UserIdentityMapper;
+import com.goafanti.common.dao.UserMapper;
+import com.goafanti.common.model.User;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.user.bo.OrgUnitNames;
+import com.goafanti.user.bo.UserBaseBo;
+import com.goafanti.user.bo.UserDownLoadBo;
+import com.goafanti.user.bo.UserIdentityBo;
+import com.goafanti.user.bo.UserNames;
+import com.goafanti.user.bo.UserPageHomeBo;
+import com.goafanti.user.bo.UserPartnerDetailBo;
+import com.goafanti.user.service.UserService;
+
+@Service
+public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserService {
+	@Autowired
+	private UserMapper						userMapper;
+	@Autowired
+	private OrganizationIdentityMapper		organizationIdentityMapper;
+	@Autowired
+	private UserIdentityMapper				userIdentityMapper;
+	@Override
+	@Transactional
+	public User insertRegister(User user, String unitName, String userName) {
+		userMapper.insert(user);
+		/*if (null != user.getType() && UserType.ORGANIZATION.getCode().equals(user.getType())) {
+			OrganizationIdentity organizationIdentity = new OrganizationIdentity();
+			organizationIdentity.setUid(user.getId());
+			organizationIdentity.setUnitName(StringUtils.isBlank(unitName) ? "" : unitName);
+			organizationIdentity.setId(UUID.randomUUID().toString());
+			organizationIdentity.setIdentityType(0);
+			organizationIdentity.setAuditStatus(0);
+			organizationIdentity.setProcess(0);
+			organizationIdentity.setWrongCount(0);
+			organizationIdentity.setListed(0);
+			organizationIdentity.setListedType(0);
+			organizationIdentityMapper.insert(organizationIdentity);
+		}
+		if (null != user.getType() && UserType.PERSONAL.getCode().equals(user.getType())) {
+			UserIdentity ui = new UserIdentity();
+			ui.setId(UUID.randomUUID().toString());
+			ui.setUid(user.getId());
+			ui.setAuditStatus(0);
+			ui.setProcess(0);
+			ui.setWrongCount(0);
+			ui.setUsername(StringUtils.isBlank(userName) ? "" : userName);
+			userIdentityMapper.insert(ui);
+		}*/
+		return user;
+	}
+
+	@Override
+	public User selectByMobieAndType(String mobile, Integer type) {
+		return userMapper.selectByMobieAndType(mobile, type);
+	}
+
+	@Override
+	public User selectByNameAndType(String username, Integer type){
+		return userMapper.selectByNameAndType(username,type);
+	}
+	
+	@Override
+	public User selectByPrimaryKey(String id) {
+		return userMapper.selectByPrimaryKey(id);
+	}
+
+	@Override
+	public int updateByPrimaryKeySelective(User u) {
+		return userMapper.updateByPrimaryKeySelective(u);
+	}
+
+	@Override
+	public User insert(User user) {
+		userMapper.insert(user);
+		return user;
+	}
+
+	@Override
+	public UserPageHomeBo selectUserPageHomeBoByUserId(String uid) {
+		UserBaseBo baseBo = userMapper.selectUserBaseByUserId(uid);
+		UserPageHomeBo homeBo = new UserPageHomeBo();
+		/*homeBo.setPatentNum(patentInfoMapper.findPatentInfoNumByUid(uid));
+		homeBo.setCopyrightNum(copyrightInfoMapper.findCopyrightInfoNumByUid(uid));
+		homeBo.setTechProjectNum(techProjectMapper.findTechProjectNumByUid(uid));
+		homeBo.setIntellectualPropertyNum(orgIntellectualPropertyMapper.findIntellectualPropertyNum(uid));*/
+		BeanUtils.copyProperties(baseBo, homeBo);
+		return homeBo;
+	}
+
+	@Override
+	public UserDownLoadBo selectUserDownLoadBoByUserId(String id) {
+		return userMapper.selectUserDownLoadBoByUserId(id);
+	}
+
+	@Override
+	public List<OrgUnitNames> selectDemandUnitNames() {
+		String aid = TokenManager.getAdminId();
+		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
+			return organizationIdentityMapper.selectManagerUnitNames(aid);
+		} else {
+			if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
+				aid = null;
+			}
+			return organizationIdentityMapper.selectAllOrgIndentity(aid);
+		}
+	}
+
+	@Override
+	public List<UserNames> selectDemandUserNames() {
+		String aid = TokenManager.getAdminId();
+		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
+			return userIdentityMapper.selectManagerUserNames(aid);
+		} else {
+			if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
+				aid = null;
+			}
+			return userIdentityMapper.selectAllUserNames(aid);
+		}
+	}
+
+	@Override
+	public Map<String, String> selectAchievementUserOwner(String name) {
+		String aid = TokenManager.getAdminId();
+		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
+			return disposeAchievementUserOwner(userIdentityMapper.selectManagerAchievementUserOwner(aid, name));
+		} else {
+			if (TokenManager.hasRole(AFTConstants.SUPERADMIN) || TokenManager.hasRole(AFTConstants.TECHBROKER)
+					|| TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
+				aid = null;
+			}
+			return disposeAchievementUserOwner(userIdentityMapper.selectAchievementUserOwner(aid, name));
+		}
+	}
+
+	public List<OrgUnitNames> selectAchievementOrgOwner(String name) {
+		String aid = TokenManager.getAdminId();
+		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
+			return organizationIdentityMapper.selectManagerAchievementOrgOwner(aid, name);
+		} else {
+			if (TokenManager.hasRole(AFTConstants.SUPERADMIN) || TokenManager.hasRole(AFTConstants.TECHBROKER)
+					|| TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
+				aid = null;
+			}
+			return organizationIdentityMapper.selectAchievementOrgOwner(aid, name);
+		}
+	}
+
+	private Map<String, String> disposeAchievementUserOwner(List<UserNames> list) {
+		Map<String, String> map = new HashMap<>();
+		if (null != list && list.size() > 0) {
+			for (UserNames u : list) {
+				map.put(u.getUid(), u.getUsername() + " " + u.getMobile());
+			}
+		}
+		return map;
+	}
+
+	@Override
+	public String findUserNameByNameAndMobile(String name, String mobile) {
+		return userMapper.findUserByNameAndMobile(name, mobile);
+	}
+
+	@Override
+	public String findOrgNameByNameAndMobile(String name, String mobile) {
+		return userMapper.findOrgByNameAndMobile(name, mobile);
+	}
+
+
+	@Override
+	@Cacheable(value = "UserNumberCache", key = "'UserNumberCache:UID:'+#userId")
+	public String selectNumberByPrimaryKey(String userId) {
+		return String.valueOf(userMapper.selectNumberByPrimaryKey(userId));
+	}	
+
+	@Override
+	public UserBasicInfo selectBaseInfo() {
+		if(TokenManager.getToken() instanceof User)return userMapper.selectBaseInfo(TokenManager.getUserId());
+		return null;
+	}
+	@Override
+	public List<User> selectUserByRoleName(String roleName){
+		return userMapper.selectUserByRoleName(roleName);
+	}
+
+	@Override
+	public User selectByNumber(String easemobName) {
+		return userMapper.selectByNumber(easemobName);
+	}
+
+	@Override
+	public UserBaseBo selectUserBase(String userId) {
+		 
+		return userMapper.selectUserBaseByUserId(userId);
+	}
+	
+	@Override
+	public UserPartnerDetailBo findUserPartnerDetail(String uid) {
+		return userMapper.findUserPartnerDetail(uid);
+	}
+	
+	@Override
+	public List<UserPartnerDetailBo> findUserPartner() {
+		return userMapper.findUserPartner();
+	}
+
+
+	
+	
+}