wanghui 8 anni fa
parent
commit
53696fd144

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

@@ -116,7 +116,7 @@
       order by ${orderByClause}
     </if>
   </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerOut">
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
       <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
@@ -466,6 +466,9 @@
     <if test="aid != null">
     	and a.aid = #{aid,jdbcType=VARCHAR}
     </if>
+    <if test="paid != null">
+    	or a.paid like concat('%',#{paid},'%')
+    </if>
     <if test="shareType != null">
         and a.share_type = #{shareType,jdbcType=INTEGER}
     </if>
@@ -487,6 +490,12 @@
     <if test="contactTel != null">
     	 and c.tel_num = #{contactTel,jdbcType=VARCHAR}
     </if>
+    <if test="companyName != null">
+    	and d.company_name = #{companyName,jdbcType=VARCHAR}
+    </if>
+    <if test="locationProvince != null">
+    	and d.location_province = #{locationProvince,jdbcType=VARCHAR}
+    </if>
    	<if test="adminName != null">
    	 	and e.name = #{adminName,jdbcType=VARCHAR}
    	</if>

+ 9 - 10
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -74,7 +74,7 @@ public class AdminCustomerApiController extends BaseApiController {
 		
 		coi.setId(UUID.randomUUID().toString());//客户公司ID
 		coi.setCid(customerId);//客户公司表中的cid
-		SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
+		SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDD);
 		fur.setFollowDate(format.parse(cusIn.getFollowDates()));
 		fur.setId(followId);//跟进记录的ID
 		fur.setCid(customerId);//跟进记录表中的cid
@@ -143,9 +143,9 @@ public class AdminCustomerApiController extends BaseApiController {
 	 * @return
 	 */
 	@RequestMapping(value = "/listPrivateCustomer", method = RequestMethod.POST)
-	public Result listPrivateCustomer(HttpServletRequest request,CustomerIn cin,Integer pageSize, Integer pageNumber){
+	public Result listPrivateCustomer(HttpServletRequest request,CustomerIn cin,Integer pageSize, Integer pageNo){
 		Result  res = new Result();
-		Pagination<CustomerOut> boList = customerService.getPrivateCustomer(cin, pageSize, pageNumber);
+		Pagination<CustomerOut> boList = customerService.getPrivateCustomer(cin, pageSize, pageNo);
 		res.setData(boList);
 		return res;
 	}
@@ -210,7 +210,6 @@ public class AdminCustomerApiController extends BaseApiController {
 		Result res=new Result();
 		Customer c =new Customer();
 		BeanUtils.copyProperties(c, cusIn);
-		c.setShareType(Integer.parseInt(cusIn.getShareType()));
 		c.setCustomerType(Integer.parseInt(cusIn.getCustomerType()));
 		coi.setCid(cusIn.getId());
 		//更新主表
@@ -374,9 +373,9 @@ public class AdminCustomerApiController extends BaseApiController {
 	 * @return
 	 */
 	@RequestMapping(value = "/listPublicCustomer", method = RequestMethod.POST)
-	public Result listPublicCustomer(HttpServletRequest request,CustomerIn cin,Integer pageSize, Integer pageNumber){
+	public Result listPublicCustomer(HttpServletRequest request,CustomerIn cin,Integer pageSize, Integer pageNo){
 		Result  res = new Result();
-		Pagination<CustomerOut> boList = customerService.getPublicCustomer(cin, pageSize, pageNumber);
+		Pagination<CustomerOut> boList = customerService.getPublicCustomer(cin, pageSize, pageNo);
 		res.setData(boList);
 		return res;
 	}
@@ -407,9 +406,9 @@ public class AdminCustomerApiController extends BaseApiController {
 	 * @return
 	 */
 	@RequestMapping(value = "/listTeamCustomer", method = RequestMethod.POST)
-	public Result listTeamCustomer(HttpServletRequest request,CustomerIn cin,Integer pageSize, Integer pageNumber){
+	public Result listTeamCustomer(HttpServletRequest request,CustomerIn cin,Integer pageSize, Integer pageNo){
 		Result  res = new Result();
-		Pagination<CustomerOut> boList = customerService.getPublicCustomer(cin, pageSize, pageNumber);
+		Pagination<CustomerOut> boList = customerService.getPublicCustomer(cin, pageSize, pageNo);
 		res.setData(boList);
 		return res;
 	}
@@ -441,9 +440,9 @@ public class AdminCustomerApiController extends BaseApiController {
 	 * @return
 	 */
 	@RequestMapping(value = "/listCompanyCustomer", method = RequestMethod.POST)
-	public Result listCompanyCustomer(HttpServletRequest request,CustomerIn cin,Integer pageSize, Integer pageNumber){
+	public Result listCompanyCustomer(HttpServletRequest request,CustomerIn cin,Integer pageSize, Integer pageNo){
 		Result  res = new Result();
-		Pagination<CustomerOut> boList = customerService.getCompanyCustomer(cin, pageSize, pageNumber);
+		Pagination<CustomerOut> boList = customerService.getCompanyCustomer(cin, pageSize, pageNo);
 		res.setData(boList);
 		return res;
 	}

+ 23 - 19
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -1,17 +1,13 @@
 package com.goafanti.customer.service.impl;
 
 import java.lang.reflect.InvocationTargetException;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
-import javax.security.auth.Subject;
-
 import org.apache.commons.beanutils.BeanUtils;
-import org.apache.shiro.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.goafanti.core.mybatis.BaseMybatisDao;
@@ -98,8 +94,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 	public Pagination<CustomerOut> getPublicCustomer(CustomerIn cin, Integer pageSize, Integer pageNumber) {
 		cin.setShareType("1");
 		Map<String,Object> params = disposeParams(cin);
-		if(pageSize == null || pageSize < 0) pageSize = 10;
-		if(pageNumber == null || pageNumber <0 ) pageNumber = 1;
 		Pagination<CustomerOut> list = (Pagination<CustomerOut>)findPage("selectCustomer","selectCustomerCount",params, pageNumber, pageSize);
 		list.setList(setResult((List<CustomerOut>)list.getList()));
 		list.setList(descResult((List<CustomerOut>)list.getList()));
@@ -178,9 +172,14 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 			case 6 : co.set_followSituation("面谈中") ;break;
 			case 7 : co.set_followSituation("已面签") ;break;
 		}
-		String[] temp = co.getCompanyIntention().split(",");
 		String _companyIntention = "";
-		if(temp.length>0){
+		if(StringUtils.isNotBlank(co.getCompanyIntention())){
+			String[] temp ;
+			if(co.getCompanyIntention().contains(",")){
+				temp = co.getCompanyIntention().split(",");
+			}else{
+				temp = new String[]{co.getCompanyIntention()};
+			}
 			for(String s:temp){
 				if(s.equals("0")) _companyIntention += "发明专利&nbsp;";
 				if(s.equals("1")) _companyIntention += "实用型新型专利&nbsp;";
@@ -191,9 +190,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 				if(s.equals("6")) _companyIntention += "技术成果&nbsp;";
 			}
 			_companyIntention = _companyIntention.substring(0, _companyIntention.length()-6);
-		}
+		}		
 		co.set_companyIntention(_companyIntention);
-		
 		if(StringUtils.isNotBlank(co.getFollowDate())) co.setFollowDate(co.getFollowDate().substring(0,19));
 		return co;
 	}
@@ -203,14 +201,20 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 	 * @return
 	 */
 	private String getCompanyIntention(String intentions){
-		String[] list = intentions.split(",");
 		String result = "";
-		if(list.length>0){
+		if(StringUtils.isNotBlank(intentions)){
+			String[] list;
+			if(intentions.contains(",")){
+				list = intentions.split(",");
+			}else{
+				list = new String[]{intentions};
+			}
 			for(String s:list){
 				result += CustomerIntentionFiled.getField(Integer.parseInt(s)).getDesc()+",";
 			}
+			result = result.substring(0, result.length()-1);
 		}
-		return result.substring(0, result.length()-1);
+		return result;
 	}
 	
 	@Override
@@ -221,6 +225,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 		log.setCid(cid);
 		log.setOperatorTime(new Date());
 		log.setOperatorName(TokenManager.getAdminToken().getName());
+		Customer c =  customerMapper.selectByPrimaryKey(cid) ;
 		if(operatorType.equals(AFTConstants.CUSTOMER_CREATE)){//创建用户
 			log.setAfterFollowSituation(CustomerFollowFiled.getField(Integer.parseInt(cus.getFollowSituation())).getDesc()); //跟进状态
 			log.setAfterCustomerIntention(getCompanyIntention(cus.getCompanyIntention())); //跟进意向
@@ -229,16 +234,15 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 			log.setOperatorType(AFTConstants.CUSTOMER_CREATE);
 		}else if(operatorType.equals(AFTConstants.CUSTOMER_MODIFY)){ //修改用户
 			log.setBeforeAdminName(cus.getBeforeAdminName());//修改前操作人
-			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.setBeforeCustomerIntention(getCompanyIntention(c.getCompanyIntention())); //修改前跟进意向
+			log.setBeforeCustomerStatus(CustomerStatusFiled.getField(c.getCustomerStatus()).getDesc()); //修改前跟进状态
+			log.setBeforeFollowSituation(CustomerFollowFiled.getField(c.getFollowSituation()).getDesc());//修改前跟进进度
+			log.setAfterFollowSituation(CustomerFollowFiled.getField(c.getFollowSituation()).getDesc()); //修改后跟进状态
 			log.setAfterCustomerIntention(getCompanyIntention(cus.getCompanyIntention())); //修改后跟进意向
 			log.setAfterCustomerStatus(CustomerStatusFiled.getField(Integer.parseInt(cus.getCustomerStatus())).getDesc()); //修改后客户状态
-			log.setAfterAdminName(adminMapper.selectByPrimaryKey(TokenManager.getAdminId()).getName());
 			log.setOperatorType(AFTConstants.CUSTOMER_MODIFY);
 		}else if(operatorType.equals(AFTConstants.CUSTOMER_DELETE)){ //删除用户
-			log.setBeforeAdminName(cus.getAdminName());
+			log.setBeforeAdminName(cus.getBeforeAdminName());
 			log.setBeforeCustomerIntention(getCompanyIntention(cus.getBeforeCompanyIntention())); //跟进意向
 			log.setBeforeCustomerStatus(CustomerStatusFiled.getField(Integer.parseInt(cus.getBeforeCustomerStatus())).getDesc()); //跟进状态
 			log.setBeforeFollowSituation(CustomerFollowFiled.getField(Integer.parseInt(cus.getBeforeFollowSituation())).getDesc());//跟进进度