|
@@ -653,8 +653,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
int followCount = userBusinessMapper.selectFollowCountByUAid(fbb.getUid(), null) + 1;
|
|
int followCount = userBusinessMapper.selectFollowCountByUAid(fbb.getUid(), null) + 1;
|
|
|
userFollow.setFollowCount(followCount);
|
|
userFollow.setFollowCount(followCount);
|
|
|
userFollowMapper.insert(userFollow);
|
|
userFollowMapper.insert(userFollow);
|
|
|
- // 判断是跟进还是签单
|
|
|
|
|
- int x = 0;
|
|
|
|
|
// 检查客户锁定情况
|
|
// 检查客户锁定情况
|
|
|
if (fbb.getUserBusinessList()!=null&&fbb.getUserBusinessList().size() > 0) {
|
|
if (fbb.getUserBusinessList()!=null&&fbb.getUserBusinessList().size() > 0) {
|
|
|
boolean isUserOwner = false;
|
|
boolean isUserOwner = false;
|
|
@@ -780,7 +778,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- followProject(fbb.getUid(), x);
|
|
|
|
|
|
|
+ followProject(fbb.getUid());
|
|
|
return 1;
|
|
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();
|
|
Date date = new Date();
|
|
|
String aid = TokenManager.getAdminId();
|
|
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")
|
|
@SuppressWarnings("unused")
|
|
@@ -1126,6 +1122,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
public int updateByOperatorType(String uid,String aid, String oldAid, Integer operatorType,Integer data) {
|
|
public int updateByOperatorType(String uid,String aid, String oldAid, Integer operatorType,Integer data) {
|
|
|
User user = new User();
|
|
User user = new User();
|
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
|
|
|
+ if(aid==null)aid=TokenManager.getAdminId();
|
|
|
if(data==null)data=0;
|
|
if(data==null)data=0;
|
|
|
// 是否多个客户
|
|
// 是否多个客户
|
|
|
boolean isUs = false;
|
|
boolean isUs = false;
|
|
@@ -1151,6 +1148,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
addUserTransferLog(uid, TokenManager.getAdminId(), null,1, null, now, uList);
|
|
addUserTransferLog(uid, TokenManager.getAdminId(), null,1, null, now, uList);
|
|
|
if (flag <= 0)
|
|
if (flag <= 0)
|
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_RECEIVE, ""));
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_RECEIVE, ""));
|
|
|
|
|
+ updateUserMid(aid,uid,0,null);
|
|
|
//转交
|
|
//转交
|
|
|
} else if (AFTConstants.USER_TRANSFER_TO_OTHER.equals(operatorType)
|
|
} else if (AFTConstants.USER_TRANSFER_TO_OTHER.equals(operatorType)
|
|
|
|| AFTConstants.SIGN_USER_TRANSFER_TO_OTHER == operatorType) {
|
|
|| AFTConstants.SIGN_USER_TRANSFER_TO_OTHER == operatorType) {
|
|
@@ -1171,7 +1169,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
if (flag <= 0)
|
|
if (flag <= 0)
|
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_TRANSFER_FAIL, ""));
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_TRANSFER_FAIL, ""));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ updateUserMid(aid,uid,0,null);
|
|
|
} else {
|
|
} else {
|
|
|
for (String us : uList) {
|
|
for (String us : uList) {
|
|
|
if (userMapper.getAidAndUser(us, TokenManager.getAdminId()) <= 0)
|
|
if (userMapper.getAidAndUser(us, TokenManager.getAdminId()) <= 0)
|
|
@@ -1180,8 +1178,10 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
if (AFTConstants.USER_TRANSFER_TO_OTHER == operatorType) {
|
|
if (AFTConstants.USER_TRANSFER_TO_OTHER == operatorType) {
|
|
|
flag = updateUsersLock(uList, oldAid, UserLockReleaseStatus.LOCKED.getCode(),
|
|
flag = updateUsersLock(uList, oldAid, UserLockReleaseStatus.LOCKED.getCode(),
|
|
|
UserLockReleaseStatus.RELEASE.getCode()); // 原用户释放客户
|
|
UserLockReleaseStatus.RELEASE.getCode()); // 原用户释放客户
|
|
|
- if (flag > 0)
|
|
|
|
|
|
|
+ if (flag > 0){
|
|
|
flag = addUserLock(uid, aid, now, uList); // 指定用户锁定客户
|
|
flag = addUserLock(uid, aid, now, uList); // 指定用户锁定客户
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
if (flag <= 0)
|
|
if (flag <= 0)
|
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_TRANSFER_FAIL, ""));
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_TRANSFER_FAIL, ""));
|
|
|
}
|
|
}
|
|
@@ -1191,6 +1191,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
|
|
|
|
|
addUserTransferLog(uid, aid,oldAid, type, null, now, uList);
|
|
addUserTransferLog(uid, aid,oldAid, type, null, now, uList);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if (isUs) {
|
|
if (isUs) {
|
|
|
if (AFTConstants.USER_RECEIVE == operatorType) {
|
|
if (AFTConstants.USER_RECEIVE == operatorType) {
|
|
|
userMapper.updateList(aid, null, 3, null, 2, uList,null);
|
|
userMapper.updateList(aid, null, 3, null, 2, uList,null);
|
|
@@ -1204,6 +1206,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 uid 客户id
|
|
|
* @param aid 接受者id
|
|
* @param aid 接受者id
|
|
@@ -2263,10 +2284,10 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
if(in.getStartTime()!=null)map.put("startTime",in.getStartTime());
|
|
if(in.getStartTime()!=null)map.put("startTime",in.getStartTime());
|
|
|
if(in.getEndTime()!=null)map.put("endTime",in.getEndTime()+" 23:59:59");
|
|
if(in.getEndTime()!=null)map.put("endTime",in.getEndTime()+" 23:59:59");
|
|
|
if(in.getShiroType()==null){in.setShiroType(0);}
|
|
if(in.getShiroType()==null){in.setShiroType(0);}
|
|
|
|
|
+ if(in.getShareType()!=null)map.put("shareType",in.getShareType());
|
|
|
else if(in.getShiroType()==2){
|
|
else if(in.getShiroType()==2){
|
|
|
if(in.getAdminName()!=null)map.put("adminName",in.getAdminName());
|
|
if(in.getAdminName()!=null)map.put("adminName",in.getAdminName());
|
|
|
if(in.getDepId()!=null)map.put("depId",in.getDepId());
|
|
if(in.getDepId()!=null)map.put("depId",in.getDepId());
|
|
|
- if(in.getShareType()!=null)map.put("shareType",in.getShareType());
|
|
|
|
|
}
|
|
}
|
|
|
map.put("shiroType",in.getShiroType());
|
|
map.put("shiroType",in.getShiroType());
|
|
|
return (Pagination<OutUserMianProducts>) findPage("findMainProductsList","findMainProductsCount",map,in.getPageNo(),in.getPageSize());
|
|
return (Pagination<OutUserMianProducts>) findPage("findMainProductsList","findMainProductsCount",map,in.getPageNo(),in.getPageSize());
|
|
@@ -2281,21 +2302,25 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
public int updateuserBusinessScope(String id, String businessScope) {
|
|
public int updateuserBusinessScope(String id, String businessScope) {
|
|
|
Date date =new Date();
|
|
Date date =new Date();
|
|
|
OrganizationIdentity use=organizationIdentityMapper.selectByPrimaryKey(id);
|
|
OrganizationIdentity use=organizationIdentityMapper.selectByPrimaryKey(id);
|
|
|
- updateBusinessScope(use.getUid(),businessScope,use.getBusinessScope(),date);
|
|
|
|
|
- OrganizationIdentity oi=new OrganizationIdentity();
|
|
|
|
|
- oi.setId(id);
|
|
|
|
|
- oi.setBusinessScope(businessScope);
|
|
|
|
|
- return organizationIdentityMapper.updateByPrimaryKeySelective(oi);
|
|
|
|
|
|
|
+ if(!businessScope.equals(use.getBusinessScope())){
|
|
|
|
|
+ updateBusinessScope(use.getUid(),businessScope,use.getBusinessScope(),date);
|
|
|
|
|
+ OrganizationIdentity oi=new OrganizationIdentity();
|
|
|
|
|
+ oi.setId(id);
|
|
|
|
|
+ oi.setBusinessScope(businessScope);
|
|
|
|
|
+ return organizationIdentityMapper.updateByPrimaryKeySelective(oi);
|
|
|
|
|
+ }
|
|
|
|
|
+ return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public boolean checkData(String uid, String aid) {
|
|
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;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|