Explorar el Código

Merge remote-tracking branch 'origin/test'

Michael_9527 hace 8 años
padre
commit
fdd68d9c19
Se han modificado 21 ficheros con 929 adiciones y 140 borrados
  1. 1 1
      generatorConfig.xml
  2. 6 1
      src/main/java/com/goafanti/common/dao/UserBusinessMapper.java
  3. 11 11
      src/main/java/com/goafanti/common/dao/UserFollowBusinessMapper.java
  4. 24 1
      src/main/java/com/goafanti/common/dao/UserMapper.java
  5. 0 1
      src/main/java/com/goafanti/common/enums/MarketingPage.java
  6. 1 1
      src/main/java/com/goafanti/common/mapper/ContractMapper.xml
  7. 63 16
      src/main/java/com/goafanti/common/mapper/UserBusinessMapper.xml
  8. 52 20
      src/main/java/com/goafanti/common/mapper/UserFollowBusinessMapper.xml
  9. 65 11
      src/main/java/com/goafanti/common/mapper/UserMapperExt.xml
  10. 61 15
      src/main/java/com/goafanti/common/model/UserFollowBusiness.java
  11. 146 16
      src/main/java/com/goafanti/common/model/UserFollowBusinessExample.java
  12. 31 6
      src/main/java/com/goafanti/customer/bo/BusinessListBo.java
  13. 40 1
      src/main/java/com/goafanti/customer/bo/BussinessFollowBo.java
  14. 18 9
      src/main/java/com/goafanti/customer/bo/FollowBusinessBo.java
  15. 9 0
      src/main/java/com/goafanti/customer/bo/FollowListBo.java
  16. 67 2
      src/main/java/com/goafanti/customer/controller/BusinessApiController.java
  17. 38 4
      src/main/java/com/goafanti/customer/controller/CustomerApiController.java
  18. 37 1
      src/main/java/com/goafanti/customer/service/BusinessService.java
  19. 31 2
      src/main/java/com/goafanti/customer/service/CustomerService.java
  20. 91 7
      src/main/java/com/goafanti/customer/service/impl/BusinessServiceImpl.java
  21. 137 14
      src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

+ 1 - 1
generatorConfig.xml

@@ -8,6 +8,6 @@
     <javaModelGenerator targetPackage="com.goafanti.common.model" targetProject="AFT" />
     <sqlMapGenerator targetPackage="com.goafanti.common.mapper" targetProject="AFT" />
     <javaClientGenerator targetPackage="com.goafanti.common.dao" targetProject="AFT" type="XMLMAPPER" />
-    <table schema="aft" tableName="organization_contact_book"/>
+    <table schema="aft" tableName="user_follow_business"/>
   </context>
 </generatorConfiguration>

+ 6 - 1
src/main/java/com/goafanti/common/dao/UserBusinessMapper.java

@@ -3,6 +3,7 @@ package com.goafanti.common.dao;
 import com.goafanti.common.model.UserBusiness;
 import com.goafanti.common.model.UserBusinessExample;
 import com.goafanti.customer.bo.BusinessListBo;
+import com.goafanti.customer.bo.BussinessFollowBo;
 
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
@@ -79,5 +80,9 @@ public interface UserBusinessMapper {
 
 	int judgeBusiness(@Param("uid")String uid,@Param("businessGlossoryId")Integer businessGlossoryId,@Param("aid")String aid);
 
-	List<UserBusiness> findBusinessByUAid(String uid, String aid);
+	List<UserBusiness> findBusinessByUAid(@Param("uid")String uid, @Param("aid")String aid);
+
+	BussinessFollowBo findBusinessDetail(@Param("businessId")String businessId);
+
+	BussinessFollowBo findFollowOneBusiness(@Param("ufbId") String ufbId);
 }

+ 11 - 11
src/main/java/com/goafanti/common/dao/UserFollowBusinessMapper.java

