Browse Source

Merge remote-tracking branch 'origin/dev' into dev

wanghui 8 years ago
parent
commit
c8c47628fd

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

@@ -92,6 +92,16 @@ public interface CustomerMapper {
      * @return 查询团队 客户记录
      */
     List<Customer> selectByLadderId(@Param("ladderId")String ladderId);
-
+    
+    /**
+     * 
+     * @param ladderId 上层领导ID
+     * @return 查询团队 客户记录
+     */
+    List<Customer> updFollowId(Customer record);
+    
+    
+    
+    int updCustomerByPrimaryKey(Customer record);
     
 }

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

@@ -312,7 +312,7 @@
         company_industry = #{companyIndustry,jdbcType=VARCHAR},
       </if>
     </set>
-    where id = #{id,jdbcType=VARCHAR}
+    where cid = #{cid,jdbcType=VARCHAR}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.CustomerOrganizationInfo">
     <!--

+ 21 - 1
src/main/java/com/goafanti/customer/bo/CustomerIn.java

@@ -3,8 +3,10 @@ package com.goafanti.customer.bo;
 public class CustomerIn {
 	/** 客户编号 **/
 	private String id;
-	/** 客户编号 **/
+	/** 跟进人编号 **/
 	private String followId;
+	/** 客户编号 **/
+	private String cuid;
 	
 	/** 客户名 **/
 	private String customerName;
@@ -44,6 +46,8 @@ public class CustomerIn {
 	
 	/** 跟单人 **/
 	private String adminName;
+	/** 跟单人 **/
+	private String beforeadminName;
 	
 	/** 跟单人ID **/
 	private String aid;
@@ -51,6 +55,14 @@ public class CustomerIn {
 	/** 客户标签 **/
 	private String tag;
 	
+	public String getCuid() {
+		return cuid;
+	}
+
+	public void setCuid(String cuid) {
+		this.cuid = cuid;
+	}
+
 	public String getId() {
 		return id;
 	}
@@ -189,6 +201,14 @@ public class CustomerIn {
 	public void setTag(String tag) {
 		this.tag = tag;
 	}
+
+	public String getBeforeadminName() {
+		return beforeadminName;
+	}
+
+	public void setBeforeadminName(String beforeadminName) {
+		this.beforeadminName = beforeadminName;
+	}
 	
 	
 }

+ 29 - 5
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -193,14 +193,38 @@ public class AdminCustomerApiController extends BaseController {
 	 * @return
 	 * @throws InvocationTargetException 
 	 * @throws IllegalAccessException 
+	 */
+	@RequestMapping(value = "/updCustomer", method = RequestMethod.POST)
+	public Result updCustomer (CustomerIn cusIn,CustomerOrganizationInfo coi) throws IllegalAccessException, InvocationTargetException  {
+		Result res=new Result();
+		Customer c =new Customer();
+		BeanUtils.copyProperties(c, cusIn);
+		c.setShareType(Integer.parseInt(cusIn.getShareTyp()));
+		c.setCustomerType(Integer.parseInt(cusIn.getCustomerTyp()));
+		//更新主表
+		customerService.setCustomer(c);
+		//更新公司表
+		customerOrganizationService.updCustomerOrganizationInfo(coi);
+		//插入日志表
+		customerService.saveCustomerLogo(cusIn, AFTConstants.CUSTOMER_MODIFY,cusIn.getId());
+	    return res;
+	}
 	
+	/**
+	 * 转交
+	 * @return
+	 * @throws InvocationTargetException 
+	 * @throws IllegalAccessException 
 	 */
-	@RequestMapping(value = "/updFollowRecord", method = RequestMethod.POST)
-	public Result addFollowRecord (CustomerIn cusIn) throws IllegalAccessException, InvocationTargetException  {
+	@RequestMapping(value = "/transferCsutomer", method = RequestMethod.POST)
+	public Result transferCsutomer (CustomerIn cusIn) throws IllegalAccessException, InvocationTargetException  {
 		Result res=new Result();
-		Customer cus =new Customer();
-		BeanUtils.copyProperties(cus, cusIn);
-		customerService.updCustomer(cus);
+		Customer c =new Customer();
+		BeanUtils.copyProperties(c, cusIn);
+		//更新主表
+		customerService.setCustomer(c);
+		//插入日志表
+		customerService.saveCustomerLogo(cusIn, AFTConstants.CUSTOMER_TRANSFER,cusIn.getId());
 	    return res;
 	}
 	

+ 7 - 0
src/main/java/com/goafanti/customer/service/CustomerOrganizationService.java

@@ -9,4 +9,11 @@ public interface CustomerOrganizationService {
 	 * @return
 	 */
 	int addCustomerOrganizationInfo(CustomerOrganizationInfo coi);
+	
+	/**
+	 * 添加客户公司信息
+	 * @param coi
+	 * @return
+	 */
+	int updCustomerOrganizationInfo(CustomerOrganizationInfo coi);
 }

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

@@ -63,7 +63,7 @@ public interface CustomerService {
 	 * @param 修改客户信息
 	 * @param id
 	 */
-	public int updCustomer(Customer c);
+	public int setCustomer(Customer c);
 	
 	
 	

+ 9 - 0
src/main/java/com/goafanti/customer/service/impl/CustomerOrganizationServiceImp.java

@@ -17,6 +17,15 @@ public class CustomerOrganizationServiceImp extends BaseMybatisDao<CustomerOrgan
 	public int addCustomerOrganizationInfo(CustomerOrganizationInfo coi) {
 		return customerOrganizationInfoMapper.insert(coi);
 	}
+	/**
+	 *  更新客户公司信息
+	 * @param intentions
+	 * @return
+	 */
+	@Override
+	public int updCustomerOrganizationInfo(CustomerOrganizationInfo coi) {
+		return customerOrganizationInfoMapper.updateByPrimaryKeySelective(coi);
+	}
 
 
 }

+ 33 - 9
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -144,7 +144,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 				if(s.equals("3")) _companyIntention += "软件著作权&nbsp;";
 				if(s.equals("4")) _companyIntention += "知识产权贯标&nbsp;";
 				if(s.equals("5")) _companyIntention += "高企认定&nbsp;";
-				if(s.equals("0")) _companyIntention += "技术成果&nbsp;";
+				if(s.equals("6")) _companyIntention += "技术成果&nbsp;";
 			}
 			_companyIntention = _companyIntention.substring(0, _companyIntention.length()-6);
 		}
@@ -176,15 +176,21 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 		log.setOperatorTime(new Date());
 		log.setOperatorName(TokenManager.getAdminToken().getName());
 		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)){ //修改用户
-			
+			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.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_MODIFY);
 		}else if(operatorType.equals(AFTConstants.CUSTOMER_DELETE)){ //删除用户
 			log.setBeforeAdminName(cus.getAdminName());
 			log.setBeforeCustomerIntention(getCompanyIntention(cus.getBeforeCompanyIntention())); //跟进意向
@@ -192,22 +198,40 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 			log.setBeforeFollowSituation(CustomerFollowFiled.getField(Integer.parseInt(cus.getBeforeFollowSituation())).getDesc());//跟进进度
 			log.setOperatorType(AFTConstants.CUSTOMER_DELETE);
 		}else if(operatorType.equals(AFTConstants.CUSTOMER_TRANSFER)){ //转交客户
-			
+			log.setBeforeAdminName(cus.getBeforeadminName());//转交前的人
+			log.setAfterAdminName(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.setAfterCustomerIntention(getCompanyIntention(cus.getBeforeCompanyIntention())); //修改前跟进意向
+			log.setAfterCustomerStatus(CustomerStatusFiled.getField(Integer.parseInt(cus.getBeforeCustomerStatus())).getDesc()); //修改前跟进状态
+			log.setAfterFollowSituation(CustomerFollowFiled.getField(Integer.parseInt(cus.getBeforeFollowSituation())).getDesc());//修改前跟进进度
+			log.setOperatorType(AFTConstants.CUSTOMER_TRANSFER);
 		}
 		CustomerLogMapper.insert(log);
 	}
 
