|
|
@@ -663,7 +663,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
@Override
|
|
|
public Pagination<FollowListBo> listFollowHistory(Integer pageNo, Integer pageSize, String uid,
|
|
|
String businessProjectId, Integer type) {
|
|
|
- Map<String, Object> params = new HashMap<String, Object>();
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
if (StringUtils.isNotBlank(uid))
|
|
|
params.put("uid", uid);
|
|
|
if (StringUtils.isNotBlank(businessProjectId))
|
|
|
@@ -711,7 +711,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
@Override
|
|
|
|
|
|
public List<OrganizationContactBook> findCustomerContacts(String uid,Integer type) {
|
|
|
- List<OrganizationContactBook> list=null;
|
|
|
+ List<OrganizationContactBook> list;
|
|
|
if(type==0){
|
|
|
list = userMapper.findCustomerContacts(uid, TokenManager.getAdminId());
|
|
|
// for (OrganizationContactBook ob : list) {
|
|
|
@@ -758,16 +758,16 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
um.setUid(userFollow.getUid());
|
|
|
//检查客户,修改小程序打卡,如果负责人和跟进人是同一个,则刷新最后跟进时间
|
|
|
User user = userMapper.queryById(fbb.getUid());
|
|
|
- if (aid.equals(user.getAid())){
|
|
|
- um.setLastFollowTime(userFollow.getCreateTime());
|
|
|
- }
|
|
|
- um.setFollowNumber(followCount);
|
|
|
+ if (aid != null && aid.equals(user.getAid())) {
|
|
|
+ um.setLastFollowTime(userFollow.getCreateTime());
|
|
|
+ }
|
|
|
+ um.setFollowNumber(followCount);
|
|
|
um.setFollowExplain(userFollow.getResult());
|
|
|
um.setFollowDep(userFollow.getFollowDep());
|
|
|
um.setLastFollowType(userFollow.getContactType());
|
|
|
um.setFollowAname(a.getName());
|
|
|
userMidMapper.updateByUid(um);
|
|
|
- addUserFllow( fbb, ufid, mainStatus,followTime,followId);
|
|
|
+ addUserFllow( fbb, mainStatus,followTime,followId);
|
|
|
}else if (type==1){
|
|
|
addRestrictProject(fbb,followTime,followId);
|
|
|
}
|
|
|
@@ -775,10 +775,10 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
}
|
|
|
|
|
|
private void addRestrictProject(FollowBusinessBo fbb, Date followTime, String followId) {
|
|
|
- String businessName = "";
|
|
|
- String ufbId = "";
|
|
|
- UserBusiness userBusiness = null;
|
|
|
- UserFollowBusiness userFollowBusiness = null;
|
|
|
+ String businessName;
|
|
|
+ String ufbId;
|
|
|
+ UserBusiness userBusiness;
|
|
|
+ UserFollowBusiness userFollowBusiness;
|
|
|
for (BusinessListBo ub : fbb.getUserBusinessList()) {
|
|
|
userBusiness = new UserBusiness();
|
|
|
userFollowBusiness = new UserFollowBusiness();
|
|
|
@@ -789,7 +789,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
// 更新业务表
|
|
|
userBusiness.setId(ub.getBusinessId());
|
|
|
if (us.getFollowSituation() == 5) {// 如果已签合同,则不允许变更
|
|
|
- if (ub.getCustomerStatus() != us.getCustomerStatus() && ub.getFollowSituation() != 5) {
|
|
|
+ if (!Objects.equals(ub.getCustomerStatus(), us.getCustomerStatus()) && ub.getFollowSituation() != 5) {
|
|
|
throw new BusinessException(new Error(ErrorConstants.BUSINESS_ALREADY_LOCKED, ""));
|
|
|
}
|
|
|
}
|
|
|
@@ -826,7 +826,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void addUserFllow(FollowBusinessBo fbb,String ufid,Integer mainStatus,Date followTime,String followId) {
|
|
|
+ private void addUserFllow(FollowBusinessBo fbb, Integer mainStatus, Date followTime, String followId) {
|
|
|
|
|
|
boolean isUserOwner = false;
|
|
|
// 检查客户锁定情况
|
|
|
@@ -837,11 +837,11 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
isUserOwner = true;
|
|
|
}
|
|
|
boolean isBusinessOwner = false;
|
|
|
- List<LockingReleaseBo> businessLockedList = null;
|
|
|
- String businessName = "";
|
|
|
- String ufbId = "";
|
|
|
- UserBusiness userBusiness = null;
|
|
|
- UserFollowBusiness userFollowBusiness = null;
|
|
|
+ List<LockingReleaseBo> businessLockedList;
|
|
|
+ String businessName;
|
|
|
+ String ufbId;
|
|
|
+ UserBusiness userBusiness;
|
|
|
+ UserFollowBusiness userFollowBusiness;
|
|
|
for (BusinessListBo ub : fbb.getUserBusinessList()) {
|
|
|
userBusiness = new UserBusiness();
|
|
|
userFollowBusiness = new UserFollowBusiness();
|
|
|
@@ -852,14 +852,14 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
// 更新业务表
|
|
|
userBusiness.setId(ub.getBusinessId());
|
|
|
if (us.getFollowSituation() == 5) {// 如果已签合同,则不允许变更
|
|
|
- if (ub.getCustomerStatus() != us.getCustomerStatus() && ub.getFollowSituation() != 5) {
|
|
|
+ if (!Objects.equals(ub.getCustomerStatus(), us.getCustomerStatus()) && ub.getFollowSituation() != 5) {
|
|
|
throw new BusinessException(new Error(ErrorConstants.BUSINESS_ALREADY_LOCKED, ""));
|
|
|
}
|
|
|
}
|
|
|
// 检查业务锁定情况
|
|
|
businessLockedList = userMapper.selectLockedProject(fbb.getUid(), null, ub.getBusinessProjectId(),
|
|
|
1, UserLockReleaseStatus.LOCKED.getCode());
|
|
|
- if (businessLockedList.size() > 0) {
|
|
|
+ if (!businessLockedList.isEmpty()) {
|
|
|
for (LockingReleaseBo bo : businessLockedList) {
|
|
|
if (!bo.getAid().equals(TokenManager.getAdminId()))
|
|
|
isBusinessOwner = true;
|
|
|
@@ -969,8 +969,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
private void releaseProject(List<LockingReleaseBo> businessLockedList) {
|
|
|
- if (businessLockedList != null && businessLockedList.size() > 0) {
|
|
|
- UserLockRelease ulr = null;
|
|
|
+ if (businessLockedList != null && !businessLockedList.isEmpty()) {
|
|
|
+ UserLockRelease ulr;
|
|
|
for (LockingReleaseBo bo : businessLockedList) {
|
|
|
ulr = new UserLockRelease();
|
|
|
ulr.setId(bo.getId());
|
|
|
@@ -1004,18 +1004,18 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
userFollow.setResult(fbb.getResult());
|
|
|
userFollow.setContactType(Integer.parseInt(fbb.getContactType()));
|
|
|
userFollowMapper.updateByPrimaryKeySelective(userFollow); // 修改拜访记录表
|
|
|
- if (fbb.getUserBusinessList().size() > 0) {
|
|
|
+ if (!fbb.getUserBusinessList().isEmpty()) {
|
|
|
// 检查客户锁定情况
|
|
|
boolean isUserOwner = false;
|
|
|
List<LockingReleaseBo> userLockedList = userMapper.selectLockedProject(fbb.getUid(),
|
|
|
TokenManager.getAdminId(), null, 0, UserLockReleaseStatus.LOCKED.getCode());
|
|
|
- if (userLockedList.size() > 0) {
|
|
|
+ if (!userLockedList.isEmpty()) {
|
|
|
isUserOwner = true;
|
|
|
}
|
|
|
boolean isBusinessOwner = false;
|
|
|
- List<LockingReleaseBo> businessLockedList = null;
|
|
|
- String businessName = "";
|
|
|
- UserFollowBusiness userFollowBusiness = null;
|
|
|
+ List<LockingReleaseBo> businessLockedList;
|
|
|
+ String businessName;
|
|
|
+ UserFollowBusiness userFollowBusiness;
|
|
|
for (BusinessListBo ub : fbb.getUserBusinessList()) {
|
|
|
userFollowBusiness = new UserFollowBusiness();
|
|
|
businessName = businessProjectMapper.selectById(ub.getBusinessProjectId()).getBname();
|
|
|
@@ -1029,7 +1029,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
// 检查业务锁定情况
|
|
|
businessLockedList = userMapper.selectLockedProject(fbb.getUid(), null, ub.getBusinessProjectId(),
|
|
|
1, UserLockReleaseStatus.LOCKED.getCode());
|
|
|
- if (businessLockedList.size() > 0) {
|
|
|
+ if (!businessLockedList.isEmpty()) {
|
|
|
for (LockingReleaseBo bo : businessLockedList) {
|
|
|
if (bo.getAid().equals(TokenManager.getAdminId()))
|
|
|
isBusinessOwner = true;
|
|
|
@@ -1079,15 +1079,13 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
|
|
|
@Override
|
|
|
public Set<OrganizationContactBook> findAllContacts(String uid) {
|
|
|
- Set<OrganizationContactBook> result = new HashSet<OrganizationContactBook>();
|
|
|
- result.addAll(userMapper.findAllContacts(uid));
|
|
|
- return result;
|
|
|
+ return new HashSet<>(userMapper.findAllContacts(uid));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int updateCustomerContacts(List<OrganizationContactBook> ocbList, String uid) {
|
|
|
- if (ocbList.size() > 0) {
|
|
|
- OrganizationContactBook ocb = null;
|
|
|
+ if (!ocbList.isEmpty()) {
|
|
|
+ OrganizationContactBook ocb;
|
|
|
for (OrganizationContactBook item : ocbList) {
|
|
|
if (item != null && item.getMajor() != null && item.getMajor() == 1) {
|
|
|
// 改变用户原本的联系人
|
|
|
@@ -1125,7 +1123,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
for (BusinessListBo b : list) {
|
|
|
if (b.getFollowSituation() == 5)
|
|
|
throw new BusinessException(new Error(ErrorConstants.BUSINESS_ALREADY_LOCKED, ""));
|
|
|
- ;
|
|
|
}
|
|
|
uf.setId(followId);
|
|
|
uf.setEffective(DeleteStatus.DELETED.getCode());
|
|
|
@@ -1138,7 +1135,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
CustomerExcelBo[] bos = boSet.toArray(new CustomerExcelBo[] {});
|
|
|
for (int i = 0; i < bos.length; i++) {
|
|
|
CustomerExcelBo bo = bos[i];
|
|
|
- CustomerExcelBo ceb = null;
|
|
|
+ CustomerExcelBo ceb;
|
|
|
for (int j = 0; j < i; j++) {
|
|
|
ceb = bos[j];
|
|
|
if (bo.getCustomerType().equals(AFTConstants.USER_TYPE_PERSONAL)) { // 个人
|
|
|
@@ -1166,22 +1163,19 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
list = userMapper.checkUser("", bo.getIdentifyName(), "", Integer.parseInt(bo.getCustomerType()),
|
|
|
null, null);
|
|
|
}
|
|
|
- if (list.size() > 0) {
|
|
|
- bo.setUid(list.get(0).getId());
|
|
|
- bo.setNewData(false);
|
|
|
- List<LockingReleaseBo> businessLockedList = userMapper.selectLockedProject(bo.getUid(), null,
|
|
|
- bo.getBusinessProjectId(), 1, UserLockReleaseStatus.LOCKED.getCode());
|
|
|
- if (businessLockedList.size() > 0) {
|
|
|
- existRows.add(bo.getRowNumber());
|
|
|
- }
|
|
|
- } else {
|
|
|
- bo.setUid(UUID.randomUUID().toString());
|
|
|
- bo.setNewData(true);
|
|
|
- }
|
|
|
- } else {
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
+ bo.setUid(list.get(0).getId());
|
|
|
+ bo.setNewData(false);
|
|
|
+ List<LockingReleaseBo> businessLockedList = userMapper.selectLockedProject(bo.getUid(), null,
|
|
|
+ bo.getBusinessProjectId(), 1, UserLockReleaseStatus.LOCKED.getCode());
|
|
|
+ if (!businessLockedList.isEmpty()) {
|
|
|
+ existRows.add(bo.getRowNumber());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
List<LockingReleaseBo> businessLockedList = userMapper.selectLockedProject(bo.getUid(), null,
|
|
|
bo.getBusinessProjectId(), 1, UserLockReleaseStatus.LOCKED.getCode());
|
|
|
- if (businessLockedList.size() > 0) {
|
|
|
+ if (!businessLockedList.isEmpty()) {
|
|
|
existRows.add(bo.getRowNumber());
|
|
|
}
|
|
|
}
|
|
|
@@ -1192,7 +1186,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
@Transactional
|
|
|
public int saveUploadData(Set<CustomerExcelBo> boSet) {
|
|
|
Date now = new Date();
|
|
|
- String uid = "";
|
|
|
+ String uid;
|
|
|
for (CustomerExcelBo bo : boSet) {
|
|
|
uid = bo.getUid();
|
|
|
if (bo.isNewData()) { // 新建客户
|
|
|
@@ -1295,17 +1289,14 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
if(aid==null)aid=TokenManager.getAdminId();
|
|
|
if(data==null)data=0;
|
|
|
// 是否多个客户
|
|
|
- boolean isUs = false;
|
|
|
- if (uid.contains(",")) {
|
|
|
- isUs = true;
|
|
|
- }
|
|
|
- List<String> uList = new ArrayList<>();
|
|
|
+ boolean isUs = uid.contains(",");
|
|
|
+ List<String> uList = new ArrayList<>();
|
|
|
if (isUs) {
|
|
|
uList = Arrays.asList(uid.split(","));
|
|
|
}
|
|
|
user.setId(uid);
|
|
|
user.setTransferTime(now);
|
|
|
- int flag = 0;
|
|
|
+ int flag;
|
|
|
//记录旧数据值,与新数据值 将旧数据与新数据都需要更新
|
|
|
List<User> useList=new ArrayList<>();
|
|
|
List<User> newList=new ArrayList<>();
|