upd
This commit is contained in:
+14
-14
@@ -90,20 +90,20 @@ public class ConfigurerAdapter implements WebMvcConfigurer {
|
|||||||
FastJsonConfig config = new FastJsonConfig();
|
FastJsonConfig config = new FastJsonConfig();
|
||||||
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
// 开启引用检测, 枚举支持
|
// 开启引用检测, 枚举支持
|
||||||
config.setWriterFeatures(
|
/// 是否输出值为null的字段
|
||||||
// 是否输出值为null的字段
|
// config.setWriterFeatures(JSONWriter.Feature.WriteMapNullValue);
|
||||||
// SerializerFeature.WriteMapNullValue,
|
/// 字段如果为null,输出为false,而非null
|
||||||
// 字段如果为null,输出为false,而非null
|
// config.setWriterFeatures(JSONWriter.Feature.WriteNullBooleanAsFalse);
|
||||||
// JSONWriter.Feature.WriteNullBooleanAsFalse,
|
/// 字段如果为null,输出为[],而非null
|
||||||
// 字段如果为null,输出为[],而非null
|
// config.setWriterFeatures(JSONWriter.Feature.WriteNullListAsEmpty);
|
||||||
// JSONWriter.Feature.WriteNullListAsEmpty,
|
/// 字符类型字段如果为null,输出为"",而非null
|
||||||
// 字符类型字段如果为null,输出为"",而非null
|
// config.setWriterFeatures(JSONWriter.Feature.WriteNullStringAsEmpty);
|
||||||
// JSONWriter.Feature.WriteNullStringAsEmpty,
|
/// 太具体的数值会直接影响逻辑本身, 所以不要这个
|
||||||
// 太具体的数值会直接影响逻辑本身, 所以不要这个
|
// config.setWriterFeatures(JSONWriter.Feature.WriteNullNumberAsZero);
|
||||||
// SerializerFeature.WriteNullNumberAsZero,
|
/// 全局Long转字符串,会导致基础框架本身异常, 所以不要这个
|
||||||
JSONWriter.Feature.WriteEnumUsingToString,
|
// config.setWriterFeatures(JSONWriter.Feature.WriteLongAsString);
|
||||||
// SerializerFeature.DisableCircularReferenceDetect,
|
config.setWriterFeatures(JSONWriter.Feature.WriteEnumUsingToString);
|
||||||
JSONWriter.Feature.ReferenceDetection);
|
config.setWriterFeatures(JSONWriter.Feature.ReferenceDetection);
|
||||||
fastJsonConverter.setFastJsonConfig(config);
|
fastJsonConverter.setFastJsonConfig(config);
|
||||||
fastJsonConverter.setSupportedMediaTypes(supportMediaTypeList);
|
fastJsonConverter.setSupportedMediaTypes(supportMediaTypeList);
|
||||||
fastJsonConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
fastJsonConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||||
|
|||||||
+4
-8
@@ -79,12 +79,9 @@ public class SystemAuthController {
|
|||||||
|
|
||||||
@ApiOperation("登录授权")
|
@ApiOperation("登录授权")
|
||||||
@AnonymousPostMapping(value = "/login")
|
@AnonymousPostMapping(value = "/login")
|
||||||
public ResponseEntity<Map<String, Object>> login(
|
public ResponseEntity<Map<String, Object>> login(@Validated @RequestBody SystemUserLoginArgs loginRequest, HttpServletRequest request) throws Exception {
|
||||||
@Validated @RequestBody SystemUserLoginArgs loginRequest,
|
|
||||||
HttpServletRequest request) throws Exception {
|
|
||||||
// 密码解密
|
// 密码解密
|
||||||
String password =
|
String password = CsRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginRequest.getPassword());
|
||||||
CsRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginRequest.getPassword());
|
|
||||||
// 查询验证码
|
// 查询验证码
|
||||||
String code = redisHelper.get(loginRequest.getUuid(), String.class);
|
String code = redisHelper.get(loginRequest.getUuid(), String.class);
|
||||||
// 清除验证码
|
// 清除验证码
|
||||||
@@ -136,8 +133,7 @@ public class SystemAuthController {
|
|||||||
String uuid = SystemCacheKey.CAPTCHA_LOGIN + IdUtil.simpleUUID();
|
String uuid = SystemCacheKey.CAPTCHA_LOGIN + IdUtil.simpleUUID();
|
||||||
//当验证码类型为 arithmetic时且长度 >= 2 时, captcha.text()的结果有几率为浮点型
|
//当验证码类型为 arithmetic时且长度 >= 2 时, captcha.text()的结果有几率为浮点型
|
||||||
String captchaValue = captcha.text();
|
String captchaValue = captcha.text();
|
||||||
if (captcha.getCharType() - 1 == CaptchaCodeEnum.ARITHMETIC.ordinal() &&
|
if (captcha.getCharType() - 1 == CaptchaCodeEnum.ARITHMETIC.ordinal() && captchaValue.contains(SystemConst.SYMBOL_DOT)) {
|
||||||
captchaValue.contains(SystemConst.SYMBOL_DOT)) {
|
|
||||||
captchaValue = captchaValue.split("\\.")[0];
|
captchaValue = captchaValue.split("\\.")[0];
|
||||||
}
|
}
|
||||||
// 保存
|
// 保存
|
||||||
@@ -155,6 +151,6 @@ public class SystemAuthController {
|
|||||||
public ResponseEntity<Void> logout(HttpServletRequest request) {
|
public ResponseEntity<Void> logout(HttpServletRequest request) {
|
||||||
String token = tokenProvider.getToken(request);
|
String token = tokenProvider.getToken(request);
|
||||||
onlineUserService.logoutByToken(token);
|
onlineUserService.logoutByToken(token);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -38,14 +38,14 @@ public class SystemCaptchaController {
|
|||||||
@PostMapping(value = "/sendResetEmailCaptcha")
|
@PostMapping(value = "/sendResetEmailCaptcha")
|
||||||
public ResponseEntity<Void> sendResetEmailCaptcha(@RequestParam String email) {
|
public ResponseEntity<Void> sendResetEmailCaptcha(@RequestParam String email) {
|
||||||
systemEmailService.sendCaptcha(SystemCaptchaBizEnum.EMAIL_RESET_EMAIL_CODE, email);
|
systemEmailService.sendCaptcha(SystemCaptchaBizEnum.EMAIL_RESET_EMAIL_CODE, email);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("重置密码,发送验证码")
|
@ApiOperation("重置密码,发送验证码")
|
||||||
@PostMapping(value = "/sendResetPasswordCaptcha")
|
@PostMapping(value = "/sendResetPasswordCaptcha")
|
||||||
public ResponseEntity<Void> sendResetPasswordCaptcha(@RequestParam String email) {
|
public ResponseEntity<Void> sendResetPasswordCaptcha(@RequestParam String email) {
|
||||||
systemEmailService.sendCaptcha(SystemCaptchaBizEnum.EMAIL_RESET_PWD_CODE, email);
|
systemEmailService.sendCaptcha(SystemCaptchaBizEnum.EMAIL_RESET_PWD_CODE, email);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("验证码验证")
|
@ApiOperation("验证码验证")
|
||||||
@@ -53,6 +53,6 @@ public class SystemCaptchaController {
|
|||||||
public ResponseEntity<Void> checkEmailCaptcha(@Validated @RequestBody SystemCheckEmailCaptchaArgs args) {
|
public ResponseEntity<Void> checkEmailCaptcha(@Validated @RequestBody SystemCheckEmailCaptchaArgs args) {
|
||||||
SystemCaptchaBizEnum biEnum = SystemCaptchaBizEnum.getByBizCode(args.getBizCode());
|
SystemCaptchaBizEnum biEnum = SystemCaptchaBizEnum.getByBizCode(args.getBizCode());
|
||||||
systemEmailService.checkEmailCaptcha(biEnum, args.getEmail(), args.getCode());
|
systemEmailService.checkEmailCaptcha(biEnum, args.getEmail(), args.getCode());
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -20,7 +20,6 @@ import cn.odboy.system.service.SystemDeptService;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
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.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -38,13 +37,13 @@ public class SystemComponentController {
|
|||||||
@PostMapping(value = "/queryDeptSelectDataSource")
|
@PostMapping(value = "/queryDeptSelectDataSource")
|
||||||
@PreAuthorize("@el.check()")
|
@PreAuthorize("@el.check()")
|
||||||
public ResponseEntity<?> queryDeptSelectDataSource() {
|
public ResponseEntity<?> queryDeptSelectDataSource() {
|
||||||
return new ResponseEntity<>(systemDeptService.queryDeptSelectDataSource(), HttpStatus.OK);
|
return ResponseEntity.ok(systemDeptService.queryDeptSelectDataSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询部门下拉选择Pro数据源")
|
@ApiOperation("查询部门下拉选择Pro数据源")
|
||||||
@PostMapping(value = "/queryDeptSelectProDataSource")
|
@PostMapping(value = "/queryDeptSelectProDataSource")
|
||||||
@PreAuthorize("@el.check()")
|
@PreAuthorize("@el.check()")
|
||||||
public ResponseEntity<?> queryDeptSelectProDataSource() {
|
public ResponseEntity<?> queryDeptSelectProDataSource() {
|
||||||
return new ResponseEntity<>(systemDeptService.queryDeptSelectProDataSource(), HttpStatus.OK);
|
return ResponseEntity.ok(systemDeptService.queryDeptSelectProDataSource());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-10
@@ -56,19 +56,16 @@ public class SystemDeptController {
|
|||||||
@ApiOperation("查询部门")
|
@ApiOperation("查询部门")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||||
public ResponseEntity<CsPageResult<SystemDeptTb>> queryDept(@Validated @RequestBody CsPageArgs<SystemQueryDeptArgs> args)
|
public ResponseEntity<CsPageResult<SystemDeptTb>> queryDept(@Validated @RequestBody CsPageArgs<SystemQueryDeptArgs> args) throws Exception {
|
||||||
throws Exception {
|
|
||||||
SystemQueryDeptArgs criteria = args.getArgs();
|
SystemQueryDeptArgs criteria = args.getArgs();
|
||||||
List<SystemDeptTb> depts = systemDeptService.queryAllDept(criteria, true);
|
List<SystemDeptTb> depts = systemDeptService.queryAllDept(criteria, true);
|
||||||
return new ResponseEntity<>(CsPageUtil.toPage(depts), HttpStatus.OK);
|
return ResponseEntity.ok(CsPageUtil.toPage(depts));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询部门:根据ID获取同级与上级数据")
|
@ApiOperation("查询部门:根据ID获取同级与上级数据")
|
||||||
@PostMapping("/queryDeptSuperiorTree")
|
@PostMapping("/queryDeptSuperiorTree")
|
||||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||||
public ResponseEntity<CsPageResult<SystemDeptTb>> queryDeptSuperiorTree(
|
public ResponseEntity<CsPageResult<SystemDeptTb>> queryDeptSuperiorTree(@RequestBody List<Long> ids, @RequestParam(defaultValue = "false") Boolean exclude) {
|
||||||
@RequestBody List<Long> ids,
|
|
||||||
@RequestParam(defaultValue = "false") Boolean exclude) {
|
|
||||||
Set<SystemDeptTb> deptSet = new LinkedHashSet<>();
|
Set<SystemDeptTb> deptSet = new LinkedHashSet<>();
|
||||||
for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
// 同级数据
|
// 同级数据
|
||||||
@@ -86,7 +83,7 @@ public class SystemDeptController {
|
|||||||
}
|
}
|
||||||
deptSet.addAll(depts);
|
deptSet.addAll(depts);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(systemDeptService.buildDeptTree(new ArrayList<>(deptSet)), HttpStatus.OK);
|
return ResponseEntity.ok(systemDeptService.buildDeptTree(new ArrayList<>(deptSet)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("新增部门")
|
@ApiOperation("新增部门")
|
||||||
@@ -94,7 +91,7 @@ public class SystemDeptController {
|
|||||||
@PreAuthorize("@el.check('dept:add')")
|
@PreAuthorize("@el.check('dept:add')")
|
||||||
public ResponseEntity<Void> saveDept(@Validated @RequestBody SystemCreateDeptArgs args) {
|
public ResponseEntity<Void> saveDept(@Validated @RequestBody SystemCreateDeptArgs args) {
|
||||||
systemDeptService.saveDept(args);
|
systemDeptService.saveDept(args);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改部门")
|
@ApiOperation("修改部门")
|
||||||
@@ -102,7 +99,7 @@ public class SystemDeptController {
|
|||||||
@PreAuthorize("@el.check('dept:edit')")
|
@PreAuthorize("@el.check('dept:edit')")
|
||||||
public ResponseEntity<Void> modifyDept(@Validated(SystemDeptTb.Update.class) @RequestBody SystemDeptTb args) {
|
public ResponseEntity<Void> modifyDept(@Validated(SystemDeptTb.Update.class) @RequestBody SystemDeptTb args) {
|
||||||
systemDeptService.modifyDept(args);
|
systemDeptService.modifyDept(args);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除部门")
|
@ApiOperation("删除部门")
|
||||||
@@ -114,6 +111,6 @@ public class SystemDeptController {
|
|||||||
// 验证是否被角色或用户关联
|
// 验证是否被角色或用户关联
|
||||||
systemDeptService.verifyBindRelationByIds(depts);
|
systemDeptService.verifyBindRelationByIds(depts);
|
||||||
systemDeptService.removeDeptByIds(depts);
|
systemDeptService.removeDeptByIds(depts);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -55,7 +55,7 @@ public class SystemDictController {
|
|||||||
@PostMapping(value = "/queryAllDict")
|
@PostMapping(value = "/queryAllDict")
|
||||||
@PreAuthorize("@el.check('dict:list')")
|
@PreAuthorize("@el.check('dict:list')")
|
||||||
public ResponseEntity<List<SystemDictTb>> queryAllDict() {
|
public ResponseEntity<List<SystemDictTb>> queryAllDict() {
|
||||||
return new ResponseEntity<>(systemDictService.queryDictByArgs(new SystemQueryDictArgs()), HttpStatus.OK);
|
return ResponseEntity.ok(systemDictService.queryDictByArgs(new SystemQueryDictArgs()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询字典")
|
@ApiOperation("查询字典")
|
||||||
@@ -69,7 +69,7 @@ public class SystemDictController {
|
|||||||
} else {
|
} else {
|
||||||
page = new Page<>(criteria.getPage(), criteria.getSize());
|
page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(systemDictService.queryDictByArgs(criteria, page), HttpStatus.OK);
|
return ResponseEntity.ok(systemDictService.queryDictByArgs(criteria, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("新增字典")
|
@ApiOperation("新增字典")
|
||||||
@@ -77,7 +77,7 @@ public class SystemDictController {
|
|||||||
@PreAuthorize("@el.check('dict:add')")
|
@PreAuthorize("@el.check('dict:add')")
|
||||||
public ResponseEntity<Void> saveDict(@Validated @RequestBody SystemCreateDictArgs args) {
|
public ResponseEntity<Void> saveDict(@Validated @RequestBody SystemCreateDictArgs args) {
|
||||||
systemDictService.saveDict(args);
|
systemDictService.saveDict(args);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改字典")
|
@ApiOperation("修改字典")
|
||||||
@@ -85,7 +85,7 @@ public class SystemDictController {
|
|||||||
@PreAuthorize("@el.check('dict:edit')")
|
@PreAuthorize("@el.check('dict:edit')")
|
||||||
public ResponseEntity<Void> modifyDictById(@Validated(SystemDictTb.Update.class) @RequestBody SystemDictTb args) {
|
public ResponseEntity<Void> modifyDictById(@Validated(SystemDictTb.Update.class) @RequestBody SystemDictTb args) {
|
||||||
systemDictService.modifyDictById(args);
|
systemDictService.modifyDictById(args);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除字典")
|
@ApiOperation("删除字典")
|
||||||
@@ -93,6 +93,6 @@ public class SystemDictController {
|
|||||||
@PreAuthorize("@el.check('dict:del')")
|
@PreAuthorize("@el.check('dict:del')")
|
||||||
public ResponseEntity<Void> removeDictByIds(@RequestBody Set<Long> ids) {
|
public ResponseEntity<Void> removeDictByIds(@RequestBody Set<Long> ids) {
|
||||||
systemDictService.removeDictByIds(ids);
|
systemDictService.removeDictByIds(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -26,7 +26,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
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.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -54,7 +53,7 @@ public class SystemDictDetailController {
|
|||||||
public ResponseEntity<CsPageResult<SystemDictDetailTb>> queryDictDetailByArgs(@Validated @RequestBody CsPageArgs<SystemQueryDictDetailArgs> args) {
|
public ResponseEntity<CsPageResult<SystemDictDetailTb>> queryDictDetailByArgs(@Validated @RequestBody CsPageArgs<SystemQueryDictDetailArgs> args) {
|
||||||
SystemQueryDictDetailArgs criteria = args.getArgs();
|
SystemQueryDictDetailArgs criteria = args.getArgs();
|
||||||
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||||
return new ResponseEntity<>(systemDictDetailService.queryDictDetailByArgs(criteria, page), HttpStatus.OK);
|
return ResponseEntity.ok(systemDictDetailService.queryDictDetailByArgs(criteria, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询多个字典详情")
|
@ApiOperation("查询多个字典详情")
|
||||||
@@ -65,7 +64,7 @@ public class SystemDictDetailController {
|
|||||||
for (String name : names) {
|
for (String name : names) {
|
||||||
dictMap.put(name, systemDictDetailService.queryDictDetailByName(name));
|
dictMap.put(name, systemDictDetailService.queryDictDetailByName(name));
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(dictMap, HttpStatus.OK);
|
return ResponseEntity.ok(dictMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("新增字典详情")
|
@ApiOperation("新增字典详情")
|
||||||
@@ -73,7 +72,7 @@ public class SystemDictDetailController {
|
|||||||
@PreAuthorize("@el.check('dict:add')")
|
@PreAuthorize("@el.check('dict:add')")
|
||||||
public ResponseEntity<Void> saveDictDetail(@Validated @RequestBody SystemCreateDictDetailArgs args) {
|
public ResponseEntity<Void> saveDictDetail(@Validated @RequestBody SystemCreateDictDetailArgs args) {
|
||||||
systemDictDetailService.saveDictDetail(args);
|
systemDictDetailService.saveDictDetail(args);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改字典详情")
|
@ApiOperation("修改字典详情")
|
||||||
@@ -81,7 +80,7 @@ public class SystemDictDetailController {
|
|||||||
@PreAuthorize("@el.check('dict:edit')")
|
@PreAuthorize("@el.check('dict:edit')")
|
||||||
public ResponseEntity<Void> modifyDictDetailById(@Validated(SystemDictDetailTb.Update.class) @RequestBody SystemDictDetailTb args) {
|
public ResponseEntity<Void> modifyDictDetailById(@Validated(SystemDictDetailTb.Update.class) @RequestBody SystemDictDetailTb args) {
|
||||||
systemDictDetailService.modifyDictDetailById(args);
|
systemDictDetailService.modifyDictDetailById(args);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除字典详情")
|
@ApiOperation("删除字典详情")
|
||||||
@@ -89,6 +88,6 @@ public class SystemDictDetailController {
|
|||||||
@PreAuthorize("@el.check('dict:del')")
|
@PreAuthorize("@el.check('dict:del')")
|
||||||
public ResponseEntity<Void> removeDictDetailById(@RequestBody SystemDictDetailTb args) {
|
public ResponseEntity<Void> removeDictDetailById(@RequestBody SystemDictDetailTb args) {
|
||||||
systemDictDetailService.removeDictDetailById(args.getId());
|
systemDictDetailService.removeDictDetailById(args.getId());
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -43,7 +43,7 @@ public class SystemEmailController {
|
|||||||
@ApiOperation("查询配置")
|
@ApiOperation("查询配置")
|
||||||
@PostMapping(value = "/getLastEmailConfig")
|
@PostMapping(value = "/getLastEmailConfig")
|
||||||
public ResponseEntity<SystemEmailConfigTb> getLastEmailConfig() {
|
public ResponseEntity<SystemEmailConfigTb> getLastEmailConfig() {
|
||||||
return new ResponseEntity<>(systemEmailService.getLastEmailConfig(), HttpStatus.OK);
|
return ResponseEntity.ok(systemEmailService.getLastEmailConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("配置邮件")
|
@ApiOperation("配置邮件")
|
||||||
@@ -51,13 +51,13 @@ public class SystemEmailController {
|
|||||||
public ResponseEntity<Void> modifyEmailConfig(@Validated @RequestBody SystemEmailConfigTb emailConfig)
|
public ResponseEntity<Void> modifyEmailConfig(@Validated @RequestBody SystemEmailConfigTb emailConfig)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
systemEmailService.modifyEmailConfig(emailConfig);
|
systemEmailService.modifyEmailConfig(emailConfig);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("发送邮件")
|
@ApiOperation("发送邮件")
|
||||||
@PostMapping(value = "/sendEmail")
|
@PostMapping(value = "/sendEmail")
|
||||||
public ResponseEntity<Void> sendEmail(@Validated @RequestBody SystemSendEmailArgs sendEmailRequest) {
|
public ResponseEntity<Void> sendEmail(@Validated @RequestBody SystemSendEmailArgs sendEmailRequest) {
|
||||||
systemEmailService.sendEmail(sendEmailRequest);
|
systemEmailService.sendEmail(sendEmailRequest);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -56,7 +56,7 @@ public class SystemJobController {
|
|||||||
public ResponseEntity<CsPageResult<SystemJobTb>> queryJobByArgs(@Validated @RequestBody CsPageArgs<SystemQueryJobArgs> args) {
|
public ResponseEntity<CsPageResult<SystemJobTb>> queryJobByArgs(@Validated @RequestBody CsPageArgs<SystemQueryJobArgs> args) {
|
||||||
SystemQueryJobArgs criteria = args.getArgs();
|
SystemQueryJobArgs criteria = args.getArgs();
|
||||||
Page<SystemJobTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
Page<SystemJobTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||||
return new ResponseEntity<>(systemJobService.queryJobByArgs(criteria, page), HttpStatus.OK);
|
return ResponseEntity.ok(systemJobService.queryJobByArgs(criteria, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询岗位")
|
@ApiOperation("查询岗位")
|
||||||
@@ -71,7 +71,7 @@ public class SystemJobController {
|
|||||||
@PreAuthorize("@el.check('job:add')")
|
@PreAuthorize("@el.check('job:add')")
|
||||||
public ResponseEntity<Void> saveJob(@Validated @RequestBody SystemCreateJobArgs args) {
|
public ResponseEntity<Void> saveJob(@Validated @RequestBody SystemCreateJobArgs args) {
|
||||||
systemJobService.saveJob(args);
|
systemJobService.saveJob(args);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改岗位")
|
@ApiOperation("修改岗位")
|
||||||
@@ -79,7 +79,7 @@ public class SystemJobController {
|
|||||||
@PreAuthorize("@el.check('job:edit')")
|
@PreAuthorize("@el.check('job:edit')")
|
||||||
public ResponseEntity<Void> modifyJobById(@Validated(SystemJobTb.Update.class) @RequestBody SystemJobTb args) {
|
public ResponseEntity<Void> modifyJobById(@Validated(SystemJobTb.Update.class) @RequestBody SystemJobTb args) {
|
||||||
systemJobService.modifyJobById(args);
|
systemJobService.modifyJobById(args);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除岗位")
|
@ApiOperation("删除岗位")
|
||||||
@@ -89,6 +89,6 @@ public class SystemJobController {
|
|||||||
// 验证是否被用户关联
|
// 验证是否被用户关联
|
||||||
systemJobService.verifyBindRelationByIds(ids);
|
systemJobService.verifyBindRelationByIds(ids);
|
||||||
systemJobService.removeJobByIds(ids);
|
systemJobService.removeJobByIds(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -51,7 +51,7 @@ public class SystemLocalStorageController {
|
|||||||
public ResponseEntity<CsPageResult<SystemLocalStorageTb>> queryLocalStorage(@Validated @RequestBody CsPageArgs<SystemQueryStorageArgs> args) {
|
public ResponseEntity<CsPageResult<SystemLocalStorageTb>> queryLocalStorage(@Validated @RequestBody CsPageArgs<SystemQueryStorageArgs> args) {
|
||||||
SystemQueryStorageArgs criteria = args.getArgs();
|
SystemQueryStorageArgs criteria = args.getArgs();
|
||||||
Page<SystemLocalStorageTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
Page<SystemLocalStorageTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||||
return new ResponseEntity<>(localStorageService.queryLocalStorage(criteria, page), HttpStatus.OK);
|
return ResponseEntity.ok(localStorageService.queryLocalStorage(criteria, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("导出数据")
|
@ApiOperation("导出数据")
|
||||||
@@ -66,7 +66,7 @@ public class SystemLocalStorageController {
|
|||||||
@PreAuthorize("@el.check('storage:add')")
|
@PreAuthorize("@el.check('storage:add')")
|
||||||
public ResponseEntity<Void> uploadFile(@RequestParam String name, @RequestParam("file") MultipartFile file) {
|
public ResponseEntity<Void> uploadFile(@RequestParam String name, @RequestParam("file") MultipartFile file) {
|
||||||
localStorageService.uploadFile(name, file);
|
localStorageService.uploadFile(name, file);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("上传图片")
|
@ApiOperation("上传图片")
|
||||||
@@ -78,7 +78,7 @@ public class SystemLocalStorageController {
|
|||||||
throw new BadRequestException("只能上传图片");
|
throw new BadRequestException("只能上传图片");
|
||||||
}
|
}
|
||||||
SystemLocalStorageTb localStorage = localStorageService.uploadFile(null, file);
|
SystemLocalStorageTb localStorage = localStorageService.uploadFile(null, file);
|
||||||
return new ResponseEntity<>(localStorage, HttpStatus.OK);
|
return ResponseEntity.ok(localStorage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改文件")
|
@ApiOperation("修改文件")
|
||||||
@@ -86,13 +86,13 @@ public class SystemLocalStorageController {
|
|||||||
@PreAuthorize("@el.check('storage:edit')")
|
@PreAuthorize("@el.check('storage:edit')")
|
||||||
public ResponseEntity<Void> modifyLocalStorageById(@Validated @RequestBody SystemLocalStorageTb args) {
|
public ResponseEntity<Void> modifyLocalStorageById(@Validated @RequestBody SystemLocalStorageTb args) {
|
||||||
localStorageService.modifyLocalStorageById(args);
|
localStorageService.modifyLocalStorageById(args);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("多选删除")
|
@ApiOperation("多选删除")
|
||||||
@PostMapping(value = "/removeFileByIds")
|
@PostMapping(value = "/removeFileByIds")
|
||||||
public ResponseEntity<Void> deleteFileByIds(@RequestBody Long[] ids) {
|
public ResponseEntity<Void> deleteFileByIds(@RequestBody Long[] ids) {
|
||||||
localStorageService.removeFileByIds(ids);
|
localStorageService.removeFileByIds(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-25
@@ -23,13 +23,13 @@ import cn.odboy.framework.exception.web.BadRequestException;
|
|||||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||||
import cn.odboy.system.dal.model.SystemMenuVo;
|
import cn.odboy.system.dal.model.SystemMenuVo;
|
||||||
import cn.odboy.system.dal.model.SystemQueryMenuArgs;
|
import cn.odboy.system.dal.model.SystemQueryMenuArgs;
|
||||||
|
import cn.odboy.system.dal.mysql.SystemMenuMapper;
|
||||||
import cn.odboy.system.framework.permission.core.CsSecurityHelper;
|
import cn.odboy.system.framework.permission.core.CsSecurityHelper;
|
||||||
import cn.odboy.system.service.SystemMenuService;
|
import cn.odboy.system.service.SystemMenuService;
|
||||||
import cn.odboy.util.CsPageUtil;
|
import cn.odboy.util.CsPageUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
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.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -45,6 +45,8 @@ import java.util.stream.Collectors;
|
|||||||
public class SystemMenuController {
|
public class SystemMenuController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemMenuService systemMenuService;
|
private SystemMenuService systemMenuService;
|
||||||
|
@Autowired
|
||||||
|
private SystemMenuMapper systemMenuMapper;
|
||||||
|
|
||||||
@ApiOperation("导出菜单数据")
|
@ApiOperation("导出菜单数据")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
@@ -58,14 +60,14 @@ public class SystemMenuController {
|
|||||||
public ResponseEntity<List<SystemMenuVo>> buildMenus() {
|
public ResponseEntity<List<SystemMenuVo>> buildMenus() {
|
||||||
List<SystemMenuTb> menuList = systemMenuService.queryMenuListByUserId(CsSecurityHelper.getCurrentUserId());
|
List<SystemMenuTb> menuList = systemMenuService.queryMenuListByUserId(CsSecurityHelper.getCurrentUserId());
|
||||||
List<SystemMenuTb> menus = systemMenuService.buildMenuTree(menuList);
|
List<SystemMenuTb> menus = systemMenuService.buildMenuTree(menuList);
|
||||||
return new ResponseEntity<>(systemMenuService.buildMenuVo(menus), HttpStatus.OK);
|
return ResponseEntity.ok(systemMenuService.buildMenuVo(menus));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("返回全部的菜单")
|
@ApiOperation("返回全部的菜单")
|
||||||
@PostMapping(value = "/queryMenuListByPid")
|
@PostMapping(value = "/queryMenuListByPid")
|
||||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||||
public ResponseEntity<List<SystemMenuTb>> queryMenuListByPid(@RequestParam Long pid) {
|
public ResponseEntity<List<SystemMenuTb>> queryMenuListByPid(@RequestParam Long pid) {
|
||||||
return new ResponseEntity<>(systemMenuService.queryMenuByPid(pid), HttpStatus.OK);
|
return ResponseEntity.ok(systemMenuService.queryMenuByPid(pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("根据菜单ID返回所有子节点ID, 包含自身ID")
|
@ApiOperation("根据菜单ID返回所有子节点ID, 包含自身ID")
|
||||||
@@ -74,38 +76,36 @@ public class SystemMenuController {
|
|||||||
public ResponseEntity<Set<Long>> queryChildMenuSet(@RequestParam Long id) {
|
public ResponseEntity<Set<Long>> queryChildMenuSet(@RequestParam Long id) {
|
||||||
Set<SystemMenuTb> menuSet = new HashSet<>();
|
Set<SystemMenuTb> menuSet = new HashSet<>();
|
||||||
List<SystemMenuTb> menuList = systemMenuService.queryMenuByPid(id);
|
List<SystemMenuTb> menuList = systemMenuService.queryMenuByPid(id);
|
||||||
menuSet.add(systemMenuService.getMenuById(id));
|
menuSet.add(systemMenuMapper.selectById(id));
|
||||||
menuSet = systemMenuService.queryChildMenu(menuList, menuSet);
|
menuSet = systemMenuService.queryChildMenu(menuList, menuSet);
|
||||||
Set<Long> ids = menuSet.stream().map(SystemMenuTb::getId).collect(Collectors.toSet());
|
Set<Long> ids = menuSet.stream().map(SystemMenuTb::getId).collect(Collectors.toSet());
|
||||||
return new ResponseEntity<>(ids, HttpStatus.OK);
|
return ResponseEntity.ok(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("查询菜单")
|
@ApiOperation("查询菜单")
|
||||||
@PreAuthorize("@el.check('menu:list')")
|
@PreAuthorize("@el.check('menu:list')")
|
||||||
public ResponseEntity<CsPageResult<SystemMenuTb>> queryAllMenuByCrud(@Validated @RequestBody CsPageArgs<SystemQueryMenuArgs> args)
|
public ResponseEntity<CsPageResult<SystemMenuTb>> queryAllMenuByCrud(@Validated @RequestBody CsPageArgs<SystemQueryMenuArgs> args) throws Exception {
|
||||||
throws Exception {
|
|
||||||
return queryAllMenu(args);
|
return queryAllMenu(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/queryMenuByArgs")
|
@PostMapping(value = "/queryMenuByArgs")
|
||||||
@ApiOperation("查询菜单")
|
@ApiOperation("查询菜单")
|
||||||
@PreAuthorize("@el.check('menu:list')")
|
@PreAuthorize("@el.check('menu:list')")
|
||||||
public ResponseEntity<CsPageResult<SystemMenuTb>> queryAllMenu(@Validated @RequestBody CsPageArgs<SystemQueryMenuArgs> args)
|
public ResponseEntity<CsPageResult<SystemMenuTb>> queryAllMenu(@Validated @RequestBody CsPageArgs<SystemQueryMenuArgs> args) throws Exception {
|
||||||
throws Exception {
|
|
||||||
SystemQueryMenuArgs criteria = args.getArgs();
|
SystemQueryMenuArgs criteria = args.getArgs();
|
||||||
List<SystemMenuTb> menuList = systemMenuService.queryAllMenu(criteria, true);
|
List<SystemMenuTb> menuList = systemMenuService.queryAllMenu(criteria, true);
|
||||||
return new ResponseEntity<>(CsPageUtil.toPage(menuList), HttpStatus.OK);
|
return ResponseEntity.ok(CsPageUtil.toPage(menuList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询菜单:根据ID获取同级与上级数据")
|
@ApiOperation("查询菜单:根据ID获取同级与上级数据")
|
||||||
@PostMapping("/queryMenuSuperior")
|
@PostMapping("/queryMenuSuperior")
|
||||||
@PreAuthorize("@el.check('menu:list')")
|
@PreAuthorize("@el.check('menu:list')")
|
||||||
public ResponseEntity<List<SystemMenuTb>> queryMenuSuperior(@RequestBody List<Long> ids) {
|
public ResponseEntity<List<SystemMenuTb>> queryMenuSuperior(@RequestBody List<Long> ids) {
|
||||||
Set<SystemMenuTb> menus = new LinkedHashSet<>();
|
Set<SystemMenuTb> menus;
|
||||||
if (CollectionUtil.isNotEmpty(ids)) {
|
if (CollectionUtil.isNotEmpty(ids)) {
|
||||||
for (Long id : ids) {
|
menus = new LinkedHashSet<>(systemMenuService.queryMenuByIds(ids));
|
||||||
SystemMenuTb menu = systemMenuService.getMenuById(id);
|
for (SystemMenuTb menu : menus) {
|
||||||
List<SystemMenuTb> menuList = systemMenuService.querySuperiorMenuList(menu, new ArrayList<>());
|
List<SystemMenuTb> menuList = systemMenuService.querySuperiorMenuList(menu, new ArrayList<>());
|
||||||
for (SystemMenuTb data : menuList) {
|
for (SystemMenuTb data : menuList) {
|
||||||
if (data.getId().equals(menu.getPid())) {
|
if (data.getId().equals(menu.getPid())) {
|
||||||
@@ -116,9 +116,9 @@ public class SystemMenuController {
|
|||||||
}
|
}
|
||||||
// 编辑菜单时不显示自己以及自己下级的数据, 避免出现PID数据环形问题
|
// 编辑菜单时不显示自己以及自己下级的数据, 避免出现PID数据环形问题
|
||||||
menus = menus.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet());
|
menus = menus.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet());
|
||||||
return new ResponseEntity<>(systemMenuService.buildMenuTree(new ArrayList<>(menus)), HttpStatus.OK);
|
return ResponseEntity.ok(systemMenuService.buildMenuTree(new ArrayList<>(menus)));
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(systemMenuService.queryMenuByPid(null), HttpStatus.OK);
|
return ResponseEntity.ok(systemMenuService.queryMenuByPid(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("新增菜单")
|
@ApiOperation("新增菜单")
|
||||||
@@ -129,7 +129,7 @@ public class SystemMenuController {
|
|||||||
throw new BadRequestException("无效参数id");
|
throw new BadRequestException("无效参数id");
|
||||||
}
|
}
|
||||||
systemMenuService.saveMenu(args);
|
systemMenuService.saveMenu(args);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改菜单")
|
@ApiOperation("修改菜单")
|
||||||
@@ -137,20 +137,14 @@ public class SystemMenuController {
|
|||||||
@PreAuthorize("@el.check('menu:edit')")
|
@PreAuthorize("@el.check('menu:edit')")
|
||||||
public ResponseEntity<Void> modifyMenuById(@Validated(SystemMenuTb.Update.class) @RequestBody SystemMenuTb args) {
|
public ResponseEntity<Void> modifyMenuById(@Validated(SystemMenuTb.Update.class) @RequestBody SystemMenuTb args) {
|
||||||
systemMenuService.modifyMenuById(args);
|
systemMenuService.modifyMenuById(args);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除菜单")
|
@ApiOperation("删除菜单")
|
||||||
@PostMapping(value = "/removeMenuByIds")
|
@PostMapping(value = "/removeMenuByIds")
|
||||||
@PreAuthorize("@el.check('menu:del')")
|
@PreAuthorize("@el.check('menu:del')")
|
||||||
public ResponseEntity<Void> removeMenuByIds(@RequestBody Set<Long> ids) {
|
public ResponseEntity<Void> removeMenuByIds(@RequestBody Set<Long> ids) {
|
||||||
Set<SystemMenuTb> menuSet = new HashSet<>();
|
systemMenuService.removeMenuByIds(ids);
|
||||||
for (Long id : ids) {
|
return ResponseEntity.ok(null);
|
||||||
List<SystemMenuTb> menuList = systemMenuService.queryMenuByPid(id);
|
|
||||||
menuSet.add(systemMenuService.getMenuById(id));
|
|
||||||
menuSet = systemMenuService.queryChildMenu(menuList, menuSet);
|
|
||||||
}
|
|
||||||
systemMenuService.removeMenuByIds(menuSet);
|
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -20,7 +20,6 @@ import cn.odboy.system.service.SystemMonitorService;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
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.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -40,6 +39,6 @@ public class SystemMonitorController {
|
|||||||
@ApiOperation("查询服务监控")
|
@ApiOperation("查询服务监控")
|
||||||
@PreAuthorize("@el.check('monitor:list')")
|
@PreAuthorize("@el.check('monitor:list')")
|
||||||
public ResponseEntity<Map<String, Object>> queryServerMonitorInfo() {
|
public ResponseEntity<Map<String, Object>> queryServerMonitorInfo() {
|
||||||
return new ResponseEntity<>(systemMonitorService.queryServerMonitorInfo(), HttpStatus.OK);
|
return ResponseEntity.ok(systemMonitorService.queryServerMonitorInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -48,9 +48,7 @@ public class SystemOnlineController {
|
|||||||
@PreAuthorize("@el.check()")
|
@PreAuthorize("@el.check()")
|
||||||
public ResponseEntity<CsPageResult<SystemUserOnlineVo>> queryOnlineUser(@Validated @RequestBody CsPageArgs<SystemUserOnlineVo> args) {
|
public ResponseEntity<CsPageResult<SystemUserOnlineVo>> queryOnlineUser(@Validated @RequestBody CsPageArgs<SystemUserOnlineVo> args) {
|
||||||
IPage<SystemUserOnlineVo> page = new Page<>(args.getPage(), args.getSize());
|
IPage<SystemUserOnlineVo> page = new Page<>(args.getPage(), args.getSize());
|
||||||
return new ResponseEntity<>(
|
return ResponseEntity.ok(systemUserOnlineInfoRedis.queryUserOnlineModelPage(args.getArgs(), page));
|
||||||
systemUserOnlineInfoRedis.queryUserOnlineModelPage(args.getArgs(), page),
|
|
||||||
HttpStatus.OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("导出数据")
|
@ApiOperation("导出数据")
|
||||||
@@ -70,6 +68,6 @@ public class SystemOnlineController {
|
|||||||
token = CsDesEncryptUtil.desDecrypt(token);
|
token = CsDesEncryptUtil.desDecrypt(token);
|
||||||
systemUserOnlineInfoRedis.logoutByToken(token);
|
systemUserOnlineInfoRedis.logoutByToken(token);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-168
@@ -27,7 +27,6 @@ import io.swagger.annotations.Api;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -51,7 +50,7 @@ public class SystemOssStorageController {
|
|||||||
public ResponseEntity<CsPageResult<SystemOssStorageVo>> queryOssStorage(@Validated @RequestBody CsPageArgs<SystemQueryStorageArgs> args) {
|
public ResponseEntity<CsPageResult<SystemOssStorageVo>> queryOssStorage(@Validated @RequestBody CsPageArgs<SystemQueryStorageArgs> args) {
|
||||||
SystemQueryStorageArgs criteria = args.getArgs();
|
SystemQueryStorageArgs criteria = args.getArgs();
|
||||||
Page<SystemOssStorageTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
Page<SystemOssStorageTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||||
return new ResponseEntity<>(systemOssStorageService.queryOssStorage(criteria, page), HttpStatus.OK);
|
return ResponseEntity.ok(systemOssStorageService.queryOssStorage(criteria, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("导出数据")
|
@ApiOperation("导出数据")
|
||||||
@@ -73,171 +72,6 @@ public class SystemOssStorageController {
|
|||||||
@PostMapping(value = "/removeFileByIds")
|
@PostMapping(value = "/removeFileByIds")
|
||||||
public ResponseEntity<Void> removeFileByIds(@RequestBody Long[] ids) {
|
public ResponseEntity<Void> removeFileByIds(@RequestBody Long[] ids) {
|
||||||
systemOssStorageService.removeFileByIds(ids);
|
systemOssStorageService.removeFileByIds(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ApiOperation(value = "图片/视频预览")
|
|
||||||
// @GetMapping("/preview-file")
|
|
||||||
// public ResponseEntity<Object> previewFile(@RequestParam("fileName") String fileName) {
|
|
||||||
// // 校验文件名是否有效
|
|
||||||
// if (StrUtil.isBlank(fileName)) {
|
|
||||||
// log.warn("文件名为空,无法生成预签名 URL");
|
|
||||||
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("文件名为空,无法生成预签名 URL");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 确保文件名包含完整的路径(例如:2025/04/28/78bda88f-ff2d-4c4f-9756-397c62c3771f.jpg)
|
|
||||||
// if (!fileName.contains("/")) {
|
|
||||||
// log.warn("请检查文件名是否正确,无法生成预签名 URL");
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// // 创建返回 map
|
|
||||||
// Map<String, Object> res = new HashMap<>();
|
|
||||||
// // 生成 1 小时有效的预签名 URL
|
|
||||||
// try {
|
|
||||||
// GetPresignedObjectUrlArgs presignedUrlArgs = GetPresignedObjectUrlArgs.builder()
|
|
||||||
// // 获取 bucket 名称
|
|
||||||
// .bucket(properties.getOss().getMinio().getBucketName())
|
|
||||||
// // 使用完整路径
|
|
||||||
// .object(fileName)
|
|
||||||
// // 设置方法为 GET(读取文件)
|
|
||||||
// .method(Method.GET)
|
|
||||||
// // 设置 URL 过期时间为 1 小时 1*60*60
|
|
||||||
// .expiry(3600).build();
|
|
||||||
//
|
|
||||||
// // 获取预签名 URL
|
|
||||||
// String url = minioClient.getPresignedObjectUrl(presignedUrlArgs);
|
|
||||||
// res.put("data", url);
|
|
||||||
// // 记录生成的 URL
|
|
||||||
// log.info("生成预签名 URL 成功,fileName: {}, url: {}", fileName, url);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// log.error("生成预签名 URL 失败,fileName: {}", fileName, e);
|
|
||||||
// }
|
|
||||||
// res.put("code", HttpStatus.OK.value());
|
|
||||||
// res.put("msg", "上传成功");
|
|
||||||
// return ResponseEntity.status(HttpStatus.OK).body(res);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 存储桶存在
|
|
||||||
// *
|
|
||||||
// * @param bucketName 存储桶名称
|
|
||||||
// * @return {@link ResponseEntity }<{@link Object }>
|
|
||||||
// */
|
|
||||||
// @ApiOperation(value = "查看存储bucket是否存在")
|
|
||||||
// @GetMapping("/bucketExists")
|
|
||||||
// public ResponseEntity<Object> bucketExists(@RequestParam("bucketName") String bucketName) {
|
|
||||||
// return ResponseEntity.status(HttpStatus.OK).body("查看存储bucket是否存在 bucketName : " + minioRepository.bucketExists(bucketName));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 制作桶
|
|
||||||
// *
|
|
||||||
// * @param bucketName 存储桶名称
|
|
||||||
// * @return {@link ResponseEntity }<{@link Object }>
|
|
||||||
// */
|
|
||||||
// @ApiOperation(value = "创建存储bucket")
|
|
||||||
// @GetMapping("/makeBucket")
|
|
||||||
// public ResponseEntity<Object> makeBucket(String bucketName) {
|
|
||||||
// return ResponseEntity.status(HttpStatus.OK).body("创建存储bucket bucketName : " + minioRepository.makeBucket(bucketName));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 删除存储桶
|
|
||||||
// *
|
|
||||||
// * @param bucketName 存储桶名称
|
|
||||||
// * @return {@link ResponseEntity }<{@link Object }>
|
|
||||||
// */
|
|
||||||
// @ApiOperation(value = "删除存储bucket")
|
|
||||||
// @GetMapping("/removeBucket")
|
|
||||||
// public ResponseEntity<Object> removeBucket(String bucketName) {
|
|
||||||
// return ResponseEntity.status(HttpStatus.OK).body("删除存储bucket bucketName : " + minioRepository.removeBucket(bucketName));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 获取所有存储桶
|
|
||||||
// *
|
|
||||||
// * @return {@link ResponseEntity }<{@link Object }>
|
|
||||||
// */
|
|
||||||
// @ApiOperation(value = "获取全部bucket")
|
|
||||||
// @GetMapping("/queryAllBuckets")
|
|
||||||
// public ResponseEntity<Object> queryAllBuckets() {
|
|
||||||
// List<Bucket> allBuckets = minioRepository.queryAllBuckets();
|
|
||||||
// // 获取名称 allBuckets.forEach(bucket -> log.info(bucket.name()));
|
|
||||||
// List<String> bucketNames = allBuckets.stream().map(Bucket::name).collect(Collectors.toList());
|
|
||||||
// HashMap<String, Object> response = new HashMap<>();
|
|
||||||
// response.put("data", bucketNames);
|
|
||||||
// response.put("code", HttpStatus.OK.value());
|
|
||||||
// response.put("msg", "获取全部bucket成功");
|
|
||||||
// return ResponseEntity.status(HttpStatus.OK).body(response);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 上传
|
|
||||||
// *
|
|
||||||
// * @param file 文件
|
|
||||||
// * @return {@link ResponseEntity }<{@link Object }>
|
|
||||||
// */
|
|
||||||
// @ApiOperation(value = "文件上传返回url")
|
|
||||||
// @PostMapping("/upload")
|
|
||||||
// public ResponseEntity<Object> upload(@RequestParam("file") MultipartFile file) {
|
|
||||||
// if (file.isEmpty()) {
|
|
||||||
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("文件不能为空");
|
|
||||||
// }
|
|
||||||
// String objectName = minioRepository.upload(file);
|
|
||||||
// if (null != objectName) {
|
|
||||||
// HashMap<String, Object> response = new HashMap<>();
|
|
||||||
// response.put("data", (properties.getOss().getMinio().getEndpoint() + "/" + properties.getOss().getMinio().getBucketName() + "/" + objectName));
|
|
||||||
// response.put("code", HttpStatus.OK.value());
|
|
||||||
// response.put("msg", "上传成功");
|
|
||||||
// return ResponseEntity.status(HttpStatus.OK).body(response);
|
|
||||||
// }
|
|
||||||
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("文件上传失败");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 文件上传
|
|
||||||
// *
|
|
||||||
// * @param file 文件
|
|
||||||
// * @return 文件在Minio中的路径
|
|
||||||
// */
|
|
||||||
// @ApiOperation(value = "文件上传返回url")
|
|
||||||
// @PostMapping("/upload")
|
|
||||||
// public ResponseEntity<Object> upload(MultipartFile file) {
|
|
||||||
// String originalFilename = file.getOriginalFilename();
|
|
||||||
// if (StrUtil.isBlank(originalFilename)) {
|
|
||||||
// throw new BadRequestException("文件名为空");
|
|
||||||
// }
|
|
||||||
// String fileExtension = FileUtil.getSuffix(originalFilename);
|
|
||||||
// // 使用UUID确保文件名唯一
|
|
||||||
// String fileName = UUID.randomUUID() + fileExtension;
|
|
||||||
// // 使用日期加上文件名,方便分类
|
|
||||||
// String objectName = CsDateUtil.getNowDateTimeMsStr() + "/" + fileName;
|
|
||||||
//
|
|
||||||
// log.info("准备上传文件,objectName: {}", objectName);
|
|
||||||
//
|
|
||||||
// // 通过更大缓冲区和流优化上传文件
|
|
||||||
// try (InputStream fileInputStream = file.getInputStream()) {
|
|
||||||
// // 上传前记录文件大小和类型
|
|
||||||
// long fileSize = file.getSize();
|
|
||||||
// log.info("上传文件大小:{} 字节, 文件类型:{}", fileSize, file.getContentType());
|
|
||||||
// PutObjectArgs objectArgs = PutObjectArgs.builder()
|
|
||||||
// .bucket(properties.getOss().getMinio().getBucketName())
|
|
||||||
// .object(objectName)
|
|
||||||
// .stream(fileInputStream, fileSize, -1)
|
|
||||||
// .contentType(file.getContentType())
|
|
||||||
// .build();
|
|
||||||
// minioClient.putObject(objectArgs);
|
|
||||||
// log.info("文件上传成功,objectName: {}", objectName);
|
|
||||||
// HashMap<String, Object> response = new HashMap<>();
|
|
||||||
// response.put("data", (properties.getOss().getMinio().getEndpoint() + "/" + properties.getOss().getMinio().getBucketName() + "/" + objectName));
|
|
||||||
// response.put("code", HttpStatus.OK.value());
|
|
||||||
// response.put("msg", "上传成功");
|
|
||||||
// return ResponseEntity.status(HttpStatus.OK).body(response);
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// log.error("上传文件失败,objectName: {}", objectName, e);
|
|
||||||
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("文件上传失败");
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// throw new BadRequestException(e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-7
@@ -54,7 +54,7 @@ public class SystemQuartzJobController {
|
|||||||
public ResponseEntity<CsPageResult<SystemQuartzJobTb>> queryQuartzJobByCrud(@Validated @RequestBody CsPageArgs<SystemQueryQuartzJobArgs> args) {
|
public ResponseEntity<CsPageResult<SystemQuartzJobTb>> queryQuartzJobByCrud(@Validated @RequestBody CsPageArgs<SystemQueryQuartzJobArgs> args) {
|
||||||
SystemQueryQuartzJobArgs criteria = args.getArgs();
|
SystemQueryQuartzJobArgs criteria = args.getArgs();
|
||||||
Page<SystemQuartzJobTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
Page<SystemQuartzJobTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||||
return new ResponseEntity<>(systemQuartzJobService.queryQuartzJobByArgs(criteria, page), HttpStatus.OK);
|
return ResponseEntity.ok(systemQuartzJobService.queryQuartzJobByArgs(criteria, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("导出任务数据")
|
@ApiOperation("导出任务数据")
|
||||||
@@ -76,7 +76,7 @@ public class SystemQuartzJobController {
|
|||||||
@PreAuthorize("@el.check('quartzJob:list')")
|
@PreAuthorize("@el.check('quartzJob:list')")
|
||||||
public ResponseEntity<CsPageResult<SystemQuartzLogTb>> queryQuartzJobLog(SystemQueryQuartzJobArgs args) {
|
public ResponseEntity<CsPageResult<SystemQuartzLogTb>> queryQuartzJobLog(SystemQueryQuartzJobArgs args) {
|
||||||
Page<SystemQuartzLogTb> page = new Page<>(args.getPage(), args.getSize());
|
Page<SystemQuartzLogTb> page = new Page<>(args.getPage(), args.getSize());
|
||||||
return new ResponseEntity<>(systemQuartzJobService.queryQuartzLogByArgs(args, page), HttpStatus.OK);
|
return ResponseEntity.ok(systemQuartzJobService.queryQuartzLogByArgs(args, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("新增定时任务")
|
@ApiOperation("新增定时任务")
|
||||||
@@ -89,7 +89,7 @@ public class SystemQuartzJobController {
|
|||||||
// 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义
|
// 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义
|
||||||
checkBean(args.getBeanName());
|
checkBean(args.getBeanName());
|
||||||
systemQuartzJobService.createJob(args);
|
systemQuartzJobService.createJob(args);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改定时任务")
|
@ApiOperation("修改定时任务")
|
||||||
@@ -99,7 +99,7 @@ public class SystemQuartzJobController {
|
|||||||
// 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义
|
// 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义
|
||||||
checkBean(args.getBeanName());
|
checkBean(args.getBeanName());
|
||||||
systemQuartzJobService.modifyQuartzJobResumeCron(args);
|
systemQuartzJobService.modifyQuartzJobResumeCron(args);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("更改定时任务状态")
|
@ApiOperation("更改定时任务状态")
|
||||||
@@ -107,7 +107,7 @@ public class SystemQuartzJobController {
|
|||||||
@PreAuthorize("@el.check('quartzJob:edit')")
|
@PreAuthorize("@el.check('quartzJob:edit')")
|
||||||
public ResponseEntity<Void> switchQuartzJobStatus(@PathVariable Long id) {
|
public ResponseEntity<Void> switchQuartzJobStatus(@PathVariable Long id) {
|
||||||
systemQuartzJobService.switchQuartzJobStatus(systemQuartzJobService.getQuartzJobById(id));
|
systemQuartzJobService.switchQuartzJobStatus(systemQuartzJobService.getQuartzJobById(id));
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("执行定时任务")
|
@ApiOperation("执行定时任务")
|
||||||
@@ -115,7 +115,7 @@ public class SystemQuartzJobController {
|
|||||||
@PreAuthorize("@el.check('quartzJob:edit')")
|
@PreAuthorize("@el.check('quartzJob:edit')")
|
||||||
public ResponseEntity<Void> startQuartzJob(@PathVariable Long id) {
|
public ResponseEntity<Void> startQuartzJob(@PathVariable Long id) {
|
||||||
systemQuartzJobService.startQuartzJob(systemQuartzJobService.getQuartzJobById(id));
|
systemQuartzJobService.startQuartzJob(systemQuartzJobService.getQuartzJobById(id));
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除定时任务")
|
@ApiOperation("删除定时任务")
|
||||||
@@ -123,7 +123,7 @@ public class SystemQuartzJobController {
|
|||||||
@PreAuthorize("@el.check('quartzJob:del')")
|
@PreAuthorize("@el.check('quartzJob:del')")
|
||||||
public ResponseEntity<Void> removeJobByIds(@RequestBody Set<Long> ids) {
|
public ResponseEntity<Void> removeJobByIds(@RequestBody Set<Long> ids) {
|
||||||
systemQuartzJobService.removeJobByIds(ids);
|
systemQuartzJobService.removeJobByIds(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+8
-8
@@ -53,7 +53,7 @@ public class SystemRoleController {
|
|||||||
@PostMapping(value = "/queryRoleById")
|
@PostMapping(value = "/queryRoleById")
|
||||||
@PreAuthorize("@el.check('roles:list')")
|
@PreAuthorize("@el.check('roles:list')")
|
||||||
public ResponseEntity<SystemRoleTb> queryRoleById(@RequestBody SystemRoleTb args) {
|
public ResponseEntity<SystemRoleTb> queryRoleById(@RequestBody SystemRoleTb args) {
|
||||||
return new ResponseEntity<>(systemRoleService.getRoleById(args.getId()), HttpStatus.OK);
|
return ResponseEntity.ok(systemRoleService.getRoleById(args.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("导出角色数据")
|
@ApiOperation("导出角色数据")
|
||||||
@@ -67,7 +67,7 @@ public class SystemRoleController {
|
|||||||
@PostMapping(value = "/queryRoleList")
|
@PostMapping(value = "/queryRoleList")
|
||||||
@PreAuthorize("@el.check('roles:list','user:add','user:edit')")
|
@PreAuthorize("@el.check('roles:list','user:add','user:edit')")
|
||||||
public ResponseEntity<List<SystemRoleTb>> queryRoleList() {
|
public ResponseEntity<List<SystemRoleTb>> queryRoleList() {
|
||||||
return new ResponseEntity<>(systemRoleService.queryAllRole(), HttpStatus.OK);
|
return ResponseEntity.ok(systemRoleService.queryAllRole());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询角色")
|
@ApiOperation("查询角色")
|
||||||
@@ -76,13 +76,13 @@ public class SystemRoleController {
|
|||||||
public ResponseEntity<CsPageResult<SystemRoleTb>> queryRoleByArgs(@Validated @RequestBody CsPageArgs<SystemQueryRoleArgs> args) {
|
public ResponseEntity<CsPageResult<SystemRoleTb>> queryRoleByArgs(@Validated @RequestBody CsPageArgs<SystemQueryRoleArgs> args) {
|
||||||
SystemQueryRoleArgs criteria = args.getArgs();
|
SystemQueryRoleArgs criteria = args.getArgs();
|
||||||
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||||
return new ResponseEntity<>(systemRoleService.queryRoleByArgs(criteria, page), HttpStatus.OK);
|
return ResponseEntity.ok(systemRoleService.queryRoleByArgs(criteria, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取用户级别")
|
@ApiOperation("获取用户级别")
|
||||||
@PostMapping(value = "/queryRoleLevel")
|
@PostMapping(value = "/queryRoleLevel")
|
||||||
public ResponseEntity<Dict> queryRoleLevel() {
|
public ResponseEntity<Dict> queryRoleLevel() {
|
||||||
return new ResponseEntity<>(Dict.create().set("level", checkRoleLevels(null)), HttpStatus.OK);
|
return ResponseEntity.ok(Dict.create().set("level", checkRoleLevels(null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("新增角色")
|
@ApiOperation("新增角色")
|
||||||
@@ -91,7 +91,7 @@ public class SystemRoleController {
|
|||||||
public ResponseEntity<Void> saveRole(@Validated @RequestBody SystemCreateRoleArgs args) {
|
public ResponseEntity<Void> saveRole(@Validated @RequestBody SystemCreateRoleArgs args) {
|
||||||
checkRoleLevels(args.getLevel());
|
checkRoleLevels(args.getLevel());
|
||||||
systemRoleService.saveRole(args);
|
systemRoleService.saveRole(args);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改角色")
|
@ApiOperation("修改角色")
|
||||||
@@ -100,7 +100,7 @@ public class SystemRoleController {
|
|||||||
public ResponseEntity<Void> modifyRoleById(@Validated(SystemRoleTb.Update.class) @RequestBody SystemRoleTb args) {
|
public ResponseEntity<Void> modifyRoleById(@Validated(SystemRoleTb.Update.class) @RequestBody SystemRoleTb args) {
|
||||||
checkRoleLevels(args.getLevel());
|
checkRoleLevels(args.getLevel());
|
||||||
systemRoleService.modifyRoleById(args);
|
systemRoleService.modifyRoleById(args);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改角色菜单")
|
@ApiOperation("修改角色菜单")
|
||||||
@@ -110,7 +110,7 @@ public class SystemRoleController {
|
|||||||
SystemRoleTb role = systemRoleService.getRoleById(args.getId());
|
SystemRoleTb role = systemRoleService.getRoleById(args.getId());
|
||||||
checkRoleLevels(role.getLevel());
|
checkRoleLevels(role.getLevel());
|
||||||
systemRoleService.modifyBindMenuById(args);
|
systemRoleService.modifyBindMenuById(args);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除角色")
|
@ApiOperation("删除角色")
|
||||||
@@ -124,7 +124,7 @@ public class SystemRoleController {
|
|||||||
// 验证是否被用户关联
|
// 验证是否被用户关联
|
||||||
systemRoleService.verifyBindRelationByIds(ids);
|
systemRoleService.verifyBindRelationByIds(ids);
|
||||||
systemRoleService.removeRoleByIds(ids);
|
systemRoleService.removeRoleByIds(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+12
-13
@@ -37,7 +37,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
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.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
@@ -98,14 +97,14 @@ public class SystemUserController {
|
|||||||
// 取交集
|
// 取交集
|
||||||
criteria.getDeptIds().retainAll(dataScopes);
|
criteria.getDeptIds().retainAll(dataScopes);
|
||||||
if (!CollectionUtil.isEmpty(criteria.getDeptIds())) {
|
if (!CollectionUtil.isEmpty(criteria.getDeptIds())) {
|
||||||
return new ResponseEntity<>(systemUserService.queryUserByArgs(criteria, page), HttpStatus.OK);
|
return ResponseEntity.ok(systemUserService.queryUserByArgs(criteria, page));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 否则取并集
|
// 否则取并集
|
||||||
criteria.getDeptIds().addAll(dataScopes);
|
criteria.getDeptIds().addAll(dataScopes);
|
||||||
return new ResponseEntity<>(systemUserService.queryUserByArgs(criteria, page), HttpStatus.OK);
|
return ResponseEntity.ok(systemUserService.queryUserByArgs(criteria, page));
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(CsPageUtil.emptyData(), HttpStatus.OK);
|
return ResponseEntity.ok(CsPageUtil.emptyData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("新增用户")
|
@ApiOperation("新增用户")
|
||||||
@@ -116,7 +115,7 @@ public class SystemUserController {
|
|||||||
// 默认密码 123456
|
// 默认密码 123456
|
||||||
args.setPassword(passwordEncoder.encode("123456"));
|
args.setPassword(passwordEncoder.encode("123456"));
|
||||||
systemUserService.saveUser(args);
|
systemUserService.saveUser(args);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改用户")
|
@ApiOperation("修改用户")
|
||||||
@@ -125,7 +124,7 @@ public class SystemUserController {
|
|||||||
public ResponseEntity<Object> modifyUserById(@Validated(SystemUserTb.Update.class) @RequestBody SystemUserTb args) {
|
public ResponseEntity<Object> modifyUserById(@Validated(SystemUserTb.Update.class) @RequestBody SystemUserTb args) {
|
||||||
checkLevel(args);
|
checkLevel(args);
|
||||||
systemUserService.modifyUserById(args);
|
systemUserService.modifyUserById(args);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改用户:个人中心")
|
@ApiOperation("修改用户:个人中心")
|
||||||
@@ -135,7 +134,7 @@ public class SystemUserController {
|
|||||||
throw new BadRequestException("不能修改他人资料");
|
throw new BadRequestException("不能修改他人资料");
|
||||||
}
|
}
|
||||||
systemUserService.modifyUserCenterInfoById(args);
|
systemUserService.modifyUserCenterInfoById(args);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除用户")
|
@ApiOperation("删除用户")
|
||||||
@@ -150,7 +149,7 @@ public class SystemUserController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
systemUserService.removeUserByIds(ids);
|
systemUserService.removeUserByIds(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改密码")
|
@ApiOperation("修改密码")
|
||||||
@@ -166,7 +165,7 @@ public class SystemUserController {
|
|||||||
throw new BadRequestException("新密码不能与旧密码相同");
|
throw new BadRequestException("新密码不能与旧密码相同");
|
||||||
}
|
}
|
||||||
systemUserService.modifyUserPasswordByUsername(user.getUsername(), passwordEncoder.encode(newPass));
|
systemUserService.modifyUserPasswordByUsername(user.getUsername(), passwordEncoder.encode(newPass));
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("重置密码")
|
@ApiOperation("重置密码")
|
||||||
@@ -174,13 +173,13 @@ public class SystemUserController {
|
|||||||
public ResponseEntity<Object> resetUserPasswordByIds(@RequestBody Set<Long> ids) {
|
public ResponseEntity<Object> resetUserPasswordByIds(@RequestBody Set<Long> ids) {
|
||||||
String defaultPwd = passwordEncoder.encode("123456");
|
String defaultPwd = passwordEncoder.encode("123456");
|
||||||
systemUserService.resetUserPasswordByIds(ids, defaultPwd);
|
systemUserService.resetUserPasswordByIds(ids, defaultPwd);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改头像")
|
@ApiOperation("修改头像")
|
||||||
@PostMapping(value = "/modifyUserAvatar")
|
@PostMapping(value = "/modifyUserAvatar")
|
||||||
public ResponseEntity<Object> modifyUserAvatar(@RequestParam MultipartFile avatar) {
|
public ResponseEntity<Object> modifyUserAvatar(@RequestParam MultipartFile avatar) {
|
||||||
return new ResponseEntity<>(systemUserService.modifyUserAvatar(avatar), HttpStatus.OK);
|
return ResponseEntity.ok(systemUserService.modifyUserAvatar(avatar));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改邮箱")
|
@ApiOperation("修改邮箱")
|
||||||
@@ -193,7 +192,7 @@ public class SystemUserController {
|
|||||||
}
|
}
|
||||||
systemEmailService.checkEmailCaptcha(SystemCaptchaBizEnum.EMAIL_RESET_EMAIL_CODE, args.getEmail(), code);
|
systemEmailService.checkEmailCaptcha(SystemCaptchaBizEnum.EMAIL_RESET_EMAIL_CODE, args.getEmail(), code);
|
||||||
systemUserService.modifyUserEmailByUsername(user.getUsername(), args.getEmail());
|
systemUserService.modifyUserEmailByUsername(user.getUsername(), args.getEmail());
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,6 +232,6 @@ public class SystemUserController {
|
|||||||
ext.put("phone", m.getPhone());
|
ext.put("phone", m.getPhone());
|
||||||
return CsSelectOptionVo.builder().label(m.getNickName()).value(String.valueOf(m.getId())).ext(ext).build();
|
return CsSelectOptionVo.builder().label(m.getNickName()).value(String.valueOf(m.getId())).ext(ext).build();
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
return new ResponseEntity<>(collect, HttpStatus.OK);
|
return ResponseEntity.ok(collect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
package cn.odboy.system.dal.dataobject;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色菜单
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("system_roles_menus")
|
||||||
|
public class SystemRoleMenuTb {
|
||||||
|
private Long menuId;
|
||||||
|
private Long roleId;
|
||||||
|
}
|
||||||
+1
-3
@@ -34,9 +34,7 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SystemDictDetailMapper extends BaseMapper<SystemDictDetailTb> {
|
public interface SystemDictDetailMapper extends BaseMapper<SystemDictDetailTb> {
|
||||||
IPage<SystemDictDetailTb> selectDictDetailByArgs(
|
IPage<SystemDictDetailTb> selectDictDetailByArgs(@Param("criteria") SystemQueryDictDetailArgs criteria, Page<Object> page);
|
||||||
@Param("criteria") SystemQueryDictDetailArgs criteria,
|
|
||||||
Page<Object> page);
|
|
||||||
|
|
||||||
List<SystemDictDetailTb> selectDictDetailByArgs(@Param("criteria") SystemQueryDictDetailArgs criteria);
|
List<SystemDictDetailTb> selectDictDetailByArgs(@Param("criteria") SystemQueryDictDetailArgs criteria);
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -31,7 +31,5 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SystemLocalStorageMapper extends BaseMapper<SystemLocalStorageTb> {
|
public interface SystemLocalStorageMapper extends BaseMapper<SystemLocalStorageTb> {
|
||||||
IPage<SystemLocalStorageTb> selectLocalStorageByArgs(
|
IPage<SystemLocalStorageTb> selectLocalStorageByArgs(@Param("criteria") SystemQueryStorageArgs criteria, Page<SystemLocalStorageTb> page);
|
||||||
@Param("criteria") SystemQueryStorageArgs criteria,
|
|
||||||
Page<SystemLocalStorageTb> page);
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -36,9 +36,7 @@ public interface SystemMenuMapper extends BaseMapper<SystemMenuTb> {
|
|||||||
|
|
||||||
List<SystemMenuTb> selectMenuByArgs(@Param("criteria") SystemQueryMenuArgs criteria);
|
List<SystemMenuTb> selectMenuByArgs(@Param("criteria") SystemQueryMenuArgs criteria);
|
||||||
|
|
||||||
LinkedHashSet<SystemMenuTb> selectMenuByRoleIdsAndType(
|
LinkedHashSet<SystemMenuTb> selectMenuByRoleIdsAndType(@Param("roleIds") Set<Long> roleIds, @Param("type") Integer type);
|
||||||
@Param("roleIds") Set<Long> roleIds,
|
|
||||||
@Param("type") Integer type);
|
|
||||||
|
|
||||||
List<SystemMenuTb> selectMenuByPidIsNullOrderByMenuSort();
|
List<SystemMenuTb> selectMenuByPidIsNullOrderByMenuSort();
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -33,9 +33,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SystemQuartzJobMapper extends BaseMapper<SystemQuartzJobTb> {
|
public interface SystemQuartzJobMapper extends BaseMapper<SystemQuartzJobTb> {
|
||||||
IPage<SystemQuartzJobTb> selectQuartzJobByArgs(
|
IPage<SystemQuartzJobTb> selectQuartzJobByArgs(@Param("criteria") SystemQueryQuartzJobArgs criteria, Page<SystemQuartzJobTb> page);
|
||||||
@Param("criteria") SystemQueryQuartzJobArgs criteria,
|
|
||||||
Page<SystemQuartzJobTb> page);
|
|
||||||
|
|
||||||
List<SystemQuartzJobTb> selectAllEnableQuartzJob();
|
List<SystemQuartzJobTb> selectAllEnableQuartzJob();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -31,7 +31,5 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SystemQuartzLogMapper extends BaseMapper<SystemQuartzLogTb> {
|
public interface SystemQuartzLogMapper extends BaseMapper<SystemQuartzLogTb> {
|
||||||
IPage<SystemQuartzLogTb> selectQuartzLogByArgs(
|
IPage<SystemQuartzLogTb> selectQuartzLogByArgs(@Param("criteria") SystemQueryQuartzJobArgs criteria, Page<SystemQuartzLogTb> page);
|
||||||
@Param("criteria") SystemQueryQuartzJobArgs criteria,
|
|
||||||
Page<SystemQuartzLogTb> page);
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -17,6 +17,8 @@
|
|||||||
package cn.odboy.system.dal.mysql;
|
package cn.odboy.system.dal.mysql;
|
||||||
|
|
||||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||||
|
import cn.odboy.system.dal.dataobject.SystemRoleMenuTb;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@@ -28,12 +30,10 @@ import java.util.Set;
|
|||||||
* @author odboy
|
* @author odboy
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SystemRoleMenuMapper {
|
public interface SystemRoleMenuMapper extends BaseMapper<SystemRoleMenuTb> {
|
||||||
void batchInsertRoleMenu(@Param("menus") Set<SystemMenuTb> menus, @Param("roleId") Long roleId);
|
void batchInsertRoleMenu(@Param("menus") Set<SystemMenuTb> menus, @Param("roleId") Long roleId);
|
||||||
|
|
||||||
void batchDeleteRoleMenu(@Param("roleIds") Set<Long> roleIds);
|
void batchDeleteRoleMenu(@Param("roleIds") Set<Long> roleIds);
|
||||||
|
|
||||||
void deleteRoleMenuByRoleId(@Param("roleId") Long roleId);
|
void deleteRoleMenuByRoleId(@Param("roleId") Long roleId);
|
||||||
|
|
||||||
void deleteRoleMenuByMenuId(@Param("menuId") Long menuId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-4
@@ -84,10 +84,7 @@ public class OperationLogAspect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private SystemOperationLogTb getOperationLogTb(
|
private SystemOperationLogTb getOperationLogTb(ProceedingJoinPoint joinPoint, OperationLog annotation, TimeInterval timeInterval) {
|
||||||
ProceedingJoinPoint joinPoint,
|
|
||||||
OperationLog annotation,
|
|
||||||
TimeInterval timeInterval) {
|
|
||||||
long executeTime = timeInterval.intervalMs();
|
long executeTime = timeInterval.intervalMs();
|
||||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
String bizName = annotation.bizName();
|
String bizName = annotation.bizName();
|
||||||
|
|||||||
+1
-5
@@ -35,11 +35,7 @@ public class AuthorityConfig {
|
|||||||
*/
|
*/
|
||||||
public Boolean check(String... permissions) {
|
public Boolean check(String... permissions) {
|
||||||
// 获取当前用户的所有权限
|
// 获取当前用户的所有权限
|
||||||
List<String> roleList = CsSecurityHelper.getCurrentUser()
|
List<String> roleList = CsSecurityHelper.getCurrentUser().getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList());
|
||||||
.getAuthorities()
|
|
||||||
.stream()
|
|
||||||
.map(GrantedAuthority::getAuthority)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
// 判断当前用户的所有权限是否包含接口上定义的权限
|
// 判断当前用户的所有权限是否包含接口上定义的权限
|
||||||
return roleList.contains("admin") || Arrays.stream(permissions).anyMatch(roleList::contains);
|
return roleList.contains("admin") || Arrays.stream(permissions).anyMatch(roleList::contains);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -122,8 +122,7 @@ public class CsSecurityHelper {
|
|||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
public static String getToken() {
|
public static String getToken() {
|
||||||
HttpServletRequest request =
|
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||||
((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
|
||||||
String bearerToken = request.getHeader(SystemConst.HEADER_NAME);
|
String bearerToken = request.getHeader(SystemConst.HEADER_NAME);
|
||||||
if (bearerToken != null && bearerToken.startsWith(SystemConst.TOKEN_PREFIX)) {
|
if (bearerToken != null && bearerToken.startsWith(SystemConst.TOKEN_PREFIX)) {
|
||||||
// 去掉令牌前缀
|
// 去掉令牌前缀
|
||||||
|
|||||||
+2
-6
@@ -31,16 +31,12 @@ import java.io.IOException;
|
|||||||
public class JwtAccessDeniedHandler implements AccessDeniedHandler {
|
public class JwtAccessDeniedHandler implements AccessDeniedHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(
|
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException {
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response,
|
|
||||||
AccessDeniedException accessDeniedException) throws IOException {
|
|
||||||
//当用户在没有授权的情况下访问受保护的REST资源时,将调用此方法发送403 Forbidden响应
|
//当用户在没有授权的情况下访问受保护的REST资源时,将调用此方法发送403 Forbidden响应
|
||||||
response.setStatus(HttpStatus.FORBIDDEN.value());
|
response.setStatus(HttpStatus.FORBIDDEN.value());
|
||||||
response.setContentType("application/json;charset=UTF-8");
|
response.setContentType("application/json;charset=UTF-8");
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
String jsonResponse =
|
String jsonResponse = objectMapper.writeValueAsString(ApiError.error(HttpStatus.FORBIDDEN.value(), "禁止访问,您没有权限访问此资源"));
|
||||||
objectMapper.writeValueAsString(ApiError.error(HttpStatus.FORBIDDEN.value(), "禁止访问,您没有权限访问此资源"));
|
|
||||||
response.getWriter().write(jsonResponse);
|
response.getWriter().write(jsonResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -33,15 +33,13 @@ import java.io.IOException;
|
|||||||
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException)
|
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException {
|
||||||
throws IOException {
|
|
||||||
// 当用户尝试访问安全的REST资源而不提供任何凭据时,将调用此方法发送401 响应
|
// 当用户尝试访问安全的REST资源而不提供任何凭据时,将调用此方法发送401 响应
|
||||||
int code = HttpStatus.UNAUTHORIZED.value();
|
int code = HttpStatus.UNAUTHORIZED.value();
|
||||||
response.setStatus(code);
|
response.setStatus(code);
|
||||||
response.setContentType("application/json;charset=UTF-8");
|
response.setContentType("application/json;charset=UTF-8");
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
String jsonResponse =
|
String jsonResponse = objectMapper.writeValueAsString(ApiError.error(HttpStatus.UNAUTHORIZED.value(), "登录状态已过期,请重新登录"));
|
||||||
objectMapper.writeValueAsString(ApiError.error(HttpStatus.UNAUTHORIZED.value(), "登录状态已过期,请重新登录"));
|
|
||||||
response.getWriter().write(jsonResponse);
|
response.getWriter().write(jsonResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -48,8 +48,7 @@ public class TokenFilter extends GenericFilterBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
|
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws ServletException, IOException {
|
||||||
throws ServletException, IOException {
|
|
||||||
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
|
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
|
||||||
String token = resolveToken(httpServletRequest);
|
String token = resolveToken(httpServletRequest);
|
||||||
// 对于 Token 为空的不需要去查 Redis
|
// 对于 Token 为空的不需要去查 Redis
|
||||||
|
|||||||
+2
-4
@@ -69,8 +69,7 @@ public class ExecutionJobBean extends QuartzJobBean {
|
|||||||
quartzLog.setCronExpression(quartzJob.getCronExpression());
|
quartzLog.setCronExpression(quartzJob.getCronExpression());
|
||||||
try {
|
try {
|
||||||
// 执行任务
|
// 执行任务
|
||||||
QuartzRunnable task =
|
QuartzRunnable task = new QuartzRunnable(quartzJob.getBeanName(), quartzJob.getMethodName(), quartzJob.getParams());
|
||||||
new QuartzRunnable(quartzJob.getBeanName(), quartzJob.getMethodName(), quartzJob.getParams());
|
|
||||||
Future<?> future = executor.submit(task);
|
Future<?> future = executor.submit(task);
|
||||||
// 忽略任务执行结果
|
// 忽略任务执行结果
|
||||||
future.get();
|
future.get();
|
||||||
@@ -123,8 +122,7 @@ public class ExecutionJobBean extends QuartzJobBean {
|
|||||||
Map<String, Object> data = new HashMap<>(16);
|
Map<String, Object> data = new HashMap<>(16);
|
||||||
data.put("task", quartzJob);
|
data.put("task", quartzJob);
|
||||||
data.put("msg", msg);
|
data.put("msg", msg);
|
||||||
TemplateEngine engine =
|
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
|
||||||
TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
|
|
||||||
Template template = engine.getTemplate("SystemQuartzJobTaskAlarmTemplate.ftl");
|
Template template = engine.getTemplate("SystemQuartzJobTaskAlarmTemplate.ftl");
|
||||||
sendEmailRequest.setContent(template.render(data));
|
sendEmailRequest.setContent(template.render(data));
|
||||||
List<String> emails = Arrays.asList(quartzJob.getEmail().split("[,,]"));
|
List<String> emails = Arrays.asList(quartzJob.getEmail().split("[,,]"));
|
||||||
|
|||||||
-32
@@ -1,32 +0,0 @@
|
|||||||
package cn.odboy.system.framework.quartz;
|
|
||||||
|
|
||||||
import cn.odboy.system.dal.dataobject.SystemQuartzJobTb;
|
|
||||||
import cn.odboy.system.dal.mysql.SystemQuartzJobMapper;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.ApplicationArguments;
|
|
||||||
import org.springframework.boot.ApplicationRunner;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class InitialActiveJobApplicationRunner implements ApplicationRunner {
|
|
||||||
@Autowired
|
|
||||||
private SystemQuartzJobMapper quartzJobMapper;
|
|
||||||
@Autowired
|
|
||||||
private QuartzManage quartzManage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 项目启动时重新激活启用的定时任务
|
|
||||||
*
|
|
||||||
* @param applicationArguments /
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void run(ApplicationArguments applicationArguments) {
|
|
||||||
List<SystemQuartzJobTb> quartzJobs = quartzJobMapper.selectAllEnableQuartzJob();
|
|
||||||
quartzJobs.forEach(quartzManage::addJob);
|
|
||||||
log.info("Timing task injection complete");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+2
-4
@@ -38,12 +38,10 @@ public class QuartzManage {
|
|||||||
public void addJob(SystemQuartzJobTb quartzJob) {
|
public void addJob(SystemQuartzJobTb quartzJob) {
|
||||||
try {
|
try {
|
||||||
// 构建job信息
|
// 构建job信息
|
||||||
JobDetail jobDetail =
|
JobDetail jobDetail = JobBuilder.newJob(ExecutionJobBean.class).withIdentity(JOB_NAME + quartzJob.getId()).build();
|
||||||
JobBuilder.newJob(ExecutionJobBean.class).withIdentity(JOB_NAME + quartzJob.getId()).build();
|
|
||||||
|
|
||||||
// 通过触发器名和cron 表达式创建 Trigger
|
// 通过触发器名和cron 表达式创建 Trigger
|
||||||
Trigger cronTrigger = TriggerBuilder.newTrigger().withIdentity(JOB_NAME + quartzJob.getId()).startNow()
|
Trigger cronTrigger = TriggerBuilder.newTrigger().withIdentity(JOB_NAME + quartzJob.getId()).startNow().withSchedule(CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression())).build();
|
||||||
.withSchedule(CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression())).build();
|
|
||||||
|
|
||||||
cronTrigger.getJobDataMap().put(SystemQuartzJobTb.JOB_KEY, quartzJob);
|
cronTrigger.getJobDataMap().put(SystemQuartzJobTb.JOB_KEY, quartzJob);
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -35,10 +35,7 @@ public class OssStorageConfiguration {
|
|||||||
public MinioClient minioClient() {
|
public MinioClient minioClient() {
|
||||||
try {
|
try {
|
||||||
OSSConfigModel minio = properties.getOss().getMinio();
|
OSSConfigModel minio = properties.getOss().getMinio();
|
||||||
return MinioClient.builder()
|
return MinioClient.builder().endpoint(minio.getEndpoint()).credentials(minio.getAccessKey(), minio.getSecretKey()).build();
|
||||||
.endpoint(minio.getEndpoint())
|
|
||||||
.credentials(minio.getAccessKey(), minio.getSecretKey())
|
|
||||||
.build();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("创建Minio客户端失败", e);
|
log.error("创建Minio客户端失败", e);
|
||||||
throw new BadRequestException("创建Minio客户端失败");
|
throw new BadRequestException("创建Minio客户端失败");
|
||||||
|
|||||||
-3
@@ -18,7 +18,6 @@ package cn.odboy.system.framework.storage.local;
|
|||||||
|
|
||||||
import cn.odboy.framework.exception.web.BadRequestException;
|
import cn.odboy.framework.exception.web.BadRequestException;
|
||||||
import cn.odboy.framework.properties.AppProperties;
|
import cn.odboy.framework.properties.AppProperties;
|
||||||
import cn.odboy.framework.server.core.CsFileLocalUploadHelper;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -36,8 +35,6 @@ public class MultipartConfig {
|
|||||||
@Value("${spring.application.name}")
|
@Value("${spring.application.name}")
|
||||||
private String name;
|
private String name;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CsFileLocalUploadHelper fileUploadPathHelper;
|
|
||||||
@Autowired
|
|
||||||
private AppProperties properties;
|
private AppProperties properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+10
-40
@@ -135,12 +135,7 @@ public class MinioRepository {
|
|||||||
* @param md5 文件md5
|
* @param md5 文件md5
|
||||||
* @return String 上传后的文件名,上传失败返回 null
|
* @return String 上传后的文件名,上传失败返回 null
|
||||||
*/
|
*/
|
||||||
public SystemOssStorageTb upload(
|
public SystemOssStorageTb upload(File tempFile, String originalFilename, long fileSize, String contentType, String md5) {
|
||||||
File tempFile,
|
|
||||||
String originalFilename,
|
|
||||||
long fileSize,
|
|
||||||
String contentType,
|
|
||||||
String md5) {
|
|
||||||
StorageOSSModel ossConfig = properties.getOss();
|
StorageOSSModel ossConfig = properties.getOss();
|
||||||
OSSConfigModel ossMinioConfig = ossConfig.getMinio();
|
OSSConfigModel ossMinioConfig = ossConfig.getMinio();
|
||||||
String type = FileTypeUtil.getType(tempFile);
|
String type = FileTypeUtil.getType(tempFile);
|
||||||
@@ -168,13 +163,7 @@ public class MinioRepository {
|
|||||||
systemOssStorageTb.setObjectName(objectName);
|
systemOssStorageTb.setObjectName(objectName);
|
||||||
|
|
||||||
try (InputStream fileInputStream = CsFileUtil.getInputStream(tempFile)) {
|
try (InputStream fileInputStream = CsFileUtil.getInputStream(tempFile)) {
|
||||||
PutObjectArgs objectArgs =
|
PutObjectArgs objectArgs = PutObjectArgs.builder().bucket(ossMinioConfig.getBucketName()).object(objectName).stream(fileInputStream, fileSize, -1).contentType(contentType).build();
|
||||||
PutObjectArgs.builder()
|
|
||||||
.bucket(ossMinioConfig.getBucketName())
|
|
||||||
.object(objectName)
|
|
||||||
.stream(fileInputStream, fileSize, -1)
|
|
||||||
.contentType(contentType)
|
|
||||||
.build();
|
|
||||||
minioClient.putObject(objectArgs);
|
minioClient.putObject(objectArgs);
|
||||||
log.info("文件上传成功,并删除临时文件,文件名:{}", originalFilename);
|
log.info("文件上传成功,并删除临时文件,文件名:{}", originalFilename);
|
||||||
return systemOssStorageTb;
|
return systemOssStorageTb;
|
||||||
@@ -212,13 +201,7 @@ public class MinioRepository {
|
|||||||
|
|
||||||
log.info("准备上传文件,原文件名:{},上传后文件名:{}", originalFilename, fileName);
|
log.info("准备上传文件,原文件名:{},上传后文件名:{}", originalFilename, fileName);
|
||||||
try (InputStream fileInputStream = file.getInputStream()) {
|
try (InputStream fileInputStream = file.getInputStream()) {
|
||||||
PutObjectArgs objectArgs =
|
PutObjectArgs objectArgs = PutObjectArgs.builder().bucket(properties.getOss().getMinio().getBucketName()).object(objectName).stream(fileInputStream, file.getSize(), -1).contentType(file.getContentType()).build();
|
||||||
PutObjectArgs.builder()
|
|
||||||
.bucket(properties.getOss().getMinio().getBucketName())
|
|
||||||
.object(objectName)
|
|
||||||
.stream(fileInputStream, file.getSize(), -1)
|
|
||||||
.contentType(file.getContentType())
|
|
||||||
.build();
|
|
||||||
// 使用重试机制进行上传
|
// 使用重试机制进行上传
|
||||||
uploadWithRetry(objectArgs, 3);
|
uploadWithRetry(objectArgs, 3);
|
||||||
log.info("文件上传成功,objectName: {}", objectName);
|
log.info("文件上传成功,objectName: {}", objectName);
|
||||||
@@ -291,14 +274,9 @@ public class MinioRepository {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
GetPresignedObjectUrlArgs presignedUrlArgs =
|
GetPresignedObjectUrlArgs presignedUrlArgs = GetPresignedObjectUrlArgs.builder().bucket(properties.getOss().getMinio().getBucketName()).object(fullFileName).method(Method.GET)
|
||||||
GetPresignedObjectUrlArgs.builder()
|
|
||||||
.bucket(properties.getOss().getMinio().getBucketName())
|
|
||||||
.object(fullFileName)
|
|
||||||
.method(Method.GET)
|
|
||||||
// 设置 URL 过期时间为 7 天, 最大 7 天, 别挣扎了
|
// 设置 URL 过期时间为 7 天, 最大 7 天, 别挣扎了
|
||||||
.expiry(3600 * 24 * 7)
|
.expiry(3600 * 24 * 7).build();
|
||||||
.build();
|
|
||||||
String url = minioClient.getPresignedObjectUrl(presignedUrlArgs);
|
String url = minioClient.getPresignedObjectUrl(presignedUrlArgs);
|
||||||
log.info("生成预签名 URL 成功,fileName: {}, url: {}", fullFileName, url);
|
log.info("生成预签名 URL 成功,fileName: {}, url: {}", fullFileName, url);
|
||||||
return url;
|
return url;
|
||||||
@@ -315,11 +293,9 @@ public class MinioRepository {
|
|||||||
* @param res HTTP 响应
|
* @param res HTTP 响应
|
||||||
*/
|
*/
|
||||||
public void download(String fileName, HttpServletResponse res) {
|
public void download(String fileName, HttpServletResponse res) {
|
||||||
GetObjectArgs objectArgs =
|
GetObjectArgs objectArgs = GetObjectArgs.builder().bucket(properties.getOss().getMinio().getBucketName()).object(fileName).build();
|
||||||
GetObjectArgs.builder().bucket(properties.getOss().getMinio().getBucketName()).object(fileName).build();
|
|
||||||
|
|
||||||
try (GetObjectResponse response = minioClient.getObject(objectArgs);
|
try (GetObjectResponse response = minioClient.getObject(objectArgs); FastByteArrayOutputStream os = new FastByteArrayOutputStream()) {
|
||||||
FastByteArrayOutputStream os = new FastByteArrayOutputStream()) {
|
|
||||||
|
|
||||||
byte[] buf = new byte[1024];
|
byte[] buf = new byte[1024];
|
||||||
int len;
|
int len;
|
||||||
@@ -347,8 +323,7 @@ public class MinioRepository {
|
|||||||
* @param res HTTP 响应
|
* @param res HTTP 响应
|
||||||
*/
|
*/
|
||||||
public void downloadOptimizedVersion(String fileName, HttpServletResponse res) {
|
public void downloadOptimizedVersion(String fileName, HttpServletResponse res) {
|
||||||
GetObjectArgs objectArgs =
|
GetObjectArgs objectArgs = GetObjectArgs.builder().bucket(properties.getOss().getMinio().getBucketName()).object(fileName).build();
|
||||||
GetObjectArgs.builder().bucket(properties.getOss().getMinio().getBucketName()).object(fileName).build();
|
|
||||||
|
|
||||||
try (GetObjectResponse response = minioClient.getObject(objectArgs)) {
|
try (GetObjectResponse response = minioClient.getObject(objectArgs)) {
|
||||||
// 增大缓冲区
|
// 增大缓冲区
|
||||||
@@ -382,9 +357,7 @@ public class MinioRepository {
|
|||||||
*/
|
*/
|
||||||
public List<Item> listObjects() {
|
public List<Item> listObjects() {
|
||||||
try {
|
try {
|
||||||
Iterable<Result<Item>> results = minioClient.listObjects(ListObjectsArgs.builder()
|
Iterable<Result<Item>> results = minioClient.listObjects(ListObjectsArgs.builder().bucket(properties.getOss().getMinio().getBucketName()).build());
|
||||||
.bucket(properties.getOss().getMinio().getBucketName())
|
|
||||||
.build());
|
|
||||||
List<Item> items = new ArrayList<>();
|
List<Item> items = new ArrayList<>();
|
||||||
for (Result<Item> result : results) {
|
for (Result<Item> result : results) {
|
||||||
items.add(result.get());
|
items.add(result.get());
|
||||||
@@ -404,10 +377,7 @@ public class MinioRepository {
|
|||||||
*/
|
*/
|
||||||
public boolean remove(String fileName) {
|
public boolean remove(String fileName) {
|
||||||
try {
|
try {
|
||||||
minioClient.removeObject(RemoveObjectArgs.builder()
|
minioClient.removeObject(RemoveObjectArgs.builder().bucket(properties.getOss().getMinio().getBucketName()).object(fileName).build());
|
||||||
.bucket(properties.getOss().getMinio().getBucketName())
|
|
||||||
.object(fileName)
|
|
||||||
.build());
|
|
||||||
log.info("删除文件成功,fileName: {}", fileName);
|
log.info("删除文件成功,fileName: {}", fileName);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
+2
-4
@@ -53,8 +53,6 @@ public class SystemEmailService {
|
|||||||
* 更新邮件配置
|
* 更新邮件配置
|
||||||
*
|
*
|
||||||
* @param emailConfig 邮箱配置
|
* @param emailConfig 邮箱配置
|
||||||
* @return /
|
|
||||||
* @throws Exception /
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -150,9 +148,9 @@ public class SystemEmailService {
|
|||||||
throw new BadRequestException("服务异常, 请联系网站负责人");
|
throw new BadRequestException("服务异常, 请联系网站负责人");
|
||||||
}
|
}
|
||||||
// 存在就再次发送原来的验证码
|
// 存在就再次发送原来的验证码
|
||||||
content = CsResourceTemplateUtil.render("system", biEnum.getTemplateName(), Dict.create().set("code", code));
|
content = CsResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", code));
|
||||||
} else {
|
} else {
|
||||||
content = CsResourceTemplateUtil.render("system", biEnum.getTemplateName(), Dict.create().set("code", oldCode));
|
content = CsResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", oldCode));
|
||||||
}
|
}
|
||||||
SystemSendEmailArgs sendEmailRequest =
|
SystemSendEmailArgs sendEmailRequest =
|
||||||
new SystemSendEmailArgs(Collections.singletonList(email), applicationTitle, content);
|
new SystemSendEmailArgs(Collections.singletonList(email), applicationTitle, content);
|
||||||
|
|||||||
+27
-22
@@ -19,9 +19,11 @@ package cn.odboy.system.service;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.odboy.framework.context.CsSpringBeanHolder;
|
||||||
import cn.odboy.framework.exception.web.BadRequestException;
|
import cn.odboy.framework.exception.web.BadRequestException;
|
||||||
import cn.odboy.system.constant.TransferProtocolConst;
|
import cn.odboy.system.constant.TransferProtocolConst;
|
||||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||||
|
import cn.odboy.system.dal.dataobject.SystemRoleMenuTb;
|
||||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||||
import cn.odboy.system.dal.model.SystemMenuMetaVo;
|
import cn.odboy.system.dal.model.SystemMenuMetaVo;
|
||||||
import cn.odboy.system.dal.model.SystemMenuVo;
|
import cn.odboy.system.dal.model.SystemMenuVo;
|
||||||
@@ -31,6 +33,7 @@ import cn.odboy.system.dal.mysql.SystemRoleMenuMapper;
|
|||||||
import cn.odboy.util.CsClassUtil;
|
import cn.odboy.util.CsClassUtil;
|
||||||
import cn.odboy.util.CsFileUtil;
|
import cn.odboy.util.CsFileUtil;
|
||||||
import cn.odboy.util.CsStringUtil;
|
import cn.odboy.util.CsStringUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -72,8 +75,7 @@ public class SystemMenuService {
|
|||||||
args.setPid(null);
|
args.setPid(null);
|
||||||
}
|
}
|
||||||
if (args.getIFrame()) {
|
if (args.getIFrame()) {
|
||||||
if (!(args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTP) || args.getPath().toLowerCase()
|
if (!(args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTP) || args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTPS))) {
|
||||||
.startsWith(TransferProtocolConst.PREFIX_HTTPS))) {
|
|
||||||
throw new BadRequestException(TransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST);
|
throw new BadRequestException(TransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,8 +99,7 @@ public class SystemMenuService {
|
|||||||
}
|
}
|
||||||
SystemMenuTb menu = systemMenuMapper.selectById(args.getId());
|
SystemMenuTb menu = systemMenuMapper.selectById(args.getId());
|
||||||
if (args.getIFrame()) {
|
if (args.getIFrame()) {
|
||||||
if (!(args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTP) || args.getPath().toLowerCase()
|
if (!(args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTP) || args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTPS))) {
|
||||||
.startsWith(TransferProtocolConst.PREFIX_HTTPS))) {
|
|
||||||
throw new BadRequestException(TransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST);
|
throw new BadRequestException(TransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,19 +146,30 @@ public class SystemMenuService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*
|
|
||||||
* @param menuSet /
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void removeMenuByIds(Set<SystemMenuTb> menuSet) {
|
public void removeMenuByIds(Set<Long> ids) {
|
||||||
|
Set<SystemMenuTb> menuSet = new HashSet<>();
|
||||||
|
for (Long id : ids) {
|
||||||
|
List<SystemMenuTb> menuList = this.queryMenuByPid(id);
|
||||||
|
menuSet.add(systemMenuMapper.selectById(id));
|
||||||
|
menuSet = this.queryChildMenu(menuList, menuSet);
|
||||||
|
}
|
||||||
|
List<Long> menuIds = menuSet.stream().map(SystemMenuTb::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(menuIds)) {
|
||||||
|
CsSpringBeanHolder.getBean(SystemMenuService.class).removeRoleMenuByMenuIds(menuIds);
|
||||||
|
systemMenuMapper.deleteByIds(menuIds);
|
||||||
|
}
|
||||||
for (SystemMenuTb menu : menuSet) {
|
for (SystemMenuTb menu : menuSet) {
|
||||||
systemRoleMenuMapper.deleteRoleMenuByMenuId(menu.getId());
|
|
||||||
systemMenuMapper.deleteById(menu.getId());
|
|
||||||
this.updateMenuSubCnt(menu.getPid());
|
this.updateMenuSubCnt(menu.getPid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void removeRoleMenuByMenuIds(List<Long> menuIds) {
|
||||||
|
systemRoleMenuMapper.delete(new LambdaQueryWrapper<SystemRoleMenuTb>().in(SystemRoleMenuTb::getMenuId, menuIds));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出
|
* 导出
|
||||||
*
|
*
|
||||||
@@ -220,17 +232,6 @@ public class SystemMenuService {
|
|||||||
return systemMenuMapper.selectMenuByArgs(criteria);
|
return systemMenuMapper.selectMenuByArgs(criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID查询
|
|
||||||
*
|
|
||||||
* @param id /
|
|
||||||
* @return /
|
|
||||||
*/
|
|
||||||
|
|
||||||
public SystemMenuTb getMenuById(long id) {
|
|
||||||
return systemMenuMapper.selectById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据当前用户获取菜单
|
* 根据当前用户获取菜单
|
||||||
*
|
*
|
||||||
@@ -294,7 +295,7 @@ public class SystemMenuService {
|
|||||||
return menus;
|
return menus;
|
||||||
}
|
}
|
||||||
menus.addAll(systemMenuMapper.selectMenuByPidOrderByMenuSort(menu.getPid()));
|
menus.addAll(systemMenuMapper.selectMenuByPidOrderByMenuSort(menu.getPid()));
|
||||||
return querySuperiorMenuList(getMenuById(menu.getPid()), menus);
|
return querySuperiorMenuList(systemMenuMapper.selectById(menu.getPid()), menus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -396,4 +397,8 @@ public class SystemMenuService {
|
|||||||
}
|
}
|
||||||
return menuVo1;
|
return menuVo1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SystemMenuTb> queryMenuByIds(List<Long> ids) {
|
||||||
|
return systemMenuMapper.selectByIds(ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,4 @@
|
|||||||
from system_roles_menus
|
from system_roles_menus
|
||||||
where role_id = #{roleId}
|
where role_id = #{roleId}
|
||||||
</delete>
|
</delete>
|
||||||
<delete id="deleteRoleMenuByMenuId">
|
|
||||||
delete
|
|
||||||
from system_roles_menus
|
|
||||||
where menu_id = #{menuId}
|
|
||||||
</delete>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
-50
@@ -1,50 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
||||||
<style>
|
|
||||||
@page {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body style="margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
font: 100% SimSun, Microsoft YaHei, Times New Roman, Verdana, Arial, Helvetica, sans-serif;
|
|
||||||
color: #000;">
|
|
||||||
<div style="height: auto;
|
|
||||||
width: 820px;
|
|
||||||
min-width: 820px;
|
|
||||||
margin: 0 auto;
|
|
||||||
margin-top: 20px;
|
|
||||||
border: 1px solid #eee;">
|
|
||||||
<div style="padding: 10px;padding-bottom: 0px;">
|
|
||||||
<p style="margin-bottom: 10px;padding-bottom: 0px;">尊敬的用户, 您好:</p>
|
|
||||||
<p style="text-indent: 2em; margin-bottom: 10px;">您正在申请邮箱验证,您的验证码为:</p>
|
|
||||||
<p style="text-align: center;
|
|
||||||
font-family: Times New Roman;
|
|
||||||
font-size: 22px;
|
|
||||||
color: #C60024;
|
|
||||||
padding: 20px 0px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-weight: bold;
|
|
||||||
background: #ebebeb;">${code}</p>
|
|
||||||
<div class="foot-hr hr" style="margin: 0 auto;
|
|
||||||
z-index: 111;
|
|
||||||
width: 800px;
|
|
||||||
margin-top: 30px;
|
|
||||||
border-top: 1px solid #DA251D;">
|
|
||||||
</div>
|
|
||||||
<div style="text-align: center;
|
|
||||||
font-size: 12px;
|
|
||||||
padding: 20px 0px;
|
|
||||||
font-family: Microsoft YaHei;">
|
|
||||||
Copyright ©${.now?string("yyyy")} <a hover="color: #DA251D;" style="color: #999;"
|
|
||||||
href="https://github.com/odboy-tianjun/cutejava" target="_blank">CuteJava</a>
|
|
||||||
后台管理系统 All Rights Reserved.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
-71
@@ -1,71 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
||||||
<style>
|
|
||||||
@page {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body style="margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
font: 100% SimSun, Microsoft YaHei, Times New Roman, Verdana, Arial, Helvetica, sans-serif;
|
|
||||||
color: #000;">
|
|
||||||
<div style="height: auto;
|
|
||||||
margin: 0 auto;
|
|
||||||
margin-top: 20px;
|
|
||||||
padding: 20px;
|
|
||||||
border: 1px solid #eee;">
|
|
||||||
<div>
|
|
||||||
<p style="margin-bottom: 10px;">任务信息:</p>
|
|
||||||
<table style="border-collapse: collapse;">
|
|
||||||
<tr>
|
|
||||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">任务名称</th>
|
|
||||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">Bean名称</th>
|
|
||||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">执行方法</th>
|
|
||||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">参数内容</th>
|
|
||||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">Cron表达式</th>
|
|
||||||
<th style="padding: .65em;background: #666;border: 1px solid #777;color: #fff;">描述内容</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="padding: .65em;border: 1px solid#777;">${task.jobName}</td>
|
|
||||||
<td style="padding: .65em;border: 1px solid#777;">${task.beanName}</td>
|
|
||||||
<td style="padding: .65em;border: 1px solid#777;">${task.methodName}</td>
|
|
||||||
<td style="padding: .65em;border: 1px solid#777;">${(task.params)!""}</td>
|
|
||||||
<td style="padding: .65em;border: 1px solid#777;">${task.cronExpression}</td>
|
|
||||||
<td style="padding: .65em;border: 1px solid#777;">${(task.description)!""}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p style="margin-bottom: 10px;">异常信息:</p>
|
|
||||||
<pre style="position: relative;
|
|
||||||
padding: 15px;
|
|
||||||
line-height: 20px;
|
|
||||||
border-left: 5px solid #ddd;
|
|
||||||
color: #333;
|
|
||||||
font-family: Courier New, serif;
|
|
||||||
font-size: 12px">
|
|
||||||
${msg}
|
|
||||||
</pre>
|
|
||||||
</div>
|
|
||||||
<div class="foot-hr hr" style="margin: 0 auto;
|
|
||||||
z-index: 111;
|
|
||||||
width: 800px;
|
|
||||||
margin-top: 30px;
|
|
||||||
border-top: 1px solid #DA251D;">
|
|
||||||
</div>
|
|
||||||
<div style="text-align: center;
|
|
||||||
font-size: 12px;
|
|
||||||
padding: 20px 0px;
|
|
||||||
font-family: Microsoft YaHei;">
|
|
||||||
Copyright ©${.now?string("yyyy")} <a hover="color: #DA251D;" style="color: #999;"
|
|
||||||
href="https://github.com/odboy-tianjun/cutejava" target="_blank">CuteJava</a>
|
|
||||||
后台管理系统 All Rights Reserved.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -37,13 +37,15 @@ public class GenCode {
|
|||||||
generator.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
generator.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
||||||
generator.setDatabaseUsername(DATABASE_USER);
|
generator.setDatabaseUsername(DATABASE_USER);
|
||||||
generator.setDatabasePassword(DATABASE_PWD);
|
generator.setDatabasePassword(DATABASE_PWD);
|
||||||
genCode(generator);
|
genTaskCode(generator);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void genCode(CsMpCmdGenUtil generator) {
|
private static void genTaskCode(CsMpCmdGenUtil generator) {
|
||||||
generator.gen("task", "", List.of(
|
generator.gen("task", "", List.of(
|
||||||
"task_instance_info",
|
"task_instance_info",
|
||||||
"task_instance_detail"
|
"task_instance_detail",
|
||||||
|
"task_template_info",
|
||||||
|
"task_instance_step_detail"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,6 +127,34 @@ spring:
|
|||||||
max-idle: 20
|
max-idle: 20
|
||||||
# 连接池中的最小空闲连接数
|
# 连接池中的最小空闲连接数
|
||||||
min-idle: 1
|
min-idle: 1
|
||||||
|
# 数据库一定不能区分大小写
|
||||||
|
quartz:
|
||||||
|
# 必需,指定使用 JDBC 存储
|
||||||
|
job-store-type: jdbc
|
||||||
|
properties:
|
||||||
|
org:
|
||||||
|
quartz:
|
||||||
|
scheduler:
|
||||||
|
# 必需,指定调度器实例的名称
|
||||||
|
instanceName: cutejava
|
||||||
|
# 必需,指定调度器实例的 ID
|
||||||
|
instanceId: auto
|
||||||
|
threadPool:
|
||||||
|
# 可选,线程池的线程数量,可以根据需要调整
|
||||||
|
threadCount: 5
|
||||||
|
jobStore:
|
||||||
|
# 可选,如果你不需要集群,可以去掉
|
||||||
|
isClustered: true
|
||||||
|
# 可选,集群检查间隔时间,可以根据需要调整
|
||||||
|
clusterCheckinInterval: 10000
|
||||||
|
# 必需,指定 JDBC 驱动代理类
|
||||||
|
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||||
|
# 可选,是否使用属性存储,可以根据需要调整
|
||||||
|
useProperties: false
|
||||||
|
# 必需,指定表的前缀
|
||||||
|
tablePrefix: qrtz_
|
||||||
|
# 可选,指定误触发阈值,可以根据需要调整
|
||||||
|
misfireThreshold: 60000
|
||||||
# 集成mybatis-plus
|
# 集成mybatis-plus
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
|
|||||||
@@ -127,6 +127,34 @@ spring:
|
|||||||
max-idle: 20
|
max-idle: 20
|
||||||
# 连接池中的最小空闲连接数
|
# 连接池中的最小空闲连接数
|
||||||
min-idle: 1
|
min-idle: 1
|
||||||
|
# 数据库一定不能区分大小写
|
||||||
|
quartz:
|
||||||
|
# 必需,指定使用 JDBC 存储
|
||||||
|
job-store-type: jdbc
|
||||||
|
properties:
|
||||||
|
org:
|
||||||
|
quartz:
|
||||||
|
scheduler:
|
||||||
|
# 必需,指定调度器实例的名称
|
||||||
|
instanceName: cutejava
|
||||||
|
# 必需,指定调度器实例的 ID
|
||||||
|
instanceId: auto
|
||||||
|
threadPool:
|
||||||
|
# 可选,线程池的线程数量,可以根据需要调整
|
||||||
|
threadCount: 5
|
||||||
|
jobStore:
|
||||||
|
# 可选,如果你不需要集群,可以去掉
|
||||||
|
isClustered: true
|
||||||
|
# 可选,集群检查间隔时间,可以根据需要调整
|
||||||
|
clusterCheckinInterval: 10000
|
||||||
|
# 必需,指定 JDBC 驱动代理类
|
||||||
|
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||||
|
# 可选,是否使用属性存储,可以根据需要调整
|
||||||
|
useProperties: false
|
||||||
|
# 必需,指定表的前缀
|
||||||
|
tablePrefix: qrtz_
|
||||||
|
# 可选,指定误触发阈值,可以根据需要调整
|
||||||
|
misfireThreshold: 60000
|
||||||
# 集成mybatis-plus
|
# 集成mybatis-plus
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
@@ -176,7 +204,7 @@ app:
|
|||||||
# 登录
|
# 登录
|
||||||
login:
|
login:
|
||||||
# 是否限制单用户登录
|
# 是否限制单用户登录
|
||||||
single: true
|
single: false
|
||||||
# 验证码
|
# 验证码
|
||||||
captchaSetting:
|
captchaSetting:
|
||||||
# 验证码类型配置 查看 LoginProperties 类
|
# 验证码类型配置 查看 LoginProperties 类
|
||||||
@@ -195,7 +223,7 @@ app:
|
|||||||
font-size: 25
|
font-size: 25
|
||||||
# 是否开启 swagger-ui
|
# 是否开启 swagger-ui
|
||||||
swagger:
|
swagger:
|
||||||
enabled: false
|
enabled: true
|
||||||
# 针对@Async
|
# 针对@Async
|
||||||
async-task-pool:
|
async-task-pool:
|
||||||
# 核心线程池大小
|
# 核心线程池大小
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
# 配置 quartz 分布式支持, sql 文件在 sql 目录下,需要导入到数据库,并且需要修改 application.yml 文件的 active: dev 配置
|
|
||||||
spring:
|
|
||||||
# Quartz集群, 数据库表名称一定要不区分大小写!
|
|
||||||
quartz:
|
|
||||||
# 必需,指定使用 JDBC 存储
|
|
||||||
job-store-type: jdbc
|
|
||||||
properties:
|
|
||||||
org:
|
|
||||||
quartz:
|
|
||||||
scheduler:
|
|
||||||
# 必需,指定调度器实例的名称
|
|
||||||
instanceName: ClusteredScheduler
|
|
||||||
# 必需,指定调度器实例的 ID
|
|
||||||
instanceId: AUTO
|
|
||||||
threadPool:
|
|
||||||
class: org.quartz.simpl.SimpleThreadPool
|
|
||||||
# 可选,线程池的线程数量,可以根据需要调整
|
|
||||||
threadCount: 10
|
|
||||||
threadsInheritContextClassLoaderOfInitializingThread: true
|
|
||||||
dataSource:
|
|
||||||
jobStoreDataSource:
|
|
||||||
driver: com.mysql.cj.jdbc.Driver
|
|
||||||
url: jdbc:p6spy:mysql://127.0.0.1:3306/cutejava?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
|
||||||
user: root
|
|
||||||
password: kd123456
|
|
||||||
maxConnections: 10
|
|
||||||
validationQuery: select 1
|
|
||||||
jobStore:
|
|
||||||
# 可选,如果你不需要集群,可以去掉
|
|
||||||
isClustered: true
|
|
||||||
# 可选,集群检查间隔时间,可以根据需要调整
|
|
||||||
clusterCheckinInterval: 10000
|
|
||||||
# class: org.quartz.impl.jdbcjobstore.JobStoreTX
|
|
||||||
# 必需,指定 JDBC 驱动代理类
|
|
||||||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
|
||||||
# 可选,是否使用属性存储,可以根据需要调整
|
|
||||||
useProperties: false
|
|
||||||
# 必需,指定表的前缀
|
|
||||||
tablePrefix: QRTZ_
|
|
||||||
# 可选,指定误触发阈值,可以根据需要调整
|
|
||||||
misfireThreshold: 60000
|
|
||||||
dataSource: jobStoreDataSource
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
# 激活的环境,如果需要 quartz 分布式支持,需要修改 active: dev,quartz
|
# 激活的环境
|
||||||
active: dev
|
active: dev
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ max_connect_errors=100 # 最大错误连接数
|
|||||||
#sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
|
#sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
|
||||||
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
|
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
|
||||||
|
|
||||||
|
lower_case_table_names=1 # 表名不区分大小写
|
||||||
|
|
||||||
[mysql]
|
[mysql]
|
||||||
default-character-set=utf8mb4
|
default-character-set=utf8mb4
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user