Browse Source

添加跟进记录

wanghui 8 years ago
parent
commit
3e8ac44bc2

+ 12 - 1
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -243,7 +243,18 @@ public class AdminCustomerApiController extends BaseController {
 		String followId = UUID.randomUUID().toString();
 		fur.setId(followId);
 		cusIn.setFollowId(followId);
-		followUpService.addFollowUp(fur, cusIn);
+		followUpService.addFollowUp(fur, cusIn);	
+		Customer cus = new Customer();
+		try {
+			BeanUtils.copyProperties(cus, cusIn);
+			if(StringUtils.isNotBlank(cusIn.getFollowSituation()))
+				cus.setFollowSituation(Integer.parseInt(cusIn.getFollowSituation()));	
+			if(StringUtils.isNotBlank(cusIn.getCustomerStatus()))
+				cus.setCustomerStatus(Integer.parseInt(cusIn.getCustomerStatus()));
+		} catch (IllegalAccessException | InvocationTargetException e) {			
+			e.printStackTrace();
+		}
+		customerService.updateCustomer(cus);
 		return res;
 	}
 }

+ 1 - 20
src/main/java/com/goafanti/customer/service/impl/FollowUpServiceImp.java

@@ -1,17 +1,11 @@
 package com.goafanti.customer.service.impl;
 
-import java.lang.reflect.InvocationTargetException;
-import java.util.UUID;
 
-import org.apache.commons.beanutils.BeanUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import com.goafanti.common.dao.CustomerMapper;
 import com.goafanti.common.dao.CustomerUserInfoMapper;
 import com.goafanti.common.dao.FollowUpRecordMapper;
-import com.goafanti.common.model.Customer;
 import com.goafanti.common.model.FollowUpRecord;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.shiro.token.TokenManager;
@@ -21,24 +15,11 @@ import com.goafanti.customer.service.FollowUpService;
 public class FollowUpServiceImp extends BaseMybatisDao<CustomerUserInfoMapper>  implements FollowUpService{
 	@Autowired
 	private FollowUpRecordMapper followUpRecordMapper ;
-	@Autowired
-	private CustomerMapper customerMapper;
 	@Override
 	public int addFollowUp(FollowUpRecord fur,CustomerIn cusIn) {
-		Customer cus = new Customer();
-		try {
-			BeanUtils.copyProperties(cus, cusIn);
-			if(StringUtils.isNotBlank(cusIn.getFollowSituation()))
-				cus.setFollowSituation(Integer.parseInt(cusIn.getFollowSituation()));	
-			if(StringUtils.isNotBlank(cusIn.getCustomerStatus()))
-				cus.setCustomerStatus(Integer.parseInt(cusIn.getCustomerStatus()));
-		} catch (IllegalAccessException | InvocationTargetException e) {			
-			e.printStackTrace();
-		}
 		fur.setCid(cusIn.getId());
 		fur.setAid(TokenManager.getAdminId());
-		followUpRecordMapper.insert(fur);
-		return  customerMapper.updateByPrimaryKeySelective(cus);
+		return followUpRecordMapper.insert(fur);
 	}
 
 }