ソースを参照

姓名查询等接口

zou_ht 8 年 前
コミット
197a67ef99

+ 2 - 2
generatorConfig.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
 <generatorConfiguration>
-  <classPathEntry location="E:/mysql-connector-java-5.1.40.jar" />
+  <classPathEntry location="E:/mysql-connector-java-5.1.44.jar" />
   <context id="context1">	
     <jdbcConnection connectionURL="jdbc:mysql://192.168.1.213:3306/aft" 
     	driverClass="com.mysql.jdbc.Driver" password="123456" userId="dev" />
@@ -9,6 +9,6 @@
     <sqlMapGenerator targetPackage="com.goafanti.common.mapper" targetProject="AFT" />
     <javaClientGenerator targetPackage="com.goafanti.common.dao" targetProject="AFT" type="XMLMAPPER" />
     <table schema="aft" tableName="customer_user_info"/>
-    <table schema="aft" tableName="customer_organization_info"/>
+   <!--  <table schema="aft" tableName="customer_organization_info"/> -->
   </context>
 </generatorConfiguration>

+ 12 - 3
src/main/java/com/goafanti/common/dao/CustomerMapper.java

@@ -48,7 +48,7 @@ public interface CustomerMapper {
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
 	 * @mbg.generated  Fri Oct 13 15:28:17 CST 2017
 	 */
-	CustomerOut selectByPrimaryKey(String id);
+	Customer selectByPrimaryKey(String id);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
@@ -73,7 +73,14 @@ public interface CustomerMapper {
 	 * @mbg.generated  Fri Oct 13 15:28:17 CST 2017
 	 */
 	int updateByPrimaryKey(Customer record);
-
+	
+	/**
+	 * 查询
+	 * @param id
+	 * @return
+	 */
+	CustomerOut selectCustomerById(String id);
+	
 	/**
      * 查询客户详情
      */
@@ -82,7 +89,9 @@ public interface CustomerMapper {
     /**
      * 
      * @param ladderId 上层领导ID
-     * @return �??有包含上层领导ID�?? 客户记录
+     * @return 查询团队 客户记录
      */
     List<Customer> selectByLadderId(@Param("ladderId")String ladderId);
+
+    
 }

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

@@ -10,68 +10,68 @@ public interface CustomerUserInfoMapper {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	long countByExample(CustomerUserInfoExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	int deleteByExample(CustomerUserInfoExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	int deleteByPrimaryKey(String id);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	int insert(CustomerUserInfo record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	int insertSelective(CustomerUserInfo record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	List<CustomerUserInfo> selectByExample(CustomerUserInfoExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	CustomerUserInfo selectByPrimaryKey(String id);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	int updateByExampleSelective(@Param("record") CustomerUserInfo record,
 			@Param("example") CustomerUserInfoExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	int updateByExample(@Param("record") CustomerUserInfo record, @Param("example") CustomerUserInfoExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	int updateByPrimaryKeySelective(CustomerUserInfo record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	int updateByPrimaryKey(CustomerUserInfo record);
 
@@ -88,5 +88,17 @@ public interface CustomerUserInfoMapper {
 	 * 新增
 	 */
 	int insertCustomerUser(CustomerUserInfo record);
+	/**
+	 * 查询联系人名称列表
+	 */
+	List<CustomerUserInfo> selectUserNameList(String cid);
+	/**
+	 * 查询是否存在主要联系人
+	 */
+	String selectPrimaryFlgByCid(String cid);
+	/**
+	 * 更新主要联系人状态
+	 */
+	int updataPrimaryFlg(String cid);
 
 }

+ 26 - 36
src/main/java/com/goafanti/common/mapper/CustomerMapper.xml

@@ -117,25 +117,15 @@
     </if>
   </select>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerOut">
-    <!--
+      <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Fri Oct 13 15:28:17 CST 2017.
     -->
     select 
-    a.id,
-	a.aid,
-	a.paid,
-	a.share_type as shareType,
-	a.customer_type as customerType,
-	a.customer_status as customerStatus,
-	a.company_intention as companyIntention,
-	a.follow_situation as followSituation,
-	a.tag,
-	a.create_time as createTime, 
-	a.follow_id followId,
-    a.from customer a
-    where effective=0 and id = #{id,jdbcType=VARCHAR}
+    <include refid="Base_Column_List" />
+    from customer
+    where id = #{id,jdbcType=VARCHAR}
   </select>
   <!-- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
     
@@ -409,28 +399,7 @@
       effective = #{effective,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>
-	
-	  
-  <select id="selectCustomerByPrimaryKey" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerOut">
-    select 
-    a.customer_typ as customerTyp,
-    a.share_type as shareTyp,
-    a.company_intention as companyIntention,
-    a.create_time as createTime,
-    a.follow_situation as followSituation,
-    a.customer_statue as customerStatue,
-    b.name,b.sex,b.mobile,b.tel_num as telNum,b.email,b.qq,b.wechat,b.depatrment,b.remarks,
-    b.customer_position as customerPosition,
-    c.company_name as companyName,
-    c.location_province as locationProvince,
-    c.company_industry as companyIndustry,
-    c.adress --&gt;
-    from customer a 
-    left join customer_user_info b on  a.id=b.cid
-    left join customer_organization_info c on a.id=c.cid
-    where id = #{id,jdbcType=VARCHAR}
-  </select> 
-  
+	 
   <select id="selectCustomer"  resultType="com.goafanti.customer.bo.CustomerOut">
     select a.id,a.customer_type as customerType,a.share_type as shareType,a.company_intention as CompanyIntention,
     a.tag,a.follow_situation as followSituation,a.customer_status as customerStatus,
@@ -517,4 +486,25 @@
 	</if>
   </select>
   
+  <select id="selectCustomerById" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerOut">
+    select 
+    a.customer_type as customerType,
+    a.share_type as shareType,
+    a.company_intention as companyIntention,
+    a.create_time as createTime,
+    a.follow_situation as followSituation,
+    a.customer_status as customerStatus ,
+    b.name as contactName,b.sex,b.mobile,b.tel_num as telNum,b.email,b.qq,b.wechat,b.depatrment,b.remarks,
+    b.customer_position as customerPosition,
+    c.company_name as companyName,
+    c.location_province as locationProvince,
+    c.company_industry as companyIndustry,
+    c.adress,
+    d.name as adminName
+    from customer a 
+    left join customer_user_info b on  a.id=b.cid
+    left join customer_organization_info c on a.id=c.cid
+    left join admin d on a.aid=d.id
+    where a.id = #{id,jdbcType=VARCHAR} and b.primary_flg=0
+  </select> 
 </mapper>

+ 56 - 20
src/main/java/com/goafanti/common/mapper/CustomerUserInfoMapper.xml

@@ -5,7 +5,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     <id column="id" jdbcType="VARCHAR" property="id" />
     <result column="cid" jdbcType="VARCHAR" property="cid" />
@@ -19,12 +19,13 @@
     <result column="customer_position" jdbcType="VARCHAR" property="customerPosition" />
     <result column="remarks" jdbcType="VARCHAR" property="remarks" />
     <result column="tel_num" jdbcType="VARCHAR" property="telNum" />
+    <result column="primary_flg" jdbcType="INTEGER" property="primaryFlg" />
   </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 Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     <where>
       <foreach collection="oredCriteria" item="criteria" separator="or">
@@ -58,7 +59,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     <where>
       <foreach collection="example.oredCriteria" item="criteria" separator="or">
@@ -92,16 +93,16 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     id, cid, name, sex, mobile, email, qq, wechat, depatrment, customer_position, remarks, 
-    tel_num
+    tel_num, primary_flg
   </sql>
   <select id="selectByExample" parameterType="com.goafanti.common.model.CustomerUserInfoExample" resultMap="BaseResultMap">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     select
     <if test="distinct">
@@ -120,7 +121,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     select 
     <include refid="Base_Column_List" />
@@ -131,7 +132,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     delete from customer_user_info
     where id = #{id,jdbcType=VARCHAR}
@@ -140,7 +141,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     delete from customer_user_info
     <if test="_parameter != null">
@@ -151,22 +152,24 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     insert into customer_user_info (id, cid, name, 
       sex, mobile, email, qq, 
       wechat, depatrment, customer_position, 
-      remarks, tel_num)
+      remarks, tel_num, primary_flg
+      )
     values (#{id,jdbcType=VARCHAR}, #{cid,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}, 
-      #{remarks,jdbcType=VARCHAR}, #{telNum,jdbcType=VARCHAR})
+      #{remarks,jdbcType=VARCHAR}, #{telNum,jdbcType=VARCHAR}, 0
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.CustomerUserInfo">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     insert into customer_user_info
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -206,6 +209,9 @@
       <if test="telNum != null">
         tel_num,
       </if>
+      <if test="primaryFlg != null">
+        primary_flg,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -244,13 +250,16 @@
       <if test="telNum != null">
         #{telNum,jdbcType=VARCHAR},
       </if>
+      <if test="primaryFlg != null">
+        #{primaryFlg,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.goafanti.common.model.CustomerUserInfoExample" resultType="java.lang.Long">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     select count(*) from customer_user_info
     <if test="_parameter != null">
@@ -261,7 +270,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     update customer_user_info
     <set>
@@ -301,6 +310,9 @@
       <if test="record.telNum != null">
         tel_num = #{record.telNum,jdbcType=VARCHAR},
       </if>
+      <if test="record.primaryFlg != null">
+        primary_flg = #{record.primaryFlg,jdbcType=INTEGER},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -310,7 +322,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     update customer_user_info
     set id = #{record.id,jdbcType=VARCHAR},
@@ -324,7 +336,8 @@
       depatrment = #{record.depatrment,jdbcType=VARCHAR},
       customer_position = #{record.customerPosition,jdbcType=VARCHAR},
       remarks = #{record.remarks,jdbcType=VARCHAR},
-      tel_num = #{record.telNum,jdbcType=VARCHAR}
+      tel_num = #{record.telNum,jdbcType=VARCHAR},
+      primary_flg = #{record.primaryFlg,jdbcType=INTEGER}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -333,7 +346,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     update customer_user_info
     <set>
@@ -370,6 +383,9 @@
       <if test="telNum != null">
         tel_num = #{telNum,jdbcType=VARCHAR},
       </if>
+      <if test="primaryFlg != null">
+        primary_flg = #{primaryFlg,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -377,7 +393,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri Oct 13 20:04:10 CST 2017.
+      This element was generated on Sat Oct 14 17:29:26 CST 2017.
     -->
     update customer_user_info
     set cid = #{cid,jdbcType=VARCHAR},
@@ -390,7 +406,27 @@
       depatrment = #{depatrment,jdbcType=VARCHAR},
       customer_position = #{customerPosition,jdbcType=VARCHAR},
       remarks = #{remarks,jdbcType=VARCHAR},
-      tel_num = #{telNum,jdbcType=VARCHAR}
+      tel_num = #{telNum,jdbcType=VARCHAR},
+      primary_flg = #{primaryFlg,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>  
+  
+  <select id="selectUserNameList" parameterType="java.lang.String" resultType="com.goafanti.common.model.CustomerUserInfo">
+    select 
+    id,name 
+    from customer_user_info
+    where 1=1 and cid = #{cid,jdbcType=VARCHAR}
+  </select>
+  
+  <select id="selectPrimaryFlgByCid" parameterType="java.lang.String" resultType="java.lang.String">
+    select 
+    id
+    from customer_user_info
+    where 1=1 and cid = #{cid,jdbcType=VARCHAR} and primary_flg=0
+  </select>
+  
+  <update id="updataPrimaryFlg" parameterType="java.lang.String" >
+    update customer set primary_flg=1 where 1=1 and cid = #{cid,jdbcType=VARCHAR}
+  </update>
+ 
 </mapper>

+ 59 - 36
src/main/java/com/goafanti/common/model/CustomerUserInfo.java

@@ -4,69 +4,74 @@ public class CustomerUserInfo {
 
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.id
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String id;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.cid
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String cid;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.name
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String name;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.sex
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String sex;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.mobile
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String mobile;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.email
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String email;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.qq
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String qq;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.wechat
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String wechat;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.depatrment
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String depatrment;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.customer_position
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String customerPosition;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.remarks
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String remarks;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.tel_num
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	private String telNum;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column customer_user_info.primary_flg
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
+	 */
+	private Integer primaryFlg;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.id
 	 * @return  the value of customer_user_info.id
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getId() {
 		return id;
@@ -75,7 +80,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.id
 	 * @param id  the value for customer_user_info.id
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setId(String id) {
 		this.id = id;
@@ -84,7 +89,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.cid
 	 * @return  the value of customer_user_info.cid
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getCid() {
 		return cid;
@@ -93,7 +98,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.cid
 	 * @param cid  the value for customer_user_info.cid
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setCid(String cid) {
 		this.cid = cid;
@@ -102,7 +107,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.name
 	 * @return  the value of customer_user_info.name
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getName() {
 		return name;
@@ -111,7 +116,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.name
 	 * @param name  the value for customer_user_info.name
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setName(String name) {
 		this.name = name;
@@ -120,7 +125,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.sex
 	 * @return  the value of customer_user_info.sex
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getSex() {
 		return sex;
@@ -129,7 +134,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.sex
 	 * @param sex  the value for customer_user_info.sex
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setSex(String sex) {
 		this.sex = sex;
@@ -138,7 +143,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.mobile
 	 * @return  the value of customer_user_info.mobile
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getMobile() {
 		return mobile;
@@ -147,7 +152,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.mobile
 	 * @param mobile  the value for customer_user_info.mobile
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setMobile(String mobile) {
 		this.mobile = mobile;
@@ -156,7 +161,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.email
 	 * @return  the value of customer_user_info.email
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getEmail() {
 		return email;
@@ -165,7 +170,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.email
 	 * @param email  the value for customer_user_info.email
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setEmail(String email) {
 		this.email = email;
@@ -174,7 +179,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.qq
 	 * @return  the value of customer_user_info.qq
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getQq() {
 		return qq;
@@ -183,7 +188,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.qq
 	 * @param qq  the value for customer_user_info.qq
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setQq(String qq) {
 		this.qq = qq;
@@ -192,7 +197,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.wechat
 	 * @return  the value of customer_user_info.wechat
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getWechat() {
 		return wechat;
@@ -201,7 +206,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.wechat
 	 * @param wechat  the value for customer_user_info.wechat
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setWechat(String wechat) {
 		this.wechat = wechat;
@@ -210,7 +215,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.depatrment
 	 * @return  the value of customer_user_info.depatrment
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getDepatrment() {
 		return depatrment;
@@ -219,7 +224,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.depatrment
 	 * @param depatrment  the value for customer_user_info.depatrment
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setDepatrment(String depatrment) {
 		this.depatrment = depatrment;
@@ -228,7 +233,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.customer_position
 	 * @return  the value of customer_user_info.customer_position
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getCustomerPosition() {
 		return customerPosition;
@@ -237,7 +242,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.customer_position
 	 * @param customerPosition  the value for customer_user_info.customer_position
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setCustomerPosition(String customerPosition) {
 		this.customerPosition = customerPosition;
@@ -246,7 +251,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.remarks
 	 * @return  the value of customer_user_info.remarks
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getRemarks() {
 		return remarks;
@@ -255,7 +260,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.remarks
 	 * @param remarks  the value for customer_user_info.remarks
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setRemarks(String remarks) {
 		this.remarks = remarks;
@@ -264,7 +269,7 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.tel_num
 	 * @return  the value of customer_user_info.tel_num
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getTelNum() {
 		return telNum;
@@ -273,10 +278,28 @@ public class CustomerUserInfo {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.tel_num
 	 * @param telNum  the value for customer_user_info.tel_num
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setTelNum(String telNum) {
 		this.telNum = telNum;
 	}
 
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column customer_user_info.primary_flg
+	 * @return  the value of customer_user_info.primary_flg
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
+	 */
+	public Integer getPrimaryFlg() {
+		return primaryFlg;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column customer_user_info.primary_flg
+	 * @param primaryFlg  the value for customer_user_info.primary_flg
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
+	 */
+	public void setPrimaryFlg(Integer primaryFlg) {
+		this.primaryFlg = primaryFlg;
+	}
+
 }

+ 76 - 16
src/main/java/com/goafanti/common/model/CustomerUserInfoExample.java

@@ -6,23 +6,23 @@ import java.util.List;
 public class CustomerUserInfoExample {
     /**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	protected String orderByClause;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	protected boolean distinct;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	protected List<Criteria> oredCriteria;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public CustomerUserInfoExample() {
 		oredCriteria = new ArrayList<Criteria>();
@@ -30,7 +30,7 @@ public class CustomerUserInfoExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setOrderByClause(String orderByClause) {
 		this.orderByClause = orderByClause;
@@ -38,7 +38,7 @@ public class CustomerUserInfoExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public String getOrderByClause() {
 		return orderByClause;
@@ -46,7 +46,7 @@ public class CustomerUserInfoExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void setDistinct(boolean distinct) {
 		this.distinct = distinct;
@@ -54,7 +54,7 @@ public class CustomerUserInfoExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public boolean isDistinct() {
 		return distinct;
@@ -62,7 +62,7 @@ public class CustomerUserInfoExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public List<Criteria> getOredCriteria() {
 		return oredCriteria;
@@ -70,7 +70,7 @@ public class CustomerUserInfoExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void or(Criteria criteria) {
 		oredCriteria.add(criteria);
@@ -78,7 +78,7 @@ public class CustomerUserInfoExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public Criteria or() {
 		Criteria criteria = createCriteriaInternal();
@@ -88,7 +88,7 @@ public class CustomerUserInfoExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public Criteria createCriteria() {
 		Criteria criteria = createCriteriaInternal();
@@ -100,7 +100,7 @@ public class CustomerUserInfoExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	protected Criteria createCriteriaInternal() {
 		Criteria criteria = new Criteria();
@@ -109,7 +109,7 @@ public class CustomerUserInfoExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public void clear() {
 		oredCriteria.clear();
@@ -119,7 +119,7 @@ public class CustomerUserInfoExample {
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	protected abstract static class GeneratedCriteria {
 		protected List<Criterion> criteria;
@@ -1001,11 +1001,71 @@ public class CustomerUserInfoExample {
 			addCriterion("tel_num not between", value1, value2, "telNum");
 			return (Criteria) this;
 		}
+
+		public Criteria andPrimaryFlgIsNull() {
+			addCriterion("primary_flg is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andPrimaryFlgIsNotNull() {
+			addCriterion("primary_flg is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andPrimaryFlgEqualTo(Integer value) {
+			addCriterion("primary_flg =", value, "primaryFlg");
+			return (Criteria) this;
+		}
+
+		public Criteria andPrimaryFlgNotEqualTo(Integer value) {
+			addCriterion("primary_flg <>", value, "primaryFlg");
+			return (Criteria) this;
+		}
+
+		public Criteria andPrimaryFlgGreaterThan(Integer value) {
+			addCriterion("primary_flg >", value, "primaryFlg");
+			return (Criteria) this;
+		}
+
+		public Criteria andPrimaryFlgGreaterThanOrEqualTo(Integer value) {
+			addCriterion("primary_flg >=", value, "primaryFlg");
+			return (Criteria) this;
+		}
+
+		public Criteria andPrimaryFlgLessThan(Integer value) {
+			addCriterion("primary_flg <", value, "primaryFlg");
+			return (Criteria) this;
+		}
+
+		public Criteria andPrimaryFlgLessThanOrEqualTo(Integer value) {
+			addCriterion("primary_flg <=", value, "primaryFlg");
+			return (Criteria) this;
+		}
+
+		public Criteria andPrimaryFlgIn(List<Integer> values) {
+			addCriterion("primary_flg in", values, "primaryFlg");
+			return (Criteria) this;
+		}
+
+		public Criteria andPrimaryFlgNotIn(List<Integer> values) {
+			addCriterion("primary_flg not in", values, "primaryFlg");
+			return (Criteria) this;
+		}
+
+		public Criteria andPrimaryFlgBetween(Integer value1, Integer value2) {
+			addCriterion("primary_flg between", value1, value2, "primaryFlg");
+			return (Criteria) this;
+		}
+
+		public Criteria andPrimaryFlgNotBetween(Integer value1, Integer value2) {
+			addCriterion("primary_flg not between", value1, value2, "primaryFlg");
+			return (Criteria) this;
+		}
 	}
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table customer_user_info
-	 * @mbg.generated  Fri Oct 13 20:04:10 CST 2017
+	 * @mbg.generated  Sat Oct 14 17:29:26 CST 2017
 	 */
 	public static class Criterion {
 		private String condition;

+ 35 - 0
src/main/java/com/goafanti/customer/bo/CustomerIn.java

@@ -33,6 +33,15 @@ public class CustomerIn {
 	/** 跟进结果**/
 	private String followResult;
 	
+	/** 操作前客户状态  **/
+	private String beforeCustomerStatus;
+	
+	/** 操作前意向服务 **/
+	private String beforeCompanyIntention;
+	
+	/** 操作前跟进进度 **/
+	private String beforeFollowSituation;
+	
 	/** 跟单人 **/
 	private String adminName;
 	
@@ -58,6 +67,32 @@ public class CustomerIn {
 	public void setFollowId(String followId) {
 		this.followId = followId;
 	}
+	
+
+	public String getBeforeCustomerStatus() {
+		return beforeCustomerStatus;
+	}
+
+	public void setBeforeCustomerStatus(String beforeCustomerStatus) {
+		this.beforeCustomerStatus = beforeCustomerStatus;
+	}
+
+	public String getBeforeCompanyIntention() {
+		return beforeCompanyIntention;
+	}
+
+	public void setBeforeCompanyIntention(String beforeCompanyIntention) {
+		this.beforeCompanyIntention = beforeCompanyIntention;
+	}
+
+	public String getBeforeFollowSituation() {
+		return beforeFollowSituation;
+	}
+
+	public void setBeforeFollowSituation(String beforeFollowSituation) {
+		this.beforeFollowSituation = beforeFollowSituation;
+	}
+
 
 	public String getCustomerName() {
 		return customerName;

+ 46 - 23
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -9,6 +9,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -101,24 +102,13 @@ public class AdminCustomerApiController extends BaseController {
 	 * @throws ParseException
 	 */
 	@RequestMapping(value = "/deleteCustomer", method = RequestMethod.POST)
-	public Result deleteCustomer(String id) throws ParseException {
+	public Result deleteCustomer(String id,CustomerIn cusIn) throws ParseException {
 		Result res=new Result();
 		customerService.deleteCustomer(id);
+		customerService.saveCustomerLogo(cusIn, AFTConstants.CUSTOMER_DELETE,id);
 		return res;
 	}
 	
-	/**
-	 * 详情查询接口
-	 * 
-	 * @return
-	 * @throws ParseException
-	 */
-	@RequestMapping(value = "/detail", method = RequestMethod.POST)
-	public Result selectCustomerDetail(String id) throws ParseException {
-		Result res=new Result();
-
-		return res;
-	}
 		
 	/**
 	 * 查询操作员信息
@@ -161,24 +151,57 @@ public class AdminCustomerApiController extends BaseController {
 	}
 	
 	/**
-	 * 查询联系人资料
+	 * 查询联系人姓名列表
 	 * 
 	 * @return
 	 */
-	public Result findCustomerUserName (String cid) {
-		return null;
-		
+	@RequestMapping(value = "/findCustomerUserNameList", method = RequestMethod.POST)
+	public Result findCustomerUserNameList (String cid) {
+		Result res =new Result();
+	    res.setData(customerUserService.findCustomerUserNameList(cid));
+	    return res;
 	}
 	
-	
 	/**
-	 * 删除
+	 * 添加联系人
 	 * 
 	 * @return
+	 * @throws InvocationTargetException 
+	 * @throws IllegalAccessException 
 	 */
-	public Result addFollowUpRecord(CustomerIn cusIn,FollowUpRecord fur) throws ParseException, IllegalAccessException, InvocationTargetException {
-		
-		
-		return null;
+	@RequestMapping(value = "/addContacter", method = RequestMethod.POST)
+	public Result addContacter (CustomerIn cusIn) throws IllegalAccessException, InvocationTargetException {
+		Result res =new Result();
+		CustomerUserInfo cui =new CustomerUserInfo();
+		BeanUtils.copyProperties(cui, cusIn);
+		cui.setId(UUID.randomUUID().toString());
+		if(cui.getPrimaryFlg()==0) {//0:主要联系人,1-非主要联系人
+			String primaryId = customerUserService.selectPrimaryFlgByCid(cusIn.getId());
+			if(StringUtils.isNoneBlank(primaryId)) {
+				customerUserService.updPrimaryFlg(cusIn.getId());//把主要联系人状态给去掉
+			}
+			customerUserService.addCustomerUserInfo(cui);//再添加联系人
+		}else {
+			customerUserService.addCustomerUserInfo(cui);
+		}
+	    return res;
 	}
+	
+	
+	/**
+	 * 修改客户信息
+	 * @return
+	 * @throws InvocationTargetException 
+	 * @throws IllegalAccessException 
+	
+	 */
+	@RequestMapping(value = "/updFollowRecord", method = RequestMethod.POST)
+	public Result addFollowRecord (CustomerIn cusIn) throws IllegalAccessException, InvocationTargetException  {
+		Result res=new Result();
+		Customer cus =new Customer();
+		BeanUtils.copyProperties(cus, cusIn);
+		customerService.updCustomer(cus);
+	    return res;
+	}
+	
 }

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

@@ -48,17 +48,23 @@ public interface CustomerService {
 	/**
 	 * 
 	 * @param cus 添加日志
-	 * @param operatorType
 	 */
 	public void saveCustomerLogo(CustomerIn cus,String operatorType,String cid);
 	
 	/**
 	 * 
 	 * @param 查询客户详情
-	 * @param operatorType
+	 * @param id
 	 */
 	public CustomerOut findCustomerDetails(String id);
 	
+	/**
+	 * 
+	 * @param 修改客户信息
+	 * @param id
+	 */
+	public int updCustomer(Customer c);
+	
 	
 	
 }

+ 17 - 1
src/main/java/com/goafanti/customer/service/CustomerUserService.java

@@ -1,5 +1,7 @@
 package com.goafanti.customer.service;
 
+import java.util.List;
+
 import com.goafanti.common.model.CustomerUserInfo;
 
 public interface CustomerUserService {
@@ -16,5 +18,19 @@ public interface CustomerUserService {
 	 * @param cui
 	 * @return
 	 */
-	int findCustomerUserNameList(String cid);
+	List<CustomerUserInfo> findCustomerUserNameList(String cid);
+	
+	/**
+	 * 查询主要联系人
+	 * @param cui
+	 * @return
+	 */
+	String selectPrimaryFlgByCid (String cid);
+	
+	/**
+	 * 更改主要联系人
+	 * @param cui
+	 * @return
+	 */
+	int updPrimaryFlg (String cid);
 }

+ 16 - 5
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -175,18 +175,22 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 		log.setCid(cid);
 		log.setOperatorTime(new Date());
 		log.setOperatorName(TokenManager.getAdminToken().getName());
-		log.setAfterFollowSituation(CustomerFollowFiled.getField(Integer.parseInt(cus.getFollowSituation())).getDesc()); //跟进状态
-		log.setAfterCustomerIntention(getCompanyIntention(cus.getCompanyIntention())); //跟进意向
-		log.setAfterCustomerStatus(CustomerStatusFiled.getField(Integer.parseInt(cus.getCustomerStatus())).getDesc()); //客户状态
 		if(operatorType.equals(AFTConstants.CUSTOMER_CREATE)){//创建用户
 			//暂时注释为了测试
 			/*log.setAfterAdminName(adminMapper.selectByPrimaryKey(cus.getAid()).getName());*/ //接单人
+			log.setAfterFollowSituation(CustomerFollowFiled.getField(Integer.parseInt(cus.getFollowSituation())).getDesc()); //跟进状态
+			log.setAfterCustomerIntention(getCompanyIntention(cus.getCompanyIntention())); //跟进意向
+			log.setAfterCustomerStatus(CustomerStatusFiled.getField(Integer.parseInt(cus.getCustomerStatus())).getDesc()); //客户状态
 			log.setAfterAdminName(adminMapper.selectByPrimaryKey(TokenManager.getUserId()).getName());
 			log.setOperatorType(AFTConstants.CUSTOMER_CREATE);
 		}else if(operatorType.equals(AFTConstants.CUSTOMER_MODIFY)){ //修改用户
 			
 		}else if(operatorType.equals(AFTConstants.CUSTOMER_DELETE)){ //删除用户
-			
+			log.setBeforeAdminName(cus.getAdminName());
+			log.setBeforeCustomerIntention(getCompanyIntention(cus.getBeforeCompanyIntention())); //跟进意向
+			log.setBeforeCustomerStatus(CustomerStatusFiled.getField(Integer.parseInt(cus.getBeforeCustomerStatus())).getDesc()); //跟进状态
+			log.setBeforeFollowSituation(CustomerFollowFiled.getField(Integer.parseInt(cus.getBeforeFollowSituation())).getDesc());//跟进进度
+			log.setOperatorType(AFTConstants.CUSTOMER_DELETE);
 		}else if(operatorType.equals(AFTConstants.CUSTOMER_TRANSFER)){ //转交客户
 			
 		}
@@ -195,7 +199,14 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 
 	@Override
 	public CustomerOut findCustomerDetails(String id) {
-		 return setFiled(customerMapper.selectByPrimaryKey(id));
+		CustomerOut co = customerMapper.selectCustomerById(id);
+		if(null !=co) setFiled(co);
+		return co;
+	}
+
+	@Override
+	public int updCustomer(Customer c) {
+		return customerMapper.updateByPrimaryKey(c);
 	}
 
 	

+ 16 - 2
src/main/java/com/goafanti/customer/service/impl/CustomerUserServiceImp.java

@@ -1,6 +1,8 @@
 package com.goafanti.customer.service.impl;
 
 
+import java.util.List;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -19,9 +21,21 @@ public class CustomerUserServiceImp extends BaseMybatisDao<CustomerUserInfoMappe
 	}
 
 	@Override
-	public int findCustomerUserNameList(String cid) {
-		return 0;
+	public List<CustomerUserInfo> findCustomerUserNameList(String cid) {
+		return customerUserInfoMapper.selectUserNameList(cid);
+	}
+
+	@Override
+	public String selectPrimaryFlgByCid(String cid) {
+		String id=customerUserInfoMapper.selectPrimaryFlgByCid(cid);
+		return id;
 	}
 
+	@Override
+	public int updPrimaryFlg(String cid) {
+		return customerUserInfoMapper.updataPrimaryFlg(cid);
+	}
+
+
 
 }