wanghongzhi 3 weeks ago
parent
commit
7bed45d6fc
100 changed files with 1252 additions and 4346 deletions
  1. 3 17
      easydo-logging/src/main/java/easydo/technology/annotation/Log.java
  2. 8 5
      easydo-common/src/main/java/easydo/technology/annotation/TableKey.java
  3. 8 22
      easydo-common/src/main/java/easydo/technology/utils/ResultSetUtil.java
  4. 67 15
      easydo-core/src/main/java/easydo/technology/components/JdbcClient.java
  5. 0 0
      easydo-core/src/main/java/easydo/technology/exception/BizException.java
  6. 14 0
      easydo-core/src/main/java/easydo/technology/model/CommonModel.java
  7. 15 0
      easydo-core/src/main/java/easydo/technology/model/MinioFile.java
  8. 0 22
      easydo-logging/pom.xml
  9. 0 45
      easydo-logging/src/main/java/easydo/technology/annotation/type/LogActionType.java
  10. 0 65
      easydo-logging/src/main/java/easydo/technology/domain/Log.java
  11. 0 15
      easydo-logging/src/main/java/easydo/technology/mapper/LogMapper.java
  12. 0 106
      easydo-logging/src/main/java/easydo/technology/rest/LogController.java
  13. 0 94
      easydo-logging/src/main/java/easydo/technology/service/LogService.java
  14. 0 47
      easydo-logging/src/main/java/easydo/technology/service/dto/LogErrorDTO.java
  15. 0 40
      easydo-logging/src/main/java/easydo/technology/service/dto/LogQueryCriteria.java
  16. 0 31
      easydo-logging/src/main/java/easydo/technology/service/dto/LogQueryParam.java
  17. 0 41
      easydo-logging/src/main/java/easydo/technology/service/dto/LogSmallDTO.java
  18. 0 181
      easydo-logging/src/main/java/easydo/technology/service/impl/LogServiceImpl.java
  19. 103 0
      easydo-mes/src/main/java/easydo/technology/controller/MinioController.java
  20. 87 0
      easydo-mes/src/main/java/easydo/technology/controller/ProcessRouteController.java
  21. 90 0
      easydo-mes/src/main/java/easydo/technology/controller/ProcessStageController.java
  22. 20 110
      easydo-mes/src/main/java/easydo/technology/enums/MESEnum.java
  23. 0 5
      easydo-mes/src/main/java/easydo/technology/listener/OpsTaskListener.java
  24. 16 0
      easydo-mes/src/main/java/easydo/technology/model/FlowNo.java
  25. 24 0
      easydo-mes/src/main/java/easydo/technology/model/ProcessRoute.java
  26. 20 0
      easydo-mes/src/main/java/easydo/technology/model/ProcessRouteRef.java
  27. 26 0
      easydo-mes/src/main/java/easydo/technology/model/ProcessStage.java
  28. 63 0
      easydo-mes/src/main/java/easydo/technology/service/FlowNoService.java
  29. 0 786
      easydo-mes/src/main/java/easydo/technology/util/WeatherUtil.java
  30. 1 1
      easydo-mes/src/main/resources/config/application-owntest.yml
  31. 2 2
      easydo-mes/src/main/resources/config/application.yml
  32. 0 99
      easydo-system/src/main/java/easydo/technology/system/domain/Dept.java
  33. 0 35
      easydo-system/src/main/java/easydo/technology/system/domain/Dict.java
  34. 0 54
      easydo-system/src/main/java/easydo/technology/system/domain/DictDetail.java
  35. 0 38
      easydo-system/src/main/java/easydo/technology/system/domain/Job.java
  36. 0 76
      easydo-system/src/main/java/easydo/technology/system/domain/Menu.java
  37. 0 38
      easydo-system/src/main/java/easydo/technology/system/domain/Role.java
  38. 0 27
      easydo-system/src/main/java/easydo/technology/system/domain/RolesDepts.java
  39. 0 27
      easydo-system/src/main/java/easydo/technology/system/domain/RolesMenus.java
  40. 0 150
      easydo-system/src/main/java/easydo/technology/system/domain/SysDept.java
  41. 0 29
      easydo-system/src/main/java/easydo/technology/system/domain/SysRolesDepts.java
  42. 0 71
      easydo-system/src/main/java/easydo/technology/system/domain/User.java
  43. 0 27
      easydo-system/src/main/java/easydo/technology/system/domain/UsersJobs.java
  44. 0 27
      easydo-system/src/main/java/easydo/technology/system/domain/UsersRoles.java
  45. 0 36
      easydo-system/src/main/java/easydo/technology/system/domain/vo/MenuMetaVo.java
  46. 0 50
      easydo-system/src/main/java/easydo/technology/system/domain/vo/MenuVo.java
  47. 0 12
      easydo-system/src/main/java/easydo/technology/system/domain/vo/UserDto.java
  48. 0 31
      easydo-system/src/main/java/easydo/technology/system/domain/vo/UserPassVo.java
  49. 0 15
      easydo-system/src/main/java/easydo/technology/system/domain/vo/UserVo.java
  50. 0 97
      easydo-system/src/main/java/easydo/technology/system/dto/DeptDto.java
  51. 0 40
      easydo-system/src/main/java/easydo/technology/system/dto/DeptQueryParam.java
  52. 0 38
      easydo-system/src/main/java/easydo/technology/system/dto/DeptSmallDto.java
  53. 0 36
      easydo-system/src/main/java/easydo/technology/system/dto/DictDetailDto.java
  54. 0 26
      easydo-system/src/main/java/easydo/technology/system/dto/DictDetailQueryParam.java
  55. 0 24
      easydo-system/src/main/java/easydo/technology/system/dto/DictDto.java
  56. 0 23
      easydo-system/src/main/java/easydo/technology/system/dto/DictQueryParam.java
  57. 0 32
      easydo-system/src/main/java/easydo/technology/system/dto/DictSmallDto.java
  58. 0 50
      easydo-system/src/main/java/easydo/technology/system/dto/JobDto.java
  59. 0 33
      easydo-system/src/main/java/easydo/technology/system/dto/JobQueryParam.java
  60. 0 34
      easydo-system/src/main/java/easydo/technology/system/dto/JobSmallDto.java
  61. 0 80
      easydo-system/src/main/java/easydo/technology/system/dto/MenuDto.java
  62. 0 35
      easydo-system/src/main/java/easydo/technology/system/dto/MenuQueryParam.java
  63. 0 50
      easydo-system/src/main/java/easydo/technology/system/dto/RoleDto.java
  64. 0 34
      easydo-system/src/main/java/easydo/technology/system/dto/RoleQueryParam.java
  65. 0 36
      easydo-system/src/main/java/easydo/technology/system/dto/RoleSmallDto.java
  66. 0 18
      easydo-system/src/main/java/easydo/technology/system/dto/SysDeptDto.java
  67. 0 86
      easydo-system/src/main/java/easydo/technology/system/dto/UserDto.java
  68. 0 39
      easydo-system/src/main/java/easydo/technology/system/dto/UserQueryParam.java
  69. 0 31
      easydo-system/src/main/java/easydo/technology/system/mapper/DeptMapper.java
  70. 0 34
      easydo-system/src/main/java/easydo/technology/system/mapper/DictDetailMapper.java
  71. 0 15
      easydo-system/src/main/java/easydo/technology/system/mapper/DictMapper.java
  72. 0 51
      easydo-system/src/main/java/easydo/technology/system/mapper/MenuMapper.java
  73. 0 51
      easydo-system/src/main/java/easydo/technology/system/mapper/RoleMapper.java
  74. 0 14
      easydo-system/src/main/java/easydo/technology/system/mapper/RolesDeptsMapper.java
  75. 0 14
      easydo-system/src/main/java/easydo/technology/system/mapper/RolesMenusMapper.java
  76. 0 42
      easydo-system/src/main/java/easydo/technology/system/mapper/SysDeptMapper.java
  77. 0 106
      easydo-system/src/main/java/easydo/technology/system/mapper/UserMapper.java
  78. 0 14
      easydo-system/src/main/java/easydo/technology/system/mapper/UsersRolesMapper.java
  79. 26 0
      easydo-system/src/main/java/easydo/technology/system/model/SysDept.java
  80. 20 0
      easydo-system/src/main/java/easydo/technology/system/model/SysJob.java
  81. 34 0
      easydo-system/src/main/java/easydo/technology/system/model/SysMenu.java
  82. 22 0
      easydo-system/src/main/java/easydo/technology/system/model/SysRole.java
  83. 16 0
      easydo-system/src/main/java/easydo/technology/system/model/SysRolesMenus.java
  84. 40 0
      easydo-system/src/main/java/easydo/technology/system/model/SysUser.java
  85. 10 0
      easydo-system/src/main/java/easydo/technology/system/model/SysUsersJobs.java
  86. 10 0
      easydo-system/src/main/java/easydo/technology/system/model/SysUsersRoles.java
  87. 0 75
      easydo-system/src/main/java/easydo/technology/system/rest/DeptController.java
  88. 0 95
      easydo-system/src/main/java/easydo/technology/system/rest/DictController.java
  89. 0 100
      easydo-system/src/main/java/easydo/technology/system/rest/DictDetailController.java
  90. 0 142
      easydo-system/src/main/java/easydo/technology/system/rest/MenuController.java
  91. 0 139
      easydo-system/src/main/java/easydo/technology/system/rest/RoleController.java
  92. 65 0
      easydo-system/src/main/java/easydo/technology/system/rest/SysDeptController.java
  93. 0 22
      easydo-system/src/main/java/easydo/technology/system/rest/SysDictController.java
  94. 54 0
      easydo-system/src/main/java/easydo/technology/system/rest/SysJobController.java
  95. 100 0
      easydo-system/src/main/java/easydo/technology/system/rest/SysMenuController.java
  96. 53 0
      easydo-system/src/main/java/easydo/technology/system/rest/SysRoleController.java
  97. 55 0
      easydo-system/src/main/java/easydo/technology/system/rest/SysRolesMenusController.java
  98. 180 39
      easydo-system/src/main/java/easydo/technology/system/rest/SysUserController.java
  99. 0 59
      easydo-system/src/main/java/easydo/technology/system/rest/SysUsersRolesController.java
  100. 0 0
      easydo-system/src/main/java/easydo/technology/system/rest/UserController.java

+ 3 - 17
easydo-logging/src/main/java/easydo/technology/annotation/Log.java

@@ -20,23 +20,9 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
-import easydo.technology.annotation.type.LogActionType;
-
-/**
- * @author Zheng Jie
- * @date 2018-11-24
- */
-@Target(ElementType.METHOD)
+@Target(ElementType.TYPE)
 @Retention(RetentionPolicy.RUNTIME)
-public @interface Log {
+public @interface Minio {
     String value() default "";
-
-    /**
-     * 是否启用
-     *
-     * @return
-     */
-    boolean enable() default true;
-
-    LogActionType type() default LogActionType.SELECT;
 }
+

+ 8 - 5
easydo-common/src/main/java/easydo/technology/annotation/TableKey.java

@@ -15,14 +15,17 @@
  */
 package easydo.technology.annotation;
 
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
 
-@Target(ElementType.FIELD)
+import com.baomidou.mybatisplus.annotation.IdType;
+
+import java.lang.annotation.*;
+
 @Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD})
 public @interface TableKey {
 
+    String value() default "";
+
+    IdType type() default IdType.ASSIGN_UUID;
 }
 

+ 8 - 22
easydo-common/src/main/java/easydo/technology/utils/ResultSetUtil.java

