Procházet zdrojové kódy

客户管理系统

wanghui před 8 roky
rodič
revize
2da2ed51bc

+ 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>

+ 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 CST 2017
 	 */
 	int updateByPrimaryKey(UserFollowBusiness record);
 }

+ 17 - 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,18 @@ 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);
+
 }

+ 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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 Thu Nov 16 12:41:22 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>

+ 32 - 3
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">
@@ -371,5 +371,34 @@
 		select id as ocbId,name from organization_contact_book 
 		where uid = #{uid,jdbcType=VARCHAR} and aid = #{aid,jdbcType=VARCHAR}
 	</select>
-		
+	
+	<select id="findFollowById" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.FollowBusinessBo">
+		select
+			a.id as followId,
+			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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 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  Thu Nov 16 12:41:22 CST 2017
 	 */
 	public static class Criterion {
 		private String condition;

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

@@ -16,8 +16,6 @@ public class FollowBusinessBo {
 	private String identityName;
 	/** 当前联系人姓名 **/
 	private String contacts;
-	/** 新的联系人 **/
-	private String contactMobile;
 	/** 需要保存的联系人ID **/
 	private String ocbId;
 	/** 联系方式 **/
@@ -26,6 +24,8 @@ public class FollowBusinessBo {
 	private String result;
 	/** 拜访时间 **/
 	private String followTime;
+	/** 拜访人 **/
+	private String adminName;
 	/** 业务意向列表 **/
 	private List<UserBusiness> userBusinessList;
 	public String getUid() {
@@ -46,12 +46,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 +70,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;
 	}

+ 7 - 1
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;
 	}
 	

+ 27 - 2
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;
@@ -186,7 +186,32 @@ 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;
+	}
+	
+	/**
+	 * 修改拜访记录
+	 * @param fbb
+	 * @return
+	 */
+	public Result updateFollow(FollowBusinessBo fbb){
+		Result res = new Result();
+		customerService.updateFollow(fbb);
 		return res;
 	}
 }

+ 2 - 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 ;
 	
 	/**
 	 * 查询业务列表

+ 23 - 1
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;
@@ -149,5 +151,25 @@ 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);
 }

+ 9 - 8
src/main/java/com/goafanti/customer/service/impl/BusinessServiceImpl.java

@@ -1,17 +1,17 @@
 package com.goafanti.customer.service.impl;
 
-import java.lang.reflect.InvocationTargetException;
-import java.util.Date;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 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;
@@ -65,25 +65,25 @@ 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.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 +107,5 @@ public class BusinessServiceImpl extends BaseMybatisDao<UserBusinessMapper> impl
 		
 		return userBusinessMapper.findBusinessByUAid(uid,aid);
 	}
+
 }

+ 85 - 13
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);
@@ -281,37 +293,97 @@ 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 {
+		//更新跟进记录表
+		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.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.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) {
+		 	 	 	
+		return 1;
+	}
 	
 }