|
@@ -8,6 +8,7 @@ import cn.kdan.pdf.tech.core.enums.LicenseCodeStatusEnum;
|
|
|
import cn.kdan.pdf.tech.core.enums.RoleEnum;
|
|
|
import cn.kdan.pdf.tech.core.mapper.ext.ExtVppTeamMapper;
|
|
|
import cn.kdan.pdf.tech.core.model.*;
|
|
|
+import cn.kdan.pdf.tech.core.params.VppMemberRegisterParam;
|
|
|
import cn.kdan.pdf.tech.core.pojo.dto.CreateTeamDTO;
|
|
|
import cn.kdan.pdf.tech.core.pojo.dto.EditTeamDTO;
|
|
|
import cn.kdan.pdf.tech.core.pojo.vo.*;
|
|
@@ -52,6 +53,8 @@ import java.util.stream.Collectors;
|
|
|
@Transactional
|
|
|
public class VppTeamServiceImpl implements VppTeamService {
|
|
|
|
|
|
+ private final static String DEFAULT_PASSWORD = "123456";
|
|
|
+
|
|
|
@Resource
|
|
|
private VppMemberService vppMemberService;
|
|
|
@Resource
|
|
@@ -70,17 +73,17 @@ public class VppTeamServiceImpl implements VppTeamService {
|
|
|
private AuthService authService;
|
|
|
@Resource
|
|
|
private VppCompanyService companyService;
|
|
|
- @Value("${webUrl}")
|
|
|
- private String webUrl;
|
|
|
- @Value("${createUrl}")
|
|
|
- private String createUrl;
|
|
|
- @Value("${loginUrl}")
|
|
|
- private String loginUrl;
|
|
|
- // 运营后台地址,图片地址emailImagesUrl
|
|
|
- @Value("${readerproUrl}")
|
|
|
- private String readerproUrl;
|
|
|
- @Value("${emailImagesUrl}")
|
|
|
- private String emailImagesUrl;
|
|
|
+// @Value("${webUrl}")
|
|
|
+// private String webUrl;
|
|
|
+// @Value("${createUrl}")
|
|
|
+// private String createUrl;
|
|
|
+// @Value("${loginUrl}")
|
|
|
+// private String loginUrl;
|
|
|
+// // 运营后台地址,图片地址emailImagesUrl
|
|
|
+// @Value("${readerproUrl}")
|
|
|
+// private String readerproUrl;
|
|
|
+// @Value("${emailImagesUrl}")
|
|
|
+// private String emailImagesUrl;
|
|
|
@Autowired
|
|
|
private RedisUtils<String, String> redisUtils;
|
|
|
private static final ThreadPoolExecutor SEND_MAIL_THREAD_POOL = new ThreadPoolExecutor( Runtime.getRuntime().availableProcessors(),
|
|
@@ -287,29 +290,31 @@ public class VppTeamServiceImpl implements VppTeamService {
|
|
|
VppCompany vppCompany = vppCompanyService.getById(superAdmin.getCompanyId());
|
|
|
if(vppMember.getRole().equals("3") && StringUtils.isEmpty(vppMember.getDigestPassword())) {
|
|
|
actionEnum = CaptchaActionEnum.JOIN_TEAM_FOR_ADD_ADMIN_NO_PASSWORD;
|
|
|
- String pwd = CommonUtils.generateVerifyCode();
|
|
|
+ String pwd = DEFAULT_PASSWORD;
|
|
|
vppMember.setDigestPassword(new RSAUtils().encrypt(pwd));
|
|
|
vppMemberService.update(vppMember);
|
|
|
//若管理员已注册账号,则仅发放邀请加入团队邮件;邮件带上memberId和用户的TeamId集合(emailTeamList)和code
|
|
|
- String url = webUrl + loginUrl + "?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
- //用户邮箱 超管邮箱 用户邮箱 密码 链接
|
|
|
- text = String.format(actionEnum.text(), vppMember.getFullName(), vppCompany.getName(),
|
|
|
- vppMember.getEmail(), pwd, url);
|
|
|
+// String url = webUrl + loginUrl + "?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
+// //用户邮箱 超管邮箱 用户邮箱 密码 链接
|
|
|
+// text = String.format(actionEnum.text(), vppMember.getFullName(), vppCompany.getName(),
|
|
|
+// vppMember.getEmail(), pwd, url);
|
|
|
+ this.enterTeam(vppMember.getId(),Collections.singletonList(newVppTeam.getId()),actionEnum.value(),code);
|
|
|
} else {
|
|
|
actionEnum = CaptchaActionEnum.JOIN_TEAM_FOR_ADD_ADMIN;
|
|
|
- String url = webUrl + loginUrl + "?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
- //用户邮箱 超管邮箱 链接
|
|
|
- text = String.format(actionEnum.text(), vppMember.getFullName(), vppCompany.getName(), url);
|
|
|
+// String url = webUrl + loginUrl + "?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
+// //用户邮箱 超管邮箱 链接
|
|
|
+// text = String.format(actionEnum.text(), vppMember.getFullName(), vppCompany.getName(), url);
|
|
|
+ this.enterTeam(vppMember.getId(),Collections.singletonList(newVppTeam.getId()),actionEnum.value(),code);
|
|
|
}
|
|
|
- //发送邮件
|
|
|
- // 替换图片动态地址和取消订阅链接
|
|
|
- text = text.replace("emailImagesUrl", emailImagesUrl).replace("cancelEmailUrl", readerproUrl + "/unsubscribe?email=" + vppMember.getEmail());
|
|
|
- String finalText = text;
|
|
|
- ThreadPoolSingleUtil.getInstance().excute(() -> {
|
|
|
-// if(emailUtils.sendMail(actionEnum.subject(), finalText, Collections.singletonList(vppMember.getEmail()))){
|
|
|
-// redisUtils.hset(AuthConstant.VERIFY_CODE_KEY + actionEnum.value(), vppMember.getEmail(), code, AuthConstant.INVITE_VERIFY_CODE_KEY_EXPIRE_TIME);
|
|
|
-// }
|
|
|
- });
|
|
|
+// //发送邮件
|
|
|
+// // 替换图片动态地址和取消订阅链接
|
|
|
+// text = text.replace("emailImagesUrl", emailImagesUrl).replace("cancelEmailUrl", readerproUrl + "/unsubscribe?email=" + vppMember.getEmail());
|
|
|
+// String finalText = text;
|
|
|
+// ThreadPoolSingleUtil.getInstance().excute(() -> {
|
|
|
+//// if(emailUtils.sendMail(actionEnum.subject(), finalText, Collections.singletonList(vppMember.getEmail()))){
|
|
|
+//// redisUtils.hset(AuthConstant.VERIFY_CODE_KEY + actionEnum.value(), vppMember.getEmail(), code, AuthConstant.INVITE_VERIFY_CODE_KEY_EXPIRE_TIME);
|
|
|
+//// }
|
|
|
+// });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -497,29 +502,31 @@ public class VppTeamServiceImpl implements VppTeamService {
|
|
|
VppCompany vppCompany = vppCompanyService.getById(member.getCompanyId());
|
|
|
if(vppMember.getRole().equals("3") && StringUtils.isEmpty(vppMember.getDigestPassword())) {
|
|
|
actionEnum = CaptchaActionEnum.JOIN_TEAM_FOR_ADD_ADMIN_NO_PASSWORD;
|
|
|
- String pwd = CommonUtils.generateVerifyCode();
|
|
|
+ String pwd = DEFAULT_PASSWORD;
|
|
|
vppMember.setDigestPassword(new RSAUtils().encrypt(pwd));
|
|
|
vppMemberService.update(vppMember);
|
|
|
//若管理员已注册账号,则仅发放邀请加入团队邮件;邮件带上memberId和用户的TeamId集合(emailTeamList)和code
|
|
|
- String url = webUrl + loginUrl + "?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
- //用户邮箱 超管邮箱 用户邮箱 密码 链接
|
|
|
- text = String.format(actionEnum.text(), vppMember.getFullName(), vppCompany.getName(),
|
|
|
- vppMember.getEmail(), pwd, url);
|
|
|
+// String url = webUrl + loginUrl + "?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
+// //用户邮箱 超管邮箱 用户邮箱 密码 链接
|
|
|
+// text = String.format(actionEnum.text(), vppMember.getFullName(), vppCompany.getName(),
|
|
|
+// vppMember.getEmail(), pwd, url);
|
|
|
+ this.enterTeam(vppMember.getId(), Collections.singletonList(vppTeam.getId()),actionEnum.value(),code);
|
|
|
} else {
|
|
|
actionEnum = CaptchaActionEnum.JOIN_TEAM_FOR_ADD_ADMIN;
|
|
|
- String url = webUrl + loginUrl + "?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
- //用户邮箱 超管邮箱 链接
|
|
|
- text = String.format(actionEnum.text(), vppMember.getFullName(), vppCompany.getName(), url);
|
|
|
+// String url = webUrl + loginUrl + "?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
+// //用户邮箱 超管邮箱 链接
|
|
|
+// text = String.format(actionEnum.text(), vppMember.getFullName(), vppCompany.getName(), url);
|
|
|
+ this.enterTeam(vppMember.getId(), Collections.singletonList(vppTeam.getId()),actionEnum.value(),code);
|
|
|
}
|
|
|
//发送邮件
|
|
|
- // 替换图片动态地址和取消订阅链接
|
|
|
- text = text.replace("emailImagesUrl", emailImagesUrl).replace("cancelEmailUrl", readerproUrl + "/unsubscribe?email=" + vppMember.getEmail());
|
|
|
- String finalText = text;
|
|
|
- ThreadPoolSingleUtil.getInstance().excute(() -> {
|
|
|
-// if(emailUtils.sendMail(actionEnum.subject(), finalText, Collections.singletonList(vppMember.getEmail()))){
|
|
|
-// redisUtils.hset(AuthConstant.VERIFY_CODE_KEY + actionEnum.value(), vppMember.getEmail(), code, AuthConstant.INVITE_VERIFY_CODE_KEY_EXPIRE_TIME);
|
|
|
-// }
|
|
|
- });
|
|
|
+// // 替换图片动态地址和取消订阅链接
|
|
|
+// text = text.replace("emailImagesUrl", emailImagesUrl).replace("cancelEmailUrl", readerproUrl + "/unsubscribe?email=" + vppMember.getEmail());
|
|
|
+// String finalText = text;
|
|
|
+// ThreadPoolSingleUtil.getInstance().excute(() -> {
|
|
|
+//// if(emailUtils.sendMail(actionEnum.subject(), finalText, Collections.singletonList(vppMember.getEmail()))){
|
|
|
+//// redisUtils.hset(AuthConstant.VERIFY_CODE_KEY + actionEnum.value(), vppMember.getEmail(), code, AuthConstant.INVITE_VERIFY_CODE_KEY_EXPIRE_TIME);
|
|
|
+//// }
|
|
|
+// });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -695,11 +702,26 @@ public class VppTeamServiceImpl implements VppTeamService {
|
|
|
String code = CommonUtils.generateVerifyCode();
|
|
|
if (ObjectUtils.isEmpty(vppMember)) {
|
|
|
VppCompany vppCompany = vppCompanyService.getById(member.getCompanyId());
|
|
|
- actionEnum = CaptchaActionEnum.USER_REGISTER_FOR_ADD_ADMIN;
|
|
|
+// actionEnum = CaptchaActionEnum.USER_REGISTER_FOR_ADD_ADMIN;
|
|
|
//发送注册邮件,前端根据注册页面表单信息和teamIds,还有code去进行注册
|
|
|
- String url = webUrl + createUrl +"?teamIds=" + teamString + "&code=" + code + "&action=" + actionEnum.value() + "&account=" + account;
|
|
|
- //用户邮箱 超管邮箱 链接
|
|
|
- text = String.format(CaptchaActionEnum.USER_REGISTER_FOR_ADD_ADMIN.text(), account, vppCompany.getName(), url, account);
|
|
|
+// String url = webUrl + createUrl +"?teamIds=" + teamString + "&code=" + code + "&action=" + actionEnum.value() + "&account=" + account;
|
|
|
+// //用户邮箱 超管邮箱 链接
|
|
|
+// text = String.format(CaptchaActionEnum.USER_REGISTER_FOR_ADD_ADMIN.text(), account, vppCompany.getName(), url, account);
|
|
|
+ VppMemberRegisterParam param = new VppMemberRegisterParam();
|
|
|
+ param.setEmail(account);
|
|
|
+ param.setUsername(account);
|
|
|
+// param.setArea();
|
|
|
+ param.setCompany(vppCompany.getName());
|
|
|
+ param.setTeamIds(teamIds);
|
|
|
+ param.setPassword(DEFAULT_PASSWORD);
|
|
|
+ param.setConfirmPassword(DEFAULT_PASSWORD);
|
|
|
+ param.setCodeFlag(true);
|
|
|
+// param.setIndustry();
|
|
|
+// param.setInviteEmailCode();
|
|
|
+// param.setIsSuperAdmin();
|
|
|
+// param.setVerifyCode();
|
|
|
+ vppMemberService.create(param);
|
|
|
+
|
|
|
} else {
|
|
|
VppCompany vppCompany = vppCompanyService.getById(vppMember.getCompanyId());
|
|
|
// 用户管理的所有团队提取备用
|
|
@@ -719,30 +741,24 @@ public class VppTeamServiceImpl implements VppTeamService {
|
|
|
//如果已经注册账号需要判断该账号是普通用户还是管理员,如果是普通用户的话给一个密码
|
|
|
if(vppMember.getRole().contains("3")&&StringUtils.isEmpty(vppMember.getDigestPassword())){
|
|
|
actionEnum = CaptchaActionEnum.JOIN_TEAM_FOR_ADD_ADMIN_NO_PASSWORD;
|
|
|
- String pwd = CommonUtils.generateVerifyCode();
|
|
|
+ String pwd = DEFAULT_PASSWORD;
|
|
|
vppMember.setDigestPassword(new RSAUtils().encrypt(pwd));
|
|
|
vppMemberService.update(vppMember);
|
|
|
//若管理员已注册账号,则仅发放邀请加入团队邮件;邮件带上memberId和用户的TeamId集合(emailTeamList)和code
|
|
|
- String url = webUrl + loginUrl +"?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
- //用户邮箱 超管邮箱 用户邮箱 密码 链接
|
|
|
- text = String.format(actionEnum.text(),vppMember.getFullName(),
|
|
|
- vppCompany.getName(), vppMember.getEmail(), pwd, url);
|
|
|
+// String url = webUrl + loginUrl +"?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
+// //用户邮箱 超管邮箱 用户邮箱 密码 链接
|
|
|
+// text = String.format(actionEnum.text(),vppMember.getFullName(),
|
|
|
+// vppCompany.getName(), vppMember.getEmail(), pwd, url);
|
|
|
+
|
|
|
+ this.enterTeam(vppMember.getId(),teamIds,actionEnum.value(),code);
|
|
|
}else{
|
|
|
actionEnum = CaptchaActionEnum.JOIN_TEAM_FOR_ADD_ADMIN;
|
|
|
- String url = webUrl + loginUrl +"?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
- //用户邮箱 超管邮箱 链接
|
|
|
- text = String.format(actionEnum.text(), vppMember.getFullName(), vppCompany.getName(), url);
|
|
|
+// String url = webUrl + loginUrl +"?teamIds=" + teamString + "&code=" + code + "&memberId=" + vppMember.getId() + "&action=" + actionEnum.value();
|
|
|
+// //用户邮箱 超管邮箱 链接
|
|
|
+// text = String.format(actionEnum.text(), vppMember.getFullName(), vppCompany.getName(), url);
|
|
|
+ this.enterTeam(vppMember.getId(),teamIds,actionEnum.value(),code);
|
|
|
}
|
|
|
}
|
|
|
- // 替换图片动态地址和取消订阅链接
|
|
|
- text = text.replace("emailImagesUrl", emailImagesUrl).replace("cancelEmailUrl", readerproUrl + "/unsubscribe?email=" + account);
|
|
|
- String finalText = text;
|
|
|
- SEND_MAIL_THREAD_POOL.submit(() -> {
|
|
|
- //发送邮件
|
|
|
-// if(emailUtils.sendMail(actionEnum.subject(), finalText, Collections.singletonList(account))){
|
|
|
-// redisUtils.hset(AuthConstant.VERIFY_CODE_KEY + actionEnum.value(), account, code, AuthConstant.INVITE_VERIFY_CODE_KEY_EXPIRE_TIME);
|
|
|
-// }
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
|
|
@@ -833,7 +849,7 @@ public class VppTeamServiceImpl implements VppTeamService {
|
|
|
VppMember member = vppMemberService.getById(memberId);
|
|
|
CaptchaActionEnum captchaActionEnum = CaptchaActionEnum.getEnumByValue(action);
|
|
|
//检查验证码
|
|
|
- authService.checkVerifyCodeByAction(captchaActionEnum, member.getEmail(), code);
|
|
|
+// authService.checkVerifyCodeByAction(captchaActionEnum, member.getEmail(), code);
|
|
|
List<VppRTeamMemberRole> rTeamMemberRoles = vppRTeamMemberRoleService.listByMemberId(memberId);
|
|
|
Map<String, List<VppRTeamMemberRole>> teamMap = rTeamMemberRoles.stream().collect(Collectors.groupingBy(VppRTeamMemberRole::getTeamId));
|
|
|
teamIds.forEach(teamId -> {
|