mirror of https://gitee.com/stylefeng/guns
【7.6.0】增加临时devops的控制器和配置
parent
387dea763f
commit
a3516019c4
|
@ -1,54 +0,0 @@
|
|||
package cn.stylefeng.guns.modular.demo.controller;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.stylefeng.guns.modular.demo.service.DemoService;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 示例控制器
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2021/1/24 10:57
|
||||
*/
|
||||
@RestController
|
||||
@ApiResource(name = "示例")
|
||||
public class DemoController {
|
||||
|
||||
@Resource
|
||||
private DemoService demoService;
|
||||
|
||||
/**
|
||||
* 示例方法
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2021/1/24 10:59
|
||||
*/
|
||||
@GetResource(name = "示例方法", path = "/json/success")
|
||||
public ResponseData<?> renderSuccess() {
|
||||
demoService.demoService();
|
||||
return new SuccessResponseData<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 示例加密方法
|
||||
* <p>
|
||||
* requiredEncryption = true
|
||||
* </p>
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2021/1/24 10:59
|
||||
*/
|
||||
@PostResource(name = "示例加密方法", path = "/encode", requiredPermission = false, requiredLogin = false, requiredEncryption = true)
|
||||
public ResponseData<Dict> encode(@RequestBody Dict dict) {
|
||||
return new SuccessResponseData<>(dict);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package cn.stylefeng.guns.modular.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.stylefeng.roses.kernel.auth.api.AuthServiceApi;
|
||||
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginRequest;
|
||||
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginResponse;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.user.entity.SysUser;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.user.pojo.request.SysUserRequest;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.user.service.SysUserService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 示例控制器
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2021/1/24 10:57
|
||||
*/
|
||||
@RestController
|
||||
@ApiResource(name = "示例")
|
||||
public class DevOpsController {
|
||||
|
||||
@Resource
|
||||
private AuthServiceApi authServiceApi;
|
||||
|
||||
@Resource
|
||||
private SysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 用户登陆
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2021/3/17 17:23
|
||||
*/
|
||||
@PostResource(name = "登陆", path = "/login", requiredLogin = false)
|
||||
public ResponseData<String> login(@RequestBody @Validated LoginRequest loginRequest) {
|
||||
LoginResponse loginResponse = authServiceApi.login(loginRequest);
|
||||
return new SuccessResponseData<>(loginResponse.getToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* 临时兼容旧的devops平台
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/6/26 20:42
|
||||
*/
|
||||
@GetResource(name = "运维平台接口检测", path = "/sysUser/devopsApiCheck", requiredLogin = false, requiredPermission = false)
|
||||
public ResponseData<Integer> devopsApiCheck() {
|
||||
return new SuccessResponseData<>(999);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有用户ID和名称列表
|
||||
*
|
||||
* @author majianguo
|
||||
* @since 2022/1/17 14:24
|
||||
**/
|
||||
@GetResource(name = "获取所有用户ID和名称列表", path = "/sysUser/getAllUserIdList")
|
||||
public ResponseData<List<SysUserRequest>> getAllUserIdList() {
|
||||
LambdaQueryWrapper<SysUser> userLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userLambdaQueryWrapper.select(SysUser::getUserId, SysUser::getAccount);
|
||||
userLambdaQueryWrapper.eq(SysUser::getStatusFlag, StatusEnum.ENABLE.getCode());
|
||||
userLambdaQueryWrapper.ne(SysUser::getDelFlag, YesOrNotEnum.Y.getCode());
|
||||
List<SysUser> list = this.sysUserService.list(userLambdaQueryWrapper);
|
||||
List<SysUserRequest> collect = list.stream().map(item -> BeanUtil.toBean(item, SysUserRequest.class)).collect(Collectors.toList());
|
||||
return new SuccessResponseData<>(collect);
|
||||
}
|
||||
|
||||
}
|
|
@ -9,3 +9,8 @@ spring:
|
|||
# 连接池大小根据实际情况调整
|
||||
max-active: 100
|
||||
max-pool-prepared-statement-per-connection-size: 100
|
||||
|
||||
devops:
|
||||
serverHost: http://192.168.31.58:12909
|
||||
project-unique-code: Y4JdNfsfS2tjAQouFm1t035IAnsjSKG3
|
||||
project-interaction-secret-key: QBAttyH2ZkolwtkDcn0Y5b8HLGHEtOHC
|
|
@ -9,3 +9,8 @@ spring:
|
|||
# 连接池大小根据实际情况调整
|
||||
max-active: 100
|
||||
max-pool-prepared-statement-per-connection-size: 100
|
||||
|
||||
devops:
|
||||
serverHost: http://192.168.31.58:12909
|
||||
project-unique-code: Y4JdNfsfS2tjAQouFm1t035IAnsjSKG3
|
||||
project-interaction-secret-key: QBAttyH2ZkolwtkDcn0Y5b8HLGHEtOHC
|
Loading…
Reference in New Issue