|
@@ -14,10 +14,13 @@ import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.common.exception.CustomException;
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.exception.ServiceException;
|
|
import com.fs.common.exception.ServiceException;
|
|
|
import com.fs.common.exception.file.OssException;
|
|
import com.fs.common.exception.file.OssException;
|
|
|
|
|
+import com.fs.common.enums.ImTypeEnum;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.common.utils.PatternUtils;
|
|
import com.fs.common.utils.PatternUtils;
|
|
|
import com.fs.common.utils.SecurityUtils;
|
|
import com.fs.common.utils.SecurityUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
import com.fs.common.utils.StringUtils;
|
|
|
|
|
+import com.fs.im.config.ImTypeConfig;
|
|
|
|
|
+import com.fs.im.service.OpenIMService;
|
|
|
import com.fs.company.domain.*;
|
|
import com.fs.company.domain.*;
|
|
|
import com.fs.company.mapper.*;
|
|
import com.fs.company.mapper.*;
|
|
|
import com.fs.company.param.CompanyUserAreaParam;
|
|
import com.fs.company.param.CompanyUserAreaParam;
|
|
@@ -107,6 +110,12 @@ public class CompanyUserServiceImpl implements ICompanyUserService
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FsUserMapper fsUserMapper;
|
|
private FsUserMapper fsUserMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private CompanyCompanyFsuserMapper companyCompanyFsuserMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private OpenIMService openIMService;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IFsUserCompanyUserService userCompanyUserService;
|
|
private IFsUserCompanyUserService userCompanyUserService;
|
|
|
|
|
|
|
@@ -1097,6 +1106,42 @@ public class CompanyUserServiceImpl implements ICompanyUserService
|
|
|
return companyUserMapper.selectBoundFsUsersByCompanyUserId(companyUserId);
|
|
return companyUserMapper.selectBoundFsUsersByCompanyUserId(companyUserId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public void bindFsUserAndImportFriend(Long userId, Long companyUserId) {
|
|
|
|
|
+ com.fs.his.domain.FsUser fsUser = fsUserMapper.selectFsUserByUserId(userId);
|
|
|
|
|
+ if (fsUser == null || (fsUser.getIsDel() != null && fsUser.getIsDel() == 1)) {
|
|
|
|
|
+ throw new CustomException("会员不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ CompanyUser companyUser = selectCompanyUserById(companyUserId);
|
|
|
|
|
+ if (companyUser == null || "1".equals(companyUser.getDelFlag())) {
|
|
|
|
|
+ throw new CustomException("销售不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!"0".equals(companyUser.getStatus())) {
|
|
|
|
|
+ throw new CustomException("销售已禁用");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ batchUpdateBindCompanyUserId(Collections.singletonList(userId), companyUserId);
|
|
|
|
|
+
|
|
|
|
|
+ CompanyCompanyFsuser existBind = companyCompanyFsuserMapper.getInfoByUserId(String.valueOf(userId));
|
|
|
|
|
+ if (existBind == null) {
|
|
|
|
|
+ CompanyCompanyFsuser bind = new CompanyCompanyFsuser();
|
|
|
|
|
+ bind.setUserId(userId);
|
|
|
|
|
+ bind.setCompanyId(companyUser.getCompanyId());
|
|
|
|
|
+ bind.setCompanyUserId(companyUserId);
|
|
|
|
|
+ bind.setStatus(1);
|
|
|
|
|
+ bind.setBindType(0);
|
|
|
|
|
+ bind.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
+ companyCompanyFsuserMapper.insertCompanyCompanyUser(bind);
|
|
|
|
|
+ } else if (!companyUserId.equals(existBind.getCompanyUserId())) {
|
|
|
|
|
+ existBind.setCompanyUserId(companyUserId);
|
|
|
|
|
+ existBind.setCompanyId(companyUser.getCompanyId());
|
|
|
|
|
+ existBind.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
+ companyCompanyFsuserMapper.updateCompanyCompanyUser(existBind);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public int unBind(String userId) {
|
|
public int unBind(String userId) {
|
|
|
return companyUserMapper.unBind(userId);
|
|
return companyUserMapper.unBind(userId);
|