+	/**
+	 *  查询客户详情
+	 * @param intentions
+	 * @return
+	 */
 	@Override
 	public CustomerOut findCustomerDetails(String id) {
 		CustomerOut co = customerMapper.selectCustomerById(id);
 		if(null !=co) setFiled(co);
 		return co;
 	}
-
+	
+	/**
+	 *  修改客户信息
+	 * @param intentions
+	 * @return
+	 */
 	@Override
-	public int updCustomer(Customer c) {
-		return customerMapper.updateByPrimaryKey(c);
+	public int setCustomer(Customer c) {
+		 return customerMapper.updCustomerByPrimaryKey(c);
 	}
-
+	
 	
 }

+ 1 - 0
src/main/java/com/goafanti/customer/service/impl/CustomerUserServiceImp.java

@@ -38,4 +38,5 @@ public class CustomerUserServiceImp extends BaseMybatisDao<CustomerUserInfoMappe
 
 
 
+
 }

+ 1 - 1
src/main/resources/spring/spring-mybatis.xml

@@ -83,7 +83,7 @@
 			<tx:method name="del*" rollback-for="Exception" />
 			<tx:method name="init*" rollback-for="Exception" />
 			<tx:method name="bind*" rollback-for="Exception" />
-			<tx:method name="*"  read-only="true" />
+			<!-- <tx:method name="*"  read-only="true" /> -->
 		</tx:attributes>
 	</tx:advice>