|
|
@@ -24,7 +24,6 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import com.alibaba.druid.sql.parser.Token;
|
|
|
import com.goafanti.common.bo.Error;
|
|
|
import com.goafanti.common.bo.userDaysBo;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
@@ -996,7 +995,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
user.setInformationMaintainer(TokenManager.getAdminId());
|
|
|
user.setSource(2);//客户来源设置为领取
|
|
|
user.setTransferTime(now);
|
|
|
- flag = addUserLock(uid,TokenManager.getAdminId(),0,null,now,false); //指定用户锁定客户
|
|
|
+ flag = addUserLock(uid,TokenManager.getAdminId(),1,null,now,false); //指定用户锁定客户
|
|
|
if(flag <= 0) throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_RECEIVE,""));
|
|
|
//取消客户领取时把联系人一并转移
|
|
|
//organizationContactBookMapper.updateAdmin(uid,TokenManager.getAdminId());
|
|
|
@@ -1010,35 +1009,16 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
//查询这个客户是否是登陆人的客户
|
|
|
if(userMapper.getAidAndUser(uid,TokenManager.getAdminId())<=0)throw new BusinessException(new Error("请勿非法操作!","请勿非法操作!"));
|
|
|
flag = updateUserLock(uid,oldAid,UserLockReleaseStatus.LOCKED.getCode(),UserLockReleaseStatus.RELEASE.getCode()); //原用户释放客户
|
|
|
- if(flag > 0 ) flag = addUserLock(uid,String.valueOf(params[0]),0,null,now,isUs); //指定用户锁定客户
|
|
|
+ if(flag > 0 ) flag = addUserLock(uid,String.valueOf(params[0]),2,null,now,isUs); //指定用户锁定客户
|
|
|
if(flag <= 0) throw new BusinessException(new Error(ErrorConstants.CUSTOMER_TRANSFER_FAIL,""));
|
|
|
- addtransferLog(uid,null,TokenManager.getAdminId(),String.valueOf(params[0]),0,isUs);
|
|
|
}else {
|
|
|
for (String us : uList) {
|
|
|
if(userMapper.getAidAndUser(us,TokenManager.getAdminId())<=0)throw new BusinessException(new Error("请勿非法操作!","请勿非法操作!"));
|
|
|
}
|
|
|
flag = updateUsersLock(uList,oldAid,UserLockReleaseStatus.LOCKED.getCode(),UserLockReleaseStatus.RELEASE.getCode()); //原用户释放客户
|
|
|
- if(flag > 0 ) flag = addUserLock(uid,String.valueOf(params[0]),0,null,now,isUs); //指定用户锁定客户
|
|
|
+ if(flag > 0 ) flag = addUserLock(uid,String.valueOf(params[0]),2,null,now,isUs); //指定用户锁定客户
|
|
|
if(flag <= 0) throw new BusinessException(new Error(ErrorConstants.CUSTOMER_TRANSFER_FAIL,""));
|
|
|
- addtransferLog(uid,null,TokenManager.getAdminId(),String.valueOf(params[0]),0,isUs);
|
|
|
}
|
|
|
- }else if(AFTConstants.SIGN_USER_TRANSFER_TO_OTHER.equals(operatorType)){
|
|
|
- if(!isUs) {
|
|
|
- user.setAid(String.valueOf(params[0]));
|
|
|
- user.setSource(3);//客户来源设置为转交
|
|
|
- if (AFTConstants.SIGN_USER_TRANSFER_TO_OTHER==operatorType) {
|
|
|
- user.setShareType(2);
|
|
|
- }
|
|
|
- //查询这个客户是否是登陆人的客户
|
|
|
- if(userMapper.getAidAndUser(uid,TokenManager.getAdminId())<=0)throw new BusinessException(new Error("请勿非法操作!","请勿非法操作!"));
|
|
|
- addtransferLog(uid,null,TokenManager.getAdminId(),String.valueOf(params[0]),0,isUs);
|
|
|
- }else {
|
|
|
- for (String us : uList) {
|
|
|
- if(userMapper.getAidAndUser(us,TokenManager.getAdminId())<=0)throw new BusinessException(new Error("请勿非法操作!","请勿非法操作!"));
|
|
|
- }
|
|
|
- addtransferLog(uid,null,TokenManager.getAdminId(),String.valueOf(params[0]),0,isUs);
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
if (isUs) {
|
|
|
if (AFTConstants.SIGN_USER_TRANSFER_TO_OTHER==operatorType) {
|
|
|
@@ -1474,40 +1454,64 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
return userLockReleaseMapper.updateUsersLock(uList,aid,oldStatus,newStatus);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param aid
|
|
|
+ * @param type 0录入 1领取 2转交客户 3转交业务
|
|
|
+ * @param pid
|
|
|
+ * @param lockTime
|
|
|
+ * @param isUs
|
|
|
+ * @return
|
|
|
+ */
|
|
|
private int addUserLock(String uid,String aid,Integer type,String pid,Date lockTime, boolean isUs){
|
|
|
if (!isUs) {
|
|
|
UserLockRelease ulr = new UserLockRelease();
|
|
|
+ UserTransferLog utl=new UserTransferLog();
|
|
|
ulr.setId(UUID.randomUUID().toString());
|
|
|
- if (type==0) {
|
|
|
- ulr.setType(0);
|
|
|
- }else {
|
|
|
- ulr.setType(1);
|
|
|
- ulr.setBusinessProjectId(pid);
|
|
|
- }
|
|
|
+ ulr.setType(0);
|
|
|
ulr.setAid(aid);
|
|
|
ulr.setLockTime(lockTime);
|
|
|
ulr.setStatus(UserLockReleaseStatus.LOCKED.getCode());
|
|
|
ulr.setUid(uid);
|
|
|
userLockReleaseMapper.insert(ulr);
|
|
|
+ utl.setType(type);
|
|
|
+ if(type==0||type==1) utl.setAid(aid);
|
|
|
+ else if(type==2||type==3) {
|
|
|
+ utl.setAid(TokenManager.getAdminId());
|
|
|
+ utl.setTakeAid(aid);
|
|
|
+ }
|
|
|
+ if(type==3)utl.setPid(pid);
|
|
|
+ utl.setCreateTime(lockTime);
|
|
|
+ utl.setUid(uid);
|
|
|
+ userTransferLogMapper.insertSelective(utl);
|
|
|
}else {
|
|
|
List<String> ulist=Arrays.asList(uid.split(","));
|
|
|
List<UserLockRelease> ulrList=new ArrayList<>();
|
|
|
+ List<UserTransferLog> utlList=new ArrayList<>();
|
|
|
for (String s : ulist) {
|
|
|
UserLockRelease ulr = new UserLockRelease();
|
|
|
+ UserTransferLog utl=new UserTransferLog();
|
|
|
ulr.setId(UUID.randomUUID().toString());
|
|
|
- if (type==0) {
|
|
|
- ulr.setType(0);
|
|
|
- }else {
|
|
|
- ulr.setType(1);
|
|
|
- ulr.setBusinessProjectId(pid);
|
|
|
- }
|
|
|
+ ulr.setType(0);
|
|
|
ulr.setAid(aid);
|
|
|
ulr.setLockTime(lockTime);
|
|
|
ulr.setStatus(UserLockReleaseStatus.LOCKED.getCode());
|
|
|
ulr.setUid(s);
|
|
|
ulrList.add(ulr);
|
|
|
+ if(type==0||type==1) utl.setAid(aid);
|
|
|
+ else if(type==2||type==3) {
|
|
|
+ utl.setAid(TokenManager.getAdminId());
|
|
|
+ utl.setTakeAid(aid);
|
|
|
+ }
|
|
|
+ if(type==3)utl.setPid(pid);
|
|
|
+ utl.setCreateTime(lockTime);
|
|
|
+ utl.setUid(uid);
|
|
|
+ utl.setType(type);
|
|
|
+ utlList.add(utl);
|
|
|
}
|
|
|
userLockReleaseMapper.insertList(ulrList);
|
|
|
+ userTransferLogMapper.insertList(utlList);
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
@@ -1516,14 +1520,10 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 查询需要释放客户
|
|
|
- * @param uid
|
|
|
- * @return
|
|
|
- */
|
|
|
+
|
|
|
@Override
|
|
|
- public List<LockingReleaseBo> selectWaitReleaseCustomer(String uid){
|
|
|
- return userLockReleaseMapper.selectWaitReleaseCustomer(uid);
|
|
|
+ public List<LockingReleaseBo> selectWaitReleaseCustomer(String uid,Integer type){
|
|
|
+ return userLockReleaseMapper.selectWaitReleaseCustomer(uid,type);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1672,10 +1672,9 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
LockingReleaseBo l=list.get(0);
|
|
|
UserLockRelease ul=new UserLockRelease();
|
|
|
ul.setId(l.getId());
|
|
|
-
|
|
|
ul.setAid(inputId);
|
|
|
userLockReleaseMapper.updateByPrimaryKeySelective(ul);
|
|
|
- addtransferLog(uid,pid,TokenManager.getAdminId(),inputId,1,false);
|
|
|
+ addtransferLog(uid,pid,TokenManager.getAdminId(),inputId,3,false);
|
|
|
List<BusinessListBo> bl=userBusinessMapper.selectBusinessProjectByUAPid(uid, TokenManager.getAdminId(), pid);
|
|
|
if (bl.size()==1) {
|
|
|
UserBusiness ub=new UserBusiness();
|
|
|
@@ -1724,23 +1723,39 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
@Override
|
|
|
public int pushReleaseUser(String id) {
|
|
|
Date date =new Date();
|
|
|
+ String aid=TokenManager.getAdminId();
|
|
|
if (!id.contains(",")) {
|
|
|
+
|
|
|
User u=userMapper.selectByPrimaryKey(id);
|
|
|
- if (!u.getAid().equals(TokenManager.getAdminId())) {
|
|
|
+ if (!u.getAid().equals(aid)) {
|
|
|
throw new BuilderException("客户归属错误!");
|
|
|
}
|
|
|
+ UserTransferLog utl=new UserTransferLog();
|
|
|
u.setTransferTime(date);
|
|
|
u.setShareType(1);
|
|
|
userMapper.updateByPrimaryKeySelective(u);
|
|
|
+ utl.setAid(aid);
|
|
|
+ utl.setCreateTime(date);
|
|
|
+ utl.setType(6);
|
|
|
+ utl.setUid(id);
|
|
|
+ userTransferLogMapper.insertSelective(utl);
|
|
|
userLockReleaseMapper.updateUserTypeLock(u.getId(), TokenManager.getAdminId(), 0, 2,date);
|
|
|
}else {
|
|
|
List<String> list=Arrays.asList(id.split(","));
|
|
|
+ List<UserTransferLog> ulList=new ArrayList<UserTransferLog>();
|
|
|
for (String str : list) {
|
|
|
User u=userMapper.selectByPrimaryKey(str);
|
|
|
if (!u.getAid().equals(TokenManager.getAdminId())) {
|
|
|
throw new BuilderException("客户归属错误!");
|
|
|
}
|
|
|
+ UserTransferLog utl=new UserTransferLog();
|
|
|
+ utl.setAid(aid);
|
|
|
+ utl.setCreateTime(date);
|
|
|
+ utl.setType(6);
|
|
|
+ utl.setUid(str);
|
|
|
+ ulList.add(utl);
|
|
|
}
|
|
|
+ userTransferLogMapper.insertList(ulList);
|
|
|
userMapper.updateList(null, null, null,date,1, list);
|
|
|
userLockReleaseMapper.updateUserTypeLockList(list, TokenManager.getAdminId(), 0, 2,date);
|
|
|
}
|
|
|
@@ -1780,5 +1795,34 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void pushReleaseLog(List<LockingReleaseBo> list,Integer type) throws InterruptedException {
|
|
|
+ Date date=new Date();
|
|
|
+ List<LockingReleaseBo> newList=new ArrayList<LockingReleaseBo>();
|
|
|
+ if (list!=null&&list.size()>0) {
|
|
|
+ for(int i=0;i<list.size();i++){
|
|
|
+ newList.add(list.get(i));
|
|
|
+ if(50 == newList.size()||i == list.size()-1){
|
|
|
+ if(newList.size()>0) {
|
|
|
+ List<UserTransferLog> list3=new ArrayList<UserTransferLog>();
|
|
|
+ for (LockingReleaseBo lrb : newList) {
|
|
|
+ UserTransferLog utl=new UserTransferLog();
|
|
|
+ utl.setAid(lrb.getAid());
|
|
|
+ utl.setCreateTime(date);
|
|
|
+ if(type==0)utl.setType(4);
|
|
|
+ else if(type==1)utl.setType(5);
|
|
|
+ utl.setUid(lrb.getUid());
|
|
|
+ list3.add(utl);
|
|
|
+ }
|
|
|
+ userTransferLogMapper.insertList(list3);
|
|
|
+ }
|
|
|
+ newList.clear();
|
|
|
+ Thread.sleep(2000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|