|
|
@@ -653,8 +653,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
int followCount = userBusinessMapper.selectFollowCountByUAid(fbb.getUid(), null) + 1;
|
|
|
userFollow.setFollowCount(followCount);
|
|
|
userFollowMapper.insert(userFollow);
|
|
|
- // 判断是跟进还是签单
|
|
|
- int x = 0;
|
|
|
// 检查客户锁定情况
|
|
|
if (fbb.getUserBusinessList()!=null&&fbb.getUserBusinessList().size() > 0) {
|
|
|
boolean isUserOwner = false;
|
|
|
@@ -780,7 +778,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- followProject(fbb.getUid(), x);
|
|
|
+ followProject(fbb.getUid());
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
@@ -788,19 +786,17 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
* 跟进更新用户中间表
|
|
|
*
|
|
|
*/
|
|
|
- private void followProject(String uid, int x) {
|
|
|
+ private void followProject(String uid) {
|
|
|
Date date = new Date();
|
|
|
String aid = TokenManager.getAdminId();
|
|
|
- if (x == 0) {
|
|
|
- if (userLockReleaseMapper.updateUserMid(uid, aid, date, null) < 1) {
|
|
|
- userLockReleaseMapper.insertUserMid(uid, aid, date, null);
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (userLockReleaseMapper.updateUserMid(uid, aid, date, date) < 1) {
|
|
|
- userLockReleaseMapper.insertUserMid(uid, aid, date, date);
|
|
|
- }
|
|
|
+ UserMid um=new UserMid();
|
|
|
+ um.setUid(uid);
|
|
|
+ um.setAid(aid);
|
|
|
+ um.setLastFollowTime(date);
|
|
|
+ int x=userMidMapper.updateByUid(um);
|
|
|
+ if (x==0){
|
|
|
+ userMidMapper.insertSelective(um);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
@@ -1151,6 +1147,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
addUserTransferLog(uid, TokenManager.getAdminId(), null,1, null, now, uList);
|
|
|
if (flag <= 0)
|
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_RECEIVE, ""));
|
|
|
+ updateUserMid(aid,uid,0,null);
|
|
|
//转交
|
|
|
} else if (AFTConstants.USER_TRANSFER_TO_OTHER.equals(operatorType)
|
|
|
|| AFTConstants.SIGN_USER_TRANSFER_TO_OTHER == operatorType) {
|
|
|
@@ -1171,7 +1168,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
if (flag <= 0)
|
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_TRANSFER_FAIL, ""));
|
|
|
}
|
|
|
-
|
|
|
+ updateUserMid(aid,uid,0,null);
|
|
|
} else {
|
|
|
for (String us : uList) {
|
|
|
if (userMapper.getAidAndUser(us, TokenManager.getAdminId()) <= 0)
|
|
|
@@ -1180,8 +1177,10 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
if (AFTConstants.USER_TRANSFER_TO_OTHER == operatorType) {
|
|
|
flag = updateUsersLock(uList, oldAid, UserLockReleaseStatus.LOCKED.getCode(),
|
|
|
UserLockReleaseStatus.RELEASE.getCode()); // 原用户释放客户
|
|
|
- if (flag > 0)
|
|
|
+ if (flag > 0){
|
|
|
flag = addUserLock(uid, aid, now, uList); // 指定用户锁定客户
|
|
|
+
|
|
|
+ }
|
|
|
if (flag <= 0)
|
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_TRANSFER_FAIL, ""));
|
|
|
}
|
|
|
@@ -1191,6 +1190,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
|
|
|
addUserTransferLog(uid, aid,oldAid, type, null, now, uList);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
if (isUs) {
|
|
|
if (AFTConstants.USER_RECEIVE == operatorType) {
|
|
|
userMapper.updateList(aid, null, 3, null, 2, uList,null);
|
|
|
@@ -1204,6 +1205,25 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 处理中间表
|
|
|
+ * @param aid
|
|
|
+ * @param uid
|
|
|
+ * @param type 0单个 1批量
|
|
|
+ */
|
|
|
+ private void updateUserMid(String aid, String uid,Integer type,List<String> list){
|
|
|
+ if (type==0){
|
|
|
+ UserMid um=new UserMid();
|
|
|
+ um.setAid(aid);
|
|
|
+ um.setUid(uid);
|
|
|
+ um.setLastFollowTime(null);
|
|
|
+ userMidMapper.updateByUid(um);
|
|
|
+ }else{
|
|
|
+ if (!list.isEmpty())userMidMapper.updateListByUid(aid,1,list);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
*
|
|
|
* @param uid 客户id
|
|
|
* @param aid 接受者id
|
|
|
@@ -2293,12 +2313,13 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
|
|
|
@Override
|
|
|
public boolean checkData(String uid, String aid) {
|
|
|
- User u=userMapper.selectByPrimaryKey(uid);
|
|
|
- if (u.getInformationMaintainer().equals(aid)){
|
|
|
- return true;
|
|
|
+ List<String> list=Arrays.asList(uid.split(","));
|
|
|
+ for (String s : list) {
|
|
|
+ User u=userMapper.selectByPrimaryKey(s);
|
|
|
+ if (u.getInformationMaintainer().equals(aid)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|