@@ -233,7 +233,7 @@ public class ResultSetUtil {
                         int lastIndex = column.lastIndexOf(suffixNotIn);
                         column = column.substring(0, lastIndex)
                                 + column.substring(lastIndex + suffixNotIn.length());
-                        List<String> list = (List<String>) value;
+                        List<Object> list = (List<Object>) value;
                         stringBuilder.append("`").append(column).append("`");
                         stringBuilder.append(" not in (");
                         if (!list.isEmpty()) {
@@ -311,8 +311,6 @@ public class ResultSetUtil {
         map.remove("size");
         map.remove("orderBy");
         map.remove("groupBy");
-        map.remove("folders");
-        map.remove("serialVersionUID");
         return orderBySql.toString() + groupBySql.toString() + limitSql.toString();
     }
 
@@ -365,9 +363,6 @@ public class ResultSetUtil {
         stringBuffer.append(" where 1=1 ");
         Field[] declaredFields = obj.getClass().getDeclaredFields();
         for (Field field : declaredFields) {
-            if ("folders".equals(field.getName()) || "serialVersionUID".equals(field.getName())) {
-                continue;
-            }
             if (field.isAnnotationPresent(NotTableField.class)) {
                 continue;
             }
@@ -411,9 +406,6 @@ public class ResultSetUtil {
         stringBuffer.append(" where 1=1 ");
         Field[] declaredFields = obj.getClass().getDeclaredFields();
         for (Field field : declaredFields) {
-            if ("folders".equals(field.getName()) || "serialVersionUID".equals(field.getName())) {
-                continue;
-            }
             if (field.isAnnotationPresent(NotTableField.class)) {
                 continue;
             }
@@ -467,9 +459,6 @@ public class ResultSetUtil {
         Field[] declaredFields = obj.getClass().getDeclaredFields();
         for (Field field : declaredFields) {
             field.setAccessible(true);
-            if ("folders".equals(field.getName()) || "serialVersionUID".equals(field.getName())) {
-                continue;
-            }
             if (field.isAnnotationPresent(NotTableField.class)) {
                 continue;
             }
@@ -493,6 +482,9 @@ public class ResultSetUtil {
             }
             if ("id".equals(field.getName())) {
                 if (StringUtil.isEmpty(field.get(obj))) {
+                    if (field.isAnnotationPresent(TableId.class) && IdType.AUTO.equals(field.getAnnotation(TableId.class).type())) {
+                        continue;
+                    }
                     field.set(obj, UUID.randomUUID().toString());
                 }
             } else if ("createTime".equals(field.getName()) || "updateTime".equals(field.getName())) {
@@ -566,17 +558,11 @@ public class ResultSetUtil {
         Field[] declaredFields = obj.getClass().getDeclaredFields();
         for (Field field : declaredFields) {
             field.setAccessible(true);
-            if ("folders".equals(field.getName()) || "serialVersionUID".equals(field.getName())) {
-                continue;
-            }
-            if (field.isAnnotationPresent(NotTableField.class)) {
-                if ("emptyField".equals(field.getName()) && StringUtil.isNotEmpty(field.get(obj))) {
-                    String[] emptyFields = field.get(obj).toString().split(",");
-                    for (String fieldName : emptyFields) {
-                        stringBuffer.append("`").append(humpToLine(fieldName)).append("`").append("=null,");
-                    }
+            if ("emptyField".equals(field.getName()) && StringUtil.isNotEmpty(field.get(obj))) {
+                List<String> emptyFields = (List<String>) field.get(obj);
+                for (String fieldName : emptyFields) {
+                    stringBuffer.append("`").append(humpToLine(fieldName)).append("`").append("=null,");
                 }
-                continue;
             }
             if (field.isAnnotationPresent(TableField.class)) {
                 if (!field.getAnnotation(TableField.class).exist()) {

+ 67 - 15
easydo-core/src/main/java/easydo/technology/components/JdbcClient.java

@@ -1,11 +1,9 @@
 package easydo.technology.components;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
 import easydo.technology.AutoIncrementModel;
-import easydo.technology.annotation.NotTableField;
-import easydo.technology.annotation.TableKey;
+import easydo.technology.annotation.Minio;
+import easydo.technology.model.MinioFile;
+import easydo.technology.model.CommonModel;
 import easydo.technology.utils.MapUtil;
 import easydo.technology.utils.ResultSetUtil;
 import easydo.technology.utils.StringUtil;
@@ -20,7 +18,6 @@ import java.sql.Statement;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 //version_1.0 whz 20230725
 //version_2.0 whz 20230802 修复分页where条件ambiguous的问题
@@ -115,10 +112,8 @@ public class JdbcClient {
             resultSet = statement.executeQuery(sql);
             if (resultSet.next()) {
                 result.put("total", resultSet.getInt(1));
-                result.put("totalElements", resultSet.getInt(1));
             }
             result.put("records", resultList);
-            result.put("content", resultList);
             return result;
         } catch (Exception e) {
             e.printStackTrace();
@@ -164,10 +159,8 @@ public class JdbcClient {
             resultSet = statement.executeQuery(sql);
             if (resultSet.next()) {
                 result.put("total", resultSet.getInt(1));
-                result.put("totalElements", resultSet.getInt(1));
             }
             result.put("records", resultList);
-            result.put("content", resultList);
             return result;
         } catch (Exception e) {
             e.printStackTrace();
@@ -217,10 +210,8 @@ public class JdbcClient {
             resultSet = statement.executeQuery(sql);
             if (resultSet.next()) {
                 result.put("total", resultSet.getInt(1));
-                result.put("totalElements", resultSet.getInt(1));
             }
             result.put("records", resultList);
-            result.put("content", resultList);
             return result;
         } catch (Exception e) {
             e.printStackTrace();
@@ -272,10 +263,8 @@ public class JdbcClient {
             resultSet = statement.executeQuery(sql);
             if (resultSet.next()) {
                 result.put("total", resultSet.getInt(1));
-                result.put("totalElements", resultSet.getInt(1));
             }
             result.put("records", resultList);
-            result.put("content", resultList);
             return result;
         } catch (Exception e) {
             e.printStackTrace();
@@ -438,7 +427,7 @@ public class JdbcClient {
         }
     }
 
-    public <T> List<T> getJdbcListBySql(Map<String, Object> map,String sql, Class<T> clazz, Connection... connections) throws Exception {
+    public <T> List<T> getJdbcListBySql(Map<String, Object> map, String sql, Class<T> clazz, Connection... connections) throws Exception {
         String condition = ResultSetUtil.formatSelectSql(map, clazz);
         Connection connection = null;
         Statement statement = null;
@@ -644,6 +633,7 @@ public class JdbcClient {
                     }
                 }
             }
+            saveMinioFile(model, connection);
 
         } catch (Exception e) {
             e.printStackTrace();
@@ -705,6 +695,7 @@ public class JdbcClient {
             sql = ResultSetUtil.formatUpdateSql(model, whereMap);
             statement.executeUpdate(sql);
 
+            saveMinioFile(model, connection);
         } catch (Exception e) {
             e.printStackTrace();
             throw e;
@@ -738,6 +729,7 @@ public class JdbcClient {
             sql = ResultSetUtil.formatUpdateByIdSql(model);
             statement.executeUpdate(sql);
 
+            saveMinioFile(model, connection);
         } catch (Exception e) {
             e.printStackTrace();
             throw e;
@@ -800,6 +792,7 @@ public class JdbcClient {
             sql = ResultSetUtil.formatRemoveByIdSql(model);
             statement.executeUpdate(sql);
 
+            removeMinioFile(model, connection);
         } catch (Exception e) {
             e.printStackTrace();
             throw e;
@@ -853,6 +846,7 @@ public class JdbcClient {
             sql = ResultSetUtil.formatRemoveSql(model);
             statement.executeUpdate(sql);
 
+            removeMinioFile(model, connection);
         } catch (Exception e) {
             e.printStackTrace();
             throw e;
@@ -993,4 +987,62 @@ public class JdbcClient {
             }
         }
     }
+
+    private void saveMinioFile(Object model, Connection connection) throws Exception {
+        if (model instanceof CommonModel) {
+            Field idField = model.getClass().getDeclaredField("id");
+            idField.setAccessible(true);
+            String refId = idField.get(model).toString();
+
+            CommonModel minio = (CommonModel) model;
+            boolean isMinioAnnotation = model.getClass().isAnnotationPresent(Minio.class);
+            String refType = model.getClass().getAnnotation(Minio.class).value();
+            if (isMinioAnnotation && StringUtil.isNotEmpty(refType)) {
+                List<MinioFile> fileList = minio.getFileList();
+                if (null == fileList) {
+                    return;
+                }
+                for (MinioFile file : fileList) {
+                    file.setRefId(refId);
+                    file.setRefType(refType);
+                    jdbcInsert(file, connection);
+                }
+            }
+        }
+    }
+
+    private void removeMinioFile(Object model, Connection connection) throws Exception {
+        if (model instanceof CommonModel) {
+            Field idField = model.getClass().getDeclaredField("id");
+            idField.setAccessible(true);
+            String refId = idField.get(model).toString();
+
+            boolean isMinioAnnotation = model.getClass().isAnnotationPresent(Minio.class);
+            String refType = model.getClass().getAnnotation(Minio.class).value();
+            if (isMinioAnnotation && StringUtil.isNotEmpty(refType)) {
+                MinioFile minioFile = new MinioFile();
+                minioFile.setRefId(refId);
+                minioFile.setRefType(refType);
+                jdbcRemove(minioFile, connection);
+            }
+        }
+    }
+
+    public void getMinioFile(Object model, Connection connection) throws Exception {
+        if (model instanceof CommonModel) {
+            Field idField = model.getClass().getDeclaredField("id");
+            idField.setAccessible(true);
+            String refId = idField.get(model).toString();
+
+            boolean isMinioAnnotation = model.getClass().isAnnotationPresent(Minio.class);
+            String refType = model.getClass().getAnnotation(Minio.class).value();
+            if (isMinioAnnotation && StringUtil.isNotEmpty(refType)) {
+                MinioFile minioFile = new MinioFile();
+                minioFile.setRefId(refId);
+                minioFile.setRefType(refType);
+                List<MinioFile> fileList = getJdbcList(minioFile, connection);
+                ((CommonModel) model).setFileList(fileList);
+            }
+        }
+    }
 }

easydo-mes/src/main/java/easydo/technology/exception/BizException.java → easydo-core/src/main/java/easydo/technology/exception/BizException.java


+ 14 - 0
easydo-core/src/main/java/easydo/technology/model/CommonModel.java

@@ -0,0 +1,14 @@
+package easydo.technology.model;
+
+import easydo.technology.annotation.NotTableField;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class CommonModel {
+    private List<MinioFile> fileList = new ArrayList<>();
+
+    private List<String> emptyField = new ArrayList<>();
+}

+ 15 - 0
easydo-core/src/main/java/easydo/technology/model/MinioFile.java

@@ -0,0 +1,15 @@
+package easydo.technology.model;
+
+import lombok.Data;
+
+@Data
+public class MinioFile {
+    private String id;
+    private String refType;
+    private String refId;
+    private String path;
+    private String contentType;
+    private String fileType;
+    private String fileName;
+    private String createTime;
+}

+ 0 - 22
easydo-logging/pom.xml

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <groupId>easydo.technology</groupId>
-        <artifactId>easydo</artifactId>
-        <version>v20220507</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>easydo-logging</artifactId>
-    <name>日志模块</name>
-
-    <dependencies>
-        <dependency>
-            <groupId>easydo.technology</groupId>
-            <artifactId>easydo-common</artifactId>
-            <version>v20220507</version>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 45
easydo-logging/src/main/java/easydo/technology/annotation/type/LogActionType.java

@@ -1,45 +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 easydo.technology.annotation.type;
-
-/**
- * @author: liaojinlong
- * @date: 2020/6/11 19:47
- * @apiNote: 日志类型
- */
-
-public enum LogActionType {
-    /**
-     * 增删改查
-     */
-    ADD("新增"),
-    SELECT("查询"),
-    UPDATE("更新"),
-    DELETE("删除");
-    private String value;
-
-    LogActionType(String value) {
-        this.value = value;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-}

+ 0 - 65
easydo-logging/src/main/java/easydo/technology/domain/Log.java

@@ -1,65 +0,0 @@
-package easydo.technology.domain;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-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 org.springframework.beans.BeanUtils;
-
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-/**
- * @author jinjin
- * @date 2020-09-27
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@EqualsAndHashCode(callSuper = false)
-@TableName("sys_log")
-public class Log implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    @TableId(value = "log_id", type = IdType.AUTO)
-    private Long id;
-
-    private String description;
-
-    private String logType;
-
-    private String method;
-
-    private String params;
-
-    private String requestIp;
-
-    private Long time;
-
-    private String username;
-
-    private String address;
-
-    private String browser;
-
-    private byte[] exceptionDetail;
-
-    @TableField(fill = FieldFill.INSERT)
-    private Date createTime;
-
-    public Log(String logType, Long time) {
-        this.logType = logType;
-        this.time = time;
-    }
-
-    public void copyFrom(Log source) {
-        BeanUtils.copyProperties(source, this);
-    }
-}

+ 0 - 15
easydo-logging/src/main/java/easydo/technology/mapper/LogMapper.java

@@ -1,15 +0,0 @@
-package easydo.technology.mapper;
-
-import org.springframework.stereotype.Repository;
-
-import easydo.technology.base.CommonMapper;
-import easydo.technology.domain.Log;
-
-/**
- * @author jinjin
- * @date 2020-09-27
- */
-@Repository
-public interface LogMapper extends CommonMapper<Log> {
-
-}

+ 0 - 106
easydo-logging/src/main/java/easydo/technology/rest/LogController.java

@@ -1,106 +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 easydo.technology.rest;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.data.domain.Pageable;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import easydo.technology.annotation.Log;
-import easydo.technology.service.LogService;
-import easydo.technology.service.dto.LogQueryParam;
-import easydo.technology.utils.SecurityUtils;
-import lombok.RequiredArgsConstructor;
-
-/**
- * @author Zheng Jie
- * @date 2018-11-24
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/logs")
-public class LogController {
-
-    private final LogService logService;
-
-    @Log("导出数据")
-    @GetMapping(value = "/download")
-    @PreAuthorize("@el.check()")
-    public void download(HttpServletResponse response, LogQueryParam criteria) throws IOException {
-        criteria.setLogType("INFO");
-        logService.download(logService.queryAll(criteria), response);
-    }
-
-    @Log("导出错误数据")
-    @GetMapping(value = "/error/download")
-    @PreAuthorize("@el.check()")
-    public void downloadErrorLog(HttpServletResponse response, LogQueryParam criteria) throws IOException {
-        criteria.setLogType("ERROR");
-        logService.download(logService.queryAll(criteria), response);
-    }
-
-    @GetMapping
-    @PreAuthorize("@el.check()")
-    public ResponseEntity<Object> query(LogQueryParam criteria, Pageable pageable) {
-        criteria.setLogType("INFO");
-        return new ResponseEntity<>(logService.queryAll(criteria, pageable), HttpStatus.OK);
-    }
-
-    @GetMapping(value = "/user")
-    public ResponseEntity<Object> queryUserLog(LogQueryParam criteria, Pageable pageable) {
-        criteria.setLogType("INFO");
-        criteria.setBlurry(SecurityUtils.getCurrentUsername());
-        return new ResponseEntity<>(logService.queryAllByUser(criteria, pageable), HttpStatus.OK);
-    }
-
-    @GetMapping(value = "/error")
-    @PreAuthorize("@el.check()")
-    public ResponseEntity<Object> queryErrorLog(LogQueryParam criteria, Pageable pageable) {
-        criteria.setLogType("ERROR");
-        return new ResponseEntity<>(logService.queryAll(criteria, pageable), HttpStatus.OK);
-    }
-
-    @GetMapping(value = "/error/{id}")
-    public ResponseEntity<Object> queryErrorLogs(@PathVariable Long id) {
-        return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK);
-    }
-
-    @DeleteMapping(value = "/del/error")
-    @Log("删除所有ERROR日志")
-    @PreAuthorize("@el.check()")
-    public ResponseEntity<Object> delAllErrorLog() {
-        logService.delAllByError();
-        return new ResponseEntity<>(HttpStatus.OK);
-    }
-
-    @DeleteMapping(value = "/del/info")
-    @Log("删除所有INFO日志")
-    @PreAuthorize("@el.check()")
-    public ResponseEntity<Object> delAllInfoLog() {
-        logService.delAllByInfo();
-        return new ResponseEntity<>(HttpStatus.OK);
-    }
-}

+ 0 - 94
easydo-logging/src/main/java/easydo/technology/service/LogService.java

@@ -1,94 +0,0 @@
-package easydo.technology.service;
-
-import java.io.IOException;
-import java.util.List;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.springframework.data.domain.Pageable;
-import org.springframework.scheduling.annotation.Async;
-
-import easydo.technology.base.CommonService;
-import easydo.technology.base.PageInfo;
-import easydo.technology.domain.Log;
-import easydo.technology.service.dto.LogQueryParam;
-import easydo.technology.service.dto.LogSmallDTO;
-
-/**
- * @author jinjin
- * @date 2020-09-27
- */
-public interface LogService extends CommonService<Log> {
-
-    static final String CACHE_KEY = "log";
-
-    /**
-     * 查询数据分页
-     *
-     * @param query    条件
-     * @param pageable 分页参数
-     * @return PageInfo<Log>
-     */
-    Object queryAll(LogQueryParam query, Pageable pageable);
-
-    /**
-     * 查询所有数据不分页
-     *
-     * @param query 条件参数
-     * @return List<Log>
-     */
-    List<Log> queryAll(LogQueryParam query);
-
-    Log findById(Long id);
-
-    /**
-     * 查询用户日志
-     *
-     * @param criteria 查询条件
-     * @param pageable 分页参数
-     * @return -
-     */
-    PageInfo<LogSmallDTO> queryAllByUser(LogQueryParam criteria, Pageable pageable);
-
-    /**
-     * 保存日志数据
-     *
-     * @param username  用户
-     * @param browser   浏览器
-     * @param ip        请求IP
-     * @param joinPoint /
-     * @param log       日志实体
-     */
-    @Async
-    void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, Log log);
-
-    /**
-     * 查询异常详情
-     *
-     * @param id 日志ID
-     * @return Object
-     */
-    Object findByErrDetail(Long id);
-
-    /**
-     * 导出日志
-     *
-     * @param logs     待导出的数据
-     * @param response /
-     * @throws IOException /
-     */
-    void download(List<Log> logs, HttpServletResponse response) throws IOException;
-
-    boolean removeByLogType(String logType);
-
-    /**
-     * 删除所有错误日志
-     */
-    void delAllByError();
-
-    /**
-     * 删除所有INFO日志
-     */
-    void delAllByInfo();
-}

+ 0 - 47
easydo-logging/src/main/java/easydo/technology/service/dto/LogErrorDTO.java

@@ -1,47 +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 easydo.technology.service.dto;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import lombok.Data;
-
-/**
- * @author Zheng Jie
- * @date 2019-5-22
- */
-@Data
-public class LogErrorDTO implements Serializable {
-
-    private Long id;
-
-    private String username;
-
-    private String description;
-
-    private String method;
-
-    private String params;
-
-    private String browser;
-
-    private String requestIp;
-
-    private String address;
-
-    private Date createTime;
-}

+ 0 - 40
easydo-logging/src/main/java/easydo/technology/service/dto/LogQueryCriteria.java

@@ -1,40 +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 easydo.technology.service.dto;
-
-import java.sql.Timestamp;
-import java.util.List;
-
-import easydo.technology.annotation.Query;
-import lombok.Data;
-
-/**
- * 日志查询类
- * @author Zheng Jie
- * @date 2019-6-4 09:23:07
- */
-@Data
-public class LogQueryCriteria {
-
-    @Query(blurry = "username,description,address,requestIp,method,params")
-    private String blurry;
-
-    @Query
-    private String logType;
-
-    @Query(type = Query.Type.BETWEEN)
-    private List<Timestamp> createTime;
-}

+ 0 - 31
easydo-logging/src/main/java/easydo/technology/service/dto/LogQueryParam.java

@@ -1,31 +0,0 @@
-package easydo.technology.service.dto;
-
-import java.util.Date;
-import java.util.List;
-
-import org.springframework.format.annotation.DateTimeFormat;
-
-import easydo.technology.annotation.Query;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
-* @author jinjin
-* @date 2020-09-27
-*/
-@Getter
-@Setter
-public class LogQueryParam {
-
-    @Query(blurry = "username,description,address,requestIp,method,params")
-    private String blurry;
-
-    /** 精确 */
-    @Query
-    private String logType;
-
-    /** BETWEEN */
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-    @Query(type = Query.Type.BETWEEN)
-    private List<Date> createTime;
-}

+ 0 - 41
easydo-logging/src/main/java/easydo/technology/service/dto/LogSmallDTO.java

@@ -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 easydo.technology.service.dto;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import lombok.Data;
-
-/**
- * @author Zheng Jie
- * @date 2019-5-22
- */
-@Data
-public class LogSmallDTO implements Serializable {
-
-    private String description;
-
-    private String requestIp;
-
-    private Long time;
-
-    private String address;
-
-    private String browser;
-
-    private Date createTime;
-}

+ 0 - 181
easydo-logging/src/main/java/easydo/technology/service/impl/LogServiceImpl.java

@@ -1,181 +0,0 @@
-package easydo.technology.service.impl;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletResponse;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.reflect.MethodSignature;
-// 默认不使用缓存
-//import org.springframework.cache.annotation.CacheConfig;
-//import org.springframework.cache.annotation.CacheEvict;
-//import org.springframework.cache.annotation.Cacheable;
-import org.springframework.data.domain.Pageable;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import ch.qos.logback.core.util.FileUtil;
-import easydo.technology.base.PageInfo;
-import easydo.technology.base.QueryHelpMybatisPlus;
-import easydo.technology.base.impl.CommonServiceImpl;
-import easydo.technology.domain.Log;
-import easydo.technology.mapper.LogMapper;
-import easydo.technology.service.LogService;
-import easydo.technology.service.dto.LogErrorDTO;
-import easydo.technology.service.dto.LogQueryParam;
-import easydo.technology.service.dto.LogSmallDTO;
-import easydo.technology.utils.ConvertUtil;
-import easydo.technology.utils.PageUtil;
-import easydo.technology.utils.ValidationUtil;
-import io.netty.util.internal.ObjectUtil;
-import lombok.AllArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * @author jinjin
- * @date 2020-09-27
- */
-@Slf4j
-@Service
-@AllArgsConstructor
-// @CacheConfig(cacheNames = LogService.CACHE_KEY)
-@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
-public class LogServiceImpl extends CommonServiceImpl<Log> implements LogService {
-
-    // private final RedisUtils redisUtils;
-    private final LogMapper logMapper;
-
-    @Override
-    public Object queryAll(LogQueryParam query, Pageable pageable) {
-        IPage<Log> page = PageUtil.toMybatisPage(pageable);
-        IPage<Log> pageList = logMapper.selectPage(page, QueryHelpMybatisPlus.getPredicate(query));
-        String status = "ERROR";
-        if (status.equals(query.getLogType())) {
-            return ConvertUtil.convertPage(pageList, LogErrorDTO.class);
-        }
-        return ConvertUtil.convertPage(pageList, Log.class);
-    }
-
-    @Override
-    public List<Log> queryAll(LogQueryParam query) {
-        return logMapper.selectList(QueryHelpMybatisPlus.getPredicate(query));
-    }
-
-    @Override
-    public PageInfo<LogSmallDTO> queryAllByUser(LogQueryParam query, Pageable pageable) {
-        IPage<Log> page = PageUtil.toMybatisPage(pageable);
-        IPage<Log> pageList = logMapper.selectPage(page, QueryHelpMybatisPlus.getPredicate(query));
-        return ConvertUtil.convertPage(pageList, LogSmallDTO.class);
-    }
-
-    @Override
-    // @Cacheable(key = "'id:' + #p0")
-    public Log findById(Long id) {
-        return logMapper.selectById(id);
-    }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public boolean removeByLogType(String logType) {
-        UpdateWrapper<Log> wrapper = new UpdateWrapper<>();
-        wrapper.lambda().eq(Log::getLogType, logType);
-        return logMapper.delete(wrapper) > 0;
-    }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, Log log) {
-
-        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
-        Method method = signature.getMethod();
-        easydo.technology.annotation.Log aopLog = method.getAnnotation(easydo.technology.annotation.Log.class);
-
-        // 方法路径
-        String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
-
-        StringBuilder params = new StringBuilder("{");
-        // 参数值
-        List<Object> argValues = new ArrayList<>(Arrays.asList(joinPoint.getArgs()));
-        // 参数名称
-        for (Object argValue : argValues) {
-            params.append(argValue).append(" ");
-        }
-        // 描述
-        if (log != null) {
-            log.setDescription(aopLog.value());
-        }
-        assert log != null;
-        log.setRequestIp(ip);
-
-        String loginPath = "login";
-        if (loginPath.equals(signature.getName())) {
-            try {
-                username = JSONObject.parseObject(JSONObject.toJSONString(argValues.get(0))).getString("username");
-            } catch (Exception e) {
-                LogServiceImpl.log.error(e.getMessage(), e);
-            }
-        }
-        // log.setAddress(StringUtils.getCityInfo(log.getRequestIp()));
-        log.setMethod(methodName);
-        log.setUsername(username);
-        log.setParams(params.toString() + " }");
-        log.setBrowser(browser);
-        if (log.getId() == null) {
-            logMapper.insert(log);
-        } else {
-            logMapper.updateById(log);
-        }
-    }
-
-    @Override
-    public Object findByErrDetail(Long id) {
-        Log log = findById(id);
-        ValidationUtil.isNull(log.getId(), "Log", "id", id);
-        byte[] details = log.getExceptionDetail();
-        // return Dict.create().set("exception", new String(details != null ? details :
-        // "".getBytes()));
-        return new String(details != null ? details : "".getBytes());
-    }
-
-    @Override
-    public void download(List<Log> logs, HttpServletResponse response) throws IOException {
-        List<Map<String, Object>> list = new ArrayList<>();
-        for (Log log : logs) {
-            Map<String, Object> map = new LinkedHashMap<>();
-            map.put("用户名", log.getUsername());
-            map.put("IP", log.getRequestIp());
-            map.put("IP来源", log.getAddress());
-            map.put("描述", log.getDescription());
-            map.put("浏览器", log.getBrowser());
-            map.put("请求耗时/毫秒", log.getTime());
-            map.put("异常详情", new String(
-                    log.getExceptionDetail() != null ? log.getExceptionDetail() : "".getBytes()));
-            map.put("创建日期", log.getCreateTime());
-            list.add(map);
-        }
-        // FileUtil.downloadExcel(list, response);
-    }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public void delAllByError() {
-        this.removeByLogType("ERROR");
-    }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public void delAllByInfo() {
-        this.removeByLogType("INFO");
-    }
-}

+ 103 - 0
easydo-mes/src/main/java/easydo/technology/controller/MinioController.java

@@ -0,0 +1,103 @@
+package easydo.technology.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import easydo.technology.components.JdbcClient;
+import easydo.technology.exception.BizException;
+import easydo.technology.model.MinioFile;
+import easydo.technology.service.MinioService;
+import easydo.technology.utils.StringUtil;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+import javax.annotation.Resource;
+import javax.servlet.http.Part;
+import javax.sql.DataSource;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.util.Collection;
+import java.util.UUID;
+
+@RestController
+@RequestMapping("/file")
+public class MinioController {
+    @Resource
+    private MinioService minioService;
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+    @Value("${minio.bucket-name}")
+    String BUCKET_NAME;
+
+    @RequestMapping(value = "/upload")
+    public Object uploadAihazard(MultipartHttpServletRequest request) throws Exception {
+        InputStream inputStream = null;
+        ByteArrayOutputStream outputStream = null;
+        String path;
+        try {
+            Collection<Part> parts = request.getParts();
+
+            JSONObject res = new JSONObject();
+            JSONObject expands = new JSONObject();
+            if (parts.isEmpty()) {
+                throw new BizException("it is empty");
+            }
+            for (Part part : parts) {
+                inputStream = part.getInputStream();
+                outputStream = new ByteArrayOutputStream();
+
+                int len = -1;
+                byte[] buffer = new byte[1024];
+                while ((len = inputStream.read(buffer)) != -1)
+                    outputStream.write(buffer, 0, len);
+
+                String[] items = part.getSubmittedFileName().split("\\.");
+                String fileName = UUID.randomUUID().toString() + "." + items[items.length - 1];
+                InputStream is = new ByteArrayInputStream(outputStream.toByteArray());
+                path = minioService.uploadFile(BUCKET_NAME, is, fileName);
+                expands.put("file", path);
+                res.put("code", 200);
+                res.put("expands", expands);
+                res.put("message", "success");
+                break;
+            }
+            return new ResponseEntity<>(res, HttpStatus.OK);
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            if (null != outputStream) {
+                outputStream.close();
+            }
+            if (null != inputStream) {
+                inputStream.close();
+            }
+        }
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object remove(@RequestBody MinioFile file) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            if (StringUtil.isNotEmpty(file.getPath())) {
+                String buckName = file.getPath().substring(1).split("/")[0];
+                String objectName = file.getPath().substring(1 + buckName.length() + 1);
+                minioService.removeFile(buckName, objectName);
+            }
+            if (StringUtil.isNotEmpty(file.getId())) {
+                jdbcClient.jdbcRemoveById(file, connection);
+            }
+            return new ResponseEntity<>(file, HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            jdbcClient.finallyExecute(connection);
+        }
+    }
+}

+ 87 - 0
easydo-mes/src/main/java/easydo/technology/controller/ProcessRouteController.java

@@ -0,0 +1,87 @@
+package easydo.technology.controller;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.enums.MESEnum;
+import easydo.technology.exception.BizException;
+import easydo.technology.model.ProcessRoute;
+import easydo.technology.model.ProcessRouteRef;
+import easydo.technology.service.FlowNoService;
+import easydo.technology.utils.SecurityUtils;
+import easydo.technology.utils.StringUtil;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/processRoute")
+public class ProcessRouteController {
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+    @Resource
+    FlowNoService flowNoService;
+
+    @RequestMapping(value = "/getList")
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        List<ProcessRoute> list = jdbcClient.getJdbcList(map, ProcessRoute.class);
+        return new ResponseEntity<>(list, HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/getPage")
+    public Object getPage(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            Map<String, Object> recordsPage = jdbcClient.getJdbcPage(map, ProcessRoute.class, connection);
+            List<ProcessRoute> records = (List<ProcessRoute>) recordsPage.get("records");
+            for (ProcessRoute model : records) {
+                ProcessRouteRef routeRef = new ProcessRouteRef();
+                routeRef.setRouteId(model.getId());
+                List<ProcessRouteRef> routeRefList = jdbcClient.getJdbcList(routeRef, connection);
+                model.setRefList(routeRefList);
+
+                jdbcClient.getMinioFile(model, connection);
+            }
+            return new ResponseEntity<>(recordsPage, HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+
+    @RequestMapping(value = "/save")
+    public Object add(@RequestBody ProcessRoute model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            model.setCreateId(SecurityUtils.getCurrentUserId());
+            if (StringUtil.isEmpty(model.getCode())) {
+                model.setCode(flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_PROCESS_ROUTE.getValue(), connection));
+            }
+            jdbcClient.jdbcInsert(model, connection);
+
+            List<ProcessRouteRef> refList = model.getRefList();
+            for (ProcessRouteRef ref : refList) {
+                ref.setRouteId(model.getId());
+                jdbcClient.jdbcInsert(ref, connection);
+            }
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+}

+ 90 - 0
easydo-mes/src/main/java/easydo/technology/controller/ProcessStageController.java

@@ -0,0 +1,90 @@
+package easydo.technology.controller;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.enums.MESEnum;
+import easydo.technology.exception.BizException;
+import easydo.technology.model.ProcessStage;
+import easydo.technology.service.FlowNoService;
+import easydo.technology.utils.SecurityUtils;
+import easydo.technology.utils.StringUtil;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/processManage")
+public class ProcessStageController {
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+    @Resource
+    FlowNoService flowNoService;
+
+    @RequestMapping(value = "/getList")
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        List<ProcessStage> list = jdbcClient.getJdbcList(map, ProcessStage.class);
+        return new ResponseEntity<>(list, HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/getPage")
+    public Object getPage(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            Map<String, Object> recordsPage = jdbcClient.getJdbcPage(map, ProcessStage.class, connection);
+            List<ProcessStage> records = (List<ProcessStage>) recordsPage.get("records");
+            for (ProcessStage model : records) {
+                jdbcClient.getMinioFile(model, connection);
+            }
+            return new ResponseEntity<>(recordsPage, HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+
+    @RequestMapping(value = "/save")
+    public Object add(@RequestBody ProcessStage model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            model.setStatus(MESEnum.PROCESS_STAGE_OF_STATUS_ENABLE.getValue());
+            model.setCreateId(SecurityUtils.getCurrentUserId());
+            if (StringUtil.isEmpty(model.getCode())) {
+                model.setCode(flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_PROCESS_MANAGE.getValue(), connection));
+            }
+            jdbcClient.jdbcInsert(model, connection);
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody ProcessStage model) throws Exception {
+        jdbcClient.jdbcUpdateById(model);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object deleteProgram(@RequestBody ProcessStage model) throws Exception {
+        jdbcClient.jdbcRemoveById(model);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+}

+ 20 - 110
easydo-mes/src/main/java/easydo/technology/enums/MESEnum.java

@@ -4,116 +4,26 @@ import java.util.HashMap;
 import java.util.Map;
 
 public enum MESEnum {
-    //task_type
-    TASK_TYPE_CAR_RINSE("car_rinse", "渣土运输管理"),
-    TASK_TYPE_AIHAZARD_RECORD("aihazard", "AI视频危险源识别"),
-    TASK_TYPE_ENVDEV_RECORD("envdev", "环境监测"),
-    TASK_TYPE_SCC_RECORD("scc", "标养室监测"),
-    TASK_TYPE_AUTOSPRAY_RECORD("autospray", "自动喷淋系统"),
-    TASK_TYPE_TCM_RECORD("tcm", "塔机监测"),
-    TASK_TYPE_TCM_WARNING_RECORD("tcm_warning", "塔机监测--报警数据"),
-    TASK_TYPE_TCM_PERSON_RECORD("tcm_person", "塔机监测--考勤数据"),
-    TASK_TYPE_ELEVATOR_RECORD("elevator", "施工升降电梯监测"),
-    TASK_TYPE_ELEVATOR_WARNING_RECORD("elevator_warning", "施工升降电梯监测--报警数据"),
-    TASK_TYPE_ELEVATOR_PERSON_RECORD("elevator_person", "施工升降电梯监测--考勤数据"),
-    TASK_TYPE_BROADCAST_RECORD("broadcast", "智能广播"),
-    TASK_TYPE_SMOKEDET_RECORD("smokedet", "智能烟感/库房监测"),
-    TASK_TYPE_SMOKEDET_RECORD_STANDARD("smokedet_standard", "智能烟感"),
-    TASK_TYPE_SMOKEDET_RECORD_STOREHOUSE("smokedet_storehouse", "库房监测"),
-    TASK_TYPE_EDGEPROT_RECORD("edgeprot", "智能临边防护网监测"),
-    TASK_TYPE_EDGEPROT_WARNING_RECORD("edgeprot_warning", "智能临边防护网监测"),
-    TASK_TYPE_PARKING_RECORD("parking", "夜间施工监测"),
-
-    TASK_TYPE_IOT_PLATFORM("iot_platform", "智慧化工地管理平台"),
-    TASK_TYPE_SAFETY_RECORD("safety", "施工安全管理模块"),
-    TASK_TYPE_CAMERA_RECORD("camera", "视频监控"),
-    TASK_TYPE_FOUNDATION_PIT("foundation_pit", "基坑监测"),
-    TASK_TYPE_HOOK_VIEW("hook_view", "吊钩盲区可视化"),
-    TASK_TYPE_SAMPLE_DETECT("sample_detect", "检验检测管理"),
-    TASK_TYPE_RESIDENCE("residence", "智慧化分户验收"),
-    TASK_TYPE_OWNER_ACTIVITY("owner_activity", "业主开放活动智能化"),
-    TASK_TYPE_QUALITY("quality", "质量管理模块"),
-    TASK_TYPE_FACEREC_PERSON("facerec_person", "实名制系统(含工人工资支付)"),
-    TASK_TYPE_FACEREC_RECORD("facerec_record", "智能化考勤"),
-    TASK_TYPE_LASER_POSITION("laser_position", "塔机激光定位系统"),
-    TASK_TYPE_ILLEGAL_ENTRY("illegal_entry", "周界防护"),
-    TASK_TYPE_FULL_VIEW("full_view", "全景成像测距监控"),
-    TASK_TYPE_COMMAND_CENTER("command_center", "智慧工地指挥中心"),
-    TASK_TYPE_PLANNER_NODE("planner_node", "进度管理"),
-    TASK_TYPE_CONSTRUCT_MODEL("construct_model", "施工模型"),
-    TASK_TYPE_BIM_DESIGN("bim_design", "BIM深化设计"),
-    TASK_TYPE_BIM_DISCLOSURE("bim_disclosure", "BIM可视化技术交底"),
-    TASK_TYPE_BIM_SIMULATION("bim_simulation", "BIM施工工艺模拟"),
-    TASK_TYPE_BIM_DRAW("bim_draw", "BIM智慧化图纸管理"),
-
-    TASK_TYPE_CAR_RINSE_REMOVE("car_rinse_remove", "渣土运输管理-批量删除"),
-    TASK_TYPE_AIHAZARD_RECORD_REMOVE("aihazard_remove", "AI视频危险源识别-批量删除"),
-    TASK_TYPE_ENVDEV_RECORD_REMOVE("envdev_remove", "环境监测-批量删除"),
-    TASK_TYPE_SCC_RECORD_REMOVE("scc_remove", "标养室监测-批量删除"),
-    TASK_TYPE_AUTOSPRAY_RECORD_REMOVE("autospray_remove", "自动喷淋系统-批量删除"),
-    TASK_TYPE_TCM_RECORD_REMOVE("tcm_remove", "塔机监测-批量删除"),
-    TASK_TYPE_TCM_WARNING_RECORD_REMOVE("tcm_warning_remove", "塔机监测--报警数据-批量删除"),
-    TASK_TYPE_TCM_PERSON_RECORD_REMOVE("tcm_person_remove", "塔机监测--考勤数据-批量删除"),
-    TASK_TYPE_ELEVATOR_RECORD_REMOVE("elevator_remove", "施工升降电梯监测-批量删除"),
-    TASK_TYPE_ELEVATOR_WARNING_RECORD_REMOVE("elevator_warning_remove", "施工升降电梯监测--报警数据-批量删除"),
-    TASK_TYPE_ELEVATOR_PERSON_RECORD_REMOVE("elevator_person_remove", "施工升降电梯监测--考勤数据-批量删除"),
-    TASK_TYPE_BROADCAST_RECORD_REMOVE("broadcast_remove", "智能广播-批量删除"),
-    TASK_TYPE_SMOKEDET_RECORD_STANDARD_REMOVE("smokedet_standard_remove", "智能烟感-批量删除"),
-    TASK_TYPE_SMOKEDET_RECORD_STOREHOUSE_REMOVE("smokedet_storehouse_remove", "库房监测-批量删除"),
-    TASK_TYPE_EDGEPROT_RECORD_REMOVE("edgeprot_remove", "智能临边防护网监测-批量删除"),
-    TASK_TYPE_EDGEPROT_WARNING_RECORD_REMOVE("edgeprot_warning_remove", "智能临边防护网监测-批量删除"),
-    TASK_TYPE_PARKING_RECORD_REMOVE("parking_remove", "夜间施工监测-批量删除"),
-
-    TASK_TYPE_DATA_DIAGNOSE("data_diagnose", "数据诊断"),
-
-    MINIO_REF_TYPE_IOT_ACCEPTANCE_PROJECT("iot_acceptance_project","项目验收应用项"),
-
-    //task_status
-    TASK_STATUS_ACTIVE("active", "已激活"),
-    TASK_STATUS_INACTIVE("inactive", "未激活"),
-    TASK_STATUS_SUCCESS("success", "已成功"),
-    TASK_STATUS_CANCEL("cancel", "已取消"),
-    TASK_STATUS_FAIL("fail", "已失败"),
-
-    ACCEPTANCE_ITEMS_TYPE_BASIC("basic","基础项"),
-    ACCEPTANCE_ITEMS_TYPE_PROMOTION("promotion","推广项"),
-    ACCEPTANCE_ITEMS_TYPE_IMPROVE("improve","提升项"),
-
-    MESSAGE_SUCCESS("success","成功"),
-    MESSAGE_CANCEL_MANUAL("cancel_manual","手工取消"),
-    MESSAGE_CANCEL_SYSTEM("cancel_system","系统自动取消"),
-    MESSAGE_UNKNOWN("unknown", "未知错误"),
-    MESSAGE_TIME_ERROR("time_error", "数据模拟的起止时间超出项目验收项的起止时间"),
-    MESSAGE_DATA_LACK_ACCEPT("data_lack_accept", "请到-基础数据管理-验收清单项-进行维护"),
-    MESSAGE_DATA_LACK_PROJECT_ACCEPT("data_lack_project_accept", "请到-基础数据管理-项目管理-进行维护项目验收项"),
-    MESSAGE_DATA_LACK_PROJECT_ACCEPT_TIME("data_lack_project_accept_time", "请到-基础数据管理-项目管理-进行维护项目验收项的起止时间"),
-    MESSAGE_DATA_UNMOUNTED_DEVICE("data_unmounted_device", "缺失设备信息,请到安装点处绑定相应的设备"),
-    MESSAGE_DATA_COPY_COVER_SAME_MOUNTED("data_copy_cover_same_mounted", "安装点X,无法实现覆盖安装点X的数据"),
-    MESSAGE_DATA_NO_PERSON_ID_CARD("data_no_person_id_card", "没有检索到人员信息,请检查后重试"),
-    MESSAGE_DATA_NO_DRIVER("data_no_driver", "该安装点没有配置司机信息"),
-    MESSAGE_DATA_NO_SENSOR("data_no_sensor", "该安装点没有配置传感器信息"),
-    MESSAGE_DATA_NO_RECORD_FOR_WARNING("data_no_sensor_for_warning", "该安装点没有数据信息,无法模拟报警数据"),
-    MESSAGE_DATA_OVER_SOURCE_DATA("data_over_source_data", "迁移总数超出数据源总数,请检查后重试"),
-
-    EXECUTE_TYPE_INSERT("i","新增"),
-    EXECUTE_TYPE_DELETE("d","删除"),
-
-    DATA_SOURCE_INIT("0", "数据库中历史存在的数据"),
-    DATA_SOURCE_TRUE("1", "iot中复制过来的"),
-    DATA_SOURCE_MAKE("2", "造数规则造的假数据"),
-
-    PLAN_NODE_STATUS_ACTIVE("active", "进行中"),
-    PLAN_NODE_STATUS_INACTIVE("inactive", "待进行"),
-    PLAN_NODE_STATUS_DONE("done", "已完成"),
-
-    BLANK_TYPE_VALUE("-","空值"),
-
-    PLAN_BIND_TYPE_1("1", "申报资料"),
-
-    //platform_type
-    PLATFORM_TYPE_QINGDAO_MSP("qingdao_msp", "青岛市智慧工地监管平台"),
-    PLATFORM_TYPE_LAOSHAN_MSP("laoshan_msp", "崂山区智慧工地监管平台"),
-    PLATFORM_TYPE_SHIZHENG_MSP("shizheng_msp", "青岛市市政智慧工地监管平台"),
+
+    FLOW_NO_TYPE_PROCESS_MANAGE("process_manage", "工序管理"),
+    FLOW_NO_TYPE_PROCESS_ROUTE("process_route", "工艺路线"),
+
+    PROCESS_STAGE_OF_CATEGORY_PREPARATION("preparation","准备工序"),
+    PROCESS_STAGE_OF_CATEGORY_PROCESSING("processing","加工工序"),
+    PROCESS_STAGE_OF_CATEGORY_INSPECTION("inspection","检验工序"),
+    PROCESS_STAGE_OF_CATEGORY_AUXILIARY("auxiliary","辅助工序"),
+
+    PROCESS_STAGE_OF_PROCESS_TYPE_SELF_MADE("self_made","自制"),
+    PROCESS_STAGE_OF_PROCESS_TYPE_OUTSOURCING("outsourcing","委外"),
+
+    PROCESS_STAGE_OF_CALCULATE_METHOD_BOTH_RATES("both_rates","计件+计时都支持"),
+    PROCESS_STAGE_OF_CALCULATE_METHOD_PIECE_RATE("piece_rate","计件"),
+    PROCESS_STAGE_OF_CALCULATE_METHOD_TIME_RATE("time_rate","计时"),
+    PROCESS_STAGE_OF_CALCULATE_METHOD_NON_PROD_PAY("non_prod_pay","不计生产工资"),
+
+    PROCESS_STAGE_OF_STATUS_ENABLE("enable","启用"),
+    PROCESS_STAGE_OF_STATUS_DISABLE("disable","停用"),
+
     ;
 
     MESEnum(String value, String comment) {

+ 0 - 5
easydo-mes/src/main/java/easydo/technology/listener/OpsTaskListener.java

@@ -24,17 +24,12 @@ public class OpsTaskListener {
     @EventListener(ApplicationReadyEvent.class)
     public void onApplicationReady() throws Exception {
         System.out.println(">>>>>> 应用已完全就绪!执行任务初始化");
-        Connection connection = dataSource.getConnection();
-        List<String> statusList = new ArrayList<>();
-        statusList.add(MESEnum.TASK_STATUS_ACTIVE.getValue());
-        statusList.add(MESEnum.TASK_STATUS_INACTIVE.getValue());
         try {
 
             System.out.println(">>>>>> 执行任务初始化完成");
         } catch (Exception e) {
             throw e;
         } finally {
-            connection.close();
         }
 
     }

+ 16 - 0
easydo-mes/src/main/java/easydo/technology/model/FlowNo.java

@@ -0,0 +1,16 @@
+package easydo.technology.model;
+
+import lombok.Data;
+
+@Data
+public class FlowNo {
+    private String type;
+
+    private String prefix;
+
+    private String currDate;
+
+    private String currNo;
+
+    private Integer currSeq;
+}

+ 24 - 0
easydo-mes/src/main/java/easydo/technology/model/ProcessRoute.java

@@ -0,0 +1,24 @@
+package easydo.technology.model;
+
+import easydo.technology.annotation.Minio;
+import easydo.technology.annotation.NotTableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+@Data
+@Minio("processRoute")
+@EqualsAndHashCode(callSuper = true)
+public class ProcessRoute extends CommonModel {
+    private String id;
+    private String name;
+    private String code;
+    private String timeUnit;
+    private String createTime;
+    private Long createId;
+    private String remark;
+
+    @NotTableField
+    private List<ProcessRouteRef> refList;
+}

+ 20 - 0
easydo-mes/src/main/java/easydo/technology/model/ProcessRouteRef.java

@@ -0,0 +1,20 @@
+package easydo.technology.model;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ProcessRouteRef {
+    private String id;
+    private String routeId;
+    private String stageId;
+    private Integer orderNum;
+    private BigDecimal readyTimeHour;
+    private Integer processNum;
+    private BigDecimal processTimeHour;
+    private Integer moveNum;
+    private BigDecimal moveTimeHour;
+    private String remark;
+
+}

+ 26 - 0
easydo-mes/src/main/java/easydo/technology/model/ProcessStage.java

@@ -0,0 +1,26 @@
+package easydo.technology.model;
+
+import easydo.technology.annotation.Minio;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+@Data
+@Minio("processManage")
+public class ProcessStage extends CommonModel {
+    private String id;
+    private String name;
+    private String code;
+    private String directorName;
+    private String directorPhone;
+    private String processType;
+    private String category;
+    private String calculateMethod;
+    private String version;
+    private String remark;
+    private String createTime;
+    private Long createId;
+    private String status;
+}
+
+

+ 63 - 0
easydo-mes/src/main/java/easydo/technology/service/FlowNoService.java

@@ -0,0 +1,63 @@
+package easydo.technology.service;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.exception.BizException;
+import easydo.technology.model.FlowNo;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class FlowNoService {
+    private static final DateTimeFormatter DFY_MD = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+    private static final DateTimeFormatter DFY_MD_2 = DateTimeFormatter.ofPattern("yyyyMMdd");
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+
+    public String getFlowNo(String type, Connection... connections) throws Exception {
+        Connection connection = null;
+        if (connections.length > 0) {
+            connection = connections[0];
+        } else {
+            connection = dataSource.getConnection();
+        }
+        try {
+            FlowNo flowNo = new FlowNo();
+            flowNo.setType(type);
+            flowNo = jdbcClient.getJdbcModel(flowNo, connection);
+
+            String currDate = DFY_MD.format(LocalDateTime.now());
+            String currDate2 = DFY_MD_2.format(LocalDateTime.now());
+
+            if (flowNo.getCurrDate() == null || !flowNo.getCurrDate().equals(currDate)) {
+                flowNo.setCurrDate(currDate);
+                flowNo.setCurrSeq(1);
+            } else {
+                flowNo.setCurrSeq(flowNo.getCurrSeq() + 1);
+            }
+            String currSeq = String.format("%05d", flowNo.getCurrSeq());
+            String no = flowNo.getPrefix() + currDate2 + currSeq;
+            flowNo.setCurrNo(no);
+
+            Map<String, Object> paramMap = new HashMap<>();
+            paramMap.put("type", type);
+            jdbcClient.jdbcUpdate(flowNo, paramMap, connection);
+            return no;
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            if (connections.length == 0) {
+                connection.close();
+            }
+        }
+
+    }
+}

+ 0 - 786
easydo-mes/src/main/java/easydo/technology/util/WeatherUtil.java

@@ -1,786 +0,0 @@
-package easydo.technology.util;
-
-import easydo.technology.model.WeatherData;
-
-import java.time.LocalDateTime;
-import java.util.*;
-import java.util.stream.Collectors;
-
-public class WeatherUtil {
-
-    // 天气状态定义
-    public enum WeatherState {
-        SUNNY, CLOUDY, RAINY, STORMY, FOGGY
-    }
-
-    // 季节定义
-    public enum Season {
-        WINTER, SPRING, SUMMER, AUTUMN
-    }
-
-    // 风向定义(16方位)
-    public enum WindDirection {
-        N, NNE, NE, ENE, E, ESE, SE, SSE,
-        S, SSW, SW, WSW, W, WNW, NW, NNW,
-        OTHER
-    }
-
-
-    // 模拟参数常量
-    private static final int TIME_INTERVAL_MINUTES = 3;
-
-    // 污染物类型
-    private enum PollutantType {
-        PM2_5, PM10, PM100, NOISE
-    }
-
-    // 马尔可夫链状态转移概率矩阵(按季节调整)
-    private static final Map<Season, double[][]> TRANSITION_MATRICES;
-
-    static {
-        Map<Season, double[][]> tempMap = new EnumMap<>(Season.class);
-        tempMap.put(Season.WINTER, new double[][]{
-                {0.70, 0.20, 0.08, 0.00, 0.02},  // SUNNY
-                {0.25, 0.55, 0.15, 0.00, 0.05},  // CLOUDY
-                {0.10, 0.30, 0.55, 0.00, 0.05},  // RAINY
-                {0.00, 0.00, 0.00, 0.00, 0.00},  // STORMY (冬季无雷暴)
-                {0.15, 0.25, 0.10, 0.00, 0.50}   // FOGGY
-        });
-        tempMap.put(Season.SPRING, new double[][]{
-                {0.65, 0.25, 0.07, 0.01, 0.02},
-                {0.30, 0.50, 0.15, 0.03, 0.02},
-                {0.15, 0.35, 0.45, 0.03, 0.02},
-                {0.05, 0.15, 0.30, 0.45, 0.05},
-                {0.20, 0.30, 0.10, 0.00, 0.40}
-        });
-        tempMap.put(Season.SUMMER, new double[][]{
-                {0.60, 0.30, 0.05, 0.05, 0.00},
-                {0.35, 0.45, 0.10, 0.08, 0.02},
-                {0.20, 0.40, 0.30, 0.08, 0.02},
-                {0.10, 0.20, 0.20, 0.45, 0.05},
-                {0.25, 0.35, 0.05, 0.00, 0.35}
-        });
-        tempMap.put(Season.AUTUMN, new double[][]{
-                {0.55, 0.30, 0.10, 0.03, 0.02},
-                {0.25, 0.50, 0.20, 0.03, 0.02},
-                {0.10, 0.30, 0.55, 0.03, 0.02},
-                {0.05, 0.15, 0.30, 0.45, 0.05},
-                {0.15, 0.25, 0.10, 0.00, 0.50}
-        });
-        TRANSITION_MATRICES = Collections.unmodifiableMap(tempMap);
-    }
-
-    // 基础温度范围(摄氏度,按季节和天气状态)
-    private static final Map<Season, Map<WeatherState, int[]>> BASE_TEMPERATURES;
-
-    static {
-        Map<Season, Map<WeatherState, int[]>> tempMap = new EnumMap<>(Season.class);
-
-        Map<WeatherState, int[]> winterTemps = new EnumMap<>(WeatherState.class);
-        winterTemps.put(WeatherState.SUNNY, new int[]{-5, 5});
-        winterTemps.put(WeatherState.CLOUDY, new int[]{-8, 2});
-        winterTemps.put(WeatherState.RAINY, new int[]{-3, 3});
-        winterTemps.put(WeatherState.STORMY, new int[]{-5, 0});
-        winterTemps.put(WeatherState.FOGGY, new int[]{-10, 0});
-        tempMap.put(Season.WINTER, Collections.unmodifiableMap(winterTemps));
-
-        Map<WeatherState, int[]> springTemps = new EnumMap<>(WeatherState.class);
-        springTemps.put(WeatherState.SUNNY, new int[]{8, 18});
-        springTemps.put(WeatherState.CLOUDY, new int[]{5, 15});
-        springTemps.put(WeatherState.RAINY, new int[]{6, 12});
-        springTemps.put(WeatherState.STORMY, new int[]{10, 16});
-        springTemps.put(WeatherState.FOGGY, new int[]{3, 10});
-        tempMap.put(Season.SPRING, Collections.unmodifiableMap(springTemps));
-
-        Map<WeatherState, int[]> summerTemps = new EnumMap<>(WeatherState.class);
-        summerTemps.put(WeatherState.SUNNY, new int[]{20, 32});
-        summerTemps.put(WeatherState.CLOUDY, new int[]{18, 28});
-        summerTemps.put(WeatherState.RAINY, new int[]{16, 24});
-        summerTemps.put(WeatherState.STORMY, new int[]{22, 28});
-        summerTemps.put(WeatherState.FOGGY, new int[]{15, 22});
-        tempMap.put(Season.SUMMER, Collections.unmodifiableMap(summerTemps));
-
-        Map<WeatherState, int[]> autumnTemps = new EnumMap<>(WeatherState.class);
-        autumnTemps.put(WeatherState.SUNNY, new int[]{15, 25});
-        autumnTemps.put(WeatherState.CLOUDY, new int[]{13, 22});
-        autumnTemps.put(WeatherState.RAINY, new int[]{10, 20});
-        autumnTemps.put(WeatherState.STORMY, new int[]{13, 24});
-        autumnTemps.put(WeatherState.FOGGY, new int[]{10, 18});
-        tempMap.put(Season.AUTUMN, Collections.unmodifiableMap(autumnTemps));
-
-        BASE_TEMPERATURES = Collections.unmodifiableMap(tempMap);
-    }
-
-    // 基础湿度范围(百分比,按天气状态)
-    private static final Map<WeatherState, int[]> BASE_HUMIDITIES;
-
-    static {
-        Map<WeatherState, int[]> tempMap = new EnumMap<>(WeatherState.class);
-        tempMap.put(WeatherState.SUNNY, new int[]{30, 60});
-        tempMap.put(WeatherState.CLOUDY, new int[]{50, 80});
-        tempMap.put(WeatherState.RAINY, new int[]{75, 90});
-        tempMap.put(WeatherState.STORMY, new int[]{70, 88});
-        tempMap.put(WeatherState.FOGGY, new int[]{70, 85});
-        BASE_HUMIDITIES = Collections.unmodifiableMap(tempMap);
-    }
-
-    // 新增:基础污染物范围(按天气状态和季节)
-    private static final Map<Season, Map<WeatherState, Map<PollutantType, int[]>>> BASE_POLLUTANTS;
-
-    static {
-        Map<Season, Map<WeatherState, Map<PollutantType, int[]>>> tempMap = new EnumMap<>(Season.class);
-
-        // 冬季污染物范围
-        Map<WeatherState, Map<PollutantType, int[]>> winterPollutants = new EnumMap<>(WeatherState.class);
-        winterPollutants.put(WeatherState.SUNNY, createPollutantMap(25, 75, 30, 80, 40, 90, 45, 65));
-        winterPollutants.put(WeatherState.CLOUDY, createPollutantMap(20, 60, 25, 70, 35, 90, 40, 60));
-        winterPollutants.put(WeatherState.RAINY, createPollutantMap(5, 20, 10, 30, 20, 50, 35, 55));
-        winterPollutants.put(WeatherState.STORMY, createPollutantMap(10, 30, 15, 40, 25, 60, 50, 70));
-        winterPollutants.put(WeatherState.FOGGY, createPollutantMap(70, 90, 80, 100, 90, 120, 40, 60));
-        tempMap.put(Season.WINTER, Collections.unmodifiableMap(winterPollutants));
-
-        // 春季污染物范围
-        Map<WeatherState, Map<PollutantType, int[]>> springPollutants = new EnumMap<>(WeatherState.class);
-        springPollutants.put(WeatherState.SUNNY, createPollutantMap(15, 40, 20, 50, 30, 70, 50, 70));
-        springPollutants.put(WeatherState.CLOUDY, createPollutantMap(20, 50, 25, 60, 35, 80, 45, 65));
-        springPollutants.put(WeatherState.RAINY, createPollutantMap(5, 25, 10, 35, 20, 60, 40, 60));
-        springPollutants.put(WeatherState.STORMY, createPollutantMap(10, 35, 15, 45, 25, 70, 55, 75));
-        springPollutants.put(WeatherState.FOGGY, createPollutantMap(40, 80, 60, 100, 80, 110, 45, 65));
-        tempMap.put(Season.SPRING, Collections.unmodifiableMap(springPollutants));
-
-        // 夏季污染物范围
-        Map<WeatherState, Map<PollutantType, int[]>> summerPollutants = new EnumMap<>(WeatherState.class);
-        summerPollutants.put(WeatherState.SUNNY, createPollutantMap(10, 30, 15, 40, 25, 60, 55, 75));
-        summerPollutants.put(WeatherState.CLOUDY, createPollutantMap(15, 35, 20, 45, 30, 70, 50, 70));
-        summerPollutants.put(WeatherState.RAINY, createPollutantMap(5, 20, 10, 30, 20, 50, 45, 65));
-        summerPollutants.put(WeatherState.STORMY, createPollutantMap(8, 25, 12, 35, 22, 55, 60, 80));
-        summerPollutants.put(WeatherState.FOGGY, createPollutantMap(30, 80, 50, 100, 70, 90, 50, 70));
-        tempMap.put(Season.SUMMER, Collections.unmodifiableMap(summerPollutants));
-
-        // 秋季污染物范围
-        Map<WeatherState, Map<PollutantType, int[]>> autumnPollutants = new EnumMap<>(WeatherState.class);
-        autumnPollutants.put(WeatherState.SUNNY, createPollutantMap(20, 50, 25, 60, 35, 80, 50, 70));
-        autumnPollutants.put(WeatherState.CLOUDY, createPollutantMap(25, 60, 30, 70, 40, 90, 45, 65));
-        autumnPollutants.put(WeatherState.RAINY, createPollutantMap(8, 30, 12, 40, 25, 70, 40, 60));
-        autumnPollutants.put(WeatherState.STORMY, createPollutantMap(12, 40, 18, 50, 30, 80, 55, 75));
-        autumnPollutants.put(WeatherState.FOGGY, createPollutantMap(60, 80, 80, 100, 80, 110, 45, 65));
-        tempMap.put(Season.AUTUMN, Collections.unmodifiableMap(autumnPollutants));
-
-        BASE_POLLUTANTS = Collections.unmodifiableMap(tempMap);
-    }
-
-    // 新增:基础风速范围(米/秒,按季节和天气状态)
-    private static final Map<Season, Map<WeatherState, int[]>> BASE_WIND_SPEEDS;
-
-    static {
-        Map<Season, Map<WeatherState, int[]>> tempMap = new EnumMap<>(Season.class);
-
-        Map<WeatherState, int[]> winterSpeeds = new EnumMap<>(WeatherState.class);
-        winterSpeeds.put(WeatherState.SUNNY, new int[]{1, 5});
-        winterSpeeds.put(WeatherState.CLOUDY, new int[]{2, 8});
-        winterSpeeds.put(WeatherState.RAINY, new int[]{3, 10});
-        winterSpeeds.put(WeatherState.STORMY, new int[]{6, 10});
-//        winterSpeeds.put(WeatherState.STORMY, new int[]{10, 20});
-        winterSpeeds.put(WeatherState.FOGGY, new int[]{0, 3});
-        tempMap.put(Season.WINTER, Collections.unmodifiableMap(winterSpeeds));
-
-        Map<WeatherState, int[]> springSpeeds = new EnumMap<>(WeatherState.class);
-        springSpeeds.put(WeatherState.SUNNY, new int[]{2, 6});
-        springSpeeds.put(WeatherState.CLOUDY, new int[]{3, 8});
-//        springSpeeds.put(WeatherState.RAINY, new int[]{4, 12});
-        springSpeeds.put(WeatherState.RAINY, new int[]{4, 9});
-//        springSpeeds.put(WeatherState.STORMY, new int[]{12, 25});
-        springSpeeds.put(WeatherState.STORMY, new int[]{6, 10});
-        springSpeeds.put(WeatherState.FOGGY, new int[]{1, 4});
-        tempMap.put(Season.SPRING, Collections.unmodifiableMap(springSpeeds));
-
-        Map<WeatherState, int[]> summerSpeeds = new EnumMap<>(WeatherState.class);
-        summerSpeeds.put(WeatherState.SUNNY, new int[]{1, 4});
-        summerSpeeds.put(WeatherState.CLOUDY, new int[]{2, 6});
-        summerSpeeds.put(WeatherState.RAINY, new int[]{3, 9});
-//        summerSpeeds.put(WeatherState.STORMY, new int[]{15, 30});
-        summerSpeeds.put(WeatherState.STORMY, new int[]{6, 10});
-        summerSpeeds.put(WeatherState.FOGGY, new int[]{0, 2});
-        tempMap.put(Season.SUMMER, Collections.unmodifiableMap(summerSpeeds));
-
-        Map<WeatherState, int[]> autumnSpeeds = new EnumMap<>(WeatherState.class);
-        autumnSpeeds.put(WeatherState.SUNNY, new int[]{2, 7});
-//        autumnSpeeds.put(WeatherState.CLOUDY, new int[]{3, 10});
-        autumnSpeeds.put(WeatherState.CLOUDY, new int[]{3, 7});
-//        autumnSpeeds.put(WeatherState.RAINY, new int[]{4, 14});
-        autumnSpeeds.put(WeatherState.RAINY, new int[]{4, 9});
-//        autumnSpeeds.put(WeatherState.STORMY, new int[]{10, 25});
-        autumnSpeeds.put(WeatherState.STORMY, new int[]{6, 10});
-        autumnSpeeds.put(WeatherState.FOGGY, new int[]{1, 5});
-        tempMap.put(Season.AUTUMN, Collections.unmodifiableMap(autumnSpeeds));
-
-        BASE_WIND_SPEEDS = Collections.unmodifiableMap(tempMap);
-    }
-
-    // 新增:主导风向概率(按季节)
-    private static final Map<Season, Map<WindDirection, Double>> DOMINANT_WIND_DIRECTIONS;
-
-    static {
-        Map<Season, Map<WindDirection, Double>> tempMap = new EnumMap<>(Season.class);
-
-        // 冬季主导风向(北风、西北风)
-        Map<WindDirection, Double> winterDirs = new EnumMap<>(WindDirection.class);
-        winterDirs.put(WindDirection.N, 0.35);
-        winterDirs.put(WindDirection.NNW, 0.20);
-        winterDirs.put(WindDirection.NW, 0.15);
-        winterDirs.put(WindDirection.NNE, 0.10);
-        winterDirs.put(WindDirection.W, 0.05);
-        winterDirs.put(WindDirection.E, 0.05);
-        winterDirs.put(WindDirection.S, 0.05);
-        winterDirs.put(WindDirection.OTHER, 0.05);
-        tempMap.put(Season.WINTER, Collections.unmodifiableMap(winterDirs));
-
-        // 春季主导风向(东南风、南风)
-        Map<WindDirection, Double> springDirs = new EnumMap<>(WindDirection.class);
-        springDirs.put(WindDirection.SE, 0.30);
-        springDirs.put(WindDirection.S, 0.25);
-        springDirs.put(WindDirection.SSE, 0.15);
-        springDirs.put(WindDirection.ESE, 0.10);
-        springDirs.put(WindDirection.E, 0.05);
-        springDirs.put(WindDirection.N, 0.05);
-        springDirs.put(WindDirection.W, 0.05);
-        springDirs.put(WindDirection.OTHER, 0.05);
-        tempMap.put(Season.SPRING, Collections.unmodifiableMap(springDirs));
-
-        // 夏季主导风向(南风、西南风)
-        Map<WindDirection, Double> summerDirs = new EnumMap<>(WindDirection.class);
-        summerDirs.put(WindDirection.S, 0.30);
-        summerDirs.put(WindDirection.SSW, 0.20);
-        summerDirs.put(WindDirection.SW, 0.15);
-        summerDirs.put(WindDirection.SSE, 0.10);
-        summerDirs.put(WindDirection.W, 0.05);
-        summerDirs.put(WindDirection.N, 0.05);
-        summerDirs.put(WindDirection.E, 0.05);
-        summerDirs.put(WindDirection.OTHER, 0.10);
-        tempMap.put(Season.SUMMER, Collections.unmodifiableMap(summerDirs));
-
-        // 秋季主导风向(西北风、西风)
-        Map<WindDirection, Double> autumnDirs = new EnumMap<>(WindDirection.class);
-        autumnDirs.put(WindDirection.NW, 0.30);
-        autumnDirs.put(WindDirection.W, 0.25);
-        autumnDirs.put(WindDirection.WNW, 0.15);
-        autumnDirs.put(WindDirection.NNW, 0.10);
-        autumnDirs.put(WindDirection.N, 0.05);
-        autumnDirs.put(WindDirection.S, 0.05);
-        autumnDirs.put(WindDirection.E, 0.05);
-        autumnDirs.put(WindDirection.OTHER, 0.05);
-        tempMap.put(Season.AUTUMN, Collections.unmodifiableMap(autumnDirs));
-
-        DOMINANT_WIND_DIRECTIONS = Collections.unmodifiableMap(tempMap);
-    }
-
-    // 辅助方法:创建污染物范围映射
-    private static Map<PollutantType, int[]> createPollutantMap(int pm25Min, int pm25Max,
-                                                                int pm10Min, int pm10Max,
-                                                                int pm100Min, int pm100Max,
-                                                                int noiseMin, int noiseMax) {
-        Map<PollutantType, int[]> map = new EnumMap<>(PollutantType.class);
-        map.put(PollutantType.PM2_5, new int[]{pm25Min, pm25Max});
-        map.put(PollutantType.PM10, new int[]{pm10Min, pm10Max});
-        map.put(PollutantType.PM100, new int[]{pm100Min, pm100Max});
-        map.put(PollutantType.NOISE, new int[]{noiseMin, noiseMax});
-        return Collections.unmodifiableMap(map);
-    }
-
-    // 辅助方法:获取随机风向(考虑季节主导风向)
-    private static WindDirection getRandomWindDirection(Season season, Random random) {
-        Map<WindDirection, Double> probs = DOMINANT_WIND_DIRECTIONS.get(season);
-        double rand = random.nextDouble();
-        double cumulative = 0.0;
-
-        for (Map.Entry<WindDirection, Double> entry : probs.entrySet()) {
-            cumulative += entry.getValue();
-            if (rand < cumulative) {
-                if (entry.getKey() == WindDirection.OTHER) {
-                    while (true){
-                        List<WindDirection> allDirs = Arrays.asList(WindDirection.values());
-                        WindDirection direction = allDirs.get(random.nextInt(allDirs.size()));
-                        if(!direction.equals(WindDirection.OTHER)){
-                            return direction;
-                        }
-                    }
-
-                }
-                return entry.getKey();
-            }
-        }
-
-        // 默认返回北风
-        return WindDirection.N;
-    }
-
-    // 辅助方法:获取风向角度(0-360度)
-    private static int getDirectionAngle(WindDirection direction) {
-        return direction.ordinal() * 22; // 每个方位22.5度,近似为22度
-    }
-
-    // 辅助方法:计算两个风向之间的角度差(考虑圆形)
-    private static int getAngleDifference(int angle1, int angle2) {
-        int diff = Math.abs(angle1 - angle2);
-        return Math.min(diff, 360 - diff);
-    }
-
-    public static List<WeatherData> simulateYearlyWeather(LocalDateTime currentTime, LocalDateTime endTime) {
-        List<WeatherData> yearlyData = new ArrayList<>();
-        Random random = new Random();
-
-//        LocalDateTime currentTime = LocalDateTime.of(year, 1, 1, 0, 0);
-//        LocalDateTime endTime = LocalDateTime.of(year + 1, 1, 1, 0, 0);
-
-        // 初始状态
-        WeatherState currentState = WeatherState.CLOUDY;
-        Season currentSeason = getSeason(currentTime);
-
-        // 使用平均值初始化
-        double currentTemp = getAverageTemperature(currentSeason, currentState);
-        double currentHumidity = getAverageHumidity(currentState);
-        double currentPM25 = getAveragePollutant(currentSeason, currentState, PollutantType.PM2_5);
-        double currentPM10 = getAveragePollutant(currentSeason, currentState, PollutantType.PM10);
-        double currentPM100 = getAveragePollutant(currentSeason, currentState, PollutantType.PM100);
-        double currentNoise = getAveragePollutant(currentSeason, currentState, PollutantType.NOISE);
-        double currentWindSpeed = getAverageWindSpeed(currentSeason, currentState);
-        WindDirection currentWindDir = getRandomWindDirection(currentSeason, random);
-
-        // 状态切换时的过渡参数
-        WeatherState targetState = currentState;
-        int transitionSteps = 0;
-        final int TOTAL_TRANSITION_STEPS = 12; // 过渡时长 = 12*3min = 36分钟
-
-        while (currentTime.isBefore(endTime)) {
-            // 每8小时检查状态变化
-            if (currentTime.getMinute() == 0 && currentTime.getHour() % 8 == 0) {
-                currentSeason = getSeason(currentTime);
-                WeatherState newState = getNextWeatherState(currentState, currentSeason, random);
-
-                if (!newState.equals(currentState)) {
-                    targetState = newState;
-                    transitionSteps = 0;
-//                    System.out.println("开始状态过渡: " + currentState + " → " + targetState + " at " + currentTime);
-                }
-            }
-
-            // 计算过渡比例 (0.0=当前状态 → 1.0=目标状态)
-            double transitionRatio = transitionSteps < TOTAL_TRANSITION_STEPS ?
-                    (double) transitionSteps / TOTAL_TRANSITION_STEPS : 1.0;
-
-            // 获取混合状态下的参数范围
-            int[] tempRange = getTransitionTemperatureRange(currentSeason, currentState, targetState, transitionRatio);
-            int[] humidityRange = getTransitionHumidityRange(currentState, targetState, transitionRatio);
-            Map<PollutantType, int[]> pollutantRanges = getTransitionPollutantRanges(
-                    currentSeason, currentState, targetState, transitionRatio);
-            int[] windSpeedRange = getTransitionWindSpeedRange(currentSeason, currentState, targetState, transitionRatio);
-
-            // 获取目标风向(只在过渡开始时确定)
-            WindDirection targetWindDir = transitionSteps == 0 ?
-                    getRandomWindDirection(currentSeason, random) : currentWindDir;
-
-            // 生成数据
-            double timeFactor = calculateTimeFactor(currentTime);
-            double seasonProgress = getSeasonProgress(currentTime);
-
-            currentTemp = generateSmoothTemperature(
-                    tempRange, currentTime, timeFactor, seasonProgress,
-                    random, currentTemp, transitionRatio);
-
-            currentHumidity = generateSmoothHumidity(
-                    humidityRange, currentTime, timeFactor,
-                    random, currentHumidity, transitionRatio);
-
-            // 生成污染物数据
-            currentPM25 = generateSmoothPollutant(
-                    pollutantRanges.get(PollutantType.PM2_5),
-                    random, currentPM25, transitionRatio, 1.5, 0.3);
-
-            currentPM10 = generateSmoothPollutant(
-                    pollutantRanges.get(PollutantType.PM10),
-                    random, currentPM10, transitionRatio, 2.0, 0.4);
-
-            currentPM100 = generateSmoothPollutant(
-                    pollutantRanges.get(PollutantType.PM100),
-                    random, currentPM100, transitionRatio, 3.0, 0.5);
-
-            // 生成噪音
-            currentNoise = generateSmoothNoise(
-                    pollutantRanges.get(PollutantType.NOISE),
-                    currentTime, random, currentNoise, transitionRatio);
-
-            // 生成风速
-            currentWindSpeed = generateSmoothWindSpeed(
-                    windSpeedRange, random, currentWindSpeed, transitionRatio);
-
-            // 生成风向(平滑过渡)
-            currentWindDir = generateSmoothWindDirection(
-                    currentWindDir, targetWindDir, transitionRatio, random);
-
-            // 添加到结果集
-            yearlyData.add(new WeatherData(
-                    currentTime,
-                    currentTemp,
-                    currentHumidity,
-                    transitionRatio < 1.0 ? currentState : targetState, // 显示当前有效状态
-                    currentPM25,
-                    currentPM10,
-                    currentPM100,
-                    currentNoise,
-                    currentWindSpeed,
-                    currentWindDir
-            ));
-
-            // 更新状态过渡进度
-            if (transitionSteps < TOTAL_TRANSITION_STEPS) {
-                transitionSteps++;
-                if (transitionSteps == TOTAL_TRANSITION_STEPS) {
-                    currentState = targetState; // 过渡完成
-                }
-            }
-
-            currentTime = currentTime.plusMinutes(TIME_INTERVAL_MINUTES);
-        }
-
-        return yearlyData;
-    }
-
-    // 获取过渡期间的温度范围
-    private static int[] getTransitionTemperatureRange(Season season,
-                                                       WeatherState from,
-                                                       WeatherState to,
-                                                       double ratio) {
-        int[] fromRange = BASE_TEMPERATURES.get(season).get(from);
-        int[] toRange = BASE_TEMPERATURES.get(season).get(to);
-
-        return new int[]{
-                (int) Math.round(fromRange[0] * (1 - ratio) + toRange[0] * ratio),
-                (int) Math.round(fromRange[1] * (1 - ratio) + toRange[1] * ratio)
-        };
-    }
-
-    // 获取过渡期间的湿度范围
-    private static int[] getTransitionHumidityRange(WeatherState from,
-                                                    WeatherState to,
-                                                    double ratio) {
-        int[] fromRange = BASE_HUMIDITIES.get(from);
-        int[] toRange = BASE_HUMIDITIES.get(to);
-
-        return new int[]{
-                (int) Math.round(fromRange[0] * (1 - ratio) + toRange[0] * ratio),
-                (int) Math.round(fromRange[1] * (1 - ratio) + toRange[1] * ratio)
-        };
-    }
-
-    // 新增:获取过渡期间的污染物范围
-    private static Map<PollutantType, int[]> getTransitionPollutantRanges(Season season,
-                                                                          WeatherState from,
-                                                                          WeatherState to,
-                                                                          double ratio) {
-        Map<PollutantType, int[]> fromRanges = BASE_POLLUTANTS.get(season).get(from);
-        Map<PollutantType, int[]> toRanges = BASE_POLLUTANTS.get(season).get(to);
-
-        Map<PollutantType, int[]> result = new EnumMap<>(PollutantType.class);
-
-        for (PollutantType type : PollutantType.values()) {
-            int[] fromRange = fromRanges.get(type);
-            int[] toRange = toRanges.get(type);
-
-            int min = (int) Math.round(fromRange[0] * (1 - ratio) + toRange[0] * ratio);
-            int max = (int) Math.round(fromRange[1] * (1 - ratio) + toRange[1] * ratio);
-            result.put(type, new int[]{min, max});
-        }
-
-        return Collections.unmodifiableMap(result);
-    }
-
-    // 新增:获取过渡期间的风速范围
-    private static int[] getTransitionWindSpeedRange(Season season,
-                                                     WeatherState from,
-                                                     WeatherState to,
-                                                     double ratio) {
-        int[] fromRange = BASE_WIND_SPEEDS.get(season).get(from);
-        int[] toRange = BASE_WIND_SPEEDS.get(season).get(to);
-
-        return new int[]{
-                (int) Math.round(fromRange[0] * (1 - ratio) + toRange[0] * ratio),
-                (int) Math.round(fromRange[1] * (1 - ratio) + toRange[1] * ratio)
-        };
-    }
-
-    // 辅助方法:获取平均温度
-    private static double getAverageTemperature(Season season, WeatherState state) {
-        int[] range = BASE_TEMPERATURES.get(season).get(state);
-        return (range[0] + range[1]) / 2.0;
-    }
-
-    // 辅助方法:获取平均湿度
-    private static double getAverageHumidity(WeatherState state) {
-        int[] range = BASE_HUMIDITIES.get(state);
-        return (range[0] + range[1]) / 2.0;
-    }
-
-    // 辅助方法:获取平均污染物浓度
-    private static double getAveragePollutant(Season season, WeatherState state, PollutantType type) {
-        int[] range = BASE_POLLUTANTS.get(season).get(state).get(type);
-        return (range[0] + range[1]) / 2.0;
-    }
-
-    // 辅助方法:获取平均风速
-    private static double getAverageWindSpeed(Season season, WeatherState state) {
-        int[] range = BASE_WIND_SPEEDS.get(season).get(state);
-        return (range[0] + range[1]) / 2.0;
-    }
-
-    // 使用马尔可夫链获取下一个天气状态
-    private static WeatherState getNextWeatherState(WeatherState currentState, Season season, Random random) {
-        double[][] matrix = TRANSITION_MATRICES.get(season);
-        double rand = random.nextDouble();
-        double cumulativeProb = 0.0;
-
-        for (int i = 0; i < matrix[currentState.ordinal()].length; i++) {
-            cumulativeProb += matrix[currentState.ordinal()][i];
-            if (rand < cumulativeProb) {
-                return WeatherState.values()[i];
-            }
-        }
-
-        return currentState;
-    }
-
-    // 计算时间影响因子(昼夜节律)
-    private static double calculateTimeFactor(LocalDateTime time) {
-        double hour = time.getHour() + time.getMinute() / 60.0;
-        // 使用两个正弦波叠加模拟昼夜温度变化
-        return 0.6 * Math.sin((hour / 24) * 2 * Math.PI - Math.PI / 2) +
-                0.4 * Math.sin((hour / 12) * 2 * Math.PI);
-    }
-
-    // 获取季节进度(0.0到1.0)
-    private static double getSeasonProgress(LocalDateTime time) {
-        int dayOfYear = time.getDayOfYear();
-        if (dayOfYear < 80) return dayOfYear / 80.0;         // 冬季
-        else if (dayOfYear < 172) return (dayOfYear - 80) / 92.0; // 春季
-        else if (dayOfYear < 264) return (dayOfYear - 172) / 92.0;// 夏季
-        else if (dayOfYear < 355) return (dayOfYear - 264) / 91.0;// 秋季
-        else return (dayOfYear - 355) / 10.0;                    // 冬季
-    }
-
-    // 平滑温度生成(过渡感知)
-    private static double generateSmoothTemperature(int[] range, LocalDateTime time,
-                                                    double timeFactor, double seasonProgress,
-                                                    Random random, double previousTemp,
-                                                    double transitionRatio) {
-        // 基础温度计算(考虑过渡比例)
-        double baseTemp = range[0] + (range[1] - range[0]) * seasonProgress;
-
-        // 昼夜影响(过渡期间减弱)
-        double diurnalEffect = timeFactor * (range[1] - range[0]) *
-                (0.25 * (1 - transitionRatio) + 0.15 * transitionRatio);
-
-        // 随机波动(过渡期间减小)
-        double randomEffect = (random.nextDouble() - 0.5) *
-                (1.0 * (1 - transitionRatio) + 0.3 * transitionRatio);
-
-        // 计算目标温度
-        double targetTemp = baseTemp + diurnalEffect + randomEffect;
-
-        // 应用变化率限制(过渡期间更严格)
-        double maxDelta = 0.3 + 0.2 * (1 - transitionRatio); // 0.3~0.5℃
-        targetTemp = Math.max(previousTemp - maxDelta,
-                Math.min(previousTemp + maxDelta, targetTemp));
-
-        // 确保在合理范围内
-        return Math.max(range[0], Math.min(range[1], targetTemp));
-    }
-
-    // 平滑湿度生成(过渡感知)
-    private static double generateSmoothHumidity(int[] range, LocalDateTime time,
-                                                 double timeFactor, Random random,
-                                                 double previousHumidity,
-                                                 double transitionRatio) {
-        // 基础湿度(考虑过渡比例)
-        double baseHumidity = range[0] + (range[1] - range[0]) * random.nextDouble();
-
-        // 昼夜影响(过渡期间减弱)
-        double diurnalEffect = timeFactor * 9 * (1 - 0.5 * transitionRatio);
-
-        // 随机波动(过渡期间减小)
-        double randomEffect = (random.nextDouble() - 0.5) * 6 * (1 - 0.7 * transitionRatio);
-
-        // 计算目标湿度
-        double targetHumidity = baseHumidity - diurnalEffect + randomEffect;
-
-        // 应用变化率限制(过渡期间更严格)
-        double maxDelta = 0.8 + 0.7 * (1 - transitionRatio); // 0.8~1.5%
-        targetHumidity = Math.max(previousHumidity - maxDelta,
-                Math.min(previousHumidity + maxDelta, targetHumidity));
-
-        // 确保在合理范围内
-        return Math.max(range[0], Math.min(range[1], targetHumidity));
-    }
-
-    // 新增:平滑污染物生成(通用方法)
-    private static double generateSmoothPollutant(int[] range, Random random,
-                                                  double previousValue, double transitionRatio,
-                                                  double baseDelta, double fluctuationFactor) {
-        // 基础值(考虑过渡比例)
-        double baseValue = range[0] + (range[1] - range[0]) * random.nextDouble();
-
-        // 随机波动(过渡期间减小)
-        double randomEffect = (random.nextDouble() - 0.5) * fluctuationFactor * range[1] *
-                (1 - 0.7 * transitionRatio);
-
-        // 计算目标值
-        double targetValue = baseValue + randomEffect;
-
-        // 应用变化率限制(过渡期间更严格)
-        double maxDelta = baseDelta + baseDelta * (1 - transitionRatio);
-        targetValue = Math.max(previousValue - maxDelta,
-                Math.min(previousValue + maxDelta, targetValue));
-
-        // 确保在合理范围内
-        return Math.max(range[0], Math.min(range[1], targetValue));
-    }
-
-    // 新增:平滑噪音生成(考虑昼夜节律)
-    private static double generateSmoothNoise(int[] range, LocalDateTime time,
-                                              Random random, double previousNoise,
-                                              double transitionRatio) {
-        // 基础噪音
-        double baseNoise = range[0] + (range[1] - range[0]) * random.nextDouble();
-
-        // 昼夜影响(白天高,夜晚低)
-        double hour = time.getHour() + time.getMinute() / 60.0;
-        double diurnalEffect = 0;
-        if (hour >= 6 && hour <= 22) { // 白天(6:00-22:00)
-            // 早晚高峰
-            if ((hour >= 7 && hour <= 9) || (hour >= 17 && hour <= 19)) {
-                diurnalEffect = 10 + 5 * Math.sin((hour - 8) * Math.PI / 6);
-            } else {
-                diurnalEffect = 5 * Math.sin((hour - 12) * Math.PI / 12);
-            }
-        } else { // 夜间
-            diurnalEffect = -15;
-        }
-
-        // 随机波动
-        double randomEffect = (random.nextDouble() - 0.5) * 5;
-
-        // 计算目标噪音
-        double targetNoise = baseNoise + diurnalEffect + randomEffect;
-
-        // 应用变化率限制
-        double maxDelta = 2.0 + 1.5 * (1 - transitionRatio); // 2.0~3.5 dB
-        targetNoise = Math.max(previousNoise - maxDelta,
-                Math.min(previousNoise + maxDelta, targetNoise));
-
-        // 确保在合理范围内
-        return Math.max(range[0], Math.min(range[1], targetNoise));
-    }
-
-    // 新增:平滑风速生成
-    private static double generateSmoothWindSpeed(int[] range, Random random,
-                                                  double previousSpeed,
-                                                  double transitionRatio) {
-        // 基础风速(考虑过渡比例)
-        double baseSpeed = range[0] + (range[1] - range[0]) * random.nextDouble();
-
-        // 随机波动(过渡期间减小)
-        double randomEffect = (random.nextDouble() - 0.5) * 2.0 * (1 - 0.7 * transitionRatio);
-
-        // 计算目标风速
-        double targetSpeed = baseSpeed + randomEffect;
-
-        // 应用变化率限制(过渡期间更严格)
-        double maxDelta = 0.5 + 0.4 * (1 - transitionRatio); // 0.5~0.9 m/s
-        targetSpeed = Math.max(previousSpeed - maxDelta,
-                Math.min(previousSpeed + maxDelta, targetSpeed));
-
-        // 确保在合理范围内
-        return Math.max(range[0], Math.min(range[1], targetSpeed));
-    }
-
-    // 新增:平滑风向过渡
-    private static WindDirection generateSmoothWindDirection(WindDirection currentDir,
-                                                             WindDirection targetDir,
-                                                             double transitionRatio,
-                                                             Random random) {
-        // 如果已经是目标风向,或者过渡完成
-        if (currentDir == targetDir || transitionRatio >= 1.0) {
-            return targetDir;
-        }
-
-        // 有20%的概率在非过渡期间改变风向
-        if (transitionRatio == 0 && random.nextDouble() < 0.2) {
-            // 随机小幅变化(±1个方位)
-            int currentIndex = currentDir.ordinal();
-            int change = random.nextBoolean() ? 1 : -1;
-            int newIndex = (currentIndex + change + WindDirection.values().length) % WindDirection.values().length;
-            return WindDirection.values()[newIndex];
-        }
-
-        // 过渡期间:逐步转向目标风向
-        int currentAngle = getDirectionAngle(currentDir);
-        int targetAngle = getDirectionAngle(targetDir);
-
-        // 计算最短转向路径
-        int diff1 = (targetAngle - currentAngle + 360) % 360;
-        int diff2 = diff1 - 360;
-        int shortestDiff = Math.abs(diff1) < Math.abs(diff2) ? diff1 : diff2;
-
-        // 最大转向角度(每次最多22.5度)
-        int maxTurn = (int) (22 * transitionRatio);
-        int actualTurn = Math.min(Math.abs(shortestDiff), maxTurn);
-        if (shortestDiff < 0) actualTurn = -actualTurn;
-
-        // 计算新角度
-        int newAngle = (currentAngle + actualTurn + 360) % 360;
-
-        // 转换为最接近的风向
-        int index = (int) Math.round(newAngle / 22.5) % 16;
-        return WindDirection.values()[index];
-    }
-
-    // 获取当前季节
-    private static Season getSeason(LocalDateTime time) {
-        int month = time.getMonthValue();
-        if (month == 12 || month <= 2) return Season.WINTER;
-        if (month <= 5) return Season.SPRING;
-        if (month <= 8) return Season.SUMMER;
-        return Season.AUTUMN;
-    }
-
-//    public static void main(String[] args) {
-//        int year = 2024;
-//        List<WeatherData> yearlyData = simulateYearlyWeather(year);
-//
-//        // 打印前3天的数据(每小时间隔)
-//        System.out.println("时间戳\t\t\t\t温度\t湿度\t天气状态\tPM2.5\tPM10\tPM100\t噪音\t风速和风向");
-//        for (int i = 0; i < 480; i += 20) { // 每20个点 = 1小时 (3分钟间隔)
-//            WeatherData data = yearlyData.get(i);
-//            System.out.println(data);
-//        }
-//        System.out.println(yearlyData.size());
-
-        // 统计不同天气下的平均风速
-//        Map<WeatherState, Double> avgWindSpeedByWeather = yearlyData.stream()
-//                .collect(Collectors.groupingBy(WeatherData::getWeatherState,
-//                        Collectors.averagingDouble(WeatherData::getWindSpeed)));
-//
-//        System.out.println("\n不同天气状态下的平均风速:");
-//        avgWindSpeedByWeather.forEach((state, avg) ->
-//                System.out.printf("%s: %.1f m/s%n", state, avg));
-
-        // 统计主导风向分布
-//        Map<WindDirection, Long> windDirectionDistribution = yearlyData.stream()
-//                .collect(Collectors.groupingBy(WeatherData::getWindDirection, Collectors.counting()));
-
-//        System.out.println("\n风向分布:");
-//        windDirectionDistribution.entrySet().stream()
-//                .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
-//                .forEach(entry ->
-//                        System.out.printf("%s: %.1f%%%n", entry.getKey(),
-//                                entry.getValue() * 100.0 / yearlyData.size()));
-//    }
-}

+ 1 - 1
easydo-mes/src/main/resources/config/application-owntest.yml

@@ -14,7 +14,7 @@ spring:
       # 最大连接数
       max-active: 20
       # 获取连接超时时间
-      max-wait: 5000
+      max-wait: 50000
       # 连接有效性检测时间
       time-between-eviction-runs-millis: 60000
       # 连接在池中最小生存的时间

+ 2 - 2
easydo-mes/src/main/resources/config/application.yml

@@ -48,7 +48,7 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     auto-mapping-behavior: full
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
-  mapper-locations: classpath*:/mapper/*Mapper.xml
+#  mapper-locations: classpath*:/mapper/*Mapper.xml
   global-config:
     db-config:
       logic-delete-value: 1 # 逻辑已删除值(默认为 1)
@@ -78,5 +78,5 @@ minio:
   endpoint: http://minio.qdeasydo.com  # MinIO服务器地址
   access-key: minioadm      # 访问密钥
   secret-key: minio@123      # 秘密密钥
-  ai-bucket-name: airecord           # 默认存储桶名称
+  bucket-name: process           # 默认存储桶名称
   secure: false                    # 是否使用HTTPS

+ 0 - 99
easydo-system/src/main/java/easydo/technology/system/domain/Dept.java

@@ -1,99 +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 easydo.technology.system.domain;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import easydo.technology.base.CommonEntity;
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.beans.BeanUtils;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import java.time.LocalDateTime;
-
-@Setter
-@Getter
-@TableName("sys_dept")
-public class Dept extends CommonEntity {
-    private static final long serialVersionUID = 1L;
-
-    @TableId(value = "dept_id", type = IdType.AUTO)
-    private Long id;
-
-    @NotNull
-    private Long pid;
-
-    private Integer subCount;
-
-    @NotBlank
-    private String name;
-
-    private Integer deptSort;
-
-    @NotNull
-    private Boolean enabled;
-
-    @NotNull
-    private String firmType;
-
-    @NotNull
-    private String firmCredit;
-
-    @NotNull
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime firmTime;
-
-    @NotNull
-    private String firmAddress;
-
-    @NotNull
-    private String firmCapital;
-
-    @NotNull
-    private String firmNature;
-
-    @NotNull
-    private String firmLegalPerson;
-
-    @NotNull
-    private String firmLegalPersonPhone;
-
-    @NotNull
-    private String firmFunctionary;
-
-    @NotNull
-    private String firmFunctionaryPhone;
-
-    @NotNull
-    private String firmOfficePhone;
-
-    @NotNull
-    private String firmFaxNumber;
-
-    @NotNull
-    private String firmBusinessAddress;
-
-    @NotNull
-    private String remark;
-
-    public void copyFrom(Dept source) {
-        BeanUtils.copyProperties(source, this);
-    }
-}

+ 0 - 35
easydo-system/src/main/java/easydo/technology/system/domain/Dict.java

@@ -1,35 +0,0 @@
-package easydo.technology.system.domain;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import easydo.technology.base.CommonEntity;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.experimental.Accessors;
-import org.springframework.beans.BeanUtils;
-
-import javax.validation.constraints.NotBlank;
-
-/**
- * @author jinjin
- * @date 2020-09-24
- */
-@Getter
-@Setter
-@TableName("sys_dict")
-@Accessors(chain = true)
-public class Dict extends CommonEntity {
-
-    @TableId(value = "dict_id", type = IdType.AUTO)
-    private Long id;
-
-    @NotBlank
-    private String name;
-
-    private String description;
-
-    public void copyFrom(Dict source) {
-        BeanUtils.copyProperties(source, this);
-    }
-}

+ 0 - 54
easydo-system/src/main/java/easydo/technology/system/domain/DictDetail.java

@@ -1,54 +0,0 @@
-package easydo.technology.system.domain;
-
-import com.baomidou.mybatisplus.annotation.*;
-import easydo.technology.system.dto.DictSmallDto;
-import lombok.Data;
-import org.springframework.beans.BeanUtils;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * @author jinjin
- * @date 2020-09-24
- */
-@Data
-@TableName("sys_dict_detail")
-public class DictDetail implements Serializable {
-
-    @TableId(value = "detail_id", type = IdType.AUTO)
-    private Long id;
-
-    @NotNull
-    private Long dictId;
-
-    @NotNull
-    @TableField(exist = false)
-    private DictSmallDto dict;
-
-    @NotBlank
-    private String label;
-
-    @NotBlank
-    private String value;
-
-    private Integer dictSort;
-
-    @TableField(fill = FieldFill.INSERT)
-    private String createBy;
-
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private String updateBy;
-
-    @TableField(fill = FieldFill.INSERT)
-    private Date createTime;
-
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private Date updateTime;
-
-    public void copyFrom(DictDetail source) {
-        BeanUtils.copyProperties(source, this);
-    }
-}

+ 0 - 38
easydo-system/src/main/java/easydo/technology/system/domain/Job.java

@@ -1,38 +0,0 @@
-package easydo.technology.system.domain;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import easydo.technology.base.CommonEntity;
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.beans.BeanUtils;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-
-/**
- * @author jinjin
- * @date 2020-09-25
- */
-@Setter
-@Getter
-@TableName("sys_job")
-public class Job extends CommonEntity {
-    private static final long serialVersionUID = 1L;
-
-    @TableId(value = "job_id", type = IdType.AUTO)
-    private Long id;
-
-    @NotBlank
-    private String name;
-
-    @NotNull
-    private Boolean enabled;
-
-    private Integer jobSort;
-
-    public void copyFrom(Job source) {
-        BeanUtils.copyProperties(source, this);
-    }
-}

+ 0 - 76
easydo-system/src/main/java/easydo/technology/system/domain/Menu.java

@@ -1,76 +0,0 @@
-package easydo.technology.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 easydo.technology.base.CommonEntity;
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.beans.BeanUtils;
-
-import java.util.Objects;
-
-/**
- * @author jinjin
- * @date 2020-09-25
- */
-@Setter
-@Getter
-@TableName("sys_menu")
-public class Menu extends CommonEntity {
-    private static final long serialVersionUID = 1L;
-
-    @TableId(value = "menu_id", type = IdType.AUTO)
-    private Long id;
-
-    private Long pid;
-
-    private Integer subCount;
-
-    private Integer type;
-
-    private String title;
-
-    @TableField(value = "name")
-    private String componentName;
-
-    private String component;
-
-    private Integer menuSort;
-
-    private String icon;
-
-    private String path;
-
-    private Boolean iFrame;
-
-    private Boolean cache;
-
-    private Boolean hidden;
-
-    private String permission;
-
-    private String platformType;
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        Menu menu = (Menu) o;
-        return Objects.equals(id, menu.id);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(id);
-    }
-
-    public void copyFrom(Menu source) {
-        BeanUtils.copyProperties(source, this);
-    }
-}

+ 0 - 38
easydo-system/src/main/java/easydo/technology/system/domain/Role.java

@@ -1,38 +0,0 @@
-package easydo.technology.system.domain;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import easydo.technology.base.CommonEntity;
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.beans.BeanUtils;
-
-import javax.validation.constraints.NotBlank;
-
-/**
- * @author jinjin
- * @date 2020-09-25
- */
-@Setter
-@Getter
-@TableName("sys_role")
-public class Role extends CommonEntity {
-    private static final long serialVersionUID = 1L;
-
-    @TableId(value = "role_id", type = IdType.AUTO)
-    private Long id;
-
-    @NotBlank
-    private String name;
-
-    private Integer level;
-
-    private String description;
-
-    private String dataScope;
-
-    public void copyFrom(Role source) {
-        BeanUtils.copyProperties(source, this);
-    }
-}

+ 0 - 27
easydo-system/src/main/java/easydo/technology/system/domain/RolesDepts.java

@@ -1,27 +0,0 @@
-package easydo.technology.system.domain;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.io.Serializable;
-
-/**
- * 用户角色关联
- * Created by jinjin on 2020-09-25.
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@JsonIgnoreProperties(value = { "handler" })
-@TableName("sys_roles_depts")
-public class RolesDepts implements Serializable{
-    private static final long serialVersionUID = 1L;
-
-    @TableField(value = "role_id")
-    private Long roleId;
-
-    @TableField(value = "dept_id")
-    private Long deptId;
-}

+ 0 - 27
easydo-system/src/main/java/easydo/technology/system/domain/RolesMenus.java

@@ -1,27 +0,0 @@
-package easydo.technology.system.domain;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.io.Serializable;
-
-/**
- * 用户角色关联
- * Created by jinjin on 2020-09-25.
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@JsonIgnoreProperties(value = { "handler" })
-@TableName("sys_roles_menus")
-public class RolesMenus implements Serializable{
-    private static final long serialVersionUID = 1L;
-
-    @TableField(value = "role_id")
-    private Long roleId;
-
-    @TableField(value = "menu_id")
-    private Long menuId;
-}

+ 0 - 150
easydo-system/src/main/java/easydo/technology/system/domain/SysDept.java

@@ -1,150 +0,0 @@
-package easydo.technology.system.domain;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.time.LocalDateTime;
-
-/**
- * <p>
- * 部门
- * </p>
- *
- * @author fr
- * @since 2022-01-26
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class SysDept extends Model {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * ID
-     */
-    @TableId(value = "dept_id", type = IdType.AUTO)
-    private Long deptId;
-
-    /**
-     * 上级部门
-     */
-    private Long pid;
-
-    /**
-     * 子部门数目
-     */
-    private Integer subCount;
-
-    /**
-     * 名称
-     */
-    private String name;
-
-    /**
-     * 企业类型
-     */
-    private String firmType;
-
-    /**
-     * 统一社会信用代码
-     */
-    private String firmCredit;
-
-    /**
-     * 注册日期
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime firmTime;
-
-    /**
-     * 企业注册地址
-     */
-    private String firmAddress;
-
-    /**
-     * 注册资本
-     */
-    private String firmCapital;
-
-    /**
-     * 企业性质
-     */
-    private String firmNature;
-
-    /**
-     * 企业法人
-     */
-    private String firmLegalPerson;
-
-    /**
-     * 法定代表人身份证号码
-     */
-    private String firmLegalPersonPhone;
-
-    /**
-     * 负责人员
-     */
-    private String firmFunctionary;
-
-    /**
-     * 负责人手机号码
-     */
-    private String firmFunctionaryPhone;
-
-    /**
-     * 办公电话
-     */
-    private String firmOfficePhone;
-
-    /**
-     * 传真号
-     */
-    private String firmFaxNumber;
-
-    /**
-     * 企业营业地址
-     */
-    private String firmBusinessAddress;
-
-    /**
-     * 排序
-     */
-    private Integer deptSort;
-
-    /**
-     * 状态
-     */
-    private Boolean enabled;
-
-    /**
-     * 创建者
-     */
-    private String createBy;
-
-    /**
-     * 更新者
-     */
-    private String updateBy;
-
-    /**
-     * 创建日期
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime createTime;
-
-    /**
-     * 更新时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime updateTime;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-}

+ 0 - 29
easydo-system/src/main/java/easydo/technology/system/domain/SysRolesDepts.java

@@ -1,29 +0,0 @@
-package easydo.technology.system.domain;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.io.Serializable;
-
-/**
- * @author tianyf
- *
- * 用于替换  RolesDepts 用户角色关联 实体类
- * 为了给jdbcClient提供查询实体类映射
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@JsonIgnoreProperties(value = { "handler" })
-public class SysRolesDepts implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @TableField(value = "role_id")
-    private Long roleId;
-
-    @TableField(value = "dept_id")
-    private Long deptId;
-
-}

+ 0 - 71
easydo-system/src/main/java/easydo/technology/system/domain/User.java

@@ -1,71 +0,0 @@
-package easydo.technology.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 easydo.technology.base.CommonEntity;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.springframework.beans.BeanUtils;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import java.util.Date;
-
-/**
- * @author jinjin
- * @date 2020-09-25
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@TableName("sys_user")
-public class User extends CommonEntity {
-    private static final long serialVersionUID = 1L;
-
-    @TableId(value = "user_id", type = IdType.AUTO)
-    @NotNull(groups = Update.class)
-    private Long id;
-
-    private Long deptId;
-
-    @NotBlank
-    private String username;
-
-    private String nickName;
-
-    private String gender;
-
-    @NotBlank
-    private String phone;
-
-    @NotBlank
-    private String email;
-
-    private String avatarName;
-
-    private String avatarPath;
-
-    private String password;
-
-    private Boolean isAdmin;
-
-    private Boolean enabled;
-
-    private Date pwdResetTime;
-
-    private Integer projectFpiId;
-
-    private String projectUserType;
-
-    private String features;
-    /**
-     * sys-user用户表的id
-     */
-    @TableField(exist = false)
-    private Long doId;
-
-    public <T> void copyFrom(T source) {
-        BeanUtils.copyProperties(source, this);
-    }
-}

+ 0 - 27
easydo-system/src/main/java/easydo/technology/system/domain/UsersJobs.java

@@ -1,27 +0,0 @@
-package easydo.technology.system.domain;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.io.Serializable;
-
-/**
- * 用户角色关联
- * Created by jinjin on 2020-09-25.
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@JsonIgnoreProperties(value = { "handler" })
-@TableName("sys_users_jobs")
-public class UsersJobs implements Serializable{
-    private static final long serialVersionUID = 1L;
-
-    @TableField(value = "user_id")
-    private Long userId;
-
-    @TableField(value = "job_id")
-    private Long jobId;
-}

+ 0 - 27
easydo-system/src/main/java/easydo/technology/system/domain/UsersRoles.java

@@ -1,27 +0,0 @@
-package easydo.technology.system.domain;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.io.Serializable;
-
-/**
- * 用户角色关联
- * Created by jinjin on 2020-09-25.
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@JsonIgnoreProperties(value = { "handler" })
-@TableName("sys_users_roles")
-public class UsersRoles implements Serializable{
-    private static final long serialVersionUID = 1L;
-
-    @TableField(value = "user_id")
-    private Long userId;
-
-    @TableField(value = "role_id")
-    private Long roleId;
-}

+ 0 - 36
easydo-system/src/main/java/easydo/technology/system/domain/vo/MenuMetaVo.java

@@ -1,36 +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 easydo.technology.system.domain.vo;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @author Zheng Jie
- * @date 2018-12-20
- */
-@Data
-@AllArgsConstructor
-public class MenuMetaVo implements Serializable {
-
-    private String title;
-
-    private String icon;
-
-    private Boolean noCache;
-}

+ 0 - 50
easydo-system/src/main/java/easydo/technology/system/domain/vo/MenuVo.java

@@ -1,50 +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 easydo.technology.system.domain.vo;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * 构建前端路由时用到
- * @author Zheng Jie
- * @date 2018-12-20
- */
-@Data
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class MenuVo implements Serializable {
-
-    private String name;
-
-    private String path;
-
-    private Boolean hidden;
-
-    private Boolean iFrame;
-
-    private String redirect;
-
-    private String component;
-
-    private Boolean alwaysShow;
-
-    private MenuMetaVo meta;
-
-    private List<MenuVo> children;
-}

+ 0 - 12
easydo-system/src/main/java/easydo/technology/system/domain/vo/UserDto.java

@@ -1,12 +0,0 @@
-package easydo.technology.system.domain.vo;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-@Data
-public class UserDto implements Serializable {
-    private static final long serialVersionUID = 1441598834880181998L;
-    private String id;
-    private String nickName;
-}

+ 0 - 31
easydo-system/src/main/java/easydo/technology/system/domain/vo/UserPassVo.java

@@ -1,31 +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 easydo.technology.system.domain.vo;
-
-import lombok.Data;
-
-/**
- * 修改密码的 Vo 类
- * @author Zheng Jie
- * @date 2019年7月11日13:59:49
- */
-@Data
-public class UserPassVo {
-
-    private String oldPass;
-
-    private String newPass;
-}

+ 0 - 15
easydo-system/src/main/java/easydo/technology/system/domain/vo/UserVo.java

@@ -1,15 +0,0 @@
-package easydo.technology.system.domain.vo;
-
-import easydo.technology.system.domain.User;
-import lombok.Data;
-
-import java.util.List;
-
-@Data
-public class UserVo extends User {
-    private Integer current;
-
-    private Integer size;
-
-    private List<Integer> projectIdList;
-}

+ 0 - 97
easydo-system/src/main/java/easydo/technology/system/dto/DeptDto.java

@@ -1,97 +0,0 @@
-package easydo.technology.system.dto;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import easydo.technology.base.CommonDto;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import java.time.LocalDateTime;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * @author jinjin
- * @date 2020-09-25
- */
-@Getter
-@Setter
-@NoArgsConstructor
-public class DeptDto extends CommonDto {
-    private static final long serialVersionUID = 1L;
-
-    private Long id;
-
-    private Long pid;
-
-    private Integer subCount;
-
-    private String name;
-
-    private Integer deptSort;
-
-    private String firmType;
-
-    private String firmCredit;
-
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime firmTime;
-
-    private String firmAddress;
-
-    private String firmCapital;
-
-    private String firmNature;
-
-    private String firmLegalPerson;
-
-    private String firmLegalPersonPhone;
-
-    private String firmFunctionary;
-
-    private String firmFunctionaryPhone;
-
-    private String firmOfficePhone;
-
-    private String firmFaxNumber;
-
-    private String firmBusinessAddress;
-
-    private String remark;
-
-    @JsonInclude(JsonInclude.Include.NON_EMPTY)
-    private List<DeptDto> children;
-
-    private Boolean enabled;
-
-    public Boolean getHasChildren() {
-        return subCount > 0;
-    }
-
-    public Boolean getLeaf() {
-        return subCount <= 0;
-    }
-
-    public String getLabel() {
-        return name;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        DeptDto deptDto = (DeptDto) o;
-        return Objects.equals(id, deptDto.id) &&
-                Objects.equals(name, deptDto.name);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(id, name);
-    }
-}

+ 0 - 40
easydo-system/src/main/java/easydo/technology/system/dto/DeptQueryParam.java

@@ -1,40 +0,0 @@
-package easydo.technology.system.dto;
-
-import easydo.technology.annotation.Query;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-import java.util.List;
-
-/**
-* @author jinjin
-* @date 2020-09-25
-*/
-@Data
-public class DeptQueryParam{
-
-    /** 精确 */
-    @Query
-    private Long deptId;
-
-    /** 精确 */
-    @Query
-    private Long pid;
-
-    @Query(type = Query.Type.IS_NULL, propName = "pid")
-    private Boolean pidIsNull;
-
-    /** 模糊 */
-    @Query(type = Query.Type.INNER_LIKE)
-    private String name;
-
-    /** 精确 */
-    @Query
-    private Boolean enabled;
-
-    /** BETWEEN */
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-    @Query(type = Query.Type.BETWEEN)
-    private List<Date> createTime;
-}

+ 0 - 38
easydo-system/src/main/java/easydo/technology/system/dto/DeptSmallDto.java

@@ -1,38 +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 easydo.technology.system.dto;
-
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.io.Serializable;
-
-/**
-* @author Zheng Jie
-* @date 2019-6-10 16:32:18
-*/
-@Data
-@NoArgsConstructor
-public class DeptSmallDto implements Serializable {
-
-    private Long id;
-    private String name;
-
-    public DeptSmallDto(Long id, String name) {
-        this.id = id;
-        this.name = name;
-    }
-}

+ 0 - 36
easydo-system/src/main/java/easydo/technology/system/dto/DictDetailDto.java

@@ -1,36 +0,0 @@
-package easydo.technology.system.dto;
-
-import lombok.Data;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
-* @author jinjin
-* @date 2020-09-24
-*/
-@Data
-public class DictDetailDto implements Serializable {
-
-    private Long id;
-
-    private DictSmallDto dict;
-
-    private String label;
-
-    private String value;
-
-    private Integer dictSort;
-
-    private String createBy;
-
-    private String updateBy;
-
-    private Date createTime;
-
-    private Date updateTime;
-
-    private String dictName;
-
-    private String postName;
-}

+ 0 - 26
easydo-system/src/main/java/easydo/technology/system/dto/DictDetailQueryParam.java

@@ -1,26 +0,0 @@
-package easydo.technology.system.dto;
-
-import easydo.technology.annotation.Query;
-import lombok.Data;
-
-/**
-* @author jinjin
-* @date 2020-09-24
-*/
-@Data
-public class DictDetailQueryParam{
-
-    private String dictName;
-
-    /** 精确 */
-    @Query
-    private Long detailId;
-
-    /** 精确 */
-    @Query
-    private Long dictId;
-
-    /** 模糊 */
-    @Query(type = Query.Type.INNER_LIKE)
-    private String label;
-}

+ 0 - 24
easydo-system/src/main/java/easydo/technology/system/dto/DictDto.java

@@ -1,24 +0,0 @@
-package easydo.technology.system.dto;
-
-import easydo.technology.base.CommonDto;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-/**
- * @author jinjin
- * @date 2020-09-24
- */
-@Getter
-@Setter
-@NoArgsConstructor
-public class DictDto extends CommonDto {
-
-    private Long id;
-
-    // private List<DictDetailDto> dictDetails;
-
-    private String name;
-
-    private String description;
-}

+ 0 - 23
easydo-system/src/main/java/easydo/technology/system/dto/DictQueryParam.java

@@ -1,23 +0,0 @@
-package easydo.technology.system.dto;
-
-import easydo.technology.annotation.Query;
-import lombok.Data;
-
-/**
-* @author jinjin
-* @date 2020-09-24
-*/
-@Data
-public class DictQueryParam{
-
-    @Query(blurry = "name,description")
-    private String blurry;
-
-    /** 精确 */
-    @Query
-    private Long dictId;
-
-    /** 模糊 */
-    @Query(type = Query.Type.INNER_LIKE)
-    private String name;
-}

+ 0 - 32
easydo-system/src/main/java/easydo/technology/system/dto/DictSmallDto.java

@@ -1,32 +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 easydo.technology.system.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import java.io.Serializable;
-
-/**
-* @author Zheng Jie
-* @date 2019-04-10
-*/
-@Getter
-@Setter
-public class DictSmallDto implements Serializable {
-
-    private Long id;
-}

+ 0 - 50
easydo-system/src/main/java/easydo/technology/system/dto/JobDto.java

@@ -1,50 +0,0 @@
-package easydo.technology.system.dto;
-
-import easydo.technology.base.CommonDto;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import java.util.Objects;
-
-/**
- * @author jinjin
- * @date 2020-09-25
- */
-@Getter
-@Setter
-@NoArgsConstructor
-public class JobDto extends CommonDto {
-    private static final long serialVersionUID = 1L;
-
-    private Long id;
-
-    private String name;
-
-    private Boolean enabled;
-
-    private Integer jobSort;
-
-    public JobDto(String name, Boolean enabled) {
-        this.name = name;
-        this.enabled = enabled;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        JobDto dto = (JobDto) o;
-        return Objects.equals(id, dto.id) &&
-                Objects.equals(name, dto.name);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(id, name);
-    }
-}

+ 0 - 33
easydo-system/src/main/java/easydo/technology/system/dto/JobQueryParam.java

@@ -1,33 +0,0 @@
-package easydo.technology.system.dto;
-
-import easydo.technology.annotation.Query;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-import java.util.List;
-
-/**
-* @author jinjin
-* @date 2020-09-25
-*/
-@Data
-public class JobQueryParam{
-
-    /** 精确 */
-    @Query
-    private Long jobId;
-
-    /** 模糊 */
-    @Query(type = Query.Type.INNER_LIKE)
-    private String name;
-
-    /** 精确 */
-    @Query
-    private Boolean enabled;
-
-    /** BETWEEN */
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-    @Query(type = Query.Type.BETWEEN)
-    private List<Date> createTime;
-}

+ 0 - 34
easydo-system/src/main/java/easydo/technology/system/dto/JobSmallDto.java

@@ -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 easydo.technology.system.dto;
-
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.io.Serializable;
-
-/**
-* @author Zheng Jie
-* @date 2019-6-10 16:32:18
-*/
-@Data
-@NoArgsConstructor
-public class JobSmallDto implements Serializable {
-
-    private Long id;
-
-    private String name;
-}

+ 0 - 80
easydo-system/src/main/java/easydo/technology/system/dto/MenuDto.java

@@ -1,80 +0,0 @@
-package easydo.technology.system.dto;
-
-import easydo.technology.base.CommonDto;
-import lombok.Getter;
-import lombok.Setter;
-
-import java.util.List;
-import java.util.Objects;
-
-/**
- * @author jinjin
- * @date 2020-09-25
- */
-@Getter
-@Setter
-public class MenuDto extends CommonDto {
-    private static final long serialVersionUID = 1L;
-
-    private Long id;
-
-    private Long pid;
-
-    private List<MenuDto> children;
-
-    private Integer subCount;
-
-    private Integer type;
-
-    private String title;
-
-    private String componentName;
-
-    private String component;
-
-    private Integer menuSort;
-
-    private String icon;
-
-    private String path;
-
-    private Boolean iFrame;
-
-    private Boolean cache;
-
-    private Boolean hidden;
-
-    private String permission;
-
-    private String platformType;
-
-    public Boolean getHasChildren() {
-        return subCount > 0;
-    }
-
-    public Boolean getLeaf() {
-        return subCount <= 0;
-    }
-
-    public String getLabel() {
-        return title;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        MenuDto menuDto = (MenuDto) o;
-        return Objects.equals(id, menuDto.id);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(id);
-    }
-
-}

+ 0 - 35
easydo-system/src/main/java/easydo/technology/system/dto/MenuQueryParam.java

@@ -1,35 +0,0 @@
-package easydo.technology.system.dto;
-
-import easydo.technology.annotation.Query;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-import java.util.List;
-
-/**
-* @author jinjin
-* @date 2020-09-25
-*/
-@Data
-public class MenuQueryParam{
-
-    @Query(blurry = "title,component,permission")
-    private String blurry;
-
-    /** 精确 */
-    @Query
-    private Long menuId;
-
-    /** 精确 */
-    @Query
-    private Long pid;
-
-    @Query(type = Query.Type.IS_NULL, propName = "pid")
-    private Boolean pidIsNull;
-
-    /** BETWEEN */
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-    @Query(type = Query.Type.BETWEEN)
-    private List<Date> createTime;
-}

+ 0 - 50
easydo-system/src/main/java/easydo/technology/system/dto/RoleDto.java

@@ -1,50 +0,0 @@
-package easydo.technology.system.dto;
-
-import easydo.technology.base.CommonDto;
-import lombok.Getter;
-import lombok.Setter;
-
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * @author jinjin
- * @date 2020-09-25
- */
-@Getter
-@Setter
-public class RoleDto extends CommonDto {
-    private static final long serialVersionUID = 1L;
-
-    private Long id;
-
-    private Set<MenuDto> menus;
-
-    private Set<DeptDto> depts;
-
-    private String name;
-
-    private Integer level;
-
-    private String description;
-
-    private String dataScope;
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        RoleDto roleDto = (RoleDto) o;
-        return Objects.equals(id, roleDto.id);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(id);
-    }
-
-}

+ 0 - 34
easydo-system/src/main/java/easydo/technology/system/dto/RoleQueryParam.java

@@ -1,34 +0,0 @@
-package easydo.technology.system.dto;
-
-import easydo.technology.annotation.Query;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-import java.util.List;
-
-/**
-* @author jinjin
-* @date 2020-09-25
-*/
-@Data
-@Accessors(chain = true)
-public class RoleQueryParam{
-
-    @Query(blurry = "name,description")
-    private String blurry;
-
-    /** 精确 */
-    @Query
-    private Long roleId;
-
-    /** 模糊 */
-    @Query(type = Query.Type.INNER_LIKE)
-    private String name;
-
-    /** BETWEEN */
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-    @Query(type = Query.Type.BETWEEN)
-    private List<Date> createTime;
-}

+ 0 - 36
easydo-system/src/main/java/easydo/technology/system/dto/RoleSmallDto.java

@@ -1,36 +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 easydo.technology.system.dto;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @author Zheng Jie
- * @date 2018-11-23
- */
-@Data
-public class RoleSmallDto implements Serializable {
-
-    private Long id;
-
-    private String name;
-
-    private Integer level;
-
-    private String dataScope;
-}

+ 0 - 18
easydo-system/src/main/java/easydo/technology/system/dto/SysDeptDto.java

@@ -1,18 +0,0 @@
-package easydo.technology.system.dto;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import easydo.technology.system.domain.SysDept;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-import java.util.Set;
-
-@Data
-public class SysDeptDto extends SysDept {
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime beginCreateTime;
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime endCreateTime;
-
-    private Set<Long> ids;
-}

+ 0 - 86
easydo-system/src/main/java/easydo/technology/system/dto/UserDto.java

@@ -1,86 +0,0 @@
-package easydo.technology.system.dto;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import easydo.technology.base.CommonDto;
-import lombok.Getter;
-import lombok.Setter;
-
-import java.util.Date;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * @author jinjin
- * @date 2020-09-25
- */
-@Getter
-@Setter
-public class UserDto extends CommonDto {
-    private static final long serialVersionUID = 1L;
-
-    private Long id;
-
-    private Set<RoleSmallDto> roles;
-
-    private Set<JobSmallDto> jobs;
-
-    private DeptSmallDto dept;
-
-    private Long deptId;
-
-    private String username;
-
-    private String nickName;
-
-    private String gender;
-
-    private String phone;
-
-    private String email;
-
-    private String avatarName;
-
-    private String avatarPath;
-
-    @JsonIgnore
-    private String password;
-
-    @JsonIgnore
-    private Boolean isAdmin;
-
-    private Boolean enabled;
-
-    private Date pwdResetTime;
-
-    // 项目id
-    private Integer projectFpiId;
-   //用户类型
-    private String projectUserType;
-
-    private String features;
-
-    // //项目表的id
-    // private Integer fpiId;
-    //
-    // //项目表的项目名称
-    // private String projectName;
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        UserDto dto = (UserDto) o;
-        return Objects.equals(id, dto.id) &&
-                Objects.equals(username, dto.username);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(id, username);
-    }
-
-}

+ 0 - 39
easydo-system/src/main/java/easydo/technology/system/dto/UserQueryParam.java

@@ -1,39 +0,0 @@
-package easydo.technology.system.dto;
-
-import easydo.technology.annotation.Query;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
-* @author jinjin
-* @date 2020-09-25
-*/
-@Data
-// @DataPermission(fieldName = "dept_id")
-public class UserQueryParam{
-
-    /** 精确 */
-    @Query
-    private Long userId;
-
-    private Long deptId;
-
-    @Query(propName = "dept_id", type = Query.Type.IN)
-    private Set<Long> deptIds = new HashSet<>();
-
-    @Query(blurry = "email,username,nickName")
-    private String blurry;
-
-    /** 精确 */
-    @Query
-    private Long enabled;
-
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-    @Query(type = Query.Type.BETWEEN)
-    private List<Date> createTime;
-}

+ 0 - 31
easydo-system/src/main/java/easydo/technology/system/mapper/DeptMapper.java

@@ -1,31 +0,0 @@
-package easydo.technology.system.mapper;
-
-import easydo.technology.base.CommonMapper;
-import easydo.technology.system.domain.Dept;
-import org.apache.ibatis.annotations.Select;
-import org.springframework.stereotype.Repository;
-
-import java.util.Set;
-
-/**
-* @author jinjin
-* @date 2020-09-25
-*/
-@Repository
-public interface DeptMapper extends CommonMapper<Dept> {
-
-    @Select("select d.dept_id as id, d.* from sys_dept d where dept_id = #{id}")
-    Dept selectLink(Long id);
-
-    @Select("SELECT " +
-            "   d.dept_id as id, " +
-            "   d.* " +
-            "FROM " +
-            "   sys_dept d " +
-            "LEFT OUTER JOIN " +
-            "   sys_roles_depts rd ON d.dept_id = rd.dept_id " +
-            "WHERE " +
-            "   rd.role_id = #{roleId}")
-    Set<Dept> selectByRoleId(Long roleId);
-
-}

+ 0 - 34
easydo-system/src/main/java/easydo/technology/system/mapper/DictDetailMapper.java

@@ -1,34 +0,0 @@
-package easydo.technology.system.mapper;
-
-import java.util.List;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-
-import easydo.technology.system.domain.DictDetail;
-import easydo.technology.system.dto.DictDetailDto;
-import org.apache.ibatis.annotations.Insert;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-import org.springframework.stereotype.Repository;
-
-import easydo.technology.base.CommonMapper;
-
-
-/**
-* @author jinjin
-* @date 2020-09-24
-*/
-@Repository
-public interface DictDetailMapper extends CommonMapper<DictDetail> {
-
-    @Select("SELECT detail.detail_id as id, dict.dict_id as \"dict.id\", detail.* FROM sys_dict_detail detail\n" +
-            "LEFT JOIN sys_dict dict ON detail.dict_id = dict.dict_id\n" +
-            "WHERE dict.name = #{dictName}\n" +
-            "ORDER BY dict_sort ASC")
-    List<DictDetailDto> getDictDetailsByDictName(DictDetailDto detailDto);
-    @Select("SELECT detail.detail_id as id, dict.dict_id as \"dict.id\", detail.* FROM sys_dict_detail detail\n" +
-            "LEFT JOIN sys_dict dict ON detail.dict_id = dict.dict_id\n" +
-            "WHERE dict.name = #{dictName}\n" +
-            "ORDER BY dict_sort ASC")
-    IPage<DictDetailDto> getDictDetailsByDictNamePage(@Param("dictName") String dictName, IPage<DictDetailDto> page);
-}

+ 0 - 15
easydo-system/src/main/java/easydo/technology/system/mapper/DictMapper.java

@@ -1,15 +0,0 @@
-package easydo.technology.system.mapper;
-
-import easydo.technology.system.domain.Dict;
-import org.springframework.stereotype.Repository;
-
-import easydo.technology.base.CommonMapper;
-
-/**
-* @author jinjin
-* @date 2020-09-24
-*/
-@Repository
-public interface DictMapper extends CommonMapper<Dict> {
-
-}

+ 0 - 51
easydo-system/src/main/java/easydo/technology/system/mapper/MenuMapper.java

@@ -1,51 +0,0 @@
-package easydo.technology.system.mapper;
-
-import easydo.technology.base.CommonMapper;
-import easydo.technology.system.domain.Menu;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-import org.springframework.stereotype.Repository;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- * @author jinjin
- * @date 2020-09-25
- */
-@Repository
-public interface MenuMapper extends CommonMapper<Menu> {
-
-    @Select("SELECT m.menu_id as id, m.* FROM sys_roles_menus rm INNER JOIN sys_menu m ON rm.menu_id=m.menu_id WHERE rm.role_id=#{roleId}")
-    Set<Menu> selectLink(Long roleId);
-
-    @Select({"<script>" +
-            "SELECT " +
-            "   m.menu_id as id," +
-            "   m.permission " +
-            "FROM " +
-            "   sys_roles_menus rm " +
-            "   INNER JOIN sys_menu m ON rm.menu_id=m.menu_id " +
-            "WHERE " +
-            "   m.permission is not null AND"+
-            "   rm.role_id  IN"
-            + " <foreach item='item' index='index' collection='roleIds' open='(' separator=',' close=')'>" +
-            "        #{item} " +
-            "   </foreach>"
-            + "</script>"})
-    Set<Menu> selectByRoleIds(@Param("roleIds") Set<Long> roleIds);
-
-    @Select({"<script>SELECT m.menu_id as id, m.* FROM sys_menu m LEFT OUTER JOIN sys_roles_menus rm ON m.menu_id=rm.menu_id LEFT OUTER JOIN sys_role r ON rm.role_id=r.role_id WHERE r.role_id IN "
-            + "<foreach item='item' index='index' collection='roleIds' open='(' separator=',' close=')'> #{item} </foreach>"
-            + " ORDER BY m.menu_sort ASC</script>"})
-    LinkedHashSet<Menu> selectLinkRole(@Param("roleIds") Set<Long> roleIds);
-
-//    @Select({"<script>SELECT m.menu_id as id, m.* FROM sys_menu m LEFT OUTER JOIN sys_roles_menus rm ON m.menu_id=rm.menu_id LEFT OUTER JOIN sys_role r ON rm.role_id=r.role_id WHERE r.role_id IN "
-//            + "<foreach item='item' index='index' collection='roleIds' open='(' separator=',' close=')'> #{item} </foreach>"
-//            + " AND m.type = #{type} ORDER BY m.menu_sort ASC</script>"})
-////    @Select("select m.menu_id as id,m.* from sys_menu m where m.type = #{type}")
-//    LinkedHashSet<Menu> selectLinkRoles(@Param("roleIds") Set<Long> roleIds, @Param("type") Long type);
-
-}
-
-//    sys_menu  sys_roles_menus  sys_role

+ 0 - 51
easydo-system/src/main/java/easydo/technology/system/mapper/RoleMapper.java

@@ -1,51 +0,0 @@
-package easydo.technology.system.mapper;
-
-import easydo.technology.base.CommonMapper;
-import easydo.technology.system.domain.Role;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-import java.util.Set;
-
-/**
-* @author jinjin
-* @date 2020-09-25
-*/
-@Repository
-public interface RoleMapper extends CommonMapper<Role> {
-    @Select("SELECT r.role_id as id, r.* FROM sys_role r LEFT OUTER JOIN sys_users_roles ur ON r.role_id=ur.role_id LEFT OUTER JOIN sys_user u ON ur.user_id=u.user_id WHERE u.user_id=#{userId}")
-    Set<Role> selectLink(Long userId);
-
-    /**
-     * 根据用户ID查询
-     *
-     * @param id 用户ID
-     * @return /
-     */
-    @Select("SELECT r.* FROM sys_role r, sys_users_roles u WHERE " + "r.role_id = u.role_id AND u.user_id = #{id}")
-    Set<Role> findByUserId(@Param("id") Long id);
-
-    /**
-     * 根据部门查询
-     *
-     * @param deptIds /
-     * @return /
-     */
-    @Select("<script>select count(1) from sys_role r, sys_roles_depts d where "
-            + "r.role_id = d.role_id and d.dept_id in "
-            + "<foreach item='item' index='index' collection='deptIds' open='(' separator=',' close=')'> #{item} </foreach>"
-            + "</script>")
-    int countByDepts(@Param("deptIds") Set<Long> deptIds);
-
-    /**
-     * 根据菜单Id查询
-     * @param menuIds /
-     * @return /
-     */
-    @Select("SELECT r.* FROM sys_role r, sys_roles_menus m WHERE " +
-            "r.role_id = m.role_id AND m.menu_id in #{menuIds}")
-    List<Role> findInMenuId(@Param("menuIds") List<Long> menuIds);
-
-}

+ 0 - 14
easydo-system/src/main/java/easydo/technology/system/mapper/RolesDeptsMapper.java

@@ -1,14 +0,0 @@
-package easydo.technology.system.mapper;
-
-import easydo.technology.base.CommonMapper;
-import easydo.technology.system.domain.RolesDepts;
-import org.springframework.stereotype.Repository;
-
-/**
-* @author jinjin
-* @date 2020-09-25
-*/
-@Repository
-public interface RolesDeptsMapper extends CommonMapper<RolesDepts> {
-
-}

+ 0 - 14
easydo-system/src/main/java/easydo/technology/system/mapper/RolesMenusMapper.java

@@ -1,14 +0,0 @@
-package easydo.technology.system.mapper;
-
-import easydo.technology.base.CommonMapper;
-import easydo.technology.system.domain.RolesMenus;
-import org.springframework.stereotype.Repository;
-
-/**
-* @author jinjin
-* @date 2020-09-25
-*/
-@Repository
-public interface RolesMenusMapper extends CommonMapper<RolesMenus> {
-
-}

+ 0 - 42
easydo-system/src/main/java/easydo/technology/system/mapper/SysDeptMapper.java

@@ -1,42 +0,0 @@
-package easydo.technology.system.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import easydo.technology.system.domain.SysDept;
-import org.apache.ibatis.annotations.Select;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-/**
- * <p>
- * 部门 Mapper 接口
- * </p>
- *
- * @author fr
- * @since 2022-01-26
- */
-@Repository
-public interface SysDeptMapper extends BaseMapper<SysDept> {
-    @Select("SELECT\n" +
-            "    ID.LEVELs,\n" +
-            "    DATA.*\n" +
-            "FROM\n" +
-            "    (\n" +
-            "    SELECT\n" +
-            "        @ids AS _ids,\n" +
-            "        ( SELECT @ids := GROUP_CONCAT( dept_id ) FROM sys_dept WHERE FIND_IN_SET(pid, @ids ) ) AS cids,\n" +
-            "        @l := @l + 1 AS LEVELs\n" +
-            "    FROM\n" +
-            "        sys_dept,\n" +
-            "        ( SELECT @ids := #{id}, @l := 0 ) b\n" +
-            "    WHERE\n" +
-            "        @ids IS NOT NULL\n" +
-            "    ) ID,\n" +
-            "    sys_dept DATA\n" +
-            "WHERE\n" +
-            "    FIND_IN_SET( DATA.dept_id, ID._ids )\n" +
-            "ORDER BY\n" +
-            "   dept_sort")
-    List<SysDept> selectChilds(int id);
-
-}

+ 0 - 106
easydo-system/src/main/java/easydo/technology/system/mapper/UserMapper.java

@@ -1,106 +0,0 @@
-package easydo.technology.system.mapper;
-
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.toolkit.Constants;
-import easydo.technology.base.CommonMapper;
-import easydo.technology.system.domain.User;
-import org.apache.ibatis.annotations.*;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author jinjin
- * @date 2020-09-25
- */
-@Repository
-public interface UserMapper extends CommonMapper<User> {
-
-        /**
-         * ${ew.customSqlSegment}” (自定义sql段),wrapper不能为null
-         */
-        @Results({
-                        @Result(column = "dept_id", property = "dept", one = @One(select = "easydo.technology.system.mapper.DeptMapper.selectLink")),
-                        @Result(column = "job_id", property = "job", one = @One(select = "easydo.technology.system.mapper.JobMapper.selectLink")), })
-        @Select("select u.user_id as id, u.* from sys_user u ${ew.customSqlSegment}")
-        User selectLink(@Param(Constants.WRAPPER) Wrapper<User> query);
-
-        /**
-         * 根据角色查询用户
-         *
-         * @param roleId /
-         * @return /
-         */
-        @Select("SELECT u.user_id as id, u.* FROM sys_user u, sys_users_roles r WHERE"
-                        + " u.user_id = r.user_id AND r.role_id = #{roleId}")
-        List<User> findByRoleId(@Param("roleId") Long roleId);
-
-        /**
-         * 根据角色中的部门查询
-         *
-         * @param roleId /
-         * @return /
-         */
-        @Select("SELECT u.user_id as id, u.* FROM sys_user u, sys_users_roles r, sys_roles_depts d WHERE "
-                        + "u.user_id = r.user_id AND r.role_id = d.role_id AND r.role_id = #{roleId} group by u.user_id")
-        List<User> findByDeptRoleId(@Param("roleId") Long roleId);
-
-        /**
-         * 根据菜单查询
-         *
-         * @param menuId 菜单ID
-         * @return /
-         */
-        @Select("SELECT u.user_id as id, u.* FROM sys_user u, sys_users_roles ur, sys_roles_menus rm WHERE "
-                        + "u.user_id = ur.user_id AND ur.role_id = rm.role_id AND rm.menu_id = #{menuId} group by u.user_id")
-        List<User> findByMenuId(@Param("menuId") Long menuId);
-
-        /**
-         * 根据岗位查询
-         *
-         * @param ids /
-         * @return /
-         */
-        @Select("<script>SELECT count(1) FROM sys_user u, sys_users_jobs j WHERE u.user_id = j.user_id AND j.job_id IN "
-                        + "<foreach item='item' index='index' collection='ids' open='(' separator=',' close=')'> #{item} </foreach>"
-                        + "</script>")
-        int countByJobs(@Param("ids") Set<Long> ids);
-
-        /**
-         * 根据部门查询
-         *
-         * @param deptIds /
-         * @return /
-         */
-        @Select("<script>SELECT count(1) FROM sys_user u WHERE u.dept_id IN "
-                        + "<foreach item='item' index='index' collection='deptIds' open='(' separator=',' close=')'> #{item} </foreach>"
-                        + "</script>")
-        int countByDepts(@Param("deptIds") Set<Long> deptIds);
-
-        /**
-         * 根据角色查询
-         *
-         * @return /
-         */
-        @Select("<script>SELECT count(1) FROM sys_user u, sys_users_roles r WHERE "
-                        + "u.user_id = r.user_id AND r.role_id in "
-                        + "<foreach item='item' index='index' collection='ids' open='(' separator=',' close=')'> #{item} </foreach>"
-                        + "</script>")
-        int countByRoles(@Param("ids") Set<Long> ids);
-
-        @Update("UPDATE sys_user SET project_fpi_id = null WHERE user_id = #{userID}")
-        int upUserProjectIDNull(@Param("userID") Long userID);
-
-        @Select("select user_id AS doId, nick_name from sys_user where  user_id != 1")
-        public List<User> findAllUser();
-
-        @Select("select\n" +
-                "project_fpi_id\n" +
-                "from\n" +
-                "sys_user\n" +
-                "where\n" +
-                "user_id = #{id}")
-        Long getPorId(Long id);
-
-}

+ 0 - 14
easydo-system/src/main/java/easydo/technology/system/mapper/UsersRolesMapper.java

@@ -1,14 +0,0 @@
-package easydo.technology.system.mapper;
-
-import easydo.technology.base.CommonMapper;
-import easydo.technology.system.domain.UsersRoles;
-import org.springframework.stereotype.Repository;
-
-/**
-* @author jinjin
-* @date 2020-09-25
-*/
-@Repository
-public interface UsersRolesMapper extends CommonMapper<UsersRoles> {
-
-}

+ 26 - 0
easydo-system/src/main/java/easydo/technology/system/model/SysDept.java

@@ -0,0 +1,26 @@
+package easydo.technology.system.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import easydo.technology.model.CommonModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SysDept extends CommonModel {
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    private Long pid;
+
+    private String name;
+
+    private Integer deptSort;
+
+    private String firmFunctionary;
+
+    private String firmFunctionaryPhone;
+
+    private String remark;
+}

+ 20 - 0
easydo-system/src/main/java/easydo/technology/system/model/SysJob.java

@@ -0,0 +1,20 @@
+package easydo.technology.system.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import easydo.technology.model.CommonModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SysJob extends CommonModel {
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    private String name;
+
+    private Boolean enabled;
+
+    private Integer jobSort;
+}

+ 34 - 0
easydo-system/src/main/java/easydo/technology/system/model/SysMenu.java

@@ -0,0 +1,34 @@
+package easydo.technology.system.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import easydo.technology.model.CommonModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SysMenu extends CommonModel {
+
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    private Long pid;
+
+    private Integer type;
+
+    private String title;
+
+    private String component;
+
+    private Integer menuSort;
+
+    private String icon;
+
+    private String path;
+
+    private Boolean iframe;
+
+    private Boolean hidden;
+
+}

+ 22 - 0
easydo-system/src/main/java/easydo/technology/system/model/SysRole.java

@@ -0,0 +1,22 @@
+package easydo.technology.system.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import easydo.technology.model.CommonModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SysRole extends CommonModel {
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    private String name;
+
+    private Integer level;
+
+    private String description;
+
+    private String dataScope;
+}

+ 16 - 0
easydo-system/src/main/java/easydo/technology/system/model/SysRolesMenus.java

@@ -0,0 +1,16 @@
+package easydo.technology.system.model;
+
+import easydo.technology.annotation.NotTableField;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class SysRolesMenus {
+    private Long roleId;
+
+    private Long menuId;
+
+    @NotTableField
+    private List<Long> menuIdList;
+}

+ 40 - 0
easydo-system/src/main/java/easydo/technology/system/model/SysUser.java

@@ -0,0 +1,40 @@
+package easydo.technology.system.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import easydo.technology.annotation.NotTableField;
+import easydo.technology.model.CommonModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SysUser extends CommonModel {
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    private Long deptId;
+
+    private String username;
+
+    private String nickName;
+
+    private String gender;
+
+    private String phone;
+
+    private String email;
+
+    private String password;
+
+    private String pwdResetTime;
+
+    private String features;
+
+    @NotTableField
+    private SysDept dept;
+    @NotTableField
+    private List<SysRole> roleList;
+}

+ 10 - 0
easydo-system/src/main/java/easydo/technology/system/model/SysUsersJobs.java

@@ -0,0 +1,10 @@
+package easydo.technology.system.model;
+
+import lombok.Data;
+
+@Data
+public class SysUsersJobs {
+    private Long userId;
+
+    private Long jobId;
+}

+ 10 - 0
easydo-system/src/main/java/easydo/technology/system/model/SysUsersRoles.java

@@ -0,0 +1,10 @@
+package easydo.technology.system.model;
+
+import lombok.Data;
+
+@Data
+public class SysUsersRoles {
+    private Long userId;
+
+    private Long roleId;
+}

+ 0 - 75
easydo-system/src/main/java/easydo/technology/system/rest/DeptController.java

@@ -1,75 +0,0 @@
-package easydo.technology.system.rest;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import easydo.technology.system.domain.SysDept;
-import easydo.technology.system.dto.SysDeptDto;
-import easydo.technology.system.mapper.SysDeptMapper;
-import easydo.technology.system.service.ISysDeptService;
-import easydo.technology.utils.StringUtil;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-
-/**
- * @author Zheng Jie
- * @date 2019-03-25
- */
-@RestController
-@RequestMapping("/dept")
-public class DeptController {
-    @Resource
-    SysDeptMapper sysDeptMapper;
-    @Resource
-    ISysDeptService sysDeptService;
-
-    @RequestMapping("/getList")
-    public Object getList(@RequestBody SysDeptDto dto) {
-        QueryWrapper<SysDept> wrapper = new QueryWrapper<>();
-        if (StringUtil.isNotEmpty(dto.getPid())) {
-            if (dto.getPid() == 0) {
-                wrapper.isNull("pid");
-            } else {
-                wrapper.eq("pid", dto.getPid());
-            }
-        }
-        if(StringUtil.isNotEmpty(dto.getName())){
-            wrapper.like("name", dto.getName());
-        }
-        if (StringUtil.isNotEmpty(dto.getEnabled())) {
-            wrapper.eq("enabled", dto.getEnabled());
-        }
-        if (StringUtil.isNotEmpty(dto.getBeginCreateTime())) {
-            wrapper.gt("create_time", dto.getBeginCreateTime());
-        }
-        if (StringUtil.isNotEmpty(dto.getEndCreateTime())) {
-            wrapper.lt("create_time", dto.getEndCreateTime());
-        }
-        List<SysDept> deptList = sysDeptMapper.selectList(wrapper);
-        return new ResponseEntity<>(deptList, HttpStatus.OK);
-    }
-
-    @RequestMapping("/save")
-    public Object save(@RequestBody SysDept dept) {
-        sysDeptService.saveDept(dept);
-        return new ResponseEntity<>(dept, HttpStatus.OK);
-    }
-
-    @RequestMapping("/update")
-    public Object update(@RequestBody SysDept dept) throws Exception {
-        sysDeptService.updateDept(dept);
-        return new ResponseEntity<>(dept, HttpStatus.OK);
-    }
-
-    @RequestMapping("/remove")
-    public Object remove(@RequestBody SysDeptDto dept) throws Exception {
-        sysDeptService.verification(dept.getIds());
-        sysDeptService.removeByIds(dept.getIds());
-        return new ResponseEntity<>(dept, HttpStatus.OK);
-    }
-}

+ 0 - 95
easydo-system/src/main/java/easydo/technology/system/rest/DictController.java

@@ -1,95 +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 easydo.technology.system.rest;
-
-import java.io.IOException;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletResponse;
-
-import easydo.technology.system.domain.Dict;
-import easydo.technology.system.dto.DictQueryParam;
-import org.springframework.data.domain.Pageable;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import easydo.technology.exception.BadRequestException;
-import easydo.technology.system.service.DictService;
-import lombok.RequiredArgsConstructor;
-
-/**
-* @author Zheng Jie
-* @date 2019-04-10
-*/
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/dict")
-public class DictController {
-
-    private final DictService dictService;
-    private static final String ENTITY_NAME = "dict";
-
-    @GetMapping(value = "/download")
-    @PreAuthorize("@el.check('dict:list')")
-    public void download(HttpServletResponse response, DictQueryParam criteria) throws IOException {
-        dictService.download(dictService.queryAll(criteria), response);
-    }
-
-    @GetMapping(value = "/all")
-    @PreAuthorize("@el.check('dict:list')")
-    public ResponseEntity<Object> queryAll(){
-        return new ResponseEntity<>(dictService.queryAll(new DictQueryParam()),HttpStatus.OK);
-    }
-
-    @GetMapping
-    @PreAuthorize("@el.check('dict:list')")
-    public ResponseEntity<Object> query(DictQueryParam query, Pageable pageable){
-        return new ResponseEntity<>(dictService.queryAll(query,pageable),HttpStatus.OK);
-    }
-
-    @PostMapping
-    @PreAuthorize("@el.check('dict:add')")
-    public ResponseEntity<Object> create(@Validated @RequestBody Dict resources){
-        if (resources.getId() != null) {
-            throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
-        }
-        dictService.save(resources);
-        return new ResponseEntity<>(HttpStatus.CREATED);
-    }
-
-    @PutMapping
-    @PreAuthorize("@el.check('dict:edit')")
-    public ResponseEntity<Object> update(@RequestBody Dict resources){
-        dictService.updateById(resources);
-        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
-    }
-
-    @DeleteMapping
-    @PreAuthorize("@el.check('dict:del')")
-    public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
-        dictService.removeByIds(ids);
-        return new ResponseEntity<>(HttpStatus.OK);
-    }
-}

+ 0 - 100
easydo-system/src/main/java/easydo/technology/system/rest/DictDetailController.java

@@ -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 easydo.technology.system.rest;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import easydo.technology.system.dto.DictDetailDto;
-import easydo.technology.system.dto.DictDetailQueryParam;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.web.PageableDefault;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import easydo.technology.exception.BadRequestException;
-import easydo.technology.system.service.DictDetailService;
-import lombok.RequiredArgsConstructor;
-
-/**
-* @author Zheng Jie
-* @date 2019-04-10
-*/
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/dictDetail")
-public class DictDetailController {
-
-    private final DictDetailService dictDetailService;
-    private static final String ENTITY_NAME = "dictDetail";
-
-    @GetMapping
-    public ResponseEntity<Object> query(DictDetailQueryParam query,
-                                        @PageableDefault(sort = {"dictSort"}, direction = Sort.Direction.ASC) Pageable pageable){
-        if (query.getDictName() == null && query.getDictName().isEmpty()) {
-            return new ResponseEntity<>(dictDetailService.queryAll(query, pageable), HttpStatus.OK);
-        } else {
-            return new ResponseEntity<>(dictDetailService.getDictByName(query.getDictName(), pageable), HttpStatus.OK);
-        }
-    }
-
-    @GetMapping(value = "/map")
-    public ResponseEntity<Object> getDictDetailMaps(@RequestParam String dictName){
-        String[] names = dictName.split("[,,]");
-        Map<String, List<DictDetailDto>> dictMap = new HashMap<>(5);
-        for (String name : names) {
-            dictMap.put(name, dictDetailService.getDictByName(name));
-        }
-        return new ResponseEntity<>(dictMap, HttpStatus.OK);
-    }
-
-    @PostMapping
-    @PreAuthorize("@el.check('dict:add')")
-    public ResponseEntity<Object> create(@Validated @RequestBody DictDetailDto resources){
-        if (resources.getId() != null) {
-            throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
-        }
-        dictDetailService.save(resources);
-        return new ResponseEntity<>(HttpStatus.CREATED);
-    }
-
-    @PutMapping
-    @PreAuthorize("@el.check('dict:edit')")
-    public ResponseEntity<Object> update(@RequestBody DictDetailDto resources){
-        dictDetailService.updateById(resources);
-        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
-    }
-
-    @DeleteMapping(value = "/{id}")
-    @PreAuthorize("@el.check('dict:del')")
-    public ResponseEntity<Object> delete(@PathVariable Long id){
-        dictDetailService.removeById(id);
-        return new ResponseEntity<>(HttpStatus.OK);
-    }
-}

+ 0 - 142
easydo-system/src/main/java/easydo/technology/system/rest/MenuController.java

@@ -1,142 +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 easydo.technology.system.rest;
-
-import com.alibaba.fastjson.JSONObject;
-import easydo.technology.exception.BadRequestException;
-import easydo.technology.system.domain.Menu;
-import easydo.technology.system.dto.MenuDto;
-import easydo.technology.system.dto.MenuQueryParam;
-import easydo.technology.system.service.MenuService;
-import easydo.technology.utils.PageUtil;
-import easydo.technology.utils.SecurityUtils;
-import lombok.Delegate;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author Zheng Jie
- * @date 2018-12-03
- */
-
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/menus")
-public class MenuController {
-
-    private final MenuService menuService;
-    // private final MenuMapper menuMapper;
-    private static final String ENTITY_NAME = "menu";
-
-    @GetMapping
-    @PreAuthorize("@el.check('menu:list')")
-    public ResponseEntity<Object> query(MenuQueryParam criteria) throws Exception {
-        List<MenuDto> menuDtoList = menuService.queryAll(criteria, true);
-        return new ResponseEntity<>(PageUtil.toPage(menuDtoList, menuDtoList.size()), HttpStatus.OK);
-    }
-
-    @GetMapping(value = "/lazy")
-    @PreAuthorize("@el.check('menu:list','roles:list')")
-    public ResponseEntity<Object> query(@RequestParam Long pid, @RequestParam String platformType) {
-        return new ResponseEntity<>(menuService.getMenus(pid, platformType), HttpStatus.OK);
-    }
-
-    @GetMapping(value = "/build")
-    public ResponseEntity<Object> buildMenus() {
-        List<MenuDto> menuDtoList = menuService.findByUser(SecurityUtils.getCurrentUserId());
-        List<MenuDto> menuDtos = menuService.buildTree(menuDtoList);
-        return new ResponseEntity<>(menuService.buildMenus(menuDtos), HttpStatus.OK);
-    }
-
-
-//    @RequestMapping(value = "/appletsMenus")
-//    @ApiOperation("获取前端所需小程序菜单")
-//    public ResponseEntity<Object> appletsMenus() {
-//        List<MenuDto> menuDtoList = menuService.findByUser(SecurityUtils.getCurrentUserId());
-//        menuDtoList = menuDtoList.stream().filter(model -> model.getPlatformType().equals("easydo-mini-iot")).collect(Collectors.toList());
-//        return new ResponseEntity<>(menuService.buildMenus(menuDtoList), HttpStatus.OK);
-//    }
-
-//    @GetMapping(value = "/buildTransfer")
-//    public ResponseEntity<Object> buildTransfer() {
-//    @ApiOperation("获取前端所需菜单")
-//        List<MenuDto> menuDtoList = menuService.findByUser(SecurityUtils.getCurrentUserId(), "easydo-transfer");
-//        menuDtoList = menuDtoList.stream().filter(model -> model.getType() < 2).collect(Collectors.toList());
-//        List<MenuDto> menuDtos = menuService.buildTree(menuDtoList);
-//        return new ResponseEntity<>(menuService.buildMenus(menuDtos), HttpStatus.OK);
-//    }
-
-    @PostMapping("/superior")
-    @PreAuthorize("@el.check('menu:list')")
-    public ResponseEntity<Object> getSuperior(@RequestBody List<Long> ids) throws Exception {
-        Set<MenuDto> menuDtos = new LinkedHashSet<>();
-        if (ids != null && !ids.isEmpty()) {
-            for (Long id : ids) {
-                MenuDto menuDto = menuService.findById(id);
-                menuDtos.addAll(menuService.getSuperior(menuDto, new ArrayList<>()));
-            }
-            return new ResponseEntity<>(menuService.buildTree(new ArrayList<>(menuDtos)), HttpStatus.OK);
-        }
-        throw new Exception("参数缺失");
-    }
-
-    @PostMapping
-    @PreAuthorize("@el.check('menu:add')")
-    public ResponseEntity<Object> create(@Validated @RequestBody Menu resources) {
-        if (resources.getId() != null) {
-            throw new BadRequestException("A new " + ENTITY_NAME + " cannot already have an ID");
-        }
-        menuService.save(resources);
-        return new ResponseEntity<>(resources, HttpStatus.OK);
-    }
-
-    @PutMapping
-    @PreAuthorize("@el.check('menu:edit')")
-    public ResponseEntity<Object> update(@Validated(Menu.Update.class) @RequestBody Menu resources) {
-        menuService.updateById(resources);
-        return new ResponseEntity<>(resources, HttpStatus.OK);
-    }
-
-    @DeleteMapping
-    @PreAuthorize("@el.check('menu:del')")
-    public ResponseEntity<Object> delete(@RequestBody Set<Long> ids) {
-        Set<Menu> menuSet = new HashSet<>();
-        List<Menu> menuList = new ArrayList<>();
-        for (Long id : ids) {
-            Menu menu = menuService.getById(id);
-            menuList.add(menu);
-        }
-        menuSet = menuService.getDeleteMenus(menuList, menuSet);
-        ids = menuSet.stream().map(Menu::getId).collect(Collectors.toSet());
-        menuService.removeByIds(ids);
-        return new ResponseEntity<>(HttpStatus.OK);
-    }
-
-    @GetMapping(value = "/download")
-    @PreAuthorize("@el.check('menu:list')")
-    public void download(HttpServletResponse response, MenuQueryParam criteria) throws Exception {
-        menuService.download(menuService.queryAll(criteria, false), response);
-    }
-
-}

+ 0 - 139
easydo-system/src/main/java/easydo/technology/system/rest/RoleController.java

@@ -1,139 +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 easydo.technology.system.rest;
-
-import easydo.technology.exception.BadRequestException;
-import easydo.technology.system.domain.Role;
-import easydo.technology.system.dto.RoleDto;
-import easydo.technology.system.dto.RoleQueryParam;
-import easydo.technology.system.dto.RoleSmallDto;
-import easydo.technology.system.service.RoleService;
-import easydo.technology.utils.SecurityUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.data.domain.Pageable;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author Zheng Jie
- * @date 2018-12-03
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/roles")
-public class RoleController {
-
-    private final RoleService roleService;
-
-    private static final String ENTITY_NAME = "role";
-
-    @GetMapping(value = "/{id}")
-    @PreAuthorize("@el.check('roles:list')")
-    public ResponseEntity<Object> query(@PathVariable Long id) {
-        return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK);
-    }
-
-    @GetMapping(value = "/download")
-    @PreAuthorize("@el.check('role:list')")
-    public void download(HttpServletResponse response, RoleQueryParam criteria) throws IOException {
-        roleService.download(roleService.queryAll(criteria), response);
-    }
-
-    @GetMapping(value = "/all")
-    @PreAuthorize("@el.check('roles:list','user:add','user:edit')")
-    public ResponseEntity<Object> query() {
-        return new ResponseEntity<>(roleService.queryAll(), HttpStatus.OK);
-    }
-
-    @GetMapping
-    @PreAuthorize("@el.check('roles:list')")
-    public ResponseEntity<Object> query(RoleQueryParam criteria, Pageable pageable) {
-        return new ResponseEntity<>(roleService.queryAll(criteria, pageable), HttpStatus.OK);
-    }
-
-    @GetMapping(value = "/level")
-    public ResponseEntity<Object> getLevel() {
-        Map<String, Object> map = new HashMap<>();
-        map.put("level", getLevels(null));
-        return new ResponseEntity<>(map, HttpStatus.OK);
-    }
-
-    @PostMapping
-    @PreAuthorize("@el.check('roles:add')")
-    public ResponseEntity<Object> create(@Validated @RequestBody RoleDto resources) {
-        if (resources.getId() != null) {
-            throw new BadRequestException("A new " + ENTITY_NAME + " cannot already have an ID");
-        }
-        getLevels(resources.getLevel());
-        roleService.save(resources);
-        return new ResponseEntity<>(HttpStatus.CREATED);
-    }
-
-    @PutMapping
-    @PreAuthorize("@el.check('roles:edit')")
-    public ResponseEntity<Object> update(@Validated(Role.Update.class) @RequestBody RoleDto resources) {
-        getLevels(resources.getLevel());
-        roleService.updateById(resources);
-        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
-    }
-
-    @PutMapping(value = "/menu")
-    @PreAuthorize("@el.check('roles:edit')")
-    public ResponseEntity<Object> updateMenu(@RequestBody RoleDto resources) {
-        RoleDto role = roleService.findById(resources.getId());
-        getLevels(role.getLevel());
-        roleService.updateMenu(resources);
-        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
-    }
-
-    @DeleteMapping
-    @PreAuthorize("@el.check('roles:del')")
-    public ResponseEntity<Object> delete(@RequestBody Set<Long> ids) {
-        for (Long id : ids) {
-            RoleDto role = roleService.findById(id);
-            getLevels(role.getLevel());
-        }
-        // 验证是否被用户关联
-        roleService.verification(ids);
-        roleService.removeByIds(ids);
-        return new ResponseEntity<>(HttpStatus.OK);
-    }
-
-    /**
-     * 获取用户的角色级别
-     * 
-     * @return /
-     */
-    private int getLevels(Integer level) {
-        List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream()
-                .map(RoleSmallDto::getLevel).collect(Collectors.toList());
-        int min = Collections.min(levels);
-        if (level != null) {
-            if (level < min) {
-                throw new BadRequestException("权限不足,你的角色级别:" + min + ",低于操作的角色级别:" + level);
-            }
-        }
-        return min;
-    }
-}

+ 65 - 0
easydo-system/src/main/java/easydo/technology/system/rest/SysDeptController.java

@@ -0,0 +1,65 @@
+package easydo.technology.system.rest;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.exception.BizException;
+import easydo.technology.system.model.SysDept;
+import easydo.technology.system.model.SysRole;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/sysDept")
+public class SysDeptController {
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+
+    @RequestMapping(value = "/getList")
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        List<SysDept> list = jdbcClient.getJdbcList(map, SysDept.class);
+        return new ResponseEntity<>(list, HttpStatus.OK);
+    }
+
+
+    @RequestMapping(value = "/save")
+    public Object add(@RequestBody SysDept model) throws Exception {
+        jdbcClient.jdbcInsert(model);
+        return new ResponseEntity<>(model, HttpStatus.OK);
+    }
+
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody SysDept model) throws Exception {
+        jdbcClient.jdbcUpdateById(model);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object deleteProgram(@RequestBody SysDept model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            SysDept childrenDept = new SysDept();
+            childrenDept.setPid(model.getId());
+            int count = jdbcClient.getJdbcCount(childrenDept, connection);
+            if (count > 0) {
+                throw new BizException("存在下级部门,无法删除");
+            }
+
+            jdbcClient.jdbcRemoveById(model, connection);
+            return new ResponseEntity<>(HttpStatus.OK);
+        } finally {
+            connection.close();
+        }
+    }
+
+}

+ 0 - 22
easydo-system/src/main/java/easydo/technology/system/rest/SysDictController.java

@@ -1,22 +0,0 @@
-package easydo.technology.system.rest;
-
-import easydo.technology.system.dto.DictDetailDto;
-import easydo.technology.system.mapper.DictDetailMapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-@RestController
-@RequestMapping("/sysDict")
-public class SysDictController {
-    @Autowired
-    private DictDetailMapper dictDetailMapper;
-    @RequestMapping(value = "/selectDict")
-    public List<DictDetailDto> selectDict(@RequestBody DictDetailDto detailDto){
-        List<DictDetailDto> dictDetailDtos = dictDetailMapper.getDictDetailsByDictName(detailDto);
-        return dictDetailDtos;
-    }
-}

+ 54 - 0
easydo-system/src/main/java/easydo/technology/system/rest/SysJobController.java

@@ -0,0 +1,54 @@
+package easydo.technology.system.rest;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.system.model.SysJob;
+import easydo.technology.system.model.SysRole;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/sysJob")
+public class SysJobController {
+    @Resource
+    JdbcClient jdbcClient;
+
+    @RequestMapping(value = "/getList")
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        List<SysJob> list = jdbcClient.getJdbcList(map, SysJob.class);
+        return new ResponseEntity<>(list, HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/getPage")
+    public Object getPage(@RequestBody Map<String, Object> map) throws Exception {
+        Map<String, Object> recordsPage = jdbcClient.getJdbcPage(map, SysJob.class);
+        return new ResponseEntity<>(recordsPage, HttpStatus.OK);
+    }
+
+
+    @RequestMapping(value = "/save")
+    public Object add(@RequestBody SysJob model) throws Exception {
+        jdbcClient.jdbcInsert(model);
+        return new ResponseEntity<>(model, HttpStatus.OK);
+    }
+
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody SysJob model) throws Exception {
+        jdbcClient.jdbcUpdateById(model);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object deleteProgram(@RequestBody SysJob model) throws Exception {
+        jdbcClient.jdbcRemoveById(model);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+}

+ 100 - 0
easydo-system/src/main/java/easydo/technology/system/rest/SysMenuController.java

@@ -0,0 +1,100 @@
+package easydo.technology.system.rest;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.exception.BizException;
+import easydo.technology.system.model.SysMenu;
+import easydo.technology.system.model.SysRolesMenus;
+import easydo.technology.system.model.SysUsersRoles;
+import easydo.technology.utils.SecurityUtils;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/sysMenu")
+public class SysMenuController {
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+
+    @RequestMapping(value = "/getList")
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        List<SysMenu> list = jdbcClient.getJdbcList(map, SysMenu.class);
+        return new ResponseEntity<>(list, HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/build")
+    public ResponseEntity<Object> buildMenus() throws Exception {
+        Map<String, Object> paramMap = new HashMap<>();
+        SysUsersRoles usersRoles = new SysUsersRoles();
+        usersRoles.setUserId(SecurityUtils.getCurrentUserId());
+        List<SysUsersRoles> rolesList = jdbcClient.getJdbcList(usersRoles);
+        List<Long> roleIdList = rolesList.stream().map(SysUsersRoles::getRoleId).collect(Collectors.toList());
+
+        paramMap.put("roleIdIn", roleIdList);
+        List<SysRolesMenus> rolesMenusList = jdbcClient.getJdbcList(paramMap, SysRolesMenus.class);
+        List<Long> menuIdList = rolesMenusList.stream().map(SysRolesMenus::getMenuId).distinct().collect(Collectors.toList());
+
+        List<SysMenu> menuList = new ArrayList<>();
+        if (!menuIdList.isEmpty()) {
+            paramMap.clear();
+            paramMap.put("idIn", menuIdList);
+            menuList = jdbcClient.getJdbcList(paramMap, SysMenu.class);
+        }
+        return new ResponseEntity<>(menuList, HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/save")
+    public Object add(@RequestBody SysMenu menu) throws Exception {
+        jdbcClient.jdbcInsert(menu);
+        return new ResponseEntity<>(menu, HttpStatus.OK);
+    }
+
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody SysMenu menu) throws Exception {
+        jdbcClient.jdbcUpdateById(menu);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object deleteProgram(@RequestBody SysMenu menu) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            SysMenu childrenMenu = new SysMenu();
+            childrenMenu.setPid(menu.getId());
+            int count = jdbcClient.getJdbcCount(childrenMenu, connection);
+            if (count > 0) {
+                throw new BizException("存在下级子菜单,无法删除");
+            }
+
+            SysRolesMenus rolesMenus = new SysRolesMenus();
+            rolesMenus.setMenuId(menu.getId());
+            jdbcClient.jdbcRemove(rolesMenus, connection);
+
+            jdbcClient.jdbcRemoveById(menu, connection);
+            connection.commit();
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+
+    }
+
+}

+ 53 - 0
easydo-system/src/main/java/easydo/technology/system/rest/SysRoleController.java

@@ -0,0 +1,53 @@
+package easydo.technology.system.rest;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.system.model.SysRole;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/sysRole")
+public class SysRoleController {
+    @Resource
+    JdbcClient jdbcClient;
+
+    @RequestMapping(value = "/getList")
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        List<SysRole> list = jdbcClient.getJdbcList(map, SysRole.class);
+        return new ResponseEntity<>(list, HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/getPage")
+    public Object getPage(@RequestBody Map<String, Object> map) throws Exception {
+        Map<String, Object> recordsPage = jdbcClient.getJdbcPage(map, SysRole.class);
+        return new ResponseEntity<>(recordsPage, HttpStatus.OK);
+    }
+
+
+    @RequestMapping(value = "/save")
+    public Object add(@RequestBody SysRole model) throws Exception {
+        jdbcClient.jdbcInsert(model);
+        return new ResponseEntity<>(model, HttpStatus.OK);
+    }
+
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody SysRole model) throws Exception {
+        jdbcClient.jdbcUpdateById(model);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object deleteProgram(@RequestBody SysRole model) throws Exception {
+        jdbcClient.jdbcRemoveById(model);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+}

+ 55 - 0
easydo-system/src/main/java/easydo/technology/system/rest/SysRolesMenusController.java

@@ -0,0 +1,55 @@
+package easydo.technology.system.rest;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.exception.BizException;
+import easydo.technology.system.model.SysRolesMenus;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/sysRolesMenus")
+public class SysRolesMenusController {
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+
+    @RequestMapping(value = "/getList")
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        List<SysRolesMenus> list = jdbcClient.getJdbcList(map, SysRolesMenus.class);
+        return new ResponseEntity<>(list, HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/batchSave")
+    public Object batchSave(@RequestBody SysRolesMenus rolesMenus) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            List<Long> menuIdList = rolesMenus.getMenuIdList();
+            jdbcClient.jdbcRemove(rolesMenus, connection);
+            for (Long menuId : menuIdList) {
+                SysRolesMenus model = new SysRolesMenus();
+                model.setMenuId(menuId);
+                model.setRoleId(rolesMenus.getRoleId());
+                jdbcClient.jdbcInsert(model, connection);
+            }
+            connection.commit();
+            return new ResponseEntity<>(rolesMenus, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+
+    }
+}

+ 180 - 39
easydo-system/src/main/java/easydo/technology/system/rest/SysUserController.java

@@ -1,67 +1,208 @@
 package easydo.technology.system.rest;
 
-
-import easydo.technology.system.domain.User;
-import easydo.technology.system.domain.vo.UserDto;
-import easydo.technology.system.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
+import easydo.technology.components.JdbcClient;
+import easydo.technology.config.RsaProperties;
+import easydo.technology.exception.BadRequestException;
+import easydo.technology.exception.BizException;
+import easydo.technology.system.model.*;
+import easydo.technology.utils.RsaUtils;
+import easydo.technology.utils.SecurityUtils;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
+import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.ArrayList;
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
-/**
- * <p>
- * 系统用户 前端控制器
- * </p>
- *
- * @author wyn
- * @since 2020-09-30
- */
 @RestController
-@RequestMapping("/sysuser")
+@RequestMapping("/sysUser")
 public class SysUserController {
-
-    @Autowired
-    private UserService sysUserService;
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+    @Resource
+    PasswordEncoder passwordEncoder;
 
     @RequestMapping(value = "/getList")
-    public ResponseEntity<Object> getList(@RequestBody Map<Object,Object> paramMap){
-        Map<String, Object> result = new HashMap<>();
-        List<User> list = null;
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = dataSource.getConnection();
         try {
-            list = sysUserService.list();
-            result.put("userList",list);
+            Map<String, Object> paramMap = new HashMap<>();
+            List<SysUser> list = jdbcClient.getJdbcList(map, SysUser.class);
+            for (SysUser model : list) {
+                SysDept dept = new SysDept();
+                dept.setId(model.getDeptId());
+                dept = jdbcClient.getJdbcModel(dept, connection);
+                model.setDept(dept);
+
+                SysUsersRoles usersRoles = new SysUsersRoles();
+                usersRoles.setUserId(model.getId());
+                List<SysUsersRoles> rolesList = jdbcClient.getJdbcList(usersRoles, connection);
+                List<Long> roleIdList = rolesList.stream().map(SysUsersRoles::getRoleId).collect(Collectors.toList());
+
+                paramMap.put("idIn", roleIdList);
+                List<SysRole> roleList = jdbcClient.getJdbcList(paramMap, SysRole.class, connection);
+                model.setRoleList(roleList);
+            }
+            return new ResponseEntity<>(list, HttpStatus.OK);
         } catch (Exception e) {
-            e.printStackTrace();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
         }
-        return new ResponseEntity<>(result, HttpStatus.OK);
     }
 
-    @RequestMapping(value = "/getUserStrList")
-    public ResponseEntity<Object> getUserStrList(@RequestBody Map<Object,Object> paramMap){
-        Map<String, Object> result = new HashMap<>();
-        List<UserDto> userList = new ArrayList<>();
-        List<User> list = null;
+    @RequestMapping(value = "/getPage")
+    public Object getPage(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = dataSource.getConnection();
         try {
-            list = sysUserService.list();
-            for(User user:list){
-                UserDto vo = new UserDto();
-                vo.setId(user.getId().toString());
-                vo.setNickName(user.getNickName());
-                userList.add(vo);
+            Map<String, Object> paramMap = new HashMap<>();
+            Map<String, Object> recordsPage = jdbcClient.getJdbcPage(map, SysUser.class, connection);
+            List<SysUser> records = (List<SysUser>) recordsPage.get("records");
+            for (SysUser model : records) {
+                SysDept dept = new SysDept();
+                dept.setId(model.getDeptId());
+                dept = jdbcClient.getJdbcModel(dept, connection);
+                model.setDept(dept);
+
+                SysUsersRoles usersRoles = new SysUsersRoles();
+                usersRoles.setUserId(model.getId());
+                List<SysUsersRoles> rolesList = jdbcClient.getJdbcList(usersRoles, connection);
+                List<Long> roleIdList = rolesList.stream().map(SysUsersRoles::getRoleId).collect(Collectors.toList());
+                paramMap.put("idIn", roleIdList);
+                List<SysRole> roleList = jdbcClient.getJdbcList(paramMap, SysRole.class, connection);
+                model.setRoleList(roleList);
             }
-            result.put("userList",userList);
+            return new ResponseEntity<>(recordsPage, HttpStatus.OK);
         } catch (Exception e) {
-            e.printStackTrace();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
         }
-        return new ResponseEntity<>(result, HttpStatus.OK);
     }
 
+
+    @RequestMapping(value = "/save")
+    public Object add(@RequestBody SysUser model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            SysUser user = new SysUser();
+            user.setUsername(model.getUsername());
+            int count = jdbcClient.getJdbcCount(user, connection);
+            if (count > 0) {
+                throw new BizException("用户名已存在");
+            }
+
+            model.setPassword(passwordEncoder.encode("123456"));
+            jdbcClient.jdbcInsert(model, connection);
+
+            List<SysRole> roleList = model.getRoleList();
+            for (SysRole rmodel : roleList) {
+                SysUsersRoles usersRoles = new SysUsersRoles();
+                usersRoles.setUserId(model.getId());
+                usersRoles.setRoleId(rmodel.getId());
+                jdbcClient.jdbcInsert(usersRoles, connection);
+            }
+
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody SysUser model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+
+            jdbcClient.jdbcUpdateById(model, connection);
+
+            SysUsersRoles usersRoles = new SysUsersRoles();
+            usersRoles.setUserId(model.getId());
+            jdbcClient.jdbcRemove(usersRoles, connection);
+
+            List<SysRole> roleList = model.getRoleList();
+            for (SysRole rmodel : roleList) {
+                usersRoles = new SysUsersRoles();
+                usersRoles.setUserId(model.getId());
+                usersRoles.setRoleId(rmodel.getId());
+                jdbcClient.jdbcInsert(usersRoles, connection);
+            }
+            connection.commit();
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object deleteProgram(@RequestBody SysUser model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            jdbcClient.jdbcRemoveById(model, connection);
+
+            SysUsersRoles usersRoles = new SysUsersRoles();
+            usersRoles.setUserId(model.getId());
+            jdbcClient.jdbcRemove(usersRoles, connection);
+            connection.commit();
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/updatePass")
+    public ResponseEntity<Object> updatePass(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, map.get("oldPass").toString());
+            String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, map.get("newPass").toString());
+            SysUser user = new SysUser();
+            user.setUsername(SecurityUtils.getCurrentUsername());
+            user = jdbcClient.getJdbcModel(user, connection);
+            if (!passwordEncoder.matches(oldPass, user.getPassword())) {
+                throw new BadRequestException("修改失败,旧密码错误");
+            }
+            if (passwordEncoder.matches(newPass, user.getPassword())) {
+                throw new BadRequestException("新密码不能与旧密码相同");
+            }
+            user.setPassword(passwordEncoder.encode(newPass));
+            jdbcClient.jdbcUpdateById(user, connection);
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/resetPass")
+    public Object resetPass(@RequestBody SysUser model) throws Exception {
+        model.setPassword(passwordEncoder.encode("123456"));
+        jdbcClient.jdbcUpdateById(model);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
 }

+ 0 - 59
easydo-system/src/main/java/easydo/technology/system/rest/SysUsersRolesController.java

@@ -1,59 +0,0 @@
-package easydo.technology.system.rest;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import easydo.technology.system.domain.User;
-import easydo.technology.system.domain.UsersRoles;
-import easydo.technology.system.service.UserService;
-import easydo.technology.system.service.UsersRolesService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * <p>
- * 用户角色关联 前端控制器
- * </p>
- *
- * @author hewj
- * @since 2020-10-13
- */
-@RestController
-@RequestMapping("/sysUsersRoles")
-public class SysUsersRolesController {
-
-    @Autowired
-    private UsersRolesService sysUsersRolesService;
-
-    @Autowired
-    private UserService sysUserService;
-
-    @RequestMapping(value = "/getUserListByRoleId")
-    public ResponseEntity<Object> getUserListByRoleId(@RequestBody Long roleId) throws Exception {
-
-        Map<String, Object> result = new HashMap<>();
-
-        QueryWrapper<UsersRoles> wrapper = Wrappers.query();
-        wrapper.eq("role_id",roleId);
-        List<UsersRoles> usersRolesList = sysUsersRolesService.list(wrapper);
-        List<Long> userIds = new ArrayList<>();
-        for (UsersRoles useRole : usersRolesList){
-            userIds.add(useRole.getUserId());
-        }
-
-        QueryWrapper<User> userWrapper = Wrappers.query();
-        userWrapper.in("user_id",userIds);
-        List<User> userList = sysUserService.list(userWrapper);
-
-        result.put("userList",userList);
-        return new ResponseEntity<>(result, HttpStatus.OK);
-    }
-}

+ 0 - 0
easydo-system/src/main/java/easydo/technology/system/rest/UserController.java


Some files were not shown because too many files changed in this diff