Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
getrebuild committed Dec 15, 2024
2 parents 5c9a54f + b2a3196 commit 74f8bf0
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/main/java/com/rebuild/web/user/UserSettingsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,18 @@ public ModelAndView pageUser(HttpServletRequest request) {

String dingtalkCorpid = RebuildConfiguration.get(ConfigurationItem.DingtalkCorpid);
if (dingtalkCorpid != null) {
Object[] dingtalkUser = Application.createQueryNoFilter(
"select appUser from ExternalUser where bindUser = ? and appId = ?")
.setParameter(1, ub.getId())
.setParameter(2, dingtalkCorpid)
.unique();
if (dingtalkUser != null) mv.getModelMap().put("dingtalkUser", dingtalkUser[0]);
Object dingtalkUser = getExternalUserId(ub.getId(), dingtalkCorpid);
if (dingtalkUser != null) mv.getModelMap().put("dingtalkUser", dingtalkUser);
}
String wxworkCorpid = RebuildConfiguration.get(ConfigurationItem.WxworkCorpid);
if (wxworkCorpid != null) {
Object[] wxworkUser = Application.createQueryNoFilter(
"select appUser from ExternalUser where bindUser = ? and appId = ?")
.setParameter(1, ub.getId())
.setParameter(2, wxworkCorpid)
.unique();
if (wxworkUser != null) mv.getModelMap().put("wxworkUser", wxworkUser[0]);
Object wxworkUser = getExternalUserId(ub.getId(), wxworkCorpid);
if (wxworkUser != null) mv.getModelMap().put("wxworkUser", wxworkUser);
}
String feishuAppid = RebuildConfiguration.get(ConfigurationItem.FeishuAppId);
if (feishuAppid != null) {
Object feishuUser = getExternalUserId(ub.getId(), feishuAppid);
if (feishuUser != null) mv.getModelMap().put("feishuUser", feishuUser);
}
String feishuAppid = RebuildConfiguration.get(ConfigurationItem.FeishuAppId);
if (feishuAppid != null) {
Expand All @@ -90,6 +87,15 @@ public ModelAndView pageUser(HttpServletRequest request) {
return mv;
}

private Object getExternalUserId(ID user, String appid) {
Object[] o = Application.createQueryNoFilter(
"select appUser from ExternalUser where bindUser = ? and appId = ?")
.setParameter(1, user)
.setParameter(2, appid)
.unique();
return o == null ? null : o[0];
}

@RequestMapping("/user/send-email-vcode")
public RespBody sendEmailVcode(HttpServletRequest request) {
if (!SMSender.availableMail()) {
Expand Down

0 comments on commit 74f8bf0

Please sign in to comment.