diff --git a/pom.xml b/pom.xml index 5ab03f3..7a40f2c 100644 --- a/pom.xml +++ b/pom.xml @@ -296,6 +296,18 @@ easyexcel 3.1.1 + + + + cn.dev33 + sa-token-spring-boot-starter + 1.34.0 + + + cn.dev33 + sa-token-dao-redis-jackson + 1.34.0 + diff --git a/src/main/java/com/glxp/udi/admin/aspect/AuthorizeAspect.java b/src/main/java/com/glxp/udi/admin/aspect/AuthorizeAspect.java index 46b9824..d2df532 100644 --- a/src/main/java/com/glxp/udi/admin/aspect/AuthorizeAspect.java +++ b/src/main/java/com/glxp/udi/admin/aspect/AuthorizeAspect.java @@ -44,41 +44,41 @@ public class AuthorizeAspect { @Before("adminLoginVerify()") public void doAdminAuthVerify(JoinPoint joinPoint) { - ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); - if (attributes == null) { - throw new JsonException(ResultEnum.NOT_NETWORK); - } - HttpServletRequest request = attributes.getRequest(); - - String id = request.getHeader("ADMIN_ID"); - Long adminId; - try { - adminId = Long.valueOf(id); - } catch (Exception e) { - throw new JsonException(ResultEnum.LOGIN_VERIFY_FALL); - } - - String token = request.getHeader("ADMIN_TOKEN"); - if (token == null) { - throw new JsonException(ResultEnum.LOGIN_VERIFY_FALL); - } - - // 验证 token - Claims claims = JwtUtils.parse(token); - if (claims == null) { - throw new JsonException(ResultEnum.LOGIN_VERIFY_FALL); - } - Long jwtAdminId = Long.valueOf(claims.get("admin_id").toString()); - if (adminId.compareTo(jwtAdminId) != 0) { - throw new JsonException(ResultEnum.LOGIN_VERIFY_FALL); - } - - // 判断是否进行权限验证 - MethodSignature signature = (MethodSignature) joinPoint.getSignature(); - //从切面中获取当前方法 - Method method = signature.getMethod(); - //得到了方,提取出他的注解 - AuthRuleAnnotation action = method.getAnnotation(AuthRuleAnnotation.class); +// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); +// if (attributes == null) { +// throw new JsonException(ResultEnum.NOT_NETWORK); +// } +// HttpServletRequest request = attributes.getRequest(); +// +// String id = request.getHeader("ADMIN_ID"); +// Long adminId; +// try { +// adminId = Long.valueOf(id); +// } catch (Exception e) { +// throw new JsonException(ResultEnum.LOGIN_VERIFY_FALL); +// } +// +// String token = request.getHeader("ADMIN_TOKEN"); +// if (token == null) { +// throw new JsonException(ResultEnum.LOGIN_VERIFY_FALL); +// } +// +// // 验证 token +// Claims claims = JwtUtils.parse(token); +// if (claims == null) { +// throw new JsonException(ResultEnum.LOGIN_VERIFY_FALL); +// } +// Long jwtAdminId = Long.valueOf(claims.get("admin_id").toString()); +// if (adminId.compareTo(jwtAdminId) != 0) { +// throw new JsonException(ResultEnum.LOGIN_VERIFY_FALL); +// } +// +// // 判断是否进行权限验证 +// MethodSignature signature = (MethodSignature) joinPoint.getSignature(); +// //从切面中获取当前方法 +// Method method = signature.getMethod(); +// //得到了方,提取出他的注解 +// AuthRuleAnnotation action = method.getAnnotation(AuthRuleAnnotation.class); // 进行权限验证 // authRuleVerify(action.value(), adminId); } diff --git a/src/main/java/com/glxp/udi/admin/config/WebMvcConfig.java b/src/main/java/com/glxp/udi/admin/config/WebMvcConfig.java index 2fd12d1..9ea6cf0 100644 --- a/src/main/java/com/glxp/udi/admin/config/WebMvcConfig.java +++ b/src/main/java/com/glxp/udi/admin/config/WebMvcConfig.java @@ -1,25 +1,34 @@ package com.glxp.udi.admin.config; +import cn.dev33.satoken.interceptor.SaInterceptor; +import com.glxp.udi.admin.config.saToken.StpInterfaceImpl; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class WebMvcConfig implements WebMvcConfigurer { +// @Override +// public void addCorsMappings(CorsRegistry registry) { +// //设置允许跨域的路径 +// registry.addMapping("/**") +// //设置允许跨域请求的域名 +// .allowedOriginPatterns("*") +// //是否允许证书 不再默认开启 +// .allowCredentials(true) +// //设置允许的方法 +// .allowedMethods("*") +// //跨域允许时间 +// .maxAge(3600); +// } + + @Override - public void addCorsMappings(CorsRegistry registry) { - //设置允许跨域的路径 - registry.addMapping("/**") - //设置允许跨域请求的域名 - .allowedOriginPatterns("*") - //是否允许证书 不再默认开启 - .allowCredentials(true) - //设置允许的方法 - .allowedMethods("*") - //跨域允许时间 - .maxAge(3600); + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(new SaInterceptor()).addPathPatterns("/**"); + WebMvcConfigurer.super.addInterceptors(registry); } - } diff --git a/src/main/java/com/glxp/udi/admin/config/saToken/SaTokenConfigure.java b/src/main/java/com/glxp/udi/admin/config/saToken/SaTokenConfigure.java new file mode 100644 index 0000000..eaa79e4 --- /dev/null +++ b/src/main/java/com/glxp/udi/admin/config/saToken/SaTokenConfigure.java @@ -0,0 +1,99 @@ +package com.glxp.udi.admin.config.saToken; + +import cn.dev33.satoken.config.SaTokenConfig; +import cn.dev33.satoken.context.SaHolder; +import cn.dev33.satoken.exception.NotLoginException; +import cn.dev33.satoken.exception.NotPermissionException; +import cn.dev33.satoken.filter.SaServletFilter; +import cn.dev33.satoken.router.SaRouter; +import cn.dev33.satoken.stp.StpUtil; +import cn.dev33.satoken.util.SaResult; +import cn.hutool.http.ContentType; +import cn.hutool.json.JSONUtil; +import com.glxp.udi.admin.common.enums.ResultEnum; +import com.glxp.udi.admin.common.util.ResultVOUtils; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.http.MediaType; + +import java.util.Arrays; +import java.util.List; + +/** + * Sa-Token 配置类 + */ +@Configuration +public class SaTokenConfigure { + + // Sa-Token 参数配置,参考文档:https://sa-token.cc + // 此配置会覆盖 application.yml 中的配置 + @Bean + @Primary + public SaTokenConfig getSaTokenConfigPrimary() { + SaTokenConfig config = new SaTokenConfig(); + config.setTokenName("ADMIN_TOKEN"); // token名称 (同时也是cookie名称) + config.setTimeout(24 * 60 * 60); // token有效期,单位s 默认1天 + config.setActivityTimeout(30 * 60); // token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 + config.setIsConcurrent(false); // 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) + config.setIsShare(true); // 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) + config.setTokenStyle("simple-uuid"); // token风格 + config.setIsLog(false); // 是否输出操作日志 + config.setIsReadCookie(false); + config.setIsReadBody(false); + config.setIsReadHeader(true); + return config; + } + + + private final List whiteList = Arrays.asList("/login", "/udiwarehouse/register/save", "udiwarehouse/register/getCheckcode"); + + /** + * 注册 [Sa-Token全局过滤器] + */ + @Bean + public SaServletFilter getSaServletFilter() { + return new SaServletFilter() + + // 指定 拦截路由 与 放行路由 + .addInclude("/**") + .addExclude("/favicon.ico") /* 排除掉 /favicon.ico */ + // 认证函数: 每次请求执行 + .setAuth(obj -> { + // 登录认证 -- 拦截所有路由,并排除白名单 用于开放登录 +// SaRouter.match("/**", String.valueOf(whiteList), () -> StpUtil.checkLogin()); + SaRouter.match("/**").notMatch(whiteList).check(() -> StpUtil.checkLogin()); + }) + // 异常处理函数:每次认证函数发生异常时执行此函数 + .setError(e -> { +// SaHolder.getResponse().setHeader("Content-Type", ContentType.JSON.getValue() + ";charset=utf-8"); + + return SaResult.error(e.getMessage()); + }) + + // 前置函数:在每次认证函数之前执行 + .setBeforeAuth(r -> { + // ---------- 设置一些安全响应头 ---------- + SaHolder.getResponse() + // 服务器名称 + .setServer("udi-ms-server") + // 是否可以在iframe显示视图: DENY=不可以 | SAMEORIGIN=同域下可以 | ALLOW-FROM uri=指定域名下可以 + .setHeader("X-Frame-Options", "SAMEORIGIN") + // 是否启用浏览器默认XSS防护: 0=禁用 | 1=启用 | 1; mode=block 启用, 并在检查到XSS攻击时,停止渲染页面 + .setHeader("X-XSS-Protection", "1; mode=block") + // 禁用浏览器内容嗅探 + .setHeader("X-Content-Type-Options", "nosniff") + // 允许指定域访问跨域资源 + .setHeader("Access-Control-Allow-Origin", "*") + // 允许所有请求方式 + .setHeader("Access-Control-Allow-Methods", "*") + // 有效时间 + .setHeader("Access-Control-Max-Age", "3600") + // 允许的header参数 + .setHeader("Access-Control-Allow-Headers", "*"); + ; + + }) + ; + } +} \ No newline at end of file diff --git a/src/main/java/com/glxp/udi/admin/config/saToken/StpInterfaceImpl.java b/src/main/java/com/glxp/udi/admin/config/saToken/StpInterfaceImpl.java new file mode 100644 index 0000000..fd624a9 --- /dev/null +++ b/src/main/java/com/glxp/udi/admin/config/saToken/StpInterfaceImpl.java @@ -0,0 +1,43 @@ +package com.glxp.udi.admin.config.saToken; + +import cn.dev33.satoken.stp.StpInterface; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.NumberUtil; +import com.glxp.udi.admin.entity.auth.AuthRoleAdmin; +import com.glxp.udi.admin.service.auth.AuthLoginService; +import com.glxp.udi.admin.service.auth.AuthRoleAdminService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 自定义权限验证接口扩展 + */ +@Service // 保证此类被SpringBoot扫描,完成Sa-Token的自定义权限验证扩展 +@RequiredArgsConstructor +public class StpInterfaceImpl implements StpInterface { + + + private final AuthLoginService authLoginService; + + /** + * 返回一个账号所拥有的权限码集合 + */ + @Override + public List getPermissionList(Object loginId, String loginType) { + List list = authLoginService.listRuleByAdminId(NumberUtil.parseLong(loginId.toString())); + System.out.println(list); + return list; + } + + @Override + public List getRoleList(Object loginId, String loginType) { + return null; + } + + +} \ No newline at end of file diff --git a/src/main/java/com/glxp/udi/admin/controller/auth/AuthAdminController.java b/src/main/java/com/glxp/udi/admin/controller/auth/AuthAdminController.java index 9accf44..0ea0721 100644 --- a/src/main/java/com/glxp/udi/admin/controller/auth/AuthAdminController.java +++ b/src/main/java/com/glxp/udi/admin/controller/auth/AuthAdminController.java @@ -1,5 +1,6 @@ package com.glxp.udi.admin.controller.auth; +import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -57,7 +58,7 @@ public class AuthAdminController { * 获取管理员列表 */ @ApiOperation(value = "获取管理员列表") - @AuthRuleAnnotation("admin/auth/admin/index") + @SaCheckPermission("admin/auth/admin/index") @GetMapping("/admin/auth/admin/index") public BaseResponse index(@Valid AuthAdminQueryRequest authAdminQueryRequest, BindingResult bindingResult) { @@ -110,7 +111,7 @@ public class AuthAdminController { * 获取角色列表 */ @ApiOperation(value = "获取角色列表") - @AuthRuleAnnotation("admin/auth/admin/roleList") + @SaCheckPermission("admin/auth/admin/roleList") @GetMapping("/admin/auth/admin/roleList") public BaseResponse roleList(@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "limit", defaultValue = "100") Integer limit) { @@ -128,7 +129,7 @@ public class AuthAdminController { } @ApiIgnore - @AuthRuleAnnotation("admin/auth/admin/roleCustomers") + @SaCheckPermission("admin/auth/admin/roleCustomers") @GetMapping("/admin/auth/admin/roleCustomers") public BaseResponse roleCustomers(@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "limit", defaultValue = "100") Integer limit) { @@ -155,7 +156,7 @@ public class AuthAdminController { } @ApiIgnore - @AuthRuleAnnotation("admin/auth/admin/customerRoles") + @SaCheckPermission("admin/auth/admin/customerRoles") @GetMapping("/admin/auth/admin/customerRoles") public BaseResponse customerRoles(@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "limit", defaultValue = "100") Integer limit) { @@ -177,7 +178,7 @@ public class AuthAdminController { * @return */ @ApiOperation(value = "新增用户接口") - @AuthRuleAnnotation("admin/auth/admin/save") + @SaCheckPermission("admin/auth/admin/save") @PostMapping("/admin/auth/admin/save") public BaseResponse save(@RequestBody @Valid AuthAdminSaveRequest authAdminSaveRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -241,7 +242,7 @@ public class AuthAdminController { * @return */ @ApiIgnore - @AuthRuleAnnotation("admin/auth/admin/edit") + @SaCheckPermission("admin/auth/admin/edit") @PostMapping("/admin/auth/admin/edit") public BaseResponse edit(@RequestBody @Valid AuthAdminSaveRequest authAdminSaveRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -288,7 +289,7 @@ public class AuthAdminController { * @return */ @ApiOperation("删除用户") - @AuthRuleAnnotation("admin/auth/admin/delete") + @SaCheckPermission("admin/auth/admin/delete") @PostMapping("/admin/auth/admin/delete") public BaseResponse delete(@RequestBody AuthAdminSaveRequest authAdminSaveRequest) { if (authAdminSaveRequest.getId() == null) { @@ -310,7 +311,7 @@ public class AuthAdminController { * @return */ @ApiOperation("获取用户列表") - @AuthRuleAnnotation("") + @GetMapping("/admin/auth/admin/getUserList") public BaseResponse getUserList(QueryRequest queryRequest) { IPage page = authAdminService.getUserList(queryRequest); @@ -327,7 +328,7 @@ public class AuthAdminController { * @return */ @ApiOperation(value = "查询此用户可分配的角色") - @AuthRuleAnnotation("") + @GetMapping("/auth/admin/admin/getAssignableRoles") public BaseResponse getAssignableRoles(AuthAdminQueryRequest authAdminQueryRequest) { if (authAdminQueryRequest == null || null == authAdminQueryRequest.getAdminId()) { @@ -353,7 +354,7 @@ public class AuthAdminController { * @return */ @ApiOperation(value = "获取后台管理角色") - @AuthRuleAnnotation("") + @GetMapping("/auth/admin/admin/getAdminRoles") public BaseResponse getAdminRoles(AuthAdminQueryRequest authAdminQueryRequest) { IPage authRolePage = authRoleService.listCustomerRoles(authAdminQueryRequest.getPage(), authAdminQueryRequest.getLimit(), 0); diff --git a/src/main/java/com/glxp/udi/admin/controller/auth/AuthPermissionRuleController.java b/src/main/java/com/glxp/udi/admin/controller/auth/AuthPermissionRuleController.java index eb215d9..d77d385 100644 --- a/src/main/java/com/glxp/udi/admin/controller/auth/AuthPermissionRuleController.java +++ b/src/main/java/com/glxp/udi/admin/controller/auth/AuthPermissionRuleController.java @@ -1,5 +1,6 @@ package com.glxp.udi.admin.controller.auth; +import cn.dev33.satoken.annotation.SaCheckPermission; import com.glxp.udi.admin.annotation.AuthRuleAnnotation; import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.entity.auth.AuthPermissionRule; @@ -38,7 +39,7 @@ public class AuthPermissionRuleController { * * @return */ - @AuthRuleAnnotation("admin/auth/permission_rule/index") + @SaCheckPermission("admin/auth/permission_rule/index") @GetMapping("/admin/auth/permission_rule/index") public BaseResponse index(String status) { List authPermissionRuleList = authPermissionRuleService.listAll(status); @@ -55,7 +56,7 @@ public class AuthPermissionRuleController { * @param bindingResult * @return */ - @AuthRuleAnnotation("admin/auth/permission_rule/save") + @SaCheckPermission("admin/auth/permission_rule/save") @PostMapping("/admin/auth/permission_rule/save") public BaseResponse save(@RequestBody @Valid AuthPermissionRuleSaveRequest authPermissionRuleSaveRequest, BindingResult bindingResult) { @@ -86,7 +87,7 @@ public class AuthPermissionRuleController { * @param bindingResult * @return */ - @AuthRuleAnnotation("admin/auth/permission_rule/edit") + @SaCheckPermission("admin/auth/permission_rule/edit") @PostMapping("/admin/auth/permission_rule/edit") public BaseResponse edit(@RequestBody @Valid AuthPermissionRuleSaveRequest authPermissionRuleSaveRequest, BindingResult bindingResult) { @@ -117,7 +118,7 @@ public class AuthPermissionRuleController { * @param authPermissionRuleSaveRequest * @return */ - @AuthRuleAnnotation("admin/auth/permission_rule/delete") + @SaCheckPermission("admin/auth/permission_rule/delete") @PostMapping("/admin/auth/permission_rule/delete") public BaseResponse delete(@RequestBody AuthPermissionRuleSaveRequest authPermissionRuleSaveRequest) { if (authPermissionRuleSaveRequest.getId() == null) { diff --git a/src/main/java/com/glxp/udi/admin/controller/auth/AuthRoleController.java b/src/main/java/com/glxp/udi/admin/controller/auth/AuthRoleController.java index 40330d6..175efe7 100644 --- a/src/main/java/com/glxp/udi/admin/controller/auth/AuthRoleController.java +++ b/src/main/java/com/glxp/udi/admin/controller/auth/AuthRoleController.java @@ -1,5 +1,6 @@ package com.glxp.udi.admin.controller.auth; +import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.glxp.udi.admin.annotation.AuthRuleAnnotation; @@ -52,7 +53,7 @@ public class AuthRoleController { * 角色列表 */ @ApiOperation(value = "角色列表") - @AuthRuleAnnotation("admin/auth/role/index") + @SaCheckPermission("admin/auth/role/index") @GetMapping("/admin/auth/role/index") public BaseResponse index(@Valid AuthRoleQueryRequest authRoleQueryRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -78,7 +79,7 @@ public class AuthRoleController { * @param id * @return */ - @AuthRuleAnnotation("admin/auth/role/authList") + @SaCheckPermission("admin/auth/role/authList") @GetMapping("/admin/auth/role/authList") public BaseResponse authList(@RequestParam("id") Long id) { // 查询当前角色拥有的权限id @@ -95,7 +96,7 @@ public class AuthRoleController { return ResultVOUtils.success(restMap); } - @AuthRuleAnnotation("admin/auth/role/auth") + @SaCheckPermission("admin/auth/role/auth") @PostMapping("/admin/auth/role/auth") public BaseResponse auth(@RequestBody @Valid AuthRoleAuthRequest authRoleAuthRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -124,7 +125,7 @@ public class AuthRoleController { * @param bindingResult * @return */ - @AuthRuleAnnotation("admin/auth/role/save") + @SaCheckPermission("admin/auth/role/save") @PostMapping("/admin/auth/role/save") public BaseResponse save(@RequestBody @Valid AuthRoleSaveRequest authRoleSaveRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -156,7 +157,7 @@ public class AuthRoleController { * @param bindingResult * @return */ - @AuthRuleAnnotation("admin/auth/role/edit") + @SaCheckPermission("admin/auth/role/edit") @PostMapping("/admin/auth/role/edit") public BaseResponse edit(@RequestBody @Valid AuthRoleSaveRequest authRoleSaveRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -190,7 +191,7 @@ public class AuthRoleController { * @param authRoleSaveRequest * @return */ - @AuthRuleAnnotation("admin/auth/role/delete") + @SaCheckPermission("admin/auth/role/delete") @PostMapping("/admin/auth/role/delete") public BaseResponse delete(@RequestBody AuthRoleSaveRequest authRoleSaveRequest) { @@ -212,7 +213,7 @@ public class AuthRoleController { } - @AuthRuleAnnotation("") + @GetMapping("/admin/auth/role/getBussinessTypeRole") public BaseResponse getBussinessTypeRole(Long roleId) { if (null == roleId) { diff --git a/src/main/java/com/glxp/udi/admin/controller/auth/CustomerContactController.java b/src/main/java/com/glxp/udi/admin/controller/auth/CustomerContactController.java index 4cf74e5..caf7509 100644 --- a/src/main/java/com/glxp/udi/admin/controller/auth/CustomerContactController.java +++ b/src/main/java/com/glxp/udi/admin/controller/auth/CustomerContactController.java @@ -25,7 +25,7 @@ public class CustomerContactController { @Resource private CustomerContactService customerContactService; - @AuthRuleAnnotation("") + @GetMapping("udiwarehouse/customerContact/list") public BaseResponse filterList(CustomerContactFilterRequest customerFilterRequest) { Page page = customerContactService.filterCustomerContact(customerFilterRequest); @@ -35,7 +35,7 @@ public class CustomerContactController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("") + @GetMapping("udiwarehouse/customerContact/add") public BaseResponse addContact(CustomerContactEntity customerContactEntity) { boolean b = customerContactService.insertCustomerContact(customerContactEntity); @@ -46,7 +46,7 @@ public class CustomerContactController { } } - @AuthRuleAnnotation("") + @GetMapping("udiwarehouse/customerContact/delete") public BaseResponse deleteContact(DeleteRequest deleteRequest) { boolean b = customerContactService.deleteById(Long.parseLong(deleteRequest.getId())); diff --git a/src/main/java/com/glxp/udi/admin/controller/auth/CustomerController.java b/src/main/java/com/glxp/udi/admin/controller/auth/CustomerController.java index 91be859..ae914b6 100644 --- a/src/main/java/com/glxp/udi/admin/controller/auth/CustomerController.java +++ b/src/main/java/com/glxp/udi/admin/controller/auth/CustomerController.java @@ -46,7 +46,7 @@ public class CustomerController { @Resource private AuthRoleAdminService authRoleAdminService; - @AuthRuleAnnotation("") + @GetMapping("udi/customer/list") public BaseResponse filterList(CustomerInfoFilterRequest customerFilterRequest) { IPage page = customerInfoService.filterDetailCustomer(customerFilterRequest); @@ -70,7 +70,7 @@ public class CustomerController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("") + @PostMapping("udi/customer/update") public BaseResponse updateCustomer(@RequestBody @Valid CustomerDetailEntity customerDetailEntity, BindingResult bindingResult) { @@ -96,7 +96,7 @@ public class CustomerController { return ResultVOUtils.success("更新成功"); } - @AuthRuleAnnotation("") + @PostMapping("udi/customer/delete") public BaseResponse deleteCustomers(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { diff --git a/src/main/java/com/glxp/udi/admin/controller/auth/LoginController.java b/src/main/java/com/glxp/udi/admin/controller/auth/LoginController.java index d6291f2..16ce612 100644 --- a/src/main/java/com/glxp/udi/admin/controller/auth/LoginController.java +++ b/src/main/java/com/glxp/udi/admin/controller/auth/LoginController.java @@ -1,5 +1,10 @@ package com.glxp.udi.admin.controller.auth; +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.dev33.satoken.annotation.SaCheckRole; +import cn.dev33.satoken.stp.SaLoginModel; +import cn.dev33.satoken.stp.SaTokenInfo; +import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.util.StrUtil; import com.glxp.udi.admin.annotation.AuthRuleAnnotation; import com.glxp.udi.admin.common.res.BaseResponse; @@ -122,15 +127,16 @@ public class LoginController { authAdminService.updateAuthAdmin(authAdminUp); // 登录成功后获取权限,这里面会设置到缓存 - authLoginService.listRuleByAdminId(authAdmin.getId()); - - Map claims = new HashMap<>(); - claims.put("admin_id", authAdmin.getId()); - String token = JwtUtils.createToken(claims, 86400L); // 一天后过期86400L + List list = authLoginService.listRuleByAdminId(authAdmin.getId()); + StpUtil.login(authAdmin.getId()); + SaTokenInfo tokenInfo = StpUtil.getTokenInfo(); +// Map claims = new HashMap<>(); +// claims.put("admin_id", authAdmin.getId()); +// String token = JwtUtils.createToken(claims, 86400L); // 一天后过期86400L Map map = new HashMap<>(); - map.put("id", authAdmin.getId()); - map.put("token", token); + map.put("id", tokenInfo.getLoginId()); + map.put("token", tokenInfo.getTokenValue()); return ResultVOUtils.success(map); } @@ -140,7 +146,6 @@ public class LoginController { * @return */ @ApiOperation("获取用户信息") - @AuthRuleAnnotation("") @GetMapping("/admin/auth/login/userInfo") public BaseResponse userInfo(HttpServletRequest request) { String adminId = request.getHeader("ADMIN_ID"); @@ -163,6 +168,7 @@ public class LoginController { @ApiOperation("退出登录") @PostMapping("/admin/auth/login/out") public BaseResponse out() { + StpUtil.logout(); return ResultVOUtils.success(); } @@ -172,7 +178,7 @@ public class LoginController { * @return */ @ApiIgnore - @AuthRuleAnnotation("") // 需要登录验证,但是不需要权限验证时,value 值填空字符串 + // 需要登录验证,但是不需要权限验证时,value 值填空字符串 @PostMapping("/admin/auth/login/password") public BaseResponse password(@RequestBody @Valid UpdatePasswordRequest updatePasswordRequest, BindingResult bindingResult) { diff --git a/src/main/java/com/glxp/udi/admin/controller/auth/RegisterController.java b/src/main/java/com/glxp/udi/admin/controller/auth/RegisterController.java index fd78632..0c55e53 100644 --- a/src/main/java/com/glxp/udi/admin/controller/auth/RegisterController.java +++ b/src/main/java/com/glxp/udi/admin/controller/auth/RegisterController.java @@ -82,7 +82,7 @@ public class RegisterController { @Resource private InvWarehouseService invWarehouseService; - @AuthRuleAnnotation("") + @GetMapping("udiwarehouse/register/list") public BaseResponse filterList(UserResisterFilterRequest userResisterFilterRequest) { Page page = userRegisterService.filterUserRegisters(userResisterFilterRequest); @@ -150,7 +150,7 @@ public class RegisterController { return ResultVOUtils.success(rMap); } - @AuthRuleAnnotation("") + @PostMapping("udiwarehouse/register/deleteResiter") public BaseResponse deleteResiter(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -180,22 +180,22 @@ public class RegisterController { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - JSONObject userCode = JSONObject.parseObject(String.valueOf(redisUtil.get(Constant.CAPTCHAS + userRegisterEntity.getMobile()))); - if (userCode == null) { - return ResultVOUtils.error(500, "验证码已失效,请重新获取"); - } - long lastTime = userCode.getLong("createTime"); - int checkCode = (Integer) userCode.get("code"); - String phoneNum = userCode.getString("memPhone"); - if ((System.currentTimeMillis() - lastTime) > 1000 * 60 * 5) { - return ResultVOUtils.error(500, "验证码已过期,请重新获取"); - } - if (checkCode != userRegisterEntity.getCheckCode()) { - return ResultVOUtils.error(500, "验证码错误,请重新获取"); - } - if (!phoneNum.equals(userRegisterEntity.getMobile())) { - return ResultVOUtils.error(500, "手机号与获取验证码不一致"); - } +// JSONObject userCode = JSONObject.parseObject(String.valueOf(redisUtil.get(Constant.CAPTCHAS + userRegisterEntity.getMobile()))); +// if (userCode == null) { +// return ResultVOUtils.error(500, "验证码已失效,请重新获取"); +// } +// long lastTime = userCode.getLong("createTime"); +// int checkCode = (Integer) userCode.get("code"); +// String phoneNum = userCode.getString("memPhone"); +// if ((System.currentTimeMillis() - lastTime) > 1000 * 60 * 5) { +// return ResultVOUtils.error(500, "验证码已过期,请重新获取"); +// } +// if (checkCode != userRegisterEntity.getCheckCode()) { +// return ResultVOUtils.error(500, "验证码错误,请重新获取"); +// } +// if (!phoneNum.equals(userRegisterEntity.getMobile())) { +// return ResultVOUtils.error(500, "手机号与获取验证码不一致"); +// } boolean isExitPhone = userRegisterService.isExit(userRegisterEntity.getMobile()); if (isExitPhone) { return ResultVOUtils.error(500, "该手机号已被注册"); @@ -264,7 +264,7 @@ public class RegisterController { return ResultVOUtils.success("密码修改成功"); } - @AuthRuleAnnotation("") + @PostMapping("udiwarehouse/register/check") public BaseResponse checkRegister(@RequestBody @Valid RegisterCheckRequest registerCheckRequest, BindingResult bindingResult) { diff --git a/src/main/java/com/glxp/udi/admin/controller/basic/BussinessTypeController.java b/src/main/java/com/glxp/udi/admin/controller/basic/BussinessTypeController.java index 23a44a4..87c448a 100644 --- a/src/main/java/com/glxp/udi/admin/controller/basic/BussinessTypeController.java +++ b/src/main/java/com/glxp/udi/admin/controller/basic/BussinessTypeController.java @@ -48,7 +48,7 @@ public class BussinessTypeController { private OrderService orderService; @ApiOperation(value = "扫码单据列表") - @AuthRuleAnnotation("") + @GetMapping("/udiwms/bussinessType/filter") public BaseResponse filterBussinessType(BussinessTypeFilterRequest bussinessTypeFilterRequest, BindingResult bindingResult) { @@ -67,7 +67,7 @@ public class BussinessTypeController { } @ApiOperation("根据用户查询单据类型列表") - @AuthRuleAnnotation("") + @GetMapping("/udiwms/bussinessType/filterAllByUser") public BaseResponse filterAllByUser(BussinessTypeFilterRequest bussinessTypeFilterRequest, BindingResult bindingResult) { @@ -90,7 +90,7 @@ public class BussinessTypeController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("") + @PostMapping("/udiwms/bussinessType/delete") public BaseResponse deleteBussinessType(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -107,7 +107,7 @@ public class BussinessTypeController { return ResultVOUtils.success("删除成功"); } - @AuthRuleAnnotation("") + @PostMapping("/udiwms/bussinessType/update") public BaseResponse updateBussinessType(@RequestBody BussinessTypeEntity bussinessTypeEntity, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -122,7 +122,7 @@ public class BussinessTypeController { return ResultVOUtils.success("更新成功"); } - @AuthRuleAnnotation("") + @PostMapping("/udiwms/bussinessType/insert") public BaseResponse insertBussinessType(@RequestBody @Valid BussinessTypeEntity bussinessTypeEntity, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -153,7 +153,7 @@ public class BussinessTypeController { * * @return */ - @AuthRuleAnnotation("") + @GetMapping("/warehouse/bussinessType/candidateBussinessType") public BaseResponse candidateBussinessType(CndidateRequest cndidateRequest) { if (StrUtil.isBlank(cndidateRequest.getMainAction())) { @@ -165,7 +165,7 @@ public class BussinessTypeController { return ResultVOUtils.success(bussinessTypeEntities); } - @AuthRuleAnnotation("") + @GetMapping("/udiwms/localBusType/filterByBus") public BaseResponse filterByBus(BussinessLocalTypeFilterRequest bussinessTypeFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -182,7 +182,7 @@ public class BussinessTypeController { * @param action 单据类型编码 * @return */ - @AuthRuleAnnotation("") + @GetMapping("/udims/basic/busType/getCorpType") public BaseResponse getCorpType(@NotBlank(message = "参数不能为空") String action) { Integer corpType = bussinessTypeService.getCorpType(action); diff --git a/src/main/java/com/glxp/udi/admin/controller/info/CompanyController.java b/src/main/java/com/glxp/udi/admin/controller/info/CompanyController.java index 6f50b8e..bbf92b4 100644 --- a/src/main/java/com/glxp/udi/admin/controller/info/CompanyController.java +++ b/src/main/java/com/glxp/udi/admin/controller/info/CompanyController.java @@ -57,7 +57,7 @@ public class CompanyController { @Resource private CustomerInfoService customerInfoService; - @AuthRuleAnnotation("") + @GetMapping("/warehouse/info/company") public BaseResponse getCompanyInfo(CompanyRequest companyRequest) { CompanyEntity companyEntity = companyService.findCompany(companyRequest.getCustomerId()); @@ -67,7 +67,7 @@ public class CompanyController { return ResultVOUtils.error(500, "企业信息为空"); } - @AuthRuleAnnotation("") + @GetMapping("/udi/info/getSubCompany") public BaseResponse getSubCompany(FilterCompanyRequest companyRequest) { Page page = companyService.getSubCompany(companyRequest); @@ -77,7 +77,7 @@ public class CompanyController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("") + @PostMapping("/warehouse/info/modifyCompany") public BaseResponse modifyCompany(@RequestBody CompanyEntity companyEntity) { if (StringUtils.isNotBlank(companyEntity.getNewFilePath())) { @@ -172,7 +172,7 @@ public class CompanyController { * @param appSecret * @return */ - @AuthRuleAnnotation("") + @GetMapping("warehouse/info/testConnection") public BaseResponse testConnection(String appId, String appSecret) { if (StrUtil.isBlank(appId) || StrUtil.isBlank(appSecret)) { @@ -191,7 +191,7 @@ public class CompanyController { * * @return */ - @AuthRuleAnnotation("") + @GetMapping("warehouse/info/verifyConnection") public BaseResponse verifyConnection() { String customerId = authAdminService.getCurrentUserCustomerId(); @@ -211,7 +211,7 @@ public class CompanyController { * * @return */ - @AuthRuleAnnotation("") + @GetMapping("warehouse/info/setIgnoreVerify") public BaseResponse setIgnoreVerify() { String customerId = authAdminService.getCurrentUserCustomerId(); diff --git a/src/main/java/com/glxp/udi/admin/controller/info/PlatformController.java b/src/main/java/com/glxp/udi/admin/controller/info/PlatformController.java index 98aec8d..82e369d 100644 --- a/src/main/java/com/glxp/udi/admin/controller/info/PlatformController.java +++ b/src/main/java/com/glxp/udi/admin/controller/info/PlatformController.java @@ -38,7 +38,7 @@ public class PlatformController { @Resource private UnitMaintainService unitMaintainService; - @AuthRuleAnnotation("") + @PostMapping("/udims/platform/remove") public BaseResponse remove(@RequestBody PlatformEntity platformEntity) { if (platformService.remove(platformEntity.getId()) > 0) { @@ -48,7 +48,7 @@ public class PlatformController { } - @AuthRuleAnnotation("") + @PostMapping("/udims/platform/update") public BaseResponse update(@RequestBody PlatformEntity platformEntity) { if (StrUtil.isBlank(platformEntity.getName()) || StrUtil.isBlank(platformEntity.getHost())) { @@ -57,7 +57,7 @@ public class PlatformController { return platformService.update(platformEntity); } - @AuthRuleAnnotation("") + @GetMapping("/udims/platform/list") public BaseResponse list(@RequestParam Map params) { IPage page = platformService.list(params); @@ -72,7 +72,7 @@ public class PlatformController { * * @return */ - @AuthRuleAnnotation("") + @PostMapping("/udims/platform/testUserInfo") public BaseResponse testUserInfo(@RequestBody PlatformUserInfoRequest platformUserInfoRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -105,7 +105,7 @@ public class PlatformController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("") + @PostMapping("/udims/platform/link") public BaseResponse update(@RequestBody PlatformLinkRequest platformLinkRequest) { //判断此数据是否重复 @@ -164,7 +164,7 @@ public class PlatformController { /** * 获取往来单位与自助平台关联数据 */ - @AuthRuleAnnotation("") + @GetMapping("/udims/platform/getLinkPlatformList") public BaseResponse getLinkPlatformList(PlatformLinkRequest platformLinkRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -183,7 +183,7 @@ public class PlatformController { * @param corpId * @return */ - @AuthRuleAnnotation("") + @PostMapping("/udims/platform/unbind") public BaseResponse unbindPlatform(DeleteRequest deleteRequest) { if (StrUtil.isBlank(deleteRequest.getId())) { @@ -198,7 +198,7 @@ public class PlatformController { * * @return */ - @AuthRuleAnnotation("") + @GetMapping("/udims/platform/getTargetActions") public BaseResponse getTargetActions(String platformId, String invSubCode) { if (StrUtil.isBlank(platformId)) { @@ -208,7 +208,7 @@ public class PlatformController { } - @AuthRuleAnnotation("") + @GetMapping("/udims/platform/getTargetInv") public BaseResponse getTargetInv(String platformId) { if (StrUtil.isBlank(platformId)) { @@ -218,7 +218,7 @@ public class PlatformController { } - @AuthRuleAnnotation("") + @GetMapping("/udims/platform/getTargetSubInv") public BaseResponse getTargetSubInv(String platformId, String invCode) { if (StrUtil.isBlank(platformId)) { @@ -233,7 +233,7 @@ public class PlatformController { * @param host * @return */ - @AuthRuleAnnotation("") + @GetMapping("udims/platform/testPlatformConnection") public BaseResponse testPlatformConnection(String host) { if (StrUtil.isBlank(host)) { diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/InvProductsController.java b/src/main/java/com/glxp/udi/admin/controller/inout/InvProductsController.java index 4005fcd..2afd4b8 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/InvProductsController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/InvProductsController.java @@ -207,7 +207,7 @@ public class InvProductsController { } } - @AuthRuleAnnotation("") + @GetMapping("spms/inv/products/getDetaiByCode") public BaseResponse getDetaiByCode(FilterInvProductDetailRequest filterInvProductDetailRequest) { InvProductDetailEntity invProductDetailEntity = invProductDetailService.statInvPreInDetail(filterInvProductDetailRequest.getCode()); diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java b/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java index 56ad96f..cf0fcef 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java @@ -83,7 +83,7 @@ public class OrderController { @Resource private WarehouseTempService warehouseTempService; - @AuthRuleAnnotation("") + @GetMapping("/warehouse/inout/order/filter") public BaseResponse filterOrder(OrderFilterRequest orderFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -184,7 +184,7 @@ public class OrderController { * @param orderFilterRequest * @return */ - @AuthRuleAnnotation("") + @GetMapping("admin/warehouse/inout/order/listerror") public BaseResponse listOrderError(OrderFilterRequest orderFilterRequest) { AuthAdmin authAdmin = authAdminService.getCurrentUser(); @@ -205,7 +205,7 @@ public class OrderController { * @param orderFilterRequest * @return */ - @AuthRuleAnnotation("") + @GetMapping("/warehouse/inout/order/filterAdditionalOrder") public BaseResponse filterAdditionalOrder(OrderFilterRequest orderFilterRequest) { AuthAdmin authAdmin = authAdminService.getCurrentUser(); @@ -233,7 +233,7 @@ public class OrderController { * @param bindingResult * @return */ - @AuthRuleAnnotation("") + @GetMapping("/warehouse/inout/order/filterSupplementOrder") public BaseResponse filterSupplementOrder(OrderFilterRequest orderFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -264,7 +264,7 @@ public class OrderController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/order/mergeOrder") public BaseResponse mergeOrder(@RequestBody OrderMergeRequest orderMergeRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -306,7 +306,7 @@ public class OrderController { return ResultVOUtils.success("添加成功"); } - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/order/updateSpms") public BaseResponse uploadSpms(@RequestBody OrderUploadRequest orderUploadRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -417,7 +417,7 @@ public class OrderController { * @param orderDetailEntity * @return */ - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/order/detail/update") public BaseResponse updateStockOrderDetail(OrderDetailEntity orderDetailEntity) { if (null != orderDetailEntity) { @@ -432,7 +432,7 @@ public class OrderController { * @param orderEditRequest * @return */ - @AuthRuleAnnotation("") + @PostMapping("/udiwms/inout/order/updateOrderInfo") public BaseResponse updateOrderInfo(@RequestBody OrderEditRequest orderEditRequest) { if (null == orderEditRequest || StrUtil.isBlank(orderEditRequest.getActDate()) || CollUtil.isEmpty(orderEditRequest.getOrderIds())) { @@ -448,7 +448,7 @@ public class OrderController { * @param orderId 单据号 * @return */ - @AuthRuleAnnotation("") + @GetMapping("/udiwms/stock/order/supplementOrder") public BaseResponse supplementOrder(@RequestParam("orderId") String orderId) { if (StrUtil.isBlank(orderId)) { @@ -468,7 +468,7 @@ public class OrderController { * @param orderId * @return */ - @AuthRuleAnnotation("") + @GetMapping("/udiwms/inout/order/filterOrderForDelete") public BaseResponse filterOrderForDelete(String orderId) { if (StrUtil.isBlank(orderId)) { @@ -499,7 +499,7 @@ public class OrderController { * @param addOrderChangeRequest * @return */ - @AuthRuleAnnotation("") + @PostMapping("/udiwms/stock/order/change") public BaseResponse stockOrderChange(@RequestBody AddOrderChangeRequest addOrderChangeRequest) { OrderEntity originOrder = orderService.findById(addOrderChangeRequest.getOrderId()); @@ -561,7 +561,7 @@ public class OrderController { } //手持终端下载订单校验 - @AuthRuleAnnotation("") + @GetMapping("/udiwms/inout/order/download") public BaseResponse downloadOrder(OrderFilterRequest orderFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -611,7 +611,7 @@ public class OrderController { } //手持终端验收完成后,更新订单状态 - @AuthRuleAnnotation("") + @PostMapping("/spms/inout/order/check/updateStatus") public BaseResponse updateStatus(@RequestBody UpdateExportStatusRequest updateExportStatusRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -633,7 +633,7 @@ public class OrderController { * * @return */ - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/order/submitWebScanOrder") public BaseResponse submitWebScanOrder(@RequestBody AddOrderRequest addOrderRequest, BindingResult bindingResult) { if (bindingResult.hasErrors() || null == addOrderRequest || StrUtil.isBlank(addOrderRequest.getOrderId())) { diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/StockQRCodeTextController.java b/src/main/java/com/glxp/udi/admin/controller/inout/StockQRCodeTextController.java index 03e6aca..492b3d0 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/StockQRCodeTextController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/StockQRCodeTextController.java @@ -86,7 +86,7 @@ public class StockQRCodeTextController { //-----------打印码 - @AuthRuleAnnotation("") + @PostMapping("/udiwms/pdf/template/inspection/stock/qrcode/text/file") public BaseResponse inspectionStockQRCodeTextPDFFromTemplateFile( @RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) { @@ -106,7 +106,7 @@ public class StockQRCodeTextController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("") + @PostMapping("/udiwms/pdf/template/stock/qrcode/text/file") public BaseResponse stockQRCodeTextPDFFromTemplateFile( @RequestBody StockQRCodeTextPDFTemplateRequest stockQRCodeTextPDFTemplateRequest, @@ -192,7 +192,7 @@ public class StockQRCodeTextController { return null; } - @AuthRuleAnnotation("") + @PostMapping("/udiwms/pdf/template/stock/qrcode/text/maxfile") public BaseResponse stockQRCodeMaxTextPDFFromTemplateFile( @RequestBody StockQRCodeTextPDFTemplateRequest stockQRCodeTextPDFTemplateRequest) { @@ -272,7 +272,7 @@ public class StockQRCodeTextController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("") + @GetMapping("/spms/stock/qrcode/filterTemp") public BaseResponse filterTemp(FilterStPrintTempRequest filterStPrintTempRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -296,7 +296,7 @@ public class StockQRCodeTextController { //-----------打印订单 - @AuthRuleAnnotation("") + @PostMapping("/udiwms/pdf/template/inspection/stock/order/file") public BaseResponse inspectionStockOrderPDFFromTemplateFile( @RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) { @@ -322,7 +322,7 @@ public class StockQRCodeTextController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("") + @PostMapping("/udiwms/pdf/template/stock/order/file") public void stockOrderPDFFromTemplateFile( @RequestBody StockQRCodeTextPDFTemplateRequest stockQRCodeTextPDFTemplateRequest, @@ -374,7 +374,7 @@ public class StockQRCodeTextController { } } - @AuthRuleAnnotation("") + @GetMapping(value = "/udiwms/stock/qrcode/text/upload") public BaseResponse upload(StockQRCodeTextFilterRequest stockQRCodeTextFilterRequest, BindingResult bindingResult) { @@ -390,7 +390,7 @@ public class StockQRCodeTextController { return ResultVOUtils.error(500, "修改失败"); } - @AuthRuleAnnotation("") + @PostMapping("/udiwms/stock/qrcode/text/delete") public BaseResponse delete(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/UdiInfoController.java b/src/main/java/com/glxp/udi/admin/controller/inout/UdiInfoController.java index a443abb..e9a1326 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/UdiInfoController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/UdiInfoController.java @@ -119,7 +119,7 @@ public class UdiInfoController { } } - @AuthRuleAnnotation("") + @GetMapping("udims/udiinfo/local/filterByUuid") public BaseResponse filterLocalByUuid(FilterUdiInfoRequest productInfoFilterRequest) { productInfoFilterRequest.setCustomerId(authAdminService.getCurrentUserCustomerId()); @@ -127,7 +127,7 @@ public class UdiInfoController { return ResultVOUtils.success(page.getRecords()); } - @AuthRuleAnnotation("") + @PostMapping("/udi/udirel/update") public BaseResponse updateRelevanceEntity(@RequestBody UdiInfoEntity udiInfoEntity, BindingResult bindingResult) { if (bindingResult.hasErrors()) { diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/UdiRelevanceController.java b/src/main/java/com/glxp/udi/admin/controller/inout/UdiRelevanceController.java index 33592e1..56522c8 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/UdiRelevanceController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/UdiRelevanceController.java @@ -122,7 +122,7 @@ public class UdiRelevanceController { * @param combineRequest * @return */ - @AuthRuleAnnotation("") + @PostMapping("/udi/udirel/revleance") public BaseResponse revleanceUdi(@RequestBody CombineRequest combineRequest) { String customerId = authAdminService.getCurrentUserCustomerId(); @@ -157,7 +157,7 @@ public class UdiRelevanceController { } //选入查询结果的所有DI - @AuthRuleAnnotation("") + @GetMapping("/udi/udirel/combineAll") public BaseResponse combineAll(FilterUdiInfoRequest productInfoFilterRequest) { productInfoFilterRequest.setCustomerId(authAdminService.getCurrentUserCustomerId()); @@ -166,7 +166,7 @@ public class UdiRelevanceController { } //更换关联ERP产品 - @AuthRuleAnnotation("") + @PostMapping("/udi/udirel/disable") public BaseResponse disable(@RequestBody CombineRequest combineRequest) { if (StrUtil.isBlank(combineRequest.getRelId())) { @@ -186,7 +186,7 @@ public class UdiRelevanceController { } //客户端器械信息下载 - @AuthRuleAnnotation("") + @GetMapping("/udi/udirel/mutil/download") public BaseResponse downloadMutilProducts(FilterUdiInfoRequest filterUdiInfoRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/UnitMaintainController.java b/src/main/java/com/glxp/udi/admin/controller/inout/UnitMaintainController.java index b96d6fb..955bd5d 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/UnitMaintainController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/UnitMaintainController.java @@ -53,7 +53,7 @@ public class UnitMaintainController { * @param bindingResult * @return */ - @AuthRuleAnnotation("") + @GetMapping("/warehouse/unitMaintain/getUnbindUnitMaintain") public BaseResponse getUnbindUnitMaintain(UnitMaintainFilterRequest unitMaintainFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -68,7 +68,7 @@ public class UnitMaintainController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("") + @GetMapping("/warehouse/unit/download") public BaseResponse downloadUnit(UnitMaintainFilterRequest unitMaintainFilterRequest, BindingResult bindingResult) { @@ -85,7 +85,7 @@ public class UnitMaintainController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("") + @GetMapping("/udiwms/unit/download") public BaseResponse downloadUnitB(UnitMaintainFilterRequest unitMaintainFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/WareHouseController.java b/src/main/java/com/glxp/udi/admin/controller/inout/WareHouseController.java index 1c73eb7..56d8c9a 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/WareHouseController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/WareHouseController.java @@ -68,7 +68,7 @@ public class WareHouseController { @Resource private StackOrderService stackOrderService; - @AuthRuleAnnotation("") + @PostMapping("warehouse/inout/postOrders") public BaseResponse postOrders(@RequestBody PostOrderRequest postOrderRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -96,7 +96,7 @@ public class WareHouseController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("") + @GetMapping("warehouse/inout/deleteCodesTempById") public BaseResponse deleteCodesTempById(String id) { return warehouseTempService.deleteCodesTempById(id); @@ -108,7 +108,7 @@ public class WareHouseController { * @param code * @return */ - @AuthRuleAnnotation("") + @GetMapping("/warehouse/inout/warehouseUserList") public BaseResponse getWarehouseUserList(FilterInvLinkDataRequest filterInvLinkDataRequest) { Page page = warehouseUserService.filterUserList(filterInvLinkDataRequest); @@ -118,7 +118,7 @@ public class WareHouseController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("") + @GetMapping("/warehouse/inout/warehouseBussniessTypeList") public BaseResponse getWarehouseBussniessTypeList(FilterInvLinkDataRequest filterInvLinkDataRequest) { Page page = warehouseBussinessTypeService.filterList(filterInvLinkDataRequest); @@ -128,7 +128,7 @@ public class WareHouseController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/saveWarehouseUser") public BaseResponse saveWarehouseUser(@RequestBody Map params) { String code = String.valueOf(params.get("code")); @@ -140,7 +140,7 @@ public class WareHouseController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/saveWarehouseBussinessType") public BaseResponse saveWarehouseBussinessType(@RequestBody Map params) { String code = String.valueOf(params.get("code")); @@ -152,7 +152,7 @@ public class WareHouseController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/updateDirector") public BaseResponse updateDirector(Integer id) { if (null == id) { @@ -162,7 +162,7 @@ public class WareHouseController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/delWarehouseUser") public BaseResponse deleteWarehouseUser(Integer id) { if (null == id) { @@ -172,7 +172,7 @@ public class WareHouseController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/delWarehouseBussinessType") public BaseResponse deleteWarehouseBussinessType(Integer id) { if (null == id) { @@ -182,7 +182,7 @@ public class WareHouseController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/commit") public BaseResponse commitOrder(@RequestBody CommitRequest commitRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -200,7 +200,7 @@ public class WareHouseController { * @param bindingResult * @return */ - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/addCommit") public BaseResponse addCommitOrder(@RequestBody CommitRequest commitRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -219,7 +219,7 @@ public class WareHouseController { * @param warehouseQueryRequest * @return */ - @AuthRuleAnnotation("") + @GetMapping("spms/inout/dlcode/findByOrderId") public BaseResponse downloadCodesByOrderId(WarehouseQueryRequest warehouseQueryRequest) { IPage page = warehouseService.filterWarehouseByPage(warehouseQueryRequest); @@ -234,7 +234,7 @@ public class WareHouseController { * * @return */ - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/replaceCodes") public BaseResponse replaceCodes(@RequestBody CodesReplaceRequest codesReplaceRequest) { if (StrUtil.isBlank(codesReplaceRequest.getCode()) || StrUtil.isBlank(codesReplaceRequest.getOrderId())) { @@ -261,7 +261,7 @@ public class WareHouseController { * @param bindingResult * @return */ - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/code/deleteCodes") public BaseResponse deleteCodes(@RequestBody DeleteCodeRequest deleteCodeRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -283,7 +283,7 @@ public class WareHouseController { * @param bindingResult * @return */ - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/code/updateCodesTime") public BaseResponse updateCodesTime(@RequestBody CodeEditRequest codeEditRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -300,7 +300,7 @@ public class WareHouseController { * @param bindingResult * @return */ - @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/addOrderWeb") public BaseResponse addOrderWeb(@RequestBody AddOrderRequest addOrderRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -571,7 +571,7 @@ public class WareHouseController { return null; } - @AuthRuleAnnotation("") + @PostMapping("warehouse/inout/saveOrderWeb") public BaseResponse saveOrderWeb(@RequestBody AddOrderRequest addOrderRequest) { OrderEntity orderEntity = new OrderEntity(); diff --git a/src/main/java/com/glxp/udi/admin/controller/inventory/InvWarehouseController.java b/src/main/java/com/glxp/udi/admin/controller/inventory/InvWarehouseController.java index 86ba24b..7bfe1f0 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inventory/InvWarehouseController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inventory/InvWarehouseController.java @@ -49,7 +49,7 @@ public class InvWarehouseController { @Resource private InvProductService invProductService; - @AuthRuleAnnotation("") + @GetMapping("spms/inv/warehouse/filter") public BaseResponse filterInvWarehouse(FilterInvWarehouseRequest filterInvWarehouseRequest) { IPage page = invWarehouseService.filterInvWarehouse(filterInvWarehouseRequest); @@ -59,7 +59,7 @@ public class InvWarehouseController { return ResultVOUtils.success(restMap); } - @AuthRuleAnnotation("") + @GetMapping("spms/inv/warehouse/filterAll") public BaseResponse filterAllInvWarehouse(FilterInvWarehouseRequest filterInvWarehouseRequest) { filterInvWarehouseRequest.setPid(0); @@ -69,7 +69,7 @@ public class InvWarehouseController { } - @AuthRuleAnnotation("") + @GetMapping("spms/inv/warehouse/filterAllLocInv") public BaseResponse filterAllLocInv(FilterInvWarehouseRequest filterInvWarehouseRequest) { filterInvWarehouseRequest.setPid(0); @@ -99,7 +99,7 @@ public class InvWarehouseController { } } - @AuthRuleAnnotation("") + @GetMapping("spms/inv/warehouse/filterAllByUser") public BaseResponse filterAllByUser(FilterInvWarehouseRequest filterInvWarehouseRequest) { List invWarehouseEntities; @@ -134,7 +134,7 @@ public class InvWarehouseController { return invWarehouseResponses; } - @AuthRuleAnnotation("") + @PostMapping("/spms/inv/warehouse/save") public BaseResponse save(@RequestBody @Valid InvWarehouseEntity invWarehouseEntity, BindingResult bindingResult) { @@ -184,7 +184,7 @@ public class InvWarehouseController { return ResultVOUtils.success("添加成功!"); } - @AuthRuleAnnotation("") + @PostMapping("/spms/inv/warehouse/edit") public BaseResponse edit(@RequestBody @Valid InvWarehouseEntity invWarehouseEntity, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -206,7 +206,7 @@ public class InvWarehouseController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("") + @PostMapping("/spms/inv/warehouse/delete") public BaseResponse delete(@RequestBody DeleteRequest deleteRequest) { if (deleteRequest.getId() == null) { @@ -235,7 +235,7 @@ public class InvWarehouseController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("") + @PostMapping("/spms/inv/warehouse/disable") public BaseResponse disable(@RequestBody InvWarehouseEntity request) { if (request.getCode() == null) { @@ -257,7 +257,7 @@ public class InvWarehouseController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("") + @PostMapping("/spms/inv/warehouse/downloadByStatus") public BaseResponse downloadByStatus(@RequestBody FilterInvWarehouseRequest filterInvWarehouseRequest) { IPage page = invWarehouseService.filterInvWarehouse(filterInvWarehouseRequest); @@ -273,7 +273,7 @@ public class InvWarehouseController { * @param thridWarehouseId * @return */ - @AuthRuleAnnotation("") + @PostMapping("/spms/inv/warehouse/bindThrWarehouse") public BaseResponse bindThrWarehouse(Integer id, Integer thridWarehouseId, String sysId) { if (null == id || null == thridWarehouseId || StrUtil.isBlank(sysId)) { @@ -290,7 +290,7 @@ public class InvWarehouseController { * @param sysId * @return */ - @AuthRuleAnnotation("") + @PostMapping("/spms/inv/warehouse/unbindThrWarehouse") public BaseResponse unbindThrWarehouse(Integer id, String sysId) { if (null == id || StrUtil.isBlank(sysId)) { diff --git a/src/main/java/com/glxp/udi/admin/controller/param/SystemPDFModuleController.java b/src/main/java/com/glxp/udi/admin/controller/param/SystemPDFModuleController.java index 25c30f8..8556dd1 100644 --- a/src/main/java/com/glxp/udi/admin/controller/param/SystemPDFModuleController.java +++ b/src/main/java/com/glxp/udi/admin/controller/param/SystemPDFModuleController.java @@ -1,5 +1,6 @@ package com.glxp.udi.admin.controller.param; +import cn.dev33.satoken.annotation.SaCheckPermission; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.glxp.udi.admin.annotation.AuthRuleAnnotation; @@ -47,7 +48,7 @@ public class SystemPDFModuleController { @Resource private BussinessTypeService bussinessTypeService; - @AuthRuleAnnotation("system/pdf/module/list") + @SaCheckPermission("system/pdf/module/list") @GetMapping("/system/pdf/module/list") public BaseResponse list(@Valid SystemPDFModuleRequest systemPDFModuleRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -75,7 +76,7 @@ public class SystemPDFModuleController { } - @AuthRuleAnnotation("system/pdf/module/detail") + @SaCheckPermission("system/pdf/module/detail") @GetMapping("/system/pdf/module/detail") public BaseResponse moduleDetail(@Valid SystemPDFTemplateRelevanceRequest systemPDFModuleRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -105,14 +106,14 @@ public class SystemPDFModuleController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("system/pdf/module/updateRl") + @SaCheckPermission("system/pdf/module/updateRl") @PostMapping("/system/pdf/module/updateRl") public BaseResponse updateRl(@RequestBody SystemPDFTemplateRelevanceEntity systemPDFModuleSaveRequest) { systemPDFTemplateRelevanceService.updateRl(systemPDFModuleSaveRequest); return ResultVOUtils.success("修改成功"); } - @AuthRuleAnnotation("system/pdf/module/list") + @SaCheckPermission("system/pdf/module/list") @GetMapping("/system/pdf/module/pdfModules") public BaseResponse pdfModules(@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "limit", defaultValue = "100") Integer limit) { @@ -130,7 +131,7 @@ public class SystemPDFModuleController { } - @AuthRuleAnnotation("system/pdf/module/save") + @SaCheckPermission("system/pdf/module/save") @PostMapping("/system/pdf/module/save") public BaseResponse save(@RequestBody @Valid SystemPDFModuleSaveRequest systemPDFModuleSaveRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -147,7 +148,7 @@ public class SystemPDFModuleController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("system/pdf/module/update") + @SaCheckPermission("system/pdf/module/update") @PostMapping("/system/pdf/module/update") public BaseResponse update(@RequestBody SystemPDFModuleSaveRequest systemPDFModuleSaveRequest) { systemPDFModuleSaveRequest.setUpdate_time(new Date()); @@ -155,7 +156,7 @@ public class SystemPDFModuleController { return ResultVOUtils.success("修改成功"); } - @AuthRuleAnnotation("system/pdf/module/delete") + @SaCheckPermission("system/pdf/module/delete") @GetMapping("/system/pdf/module/delete") public BaseResponse deleteById(@RequestParam("id") Integer id) { systemPDFModuleService.deleteById(id); diff --git a/src/main/java/com/glxp/udi/admin/controller/param/SystemPDFTemplateController.java b/src/main/java/com/glxp/udi/admin/controller/param/SystemPDFTemplateController.java index 7712854..fce88c6 100644 --- a/src/main/java/com/glxp/udi/admin/controller/param/SystemPDFTemplateController.java +++ b/src/main/java/com/glxp/udi/admin/controller/param/SystemPDFTemplateController.java @@ -1,5 +1,6 @@ package com.glxp.udi.admin.controller.param; +import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -41,7 +42,7 @@ public class SystemPDFTemplateController { @Resource private BussinessTypeService bussinessTypeService; - @AuthRuleAnnotation("system/pdf/template/list") + @SaCheckPermission("system/pdf/template/list") @GetMapping("/system/pdf/template/list") public BaseResponse list(@Valid SystemPDFTemplateRequest systemPDFTemplateRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -85,7 +86,7 @@ public class SystemPDFTemplateController { } - @AuthRuleAnnotation("system/pdf/template/save") + @SaCheckPermission("system/pdf/template/save") @PostMapping("/system/pdf/template/save") public BaseResponse save(@RequestBody @Valid SystemPDFTemplateSaveRequest systemPDFTemplateSaveRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -110,7 +111,7 @@ public class SystemPDFTemplateController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("system/pdf/template/update") + @SaCheckPermission("system/pdf/template/update") @PostMapping("/system/pdf/template/update") public BaseResponse update(@RequestBody SystemPDFTemplateSaveRequest systemPDFTemplateSaveRequest) { systemPDFTemplateSaveRequest.setUpdate_time(new Date()); @@ -118,7 +119,7 @@ public class SystemPDFTemplateController { return ResultVOUtils.success("修改成功"); } - @AuthRuleAnnotation("system/pdf/template/delete") + @SaCheckPermission("system/pdf/template/delete") @GetMapping("/system/pdf/template/delete") public BaseResponse deleteById(@RequestParam("id") Integer id, @RequestParam("path") String path) { @@ -135,7 +136,7 @@ public class SystemPDFTemplateController { } } - @AuthRuleAnnotation("") + @PostMapping("/system/pdf/template/demoPrint") public void demoPrint( @RequestBody SystemPDFTemplateRequest systemPDFTemplateRequest, diff --git a/src/main/java/com/glxp/udi/admin/controller/param/SystemParamConfigController.java b/src/main/java/com/glxp/udi/admin/controller/param/SystemParamConfigController.java index 7cb2c42..7c2edef 100644 --- a/src/main/java/com/glxp/udi/admin/controller/param/SystemParamConfigController.java +++ b/src/main/java/com/glxp/udi/admin/controller/param/SystemParamConfigController.java @@ -1,5 +1,6 @@ package com.glxp.udi.admin.controller.param; +import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -44,7 +45,7 @@ public class SystemParamConfigController { @Resource private CustomerService customerService; - @AuthRuleAnnotation("system/param/config/list") + @SaCheckPermission("system/param/config/list") @GetMapping("/system/param/config/list") public BaseResponse list(@Valid SystemParamConfigRequest systemParamConfigRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -69,7 +70,7 @@ public class SystemParamConfigController { return ResultVOUtils.success(pageSimpleResponse); } - @AuthRuleAnnotation("system/param/config/save") + @SaCheckPermission("system/param/config/save") @PostMapping("/system/param/config/save") public BaseResponse save(@RequestBody @Valid SystemParamConfigSaveRequest systemParamConfigSaveRequest, BindingResult bindingResult) { @@ -87,7 +88,7 @@ public class SystemParamConfigController { return ResultVOUtils.success(); } - @AuthRuleAnnotation("system/param/config/update") + @SaCheckPermission("system/param/config/update") @PostMapping("/system/param/config/update") public BaseResponse update(@RequestBody SystemParamConfigSaveRequest systemParamConfigSaveRequest) { if (null == systemParamConfigSaveRequest || StrUtil.isBlank(systemParamConfigSaveRequest.getParamValue())) { @@ -100,7 +101,7 @@ public class SystemParamConfigController { //key搜索 - @AuthRuleAnnotation("") + @GetMapping("/udiwms/sys/config/selectByKey") public BaseResponse selectByKey(SystemParamConfigRequest systemParamConfigRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -116,7 +117,7 @@ public class SystemParamConfigController { * * @return */ - @AuthRuleAnnotation("") + @GetMapping("/udiwms/sys/config/getCustomizeParams") public BaseResponse getCustomizeParams(String customerId) { List list = systemParamConfigService.selectCustomizeParam(SystemParamConstant.SYSTEM_PARAMS, customerId); @@ -130,7 +131,7 @@ public class SystemParamConfigController { * @param bindingResult * @return */ - @AuthRuleAnnotation("") + @PostMapping("/udiwms/sys/config/addCustomizeParam") public BaseResponse addCustomizeParam(@RequestBody SystemParamConfigCustomerEntity configCustomerEntity, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -145,7 +146,7 @@ public class SystemParamConfigController { * * @return */ - @AuthRuleAnnotation("") + @GetMapping("/udiwms/sys/config/deleteParam") public BaseResponse deleteParam(Integer id) { if (null == id) { diff --git a/src/main/java/com/glxp/udi/admin/controller/product/StackOrderController.java b/src/main/java/com/glxp/udi/admin/controller/product/StackOrderController.java index a17970e..aae89ee 100644 --- a/src/main/java/com/glxp/udi/admin/controller/product/StackOrderController.java +++ b/src/main/java/com/glxp/udi/admin/controller/product/StackOrderController.java @@ -51,7 +51,7 @@ public class StackOrderController { @Resource private CustomerService customerService; - @AuthRuleAnnotation("") + @GetMapping("/udims/stack/order/filter") public BaseResponse filterOrder(StackOrderFilterRequest stackOrderFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -77,7 +77,7 @@ public class StackOrderController { } - @AuthRuleAnnotation("") + @PostMapping("/udims/stack/order/update") public BaseResponse updateStack(@RequestBody StackUploadRequest stackUploadRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -88,7 +88,7 @@ public class StackOrderController { } - @AuthRuleAnnotation("") + @PostMapping("/udims/stack/order/delete") public BaseResponse deleteStack(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -105,7 +105,7 @@ public class StackOrderController { * @param bindingResult * @return */ - @AuthRuleAnnotation("") + @PostMapping("/udims/stack/order/uploadStackOrder") public BaseResponse uploadStackOrder(@RequestBody StackUploadRequest stackUploadRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -138,7 +138,7 @@ public class StackOrderController { * @param bindingResult * @return */ - @AuthRuleAnnotation("") + @PostMapping("/udims/stack/order/upload") public BaseResponse uploadStack(@RequestBody StackUploadRequest stackUploadRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -216,7 +216,7 @@ public class StackOrderController { * @param bindingResult * @return */ - @AuthRuleAnnotation("") + @PostMapping("/udims/stack/order/importStackOrder") public BaseResponse importStackOrder(@RequestBody ImportStackOrderRequest importStackOrderRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { diff --git a/src/main/java/com/glxp/udi/admin/controller/udidl/SysUserController.java b/src/main/java/com/glxp/udi/admin/controller/udidl/SysUserController.java index 5c45e96..da49004 100644 --- a/src/main/java/com/glxp/udi/admin/controller/udidl/SysUserController.java +++ b/src/main/java/com/glxp/udi/admin/controller/udidl/SysUserController.java @@ -45,7 +45,7 @@ public class SysUserController { * @param id * @return */ - @AuthRuleAnnotation("") + @PostMapping("/sys/user/detail") public BaseResponse detail(Integer id) { return sysUserService.getDetail(id); @@ -57,7 +57,7 @@ public class SysUserController { * @param sysUserModel * @return */ - @AuthRuleAnnotation("") + @PostMapping("/sys/user/insert") public BaseResponse insert(@RequestBody SysUserModel sysUserModel) { return sysUserService.insert(sysUserModel); @@ -69,7 +69,7 @@ public class SysUserController { * @param sysUserModel * @return */ - @AuthRuleAnnotation("") + @PostMapping("/sys/user/update") public BaseResponse update(@RequestBody SysUserModel sysUserModel) { return sysUserService.update(sysUserModel); @@ -81,7 +81,7 @@ public class SysUserController { * @param id * @return */ - @AuthRuleAnnotation("") + @PostMapping("/sys/user/delete") public BaseResponse delete(Integer id) { return sysUserService.delete(id); diff --git a/src/main/java/com/glxp/udi/admin/entity/info/SetupEntity.java b/src/main/java/com/glxp/udi/admin/entity/info/SetupEntity.java index dacaa43..9b8a927 100644 --- a/src/main/java/com/glxp/udi/admin/entity/info/SetupEntity.java +++ b/src/main/java/com/glxp/udi/admin/entity/info/SetupEntity.java @@ -7,39 +7,39 @@ import lombok.Data; @TableName("customer_set") public class SetupEntity { - private Integer id; - - private boolean erpSaleOutModify; - - private boolean erpGetSaleOut; - - private boolean erpSaleOutSign; - - private boolean filterSaleOutSign; - - private int erpGetSaleOutDay; - - private boolean erpPruchaseModify; - - private boolean erpGetPurchaseIn; - - private boolean erpPruchaseSign; - - private int erpGetPurchaseDay; - - private boolean filterPurchaseSign; - - private String remark; - - private boolean forbidSameErp; +// private Integer id; +// +// private boolean erpSaleOutModify; +// +// private boolean erpGetSaleOut; +// +// private boolean erpSaleOutSign; +// +// private boolean filterSaleOutSign; +// +// private int erpGetSaleOutDay; +// +// private boolean erpPruchaseModify; +// +// private boolean erpGetPurchaseIn; +// +// private boolean erpPruchaseSign; +// +// private int erpGetPurchaseDay; +// +// private boolean filterPurchaseSign; +// +// private String remark; +// +// private boolean forbidSameErp; +// +// private boolean updateErpData; +// private boolean salesWareHouseOut; private boolean returnWareHouseOut; - private boolean salesWareHouseOut; - private boolean returnWareHouseIn; - private boolean updateErpData; private String customerId; diff --git a/src/main/java/com/glxp/udi/admin/handler/GlobalExceptionHandler.java b/src/main/java/com/glxp/udi/admin/handler/GlobalExceptionHandler.java index 0abb541..9c8a2cb 100644 --- a/src/main/java/com/glxp/udi/admin/handler/GlobalExceptionHandler.java +++ b/src/main/java/com/glxp/udi/admin/handler/GlobalExceptionHandler.java @@ -1,6 +1,10 @@ package com.glxp.udi.admin.handler; +import cn.dev33.satoken.exception.NotLoginException; +import cn.dev33.satoken.exception.NotPermissionException; +import cn.dev33.satoken.exception.SaTokenException; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import com.glxp.udi.admin.common.enums.ResultEnum; import com.glxp.udi.admin.common.util.ResultVOUtils; import com.glxp.udi.admin.exception.JsonException; @@ -31,4 +35,18 @@ public class GlobalExceptionHandler { return ResultVOUtils.error(ResultEnum.NOT_NETWORK, errorMsg); } + // 拦截API异常 + @ExceptionHandler(value = SaTokenException.class) + public com.glxp.udi.admin.common.res.BaseResponse handlerSaTokenException(SaTokenException e) { + log.error(e.getMessage(), e); + if (e instanceof NotPermissionException) { + return ResultVOUtils.error(ResultEnum.AUTH_FAILED.getCode(), "没有权限"); + } else if (e instanceof NotLoginException) { + return ResultVOUtils.error(ResultEnum.LOGIN_VERIFY_FALL); + } + String errorMsg = StrUtil.isBlank(e.getMessage()) ? ResultEnum.NOT_NETWORK.getMessage() : e.getMessage(); + // 返回对应的错误信息 + return ResultVOUtils.error(ResultEnum.NOT_NETWORK, errorMsg); + } + } diff --git a/src/main/java/com/glxp/udi/admin/service/auth/AuthLoginService.java b/src/main/java/com/glxp/udi/admin/service/auth/AuthLoginService.java index f83a295..5ccb13a 100644 --- a/src/main/java/com/glxp/udi/admin/service/auth/AuthLoginService.java +++ b/src/main/java/com/glxp/udi/admin/service/auth/AuthLoginService.java @@ -39,6 +39,7 @@ public class AuthLoginService { List authRules = new ArrayList<>(); // 超级管理员 if (adminId.equals(1L)) { + authRules.add("admin/**"); authRules.add("admin"); return authRules; } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index a195c69..2c60f1a 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -19,16 +19,10 @@ spring: min-idle: 0 logging: level: - org.springframework.data.mongodb.core.MongoTemplate: debug com.glxp.udi.admin.dao: debug -#mips服务地址 -UDIC_MIPSDOWNLOAD_URL: http://127.0.0.1:8080/UDIC_MIPSDL_Server -UCLOD_SERVER_URL: http://127.0.0.1:9997 UDI_SERVER_URL: https://www.udims.com/UDI_DL_Server_test -COOR_UPLOAD_ORDER: http://127.0.0.1:9987/udi/upload -#同步库接口调用地址相关信息 https://www.udims.com/UDI_DL_Server_test UDI_SERVER: url: https://www.udims.com/UDI_DL_Server_test connectTimeout: 2000 @@ -38,5 +32,4 @@ UDI_SERVER: file_path: D:/1s/udims -# UDI数据下载 UDI_KEY: 6b137c66-6286-46c6-8efa-c2f5dd9237df \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 56c202a..bf00a5f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -17,12 +17,10 @@ mybatis-plus: type-aliases-package: com.glxp.udi.admin.entity check-config-location: false configuration: - #不使用驼峰命名 map-underscore-to-camel-case: false auto-mapping-unknown-column-behavior: none auto-mapping-behavior: partial log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl - #是否可以使用列别名 use-column-label: true global-config: banner: true