diff --git a/backend/pom.xml b/backend/pom.xml index daccb25..71e10ab 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -11,7 +11,7 @@ com.yfd platform 1.0 - jar + pom platform springboot 项目基础框架4.0.3 @@ -46,6 +46,7 @@ + org.mybatis mybatis @@ -56,260 +57,151 @@ mybatis-spring 3.0.3 + + org.mybatis.spring.boot + mybatis-spring-boot-starter + ${mybatis.spring.boot.starter.version} + + + + + com.baomidou + mybatis-plus-spring-boot4-starter + ${mybatis-plus.version} + + + com.baomidou + mybatis-plus-jsqlparser + ${mybatis-plus.version} + + + com.baomidou + mybatis-plus-generator + ${mybatis-plus.version} + + + + + com.alibaba + druid + ${druid.version} + + + com.dameng + DmJdbcDriver18 + 8.1.2.79 + runtime + + + com.oracle.database.jdbc + ojdbc8 + 21.9.0.0 + runtime + + + com.oracle.database.nls + orai18n + 21.9.0.0 + runtime + + + org.xerial + sqlite-jdbc + ${sqlite-jdbc.version} + + + + + com.google.guava + guava + ${guava.version} + + + org.apache.commons + commons-lang3 + + + org.projectlombok + lombok + 1.18.42 + true + + + cn.hutool + hutool-all + ${hutool.version} + + + org.apache.poi + poi + ${poi.version} + + + org.apache.poi + poi-ooxml + ${poi.ooxml.version} + + + com.alibaba + fastjson + ${fastjson.version} + + + org.freemarker + freemarker + ${freemarker.version} + compile + + + org.jsoup + jsoup + ${jsoup.version} + + + com.github.ulisesbocchio + jasypt-spring-boot-starter + ${jasypt.version} + + + org.lionsoul + ip2region + ${ip2region.version} + + + com.github.whvcse + easy-captcha + ${easy.captcha.version} + + + eu.bitwalker + UserAgentUtils + ${useragentutils.version} + + + org.openjdk.nashorn + nashorn-core + 15.4 + + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + ${springdoc.version} + - - - org.springframework.boot - spring-boot-starter-actuator - - - - - org.springframework.boot - spring-boot-starter-web - - - - - org.springframework.boot - spring-boot-starter-security - - - - - org.springframework.boot - spring-boot-starter-data-redis - - - - - org.springframework.boot - spring-boot-starter-websocket - - - - - org.springframework.boot - spring-boot-starter-cache - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - com.google.guava - guava - ${guava.version} - - - - - - - org.springframework.boot - spring-boot-starter-quartz - - - - - - - - - - - org.mybatis.spring.boot - mybatis-spring-boot-starter - ${mybatis.spring.boot.starter.version} - - - - - org.mybatis - mybatis - ${mybatis.version} - - - - - com.alibaba - druid - ${druid.version} - - - - - org.springframework.boot - spring-boot-starter-jdbc - - - - - com.mysql - mysql-connector-j - runtime - - - - - com.dameng - DmJdbcDriver18 - 8.1.2.79 - runtime - - - - - com.oracle.database.jdbc - ojdbc8 - 21.9.0.0 - runtime - - - - - com.oracle.database.nls - orai18n - 21.9.0.0 - runtime - - - - - org.xerial - sqlite-jdbc - ${sqlite-jdbc.version} - - - - - com.baomidou - mybatis-plus-spring-boot4-starter - ${mybatis-plus.version} - - - - com.baomidou - mybatis-plus-jsqlparser - ${mybatis-plus.version} - - - - com.baomidou - mybatis-plus-generator - ${mybatis-plus.version} - - - - - org.apache.commons - commons-lang3 - - - - - org.projectlombok - lombok - true - - - - - org.springframework.boot - spring-boot-starter-aspectj - - - - - cn.hutool - hutool-all - ${hutool.version} - - - - - org.apache.poi - poi - ${poi.version} - - - org.apache.poi - poi-ooxml - ${poi.ooxml.version} - - - - - com.alibaba - fastjson - ${fastjson.version} - - - - - org.springdoc - springdoc-openapi-starter-webmvc-ui - ${springdoc.version} - - - - io.micrometer - micrometer-registry-prometheus - - - - org.freemarker - freemarker - ${freemarker.version} - compile - - - org.jsoup - jsoup - ${jsoup.version} - - - - - com.github.ulisesbocchio - jasypt-spring-boot-starter - ${jasypt.version} - - - - org.lionsoul - ip2region - ${ip2region.version} - - - - - com.github.whvcse - easy-captcha - ${easy.captcha.version} - - - - - eu.bitwalker - UserAgentUtils - ${useragentutils.version} - - - - org.openjdk.nashorn - nashorn-core - 15.4 - + + + platform-system + platform-common + qgc-env-server + qgc-eng-server + + @@ -408,18 +300,18 @@ enforce - - - - [3.6.3,) - - - [21,) - - - - - + + + + [3.6.3,) + + + [21,) + + + + + diff --git a/backend/src/main/java/com/yfd/platform/PlatformApplication.java b/backend/src/main/java/com/yfd/platform/PlatformApplication.java deleted file mode 100644 index 03ca484..0000000 --- a/backend/src/main/java/com/yfd/platform/PlatformApplication.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.yfd.platform; - -import com.yfd.platform.annotation.rest.AnonymousGetMapping; -import com.yfd.platform.datasource.DynamicDataSourceConfig; -import com.yfd.platform.utils.SpringContextHolder; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.data.redis.autoconfigure.DataRedisAutoConfiguration; -import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration; -import org.springframework.boot.web.server.servlet.context.ServletComponentScan; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; -import org.springframework.transaction.annotation.EnableTransactionManagement; -import org.springframework.web.bind.annotation.RestController; - -//@SpringBootApplication -@RestController -@EnableTransactionManagement -@ServletComponentScan("com.yfd.platform.config") -@MapperScan(basePackages = "com.yfd.platform.*.mapper") -@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class, DataRedisAutoConfiguration.class}) -@Import({DynamicDataSourceConfig.class}) -@EnableCaching -public class PlatformApplication { - - public static void main(String[] args) { - SpringApplication.run(PlatformApplication.class, args); - } - - @Bean - public SpringContextHolder springContextHolder() { - return new SpringContextHolder(); - } - - /** - * 访问首页提示 - * - * @return / - */ - @AnonymousGetMapping("/") - public String index() { - return "Backend service started successfully"; - } -} diff --git a/backend/src/main/java/com/yfd/platform/ServletInitializer.java b/backend/src/main/java/com/yfd/platform/ServletInitializer.java deleted file mode 100644 index 0234b48..0000000 --- a/backend/src/main/java/com/yfd/platform/ServletInitializer.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.yfd.platform; - -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; - -public class ServletInitializer extends SpringBootServletInitializer { - - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { - return application.sources(PlatformApplication.class); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/annotation/AnonymousAccess.java b/backend/src/main/java/com/yfd/platform/annotation/AnonymousAccess.java deleted file mode 100644 index 2fbd4c0..0000000 --- a/backend/src/main/java/com/yfd/platform/annotation/AnonymousAccess.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.annotation; - -import java.lang.annotation.*; - -/** - * @author jacky - * 用于标记匿名访问方法 - */ -@Inherited -@Documented -@Target({ElementType.METHOD,ElementType.ANNOTATION_TYPE}) -@Retention(RetentionPolicy.RUNTIME) -public @interface AnonymousAccess { - -} diff --git a/backend/src/main/java/com/yfd/platform/annotation/Log.java b/backend/src/main/java/com/yfd/platform/annotation/Log.java deleted file mode 100644 index 6739494..0000000 --- a/backend/src/main/java/com/yfd/platform/annotation/Log.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.yfd.platform.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * @author TangWei - * @date 2018-11-24 - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Log { - - String value() default ""; - - String module() default ""; -} - diff --git a/backend/src/main/java/com/yfd/platform/annotation/rest/AnonymousGetMapping.java b/backend/src/main/java/com/yfd/platform/annotation/rest/AnonymousGetMapping.java deleted file mode 100644 index 01fcc32..0000000 --- a/backend/src/main/java/com/yfd/platform/annotation/rest/AnonymousGetMapping.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2002-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.yfd.platform.annotation.rest; - -import com.yfd.platform.annotation.AnonymousAccess; -import org.springframework.core.annotation.AliasFor; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -import java.lang.annotation.*; - -/** - * Annotation for mapping HTTP {@code GET} requests onto specific handler - * methods. - *

- * 支持匿名访问 GetMapping - * - * @author liaojinlong - * @see RequestMapping - */ -@AnonymousAccess -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@RequestMapping(method = RequestMethod.GET) -public @interface AnonymousGetMapping { - - /** - * Alias for {@link RequestMapping#name}. - */ - @AliasFor(annotation = RequestMapping.class) - String name() default ""; - - /** - * Alias for {@link RequestMapping#value}. - */ - @AliasFor(annotation = RequestMapping.class) - String[] value() default {}; - - /** - * Alias for {@link RequestMapping#path}. - */ - @AliasFor(annotation = RequestMapping.class) - String[] path() default {}; - - /** - * Alias for {@link RequestMapping#params}. - */ - @AliasFor(annotation = RequestMapping.class) - String[] params() default {}; - - /** - * Alias for {@link RequestMapping#headers}. - */ - @AliasFor(annotation = RequestMapping.class) - String[] headers() default {}; - - /** - * Alias for {@link RequestMapping#consumes}. - * - * @since 4.3.5 - */ - @AliasFor(annotation = RequestMapping.class) - String[] consumes() default {}; - - /** - * Alias for {@link RequestMapping#produces}. - */ - @AliasFor(annotation = RequestMapping.class) - String[] produces() default {}; - -} diff --git a/backend/src/main/java/com/yfd/platform/aspect/LogAspect.java b/backend/src/main/java/com/yfd/platform/aspect/LogAspect.java deleted file mode 100644 index 0c52a21..0000000 --- a/backend/src/main/java/com/yfd/platform/aspect/LogAspect.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.aspect; - -import com.yfd.platform.system.domain.SysLog; -import com.yfd.platform.system.mapper.SysUserMapper; -import com.yfd.platform.system.service.ISysLogService; -import com.yfd.platform.system.service.IUserService; -import com.yfd.platform.utils.RequestHolder; -import com.yfd.platform.utils.SecurityUtils; -import com.yfd.platform.utils.StringUtils; -import lombok.extern.slf4j.Slf4j; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; -import org.springframework.stereotype.Component; - -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; -import java.util.Map; - -/** - * @author - * @date 2018-11-24 - */ -@Component -@Aspect -@Slf4j -public class LogAspect { - - @Resource - private final ISysLogService sysLogService; - - @Resource - private IUserService userService; - - ThreadLocal currentTime = new ThreadLocal<>(); - - public LogAspect(ISysLogService sysLogService) { - this.sysLogService = sysLogService; - } - - /** - * 配置切入点 - */ - @Pointcut("@annotation(com.yfd.platform.annotation.Log)") - public void logPointcut() { - // 该方法无方法体,主要为了让同类中其他方法使用此切入点 - } - - /** - * 配置环绕通知,使用在方法logPointcut()上注册的切入点 - * - * @param joinPoint join point for advice - */ - @Around("logPointcut()") - public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { - Object result; - currentTime.set(System.currentTimeMillis()); - result = joinPoint.proceed(); - SysLog log = new SysLog("INFO"); - currentTime.remove(); - HttpServletRequest request = RequestHolder.getHttpServletRequest(); - Map nameInfo = userService.getNameInfo(); - String nickname = nameInfo.get("nickname"); - String username = nameInfo.get("username"); - sysLogService.save(nickname, username, StringUtils.getBrowser(request), - StringUtils.getIp(request), joinPoint, log); - return result; - } - - public String getUsername() { - try { - return SecurityUtils.getCurrentUsername(); - } catch (Exception e) { - return ""; - } - } -} diff --git a/backend/src/main/java/com/yfd/platform/component/ServerSendEventServer.java b/backend/src/main/java/com/yfd/platform/component/ServerSendEventServer.java deleted file mode 100644 index ca1b1fe..0000000 --- a/backend/src/main/java/com/yfd/platform/component/ServerSendEventServer.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.yfd.platform.component; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.MediaType; -import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Consumer; - -/** - * @author Huhailong - * SSE Server send Event 服务器推送服务 - */ -@Slf4j -public class ServerSendEventServer { - - /** - * 当前连接数 - */ - private static AtomicInteger count = new AtomicInteger(0); - - private static Map sseEmitterMap = - new ConcurrentHashMap<>(); - - public static SseEmitter connect(String userId) { - //设置超时时间,0表示不过期,默认是30秒,超过时间未完成会抛出异常 - SseEmitter sseEmitter = new SseEmitter(0L); - //SseEmitter sseEmitter = new SseEmitter(); - //注册回调 - sseEmitter.onCompletion(completionCallBack(userId)); - sseEmitter.onError(errorCallBack(userId)); - sseEmitter.onTimeout(timeOutCallBack(userId)); - sseEmitterMap.put(userId, sseEmitter); - //数量+1 - count.getAndIncrement(); - log.info("create new sse connect ,current user:{}", userId); - return sseEmitter; - } - - /** - * 给指定用户发消息 - */ - public static void sendMessage(String userId, String message) { - if (sseEmitterMap.containsKey(userId)) { - try { - sseEmitterMap.get(userId).send(message); - } catch (IOException e) { - log.error("user id:{}, send message error:{}", userId, - e.getMessage()); - e.printStackTrace(); - } - } - } - - /** - * 给所有用户发消息 - */ - public static void sendMessage(String message) { - if (sseEmitterMap != null && !sseEmitterMap.isEmpty()) { - sseEmitterMap.forEach((k, v) -> { - // 发送消息 - sendMessage(k, message); - - }); - } - } - - /** - * 想多人发送消息,组播 - */ - public static void groupSendMessage(String groupId, String message) { - if (sseEmitterMap != null && !sseEmitterMap.isEmpty()) { - sseEmitterMap.forEach((k, v) -> { - try { - if (k.startsWith(groupId)) { - v.send(message, MediaType.APPLICATION_JSON); - } - } catch (IOException e) { - log.error("user id:{}, send message error:{}", groupId, - message); - removeUser(k); - } - }); - } - } - - public static void batchSendMessage(String message) { - sseEmitterMap.forEach((k, v) -> { - try { - v.send(message, MediaType.APPLICATION_JSON); - } catch (IOException e) { - log.error("user id:{}, send message error:{}", k, - e.getMessage()); - removeUser(k); - } - }); - } - - /** - * 群发消息 - */ - public static void batchSendMessage(String message, Set userIds) { - userIds.forEach(userId -> sendMessage(userId, message)); - } - - public static void removeUser(String userId) { - sseEmitterMap.remove(userId); - //数量-1 - count.getAndDecrement(); - log.info("remove user id:{}", userId); - } - - public static List getIds() { - return new ArrayList<>(sseEmitterMap.keySet()); - } - - public static int getUserCount() { - return count.intValue(); - } - - private static Runnable completionCallBack(String userId) { - return () -> { - log.info("结束连接,{}", userId); - removeUser(userId); - }; - } - - private static Runnable timeOutCallBack(String userId) { - return () -> { - log.info("连接超时,{}", userId); - removeUser(userId); - }; - } - - private static Consumer errorCallBack(String userId) { - return throwable -> { - log.error("连接异常,{}", userId); - removeUser(userId); - }; - } -} diff --git a/backend/src/main/java/com/yfd/platform/component/WebSocketServer.java b/backend/src/main/java/com/yfd/platform/component/WebSocketServer.java deleted file mode 100644 index 1d0b913..0000000 --- a/backend/src/main/java/com/yfd/platform/component/WebSocketServer.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.yfd.platform.component; - -import org.springframework.stereotype.Component; - -import jakarta.websocket.*; -import jakarta.websocket.server.PathParam; -import jakarta.websocket.server.ServerEndpoint; -import java.io.IOException; -import java.util.concurrent.CopyOnWriteArrayList; - -@ServerEndpoint("/websocket/{token}") -@Component -public class WebSocketServer { - private static int onlineCount=0;//在线人数 - private static CopyOnWriteArrayList webSocketSet=new CopyOnWriteArrayList();//在线用户集合 - private Session session;//与某个客户端的连接会话 - private String currentUser; - - @OnOpen - public void onOpen(@PathParam("token") String token, Session session){ - this.currentUser = token; - this.session=session; - webSocketSet.add(this);//加入set中 - addOnlineCount(); - System.out.println("有新连接加入!当前在线人数为"+getOnlineCount()); - allCurrentOnline(); - } - - @OnClose - public void onClose(){ - webSocketSet.remove(this); - subOnlineCount(); - System.out.println("有一连接关闭!当前在线人数为" + getOnlineCount()); - allCurrentOnline(); - } - - @OnMessage - public void onMessage(String message, Session session){ - System.out.println("来自客户端的消息:"+message); - for (WebSocketServer item:webSocketSet){ - try { - item.sendMessage(message); - } catch (IOException e) { - e.printStackTrace(); - continue; - } - } - } - - @OnError - public void onError(Session session, Throwable throwable){ - System.out.println("发生错误!"); - throwable.printStackTrace(); - } - - public void sendMessage(String message) throws IOException { - this.session.getBasicRemote().sendText(message); - } - - /** - * 获取当前所有在线用户名 - */ - public static void allCurrentOnline(){ - for (WebSocketServer item : webSocketSet) { - System.out.println(item.currentUser); - } - } - - /** - * 发送给指定用户 - */ - public static void sendMessageTo(String message,String token) throws IOException { - for (WebSocketServer item : webSocketSet) { - if(item.currentUser.equals(token)){ - item.session.getBasicRemote().sendText(message); - } - } - } - - /** - * 群发自定义消息 - */ - public static void sendInfo(String message) throws IOException { - System.out.println(message); - for (WebSocketServer item : webSocketSet) { - try { - item.sendMessage(message); - } catch (IOException e) { - continue; - } - } - } - - public static synchronized int getOnlineCount(){ - return onlineCount; - } - public static synchronized void addOnlineCount(){ - WebSocketServer.onlineCount++; - } - public static synchronized void subOnlineCount(){ - WebSocketServer.onlineCount--; - } - -} - - diff --git a/backend/src/main/java/com/yfd/platform/config/AppInitProperties.java b/backend/src/main/java/com/yfd/platform/config/AppInitProperties.java deleted file mode 100644 index 4ee304f..0000000 --- a/backend/src/main/java/com/yfd/platform/config/AppInitProperties.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.yfd.platform.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Data -@Configuration -@ConfigurationProperties(prefix = "app.init") -public class AppInitProperties { - private boolean enabled = false; - private String schema; - private String data; - // 用于判断是否已初始化:默认检查是否存在核心表 - private String markerTable = "sys_user"; - private String markerVersion = "v1.0.0"; -} \ No newline at end of file diff --git a/backend/src/main/java/com/yfd/platform/config/DataInitializer.java b/backend/src/main/java/com/yfd/platform/config/DataInitializer.java deleted file mode 100644 index b5dab5a..0000000 --- a/backend/src/main/java/com/yfd/platform/config/DataInitializer.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.yfd.platform.config; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.context.annotation.Profile; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.core.io.ByteArrayResource; -import org.springframework.core.io.Resource; -import org.springframework.core.io.ResourceLoader; -import org.springframework.core.io.support.EncodedResource; -import org.springframework.jdbc.datasource.init.ScriptUtils; -import org.springframework.jdbc.datasource.init.ScriptException; -import org.springframework.jdbc.datasource.init.ScriptStatementFailedException; -import org.springframework.stereotype.Component; - -import javax.sql.DataSource; -import java.nio.charset.StandardCharsets; -import java.util.stream.Collectors; -import org.springframework.util.StreamUtils; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; - -@Slf4j -@Component -@Profile({"dev","server"}) -@RequiredArgsConstructor -@Order(Ordered.HIGHEST_PRECEDENCE) -public class DataInitializer implements ApplicationRunner { - - private final DataSource dataSource; - private final AppInitProperties properties; - private final ResourceLoader resourceLoader; - - @Override - public void run(ApplicationArguments args) throws Exception { - if (!properties.isEnabled()) { - log.info("[DataInit] 自动初始化已关闭 app.init.enabled=false"); - return; - } - - try (Connection conn = dataSource.getConnection()) { - boolean initialized = tableExists(conn, properties.getMarkerTable()); - if (initialized) { - log.info("[DataInit] 检测到标记表已存在: {},跳过初始化", properties.getMarkerTable()); - return; - } - - log.info("[DataInit] 未检测到标记表: {},开始导入 schema 与 data", properties.getMarkerTable()); - executeIfPresent(conn, properties.getSchema()); - executeIfPresent(conn, properties.getData()); - log.info("[DataInit] 导入完成。marker={} version={}", properties.getMarkerTable(), properties.getMarkerVersion()); - } catch (Exception ex) { - log.error("[DataInit] 初始化失败: {}", ex.getMessage(), ex); - throw ex; - } - } - - private boolean tableExists(Connection conn, String tableName) { - if (tableName == null || tableName.isEmpty()) return false; - try { - DatabaseMetaData meta = conn.getMetaData(); - try (ResultSet rs = meta.getTables(conn.getCatalog(), null, tableName, null)) { - return rs.next(); - } - } catch (Exception e) { - log.warn("[DataInit] 检查表存在异常: {}", e.getMessage()); - return false; - } - } - - private void executeIfPresent(Connection conn, String location) throws Exception { - if (location == null || location.isEmpty()) return; - Resource resource = resourceLoader.getResource(location); - if (!resource.exists()) { - log.warn("[DataInit] 资源不存在: {}", location); - return; - } - log.info("[DataInit] 执行脚本: {}", location); - // 读取并清理脚本首部的 BOM 和危险语句(CREATE DATABASE / USE schema) - String sql = StreamUtils.copyToString(resource.getInputStream(), StandardCharsets.UTF_8); - if (sql != null && !sql.isEmpty()) { - // 移除 UTF-8 BOM(\uFEFF) - if (sql.charAt(0) == '\uFEFF') { - sql = sql.substring(1); - } - // 移除 "USE xxx;" 和 "CREATE DATABASE" 等与连接无关的语句 - sql = sql.lines() - .filter(line -> { - String raw = line; - String t = raw.trim(); - String u = t.toUpperCase(); - // 过滤与连接无关或可能引发解析问题的语句/注释 - if (u.startsWith("USE ")) return false; - if (u.startsWith("CREATE DATABASE")) return false; - if (t.startsWith("--")) return false; // 单行注释 - if (t.startsWith("/*") || t.startsWith("*/")) return false; // 多行注释行 - if (t.startsWith("/*!")) return false; // MySQL 版本注释 - if (t.matches("^-+$")) return false; // 分隔线 - return true; - }) - .collect(Collectors.joining("\n")); - } - if (sql != null && !sql.trim().isEmpty()) { - try { - ScriptUtils.executeSqlScript(conn, new EncodedResource(new ByteArrayResource(sql.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8)); - } catch (ScriptStatementFailedException e) { - String preview = sql.lines() - .filter(s -> !s.trim().isEmpty()) - .limit(10) - .collect(Collectors.joining("\n")); - log.error("[DataInit] SQL语句执行失败: {}\n前10行预览:\n{}", e.getMessage(), preview); - throw e; - } catch (ScriptException e) { - String preview = sql.lines() - .filter(s -> !s.trim().isEmpty()) - .limit(10) - .collect(Collectors.joining("\n")); - log.error("[DataInit] 脚本执行失败: {}\n前10行预览:\n{}", e.getMessage(), preview); - throw e; - } - } else { - log.warn("[DataInit] 脚本在清理后为空,跳过执行: {}", location); - } - } -} \ No newline at end of file diff --git a/backend/src/main/java/com/yfd/platform/config/FileProperties.java b/backend/src/main/java/com/yfd/platform/config/FileProperties.java deleted file mode 100644 index c179499..0000000 --- a/backend/src/main/java/com/yfd/platform/config/FileProperties.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -/** - * @author - */ -@Data -@Configuration -@ConfigurationProperties(prefix = "file") -public class FileProperties { - - /** 文件大小限制 */ - private Long maxSize; - - /** 头像大小限制 */ - private Long avatarMaxSize; - - private ElPath mac; - - private ElPath linux; - - private ElPath windows; - - public ElPath getPath(){ - String os = System.getProperty("os.name"); - if(os.toLowerCase().startsWith("win")) { - return windows; - } else if(os.toLowerCase().startsWith("mac")){ - return mac; - } - return linux; - } - - @Data - public static class ElPath{ - - private String path; - - private String avatar; - } -} diff --git a/backend/src/main/java/com/yfd/platform/config/FileSpaceProperties.java b/backend/src/main/java/com/yfd/platform/config/FileSpaceProperties.java deleted file mode 100644 index 74aab7d..0000000 --- a/backend/src/main/java/com/yfd/platform/config/FileSpaceProperties.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.yfd.platform.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -/** - * 文件空间相关配置,替换 @Value("${file-space.system}") 用法 - */ -@Data -@Configuration -@ConfigurationProperties(prefix = "file-space") -public class FileSpaceProperties { - - /** 基础目录,例如 D:/data/platform/ */ - private String system; -} \ No newline at end of file diff --git a/backend/src/main/java/com/yfd/platform/config/GlobalExceptionHandler.java b/backend/src/main/java/com/yfd/platform/config/GlobalExceptionHandler.java deleted file mode 100644 index d241883..0000000 --- a/backend/src/main/java/com/yfd/platform/config/GlobalExceptionHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.yfd.platform.config; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ResponseBody; - -/** - * @author TangWei - * @Date: 2023/3/27 18:07 - * @Description: - */ -@Slf4j -@ControllerAdvice -public class GlobalExceptionHandler { - - @ResponseBody - @ExceptionHandler(value = Throwable.class) - public ResponseResult handleException(Throwable e) { - log.error("message:{}", e.getMessage()); - e.printStackTrace(); - return ResponseResult.error(e.getMessage()); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/config/JobRunner.java b/backend/src/main/java/com/yfd/platform/config/JobRunner.java deleted file mode 100644 index 74bf8db..0000000 --- a/backend/src/main/java/com/yfd/platform/config/JobRunner.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.config; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.yfd.platform.system.domain.QuartzJob; -import com.yfd.platform.system.mapper.QuartzJobMapper; -import com.yfd.platform.utils.QuartzManage; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author - * @date 2019-01-07 - */ -@Component -@RequiredArgsConstructor -@Order(Ordered.LOWEST_PRECEDENCE) -public class JobRunner implements ApplicationRunner { - - private static final Logger log = LoggerFactory.getLogger(JobRunner.class); - private final QuartzJobMapper quartzJobMapper; - private final QuartzManage quartzManage; - - /** - * 项目启动时重新激活启用的定时任务 - * - * @param applicationArguments / - */ - @Override - public void run(ApplicationArguments applicationArguments) { - log.info("--------------------注入定时任务---------------------"); - List quartzJobs = - quartzJobMapper.selectList(new LambdaQueryWrapper().eq(QuartzJob::getStatus, "1")); - quartzJobs.forEach(quartzManage::addJob); - log.info("--------------------定时任务注入完成---------------------"); - } -} diff --git a/backend/src/main/java/com/yfd/platform/config/JwtAuthenticationTokenFilter.java b/backend/src/main/java/com/yfd/platform/config/JwtAuthenticationTokenFilter.java deleted file mode 100644 index bcb79c0..0000000 --- a/backend/src/main/java/com/yfd/platform/config/JwtAuthenticationTokenFilter.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.yfd.platform.config; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.jwt.JWT; -import cn.hutool.jwt.JWTUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.yfd.platform.component.ServerSendEventServer; -import com.yfd.platform.constant.Constant; -import com.yfd.platform.system.domain.LoginUser; -import com.yfd.platform.system.domain.Message; -import com.yfd.platform.system.service.IMessageService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Component; -import org.springframework.web.filter.OncePerRequestFilter; - -import jakarta.annotation.Resource; -import jakarta.servlet.FilterChain; -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; - -@Component -public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { - - @Autowired - private WebConfig webConfig; - - @Override - protected void doFilterInternal(HttpServletRequest httpServletRequest, - HttpServletResponse httpServletResponse, - FilterChain filterChain) throws ServletException, IOException { - //获取token - String uri = httpServletRequest.getRequestURI(); - String token = httpServletRequest.getHeader("token"); - if (StrUtil.isEmpty(token) || "/user/login".equals(uri)) { - filterChain.doFilter(httpServletRequest, httpServletResponse); - return; - } - //解析token - boolean isok = JWTUtil.verify(token, "12345678".getBytes()); - String userid = ""; - if (isok) { - final JWT jwt = JWTUtil.parseToken(token); - userid = jwt.getPayload("userid").toString(); - //从cachekey中获取用户信息失效时间 - String cachekey = "expire_time:" + userid; - if(StrUtil.isNotEmpty(webConfig.loginuserCache().get(cachekey))){ - long expire_time =Long.parseLong(webConfig.loginuserCache().get(cachekey)); - if (System.currentTimeMillis() > expire_time) { - httpServletResponse.sendError(HttpServletResponse.SC_FORBIDDEN, "Token超过期限!"); - return; - } - } - } - - //从cachekey中获取用户信息 - String cachekey = "login:" + userid; - String jsonstr = webConfig.loginuserCache().get(cachekey); - LoginUser loginUser = JSON.parseObject(jsonstr, LoginUser.class); - if (ObjectUtil.isEmpty(loginUser)) { - httpServletResponse.sendError(HttpServletResponse.SC_FORBIDDEN, - "登录用户已失效!"); - return; - } - //存入SecurityContextHolder - UsernamePasswordAuthenticationToken authenticationToken = - new UsernamePasswordAuthenticationToken(loginUser, null, - loginUser.getAuthorities()); - SecurityContextHolder.getContext().setAuthentication(authenticationToken); - webConfig.loginuserCache().put(Constant.TOKEN + userid, token); - //更新了超期时间 - long expireTime =System.currentTimeMillis() + ( 30L * 60L * 1000L); - webConfig.loginuserCache().put("expire_time:" + userid, String.valueOf(expireTime)); - //放行过滤器 - filterChain.doFilter(httpServletRequest, httpServletResponse); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/config/MessageConfig.java b/backend/src/main/java/com/yfd/platform/config/MessageConfig.java deleted file mode 100644 index e079d02..0000000 --- a/backend/src/main/java/com/yfd/platform/config/MessageConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.yfd.platform.config; - -import cn.hutool.cache.Cache; -import cn.hutool.cache.impl.CacheObj; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.yfd.platform.component.ServerSendEventServer; -import com.yfd.platform.constant.Constant; -import com.yfd.platform.system.domain.Message; -import com.yfd.platform.system.domain.SysUser; -import com.yfd.platform.system.service.IMessageService; -import com.yfd.platform.system.service.IUserService; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Component; - -import jakarta.annotation.Resource; -import java.util.Iterator; - -/** - * @author TangWei - * @Date: 2023/3/24 15:56 - * @Description: - */ -@Component -public class MessageConfig { - - @Resource - private IMessageService messageService; - - @Resource - private IUserService userService; - - @Resource - private WebConfig webConfig; - - public void sendMessage() { - long count = - messageService.count(new LambdaQueryWrapper().eq(Message::getStatus, "1")); - String userId = userService.getUserInfo().getId(); - String token = webConfig.loginuserCache().get(Constant.TOKEN + userId); - ServerSendEventServer.sendMessage(token, count + ""); - } - - public void addMessage(Message message) { - messageService.save(message); - long count = - messageService.count(new LambdaQueryWrapper().eq(Message::getStatus, "1")); - ServerSendEventServer.sendMessage(count + ""); - } -} diff --git a/backend/src/main/java/com/yfd/platform/config/MybitsPlusConfig.java b/backend/src/main/java/com/yfd/platform/config/MybitsPlusConfig.java deleted file mode 100644 index 99d4330..0000000 --- a/backend/src/main/java/com/yfd/platform/config/MybitsPlusConfig.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.yfd.platform.config; - -import com.baomidou.mybatisplus.annotation.DbType; -import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; -import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/****************************** - * 用途说明: - * 作者姓名: pcj - * 创建时间: 2022/10/24 10:50 - ******************************/ -@Configuration -public class MybitsPlusConfig { - -// @Bean -// public MybatisPlusInterceptor mybatisPlusInterceptor() { -// MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor(); -// mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); -// return mybatisPlusInterceptor; -// } - - /** - * 分页插件配置(Oracle 兼容) - */ - @Bean - public MybatisPlusInterceptor mybatisPlusInterceptor() { - MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); - // 添加分页拦截器,指定数据库类型为 Oracle - interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.ORACLE)); - return interceptor; - } - -} diff --git a/backend/src/main/java/com/yfd/platform/config/ProdApiPrefixFilter.java b/backend/src/main/java/com/yfd/platform/config/ProdApiPrefixFilter.java deleted file mode 100644 index 4c1680a..0000000 --- a/backend/src/main/java/com/yfd/platform/config/ProdApiPrefixFilter.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.yfd.platform.config; - -import jakarta.servlet.Filter; -import jakarta.servlet.FilterChain; -import jakarta.servlet.RequestDispatcher; -import jakarta.servlet.ServletException; -import jakarta.servlet.ServletRequest; -import jakarta.servlet.ServletResponse; -import jakarta.servlet.annotation.WebFilter; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * 将以 /prod-api/ 开头的请求转发到去掉前缀的真实后端接口路径。 - * 例如:/prod-api/user/code -> /user/code - * 这样可以兼容前端生产环境仍使用 /prod-api 作为网关前缀的情况。 - */ -@WebFilter(urlPatterns = "/prod-api/*", filterName = "prodApiPrefixFilter") -public class ProdApiPrefixFilter implements Filter { - - private static final String PREFIX = "/prod-api"; - - @Override - public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { - if (!(req instanceof HttpServletRequest) || !(res instanceof HttpServletResponse)) { - chain.doFilter(req, res); - return; - } - - HttpServletRequest request = (HttpServletRequest) req; - String uri = request.getRequestURI(); - - // 仅拦截 /prod-api/* 的接口请求并进行内部 forward - if (uri.startsWith(PREFIX + "/")) { - String forwardUri = uri.substring(PREFIX.length()); - RequestDispatcher dispatcher = request.getRequestDispatcher(forwardUri); - dispatcher.forward(req, res); - return; - } - - chain.doFilter(req, res); - } -} \ No newline at end of file diff --git a/backend/src/main/java/com/yfd/platform/config/QuartzConfig.java b/backend/src/main/java/com/yfd/platform/config/QuartzConfig.java deleted file mode 100644 index 41a36db..0000000 --- a/backend/src/main/java/com/yfd/platform/config/QuartzConfig.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.config; - -import org.quartz.Scheduler; -import org.quartz.spi.TriggerFiredBundle; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.quartz.AdaptableJobFactory; -import org.springframework.scheduling.quartz.SchedulerFactoryBean; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; - -/** - * 定时任务配置 - * - * @author / - * @date 2019-01-07 - */ -@Configuration -public class QuartzConfig { - - /** - * 解决Job中注入Spring Bean为null的问题 - */ - @Component("quartzJobFactory") - public static class QuartzJobFactory extends AdaptableJobFactory { - - private final AutowireCapableBeanFactory capableBeanFactory; - - public QuartzJobFactory(AutowireCapableBeanFactory capableBeanFactory) { - this.capableBeanFactory = capableBeanFactory; - } - - @Override - protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception { - - //调用父类的方法 - Object jobInstance = super.createJobInstance(bundle); - capableBeanFactory.autowireBean(jobInstance); - return jobInstance; - } - } - - /** - * 注入scheduler到spring - * - * @param quartzJobFactory / - * @return Scheduler - * @throws Exception / - */ - @Bean(name = "scheduler") - public Scheduler scheduler(QuartzJobFactory quartzJobFactory) throws Exception { - SchedulerFactoryBean factoryBean = new SchedulerFactoryBean(); - factoryBean.setJobFactory(quartzJobFactory); - factoryBean.afterPropertiesSet(); - Scheduler scheduler = factoryBean.getScheduler(); - scheduler.start(); - return scheduler; - } - -} diff --git a/backend/src/main/java/com/yfd/platform/config/ResponseResult.java b/backend/src/main/java/com/yfd/platform/config/ResponseResult.java deleted file mode 100644 index 9638fcf..0000000 --- a/backend/src/main/java/com/yfd/platform/config/ResponseResult.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.yfd.platform.config; - -import java.util.HashMap; - -public class ResponseResult extends HashMap { - private static final long serialVersionUID = 1L; - - public ResponseResult() { - } - - public static ResponseResult unlogin() { - return message("401", "未登录"); - } - - public static ResponseResult error() { - return error("操作失败"); - } - - public static ResponseResult success() { - return success("操作成功"); - } - - public static ResponseResult error(String msg) { - ResponseResult json = new ResponseResult(); - json.put((String)"code", "1");//错误 - json.put((String)"msg", msg); - return json; - } - - public static ResponseResult message(String code, String msg) { - ResponseResult json = new ResponseResult(); - json.put((String)"code", code); - json.put((String)"msg", msg); - return json; - } - - public static ResponseResult success(String msg) { - ResponseResult json = new ResponseResult(); - json.put((String)"code", "0");//正常 - json.put((String)"msg", msg); - return json; - } - - public static ResponseResult successData(Object obj) { - ResponseResult json = new ResponseResult(); - json.put((String)"code", "0");//正常 - json.put((String)"msg", "操作成功"); - json.put("data", obj); - return json; - } - - - public ResponseResult put(String key, Object value) { - super.put(key, value); - return this; - } -} diff --git a/backend/src/main/java/com/yfd/platform/config/SecurityConfig.java b/backend/src/main/java/com/yfd/platform/config/SecurityConfig.java deleted file mode 100644 index 37aa470..0000000 --- a/backend/src/main/java/com/yfd/platform/config/SecurityConfig.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.yfd.platform.config; - -import com.yfd.platform.config.bean.LoginProperties; -import com.yfd.platform.exception.AccessDeniedHandExcetion; -import com.yfd.platform.exception.AuthenticationException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpMethod; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.security.web.SecurityFilterChain; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; - -@Configuration -public class SecurityConfig { - - @Bean - public PasswordEncoder passwordEncoder() { - return new BCryptPasswordEncoder(); - } - - @Bean - @ConfigurationProperties(prefix = "login", ignoreUnknownFields = true) - public LoginProperties loginProperties() { - return new LoginProperties(); - } - - @Bean - public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { - return authenticationConfiguration.getAuthenticationManager(); - } - - @Autowired - private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter; - - @Autowired - private AuthenticationException authenticationException; - - @Autowired - private AccessDeniedHandExcetion accessDeniedHandExcetion; - - @Bean - public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { - http - .csrf(csrf -> csrf.disable()) - .sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) - .authorizeHttpRequests(auth -> auth - .requestMatchers("/user/login").anonymous() - .requestMatchers("/user/code").permitAll() - .requestMatchers(HttpMethod.GET, "/").permitAll() - .requestMatchers(HttpMethod.GET, - "/*.html", - "/webSocket/**", - "/assets/**", - "/icon/**").permitAll() - .requestMatchers( - "/swagger-ui.html", - "/swagger-ui/**", - "/v3/api-docs/**", - "/v3/api-docs.yaml", - "/swagger-resources/**", - "/webjars/**", - "/*/api-docs").permitAll() - .requestMatchers( - "/report/**", - "/images/**", - "/pageimage/**", - "/avatar/**", - "/systemurl/**", - "/api/imageserver/upload").permitAll() - .anyRequest().authenticated() - ) - .cors(cors -> {}); - - http.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); - - http.exceptionHandling(ex -> ex - .authenticationEntryPoint(authenticationException) - .accessDeniedHandler(accessDeniedHandExcetion) - ); - - return http.build(); - } -} diff --git a/backend/src/main/java/com/yfd/platform/config/SwaggerConfig.java b/backend/src/main/java/com/yfd/platform/config/SwaggerConfig.java deleted file mode 100644 index bdfe72a..0000000 --- a/backend/src/main/java/com/yfd/platform/config/SwaggerConfig.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.yfd.platform.config; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springdoc.core.models.GroupedOpenApi; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.info.Contact; - -/** - * Springdoc OpenAPI 配置 - */ -@Configuration -public class SwaggerConfig { - - @Bean - public OpenAPI projectOpenAPI() { - return new OpenAPI() - .info(new Info() - .title("项目API 接口文档") - .version("3.0") - .description("") - .contact(new Contact().name("郑顺利").email("13910913995@163.com")) - ); - } - - @Bean - public GroupedOpenApi groupWebsiteApi() { - return GroupedOpenApi.builder() - .group("1. 平台模块") - .packagesToScan("com.yfd.platform.modules.platformdb.controller") - .build(); - } - - @Bean - public GroupedOpenApi groupQuartzApi() { - return GroupedOpenApi.builder() - .group("2. 定时任务") - .packagesToScan("com.yfd.platform.modules.quartz.controller") - .build(); - } - - @Bean - public GroupedOpenApi groupSystemApi() { - return GroupedOpenApi.builder() - .group("3. 系统管理") - .packagesToScan("com.yfd.platform.system.controller") - .build(); - } -} diff --git a/backend/src/main/java/com/yfd/platform/config/WebConfig.java b/backend/src/main/java/com/yfd/platform/config/WebConfig.java deleted file mode 100644 index 45b051a..0000000 --- a/backend/src/main/java/com/yfd/platform/config/WebConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.yfd.platform.config; - -import cn.hutool.cache.Cache; -import cn.hutool.cache.CacheUtil; -import lombok.SneakyThrows; -import jakarta.annotation.Resource; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -import org.springframework.web.filter.CorsFilter; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class WebConfig implements WebMvcConfigurer { - @Resource - private FileSpaceProperties fileSpaceProperties; - - - - @Bean - public Cache loginuserCache() { - return CacheUtil.newLRUCache(200);//用户登录缓存数 缺省200 - } - - @Bean - public CorsFilter corsFilter() { - UrlBasedCorsConfigurationSource source = - new UrlBasedCorsConfigurationSource(); - CorsConfiguration config = new CorsConfiguration(); - config.setAllowCredentials(true); - config.addAllowedOriginPattern("*"); - config.addAllowedHeader("*"); - config.addAllowedMethod("*"); - config.setMaxAge(3600L); - source.registerCorsConfiguration("/**", config); - return new CorsFilter(source); - } - - @SneakyThrows - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/icon/**") - .addResourceLocations("classpath:/static/icon/") - .setCachePeriod(0); - - registry.addResourceHandler("/assets/**") - .addResourceLocations("classpath:/static/assets/") - .setCachePeriod(0); - - registry.addResourceHandler("swagger-ui.html").addResourceLocations( - "classpath:/META-INF/resources/"); - - String systemUrl = "file:" + fileSpaceProperties.getSystem().replace("\\", "/")+"user\\"; - registry.addResourceHandler("/avatar/**").addResourceLocations(systemUrl).setCachePeriod(0); - - - } - -} diff --git a/backend/src/main/java/com/yfd/platform/config/WebSocketConfig.java b/backend/src/main/java/com/yfd/platform/config/WebSocketConfig.java deleted file mode 100644 index 349ead0..0000000 --- a/backend/src/main/java/com/yfd/platform/config/WebSocketConfig.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.yfd.platform.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.socket.server.standard.ServerEndpointExporter; - -@Configuration -public class WebSocketConfig { - - @Bean - public ServerEndpointExporter serverEndpointExporter() { - - return new ServerEndpointExporter(); - } -} - diff --git a/backend/src/main/java/com/yfd/platform/config/bean/LoginCode.java b/backend/src/main/java/com/yfd/platform/config/bean/LoginCode.java deleted file mode 100644 index 2a7586b..0000000 --- a/backend/src/main/java/com/yfd/platform/config/bean/LoginCode.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2019-2020 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.config.bean; - -import lombok.Data; - -/** - * 登录验证码配置信息 - * - * @author: liaojinlong - * @date: 2020/6/10 18:53 - */ -@Data -public class LoginCode { - - /** - * 验证码配置 - */ - private LoginCodeEnum codeType; - /** - * 验证码有效期 分钟 - */ - private Long expiration = 2L; - /** - * 验证码内容长度 - */ - private int length = 2; - /** - * 验证码宽度 - */ - private int width = 111; - /** - * 验证码高度 - */ - private int height = 36; - /** - * 验证码字体 - */ - private String fontName; - /** - * 字体大小 - */ - private int fontSize = 25; - - public LoginCodeEnum getCodeType() { - return codeType; - } -} diff --git a/backend/src/main/java/com/yfd/platform/config/bean/LoginCodeEnum.java b/backend/src/main/java/com/yfd/platform/config/bean/LoginCodeEnum.java deleted file mode 100644 index d9ade21..0000000 --- a/backend/src/main/java/com/yfd/platform/config/bean/LoginCodeEnum.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2019-2020 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.config.bean; - -/** - * 验证码配置枚举 - * - * @author: liaojinlong - * @date: 2020/6/10 17:40 - */ - -public enum LoginCodeEnum { - /** - * 算数 - */ - arithmetic, - /** - * 中文 - */ - chinese, - /** - * 中文闪图 - */ - chinese_gif, - /** - * 闪图 - */ - gif, - spec -} diff --git a/backend/src/main/java/com/yfd/platform/config/bean/LoginProperties.java b/backend/src/main/java/com/yfd/platform/config/bean/LoginProperties.java deleted file mode 100644 index b16644d..0000000 --- a/backend/src/main/java/com/yfd/platform/config/bean/LoginProperties.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2019-2020 the original author or authors. - * - * Licensed under the Apache License, Version loginCode.length.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-loginCode.length.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.config.bean; - -import cn.hutool.core.util.StrUtil; -import com.wf.captcha.*; -import com.wf.captcha.base.Captcha; -import com.yfd.platform.exception.BadConfigurationException; -import lombok.Data; -import java.awt.*; -import java.util.Objects; - -/** - * 配置文件读取 - * - * @author liaojinlong - * @date loginCode.length0loginCode.length0/6/10 17:loginCode.length6 - */ -@Data -public class LoginProperties { - - /** - * 账号单用户 登录 - */ - private boolean singleLogin = false; - - private LoginCode loginCode; - /** - * 用户登录信息缓存 - */ - private boolean cacheEnable; - - public boolean isSingleLogin() { - return singleLogin; - } - - public boolean isCacheEnable() { - return cacheEnable; - } - - /** - * 获取验证码生产类 - * - * @return / - */ - public Captcha getCaptcha() { - if (Objects.isNull(loginCode)) { - loginCode = new LoginCode(); - if (Objects.isNull(loginCode.getCodeType())) { - loginCode.setCodeType(LoginCodeEnum.arithmetic); - } - } - return switchCaptcha(loginCode); - } - - /** - * 依据配置信息生产验证码 - * - * @param loginCode 验证码配置信息 - * @return / - */ - private Captcha switchCaptcha(LoginCode loginCode) { - Captcha captcha; - synchronized (this) { - switch (loginCode.getCodeType()) { - case arithmetic: - // 算术类型 https://gitee.com/whvse/EasyCaptcha - captcha = new ArithmeticCaptcha(loginCode.getWidth(), loginCode.getHeight()); - // 几位数运算,默认是两位 - captcha.setLen(loginCode.getLength()); - break; - case chinese: - captcha = new ChineseCaptcha(loginCode.getWidth(), loginCode.getHeight()); - captcha.setLen(loginCode.getLength()); - break; - case chinese_gif: - captcha = new ChineseGifCaptcha(loginCode.getWidth(), loginCode.getHeight()); - captcha.setLen(loginCode.getLength()); - break; - case gif: - captcha = new GifCaptcha(loginCode.getWidth(), loginCode.getHeight()); - captcha.setLen(loginCode.getLength()); - break; - case spec: - captcha = new SpecCaptcha(loginCode.getWidth(), loginCode.getHeight()); - captcha.setLen(loginCode.getLength()); - break; - default: - throw new BadConfigurationException("验证码配置信息错误!正确配置查看 LoginCodeEnum "); - } - } - if(StrUtil.isNotBlank(loginCode.getFontName())){ - captcha.setFont(new Font(loginCode.getFontName(), Font.PLAIN, loginCode.getFontSize())); - } - return captcha; - } -} diff --git a/backend/src/main/java/com/yfd/platform/config/thread/AsyncTaskExecutePool.java b/backend/src/main/java/com/yfd/platform/config/thread/AsyncTaskExecutePool.java deleted file mode 100644 index ff10654..0000000 --- a/backend/src/main/java/com/yfd/platform/config/thread/AsyncTaskExecutePool.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.config.thread; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.annotation.AsyncConfigurer; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; - -import java.util.concurrent.Executor; -import java.util.concurrent.ThreadPoolExecutor; - -/** - * 异步任务线程池装配类 - * @author https://juejin.im/entry/5abb8f6951882555677e9da2 - * @date 2019年10月31日15:06:18 - */ -@Slf4j -@Configuration -public class AsyncTaskExecutePool implements AsyncConfigurer { - - /** 注入配置类 */ - private final AsyncTaskProperties config; - - public AsyncTaskExecutePool(AsyncTaskProperties config) { - this.config = config; - } - - @Override - public Executor getAsyncExecutor() { - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - //核心线程池大小 - executor.setCorePoolSize(config.getCorePoolSize()); - //最大线程数 - executor.setMaxPoolSize(config.getMaxPoolSize()); - //队列容量 - executor.setQueueCapacity(config.getQueueCapacity()); - //活跃时间 - executor.setKeepAliveSeconds(config.getKeepAliveSeconds()); - //线程名字前缀 - executor.setThreadNamePrefix("el-async-"); - // setRejectedExecutionHandler:当pool已经达到max size的时候,如何处理新任务 - // CallerRunsPolicy:不在新线程中执行任务,而是由调用者所在的线程来执行 - executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); - executor.initialize(); - return executor; - } - - @Override - public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { - return (throwable, method, objects) -> { - log.error("===="+throwable.getMessage()+"====", throwable); - log.error("exception method:"+method.getName()); - }; - } -} diff --git a/backend/src/main/java/com/yfd/platform/config/thread/AsyncTaskProperties.java b/backend/src/main/java/com/yfd/platform/config/thread/AsyncTaskProperties.java deleted file mode 100644 index a5bc7d2..0000000 --- a/backend/src/main/java/com/yfd/platform/config/thread/AsyncTaskProperties.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.config.thread; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * 线程池配置属性类 - * @author https://juejin.im/entry/5abb8f6951882555677e9da2 - * @date 2019年10月31日14:58:18 - */ -@Data -@Component -@ConfigurationProperties(prefix = "task.pool") -public class AsyncTaskProperties { - - private int corePoolSize; - - private int maxPoolSize; - - private int keepAliveSeconds; - - private int queueCapacity; -} diff --git a/backend/src/main/java/com/yfd/platform/config/thread/TheadFactoryName.java b/backend/src/main/java/com/yfd/platform/config/thread/TheadFactoryName.java deleted file mode 100644 index 118faba..0000000 --- a/backend/src/main/java/com/yfd/platform/config/thread/TheadFactoryName.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.config.thread; - -import org.springframework.stereotype.Component; - -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * 自定义线程名称 - * @author - * @date 2019年10月31日17:49:55 - */ -@Component -public class TheadFactoryName implements ThreadFactory { - - private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1); - private final ThreadGroup group; - private final AtomicInteger threadNumber = new AtomicInteger(1); - private final String namePrefix; - - public TheadFactoryName() { - this("el-pool"); - } - - private TheadFactoryName(String name){ - // 使用当前线程的线程组,避免依赖已弃用的 SecurityManager - group = Thread.currentThread().getThreadGroup(); - //此时namePrefix就是 name + 第几个用这个工厂创建线程池的 - this.namePrefix = name + - POOL_NUMBER.getAndIncrement(); - } - - @Override - public Thread newThread(Runnable r) { - //此时线程的名字 就是 namePrefix + -thread- + 这个线程池中第几个执行的线程 - Thread t = new Thread(group, r, - namePrefix + "-thread-"+threadNumber.getAndIncrement(), - 0); - if (t.isDaemon()) { - t.setDaemon(false); - } - if (t.getPriority() != Thread.NORM_PRIORITY) { - t.setPriority(Thread.NORM_PRIORITY); - } - return t; - } -} diff --git a/backend/src/main/java/com/yfd/platform/config/thread/ThreadPoolExecutorUtil.java b/backend/src/main/java/com/yfd/platform/config/thread/ThreadPoolExecutorUtil.java deleted file mode 100644 index cb84cc4..0000000 --- a/backend/src/main/java/com/yfd/platform/config/thread/ThreadPoolExecutorUtil.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.config.thread; - - - -import com.yfd.platform.utils.SpringContextHolder; - -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -/** - * 用于获取自定义线程池 - * @author - * @date 2019年10月31日18:16:47 - */ -public class ThreadPoolExecutorUtil { - - public static ThreadPoolExecutor getPoll(){ - AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class); - return new ThreadPoolExecutor( - properties.getCorePoolSize(), - properties.getMaxPoolSize(), - properties.getKeepAliveSeconds(), - TimeUnit.SECONDS, - new ArrayBlockingQueue<>(properties.getQueueCapacity()), - new TheadFactoryName() - ); - } -} diff --git a/backend/src/main/java/com/yfd/platform/constant/Constant.java b/backend/src/main/java/com/yfd/platform/constant/Constant.java deleted file mode 100644 index c460999..0000000 --- a/backend/src/main/java/com/yfd/platform/constant/Constant.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.yfd.platform.constant; - -/** - * @author TangWei - * @Date: 2023/3/3 17:40 - * @Description: 常量类 - */ -public class Constant { - - public static final String LOGIN = "login:"; - public static final String TOKEN = "token:"; - public static final String USER_ID = "userid"; - public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; - - public static final String CODE_KEY = "code-key-"; - public static final long CODE_EXPIRATION_TIME = 1000 * 60; - /** - * 用于IP定位转换 - */ - public static final String REGION = "内网IP|内网IP"; - /** - * win 系统 - */ - public static final String WIN = "win"; - - /** - * mac 系统 - */ - public static final String MAC = "mac"; - - /** - * 常用接口 - */ - public static class Url { - - // IP归属地查询 - // public static final String IP_URL = "http://whois.pconline.com - // .cn/ipJson.jsp?ip=%s&json=true"; - public static final String IP_URL = "http://whois.pconline.com" + - ".cn/ipJson.jsp?ip=%s&json=true"; - } -} diff --git a/backend/src/main/java/com/yfd/platform/datasource/DataSource.java b/backend/src/main/java/com/yfd/platform/datasource/DataSource.java deleted file mode 100644 index 7c6d795..0000000 --- a/backend/src/main/java/com/yfd/platform/datasource/DataSource.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.yfd.platform.datasource; - -import java.lang.annotation.*; - -/****************************** - * 用途说明: - * 作者姓名: wxy - * 创建时间: 2022/9/23 17:48 - ******************************/ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface DataSource { - - String name() default ""; - -} diff --git a/backend/src/main/java/com/yfd/platform/datasource/DataSourceAspect.java b/backend/src/main/java/com/yfd/platform/datasource/DataSourceAspect.java deleted file mode 100644 index f20c0f8..0000000 --- a/backend/src/main/java/com/yfd/platform/datasource/DataSourceAspect.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.yfd.platform.datasource; - -import cn.hutool.core.util.StrUtil; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; -import org.aspectj.lang.reflect.MethodSignature; -import org.springframework.stereotype.Component; - -import java.lang.reflect.Method; - -/****************************** - * 用途说明: - * 作者姓名: wxy - * 创建时间: 2022/9/23 17:50 - ******************************/ -@Aspect -@Component -public class DataSourceAspect { - - @Pointcut("@annotation(com.yfd.platform.datasource.DataSource)") - public void dataSourcePointCut() { - - } - - private String DataBaseName; - - @Around("dataSourcePointCut()") - public Object around(ProceedingJoinPoint point) throws Throwable { - MethodSignature signature = (MethodSignature) point.getSignature(); - Method method = signature.getMethod(); - if (StrUtil.isNotBlank(DataBaseName)){ - DynamicDataSource.setDataSource(DataBaseName); - }else { - DynamicDataSource.setDataSource("master"); - } - - try { - return point.proceed(); - } finally { - DynamicDataSource.clearDataSource(); - } - } - - public String getDataBase(Integer type){ - if (type == 1){ - DataBaseName="master"; - }else { - DataBaseName="slave"; - } - return DataBaseName; - } - -} diff --git a/backend/src/main/java/com/yfd/platform/datasource/DynamicDataSource.java b/backend/src/main/java/com/yfd/platform/datasource/DynamicDataSource.java deleted file mode 100644 index 8b52521..0000000 --- a/backend/src/main/java/com/yfd/platform/datasource/DynamicDataSource.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.yfd.platform.datasource; - -import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; - -import javax.sql.DataSource; -import java.util.Map; - -/****************************** - * 用途说明: - * 作者姓名: wxy - * 创建时间: 2022/9/23 17:47 - ******************************/ -public class DynamicDataSource extends AbstractRoutingDataSource { - private static final ThreadLocal contextHolder = new ThreadLocal<>(); - - public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) { - super.setDefaultTargetDataSource(defaultTargetDataSource); - super.setTargetDataSources(targetDataSources); - super.afterPropertiesSet(); - } - - @Override - protected Object determineCurrentLookupKey() { - return getDataSource(); - } - - public static void setDataSource(String dataSource) { - contextHolder.set(dataSource); - } - - public static String getDataSource() { - return contextHolder.get(); - } - - public static void clearDataSource() { - contextHolder.remove(); - } - - -} diff --git a/backend/src/main/java/com/yfd/platform/datasource/DynamicDataSourceConfig.java b/backend/src/main/java/com/yfd/platform/datasource/DynamicDataSourceConfig.java deleted file mode 100644 index f559443..0000000 --- a/backend/src/main/java/com/yfd/platform/datasource/DynamicDataSourceConfig.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.yfd.platform.datasource; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; -import com.alibaba.druid.pool.DruidDataSource; - -import javax.sql.DataSource; -import java.util.HashMap; -import java.util.Map; - -/****************************** - * 用途说明: - * 作者姓名: wxy - * 创建时间: 2022/9/23 17:45 - ******************************/ -@Configuration -@Component -public class DynamicDataSourceConfig { - - @Bean - @ConfigurationProperties("spring.datasource.druid.master") - public DataSource wglMasterDataSource(){ - DruidDataSource dataSource = new DruidDataSource(); - dataSource.setBreakAfterAcquireFailure(true); - dataSource.setConnectionErrorRetryAttempts(0); - return dataSource; - } - - @Bean - @ConfigurationProperties("spring.datasource.druid.slave") - public DataSource wglSlaveDataSource(){ - DruidDataSource dataSource = new DruidDataSource(); - dataSource.setBreakAfterAcquireFailure(true); - dataSource.setConnectionErrorRetryAttempts(0); - return dataSource; - } - - @Bean - @Primary - public DynamicDataSource dataSource(DataSource wglMasterDataSource, DataSource wglSlaveDataSource) { - Map targetDataSources = new HashMap<>(); - targetDataSources.put("master",wglMasterDataSource); - targetDataSources.put("slave",wglSlaveDataSource); - return new DynamicDataSource(wglMasterDataSource, targetDataSources); - } - - -} diff --git a/backend/src/main/java/com/yfd/platform/exception/AccessDeniedHandExcetion.java b/backend/src/main/java/com/yfd/platform/exception/AccessDeniedHandExcetion.java deleted file mode 100644 index 0bb0ed3..0000000 --- a/backend/src/main/java/com/yfd/platform/exception/AccessDeniedHandExcetion.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.yfd.platform.exception; - -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.AccessDeniedException; -import org.springframework.security.web.access.AccessDeniedHandler; -import org.springframework.stereotype.Component; - -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; -@Component -public class AccessDeniedHandExcetion implements AccessDeniedHandler { - @Override - public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { - JSONObject jobj=new JSONObject(); - jobj.putOnce("status","403"); - jobj.putOnce("msg","用户权限不足,不能访问"); - response.setStatus(200); - response.setContentType("application/json"); - response.setCharacterEncoding("utf-8"); - response.getWriter().println(JSONUtil.toJsonStr(jobj)); - } -} diff --git a/backend/src/main/java/com/yfd/platform/exception/AuthenticationException.java b/backend/src/main/java/com/yfd/platform/exception/AuthenticationException.java deleted file mode 100644 index 15e8e97..0000000 --- a/backend/src/main/java/com/yfd/platform/exception/AuthenticationException.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.yfd.platform.exception; - -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import com.yfd.platform.config.ResponseResult; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.web.AuthenticationEntryPoint; -import org.springframework.stereotype.Component; - -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; -@Component -public class AuthenticationException implements AuthenticationEntryPoint { - @Override - public void commence(HttpServletRequest request, HttpServletResponse response, org.springframework.security.core.AuthenticationException authException) throws IOException, ServletException { - JSONObject jobj=new JSONObject(); - if(authException.getMessage().equals("用户账号不存在!")){ - jobj.putOnce("code","401"); - jobj.putOnce("msg","用户账号不存在/密码错误,登录失败!"); - }else{ - jobj.putOnce("code","401"); - jobj.putOnce("msg","用户Token失效,请重新登录!"); - } - response.setStatus(200); - response.setContentType("application/json"); - response.setCharacterEncoding("utf-8"); - response.getWriter().println(JSONUtil.toJsonStr(jobj)); - } -} diff --git a/backend/src/main/java/com/yfd/platform/exception/BadConfigurationException.java b/backend/src/main/java/com/yfd/platform/exception/BadConfigurationException.java deleted file mode 100644 index 92ffac0..0000000 --- a/backend/src/main/java/com/yfd/platform/exception/BadConfigurationException.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2019-2020 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.exception; - -/** - * 统一关于错误配置信息 异常 - * - * @author: liaojinlong - * @date: 2020/6/10 18:06 - */ -public class BadConfigurationException extends RuntimeException { - /** - * Constructs a new runtime exception with {@code null} as its - * detail message. The cause is not initialized, and may subsequently be - * initialized by a call to {@link #initCause}. - */ - public BadConfigurationException() { - super(); - } - - /** - * Constructs a new runtime exception with the specified detail message. - * The cause is not initialized, and may subsequently be initialized by a - * call to {@link #initCause}. - * - * @param message the detail message. The detail message is saved for - * later retrieval by the {@link #getMessage()} method. - */ - public BadConfigurationException(String message) { - super(message); - } - - /** - * Constructs a new runtime exception with the specified detail message and - * cause.

Note that the detail message associated with - * {@code cause} is not automatically incorporated in - * this runtime exception's detail message. - * - * @param message the detail message (which is saved for later retrieval - * by the {@link #getMessage()} method). - * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A {@code null} value is - * permitted, and indicates that the cause is nonexistent or - * unknown.) - * @since 1.4 - */ - public BadConfigurationException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Constructs a new runtime exception with the specified cause and a - * detail message of {@code (cause==null ? null : cause.toString())} - * (which typically contains the class and detail message of - * {@code cause}). This constructor is useful for runtime exceptions - * that are little more than wrappers for other throwables. - * - * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A {@code null} value is - * permitted, and indicates that the cause is nonexistent or - * unknown.) - * @since 1.4 - */ - public BadConfigurationException(Throwable cause) { - super(cause); - } - - /** - * Constructs a new runtime exception with the specified detail - * message, cause, suppression enabled or disabled, and writable - * stack trace enabled or disabled. - * - * @param message the detail message. - * @param cause the cause. (A {@code null} value is permitted, - * and indicates that the cause is nonexistent or unknown.) - * @param enableSuppression whether or not suppression is enabled - * or disabled - * @param writableStackTrace whether or not the stack trace should - * be writable - * @since 1.7 - */ - protected BadConfigurationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } -} diff --git a/backend/src/main/java/com/yfd/platform/exception/BadRequestException.java b/backend/src/main/java/com/yfd/platform/exception/BadRequestException.java deleted file mode 100644 index f2202ec..0000000 --- a/backend/src/main/java/com/yfd/platform/exception/BadRequestException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.exception; - -import lombok.Getter; -import org.springframework.http.HttpStatus; - -import static org.springframework.http.HttpStatus.BAD_REQUEST; - -/** - * @author - * @date 2018-11-23 - * 统一异常处理 - */ -@Getter -public class BadRequestException extends RuntimeException{ - - private Integer status = BAD_REQUEST.value(); - - public BadRequestException(String msg){ - super(msg); - } - - public BadRequestException(HttpStatus status, String msg){ - super(msg); - this.status = status.value(); - } -} diff --git a/backend/src/main/java/com/yfd/platform/exception/ChildrenExistException.java b/backend/src/main/java/com/yfd/platform/exception/ChildrenExistException.java deleted file mode 100644 index 18eca34..0000000 --- a/backend/src/main/java/com/yfd/platform/exception/ChildrenExistException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.yfd.platform.exception; - -import org.springframework.util.StringUtils; - -/** - * @Author pcj - * @Date 2021/1/26 9:07 - * @Version 1.0 - */ -public class ChildrenExistException extends RuntimeException{ - - public ChildrenExistException(Class clazz, String field, String val) { - super(ChildrenExistException.generateMessage(clazz.getSimpleName(), field, val)); - } - - private static String generateMessage(String entity, String field, String val) { - return StringUtils.capitalize(entity) - + " with " + field + " "+ val + " Children Exist"; - } -} diff --git a/backend/src/main/java/com/yfd/platform/exception/EntityExistException.java b/backend/src/main/java/com/yfd/platform/exception/EntityExistException.java deleted file mode 100644 index 028aeed..0000000 --- a/backend/src/main/java/com/yfd/platform/exception/EntityExistException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.exception; - -import org.springframework.util.StringUtils; - -/** - * @author - * @date 2018-11-23 - */ -public class EntityExistException extends RuntimeException { - - public EntityExistException(Class clazz, String field, String val) { - super(EntityExistException.generateMessage(clazz.getSimpleName(), field, val)); - } - - private static String generateMessage(String entity, String field, String val) { - return StringUtils.capitalize(entity) - + " with " + field + " "+ val + " existed"; - } -} \ No newline at end of file diff --git a/backend/src/main/java/com/yfd/platform/exception/EntityNotFoundException.java b/backend/src/main/java/com/yfd/platform/exception/EntityNotFoundException.java deleted file mode 100644 index 8f5e1c5..0000000 --- a/backend/src/main/java/com/yfd/platform/exception/EntityNotFoundException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.exception; - -import org.springframework.util.StringUtils; - -/** - * @author - * @date 2018-11-23 - */ -public class EntityNotFoundException extends RuntimeException { - - public EntityNotFoundException(Class clazz, String field, String val) { - super(EntityNotFoundException.generateMessage(clazz.getSimpleName(), field, val)); - } - - private static String generateMessage(String entity, String field, String val) { - return StringUtils.capitalize(entity) - + " with " + field + " "+ val + " does not exist"; - } -} \ No newline at end of file diff --git a/backend/src/main/java/com/yfd/platform/system/controller/DataSourceController.java b/backend/src/main/java/com/yfd/platform/system/controller/DataSourceController.java deleted file mode 100644 index b34b37c..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/DataSourceController.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.yfd.platform.system.controller; - -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.datasource.DataSource; -import com.yfd.platform.datasource.DataSourceAspect; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import jakarta.annotation.Resource; - -/** - * @author zhengsl - * @since 2022-09-20 - */ -@RestController -@RequestMapping("/system") -@Tag(name = "切换数据库") -public class DataSourceController { - - @Resource - DataSourceAspect dataSourceAspect; - - /** - * 切换数据库 - * - * @DataSource(name="master") 可以通过注解方式切换数据库 - */ - @GetMapping("/changeDataSource") - @Operation(summary = "切换数据库") - public ResponseResult changeDataSource(Integer type) { - if (type == null) { - return ResponseResult.error("参数为空"); - } - String dataBase = dataSourceAspect.getDataBase(type); - String mess = "已切换为" + dataBase + "数据库"; - return ResponseResult.success(mess); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/LoginController.java b/backend/src/main/java/com/yfd/platform/system/controller/LoginController.java deleted file mode 100644 index ac08378..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/LoginController.java +++ /dev/null @@ -1,238 +0,0 @@ -package com.yfd.platform.system.controller; - -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONUtil; -import cn.hutool.jwt.JWTUtil; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; -import com.wf.captcha.base.Captcha; -import com.yfd.platform.annotation.Log; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.config.WebConfig; -import com.yfd.platform.config.bean.LoginCodeEnum; -import com.yfd.platform.config.bean.LoginProperties; -import com.yfd.platform.constant.Constant; -import com.yfd.platform.system.domain.LoginUser; -import com.yfd.platform.system.domain.SysLog; -import com.yfd.platform.system.domain.SysUser; -import com.yfd.platform.system.service.ISysLogService; -import com.yfd.platform.system.service.IUserService; -import com.yfd.platform.utils.RequestHolder; -import com.yfd.platform.utils.RsaUtils; -import com.yfd.platform.utils.StringUtils; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.web.bind.annotation.*; - -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; -import java.sql.Timestamp; -import java.util.HashMap; -import java.util.Map; - -/** - * @author TangWei - */ -@RestController -@RequestMapping("/user") -@Tag(name = "用户登录") -public class LoginController { - - @Autowired - private AuthenticationManager authenticationManager; - - @Autowired - private WebConfig webConfig; - - @Resource - private IUserService userService; - - @Value("${rsa.private_key}") - private String privateKey; - - @Resource - private ISysLogService sysLogService; - - @Resource - private LoginProperties loginProperties; - - @PostMapping("/login") - @Operation(summary = "登录用户") - @ResponseBody - public ResponseResult login(SysUser user) throws Exception { - // 密码解密 - String password = RsaUtils.decryptByPrivateKey(privateKey, - user.getPassword()); - - // 是否需要验证码不需要改成false - boolean hascode = true; - if (hascode) { - // 查询验证码 - String code = webConfig.loginuserCache().get(user.getUuid()); - // 清除验证码 - webConfig.loginuserCache().remove(user.getUuid()); - if (StrUtil.isBlank(code)) { - return ResponseResult.error("验证码不存在或已过期"); - } - if (StrUtil.isBlank(user.getCode()) || !user.getCode().equalsIgnoreCase(code)) { - return ResponseResult.error("验证码错误"); - } - } - //如果认证通过了,使用userId生成token token存入ResponseResult返回 - UsernamePasswordAuthenticationToken authenticationToken = - new UsernamePasswordAuthenticationToken(user.getUsername(), - password); - Authentication authenticate = - authenticationManager.authenticate(authenticationToken); - if (ObjectUtil.isNull(authenticate)) { - return ResponseResult.unlogin(); - } - LoginUser loginUser = (LoginUser) authenticate.getPrincipal(); - Integer status = loginUser.getUser().getStatus(); - if ("0".equals(status.toString())) { - return ResponseResult.error("账号已停用"); - } - HttpServletRequest request = RequestHolder.getHttpServletRequest(); - SysLog sysLog = new SysLog(); - sysLog.setUsercode(user.getUsername()); - sysLog.setUsername(loginUser.getUser().getNickname()); - sysLog.setRequestip(StringUtils.getIp(request)); - sysLog.setBrowser(StringUtils.getBrowser(request)); - sysLog.setOpttype("登录(login)"); - sysLog.setModule("用户登录"); - String className = this.getClass().getName(); - String method = - Thread.currentThread().getStackTrace()[1].getMethodName(); - sysLog.setMethod(className + "." + method + "()"); - //sysLog.setParams(user.toString()); - sysLog.setDescription(loginUser.getUser().getNickname() + "登录系统!"); - sysLog.setLogtime(new Timestamp(System.currentTimeMillis())); - sysLogService.save(sysLog); - String userId = loginUser.getUser().getId(); - Map map = new HashMap(10) { - private static final long serialVersionUID = 1L; - - { - put("userid", userId); - put("username", loginUser.getUsername()); - long expireTime = - System.currentTimeMillis() + (long) (30L * 24L * 60L * 60L * 1000L); - put("expire_time", expireTime);//个月过期 - } - }; - - String token = JWTUtil.createToken(map, "12345678".getBytes()); - map.put("token", token); - //把完整的用户信息存入到HuTool缓存中,userId作为key - String jsonStr = JSONUtil.toJsonStr(loginUser); - webConfig.loginuserCache().put("login:" + userId, jsonStr); - webConfig.loginuserCache().put("expire_time:" + userId, map.get("expire_time").toString()); - return ResponseResult.successData(map); - } - - @Operation(summary = "获取验证码") - @GetMapping(value = "/code") - public ResponseResult getCode() { - // 获取运算的结果 - Captcha captcha = loginProperties.getCaptcha(); - String uuid = Constant.CODE_KEY + IdUtil.simpleUUID(); - //当验证码类型为 arithmetic时且长度 >= 2 时,captcha.text()的结果有几率为浮点型 - String captchaValue = captcha.text(); - if (captcha.getCharType() - 1 == LoginCodeEnum.arithmetic.ordinal() && captchaValue.contains(".")) { - captchaValue = captchaValue.split("\\.")[0]; - } - // 保存 - //redisUtils.set(uuid, captchaValue, loginProperties.getLoginCode() - // .getExpiration(), TimeUnit.MINUTES); - // 将验证码放入缓存,设置失效时间为60秒 - webConfig.loginuserCache().put(uuid, captchaValue, - Constant.CODE_EXPIRATION_TIME); - // 验证码信息 - Map imgResult = new HashMap(2) {{ - put("img", captcha.toBase64()); - put("uuid", uuid); - }}; - return ResponseResult.successData(imgResult); - } - - @PostMapping("/logout") - @Operation(summary = "退出登录") - @ResponseBody - public ResponseResult logout() { - //获取SecurityContextHolder中的用户id - UsernamePasswordAuthenticationToken authentication = - (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); - LoginUser loginuser = (LoginUser) authentication.getPrincipal(); - String userId = loginuser.getUser().getId(); - //删除redis中的登陆用户信息 - webConfig.loginuserCache().remove("login:" + userId); - //记录退出日志 - HttpServletRequest request = RequestHolder.getHttpServletRequest(); - SysLog sysLog = new SysLog(); - sysLog.setUsercode(loginuser.getUsername()); - sysLog.setUsername(loginuser.getUser().getNickname()); - sysLog.setRequestip(StringUtils.getIp(request)); - sysLog.setBrowser(StringUtils.getBrowser(request)); - sysLog.setOpttype("其他(other)"); - sysLog.setModule("注销退出"); - sysLog.setDescription("注销退出系统!"); - sysLog.setLogtime(new Timestamp(System.currentTimeMillis())); - sysLogService.save(sysLog); - return ResponseResult.success(); - } - - @Log(module = "用户登录", value = "更改用户密码") - @GetMapping("/updatePassword") - @Operation(summary = "更改用户密码") - @ResponseBody - public ResponseResult updatePassword(@RequestBody SysUser user) throws Exception { - // 密码解密 - String password = RsaUtils.decryptByPrivateKey(privateKey, - user.getPassword()); - BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); - String cryptPassword = passwordEncoder.encode(password); - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.set("password", cryptPassword); - updateWrapper.eq("id", user.getId()); - userService.update(updateWrapper); - return ResponseResult.success(); - } - - @GetMapping("/me") - @Operation(summary = "查询当前用户信息") - @ResponseBody - public ResponseResult getUserInfo() { - ResponseResult responseResult = userService.getLoginUserInfo(); - return ResponseResult.successData(responseResult); - } - - @Log(module = "用户登录", value = "修改个人信息") - @PostMapping("/updatePersonalInfo") - @Operation(summary = "修改个人信息") - @ResponseBody - public ResponseResult updateUser(@org.springframework.web.bind.annotation.RequestBody SysUser user) { - if (StrUtil.isEmpty(user.getId())) { - return ResponseResult.error("没有用户ID"); - } - //填写 当前用户名称 - user.setLastmodifier(userService.getUsername()); - //填写 当前日期 - user.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - boolean ok = userService.updateById(user); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/MessageController.java b/backend/src/main/java/com/yfd/platform/system/controller/MessageController.java deleted file mode 100644 index 58f61ba..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/MessageController.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.yfd.platform.system.controller; - -import cn.hutool.core.date.DateTime; -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yfd.platform.annotation.Log; -import com.yfd.platform.config.MessageConfig; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.config.WebConfig; -import com.yfd.platform.system.domain.Message; -import com.yfd.platform.system.service.IMessageService; -import com.yfd.platform.system.service.IUserService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; - -import jakarta.annotation.Resource; -import java.sql.Timestamp; -import java.util.*; - -/** - *

- * 消息通知 前端控制器 - *

- * - * @author TangWei - * @since 2023-03-19 - */ -@RestController -@RequestMapping("/system/message") -@Tag(name = "消息通知") -public class MessageController { - - @Resource - private IMessageService messageService; - - @Resource - private MessageConfig messageConfig; - - @Operation(summary = "查询消息") - @GetMapping("/getMessageList") - public ResponseResult getMessageList(Page page, - String status, String title, - String type, String startDate, - String endDate) { - if (StrUtil.isBlank(status)) { - return ResponseResult.error("参数为空"); - } - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if ("0".equals(status)) { - queryWrapper.eq(Message::getStatus, "1"); - } else { - List statusList = new ArrayList<>(); - statusList.add("2"); - statusList.add("9"); - queryWrapper.in(Message::getStatus, statusList); - - if (StrUtil.isNotBlank(title)) { - queryWrapper.like(Message::getTitle, title); - } - - if (StrUtil.isNotBlank(type)) { - queryWrapper.eq(Message::getType, type); - } - - DateTime parseStartDate = DateUtil.parse(startDate); - DateTime parseEndDate = DateUtil.parse(endDate); - DateTime dateTime = DateUtil.offsetDay(parseEndDate, 1); - - if (parseStartDate != null && parseEndDate != null) { - queryWrapper.ge(Message::getCreatetime, parseStartDate).lt(Message::getCreatetime, dateTime); - } - } - queryWrapper.orderByDesc(Message::getCreatetime); - Page pageList = messageService.page(page, queryWrapper); - return ResponseResult.successData(pageList); - } - - @Operation(summary = "根据ID查询消息") - @GetMapping("/getMessageById") - public ResponseResult getMessageById(String id) { - if (StrUtil.isBlank(id)) { - return ResponseResult.error("参数为空"); - } - Message message = messageService.getById(id); - Map map = new HashMap<>(); - map.put("title", message.getTitle()); - map.put("content", message.getContent()); - map.put("createtime", message.getCreatetime()); - return ResponseResult.successData(map); - } - - @Log(module = "消息通知",value = "根据ID删除消息") - @Operation(summary = "根据ID删除消息") - @PostMapping("/deleteMessageById") - public ResponseResult deleteMessageById(@RequestParam String id) { - if (StrUtil.isBlank(id)) { - return ResponseResult.error("参数为空"); - } - String[] split = id.split(","); - List idList = Arrays.asList(split); - boolean ok = messageService.removeByIds(idList); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error("删除失败"); - } - - } - - @Log(module = "消息通知", value = "将消息标记为已阅状态") - @Operation(summary = "标记已阅") - @PostMapping("/setMessageStatus") - public ResponseResult setMessageStatus(@RequestParam String id) { - if (StrUtil.isBlank(id)) { - return ResponseResult.error("参数为空"); - } - String[] split = id.split(","); - long time = System.currentTimeMillis(); - for (String mid : split) { - Message message = messageService.getById(mid); - if ("9".equals(message.getStatus())) { - continue; - } - message.setStatus("2"); - message.setReadtime(new Timestamp(time)); - messageService.updateById(message); - } - messageConfig.sendMessage(); - return ResponseResult.success(); - } - - @Operation(summary = "全部已阅") - @PostMapping("/setAllMessageStatus") - public ResponseResult setAllMessageStatus() { - long time = System.currentTimeMillis(); - List list = - messageService.list(new LambdaQueryWrapper().eq(Message::getStatus, "1")); - for (Message message : list) { - message.setStatus("2"); - message.setReadtime(new Timestamp(time)); - messageService.updateById(message); - } - messageConfig.sendMessage(); - return ResponseResult.success(); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/QuartzJobController.java b/backend/src/main/java/com/yfd/platform/system/controller/QuartzJobController.java deleted file mode 100644 index 9da6c89..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/QuartzJobController.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.yfd.platform.system.controller; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yfd.platform.annotation.Log; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.QuartzJob; -import com.yfd.platform.system.service.IQuartzJobService; -import com.yfd.platform.system.service.impl.UserServiceImpl; -import com.yfd.platform.utils.QuartzManage; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.quartz.CronExpression; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; - -import jakarta.annotation.Resource; -import java.sql.Timestamp; -import java.time.LocalDateTime; - -/** - *

- * 定时任务 前端控制器 - *

- * - * @author TangWei - * @since 2023-03-19 - */ -@RestController -@RequestMapping("/system/quartzjob") -@Tag(name = "定时任务") -@Transactional -public class QuartzJobController { - - @Resource - private IQuartzJobService quartzJobService; - - @Resource - private UserServiceImpl currentUser; - - @Resource - private QuartzManage quartzManage; - - @Operation(summary = "查询定时任务") - @GetMapping("/getQuartzJobList") - public ResponseResult getQuartzJobList(Page page, - String jobName) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if (StrUtil.isNotBlank(jobName)) { - queryWrapper.like(QuartzJob::getJobName, jobName); - } - queryWrapper.orderByAsc(QuartzJob::getOrderno); - Page pageList = quartzJobService.page(page, queryWrapper); - return ResponseResult.successData(pageList); - } - - @Log(module = "定时任务管理", value = "新增定时任务") - @Operation(summary = "新增定时任务") - @PostMapping("/addQuartzJob") - public ResponseResult addQuartzJob(@RequestBody QuartzJob quartzJob) { - if (quartzJob == null) { - return ResponseResult.error("参数为空"); - } - // 添加最近修改人 - quartzJob.setLastmodifier(currentUser.getUsername()); - // 添加最近修改时间 - quartzJob.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - if (StrUtil.isBlank(quartzJob.getJobCron()) || !CronExpression.isValidExpression(quartzJob.getJobCron())) { - return ResponseResult.error("cron表达式格式错误"); - } - quartzJob.setStatus("0"); - boolean ok = quartzJobService.addQuartzJob(quartzJob); - quartzManage.addJob(quartzJob); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error("新增失败"); - } - } - - @Log(module = "定时任务管理", value = "设置定时任务是否有效") - @Operation(summary = "设置定时任务是否有效") - @PostMapping("/setQuartzStatus") - public ResponseResult setQuartzStatus(@RequestParam String id, - @RequestParam String status) { - if (StrUtil.isBlank(id) || StrUtil.isBlank(status)) { - return ResponseResult.error("参数为空"); - } - LambdaUpdateWrapper updateWrapper = - new LambdaUpdateWrapper<>(); - //根据id 更新状态,最近修改人,最近修改时间 - updateWrapper.eq(QuartzJob::getId, id).set(QuartzJob::getStatus, - status).set( - QuartzJob::getLastmodifier, currentUser.getUsername()).set(QuartzJob::getLastmodifydate, - LocalDateTime.now()); - boolean ok = quartzJobService.update(updateWrapper); - QuartzJob quartzJob = quartzJobService.getById(id); - if ("0".equals(quartzJob.getStatus())) { - quartzManage.pauseJob(quartzJob); - } else { - quartzManage.resumeJob(quartzJob); - } - - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - @Operation(summary = "根据ID查询定时任务") - @GetMapping("/getQuartzJobById") - public ResponseResult getQuartzJobById(String id) { - QuartzJob quartzJob = quartzJobService.getById(id); - return ResponseResult.successData(quartzJob); - } - - @Log(module = "定时任务管理", value = "修改定时任务") - @Operation(summary = "修改定时任务") - @PostMapping("/updateQuartzJob") - @Transactional(rollbackFor = Exception.class) - public ResponseResult updateQuartzJob(@RequestBody QuartzJob quartzJob) { - // 添加最近修改人 - quartzJob.setLastmodifier(currentUser.getUsername()); - // 添加最近修改时间 - quartzJob.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - if (StrUtil.isBlank(quartzJob.getJobCron()) || !CronExpression.isValidExpression(quartzJob.getJobCron())) { - return ResponseResult.error("cron表达式格式错误"); - } - boolean ok = quartzJobService.updateById(quartzJob); - quartzManage.updateJobCron(quartzJob); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error("修改失败"); - } - } - - @Log(module = "定时任务管理", value = "删除定时任务") - @Operation(summary = "删除定时任务") - @PostMapping("/deleteQuartzJob") - public ResponseResult deleteQuartzJob(@RequestParam String id) { - if (StrUtil.isBlank(id)) { - return ResponseResult.error("参数为空"); - } - boolean ok = quartzJobService.deleteQuartzJob(id); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error("删除失败"); - } - } - - @Log(module = "定时任务管理", value = "执行定时任务") - @Operation(summary = "执行定时任务") - @PostMapping("/execution") - public ResponseResult execution(@RequestParam String id) { - quartzJobService.execution(quartzJobService.getById(id)); - return ResponseResult.success(); - } - - /********************************** - * 用途说明: 拖动修改定时顺序 - * 参数说明 fromID 当前ID toID 到达ID - * 返回值说明: com.yfd.platform.config.ResponseResult 成功或者失败 - ***********************************/ - @Log(module = "定时任务管理", value = "拖动定时任务") - @PostMapping("/changeDictOrder") - @Operation(summary = "拖动修改定时任务顺序") - public ResponseResult changeQuartzOrder(@RequestParam String fromID, - @RequestParam String toID) { - - boolean ok = quartzJobService.changeDictOrder(fromID, toID); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - - } -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/SSEController.java b/backend/src/main/java/com/yfd/platform/system/controller/SSEController.java deleted file mode 100644 index 41adfbb..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/SSEController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.yfd.platform.system.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.yfd.platform.component.ServerSendEventServer; -import com.yfd.platform.config.WebConfig; -import com.yfd.platform.constant.Constant; -import com.yfd.platform.system.domain.Message; -import com.yfd.platform.system.service.IMessageService; -import com.yfd.platform.system.service.IUserService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; - -import jakarta.annotation.Resource; - -/** - * @author Huhailong - */ -@Slf4j -@RestController -@CrossOrigin -@RequestMapping("/sse") -@Tag(name = "SSE推送服务") -public class SSEController { - - @Resource - private IMessageService messageService; - - @GetMapping("/connect/{token}") - @Operation(summary = "建立连接") - public SseEmitter connect(@PathVariable String token) { - SseEmitter connect = ServerSendEventServer.connect(token); - long count = - messageService.count(new LambdaQueryWrapper().eq(Message::getStatus, "1")); - ServerSendEventServer.sendMessage(token, count + ""); - return connect; - } - - @GetMapping("/sendmsg") - @Operation(summary = "发送消息") - public void sendMessage(String token, String message) throws InterruptedException { - - ServerSendEventServer.sendMessage(token, message); - } - - @GetMapping("/sendgroupmsg") - @Operation(summary = "多人发送消息") - public void sendgroupmsg(String groupid, String message) throws InterruptedException { - ServerSendEventServer.groupSendMessage(groupid, message); - } - - @GetMapping("/disconnect/{token}") - @Operation(summary = "关闭连接") - public void disconnect(@PathVariable String token) throws InterruptedException { - ServerSendEventServer.removeUser(token); - } -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/SysConfigController.java b/backend/src/main/java/com/yfd/platform/system/controller/SysConfigController.java deleted file mode 100644 index 3cfa7cc..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/SysConfigController.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.yfd.platform.system.controller; - - -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.SysConfig; -import com.yfd.platform.system.service.ISysConfigService; -import com.yfd.platform.system.service.IUserService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; - -import jakarta.annotation.Resource; -import javax.sound.sampled.UnsupportedAudioFileException; -import java.io.IOException; -import java.sql.Timestamp; - - -/** - *

- * 系统全局配置 前端控制器 - *

- * - * @author zhengsl - * @since 2022-01-19 - */ -@RestController - @RequestMapping("/system/config") -@Tag(name = "系统全局配置") -public class SysConfigController { - @Resource - private ISysConfigService configService; - - @Resource - private IUserService userService; - - @PostMapping("/getOneById") - @Operation(summary = "根据id查询全局配置详情记录") - @ResponseBody - public SysConfig getOneById(String id){ - return configService.getById(id); - } - - @PostMapping("/addConfig") - @Operation(summary = "根据id查询全局配置详情记录") - @ResponseBody - public ResponseResult addConfig(@RequestBody SysConfig config ) throws IOException, UnsupportedAudioFileException { - if (StrUtil.isEmpty(config.getId())){ - config.setId(IdUtil.fastSimpleUUID()); } - config.setLastmodifier(userService.getUsername()); - config.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - boolean ok=configService.save(config); - return ResponseResult.success(); - } - - @PostMapping("/updateById") - @Operation(summary = "根据id修改全局配置记录") - @ResponseBody - public ResponseResult updateById(@RequestBody SysConfig config) throws IOException, UnsupportedAudioFileException { - config.setLastmodifier(userService.getUsername()); - config.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - boolean ok=configService.updateById(config); - return ResponseResult.success(); - } - - -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/SysDictionaryController.java b/backend/src/main/java/com/yfd/platform/system/controller/SysDictionaryController.java deleted file mode 100644 index 70a5fdf..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/SysDictionaryController.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.yfd.platform.system.controller; - -import cn.hutool.core.util.StrUtil; -import com.yfd.platform.annotation.Log; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.SysDictionary; -import com.yfd.platform.system.mapper.SysDictionaryItemsMapper; -import com.yfd.platform.system.service.ISysDictionaryService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.*; - -import jakarta.annotation.Resource; -import java.util.List; -import java.util.Objects; - -/** - *

- * 数据字典表 前端控制器 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -@RestController -@RequestMapping("/system/dictionary") -@Tag(name = "数据字典") -public class SysDictionaryController { - - @Resource - private ISysDictionaryService sysDictionaryService; - - /********************************** - * 用途说明: 获取数据字典列表 - * 参数说明 dictType 字典类型 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果 - ***********************************/ - @GetMapping("/dictList") - @Operation(summary = "获取数据字典列表") - public ResponseResult getDictList(String dictType) { - if (StrUtil.isBlank(dictType)) { - return ResponseResult.error("参数为空"); - } - List sysDictionaries = - sysDictionaryService.getDictList(dictType); - return ResponseResult.successData(sysDictionaries); - } - - /********************************** - * 用途说明: 根据ID删除字典 - * 参数说明 id 字典ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回删除结果成功或者失败 - ***********************************/ - @Log(module = "数据字典", value = "根据ID删除字典") - @PostMapping("/deleteById") - @Operation(summary = "根据ID删除字典") - public ResponseResult deleteDictById(@RequestParam String id) { - boolean ok = sysDictionaryService.deleteDictById(id); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /********************************** - * 用途说明: 新增字典 - * 参数说明 sysDictionary 字典对象 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回增加成功或者失败 - ***********************************/ - @Log(module = "数据字典", value = "新增数据字典") - @PostMapping("/addDict") - @Operation(summary = "新增字典") - public ResponseResult addDict(@RequestBody SysDictionary sysDictionary) { - if (sysDictionary == null) { - return ResponseResult.error("参数为空"); - } - boolean ok = sysDictionaryService.addDict(sysDictionary); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /********************************** - * 用途说明: 修改字典 - * 参数说明 sysDictionary 字典对象 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回修改成功或者失败 - ***********************************/ - @Log(module = "数据字典", value = "修改数据字典") - @PostMapping("/updateDict") - @Operation(summary = "修改字典") - public ResponseResult updateDict(@RequestBody SysDictionary sysDictionary) { - if (sysDictionary == null) { - return ResponseResult.error("参数为空"); - } - boolean ok = sysDictionaryService.updateById(sysDictionary); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /********************************** - * 用途说明: 根据ID查询字典 - * 参数说明 sysDictionary 字典对象 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回查询结果 - ***********************************/ - @PostMapping("/getDictById") - @Operation(summary = "根据ID查询字典") - public ResponseResult getDictById(String id) { - if (StrUtil.isBlank(id)) { - return ResponseResult.error("参数为空"); - } - SysDictionary sysDictionary = sysDictionaryService.getById(id); - return ResponseResult.successData(sysDictionary); - } - - /********************************** - * 用途说明: 拖动修改字典顺序 - * 参数说明 fromID 当前ID toID 到达ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回拖动成功或者失败 - ***********************************/ - @Log(module = "数据字典", value = "拖动修改字典顺序") - @PostMapping("/changeDictOrder") - @Operation(summary = "拖动修改字典顺序") - public ResponseResult changeDictOrder(@RequestParam String fromID, - @RequestParam String toID) { - - boolean ok = sysDictionaryService.changeDictOrder(fromID, toID); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/SysDictionaryItemsController.java b/backend/src/main/java/com/yfd/platform/system/controller/SysDictionaryItemsController.java deleted file mode 100644 index bf85d30..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/SysDictionaryItemsController.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.yfd.platform.system.controller; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yfd.platform.annotation.Log; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.SysDictionaryItems; -import com.yfd.platform.system.mapper.SysDictionaryItemsMapper; -import com.yfd.platform.system.service.ISysDictionaryItemsService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; - -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletResponse; -import java.util.Arrays; -import java.util.List; - -/** - *

- * 数据字典明细 前端控制器 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -@RestController -@RequestMapping("/system/dictionaryItems") -@Tag(name = "数据字典项") -public class SysDictionaryItemsController { - - @Resource - private ISysDictionaryItemsService sysDictionaryItemsService; - - /********************************** - * 用途说明: 分页查询字典项信息 - * 参数说明 dictID 字典ID ItemName 字典项名称 pageNum 当前页 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果 - ***********************************/ - @GetMapping("/page") - @Operation(summary = "分页查询字典项信息") - public ResponseResult getDictItemPage(String dictId, String dictName, - Page page) { - - LambdaQueryWrapper queryWrapper = - new LambdaQueryWrapper<>(); - queryWrapper.eq(SysDictionaryItems::getDictId, dictId).orderByAsc(SysDictionaryItems::getOrderNo); - - // 查询前将序号初始化 - List list = - sysDictionaryItemsService.list(queryWrapper); - for (int i = 0; i < list.size(); i++) { - SysDictionaryItems sysDictionaryItems = list.get(i); - sysDictionaryItems.setOrderNo(i + 1); - sysDictionaryItemsService.updateById(sysDictionaryItems); - } - Page sysDictionaryItemsPage = - sysDictionaryItemsService.getDictItemPage(dictId, dictName, - page); - - return ResponseResult.successData(sysDictionaryItemsPage); - } - - /********************************** - * 用途说明: 增加字典项 - * 参数说明 sysDictionaryItems 字典项信息 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回增加成功或者失败 - ***********************************/ - @Log(module = "数据字典项", value = "增加字典项") - @PostMapping("/addDictionaryItem") - @Operation(summary = "增加字典项") - public ResponseResult addDictionaryItem(@RequestBody SysDictionaryItems sysDictionaryItems) { - if (sysDictionaryItems == null) { - return ResponseResult.error("参数为空"); - } - boolean ok = - sysDictionaryItemsService.addDictionaryItem(sysDictionaryItems); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /********************************** - * 用途说明: 修改字典项 - * 参数说明 sysDictionaryItems 字典项信息 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回修改成功或者失败 - ***********************************/ - @Log(module = "数据字典项", value = "修改字典项") - @PostMapping("/updateDictionaryItem") - @Operation(summary = "修改字典项") - public ResponseResult updateDictionaryItem(@RequestBody SysDictionaryItems sysDictionaryItems) { - if (sysDictionaryItems == null) { - return ResponseResult.error("参数为空"); - } - boolean ok = - sysDictionaryItemsService.updateById(sysDictionaryItems); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /********************************** - * 用途说明: 根据ID查询字典项 - * 参数说明 id 字典项ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回字典项信息 - ***********************************/ - @GetMapping("/getDictItemById") - @Operation(summary = "根据ID查询字典项") - public ResponseResult getDictItemById(String id) { - if (StrUtil.isBlank(id)) { - return ResponseResult.error("参数为空"); - } - SysDictionaryItems sysDictionaryItems = - sysDictionaryItemsService.getById(id); - return ResponseResult.successData(sysDictionaryItems); - } - - /********************************** - * 用途说明: 根据ID删除字典项 - * 参数说明 id 字典项ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回删除成功或者失败 - ***********************************/ - @Log(module = "数据字典项", value = "根据ID删除字典项") - @PostMapping("/deleteDictItemById") - @Operation(summary = "根据ID删除字典项") - public ResponseResult deleteDictItemById(@RequestParam String id) { - if (StrUtil.isBlank(id)) { - return ResponseResult.error("参数为空"); - } - boolean ok = sysDictionaryItemsService.removeById(id); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /********************************** - * 用途说明: 批量删除字典项 - * 参数说明 ids 字典项id数组 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回批量删除成功或失败 - ***********************************/ - @Log(module = "数据字典项", value = "批量删除字典项") - @PostMapping("/deleteDictItemByIds") - @Operation(summary = "批量删除字典项") - public ResponseResult deleteDictItemByIds(@RequestParam String id) { - if (StrUtil.isBlank(id)) { - return ResponseResult.error("参数为空"); - } - String[] splitIds = id.split(","); - // 数组转集合 - List ids = Arrays.asList(splitIds); - boolean ok = sysDictionaryItemsService.removeByIds(ids); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /********************************** - * 用途说明: 拖动修改字典项顺序 - * 参数说明 fromID 当前ID toID 到达ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回拖动成功或者失败 - ***********************************/ - @Log(module = "数据字典项", value = "拖动修改字典项顺序") - @PostMapping("/changeItemOrder") - @Operation(summary = "拖动修改字典项顺序") - public ResponseResult changeItemOrder(@RequestParam String fromID, - @RequestParam String toID) { - boolean ok = sysDictionaryItemsService.changeItemOrder(fromID, toID); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /********************************** - * 用途说明: 导出数据字典项数据 - * 参数说明 sysDictionaryItemsList 所需导出的字典项集合 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回导出成功或失败 - ***********************************/ - @Log(module = "数据字典项", value = "导出字典数据到Excel") - @GetMapping("/exportExcel") - @Operation(summary = "导出数据字典项数据") - public void exportExcel(String dictID, String itemName, - Page page, - HttpServletResponse response) { - Page sysDictionaryItemsPage = - sysDictionaryItemsService.getDictItemPage(dictID, itemName, - page); - sysDictionaryItemsService.exportExcel(sysDictionaryItemsPage.getRecords(), response); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/SysLogController.java b/backend/src/main/java/com/yfd/platform/system/controller/SysLogController.java deleted file mode 100644 index 9f2081a..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/SysLogController.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.yfd.platform.system.controller; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yfd.platform.annotation.Log; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.SysLog; -import com.yfd.platform.system.service.ISysLogService; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.web.bind.annotation.*; - -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - *

- * 系统操作日志 前端控制器 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -@RestController -@RequestMapping("/system/log") -@Tag(name = "系统日志") -public class SysLogController { - - @Resource - private ISysLogService sysLogService; - - /********************************** - * 用途说明: 分页查询日志信息 - * 参数说明 page分页对象、username(用户名)、(optType) - * 操作类型、startDate(开始日期)、endDate(结束日期) - * 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果 - ***********************************/ - @PostMapping("/getLogList") - @Operation(summary = "分页查询日志信息") - public ResponseResult getLogList(String username, String optType, - String startDate, - String endDate, Page page) { - - Page sysLogPage = sysLogService.getLogList(username, optType, - startDate, endDate, page); - Map map = new HashMap<>(); - map.put("list", sysLogPage.getRecords()); - map.put("total", sysLogPage.getTotal()); - map.put("size", sysLogPage.getSize()); - map.put("current", sysLogPage.getCurrent()); - return ResponseResult.successData(map); - } - - /********************************** - * 用途说明: 导出日志数据 - * 参数说明 sysLogs 所需导出的字典项集合 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回导出成功或者失败 - ***********************************/ - @Log(module = "系统日志", value = "导出系统日志到Excel") - @GetMapping("/exportExcel") - @Operation(summary = "导出日志数据") - public void exportExcel(String username, String optType, - String startDate, - String endDate, Page page, - HttpServletResponse response) throws IOException { - - Page sysLogPage = sysLogService.getLogList(username, optType, - startDate, endDate, page); - sysLogService.exportExcel(sysLogPage.getRecords(), response); - } -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/SysMenuController.java b/backend/src/main/java/com/yfd/platform/system/controller/SysMenuController.java deleted file mode 100644 index 3ac00e2..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/SysMenuController.java +++ /dev/null @@ -1,310 +0,0 @@ -package com.yfd.platform.system.controller; - -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; -import com.yfd.platform.annotation.Log; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.SysMenu; -import com.yfd.platform.system.domain.SysUser; -import com.yfd.platform.system.service.ISysMenuService; -import com.yfd.platform.system.service.IUserService; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.apache.catalina.User; -import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import jakarta.annotation.Resource; -import java.io.File; -import java.io.FileNotFoundException; -import java.sql.Timestamp; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - *

- * 菜单及按钮 前端控制器 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -@RestController -@RequestMapping("/system/menu") -@Tag(name = "菜单及按钮") -public class SysMenuController { - - @Resource - private ISysMenuService sysMenuService; - - @Resource - private IUserService userService; - - // 菜单图片路径通过服务层配置获取,无需在控制器注入 - - /*********************************** - * 用途说明:获取菜单结构树(含按钮) - * 参数说明 - * systemcode 系统 - * name 名称 - * isdisplay 是否显示 - * 返回值说明: 菜单结构树集合 - ***********************************/ - @PostMapping("/getMenuButtonTree") - @Operation(summary = "获取菜单结构树(含按钮)") - @ResponseBody - public List> getMenuButtonTree(String systemcode, - String name, - String isdisplay) { - return sysMenuService.getMenuButtonTree(systemcode, name, isdisplay); - } - - /*********************************** - * 用途说明:获取菜单结构树(不含按钮) - * 参数说明 - * systemcode 系统 - * name 名称 - * isdisplay 是否显示 - * 返回值说明: 菜单结构树集合 - ***********************************/ - @PostMapping("/getMenuTree") - @Operation(summary = "获取菜单结构树(不含按钮)") - @ResponseBody - public List> getMenuTree(String systemcode, - String name, - String isdisplay) { - return sysMenuService.getMenuTree(systemcode, name, isdisplay); - } - - /*********************************** - * 用途说明:权限分配 - * 参数说明 - * systemcode 系统 - * name 名称 - * isdisplay 是否显示 - * 返回值说明: 菜单结构树集合 - ***********************************/ - @PostMapping("/permissionAssignment") - @Operation(summary = "获取分配权限(不含按钮)") - @ResponseBody - public List> permissionAssignment(String code, String roleId) { - if (StrUtil.isBlank(code)) { - code = "1"; - } - return sysMenuService.permissionAssignment(code,roleId); - } - - /********************************** - * 用途说明: 获取当前用户菜单结构树 - * 参数说明 - * 返回值说明: java.util.List - ***********************************/ - @GetMapping("/treeRoutes") - @Operation(summary = "获取当前用户菜单结构树") - @ResponseBody - public List> getMenuTreeByUser() { - SysUser userInfo = userService.getUserInfo(); - String id = ""; - if (0 != userInfo.getUsertype()) { - id = userInfo.getId(); - } - return sysMenuService.getMenuTree(id); - } - - /*********************************** - * 用途说明:根据id查询菜单或按钮详情 - * 参数说明 - * id 菜单或按钮表id - * 返回值说明: 菜单或按钮表对象 - ***********************************/ - @PostMapping("/getOneById") - @Operation(summary = "根据id查询菜单或按钮详情") - @ResponseBody - public ResponseResult getOneById(String id) { - SysMenu sysMenu = sysMenuService.getById(id); - return ResponseResult.successData(sysMenu); - } - - /*********************************** - * 用途说明:新增菜单及按钮 - * 参数说明 - * sysMenu 菜单或按钮表对象 - * 返回值说明: 是否添加成功提示 - ***********************************/ - @Log(module = "菜单及按钮", value = "新增菜单及按钮!") - @PostMapping("/addMenu") - @Operation(summary = "新增菜单及按钮") - @ResponseBody - public ResponseResult addMenu(@RequestBody SysMenu sysMenu) { - boolean isOk = sysMenuService.addMenu(sysMenu); - if (isOk) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:修改菜单及按钮 - * 参数说明 - * sysMenu 菜单或按钮表对象 - * 返回值说明: 是否修改成功提示 - ***********************************/ - @Log(module = "菜单及按钮", value = "修改菜单及按钮") - @PostMapping("/updateById") - @Operation(summary = "修改菜单及按钮") - @ResponseBody - public ResponseResult updateById(@RequestBody SysMenu sysMenu) { - sysMenu.setLastmodifier(userService.getUsername()); - sysMenu.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - boolean isOk = sysMenuService.updateById(sysMenu); - if (isOk) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:根据id删除单个图标 - * 参数说明 - * id 删除图标id - * icon 图标名称 - * 返回值说明: 是否删除成功 - ***********************************/ - @Log(module = "菜单及按钮", value = "根据id删除单个图标!") - @PostMapping("/deleteIcon") - @Operation(summary = "根据id删除单个图标") - @ResponseBody - public ResponseResult deleteIcon(@RequestParam String id) { - boolean ok = sysMenuService.deleteIcon(id); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:更新菜单及按钮是否有效 - * 参数说明 - * id 菜单及按钮表id - * isdisplay 是否有效字段 - * 返回值说明: 是否更新成功 - ***********************************/ - @Log(module = "菜单及按钮", value = "更新菜单及按钮是否有效!") - @PostMapping("/setIsDisplay") - @Operation(summary = "更新菜单及按钮是否有效") - @ResponseBody - public ResponseResult setIsDisplay(String id, String isdisplay) { - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - //根据id 修改是否显示 ,最近修改人,最近修改时间 - updateWrapper.eq("id", id).set("isdisplay", isdisplay).set( - "lastmodifier", userService.getUsername()).set( - "lastmodifydate", - new Timestamp(System.currentTimeMillis())); - boolean ok = sysMenuService.update(updateWrapper); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:菜单及按钮序号排序 - * 参数说明 - * parentid 上级id - * orderMap map<菜单及按钮表id,排列序号> - * 返回值说明: 是否更新成功 - ***********************************/ - @Log(module = "菜单及按钮", value = "菜单及按钮序号排序!") - @PostMapping("/moveOrderno") - @Operation(summary = "菜单及按钮序号排序") - @ResponseBody - public ResponseResult moveOrderno(@RequestParam String parentid, - @RequestParam String id, - @RequestParam int orderno) { - boolean ok = sysMenuService.moveOrderno(parentid, id, orderno); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:根据id删除菜单或按钮 - * 参数说明 - * id 删除列的id - * 返回值说明: 是否删除成功 - ***********************************/ - @Log(module = "菜单及按钮", value = "根据id删除菜单或按钮!") - @PostMapping("/deleteById") - @Operation(summary = "根据id删除菜单或按钮") - @ResponseBody - public ResponseResult deleteById(@RequestParam String id) { - boolean ok = sysMenuService.deleteById(id); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /********************************** - * 用途说明: 菜单或者按钮拖动 - * 参数说明 id - * 参数说明 id1 - * 返回值说明: com.yfd.platform.config.ResponseResult - ***********************************/ - @Log(module = "菜单及按钮", value = "拖动修改菜单或按钮同级顺序!") - @PostMapping("/changeMenuOrder") - @Operation(summary = "菜单或按钮切换") - @ResponseBody - public ResponseResult changeMenuOrder(@RequestParam String fromId, - @RequestParam String toId) { - if (StrUtil.isBlank(fromId) || StrUtil.isBlank(toId)) { - return ResponseResult.error("参数为空!"); - } - if (fromId.equals(toId)) { - return ResponseResult.error("切换失败!"); - } - boolean ok = sysMenuService.changeOderNoById(fromId, toId); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:上传单个图标 - * 参数说明 - * icon 图标 - * 返回值说明: 是否上传成功 - ***********************************/ - @PostMapping("/uploadIcon") - @Operation(summary = "上传单个图标") - @ResponseBody - public ResponseResult uploadIcon(MultipartFile icon, String menuId) throws FileNotFoundException { - if (StrUtil.isNotBlank(menuId)) { - SysMenu sysMenu = sysMenuService.getById(menuId); - //图片路径 - String iconname = - System.getProperty("user.dir") + "\\src\\main" + - "\\resources\\static\\icon" + File.separator + sysMenu.getIcon(); - //删除图标 - new File(iconname).delete(); - } - String filename = sysMenuService.uploadIcon(icon); - SysMenu sysMenu = new SysMenu(); - sysMenu.setId(menuId); - sysMenu.setIcon(filename); - sysMenuService.updateById(sysMenu); - return ResponseResult.successData(filename); - } -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/SysOrganizationController.java b/backend/src/main/java/com/yfd/platform/system/controller/SysOrganizationController.java deleted file mode 100644 index 45c0218..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/SysOrganizationController.java +++ /dev/null @@ -1,213 +0,0 @@ -package com.yfd.platform.system.controller; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; -import com.yfd.platform.annotation.Log; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.SysOrganization; -import com.yfd.platform.system.domain.SysRole; -import com.yfd.platform.system.domain.SysUser; -import com.yfd.platform.system.mapper.SysRoleMapper; -import com.yfd.platform.system.service.ISysOrganizationService; -import com.yfd.platform.system.service.IUserService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; - -import jakarta.annotation.Resource; -import java.sql.Timestamp; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - *

- * 系统组织框架 前端控制器 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -@RestController -@RequestMapping("/system/organization") -@Tag(name = "系统组织框架") -public class SysOrganizationController { - - @Resource - private ISysOrganizationService organizationService; - - @Resource - private IUserService userService; - - /*********************************** - * 用途说明:获取组织范围树结构 - * 参数说明 - *parentid 上级id - * params 名称(根据名称查询二级) - * 返回值说明: 组织树集合 - ***********************************/ - @PostMapping("/getOrgScopeTree") - @Operation(summary = "获取组织范围树结构") - @ResponseBody - public List> getOrgScopeTree(String roleId) { - return organizationService.getOrgScopeTree(roleId); - } - - /*********************************** - * 用途说明:获取组织范围 - * 参数说明 - * 返回值说明: 组织范围集合 - ***********************************/ - @PostMapping("/getOrgTree") - @Operation(summary = "获取组织结构树") - @ResponseBody - public List> getOrgTree(String parentid, - String params) { - return organizationService.getOrgTree(parentid, params); - } - - /*********************************** - * 用途说明:根据企业ID查询组织详情 - * 参数说明 - * id 企业id - * 返回值说明: 系统组织框架对象 - ***********************************/ - @PostMapping("/getOrganizationById") - @Operation(summary = "根据企业ID查询组织信息") - @ResponseBody - public ResponseResult getOrganizationById(String id, String orgName) { - if (StrUtil.isBlank(id)) { - return ResponseResult.error("查询失败!"); - } - List sysOrganizations = - organizationService.getOrganizationById(id, orgName); - return ResponseResult.successData(sysOrganizations); - } - - /*********************************** - * 用途说明:根据ID查询组织详情 - * 参数说明 - * id 系统组织id - * 返回值说明: 系统组织框架对象 - ***********************************/ - @PostMapping("/getOneById") - @Operation(summary = "根据ID查询组织详情") - @ResponseBody - public ResponseResult getOneById(String id) { - SysOrganization sysOrganization = organizationService.getById(id); - return ResponseResult.successData(sysOrganization); - } - - /*********************************** - * 用途说明:新增系统组织框架 - * 参数说明 - * sysOrganization 系统组织框架对象 - * 返回值说明: 是否新增成功 - ***********************************/ - @Log(module = "系统组织框架", value = "新增企业或者部门!") - @PostMapping("/addOrg") - @Operation(summary = "新增系统组织框架") - @ResponseBody - public ResponseResult addOrg(@RequestBody SysOrganization sysOrganization) { - //判断是否是否填写 有效 否则默认为 1 - if (StrUtil.isEmpty(sysOrganization.getIsvaild())) { - sysOrganization.setIsvaild("1"); - } - if("".equals(sysOrganization.getId())){ - sysOrganization.setId(null); - } - //填写 当前用户名称 - sysOrganization.setLastmodifier(userService.getUsername()); - //填写 当前日期 - sysOrganization.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - //新增 系统组织R - boolean isOk = organizationService.addOrg(sysOrganization); - if (isOk) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:修改系统组织框架 - * 参数说明 - * sysOrganization 系统组织框架对象 - * 返回值说明: 是否修改成功 - ***********************************/ - @Log(module = "系统组织框架", value = "修改企业或者部门信息!") - @PostMapping("/updateById") - @Operation(summary = "修改系统组织框架") - @ResponseBody - public ResponseResult updateById(@RequestBody SysOrganization sysOrganization) { - //填写 当前用户名称 - sysOrganization.setLastmodifier(userService.getUsername()); - //填写 当前日期 - sysOrganization.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - //根据id 修改系统组织 - boolean isOk = organizationService.updateById(sysOrganization); - if (isOk) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:修改系统组织框架 - * 参数说明 - * sysOrganization 系统组织框架对象 - * 返回值说明: 是否修改成功 - ***********************************/ - @Log(module = "系统组织框架", value = "设置企业/部门是否有效!") - @PostMapping("/setIsValid") - @Operation(summary = "设置组织是否有效") - @ResponseBody - public ResponseResult setIsValid(@RequestParam String id, - @RequestParam String isvaild) { - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - //根据id 修改是否有效,最近修改人,最近修改时间 - updateWrapper.eq("id", id).set("isvaild", isvaild).set("lastmodifier" - , userService.getUsername()).set("lastmodifydate", - new Timestamp(System.currentTimeMillis())); - boolean isOk = organizationService.update(updateWrapper); - if (isOk) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:根据id删除系统组织框架 - * 参数说明 - * id 系统组织框架id - * 返回值说明: 是否删除成功 - ***********************************/ - @Log(module = "系统组织框架", value = "根据ID删除企业或者部门!") - @PostMapping("/deleteById") - @Operation(summary = "根据id删除系统组织框架") - @ResponseBody - public ResponseResult deleteById(@RequestParam String id) { - String[] orgIds = id.split(","); - for (String orgId : orgIds) { - LambdaQueryWrapper queryWrapper = - new LambdaQueryWrapper<>(); - List list = - organizationService.list(queryWrapper.eq(SysOrganization::getParentid, orgId)); - List ids = - list.stream().map(SysOrganization::getId).collect(Collectors.toList()); - boolean isOk = organizationService.removeById(orgId); - if (!isOk) { - continue; - } - for (String oid : ids) { - organizationService.removeById(oid); - } - } - return ResponseResult.success(); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/SysRoleController.java b/backend/src/main/java/com/yfd/platform/system/controller/SysRoleController.java deleted file mode 100644 index dae5472..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/SysRoleController.java +++ /dev/null @@ -1,318 +0,0 @@ -package com.yfd.platform.system.controller; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; -import com.yfd.platform.annotation.Log; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.SysRole; -import com.yfd.platform.system.service.ISysRoleService; -import com.yfd.platform.system.service.IUserService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; - -import jakarta.annotation.Resource; -import java.sql.Timestamp; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; - -/** - *

- * 系统角色 前端控制器 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -@RestController -@RequestMapping("/system/role") -@Tag(name = "系统角色") -public class SysRoleController { - - @Resource - private ISysRoleService roleService; - - @Resource - private IUserService userService; - - /*********************************** - * 用途说明:查询所有角色 - * 参数说明 - * roleName 角色名称 - * 返回值说明: 查询都有角色 - ***********************************/ - @PostMapping("/list") - @Operation(summary = "查询所有角色") - @ResponseBody - public List list(@RequestParam(required = false) String rolename) { - return roleService.selectRoleList(rolename); - } - - /*********************************** - * 用途说明:根据Id获取当个角色 - * 参数说明 - * id 角色表id - * 返回值说明: 根据id查询到角色详情 - ***********************************/ - @PostMapping("/getOneById") - @Operation(summary = "根据Id获取当个角色") - @ResponseBody - public ResponseResult getOneById(String id) { - SysRole sysRole = roleService.getById(id); - return ResponseResult.successData(sysRole); - } - - /*********************************** - * 用途说明:新增角色 - * 参数说明 - * sysRole 新增角色信息 - * 返回值说明: 是否新增成功 - ***********************************/ - @Log(module = "系统角色", value = "新增角色") - @PostMapping("/addRole") - @Operation(summary = "新增角色") - @ResponseBody - public ResponseResult addRole(@RequestBody SysRole sysRole) { - boolean isOk = roleService.addRole(sysRole); - if (isOk) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:分配操作权限 - * 参数说明 - * id 角色id - * optscope 分配的权限 - * 返回值说明: 是否新增成功 - ***********************************/ - @Log(module = "系统角色", value = "分配操作权限") - @PostMapping("/setOptScope") - @Operation(summary = "分配操作权限") - @ResponseBody - public ResponseResult setOptScope(@RequestParam String id, - @RequestParam String optscope) { - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - //根据id 更新权限,最近修改人,最近修改时间 - updateWrapper.eq("id", id).set("optscope", optscope).set( - "lastmodifier", userService.getUsername()).set( - "lastmodifydate", LocalDateTime.now()); - boolean ok = roleService.update(updateWrapper); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:角色菜单权限 - * 参数说明 - * id 角色id - * menuIds 权限id字符串 - * 返回值说明: 是否分配成功 - ***********************************/ - @Log(module = "系统角色", value = "角色菜单权限") - @PostMapping("/setMenuById") - @Operation(summary = "角色菜单权限") - @ResponseBody - public ResponseResult setMenuById(String id, String menuIds) { - if (StrUtil.isBlank(id)) { - return ResponseResult.error("参数为空"); - } - if (StrUtil.isBlank(menuIds)) { - return ResponseResult.success(); - } - boolean ok = roleService.setMenuById(id, menuIds); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - - } - - /*********************************** - * 用途说明:设置组织范围 - * 参数说明 - * id 角色id - * orgscope 组织范围 - * 返回值说明: 是否新增成功 - ***********************************/ - @Log(module = "系统角色", value = "设置组织范围") - @PostMapping("/setOrgscope") - @Operation(summary = "设置组织范围") - @ResponseBody - public ResponseResult setOrgscope(@RequestParam String id, - @RequestParam String orgscope) { - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - //根据id 更新组织范围,最近修改人,最近修改时间 - updateWrapper.eq("id", id).set("orgscope", orgscope).set( - "lastmodifier", userService.getUsername()).set( - "lastmodifydate", LocalDateTime.now()); - boolean ok = roleService.update(updateWrapper); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:设置业务范围 - * 参数说明 - * id 角色id - * busscope 业务范围 - * 返回值说明: 是否新增成功 - ***********************************/ - @Log(module = "系统角色", value = "设置业务范围") - @PostMapping("/setBusscope") - @Operation(summary = "设置业务范围") - @ResponseBody - public ResponseResult setBusscope(@RequestParam String id, - @RequestParam String busscope) { - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - //根据id 更新业务范围,最近修改人,最近修改时间 - updateWrapper.eq("id", id).set("busscope", busscope).set( - "lastmodifier", userService.getUsername()).set( - "lastmodifydate", LocalDateTime.now()); - boolean ok = roleService.update(updateWrapper); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:角色添加用户 - * 参数说明 - * roleid 角色id - * userids 用户id组 - * 返回值说明: 是否新增成功 - ***********************************/ - @Log(module = "系统角色", value = "角色添加用户") - @PostMapping("/setRoleUsers") - @Operation(summary = "角色添加用户") - @ResponseBody - public ResponseResult setRoleUsers(String roleid, String userids) { - boolean isOk = true; - String[] temp = userids.split(","); - for (String userid : temp) { - isOk = isOk && userService.addUserRoles(roleid, userid); - } - if (isOk) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:删除角色用户 - * 参数说明 - * roleid 角色id - * 返回值说明: 是否新增成功 - ***********************************/ - @PostMapping("/deleteRoleUser") - @Operation(summary = "删除角色用户") - @ResponseBody - public ResponseResult deleteRoleUsers(@RequestParam String roleid, - @RequestParam String userids) { - //根据角色id、用户id删除 - boolean ok = roleService.deleteRoleUsers(roleid, userids); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:设置角色是否有效 - * 参数说明 - * id 角色id - *isvaild 是否有效(1 是 0 否 ) - * 返回值说明: 是否新增成功 - ***********************************/ - @PostMapping("/setIsvaild") - @Operation(summary = "设置角色是否有效") - @ResponseBody - public ResponseResult setIsvaild(String id, String isvaild) { - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - //根据id 更新业务范围,最近修改人,最近修改时间 - updateWrapper.eq("id", id).set("isvaild", isvaild).set("lastmodifier" - , userService.getUsername()).set("lastmodifydate", - LocalDateTime.now()); - boolean ok = roleService.update(updateWrapper); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:更新角色信息 - * 参数说明 - *sysRole 角色对象 - * 返回值说明: 是否修改成功 - ***********************************/ - @PostMapping("/updateById") - @Operation(summary = "更新角色信息") - @ResponseBody - public ResponseResult updateById(@RequestBody SysRole sysRole) { - //更新最近修改人 - sysRole.setLastmodifier(userService.getUsername()); - //更新最近修改时间 - sysRole.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - //根据id更新角色信息 - boolean ok = roleService.updateById(sysRole); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:根据id删除角色 - * 参数说明 - *id 角色id - * 返回值说明: 是否删除成功 - ***********************************/ - @PostMapping("/deleteById") - @Operation(summary = "根据id删除角色") - @ResponseBody - public ResponseResult deleteById(@RequestParam String id) { - roleService.deleteById(id); - return ResponseResult.success(); - } - - /*********************************** - * 用途说明:查询已分配的用户 - * 参数说明 - *orgid 所属组织 - *username 用户名称 - *status 状态 - *level 角色级别 - * rolename 角色名称 - * isvaild 角色是否有效 - * 返回值说明: 系统用户角色数据集合 - ***********************************/ - @PostMapping("/listRoleUsers") - @Operation(summary = "查询已分配的用户") - @ResponseBody - public List listRoleUsers(String orgid, String username, - String status, String level, - String rolename, String isvaild) { - return roleService.listRoleUsers(orgid, username, status, level, - rolename, isvaild); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/controller/UserController.java b/backend/src/main/java/com/yfd/platform/system/controller/UserController.java deleted file mode 100644 index ecf4003..0000000 --- a/backend/src/main/java/com/yfd/platform/system/controller/UserController.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.yfd.platform.system.controller; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yfd.platform.annotation.Log; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.datasource.DataSource; -import com.yfd.platform.system.domain.SysUser; -import com.yfd.platform.system.service.IUserService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import jakarta.annotation.Resource; -import java.sql.Timestamp; -import java.util.Map; - -/** - *

- * 用户信息 前端控制器 - *

- * - * @author zhengsl - * @since 2022-09-20 - */ -@RestController -@RequestMapping("/system/user") -@Tag(name = "系统用户") -public class UserController { - - @Resource - private IUserService userService; - - @Log(module = "系统用户", value = "新增系统用户") - @PostMapping("/addUser") - @Operation(summary = "新增系统用户") - @ResponseBody - public ResponseResult addUser(@RequestBody SysUser user, String roleids) { - Map reslut = userService.addUser(user, roleids); - return ResponseResult.successData(reslut); - } - - @Log(module = "系统用户", value = "修改用户信息") - @PostMapping("/updateUser") - @Operation(summary = "修改用户信息") - @ResponseBody - public ResponseResult updateUser(@RequestBody SysUser user, - String roleids) { - if (StrUtil.isEmpty(user.getId())) { - return ResponseResult.error("没有用户ID"); - } - //填写 当前用户名称 - user.setLastmodifier(userService.getUsername()); - //填写 当前日期 - user.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - Map reslut = userService.updateById(user, roleids); - return ResponseResult.successData(reslut); - } - - @GetMapping("/queryUsers") - @Operation(summary = "查询用户信息") - @ResponseBody - public ResponseResult queryUsers(String orgid, - String username, Page page) { - - Page mapPage = userService.queryUsers(orgid, - username, page); - return ResponseResult.successData(mapPage); - } - - /*********************************** - * 用途说明:用户分配角色 - * 参数说明 - *idMap 用户id与角色id - * 返回值说明: 判断是否添加成功 - ************************************/ - @Log(module = "系统用户", value = "用户分配角色") - @PostMapping("/setUserRoles") - @Operation(summary = "用户分配角色") - @ResponseBody - public ResponseResult setUserRoles(String roleid, String userids) { - boolean ok = userService.setUserRoles(roleid, userids); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:根据id删除用户 - * 参数说明 - *id 用户id - * 返回值说明: 判断是否删除成功 - ************************************/ - @Log(module = "系统用户", value = "根据ID删除用户") - @PostMapping("/deleteById") - @Operation(summary = "根据ID删除用户") - @ResponseBody - public ResponseResult deleteById(String id) { - userService.deleteById(id); - return ResponseResult.success(); - } - - /*********************************** - * 用途说明:根据ID批量删除用户 - * 参数说明 - *ids 用户id集合 - * 返回值说明: 判断是否删除成功 - ************************************/ - @Log(module = "系统用户", value = "根据ID批量删除用户") - @PostMapping("/deleteUserByIds") - @Operation(summary = "根据ID批量删除用户") - @ResponseBody - public ResponseResult deleteUserByIds(String id) { - if (StrUtil.isBlank(id)) { - return ResponseResult.error("参数为空"); - } - boolean ok = userService.deleteUserByIds(id); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:重置用户密码(管理员) - * 参数说明 - *id 重置密码的 用户id - * 返回值说明: 判断是否重置成功 - ************************************/ - @Log(module = "系统用户", value = "重置用户密码") - @PostMapping("/resetPassword") - @Operation(summary = "重置用户密码") - @ResponseBody - @DataSource - public ResponseResult resetPassword(String id) throws Exception { - if (StrUtil.isBlank(id)) { - ResponseResult.error("参数为空"); - } - boolean ok = userService.resetPassword(id); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:设置账号状态(管理员) - * 参数说明 - *id 用户id - * status 设置状态 - * 返回值说明: 判断是否设置成功 - ************************************/ - @Log(module = "系统用户", value = "设置账号状态") - @PostMapping("/setStatus") - @Operation(summary = "设置账号状态") - @ResponseBody - public ResponseResult setStatus(@RequestParam String id, - @RequestParam String status) { - boolean ok = userService.setStatus(id, status); - if (ok) { - return ResponseResult.success(); - } else { - return ResponseResult.error(); - } - } - - /*********************************** - * 用途说明:修改头像(管理员) - * 参数说明 - * multipartFile 文件对象 - * status 设置状态 - * 返回值说明: 文件名 - ************************************/ - @Operation(summary = "修改头像") - @PostMapping(value = "/updateAvatar") - public ResponseResult updateAvatar(String id, MultipartFile multipartFile) { - if (multipartFile == null) { - ResponseResult.error("参数为空"); - } - boolean ok = userService.uploadAvatar(id, multipartFile); - return ResponseResult.success(); - } -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/Dictionary.java b/backend/src/main/java/com/yfd/platform/system/domain/Dictionary.java deleted file mode 100644 index 9abb146..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/Dictionary.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; - -/** - *

- * 数据字典表 - *

- * - * @author zhengsl - * @since 2021-10-27 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("RCA_DICTIONARY") -public class Dictionary implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * id - */ - @TableId(type = IdType.ASSIGN_UUID) - private String id; - - /** - * 类型 - */ - private String type; - - /** - * 类型名称 - */ - private String typename; - - /** - * 代码 - */ - private String code; - - /** - * 名称 - */ - private String name; - - /** - * 顺序号 - */ - private String orderno; - - /** - * 上级代码 - */ - private String parentcode; - - /** - * 备用1 - */ - private String custom1; - - /** - * 备用2 - */ - private String custom2; - - /** - * 备用3 - */ - private String custom3; - - -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/LoginUser.java b/backend/src/main/java/com/yfd/platform/system/domain/LoginUser.java deleted file mode 100644 index 44cfb35..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/LoginUser.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.alibaba.fastjson.annotation.JSONField; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.SimpleGrantedAuthority; -import org.springframework.security.core.userdetails.UserDetails; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class LoginUser implements UserDetails { - - private SysUser user; - - private List permissions; - - public LoginUser(SysUser user, List permissions) { - this.user = user; - this.permissions = permissions; - } - - @JSONField(serialize = false) - private List authorities; - - @Override - public Collection getAuthorities() { - // 将权限信息放入集合 - authorities = permissions.stream() - .map(SimpleGrantedAuthority::new) - .collect(Collectors.toList()); - return authorities; - } - - @Override - public String getPassword() { - return user.getPassword(); - } - - @Override - public String getUsername() { - return user.getUsername(); - } - - //获取用户昵称 - public String geNickname() { - return user.getNickname(); - } - - @Override - public boolean isAccountNonExpired() { - return true; - } - - @Override - public boolean isAccountNonLocked() { - return true; - } - - @Override - public boolean isCredentialsNonExpired() { - return true; - } - - @Override - public boolean isEnabled() { - return true; - } -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/Message.java b/backend/src/main/java/com/yfd/platform/system/domain/Message.java deleted file mode 100644 index 759819e..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/Message.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; - -import java.sql.Timestamp; -import java.time.LocalDateTime; -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - *

- * 消息通知 - *

- * - * @author TangWei - * @since 2023-03-19 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("SYS_MESSAGE") -public class Message implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * ID - */ - @TableId(type = IdType.ASSIGN_UUID) - @Schema(description = "ID") - private String id; - - /** - * 创建时间:排序 - */ - @Schema(description = "创建时间:排序") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private Timestamp createtime; - - /** - * 消息类型:1-定时任务 2-工作流触发 3-人工触发 - */ - @Schema(description = "消息类型:1-定时任务 2-工作流触发 3-人工触发") - private String type; - - /** - * 消息标题 - */ - @Schema(description = "消息标题") - private String title; - - /** - * 消息内容 - */ - @Schema(description = "消息内容") - private String content; - - /** - * 发送者名称,定时器,人员 - */ - @Schema(description = "发送者名称,定时器,人员") - private String senderName; - - /** - * 接收者代码 人员账号列表 - */ - @Schema(description = "接收者代码 人员账号列表 ") - private String receiverCodes; - - /** - * 接收者名称:为空 即为所有人,人员名称列表 - */ - @Schema(description = "接收者名称:为空 即为所有人,人员名称列表") - private String receiverNames; - - /** - * 状态:1、初始创建 2-消息已阅 9-消息过期 - */ - @Schema(description = "状态:1、初始创建 2-消息已阅 9-消息过期") - private String status; - - /** - * 有效期:小时 - */ - @Schema(description = "有效期:小时") - private Integer validperiod; - - /** - * 已阅时间 - */ - @Schema(description = "已阅时间") - private Timestamp readtime; - - /** - * 备用1 - */ - @Schema(description = "备用1") - private String custom1; - - /** - * 备用2 - */ - @Schema(description = "备用2") - private String custom2; - - /** - * 备用3 - */ - @Schema(description = "备用3") - private String custom3; - -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/QuartzJob.java b/backend/src/main/java/com/yfd/platform/system/domain/QuartzJob.java deleted file mode 100644 index d513514..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/QuartzJob.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; - -import java.sql.Timestamp; -import java.time.LocalDateTime; -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - *

- * 定时任务 - *

- * - * @author TangWei - * @since 2023-03-19 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("SYS_QUARTZ_JOB") -public class QuartzJob implements Serializable { - - public static final String JOB_KEY = "JOB_KEY"; - private static final long serialVersionUID = 1L; - - /** - * ID - */ - @Schema(description = "ID") - @TableId(type = IdType.ASSIGN_UUID) - private String id; - - /** - * 排序号 - */ - @Schema(description = "排序号") - private Integer orderno; - - /** - * 任务名称 - */ - @Schema(description = "任务名称") - private String jobName; - - /** - * 执行类名称 - */ - @Schema(description = "执行类名称") - private String jobClass; - - /** - * 执行方法名称 - */ - @Schema(description = "执行方法名称") - private String jobMethod; - - /** - * 时间周期表达式 - */ - @Schema(description = "时间周期表达式") - private String jobCron; - - /** - * 方法参数 - */ - @Schema(description = "方法参数") - private String jobParams; - - /** - * 任务描述 - */ - @Schema(description = "任务描述") - private String description; - - /** - * 状态:0-暂停、1-启用 - */ - @Schema(description = "状态:0-暂停、1-启用") - private String status; - - /** - * 最近修改者 - */ - @Schema(description = "最近修改者") - private String lastmodifier; - - /** - * 最近修改日期 - */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description = "最近修改日期") - private Timestamp lastmodifydate; - - /** - * 备用1 - */ - @Schema(description = "备用1") - private String custom1; - - /** - * 备用2 - */ - @Schema(description = "备用2") - private String custom2; - - /** - * 备用3 - */ - @Schema(description = "备用3") - private String custom3; - -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/SysConfig.java b/backend/src/main/java/com/yfd/platform/system/domain/SysConfig.java deleted file mode 100644 index 3830d97..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/SysConfig.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - *

- * 系统全局配置 - *

- * - * @author zhengsl - * @since 2022-01-19 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("SYS_CONFIG") -public class SysConfig implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * id - */ - @TableId(type = IdType.ASSIGN_UUID) - private String id; - - /** - * 欢迎词 - */ - private String welcome; - - /** - * 系统功能介绍 - */ - private String funcation; - - /** - * 系统版本信息 - */ - private String versioninfo; - - /** - * 备注 - */ - private String remark; - - /** - * 最近修改者 - */ - private String lastmodifier; - - /** - * 最近修改日期 - */ - @TableField(fill = FieldFill.UPDATE) - private Timestamp lastmodifydate; - - /** - * 备用1 - */ - private String custom1; - - /** - * 备用2 - */ - private String custom2; - - /** - * 备用3 - */ - private String custom3; - - -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/SysDictionary.java b/backend/src/main/java/com/yfd/platform/system/domain/SysDictionary.java deleted file mode 100644 index e57a13e..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/SysDictionary.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; - -/** - *

- * 数据字典表 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("SYS_DICTIONARY") -public class SysDictionary implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * id - */ - @TableId(type = IdType.ASSIGN_UUID) - private String id; - - /** - * 字典类型 00-系统内置 01-用户配置 - */ - @TableField("DICTTYPE") - private String dictType; - - /** - * 顺序号 - */ - @TableField("ORDERNO") - private Integer orderNo; - - /** - * 字典编码 - */ - @TableField("DICTCODE") - private String dictCode; - - /** - * 字典名称 - */ - @TableField("DICTNAME") - private String dictName; - - /** - * 备用1 - */ - private String custom1; - - /** - * 备用2 - */ - private String custom2; - - /** - * 备用3 - */ - private String custom3; - - -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/SysDictionaryItems.java b/backend/src/main/java/com/yfd/platform/system/domain/SysDictionaryItems.java deleted file mode 100644 index 59a7c56..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/SysDictionaryItems.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; - -/** - *

- * 数据字典明细 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("SYS_DICTIONARY_ITEMS") -public class SysDictionaryItems implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * id - */ - @TableId(type = IdType.ASSIGN_UUID) - private String id; - - /** - * 对应字典ID - */ - @TableField("DICTID") - private String dictId; - - /** - * 顺序号 - */ - @TableField("ORDERNO") - private Integer orderNo; - - /** - * 项编码 - */ - @TableField("ITEMCODE") - private String itemCode; - - /** - * 项名称 - */ - @TableField("DICTNAME") - private String dictName; - - /** - * 父项编码 - */ - @TableField("PARENTCODE") - private String parentCode; - - /** - * 备用1 - */ - private String custom1; - - /** - * 备用2 - */ - private String custom2; - - /** - * 备用3 - */ - private String custom3; - - -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/SysLog.java b/backend/src/main/java/com/yfd/platform/system/domain/SysLog.java deleted file mode 100644 index a359769..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/SysLog.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.sql.Timestamp; -import java.time.LocalDateTime; - -/** - *

- * 系统操作日志 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -@Data -@NoArgsConstructor -@EqualsAndHashCode(callSuper = false) -@TableName("SYS_LOG") -public class SysLog implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * ID - */ - @TableId(value = "ID", type = IdType.ASSIGN_UUID) - private String id; - - /** - * 用户账号 - */ - @TableField("USERCODE") - private String usercode; - - /** - * 用户名称 - */ - private String username; - - /** - * 操作类型 00-登录 01-新增 02-修改 03-删除 06-查询 09其他 - */ - @TableField("OPTTYPE") - private String opttype; - - /** - * 模块名称 - */ - private String module; - - /** - * 日志描述 - */ - private String description; - - /** - * 操作方法 - */ - private String method; - - /** - * 方法参数 - */ - private String params; - - /** - * 创建时间 - */ - @TableField("LOGTIME") - private Timestamp logtime; - - /** - * 请求IP - */ - @TableField("REQUESTIP") - private String requestip; - - /** - * 浏览器类型 - */ - private String browser; - - public SysLog(String opttype) { - this.opttype = opttype; - } -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/SysMenu.java b/backend/src/main/java/com/yfd/platform/system/domain/SysMenu.java deleted file mode 100644 index 8392ce6..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/SysMenu.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.List; - -/** - *

- * 菜单及按钮 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("SYS_MENU") -public class SysMenu implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * id - */ - @TableId(type = IdType.ASSIGN_UUID) - private String id; - - /** - * 1-web 2-pad 3-mobile - */ - private String systemcode; - - /** - * 1-菜单 2-按钮 - */ - private String type; - - /** - * 在系统内自动生成 - */ - private String code; - - /** - * 名称 - */ - private String name; - - /** - * 图标地址 - */ - private String icon; - - /** - * 是否外链 - */ - private String islink; - - /** - * 内部模块路径或者外链地址 - */ - private String opturl; - - /** - * 权限控制标识 - */ - private String permission; - - /** - * 顶级为0 - */ - private String parentid; - - /** - * 排序号 - */ - private Integer orderno; - - /** - * 0-不显示 1-显示 - */ - private String isdisplay; - - /** - * 最近修改者 - */ - private String lastmodifier; - - /** - * 最近修改日期 - */ - @TableField(fill = FieldFill.UPDATE) - private Timestamp lastmodifydate; - - /** - * 备用1 - */ - private String custom1; - - /** - * 备用2 - */ - private String custom2; - - /** - * 备用3 - */ - private String custom3; - -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/SysOrganization.java b/backend/src/main/java/com/yfd/platform/system/domain/SysOrganization.java deleted file mode 100644 index 0f9a719..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/SysOrganization.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - *

- * 系统组织框架 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("SYS_ORGANIZATION") -public class SysOrganization implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * id - */ - @TableId(type = IdType.ASSIGN_UUID) - private String id; - - /** - * 1-公司 -2-部门 - */ - private String orgtype; - - /** - * 两位一级 - */ - private String orgcode; - - /** - * 组织名称 - */ - private String orgname; - - /** - * 上级id - */ - private String parentid; - - /** - * 组织负责人 - */ - private String manager; - - /** - * 1-是 0-否 - */ - private String isvaild; - - /** - * 描述 - */ - private String description; - - /** - * 最近修改者 - */ - private String lastmodifier; - - /** - * 最近修改日期 - */ - @TableField(fill = FieldFill.UPDATE) - private Timestamp lastmodifydate; - - /** - * 备用1 - */ - private String custom1; - - /** - * 备用2 - */ - private String custom2; - - /** - * 备用3 - */ - private String custom3; - - -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/SysRole.java b/backend/src/main/java/com/yfd/platform/system/domain/SysRole.java deleted file mode 100644 index 68ab3ce..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/SysRole.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - *

- * 系统角色 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("SYS_ROLE") -public class SysRole implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * id - */ - @TableId(type = IdType.ASSIGN_UUID) - private String id; - - /** - * 系统生成,三位编号 - */ - private String rolecode; - - /** - * 角色名称 - */ - private String rolename; - - /** - * 1-超级管理员 2-单位管理员 3-普通用户 - */ - @TableField("\"LEVEL\"") - private String level; - - /** - * 描述 - */ - private String description; - - /** - * org1,org2 - */ - private String orgscope; - - /** - * 多个操作代码(菜单、按钮) - */ - private String optscope; - - /** - * json格式自定义业务范围 - */ - private String busscope; - - /** - * 1-是 0-否 - */ - private String isvaild; - - /** - * 最近修改者 - */ - private String lastmodifier; - - /** - * 最近修改日期 - */ - @TableField(fill = FieldFill.UPDATE) - private Timestamp lastmodifydate; - - /** - * 备用1 - */ - private String custom1; - - /** - * 备用2 - */ - private String custom2; - - /** - * 备用3 - */ - private String custom3; - - -} diff --git a/backend/src/main/java/com/yfd/platform/system/domain/SysUser.java b/backend/src/main/java/com/yfd/platform/system/domain/SysUser.java deleted file mode 100644 index 57c5b85..0000000 --- a/backend/src/main/java/com/yfd/platform/system/domain/SysUser.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.yfd.platform.system.domain; - -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.sql.Timestamp; -import java.util.List; - -/** - *

- * 系统用户 - *

- * - * @author zhengsl - * @since 2021-10-27 - */ - -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("SYS_USER") -public class SysUser implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * id 主键 - */ - @TableId(type = IdType.ASSIGN_UUID) - private String id; - - /** - * 用户类型 0-管理员 1-普通用户 - */ - private Integer usertype; - - /** - * 用户名(账号) - */ - private String username; - /** - * 用户昵称 - */ - private String nickname; - - /** - * 登录密码(加密存储) - */ - private String password; - - /** - * 性别(0-男 1-女 ) - */ - private String sex; - - /** - * 邮箱 - */ - private String email; - /** - * 手机号 - */ - private String phone; - - /** - * 头像(预留) - */ - private String avatar; - - /** - * 账号状态(1-正常 0-停用) - */ - private Integer status; - - /** - * 部门ID - */ - private String orgid; - - /** - * 密码重置时间 - */ - private String pwdresettime; - - /** - * 最近修改者 - */ - private String lastmodifier; - - /** - * 最近修改日期 - */ - @TableField(fill = FieldFill.UPDATE) - private Timestamp lastmodifydate; - - @TableField(exist = false) - private String uuid; - - @TableField(exist = false) - private String code; - - /** - * 备用1 - */ - private String custom1; - - /** - * 备用2 - */ - private String custom2; - - /** - * 备用3 - */ - private String custom3; - - @TableField(exist = false) - List roles; -} diff --git a/backend/src/main/java/com/yfd/platform/system/mapper/MessageMapper.java b/backend/src/main/java/com/yfd/platform/system/mapper/MessageMapper.java deleted file mode 100644 index d08fa95..0000000 --- a/backend/src/main/java/com/yfd/platform/system/mapper/MessageMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.yfd.platform.system.mapper; - -import com.yfd.platform.system.domain.Message; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * 消息通知 Mapper 接口 - *

- * - * @author TangWei - * @since 2023-03-19 - */ -public interface MessageMapper extends BaseMapper { - -} diff --git a/backend/src/main/java/com/yfd/platform/system/mapper/QuartzJobMapper.java b/backend/src/main/java/com/yfd/platform/system/mapper/QuartzJobMapper.java deleted file mode 100644 index ad46f1b..0000000 --- a/backend/src/main/java/com/yfd/platform/system/mapper/QuartzJobMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.yfd.platform.system.mapper; - -import com.yfd.platform.system.domain.QuartzJob; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * 定时任务 Mapper 接口 - *

- * - * @author TangWei - * @since 2023-03-19 - */ -public interface QuartzJobMapper extends BaseMapper { - -} diff --git a/backend/src/main/java/com/yfd/platform/system/mapper/SysConfigMapper.java b/backend/src/main/java/com/yfd/platform/system/mapper/SysConfigMapper.java deleted file mode 100644 index 5bae048..0000000 --- a/backend/src/main/java/com/yfd/platform/system/mapper/SysConfigMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.yfd.platform.system.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.yfd.platform.system.domain.SysConfig; - - -/** - *

- * 系统全局配置 Mapper 接口 - *

- * - * @author zhengsl - * @since 2022-01-19 - */ -public interface SysConfigMapper extends BaseMapper { - -} diff --git a/backend/src/main/java/com/yfd/platform/system/mapper/SysDictionaryItemsMapper.java b/backend/src/main/java/com/yfd/platform/system/mapper/SysDictionaryItemsMapper.java deleted file mode 100644 index de7deaa..0000000 --- a/backend/src/main/java/com/yfd/platform/system/mapper/SysDictionaryItemsMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.yfd.platform.system.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yfd.platform.system.domain.SysDictionaryItems; - -/** - *

- * 数据字典明细 Mapper 接口 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -public interface SysDictionaryItemsMapper extends BaseMapper { - -} diff --git a/backend/src/main/java/com/yfd/platform/system/mapper/SysDictionaryMapper.java b/backend/src/main/java/com/yfd/platform/system/mapper/SysDictionaryMapper.java deleted file mode 100644 index 7d03ca9..0000000 --- a/backend/src/main/java/com/yfd/platform/system/mapper/SysDictionaryMapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.yfd.platform.system.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.yfd.platform.system.domain.SysDictionary; - -/** - *

- * 数据字典表 Mapper 接口 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -public interface SysDictionaryMapper extends BaseMapper { - - /********************************** - * 用途说明: 根据字典类型获取字典最大序号 - * 参数说明 sysDictionary 字典对象 - * 返回值说明: 返回增加成功或者失败 - ***********************************/ - Integer selectMaxNo(String dictType); -} diff --git a/backend/src/main/java/com/yfd/platform/system/mapper/SysLogMapper.java b/backend/src/main/java/com/yfd/platform/system/mapper/SysLogMapper.java deleted file mode 100644 index 7b18518..0000000 --- a/backend/src/main/java/com/yfd/platform/system/mapper/SysLogMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.yfd.platform.system.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.yfd.platform.system.domain.SysLog; - -/** - *

- * 系统操作日志 Mapper 接口 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -public interface SysLogMapper extends BaseMapper { - -} diff --git a/backend/src/main/java/com/yfd/platform/system/mapper/SysMenuMapper.java b/backend/src/main/java/com/yfd/platform/system/mapper/SysMenuMapper.java deleted file mode 100644 index 061feeb..0000000 --- a/backend/src/main/java/com/yfd/platform/system/mapper/SysMenuMapper.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.yfd.platform.system.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.yfd.platform.system.domain.SysMenu; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -/** - *

- * 菜单及按钮 Mapper 接口 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -public interface SysMenuMapper extends BaseMapper { - - /*********************************** - * 用途说明:菜单及按钮序号向上移动 - * 参数说明 - * parentid 上级id - *Orderno 小于序号(原序号) - *upOrderno 大于等于序号(更改的序号加一) - * 返回值说明: 是否更新成功 - ***********************************/ - boolean upMoveOrderno(@Param("parentid") String parentid, @Param("Orderno") int Orderno, @Param("upOrderno") int upOrderno); - - /*********************************** - * 用途说明:菜单及按钮序号向下移动 - * 参数说明 - * parentid 上级id - *Orderno 大于序号(原序号) - *downOrderno 小于等于序号(更改的序号减一) - * 返回值说明: 是否更新成功 - ***********************************/ - boolean downMoveOrderno(@Param("parentid") String parentid, @Param("Orderno") int Orderno, @Param("downOrderno") int downOrderno); - - - List selectPermsByUserId(String userId); - - //List selectMenuByUserId(String userId); - List selectMenuByUserId(String userId); - - /*********************************** - * 用途说明:根据权限id查找系统类型 - * 参数说明 id 权限id - * 返回值说明: 返回系统类型 - ***********************************/ - String getSystemCodeById(String id); - - /*********************************** - * 用途说明:根据角色Id查找权限 - * 参数说明 id 权限id - * 返回值说明: 返回权限集合 - ***********************************/ - List selectMenuByRoleId(String id); -} diff --git a/backend/src/main/java/com/yfd/platform/system/mapper/SysOrganizationMapper.java b/backend/src/main/java/com/yfd/platform/system/mapper/SysOrganizationMapper.java deleted file mode 100644 index e856aae..0000000 --- a/backend/src/main/java/com/yfd/platform/system/mapper/SysOrganizationMapper.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.yfd.platform.system.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.yfd.platform.system.domain.SysOrganization; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - *

- * 系统组织框架 Mapper 接口 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -public interface SysOrganizationMapper extends BaseMapper { - - /*********************************** - * 用途说明:去重查询组织分类 - * 返回值说明: 所有组织分类 - ***********************************/ - List queryOrgtype(); - - /*********************************** - * 用途说明:根据组织分类查询上级id - * 参数说明 - * orgtype 组织分类 - * 返回值说明: 上级id - ***********************************/ - List queryParentid(@Param("orgtype") String orgtype); - -} diff --git a/backend/src/main/java/com/yfd/platform/system/mapper/SysRoleMapper.java b/backend/src/main/java/com/yfd/platform/system/mapper/SysRoleMapper.java deleted file mode 100644 index 09201a1..0000000 --- a/backend/src/main/java/com/yfd/platform/system/mapper/SysRoleMapper.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.yfd.platform.system.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.yfd.platform.system.domain.SysRole; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -/** - *

- * 系统角色 Mapper 接口 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -public interface SysRoleMapper extends BaseMapper { - - /*********************************** - * 用途说明:根据角色id查询是否存在用户 - * 参数说明 - * roleid 角色id - * 返回值说明: 该角色下是否存在用户 - ************************************/ - List> isRoleUsersByroleid(String roleid); - - /*********************************** - * 用途说明:根据角色id查询是否存在权限 - * 参数说明 - * roleid 角色id - * 返回值说明: 该角色下是否存在权限 - ************************************/ - List> isRoleMenuByRoleId(String roleId); - - /*********************************** - * 用途说明:查询已分配的用户 - * 参数说明 - *orgid 所属组织 - *username 用户名称 - *status 状态 - *level 角色级别 '1-超级管理员 2-单位管理员 3-普通用户' - * rolename 角色名称 - * isvaild 角色是否有效 - * 返回值说明: 系统用户角色数据集合 - ***********************************/ - List listRoleUsers(String orgid, String username, String status, - String level, String rolename, String isvaild); - - /*********************************** - * 用途说明:根据 角色id和用户id 删除 (admin除外) - * 参数说明 - *roleid 角色id - * urserid 用户id - * 返回值说明: 是否删除成功 - ***********************************/ - boolean deleteRoleUsers(String roleid, String urserid); - - /********************************** - * 用途说明: 根据用户id获取角色信息 - * 参数说明 id 角色id - * 返回值说明: void - ***********************************/ - List getRoleByUserId(String id); - - /********************************** - * 用途说明: 根据角色ID删除菜单与角色关联信息 - * 参数说明 id 角色id - * 返回值说明: void - ***********************************/ - boolean deleteRoleMenus(String id); - - /********************************** - * 用途说明: 根据角色ID删除用户与角色关联信息 - * 参数说明 id 角色id - * 返回值说明: void - ***********************************/ - boolean deleteRoleUser(String id); - - /********************************** - * 用途说明: 根据角色id获取用户id - * 参数说明 id 角色id - * 返回值说明: 用户id - ***********************************/ - List getUserIdById(String id); - - void addRoleMenu(@Param("id") String id, @Param("roleid") String roleid, - @Param("menuid") String menuid); - - - /********************************** - * 用途说明:根据用户 id 获取角色信息 - * 参数说明 id 用户 id - * 返回值说明:角色列表 - ***********************************/ - List getRoleListByUserId(String id); - - /********************************** - * 用途说明:根据用户 id 获取角色 ID 列表 - * 参数说明 id 用户 id - * 返回值说明:角色 ID 列表 - ***********************************/ - List getRoleIdsByUserId(String id); - - /********************************** - * 用途说明:查询角色列表(Oracle 兼容) - * 参数说明:rolename - 角色名称 - * 返回值说明:角色列表 - ***********************************/ - List selectRoleList(@Param("rolename") String rolename); - -} diff --git a/backend/src/main/java/com/yfd/platform/system/mapper/SysUserMapper.java b/backend/src/main/java/com/yfd/platform/system/mapper/SysUserMapper.java deleted file mode 100644 index 7aae6a3..0000000 --- a/backend/src/main/java/com/yfd/platform/system/mapper/SysUserMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.yfd.platform.system.mapper; - - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yfd.platform.system.domain.SysUser; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -/** - *

- * 系统用户表 Mapper 接口 - *

- * - * @author zhengsl - * @since 2021-10-27 - */ -public interface SysUserMapper extends BaseMapper { - List list(@Param("total")String total, @Param("size")String size, @Param("orgid")String orgid, @Param("username")String username, @Param("mobile")String mobile , @Param("status")String status); - - /*********************************** - * 用途说明:新增系统角色用户对照表 对用户分配角色 - * 参数说明 - * id 生成的id - * roleid 角色id - * userid 用户id - * 返回值说明: - ************************************/ - boolean addUserRoles(@Param("id")String id,@Param("roleid") String roleid,@Param("userid") String userid); - - /*********************************** - * 用途说明:根据用户id 和角色id 查询 系统角色用户对照表 - * 参数说明 - * userid 用户id - * roleid 角色id - * 返回值说明: - ************************************/ - List getRoleUsersByid(@Param("roleid") String roleid,@Param("userid") String userid); - - /*********************************** - * 用途说明:根据用户表id查询角色表所有角色 - * 参数说明 - * userid 用户id - * 返回值说明: - ************************************/ - List getLevel(@Param("userid") String userid); - - /*********************************** - * 用途说明:根据用户表id查询角色表所有角色id - * 参数说明 - * userid 用户id - * 返回值说明: - ************************************/ - List getRoleid(@Param("userid") String userid); - - /*********************************** - * 用途说明:根据用户表id查询角色表级别 - * 参数说明 - * userid 用户id - * 返回值说明: - ************************************/ - String getMaxLevel(@Param("userid") String userid); - - /*********************************** - * 用途说明:根据用户id删除所分配的角色 - * 参数说明 - * userid 用户id - * 返回值说明: - ************************************/ - boolean delRoleUsersByUserid(@Param("userid") String userid); - - /*********************************** - * 用途说明:根据用户id删除所分配的不包含角色 - * 参数说明 - * userid 用户id - * roleids 多个角色id - * 返回值说明: - ************************************/ - boolean delInRoleUsersByUserid(@Param("userid") String userid,@Param("roleids")String[] roleids); - - Page queryUsers(String orgid, - String username, - Page page); - - Map getOrganizationByid(String id); - - /********************************** - * 用途说明: 根据ID删除用户与角色的关联信息 - * 参数说明 ids 用户id集合 - * 返回值说明: void - ***********************************/ - void delRoleUsersByUserIds(List ids); -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/IMessageService.java b/backend/src/main/java/com/yfd/platform/system/service/IMessageService.java deleted file mode 100644 index 2b4c645..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/IMessageService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.yfd.platform.system.service; - -import com.yfd.platform.system.domain.Message; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 消息通知 服务类 - *

- * - * @author TangWei - * @since 2023-03-19 - */ -public interface IMessageService extends IService { - -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/IQuartzJobService.java b/backend/src/main/java/com/yfd/platform/system/service/IQuartzJobService.java deleted file mode 100644 index 8b71868..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/IQuartzJobService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.yfd.platform.system.service; - -import com.yfd.platform.system.domain.QuartzJob; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 定时任务 服务类 - *

- * - * @author TangWei - * @since 2023-03-19 - */ -public interface IQuartzJobService extends IService { - - /********************************** - * 用途说明: 新增定时任务 - * 参数说明 quartzJob 定时对象 - * 返回值说明: boolean 是否成功 - ***********************************/ - boolean addQuartzJob(QuartzJob quartzJob); - - /********************************** - * 用途说明: 删除定时任务 - * 参数说明 id id - * 返回值说明: boolean 是否成功 - ***********************************/ - boolean deleteQuartzJob(String id); - - /********************************** - * 用途说明: 拖动修改定时任务顺序 - * 参数说明 fromID 当前ID toID 到达ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回拖动成功或者失败 - ***********************************/ - boolean changeDictOrder(String fromID, String toID); - - /********************************** - * 用途说明: 执行定时任务 - * 参数说明 id id - * 返回值说明: void - ***********************************/ - void execution(QuartzJob byId); -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/ISysConfigService.java b/backend/src/main/java/com/yfd/platform/system/service/ISysConfigService.java deleted file mode 100644 index ef3a399..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/ISysConfigService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.yfd.platform.system.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.yfd.platform.system.domain.SysConfig; - -import javax.sound.sampled.UnsupportedAudioFileException; -import java.io.IOException; -import java.util.Map; - -/** - *

- * 系统全局配置 服务类 - *

- * - * @author zhengsl - * @since 2022-01-19 - */ -public interface ISysConfigService extends IService { - - - -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/ISysDictionaryItemsService.java b/backend/src/main/java/com/yfd/platform/system/service/ISysDictionaryItemsService.java deleted file mode 100644 index 32f9b8f..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/ISysDictionaryItemsService.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.yfd.platform.system.service; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.IService; -import com.yfd.platform.system.domain.SysDictionaryItems; - -import jakarta.servlet.http.HttpServletResponse; -import java.util.List; - -/** - *

- * 数据字典明细 服务类 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -public interface ISysDictionaryItemsService extends IService { - - /********************************** - * 用途说明: 分页查询字典项信息 - * 参数说明 dictID 字典ID ItemName 字典项名称 pageNum 当前页 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果 - ***********************************/ - Page getDictItemPage(String dictId, String itemName, Page page); - - /********************************** - * 用途说明: 增加字典项 - * 参数说明 sysDictionaryItems 字典项信息 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回增加成功或者失败 - ***********************************/ - boolean addDictionaryItem(SysDictionaryItems sysDictionaryItems); - - /********************************** - * 用途说明: 拖动修改字典项顺序 - * 参数说明 fromID 当前ID toID 到达ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回拖动成功或者失败 - ***********************************/ - boolean changeItemOrder(String fromID, String toID); - - /********************************** - * 用途说明: 导出数据字典项数据 - * 参数说明 sysDictionaryItemsList 所需导出的字典项集合 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回导出成功或失败 - ***********************************/ - void exportExcel(List records, HttpServletResponse response); -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/ISysDictionaryService.java b/backend/src/main/java/com/yfd/platform/system/service/ISysDictionaryService.java deleted file mode 100644 index f3a4990..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/ISysDictionaryService.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.yfd.platform.system.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.yfd.platform.system.domain.SysDictionary; - -import java.util.List; - -/** - *

- * 数据字典表 服务类 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -public interface ISysDictionaryService extends IService { - - /********************************** - * 用途说明: 获取数据字典列表 - * 参数说明 dictType 字典类型 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果 - ***********************************/ - List getDictList(String dictType); - - /********************************** - * 用途说明: 新增字典 - * 参数说明 sysDictionary 字典对象 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回增加成功或者失败 - ***********************************/ - boolean addDict(SysDictionary sysDictionary); - - /********************************** - * 用途说明: 根据ID删除字典 - * 参数说明 id 字典ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回删除结果成功或者失败 - ***********************************/ - boolean deleteDictById(String id); - - /********************************** - * 用途说明: 拖动修改字典顺序 - * 参数说明 fromID 当前ID toID 到达ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回拖动成功或者失败 - ***********************************/ - boolean changeDictOrder(String fromID, String toID); -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/ISysLogService.java b/backend/src/main/java/com/yfd/platform/system/service/ISysLogService.java deleted file mode 100644 index 85fdffa..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/ISysLogService.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.yfd.platform.system.service; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.IService; -import com.yfd.platform.system.domain.SysLog; -import org.aspectj.lang.ProceedingJoinPoint; - -import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - *

- * 系统操作日志 服务类 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -public interface ISysLogService extends IService { - - /********************************** - * 用途说明: 分页查询日志信息 - * 参数说明 pageNum(页码数)、pageSize(页大小,如果是固定页大小可不传)、username(用户名)、(optType) - * 操作类型、startDate(开始日期)、endDate(结束日期) - * 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果 - ***********************************/ - Page getLogList(String username, String optType, - String startDate, - String endDate, Page page); - - - /********************************** - * 用途说明: 导出日志数据 - * 参数说明 sysLogs 所需导出的字典项集合 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回导出成功或者失败 - ***********************************/ - void exportExcel(List sysLogs, HttpServletResponse response) throws IOException; - - /********************************** - * 用途说明: 新增日志 - * 参数说明 nickname 用户名 - * 参数说明 username 用户账号 - * 参数说明 browser 浏览器 - * 参数说明 ip 本机Ip地址 - * 参数说明 joinPoint 连接点 - * 参数说明 log 日志信息 - * 返回值说明: void - ***********************************/ - void save(String nickname,String username, String browser, String ip, ProceedingJoinPoint joinPoint, SysLog log); -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/ISysMenuService.java b/backend/src/main/java/com/yfd/platform/system/service/ISysMenuService.java deleted file mode 100644 index b24b283..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/ISysMenuService.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.yfd.platform.system.service; - -import com.baomidou.mybatisplus.extension.service.IService; - -import com.yfd.platform.system.domain.SysMenu; -import org.springframework.web.multipart.MultipartFile; - -import java.io.FileNotFoundException; -import java.util.List; -import java.util.Map; - -/** - *

- * 菜单及按钮 服务类 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -public interface ISysMenuService extends IService { - - /*********************************** - * 用途说明:获取菜单结构树(含按钮) - * 参数说明 - * systemcode 系统 - * name 名称 - * isdisplay 是否显示 - * 返回值说明: 菜单结构树集合 - ***********************************/ - List> getMenuButtonTree(String systemcode, String name, String isdisplay); - - /*********************************** - * 用途说明:获取菜单结构树(不含按钮) - * 参数说明 - * systemcode 系统 - * name 名称 - * isdisplay 是否显示 - * 返回值说明: 菜单结构树集合 - ***********************************/ - List> getMenuTree(String systemcode, String name, String isdisplay); - - - /*********************************** - * 用途说明:新增菜单及按钮 - * 参数说明 - * sysMenu 菜单或按钮表对象 - * 返回值说明: 是否添加成功提示 - ***********************************/ - boolean addMenu(SysMenu sysMenu); - - /*********************************** - * 用途说明:上传单个图标 - * 参数说明 - * id 上传图标id - * icon 图标 - * 返回值说明: 是否上传成功 - ***********************************/ - boolean uploadIcon(String id, MultipartFile icon); - - /*********************************** - * 用途说明:根据id删除单个图标 - * 参数说明 - * id 删除图标id - * icon 图标名称 - * 返回值说明: 是否删除成功 - ***********************************/ - boolean deleteIcon(String id); - - /*********************************** - * 用途说明:菜单及按钮序号排序 - * 参数说明 - * parentid 上级id - * orderMap map<菜单及按钮表id,排列序号> - * 返回值说明: 是否更新成功 - ***********************************/ - boolean moveOrderno(String parentid, String id, int orderno); - - /*********************************** - * 用途说明:根据id删除菜单或按钮 - * 参数说明 - * id 删除列的id - * 返回值说明: 是否删除成功 - ***********************************/ - boolean deleteById(String id); - - boolean changeOderNoById(String fromId, String toId); - - List> getMenuTree(String id); - - /*********************************** - * 用途说明:权限分配 - * 参数说明 - * systemcode 系统 - * name 名称 - * isdisplay 是否显示 - * 返回值说明: 菜单结构树集合 - ***********************************/ - List> permissionAssignment(String code,String roleId); - - String uploadIcon(MultipartFile icon) throws FileNotFoundException; -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/ISysOrganizationService.java b/backend/src/main/java/com/yfd/platform/system/service/ISysOrganizationService.java deleted file mode 100644 index 5b03119..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/ISysOrganizationService.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.yfd.platform.system.service; - - -import com.baomidou.mybatisplus.extension.service.IService; -import com.yfd.platform.system.domain.SysOrganization; - -import java.util.List; -import java.util.Map; - -/** - *

- * 系统组织框架 服务类 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -public interface ISysOrganizationService extends IService { - - /*********************************** - * 用途说明:获取组织结构树 - * 参数说明 - *parentid 上级id - * params 名称(根据名称查询二级) - * 返回值说明: 组织树集合 - ***********************************/ - List> getOrgTree(String parentid, String params); - - /*********************************** - * 用途说明:新增系统组织框架 - * 参数说明 - * sysOrganization 系统组织框架对象 - * 返回值说明: 是否新增成功 - ***********************************/ - boolean addOrg(SysOrganization sysOrganization); - - /*********************************** - * 用途说明:根据企业ID查询组织详情 - * 参数说明 - * id 企业id - * 返回值说明: 系统组织框架对象 - ***********************************/ - List getOrganizationById(String id,String orgName); - - /*********************************** - * 用途说明:获取组织范围树结构 - * 参数说明 - *roleId 角色id - * 返回值说明: 组织树集合 - ***********************************/ - List> getOrgScopeTree(String roleId); - - /********************************** - * 用途说明: 修改角色组织范围 - * 参数说明 roleId 角色id - * 参数说明 orgscope 组织id集合 - * 返回值说明: boolean 是否修改成功 - ***********************************/ - boolean updateOrgScopeByRoleId(String roleId, String orgscope); -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/ISysRoleService.java b/backend/src/main/java/com/yfd/platform/system/service/ISysRoleService.java deleted file mode 100644 index 2065a17..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/ISysRoleService.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.yfd.platform.system.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.yfd.platform.system.domain.SysRole; - -import java.util.List; -import java.util.Map; - -/** - *

- * 系统角色 服务类 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -public interface ISysRoleService extends IService { - - /*********************************** - * 用途说明:新增角色 - * 参数说明 - * sysRole 新增角色信息 - * 返回值说明: 是否新增成功 - ***********************************/ - boolean addRole(SysRole sysRole); - - /*********************************** - * 用途说明:删除角色用户 - * 参数说明 - * id 系统角色用户对照表id - * 返回值说明: 是否新增成功 - ***********************************/ - - boolean deleteRoleUsers(String roleid, String urserids); - - /*********************************** - * 用途说明:根据id删除角色 - * 参数说明 - *id 角色id - * 返回值说明: 是否删除成功 - ***********************************/ - void deleteById(String id); - - /*********************************** - * 用途说明:查询已分配的用户 - * 参数说明 - *orgid 所属组织 - *username 用户名称 - *status 状态 - *level 角色级别 - * rolename 角色名称 - * isvaild 角色是否有效 - * 返回值说明: 系统用户角色数据集合 - ***********************************/ - List listRoleUsers(String orgid, String username, String status, String level, String rolename, String isvaild); - - - /*********************************** - * 用途说明:角色分配权限 - * 参数说明 - * id 角色id - * menuIds 权限id字符串 - * 返回值说明: 是否分配成功 - ***********************************/ - boolean setMenuById(String id, String menuIds); - - List selectRoleList(String rolename); -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/IUserService.java b/backend/src/main/java/com/yfd/platform/system/service/IUserService.java deleted file mode 100644 index e1ff507..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/IUserService.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.yfd.platform.system.service; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.IService; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.LoginUser; -import com.yfd.platform.system.domain.SysUser; -import org.springframework.web.multipart.MultipartFile; - -import java.io.File; -import java.util.List; -import java.util.Map; - -/** - *

- * 系统用户 - *

- * - * @author zhengsl - * @since 2021-10-27 - */ -public interface IUserService extends IService { - - //获取当前用户账号及名称 - String getUsername(); - - //获取当前用户信息 - SysUser getUserInfo(); - /*********************************** - * 用途说明:获取当前用户账号与姓名 - * 返回值说明: 当前用户账号与姓名 - ************************************/ - Map getNameInfo(); - //获取当前用户信息带权限 - ResponseResult getLoginUserInfo(); - - /*********************************** - * 用途说明:新增用户 - * 参数说明 - *sysUser 新增用户对象 - * id 创建者id - * roleId 角色id - * 返回值说明: 提示字符串 - ************************************/ - Map addUser(SysUser sysUser, String roleids); - - /*********************************** - * 用途说明:查询系统用户 - * 参数说明 - *page 分页集合参数 - *orgid 所属组织 - *username 用户名称 - * mobile 手机号 - * status 状态 - * 返回值说明: 用户分页集合 - ************************************/ - List list(String total, String size, String orgid, String username, - String mobile, String status); - - /*********************************** - * 用途说明:根据ID查询用户详情 - * 参数说明 - *id 用户id - * 返回值说明: 用户表对象 - ************************************/ - Map getOneById(String id); - - /*********************************** - * 用途说明:根据ID修改用户 - * 参数说明 - *sysUser 用户对象 - *roleids 角色id - * 返回值说明: 是否更新成功 - ************************************/ - Map updateById(SysUser sysUser, String roleids); - - /*********************************** - * 用途说明:用户分配角色(多个) - * 参数说明 - *roleid 角色id - * userids 用户id数组 - * 返回值说明: 判断是否添加成功 - ************************************/ - boolean setUserRoles(String roleid, String userids); - - /*********************************** - * 用途说明:根据id删除用户 - * 参数说明 - *id 用户id - * 返回值说明: 判断是否删除成功 - ************************************/ - boolean deleteById(String id); - - /*********************************** - * 用途说明:重置用户密码(管理员) - * 参数说明 - *id 重置密码的 用户id - * 返回值说明: 判断是否重置成功 - ************************************/ - boolean resetPassword(String id) throws Exception; - - /*********************************** - * 用途说明:设置账号状态(管理员) - * 参数说明 - *id 用户id - * status 设置状态 - * 返回值说明: 判断是否设置成功 - ************************************/ - boolean setStatus(String id, String status); - - /*********************************** - * 用途说明:上传用户头像 - * 参数说明 - * id 用户id - * img 账号头像 - * 返回值说明: 判断是否上传 - ***********************************/ - boolean uploadAvatar(String id, MultipartFile img); - - /*********************************** - * 用途说明:新增系统角色用户对照表 对用户分配角色(单个) - * 参数说明 - * id 生成的id - * userid 用户id - * roleid 角色id - * 返回值说明: - ************************************/ - boolean addUserRoles(String roleid, String userid); - - //Page queryUsers(String orgid, String username, Page page); - Page queryUsers(String orgid, String username, Page page); - - /*********************************** - * 用途说明:根据ID批量删除用户 - * 参数说明 - *ids 用户id集合 - * 返回值说明: 判断是否删除成功 - ************************************/ - boolean deleteUserByIds(String ids); - - - -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/impl/MessageServiceImpl.java b/backend/src/main/java/com/yfd/platform/system/service/impl/MessageServiceImpl.java deleted file mode 100644 index 0d3875f..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/impl/MessageServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.yfd.platform.system.service.impl; - -import com.yfd.platform.system.domain.Message; -import com.yfd.platform.system.mapper.MessageMapper; -import com.yfd.platform.system.service.IMessageService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 消息通知 服务实现类 - *

- * - * @author TangWei - * @since 2023-03-19 - */ -@Service -public class MessageServiceImpl extends ServiceImpl implements IMessageService { - -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/impl/QuartzJobServiceImpl.java b/backend/src/main/java/com/yfd/platform/system/service/impl/QuartzJobServiceImpl.java deleted file mode 100644 index d2a9030..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/impl/QuartzJobServiceImpl.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.yfd.platform.system.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.yfd.platform.system.domain.QuartzJob; -import com.yfd.platform.system.domain.SysDictionary; -import com.yfd.platform.system.mapper.QuartzJobMapper; -import com.yfd.platform.system.service.IQuartzJobService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yfd.platform.utils.QuartzManage; -import org.springframework.stereotype.Service; - -import jakarta.annotation.Resource; -import java.util.Arrays; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -/** - *

- * 定时任务 服务实现类 - *

- * - * @author TangWei - * @since 2023-03-19 - */ -@Service -public class QuartzJobServiceImpl extends ServiceImpl implements IQuartzJobService { - - @Resource - private QuartzJobMapper quartzJobMapper; - - @Resource - private QuartzManage quartzManage; - - /********************************** - * 用途说明: 新增定时任务 - * 参数说明 quartzJob 定时对象 - * 返回值说明: boolean 是否成功 - ***********************************/ - @Override - public boolean addQuartzJob(QuartzJob quartzJob) { - // 生成序号 - long orderNo = this.count() + 1L; - quartzJob.setOrderno((int) orderNo); - return this.save(quartzJob); - } - - /********************************** - * 用途说明: 删除定时任务 - * 参数说明 id id - * 返回值说明: boolean 是否成功 - ***********************************/ - @Override - public boolean deleteQuartzJob(String id) { - String[] split = id.split(","); - Set ids = Arrays.stream(split).collect(Collectors.toSet()); - for (String s : ids) { - QuartzJob quartzJob = this.getById(s); - quartzManage.deleteJob(quartzJob); - this.removeById(s); - } - - // 查询所有定时任务 - List list = - this.list(new LambdaQueryWrapper().orderByAsc(QuartzJob::getOrderno)); - // 更新序号 - for (int i = 0; i < list.size(); i++) { - QuartzJob quartzJob = list.get(i); - quartzJob.setOrderno(i + 1); - this.updateById(quartzJob); - } - return true; - } - - /********************************** - * 用途说明: 拖动修改定时任务顺序 - * 参数说明 fromID 当前ID toID 到达ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回拖动成功或者失败 - ***********************************/ - @Override - public boolean changeDictOrder(String fromID, String toID) { - QuartzJob fromQuartzJob = - quartzJobMapper.selectById(fromID); - QuartzJob toQuartzJob = quartzJobMapper.selectById(toID); - // 如果数据字典不存在拖动失败 - if (fromQuartzJob == null || toQuartzJob == null) { - return false; - } - Integer fromOrderNo = fromQuartzJob.getOrderno(); - Integer toOrderNo = toQuartzJob.getOrderno(); - // 如果数据字典的顺序号不存在拖动失败 - if (fromOrderNo == null || toOrderNo == null) { - return false; - } - // 将顺序号放入字典对象中 - fromQuartzJob.setOrderno(toOrderNo); - toQuartzJob.setOrderno(fromOrderNo); - // 更改顺序号 - boolean fromBool = this.updateById(fromQuartzJob); - boolean toBool = this.updateById(toQuartzJob); - return fromBool && toBool; - } - - /********************************** - * 用途说明: 执行定时任务 - * 参数说明 id id - * 返回值说明: void - ***********************************/ - @Override - public void execution(QuartzJob quartzJob) { - quartzManage.runJobNow(quartzJob); - } -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/impl/SysConfigServiceImpl.java b/backend/src/main/java/com/yfd/platform/system/service/impl/SysConfigServiceImpl.java deleted file mode 100644 index da15188..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/impl/SysConfigServiceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.yfd.platform.system.service.impl; - - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yfd.platform.system.domain.SysConfig; -import com.yfd.platform.system.mapper.SysConfigMapper; -import com.yfd.platform.system.service.ISysConfigService; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import jakarta.annotation.Resource; -import javax.sound.sampled.UnsupportedAudioFileException; -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -/** - *

- * 系统全局配置 服务实现类 - *

- * - * @author zhengsl - * @since 2022-01-19 - */ -@Service -public class SysConfigServiceImpl extends ServiceImpl implements ISysConfigService { - @Resource - private UserServiceImpl currentUser; - - - - -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/impl/SysDictionaryItemsServiceImpl.java b/backend/src/main/java/com/yfd/platform/system/service/impl/SysDictionaryItemsServiceImpl.java deleted file mode 100644 index 26a30ab..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/impl/SysDictionaryItemsServiceImpl.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.yfd.platform.system.service.impl; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yfd.platform.system.domain.SysDictionaryItems; -import com.yfd.platform.system.mapper.SysDictionaryItemsMapper; -import com.yfd.platform.system.service.ISysDictionaryItemsService; -import com.yfd.platform.utils.FileUtil; -import org.springframework.stereotype.Service; - -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletResponse; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - *

- * 数据字典明细 服务实现类 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -@Service -public class SysDictionaryItemsServiceImpl extends ServiceImpl implements ISysDictionaryItemsService { - - @Resource - private SysDictionaryItemsMapper sysDictionaryItemsMapper; - - /********************************** - * 用途说明: 分页查询字典项信息 - * 参数说明 dictID 字典ID ItemName 字典项名称 pageNum 当前页 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果 - ***********************************/ - @Override - public Page getDictItemPage(String dictId, - String itemName, - Page page) { - LambdaQueryWrapper queryWrapper = - new LambdaQueryWrapper<>(); - if (StrUtil.isNotBlank(itemName)) { - queryWrapper.like(SysDictionaryItems::getDictName, itemName); - } - queryWrapper.eq(SysDictionaryItems::getDictId, dictId).orderByAsc(SysDictionaryItems::getOrderNo); - return sysDictionaryItemsMapper.selectPage(page, queryWrapper); - } - - /********************************** - * 用途说明: 增加字典项 - * 参数说明 sysDictionaryItems 字典项信息 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回增加成功或者失败 - ***********************************/ - @Override - public boolean addDictionaryItem(SysDictionaryItems sysDictionaryItems) { - LambdaQueryWrapper queryWrapper = - new LambdaQueryWrapper<>(); - queryWrapper.eq(SysDictionaryItems::getDictId,sysDictionaryItems.getDictId()); - long orderNo = this.count(queryWrapper) + 1L; - // 添加顺序号 - sysDictionaryItems.setOrderNo((int) orderNo); - return this.save(sysDictionaryItems); - } - - /********************************** - * 用途说明: 拖动修改字典项顺序 - * 参数说明 fromID 当前ID toID 到达ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回拖动成功或者失败 - ***********************************/ - @Override - public boolean changeItemOrder(String fromID, String toID) { - SysDictionaryItems fromSysDictionaryItems = - sysDictionaryItemsMapper.selectById(fromID); - SysDictionaryItems toSysDictionaryItems = - sysDictionaryItemsMapper.selectById(toID); - // 如果数据字典项不存在拖动失败 - if (fromSysDictionaryItems == null || toSysDictionaryItems == null) { - return false; - } - Integer fromOrderNo = fromSysDictionaryItems.getOrderNo(); - Integer toOrderNo = toSysDictionaryItems.getOrderNo(); - // 如果数据字典的顺序号不存在拖动失败 - if (fromOrderNo == null || toOrderNo == null) { - return false; - } - // 将顺序号放入字典对象中 - fromSysDictionaryItems.setOrderNo(toOrderNo); - toSysDictionaryItems.setOrderNo(fromOrderNo); - // 更改顺序号 - boolean fromBool = this.updateById(fromSysDictionaryItems); - boolean toBool = this.updateById(toSysDictionaryItems); - return fromBool && toBool; - - } - - /********************************** - * 用途说明: 导出数据字典项数据 - * 参数说明 sysDictionaryItemsList 所需导出的字典项集合 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回导出成功或失败 - ***********************************/ - @Override - public void exportExcel(List sysDictionaryItems, - HttpServletResponse response) { - try { - List> list = new LinkedList<>(); - for (SysDictionaryItems sysDictionaryItem : sysDictionaryItems) { - Map map = new LinkedHashMap<>(); - map.put("项编号", sysDictionaryItem.getItemCode()); - map.put("项名称", sysDictionaryItem.getDictName()); - map.put("父编码", sysDictionaryItem.getParentCode()); - map.put("备注", sysDictionaryItem.getCustom1()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/impl/SysDictionaryServiceImpl.java b/backend/src/main/java/com/yfd/platform/system/service/impl/SysDictionaryServiceImpl.java deleted file mode 100644 index 58508b3..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/impl/SysDictionaryServiceImpl.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.yfd.platform.system.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yfd.platform.system.domain.SysDictionary; -import com.yfd.platform.system.domain.SysDictionaryItems; -import com.yfd.platform.system.mapper.SysDictionaryItemsMapper; -import com.yfd.platform.system.mapper.SysDictionaryMapper; -import com.yfd.platform.system.service.ISysDictionaryService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import jakarta.annotation.Resource; -import java.util.List; - -/** - *

- * 数据字典表 服务实现类 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -@Service -public class SysDictionaryServiceImpl extends ServiceImpl implements ISysDictionaryService { - - @Resource - private SysDictionaryMapper sysDictionaryMapper; - - @Resource - private SysDictionaryItemsMapper sysDictionaryItemsMapper; - - /********************************** - * 用途说明: 获取数据字典列表 - * 参数说明 dictType 字典类型 - * 返回值说明: 返回字典列表集合 - ***********************************/ - @Override - public List getDictList(String dictType) { - LambdaQueryWrapper queryWrapper = - new LambdaQueryWrapper<>(); - queryWrapper.eq(SysDictionary::getDictType, dictType).orderByAsc(SysDictionary::getOrderNo); - return sysDictionaryMapper.selectList(queryWrapper); - } - - /********************************** - * 用途说明: 新增字典 - * 参数说明 sysDictionary 字典对象 - * 返回值说明: 返回增加成功或者失败 - ***********************************/ - @Override - public boolean addDict(SysDictionary sysDictionary) { - //int orderNo = this.count() + 1; - Integer maxNo = - sysDictionaryMapper.selectMaxNo(sysDictionary.getDictType()); - if (maxNo == null) { - maxNo = 0; - } - // 添加顺序号 - sysDictionary.setOrderNo(maxNo + 1); - return this.save(sysDictionary); - } - - /********************************** - * 用途说明: 根据ID删除字典 - * 参数说明 id 字典ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回删除结果成功或者失败 - ***********************************/ - @Override - @Transactional(rollbackFor = Exception.class) - public boolean deleteDictById(String id) { - // 根据字典编码查询字典项中是否关联 - boolean isok=true; - QueryWrapper Wrapper = new QueryWrapper<>(); - Wrapper.eq("dictid", id); - if(sysDictionaryItemsMapper.delete(Wrapper)>0) { - isok=true; - } - return isok&&this.removeById(id); - } - - /********************************** - * 用途说明: 拖动修改字典顺序 - * 参数说明 fromID 当前ID toID 到达ID - * 返回值说明: com.yfd.platform.config.ResponseResult 返回拖动成功或者失败 - ***********************************/ - @Override - public boolean changeDictOrder(String fromID, String toID) { - SysDictionary fromSysDictionary = - sysDictionaryMapper.selectById(fromID); - SysDictionary toSysDictionary = sysDictionaryMapper.selectById(toID); - // 如果数据字典不存在拖动失败 - if (fromSysDictionary == null || toSysDictionary == null) { - return false; - } - Integer fromOrderNo = fromSysDictionary.getOrderNo(); - Integer toOrderNo = toSysDictionary.getOrderNo(); - // 如果数据字典的顺序号不存在拖动失败 - if (fromOrderNo == null || toOrderNo == null) { - return false; - } - // 将顺序号放入字典对象中 - fromSysDictionary.setOrderNo(toOrderNo); - toSysDictionary.setOrderNo(fromOrderNo); - // 更改顺序号 - boolean fromBool = this.updateById(fromSysDictionary); - boolean toBool = this.updateById(toSysDictionary); - return fromBool && toBool; - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/impl/SysLogServiceImpl.java b/backend/src/main/java/com/yfd/platform/system/service/impl/SysLogServiceImpl.java deleted file mode 100644 index ee671bf..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/impl/SysLogServiceImpl.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.yfd.platform.system.service.impl; - -import cn.hutool.core.date.DateTime; -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yfd.platform.annotation.Log; -import com.yfd.platform.system.domain.SysLog; -import com.yfd.platform.system.mapper.SysLogMapper; -import com.yfd.platform.system.mapper.SysUserMapper; -import com.yfd.platform.system.service.ISysLogService; -import com.yfd.platform.utils.FileUtil; -import com.yfd.platform.utils.StringUtils; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.reflect.MethodSignature; -import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; - -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.lang.reflect.AnnotatedType; -import java.lang.reflect.Method; -import java.lang.reflect.Parameter; -import java.sql.Timestamp; -import java.text.SimpleDateFormat; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; - -/** - *

- * 系统操作日志 服务实现类 - *

- * - * @author TangWei - * @since 2023-03-08 - */ -@Service -public class SysLogServiceImpl extends ServiceImpl implements ISysLogService { - - @Resource - private SysLogMapper sysLogMapper; - - /********************************** - * 用途说明: 分页查询日志信息 - * 参数说明 pageNum(页码数)、pageSize(页大小,如果是固定页大小可不传)、username(用户名)、(optType) - * 操作类型、startDate(开始日期)、endDate(结束日期) - * 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果 - ***********************************/ - @Override - public Page getLogList(String username, String optType, - String startDate, - String endDate, Page page) { - - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - // 没有传username就不按此条件查询 - if (StrUtil.isNotBlank(username)) { - queryWrapper.like(SysLog::getUsername, username); - } - // 没有传optType就不按此条件查询 - if (StrUtil.isNotBlank(optType)) { - queryWrapper.eq(SysLog::getOpttype, optType); - } - DateTime parseStartDate = DateUtil.parse(startDate); - DateTime parseEndDate = DateUtil.parse(endDate); - DateTime dateTime = DateUtil.offsetDay(parseEndDate, 1); - if (parseStartDate != null && parseEndDate != null) { - queryWrapper.ge(SysLog::getLogtime, parseStartDate).lt(SysLog::getLogtime, dateTime); - } - - queryWrapper.orderByDesc(SysLog::getLogtime); - return sysLogMapper.selectPage(page, queryWrapper); - } - - /********************************** - * 用途说明: 导出日志数据 - * 参数说明 sysLogs 所需导出的字典项集合 - * 返回值说明: com.yfd.platform.config.ResponseResult 返回导出成功或者失败 - ***********************************/ - @Override - public void exportExcel(List sysLogs, - HttpServletResponse response) { - try { - List> list = new LinkedList<>(); - for (SysLog sysLog : sysLogs) { - Map map = new LinkedHashMap<>(); - map.put("操作账号", sysLog.getUsercode()); - map.put("用户姓名", sysLog.getUsername()); - map.put("IP地址", sysLog.getRequestip()); - map.put("浏览器", sysLog.getBrowser()); - map.put("日志类型", sysLog.getOpttype()); - map.put("模块名称", sysLog.getModule()); - map.put("日志描述", sysLog.getDescription()); - Timestamp logTime = sysLog.getLogtime(); - String dateTime = ""; - if (logTime != null) { - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd " + - "HH:mm:ss"); - dateTime = df.format(logTime); - } - - /*String dateTime = ""; - if (logTime != null) { - dateTime = logTime.format(DateTimeFormatter.ofPattern( - "yyyy-MM-dd HH:mm:ss")); - }*/ - - map.put("操作日期", dateTime); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - /********************************** - * 用途说明: 新增日志 - * 参数说明 nickname 用户名 - * 参数说明 username 用户账号 - * 参数说明 browser 浏览器 - * 参数说明 ip 本机Ip地址 - * 参数说明 joinPoint 连接点 - * 参数说明 log 日志信息 - * 返回值说明: void - ***********************************/ - @Override - public void save(String nickname, String username, String browser, - String ip, - ProceedingJoinPoint joinPoint, SysLog log) { - MethodSignature signature = (MethodSignature) joinPoint.getSignature(); - Method method = signature.getMethod(); - Log aopLog = method.getAnnotation(Log.class); - // 方法路径 - String methodName = - joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()"; - // 描述 - if (log != null) { - log.setDescription(aopLog.value()); - log.setModule(aopLog.module()); - } - assert log != null; - log.setUsercode(username); - log.setRequestip(ip); - log.setMethod(methodName); - log.setUsername(nickname); - log.setParams(getParameter(method, joinPoint.getArgs())); - log.setBrowser(browser); - String operationtype = getOperationtype(signature.getName()); - log.setOpttype(operationtype); - log.setLogtime(new Timestamp(System.currentTimeMillis())); - sysLogMapper.insert(log); - } - - /** - * 根据方法和传入的参数获取请求参数 - */ - private String getParameter(Method method, Object[] args) { - List argList = new ArrayList<>(); - Parameter[] parameters = method.getParameters(); - for (int i = 0; i < parameters.length; i++) { - //将RequestBody注解修饰的参数作为请求参数 - AnnotatedType type = parameters[i].getAnnotatedType(); - - RequestBody requestBody = - parameters[i].getAnnotation(RequestBody.class); - if (requestBody != null) { - argList.add(args[i]); - } - - //将RequestParam注解修饰的参数作为请求参数 - RequestParam requestParam = - parameters[i].getAnnotation(RequestParam.class); - if (requestParam != null) { - Map map = new HashMap<>(); - String key = parameters[i].getName(); - if (!StringUtils.isEmpty(requestParam.value())) { - key = requestParam.value(); - } - map.put(key, args[i]); - argList.add(map); - } - } - if (argList.size() == 0) { - return ""; - } - return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : - JSONUtil.toJsonStr(argList); - } - - public static String getOperationtype(String value) { - String type = ""; - if (value.contains("get") || value.contains("select")) { - type = "查询(select)"; - } else if (value.contains("add") || value.contains("insert")) { - type = "添加(insert)"; - } else if (value.contains("update") || value.contains("upd") || value.contains("change") || value.contains("set")) { - type = "修改(update)"; - } else if (value.contains("delete") || value.contains("del")) { - type = "删除(delete)"; - } else if (value.contains("dowload")) { - type = "下载(dowload)"; - } else if (value.contains("import")) { - type = "导入(import)"; - } else if (value.contains("word")) { - type = "word转pdf(wordToPdf)"; - } else { - type = "其他(other)"; - } - return type; - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/impl/SysMenuServiceImpl.java b/backend/src/main/java/com/yfd/platform/system/service/impl/SysMenuServiceImpl.java deleted file mode 100644 index af5dcad..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/impl/SysMenuServiceImpl.java +++ /dev/null @@ -1,695 +0,0 @@ -package com.yfd.platform.system.service.impl; - -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yfd.platform.system.domain.SysMenu; -import com.yfd.platform.system.domain.SysRole; -import com.yfd.platform.system.mapper.SysMenuMapper; -import com.yfd.platform.system.mapper.SysRoleMapper; -import com.yfd.platform.system.service.ISysMenuService; -import com.yfd.platform.utils.FileUtil; -import com.yfd.platform.config.FileSpaceProperties; -import com.yfd.platform.utils.ObjectConverterUtil; -import jakarta.annotation.Resource; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.ResourceUtils; -import org.springframework.web.multipart.MultipartFile; - -import jakarta.annotation.Resource; -import java.io.File; -import java.io.FileNotFoundException; -import java.sql.Timestamp; -import java.text.DecimalFormat; -import java.util.*; -import java.util.stream.Collectors; - -/** - *

- * 菜单及按钮 服务实现类 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -@Service -@Transactional -public class SysMenuServiceImpl extends ServiceImpl implements ISysMenuService { - - @Resource - private SysMenuMapper sysMenuMapper; - - @Resource - private UserServiceImpl currentUser; - - @Resource - private SysRoleMapper sysRoleMapper; - - // 菜单图片路径配置 - @Resource - private FileSpaceProperties fileSpaceProperties; - - /*********************************** - * 用途说明:查询菜单及按钮树状图 - * 参数说明 - * systemcode 系统 - *isdisplay 是否显示 - * 返回值说明: 菜单结构树集合 - ***********************************/ - @Override - public List> getMenuButtonTree(String systemcode, - String name, - String isdisplay) { - List> mapList=null; - List> listMap =new ArrayList<>(); - if(StrUtil.isEmpty(name)){//不带名称查询,返回树结构 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("parentid", "0").eq("systemcode", systemcode).orderByAsc("orderno"); - mapList = this.listMaps(queryWrapper); - listMap.addAll(ObjectConverterUtil.convertMapFieldsToEntityFormat(SysMenu.class, mapList)); - for (int i = 0; i < listMap.size(); i++) { - //查询下一子集 - List> childList = child(listMap.get(i).get( - "id").toString(), systemcode, name, null, null); - listMap.get(i).put("children", childList); //添加新列 子集 - } - }else{ //根据菜单名称查询,直接返回类别 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.like("name", name).eq("systemcode", systemcode).orderByAsc("name"); - mapList = this.listMaps(queryWrapper); - listMap.addAll(ObjectConverterUtil.convertMapFieldsToEntityFormat(SysMenu.class, mapList)); - } - return listMap; - } - - /*********************************** - * 用途说明:获取菜单结构树(不含按钮) - * 参数说明 - * systemcode 系统 - * isdisplay 是否显示 - * 返回值说明: 菜单结构树集合 - ***********************************/ - @Override - public List> getMenuTree(String systemcode, - String name, - String isdisplay) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - if (StrUtil.isNotEmpty(isdisplay)) { - queryWrapper.eq("isdisplay", isdisplay); - } else { - queryWrapper.eq("isdisplay", 1); - } - - //根据系统 ,类型不为2 显示,序号 正序排序 - queryWrapper.eq("parentid", "0").eq("systemcode", systemcode).ne( - "type", "2").orderByAsc("orderno"); - List> listMap = this.listMaps(queryWrapper); - for (int i = 0; i < listMap.size(); i++) { - List> childList = child(listMap.get(i).get( - "id").toString(), systemcode, name, isdisplay, "2");//查询下一子集 - listMap.get(i).put("children", childList); //添加新列 子集 - } - return listMap; - } - - /*********************************** - * 用途说明:查询菜单及按钮树状图 - * 参数说明 - * parentid 上级id - *systemcode 系统 - * isdisplay 是否显示 - * type 按钮 - * 返回值说明: 菜单结构树集合 - ***********************************/ - private List> child(String parentid, - String systemcode, String name, - String isdisplay, String type) { - List> mapList; - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("parentid", parentid).eq("systemcode", systemcode); - //根据上级id 系统 查询 - if (StrUtil.isNotEmpty(type)) { - queryWrapper.ne("type", type); - } - - if (StrUtil.isNotEmpty(name)) { //根据菜单名称查询 - queryWrapper.like("name", name); - } - mapList = this.listMaps(queryWrapper.orderByAsc("orderno")); - List> listMap = ObjectConverterUtil.convertMapFieldsToEntityFormat(SysMenu.class, mapList); - if (!listMap.isEmpty()) { //判断是否存在子集 - for (int i = 0; i < listMap.size(); i++) { //遍历表数据 - List> childList = - child(listMap.get(i).get("id").toString(), systemcode - , name, isdisplay, type); //循环获取下一子集 - listMap.get(i).put("children", childList); //添加新列 子集 - } - } - - return listMap; - } - - /*********************************** - * 用途说明:新增菜单及按钮 - * 参数说明 - * sysMenu 菜单或按钮表对象 - * 返回值说明: 是否添加成功提示 - ***********************************/ - @Override - public boolean addMenu(SysMenu sysMenu) { - String parentId = sysMenu.getParentid(); - QueryWrapper queryWrapper = new QueryWrapper<>(); - //根据上级id 查询到总数 并累加 - long orderno = this.count(queryWrapper.eq("parentid", - parentId)) + 1L; - // 生成排序号 - sysMenu.setOrderno((int) orderno); - // 生成编号 - QueryWrapper queryMaxCode = new QueryWrapper<>(); - queryMaxCode.eq("parentid", parentId); - - // 使用 Oracle 兼容的 NVL 函数处理空值 - List maxList = this.listObjs( - queryMaxCode.select("NVL(MAX(code), '0') as code") - .eq("systemcode", sysMenu.getSystemcode()) - ); - SysMenu parentMenu = sysMenuMapper.selectById(parentId); - // 最大编号转换成int类型 - String maxCode = !maxList.isEmpty() ? maxList.getFirst().toString() : "0"; - int max = ObjectUtil.isEmpty(maxList) ? 0 : - Integer.parseInt(maxCode); - DecimalFormat df; - if ("0".equals(sysMenu.getParentid())) { - df = new DecimalFormat("00"); - } else if (parentMenu.getCode().length() == 2) { - df = new DecimalFormat("0000"); - } else { - df = new DecimalFormat("000000"); - } - //DecimalFormat df = new DecimalFormat("00"); - //int parentCode = Integer.parseInt(parentMenu.getCode()); - String parentCode = ""; - if (parentMenu != null) { - parentCode = parentMenu.getCode(); - } - // 生成的新编号 年月日+4位编号 - String code; - if (max > 0) { - code = df.format(max + 1); - } else { - max = max + 1; - if (StrUtil.isBlank(parentCode)) { - parentCode = "0" + max; - } else { - int i = Integer.parseInt(parentCode); - parentCode = i + "0" + max; - } - - int format = Integer.parseInt(parentCode); - code = df.format(format); - } - - // 判断是否显示字段 是否填写 为空 - if (StrUtil.isEmpty(sysMenu.getIsdisplay())) { - // 默认设置成 1 显示 - sysMenu.setIsdisplay("1"); - } - // 判断是否填写父级id 为空 默认设置成 0 - if (StrUtil.isEmpty(sysMenu.getParentid())) { - sysMenu.setParentid("0"); - } - // 添加编号 - sysMenu.setCode(code); - // 添加排序号 - sysMenu.setOrderno((int) orderno); - // 添加最近修改人 - sysMenu.setLastmodifier(currentUser.getUsername()); - // 添加最近修改时间 - sysMenu.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - return this.save(sysMenu); - } - - /*********************************** - * 用途说明:上传单个图标 - * 参数说明 - * id 上传图标id - * icon 图标 - * 返回值说明: 是否上传成功 - ***********************************/ - @Override - public boolean uploadIcon(String id, MultipartFile icon) { - //根据id查询 - SysMenu sysMenu = this.getById(id); - //图片路径 - String iconPath = fileSpaceProperties.getSystem() + "menu" + File.separator; - String iconname = - IdUtil.fastSimpleUUID() + "." + FileUtil.getExtensionName(icon.getOriginalFilename()); - //上传图标并获取图标名称 (图片改为png格式) - String filename = - FileUtil.upload(icon, iconPath, iconname).getName(); - //更新图标名称 - sysMenu.setIcon(filename); - //添加最近修改人 - sysMenu.setLastmodifier(currentUser.getUsername()); - //添加最近修改时间 - sysMenu.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - //更新数据 - boolean isOk = this.updateById(sysMenu); - return isOk; - } - - /*********************************** - * 用途说明:根据id删除单个图标 - * 参数说明 - * id 删除图标id - * icon 图标名称 - * 返回值说明: 是否删除成功 - ***********************************/ - @Override - public boolean deleteIcon(String id) { - //根据id查询 - SysMenu sysMenu = this.getById(id); - //图片路径 - String iconname = - System.getProperty("user.dir") + "\\src\\main" + - "\\resources\\static\\icon" + File.separator + sysMenu.getIcon(); - //更新图标名称 - sysMenu.setIcon(""); - //添加最近修改人 - sysMenu.setLastmodifier(currentUser.getUsername()); - //添加最近修改时间 - sysMenu.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - //更新数据 - boolean isOk = this.updateById(sysMenu); - //更新成功 删除图片 - if (isOk == true) { - FileUtil.del(iconname); - } - return isOk; - } - - /*********************************** - * 用途说明:菜单及按钮序号排序 - * 参数说明 - * parentid 上级id - * id - * orderno 更改后序号 - * 返回值说明: 是否更新成功 - ***********************************/ - @Override - public boolean moveOrderno(String parentid, String id, int orderno) { - boolean ok = true; - SysMenu sysMenu = this.getById(id); //根据id查询原顺序号 - if (sysMenu.getOrderno() > orderno) { - ok = sysMenuMapper.upMoveOrderno(parentid, sysMenu.getOrderno(), - orderno); //根据 父级id 小于原序号 大于等于更改序号 - } else { - ok = sysMenuMapper.downMoveOrderno(parentid, sysMenu.getOrderno() - , orderno); //根据 父级id 大于原序号 小于等于更改序号 - } - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - ok = ok && this.update(updateWrapper.eq("id", id).set("orderno", - orderno)); //根据 id修改序号 - return ok; - } - - /*********************************** - * 用途说明:根据id删除菜单或按钮 - * 参数说明 - * id 删除列的id - * 返回值说明: 是否删除成功 - ***********************************/ - @Override - public boolean deleteById(String id) { - //根据id查询 - SysMenu sysMenu = this.getById(id); - //图片路径 - String iconname = - fileSpaceProperties.getSystem() + "menu" + File.separator + sysMenu.getIcon(); - //删除图标 - new File(iconname).delete(); - //根据id删除 - boolean isOk = this.removeById(id); - //删除成功同步更新表数据 - if (isOk) { - //1 创建list集合,用于封装所有删除目录或菜单id值 - List idList = new ArrayList<>(); - this.selectPermissionChildById(id, idList); - if (idList.size() > 0) { - sysMenuMapper.deleteBatchIds(idList); - } - QueryWrapper queryWrapper = new QueryWrapper<>(); - //根据上级id 查询 根据 orderno 正序排序 - queryWrapper.eq("parentid", sysMenu.getParentid()).orderByAsc( - "orderno"); - List list = this.list(queryWrapper); - for (int i = 0; i < list.size(); i++) { - SysMenu menu = list.get(i); - //更新序列号 - menu.setOrderno(i + 1); - } - //更新表数据 - this.updateBatchById(list); - } - return isOk; - } - - //2 根据当前菜单id,查询菜单里面子菜单id,封装到list集合 - private void selectPermissionChildById(String id, List idList) { - //查询菜单里面子菜单id - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("parentid", id); - wrapper.select("id"); - List childIdList = baseMapper.selectList(wrapper); - //把childIdList里面菜单id值获取出来,封装idList里面,做递归查询 - childIdList.stream().forEach(item -> { - //封装idList里面 - idList.add(item.getId()); - //递归查询 - this.selectPermissionChildById(item.getId(), idList); - }); - } - - /********************************** - * 用途说明: 调换菜单或按钮的位置 - * 参数说明 upperId 选中的菜单Id - * 参数说明 belowId 切换的菜单Id - * 返回值说明: boolean - ***********************************/ - @Override - @Transactional - public boolean changeOderNoById(String fromId, String toId) { - SysMenu fromSysMenu = this.getById(fromId); - SysMenu toSysMenu = this.getById(toId); - // 如果菜单或按钮不存在拖动失败 - if (fromSysMenu == null || toSysMenu == null) { - return false; - } - Integer fromOrderNo = fromSysMenu.getOrderno(); - Integer toOrderNo = toSysMenu.getOrderno(); - // 如果菜单或按钮的顺序号不存在拖动失败 - if (fromOrderNo == null || toOrderNo == null) { - return false; - } - fromSysMenu.setOrderno(toOrderNo); - toSysMenu.setOrderno(fromOrderNo); - boolean fromBool = this.updateById(fromSysMenu); - boolean toBool = this.updateById(toSysMenu); - return fromBool && toBool; - } - - /********************************** - * 用途说明: 根据用户id获取菜单树 - * 参数说明 id 用户id - * 返回值说明: 返回菜单树 - ***********************************/ - @Override - public List> getMenuTree(String id) { - // 根据id获取菜单 - //List sysMenus = sysMenuMapper.selectMenuByUserId(id); - List sysMenuList; - if (StrUtil.isBlank(id)) { - LambdaQueryWrapper queryWrapper = - new LambdaQueryWrapper<>(); - sysMenuList = this.list(queryWrapper.eq(SysMenu::getIsdisplay, "1").ne(SysMenu::getType, "2").eq(SysMenu::getSystemcode, "1").orderByAsc(SysMenu::getOrderno)); - } else { - sysMenuList = sysMenuMapper.selectMenuByUserId(id); - } - // 将 SysMenu 转换为 Map 并构建树 - List> list = sysMenuList.stream() - .map(menu -> { - Map map = new HashMap<>(); - map.put("id", menu.getId()); - map.put("parentid", menu.getParentid()); - map.put("name", menu.getName()); - map.put("opturl", menu.getOpturl()); - map.put("icon", menu.getIcon()); - map.put("type", menu.getType()); - map.put("systemcode", menu.getSystemcode()); - map.put("isdisplay", menu.getIsdisplay()); - map.put("orderno", menu.getOrderno()); - return map; - }) - .collect(Collectors.toList()); - - // 将菜单转换成树 - List> sysMenus = buildTreeLeft(list); - return sysMenus; - } - - /*********************************** - * 用途说明:权限分配 - * 参数说明 - * systemcode 系统 - * name 名称 - * isdisplay 是否显示 - * 返回值说明: 菜单结构树集合 - ***********************************/ - @Override - public List> permissionAssignment(String code,String roleId) { - -// String code = sysMenuMapper.getSystemCodeById(roleId); -// if (code == null) { -// code = "1"; -// } - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(SysMenu::getSystemcode, code).select(SysMenu::getId, - SysMenu::getParentid, SysMenu::getName).orderByAsc - (SysMenu::getOrderno); - List> mapList = - sysMenuMapper.selectMaps(queryWrapper); - List> listAll = ObjectConverterUtil.convertMapFieldsToEntityFormat(SysMenu.class, mapList); - List listRole = - sysMenuMapper.selectMenuByRoleId(roleId); - for (Map map : listAll) { - String id = (String) map.get("id"); - if (listRole.contains(id)) { - map.put("checkinfo", true); - } else { - map.put("checkinfo", false); - } - - } - List> listTree = buildTrees(listAll); - return listTree; - } - - // 另一种方法 - /*public List> permissionAssignment(String roleId) { - - String code = sysMenuMapper.getSystemCodeById(roleId); - if (code == null) { - code = "1"; - } - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(SysMenu::getSystemcode, code).select(SysMenu::getId, - SysMenu::getParentid, SysMenu::getName).orderByAsc - (SysMenu::getOrderno); - List> listAll = - sysMenuMapper.selectMaps(queryWrapper); - *//*List listRole = - sysMenuMapper.selectMenuByRoleId(roleId);*//* - SysRole sysRole = sysRoleMapper.selectById(roleId); - String optscope = sysRole.getOptscope(); - // 将当前角色所对应权限id拆分 - String[] split = optscope.split(","); - List listRole = Arrays.asList(split); - for (Map map : listAll) { - String id = (String) map.get("id"); - if (listRole.contains(id)) { - map.put("checkinfo", true); - } else { - map.put("checkinfo", false); - } - - } - List> listTree = buildTrees(listAll); - return listTree; - }*/ - - /*********************************** - * 用途说明:上传单个图标 - * 参数说明 - * icon 图标 - * 返回值说明: 是否上传成功 - ***********************************/ - @Override - public String uploadIcon(MultipartFile icon) throws FileNotFoundException { - - String path = System.getProperty("user.dir") + "\\src\\main" + - "\\resources\\"; - //图片路径 - String iconPath = path + "static\\icon" + File.separator; - String iconname = - IdUtil.fastSimpleUUID() + "." + FileUtil.getExtensionName(icon.getOriginalFilename()); - //上传图标并获取图标名称 (图片改为png格式) - String filename = - FileUtil.upload(icon, iconPath, iconname).getName(); - return filename; - } - - /** - * 菜单集合递归生成树状菜单(List) - * - * @param sysMenus 菜单对象 - * @return - */ - /* public List buildTree(List sysMenus) { - List resultMenuList = new ArrayList<>(); - for (SysMenu sysMenu : sysMenus) { - - for (SysMenu menu : sysMenus) { - if (menu.getParentid().equals(sysMenu.getId())) { - sysMenu.getChildren().add(menu); - } - } - if ("0".equals(sysMenu.getParentid())) { - resultMenuList.add(sysMenu); - } - } - return resultMenuList; - }*/ - - /** - * 菜单集合递归生成树状菜单(Map)(暂不使用该方法) - * - * @param sysMenus 菜单对象 - * @return - */ - public List> buildTree(List> sysMenus) { - List> resultMenuList = new ArrayList<>(); - for (Map sysMenu : sysMenus) { - - List> childrenList = new ArrayList<>(); - for (Map menu : sysMenus) { - if (menu.get("parentid").equals(sysMenu.get("id"))) { - childrenList.add(menu); - } - } - if ("0".equals(sysMenu.get("parentid"))) { - if (childrenList.size() > 0) { - sysMenu.put("children", childrenList); - } - resultMenuList.add(sysMenu); - } - } - return resultMenuList; - } - - /********************************** - * 用途说明: 左侧菜单树构建 - * 参数说明 sysMenus - * 返回值说明: java.util.List> - ***********************************/ - public List> buildTreeLeft(List> sysMenus) { - List> resultMenuList = new ArrayList<>(); - for (Map sysMenu : sysMenus) { - if ("0".equals(sysMenu.get("parentid"))) { - resultMenuList.add(sysMenu); - } - } - for (Map sysMenu : resultMenuList) { - List> menus = iterateMenusLeft(sysMenus, - (String) sysMenu.get("id")); - if (menus.size() > 0) { - sysMenu.put("children", menus); - } - } - return resultMenuList; - } - - /** - * 左侧多级菜单查询方法 - * - * @param menuVoList 不包含最高层次菜单的菜单集合 - * @param pid 父类id - * @return - */ - public List> iterateMenusLeft(List> menuVoList, String pid) { - List> result = new ArrayList<>(); - for (Map menu : menuVoList) { - //获取菜单的id - String menuid = (String) menu.get("id"); - //获取菜单的父id - String parentid = (String) menu.get("parentid"); - if (StrUtil.isNotBlank(parentid)) { - if (parentid.equals(pid)) { - //递归查询当前子菜单的子菜单 - List> iterateMenu = - iterateMenus(menuVoList, menuid); - if (iterateMenu.size() > 0) { - menu.put("children", iterateMenu); - } - result.add(menu); - } - } - } - return result; - } - - /********************************** - * 用途说明: 生成权菜单权限树 - * 参数说明 sysMenus - * 返回值说明: java.util.List> - ***********************************/ - public List> buildTrees(List> sysMenus) { - List> resultMenuList = new ArrayList<>(); - for (Map sysMenu : sysMenus) { - if ("0".equals(sysMenu.get("parentid"))) { - resultMenuList.add(sysMenu); - } - } - for (Map sysMenu : resultMenuList) { - List> menus = iterateMenus(sysMenus, - (String) sysMenu.get("id")); - for (Map menu : menus) { - if (!(boolean) menu.get("checkinfo")) { - sysMenu.put("checkinfo", false); - break; - } - } - sysMenu.put("children", menus); - } - return resultMenuList; - } - - /** - * 多级菜单查询方法 - * - * @param menuVoList 不包含最高层次菜单的菜单集合 - * @param pid 父类id - * @return - */ - public List> iterateMenus(List> menuVoList, String pid) { - List> result = new ArrayList<>(); - for (Map menu : menuVoList) { - //获取菜单的id - String menuid = (String) menu.get("id"); - //获取菜单的父id - String parentid = (String) menu.get("parentid"); - if (StrUtil.isNotBlank(parentid)) { - if (parentid.equals(pid)) { - //递归查询当前子菜单的子菜单 - List> iterateMenu = - iterateMenus(menuVoList, menuid); - for (Map map : iterateMenu) { - boolean checkinfo = (boolean) map.get("checkinfo"); - if (!checkinfo) { - menu.put("checkinfo", false); - } - } - menu.put("children", iterateMenu); - result.add(menu); - } - } - } - return result; - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/impl/SysOrganizationServiceImpl.java b/backend/src/main/java/com/yfd/platform/system/service/impl/SysOrganizationServiceImpl.java deleted file mode 100644 index 4bc9925..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/impl/SysOrganizationServiceImpl.java +++ /dev/null @@ -1,363 +0,0 @@ -package com.yfd.platform.system.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.SysOrganization; -import com.yfd.platform.system.domain.SysRole; -import com.yfd.platform.system.domain.SysUser; -import com.yfd.platform.system.mapper.SysOrganizationMapper; -import com.yfd.platform.system.mapper.SysRoleMapper; -import com.yfd.platform.system.service.ISysOrganizationService; -import com.yfd.platform.system.service.IUserService; -import com.yfd.platform.utils.ObjectConverterUtil; -import org.springframework.stereotype.Service; - -import jakarta.annotation.Resource; -import java.sql.Timestamp; -import java.text.DecimalFormat; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - *

- * 系统组织框架 服务实现类 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -@Service -public class SysOrganizationServiceImpl extends ServiceImpl implements ISysOrganizationService { - - @Resource - private UserServiceImpl currentUser; - - @Resource - private IUserService userService; - - @Resource - private SysRoleMapper sysRoleMapper; - - @Resource - private SysOrganizationMapper sysOrganizationMapper; - - /*********************************** - * 用途说明:获取组织结构树 - * 参数说明 - *parentid 上级id - * params 名称(根据名称查询二级) - * 返回值说明: 组织树集合 - ***********************************/ - @Override - public List> getOrgTree(String parentid, - String params) { - List orgList = new ArrayList<>(); - QueryWrapper queryWrapper = new QueryWrapper<>(); - //根据父级id查询 - queryWrapper.eq("parentid", parentid); - if (StrUtil.isNotEmpty(params)) { - queryWrapper.like("orgname", params); // 根据 部门名称 - } - SysUser userInfo = userService.getUserInfo(); - if (userInfo.getUsertype() != 0) { - List roleByUserId = - sysRoleMapper.getRoleByUserId(userInfo.getId()); - List ids = new ArrayList<>(); - // 循环当前角色 - for (SysRole sysRole : roleByUserId) { - // 获取角色的组织Id - String orgscope = sysRole.getOrgscope(); - if (StrUtil.isBlank(orgscope)) { - continue; - } - // 拆分组织Id - String[] split = orgscope.split(","); - List stringList = Arrays.asList(split); - Set set = new HashSet<>(); - if (stringList.size() > 0) { - List list = - sysOrganizationMapper.selectList(new LambdaQueryWrapper().in(SysOrganization::getId, stringList)); - list.forEach(l -> set.add(l.getParentid())); - } - ids.addAll(stringList); - ids.addAll(set); - } - queryWrapper.in("id", ids); - } - orgList = this.list(queryWrapper.orderByAsc("orgcode")); - // 将实体对象转换为 Map,确保字段名与实体类一致 - // 将实体对象转换为 Map,确保字段名与实体类一致 - List> listMap = orgList.stream().map(org -> { - Map map = new HashMap<>(); - map.put("id", org.getId()); - map.put("orgtype", org.getOrgtype()); - map.put("orgcode", org.getOrgcode()); - map.put("orgname", org.getOrgname()); - map.put("parentid", org.getParentid()); - map.put("manager", org.getManager()); - map.put("isvaild", org.getIsvaild()); - map.put("description", org.getDescription()); - map.put("lastmodifier", org.getLastmodifier()); - map.put("lastmodifydate", org.getLastmodifydate()); - map.put("custom1", org.getCustom1()); - map.put("custom2", org.getCustom2()); - map.put("custom3", org.getCustom3()); - return map; - }).collect(Collectors.toList()); - for (Map map : listMap) { - List> childList = child(map.get( - "id").toString());//查询下一子集 - map.put("childList", childList); //添加新列 子集 - } - return listMap; - } - - /*********************************** - * 用途说明:获取组织结构树 - * 参数说明 - *parentid 上级id - * params (根据参数查询 组织名称 负责人 描述) - * 返回值说明: 组织树集合 - ***********************************/ - private List> child(String parentid) { - List> listMap = new ArrayList<>(); - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("parentid", parentid); //根据上级id 查询 - listMap = this.listMaps(queryWrapper.orderByAsc("orgcode")); - - if (!listMap.isEmpty()) { - List> mapList = ObjectConverterUtil.convertMapFieldsToEntityFormat(SysOrganization.class, listMap);//判断是否存在子集 - for (int i = 0; i < mapList.size(); i++) { //遍历表数据 - List> childList = - child(mapList.get(i).get("id").toString()); //循环获取下一子集 - mapList.get(i).put("childList", childList); //添加新列 子集 - } - return mapList; - } - return listMap; - } - - /*********************************** - * 用途说明:新增系统组织框架 - * 参数说明 - * sysOrganization 系统组织框架对象 - * 返回值说明: 是否新增成功 - ***********************************/ - @Override - public boolean addOrg(SysOrganization sysOrganization) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - SysOrganization parent = null; - int codeMax = 0; - //查询最大的编号 判断是否存在父级id 有值 根据父级id查询 否则 根据父级id为0 查询 - queryWrapper.select("max(orgcode)"); - if (StrUtil.isNotEmpty(sysOrganization.getParentid())) { - //根据父级id查询父级信息 - parent = this.getById(sysOrganization.getParentid()); - queryWrapper.eq("parentid", sysOrganization.getParentid()); - } else { - //默认 填写父级id为0 - sysOrganization.setParentid("0"); - queryWrapper.eq("parentid", "0"); - } - List max = this.listObjs(queryWrapper); - //判断查询是否存在 存在转换成 int 类型并给 codeMax 替换值 - if (!max.isEmpty() && max.getFirst() != null) { - String maxValue = max.getFirst().toString(); - if (maxValue.length() >= 2) { - codeMax = Integer.parseInt(maxValue.substring(maxValue.length() - 2)); - } - } - //2位数字编号 - DecimalFormat df = new DecimalFormat("00"); - //编号 - String code = df.format(codeMax + 1); - //查询到父级不为空 重新赋值 父级编号+新的序号 - if (parent != null) { - code = parent.getOrgcode() + df.format(codeMax + 1); - } - //判断是否是否填写 有效 否则默认为 1 - if (StrUtil.isEmpty(sysOrganization.getIsvaild())) { - sysOrganization.setIsvaild("1"); - } - //填写 编号 - sysOrganization.setOrgcode(code); - //填写 当前用户名称 - sysOrganization.setLastmodifier(currentUser.getUsername()); - //填写 当前日期 - sysOrganization.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - return this.save(sysOrganization); - } - - /*********************************** - * 用途说明:根据企业ID查询组织详情 - * 参数说明 - * id 企业id - * 返回值说明: 系统组织框架对象 - ***********************************/ - @Override - public List getOrganizationById(String id, - String orgName) { - - LambdaQueryWrapper queryWrapper = - new LambdaQueryWrapper<>(); - SysUser userInfo = userService.getUserInfo(); - if (userInfo.getUsertype() != 0) { - List roleByUserId = - sysRoleMapper.getRoleByUserId(userInfo.getId()); - List ids = new ArrayList<>(); - // 循环当前角色 - for (SysRole sysRole : roleByUserId) { - // 获取角色的组织Id - String orgscope = sysRole.getOrgscope(); - if (StrUtil.isBlank(orgscope)) { - continue; - } - // 拆分组织Id - String[] split = orgscope.split(","); - List stringList = Arrays.asList(split); - ids.addAll(stringList); - } - if (ObjectUtil.isNotEmpty(ids)) { - queryWrapper.in(SysOrganization::getId, ids); - } - - } - if (StrUtil.isNotBlank(orgName)) { - queryWrapper.like(SysOrganization::getOrgname, orgName); - } - queryWrapper.eq(SysOrganization::getParentid, id).orderByDesc(SysOrganization::getOrgcode); - return this.list(queryWrapper); - } - - /*********************************** - * 用途说明:获取组织范围树结构 - * 参数说明 - *parentid 上级id - * params 名称(根据名称查询二级) - * 返回值说明: 组织树集合 - ***********************************/ - @Override - public List> getOrgScopeTree(String roleId) { - LambdaQueryWrapper queryWrapper = - new LambdaQueryWrapper<>(); - queryWrapper.eq(SysOrganization::getIsvaild, '1'); - queryWrapper.orderByAsc(SysOrganization::getOrgcode); - List> listMaps = this.listMaps(queryWrapper); - // 获取当前角色 - SysRole sysRole = sysRoleMapper.selectById(roleId); - String orgscope = sysRole.getOrgscope(); - List ids = new ArrayList<>(); - if (StrUtil.isNotBlank(orgscope)) { - String[] split = orgscope.split(","); - ids = Arrays.asList(split); - } - - for (Map map : listMaps) { - String id = (String) map.get("id"); - if (ids.contains(id)) { - map.put("checkinfo", true); - } else { - map.put("checkinfo", false); - } - map.put("bool", true); - } - // 生成组织树 - List> listMap = buildTrees(listMaps); - return listMap; - } - - /********************************** - * 用途说明: 修改角色组织范围 - * 参数说明 roleId 角色id - * 参数说明 orgscope 组织id集合 - * 返回值说明: boolean 是否修改成功 - ***********************************/ - @Override - public boolean updateOrgScopeByRoleId(String roleId, String orgscope) { - SysRole sysRole = new SysRole(); - sysRole.setId(roleId); - sysRole.setOrgscope(orgscope); - int i = sysRoleMapper.updateById(sysRole); - if (i > 0) { - return true; - } else { - return false; - } - - } - - /********************************** - * 用途说明: 生成组织范围树 - * 参数说明 sysMenus - * 返回值说明: java.util.List> - ***********************************/ - public List> buildTrees(List> sysMenus) { - List> resultMenuList = new ArrayList<>(); - // 获取父节点 - for (Map sysMenu : sysMenus) { - if ("0".equals(sysMenu.get("parentid"))) { - resultMenuList.add(sysMenu); - } - } - // 寻找子节点 - for (Map sysMenu : resultMenuList) { - sysMenu.put("checkinfo", true); - List> children = new ArrayList<>(); - List array = new ArrayList<>(); - for (Map menu : sysMenus) { - String id = (String) sysMenu.get("id"); - String parentid = (String) menu.get("parentid"); - if (id.equals(parentid)) { - // 如果存在一个子节点没有被选中,父节点则不是全选状态 - if (!(boolean) menu.get("checkinfo")) { - sysMenu.put("checkinfo", false); - } else { - // 将处于选中状态的子节点加入到数组中 - array.add((String) menu.get("orgname")); - } - children.add(menu); - } - } - // 所有子节点加入父节点 - sysMenu.put("children", children); - sysMenu.put("array", array); - } - return resultMenuList; - } - - /** - * 组织集合递归生成树状菜单(Map) - * - * @param sysOrgList 组织集合 - * @return - */ - public List> buildTree(List> sysOrgList) { - List> resultOrgList = new ArrayList<>(); - for (Map sysOrg : sysOrgList) { - List> childrenList = new ArrayList<>(); - List array = new ArrayList<>(); - for (Map org : sysOrgList) { - if (org.get("parentid").equals(sysOrg.get("id"))) { - if (!(boolean) org.get("checkinfo")) { - sysOrg.put("checkinfo", false); - } - array.add((String) org.get("orgname")); - childrenList.add(org); - } - } - if ("0".equals(sysOrg.get("parentid"))) { - if (childrenList.size() > 0) { - sysOrg.put("children", childrenList); - } - resultOrgList.add(sysOrg); - } - sysOrg.put("array", array); - } - return resultOrgList; - } -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/impl/SysRoleServiceImpl.java b/backend/src/main/java/com/yfd/platform/system/service/impl/SysRoleServiceImpl.java deleted file mode 100644 index f06dbd8..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/impl/SysRoleServiceImpl.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.yfd.platform.system.service.impl; - -import cn.hutool.core.util.IdUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.SysRole; -import com.yfd.platform.system.mapper.SysRoleMapper; -import com.yfd.platform.system.service.ISysRoleService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import jakarta.annotation.Resource; -import java.sql.Timestamp; -import java.text.DecimalFormat; -import java.util.List; -import java.util.Map; - -/** - *

- * 系统角色 服务实现类 - *

- * - * @author zhengsl - * @since 2021-12-15 - */ -@Service -@Transactional -public class SysRoleServiceImpl extends ServiceImpl implements ISysRoleService { - - @Resource - private SysRoleMapper roleMapper; - - @Resource - private UserServiceImpl currentuser; - - /*********************************** - * 用途说明:新增角色 - * 参数说明 - * sysRole 新增角色信息 - * 返回值说明: 是否新增成功 - ***********************************/ - @Override - public boolean addRole(SysRole sysRole) { - //生成用户编号 - int codeMax = 0; - DecimalFormat df = new DecimalFormat("000");//四位数字编号 - QueryWrapper queryWrapper = new QueryWrapper<>(); - List max = this.listObjs(queryWrapper.select("MAX(rolecode) " + - "rolecode"));// 查询最大的编号 - // 存在转换成 int 类型并给 codeMax 替换值 - if (!max.isEmpty() && max.getFirst() != null) { - try { - codeMax = Integer.parseInt(max.getFirst().toString()); - } catch (NumberFormatException e) { - // 如果转换失败,保持默认值 0 - e.printStackTrace(); - } - } - // 存在转换成int类型并给codeMax替换值 - String code = df.format(codeMax + 1); // 最大编号累加 - - sysRole.setRolecode(code); //添加角色编号 - if (StringUtils.isEmpty(sysRole.getIsvaild())) { - sysRole.setIsvaild("1"); //判断是否填写有效性 默认为 1 是 - } - sysRole.setLastmodifier(currentuser.getUsername()); //添加最近修改者 - sysRole.setLastmodifydate(new Timestamp(System.currentTimeMillis())); //添加最近修改时间 - return this.save(sysRole); - } - - /*********************************** - * 用途说明:删除角色用户(admin除外) - * 参数说明 - * id 系统角色用户对照表id - * 返回值说明: 是否新增成功 - ***********************************/ - @Override - public boolean deleteRoleUsers(String roleid, String urserids) { - boolean ok = true; - //得到单个用户id - String[] temp = urserids.split(","); - for (String userid : temp) { - //根据角色id、用户id删除 (登录账号admin除外) - ok = ok && roleMapper.deleteRoleUsers(roleid, userid); - - } - return ok; - } - - /*********************************** - * 用途说明:根据id删除角色 //待修改 - * 参数说明 - *id 角色id - * 返回值说明: 是否删除成功 - ***********************************/ - @Override - public void deleteById(String id) { - String[] ids = id.split(","); - for (String roleId : ids) { - //根据id删除 角色 - boolean isOk = this.removeById(roleId); - if (!isOk) { - continue; - } - roleMapper.deleteRoleMenus(roleId); - roleMapper.deleteRoleUser(roleId); - } - } - /* 原逻辑 - @Override - public boolean deleteById(String id) { - //根据角色id查询 所关联的用户 - List> isRoleUsersByroleid = - roleMapper.isRoleUsersByroleid(id); - //判断是否关联用户 - if (isRoleUsersByroleid.size() > 0) { - return false; - } - //根据id删除 角色 - boolean isOk = this.removeById(id); - if (isOk) { - return true; - } - return false; - }*/ - - /*********************************** - * 用途说明:查询已分配的用户 - * 参数说明 - *orgid 所属组织 - *username 用户名称 - *status 状态 - *level 角色级别 - * rolename 角色名称 - * isvaild 角色是否有效 - * 返回值说明: 系统用户角色数据集合 - ***********************************/ - @Override - public List listRoleUsers(String orgid, String username, - String status, String level, - String rolename, String isvaild) { - return roleMapper.listRoleUsers(orgid, username, status, level, - rolename, isvaild); - } - - /*********************************** - * 用途说明:角色分配权限 - * 参数说明 - * id 角色id - * menuIds 权限id字符串 - * 返回值说明: 是否分配成功 - ***********************************/ - @Override - @Transactional(rollbackFor = Exception.class) - public boolean setMenuById(String id, String menuIds) { - // 删除角色所对应的权限 - roleMapper.deleteRoleMenus(id); - // 重新赋予权限 - String[] ids = menuIds.split(","); - for (String menuId : ids) { - String uuid = IdUtil.fastSimpleUUID(); - roleMapper.addRoleMenu(uuid, id, menuId); - } - return true; - } - - @Override - public List selectRoleList(String rolename) { - return roleMapper.selectRoleList(rolename); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/impl/UserDetailsServiceImpl.java b/backend/src/main/java/com/yfd/platform/system/service/impl/UserDetailsServiceImpl.java deleted file mode 100644 index dc28501..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/impl/UserDetailsServiceImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.yfd.platform.system.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.yfd.platform.datasource.DataSource; -import com.yfd.platform.system.domain.LoginUser; -import com.yfd.platform.system.domain.SysUser; -import com.yfd.platform.system.mapper.SysMenuMapper; -import com.yfd.platform.system.service.IUserService; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; - -import jakarta.annotation.Resource; -import java.util.List; - -/** - *

- * 用户服务实现类 继承UserDetailsService 实现接口 - *

- * - * @author zhengsl - * @since 2021-10-27 - */ -@Service -public class UserDetailsServiceImpl implements UserDetailsService { - - @Resource - private IUserService userService; - - @Resource - private SysMenuMapper sysMenuMapper; - - @Override - @DataSource(name = "master") - public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { - //根据用户名称查询用户信息 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("username", username); - SysUser user = userService.getOne(queryWrapper); - if (ObjectUtil.isEmpty(user)) { - throw new RuntimeException("用户账号不存在!"); - } - //Todo 根据用户查询权限信息 添加到LoginUser中 - List permissions = - sysMenuMapper.selectPermsByUserId(user.getId()); - - //封装成UserDetails对象返回 - return new LoginUser(user,permissions); - } -} diff --git a/backend/src/main/java/com/yfd/platform/system/service/impl/UserServiceImpl.java b/backend/src/main/java/com/yfd/platform/system/service/impl/UserServiceImpl.java deleted file mode 100644 index 7e483f1..0000000 --- a/backend/src/main/java/com/yfd/platform/system/service/impl/UserServiceImpl.java +++ /dev/null @@ -1,579 +0,0 @@ -package com.yfd.platform.system.service.impl; - -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yfd.platform.config.FileProperties; -import com.yfd.platform.config.ResponseResult; -import com.yfd.platform.system.domain.LoginUser; -import com.yfd.platform.system.domain.SysOrganization; -import com.yfd.platform.system.domain.SysRole; -import com.yfd.platform.system.domain.SysUser; -import com.yfd.platform.system.mapper.SysOrganizationMapper; -import com.yfd.platform.system.mapper.SysRoleMapper; -import com.yfd.platform.system.mapper.SysUserMapper; -import com.yfd.platform.system.service.IUserService; -import com.yfd.platform.utils.FileUtil; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import com.yfd.platform.config.FileSpaceProperties; -import jakarta.annotation.Resource; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.MultipartFile; - -import jakarta.annotation.Resource; -import jakarta.validation.constraints.NotBlank; -import java.io.File; -import java.sql.Timestamp; -import java.util.*; -import java.util.stream.Collectors; - -/** - *

- * 用户服务实现类 - *

- * - * @author zhengsl - * @since 2021-10-27 - */ -@Service -@RequiredArgsConstructor -public class UserServiceImpl extends ServiceImpl implements IUserService { - - @Resource - private SysUserMapper sysUserMapper; - - @Resource - private SysRoleMapper sysRoleMapper; - - @Resource - private PasswordEncoder passwordEncoder; - /** - * 文件空间配置 - */ - @Resource - private FileSpaceProperties fileSpaceProperties; - - /********************************** - * 用途说明:获取当前用户账号及名称 - * 参数说明 - * 返回值说明: 系统管理员[admin] - ***********************************/ - @Override - public String getUsername() { - UsernamePasswordAuthenticationToken authentication = - (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); - LoginUser loginuser = (LoginUser) authentication.getPrincipal(); - String acountname = - loginuser.getUser().getNickname(); - return acountname; - //return "admin"; - } - - @Override - public Map getNameInfo() { - UsernamePasswordAuthenticationToken authentication = - (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); - LoginUser loginuser = (LoginUser) authentication.getPrincipal(); - String nickname = loginuser.getUser().getNickname(); - String username = loginuser.getUser().getUsername(); - Map map = new HashMap<>(); - map.put("nickname", nickname); - map.put("username", username); - return map; - } - - @Override - public SysUser getUserInfo() { - UsernamePasswordAuthenticationToken authentication = - (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); - LoginUser loginuser = (LoginUser) authentication.getPrincipal(); - return loginuser.getUser(); - } - - @Override - public ResponseResult getLoginUserInfo() { - UsernamePasswordAuthenticationToken authentication = - (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); - LoginUser loginuser = (LoginUser) authentication.getPrincipal(); - SysUser user = loginuser.getUser(); - //根据用户ID获取组织 - Map userInfo = - sysUserMapper.getOrganizationByid(user.getId()); - - // 使用 MyBatis 方式查询用户角色(Oracle 兼容) - List roles = sysRoleMapper.getRoleByUserId(user.getId()); - List collect = - roles.stream().map(SysRole::getRolename).collect(Collectors.toList()); - ResponseResult responseResult = new ResponseResult(); - responseResult.put("userInfo", userInfo); - responseResult.put("roles", collect); - responseResult.put("permissions", loginuser.getPermissions()); - return responseResult; - } - - /*********************************** - * 用途说明:新增用户 - * 参数说明 - *sysUser 新增用户对象 - * id 创建者id - * roleId 角色id - * 返回值说明: 提示字符串 - ************************************/ - @Override - public Map addUser(SysUser sysUser, String roleids) { - //返回信息 - Map result = new HashMap<>(); - sysUser.setId(IdUtil.fastSimpleUUID()); - //普通用户 - sysUser.setUsertype(1); - BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); - //设置缺省密码 - String cryptPassword = passwordEncoder.encode("123456"); - sysUser.setPassword(cryptPassword); - sysUser.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - sysUser.setLastmodifier(getUsername()); - //账号有效 - sysUser.setStatus(1); - //判断注册的登录账号是否存在 - if (isExistAccount(sysUser.getUsername())) { - //新增用户 - boolean ok = this.save(sysUser); - //新增用户分配权限 - if (StrUtil.isNotEmpty(roleids)) { - String[] roles = roleids.split(","); - for (String roleid : roles) { - //系统生成id - String id = IdUtil.fastSimpleUUID(); - //新增sys_role_users表数据 - ok = ok && sysUserMapper.addUserRoles(id, roleid, - sysUser.getId()); - } - } - //判断新增是否成功 消息提示 - if (ok) { - result.put("status", "sucess"); - result.put("msg", "新增用户成功!"); - - } else { - result.put("status", "error"); - result.put("msg", "新增用户失败!"); - } - } else { - result.put("status", "error"); - result.put("msg", "用户账号已存在,不能重复添加!"); - } - return result; - } - - /*********************************** - * 用途说明:查询系统用户 - * 参数说明 - *page 分页集合参数 - *orgid 所属组织 - *username 用户名称 - * mobile 手机号 - * status 状态 - * 返回值说明: 用户分页集合 - ************************************/ - @Override - public List list(String total, String size, String orgid, - String username, String mobile, String status) { - List list = sysUserMapper.list(total, size, orgid, username, - mobile, status); - for (Map map : list) { - List mapList = - sysUserMapper.getLevel(map.get("id").toString()); - String roleid = ""; - String level = ""; - String rolename = ""; - for (Map map1 : mapList) { - roleid += map1.get("id") + ","; - level += map1.get("level") + ","; - rolename += map1.get("rolename") + ","; - } - if (roleid.endsWith(",")) { - roleid = roleid.substring(0, roleid.length() - 1); - } - if (level.endsWith(",")) { - level = level.substring(0, level.length() - 1); - } - if (rolename.endsWith(",")) { - rolename = rolename.substring(0, rolename.length() - 1); - } - - map.put("roleid", roleid); - map.put("level", level); - map.put("rolename", rolename); - } - return list; //返回分页集合 - } - - /*********************************** - * 用途说明:根据ID修改用户 - * 参数说明 - *sysUser 用户对象 - *roleids 角色id - * 返回值说明: 是否更新成功 - ************************************/ - // ... existing code ... - - @Override - @Transactional(rollbackFor = Exception.class) - public Map updateById(SysUser sysUser, String roleids) { - Map result = new HashMap<>(); - - try { - // 设置修改信息 - String currentUsername = getUsername(); - Timestamp currentTime = new Timestamp(System.currentTimeMillis()); - sysUser.setLastmodifier(currentUsername); - sysUser.setLastmodifydate(currentTime); - - // 更新用户信息 - boolean ok = this.updateById(sysUser); - if (!ok) { - result.put("status", "error"); - result.put("msg", "用户信息修改失败!"); - return result; - } - - // 处理角色分配 - String userId = sysUser.getId(); - if (StrUtil.isNotEmpty(roleids)) { - handleUserRoles(userId, roleids); - } else { - // 清空所有角色 - sysUserMapper.delRoleUsersByUserid(userId); - } - - result.put("status", "sucess"); - result.put("msg", "用户信息修改成功!"); - - } catch (Exception e) { - log.error("更新用户信息失败", e); - result.put("status", "error"); - result.put("msg", "操作失败:" + e.getMessage()); - throw e; // 抛出异常,触发事务回滚 - } - - return result; - } - - /** - * 处理用户角色分配(增量更新) - * @param userId 用户 ID - * @param roleIds 角色 ID 字符串(逗号分隔) - */ - private void handleUserRoles(String userId, String roleIds) { - // 获取用户当前角色 - List currentRoles = sysUserMapper.getRoleid(userId); - Set currentRoleSet = new HashSet<>(currentRoles != null ? currentRoles : Collections.emptyList()); - - // 解析新角色列表 - String[] newRoles = roleIds.split(","); - Set newRoleSet = new HashSet<>(Arrays.asList(newRoles)); - - // 需要新增的角色(新角色 - 当前角色) - for (String roleId : newRoles) { - if (!currentRoleSet.contains(roleId)) { - String id = IdUtil.fastSimpleUUID(); - sysUserMapper.addUserRoles(id, roleId, userId); - } - } - - // 需要删除的角色(当前角色 - 新角色) - sysUserMapper.delInRoleUsersByUserid(userId, newRoles); - } - -// ... existing code ... - - - @Override - public Map getOneById(String id) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - Map map = this.getMap(queryWrapper.eq("id", id)); - List mapList = sysUserMapper.getLevel(id); - String roleid = ""; - String level = ""; - String rolename = ""; - for (Map map1 : mapList) { - roleid += map1.get("id") + ","; - level += map1.get("level") + ","; - rolename += map1.get("rolename") + ","; - } - if (roleid.endsWith(",")) { - roleid = roleid.substring(0, roleid.length() - 1); - } - if (level.endsWith(",")) { - level = level.substring(0, level.length() - 1); - } - if (rolename.endsWith(",")) { - rolename = rolename.substring(0, rolename.length() - 1); - } - - map.put("roleid", roleid); - map.put("level", level); - map.put("rolename", rolename); - return map; - } - - /*********************************** - * 用途说明:用户分配角色 - * 参数说明 - *listId 用户id与角色id - * 返回值说明: 判断是否添加成功 - ************************************/ - @Override - public boolean setUserRoles(String roleid, String userids) { - boolean isOk = true; - //拆分userid 数组 - String[] temp = userids.split(","); - //遍历userid - for (String userid : temp) { - //根据角色id与用户id查询 - List list = sysUserMapper.getRoleUsersByid(roleid, userid); - //判断是否用户已分配此权限 - if (list.size() == 0) { - //系统生成id - String id = IdUtil.fastSimpleUUID(); - //新增sys_role_users表数据 - isOk = isOk && sysUserMapper.addUserRoles(id, roleid, userid); - } - } - return isOk; - } - - /*********************************** - * 用途说明:根据id删除用户 - * 参数说明 - *id 用户id - * 返回值说明: 判断是否删除成功 - ************************************/ - @Override - public boolean deleteById(String id) { - //根据id查询 - SysUser sysUser = this.getById(id); - //账号头像存储地址 - String imgName = - fileSpaceProperties.getSystem() + File.separator + "user" + File.separator + sysUser.getAvatar(); - if ("admin".equals(sysUser.getUsername())) { - return false; - } else { - boolean isOk = this.removeById(id); - //判断是否删除成功 - if (isOk) { - //根据用户id 删除该用户角色关联 - sysUserMapper.delRoleUsersByUserid(id); - //判断是否存在 账号头像 存在删除 - if (StrUtil.isNotEmpty(sysUser.getAvatar())) { - FileUtil.del(imgName); - } - return false; - } else { - return false; - } - } - } - - /*********************************** - * 用途说明:重置用户密码(管理员) - * 参数说明 - *id 重置密码的 用户id - * 返回值说明: 判断是重置成功 - ************************************/ - @Override - public boolean resetPassword(String id) throws Exception { - boolean isOk = false; - //根据当前用户id 查询角色表的级别 currentUser.getUser() 获取当前用户id - String level = sysUserMapper.getMaxLevel(id); - //判断是否获取级别 - if (StrUtil.isNotEmpty(level)) { - //判断当前用户级别 管理员及以上权限 - if (Integer.parseInt(level) <= 2) { - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - //根据id 修改密码,密码修改时间,最近修改者,最近修改日期 将密码修改为 123456 - String cryptPassword = passwordEncoder.encode("123456"); - updateWrapper.eq("id", id).set("password", cryptPassword).set( - "pwdresettime", - new Timestamp(System.currentTimeMillis())).set( - "lastmodifydate", - new Timestamp(System.currentTimeMillis())).set( - "lastmodifier", getUsername()); - //是否修改成功 - isOk = this.update(updateWrapper); - } - } - return isOk; - } - - /*********************************** - * 用途说明:设置账号状态(管理员) - * 参数说明 - *id 用户id - * status 设置状态 - * 返回值说明: 判断是否设置成功 - ************************************/ - @Override - public boolean setStatus(String id, String status) { - boolean isOk = false; - //根据当前用户id 查询角色表的级别 currentUser.getUser() 获取当前用户id - String level = sysUserMapper.getMaxLevel(id); - //判断当前用户级别 管理员及以上权限 - if (Integer.parseInt(level) <= 2) { - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - //根据id修改用户状态,最近修改人,最近修改时间 - updateWrapper.eq("id", id).set("status", status).set( - "lastmodifydate", - new Timestamp(System.currentTimeMillis())).set( - "lastmodifier", getUsername()); - //是否修改成功 - isOk = this.update(updateWrapper); - } - return isOk; - } - - /*********************************** - * 用途说明:上传用户头像 - * 参数说明 - * id 用户id - * img 账号头像 - * 返回值说明: 判断是否上传 - ***********************************/ - @Override - public boolean uploadAvatar(String id, MultipartFile img) { - //根据id查询 - SysUser sysUser = this.getById(id); - //账号头像存储地址 - String imgPath = fileSpaceProperties.getSystem() + "user"; - String avatar = sysUser.getAvatar(); - if (StrUtil.isNotBlank(avatar)) { - String imgName = imgPath + File.separator + avatar; - FileUtil.del(imgName); - } - //上传图片 并获取图片名称 (图片格式修改成png) - String imgName = FileUtil.upload(img, imgPath, - IdUtil.fastSimpleUUID() + "." + FileUtil.getExtensionName(img.getOriginalFilename())).getName(); - //修改 账户头像 - sysUser.setAvatar(imgName); - //修改 最近修改者 - sysUser.setLastmodifier(getUsername()); - //修改 最近修改日期 - sysUser.setLastmodifydate(new Timestamp(System.currentTimeMillis())); - //更新用户表 - boolean isOk = this.updateById(sysUser); - return isOk; - } - - /*********************************** - * 用途说明:新增系统角色用户对照表 对用户分配角色(单个) - * 参数说明 - * id 生成的id - * roleid 角色id - * userid 用户id - * 返回值说明: - ************************************/ - @Override - public boolean addUserRoles(String roleid, String userid) { - boolean isOk = true; - //根据角色id与用户id查询 - List list = sysUserMapper.getRoleUsersByid(roleid, userid); - //判断是否用户已分配此权限 - if (list.size() == 0) { - //系统生成id - String id = IdUtil.fastSimpleUUID(); - //新增sys_role_users表数据 - isOk = sysUserMapper.addUserRoles(id, roleid, userid); - } - return isOk; - } - - /* @Override - public Page queryUsers(String orgid, - String username, Page page) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - // 分页查询中的条件查询 - if (StrUtil.isNotBlank(username)) { - queryWrapper.like(SysUser::getUsername, username); - } - queryWrapper.eq(SysUser::getOrgid, orgid); - return sysUserMapper.selectPage(page, queryWrapper); - }*/ - - @Override - public Page queryUsers(String orgid, - String username, - Page page) { - Page mapPage = sysUserMapper.queryUsers(orgid, - username, page); - ;mapPage.getRecords().forEach(record -> { - String id = record.getId(); - List sysRoles = sysRoleMapper.getRoleByUserId(id); - record.setRoles(sysRoles); - }); - return mapPage; - } - - /*********************************** - * 用途说明:根据ID批量删除用户 - * 参数说明 - *ids 用户id集合 - * 返回值说明: 判断是否删除成功 - ************************************/ - @Override - public boolean deleteUserByIds(String id) { - String[] splitId = id.split(","); - List ids = Arrays.asList(splitId); - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.in(SysUser::getId, ids); - List sysUsers = sysUserMapper.selectList(queryWrapper); - List names = - sysUsers.stream().map(SysUser::getUsername).collect(Collectors.toList()); - if (names.contains("admin")) { - return false; - } else { - int result = sysUserMapper.deleteBatchIds(ids); - if (result <= 0) { - return false; - } - // 根据ID删除用户与角色的关联信息 - sysUserMapper.delRoleUsersByUserIds(ids); - List avatars = - sysUsers.stream().map(SysUser::getAvatar).collect(Collectors.toList()); - if (avatars.size() > 0) { - for (String avatar : avatars) { - //账号头像存储地址 - String imgName = - fileSpaceProperties.getSystem() + File.separator + "user" + File.separator + avatar; - FileUtil.del(imgName); - } - } - return true; - } - } - - /*********************************** - * 用途说明:比较登录名称是否有重复 - * 参数说明 - * account 登录名称 - * 返回值说明: 重复返回 false 否则返回 true - ************************************/ - private boolean isExistAccount(String username) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - if (this.list(queryWrapper.eq("username", username)).size() > 0) { - //判断 查询登录账号 结果集是否为null 重复返回 false 否则返回 tree - return false; - } else { - return true; - } - } -} diff --git a/backend/src/main/java/com/yfd/platform/task/TaskMessage.java b/backend/src/main/java/com/yfd/platform/task/TaskMessage.java deleted file mode 100644 index 4a43d15..0000000 --- a/backend/src/main/java/com/yfd/platform/task/TaskMessage.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.yfd.platform.task; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.yfd.platform.component.ServerSendEventServer; -import com.yfd.platform.config.MessageConfig; -import com.yfd.platform.config.WebConfig; -import com.yfd.platform.system.domain.Message; -import com.yfd.platform.system.service.IMessageService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import jakarta.annotation.Resource; -import java.sql.Timestamp; -import java.util.List; - -/** - * @author TangWei - * @Date: 2023/3/22 15:39 - * @Description: - */ -@Component -public class TaskMessage { - - @Resource - private IMessageService messageService; - - /********************************** - * 用途说明: 定时监控消息是否过期 - * 参数说明 - * 返回值说明: void - ***********************************/ - public void examineMessage() { - List list = - messageService.list(new LambdaQueryWrapper().eq(Message::getStatus, "1")); - for (Message message : list) { - Timestamp createtime = message.getCreatetime(); - Timestamp timestamp = new Timestamp(System.currentTimeMillis()); - long create = createtime.getTime(); - long now = timestamp.getTime(); - Integer validperiod = message.getValidperiod(); - long v = validperiod * 60 * 60 * 1000; - if ((now - create) > v) { - message.setStatus("9"); - message.setReadtime(timestamp); - messageService.updateById(message); - } - - } - } - - /*public void sendMessage() { - String loginToken = webConfig.loginuserCache().get("loginToken"); - long count = - messageService.count(new LambdaQueryWrapper().eq(Message::getStatus, "1")); - ServerSendEventServer.sendMessage(loginToken, count + ""); - }*/ -} diff --git a/backend/src/main/java/com/yfd/platform/utils/CallBack.java b/backend/src/main/java/com/yfd/platform/utils/CallBack.java deleted file mode 100644 index 5f13d70..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/CallBack.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2019-2020 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.yfd.platform.utils; - -/** - * @author: liaojinlong - * @date: 2020/6/9 17:02 - * @since: 1.0 - * @see {@link SpringContextHolder} - * 针对某些初始化方法,在SpringContextHolder 初始化前时,
- * 可提交一个 提交回调任务。
- * 在SpringContextHolder 初始化后,进行回调使用 - */ - -public interface CallBack { - /** - * 回调执行方法 - */ - void executor(); - - /** - * 本回调任务名称 - * @return / - */ - default String getCallBackName() { - return Thread.currentThread().getId() + ":" + this.getClass().getName(); - } -} - diff --git a/backend/src/main/java/com/yfd/platform/utils/CodeGenerator.java b/backend/src/main/java/com/yfd/platform/utils/CodeGenerator.java deleted file mode 100644 index 1c65429..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/CodeGenerator.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.yfd.platform.utils; - -import com.baomidou.mybatisplus.generator.FastAutoGenerator; -import com.baomidou.mybatisplus.generator.config.OutputFile; -import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; -import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; - -import java.util.HashMap; -import java.util.Map; -import java.util.Scanner; - -// 演示例子,执行 main 方法控制台输入模块表名回车自动生成对应项目目录中 -public class CodeGenerator { - - public static String scanner(String tip) { - Scanner scanner = new Scanner(System.in); - StringBuilder help = new StringBuilder(); - help.append("请输入" + tip + ":"); - System.out.println(help.toString()); - if (scanner.hasNext()) { - String ipt = scanner.next(); - if (ipt != null && !ipt.trim().isEmpty()) { - return ipt; - } - } - throw new RuntimeException("请输入正确的" + tip + "!"); - } - - public static void main(String[] args) { - String projectPath = System.getProperty("user.dir"); - String module = scanner("模块名称"); - - Map pathInfo = new HashMap<>(); - pathInfo.put(OutputFile.entity, projectPath + "/src/main/java/com/yfd/platform/" + module + "/domain"); - pathInfo.put(OutputFile.mapper, projectPath + "/src/main/java/com/yfd/platform/" + module + "/mapper"); - pathInfo.put(OutputFile.controller, projectPath + "/src/main/java/com/yfd/platform/" + module + "/controller"); - pathInfo.put(OutputFile.serviceImpl, projectPath + "/src/main/java/com/yfd/platform/" + module + "/service/impl"); - pathInfo.put(OutputFile.service, projectPath + "/src/main/java/com/yfd/platform/" + module + "/service"); - pathInfo.put(OutputFile.xml, projectPath + "/src/main/resources/mapper/" + module); - - FastAutoGenerator.create( - "jdbc:mysql://43.143.220.7:3306/frameworkdb2023?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai", - "root", - "zhengg7QkXa { - builder.author("TangWei") - .disableOpenDir() - .outputDir(projectPath + "/src/main/java"); - }) - .packageConfig(builder -> { - builder.parent("com.yfd.platform") - .moduleName(module) - .pathInfo(pathInfo); - }) - .strategyConfig(builder -> { - builder.addInclude(scanner("表名,多个英文逗号分割").split(",")) - .entityBuilder() - .enableLombok() - .naming(NamingStrategy.underline_to_camel) - .columnNaming(NamingStrategy.underline_to_camel) - .controllerBuilder() - .enableRestStyle() - .mapperBuilder() - .formatMapperFileName("%sMapper") - .serviceBuilder() - .formatServiceFileName("%sService") - .formatServiceImplFileName("%sServiceImpl") - .controllerBuilder() - .formatFileName("%sController"); - }) - .templateEngine(new FreemarkerTemplateEngine()) - .execute(); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/utils/EncryptConfigUtil.java b/backend/src/main/java/com/yfd/platform/utils/EncryptConfigUtil.java deleted file mode 100644 index 4df5527..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/EncryptConfigUtil.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.yfd.platform.utils; - -import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; -import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; -import org.jasypt.util.text.BasicTextEncryptor; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; - -public class EncryptConfigUtil { - - public static void main(String[] args) { - -// String salt = "rca20230101"; -// String password = "123456"; -// -// BasicTextEncryptor textEncryptor = new BasicTextEncryptor(); -// //加密所需的salt -// textEncryptor.setPassword(salt); -// //要加密的数据(数据库的用户名或密码) -// String encrypt = textEncryptor.encrypt(password); -// System.out.println("password:"+encrypt); - - - BCryptPasswordEncoder passwordEncoder=new BCryptPasswordEncoder(); - String cryptPassword=passwordEncoder.encode("dl_2023");//设置缺省密码 - - } - -} \ No newline at end of file diff --git a/backend/src/main/java/com/yfd/platform/utils/EncryptUtils.java b/backend/src/main/java/com/yfd/platform/utils/EncryptUtils.java deleted file mode 100644 index 2ae2b26..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/EncryptUtils.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.utils; - -import javax.crypto.Cipher; -import javax.crypto.SecretKey; -import javax.crypto.SecretKeyFactory; -import javax.crypto.spec.DESKeySpec; -import javax.crypto.spec.IvParameterSpec; -import java.nio.charset.StandardCharsets; - -/** - * 加密 - * @author - * @date 2018-11-23 - */ - -public class EncryptUtils { - - private static final String STR_PARAM = "Passw0rd"; - - private static Cipher cipher; - - private static final IvParameterSpec IV = new IvParameterSpec(STR_PARAM.getBytes(StandardCharsets.UTF_8)); - - private static DESKeySpec getDesKeySpec(String source) throws Exception { - if (source == null || source.length() == 0){ - return null; - } - cipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); - String strKey = "Passw0rd"; - return new DESKeySpec(strKey.getBytes(StandardCharsets.UTF_8)); - } - - /** - * 对称加密 - */ - public static String desEncrypt(String source) throws Exception { - DESKeySpec desKeySpec = getDesKeySpec(source); - SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); - SecretKey secretKey = keyFactory.generateSecret(desKeySpec); - cipher.init(Cipher.ENCRYPT_MODE, secretKey, IV); - return byte2hex( - cipher.doFinal(source.getBytes(StandardCharsets.UTF_8))).toUpperCase(); - } - - /** - * 对称解密 - */ - public static String desDecrypt(String source) throws Exception { - byte[] src = hex2byte(source.getBytes(StandardCharsets.UTF_8)); - DESKeySpec desKeySpec = getDesKeySpec(source); - SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); - SecretKey secretKey = keyFactory.generateSecret(desKeySpec); - cipher.init(Cipher.DECRYPT_MODE, secretKey, IV); - byte[] retByte = cipher.doFinal(src); - return new String(retByte); - } - - private static String byte2hex(byte[] inStr) { - String stmp; - StringBuilder out = new StringBuilder(inStr.length * 2); - for (byte b : inStr) { - stmp = Integer.toHexString(b & 0xFF); - if (stmp.length() == 1) { - // 如果是0至F的单位字符串,则添加0 - out.append("0").append(stmp); - } else { - out.append(stmp); - } - } - return out.toString(); - } - - private static byte[] hex2byte(byte[] b) { - int size = 2; - if ((b.length % size) != 0){ - throw new IllegalArgumentException("长度不是偶数"); - } - byte[] b2 = new byte[b.length / 2]; - for (int n = 0; n < b.length; n += size) { - String item = new String(b, n, 2); - b2[n / 2] = (byte) Integer.parseInt(item, 16); - } - return b2; - } -} diff --git a/backend/src/main/java/com/yfd/platform/utils/ExecutionJob.java b/backend/src/main/java/com/yfd/platform/utils/ExecutionJob.java deleted file mode 100644 index c4a2fcf..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/ExecutionJob.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.utils; - -import com.yfd.platform.config.MessageConfig; -import com.yfd.platform.config.thread.ThreadPoolExecutorUtil; -import com.yfd.platform.system.domain.Message; -import com.yfd.platform.system.domain.QuartzJob; -import com.yfd.platform.system.service.IMessageService; -import com.yfd.platform.system.service.IQuartzJobService; -import org.quartz.JobExecutionContext; -import org.springframework.scheduling.annotation.Async; -import org.springframework.scheduling.quartz.QuartzJobBean; -import org.springframework.stereotype.Component; - -import jakarta.annotation.Resource; -import java.sql.Timestamp; -import java.util.concurrent.Future; -import java.util.concurrent.ThreadPoolExecutor; - -/** - * 参考人人开源,https://gitee.com/renrenio/renren-security - * - * @author / - * @date 2019-01-07 - */ -@Async -@SuppressWarnings({"unchecked", "all"}) -public class ExecutionJob extends QuartzJobBean { - - /** - * 该处仅供参考 - */ - private final static ThreadPoolExecutor EXECUTOR = - ThreadPoolExecutorUtil.getPoll(); - - @Resource - private IMessageService messageService; - - @Resource - private MessageConfig messageConfig; - - @Override - public void executeInternal(JobExecutionContext context) { - QuartzJob quartzJob = - (QuartzJob) context.getMergedJobDataMap().get(QuartzJob.JOB_KEY); - // 获取spring bean - IQuartzJobService quartzJobService = - SpringContextHolder.getBean(IQuartzJobService.class); - String uuid = quartzJob.getId(); - long startTime = System.currentTimeMillis(); - String jobName = quartzJob.getJobName(); - try { - // 执行任务 - System.out.println( - "--------------------------------------------------------------"); - System.out.println("任务开始执行,任务名称:" + jobName); - QuartzRunnable task = new QuartzRunnable(quartzJob.getJobClass(), - quartzJob.getJobMethod(), - quartzJob.getJobParams()); - Future future = EXECUTOR.submit(task); - future.get(); - long times = System.currentTimeMillis() - startTime; - Message message = new Message(); - message.setCreatetime(new Timestamp(System.currentTimeMillis())); - message.setType("1"); - message.setTitle(quartzJob.getJobName()); - message.setContent(quartzJob.getDescription()); - message.setSenderName("定时器"); - message.setReceiverCodes(quartzJob.getOrderno().toString()); - message.setReceiverNames(""); - message.setStatus("1"); - message.setValidperiod(24); - messageConfig.addMessage(message); - // 任务状态 - System.out.println("任务执行完毕,任务名称:" + jobName + ", " + - "执行时间:" + times + "毫秒"); - System.out.println( - "--------------------------------------------------------------"); - } catch (Exception e) { - System.out.println("任务执行失败,任务名称:" + jobName); - System.out.println( - "--------------------------------------------------------------"); - quartzJob.setStatus("0"); - //更新状态 - quartzJobService.updateById(quartzJob); - } - } - -} diff --git a/backend/src/main/java/com/yfd/platform/utils/FileUtil.java b/backend/src/main/java/com/yfd/platform/utils/FileUtil.java deleted file mode 100644 index 6940aee..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/FileUtil.java +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.utils; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.io.IoUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.poi.excel.BigExcelWriter; -import cn.hutool.poi.excel.ExcelUtil; -import com.yfd.platform.exception.BadRequestException; -import org.apache.commons.lang3.StringUtils; -import org.apache.poi.util.IOUtils; -import org.apache.poi.xssf.streaming.SXSSFSheet; -import org.apache.tomcat.util.http.fileupload.FileUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.multipart.MultipartFile; - -import jakarta.servlet.ServletOutputStream; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import java.io.*; -import java.net.URLDecoder; -import java.security.MessageDigest; -import java.text.DecimalFormat; -import java.text.SimpleDateFormat; -import java.util.*; - -/** - * File工具类,扩展 hutool 工具包 - * - * @author - * @date 2018-12-27 - */ -public class FileUtil extends cn.hutool.core.io.FileUtil { - - private static final Logger log = LoggerFactory.getLogger(FileUtil.class); - - /** - * 系统临时目录 - *
- * windows 包含路径分割符,但Linux 不包含, - * 在windows \\==\ 前提下, - * 为安全起见 同意拼装 路径分割符, - *
-     *       java.io.tmpdir
-     *       windows : C:\Users/xxx\AppData\Local\Temp\
-     *       linux: /temp
-     * 
- */ - public static final String SYS_TEM_DIR = System.getProperty("java.io.tmpdir") + File.separator; - /** - * 定义GB的计算常量 - */ - private static final int GB = 1024 * 1024 * 1024; - /** - * 定义MB的计算常量 - */ - private static final int MB = 1024 * 1024; - /** - * 定义KB的计算常量 - */ - private static final int KB = 1024; - - /** - * 格式化小数 - */ - private static final DecimalFormat DF = new DecimalFormat("0.00"); - - public static final String IMAGE = "image"; - public static final String TXT = "document"; - public static final String MUSIC = "music"; - public static final String VIDEO = "video"; - public static final String OTHER = "other"; - - - /** - * MultipartFile转File - */ - public static File toFile(MultipartFile multipartFile) { - // 获取文件名 - String fileName = multipartFile.getOriginalFilename(); - // 获取文件后缀 - String prefix = "." + getExtensionName(fileName); - File file = null; - try { - // 用uuid作为文件名,防止生成的临时文件重复 - file = File.createTempFile(IdUtil.simpleUUID(), prefix); - // MultipartFile to File - multipartFile.transferTo(file); - } catch (IOException e) { - log.error(e.getMessage(), e); - } - return file; - } - - /** - * 获取文件扩展名,不带 . - */ - public static String getExtensionName(String filename) { - if ((filename != null) && (filename.length() > 0)) { - int dot = filename.lastIndexOf('.'); - if ((dot > -1) && (dot < (filename.length() - 1))) { - return filename.substring(dot + 1); - } - } - return filename; - } - - /** - * Java文件操作 获取不带扩展名的文件名 - */ - public static String getFileNameNoEx(String filename) { - if ((filename != null) && (filename.length() > 0)) { - int dot = filename.lastIndexOf('.'); - if ((dot > -1) && (dot < (filename.length()))) { - return filename.substring(0, dot); - } - } - return filename; - } - - /** - * 文件大小转换 - */ - public static String getSize(long size) { - String resultSize; - if (size / GB >= 1) { - //如果当前Byte的值大于等于1GB - resultSize = DF.format(size / (float) GB) + "GB "; - } else if (size / MB >= 1) { - //如果当前Byte的值大于等于1MB - resultSize = DF.format(size / (float) MB) + "MB "; - } else if (size / KB >= 1) { - //如果当前Byte的值大于等于1KB - resultSize = DF.format(size / (float) KB) + "KB "; - } else { - resultSize = size + "B "; - } - return resultSize; - } - - /** - * inputStream 转 File - */ - static File inputStreamToFile(InputStream ins, String name) throws Exception { - File file = new File(SYS_TEM_DIR + name); - if (file.exists()) { - return file; - } - OutputStream os = new FileOutputStream(file); - int bytesRead; - int len = 8192; - byte[] buffer = new byte[len]; - while ((bytesRead = ins.read(buffer, 0, len)) != -1) { - os.write(buffer, 0, bytesRead); - } - os.close(); - ins.close(); - return file; - } - - /** - * 将文件名解析成文件的上传路径 - */ - public static File upload(MultipartFile file, String filePath) { - Date date = new Date(); - SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS"); - String name = getFileNameNoEx(file.getOriginalFilename()); - String suffix = getExtensionName(file.getOriginalFilename()); - String nowStr = "-" + format.format(date); - try { - String fileName = name + "." + suffix; - String path = filePath +File.separator + fileName; - // getCanonicalFile 可解析正确各种路径 - File dest = new File(path).getCanonicalFile(); - // 检测是否存在目录 - if (!dest.getParentFile().exists()) { - if (!dest.getParentFile().mkdirs()) { - System.out.println("was not successful."); - } - } - // 文件写入 - file.transferTo(dest); - return dest; - } catch (Exception e) { - log.error(e.getMessage(), e); - } - return null; - } - - /** - * 将文件名解析成文件的上传路径 - * file 上传的文件 - * filePath 存储路径 - * tofilename 保存文件名称 - - */ - public static File upload(MultipartFile file, String filePath,String tofilename) { - try { - String filename = filePath + File.separator + tofilename; - File dest = new File(filename).getCanonicalFile(); - // 检测是否存在目录 - if (!dest.getParentFile().exists()) { - if (!dest.getParentFile().mkdirs()) { - } - } - // 文件写入 - file.transferTo(dest); - return dest; - } catch (Exception e) { - log.error(e.getMessage(), e); - } - return null; - } - - - /** - * 导出excel - */ - public static void downloadExcel(List> list, HttpServletResponse response) throws IOException { - String tempPath = SYS_TEM_DIR + IdUtil.fastSimpleUUID() + ".xlsx"; - String filename = "record"+cn.hutool.core.date.DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss"); - File file = new File(tempPath); - BigExcelWriter writer = ExcelUtil.getBigWriter(file); - // 一次性写出内容,使用默认样式,强制输出标题 - writer.write(list, true); - SXSSFSheet sheet = (SXSSFSheet)writer.getSheet(); - //上面需要强转SXSSFSheet 不然没有trackAllColumnsForAutoSizing方法 - sheet.trackAllColumnsForAutoSizing(); - //列宽自适应 - writer.autoSizeColumnAll(); - //response为HttpServletResponse对象 - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); - //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 - response.setHeader("Content-Disposition", "attachment;filename="+filename+".xlsx"); - ServletOutputStream out = response.getOutputStream(); - // 终止后删除临时文件 - file.deleteOnExit(); - writer.flush(out, true); - //此处记得关闭输出Servlet流 - IoUtil.close(out); - } - - public static String getFileType(String type) { - String documents = "txt doc pdf ppt pps xlsx xls docx"; - String music = "mp3 wav wma mpa ram ra aac aif m4a"; - String video = "avi mpg mpe mpeg asf wmv mov qt rm mp4 flv m4v webm ogv ogg"; - String image = "bmp dib pcp dif wmf gif jpg tif eps psd cdr iff tga pcd mpt png jpeg"; - if (image.contains(type)) { - return IMAGE; - } else if (documents.contains(type)) { - return TXT; - } else if (music.contains(type)) { - return MUSIC; - } else if (video.contains(type)) { - return VIDEO; - } else { - return OTHER; - } - } - - public static void checkSize(long maxSize, long size) { - // 1M - int len = 1024 * 1024; - if (size > (maxSize * len)) { - throw new BadRequestException("文件超出规定大小"); - } - } - - /** - * 判断两个文件是否相同 - */ - public static boolean check(File file1, File file2) { - String img1Md5 = getMd5(file1); - String img2Md5 = getMd5(file2); - return img1Md5.equals(img2Md5); - } - - /** - * 判断两个文件是否相同 - */ - public static boolean check(String file1Md5, String file2Md5) { - return file1Md5.equals(file2Md5); - } - - private static byte[] getByte(File file) { - // 得到文件长度 - byte[] b = new byte[(int) file.length()]; - try { - InputStream in = new FileInputStream(file); - try { - System.out.println(in.read(b)); - } catch (IOException e) { - log.error(e.getMessage(), e); - } - } catch (FileNotFoundException e) { - log.error(e.getMessage(), e); - return null; - } - return b; - } - - private static String getMd5(byte[] bytes) { - // 16进制字符 - char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - try { - MessageDigest mdTemp = MessageDigest.getInstance("MD5"); - mdTemp.update(bytes); - byte[] md = mdTemp.digest(); - int j = md.length; - char[] str = new char[j * 2]; - int k = 0; - // 移位 输出字符串 - for (byte byte0 : md) { - str[k++] = hexDigits[byte0 >>> 4 & 0xf]; - str[k++] = hexDigits[byte0 & 0xf]; - } - return new String(str); - } catch (Exception e) { - log.error(e.getMessage(), e); - } - return null; - } - - /** - * 下载文件 - * - * @param request / - * @param response / - * @param file / - */ - public static void downloadFile(HttpServletRequest request, HttpServletResponse response, File file, boolean deleteOnExit) { - response.setCharacterEncoding(request.getCharacterEncoding()); - response.setContentType("application/octet-stream"); - FileInputStream fis = null; - try { - fis = new FileInputStream(file); - response.setHeader("Content-Disposition", "attachment; filename=" + file.getName()); - IOUtils.copy(fis, response.getOutputStream()); - response.flushBuffer(); - } catch (Exception e) { - log.error(e.getMessage(), e); - } finally { - if (fis != null) { - try { - fis.close(); - if (deleteOnExit) { - file.deleteOnExit(); - } - } catch (IOException e) { - log.error(e.getMessage(), e); - } - } - } - } - /** - * 预览PDF文件 - * - * @param filepath / - * @param response / - */ - public static void viewPDF(String filepath, HttpServletResponse response) throws IOException { - File file=new File(filepath); - String originFileName=file.getName(); //中文编码 - response.setCharacterEncoding("UTF-8"); - String showName= StrUtil.isNotBlank(originFileName)?originFileName:file.getName(); - showName= URLDecoder.decode(showName,"UTF-8"); - response.setHeader("Content-Disposition","inline;fileName="+new String(showName.getBytes(), "ISO8859-1")+";fileName*=UTF-8''"+ new String(showName.getBytes(), "ISO8859-1")); - FileInputStream fis = new FileInputStream(file); - response.setHeader("content-type", "application/pdf"); - response.setContentType("application/pdf; charset=utf-8"); - IOUtils.copy(fis, response.getOutputStream()); - fis.close(); - } - - public static String getMd5(File file) { - return getMd5(getByte(file)); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/utils/MpGenerator.java b/backend/src/main/java/com/yfd/platform/utils/MpGenerator.java deleted file mode 100644 index e3aec6e..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/MpGenerator.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.yfd.platform.utils; - -import com.baomidou.mybatisplus.generator.FastAutoGenerator; -import com.baomidou.mybatisplus.generator.config.OutputFile; -import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; -import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; -import org.springframework.util.StringUtils; - -import java.util.HashMap; -import java.util.Map; -import java.util.Scanner; - -public class MpGenerator { - /** - * 读取控制台内容 - */ - public static String scanner(String tip) { - Scanner scanner = new Scanner(System.in); - StringBuilder help = new StringBuilder(); - help.append("请输入" + tip + ":"); - System.out.println(help.toString()); - if (scanner.hasNext()) { - String ipt = scanner.next(); - if (StringUtils.hasText(ipt)) { - return ipt; - } - } - throw new RuntimeException("请输入正确的" + tip + "!"); - } - - public static void main(String[] args) { - String projectPath = System.getProperty("user.dir"); - String url = PropertiesUtils.getPropertyField("spring.datasource.url"); - String username = PropertiesUtils.getPropertyField("spring.datasource.username"); - String password = PropertiesUtils.getPropertyField("spring.datasource.password"); - - String moduleName = scanner("模块名"); - String modulePath = moduleName.replace(".", "/"); - - Map pathInfo = new HashMap<>(); - pathInfo.put(OutputFile.entity, projectPath + "/src/main/java/com/yfd/platform/modules/domain" + modulePath + "/entity"); - pathInfo.put(OutputFile.mapper, projectPath + "/src/main/java/com/yfd/platform/modules/domain/" + modulePath + "/dao"); - pathInfo.put(OutputFile.controller, projectPath + "/src/main/java/com/yfd/platform/modules/domain" + modulePath + "/controller"); - pathInfo.put(OutputFile.service, projectPath + "/src/main/java/com/yfd/platform/modules/domain" + modulePath + "/service"); - pathInfo.put(OutputFile.serviceImpl, projectPath + "/src/main/java/com/yfd/platform/modules/domain" + modulePath + "/service/impl"); - pathInfo.put(OutputFile.xml, projectPath + "/src/main/resources/mapper/" + modulePath); - - FastAutoGenerator.create(url, username, password) - .globalConfig(builder -> { - builder.author("fwh") - .disableOpenDir() - .outputDir(projectPath + "/src/main/java"); - }) - .packageConfig(builder -> { - builder.parent(PropertiesUtils.getPropertyField("project.package.name")) - .moduleName(moduleName) - .pathInfo(pathInfo); - }) - .strategyConfig(builder -> { - builder.addInclude(scanner("表名,多个英文逗号分割").split(",")) - .entityBuilder() - .enableLombok() - .naming(NamingStrategy.underline_to_camel) - .columnNaming(NamingStrategy.underline_to_camel) - .controllerBuilder() - .enableRestStyle() - .mapperBuilder() - .formatMapperFileName("%sDao") - .serviceBuilder() - .formatServiceFileName("%sService") - .formatServiceImplFileName("%sServiceImpl") - .controllerBuilder() - .formatFileName("%sController"); - }) - .templateEngine(new FreemarkerTemplateEngine()) - .execute(); - } -} - diff --git a/backend/src/main/java/com/yfd/platform/utils/ObjectConverterUtil.java b/backend/src/main/java/com/yfd/platform/utils/ObjectConverterUtil.java deleted file mode 100644 index da72785..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/ObjectConverterUtil.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.yfd.platform.utils; - -import java.lang.reflect.Field; -import java.sql.Timestamp; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.stream.Collectors; - -public class ObjectConverterUtil { - - // 日期时间格式 - private static final DateTimeFormatter DATE_TIME_FORMATTER = - DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - - /** - * 将 List 中的大写字段名转换为与实体类一致的小写格式 - * 适用于 Oracle 数据库查询结果转换 - * 时间类型字段会转换为字符串格式 - * - * @param entityClass 实体类 Class 对象 - * @param sourceList 源数据列表(字段名为大写) - * @return 转换后的列表(字段名与实体类一致) - */ - public static List> convertMapFieldsToEntityFormat( - Class entityClass, - List> sourceList) { - - if (sourceList == null || sourceList.isEmpty()) { - return sourceList; - } - - // 获取实体类的所有字段及类型 - Map fieldMap = new HashMap<>(); - for (Field field : entityClass.getDeclaredFields()) { - fieldMap.put(field.getName(), field); - } - - // 转换每个 Map - return sourceList.stream().map(sourceMap -> { - Map targetMap = new HashMap<>(); - - for (Map.Entry entry : sourceMap.entrySet()) { - String dbColumnName = entry.getKey(); // 数据库列名(大写) - Object value = entry.getValue(); - - // 将大写列名转为小写 - String lowerCaseName = dbColumnName.toLowerCase(); - - // 如果实体类中有对应的字段 - if (fieldMap.containsKey(lowerCaseName)) { - Field field = fieldMap.get(lowerCaseName); - String fieldType = field.getType().getSimpleName(); - - // 处理时间类型,转换为字符串 - if ("Timestamp".equals(fieldType) || "Date".equals(fieldType) || - "LocalDateTime".equals(fieldType)) { - targetMap.put(lowerCaseName, formatDateTimeValue(value)); - } else { - targetMap.put(lowerCaseName, value); - } - } else { - // 如果实体类中没有对应字段,保留原列名(转小写) - targetMap.put(lowerCaseName, value); - } - } - - return targetMap; - }).collect(Collectors.toList()); - } - - /** - * 通用方法:将单个 Map 的大写字段转换为实体类格式 - * 时间类型字段会转换为字符串格式 - * - * @param entityClass 实体类 Class 对象 - * @param sourceMap 源 Map(字段名为大写) - * @return 转换后的 Map(字段名与实体类一致) - */ - public static Map convertSingleMapFieldsToEntityFormat( - Class entityClass, - Map sourceMap) { - - if (sourceMap == null) { - return sourceMap; - } - - // 获取实体类的所有字段及类型 - Map fieldMap = new HashMap<>(); - for (Field field : entityClass.getDeclaredFields()) { - fieldMap.put(field.getName(), field); - } - - Map targetMap = new HashMap<>(); - - for (Map.Entry entry : sourceMap.entrySet()) { - String dbColumnName = entry.getKey(); - Object value = entry.getValue(); - - // 将大写列名转为小写 - String lowerCaseName = dbColumnName.toLowerCase(); - - // 验证字段是否存在于实体类中 - if (fieldMap.containsKey(lowerCaseName)) { - Field field = fieldMap.get(lowerCaseName); - String fieldType = field.getType().getSimpleName(); - - // 处理时间类型,转换为字符串 - if ("Timestamp".equals(fieldType) || "Date".equals(fieldType) || - "LocalDateTime".equals(fieldType)) { - targetMap.put(lowerCaseName, formatDateTimeValue(value)); - } else { - targetMap.put(lowerCaseName, value); - } - } - } - - return targetMap; - } - - /** - * 格式化时间类型值为字符串 - * - * @param value 时间值(可能是 Timestamp、Date 或 LocalDateTime) - * @return 格式化后的字符串,如果为 null 则返回 null - */ - private static String formatDateTimeValue(Object value) { - if (value == null) { - return null; - } - - if (value instanceof Timestamp) { - LocalDateTime localDateTime = ((Timestamp) value).toLocalDateTime(); - return localDateTime.format(DATE_TIME_FORMATTER); - } else if (value instanceof java.util.Date) { - // 包括 java.sql.Date 和 java.util.Date - LocalDateTime localDateTime = ((java.util.Date) value).toInstant() - .atZone(java.time.ZoneId.systemDefault()) - .toLocalDateTime(); - return localDateTime.format(DATE_TIME_FORMATTER); - } else if (value instanceof LocalDateTime) { - return ((LocalDateTime) value).format(DATE_TIME_FORMATTER); - } else { - // 其他类型直接转字符串 - return value.toString(); - } - } - -} diff --git a/backend/src/main/java/com/yfd/platform/utils/PropertiesUtils.java b/backend/src/main/java/com/yfd/platform/utils/PropertiesUtils.java deleted file mode 100644 index 93c7cfd..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/PropertiesUtils.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.yfd.platform.utils; - -import org.springframework.core.io.ClassPathResource; - -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.Properties; -/****************************** - * 用途说明: - * 作者姓名: pcj - * 创建时间: 2022/9/20 14:31 - ******************************/ -public class PropertiesUtils { - public final static String RESOURCE_PATH = "application.properties"; - - public final static Properties properties = new Properties(); - - public static String getPropertyField(String parameter) { - //对应resources目录下的资源路径 - ClassPathResource resource = new ClassPathResource(RESOURCE_PATH); - try { - properties.load(new InputStreamReader(resource.getInputStream(), "gbk")); - } catch (IOException e) { - throw new RuntimeException(e); - } - return properties.getProperty(parameter); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/utils/QuartzManage.java b/backend/src/main/java/com/yfd/platform/utils/QuartzManage.java deleted file mode 100644 index 3ff265c..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/QuartzManage.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.utils; - -import com.yfd.platform.system.domain.QuartzJob; -import lombok.extern.slf4j.Slf4j; -import org.quartz.*; -import org.quartz.impl.triggers.CronTriggerImpl; -import org.springframework.stereotype.Component; - -import jakarta.annotation.Resource; -import java.util.Date; - -import static org.quartz.TriggerBuilder.newTrigger; - -/** - * @author - * @date 2019-01-07 - */ -@Slf4j -@Component -public class QuartzManage { - - private static final String JOB_NAME = "TASK_"; - - @Resource(name = "scheduler") - private Scheduler scheduler; - - public void addJob(QuartzJob quartzJob) { - try { - // 构建job信息 - JobDetail jobDetail = JobBuilder.newJob(ExecutionJob.class). - withIdentity(JOB_NAME + quartzJob.getId()).build(); - - //通过触发器名和cron 表达式创建 Trigger - Trigger cronTrigger = newTrigger() - .withIdentity(JOB_NAME + quartzJob.getId()) - .startNow() - .withSchedule(CronScheduleBuilder.cronSchedule(quartzJob.getJobCron())) - .build(); - - cronTrigger.getJobDataMap().put(QuartzJob.JOB_KEY, quartzJob); - - //重置启动时间 - ((CronTriggerImpl) cronTrigger).setStartTime(new Date()); - - //执行定时任务 - scheduler.scheduleJob(jobDetail, cronTrigger); - - // 暂停任务 - if ("0".equals(quartzJob.getStatus())) { - pauseJob(quartzJob); - } - } catch (Exception e) { - log.error("创建定时任务失败", e); - throw new RuntimeException("创建定时任务失败"); - } - } - - /** - * 更新job cron表达式 - * - * @param quartzJob / - */ - public void updateJobCron(QuartzJob quartzJob) { - try { - TriggerKey triggerKey = - TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); - CronTrigger trigger = - (CronTrigger) scheduler.getTrigger(triggerKey); - // 如果不存在则创建一个定时任务 - if (trigger == null) { - addJob(quartzJob); - trigger = (CronTrigger) scheduler.getTrigger(triggerKey); - } - CronScheduleBuilder scheduleBuilder = - CronScheduleBuilder.cronSchedule(quartzJob.getJobCron()); - trigger = - trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build(); - //重置启动时间 - ((CronTriggerImpl) trigger).setStartTime(new Date()); - trigger.getJobDataMap().put(QuartzJob.JOB_KEY, quartzJob); - - scheduler.rescheduleJob(triggerKey, trigger); - // 暂停任务 - if ("0".equals(quartzJob.getStatus())) { - pauseJob(quartzJob); - } - } catch (Exception e) { - log.error("更新定时任务失败", e); - throw new RuntimeException("更新定时任务失败"); - } - - } - - /** - * 删除一个job - * - * @param quartzJob / - */ - public void deleteJob(QuartzJob quartzJob) { - try { - JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); - scheduler.pauseJob(jobKey); - scheduler.deleteJob(jobKey); - } catch (Exception e) { - log.error("删除定时任务失败", e); - throw new RuntimeException("删除定时任务失败"); - } - } - - /** - * 恢复一个job - * - * @param quartzJob / - */ - public void resumeJob(QuartzJob quartzJob) { - try { - TriggerKey triggerKey = - TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); - CronTrigger trigger = - (CronTrigger) scheduler.getTrigger(triggerKey); - // 如果不存在则创建一个定时任务 - if (trigger == null) { - addJob(quartzJob); - } - JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); - scheduler.resumeJob(jobKey); - } catch (Exception e) { - log.error("恢复定时任务失败", e); - throw new RuntimeException("恢复定时任务失败"); - } - } - - /** - * 立即执行job - * - * @param quartzJob / - */ - public void runJobNow(QuartzJob quartzJob) { - try { - TriggerKey triggerKey = - TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); - CronTrigger trigger = - (CronTrigger) scheduler.getTrigger(triggerKey); - // 如果不存在则创建一个定时任务 - if (trigger == null) { - addJob(quartzJob); - } - JobDataMap dataMap = new JobDataMap(); - dataMap.put(QuartzJob.JOB_KEY, quartzJob); - JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); - scheduler.triggerJob(jobKey, dataMap); - } catch (Exception e) { - log.error("定时任务执行失败", e); - throw new RuntimeException("定时任务执行失败"); - } - } - - /** - * 暂停一个job - * - * @param quartzJob / - */ - public void pauseJob(QuartzJob quartzJob) { - try { - JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); - scheduler.pauseJob(jobKey); - } catch (Exception e) { - log.error("定时任务暂停失败", e); - throw new RuntimeException("定时任务暂停失败"); - } - } -} diff --git a/backend/src/main/java/com/yfd/platform/utils/QuartzRunnable.java b/backend/src/main/java/com/yfd/platform/utils/QuartzRunnable.java deleted file mode 100644 index b1da541..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/QuartzRunnable.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.utils; - -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.util.ReflectionUtils; - -import java.lang.reflect.Method; -import java.util.concurrent.Callable; - -/** - * 执行定时任务 - * @author / - */ -@Slf4j -public class QuartzRunnable implements Callable { - - private final Object target; - private final Method method; - private final String params; - - QuartzRunnable(String beanName, String methodName, String params) - throws NoSuchMethodException, SecurityException { - this.target = SpringContextHolder.getBean(beanName); - this.params = params; - - if (StringUtils.isNotBlank(params)) { - this.method = target.getClass().getDeclaredMethod(methodName, String.class); - } else { - this.method = target.getClass().getDeclaredMethod(methodName); - } - } - - @Override - public Object call() throws Exception { - ReflectionUtils.makeAccessible(method); - if (StringUtils.isNotBlank(params)) { - method.invoke(target, params); - } else { - method.invoke(target); - } - return null; - } -} diff --git a/backend/src/main/java/com/yfd/platform/utils/RequestHolder.java b/backend/src/main/java/com/yfd/platform/utils/RequestHolder.java deleted file mode 100644 index 3dbfa55..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/RequestHolder.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.utils; - -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - -import jakarta.servlet.http.HttpServletRequest; -import java.util.Objects; - -/** - * 获取 HttpServletRequest - * @author - * @date 2018-11-24 - */ -public class RequestHolder { - - public static HttpServletRequest getHttpServletRequest() { - return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); - } -} diff --git a/backend/src/main/java/com/yfd/platform/utils/RsaUtils.java b/backend/src/main/java/com/yfd/platform/utils/RsaUtils.java deleted file mode 100644 index 5c3e6c7..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/RsaUtils.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.yfd.platform.utils; - -import org.apache.commons.codec.binary.Base64; - -import javax.crypto.Cipher; -import java.security.*; -import java.security.interfaces.RSAPrivateKey; -import java.security.interfaces.RSAPublicKey; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; - -/** - * @author https://www.cnblogs.com/nihaorz/p/10690643.html - * @description Rsa 工具类,公钥私钥生成,加解密 - * @date 2020-05-18 - **/ -public class RsaUtils { - - private static final String SRC = "123456"; - - public static void main(String[] args) throws Exception { - System.out.println("\n"); -// RsaKeyPair keyPair = generateKeyPair(); - String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ=="; - String privateKey = "MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8\n" + - "mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9p\n" + - "B6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue\n" + - "/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZ\n" + - "UBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6\n" + - "vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha\n" + - "4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3\n" + - "tTbklZkD2A=="; - RsaKeyPair keyPair =new RsaKeyPair(publicKey, privateKey); - System.out.println("私钥:" + keyPair.getPrivateKey()); - System.out.println("\n"); - test1(keyPair); - System.out.println("\n"); -// test2(keyPair); - System.out.println("\n"); - } - - /** - * 公钥加密私钥解密 - */ - private static void test1(RsaKeyPair keyPair) throws Exception { - System.out.println("***************** 公钥加密私钥解密开始 *****************"); - String text1 = encryptByPublicKey(keyPair.getPublicKey(), RsaUtils.SRC); - String text2 = decryptByPrivateKey(keyPair.getPrivateKey(), text1); - System.out.println("加密前:" + RsaUtils.SRC); - System.out.println("加密后:" + text1); - System.out.println("解密后:" + text2); - if (RsaUtils.SRC.equals(text2)) { - System.out.println("解密字符串和原始字符串一致,解密成功"); - } else { - System.out.println("解密字符串和原始字符串不一致,解密失败"); - } - System.out.println("***************** 公钥加密私钥解密结束 *****************"); - } - - /** - * 私钥加密公钥解密 - * @throws Exception / - */ - private static void test2(RsaKeyPair keyPair) throws Exception { - System.out.println("***************** 私钥加密公钥解密开始 *****************"); - String text1 = encryptByPrivateKey(keyPair.getPrivateKey(), RsaUtils.SRC); - String text2 = decryptByPublicKey(keyPair.getPublicKey(), text1); - System.out.println("加密前:" + RsaUtils.SRC); - System.out.println("加密后:" + text1); - System.out.println("解密后:" + text2); - if (RsaUtils.SRC.equals(text2)) { - System.out.println("解密字符串和原始字符串一致,解密成功"); - } else { - System.out.println("解密字符串和原始字符串不一致,解密失败"); - } - System.out.println("***************** 私钥加密公钥解密结束 *****************"); - } - - /** - * 公钥解密 - * - * @param publicKeyText 公钥 - * @param text 待解密的信息 - * @return / - * @throws Exception / - */ - public static String decryptByPublicKey(String publicKeyText, String text) throws Exception { - X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyText)); - KeyFactory keyFactory = KeyFactory.getInstance("RSA"); - PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec); - Cipher cipher = Cipher.getInstance("RSA"); - cipher.init(Cipher.DECRYPT_MODE, publicKey); - byte[] result = cipher.doFinal(Base64.decodeBase64(text)); - return new String(result); - } - - /** - * 私钥加密 - * - * @param privateKeyText 私钥 - * @param text 待加密的信息 - * @return / - * @throws Exception / - */ - public static String encryptByPrivateKey(String privateKeyText, String text) throws Exception { - PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyText)); - KeyFactory keyFactory = KeyFactory.getInstance("RSA"); - PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec); - Cipher cipher = Cipher.getInstance("RSA"); - cipher.init(Cipher.ENCRYPT_MODE, privateKey); - byte[] result = cipher.doFinal(text.getBytes()); - return Base64.encodeBase64String(result); - } - - /** - * 私钥解密 - * - * @param privateKeyText 私钥 - * @param text 待解密的文本 - * @return / - * @throws Exception / - */ - public static String decryptByPrivateKey(String privateKeyText, String text) throws Exception { - PKCS8EncodedKeySpec pkcs8EncodedKeySpec5 = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyText)); - KeyFactory keyFactory = KeyFactory.getInstance("RSA"); - PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5); - Cipher cipher = Cipher.getInstance("RSA"); - cipher.init(Cipher.DECRYPT_MODE, privateKey); - byte[] result = cipher.doFinal(Base64.decodeBase64(text)); - return new String(result); - } - - /** - * 公钥加密 - * - * @param publicKeyText 公钥 - * @param text 待加密的文本 - * @return / - */ - public static String encryptByPublicKey(String publicKeyText, String text) throws Exception { - X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyText)); - KeyFactory keyFactory = KeyFactory.getInstance("RSA"); - PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec2); - Cipher cipher = Cipher.getInstance("RSA"); - cipher.init(Cipher.ENCRYPT_MODE, publicKey); - byte[] result = cipher.doFinal(text.getBytes()); - return Base64.encodeBase64String(result); - } - - /** - * 构建RSA密钥对 - * - * @return / - * @throws NoSuchAlgorithmException / - */ - public static RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException { - KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); - keyPairGenerator.initialize(1024); - KeyPair keyPair = keyPairGenerator.generateKeyPair(); - RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic(); - RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate(); - String publicKeyString = Base64.encodeBase64String(rsaPublicKey.getEncoded()); - String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded()); - return new RsaKeyPair(publicKeyString, privateKeyString); - } - - - /** - * RSA密钥对对象 - */ - public static class RsaKeyPair { - - private final String publicKey; - private final String privateKey; - - public RsaKeyPair(String publicKey, String privateKey) { - this.publicKey = publicKey; - this.privateKey = privateKey; - } - - public String getPublicKey() { - return publicKey; - } - - public String getPrivateKey() { - return privateKey; - } - - } -} diff --git a/backend/src/main/java/com/yfd/platform/utils/SecurityUtils.java b/backend/src/main/java/com/yfd/platform/utils/SecurityUtils.java deleted file mode 100644 index 9df23cd..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/SecurityUtils.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.utils; - -import cn.hutool.json.JSONArray; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import com.yfd.platform.exception.BadRequestException; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; - -import java.util.List; - -/** - * 获取当前登录的用户 - * @author - * @date 2019-01-17 - */ -@Slf4j -public class SecurityUtils { - - /** - * 获取当前登录的用户 - * @return UserDetails - */ - public static UserDetails getCurrentUser() { - UserDetailsService userDetailsService = SpringContextHolder.getBean(UserDetailsService.class); - return userDetailsService.loadUserByUsername(getCurrentUsername()); - } - - /** - * 获取系统用户名称 - * - * @return 系统用户名称 - */ - public static String getCurrentUsername() { - final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if (authentication == null) { - throw new BadRequestException(HttpStatus.UNAUTHORIZED, "当前登录状态过期"); - } - if (authentication.getPrincipal() instanceof UserDetails) { - UserDetails userDetails = (UserDetails) authentication.getPrincipal(); - return userDetails.getUsername(); - } - throw new BadRequestException(HttpStatus.UNAUTHORIZED, "找不到当前登录的信息"); - } - - /** - * 获取系统用户ID - * @return 系统用户ID - */ - public static Long getCurrentUserId() { - UserDetails userDetails = getCurrentUser(); - return new JSONObject(new JSONObject(userDetails).get("user")).get("id", Long.class); - } - - /** - * 获取当前用户的数据权限 - * @return / - */ - public static List getCurrentUserDataScope(){ - UserDetails userDetails = getCurrentUser(); - JSONArray array = JSONUtil.parseArray(new JSONObject(userDetails).get("dataScopes")); - return JSONUtil.toList(array,Long.class); - } - -} diff --git a/backend/src/main/java/com/yfd/platform/utils/SpringContextHolder.java b/backend/src/main/java/com/yfd/platform/utils/SpringContextHolder.java deleted file mode 100644 index b85c770..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/SpringContextHolder.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.utils; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.core.env.Environment; - -import java.util.ArrayList; -import java.util.List; -/** - * @author Jie - * @date 2019-01-07 - */ -@Slf4j -public class SpringContextHolder implements ApplicationContextAware, DisposableBean { - - private static ApplicationContext applicationContext = null; - private static final List CALL_BACKS = new ArrayList<>(); - private static boolean addCallback = true; - - /** - * 针对 某些初始化方法,在SpringContextHolder 未初始化时 提交回调方法。 - * 在SpringContextHolder 初始化后,进行回调使用 - * - * @param callBack 回调函数 - */ - public synchronized static void addCallBacks(CallBack callBack) { - if (addCallback) { - SpringContextHolder.CALL_BACKS.add(callBack); - } else { - log.warn("CallBack:{} 已无法添加!立即执行", callBack.getCallBackName()); - callBack.executor(); - } - } - - /** - * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. - */ - @SuppressWarnings("unchecked") - public static T getBean(String name) { - assertContextInjected(); - return (T) applicationContext.getBean(name); - } - - /** - * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. - */ - public static T getBean(Class requiredType) { - assertContextInjected(); - return applicationContext.getBean(requiredType); - } - - /** - * 获取SpringBoot 配置信息 - * - * @param property 属性key - * @param defaultValue 默认值 - * @param requiredType 返回类型 - * @return / - */ - public static T getProperties(String property, T defaultValue, Class requiredType) { - T result = defaultValue; - try { - result = getBean(Environment.class).getProperty(property, requiredType); - } catch (Exception ignored) {} - return result; - } - - /** - * 获取SpringBoot 配置信息 - * - * @param property 属性key - * @return / - */ - public static String getProperties(String property) { - return getProperties(property, null, String.class); - } - - /** - * 获取SpringBoot 配置信息 - * - * @param property 属性key - * @param requiredType 返回类型 - * @return / - */ - public static T getProperties(String property, Class requiredType) { - return getProperties(property, null, requiredType); - } - - /** - * 检查ApplicationContext不为空. - */ - private static void assertContextInjected() { - if (applicationContext == null) { - throw new IllegalStateException("applicaitonContext属性未注入, 请在applicationContext" + - ".xml中定义SpringContextHolder或在SpringBoot启动类中注册SpringContextHolder."); - } - } - - /** - * 清除SpringContextHolder中的ApplicationContext为Null. - */ - private static void clearHolder() { - log.debug("清除SpringContextHolder中的ApplicationContext:" - + applicationContext); - applicationContext = null; - } - - @Override - public void destroy() { - SpringContextHolder.clearHolder(); - } - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - if (SpringContextHolder.applicationContext != null) { - log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext); - } - SpringContextHolder.applicationContext = applicationContext; - if (addCallback) { - for (CallBack callBack : SpringContextHolder.CALL_BACKS) { - callBack.executor(); - } - CALL_BACKS.clear(); - } - SpringContextHolder.addCallback = false; - } -} diff --git a/backend/src/main/java/com/yfd/platform/utils/StringUtils.java b/backend/src/main/java/com/yfd/platform/utils/StringUtils.java deleted file mode 100644 index b2a9be7..0000000 --- a/backend/src/main/java/com/yfd/platform/utils/StringUtils.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yfd.platform.utils; - - -import cn.hutool.http.HttpUtil; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import com.yfd.platform.constant.Constant; -import lombok.SneakyThrows; -import org.lionsoul.ip2region.DataBlock; -import org.lionsoul.ip2region.DbConfig; -import org.lionsoul.ip2region.DbSearcher; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.core.io.ClassPathResource; -import eu.bitwalker.useragentutils.Browser; -import eu.bitwalker.useragentutils.UserAgent; -import jakarta.servlet.http.HttpServletRequest; -import java.io.File; -import java.io.IOException; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.UnknownHostException; -import java.util.Calendar; -import java.util.Date; -import java.util.Enumeration; - -/** - * @author - * 字符串工具类, 继承org.apache.commons.lang3.StringUtils类 - */ -public class StringUtils extends org.apache.commons.lang3.StringUtils { - - private static final Logger log = LoggerFactory.getLogger(StringUtils.class); - private static boolean ipLocal = false; - private static File file ; - private static DbConfig config; - private static final char SEPARATOR = '_'; - private static final String UNKNOWN = "unknown"; - - static { - SpringContextHolder.addCallBacks(() -> { - StringUtils.ipLocal = SpringContextHolder.getProperties("ip.local-parsing", false, Boolean.class); - if (ipLocal) { - /* - * 此文件为独享 ,不必关闭 - */ - String path = "ip2region/ip2region.db"; - String name = "ip2region.db"; - try { - config = new DbConfig(); - file = FileUtil.inputStreamToFile(new ClassPathResource(path).getInputStream(), name); - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } - }); - } - - /** - * 驼峰命名法工具 - * - * @return toCamelCase(" hello_world ") == "helloWorld" - * toCapitalizeCamelCase("hello_world") == "HelloWorld" - * toUnderScoreCase("helloWorld") = "hello_world" - */ - public static String toCamelCase(String s) { - if (s == null) { - return null; - } - - s = s.toLowerCase(); - - StringBuilder sb = new StringBuilder(s.length()); - boolean upperCase = false; - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - - if (c == SEPARATOR) { - upperCase = true; - } else if (upperCase) { - sb.append(Character.toUpperCase(c)); - upperCase = false; - } else { - sb.append(c); - } - } - - return sb.toString(); - } - - /** - * 驼峰命名法工具 - * - * @return toCamelCase(" hello_world ") == "helloWorld" - * toCapitalizeCamelCase("hello_world") == "HelloWorld" - * toUnderScoreCase("helloWorld") = "hello_world" - */ - public static String toCapitalizeCamelCase(String s) { - if (s == null) { - return null; - } - s = toCamelCase(s); - return s.substring(0, 1).toUpperCase() + s.substring(1); - } - - /** - * 驼峰命名法工具 - * - * @return toCamelCase(" hello_world ") == "helloWorld" - * toCapitalizeCamelCase("hello_world") == "HelloWorld" - * toUnderScoreCase("helloWorld") = "hello_world" - */ - static String toUnderScoreCase(String s) { - if (s == null) { - return null; - } - - StringBuilder sb = new StringBuilder(); - boolean upperCase = false; - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - - boolean nextUpperCase = true; - - if (i < (s.length() - 1)) { - nextUpperCase = Character.isUpperCase(s.charAt(i + 1)); - } - - if ((i > 0) && Character.isUpperCase(c)) { - if (!upperCase || !nextUpperCase) { - sb.append(SEPARATOR); - } - upperCase = true; - } else { - upperCase = false; - } - - sb.append(Character.toLowerCase(c)); - } - - return sb.toString(); - } - - /** - * 获取ip地址 - */ - public static String getIp(HttpServletRequest request) { - String ip = request.getHeader("x-forwarded-for"); - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getRemoteAddr(); - } - String comma = ","; - String localhost = "127.0.0.1"; - if (ip.contains(comma)) { - ip = ip.split(",")[0]; - } - if (localhost.equals(ip)) { - // 获取本机真正的ip地址 - try { - ip = InetAddress.getLocalHost().getHostAddress(); - } catch (UnknownHostException e) { - log.error(e.getMessage(), e); - } - } - return ip; - } - - /** - * 根据ip获取详细地址 - */ - @SneakyThrows - public static String getCityInfo(String ip) { - if (ipLocal) { - return getLocalCityInfo(ip); - } else { - return getHttpCityInfo(ip); - } - } - - /** - * 根据ip获取详细地址 - */ - public static String getHttpCityInfo(String ip) { - String host = "202.108.22.5"; - //超时应该在3钞以上 - int timeOut = 3000; - boolean status = false; - try { - status = InetAddress.getByName(host).isReachable(timeOut); - } catch (IOException e) { - e.printStackTrace(); - } - String api =""; - if (status){ - api = HttpUtil.get(String.format(Constant.Url.IP_URL, ip)); - }else { - api = "{\"ip\":\"127.0.0.1\",\"pro\":\"\",\"proCode\":\"999999\",\"city\":\"\",\"cityCode\":\"0\",\"region\":\"\",\"regionCode\":\"0\",\"addr\":\" 局域网\",\"regionNames\":\"\",\"err\":\"noprovince\"}"; - } - JSONObject object = JSONUtil.parseObj(api); - return object.get("addr", String.class); - } - - - /** - * 根据ip获取详细地址 - */ - public static String getLocalCityInfo(String ip) { - try { - DataBlock dataBlock = new DbSearcher(config, file.getPath()) - .binarySearch(ip); - String region = dataBlock.getRegion(); - String address = region.replace("0|", ""); - char symbol = '|'; - if (address.charAt(address.length() - 1) == symbol) { - address = address.substring(0, address.length() - 1); - } - return address.equals(Constant.REGION) ? "内网IP" : address; - } catch (Exception e) { - log.error(e.getMessage(), e); - } - return ""; - } - - public static String getBrowser(HttpServletRequest request) { - UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent")); - Browser browser = userAgent.getBrowser(); - return browser.getName(); - } - - /** - * 获得当天是周几 - */ - public static String getWeekDay() { - String[] weekDays = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; - Calendar cal = Calendar.getInstance(); - cal.setTime(new Date()); - - int w = cal.get(Calendar.DAY_OF_WEEK) - 1; - if (w < 0) { - w = 0; - } - return weekDays[w]; - } - - /** - * 获取当前机器的IP - * - * @return / - */ - public static String getLocalIp() { - try { - InetAddress candidateAddress = null; - // 遍历所有的网络接口 - for (Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); interfaces.hasMoreElements();) { - NetworkInterface anInterface = interfaces.nextElement(); - // 在所有的接口下再遍历IP - for (Enumeration inetAddresses = anInterface.getInetAddresses(); inetAddresses.hasMoreElements();) { - InetAddress inetAddr = inetAddresses.nextElement(); - // 排除loopback类型地址 - if (!inetAddr.isLoopbackAddress()) { - if (inetAddr.isSiteLocalAddress()) { - // 如果是site-local地址,就是它了 - return inetAddr.getHostAddress(); - } else if (candidateAddress == null) { - // site-local类型的地址未被发现,先记录候选地址 - candidateAddress = inetAddr; - } - } - } - } - if (candidateAddress != null) { - return candidateAddress.getHostAddress(); - } - // 如果没有发现 non-loopback地址.只能用最次选的方案 - InetAddress jdkSuppliedAddress = InetAddress.getLocalHost(); - if (jdkSuppliedAddress == null) { - return ""; - } - return jdkSuppliedAddress.getHostAddress(); - } catch (Exception e) { - return ""; - } - } -} diff --git a/backend/src/main/resources/application-dev.yml b/backend/src/main/resources/application-dev.yml deleted file mode 100644 index 37c1cdd..0000000 --- a/backend/src/main/resources/application-dev.yml +++ /dev/null @@ -1,94 +0,0 @@ -server: - port: 8093 - -spring: - #应用名称 - application: - name: Project-plateform - datasource: - type: com.alibaba.druid.pool.DruidDataSource - druid: - master: - driverClassName: dm.jdbc.driver.DmDriver - url: "${DB_MASTER_URL:jdbc:dm://localhost:5236/WPPDB}" - username: "${DB_MASTER_USERNAME:WPPDB}" - password: "${DB_MASTER_PASSWORD:}" - slave: - driverClassName: dm.jdbc.driver.DmDriver - url: "${DB_SLAVE_URL:jdbc:dm://localhost:5236/WPPDB}" - username: "${DB_SLAVE_USERNAME:WPPDB}" - password: "${DB_SLAVE_PASSWORD:}" - - mvc: - pathmatch: - matching-strategy: ant_path_matcher - servlet: - multipart: - max-file-size: 30MB - max-request-size: 100MB - -logging: - file: - name: logs/projectname.log - level: - com.genersoft.iot: debug - com.genersoft.iot.vmp.storager.dao: info - com.genersoft.iot.vmp.gb28181: info - -# 在线文档: swagger-ui(生产环境建议关闭) -swagger-ui: - enabled: true - - -# 登录相关配置 -login: - # 登录缓存 - cache-enable: true - # 是否限制单用户登录 - single-login: false - # 验证码 - login-code: - # 验证码类型配置 查看 LoginProperties 类 - code-type: arithmetic - -# 启动自动数据库初始化(仅 dev/server): -app: - init: - enabled: false - schema: classpath:db-init/sql/min-schema.sql - # data 文件可选;为避免复杂 dump 解析问题,先不导入 - # data: - marker-table: sys_user - marker-version: v1.0.0 - # 登录图形验证码有效时间/分钟 - expiration: 2 - # 验证码高度 - width: 111 - # 验证码宽度 - heigth: 36 - # 内容长度 - length: 2 - # 字体名称,为空则使用默认字体 - font-name: - # 字体大小 - font-size: 25 - -# IP 本地解析 -ip: - local-parsing: true - - -file-space: #项目文档空间 - files: D:\demoproject\files\ #单独上传的文件附件 - system: D:\demoproject\system\ #单独上传的文件 - -task: - pool: - # 核心线程池大小 - core-pool-size: 10 - # 最大线程数 - max-pool-size: 30 - # 活跃时间 - keep-alive-seconds: 60 - # 队列容量 - queue-capacity: 50 diff --git a/backend/src/main/resources/application-devtw.yml b/backend/src/main/resources/application-devtw.yml deleted file mode 100644 index f59a149..0000000 --- a/backend/src/main/resources/application-devtw.yml +++ /dev/null @@ -1,94 +0,0 @@ -server: - port: 8093 - -spring: - #应用名称 - application: - name: Project-plateform - datasource: - type: com.alibaba.druid.pool.DruidDataSource - druid: - master: - driverClassName: oracle.jdbc.OracleDriver - url: "${DB_MASTER_URL:jdbc:oracle:thin:@172.16.21.134:1521/SDLYZ}" - username: "${DB_MASTER_USERNAME:QGC}" - password: "${DB_MASTER_PASSWORD:ar6Yr7Vxo5}" - slave: - driverClassName: oracle.jdbc.OracleDriver - url: "${DB_SLAVE_URL:jdbc:oracle:thin:@172.16.21.134:1521/SDLYZ}" - username: "${DB_SLAVE_USERNAME:QGC}" - password: "${DB_SLAVE_PASSWORD:ar6Yr7Vxo5}" - - mvc: - pathmatch: - matching-strategy: ant_path_matcher - servlet: - multipart: - max-file-size: 30MB - max-request-size: 100MB - -logging: - file: - name: logs/projectname.log - level: - com.genersoft.iot: debug - com.genersoft.iot.vmp.storager.dao: info - com.genersoft.iot.vmp.gb28181: info - -# 在线文档: swagger-ui(生产环境建议关闭) -swagger-ui: - enabled: true - - -# 登录相关配置 -login: - # 登录缓存 - cache-enable: true - # 是否限制单用户登录 - single-login: false - # 验证码 - login-code: - # 验证码类型配置 查看 LoginProperties 类 - code-type: arithmetic - -# 启动自动数据库初始化(仅 dev/server): -app: - init: - enabled: false - schema: classpath:db-init/sql/min-schema.sql - # data 文件可选;为避免复杂 dump 解析问题,先不导入 - # data: - marker-table: sys_user - marker-version: v1.0.0 - # 登录图形验证码有效时间/分钟 - expiration: 2 - # 验证码高度 - width: 111 - # 验证码宽度 - heigth: 36 - # 内容长度 - length: 2 - # 字体名称,为空则使用默认字体 - font-name: - # 字体大小 - font-size: 25 - -# IP 本地解析 -ip: - local-parsing: true - - -file-space: #项目文档空间 - files: D:\demoproject\files\ #单独上传的文件附件 - system: D:\demoproject\system\ #单独上传的文件 - -task: - pool: - # 核心线程池大小 - core-pool-size: 10 - # 最大线程数 - max-pool-size: 30 - # 活跃时间 - keep-alive-seconds: 60 - # 队列容量 - queue-capacity: 50 diff --git a/backend/src/main/resources/application-framework.yml b/backend/src/main/resources/application-framework.yml deleted file mode 100644 index 9baea68..0000000 --- a/backend/src/main/resources/application-framework.yml +++ /dev/null @@ -1,30 +0,0 @@ -jasypt: - encryptor: - password: ${JASYPT_PASSWORD:} - -# 密码加密传输,前端公钥加密,后端私钥解密(共性配置) -rsa: - private_key: ${RSA_PRIVATE_KEY:} - -# Actuator & Micrometer 默认配置(共性) -management: - endpoints: - web: - exposure: - include: health,info,metrics,prometheus,env,beans,threaddump,loggers,configprops - endpoint: - health: - show-details: always - metrics: - tags: - application: ${spring.application.name:platform} - - -# Springdoc 默认配置(共性) -springdoc: - api-docs: - enabled: true - swagger-ui: - enabled: true - path: /swagger-ui.html - packages-to-scan: com.yfd.platform diff --git a/backend/src/main/resources/application-server.yml b/backend/src/main/resources/application-server.yml deleted file mode 100644 index b4e0057..0000000 --- a/backend/src/main/resources/application-server.yml +++ /dev/null @@ -1,52 +0,0 @@ -server: - port: 8090 - -spring: - #应用名称 - application: - name: Project-plateform - datasource: - type: com.alibaba.druid.pool.DruidDataSource - druid: - master: - driverClassName: com.mysql.cj.jdbc.Driver - url: "${DB_MASTER_URL:jdbc:mysql://43.138.168.68:3306/frameworkdb2025?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true}" - username: "${DB_MASTER_USERNAME:root}" - password: "${DB_MASTER_PASSWORD:}" - - mvc: - pathmatch: - matching-strategy: ant_path_matcher - servlet: - multipart: - max-file-size: 30MB - max-request-size: 100MB - -logging: - file: - name: logs/projectname.log - - level: - com.genersoft.iot: debug - com.genersoft.iot.vmp.storager.dao: info - com.genersoft.iot.vmp.gb28181: info - -# 在线文档: swagger-ui(生产环境建议关闭) -swagger-ui: - enabled: false - -file-space: #项目文档空间 - files: D:\demoproject\files\ #单独上传的文件附件 - useravatar: D:\demoproject\useravatar\ #用户头像 - system: D:\demoproject\system\ #系统文档根目录,用于头像等静态资源 - -# 启动自动数据库初始化(仅 dev/server): -app: - init: - enabled: true - schema: classpath:db-init/sql/min-schema.sql - # data 文件可选;为避免复杂 dump 解析问题,先不导入 - # data: - marker-table: sys_user - marker-version: v1.0.0 - diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml deleted file mode 100644 index 8f42778..0000000 --- a/backend/src/main/resources/application.yml +++ /dev/null @@ -1,34 +0,0 @@ -spring: - profiles: - active: devtw - -jasypt: - encryptor: - password: ${JASYPT_PASSWORD:} - -#密码加密传输,前端公钥加密,后端私钥解密 -rsa: - private_key: ${RSA_PRIVATE_KEY:MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==} - -# Actuator & Micrometer 默认配置 -management: - endpoints: - web: - exposure: - include: health,info,metrics,prometheus,env,beans,threaddump,loggers,configprops - endpoint: - health: - show-details: always - metrics: - tags: - application: ${spring.application.name:platform} - - -# Springdoc 默认配置 -springdoc: - api-docs: - enabled: true - swagger-ui: - enabled: true - path: /swagger-ui.html - packages-to-scan: com.yfd.platform diff --git a/backend/src/main/resources/banner.txt b/backend/src/main/resources/banner.txt deleted file mode 100644 index 47e51d1..0000000 --- a/backend/src/main/resources/banner.txt +++ /dev/null @@ -1,8 +0,0 @@ - __ ____ ____ .___________. _______ ______ __ __ - | | \ \ / / | || ____| / || | | | - | | \ \/ / `---| |----`| |__ | ,----'| |__| | - .--. | | \_ _/ | | | __| | | | __ | - | `--' | | | | | | |____ | `----.| | | | - \______/ |__| |__| |_______| \______||__| |__| - - diff --git a/backend/src/main/resources/ip2region/ip2region.db b/backend/src/main/resources/ip2region/ip2region.db deleted file mode 100644 index e69de29..0000000 diff --git a/backend/src/main/resources/log4jdbc.log4j2.properties b/backend/src/main/resources/log4jdbc.log4j2.properties deleted file mode 100644 index 302525f..0000000 --- a/backend/src/main/resources/log4jdbc.log4j2.properties +++ /dev/null @@ -1,4 +0,0 @@ -# If you use SLF4J. First, you need to tell log4jdbc-log4j2 that you want to use the SLF4J logger -log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator -log4jdbc.auto.load.popular.drivers=false -log4jdbc.drivers=com.mysql.cj.jdbc.Driver \ No newline at end of file diff --git a/backend/src/main/resources/logback-spring.xml b/backend/src/main/resources/logback-spring.xml deleted file mode 100644 index 31a0ed8..0000000 --- a/backend/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - UTF-8 - ${LOG_PATTERN} - - - - - - ${LOG_PATH}/${LOG_FILE}.log - - UTF-8 - ${LOG_PATTERN} - - - ${LOG_PATH}/${LOG_FILE}.%d{yyyy-MM-dd}.log - 30 - - - - - - - - - - - - - \ No newline at end of file diff --git a/backend/src/main/resources/logback.xml b/backend/src/main/resources/logback.xml deleted file mode 100644 index c949c89..0000000 --- a/backend/src/main/resources/logback.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - yfAdmin - - - - - - - ${log.pattern} - ${log.charset} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/backend/src/main/resources/mapper/system/DictionaryMapper.xml b/backend/src/main/resources/mapper/system/DictionaryMapper.xml deleted file mode 100644 index 16edd1e..0000000 --- a/backend/src/main/resources/mapper/system/DictionaryMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/backend/src/main/resources/mapper/system/MessageMapper.xml b/backend/src/main/resources/mapper/system/MessageMapper.xml deleted file mode 100644 index 96cbcfc..0000000 --- a/backend/src/main/resources/mapper/system/MessageMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/backend/src/main/resources/mapper/system/Model3dMapper.xml b/backend/src/main/resources/mapper/system/Model3dMapper.xml deleted file mode 100644 index d935f68..0000000 --- a/backend/src/main/resources/mapper/system/Model3dMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/backend/src/main/resources/mapper/system/QuartzJobMapper.xml b/backend/src/main/resources/mapper/system/QuartzJobMapper.xml deleted file mode 100644 index b523b0a..0000000 --- a/backend/src/main/resources/mapper/system/QuartzJobMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/backend/src/main/resources/mapper/system/SysConfigMapper.xml b/backend/src/main/resources/mapper/system/SysConfigMapper.xml deleted file mode 100644 index cf22aa4..0000000 --- a/backend/src/main/resources/mapper/system/SysConfigMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/backend/src/main/resources/mapper/system/SysDictionaryItemsMapper.xml b/backend/src/main/resources/mapper/system/SysDictionaryItemsMapper.xml deleted file mode 100644 index 1bf0942..0000000 --- a/backend/src/main/resources/mapper/system/SysDictionaryItemsMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/backend/src/main/resources/mapper/system/SysDictionaryMapper.xml b/backend/src/main/resources/mapper/system/SysDictionaryMapper.xml deleted file mode 100644 index 6963e40..0000000 --- a/backend/src/main/resources/mapper/system/SysDictionaryMapper.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - diff --git a/backend/src/main/resources/mapper/system/SysLogMapper.xml b/backend/src/main/resources/mapper/system/SysLogMapper.xml deleted file mode 100644 index 1046de9..0000000 --- a/backend/src/main/resources/mapper/system/SysLogMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/backend/src/main/resources/mapper/system/SysMenuMapper.xml b/backend/src/main/resources/mapper/system/SysMenuMapper.xml deleted file mode 100644 index 85869c7..0000000 --- a/backend/src/main/resources/mapper/system/SysMenuMapper.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - update sys_menu set orderno=orderno+1 where parentid=#{parentid} and orderno < #{Orderno} and orderno >= #{upOrderno} - - - - - update sys_menu SET orderno=orderno-1 where parentid=#{parentid} and orderno > #{Orderno} and orderno <= #{downOrderno} - - - - - - - - - - diff --git a/backend/src/main/resources/mapper/system/SysMessageMapper.xml b/backend/src/main/resources/mapper/system/SysMessageMapper.xml deleted file mode 100644 index cda7c6f..0000000 --- a/backend/src/main/resources/mapper/system/SysMessageMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/backend/src/main/resources/mapper/system/SysOrganizationMapper.xml b/backend/src/main/resources/mapper/system/SysOrganizationMapper.xml deleted file mode 100644 index 053c5ae..0000000 --- a/backend/src/main/resources/mapper/system/SysOrganizationMapper.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - diff --git a/backend/src/main/resources/mapper/system/SysQuartzJobMapper.xml b/backend/src/main/resources/mapper/system/SysQuartzJobMapper.xml deleted file mode 100644 index 268cb3d..0000000 --- a/backend/src/main/resources/mapper/system/SysQuartzJobMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/backend/src/main/resources/mapper/system/SysRoleMapper.xml b/backend/src/main/resources/mapper/system/SysRoleMapper.xml deleted file mode 100644 index c2c0d97..0000000 --- a/backend/src/main/resources/mapper/system/SysRoleMapper.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - - INSERT INTO sys_role_menu - - - id, - - - roleid, - - - menuid - - - - - #{id}, - - - #{roleid}, - - - #{menuid} - - - - - - - - - - - - - - - - - - - - - - - - - delete from sys_role_users where userid !=(select u.id from sys_user u where u.account="admin") and roleid=#{roleid} and userid=#{urserid} - - - - - DELETE FROM sys_role_menu WHERE roleid= #{id} - - - - - DELETE FROM sys_role_users WHERE roleid= #{id} - - diff --git a/backend/src/main/resources/mapper/system/SysUserMapper.xml b/backend/src/main/resources/mapper/system/SysUserMapper.xml deleted file mode 100644 index dfc56f0..0000000 --- a/backend/src/main/resources/mapper/system/SysUserMapper.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - insert into sys_role_users values (#{id},#{roleid},#{userid}) - - - - - - - - - - - - - - - - - - delete from sys_role_users where userid=#{userid} - - - - delete from sys_role_users - where - userid=#{userid} - and roleid not in - - #{roleids} - - - - DELETE FROM sys_role_users WHERE userid IN - - #{id} - - - - diff --git a/backend/src/main/resources/quartz.properties b/backend/src/main/resources/quartz.properties deleted file mode 100644 index 03d3988..0000000 --- a/backend/src/main/resources/quartz.properties +++ /dev/null @@ -1,21 +0,0 @@ -######################################## -# Quartz 默认配置示例(RAMJobStore) -######################################## - -org.quartz.scheduler.instanceName = PlatformScheduler -org.quartz.scheduler.instanceId = AUTO - -# 线程池配置 -org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool -org.quartz.threadPool.threadCount = 10 -org.quartz.threadPool.threadPriority = 5 - -# 使用内存存储(如需持久化请改为 JobStoreTX 并配置数据源) -org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore - -# Misfire 阈值 -org.quartz.jobStore.misfireThreshold = 60000 - -# 插件(可选):关闭时清理 -org.quartz.plugin.shutdownHook.class = org.quartz.plugins.management.ShutdownHookPlugin -org.quartz.plugin.shutdownHook.cleanShutdown = true \ No newline at end of file diff --git a/backend/src/main/resources/static/assets/401-099a3a32.js b/backend/src/main/resources/static/assets/401-099a3a32.js deleted file mode 100644 index 314a602..0000000 --- a/backend/src/main/resources/static/assets/401-099a3a32.js +++ /dev/null @@ -1 +0,0 @@ -import{d as k,a9 as v,aa as x,c as V,g as o,w as s,a as i,Q as C,e as l,I as y,o as R,j as a,i as e,U as z,_ as B}from"./index-b25f0d08.js";const G={class:"errPage-container"},N={class:"list-unstyled"},U={class:"link-type"},j=["src"],I=["src"],P={name:"Page401"},h=k({...P,setup(E){const u=v({errGif:new URL("/assets/401-a61ddb94.gif",self.location).href,ewizardClap:"https://wpimg.wallstcn.com/007ef517-bafd-4066-aae4-6883632d9646",dialogVisible:!1}),{errGif:p,ewizardClap:_,dialogVisible:n}=x(u),f=y();function m(){f.back()}return(L,t)=>{const c=l("el-button"),b=l("router-link"),r=l("el-col"),g=l("el-row"),w=l("el-dialog");return R(),V("div",G,[o(c,{icon:"el-icon-arrow-left",class:"pan-back-btn",onClick:m},{default:s(()=>[...t[2]||(t[2]=[a(" 返回 ",-1)])]),_:1}),o(g,null,{default:s(()=>[o(r,{span:12},{default:s(()=>[t[6]||(t[6]=e("h1",{class:"text-jumbo text-ginormous"},"Oops!",-1)),t[7]||(t[7]=a(" gif来源",-1)),t[8]||(t[8]=e("a",{href:"https://zh.airbnb.com/",target:"_blank"},"airbnb",-1)),t[9]||(t[9]=a(" 页面 ",-1)),t[10]||(t[10]=e("h2",null,"你没有权限去该页面",-1)),t[11]||(t[11]=e("h6",null,"如有不满请联系你领导",-1)),e("ul",N,[t[4]||(t[4]=e("li",null,"或者你可以去:",-1)),e("li",U,[o(b,{to:"/dashboard"},{default:s(()=>[...t[3]||(t[3]=[a(" 回首页 ",-1)])]),_:1})]),t[5]||(t[5]=e("li",{class:"link-type"},[e("a",{href:"https://www.taobao.com/"},"随便看看")],-1)),e("li",null,[e("a",{href:"#",onClick:t[0]||(t[0]=z(d=>n.value=!0,["prevent"]))},"点我看图")])])]),_:1}),o(r,{span:12},{default:s(()=>[e("img",{src:i(p),width:"313",height:"428",alt:"Girl has dropped her ice cream."},null,8,j)]),_:1})]),_:1}),o(w,{modelValue:i(n),"onUpdate:modelValue":t[1]||(t[1]=d=>C(n)?n.value=d:null),title:"随便看"},{default:s(()=>[e("img",{src:i(_),class:"pan-img"},null,8,I)]),_:1},8,["modelValue"])])}}});const O=B(h,[["__scopeId","data-v-f88583c8"]]);export{O as default}; diff --git a/backend/src/main/resources/static/assets/401-485a4475.js b/backend/src/main/resources/static/assets/401-485a4475.js deleted file mode 100644 index 390a98a..0000000 --- a/backend/src/main/resources/static/assets/401-485a4475.js +++ /dev/null @@ -1 +0,0 @@ -import{d as v,aa as x,ab as V,c as C,f as t,w as o,a as i,S as y,i as a,M as I,o as R,j as _,h as e,W as S,J as z,K as B,_ as G}from"./index-5c62e6c4.js";const s=l=>(z("data-v-25007613"),l=l(),B(),l),N={class:"errPage-container"},j=s(()=>e("h1",{class:"text-jumbo text-ginormous"},"Oops!",-1)),M=s(()=>e("a",{href:"https://zh.airbnb.com/",target:"_blank"},"airbnb",-1)),P=s(()=>e("h2",null,"你没有权限去该页面",-1)),U=s(()=>e("h6",null,"如有不满请联系你领导",-1)),E={class:"list-unstyled"},J=s(()=>e("li",null,"或者你可以去:",-1)),K={class:"link-type"},L=s(()=>e("li",{class:"link-type"},[e("a",{href:"https://www.taobao.com/"},"随便看看")],-1)),O=["src"],T=["src"],W={name:"Page401"},$=v({...W,setup(l){const u=x({errGif:new URL("/assets/401-a61ddb94.gif",self.location).href,ewizardClap:"https://wpimg.wallstcn.com/007ef517-bafd-4066-aae4-6883632d9646",dialogVisible:!1}),{errGif:p,ewizardClap:f,dialogVisible:n}=V(u),h=I();function m(){h.back()}return(q,c)=>{const b=a("el-button"),g=a("router-link"),r=a("el-col"),w=a("el-row"),k=a("el-dialog");return R(),C("div",N,[t(b,{icon:"el-icon-arrow-left",class:"pan-back-btn",onClick:m},{default:o(()=>[_(" 返回 ")]),_:1}),t(w,null,{default:o(()=>[t(r,{span:12},{default:o(()=>[j,_(" gif来源"),M,_(" 页面 "),P,U,e("ul",E,[J,e("li",K,[t(g,{to:"/dashboard"},{default:o(()=>[_(" 回首页 ")]),_:1})]),L,e("li",null,[e("a",{href:"#",onClick:c[0]||(c[0]=S(d=>n.value=!0,["prevent"]))},"点我看图")])])]),_:1}),t(r,{span:12},{default:o(()=>[e("img",{src:i(p),width:"313",height:"428",alt:"Girl has dropped her ice cream."},null,8,O)]),_:1})]),_:1}),t(k,{modelValue:i(n),"onUpdate:modelValue":c[1]||(c[1]=d=>y(n)?n.value=d:null),title:"随便看"},{default:o(()=>[e("img",{src:i(f),class:"pan-img"},null,8,T)]),_:1},8,["modelValue"])])}}});const D=G($,[["__scopeId","data-v-25007613"]]);export{D as default}; diff --git a/backend/src/main/resources/static/assets/401-a61ddb94.gif b/backend/src/main/resources/static/assets/401-a61ddb94.gif deleted file mode 100644 index cd6e0d9..0000000 Binary files a/backend/src/main/resources/static/assets/401-a61ddb94.gif and /dev/null differ diff --git a/backend/src/main/resources/static/assets/401-fffd1e4b.css b/backend/src/main/resources/static/assets/401-fffd1e4b.css deleted file mode 100644 index 6a09eaa..0000000 --- a/backend/src/main/resources/static/assets/401-fffd1e4b.css +++ /dev/null @@ -1 +0,0 @@ -.errPage-container[data-v-f88583c8]{width:800px;max-width:100%;margin:100px auto}.errPage-container .pan-back-btn[data-v-f88583c8]{background:#008489;color:#fff;border:none!important}.errPage-container .pan-gif[data-v-f88583c8]{margin:0 auto;display:block}.errPage-container .pan-img[data-v-f88583c8]{display:block;margin:0 auto;width:100%}.errPage-container .text-jumbo[data-v-f88583c8]{font-size:60px;font-weight:700;color:#484848}.errPage-container .list-unstyled[data-v-f88583c8]{font-size:14px}.errPage-container .list-unstyled li[data-v-f88583c8]{padding-bottom:5px}.errPage-container .list-unstyled a[data-v-f88583c8]{color:#008489;text-decoration:none}.errPage-container .list-unstyled a[data-v-f88583c8]:hover{text-decoration:underline} diff --git a/backend/src/main/resources/static/assets/404-51ac6f86.css b/backend/src/main/resources/static/assets/404-51ac6f86.css deleted file mode 100644 index 52dce10..0000000 --- a/backend/src/main/resources/static/assets/404-51ac6f86.css +++ /dev/null @@ -1 +0,0 @@ -.wscn-http404-container[data-v-578ebab8]{transform:translate(-50%,-50%);position:absolute;top:40%;left:50%}.wscn-http404[data-v-578ebab8]{position:relative;width:1200px;padding:0 50px;overflow:hidden}.wscn-http404 .pic-404[data-v-578ebab8]{position:relative;float:left;width:600px;overflow:hidden}.wscn-http404 .pic-404__parent[data-v-578ebab8]{width:100%}.wscn-http404 .pic-404__child[data-v-578ebab8]{position:absolute}.wscn-http404 .pic-404__child.left[data-v-578ebab8]{width:80px;top:17px;left:220px;opacity:0;animation-name:cloudLeft-578ebab8;animation-duration:2s;animation-timing-function:linear;animation-fill-mode:forwards;animation-delay:1s}.wscn-http404 .pic-404__child.mid[data-v-578ebab8]{width:46px;top:10px;left:420px;opacity:0;animation-name:cloudMid-578ebab8;animation-duration:2s;animation-timing-function:linear;animation-fill-mode:forwards;animation-delay:1.2s}.wscn-http404 .pic-404__child.right[data-v-578ebab8]{width:62px;top:100px;left:500px;opacity:0;animation-name:cloudRight-578ebab8;animation-duration:2s;animation-timing-function:linear;animation-fill-mode:forwards;animation-delay:1s}@keyframes cloudLeft-578ebab8{0%{top:17px;left:220px;opacity:0}20%{top:33px;left:188px;opacity:1}80%{top:81px;left:92px;opacity:1}to{top:97px;left:60px;opacity:0}}@keyframes cloudMid-578ebab8{0%{top:10px;left:420px;opacity:0}20%{top:40px;left:360px;opacity:1}70%{top:130px;left:180px;opacity:1}to{top:160px;left:120px;opacity:0}}@keyframes cloudRight-578ebab8{0%{top:100px;left:500px;opacity:0}20%{top:120px;left:460px;opacity:1}80%{top:180px;left:340px;opacity:1}to{top:200px;left:300px;opacity:0}}.wscn-http404 .bullshit[data-v-578ebab8]{position:relative;float:left;width:300px;padding:30px 0;overflow:hidden}.wscn-http404 .bullshit__oops[data-v-578ebab8]{font-size:32px;font-weight:700;line-height:40px;color:#1482f0;opacity:0;margin-bottom:20px;animation-name:slideUp-578ebab8;animation-duration:.5s;animation-fill-mode:forwards}.wscn-http404 .bullshit__headline[data-v-578ebab8]{font-size:20px;line-height:24px;color:#222;font-weight:700;opacity:0;margin-bottom:10px;animation-name:slideUp-578ebab8;animation-duration:.5s;animation-delay:.1s;animation-fill-mode:forwards}.wscn-http404 .bullshit__info[data-v-578ebab8]{font-size:13px;line-height:21px;color:gray;opacity:0;margin-bottom:30px;animation-name:slideUp-578ebab8;animation-duration:.5s;animation-delay:.2s;animation-fill-mode:forwards}.wscn-http404 .bullshit__return-home[data-v-578ebab8]{display:block;float:left;width:110px;height:36px;background:#1482f0;border-radius:100px;text-align:center;color:#fff;opacity:0;font-size:14px;line-height:36px;cursor:pointer;animation-name:slideUp-578ebab8;animation-duration:.5s;animation-delay:.3s;animation-fill-mode:forwards}@keyframes slideUp-578ebab8{0%{transform:translateY(60px);opacity:0}to{transform:translateY(0);opacity:1}} diff --git a/backend/src/main/resources/static/assets/404-538aa4d7.png b/backend/src/main/resources/static/assets/404-538aa4d7.png deleted file mode 100644 index 3d8e230..0000000 Binary files a/backend/src/main/resources/static/assets/404-538aa4d7.png and /dev/null differ diff --git a/backend/src/main/resources/static/assets/404-6dcbdda2.js b/backend/src/main/resources/static/assets/404-6dcbdda2.js deleted file mode 100644 index 7deafbf..0000000 --- a/backend/src/main/resources/static/assets/404-6dcbdda2.js +++ /dev/null @@ -1 +0,0 @@ -import{d as l,c as i,i as s,af as o,j as c,t as r,o as n,_}from"./index-b25f0d08.js";const d="/assets/404-538aa4d7.png",e="/assets/404_cloud-98e7ac66.png",p={class:"wscn-http404-container"},b={name:"Page404"},u=l({...b,setup(h){function a(){return"The webmaster said that you can not enter this page..."}return(m,t)=>(n(),i("div",p,[s("div",{class:"wscn-http404"},[t[4]||(t[4]=o('
404404404404
',1)),s("div",{class:"bullshit"},[t[0]||(t[0]=s("div",{class:"bullshit__oops"},"OOPS!",-1)),t[1]||(t[1]=s("div",{class:"bullshit__info"},[c(" All rights reserved "),s("a",{style:{color:"#20a0ff"},href:"https://wallstreetcn.com",target:"_blank"},"wallstreetcn")],-1)),s("div",{class:"bullshit__headline"},r(a)),t[2]||(t[2]=s("div",{class:"bullshit__info"}," Please check that the URL you entered is correct, or click the button below to return to the homepage. ",-1)),t[3]||(t[3]=s("a",{href:"",class:"bullshit__return-home"},"Back to home",-1))])])]))}});const f=_(u,[["__scopeId","data-v-578ebab8"]]);export{f as default}; diff --git a/backend/src/main/resources/static/assets/404-ae343fa7.js b/backend/src/main/resources/static/assets/404-ae343fa7.js deleted file mode 100644 index 51a23cb..0000000 --- a/backend/src/main/resources/static/assets/404-ae343fa7.js +++ /dev/null @@ -1 +0,0 @@ -import{d as o,c as _,h as t,t as i,ag as l,J as n,K as d,j as r,o as h,_ as p}from"./index-5c62e6c4.js";const f="/assets/404-538aa4d7.png",a="/assets/404_cloud-98e7ac66.png",e=s=>(n("data-v-ec8f1f5a"),s=s(),d(),s),u={class:"wscn-http404-container"},m=l('
404404404404
',1),v=e(()=>t("div",{class:"bullshit__oops"},"OOPS!",-1)),g=e(()=>t("div",{class:"bullshit__info"},[r(" All rights reserved "),t("a",{style:{color:"#20a0ff"},href:"https://wallstreetcn.com",target:"_blank"},"wallstreetcn")],-1)),b=e(()=>t("div",{class:"bullshit__info"}," Please check that the URL you entered is correct, or click the button below to return to the homepage. ",-1)),w=e(()=>t("a",{href:"",class:"bullshit__return-home"},"Back to home",-1)),k={name:"Page404"},y=o({...k,setup(s){function c(){return"The webmaster said that you can not enter this page..."}return(S,x)=>(h(),_("div",u,[t("div",{class:"wscn-http404"},[m,t("div",{class:"bullshit"},[v,g,t("div",{class:"bullshit__headline"},i(c)),b,w])])]))}});const I=p(y,[["__scopeId","data-v-ec8f1f5a"]]);export{I as default}; diff --git a/backend/src/main/resources/static/assets/404_cloud-98e7ac66.png b/backend/src/main/resources/static/assets/404_cloud-98e7ac66.png deleted file mode 100644 index c6281d0..0000000 Binary files a/backend/src/main/resources/static/assets/404_cloud-98e7ac66.png and /dev/null differ diff --git a/backend/src/main/resources/static/assets/BarChart-a4765ae3.js b/backend/src/main/resources/static/assets/BarChart-a4765ae3.js deleted file mode 100644 index 95b45f0..0000000 --- a/backend/src/main/resources/static/assets/BarChart-a4765ae3.js +++ /dev/null @@ -1 +0,0 @@ -import{r as c,i as f,L as a}from"./resize-9f0962b6.js";import{d as m,I as y,aq as u,ar as x,k as h,a4 as p,o as g,c as b,X as S,p as v}from"./index-5c62e6c4.js";const w=["id"],L=m({__name:"BarChart",props:{id:{type:String,default:"barChart"},className:{type:String,default:""},width:{type:String,default:"200px",required:!0},height:{type:String,default:"200px",required:!0}},setup(e){const o=e,{mounted:i,chart:r,beforeDestroy:n,activated:l,deactivated:s}=c();function d(){const t=f(document.getElementById(o.id));t.setOption({title:{show:!0,text:"业绩总览",x:"center",padding:15,textStyle:{fontSize:18,fontStyle:"normal",fontWeight:"bold",color:"#337ecc"}},grid:{left:"2%",right:"2%",bottom:"10%",containLabel:!0},tooltip:{trigger:"axis",axisPointer:{type:"cross",crossStyle:{color:"#999"}}},legend:{x:"center",y:"bottom",data:["收入","毛利润","收入增长率","利润增长率"]},xAxis:[{type:"category",data:["浙江","北京","上海","广东","深圳"],axisPointer:{type:"shadow"}}],yAxis:[{type:"value",min:0,max:1e4,interval:2e3,axisLabel:{formatter:"{value} "}},{type:"value",min:0,max:100,interval:20,axisLabel:{formatter:"{value}%"}}],series:[{name:"收入",type:"bar",data:[7e3,7100,7200,7300,7400],barWidth:20,itemStyle:{color:new a(0,0,0,1,[{offset:0,color:"#83bff6"},{offset:.5,color:"#188df0"},{offset:1,color:"#188df0"}])}},{name:"毛利润",type:"bar",data:[8e3,8200,8400,8600,8800],barWidth:20,itemStyle:{color:new a(0,0,0,1,[{offset:0,color:"#25d73c"},{offset:.5,color:"#1bc23d"},{offset:1,color:"#179e61"}])}},{name:"收入增长率",type:"line",yAxisIndex:1,data:[60,65,70,75,80],itemStyle:{color:"#67C23A"}},{name:"利润增长率",type:"line",yAxisIndex:1,data:[70,75,80,85,90],itemStyle:{color:"#409EFF"}}]}),r.value=t}return y(()=>{n()}),u(()=>{l()}),x(()=>{s()}),h(()=>{i(),p(()=>{d()})}),(t,C)=>(g(),b("div",{id:e.id,class:S(e.className),style:v({height:e.height,width:e.width})},null,14,w))}});export{L as default}; diff --git a/backend/src/main/resources/static/assets/BarChart-efd5cbe1.js b/backend/src/main/resources/static/assets/BarChart-efd5cbe1.js deleted file mode 100644 index 87b1a1e..0000000 --- a/backend/src/main/resources/static/assets/BarChart-efd5cbe1.js +++ /dev/null @@ -1 +0,0 @@ -import{r as c,i as f,L as a}from"./resize-24879ea2.js";import{d as m,K as y,ap as u,aq as x,k as h,a3 as p,o as g,c as b,V as S,q as v}from"./index-b25f0d08.js";const w=["id"],L=m({__name:"BarChart",props:{id:{type:String,default:"barChart"},className:{type:String,default:""},width:{type:String,default:"200px",required:!0},height:{type:String,default:"200px",required:!0}},setup(e){const o=e,{mounted:i,chart:r,beforeDestroy:n,activated:l,deactivated:s}=c();function d(){const t=f(document.getElementById(o.id));t.setOption({title:{show:!0,text:"业绩总览",x:"center",padding:15,textStyle:{fontSize:18,fontStyle:"normal",fontWeight:"bold",color:"#337ecc"}},grid:{left:"2%",right:"2%",bottom:"10%",containLabel:!0},tooltip:{trigger:"axis",axisPointer:{type:"cross",crossStyle:{color:"#999"}}},legend:{x:"center",y:"bottom",data:["收入","毛利润","收入增长率","利润增长率"]},xAxis:[{type:"category",data:["浙江","北京","上海","广东","深圳"],axisPointer:{type:"shadow"}}],yAxis:[{type:"value",min:0,max:1e4,interval:2e3,axisLabel:{formatter:"{value} "}},{type:"value",min:0,max:100,interval:20,axisLabel:{formatter:"{value}%"}}],series:[{name:"收入",type:"bar",data:[7e3,7100,7200,7300,7400],barWidth:20,itemStyle:{color:new a(0,0,0,1,[{offset:0,color:"#83bff6"},{offset:.5,color:"#188df0"},{offset:1,color:"#188df0"}])}},{name:"毛利润",type:"bar",data:[8e3,8200,8400,8600,8800],barWidth:20,itemStyle:{color:new a(0,0,0,1,[{offset:0,color:"#25d73c"},{offset:.5,color:"#1bc23d"},{offset:1,color:"#179e61"}])}},{name:"收入增长率",type:"line",yAxisIndex:1,data:[60,65,70,75,80],itemStyle:{color:"#67C23A"}},{name:"利润增长率",type:"line",yAxisIndex:1,data:[70,75,80,85,90],itemStyle:{color:"#409EFF"}}]}),r.value=t}return y(()=>{n()}),u(()=>{l()}),x(()=>{s()}),h(()=>{i(),p(()=>{d()})}),(t,C)=>(g(),b("div",{id:e.id,class:S(e.className),style:v({height:e.height,width:e.width})},null,14,w))}});export{L as default}; diff --git a/backend/src/main/resources/static/assets/FunnelChart-79f3d5f7.js b/backend/src/main/resources/static/assets/FunnelChart-79f3d5f7.js deleted file mode 100644 index 0a2fd3d..0000000 --- a/backend/src/main/resources/static/assets/FunnelChart-79f3d5f7.js +++ /dev/null @@ -1 +0,0 @@ -import{r as s,i as u}from"./resize-24879ea2.js";import{d as c,K as m,ap as h,aq as f,k as p,a3 as y,o as g,c as S,V as b,q as v}from"./index-b25f0d08.js";const w=["id"],q=c({__name:"FunnelChart",props:{id:{type:String,default:"funnelChart"},className:{type:String,default:""},width:{type:String,default:"200px",required:!0},height:{type:String,default:"200px",required:!0}},setup(e){const n=e,{mounted:a,chart:i,beforeDestroy:o,activated:l,deactivated:r}=s();function d(){const t=u(document.getElementById(n.id));t.setOption({title:{show:!0,text:"订单线索转化漏斗图",x:"center",padding:15,textStyle:{fontSize:18,fontStyle:"normal",fontWeight:"bold",color:"#337ecc"}},grid:{left:"2%",right:"2%",bottom:"10%",containLabel:!0},legend:{x:"center",y:"bottom",data:["Show","Click","Visit","Inquiry","Order"]},series:[{name:"Funnel",type:"funnel",left:"20%",top:60,bottom:60,width:"60%",sort:"descending",gap:2,label:{show:!0,position:"inside"},labelLine:{length:10,lineStyle:{width:1,type:"solid"}},itemStyle:{borderColor:"#fff",borderWidth:1},emphasis:{label:{fontSize:20}},data:[{value:60,name:"Visit"},{value:40,name:"Inquiry"},{value:20,name:"Order"},{value:80,name:"Click"},{value:100,name:"Show"}]}]}),i.value=t}return m(()=>{o()}),h(()=>{l()}),f(()=>{r()}),p(()=>{a(),y(()=>{d()})}),(t,x)=>(g(),S("div",{id:e.id,class:b(e.className),style:v({height:e.height,width:e.width})},null,14,w))}});export{q as default}; diff --git a/backend/src/main/resources/static/assets/FunnelChart-8e41d306.js b/backend/src/main/resources/static/assets/FunnelChart-8e41d306.js deleted file mode 100644 index b4f80e1..0000000 --- a/backend/src/main/resources/static/assets/FunnelChart-8e41d306.js +++ /dev/null @@ -1 +0,0 @@ -import{r as s,i as u}from"./resize-9f0962b6.js";import{d as c,I as m,aq as h,ar as f,k as p,a4 as y,o as g,c as S,X as b,p as v}from"./index-5c62e6c4.js";const w=["id"],q=c({__name:"FunnelChart",props:{id:{type:String,default:"funnelChart"},className:{type:String,default:""},width:{type:String,default:"200px",required:!0},height:{type:String,default:"200px",required:!0}},setup(e){const n=e,{mounted:a,chart:i,beforeDestroy:o,activated:l,deactivated:r}=s();function d(){const t=u(document.getElementById(n.id));t.setOption({title:{show:!0,text:"订单线索转化漏斗图",x:"center",padding:15,textStyle:{fontSize:18,fontStyle:"normal",fontWeight:"bold",color:"#337ecc"}},grid:{left:"2%",right:"2%",bottom:"10%",containLabel:!0},legend:{x:"center",y:"bottom",data:["Show","Click","Visit","Inquiry","Order"]},series:[{name:"Funnel",type:"funnel",left:"20%",top:60,bottom:60,width:"60%",sort:"descending",gap:2,label:{show:!0,position:"inside"},labelLine:{length:10,lineStyle:{width:1,type:"solid"}},itemStyle:{borderColor:"#fff",borderWidth:1},emphasis:{label:{fontSize:20}},data:[{value:60,name:"Visit"},{value:40,name:"Inquiry"},{value:20,name:"Order"},{value:80,name:"Click"},{value:100,name:"Show"}]}]}),i.value=t}return m(()=>{o()}),h(()=>{l()}),f(()=>{r()}),p(()=>{a(),y(()=>{d()})}),(t,x)=>(g(),S("div",{id:e.id,class:b(e.className),style:v({height:e.height,width:e.width})},null,14,w))}});export{q as default}; diff --git a/backend/src/main/resources/static/assets/PieChart-bffd7bcc.js b/backend/src/main/resources/static/assets/PieChart-bffd7bcc.js deleted file mode 100644 index 06edc6a..0000000 --- a/backend/src/main/resources/static/assets/PieChart-bffd7bcc.js +++ /dev/null @@ -1 +0,0 @@ -import{r as c,i as u}from"./resize-24879ea2.js";import{d as m,K as h,ap as f,aq as p,k as g,a3 as y,o as C,c as v,V as x,q as S}from"./index-b25f0d08.js";const b=["id"],z=m({__name:"PieChart",props:{id:{type:String,default:"pieChart"},className:{type:String,default:""},width:{type:String,default:"200px",required:!0},height:{type:String,default:"200px",required:!0}},setup(e){const i=e,{mounted:n,chart:o,beforeDestroy:r,activated:s,deactivated:d}=c();function l(){const t=u(document.getElementById(i.id));t.setOption({title:{show:!0,text:"产品分类总览",x:"center",padding:15,textStyle:{fontSize:18,fontStyle:"normal",fontWeight:"bold",color:"#337ecc"}},grid:{left:"2%",right:"2%",bottom:"10%",containLabel:!0},legend:{top:"bottom"},series:[{name:"Nightingale Chart",type:"pie",radius:[50,130],center:["50%","50%"],roseType:"area",itemStyle:{borderRadius:1,color:function(a){return["#409EFF","#67C23A","#E6A23C","#F56C6C"][a.dataIndex]}},data:[{value:26,name:"家用电器"},{value:27,name:"户外运动"},{value:24,name:"汽车用品"},{value:23,name:"手机数码"}]}]}),o.value=t}return h(()=>{r()}),f(()=>{s()}),p(()=>{d()}),g(()=>{n(),y(()=>{l()})}),(t,a)=>(C(),v("div",{id:e.id,class:x(e.className),style:S({height:e.height,width:e.width})},null,14,b))}});export{z as default}; diff --git a/backend/src/main/resources/static/assets/PieChart-f0d9d351.js b/backend/src/main/resources/static/assets/PieChart-f0d9d351.js deleted file mode 100644 index 8f6ea0a..0000000 --- a/backend/src/main/resources/static/assets/PieChart-f0d9d351.js +++ /dev/null @@ -1 +0,0 @@ -import{r as c,i as u}from"./resize-9f0962b6.js";import{d as m,I as h,aq as f,ar as p,k as g,a4 as y,o as C,c as v,X as x,p as S}from"./index-5c62e6c4.js";const b=["id"],B=m({__name:"PieChart",props:{id:{type:String,default:"pieChart"},className:{type:String,default:""},width:{type:String,default:"200px",required:!0},height:{type:String,default:"200px",required:!0}},setup(e){const i=e,{mounted:n,chart:o,beforeDestroy:r,activated:s,deactivated:d}=c();function l(){const t=u(document.getElementById(i.id));t.setOption({title:{show:!0,text:"产品分类总览",x:"center",padding:15,textStyle:{fontSize:18,fontStyle:"normal",fontWeight:"bold",color:"#337ecc"}},grid:{left:"2%",right:"2%",bottom:"10%",containLabel:!0},legend:{top:"bottom"},series:[{name:"Nightingale Chart",type:"pie",radius:[50,130],center:["50%","50%"],roseType:"area",itemStyle:{borderRadius:1,color:function(a){return["#409EFF","#67C23A","#E6A23C","#F56C6C"][a.dataIndex]}},data:[{value:26,name:"家用电器"},{value:27,name:"户外运动"},{value:24,name:"汽车用品"},{value:23,name:"手机数码"}]}]}),o.value=t}return h(()=>{r()}),f(()=>{s()}),p(()=>{d()}),g(()=>{n(),y(()=>{l()})}),(t,a)=>(C(),v("div",{id:e.id,class:x(e.className),style:S({height:e.height,width:e.width})},null,14,b))}});export{B as default}; diff --git a/backend/src/main/resources/static/assets/RadarChart-94b1112a.js b/backend/src/main/resources/static/assets/RadarChart-94b1112a.js deleted file mode 100644 index 3a44423..0000000 --- a/backend/src/main/resources/static/assets/RadarChart-94b1112a.js +++ /dev/null @@ -1 +0,0 @@ -import{r as l,i as m}from"./resize-9f0962b6.js";import{d as u,I as h,aq as f,ar as g,k as p,a4 as y,o as v,c as x,X as C,p as S}from"./index-5c62e6c4.js";const b=["id"],z=u({__name:"RadarChart",props:{id:{type:String,default:"radarChart"},className:{type:String,default:""},width:{type:String,default:"200px",required:!0},height:{type:String,default:"200px",required:!0}},setup(e){const n=e,{mounted:r,chart:i,beforeDestroy:o,activated:d,deactivated:s}=l();function c(){const t=m(document.getElementById(n.id));t.setOption({title:{show:!0,text:"订单状态统计",x:"center",padding:15,textStyle:{fontSize:18,fontStyle:"normal",fontWeight:"bold",color:"#337ecc"}},grid:{left:"2%",right:"2%",bottom:"10%",containLabel:!0},legend:{x:"center",y:"bottom",data:["预定数量","下单数量","发货数量"]},radar:{radius:"60%",indicator:[{name:"家用电器"},{name:"服装箱包"},{name:"运动户外"},{name:"手机数码"},{name:"汽车用品"},{name:"家具厨具"}]},series:[{name:"Budget vs spending",type:"radar",itemStyle:{borderRadius:6,color:function(a){return["#409EFF","#67C23A","#E6A23C","#F56C6C"][a.dataIndex]}},data:[{value:[400,400,400,400,400,400],name:"预定数量"},{value:[300,300,300,300,300,300],name:"下单数量"},{value:[200,200,200,200,200,200],name:"发货数量"}]}]}),i.value=t}return h(()=>{o()}),f(()=>{d()}),g(()=>{s()}),p(()=>{r(),y(()=>{c()})}),(t,a)=>(v(),x("div",{id:e.id,class:C(e.className),style:S({height:e.height,width:e.width})},null,14,b))}});export{z as default}; diff --git a/backend/src/main/resources/static/assets/RadarChart-e43ec971.js b/backend/src/main/resources/static/assets/RadarChart-e43ec971.js deleted file mode 100644 index 5f5722d..0000000 --- a/backend/src/main/resources/static/assets/RadarChart-e43ec971.js +++ /dev/null @@ -1 +0,0 @@ -import{r as l,i as m}from"./resize-24879ea2.js";import{d as u,K as h,ap as f,aq as g,k as p,a3 as y,o as v,c as x,V as C,q as S}from"./index-b25f0d08.js";const b=["id"],w=u({__name:"RadarChart",props:{id:{type:String,default:"radarChart"},className:{type:String,default:""},width:{type:String,default:"200px",required:!0},height:{type:String,default:"200px",required:!0}},setup(e){const n=e,{mounted:r,chart:i,beforeDestroy:o,activated:d,deactivated:s}=l();function c(){const t=m(document.getElementById(n.id));t.setOption({title:{show:!0,text:"订单状态统计",x:"center",padding:15,textStyle:{fontSize:18,fontStyle:"normal",fontWeight:"bold",color:"#337ecc"}},grid:{left:"2%",right:"2%",bottom:"10%",containLabel:!0},legend:{x:"center",y:"bottom",data:["预定数量","下单数量","发货数量"]},radar:{radius:"60%",indicator:[{name:"家用电器"},{name:"服装箱包"},{name:"运动户外"},{name:"手机数码"},{name:"汽车用品"},{name:"家具厨具"}]},series:[{name:"Budget vs spending",type:"radar",itemStyle:{borderRadius:6,color:function(a){return["#409EFF","#67C23A","#E6A23C","#F56C6C"][a.dataIndex]}},data:[{value:[400,400,400,400,400,400],name:"预定数量"},{value:[300,300,300,300,300,300],name:"下单数量"},{value:[200,200,200,200,200,200],name:"发货数量"}]}]}),i.value=t}return h(()=>{o()}),f(()=>{d()}),g(()=>{s()}),p(()=>{r(),y(()=>{c()})}),(t,a)=>(v(),x("div",{id:e.id,class:C(e.className),style:S({height:e.height,width:e.width})},null,14,b))}});export{w as default}; diff --git a/backend/src/main/resources/static/assets/editor-501cf061.css b/backend/src/main/resources/static/assets/editor-501cf061.css deleted file mode 100644 index 50ac020..0000000 --- a/backend/src/main/resources/static/assets/editor-501cf061.css +++ /dev/null @@ -1 +0,0 @@ -:root,:host{--w-e-textarea-bg-color: #fff;--w-e-textarea-color: #333;--w-e-textarea-border-color: #ccc;--w-e-textarea-slight-border-color: #e8e8e8;--w-e-textarea-slight-color: #d4d4d4;--w-e-textarea-slight-bg-color: #f5f2f0;--w-e-textarea-selected-border-color: #B4D5FF;--w-e-textarea-handler-bg-color: #4290f7;--w-e-toolbar-color: #595959;--w-e-toolbar-bg-color: #fff;--w-e-toolbar-active-color: #333;--w-e-toolbar-active-bg-color: #f1f1f1;--w-e-toolbar-disabled-color: #999;--w-e-toolbar-border-color: #e8e8e8;--w-e-modal-button-bg-color: #fafafa;--w-e-modal-button-border-color: #d9d9d9}.w-e-text-container *,.w-e-toolbar *{box-sizing:border-box;margin:0;outline:none;padding:0}.w-e-text-container blockquote,.w-e-text-container li,.w-e-text-container p,.w-e-text-container td,.w-e-text-container th,.w-e-toolbar *{line-height:1.5}.w-e-text-container{background-color:var(--w-e-textarea-bg-color);color:var(--w-e-textarea-color);height:100%;position:relative}.w-e-text-container .w-e-scroll{-webkit-overflow-scrolling:touch;height:100%}.w-e-text-container [data-slate-editor]{word-wrap:break-word;border-top:1px solid transparent;min-height:100%;outline:0;padding:0 10px;white-space:pre-wrap}.w-e-text-container [data-slate-editor] p{margin:15px 0}.w-e-text-container [data-slate-editor] h1,.w-e-text-container [data-slate-editor] h2,.w-e-text-container [data-slate-editor] h3,.w-e-text-container [data-slate-editor] h4,.w-e-text-container [data-slate-editor] h5{margin:20px 0}.w-e-text-container [data-slate-editor] img{cursor:default;display:inline!important;max-width:100%;min-height:20px;min-width:20px}.w-e-text-container [data-slate-editor] span{text-indent:0}.w-e-text-container [data-slate-editor] [data-selected=true]{box-shadow:0 0 0 2px var(--w-e-textarea-selected-border-color)}.w-e-text-placeholder{font-style:italic;left:10px;top:17px;width:90%}.w-e-max-length-info,.w-e-text-placeholder{color:var(--w-e-textarea-slight-color);pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.w-e-max-length-info{bottom:.5em;right:1em}.w-e-bar{background-color:var(--w-e-toolbar-bg-color);color:var(--w-e-toolbar-color);font-size:14px;padding:0 5px}.w-e-bar svg{fill:var(--w-e-toolbar-color);height:14px;width:14px}.w-e-bar-show{display:flex}.w-e-bar-hidden{display:none}.w-e-hover-bar{border:1px solid var(--w-e-toolbar-border-color);border-radius:3px;box-shadow:0 2px 5px #0000001f;position:absolute}.w-e-toolbar{flex-wrap:wrap;position:relative}.w-e-bar-divider{background-color:var(--w-e-toolbar-border-color);display:inline-flex;height:40px;margin:0 5px;width:1px}.w-e-bar-item{display:flex;height:40px;padding:4px;position:relative;text-align:center}.w-e-bar-item,.w-e-bar-item button{align-items:center;justify-content:center}.w-e-bar-item button{background:transparent;border:none;color:var(--w-e-toolbar-color);cursor:pointer;display:inline-flex;height:32px;overflow:hidden;padding:0 8px;white-space:nowrap}.w-e-bar-item button:hover{background-color:var(--w-e-toolbar-active-bg-color);color:var(--w-e-toolbar-active-color)}.w-e-bar-item button .title{margin-left:5px}.w-e-bar-item .active{background-color:var(--w-e-toolbar-active-bg-color);color:var(--w-e-toolbar-active-color)}.w-e-bar-item .disabled{color:var(--w-e-toolbar-disabled-color);cursor:not-allowed}.w-e-bar-item .disabled svg{fill:var(--w-e-toolbar-disabled-color)}.w-e-bar-item .disabled:hover{background-color:var(--w-e-toolbar-bg-color);color:var(--w-e-toolbar-disabled-color)}.w-e-bar-item .disabled:hover svg{fill:var(--w-e-toolbar-disabled-color)}.w-e-menu-tooltip-v5:before{background-color:var(--w-e-toolbar-active-color);border-radius:5px;color:var(--w-e-toolbar-bg-color);content:attr(data-tooltip);font-size:.75em;opacity:0;padding:5px 10px;position:absolute;text-align:center;top:40px;transition:opacity .6s;visibility:hidden;white-space:pre;z-index:1}.w-e-menu-tooltip-v5:after{border:5px solid transparent;border-bottom:5px solid var(--w-e-toolbar-active-color);content:"";opacity:0;position:absolute;top:30px;transition:opacity .6s;visibility:hidden}.w-e-menu-tooltip-v5:hover:after,.w-e-menu-tooltip-v5:hover:before{opacity:1;visibility:visible}.w-e-menu-tooltip-v5.tooltip-right:before{left:100%;top:10px}.w-e-menu-tooltip-v5.tooltip-right:after{border-bottom-color:transparent;border-left-color:transparent;border-right-color:var(--w-e-toolbar-active-color);border-top-color:transparent;left:100%;margin-left:-10px;top:16px}.w-e-bar-item-group .w-e-bar-item-menus-container{background-color:var(--w-e-toolbar-bg-color);border:1px solid var(--w-e-toolbar-border-color);border-radius:3px;box-shadow:0 2px 10px #0000001f;display:none;left:0;margin-top:40px;position:absolute;top:0;z-index:1}.w-e-bar-item-group:hover .w-e-bar-item-menus-container{display:block}.w-e-select-list{background-color:var(--w-e-toolbar-bg-color);border:1px solid var(--w-e-toolbar-border-color);border-radius:3px;box-shadow:0 2px 10px #0000001f;left:0;margin-top:40px;max-height:350px;min-width:100px;overflow-y:auto;position:absolute;top:0;z-index:1}.w-e-select-list ul{line-height:1;list-style:none}.w-e-select-list ul .selected{background-color:var(--w-e-toolbar-active-bg-color)}.w-e-select-list ul li{cursor:pointer;padding:7px 0 7px 25px;position:relative;text-align:left;white-space:nowrap}.w-e-select-list ul li:hover{background-color:var(--w-e-toolbar-active-bg-color)}.w-e-select-list ul li svg{left:0;margin-left:5px;margin-top:-7px;position:absolute;top:50%}.w-e-bar-bottom .w-e-select-list{bottom:0;margin-bottom:40px;margin-top:0;top:inherit}.w-e-drop-panel{background-color:var(--w-e-toolbar-bg-color);border:1px solid var(--w-e-toolbar-border-color);border-radius:3px;box-shadow:0 2px 10px #0000001f;margin-top:40px;min-width:200px;padding:10px;position:absolute;top:0;z-index:1}.w-e-bar-bottom .w-e-drop-panel{bottom:0;margin-bottom:40px;margin-top:0;top:inherit}.w-e-modal{background-color:var(--w-e-toolbar-bg-color);border:1px solid var(--w-e-toolbar-border-color);border-radius:3px;box-shadow:0 2px 10px #0000001f;color:var(--w-e-toolbar-color);font-size:14px;min-height:40px;min-width:100px;padding:20px 15px 0;position:absolute;text-align:left;z-index:1}.w-e-modal .btn-close{cursor:pointer;line-height:1;padding:5px;position:absolute;right:8px;top:7px}.w-e-modal .btn-close svg{fill:var(--w-e-toolbar-color);height:10px;width:10px}.w-e-modal .babel-container{display:block;margin-bottom:15px}.w-e-modal .babel-container span{display:block;margin-bottom:10px}.w-e-modal .button-container{margin-bottom:15px}.w-e-modal button{background-color:var(--w-e-modal-button-bg-color);border:1px solid var(--w-e-modal-button-border-color);border-radius:4px;color:var(--w-e-toolbar-color);cursor:pointer;font-weight:400;height:32px;padding:4.5px 15px;text-align:center;touch-action:manipulation;transition:all .3s cubic-bezier(.645,.045,.355,1);-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.w-e-modal input[type=number],.w-e-modal input[type=text],.w-e-modal textarea{font-feature-settings:"tnum";background-color:var(--w-e-toolbar-bg-color);border:1px solid var(--w-e-modal-button-border-color);border-radius:4px;color:var(--w-e-toolbar-color);font-variant:tabular-nums;padding:4.5px 11px;transition:all .3s;width:100%}.w-e-modal textarea{min-height:60px}body .w-e-modal,body .w-e-modal *{box-sizing:border-box}.w-e-progress-bar{background-color:var(--w-e-textarea-handler-bg-color);height:1px;position:absolute;transition:width .3s;width:0}.w-e-full-screen-container{bottom:0!important;display:flex!important;flex-direction:column!important;height:100%!important;left:0!important;margin:0!important;padding:0!important;position:fixed;right:0!important;top:0!important;width:100%!important}.w-e-full-screen-container [data-w-e-textarea=true]{flex:1!important}.w-e-text-container [data-slate-editor] code{background-color:var(--w-e-textarea-slight-bg-color);border-radius:3px;font-family:monospace;padding:3px}.w-e-panel-content-color{list-style:none;text-align:left;width:230px}.w-e-panel-content-color li{border:1px solid var(--w-e-toolbar-bg-color);border-radius:3px;cursor:pointer;display:inline-block;padding:2px}.w-e-panel-content-color li:hover{border-color:var(--w-e-toolbar-color)}.w-e-panel-content-color li .color-block{border:1px solid var(--w-e-toolbar-border-color);border-radius:3px;height:17px;width:17px}.w-e-panel-content-color .active{border-color:var(--w-e-toolbar-color)}.w-e-panel-content-color .clear{line-height:1.5;margin-bottom:5px;width:100%}.w-e-panel-content-color .clear svg{height:16px;margin-bottom:-4px;width:16px}.w-e-text-container [data-slate-editor] blockquote{background-color:var(--w-e-textarea-slight-bg-color);border-left:8px solid var(--w-e-textarea-selected-border-color);display:block;font-size:100%;line-height:1.5;margin:10px 0;padding:10px}.w-e-panel-content-emotion{font-size:20px;list-style:none;text-align:left;width:300px}.w-e-panel-content-emotion li{border-radius:3px;cursor:pointer;display:inline-block;padding:0 5px}.w-e-panel-content-emotion li:hover{background-color:var(--w-e-textarea-slight-bg-color)}.w-e-textarea-divider{border-radius:3px;margin:20px auto;padding:20px}.w-e-textarea-divider hr{background-color:var(--w-e-textarea-border-color);border:0;display:block;height:1px}.w-e-text-container [data-slate-editor] pre>code{background-color:var(--w-e-textarea-slight-bg-color);border:1px solid var(--w-e-textarea-slight-border-color);border-radius:4px;display:block;font-size:14px;padding:10px;text-indent:0}.w-e-text-container [data-slate-editor] .w-e-image-container{display:inline-block;margin:0 3px}.w-e-text-container [data-slate-editor] .w-e-image-container:hover{box-shadow:0 0 0 2px var(--w-e-textarea-selected-border-color)}.w-e-text-container [data-slate-editor] .w-e-selected-image-container{overflow:hidden;position:relative}.w-e-text-container [data-slate-editor] .w-e-selected-image-container .w-e-image-dragger{background-color:var(--w-e-textarea-handler-bg-color);height:7px;position:absolute;width:7px}.w-e-text-container [data-slate-editor] .w-e-selected-image-container .left-top{cursor:nwse-resize;left:0;top:0}.w-e-text-container [data-slate-editor] .w-e-selected-image-container .right-top{cursor:nesw-resize;right:0;top:0}.w-e-text-container [data-slate-editor] .w-e-selected-image-container .left-bottom{bottom:0;cursor:nesw-resize;left:0}.w-e-text-container [data-slate-editor] .w-e-selected-image-container .right-bottom{bottom:0;cursor:nwse-resize;right:0}.w-e-text-container [data-slate-editor] .w-e-selected-image-container:hover,.w-e-text-container [contenteditable=false] .w-e-image-container:hover{box-shadow:none}.w-e-text-container [data-slate-editor] .table-container{border:1px dashed var(--w-e-textarea-border-color);border-radius:5px;margin-top:10px;overflow-x:auto;padding:10px;width:100%}.w-e-text-container [data-slate-editor] table{border-collapse:collapse}.w-e-text-container [data-slate-editor] table td,.w-e-text-container [data-slate-editor] table th{border:1px solid var(--w-e-textarea-border-color);line-height:1.5;min-width:30px;padding:3px 5px;text-align:left}.w-e-text-container [data-slate-editor] table th{background-color:var(--w-e-textarea-slight-bg-color);font-weight:700;text-align:center}.w-e-panel-content-table{background-color:var(--w-e-toolbar-bg-color)}.w-e-panel-content-table table{border-collapse:collapse}.w-e-panel-content-table td{border:1px solid var(--w-e-toolbar-border-color);cursor:pointer;height:15px;padding:3px 5px;width:20px}.w-e-panel-content-table td.active{background-color:var(--w-e-toolbar-active-bg-color)}.w-e-textarea-video-container{background-image:linear-gradient(45deg,#eee 25%,transparent 0,transparent 75%,#eee 0,#eee),linear-gradient(45deg,#eee 25%,#fff 0,#fff 75%,#eee 0,#eee);background-position:0 0,10px 10px;background-size:20px 20px;border:1px dashed var(--w-e-textarea-border-color);border-radius:5px;margin:10px auto 0;padding:10px 0;text-align:center}.w-e-text-container [data-slate-editor] pre>code{word-wrap:normal;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;-webkit-hyphens:none;hyphens:none;line-height:1.5;margin:.5em 0;overflow:auto;padding:1em;-moz-tab-size:4;-o-tab-size:4;tab-size:4;text-align:left;text-shadow:0 1px #fff;white-space:pre;word-break:normal;word-spacing:normal}.w-e-text-container [data-slate-editor] pre>code .token.cdata,.w-e-text-container [data-slate-editor] pre>code .token.comment,.w-e-text-container [data-slate-editor] pre>code .token.doctype,.w-e-text-container [data-slate-editor] pre>code .token.prolog{color:#708090}.w-e-text-container [data-slate-editor] pre>code .token.punctuation{color:#999}.w-e-text-container [data-slate-editor] pre>code .token.namespace{opacity:.7}.w-e-text-container [data-slate-editor] pre>code .token.boolean,.w-e-text-container [data-slate-editor] pre>code .token.constant,.w-e-text-container [data-slate-editor] pre>code .token.deleted,.w-e-text-container [data-slate-editor] pre>code .token.number,.w-e-text-container [data-slate-editor] pre>code .token.property,.w-e-text-container [data-slate-editor] pre>code .token.symbol,.w-e-text-container [data-slate-editor] pre>code .token.tag{color:#905}.w-e-text-container [data-slate-editor] pre>code .token.attr-name,.w-e-text-container [data-slate-editor] pre>code .token.builtin,.w-e-text-container [data-slate-editor] pre>code .token.char,.w-e-text-container [data-slate-editor] pre>code .token.inserted,.w-e-text-container [data-slate-editor] pre>code .token.selector,.w-e-text-container [data-slate-editor] pre>code .token.string{color:#690}.w-e-text-container [data-slate-editor] pre>code .language-css .token.string,.w-e-text-container [data-slate-editor] pre>code .style .token.string,.w-e-text-container [data-slate-editor] pre>code .token.entity,.w-e-text-container [data-slate-editor] pre>code .token.operator,.w-e-text-container [data-slate-editor] pre>code .token.url{color:#9a6e3a}.w-e-text-container [data-slate-editor] pre>code .token.atrule,.w-e-text-container [data-slate-editor] pre>code .token.attr-value,.w-e-text-container [data-slate-editor] pre>code .token.keyword{color:#07a}.w-e-text-container [data-slate-editor] pre>code .token.class-name,.w-e-text-container [data-slate-editor] pre>code .token.function{color:#dd4a68}.w-e-text-container [data-slate-editor] pre>code .token.important,.w-e-text-container [data-slate-editor] pre>code .token.regex,.w-e-text-container [data-slate-editor] pre>code .token.variable{color:#e90}.w-e-text-container [data-slate-editor] pre>code .token.bold,.w-e-text-container [data-slate-editor] pre>code .token.important{font-weight:700}.w-e-text-container [data-slate-editor] pre>code .token.italic{font-style:italic}.w-e-text-container [data-slate-editor] pre>code .token.entity{cursor:help} diff --git a/backend/src/main/resources/static/assets/editor-b13c93a6.js b/backend/src/main/resources/static/assets/editor-b13c93a6.js deleted file mode 100644 index 65ea8e0..0000000 --- a/backend/src/main/resources/static/assets/editor-b13c93a6.js +++ /dev/null @@ -1,186 +0,0 @@ -import{d as N1,r as Eg,al as lP,k as u$,a2 as s$,o as I1,c as L1,a8 as l$,am as c$,a9 as cP,aa as fP,K as f$,g as Dg,a as $r,Q as d$,ad as yx,w as p$}from"./index-b25f0d08.js";import{u as h$}from"./index-5282e30f.js";var se=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function g$(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function us(t){var e={exports:{}};return t(e,e.exports),e.exports}var yi,$0,Fh=function(t){return t&&t.Math==Math&&t},kt=Fh(typeof globalThis=="object"&&globalThis)||Fh(typeof window=="object"&&window)||Fh(typeof self=="object"&&self)||Fh(typeof se=="object"&&se)||function(){return this}()||Function("return this")(),r5=Function.prototype,bx=r5.apply,v$=r5.bind,wx=r5.call,dP=typeof Reflect=="object"&&Reflect.apply||(v$?wx.bind(bx):function(){return wx.apply(bx,arguments)}),pP=Function.prototype,w4=pP.bind,E4=pP.call,m$=w4&&w4.bind(E4),ge=w4?function(t){return t&&m$(E4,t)}:function(t){return t&&function(){return E4.apply(t,arguments)}},sn=function(t){return typeof t=="function"},Gn=function(t){try{return!!t()}catch{return!0}},Hn=!Gn(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),kc=Function.prototype.call,zn=kc.bind?kc.bind(kc):function(){return kc.apply(kc,arguments)},Ex={}.propertyIsEnumerable,Dx=Object.getOwnPropertyDescriptor,y$=Dx&&!Ex.call({1:2},1)?function(t){var e=Dx(this,t);return!!e&&e.enumerable}:Ex,o5={f:y$},Xr=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},b$=ge({}.toString),w$=ge("".slice),Du=function(t){return w$(b$(t),8,-1)},qm=kt.Object,E$=ge("".split),hP=Gn(function(){return!qm("z").propertyIsEnumerable(0)})?function(t){return Du(t)=="String"?E$(t,""):qm(t)}:qm,D$=kt.TypeError,i5=function(t){if(t==null)throw D$("Can't call method on "+t);return t},jo=function(t){return hP(i5(t))},tr=function(t){return typeof t=="object"?t!==null:sn(t)},Qn={},Cx=function(t){return sn(t)?t:void 0},oc=function(t,e){return arguments.length<2?Cx(Qn[t])||Cx(kt[t]):Qn[t]&&Qn[t][e]||kt[t]&&kt[t][e]},Td=ge({}.isPrototypeOf),Km=oc("navigator","userAgent")||"",xx=kt.process,Sx=kt.Deno,Ax=xx&&xx.versions||Sx&&Sx.version,Ox=Ax&&Ax.v8;Ox&&($0=(yi=Ox.split("."))[0]>0&&yi[0]<4?1:+(yi[0]+yi[1])),!$0&&Km&&(!(yi=Km.match(/Edge\/(\d+)/))||yi[1]>=74)&&(yi=Km.match(/Chrome\/(\d+)/))&&($0=+yi[1]);var _h,Cg=$0,ho=!!Object.getOwnPropertySymbols&&!Gn(function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Cg&&Cg<41}),a5=ho&&!Symbol.sham&&typeof Symbol.iterator=="symbol",C$=kt.Object,hl=a5?function(t){return typeof t=="symbol"}:function(t){var e=oc("Symbol");return sn(e)&&Td(e.prototype,C$(t))},x$=kt.String,D4=function(t){try{return x$(t)}catch{return"Object"}},S$=kt.TypeError,u5=function(t){if(sn(t))return t;throw S$(D4(t)+" is not a function")},xg=function(t,e){var n=t[e];return n==null?void 0:u5(n)},A$=kt.TypeError,O$=Object.defineProperty,ea=kt["__core-js_shared__"]||function(t,e){try{O$(kt,t,{value:e,configurable:!0,writable:!0})}catch{kt[t]=e}return e}("__core-js_shared__",{}),ss=us(function(t){(t.exports=function(e,n){return ea[e]||(ea[e]=n!==void 0?n:{})})("versions",[]).push({version:"3.19.3",mode:"pure",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})}),k$=kt.Object,Fp=function(t){return k$(i5(t))},B$=ge({}.hasOwnProperty),Vt=Object.hasOwn||function(t,e){return B$(Fp(t),e)},F$=0,_$=Math.random(),T$=ge(1 .toString),Sg=function(t){return"Symbol("+(t===void 0?"":t)+")_"+T$(++F$+_$,36)},Bc=ss("wks"),Cu=kt.Symbol,kx=Cu&&Cu.for,P$=a5?Cu:Cu&&Cu.withoutSetter||Sg,Bn=function(t){if(!Vt(Bc,t)||!ho&&typeof Bc[t]!="string"){var e="Symbol."+t;ho&&Vt(Cu,t)?Bc[t]=Cu[t]:Bc[t]=a5&&kx?kx(e):P$(e)}return Bc[t]},j$=kt.TypeError,N$=Bn("toPrimitive"),I$=function(t,e){if(!tr(t)||hl(t))return t;var n,r=xg(t,N$);if(r){if(e===void 0&&(e="default"),n=zn(r,t,e),!tr(n)||hl(n))return n;throw j$("Can't convert object to primitive value")}return e===void 0&&(e="number"),function(o,i){var a,u;if(i==="string"&&sn(a=o.toString)&&!tr(u=zn(a,o))||sn(a=o.valueOf)&&!tr(u=zn(a,o))||i!=="string"&&sn(a=o.toString)&&!tr(u=zn(a,o)))return u;throw A$("Can't convert object to primitive value")}(t,e)},ic=function(t){var e=I$(t,"string");return hl(e)?e:e+""},C4=kt.document,L$=tr(C4)&&tr(C4.createElement),gP=function(t){return L$?C4.createElement(t):{}},vP=!Hn&&!Gn(function(){return Object.defineProperty(gP("div"),"a",{get:function(){return 7}}).a!=7}),Bx=Object.getOwnPropertyDescriptor,R$=Hn?Bx:function(t,e){if(t=jo(t),e=ic(e),vP)try{return Bx(t,e)}catch{}if(Vt(t,e))return Xr(!zn(o5.f,t,e),t[e])},R1={f:R$},M$=/#|\.prototype\./,_p=function(t,e){var n=$$[z$(t)];return n==V$||n!=H$&&(sn(e)?Gn(e):!!e)},z$=_p.normalize=function(t){return String(t).replace(M$,".").toLowerCase()},$$=_p.data={},H$=_p.NATIVE="N",V$=_p.POLYFILL="P",U$=_p,Fx=ge(ge.bind),s5=function(t,e){return u5(t),e===void 0?t:Fx?Fx(t,e):function(){return t.apply(e,arguments)}},W$=kt.String,G$=kt.TypeError,ar=function(t){if(tr(t))return t;throw G$(W$(t)+" is not an object")},q$=kt.TypeError,_x=Object.defineProperty,K$=Hn?_x:function(t,e,n){if(ar(t),e=ic(e),ar(n),vP)try{return _x(t,e,n)}catch{}if("get"in n||"set"in n)throw q$("Accessors not supported");return"value"in n&&(t[e]=n.value),t},Na={f:K$},Tn=Hn?function(t,e,n){return Na.f(t,e,Xr(1,n))}:function(t,e,n){return t[e]=n,t},Y$=R1.f,X$=function(t){var e=function(n,r,o){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,r)}return new t(n,r,o)}return dP(t,this,arguments)};return e.prototype=t.prototype,e},Ko=function(t,e){var n,r,o,i,a,u,s,l,c=t.target,f=t.global,p=t.stat,d=t.proto,v=f?kt:p?kt[c]:(kt[c]||{}).prototype,g=f?Qn:Qn[c]||Tn(Qn,c,{})[c],m=g.prototype;for(o in e)n=!U$(f?o:c+(p?".":"#")+o,t.forced)&&v&&Vt(v,o),a=g[o],n&&(u=t.noTargetGet?(l=Y$(v,o))&&l.value:v[o]),i=n&&u?u:e[o],n&&typeof a==typeof i||(s=t.bind&&n?s5(i,kt):t.wrap&&n?X$(i):d&&sn(i)?ge(i):i,(t.sham||i&&i.sham||a&&a.sham)&&Tn(s,"sham",!0),Tn(g,o,s),d&&(Vt(Qn,r=c+"Prototype")||Tn(Qn,r,{}),Tn(Qn[r],o,i),t.real&&m&&!m[o]&&Tn(m,o,i)))},Tx=ss("keys"),M1=function(t){return Tx[t]||(Tx[t]=Sg(t))},Z$=!Gn(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Px=M1("IE_PROTO"),x4=kt.Object,J$=x4.prototype,Ag=Z$?x4.getPrototypeOf:function(t){var e=Fp(t);if(Vt(e,Px))return e[Px];var n=e.constructor;return sn(n)&&e instanceof n?n.prototype:e instanceof x4?J$:null},Q$=kt.String,tH=kt.TypeError,Og=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=ge(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),e=n instanceof Array}catch{}return function(r,o){return ar(r),function(i){if(typeof i=="object"||sn(i))return i;throw tH("Can't set "+Q$(i)+" as a prototype")}(o),e?t(r,o):r.__proto__=o,r}}():void 0),eH=Math.ceil,nH=Math.floor,l5=function(t){var e=+t;return e!=e||e===0?0:(e>0?nH:eH)(e)},rH=Math.max,oH=Math.min,S4=function(t,e){var n=l5(t);return n<0?rH(n+e,0):oH(n,e)},iH=Math.min,Tp=function(t){return(e=t.length)>0?iH(l5(e),9007199254740991):0;var e},jx=function(t){return function(e,n,r){var o,i=jo(e),a=Tp(i),u=S4(r,a);if(t&&n!=n){for(;a>u;)if((o=i[u++])!=o)return!0}else for(;a>u;u++)if((t||u in i)&&i[u]===n)return t||u||0;return!t&&-1}},aH={includes:jx(!0),indexOf:jx(!1)},Pp={},uH=aH.indexOf,Nx=ge([].push),mP=function(t,e){var n,r=jo(t),o=0,i=[];for(n in r)!Vt(Pp,n)&&Vt(r,n)&&Nx(i,n);for(;e.length>o;)Vt(r,n=e[o++])&&(~uH(i,n)||Nx(i,n));return i},kg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],sH=kg.concat("length","prototype"),lH=Object.getOwnPropertyNames||function(t){return mP(t,sH)},c5={f:lH},H0={f:Object.getOwnPropertySymbols},cH=ge([].concat),fH=oc("Reflect","ownKeys")||function(t){var e=c5.f(ar(t)),n=H0.f;return n?cH(e,n(t)):e},f5=Object.keys||function(t){return mP(t,kg)},dH=Hn?Object.defineProperties:function(t,e){ar(t);for(var n,r=jo(e),o=f5(e),i=o.length,a=0;i>a;)Na.f(t,n=o[a++],r[n]);return t},pH=oc("document","documentElement"),yP=M1("IE_PROTO"),Ym=function(){},bP=function(t){return" - - - -
- - - diff --git a/backend/src/test/java/com/yfd/platform/PlatformApplicationTests.java b/backend/src/test/java/com/yfd/platform/PlatformApplicationTests.java deleted file mode 100644 index c04ccc4..0000000 --- a/backend/src/test/java/com/yfd/platform/PlatformApplicationTests.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.yfd.platform; - -import cn.hutool.jwt.JWTUtil; -import org.junit.jupiter.api.Test; - -import java.sql.Timestamp; -import java.text.DecimalFormat; -import java.util.HashMap; -import java.util.Map; - -class PlatformApplicationTests { - - @Test - void contextLoads() { - Timestamp timestamp = new Timestamp(System.currentTimeMillis()); - Timestamp timestamp1 = new Timestamp(System.currentTimeMillis()); - long time = timestamp.getTime(); - long time1 = timestamp1.getTime(); - System.out.println(time1 - time); - String path = System.getProperty("user.dir"); - System.out.println(path); - int max = 101; - DecimalFormat df = new DecimalFormat("0000"); - String code = df.format(max + 1); - int i = Integer.parseInt("0030"); - System.out.println(i); - } - - @Test - void myTest() throws InterruptedException { - Map map = new HashMap() { - private static final long serialVersionUID = 1L; - - { - put("userid", Integer.parseInt("123232323")); - put("expire_time", System.currentTimeMillis() + 5 * 1000); - } - }; - String token = JWTUtil.createToken(map, "1234".getBytes()); - System.out.println(token); - Thread.sleep(10 * 1000); - - //解析token - boolean isok = JWTUtil.verify(token, "1234".getBytes()); - String userid = ""; - - } - -} diff --git a/backend/src/test/java/com/yfd/platform/TestGuaVA.java b/backend/src/test/java/com/yfd/platform/TestGuaVA.java deleted file mode 100644 index 870023e..0000000 --- a/backend/src/test/java/com/yfd/platform/TestGuaVA.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.yfd.platform; - -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; - -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; - -public class TestGuaVA { - private Cache cache = CacheBuilder.newBuilder().maximumSize(2).expireAfterWrite(10, TimeUnit.MINUTES).build(); - - public Object getCache(K keyValue, final String ThreadName) { - Object value = null; - try { - System.out.println("ThreadName getCache==============" + ThreadName); - value = cache.get(keyValue, new Callable() { - @SuppressWarnings("unchecked") - public V call() { - System.out.println("ThreadName 执行业务数据并返回处理结果的数据(访问数据库等)==============" + ThreadName); - return (V) "dataValue"; - } - }); - } catch (ExecutionException e) { - e.printStackTrace(); - } - return value; - } - - public static void main(String[] args) { - final TestGuaVA TestGuaVA=new TestGuaVA(); - - - Thread t1=new Thread(new Runnable() { - @Override - public void run() { - System.out.println("T1======start========"); - Object value=TestGuaVA.getCache("key","T1"); - System.out.println("T1 value=============="+value); - System.out.println("T1======end========"); - - } - }); - - Thread t2=new Thread(new Runnable() { - @Override - public void run() { - System.out.println("T2======start========"); - Object value=TestGuaVA.getCache("key","T2"); - System.out.println("T2 value=============="+value); - System.out.println("T2======end========"); - - } - }); - - Thread t3=new Thread(new Runnable() { - @Override - public void run() { - System.out.println("T3======start========"); - Object value=TestGuaVA.getCache("key","T3"); - System.out.println("T3 value=============="+value); - System.out.println("T3======end========"); - - } - }); - - t1.start(); - t2.start(); - t3.start(); - } - -} -