|
|
@@ -110,8 +110,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
@Resource
|
|
|
private SystemWebSocketHandler systemWebSocketHandler;
|
|
|
@Resource
|
|
|
- private AdminUserCountMapper adminUserCountMapper;
|
|
|
- @Resource
|
|
|
private RestrictProjectMapper restrictProjectMapper;
|
|
|
@Resource
|
|
|
private AsyncUtils asyncUtils;
|
|
|
@@ -445,63 +443,14 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
addUserLock(uid, TokenManager.getAdminId(), now, uList);
|
|
|
addUserTransferLog(uid, TokenManager.getAdminId(), null,0, null, now, uList);
|
|
|
|
|
|
- updateAdminUserCount(user.getAid(),user.getTransferTime());
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param aid 管理员编号
|
|
|
- * @param transferTime 客户转换时间
|
|
|
- */
|
|
|
- @Override
|
|
|
- public void updateAdminUserCount(String aid ,Date transferTime) {
|
|
|
- String startTime=DateUtils.formatDate(transferTime,AFTConstants.YYYYMMDD);
|
|
|
- String endTime=startTime+" 23:59:59";
|
|
|
- AdminUserCount adminUserCount=getAdminUserCount(aid,startTime);
|
|
|
- AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
|
|
|
- if (adminUserCount==null){
|
|
|
- if(selectAUC!=null) adminUserCountMapper.insertSelective(selectAUC);
|
|
|
- }else {
|
|
|
- AdminUserCount newAUC=new AdminUserCount();
|
|
|
- newAUC.setId(adminUserCount.getId());
|
|
|
- if (selectAUC==null){
|
|
|
- newAUC.setPrivateCount(0);
|
|
|
- newAUC.setChannelCount(0);
|
|
|
- newAUC.setSignCount(0);
|
|
|
- }else {
|
|
|
- if (selectAUC.getPrivateCount()==null)selectAUC.setPrivateCount(0);
|
|
|
- if (selectAUC.getChannelCount()==null)selectAUC.setChannelCount(0);
|
|
|
- if (selectAUC.getSignCount()==null)selectAUC.setSignCount(0);
|
|
|
- newAUC.setPrivateCount(selectAUC.getPrivateCount());
|
|
|
- newAUC.setChannelCount(selectAUC.getChannelCount());
|
|
|
- newAUC.setSignCount(selectAUC.getSignCount());
|
|
|
- }
|
|
|
- adminUserCountMapper.updateByPrimaryKeySelective(newAUC);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 用于处理异常多产生数据,删除多余数据修改原本数据
|
|
|
- * @param aid
|
|
|
- * @param startTime
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public AdminUserCount getAdminUserCount(String aid, String startTime) {
|
|
|
- List<AdminUserCount> selectList = adminUserCountMapper.selectByaidAndDate(aid, startTime);
|
|
|
- AdminUserCount selectAUC=null;
|
|
|
- if(!selectList.isEmpty())selectAUC=selectList.get(0);
|
|
|
- if (selectList.size()>1){
|
|
|
- for (int i=1;i<selectList.size();i++){
|
|
|
- Integer id = selectList.get(i).getId();
|
|
|
- if(id!=null) adminUserCountMapper.deleteByPrimaryKey(id);
|
|
|
- }
|
|
|
- }
|
|
|
- return selectAUC;
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -974,7 +923,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
if (mainStatus==1){
|
|
|
followProject(fbb.getUid());
|
|
|
}
|
|
|
- updateADminUserCountFollow(TokenManager.getAdminId(),followTime);
|
|
|
}
|
|
|
|
|
|
private void addUserFollowBusiness(UserFollowBusiness userFollowBusiness, String ub, BusinessListBo ub1, String ufbId, String followId) {
|
|
|
@@ -988,40 +936,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
userFollowBusinessMapper.insert(userFollowBusiness);
|
|
|
}
|
|
|
|
|
|
- private void updateADminUserCountFollow(String aid, Date transferTime) {
|
|
|
- {
|
|
|
- String startTime= DateUtils.formatDate(transferTime,AFTConstants.YYYYMMDD);
|
|
|
- String endTime=startTime+" 23:59:59";
|
|
|
- AdminUserCount adminUserCount = getAdminUserCount(aid,startTime);
|
|
|
- Integer count = userFollowMapper.selectByaidAndDate(aid, startTime, endTime);
|
|
|
- AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
|
|
|
- if (adminUserCount==null){
|
|
|
- if (selectAUC==null)selectAUC=new AdminUserCount();
|
|
|
- selectAUC.setFollowCount(count);
|
|
|
- selectAUC.setAid(aid);
|
|
|
- selectAUC.setDateTime(transferTime);
|
|
|
- adminUserCountMapper.insertSelective(selectAUC);
|
|
|
- }else {
|
|
|
- AdminUserCount newAUC=new AdminUserCount();
|
|
|
- newAUC.setId(adminUserCount.getId());
|
|
|
- newAUC.setFollowCount(count);
|
|
|
- if (selectAUC==null){
|
|
|
- newAUC.setPrivateCount(0);
|
|
|
- newAUC.setChannelCount(0);
|
|
|
- newAUC.setSignCount(0);
|
|
|
- }else {
|
|
|
- if (selectAUC.getPrivateCount()==null)selectAUC.setPrivateCount(0);
|
|
|
- if (selectAUC.getChannelCount()==null)selectAUC.setChannelCount(0);
|
|
|
- if (selectAUC.getSignCount()==null)selectAUC.setSignCount(0);
|
|
|
- newAUC.setPrivateCount(selectAUC.getPrivateCount());
|
|
|
- newAUC.setChannelCount(selectAUC.getChannelCount());
|
|
|
- newAUC.setSignCount(selectAUC.getSignCount());
|
|
|
- }
|
|
|
- adminUserCountMapper.updateByPrimaryKeySelective(newAUC);
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 跟进更新用户中间表
|
|
|
@@ -1479,32 +1394,13 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
} else {
|
|
|
userMapper.update(user);
|
|
|
}
|
|
|
- //处理用户客户统计
|
|
|
- if (AFTConstants.USER_RECEIVE.equals(operatorType)){
|
|
|
- updateAdminUserCount(user.getAid(),user.getTransferTime());
|
|
|
- }
|
|
|
- if (typeFlag) {
|
|
|
- updateAdminUserCountTransfer(useList,newList);
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
return errors;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param useList
|
|
|
- * @param newList
|
|
|
- */
|
|
|
- private void updateAdminUserCountTransfer(List<User> useList, List<User> newList) {
|
|
|
- for (User u : useList) {
|
|
|
-
|
|
|
- updateAdminUserCount(u.getAid(),u.getTransferTime());
|
|
|
- }
|
|
|
- for (User u : newList) {
|
|
|
|
|
|
- updateAdminUserCount(u.getAid(),u.getTransferTime());
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
public void transferUser(List<String> uList, String aid, String uid) {
|
|
|
@@ -1624,7 +1520,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
updateUserMid(aid,uid,0,null);
|
|
|
addUserTransferLog(uid, aid,null, 15, null, date, null);
|
|
|
userMapper.update(u);
|
|
|
- updateAdminUserCount(use.getAid(),use.getTransferTime());
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
@@ -2475,9 +2370,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
utl.setUid(id);
|
|
|
userTransferLogMapper.insertSelective(utl);
|
|
|
userLockReleaseMapper.updateUserTypeLock(u.getId(), TokenManager.getAdminId(), 0, 2, date);
|
|
|
- //用户客户统计移除时修改
|
|
|
- updateAdminUserCount(u.getAid(),u.getTransferTime());
|
|
|
-
|
|
|
} else {
|
|
|
List<String> list = Arrays.asList(id.split(","));
|
|
|
List<UserTransferLog> ulList = new ArrayList<UserTransferLog>();
|
|
|
@@ -2500,16 +2392,11 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
userMapper.updateList(null, null, null, date, 1, list,null);
|
|
|
userLockReleaseMapper.updateUserTypeLockList(list, TokenManager.getAdminId(), 0, 2, date);
|
|
|
//批量移除客户,需要单独处理客户每天得计算。
|
|
|
- updateAdminUserAllCount(userList);
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
- private void updateAdminUserAllCount(List<User> userList) {
|
|
|
- for (User user : userList) {
|
|
|
- updateAdminUserCount(user.getAid(),user.getTransferTime());
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
|
|
|
@Override
|