@@ -9,69 +9,69 @@ public interface UserFollowBusinessMapper {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	long countByExample(UserFollowBusinessExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	int deleteByExample(UserFollowBusinessExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	int deleteByPrimaryKey(String id);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	int insert(UserFollowBusiness record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	int insertSelective(UserFollowBusiness record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	List<UserFollowBusiness> selectByExample(UserFollowBusinessExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	UserFollowBusiness selectByPrimaryKey(String id);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	int updateByExampleSelective(@Param("record") UserFollowBusiness record,
 			@Param("example") UserFollowBusinessExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	int updateByExample(@Param("record") UserFollowBusiness record,
 			@Param("example") UserFollowBusinessExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	int updateByPrimaryKeySelective(UserFollowBusiness record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	int updateByPrimaryKey(UserFollowBusiness record);
 }

+ 24 - 1
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
 
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.User;
+import com.goafanti.common.model.UserBusiness;
 import com.goafanti.user.bo.OrgPartnerDetailBo;
 import com.goafanti.user.bo.UserDownLoadBo;
 import com.goafanti.user.bo.UserPageHomeBo;
@@ -15,6 +16,7 @@ import com.goafanti.common.model.UserExample;
 import com.goafanti.customer.bo.CustomerOrganizationDetailBo;
 import com.goafanti.customer.bo.CustomerPersonalDetailBo;
 import com.goafanti.customer.bo.CustomerSimpleBo;
+import com.goafanti.customer.bo.FollowBusinessBo;
 
 public interface UserMapper {
 	/**
@@ -108,7 +110,7 @@ public interface UserMapper {
 	 * @param name
 	 * @return
 	 */
-	List<CustomerSimpleBo> findCustomerByName(@Param("name")String name);
+	List<CustomerSimpleBo> findCustomerByName(@Param("identifyName")String identifyName);
 
 	/**
 	 * 判断客户是否存在
@@ -146,4 +148,25 @@ public interface UserMapper {
 	 */
 	List<OrganizationContactBook> findCustomerContacts(@Param("uid")String uid,@Param("aid")String aid);
 
+	/**
+	 * 查询拜访详情
+	 * @param followId
+	 * @return
+	 */
+	FollowBusinessBo findFollowById(String followId);
+
+	/**
+	 * 查询单次拜访推进的客户业务
+	 * @param followId
+	 * @return
+	 */
+	List<UserBusiness> findBusinessByFollowId(String followId);
+
+	/**
+	 * 查询客户所有联系人
+	 * @param uid
+	 * @return
+	 */
+	List<OrganizationContactBook> findAllContacts(String uid);
+
 }

+ 0 - 1
src/main/java/com/goafanti/common/enums/MarketingPage.java

@@ -4,7 +4,6 @@ public enum MarketingPage {
 	mainAchievement("/index",1,5), //首页成果
 	mainDemand("/index",2,5),	// 首页需求
 	mainPolicy("/index",6,3); //首页政策
-	
 	MarketingPage(String pageUrl,Integer boothType,Integer boothSize){
 		this.boothSize = boothSize;
 		this.pageUrl = pageUrl;

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

@@ -379,7 +379,7 @@
    <if test="type !=null">
     and c.type = #{type,jdbcType=INTEGER}
   </if>
-   <if test="uid !=null">ContractDetail
+   <if test="uid !=null">
     and c.uid = #{uid,jdbcType=INTEGER}
   </if>
    <if test="status !=null">

+ 63 - 16
src/main/java/com/goafanti/common/mapper/UserBusinessMapper.xml

@@ -352,7 +352,7 @@
 	  select
 		c.name as businessName,
 		b.identify_name as identifyName,
-		a.id,
+		a.id as businessId,
 		a.create_time as createTime,
 		a.follow_situation as followSituation,
 		a.customer_status as customerStatus,
@@ -362,27 +362,30 @@
 		a.uid = b.id left join business_glossory c on
 		a.business_glossory_id = c.id left join admin d on
 		a.uid = d.id
-	where a.aid = #{adminId,jdbcType=VARCHAR}
+	where a.aid = #{aid,jdbcType=VARCHAR}
+	<if test="uid != null and uid !=''">
+		and a.uid = #{uid,jdbcType=VARCHAR}
+	</if>
 	<if test="businessId !=null and businessId != ''">
-		and c.id = #{businessId,jdbcType=VARCHAR}
+		and a.business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
 	</if>
 	<if test="identifyName != null and identifyName != ''">
-		b.identify_name = #{identifyName,jdbcType=VARCHAR}
+		and b.identify_name = #{identifyName,jdbcType=VARCHAR}
 	</if>
 	<if test="followSituation != null">
-		a.follow_situation = #{followSituation,jdbcType=INTEGER}
+		and a.follow_situation = #{followSituation,jdbcType=INTEGER}
 	</if>
 	<if test="customerStatus != null">
-		a.customer_status = #{customerStatus,jdbcType=INTEGER}
+		and a.customer_status = #{customerStatus,jdbcType=INTEGER}
 	</if>
 	<if test="adminName != null and adminName != ''">
-		d.name = #{adminName,jdbcType=VARCHAR}
+		and d.name = #{adminName,jdbcType=VARCHAR}
 	</if>
 	<if test="startDate != null and startDate != ''">
-		and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
+		and and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
 	</if>
 	<if test="endDate != null and endDate != ''">
-		and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
+		and and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
 	</if>
 	<if test="page_sql != null">
     	${page_sql}
@@ -396,21 +399,24 @@
 		a.uid = b.id left join business_glossory c on
 		a.business_glossory_id = c.id left join admin d on
 		a.uid = d.id
-	where a.aid = #{adminId,jdbcType=VARCHAR}
+	where a.aid = #{aid,jdbcType=VARCHAR}
+	<if test="uid != null and uid !=''">
+		and a.uid = #{uid,jdbcType=VARCHAR}
+	</if>
 	<if test="businessId !=null and businessId != ''">
 		and c.id = #{businessId,jdbcType=VARCHAR}
 	</if>
 	<if test="identifyName != null and identifyName != ''">
-		b.identify_name = #{identifyName,jdbcType=VARCHAR}
+		and b.identify_name = #{identifyName,jdbcType=VARCHAR}
 	</if>
 	<if test="followSituation != null">
-		a.follow_situation = #{followSituation,jdbcType=INTEGER}
+		and a.follow_situation = #{followSituation,jdbcType=INTEGER}
 	</if>
 	<if test="customerStatus != null">
-		a.customer_status = #{customerStatus,jdbcType=INTEGER}
+		and a.customer_status = #{customerStatus,jdbcType=INTEGER}
 	</if>
 	<if test="adminName != null and adminName != ''">
-		d.name = #{adminName,jdbcType=VARCHAR}
+		and d.name = #{adminName,jdbcType=VARCHAR}
 	</if>
 	<if test="startDate != null and startDate != ''">
 		and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
@@ -421,7 +427,7 @@
   </select>
   
   <select id="findBusinessGlossory" resultType="com.goafanti.customer.bo.BusinessListBo">
-  	select id as businessId,name as businessName from business_glossory
+  	select id as businessGlossoryId,name as businessName from business_glossory
   </select>
   
   <select id="judgeBusiness" resultType="java.lang.Integer">
@@ -436,7 +442,48 @@
   </select>
   
   <select id="findBusinessByUAid"  parameterType="java.lang.String" resultMap="BaseResultMap">
-  	select select id,uid,business_glossory_id,follow_situation,customer_status,remarks from user_business
+  	select id,uid,business_glossory_id,follow_situation,customer_status,remarks from user_business
   	where  uid = #{uid,jdbcType=VARCHAR} and aid = #{aid,jdbcType=VARCHAR}
   </select>
+  
+  <select id="findBusinessDetail" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BussinessFollowBo">
+	select
+		a.id as businessId,
+		a.uid,
+		a.business_glossory_id as businessGlossoryId,
+		a.create_time as createTime,
+		a.follow_situation as followSituation,
+		a.customer_status as customerStatus,
+		a.remarks,
+		b.identify_name as identifyName,
+		c.name as adminName
+	from
+		user_business a left join user b on
+		a.uid = b.id left join admin c on
+		a.aid = c.id
+	where a.id = #{businessId,jdbcType=VARCHAR}
+  </select>
+  
+  <select id="findFollowOneBusiness" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BussinessFollowBo">
+	select
+		a.customer_status as customerStatus,
+		a.follow_situation as followSituation,
+		a.remarks,
+		b.id as followId,
+		b.create_time as createTime,
+		b.business_glossory_id as businessGlossoryId,
+		b.result,
+		d.name as contacts,
+		d.mobile as contactMobile,
+		b.create_time as followTime,
+		e.name as adminName,
+		f.name as identifyName
+	from
+		user_follow_business a 
+	left join user_follow b on a.follow_id = b.id
+	left join user_business c on a.business_id = c.id
+	left join organization_contact_book d on b.ocb_id = d.id
+	left join admin e on b.aid = e.id
+	left join user f on b.uid = f.id
+  </select>
 </mapper>

+ 52 - 20
src/main/java/com/goafanti/common/mapper/UserFollowBusinessMapper.xml

@@ -5,19 +5,21 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     <id column="id" jdbcType="VARCHAR" property="id" />
     <result column="follow_id" jdbcType="VARCHAR" property="followId" />
     <result column="business_id" jdbcType="VARCHAR" property="businessId" />
     <result column="follow_situation" jdbcType="INTEGER" property="followSituation" />
     <result column="customer_status" jdbcType="INTEGER" property="customerStatus" />
+    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+    <result column="business_glossory_id" jdbcType="INTEGER" property="businessGlossoryId" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     <where>
       <foreach collection="oredCriteria" item="criteria" separator="or">
@@ -51,7 +53,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     <where>
       <foreach collection="example.oredCriteria" item="criteria" separator="or">
@@ -85,15 +87,15 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
-    id, follow_id, business_id, follow_situation, customer_status
+    id, follow_id, business_id, follow_situation, customer_status, remarks, business_glossory_id
   </sql>
   <select id="selectByExample" parameterType="com.goafanti.common.model.UserFollowBusinessExample" resultMap="BaseResultMap">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     select
     <if test="distinct">
@@ -112,7 +114,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     select 
     <include refid="Base_Column_List" />
@@ -123,7 +125,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     delete from user_follow_business
     where id = #{id,jdbcType=VARCHAR}
@@ -132,7 +134,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     delete from user_follow_business
     <if test="_parameter != null">
@@ -143,18 +145,20 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     insert into user_follow_business (id, follow_id, business_id, 
-      follow_situation, customer_status)
+      follow_situation, customer_status, remarks, 
+      business_glossory_id)
     values (#{id,jdbcType=VARCHAR}, #{followId,jdbcType=VARCHAR}, #{businessId,jdbcType=VARCHAR}, 
-      #{followSituation,jdbcType=INTEGER}, #{customerStatus,jdbcType=INTEGER})
+      #{followSituation,jdbcType=INTEGER}, #{customerStatus,jdbcType=INTEGER}, #{remarks,jdbcType=VARCHAR}, 
+      #{businessGlossoryId,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.UserFollowBusiness">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     insert into user_follow_business
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -173,6 +177,12 @@
       <if test="customerStatus != null">
         customer_status,
       </if>
+      <if test="remarks != null">
+        remarks,
+      </if>
+      <if test="businessGlossoryId != null">
+        business_glossory_id,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -190,13 +200,19 @@
       <if test="customerStatus != null">
         #{customerStatus,jdbcType=INTEGER},
       </if>
+      <if test="remarks != null">
+        #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="businessGlossoryId != null">
+        #{businessGlossoryId,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.goafanti.common.model.UserFollowBusinessExample" resultType="java.lang.Long">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     select count(*) from user_follow_business
     <if test="_parameter != null">
@@ -207,7 +223,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     update user_follow_business
     <set>
@@ -226,6 +242,12 @@
       <if test="record.customerStatus != null">
         customer_status = #{record.customerStatus,jdbcType=INTEGER},
       </if>
+      <if test="record.remarks != null">
+        remarks = #{record.remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="record.businessGlossoryId != null">
+        business_glossory_id = #{record.businessGlossoryId,jdbcType=INTEGER},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -235,14 +257,16 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     update user_follow_business
     set id = #{record.id,jdbcType=VARCHAR},
       follow_id = #{record.followId,jdbcType=VARCHAR},
       business_id = #{record.businessId,jdbcType=VARCHAR},
       follow_situation = #{record.followSituation,jdbcType=INTEGER},
-      customer_status = #{record.customerStatus,jdbcType=INTEGER}
+      customer_status = #{record.customerStatus,jdbcType=INTEGER},
+      remarks = #{record.remarks,jdbcType=VARCHAR},
+      business_glossory_id = #{record.businessGlossoryId,jdbcType=INTEGER}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -251,7 +275,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     update user_follow_business
     <set>
@@ -267,6 +291,12 @@
       <if test="customerStatus != null">
         customer_status = #{customerStatus,jdbcType=INTEGER},
       </if>
+      <if test="remarks != null">
+        remarks = #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="businessGlossoryId != null">
+        business_glossory_id = #{businessGlossoryId,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -274,13 +304,15 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Nov 10 19:10:10 CST 2017.
+      This element was generated on Sat Nov 18 16:17:07 CST 2017.
     -->
     update user_follow_business
     set follow_id = #{followId,jdbcType=VARCHAR},
       business_id = #{businessId,jdbcType=VARCHAR},
       follow_situation = #{followSituation,jdbcType=INTEGER},
-      customer_status = #{customerStatus,jdbcType=INTEGER}
+      customer_status = #{customerStatus,jdbcType=INTEGER},
+      remarks = #{remarks,jdbcType=VARCHAR},
+      business_glossory_id = #{businessGlossoryId,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>
 </mapper>

+ 65 - 11
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -266,8 +266,8 @@
 	</select>
 	
 	<select id="findCustomerByName" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerSimpleBo">
-		select id,name from user where name like
-		concat('%',#{identify_name},'%')
+		select id,identify_name as name from user where identify_name like
+		concat(#{identifyName},'%')
 	</select>
 	
 	<select id="judgeCustomerByName" parameterType="java.lang.String" resultType="java.lang.Integer">
@@ -317,33 +317,50 @@
 			b.identify_name as identityName,
 			c.name,
 			c.mobile,
-			d.name as adminName 
+			d.name as adminName
+		<if test="businessGlossoryId != null and businessGlossoryId != ''"><!--  客户甲项目A所有的跟进记录 -->
+			,e.id as ufbId
+		</if>
 		from user_follow a
 		left join user b on a.uid = b.id 
 		left join organization_contact_book c on a.ocb_id = c.id
 		left join admin d on a.aid = d.id
+		<if test="businessGlossoryId != null and businessGlossoryId != ''"><!--  客户甲项目A所有的跟进记录 -->
+			right join user_follow_business e on a.id = e.follow_id
+		</if>
+		where a.effective = 0
 		<if test="uid != null and uid != ''">
-			a.uid = #{uid,jdbcType=VARCHAR}
+			and a.uid = #{uid,jdbcType=VARCHAR}
 		</if>
 		<if test="aid != null and aid != ''">
-			a.aid = #{adid,jdbcType=VARCHAR}
+			and a.aid = #{adid,jdbcType=VARCHAR}
+		</if>
+		<if test="businessGlossoryId != null and businessGlossoryId != ''"><!--  客户甲项目A所有的跟进记录 -->
+			and e.businessGlossoryId = #{businessGlossoryId,jdbcType=VARCHAR}
 		</if>
 		<if test="page_sql != null">
     		${page_sql}
    		 </if>
 	</select>
-	<select id="selectFollowHistoryCount">
+	<select id="selectFollowHistoryCount" resultType="java.lang.Integer">
 		select 
 			count(0)
 		from user_follow a
 		left join user b on a.uid = b.id 
 		left join organization_contact_book c on a.ocb_id = c.id
 		left join admin d on a.aid = d.id
+		<if test="businessGlossoryId != null and businessGlossoryId != ''"><!--  客户甲项目A所有的跟进记录 -->
+			right join user_follow_business e on a.id = e.follow_id
+		</if>
+		where a.effective = 0
 		<if test="uid != null and uid != ''">
-			a.uid = #{uid,jdbcType=VARCHAR}
+			and a.uid = #{uid,jdbcType=VARCHAR}
 		</if>
 		<if test="aid != null and aid != ''">
-			a.aid = #{adid,jdbcType=VARCHAR}
+			and a.aid = #{adid,jdbcType=VARCHAR}
+		</if>
+		<if test="businessGlossoryId != null and businessGlossoryId != ''"><!--  客户甲项目A所有的跟进记录 -->
+			and e.businessGlossoryId = #{businessGlossoryId,jdbcType=VARCHAR}
 		</if>
 	</select>
 	
@@ -361,15 +378,52 @@
 			current_member_status currentMemberStatus,
 			service_certification as  serviceCertification,
 			user_certification as userCertification,
-			identify_name as identifyName
+			identify_name as identifyName,
+			status
 		from
 			user
 		where id = #{uid,jdbcType=VARCHAR}
 	</select>
 	
 	<select id="findCustomerContacts" parameterType="java.lang.String" resultType="com.goafanti.common.model.OrganizationContactBook">
-		select id as ocbId,name from organization_contact_book 
+		select id,name,mobile from organization_contact_book 
 		where uid = #{uid,jdbcType=VARCHAR} and aid = #{aid,jdbcType=VARCHAR}
 	</select>
-		
+	
+	<select id="findAllContacts" parameterType="java.lang.String" resultType="com.goafanti.common.model.OrganizationContactBook">
+		select id,name,mobile from organization_contact_book 
+		where uid = #{uid,jdbcType=VARCHAR}
+		group by name
+	</select>
+	
+	<select id="findFollowById" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.FollowBusinessBo">
+		select
+			a.id as followId,
+			a.uid,
+			a.ocb_id as ocbId,
+			a.contact_type as contactType,
+			a.result,
+			a.create_time as followTime,
+			b.identify_name as identifyName,
+			c.name as contacts,
+			d.name as adminName
+		from
+			user_follow a
+		left join user b on a.uid = b.id
+		left join organization_contact_book c on a.ocb_id = c.id
+		left join admin d on a.aid = d.id
+		where a.id = #{followId,jdbcType=VARCHAR}
+	</select>
+
+	<select id="findBusinessByFollowId" parameterType="java.lang.String" resultType="com.goafanti.common.model.UserBusiness">
+		select
+		a.id,
+		a.follow_situation as followSituation,
+		a.customer_status as customerStatus,
+		a.remarks,
+		a.business_glossory_id as businessGlossoryId
+		from
+		user_follow_business a
+		where a.id = #{followId,jdbcType=VARCHAR}
+	</select>
 </mapper>

+ 61 - 15
src/main/java/com/goafanti/common/model/UserFollowBusiness.java

@@ -4,34 +4,44 @@ public class UserFollowBusiness {
 
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column user_follow_business.id
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	private String id;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column user_follow_business.follow_id
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	private String followId;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column user_follow_business.business_id
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	private String businessId;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column user_follow_business.follow_situation
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	private Integer followSituation;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column user_follow_business.customer_status
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	private Integer customerStatus;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column user_follow_business.remarks
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
+	 */
+	private String remarks;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column user_follow_business.business_glossory_id
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
+	 */
+	private Integer businessGlossoryId;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column user_follow_business.id
 	 * @return  the value of user_follow_business.id
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public String getId() {
 		return id;
@@ -40,7 +50,7 @@ public class UserFollowBusiness {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column user_follow_business.id
 	 * @param id  the value for user_follow_business.id
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public void setId(String id) {
 		this.id = id;
@@ -49,7 +59,7 @@ public class UserFollowBusiness {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column user_follow_business.follow_id
 	 * @return  the value of user_follow_business.follow_id
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public String getFollowId() {
 		return followId;
@@ -58,7 +68,7 @@ public class UserFollowBusiness {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column user_follow_business.follow_id
 	 * @param followId  the value for user_follow_business.follow_id
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public void setFollowId(String followId) {
 		this.followId = followId;
@@ -67,7 +77,7 @@ public class UserFollowBusiness {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column user_follow_business.business_id
 	 * @return  the value of user_follow_business.business_id
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public String getBusinessId() {
 		return businessId;
@@ -76,7 +86,7 @@ public class UserFollowBusiness {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column user_follow_business.business_id
 	 * @param businessId  the value for user_follow_business.business_id
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public void setBusinessId(String businessId) {
 		this.businessId = businessId;
@@ -85,7 +95,7 @@ public class UserFollowBusiness {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column user_follow_business.follow_situation
 	 * @return  the value of user_follow_business.follow_situation
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public Integer getFollowSituation() {
 		return followSituation;
@@ -94,7 +104,7 @@ public class UserFollowBusiness {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column user_follow_business.follow_situation
 	 * @param followSituation  the value for user_follow_business.follow_situation
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public void setFollowSituation(Integer followSituation) {
 		this.followSituation = followSituation;
@@ -103,7 +113,7 @@ public class UserFollowBusiness {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column user_follow_business.customer_status
 	 * @return  the value of user_follow_business.customer_status
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public Integer getCustomerStatus() {
 		return customerStatus;
@@ -112,9 +122,45 @@ public class UserFollowBusiness {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column user_follow_business.customer_status
 	 * @param customerStatus  the value for user_follow_business.customer_status
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public void setCustomerStatus(Integer customerStatus) {
 		this.customerStatus = customerStatus;
 	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column user_follow_business.remarks
+	 * @return  the value of user_follow_business.remarks
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
+	 */
+	public String getRemarks() {
+		return remarks;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column user_follow_business.remarks
+	 * @param remarks  the value for user_follow_business.remarks
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
+	 */
+	public void setRemarks(String remarks) {
+		this.remarks = remarks;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column user_follow_business.business_glossory_id
+	 * @return  the value of user_follow_business.business_glossory_id
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
+	 */
+	public Integer getBusinessGlossoryId() {
+		return businessGlossoryId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column user_follow_business.business_glossory_id
+	 * @param businessGlossoryId  the value for user_follow_business.business_glossory_id
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
+	 */
+	public void setBusinessGlossoryId(Integer businessGlossoryId) {
+		this.businessGlossoryId = businessGlossoryId;
+	}
 }

+ 146 - 16
src/main/java/com/goafanti/common/model/UserFollowBusinessExample.java

@@ -6,23 +6,23 @@ import java.util.List;
 public class UserFollowBusinessExample {
     /**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	protected String orderByClause;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	protected boolean distinct;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	protected List<Criteria> oredCriteria;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public UserFollowBusinessExample() {
 		oredCriteria = new ArrayList<Criteria>();
@@ -30,7 +30,7 @@ public class UserFollowBusinessExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public void setOrderByClause(String orderByClause) {
 		this.orderByClause = orderByClause;
@@ -38,7 +38,7 @@ public class UserFollowBusinessExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public String getOrderByClause() {
 		return orderByClause;
@@ -46,7 +46,7 @@ public class UserFollowBusinessExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public void setDistinct(boolean distinct) {
 		this.distinct = distinct;
@@ -54,7 +54,7 @@ public class UserFollowBusinessExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public boolean isDistinct() {
 		return distinct;
@@ -62,7 +62,7 @@ public class UserFollowBusinessExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public List<Criteria> getOredCriteria() {
 		return oredCriteria;
@@ -70,7 +70,7 @@ public class UserFollowBusinessExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public void or(Criteria criteria) {
 		oredCriteria.add(criteria);
@@ -78,7 +78,7 @@ public class UserFollowBusinessExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public Criteria or() {
 		Criteria criteria = createCriteriaInternal();
@@ -88,7 +88,7 @@ public class UserFollowBusinessExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public Criteria createCriteria() {
 		Criteria criteria = createCriteriaInternal();
@@ -100,7 +100,7 @@ public class UserFollowBusinessExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	protected Criteria createCriteriaInternal() {
 		Criteria criteria = new Criteria();
@@ -109,7 +109,7 @@ public class UserFollowBusinessExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public void clear() {
 		oredCriteria.clear();
@@ -119,7 +119,7 @@ public class UserFollowBusinessExample {
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	protected abstract static class GeneratedCriteria {
 		protected List<Criterion> criteria;
@@ -491,11 +491,141 @@ public class UserFollowBusinessExample {
 			addCriterion("customer_status not between", value1, value2, "customerStatus");
 			return (Criteria) this;
 		}
+
+		public Criteria andRemarksIsNull() {
+			addCriterion("remarks is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksIsNotNull() {
+			addCriterion("remarks is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksEqualTo(String value) {
+			addCriterion("remarks =", value, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksNotEqualTo(String value) {
+			addCriterion("remarks <>", value, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksGreaterThan(String value) {
+			addCriterion("remarks >", value, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksGreaterThanOrEqualTo(String value) {
+			addCriterion("remarks >=", value, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksLessThan(String value) {
+			addCriterion("remarks <", value, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksLessThanOrEqualTo(String value) {
+			addCriterion("remarks <=", value, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksLike(String value) {
+			addCriterion("remarks like", value, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksNotLike(String value) {
+			addCriterion("remarks not like", value, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksIn(List<String> values) {
+			addCriterion("remarks in", values, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksNotIn(List<String> values) {
+			addCriterion("remarks not in", values, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksBetween(String value1, String value2) {
+			addCriterion("remarks between", value1, value2, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andRemarksNotBetween(String value1, String value2) {
+			addCriterion("remarks not between", value1, value2, "remarks");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdIsNull() {
+			addCriterion("business_glossory_id is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdIsNotNull() {
+			addCriterion("business_glossory_id is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdEqualTo(Integer value) {
+			addCriterion("business_glossory_id =", value, "businessGlossoryId");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdNotEqualTo(Integer value) {
+			addCriterion("business_glossory_id <>", value, "businessGlossoryId");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdGreaterThan(Integer value) {
+			addCriterion("business_glossory_id >", value, "businessGlossoryId");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdGreaterThanOrEqualTo(Integer value) {
+			addCriterion("business_glossory_id >=", value, "businessGlossoryId");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdLessThan(Integer value) {
+			addCriterion("business_glossory_id <", value, "businessGlossoryId");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdLessThanOrEqualTo(Integer value) {
+			addCriterion("business_glossory_id <=", value, "businessGlossoryId");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdIn(List<Integer> values) {
+			addCriterion("business_glossory_id in", values, "businessGlossoryId");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdNotIn(List<Integer> values) {
+			addCriterion("business_glossory_id not in", values, "businessGlossoryId");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdBetween(Integer value1, Integer value2) {
+			addCriterion("business_glossory_id between", value1, value2, "businessGlossoryId");
+			return (Criteria) this;
+		}
+
+		public Criteria andBusinessGlossoryIdNotBetween(Integer value1, Integer value2) {
+			addCriterion("business_glossory_id not between", value1, value2, "businessGlossoryId");
+			return (Criteria) this;
+		}
 	}
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table user_follow_business
-	 * @mbg.generated  Fri Nov 10 19:10:10 CST 2017
+	 * @mbg.generated  Sat Nov 18 16:17:07 CST 2017
 	 */
 	public static class Criterion {
 		private String condition;

+ 31 - 6
src/main/java/com/goafanti/customer/bo/BusinessListBo.java

@@ -1,9 +1,9 @@
 package com.goafanti.customer.bo;
 
 public class BusinessListBo {
+	/** 客户ID **/
+	private String uid;
 	/** 客户业务ID **/
-	private String id;
-	/** 业务字典ID **/
 	private String businessId;
 	/** 业务名称 **/
 	private String businessName;
@@ -13,17 +13,24 @@ public class BusinessListBo {
 	private String followSituation;
 	/** 客户状态 **/
 	private String customerStatus;
+	/** 营销员ID **/
+	private String aid;
 	/** 营销员名字 **/
 	private String adminName;
 	/** 开始时间 **/
 	private String startDate;
 	/** 结束时间 **/
 	private String endDate;
-	public String getId() {
-		return id;
+	/** 业务创建时间 **/
+	private String createTime;
+	/** 业务字典ID **/
+	private String businessGlossoryId;
+	
+	public String getUid() {
+		return uid;
 	}
-	public void setId(String id) {
-		this.id = id;
+	public void setUid(String uid) {
+		this.uid = uid;
 	}
 	public String getBusinessId() {
 		return businessId;
@@ -49,6 +56,12 @@ public class BusinessListBo {
 	public void setFollowSituation(String followSituation) {
 		this.followSituation = followSituation;
 	}
+	public String getAid() {
+		return aid;
+	}
+	public void setAid(String aid) {
+		this.aid = aid;
+	}
 	public String getCustomerStatus() {
 		return customerStatus;
 	}
@@ -73,4 +86,16 @@ public class BusinessListBo {
 	public void setEndDate(String endDate) {
 		this.endDate = endDate;
 	}
+	public String getCreateTime() {
+		return createTime;
+	}
+	public void setCreateTime(String createTime) {
+		this.createTime = createTime;
+	}
+	public String getBusinessGlossoryId() {
+		return businessGlossoryId;
+	}
+	public void setBusinessGlossoryId(String businessGlossoryId) {
+		this.businessGlossoryId = businessGlossoryId;
+	}
 }

+ 40 - 1
src/main/java/com/goafanti/customer/bo/BussinessFollowBo.java

@@ -8,6 +8,8 @@ package com.goafanti.customer.bo;
 public class BussinessFollowBo {
 	/** 客户ID **/
 	private String uid;
+	/** 客户名 **/
+	private String identifyName;
 	/** 客户业务ID **/
 	private String businessId;
 	/** 意向服务ID **/
@@ -18,6 +20,8 @@ public class BussinessFollowBo {
 	private String customerStatus;
 	/** 创建时间 **/
 	private String createTime;
+	/** 拜访记录ID **/
+	private String followId;
 	/** 跟进时间 **/
 	private String followTime;
 	/** 营销员ID **/
@@ -30,13 +34,24 @@ public class BussinessFollowBo {
 	private String remarks;
 	/** 拜访结果 **/
 	private String result;
-	
+	/** 当前联系人姓名 **/
+	private String contacts;
+	/** 当前联系人号码 **/
+	private String contactMobile;
+	/** 客户甲的项目A对应的拜访记录ID **/
+	private String ufbId;
 	public String getUid() {
 		return uid;
 	}
 	public void setUid(String uid) {
 		this.uid = uid;
 	}
+	public String getIdentifyName() {
+		return identifyName;
+	}
+	public void setIdentifyName(String identifyName) {
+		this.identifyName = identifyName;
+	}
 	public String getBusinessId() {
 		return businessId;
 	}
@@ -67,6 +82,12 @@ public class BussinessFollowBo {
 	public void setCreateTime(String createTime) {
 		this.createTime = createTime;
 	}
+	public String getFollowId() {
+		return followId;
+	}
+	public void setFollowId(String followId) {
+		this.followId = followId;
+	}
 	public String getFollowTime() {
 		return followTime;
 	}
@@ -103,4 +124,22 @@ public class BussinessFollowBo {
 	public void setResult(String result) {
 		this.result = result;
 	}
+	public String getContacts() {
+		return contacts;
+	}
+	public void setContacts(String contacts) {
+		this.contacts = contacts;
+	}
+	public String getContactMobile() {
+		return contactMobile;
+	}
+	public void setContactMobile(String contactMobile) {
+		this.contactMobile = contactMobile;
+	}
+	public String getUfbId() {
+		return ufbId;
+	}
+	public void setUfbId(String ufbId) {
+		this.ufbId = ufbId;
+	}
 }

+ 18 - 9
src/main/java/com/goafanti/customer/bo/FollowBusinessBo.java

@@ -10,24 +10,33 @@ import com.goafanti.common.model.UserBusiness;
  *
  */
 public class FollowBusinessBo {
+	/** 拜访记录ID **/
+	private String followId;
 	/** 客户ID **/
 	private String uid;
 	/** 客户名 **/
 	private String identityName;
 	/** 当前联系人姓名 **/
 	private String contacts;
-	/** 新的联系人 **/
-	private String contactMobile;
 	/** 需要保存的联系人ID **/
 	private String ocbId;
-	/** 联系方式 **/
+	/** 拜访方式 **/
 	private String contactType;
 	/** 拜访结果 **/
 	private String result;
 	/** 拜访时间 **/
 	private String followTime;
+	/** 拜访人 **/
+	private String adminName;
 	/** 业务意向列表 **/
 	private List<UserBusiness> userBusinessList;
+	
+	public String getFollowId() {
+		return followId;
+	}
+	public void setFollowId(String followId) {
+		this.followId = followId;
+	}
 	public String getUid() {
 		return uid;
 	}
@@ -46,12 +55,6 @@ public class FollowBusinessBo {
 	public void setContacts(String contacts) {
 		this.contacts = contacts;
 	}
-	public String getContactMobile() {
-		return contactMobile;
-	}
-	public void setContactMobile(String contactMobile) {
-		this.contactMobile = contactMobile;
-	}
 	public String getOcbId() {
 		return ocbId;
 	}
@@ -76,6 +79,12 @@ public class FollowBusinessBo {
 	public void setFollowTime(String followTime) {
 		this.followTime = followTime;
 	}
+	public String getAdminName() {
+		return adminName;
+	}
+	public void setAdminName(String adminName) {
+		this.adminName = adminName;
+	}
 	public List<UserBusiness> getUserBusinessList() {
 		return userBusinessList;
 	}

+ 9 - 0
src/main/java/com/goafanti/customer/bo/FollowListBo.java

@@ -22,6 +22,9 @@ public class FollowListBo {
 	/** 拜访人姓名 **/
 	private String adminName;
 	
+	/** user_follow_business ID **/ 
+	private String ufbId;
+	
 	public String getFollowId() {
 		return followId;
 	}
@@ -64,4 +67,10 @@ public class FollowListBo {
 	public void setAdminName(String adminName) {
 		this.adminName = adminName;
 	}
+	public String getUfbId() {
+		return ufbId;
+	}
+	public void setUfbId(String ufbId) {
+		this.ufbId = ufbId;
+	}
 }

+ 67 - 2
src/main/java/com/goafanti/customer/controller/BusinessApiController.java

@@ -1,5 +1,6 @@
 package com.goafanti.customer.controller;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
@@ -33,6 +34,7 @@ public class BusinessApiController extends BaseController{
 		res.setData(businessService.listBusiness(blo, pageNo, pageSize));
 		return res;
 	}
+	
 	/** 查询业务字典 **/
 	@RequestMapping(value = "/findBusinessGlossory",method = RequestMethod.GET)
 	public Result findBusinessGlossory(){
@@ -53,7 +55,11 @@ public class BusinessApiController extends BaseController{
 			res.getError().add(new Error("该项业务已经被跟进"));
 			return res;
 		}
-		businessService.addBusinessAndFollow(bfb);
+		try {
+			businessService.addBusinessAndFollow(bfb);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
 		return res;
 	}
 	
@@ -69,5 +75,64 @@ public class BusinessApiController extends BaseController{
 		res.setData(bo);
 		return res;
 	}
-
+	
+	/** 进入修改业务意向 **/
+	@RequestMapping(value = "/toUpdateBusiness", method = RequestMethod.GET)
+	public Result toUpdateBusiness(String businessId){
+		Result res = new Result();
+		res.setData(businessService.findBusinessDetail(businessId));
+		return res;
+	}
+	
+	/** 修改业务意向 **/
+	@RequestMapping(value = "/updateBusiness", method = RequestMethod.POST)
+	public Result updateBusiness(BussinessFollowBo bfb){
+		Result res = new Result();
+		businessService.updateBusiness(bfb);
+		return res;
+	}
+	
+	/** 进入跟进单个客户意向 **/
+	@RequestMapping(value = "/toAddFollowOneBusiness", method = RequestMethod.GET)
+	public Result toAddFollowOneBusiness(String businessId){
+		Result res = new Result();
+		res.setData(businessService.findBusinessDetail(businessId));
+		return res;
+	}
+	
+	/** 跟进单个客户意向 **/
+	@RequestMapping(value = "/addFollowOneBusiness", method = RequestMethod.POST)
+	public Result addFollowOneBusiness(BussinessFollowBo bfb){
+		Result res = new Result();
+		if(StringUtils.isBlank(bfb.getBusinessId()) ||
+				StringUtils.isBlank(bfb.getUid()) || StringUtils.isBlank(bfb.getOcbId())){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
+			return res;
+		}
+		try {
+			businessService.addFollowOneBusiness(bfb);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return res;
+	}
+	
+	/** 进入修改某个客户一个业务的当次拜访 **/
+	@RequestMapping(value = "/toUpdateFollowOneBusiness", method = RequestMethod.GET)
+	public Result toUpdateFollowOneBusiness(String ufbId){
+		Result res = new Result();
+		res.setData(businessService.findFollowOneBusiness(ufbId));
+		return res;
+	}
+	
+	/** 修改某个客户一个业务的当次拜访 **/
+	@RequestMapping(value = "/updateFollowOneBusiness", method = RequestMethod.GET)
+	public Result updateFollowOneBusiness(BussinessFollowBo bfb){
+		Result res = new Result();
+		if(StringUtils.isBlank(bfb.getFollowId()) || StringUtils.isBlank(bfb.getUfbId())){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
+		}
+		businessService.updateFollowOneBusiness(bfb);
+		return res;
+	}
 }

+ 38 - 4
src/main/java/com/goafanti/customer/controller/CustomerApiController.java

@@ -1,6 +1,7 @@
 package com.goafanti.customer.controller;
 
 import java.lang.reflect.InvocationTargetException;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
@@ -10,7 +11,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.goafanti.common.bo.Error;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
@@ -128,9 +128,9 @@ public class CustomerApiController extends BaseController{
 	
 	/** 查看跟进记录 **/
 	@RequestMapping(value = "/listFollowHistory", method = RequestMethod.GET)
-	public Result listFollowHistory(Integer pageNo, Integer pageSize,String uid){
+	public Result listFollowHistory(Integer pageNo, Integer pageSize,String uid,String businessGlossoryId){
 		Result res = new Result();
-		res.setData(customerService.listFollowHistory(pageNo,pageSize,uid));
+		res.setData(customerService.listFollowHistory(pageNo,pageSize,uid,businessGlossoryId));
 		return res;
 	}
 	
@@ -186,7 +186,41 @@ public class CustomerApiController extends BaseController{
 	@RequestMapping(value = "/addFollow", method = RequestMethod.POST)
 	public Result addFollow(FollowBusinessBo fbb){
 		Result res =  new Result();
-		customerService.addFollow(fbb);
+		try {
+			customerService.addFollow(fbb);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return res;
+	}
+	
+	/** 进入修改拜访记录 **/
+	@RequestMapping(value = "/toUpdateFollow", method = RequestMethod.GET)
+	public Result toUpdateFollow(String followId){
+		Result res = new Result();
+		FollowBusinessBo fbb = customerService.findFollowById(followId);
+		fbb.setUserBusinessList(customerService.findBusinessByFollowId(followId));
+		res.setData(fbb);
+		return res;
+	}
+	
+	/** 修改拜访记录 **/ 
+	@RequestMapping(value = "/updateFollow", method = RequestMethod.POST)
+	public Result updateFollow(FollowBusinessBo fbb){
+		Result res = new Result();
+		try {
+			customerService.updateFollow(fbb);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return res;
+	}
+	
+	/** 查询客户的所有联系人 **/ 
+	@RequestMapping(value = "/findAllContacts", method = RequestMethod.GET)
+	public Result findAllContacts(String uid){
+		Result res = new Result();
+		res.setData(customerService.findAllContacts(uid));
 		return res;
 	}
 }

+ 37 - 1
src/main/java/com/goafanti/customer/service/BusinessService.java

@@ -1,5 +1,6 @@
 package com.goafanti.customer.service;
 
+import java.text.ParseException;
 import java.util.List;
 
 import com.goafanti.common.model.UserBusiness;
@@ -33,7 +34,7 @@ public interface BusinessService {
 	 * 添加意向服务和跟进记录
 	 * @param bfb
 	 */
-	void addBusinessAndFollow(BussinessFollowBo bfb);
+	void addBusinessAndFollow(BussinessFollowBo bfb)  throws ParseException ;
 	
 	/**
 	 * 查询业务列表
@@ -42,4 +43,39 @@ public interface BusinessService {
 	 * @return
 	 */
 	List<UserBusiness> findBusinessByUAid(String uid,String aid);
+
+	/**
+	 * 查看业务意向详情
+	 * @param businessId
+	 * @return
+	 */
+	BussinessFollowBo findBusinessDetail(String businessId);
+
+	/**
+	 * 修改业务意向
+	 * @param bfb
+	 * @return
+	 */
+	int updateBusiness(BussinessFollowBo bfb);
+
+	/**
+	 * 跟进单个业务意向
+	 * @param bfb
+	 * @return
+	 */
+	int addFollowOneBusiness(BussinessFollowBo bfb) throws ParseException;
+
+	/**
+	 * 查询某个客户的一个意向的当次拜访
+	 * @param ufbId
+	 * @return
+	 */
+	BussinessFollowBo findFollowOneBusiness(String ufbId);
+
+	/**
+	 * 修改某个客户的一个意向的当次拜访
+	 * @param bfb
+	 * @return
+	 */
+	int updateFollowOneBusiness(BussinessFollowBo bfb);
 }

+ 31 - 2
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -1,9 +1,11 @@
 package com.goafanti.customer.service;
 
+import java.text.ParseException;
 import java.util.List;
 
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.User;
+import com.goafanti.common.model.UserBusiness;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.customer.bo.CustomerListIn;
 import com.goafanti.customer.bo.CustomerListOut;
@@ -123,7 +125,7 @@ public interface CustomerService {
 	 * @param pageSize
 	 * @return
 	 */
-	Pagination<FollowListBo> listFollowHistory(Integer pageNo, Integer pageSize,String uid);
+	Pagination<FollowListBo> listFollowHistory(Integer pageNo, Integer pageSize,String uid,String businessGlossoryId);
 	
 	/**
 	 * 查看客户账户信息
@@ -149,5 +151,32 @@ public interface CustomerService {
 	 * 添加拜访记录
 	 * @param fbb
 	 */
-	int addFollow(FollowBusinessBo fbb);
+	int addFollow(FollowBusinessBo fbb)  throws ParseException;
+	
+	/**
+	 * 查询拜访记录详情
+	 * @param followId
+	 * @return
+	 */
+	FollowBusinessBo findFollowById(String followId);
+
+	/**
+	 * 查询单词拜访推进的客户意向
+	 * @param followId
+	 * @return
+	 */
+	List<UserBusiness> findBusinessByFollowId(String followId);
+	
+	/**
+	 * 修改拜访记录
+	 * @param fbb
+	 */
+	int updateFollow(FollowBusinessBo fbb)  throws ParseException ;
+	
+	/**
+	 * 查询客户的所有联系人
+	 * @param uid
+	 * @return
+	 */
+	List<OrganizationContactBook> findAllContacts(String uid);
 }

+ 91 - 7
src/main/java/com/goafanti/customer/service/impl/BusinessServiceImpl.java

@@ -1,17 +1,18 @@
 package com.goafanti.customer.service.impl;
 
-import java.lang.reflect.InvocationTargetException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
-import org.apache.commons.beanutils.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.UserBusinessMapper;
 import com.goafanti.common.dao.UserFollowBusinessMapper;
 import com.goafanti.common.dao.UserFollowMapper;
@@ -37,11 +38,14 @@ public class BusinessServiceImpl extends BaseMybatisDao<UserBusinessMapper> impl
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<BusinessListBo> listBusiness(BusinessListBo blo,Integer pageNo,Integer pageSize) {
+		blo.setAid(TokenManager.getAdminId());
 		return (Pagination<BusinessListBo>) findPage("selectBusinessList", "selectBusinessCount", disposeParams(blo), pageNo, pageSize);
 	}
 	
 	private Map<String,Object> disposeParams(BusinessListBo blo){
 		Map<String, Object> params = new HashMap<String, Object>();
+		if(StringUtils.isNotBlank(blo.getUid())) params.put("uid", blo.getUid());
+		if(StringUtils.isNotBlank(blo.getAid())) params.put("aid", blo.getAid());
 		if(StringUtils.isNotBlank(blo.getAdminName())) params.put("adminName", blo.getAdminName());
 		if(StringUtils.isNotBlank(blo.getBusinessId())) params.put("businessId", blo.getBusinessId());
 		if(StringUtils.isNotBlank(blo.getStartDate())) params.put("startDate", blo.getStartDate()+" 00:00:00");
@@ -65,25 +69,26 @@ public class BusinessServiceImpl extends BaseMybatisDao<UserBusinessMapper> impl
 
 	@Override
 	@Transactional
-	public void addBusinessAndFollow(BussinessFollowBo bfb) {
+	public void addBusinessAndFollow(BussinessFollowBo bfb) throws ParseException {
 		UserBusiness ub = new UserBusiness();
 		String ubId = UUID.randomUUID().toString();
-		Date date = new Date();
+		SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
 		ub.setCustomerStatus(Integer.parseInt(bfb.getCustomerStatus()));
 		ub.setFollowSituation(Integer.parseInt(bfb.getFollowSituation()));
 		ub.setId(ubId);
 		ub.setUid(bfb.getUid());
 		ub.setAid(TokenManager.getAdminId());
 		ub.setRemarks(bfb.getRemarks());
-		ub.setUpdateTime(date);
-		ub.setCreateTime(date);
+		ub.setBusinessGlossoryId(Integer.parseInt(bfb.getBusinessGlossoryId()));
+		ub.setUpdateTime(format.parse(bfb.getCreateTime()));
+		ub.setCreateTime(format.parse(bfb.getCreateTime()));
 		userBusinessMapper.insert(ub);
 		if (StringUtils.isNotBlank(bfb.getOcbId())) { // 跟进联系人不为空则添加跟进记录
 			UserFollow uf = new UserFollow();
 			String ufId = UUID.randomUUID().toString();
 			uf.setId(ufId);
 			uf.setUid(bfb.getUid());
-			uf.setCreateTime(date);
+			uf.setCreateTime(format.parse(bfb.getFollowTime()));
 			uf.setOcbId(bfb.getOcbId());
 			uf.setResult(bfb.getResult());
 			uf.setContactType(Integer.parseInt(bfb.getContactType()));
@@ -107,4 +112,83 @@ public class BusinessServiceImpl extends BaseMybatisDao<UserBusinessMapper> impl
 		
 		return userBusinessMapper.findBusinessByUAid(uid,aid);
 	}
+
+	@Override
+	public BussinessFollowBo findBusinessDetail(String businessId) {
+		
+		return userBusinessMapper.findBusinessDetail(businessId);
+	}
+
+	@Override
+	public int updateBusiness(BussinessFollowBo bfb) {
+		UserBusiness userBusiness = new UserBusiness();
+		userBusiness.setId(bfb.getBusinessId());
+		userBusiness.setCustomerStatus(Integer.parseInt(bfb.getCustomerStatus()));
+		userBusiness.setFollowSituation(Integer.parseInt(bfb.getFollowSituation()));
+		userBusiness.setRemarks(bfb.getRemarks());
+		userBusiness.setUpdateTime(new Date());
+		userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
+		return 1;
+	}
+
+	@Override
+	@Transactional
+	public int addFollowOneBusiness(BussinessFollowBo bfb) throws ParseException {
+		Date updateTime = new Date();
+		SimpleDateFormat format = new  SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
+		UserBusiness userBusiness = new UserBusiness();
+		userBusiness.setId(bfb.getBusinessId());
+		userBusiness.setUpdateTime(updateTime);
+		userBusiness.setCustomerStatus(Integer.parseInt(bfb.getCustomerStatus()));
+		userBusiness.setFollowSituation(Integer.parseInt(bfb.getFollowSituation()));
+		userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
+		UserFollow userFollow = new UserFollow();
+		String followId = UUID.randomUUID().toString();
+		int followCount = userBusinessMapper.judgeBusiness(bfb.getUid(), null, TokenManager.getAdminId()) + 1;
+		userFollow.setId(followId);
+		userFollow.setResult(bfb.getResult());
+		userFollow.setCreateTime(format.parse(bfb.getFollowTime()));
+		userFollow.setEffective(0);
+		userFollow.setOcbId(bfb.getOcbId());
+		userFollow.setFollowCount(followCount);
+		userFollow.setContactType(Integer.parseInt(bfb.getContactType()));
+		userFollow.setAid(TokenManager.getAdminId());
+		userFollowMapper.insert(userFollow);
+		UserFollowBusiness userFollowBusiness = new UserFollowBusiness();
+		String ufbId = UUID.randomUUID().toString();
+		userFollowBusiness.setId(ufbId);
+		userFollowBusiness.setFollowId(followId);
+		userFollowBusiness.setBusinessGlossoryId(Integer.parseInt(bfb.getBusinessGlossoryId()));
+		userFollowBusiness.setBusinessId(bfb.getBusinessId());
+		userFollowBusiness.setCustomerStatus(Integer.parseInt(bfb.getCustomerStatus()));
+		userFollowBusiness.setFollowSituation(Integer.parseInt(bfb.getFollowSituation()));
+		userFollowBusiness.setRemarks(bfb.getRemarks());
+		userFollowBusinessMapper.insert(userFollowBusiness);
+		return 1;
+	}
+
+	@Override
+	public BussinessFollowBo findFollowOneBusiness(String ufbId) {
+		
+		return userBusinessMapper.findFollowOneBusiness(ufbId);
+	}
+
+	@Override
+	public int updateFollowOneBusiness(BussinessFollowBo bfb) {
+		//修改业务跟进中间表
+		UserFollowBusiness userFollowBusiness = new UserFollowBusiness();
+		userFollowBusiness.setId(bfb.getUfbId());
+		userFollowBusiness.setRemarks(bfb.getRemarks());
+		userFollowBusiness.setCustomerStatus(Integer.parseInt(bfb.getCustomerStatus()));
+		userFollowBusiness.setFollowSituation(Integer.parseInt(bfb.getFollowSituation()));
+		userFollowBusinessMapper.updateByPrimaryKeySelective(userFollowBusiness);
+		//修改跟进记录表
+		UserFollow userFollow = new UserFollow();
+		userFollow.setId(bfb.getFollowId());
+		userFollow.setContactType(Integer.parseInt(bfb.getContactType()));
+		userFollow.setResult(bfb.getResult());
+		userFollowMapper.updateByPrimaryKeySelective(userFollow);
+		return 1;
+	}
+
 }

+ 137 - 14
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -1,6 +1,8 @@
 package com.goafanti.customer.service.impl;
 
 import java.lang.reflect.InvocationTargetException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -13,10 +15,14 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import com.goafanti.common.bo.Error;
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.BusinessGlossoryMapper;
 import com.goafanti.common.dao.OrganizationContactBookMapper;
 import com.goafanti.common.dao.OrganizationIdentityMapper;
 import com.goafanti.common.dao.UserBusinessMapper;
+import com.goafanti.common.dao.UserFollowBusinessMapper;
+import com.goafanti.common.dao.UserFollowMapper;
 import com.goafanti.common.dao.UserIdentityMapper;
 import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.error.BusinessException;
@@ -55,7 +61,13 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	@Resource(name = "passwordUtil")
 	private PasswordUtil					passwordUtil;
 	@Resource
+	private UserFollowMapper userFollowMapper;
+	@Resource
 	private UserBusinessMapper userBusinessMapper;
+	@Resource
+	private UserFollowBusinessMapper userFollowBusinessMapper;
+	@Resource
+	private BusinessGlossoryMapper businessGlossoryMapper;
 	@Override
 	public Pagination<CustomerListOut> listPrivatePersonalCustomer(CustomerListIn cli, Integer pageNo,Integer pageSize) {
 		cli.setType(AFTConstants.USER_TYPE_PERSONAL);
@@ -255,9 +267,10 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<FollowListBo> listFollowHistory(Integer pageNo, Integer pageSize,String uid) {
+	public Pagination<FollowListBo> listFollowHistory(Integer pageNo, Integer pageSize,String uid,String businessGlossoryId) {
 		Map<String, Object> params = new HashMap<String, Object>();
 		if(StringUtils.isNotBlank(uid))params.put("uid", uid);
+		if(StringUtils.isNotBlank(businessGlossoryId)) params.put("businessGlossoryId", businessGlossoryId);
 		return (Pagination<FollowListBo>)findPage("selectFollowHistoryList","selectFollowHistoryCount",params, pageNo, pageSize);
 	}
 
@@ -281,37 +294,147 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 
 	@Override
 	@Transactional
-	public int addFollow(FollowBusinessBo fbb) {
-		Date date = new Date();
+	public int addFollow(FollowBusinessBo fbb) throws ParseException {
+		if(fbb.getUserBusinessList().size()<1) throw new BusinessException(new Error("至少需要填一个跟进业务"));
+		//更新跟进记录表
+		SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
 		UserFollow userFollow = new UserFollow();
-		String ufId = UUID.randomUUID().toString();
-		userFollow.setId(ufId);
+		String followId = UUID.randomUUID().toString();
+		userFollow.setId(followId);
 		userFollow.setAid(TokenManager.getAdminId());
 		userFollow.setContactType(Integer.parseInt(fbb.getContactType()));
 		userFollow.setEffective(0);
-		userFollow.setCreateTime(date);
+		userFollow.setCreateTime(format.parse(fbb.getFollowTime()));
 		userFollow.setOcbId(fbb.getOcbId());
 		userFollow.setResult(fbb.getResult());
 		userFollow.setUid(fbb.getUid());
 		int followCount = userBusinessMapper.judgeBusiness(fbb.getUid(), null, TokenManager.getAdminId()) + 1;
 		userFollow.setFollowCount(followCount);
+		userFollowMapper.insert(userFollow);
 		String ufbId = "";
-		UserFollowBusiness ufb = null;
+		UserBusiness userBusiness = null;
+		UserFollowBusiness userFollowBusiness = null;
 		for(UserBusiness ub: fbb.getUserBusinessList()){
-			ufb = new UserFollowBusiness();
+			userBusiness = new UserBusiness();
+			userFollowBusiness = new UserFollowBusiness();
 			ufbId = UUID.randomUUID().toString();
 			if(StringUtils.isNotBlank(ub.getId())){
-				ufb.setBusinessId(ub.getId()); //意向表ID
-				ufb.setCustomerStatus(ub.getCustomerStatus());
-				ufb.setFollowId(ufbId);
-				ufb.setFollowSituation(ub.getFollowSituation());
-				//更新
+				//更新业务表
+				userBusiness.setId(ub.getId());
+				userBusiness.setBusinessGlossoryId(ub.getBusinessGlossoryId());
+				userBusiness.setCustomerStatus(ub.getCustomerStatus());
+				userBusiness.setFollowSituation(ub.getFollowSituation());
+				userBusiness.setUid(fbb.getUid());
+				userBusiness.setUpdateTime(format.parse(fbb.getFollowTime()));
+				userBusiness.setAid(TokenManager.getAdminId());
+				userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
+				//更新业务中间表
+				userFollowBusiness.setBusinessId(ub.getId());
+				userFollowBusiness.setCustomerStatus(ub.getCustomerStatus());
+				userFollowBusiness.setFollowSituation(ub.getFollowSituation());
+				userFollowBusiness.setId(ufbId);
+				userFollowBusiness.setFollowId(followId);
+				userFollowBusiness.setRemarks(ub.getRemarks());
+				userFollowBusiness.setBusinessGlossoryId(ub.getBusinessGlossoryId());
+				userFollowBusinessMapper.insert(userFollowBusiness);
 			}else{
-				//检测是否可以创建业务
+				//检测是否可以创建业务	
+				if(userBusinessMapper.judgeBusiness(fbb.getUid(), ub.getBusinessGlossoryId(), "")>0){
+					String businessName = businessGlossoryMapper.selectByPrimaryKey(ub.getBusinessGlossoryId()).getName();
+					throw new BusinessException(new Error(businessName+" 已经被跟进"));
+				}
+				String ubId = UUID.randomUUID().toString();
+				//更新业务表
+				userBusiness.setId(ubId);
+				userBusiness.setBusinessGlossoryId(ub.getBusinessGlossoryId());
+				userBusiness.setCreateTime(format.parse(fbb.getFollowTime()));
+				userBusiness.setCustomerStatus(ub.getCustomerStatus());
+				userBusiness.setFollowSituation(ub.getFollowSituation());
+				userBusiness.setUid(fbb.getUid());
+				userBusiness.setUpdateTime(format.parse(fbb.getFollowTime()));
+				userBusiness.setAid(TokenManager.getAdminId());
+				userBusinessMapper.insert(userBusiness);	
+				//更新业务中间表
+				userFollowBusiness.setBusinessId(ubId);
+				userFollowBusiness.setCustomerStatus(ub.getCustomerStatus());
+				userFollowBusiness.setFollowSituation(ub.getFollowSituation());
+				userFollowBusiness.setId(ufbId);
+				userFollowBusiness.setFollowId(followId);
+				userFollowBusiness.setRemarks(ub.getRemarks());
+				userFollowBusiness.setBusinessGlossoryId(ub.getBusinessGlossoryId());
+				userFollowBusinessMapper.insert(userFollowBusiness);
 			}
 			
 		}
 		return 1;
 	}
+
+	@Override
+	public FollowBusinessBo findFollowById(String followId) {
+		
+		return userMapper.findFollowById(followId);
+	}
+
+	@Override
+	public List<UserBusiness> findBusinessByFollowId(String followId) {
+		return userMapper.findBusinessByFollowId(followId);
+	}
+
+	@Override
+	@Transactional
+	public int updateFollow(FollowBusinessBo fbb) throws ParseException {
+		 UserFollow userFollow  = new UserFollow();
+		 SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
+		 userFollow.setCreateTime(format.parse(fbb.getFollowTime()));
+		if(StringUtils.isNotBlank(fbb.getOcbId())) userFollow.setOcbId(fbb.getOcbId());
+		userFollow.setResult(fbb.getResult());
+		userFollow.setContactType(Integer.parseInt(fbb.getContactType()));
+		userFollowMapper.updateByPrimaryKeySelective(userFollow); //修改拜访记录表
+		UserFollowBusiness userFollowBusiness = null;
+		for(UserBusiness ub: fbb.getUserBusinessList()){
+			userFollowBusiness = new UserFollowBusiness();
+			if(StringUtils.isNotBlank(ub.getId())){
+				userFollowBusiness.setId(ub.getId());
+				userFollowBusiness.setFollowSituation(ub.getFollowSituation());
+				userFollowBusiness.setCustomerStatus(ub.getCustomerStatus());
+				userFollowBusiness.setRemarks(ub.getRemarks());
+				userFollowBusinessMapper.updateByPrimaryKeySelective(userFollowBusiness); //修改拜访记录中间表
+			}else{
+				//检测是否可以创建业务	
+				if(userBusinessMapper.judgeBusiness(fbb.getUid(), ub.getBusinessGlossoryId(), "")>0){
+					String businessName = businessGlossoryMapper.selectByPrimaryKey(ub.getBusinessGlossoryId()).getName();
+					throw new BusinessException(new Error(businessName+" 已经被跟进"));
+				}
+				String ubId = UUID.randomUUID().toString();		
+				UserBusiness userBusiness = new UserBusiness();
+				//更新业务表
+				userBusiness.setId(ubId);
+				userBusiness.setBusinessGlossoryId(ub.getBusinessGlossoryId());
+				userBusiness.setCreateTime(format.parse(fbb.getFollowTime()));
+				userBusiness.setCustomerStatus(ub.getCustomerStatus());
+				userBusiness.setFollowSituation(ub.getFollowSituation());
+				userBusiness.setUid(fbb.getUid());
+				userBusiness.setUpdateTime(format.parse(fbb.getFollowTime()));
+				userBusiness.setAid(TokenManager.getAdminId());
+				userBusinessMapper.insert(userBusiness);	
+				//更新业务中间表
+				String ufbId = UUID.randomUUID().toString();
+				userFollowBusiness.setBusinessId(ubId);
+				userFollowBusiness.setCustomerStatus(ub.getCustomerStatus());
+				userFollowBusiness.setFollowSituation(ub.getFollowSituation());
+				userFollowBusiness.setId(ufbId);
+				userFollowBusiness.setFollowId(fbb.getFollowId());
+				userFollowBusiness.setRemarks(ub.getRemarks());
+				userFollowBusiness.setBusinessGlossoryId(ub.getBusinessGlossoryId());
+				userFollowBusinessMapper.insert(userFollowBusiness);
+			}		
+		}
+		return 1;
+	}
+
+	@Override
+	public List<OrganizationContactBook> findAllContacts(String uid) {
+		return userMapper.findAllContacts(uid);
+	}
 	
 }