Browse Source

客户管理

wanghui 8 years ago
parent
commit
ec3d3023c0

+ 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="user_follow_business"/>
+    <table schema="aft" tableName="organization_contact_book"/>
   </context>
 </generatorConfiguration>

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

@@ -11,69 +11,69 @@ public interface OrganizationContactBookMapper {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	long countByExample(OrganizationContactBookExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	int deleteByExample(OrganizationContactBookExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	int deleteByPrimaryKey(String id);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	int insert(OrganizationContactBook record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	int insertSelective(OrganizationContactBook record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	List<OrganizationContactBook> selectByExample(OrganizationContactBookExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	OrganizationContactBook selectByPrimaryKey(String id);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	int updateByExampleSelective(@Param("record") OrganizationContactBook record,
 			@Param("example") OrganizationContactBookExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	int updateByExample(@Param("record") OrganizationContactBook record,
 			@Param("example") OrganizationContactBookExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	int updateByPrimaryKeySelective(OrganizationContactBook record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	int updateByPrimaryKey(OrganizationContactBook record);
 }

+ 30 - 30
src/main/java/com/goafanti/common/mapper/OrganizationContactBookMapper.xml

@@ -5,7 +5,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     <id column="id" jdbcType="VARCHAR" property="id" />
     <result column="uid" jdbcType="VARCHAR" property="uid" />
@@ -16,7 +16,7 @@
     <result column="qq" jdbcType="VARCHAR" property="qq" />
     <result column="wechat" jdbcType="VARCHAR" property="wechat" />
     <result column="depatrment" jdbcType="VARCHAR" property="depatrment" />
-    <result column="customer_position" jdbcType="VARCHAR" property="customerPosition" />
+    <result column="position" jdbcType="VARCHAR" property="position" />
     <result column="tel_num" jdbcType="VARCHAR" property="telNum" />
     <result column="major" jdbcType="INTEGER" property="major" />
     <result column="aid" jdbcType="VARCHAR" property="aid" />
@@ -25,7 +25,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     <where>
       <foreach collection="oredCriteria" item="criteria" separator="or">
@@ -59,7 +59,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     <where>
       <foreach collection="example.oredCriteria" item="criteria" separator="or">
@@ -93,16 +93,16 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
-    id, uid, name, sex, mobile, email, qq, wechat, depatrment, customer_position, tel_num, 
-    major, aid
+    id, uid, name, sex, mobile, email, qq, wechat, depatrment, position, tel_num, major, 
+    aid
   </sql>
   <select id="selectByExample" parameterType="com.goafanti.common.model.OrganizationContactBookExample" resultMap="BaseResultMap">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     select
     <if test="distinct">
@@ -121,7 +121,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     select 
     <include refid="Base_Column_List" />
@@ -132,7 +132,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     delete from organization_contact_book
     where id = #{id,jdbcType=VARCHAR}
@@ -141,7 +141,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     delete from organization_contact_book
     <if test="_parameter != null">
@@ -152,22 +152,22 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     insert into organization_contact_book (id, uid, name, 
       sex, mobile, email, qq, 
-      wechat, depatrment, customer_position, 
+      wechat, depatrment, position, 
       tel_num, major, aid)
     values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
       #{sex,jdbcType=CHAR}, #{mobile,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{qq,jdbcType=VARCHAR}, 
-      #{wechat,jdbcType=VARCHAR}, #{depatrment,jdbcType=VARCHAR}, #{customerPosition,jdbcType=VARCHAR}, 
+      #{wechat,jdbcType=VARCHAR}, #{depatrment,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, 
       #{telNum,jdbcType=VARCHAR}, #{major,jdbcType=INTEGER}, #{aid,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.OrganizationContactBook">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     insert into organization_contact_book
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -198,8 +198,8 @@
       <if test="depatrment != null">
         depatrment,
       </if>
-      <if test="customerPosition != null">
-        customer_position,
+      <if test="position != null">
+        position,
       </if>
       <if test="telNum != null">
         tel_num,
@@ -239,8 +239,8 @@
       <if test="depatrment != null">
         #{depatrment,jdbcType=VARCHAR},
       </if>
-      <if test="customerPosition != null">
-        #{customerPosition,jdbcType=VARCHAR},
+      <if test="position != null">
+        #{position,jdbcType=VARCHAR},
       </if>
       <if test="telNum != null">
         #{telNum,jdbcType=VARCHAR},
@@ -257,7 +257,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     select count(*) from organization_contact_book
     <if test="_parameter != null">
@@ -268,7 +268,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     update organization_contact_book
     <set>
@@ -299,8 +299,8 @@
       <if test="record.depatrment != null">
         depatrment = #{record.depatrment,jdbcType=VARCHAR},
       </if>
-      <if test="record.customerPosition != null">
-        customer_position = #{record.customerPosition,jdbcType=VARCHAR},
+      <if test="record.position != null">
+        position = #{record.position,jdbcType=VARCHAR},
       </if>
       <if test="record.telNum != null">
         tel_num = #{record.telNum,jdbcType=VARCHAR},
@@ -320,7 +320,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     update organization_contact_book
     set id = #{record.id,jdbcType=VARCHAR},
@@ -332,7 +332,7 @@
       qq = #{record.qq,jdbcType=VARCHAR},
       wechat = #{record.wechat,jdbcType=VARCHAR},
       depatrment = #{record.depatrment,jdbcType=VARCHAR},
-      customer_position = #{record.customerPosition,jdbcType=VARCHAR},
+      position = #{record.position,jdbcType=VARCHAR},
       tel_num = #{record.telNum,jdbcType=VARCHAR},
       major = #{record.major,jdbcType=INTEGER},
       aid = #{record.aid,jdbcType=VARCHAR}
@@ -344,7 +344,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     update organization_contact_book
     <set>
@@ -372,8 +372,8 @@
       <if test="depatrment != null">
         depatrment = #{depatrment,jdbcType=VARCHAR},
       </if>
-      <if test="customerPosition != null">
-        customer_position = #{customerPosition,jdbcType=VARCHAR},
+      <if test="position != null">
+        position = #{position,jdbcType=VARCHAR},
       </if>
       <if test="telNum != null">
         tel_num = #{telNum,jdbcType=VARCHAR},
@@ -391,7 +391,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Nov 15 16:01:22 CST 2017.
+      This element was generated on Sun Nov 19 20:34:03 CST 2017.
     -->
     update organization_contact_book
     set uid = #{uid,jdbcType=VARCHAR},
@@ -402,7 +402,7 @@
       qq = #{qq,jdbcType=VARCHAR},
       wechat = #{wechat,jdbcType=VARCHAR},
       depatrment = #{depatrment,jdbcType=VARCHAR},
-      customer_position = #{customerPosition,jdbcType=VARCHAR},
+      position = #{position,jdbcType=VARCHAR},
       tel_num = #{telNum,jdbcType=VARCHAR},
       major = #{major,jdbcType=INTEGER},
       aid = #{aid,jdbcType=VARCHAR}

+ 4 - 2
src/main/java/com/goafanti/common/mapper/UserBusinessMapper.xml

@@ -469,15 +469,16 @@
 		a.customer_status as customerStatus,
 		a.follow_situation as followSituation,
 		a.remarks,
+		a.business_glossory_id as businessGlossoryId,
 		b.id as followId,
 		b.create_time as createTime,
-		b.business_glossory_id as businessGlossoryId,
 		b.result,
+		b.contact_type as contactType,
 		d.name as contacts,
 		d.mobile as contactMobile,
 		b.create_time as followTime,
 		e.name as adminName,
-		f.name as identifyName
+		f.identify_name as identifyName
 	from
 		user_follow_business a 
 	left join user_follow b on a.follow_id = b.id
@@ -485,5 +486,6 @@
 	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
+	where a.id = #{ufbId,jdbcType=VARCHAR}
   </select>
 </mapper>

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

@@ -319,7 +319,7 @@
 			c.mobile as contactMobile,
 			d.name as adminName
 		<if test="businessGlossoryId != null and businessGlossoryId != ''"><!--  客户甲项目A所有的跟进记录 -->
-			,e.id as ufbId
+			,e.id as ufbId,e.follow_situation as followSituation,e.customer_status as customerStatus
 		</if>
 		from user_follow a
 		left join user b on a.uid = b.id 
@@ -333,10 +333,10 @@
 			and a.uid = #{uid,jdbcType=VARCHAR}
 		</if>
 		<if test="aid != null and aid != ''">
-			and a.aid = #{adid,jdbcType=VARCHAR}
+			and a.aid = #{aid,jdbcType=VARCHAR}
 		</if>
 		<if test="businessGlossoryId != null and businessGlossoryId != ''"><!--  客户甲项目A所有的跟进记录 -->
-			and e.businessGlossoryId = #{businessGlossoryId,jdbcType=VARCHAR}
+			and e.business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
 		</if>
 		<if test="page_sql != null">
     		${page_sql}
@@ -357,10 +357,10 @@
 			and a.uid = #{uid,jdbcType=VARCHAR}
 		</if>
 		<if test="aid != null and aid != ''">
-			and a.aid = #{adid,jdbcType=VARCHAR}
+			and a.aid = #{aid,jdbcType=VARCHAR}
 		</if>
 		<if test="businessGlossoryId != null and businessGlossoryId != ''"><!--  客户甲项目A所有的跟进记录 -->
-			and e.businessGlossoryId = #{businessGlossoryId,jdbcType=VARCHAR}
+			and e.business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
 		</if>
 	</select>
 	
@@ -386,7 +386,7 @@
 	</select>
 	
 	<select id="findCustomerContacts" parameterType="java.lang.String" resultType="com.goafanti.common.model.OrganizationContactBook">
-		select id,name,mobile from organization_contact_book 
+		select id,name,mobile,email,qq,wechat,depatrment,position from organization_contact_book
 		where uid = #{uid,jdbcType=VARCHAR} and aid = #{aid,jdbcType=VARCHAR}
 	</select>
 	

+ 50 - 51
src/main/java/com/goafanti/common/model/OrganizationContactBook.java

@@ -4,74 +4,74 @@ public class OrganizationContactBook {
 
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.id
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private String id;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.uid
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private String uid;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.name
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private String name;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.sex
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private String sex;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.mobile
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private String mobile;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.email
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private String email;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.qq
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private String qq;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.wechat
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private String wechat;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.depatrment
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private String depatrment;
 	/**
-	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.customer_position
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.position
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
-	private String customerPosition;
+	private String position;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.tel_num
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private String telNum;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.major
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private Integer major;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_contact_book.aid
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	private String aid;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.id
 	 * @return  the value of organization_contact_book.id
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getId() {
 		return id;
@@ -80,7 +80,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.id
 	 * @param id  the value for organization_contact_book.id
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setId(String id) {
 		this.id = id;
@@ -89,7 +89,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.uid
 	 * @return  the value of organization_contact_book.uid
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getUid() {
 		return uid;
@@ -98,7 +98,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.uid
 	 * @param uid  the value for organization_contact_book.uid
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setUid(String uid) {
 		this.uid = uid;
@@ -107,7 +107,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.name
 	 * @return  the value of organization_contact_book.name
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getName() {
 		return name;
@@ -116,7 +116,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.name
 	 * @param name  the value for organization_contact_book.name
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setName(String name) {
 		this.name = name;
@@ -125,7 +125,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.sex
 	 * @return  the value of organization_contact_book.sex
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getSex() {
 		return sex;
@@ -134,7 +134,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.sex
 	 * @param sex  the value for organization_contact_book.sex
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setSex(String sex) {
 		this.sex = sex;
@@ -143,7 +143,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.mobile
 	 * @return  the value of organization_contact_book.mobile
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getMobile() {
 		return mobile;
@@ -152,7 +152,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.mobile
 	 * @param mobile  the value for organization_contact_book.mobile
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setMobile(String mobile) {
 		this.mobile = mobile;
@@ -161,7 +161,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.email
 	 * @return  the value of organization_contact_book.email
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getEmail() {
 		return email;
@@ -170,7 +170,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.email
 	 * @param email  the value for organization_contact_book.email
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setEmail(String email) {
 		this.email = email;
@@ -179,7 +179,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.qq
 	 * @return  the value of organization_contact_book.qq
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getQq() {
 		return qq;
@@ -188,7 +188,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.qq
 	 * @param qq  the value for organization_contact_book.qq
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setQq(String qq) {
 		this.qq = qq;
@@ -197,7 +197,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.wechat
 	 * @return  the value of organization_contact_book.wechat
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getWechat() {
 		return wechat;
@@ -206,7 +206,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.wechat
 	 * @param wechat  the value for organization_contact_book.wechat
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setWechat(String wechat) {
 		this.wechat = wechat;
@@ -215,7 +215,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.depatrment
 	 * @return  the value of organization_contact_book.depatrment
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getDepatrment() {
 		return depatrment;
@@ -224,34 +224,34 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.depatrment
 	 * @param depatrment  the value for organization_contact_book.depatrment
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setDepatrment(String depatrment) {
 		this.depatrment = depatrment;
 	}
 
 	/**
-	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.customer_position
-	 * @return  the value of organization_contact_book.customer_position
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.position
+	 * @return  the value of organization_contact_book.position
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
-	public String getCustomerPosition() {
-		return customerPosition;
+	public String getPosition() {
+		return position;
 	}
 
 	/**
-	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.customer_position
-	 * @param customerPosition  the value for organization_contact_book.customer_position
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.position
+	 * @param position  the value for organization_contact_book.position
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
-	public void setCustomerPosition(String customerPosition) {
-		this.customerPosition = customerPosition;
+	public void setPosition(String position) {
+		this.position = position;
 	}
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.tel_num
 	 * @return  the value of organization_contact_book.tel_num
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getTelNum() {
 		return telNum;
@@ -260,7 +260,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.tel_num
 	 * @param telNum  the value for organization_contact_book.tel_num
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setTelNum(String telNum) {
 		this.telNum = telNum;
@@ -269,7 +269,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.major
 	 * @return  the value of organization_contact_book.major
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public Integer getMajor() {
 		return major;
@@ -278,7 +278,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.major
 	 * @param major  the value for organization_contact_book.major
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setMajor(Integer major) {
 		this.major = major;
@@ -287,7 +287,7 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_contact_book.aid
 	 * @return  the value of organization_contact_book.aid
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getAid() {
 		return aid;
@@ -296,14 +296,13 @@ public class OrganizationContactBook {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_contact_book.aid
 	 * @param aid  the value for organization_contact_book.aid
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setAid(String aid) {
 		this.aid = aid;
 	}
-	
 
-    @Override  
+	@Override  
     public boolean equals(Object arg0) {  
     	OrganizationContactBook p = (OrganizationContactBook) arg0;  
         return name.equals(p.name) && name.equals(p.name);  

+ 44 - 44
src/main/java/com/goafanti/common/model/OrganizationContactBookExample.java

@@ -6,23 +6,23 @@ import java.util.List;
 public class OrganizationContactBookExample {
     /**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	protected String orderByClause;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	protected boolean distinct;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	protected List<Criteria> oredCriteria;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public OrganizationContactBookExample() {
 		oredCriteria = new ArrayList<Criteria>();
@@ -30,7 +30,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setOrderByClause(String orderByClause) {
 		this.orderByClause = orderByClause;
@@ -38,7 +38,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public String getOrderByClause() {
 		return orderByClause;
@@ -46,7 +46,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void setDistinct(boolean distinct) {
 		this.distinct = distinct;
@@ -54,7 +54,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public boolean isDistinct() {
 		return distinct;
@@ -62,7 +62,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public List<Criteria> getOredCriteria() {
 		return oredCriteria;
@@ -70,7 +70,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void or(Criteria criteria) {
 		oredCriteria.add(criteria);
@@ -78,7 +78,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public Criteria or() {
 		Criteria criteria = createCriteriaInternal();
@@ -88,7 +88,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public Criteria createCriteria() {
 		Criteria criteria = createCriteriaInternal();
@@ -100,7 +100,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	protected Criteria createCriteriaInternal() {
 		Criteria criteria = new Criteria();
@@ -109,7 +109,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public void clear() {
 		oredCriteria.clear();
@@ -119,7 +119,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	protected abstract static class GeneratedCriteria {
 		protected List<Criterion> criteria;
@@ -792,73 +792,73 @@ public class OrganizationContactBookExample {
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionIsNull() {
-			addCriterion("customer_position is null");
+		public Criteria andPositionIsNull() {
+			addCriterion("position is null");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionIsNotNull() {
-			addCriterion("customer_position is not null");
+		public Criteria andPositionIsNotNull() {
+			addCriterion("position is not null");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionEqualTo(String value) {
-			addCriterion("customer_position =", value, "customerPosition");
+		public Criteria andPositionEqualTo(String value) {
+			addCriterion("position =", value, "position");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionNotEqualTo(String value) {
-			addCriterion("customer_position <>", value, "customerPosition");
+		public Criteria andPositionNotEqualTo(String value) {
+			addCriterion("position <>", value, "position");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionGreaterThan(String value) {
-			addCriterion("customer_position >", value, "customerPosition");
+		public Criteria andPositionGreaterThan(String value) {
+			addCriterion("position >", value, "position");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionGreaterThanOrEqualTo(String value) {
-			addCriterion("customer_position >=", value, "customerPosition");
+		public Criteria andPositionGreaterThanOrEqualTo(String value) {
+			addCriterion("position >=", value, "position");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionLessThan(String value) {
-			addCriterion("customer_position <", value, "customerPosition");
+		public Criteria andPositionLessThan(String value) {
+			addCriterion("position <", value, "position");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionLessThanOrEqualTo(String value) {
-			addCriterion("customer_position <=", value, "customerPosition");
+		public Criteria andPositionLessThanOrEqualTo(String value) {
+			addCriterion("position <=", value, "position");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionLike(String value) {
-			addCriterion("customer_position like", value, "customerPosition");
+		public Criteria andPositionLike(String value) {
+			addCriterion("position like", value, "position");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionNotLike(String value) {
-			addCriterion("customer_position not like", value, "customerPosition");
+		public Criteria andPositionNotLike(String value) {
+			addCriterion("position not like", value, "position");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionIn(List<String> values) {
-			addCriterion("customer_position in", values, "customerPosition");
+		public Criteria andPositionIn(List<String> values) {
+			addCriterion("position in", values, "position");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionNotIn(List<String> values) {
-			addCriterion("customer_position not in", values, "customerPosition");
+		public Criteria andPositionNotIn(List<String> values) {
+			addCriterion("position not in", values, "position");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionBetween(String value1, String value2) {
-			addCriterion("customer_position between", value1, value2, "customerPosition");
+		public Criteria andPositionBetween(String value1, String value2) {
+			addCriterion("position between", value1, value2, "position");
 			return (Criteria) this;
 		}
 
-		public Criteria andCustomerPositionNotBetween(String value1, String value2) {
-			addCriterion("customer_position not between", value1, value2, "customerPosition");
+		public Criteria andPositionNotBetween(String value1, String value2) {
+			addCriterion("position not between", value1, value2, "position");
 			return (Criteria) this;
 		}
 
@@ -1065,7 +1065,7 @@ public class OrganizationContactBookExample {
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table organization_contact_book
-	 * @mbg.generated  Wed Nov 15 16:01:22 CST 2017
+	 * @mbg.generated  Sun Nov 19 20:34:03 CST 2017
 	 */
 	public static class Criterion {
 		private String condition;

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

@@ -28,6 +28,12 @@ public class FollowListBo {
 	/** user_follow_business ID **/ 
 	private String ufbId;
 	
+	/** 跟进状态 **/ 
+	private String followSituation;
+	
+	/** 客户状态 **/
+	private String customerStatus;
+	
 	public String getFollowId() {
 		return followId;
 	}
@@ -82,4 +88,16 @@ public class FollowListBo {
 	public void setUfbId(String ufbId) {
 		this.ufbId = ufbId;
 	}
+	public String getFollowSituation() {
+		return followSituation;
+	}
+	public void setFollowSituation(String followSituation) {
+		this.followSituation = followSituation;
+	}
+	public String getCustomerStatus() {
+		return customerStatus;
+	}
+	public void setCustomerStatus(String customerStatus) {
+		this.customerStatus = customerStatus;
+	}
 }

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

@@ -96,7 +96,10 @@ public class BusinessApiController extends BaseController{
 	@RequestMapping(value = "/toAddFollowOneBusiness", method = RequestMethod.GET)
 	public Result toAddFollowOneBusiness(String businessId){
 		Result res = new Result();
-		res.setData(businessService.findBusinessDetail(businessId));
+		BussinessFollowBo bo = businessService.findBusinessDetail(businessId);
+		SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
+		bo.setFollowTime(format.format(new Date()));
+		res.setData(bo);
 		return res;
 	}
 	
@@ -121,12 +124,16 @@ public class BusinessApiController extends BaseController{
 	@RequestMapping(value = "/toUpdateFollowOneBusiness", method = RequestMethod.GET)
 	public Result toUpdateFollowOneBusiness(String ufbId){
 		Result res = new Result();
+		if(StringUtils.isBlank(ufbId)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
+			return res;
+		}
 		res.setData(businessService.findFollowOneBusiness(ufbId));
 		return res;
 	}
 	
 	/** 修改某个客户一个业务的当次拜访 **/
-	@RequestMapping(value = "/updateFollowOneBusiness", method = RequestMethod.GET)
+	@RequestMapping(value = "/updateFollowOneBusiness", method = RequestMethod.POST)
 	public Result updateFollowOneBusiness(BussinessFollowBo bfb){
 		Result res = new Result();
 		if(StringUtils.isBlank(bfb.getFollowId()) || StringUtils.isBlank(bfb.getUfbId())){

+ 68 - 18
src/main/java/com/goafanti/customer/controller/CustomerApiController.java

@@ -19,6 +19,8 @@ import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseController;
+import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.User;
 import com.goafanti.common.model.UserBusiness;
 import com.goafanti.common.utils.BeanUtilsExt;
@@ -95,9 +97,11 @@ public class CustomerApiController extends BaseController{
 		return res;
 	}
 	
-	/** 添加客户基本信息  **/
+	/** 添加客户基本信息  
+	 * @throws Exception 
+	 * @throws NumberFormatException **/
 	@RequestMapping(value = "/addCustomer", method = RequestMethod.POST)
-	public Result addCustomer(String name,String contacts,String contactMobile,String type){
+	public Result addCustomer(String name,String contacts,String contactMobile,String type) throws Exception{
 		Result res = new Result();
 		customerService.addCustomer(name, contacts, contactMobile, Integer.parseInt(type));
 		return res;
@@ -176,6 +180,10 @@ public class CustomerApiController extends BaseController{
 	@RequestMapping(value = "/toAddFollow", method = RequestMethod.GET)
 	public Result toAddFollow(String uid){
 		Result res =  new Result();
+		if(StringUtils.isBlank(uid)){
+			 res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
+			 return res;
+		}
 		User user = customerService.findUserAccountDetail(uid);
 		FollowBusinessBo fbb = new FollowBusinessBo();
 		SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
@@ -187,18 +195,29 @@ public class CustomerApiController extends BaseController{
 		return res;
 	}
 	
-	/** 添加拜访记录 **/
+	/** 添加拜访记录 
+	 * @throws ParseException 
+	 * @throws Exception **/
 	@RequestMapping(value = "/addFollow", method = RequestMethod.POST)
-	public Result addFollow(String userBusinessList,String uid,String ocbId,String contactType,String result,String followTime){
+	public Result addFollow(String userBusinessList,String uid,String ocbId,String contactType,String result,String followTime)  throws BusinessException{
 		Result res = new Result();
 		if(StringUtils.isBlank(uid) || StringUtils.isBlank(ocbId)){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
+			return res;
 		}
 		JSONArray ja = (JSONArray) JSON.parse(userBusinessList);
 		List<UserBusiness> list = new ArrayList<UserBusiness>();
 		if (ja != null && !ja.isEmpty()) {
+			UserBusiness userBusiness = null;
 			for (int idx = 0; idx < ja.size(); idx++) {
-				list.add(ja.getJSONObject(idx).toJavaObject(UserBusiness.class));
+				userBusiness = ja.getJSONObject(idx).toJavaObject(UserBusiness.class);
+				for(UserBusiness ub:list){
+					if(ub.getBusinessGlossoryId() == userBusiness.getBusinessGlossoryId()){
+						res.getError().add(new com.goafanti.common.bo.Error("业务类型重复,请检查后重新提交!"));
+						return res;
+					}
+				}
+				list.add(userBusiness);
 			}
 		}
 		FollowBusinessBo fbb = new FollowBusinessBo();
@@ -208,11 +227,7 @@ public class CustomerApiController extends BaseController{
 		fbb.setResult(result);
 		fbb.setFollowTime(followTime);
 		fbb.setUserBusinessList(list);	
-		try {
-			customerService.addFollow(fbb);
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
+		customerService.addFollow(fbb);
 		return res;
 	}
 	
@@ -226,18 +241,30 @@ public class CustomerApiController extends BaseController{
 		return res;
 	}
 	
-	/** 修改拜访记录 **/ 
+	/** 修改拜访记录 
+	 * @throws ParseException 
+	 * @throws BusinessException 
+	 */
 	@RequestMapping(value = "/updateFollow", method = RequestMethod.POST)
-	public Result updateFollow(String userBusinessList,String followId,String followTime,String uid,String contactType,String result){
+	public Result updateFollow(String userBusinessList,String followId,String followTime,String uid,String contactType,String result) throws BusinessException{
 		Result res = new Result();
 		if(StringUtils.isBlank(uid) || StringUtils.isBlank(followId)){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
+			return res;
 		}
 		JSONArray ja = (JSONArray) JSON.parse(userBusinessList);
 		List<UserBusiness> list = new ArrayList<UserBusiness>();
 		if (ja != null && !ja.isEmpty()) {
+			UserBusiness userBusiness = null;
 			for (int idx = 0; idx < ja.size(); idx++) {
-				list.add(ja.getJSONObject(idx).toJavaObject(UserBusiness.class));
+				userBusiness = ja.getJSONObject(idx).toJavaObject(UserBusiness.class);
+				for(UserBusiness ub:list){
+					if(ub.getBusinessGlossoryId() == userBusiness.getBusinessGlossoryId()){
+						res.getError().add(new com.goafanti.common.bo.Error("业务类型重复,请检查后重新提交!"));
+						return res;
+					}
+				}
+				list.add(userBusiness);
 			}
 		}
 		FollowBusinessBo fbb = new FollowBusinessBo();
@@ -246,11 +273,8 @@ public class CustomerApiController extends BaseController{
 		fbb.setContactType(contactType);
 		fbb.setResult(result);
 		fbb.setUserBusinessList(list);	
-		try {
-			customerService.updateFollow(fbb);
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
+		fbb.setFollowId(followId);
+		customerService.updateFollow(fbb);
 		return res;
 	}
 	
@@ -261,4 +285,30 @@ public class CustomerApiController extends BaseController{
 		res.setData(customerService.findAllContacts(uid));
 		return res;
 	}
+	
+	/** 修改企业联系人 **/
+	@RequestMapping(value = "/updateCustomerContacts", method = RequestMethod.POST)
+	public Result updateCustomerContacts(String contactList,String uid){
+		Result res = new Result();
+		if(StringUtils.isBlank(uid)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
+			return res;
+		}
+		JSONArray ja = (JSONArray) JSON.parse(contactList);
+		List<OrganizationContactBook>  ocbList = new ArrayList<OrganizationContactBook>();
+		OrganizationContactBook ocb = null;
+		if(ja != null & !ja.isEmpty()){
+			for (int idx = 0; idx < ja.size(); idx++) {
+				ocb = ja.getJSONObject(idx).toJavaObject(OrganizationContactBook.class);
+				if(StringUtils.isBlank(ocb.getMobile()) || StringUtils.isBlank(ocb.getName())){
+					res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名和手机号码为必填"));
+					return res;
+				}
+				if(StringUtils.isBlank(ocb.getUid())) ocb.setUid(uid);
+				ocbList.add(ocb);
+			}
+		}
+		customerService.updateCustomerContacts(ocbList,uid);
+		return res;
+	}
 }

+ 12 - 4
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -1,9 +1,9 @@
 package com.goafanti.customer.service;
 
-import java.text.ParseException;
 import java.util.List;
 import java.util.Set;
 
+import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.User;
 import com.goafanti.common.model.UserBusiness;
@@ -95,7 +95,7 @@ public interface CustomerService {
 	 * @param type 客户类型
 	 * @return
 	 */
-	int addCustomer(String name,String contacts,String contactMobile,Integer type);
+	int addCustomer(String name,String contacts,String contactMobile,Integer type)  throws BusinessException;
 	
 	
 	/**
@@ -152,7 +152,7 @@ public interface CustomerService {
 	 * 添加拜访记录
 	 * @param fbb
 	 */
-	int addFollow(FollowBusinessBo fbb)  throws ParseException;
+	int addFollow(FollowBusinessBo fbb) throws BusinessException;
 	
 	/**
 	 * 查询拜访记录详情
@@ -172,7 +172,7 @@ public interface CustomerService {
 	 * 修改拜访记录
 	 * @param fbb
 	 */
-	int updateFollow(FollowBusinessBo fbb)  throws ParseException ;
+	int updateFollow(FollowBusinessBo fbb)  throws BusinessException;
 	
 	/**
 	 * 查询客户的所有联系人
@@ -180,4 +180,12 @@ public interface CustomerService {
 	 * @return
 	 */
 	Set<OrganizationContactBook> findAllContacts(String uid);
+	
+	/**
+	 * 更新客户联系人
+	 * @param ocbList
+	 * @return
+	 */
+	int updateCustomerContacts(List<OrganizationContactBook> ocbList,String uid);
+	
 }

+ 2 - 0
src/main/java/com/goafanti/customer/service/impl/BusinessServiceImpl.java

@@ -153,6 +153,7 @@ public class BusinessServiceImpl extends BaseMybatisDao<UserBusinessMapper> impl
 		userFollow.setFollowCount(followCount);
 		userFollow.setContactType(Integer.parseInt(bfb.getContactType()));
 		userFollow.setAid(TokenManager.getAdminId());
+		userFollow.setUid(bfb.getUid());
 		userFollowMapper.insert(userFollow);
 		UserFollowBusiness userFollowBusiness = new UserFollowBusiness();
 		String ufbId = UUID.randomUUID().toString();
@@ -187,6 +188,7 @@ public class BusinessServiceImpl extends BaseMybatisDao<UserBusinessMapper> impl
 		userFollow.setId(bfb.getFollowId());
 		userFollow.setContactType(Integer.parseInt(bfb.getContactType()));
 		userFollow.setResult(bfb.getResult());
+		if(StringUtils.isNotBlank(bfb.getOcbId())) userFollow.setOcbId(bfb.getOcbId());
 		userFollowMapper.updateByPrimaryKeySelective(userFollow);
 		return 1;
 	}

+ 60 - 17
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -13,12 +13,14 @@ import java.util.UUID;
 
 import javax.annotation.Resource;
 
+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.bo.Error;
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.dao.BusinessGlossoryMapper;
 import com.goafanti.common.dao.OrganizationContactBookMapper;
 import com.goafanti.common.dao.OrganizationIdentityMapper;
@@ -172,7 +174,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 
 	@Override
 	@Transactional
-	public int addCustomer(String name, String contacts, String contactMobile, Integer type){
+	public int addCustomer(String name, String contacts, String contactMobile, Integer type)  throws BusinessException{
 		User user = new User();
 		Date now = new Date();
 		String uid = UUID.randomUUID().toString();
@@ -188,7 +190,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		user.setAid(TokenManager.getAdminId());
 		user.setType(type);
 		user.setCurrentMemberStatus(0);
-		user.setLvl(0);
+		user.setLvl(1);
 		user.setCreateTime(now);
 		user.setUpdateTime(now);
 		user.setMobile(contactMobile);
@@ -207,7 +209,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 			ui.setAuditStatus(0);
 			userIdentityMapper.insert(ui);
 		}else if(type == 1){
-			if(userMapper.judgeCustomerByName(name)>1) throw new BusinessException("客户已存在");
+			if(userMapper.judgeCustomerByName(name)>1) throw new BusinessException(new Error(ErrorConstants.PARAM_ERROR, name , "客户已存在"));
 			// 创建企业认证信息
 			OrganizationIdentity oi = new OrganizationIdentity();
 			oi.setUnitName(name);
@@ -218,7 +220,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 			oi.setHighTechZone(0);
 			oi.setInternational(0);
 			oi.setListed(0);
-			oi.setAuditStatus(0);
+			oi.setAuditStatus(5); //实名企业
 			organizationIdentityMapper.insert(oi);
 		}
 		userMapper.insert(user);	
@@ -296,8 +298,8 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 
 	@Override
 	@Transactional
-	public int addFollow(FollowBusinessBo fbb) throws ParseException {
-		if(fbb.getUserBusinessList().size()<1) throw new BusinessException(new Error("至少需要填一个跟进业务"));
+	public int addFollow(FollowBusinessBo fbb) throws BusinessException{
+		if(fbb.getUserBusinessList().size()<1) throw new BusinessException(new Error(ErrorConstants.PARAM_ERROR, "", "至少需要填一个跟进业务"));
 		//更新跟进记录表
 		SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
 		UserFollow userFollow = new UserFollow();
@@ -306,7 +308,11 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		userFollow.setAid(TokenManager.getAdminId());
 		userFollow.setContactType(Integer.parseInt(fbb.getContactType()));
 		userFollow.setEffective(0);
-		userFollow.setCreateTime(format.parse(fbb.getFollowTime()));
+		try {
+			userFollow.setCreateTime(format.parse(fbb.getFollowTime()));
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
 		userFollow.setOcbId(fbb.getOcbId());
 		userFollow.setResult(fbb.getResult());
 		userFollow.setUid(fbb.getUid());
@@ -327,7 +333,11 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 				userBusiness.setCustomerStatus(ub.getCustomerStatus());
 				userBusiness.setFollowSituation(ub.getFollowSituation());
 				userBusiness.setUid(fbb.getUid());
-				userBusiness.setUpdateTime(format.parse(fbb.getFollowTime()));
+				try {
+					userBusiness.setUpdateTime(format.parse(fbb.getFollowTime()));
+				} catch (ParseException e) {
+					e.printStackTrace();
+				}
 				userBusiness.setAid(TokenManager.getAdminId());
 				userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
 				//更新业务中间表
@@ -343,17 +353,21 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 				//检测是否可以创建业务	
 				if(userBusinessMapper.judgeBusiness(fbb.getUid(), ub.getBusinessGlossoryId(), "")>0){
 					String businessName = businessGlossoryMapper.selectByPrimaryKey(ub.getBusinessGlossoryId()).getName();
-					throw new BusinessException(new Error(businessName+" 已经被跟进"));
+					throw new BusinessException(new Error(ErrorConstants.PARAM_ERROR, businessName, "已经被跟进"));
 				}
 				String ubId = UUID.randomUUID().toString();
 				//更新业务表
 				userBusiness.setId(ubId);
 				userBusiness.setBusinessGlossoryId(ub.getBusinessGlossoryId());
-				userBusiness.setCreateTime(format.parse(fbb.getFollowTime()));
+				try {
+					userBusiness.setCreateTime(format.parse(fbb.getFollowTime()));
+					userBusiness.setUpdateTime(format.parse(fbb.getFollowTime()));
+				} catch (ParseException e) {
+					e.printStackTrace();
+				}
 				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);	
 				//更新业务中间表
@@ -384,9 +398,10 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 
 	@Override
 	@Transactional
-	public int updateFollow(FollowBusinessBo fbb) throws ParseException {
+	public int updateFollow(FollowBusinessBo fbb) throws BusinessException{
 		UserFollow userFollow  = new UserFollow();
 		SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
+		userFollow.setId(fbb.getFollowId());
 		if(StringUtils.isNotBlank(fbb.getOcbId())) userFollow.setOcbId(fbb.getOcbId());
 		userFollow.setResult(fbb.getResult());
 		userFollow.setContactType(Integer.parseInt(fbb.getContactType()));
@@ -404,27 +419,31 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 				//检测是否可以创建业务	
 				if(userBusinessMapper.judgeBusiness(fbb.getUid(), ub.getBusinessGlossoryId(), "")>0){
 					String businessName = businessGlossoryMapper.selectByPrimaryKey(ub.getBusinessGlossoryId()).getName();
-					throw new BusinessException(new Error(businessName+" 已经被跟进"));
+					throw new BusinessException(new Error(ErrorConstants.PARAM_ERROR, businessName, "已经被跟进"));
 				}
 				String ubId = UUID.randomUUID().toString();		
 				UserBusiness userBusiness = new UserBusiness();
 				//更新业务表
 				userBusiness.setId(ubId);
 				userBusiness.setBusinessGlossoryId(ub.getBusinessGlossoryId());
-				userBusiness.setCreateTime(format.parse(fbb.getFollowTime()));
+				try {
+					userBusiness.setCreateTime(format.parse(fbb.getFollowTime()));
+					userBusiness.setUpdateTime(format.parse(fbb.getFollowTime()));
+				} catch (ParseException e) {
+					e.printStackTrace();
+				}
 				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.setId(ufbId);
+				userFollowBusiness.setFollowId(fbb.getFollowId());
 				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);
@@ -439,5 +458,29 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		result.addAll(userMapper.findAllContacts(uid));
 		return result;
 	}
+
+	@Override
+	public int updateCustomerContacts(List<OrganizationContactBook> ocbList,String uid) {
+		if(ocbList.size()>0){
+			OrganizationContactBook ocb = null;
+			for(OrganizationContactBook item: ocbList){
+				ocb = new OrganizationContactBook();
+				try {
+					BeanUtils.copyProperties(ocb, item);
+					if(StringUtils.isBlank(ocb.getId())){
+						ocb.setId(UUID.randomUUID().toString());
+						ocb.setUid(uid);
+						ocb.setAid(TokenManager.getAdminId());
+						organizationContactBookMapper.insert(ocb);
+					}else{
+						organizationContactBookMapper.updateByPrimaryKeySelective(ocb);
+					}
+				} catch (IllegalAccessException | InvocationTargetException e) {
+					e.printStackTrace();
+				}
+			}		
+		}
+		return 1;
+	}
 	
 }