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

SysOperator接管

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