提交 47013101 编写于 作者: sq3536's avatar sq3536

SysOperator接管

上级 8d3e341e
...@@ -6,16 +6,20 @@ import cn.ibizlab.api.mapping.SysPSSystemMapping; ...@@ -6,16 +6,20 @@ import cn.ibizlab.api.mapping.SysPSSystemMapping;
import cn.ibizlab.api.mapping.SysRolePermissionMapping; import cn.ibizlab.api.mapping.SysRolePermissionMapping;
import cn.ibizlab.core.uaa.domain.SysPSSystem; import cn.ibizlab.core.uaa.domain.SysPSSystem;
import cn.ibizlab.core.uaa.domain.SysRolePermission; import cn.ibizlab.core.uaa.domain.SysRolePermission;
import cn.ibizlab.core.uaa.domain.SysUser;
import cn.ibizlab.core.uaa.extensions.domain.PermissionNode; import cn.ibizlab.core.uaa.extensions.domain.PermissionNode;
import cn.ibizlab.core.uaa.extensions.domain.SysStructure; import cn.ibizlab.core.uaa.extensions.domain.SysStructure;
import cn.ibizlab.core.uaa.extensions.service.SysAppService; import cn.ibizlab.core.uaa.extensions.service.SysAppService;
import cn.ibizlab.core.uaa.extensions.service.UAACoreService; import cn.ibizlab.core.uaa.extensions.service.UAACoreService;
import cn.ibizlab.core.uaa.service.ISysPSSystemService; import cn.ibizlab.core.uaa.service.ISysPSSystemService;
import cn.ibizlab.core.uaa.service.ISysRolePermissionService; import cn.ibizlab.core.uaa.service.ISysRolePermissionService;
import cn.ibizlab.core.uaa.service.ISysUserService;
import cn.ibizlab.util.security.AuthenticationUser; import cn.ibizlab.util.security.AuthenticationUser;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.http.HttpRequest; import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
...@@ -26,6 +30,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -26,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -110,4 +115,39 @@ public class UAACoreResource { ...@@ -110,4 +115,39 @@ public class UAACoreResource {
return ResponseEntity.ok().body(uaaCoreService.getPublicKey()); return ResponseEntity.ok().body(uaaCoreService.getPublicKey());
} }
@Cacheable( value="ibzuaa-model",key = "'catalog:SysOperator'")
@RequestMapping(method = RequestMethod.GET, value = "/dictionarys/catalogs/SysOperator")
public ResponseEntity<JSONObject> getCatalog() {
return getOptions("SysOperator");
}
@Cacheable( value="ibzuaa-model",key = "'codelist:SysOperator'")
@RequestMapping(method = RequestMethod.GET, value = "/dictionarys/codelist/SysOperator")
public ResponseEntity<JSONObject> getCodeList() {
return getOptions("SysOperator");
}
@Autowired
private ISysUserService userService;;
public ResponseEntity<JSONObject> getOptions(String catalog) {
JSONObject jo = new JSONObject();
jo.put("srfkey", catalog);
jo.put("emptytext", "");
List<JSONObject> list = new ArrayList<>();
userService.list().forEach(item -> {
JSONObject option = new JSONObject();
option.put("id", item.getUserid());
option.put("value", item.getUserid());
option.put("label", item.getUsername());
option.put("text", item.getUsername());
list.add(option);
});
jo.put("items",list);
return ResponseEntity.status(HttpStatus.OK).body(jo);
}
} }
...@@ -49,12 +49,12 @@ public class UserDingtalkRegisterResource { ...@@ -49,12 +49,12 @@ public class UserDingtalkRegisterResource {
@GetMapping(value = "/uaa/getDingtalkAppId") @GetMapping(value = "/uaa/getDingtalkAppId")
public ResponseEntity<JSONObject> getDingtalkAppId() { public ResponseEntity<JSONObject> getDingtalkAppId() {
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
SysOpenAccess openAccess = openAccessService.getOne(Wrappers.<SysOpenAccess>query().eq("open_type","dingtalk")); SysOpenAccess openAccess = openAccessService.getById("dingtalk");
if (!"1".equals(openAccess.getDisabled())) { if (openAccess==null || (openAccess.getDisabled()!=null && openAccess.getDisabled()==1))
String appId = openAccess.getAccessKey(); return ResponseEntity.ok(obj);
if (!StringUtils.isEmpty(appId)) { String appId = openAccess.getAccessKey();// qq互联appid
obj.put("appid", appId); if (!StringUtils.isEmpty(appId)) {
} obj.put("appid", appId);
} }
return ResponseEntity.ok(obj); return ResponseEntity.ok(obj);
...@@ -76,9 +76,9 @@ public class UserDingtalkRegisterResource { ...@@ -76,9 +76,9 @@ public class UserDingtalkRegisterResource {
throw new BadRequestAlertException("code为空", "UserDingtalkRegisterResource", ""); throw new BadRequestAlertException("code为空", "UserDingtalkRegisterResource", "");
// 从数据库中获取钉钉授权应用信息 // 从数据库中获取钉钉授权应用信息
SysOpenAccess openAccess = openAccessService.getOne(Wrappers.<SysOpenAccess>query().eq("open_type","dingtalk")); SysOpenAccess openAccess = openAccessService.getById("dingtalk");
if ("1".equals(openAccess.getDisabled()) || StringUtils.isEmpty(openAccess)) if (openAccess==null || (openAccess.getDisabled()!=null && openAccess.getDisabled()==1))
throw new BadRequestAlertException("未获得钉钉授权", "UserDingtalkRegisterResource", ""); throw new BadRequestAlertException("未找到配置", "UserDingtalkRegisterResource", "");
String appId = openAccess.getAccessKey();// 个人应用开发过程中的唯一性标识AppId String appId = openAccess.getAccessKey();// 个人应用开发过程中的唯一性标识AppId
String appSecret = openAccess.getSecretKey();// 个人应用AppSecret String appSecret = openAccess.getSecretKey();// 个人应用AppSecret
......
...@@ -50,14 +50,15 @@ public class UserQQRegisterResource { ...@@ -50,14 +50,15 @@ public class UserQQRegisterResource {
@GetMapping(value = "/uaa/getQQAppId") @GetMapping(value = "/uaa/getQQAppId")
public ResponseEntity<JSONObject> getQQAppId() { public ResponseEntity<JSONObject> getQQAppId() {
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
SysOpenAccess openAccess = openAccessService.getOne(Wrappers.<SysOpenAccess>query().eq("open_type","qq")); SysOpenAccess openAccess = openAccessService.getById("qq");
if (!"1".equals(openAccess.getDisabled())) { if (openAccess==null || (openAccess.getDisabled()!=null && openAccess.getDisabled()==1))
String appId = openAccess.getAccessKey();// qq互联appid return ResponseEntity.ok(obj);
if (!StringUtils.isEmpty(appId)) { String appId = openAccess.getAccessKey();// qq互联appid
obj.put("appid", appId); if (!StringUtils.isEmpty(appId)) {
} obj.put("appid", appId);
} }
return ResponseEntity.ok(obj); return ResponseEntity.ok(obj);
} }
...@@ -76,9 +77,9 @@ public class UserQQRegisterResource { ...@@ -76,9 +77,9 @@ public class UserQQRegisterResource {
throw new BadRequestAlertException("code为空", "UserQQRegisterResource", ""); throw new BadRequestAlertException("code为空", "UserQQRegisterResource", "");
// 从数据库中获取qq互联信息 // 从数据库中获取qq互联信息
SysOpenAccess openAccess = openAccessService.getOne(Wrappers.<SysOpenAccess>query().eq("open_type","qq")); SysOpenAccess openAccess = openAccessService.getById("qq");
if ("1".equals(openAccess.getDisabled()) || StringUtils.isEmpty(openAccess)) if (openAccess==null || (openAccess.getDisabled()!=null && openAccess.getDisabled()==1))
throw new BadRequestAlertException("未获得qq授权", "UserQQRegisterResource", ""); throw new BadRequestAlertException("未找到配置", "UserQQRegisterResource", "");
String appId = openAccess.getAccessKey();// qq互联appid String appId = openAccess.getAccessKey();// qq互联appid
String appSecret = openAccess.getSecretKey();// qq互联appkey String appSecret = openAccess.getSecretKey();// qq互联appkey
String redirectUri = openAccess.getRedirectUri();// qq互联应用回调地址 String redirectUri = openAccess.getRedirectUri();// qq互联应用回调地址
......
...@@ -50,12 +50,12 @@ public class UserWechatRegisterResource { ...@@ -50,12 +50,12 @@ public class UserWechatRegisterResource {
@GetMapping(value = "/uaa/getWechatAppId") @GetMapping(value = "/uaa/getWechatAppId")
public ResponseEntity<JSONObject> getWechatAppId() { public ResponseEntity<JSONObject> getWechatAppId() {
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
SysOpenAccess openAccess = openAccessService.getOne(Wrappers.<SysOpenAccess>query().eq("open_type","webchart")); SysOpenAccess openAccess = openAccessService.getById("webchart");
if (!"1".equals(openAccess.getDisabled())) { if (openAccess==null || (openAccess.getDisabled()!=null && openAccess.getDisabled()==1))
String appId = openAccess.getAccessKey(); return ResponseEntity.ok(obj);
if (!StringUtils.isEmpty(appId)) { String appId = openAccess.getAccessKey();// qq互联appid
obj.put("appid", appId); if (!StringUtils.isEmpty(appId)) {
} obj.put("appid", appId);
} }
return ResponseEntity.ok(obj); return ResponseEntity.ok(obj);
...@@ -77,9 +77,9 @@ public class UserWechatRegisterResource { ...@@ -77,9 +77,9 @@ public class UserWechatRegisterResource {
throw new BadRequestAlertException("code为空", "UserWechatRegisterResource", ""); throw new BadRequestAlertException("code为空", "UserWechatRegisterResource", "");
// 从数据库中获取微信授权应用信息 // 从数据库中获取微信授权应用信息
SysOpenAccess openAccess = openAccessService.getOne(Wrappers.<SysOpenAccess>query().eq("open_type","webchart")); SysOpenAccess openAccess = openAccessService.getById("webchart");
if ("1".equals(openAccess.getDisabled()) || StringUtils.isEmpty(openAccess)) if (openAccess==null || (openAccess.getDisabled()!=null && openAccess.getDisabled()==1))
throw new BadRequestAlertException("未获得微信授权", "UserWechatRegisterResource", ""); throw new BadRequestAlertException("未找到配置", "UserWechatRegisterResource", "");
String appId = openAccess.getAccessKey();// 微信开放平台appid String appId = openAccess.getAccessKey();// 微信开放平台appid
String appSecret = openAccess.getSecretKey();// 微信开放平台appsecret String appSecret = openAccess.getSecretKey();// 微信开放平台appsecret
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册