ソースを参照

新增公共客户转为渠道

anderx 3 年 前
コミット
3e5b43f398

+ 16 - 0
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -659,6 +659,22 @@ public class AdminCustomerApiController extends BaseApiController{
 	}
 
 	/**
+	 * 领取为渠道
+	 * @param uid
+	 * @return
+	 */
+	@RequestMapping(value = "/receiveAsChannel",method=RequestMethod.POST)
+	public Result receiveAsChannel(String uid){
+		Result res = new Result();
+		if (uid ==null ){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"客户"));
+			return res;
+		}
+		res.data(customerService.pushReceiveAsChannel(uid));
+		return res;
+	}
+
+	/**
 	 * 上传excel文档
 	 * @param req
 	 * @return

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

@@ -546,4 +546,6 @@ public interface CustomerService {
     List<?> selectChannelUserList(InputChannelListBo in);
 
 	boolean receiveEveryDay(String uid);
+
+    int pushReceiveAsChannel(String uid);
 }

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

@@ -1243,6 +1243,20 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return false;
 	}
 
+	@Override
+	public int pushReceiveAsChannel(String uid) {
+		Date date = new Date();
+		User u =new User();
+		String aid=TokenManager.getAdminId();
+		u.setId(uid);
+		u.setChannel(0);
+		u.setShareType(0);
+		u.setNewChannel(1);
+		addUserLock(uid,aid, date, null); // 指定用户锁定客户
+		updateUserMid(aid,uid,0,null);
+		addUserTransferLog(uid, aid,null, 15, null, date, null);
+		return userMapper.updateByPrimaryKeySelective(u);
+	}
 
 
 	/**
@@ -1273,7 +1287,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	 * @return
 	 */
 	private int addUserLock(String uid, String aid, Date lockTime, List<String> uList) {
-		if (uList.isEmpty()) {
+		if (uList ==null|| uList.isEmpty()) {
 			UserLockRelease ulr = new UserLockRelease();
 			ulr.setId(UUID.randomUUID().toString());
 			ulr.setType(0);
@@ -1301,19 +1315,20 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 
 	/**
 	 *
-	 * @param type 0录入 1 领取 2 转交私有客户 3转交业务 4 未跟进丢失(30) 5未签单丢失(270天)6释放 7转交签单客户
+	 * @param type 类型 0录入 1 领取 2 转交私有客户 3转交业务 4 未跟进丢失(30) 5未签单丢失(270天)6释放  7转交签单客户 8渠道录入 9渠道客户总监分配 10 渠道客户经理分配 11渠道释放 12回收 13离职客户转交 14离职签单业务转交
+	 * 15 领取为私有渠道
 	 */
 	private void addUserTransferLog(String uid, String aid,String oldAid, Integer type, String pid,
 			Date lockTime, List<String> uList) {
-		if (uList.isEmpty()) {
+		if (uList ==null || uList.isEmpty()) {
 			UserTransferLog utl = new UserTransferLog();
-			if (type == 0 || type == 1)
+			if (type == 0 || type == 1 ||type ==15)
 				utl.setAid(aid);
 			else if (type == 2 || type == 3 || type == 7) {
 				utl.setAid(TokenManager.getAdminId());
 				utl.setTakeAid(aid);
+				if (type == 3) utl.setPid(pid);
 			}
-			if (type == 3) utl.setPid(pid);
 			utl.setType(type);
 			utl.setCreateTime(lockTime);
 			utl.setUid(uid);