|
|
@@ -24,6 +24,7 @@ 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;
|
|
|
@@ -570,13 +571,11 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
}else{
|
|
|
if(!isUserOwner) throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_LOCKED,businessName,""));
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- if (us.getFollowSituation()!=5&&ub.getFollowSituation()==5) {//如果改成已签合同,则锁定业务
|
|
|
- if (StringUtils.isNotBlank(fbb.getUid())) ub.setUid(fbb.getUid());
|
|
|
- lockProject(ub);//锁定客户业务
|
|
|
- x=1;
|
|
|
- }
|
|
|
+// if (us.getFollowSituation()!=5&&ub.getFollowSituation()==5) {//如果改成已签合同,则锁定业务
|
|
|
+// if (StringUtils.isNotBlank(fbb.getUid())) ub.setUid(fbb.getUid());
|
|
|
+// lockProject(ub);//锁定客户业务
|
|
|
+// x=1;
|
|
|
+// }
|
|
|
userBusiness.setBusinessProjectId(ub.getBusinessProjectId());
|
|
|
userBusiness.setCustomerStatus(ub.getCustomerStatus());
|
|
|
userBusiness.setFollowSituation(ub.getFollowSituation());
|
|
|
@@ -613,11 +612,11 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
if(userBusinessMapper.judgeBusiness(fbb.getUid(), ub.getBusinessProjectId(), "")>0){
|
|
|
throw new BusinessException(new Error(ErrorConstants.BUSINESS_ALREADY_EXIST,businessName,""));
|
|
|
}
|
|
|
- if (ub.getFollowSituation()==5) {//如果改成已签合同,则锁定业务
|
|
|
- if (StringUtils.isNotBlank(fbb.getUid())) ub.setUid(fbb.getUid());
|
|
|
- lockProject(ub);//锁定客户业务
|
|
|
- x=1;
|
|
|
- }
|
|
|
+// if (ub.getFollowSituation()==5) {//如果改成已签合同,则锁定业务
|
|
|
+// if (StringUtils.isNotBlank(fbb.getUid())) ub.setUid(fbb.getUid());
|
|
|
+// lockProject(ub);//锁定客户业务
|
|
|
+// x=1;
|
|
|
+// }
|
|
|
String ubId = UUID.randomUUID().toString();
|
|
|
//更新业务表
|
|
|
userBusiness.setId(ubId);
|
|
|
@@ -669,33 +668,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 锁定用户
|
|
|
- * @param ub
|
|
|
- */
|
|
|
- private void lockProject(BusinessListBo ub) {
|
|
|
- UserLockRelease ulr= new UserLockRelease();
|
|
|
- ulr.setId(UUID.randomUUID().toString());
|
|
|
- ulr.setType(1);
|
|
|
- ulr.setAid(TokenManager.getAdminId());
|
|
|
- ulr.setBusinessProjectId(ub.getBusinessProjectId());
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat( " yyyy-MM-dd HH:mm:ss " );
|
|
|
- try {
|
|
|
- if (null==ub.getCreateTime()) {
|
|
|
- ulr.setLockTime(new Date());
|
|
|
- }else {
|
|
|
- ulr.setLockTime(sdf.parse(ub.getCreateTime()));
|
|
|
- }
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- ulr.setStatus(UserLockReleaseStatus.LOCKED.getCode());
|
|
|
- ulr.setUid(ub.getUid());
|
|
|
-
|
|
|
- userLockReleaseMapper.insert(ulr);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@SuppressWarnings("unused")
|
|
|
private void releaseProject(List<LockingReleaseBo> businessLockedList) {
|
|
|
if(businessLockedList != null && businessLockedList.size()>0){
|
|
|
@@ -1002,7 +974,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int updateByOperatorType(String uid,String oldAid, String operatorType,Object... params) {
|
|
|
+ public int updateByOperatorType(String uid,String oldAid, Integer operatorType,Object... params) {
|
|
|
User user = new User();
|
|
|
Date now = new Date();
|
|
|
//是否多个客户
|
|
|
@@ -1016,7 +988,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
}
|
|
|
user.setId(uid);
|
|
|
int flag = 0;
|
|
|
- if(operatorType.equals(AFTConstants.USER_RECEIVE)){
|
|
|
+ if(AFTConstants.USER_RECEIVE.equals(operatorType)){
|
|
|
if(userMapper.UserReceiveCount(TokenManager.getAdminId())>=USER_RECEIVE_MAX)
|
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOM_EREXCESS,""+USER_RECEIVE_MAX,""));
|
|
|
user.setAid(TokenManager.getAdminId());
|
|
|
@@ -1028,12 +1000,13 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
if(flag <= 0) throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_RECEIVE,""));
|
|
|
//取消客户领取时把联系人一并转移
|
|
|
//organizationContactBookMapper.updateAdmin(uid,TokenManager.getAdminId());
|
|
|
- }else if(operatorType.equals(AFTConstants.USER_TRANSFER_TO_OTHER)){
|
|
|
+ }else if(AFTConstants.USER_TRANSFER_TO_OTHER.equals(operatorType)){
|
|
|
if(!isUs) {
|
|
|
user.setAid(String.valueOf(params[0]));
|
|
|
user.setSource(3);//客户来源设置为转交
|
|
|
-// 转换不重置时间
|
|
|
-// user.setTransferTime(now);
|
|
|
+ if (AFTConstants.SIGN_USER_TRANSFER_TO_OTHER==operatorType) {
|
|
|
+ user.setShareType(2);
|
|
|
+ }
|
|
|
//查询这个客户是否是登陆人的客户
|
|
|
if(userMapper.getAidAndUser(uid,TokenManager.getAdminId())<=0)throw new BusinessException(new Error("请勿非法操作!","请勿非法操作!"));
|
|
|
flag = updateUserLock(uid,oldAid,UserLockReleaseStatus.LOCKED.getCode(),UserLockReleaseStatus.RELEASE.getCode()); //原用户释放客户
|
|
|
@@ -1049,9 +1022,33 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
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) {
|
|
|
+ userMapper.updateList(String.valueOf(params[0]),null,3,null,2,uList);
|
|
|
+ } else {
|
|
|
+ userMapper.updateList(String.valueOf(params[0]),null,3,null,null,uList);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ userMapper.updateByPrimaryKeySelective(user);
|
|
|
}
|
|
|
- if (isUs) userMapper.updateList(String.valueOf(params[0]),null,3,null,null,uList);
|
|
|
- else userMapper.updateByPrimaryKeySelective(user);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
@@ -1429,12 +1426,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
public Pagination<CustomerListOut> listSignOrganizationCustomer(CustomerListIn cli, Integer pageNo,
|
|
|
Integer pageSize) {
|
|
|
cli.setAid(TokenManager.getAdminId());
|
|
|
-// cli.setAid("1");
|
|
|
Map<String,Object> params = disposeParams(cli);
|
|
|
Pagination<CustomerListOut> list = (Pagination<CustomerListOut>) findPage("selectSignOrganizationCustomerList","selectSignOrganizationCustomerCount",params,pageNo,pageSize);
|
|
|
-// List<CustomerListOut> tmpList = (List<CustomerListOut>)list.getList();
|
|
|
-// setCustomerList(tmpList,1,0);
|
|
|
-// list.setList(tmpList);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
@@ -1453,7 +1446,15 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
|
|
|
@Override
|
|
|
public List<LockingReleaseBo> selectLockedProject(String uid) {
|
|
|
- return userMapper.selectLockedProject(uid,null,null,1,0);
|
|
|
+ List<LockingReleaseBo> list=userMapper.selectLockedProject(uid,null,null,1,0);
|
|
|
+ for (LockingReleaseBo lrb : list) {
|
|
|
+ if (lrb.getAid().equals(TokenManager.getAdminId())) {
|
|
|
+ lrb.setMySign(1);
|
|
|
+ }else {
|
|
|
+ lrb.setMySign(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -1667,20 +1668,14 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
List<LockingReleaseBo> list=userLockReleaseMapper.checkUserProject(uid, pid,TokenManager.getAdminId());
|
|
|
if (list.isEmpty()) {
|
|
|
throw new BusinessException(new Error("客户归属错误","客户归属错误"));
|
|
|
- }else if(list.size()>1) {
|
|
|
- throw new BusinessException(new Error("业务数量错误","业务数量错误"));
|
|
|
}
|
|
|
LockingReleaseBo l=list.get(0);
|
|
|
UserLockRelease ul=new UserLockRelease();
|
|
|
ul.setId(l.getId());
|
|
|
-// 不做释放与锁定的动作
|
|
|
-// ul.setStatus(2);
|
|
|
+
|
|
|
ul.setAid(inputId);
|
|
|
-// 不修改时间
|
|
|
-// ul.setReleaseTime(now);
|
|
|
userLockReleaseMapper.updateByPrimaryKeySelective(ul);
|
|
|
addtransferLog(uid,pid,TokenManager.getAdminId(),inputId,1,false);
|
|
|
-// addUserLock(uid,inputId,1,pid,now); //指定用户锁定客户
|
|
|
List<BusinessListBo> bl=userBusinessMapper.selectBusinessProjectByUAPid(uid, TokenManager.getAdminId(), pid);
|
|
|
if (bl.size()==1) {
|
|
|
UserBusiness ub=new UserBusiness();
|