郑根木 2 роки тому
джерело
коміт
3ef36646ba
100 змінених файлів з 62 додано та 1807 видалено
  1. +2
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/AbstractCache.java
  2. +1
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/CacheManager.java
  3. +0
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/SessionCache.java
  4. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/SessionCacheFactory.java
  5. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisBroadcastEvent.java
  6. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisConnection.java
  7. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisManager.java
  8. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisPooledObjectFactory.java
  9. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisSysTask.java
  10. +2
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/config/RedisConfig.java
  11. +0
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java
  12. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java
  13. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/EntityDao.java
  14. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/EntityHelper.java
  15. +0
    -6
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/cache/EntityCache.java
  16. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/config/DbEngineConfiguration.java
  17. +5
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/dao/AbstractEntityDao.java
  18. +0
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/impl/DefaultDatabaseInfoImpl.java
  19. +0
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/sqlbuilder/SelectSqlBuilder.java
  20. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/sqlbuilder/SqlJoinField.java
  21. +0
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/ModelCache.java
  22. +0
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/ModelDatabase.java
  23. +0
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/ModelIndex.java
  24. +0
    -4
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/ModelTable.java
  25. +0
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/exception/ExceptionMessage.java
  26. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/config/ControllerConfig.java
  27. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/config/GlobalExceptionHandler.java
  28. +4
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/config/SettingsEnvironmentPostProcessor.java
  29. +2
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/config/WebMvcConfig.java
  30. +2
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/MethodAccessManager.java
  31. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/access/BindFieldAccess.java
  32. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/access/FieldAccess.java
  33. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/access/MethodParamAccess.java
  34. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/WebDataBinder.java
  35. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/bean/AbstractContextEditor.java
  36. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/bean/NullEditor.java
  37. +0
    -4
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/bean/SwIpAddrEditor.java
  38. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/param/AbstractRequestEditor.java
  39. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/param/BeanTypeEditor.java
  40. +0
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/scan/MethodParser.java
  41. +0
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/scan/PackageScanner.java
  42. +4
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/scan/ScanContext.java
  43. +2
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/realm/interceptor/AbstractPermInterceptor.java
  44. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/realm/interceptor/AuthorizationInterceptor.java
  45. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/realm/interceptor/PermInterceptor.java
  46. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/scheduler/AbstractJobQueue.java
  47. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/scheduler/SchedulerTaskManager.java
  48. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/scheduler/job/GroupJob.java
  49. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/scheduler/job/RedisJobExecutor.java
  50. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/scheduler/job/SimpleJob.java
  51. +0
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractCompProvider.java
  52. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractCompService.java
  53. +2
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java
  54. +4
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultComboHandler.java
  55. +3
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultListHandler.java
  56. +2
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java
  57. +0
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/IWorker.java
  58. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/SwListData.java
  59. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/TreeHelper.java
  60. +2
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/session/SessionManager.java
  61. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/session/SessionUtil.java
  62. +3
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/IpAddrUtil.java
  63. +0
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/jackson/BaseBeanSerializer.java
  64. +0
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/jackson/TimestampDeserializer.java
  65. +1
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/kryo/KryoTool.java
  66. +1
    -1
      smtweb-framework/sw-framework-file/src/main/java/cc/smtweb/framework/file/spring/controller/FileDownloadController.java
  67. +1
    -1
      smtweb-framework/sw-framework-file/src/main/java/cc/smtweb/framework/file/spring/controller/FileUploadController.java
  68. +1
    -1
      smtweb-framework/sw-framework-web/src/main/java/cc/smtweb/framework/web/web/api/DemoTimerService.java
  69. +0
    -20
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/annotation/BpmEvent.java
  70. +0
    -39
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/annotation/BpmEventType.java
  71. +0
    -7
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmDataException.java
  72. +0
    -19
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmException.java
  73. +0
    -14
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmFieldError.java
  74. +0
    -12
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmIlegalArgumentException.java
  75. +0
    -7
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmLockRevException.java
  76. +0
    -7
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmObjectNotFoundException.java
  77. +0
    -15
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmValidException.java
  78. +0
    -46
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/ModelLoaderError.java
  79. +0
    -9
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/BpmKeyValue.java
  80. +0
    -37
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/BpmListData.java
  81. +0
    -13
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/BpmMapData.java
  82. +0
    -60
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/BpmPageContext.java
  83. +0
    -29
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/IParamConst.java
  84. +0
    -80
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/bind/BpmBeanAttrEditor.java
  85. +0
    -62
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/bind/BpmMapAttrEditor.java
  86. +0
    -68
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/bind/BpmPageContextEditor.java
  87. +0
    -13
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/bind/IBpmBeanConst.java
  88. +0
    -310
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/CardDataBuilder.java
  89. +0
    -134
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/CardTreeDataBuilder.java
  90. +0
    -106
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/SqlUtil.java
  91. +0
    -207
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/TreeDataBuilder.java
  92. +0
    -10
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/TreeItemVO.java
  93. +0
    -20
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/dataset/DateFieldFormater.java
  94. +0
    -20
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/dataset/DateTimeFieldFormater.java
  95. +0
    -42
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/dataset/FieldFormatTool.java
  96. +0
    -16
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/dataset/FieldFormatter.java
  97. +0
    -43
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/entity/BpmPage.java
  98. +0
    -33
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/entity/dataset/AbstractBpmFieldLookup.java
  99. +0
    -186
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/entity/dataset/BpmDataset.java
  100. +0
    -10
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/entity/dataset/BpmDatasetSql.java

+ 2
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/AbstractCache.java Переглянути файл

@@ -1,9 +1,9 @@
package cc.smtweb.framework.core.cache;

import cc.smtweb.framework.core.annotation.SwCache;
import cc.smtweb.framework.core.cache.redis.RedisBroadcastEvent;
import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.redis.RedisBroadcastEvent;
import cc.smtweb.framework.core.redis.RedisManager;
import cc.smtweb.framework.core.util.CommUtil;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;


+ 1
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/CacheManager.java Переглянути файл

@@ -1,10 +1,9 @@
package cc.smtweb.framework.core.cache;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.cache.redis.RedisBroadcastEvent;
import cc.smtweb.framework.core.db.cache.EntityCache;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.redis.RedisBroadcastEvent;
import cc.smtweb.framework.core.util.SpringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;


+ 0
- 3
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/SessionCache.java Переглянути файл

@@ -2,9 +2,6 @@ package cc.smtweb.framework.core.cache;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;
import com.github.benmanes.caffeine.cache.Scheduler;
import org.checkerframework.checker.nullness.qual.NonNull;

import java.util.concurrent.TimeUnit;



+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/SessionCacheFactory.java Переглянути файл

@@ -1,6 +1,5 @@
package cc.smtweb.framework.core.cache;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;



smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/redis/RedisBroadcastEvent.java → smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisBroadcastEvent.java Переглянути файл

@@ -1,4 +1,4 @@
package cc.smtweb.framework.core.redis;
package cc.smtweb.framework.core.cache.redis;

import lombok.Data;


smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/redis/RedisConnection.java → smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisConnection.java Переглянути файл

@@ -1,4 +1,4 @@
package cc.smtweb.framework.core.redis;
package cc.smtweb.framework.core.cache.redis;

import cc.smtweb.framework.core.util.CommUtil;
import io.lettuce.core.KeyValue;

smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/redis/RedisManager.java → smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisManager.java Переглянути файл

@@ -1,4 +1,4 @@
package cc.smtweb.framework.core.redis;
package cc.smtweb.framework.core.cache.redis;

import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.systask.SysTaskManager;

smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/redis/RedisPooledObjectFactory.java → smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisPooledObjectFactory.java Переглянути файл

@@ -1,4 +1,4 @@
package cc.smtweb.framework.core.redis;
package cc.smtweb.framework.core.cache.redis;

import io.lettuce.core.RedisClient;
import io.lettuce.core.api.StatefulRedisConnection;

smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/redis/RedisSysTask.java → smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisSysTask.java Переглянути файл

@@ -1,4 +1,4 @@
package cc.smtweb.framework.core.redis;
package cc.smtweb.framework.core.cache.redis;

import cc.smtweb.framework.core.systask.ISysTask;
import cc.smtweb.framework.core.util.JsonUtil;

smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/redis/config/RedisConfig.java → smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/redis/config/RedisConfig.java Переглянути файл

@@ -1,9 +1,8 @@
package cc.smtweb.framework.core.redis.config;
package cc.smtweb.framework.core.cache.redis.config;


import cc.smtweb.framework.core.redis.RedisManager;
import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.systask.SysTaskManager;
import io.lettuce.core.RedisClient;
import io.lettuce.core.RedisURI;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

+ 0
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java Переглянути файл

@@ -1,7 +1,5 @@
package cc.smtweb.framework.core.common;

import lombok.Data;

/**
* Created by Akmm at 2022/3/23 9:46
*/


+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java Переглянути файл

@@ -1,6 +1,5 @@
package cc.smtweb.framework.core.common;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.sql.Types;


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/EntityDao.java Переглянути файл

@@ -1,7 +1,7 @@
package cc.smtweb.framework.core.db;

import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.db.dao.AbstractEntityDao;
import cc.smtweb.framework.core.db.dao.EntityColumn;
import cc.smtweb.framework.core.db.impl.DefaultEntity;


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/EntityHelper.java Переглянути файл

@@ -1,8 +1,8 @@
package cc.smtweb.framework.core.db;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.vo.ModelLinkName;
import cc.smtweb.framework.core.db.vo.ModelTable;


+ 0
- 6
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/cache/EntityCache.java Переглянути файл

@@ -1,6 +1,5 @@
package cc.smtweb.framework.core.db.cache;

import cc.smtweb.framework.core.annotation.SwCache;
import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.db.DbEngine;
@@ -10,14 +9,9 @@ import cc.smtweb.framework.core.db.vo.ModelCache;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.mvc.controller.scan.BeanManager;
import cc.smtweb.framework.core.util.CommUtil;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.Scheduler;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.nullness.qual.NonNull;

import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
* Created by Akmm at 2022/2/19 17:19


+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/config/DbEngineConfiguration.java Переглянути файл

@@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;

/**


+ 5
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/dao/AbstractEntityDao.java Переглянути файл

@@ -1,9 +1,9 @@
package cc.smtweb.framework.core.db.dao;

import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.vo.ModelField;
@@ -18,7 +18,10 @@ import org.springframework.util.ClassUtils;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* 抽象的值对象数据库访问


+ 0
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/impl/DefaultDatabaseInfoImpl.java Переглянути файл

@@ -4,8 +4,6 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.util.SpringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ConnectionCallback;
import org.springframework.jdbc.support.JdbcUtils;

import java.sql.Connection;


+ 0
- 3
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/sqlbuilder/SelectSqlBuilder.java Переглянути файл

@@ -1,8 +1,5 @@
package cc.smtweb.framework.core.db.sqlbuilder;

import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.jdbc.JdbcEngine;

import java.util.ArrayList;
import java.util.List;
import java.util.function.BiFunction;


+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/sqlbuilder/SqlJoinField.java Переглянути файл

@@ -1,6 +1,5 @@
package cc.smtweb.framework.core.db.sqlbuilder;

import lombok.Data;
import lombok.Getter;

@Getter


+ 0
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/ModelCache.java Переглянути файл

@@ -2,8 +2,6 @@ package cc.smtweb.framework.core.db.vo;

import lombok.Data;

import java.util.List;

/**
* 表缓存信息定义:{"name":"tn","title":"按表名","fields":"table_name","type":"M"}
* Created by Akmm at 2022/2/21 16:22


+ 0
- 3
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/ModelDatabase.java Переглянути файл

@@ -4,9 +4,6 @@ import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import lombok.Data;

import java.io.Serializable;
import java.util.Map;

@Data
@SwTable(value = "ASP_MODEL_DATABASE")
public class ModelDatabase extends DefaultEntity {


+ 0
- 3
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/ModelIndex.java Переглянути файл

@@ -2,9 +2,6 @@ package cc.smtweb.framework.core.db.vo;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
* 索引定义 {name:"索引名称,如idx_t1", fields:"字段,如f1,f2", type="索引类别:P-主键 I-一般索引 U-唯一索引"}
*/


+ 0
- 4
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/ModelTable.java Переглянути файл

@@ -1,16 +1,12 @@
package cc.smtweb.framework.core.db.vo;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.common.AbstractEnum;
import cc.smtweb.framework.core.common.IntEnum;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.cache.ModelDatabaseCache;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.framework.core.util.jackson.BaseBeanSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;


+ 0
- 3
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/exception/ExceptionMessage.java Переглянути файл

@@ -3,9 +3,6 @@ package cc.smtweb.framework.core.exception;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

import java.util.Set;

/**
* 错误码 JDK version used: <JDK1.8>


+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/config/ControllerConfig.java Переглянути файл

@@ -1,6 +1,5 @@
package cc.smtweb.framework.core.mvc.config;

import cc.smtweb.framework.core.mvc.controller.scan.IScanAction;
import cc.smtweb.framework.core.mvc.controller.scan.IScanActionBuilder;
import lombok.Getter;



+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/config/GlobalExceptionHandler.java Переглянути файл

@@ -1,5 +1,6 @@
package cc.smtweb.framework.core.mvc.config;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.mvc.realm.exception.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
@@ -8,7 +9,6 @@ import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import cc.smtweb.framework.core.common.R;

import java.util.List;
import java.util.stream.Collectors;


+ 4
- 3
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/config/SettingsEnvironmentPostProcessor.java Переглянути файл

@@ -1,8 +1,5 @@
package cc.smtweb.framework.core.mvc.config;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
@@ -10,6 +7,10 @@ import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.io.FileSystemResource;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
* 〈读取外部配置文件〉
*


+ 2
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/config/WebMvcConfig.java Переглянути файл

@@ -1,10 +1,10 @@
package cc.smtweb.framework.core.mvc.config;

import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.db.jdbc.IdGenerator;
import cc.smtweb.framework.core.mvc.controller.MethodAccessManager;
import cc.smtweb.framework.core.mvc.controller.ApiConfigBean;
import cc.smtweb.framework.core.redis.RedisManager;
import cc.smtweb.framework.core.mvc.controller.MethodAccessManager;
import cc.smtweb.framework.core.session.SessionManager;
import cc.smtweb.framework.core.session.UserSessionArgumentResolver;
import cc.smtweb.framework.core.util.JsonUtil;


+ 2
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/MethodAccessManager.java Переглянути файл

@@ -1,8 +1,9 @@
package cc.smtweb.framework.core.mvc.controller;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.cache.ISwCache;
import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.mvc.SchedulerManager;
import cc.smtweb.framework.core.mvc.controller.access.IMethodAccess;
import cc.smtweb.framework.core.mvc.controller.access.MethodAccess;
@@ -10,7 +11,6 @@ import cc.smtweb.framework.core.mvc.controller.scan.BeanManager;
import cc.smtweb.framework.core.mvc.realm.interceptor.PermInterceptor;
import cc.smtweb.framework.core.mvc.realm.service.PermChecker;
import cc.smtweb.framework.core.mvc.scheduler.SchedulerTaskManager;
import cc.smtweb.framework.core.redis.RedisManager;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;



+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/access/BindFieldAccess.java Переглянути файл

@@ -1,6 +1,5 @@
package cc.smtweb.framework.core.mvc.controller.access;

import cc.smtweb.framework.core.exception.BindBeanException;
import cc.smtweb.framework.core.mvc.controller.IBeanContext;
import cc.smtweb.framework.core.mvc.controller.IEditor;



+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/access/FieldAccess.java Переглянути файл

@@ -2,7 +2,6 @@ package cc.smtweb.framework.core.mvc.controller.access;

import cc.smtweb.framework.core.exception.BindBeanException;
import cc.smtweb.framework.core.mvc.controller.IBeanContext;
import cc.smtweb.framework.core.mvc.controller.IEditor;

import java.lang.reflect.Field;
import java.util.Map;


+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/access/MethodParamAccess.java Переглянути файл

@@ -5,7 +5,6 @@ import cc.smtweb.framework.core.mvc.controller.IEditor;
import lombok.Getter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/WebDataBinder.java Переглянути файл

@@ -1,8 +1,8 @@
package cc.smtweb.framework.core.mvc.controller.binder;

import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.common.SwIpAddr;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.mvc.controller.IEditor;
import cc.smtweb.framework.core.mvc.controller.binder.attr.BeanAttrEditor;
import cc.smtweb.framework.core.mvc.controller.binder.bean.*;


+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/bean/AbstractContextEditor.java Переглянути файл

@@ -4,7 +4,6 @@ import cc.smtweb.framework.core.mvc.controller.IBeanContext;
import cc.smtweb.framework.core.mvc.controller.IEditor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

public abstract class AbstractContextEditor implements IEditor {


+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/bean/NullEditor.java Переглянути файл

@@ -4,7 +4,6 @@ import cc.smtweb.framework.core.mvc.controller.IBeanContext;
import cc.smtweb.framework.core.mvc.controller.IEditor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

public class NullEditor implements IEditor {


+ 0
- 4
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/bean/SwIpAddrEditor.java Переглянути файл

@@ -1,13 +1,9 @@
package cc.smtweb.framework.core.mvc.controller.binder.bean;

import cc.smtweb.framework.core.mvc.controller.IEditor;
import cc.smtweb.framework.core.mvc.controller.binder.param.AbstractRequestEditor;
import cc.smtweb.framework.core.session.SessionUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.BeanFactory;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/***
* 获取客户端IP地址;这里通过了Nginx获取;X-Real-IP


+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/param/AbstractRequestEditor.java Переглянути файл

@@ -4,7 +4,6 @@ import cc.smtweb.framework.core.mvc.controller.IBeanContext;
import cc.smtweb.framework.core.mvc.controller.IEditor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

public abstract class AbstractRequestEditor implements IEditor {


+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/param/BeanTypeEditor.java Переглянути файл

@@ -4,7 +4,6 @@ import cc.smtweb.framework.core.mvc.controller.IBeanContext;
import cc.smtweb.framework.core.mvc.controller.IEditor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

public class BeanTypeEditor implements IEditor {


+ 0
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/scan/MethodParser.java Переглянути файл

@@ -10,9 +10,7 @@ import cc.smtweb.framework.core.mvc.controller.binder.WebDataBinder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.ResolvableType;
import org.springframework.core.annotation.SynthesizingMethodParameter;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;


+ 0
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/scan/PackageScanner.java Переглянути файл

@@ -3,11 +3,9 @@ package cc.smtweb.framework.core.mvc.controller.scan;
import lombok.extern.slf4j.Slf4j;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.lang.reflect.Modifier;
import java.net.JarURLConnection;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.Enumeration;


+ 4
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/controller/scan/ScanContext.java Переглянути файл

@@ -1,7 +1,10 @@
package cc.smtweb.framework.core.mvc.controller.scan;

import cc.smtweb.framework.core.annotation.SwBean;
import cc.smtweb.framework.core.annotation.SwConstruct;
import cc.smtweb.framework.core.annotation.SwDestroy;
import cc.smtweb.framework.core.annotation.SwScheduling;
import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.annotation.*;
import cc.smtweb.framework.core.mvc.controller.access.MethodAccess;
import cc.smtweb.framework.core.mvc.controller.access.SchedulerMethodAccess;
import cc.smtweb.framework.core.mvc.controller.binder.WebDataBinder;


+ 2
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/realm/interceptor/AbstractPermInterceptor.java Переглянути файл

@@ -1,6 +1,8 @@
package cc.smtweb.framework.core.mvc.realm.interceptor;

import cc.smtweb.framework.core.annotation.SwPerm;
import cc.smtweb.framework.core.cache.ISwCache;
import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.mvc.controller.IEditor;
import cc.smtweb.framework.core.mvc.realm.exception.ForbiddenException;
import cc.smtweb.framework.core.mvc.realm.exception.UnauthenticatedException;
@@ -8,8 +10,6 @@ import cc.smtweb.framework.core.mvc.realm.service.PermCheckItem;
import cc.smtweb.framework.core.mvc.realm.service.PermChecker;
import cc.smtweb.framework.core.session.SessionUtil;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.cache.ISwCache;
import cc.smtweb.framework.core.redis.RedisManager;
import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/realm/interceptor/AuthorizationInterceptor.java Переглянути файл

@@ -1,7 +1,7 @@
package cc.smtweb.framework.core.mvc.realm.interceptor;

import cc.smtweb.framework.core.annotation.SwPerm;
import cc.smtweb.framework.core.redis.RedisManager;
import cc.smtweb.framework.core.cache.redis.RedisManager;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;



+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/realm/interceptor/PermInterceptor.java Переглянути файл

@@ -1,6 +1,6 @@
package cc.smtweb.framework.core.mvc.realm.interceptor;

import cc.smtweb.framework.core.redis.RedisManager;
import cc.smtweb.framework.core.cache.redis.RedisManager;

import javax.servlet.http.HttpServletRequest;



+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/scheduler/AbstractJobQueue.java Переглянути файл

@@ -3,7 +3,6 @@ package cc.smtweb.framework.core.mvc.scheduler;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/scheduler/SchedulerTaskManager.java Переглянути файл

@@ -1,6 +1,7 @@
package cc.smtweb.framework.core.mvc.scheduler;

import cc.smtweb.framework.core.annotation.SwScheduling;
import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.mvc.ISchedulerWakeup;
import cc.smtweb.framework.core.mvc.controller.IBeanContext;
@@ -9,7 +10,6 @@ import cc.smtweb.framework.core.mvc.scheduler.job.GroupJob;
import cc.smtweb.framework.core.mvc.scheduler.job.LocalJobExecutor;
import cc.smtweb.framework.core.mvc.scheduler.job.RedisJobExecutor;
import cc.smtweb.framework.core.mvc.scheduler.job.SimpleJob;
import cc.smtweb.framework.core.redis.RedisManager;
import com.serotonin.timer.RealTimeTimer;
import com.serotonin.timer.TimerTask;
import org.apache.commons.lang3.StringUtils;


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/scheduler/job/GroupJob.java Переглянути файл

@@ -1,10 +1,10 @@
package cc.smtweb.framework.core.mvc.scheduler.job;

import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.mvc.controller.access.MethodAccess;
import cc.smtweb.framework.core.mvc.scheduler.AbstractJob;
import cc.smtweb.framework.core.mvc.scheduler.AbstractJobExecutor;
import cc.smtweb.framework.core.mvc.scheduler.AbstractJobQueue;
import cc.smtweb.framework.core.redis.RedisManager;

public class GroupJob extends AbstractJob {
@Override


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/scheduler/job/RedisJobExecutor.java Переглянути файл

@@ -1,10 +1,10 @@
package cc.smtweb.framework.core.mvc.scheduler.job;

import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.mvc.controller.IBeanContext;
import cc.smtweb.framework.core.mvc.scheduler.AbstractJob;
import cc.smtweb.framework.core.mvc.scheduler.AbstractJobExecutor;
import cc.smtweb.framework.core.redis.RedisManager;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/scheduler/job/SimpleJob.java Переглянути файл

@@ -1,10 +1,10 @@
package cc.smtweb.framework.core.mvc.scheduler.job;

import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.mvc.controller.access.MethodAccess;
import cc.smtweb.framework.core.mvc.scheduler.AbstractJob;
import cc.smtweb.framework.core.mvc.scheduler.AbstractJobExecutor;
import cc.smtweb.framework.core.mvc.scheduler.AbstractJobQueue;
import cc.smtweb.framework.core.redis.RedisManager;

public class SimpleJob extends AbstractJob {
public SimpleJob(MethodAccess methodAccess) {


+ 0
- 3
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractCompProvider.java Переглянути файл

@@ -1,8 +1,5 @@
package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;

import java.util.HashMap;
import java.util.Map;



+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractCompService.java Переглянути файл

@@ -1,9 +1,9 @@
package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.session.UserSession;

/**


+ 2
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java Переглянути файл

@@ -1,9 +1,9 @@
package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.cache.SessionCache;
import cc.smtweb.framework.core.cache.SessionCacheFactory;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.mvc.service.list.FooterField;
import lombok.extern.slf4j.Slf4j;


+ 4
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultComboHandler.java Переглянути файл

@@ -1,9 +1,9 @@
package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
@@ -11,7 +11,9 @@ import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import org.apache.commons.lang3.StringUtils;

import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
* Created by Akmm at 2022/3/2 19:52


+ 3
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultListHandler.java Переглянути файл

@@ -1,7 +1,7 @@
package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.EntityHelper;
@@ -11,7 +11,8 @@ import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import org.apache.commons.lang3.StringUtils;

import java.util.*;
import java.util.ArrayList;
import java.util.List;

/**
* Created by Akmm at 2022/3/2 19:52


+ 2
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java Переглянути файл

@@ -1,10 +1,10 @@
package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;


+ 0
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/IWorker.java Переглянути файл

@@ -1,8 +1,6 @@
package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.session.UserSession;

/**
* Created by Akmm at 2022/3/2 19:01


+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/SwListData.java Переглянути файл

@@ -1,6 +1,5 @@
package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.common.SwMap;
import lombok.Getter;

import java.util.ArrayList;


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/TreeHelper.java Переглянути файл

@@ -1,10 +1,10 @@
package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;


+ 2
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/session/SessionManager.java Переглянути файл

@@ -1,9 +1,9 @@
package cc.smtweb.framework.core.session;

import cc.smtweb.framework.core.cache.redis.RedisBroadcastEvent;
import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.db.jdbc.IdGenerator;
import cc.smtweb.framework.core.mvc.controller.IEditor;
import cc.smtweb.framework.core.redis.RedisBroadcastEvent;
import cc.smtweb.framework.core.redis.RedisManager;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/session/SessionUtil.java Переглянути файл

@@ -1,8 +1,8 @@
package cc.smtweb.framework.core.session;

import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.mvc.controller.IEditor;
import cc.smtweb.framework.core.mvc.realm.exception.UnauthenticatedException;
import cc.smtweb.framework.core.redis.RedisManager;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;



+ 3
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/IpAddrUtil.java Переглянути файл

@@ -1,9 +1,10 @@
package cc.smtweb.framework.core.util;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;

/**
* 〈IP〉工具类


+ 0
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/jackson/BaseBeanSerializer.java Переглянути файл

@@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;
import java.util.Date;

public class BaseBeanSerializer extends JsonSerializer<BaseBean> {



+ 0
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/jackson/TimestampDeserializer.java Переглянути файл

@@ -1,8 +1,6 @@
package cc.smtweb.framework.core.util.jackson;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;


+ 1
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/kryo/KryoTool.java Переглянути файл

@@ -5,6 +5,7 @@ import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.esotericsoftware.kryo.pool.KryoFactory;
import com.esotericsoftware.kryo.pool.KryoPool;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Serializable;


+ 1
- 1
smtweb-framework/sw-framework-file/src/main/java/cc/smtweb/framework/file/spring/controller/FileDownloadController.java Переглянути файл

@@ -1,6 +1,6 @@
package cc.smtweb.framework.file.spring.controller;

import cc.smtweb.framework.core.redis.RedisManager;
import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.session.SessionUtil;
import cc.smtweb.framework.file.FilePathGenerator;
import org.apache.commons.lang3.StringUtils;


+ 1
- 1
smtweb-framework/sw-framework-file/src/main/java/cc/smtweb/framework/file/spring/controller/FileUploadController.java Переглянути файл

@@ -2,7 +2,7 @@ package cc.smtweb.framework.file.spring.controller;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.redis.RedisManager;
import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.session.SessionUtil;
import cc.smtweb.framework.file.FilePathGenerator;
import cc.smtweb.framework.file.FilePathInfo;


+ 1
- 1
smtweb-framework/sw-framework-web/src/main/java/cc/smtweb/framework/web/web/api/DemoTimerService.java Переглянути файл

@@ -4,7 +4,7 @@ import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.annotation.*;
import cc.smtweb.framework.core.mvc.SchedulerManager;
import cc.smtweb.framework.core.mvc.scheduler.SchedulerPoint;
import cc.smtweb.framework.core.redis.RedisManager;
import cc.smtweb.framework.core.cache.redis.RedisManager;
import cc.smtweb.framework.core.util.DateUtil;
import lombok.extern.slf4j.Slf4j;



+ 0
- 20
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/annotation/BpmEvent.java Переглянути файл

@@ -1,20 +0,0 @@
package cc.smtweb.system.bpm.core.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* 数据模型注解,放到@SwService类中使用
* @author xkliu
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface BpmEvent {

/** 数据集地址,如 uc.perm.perm.sysRoleMenuPrivilege */
String dataset();
/** 事件类型, BpmEventType */
int event();
}

+ 0
- 39
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/annotation/BpmEventType.java Переглянути файл

@@ -1,39 +0,0 @@
package cc.smtweb.system.bpm.core.annotation;

/**
* 数据模型事件类型
* @author xkliu
*/
public interface BpmEventType {
/**
* 卡片模型
*/
int CARD_BEFORE_LOAD = 101;
int CARD_LOAD = 102;
int CARD_AFTER_LOAD = 103;
int CARD_BEFORE_SAVE = 104;
int CARD_SAVE = 105;
int CARD_AFTER_SAVE = 106;
int CARD_BEFORE_REMOVE = 107;
int CARD_REMOVE = 108;
int CARD_AFTER_REMOVE = 109;
// int CARD_LOAD_LOOKUP = 16;
/**
* 列表模型
*/
int LIST_BEFORE_LIST = 201;
int LIST_LIST = 202;
int LIST_AFTER_LIST = 203;
int LIST_BEFORE_COUNT = 204;
int LIST_COUNT = 205;
int LIST_AFTER_COUNT = 206;
/**
* 树模型
*/
int TREE_BEFORE_TREE = 301;
int TREE_TREE = 302;
int TREE_AFTER_TREE = 303;
int TREE_BEFORE_MOVE = 304;
int TREE_MOVE = 305;
int TREE_AFTER_MOVE = 306;
}

+ 0
- 7
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmDataException.java Переглянути файл

@@ -1,7 +0,0 @@
package cc.smtweb.system.bpm.core.exception;

public class BpmDataException extends BpmException {
public BpmDataException(String msg) {
super(msg);
}
}

+ 0
- 19
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmException.java Переглянути файл

@@ -1,19 +0,0 @@
package cc.smtweb.system.bpm.core.exception;

import cc.smtweb.framework.core.common.SwException;

import java.io.IOException;

public class BpmException extends SwException {
public BpmException(String message) {
super(message);
}

public BpmException(Exception e) {
super(e);
}

public BpmException(String message, IOException e) {
super(message, e);
}
}

+ 0
- 14
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmFieldError.java Переглянути файл

@@ -1,14 +0,0 @@
package cc.smtweb.system.bpm.core.exception;

import lombok.Data;

@Data
public class BpmFieldError {
private String field;
private String message;

public BpmFieldError(String field, String message) {
this.field = field;
this.message = message;
}
}

+ 0
- 12
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmIlegalArgumentException.java Переглянути файл

@@ -1,12 +0,0 @@
package cc.smtweb.system.bpm.core.exception;

import java.io.IOException;

public class BpmIlegalArgumentException extends RuntimeException {
public BpmIlegalArgumentException(String message) {
super(message);
}
public BpmIlegalArgumentException(String message, IOException e) {
super(message, e);
}
}

+ 0
- 7
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmLockRevException.java Переглянути файл

@@ -1,7 +0,0 @@
package cc.smtweb.system.bpm.core.exception;

public class BpmLockRevException extends BpmException {
public BpmLockRevException() {
super("update lock rev error");
}
}

+ 0
- 7
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmObjectNotFoundException.java Переглянути файл

@@ -1,7 +0,0 @@
package cc.smtweb.system.bpm.core.exception;

public class BpmObjectNotFoundException extends BpmException {
public BpmObjectNotFoundException(String msg) {
super(msg);
}
}

+ 0
- 15
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/BpmValidException.java Переглянути файл

@@ -1,15 +0,0 @@
package cc.smtweb.system.bpm.core.exception;

import lombok.Getter;

import java.util.List;

public class BpmValidException extends BpmException {
@Getter
private List<BpmFieldError> fieldErrors;

public BpmValidException(List<BpmFieldError> fieldErrors) {
super("数据验证失败");
this.fieldErrors = fieldErrors;
}
}

+ 0
- 46
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/exception/ModelLoaderError.java Переглянути файл

@@ -1,46 +0,0 @@
package cc.smtweb.system.bpm.core.exception;

import lombok.Getter;

@Getter
public class ModelLoaderError {
public static final int ERROR_FLOW = 11;
public static final int ERROR_NODE = 12;
public static final int ERROR_ACTION = 13;
public static final int ERROR_CONNECTION = 14;
public static final int ERROR_DB = 21;
public static final int ERROR_TABLE = 22;
public static final int ERROR_FIELD = 23;
public static final int ERROR_INDEX = 24;
public static final int ERROR_UI = 31;
public static final int ERROR_UI_DATASET = 32;

private int type;
private final String id;
private final String subId;
private String msg;

public ModelLoaderError(int type, String msg) {
this(type, null, null, msg);
}

public ModelLoaderError(int type, String id, String msg) {
this(type, id, null, msg);
}

public ModelLoaderError(int type, String id, String subId, String msg) {
this.type = type;
this.id = id;
this.subId = subId;
this.msg = msg;
}

@Override
public String toString() {
if (id != null) {
return msg;
} else {
return "[id=" + id + "]"+ msg;
}
}
}

+ 0
- 9
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/BpmKeyValue.java Переглянути файл

@@ -1,9 +0,0 @@
package cc.smtweb.system.bpm.core.ui;

import lombok.Data;

@Data
public class BpmKeyValue {
private String optKey;
private String optValue;
}

+ 0
- 37
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/BpmListData.java Переглянути файл

@@ -1,37 +0,0 @@
package cc.smtweb.system.bpm.core.ui;

import cc.smtweb.framework.core.common.SwMap;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

@Getter
public class BpmListData {
public static final BpmListData EMPTY = new BpmListData(new ArrayList<>(), 0);

private final List<SwMap> rows;
// 总数, -1 表示需要异步获取数量, >=0 表示总数
private int total;

private BpmListData(List<SwMap> rows, int total) {
this.rows = rows;
this.total = total;
}

public static BpmListData create(List<SwMap> list, boolean loadCount) {
if (list == null) {
return BpmListData.EMPTY;
}

if (loadCount) {
return new BpmListData(list, -1);
} else {
return new BpmListData(list, list.size());
}
}

public boolean isEmpty() {
return rows == null || rows.isEmpty();
}
}

+ 0
- 13
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/BpmMapData.java Переглянути файл

@@ -1,13 +0,0 @@
package cc.smtweb.system.bpm.core.ui;

import java.util.HashMap;

public class BpmMapData extends HashMap<String, String> {
public BpmMapData() {

}

public BpmMapData(int initialCapacity) {
super(initialCapacity);
}
}

+ 0
- 60
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/BpmPageContext.java Переглянути файл

@@ -1,60 +0,0 @@
package cc.smtweb.system.bpm.core.ui;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.mvc.controller.IBeanContext;
import cc.smtweb.framework.core.session.SessionUtil;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmFieldLookup;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Getter
public class BpmPageContext {
static final String ATTR_MAP_BODY = "_bpm_map_body";
private final IBeanContext context;
private final Map<String, Object> params;
private final HttpServletRequest request;
private final String postBody;

private SwMap body;
private UserSession session;
@Setter
private boolean deploy = true;
@Setter
private String pageName;
@Setter
private BpmDataset dataset;
@Setter
private BpmFieldLookup fieldLookup;

// BpmPageContext(SwMap body, UserSession session) {
// this.body = body;
// this.session = session;
// }

public BpmPageContext(IBeanContext context, Map<String, Object> params, String body, HttpServletRequest request) {
this.context = context;
this.params = params;
this.request = request;
this.postBody = body;

SwMap mapBody = null;
if (StringUtils.isNotBlank(body)) {
mapBody = JsonUtil.parse(body, SwMap.class);
request.setAttribute(ATTR_MAP_BODY, mapBody);
}

this.body = mapBody;
this.session = (UserSession) SessionUtil.getSession();
}

public long getParamId() {
return body.readLong(IParamConst.PARAM_ID, 0L);
}
}

+ 0
- 29
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/IParamConst.java Переглянути файл

@@ -1,29 +0,0 @@
package cc.smtweb.system.bpm.core.ui;

/**
* 前端页面参数名
* @author xkliu
*/
public interface IParamConst {
// 请求参数
String PARAM_PAGE_ID = "pageId";
String PARAM_PAGE_NAME = "pageName";
String PARAM_DATASET = "dataset";
String PARAM_ID = "id";
String PARAMS_IDS = "ids";
String PARAM_PARENT_ID = "dataParentId";
String PARAM_ORDERS = "dataOrders";
// 分页参数
String PARAM_PAGE_INDEX = "pageIndex";
String PARAM_PAGE_SIZE = "pageSize";
int PAGE_DEFAULT_SIZE = 20;
// 字段参数后缀
String LOOKUP_TEXT = "_text";
String LOOKUP_KEY = "_key";
// lookup : select/tree
String OPTION_KEY = "optKey";
String OPTION_LABEL = "optLabel";
String OPTION_ORDER = "optOrder";
// tree 返回值
String TREE_CHILDREN = "children";
}

+ 0
- 80
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/bind/BpmBeanAttrEditor.java Переглянути файл

@@ -1,80 +0,0 @@
package cc.smtweb.system.bpm.core.ui.bind;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.exception.BindBeanException;
import cc.smtweb.framework.core.mvc.controller.binder.attr.AbstractAttrEditor;
import cc.smtweb.system.bpm.util.BeanUtil;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* API函数@SwBody参数的转换处理,POST请求直接转换Json内容为Bean对象,GET请求转换Map请求参数为Bean对
* @author xkliu
*/
public class BpmBeanAttrEditor extends AbstractAttrEditor implements IBpmBeanConst {
@Override
public Object getValue(String paramName, Class<?> paramType, HttpServletRequest request) {
if (ATTRIBUTE_ROW.equals(paramName)) {
return getBeanRow(paramType, request);
} else if (ATTRIBUTE_ROWS.equals(paramName)) {
return getBeanRows(paramType, request);
}

return request.getAttribute(paramName);
}

private Object getBeanRow(Class<?> paramType, HttpServletRequest request) {
SwMap map = (SwMap)request.getAttribute(BEAN_ROW_MAP);
Object bean = request.getAttribute(BEAN_ROW_BEAN);

if (bean != null) {
if (map != null) {
// 逻辑有错误 map 和 bean 不会同时有值
request.removeAttribute(BEAN_ROW_BEAN);
}

// if (paramType != null) {
// if (!paramType.equals(bean.getClass())) {
// throw new BindBeanException("type noe equals " + paramType.getName() + "," + bean.getClass().getName());
// }
// }
} else if (map != null) {
try {
bean = paramType.newInstance();
} catch (IllegalAccessException | InstantiationException e) {
throw new BindBeanException(e);
}

BeanUtil.mapToBean(map, bean);
request.setAttribute(BEAN_ROW_MAP, bean);
request.removeAttribute(BEAN_ROW_BEAN);
}

return bean;
}

private List<?> getBeanRows(Class<?> paramType, HttpServletRequest request) {
List<SwMap> map = (List<SwMap>)request.getAttribute(BEAN_ROWS_MAP);
List<?> bean = (List<?>)request.getAttribute(BEAN_ROWS_BEAN);

if (bean != null) {
if (map != null) {
// 逻辑有错误 map 和 bean 不会同时有值
request.removeAttribute(BEAN_ROWS_MAP);
}

// if (paramType != null) {
// if (!paramType.equals(bean.getClass())) {
// throw new BindBeanException("type noe equals " + paramType.getName() + "," + bean.getClass().getName());
// }
// }
} else if (map != null) {
bean = BeanUtil.toBeanList(map, paramType);
request.setAttribute(BEAN_ROWS_BEAN, bean);
request.removeAttribute(BEAN_ROWS_MAP);
}

return bean;
}
}

+ 0
- 62
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/bind/BpmMapAttrEditor.java Переглянути файл

@@ -1,62 +0,0 @@
package cc.smtweb.system.bpm.core.ui.bind;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.mvc.controller.binder.attr.AbstractAttrEditor;
import cc.smtweb.system.bpm.util.BeanUtil;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* API函数@SwBody参数的转换处理,POST请求直接转换Json内容为Bean对象,GET请求转换Map请求参数为Bean对
* @author xkliu
*/
public class BpmMapAttrEditor extends AbstractAttrEditor implements IBpmBeanConst {
@Override
public Object getValue(String paramName, Class<?> paramType, HttpServletRequest request) {
if (ATTRIBUTE_ROW.equals(paramName)) {
return getMapRow(request);
} else if (ATTRIBUTE_ROWS.equals(paramName)) {
return getMapRows(request);
}

return request.getAttribute(paramName);
}

private Object getMapRow(HttpServletRequest request) {
SwMap map = (SwMap)request.getAttribute(BEAN_ROW_MAP);
Object bean = request.getAttribute(BEAN_ROW_BEAN);

if (map != null) {
if (bean != null) {
// 逻辑有错误 map 和 bean 不会同时有值
request.removeAttribute(BEAN_ROW_BEAN);
}
} else if (bean != null) {
map = new SwMap();
BeanUtil.beanToMap(bean, map);
request.setAttribute(BEAN_ROW_MAP, map);
request.removeAttribute(BEAN_ROW_BEAN);
}

return map;
}

private Object getMapRows(HttpServletRequest request) {
List<SwMap> map = (List<SwMap>)request.getAttribute(BEAN_ROWS_MAP);
List<?> bean = (List<?>)request.getAttribute(BEAN_ROWS_BEAN);

if (map != null) {
if (bean != null) {
// 逻辑有错误 map 和 bean 不会同时有值
request.removeAttribute(BEAN_ROWS_BEAN);
}
} else if (bean != null) {
map = BeanUtil.toMapList(bean);
request.setAttribute(BEAN_ROWS_MAP, map);
request.removeAttribute(BEAN_ROWS_BEAN);
}

return map;
}
}

+ 0
- 68
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/bind/BpmPageContextEditor.java Переглянути файл

@@ -1,68 +0,0 @@
package cc.smtweb.system.bpm.core.ui.bind;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.mvc.controller.IBeanContext;
import cc.smtweb.framework.core.mvc.controller.IEditor;
import cc.smtweb.system.bpm.core.exception.BpmException;
import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.IParamConst;
import cc.smtweb.system.bpm.core.ui.entity.BpmPage;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.spring.cache.BpmPageCache;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

public class BpmPageContextEditor implements IEditor {

public BpmPageContextEditor(){
}

@Override
public Object getParamValue(String paramName, Class<?> paramType, IBeanContext context, Map<String, Object> params, String body, HttpServletRequest request) {
BpmPageContext pageContext = new BpmPageContext(context, params, body, request);
SwMap mapBody = pageContext.getBody();
String pageName = mapBody.readString(IParamConst.PARAM_PAGE_NAME);
if (pageName == null) {
pageName = mapBody.readString(IParamConst.PARAM_PAGE_ID);
}

BpmPage page = loadPage(pageName);
pageContext.setPageName(page.getFullName());
pageContext.setDeploy(page.isDeploy());
pageContext.setDataset(findUiDataset(page, mapBody.readString(IParamConst.PARAM_DATASET)));

return pageContext;
}

private BpmPage loadPage(String pageName) {
if (pageName == null) {
throw new BpmException("参数 pageName 必填");
}

BpmPage uiPage = BpmPageCache.getInstance().get(pageName);
if (uiPage == null) {
uiPage = BpmPageCache.getInstance().getByOtherKey(pageName);
}

if (uiPage == null) {
throw new BpmException("未找到页面, name=" + pageName);
}

return uiPage;
}

private BpmDataset findUiDataset(BpmPage uiPage, String datasetName) {
if (datasetName == null) {
throw new BpmException("参数 dataset 必填");
}

BpmDataset dataset = uiPage.findDatasetByName(datasetName);

if (dataset == null) {
throw new BpmException("未找到dataset, pageId=" + uiPage.getId() + ", id=" + datasetName);
}

return dataset;
}
}

+ 0
- 13
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/bind/IBpmBeanConst.java Переглянути файл

@@ -1,13 +0,0 @@
package cc.smtweb.system.bpm.core.ui.bind;

public interface IBpmBeanConst {
String ATTRIBUTE_ROW = "row";
String ATTRIBUTE_ROWS = "rows";

String BEAN_ROW = "_sw_bpm_" + ATTRIBUTE_ROW;
String BEAN_ROW_MAP = BEAN_ROW + "_map";
String BEAN_ROW_BEAN = BEAN_ROW + "_bean";
String BEAN_ROWS = "_sw_bpm_" + ATTRIBUTE_ROWS;
String BEAN_ROWS_MAP = BEAN_ROWS + "_map";
String BEAN_ROWS_BEAN = BEAN_ROWS + "_bean";
}

+ 0
- 310
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/CardDataBuilder.java Переглянути файл

@@ -1,310 +0,0 @@
package cc.smtweb.system.bpm.core.ui.builder;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.sqlbuilder.AbstractUpdateSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.DeleteSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.DateUtil;
import cc.smtweb.system.bpm.core.exception.BpmFieldError;
import cc.smtweb.system.bpm.core.exception.BpmValidException;
import cc.smtweb.system.bpm.core.ui.IParamConst;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmField;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmFieldLookup;
import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.*;
import java.util.regex.Pattern;

/**
* 卡片界面保存操作的SQL构建
* @author xkliu
*/
public class CardDataBuilder {
private DbEngine dbEngine;

@Getter
private long masterId;

private Long masterParentId;

@Getter
private boolean instert;
private UserSession userSession;
private Long now;
private CardTreeDataBuilder cardTreeDataBuilder;

private List<AbstractUpdateSqlBuilder> sqlBuilders = new ArrayList<>();
private BpmDataset masterDataset;

/* 字段验证错误列表 */
@Getter
private List<BpmFieldError> fieldErrors;

public CardDataBuilder(DbEngine dbEngine, long dataId, Long parentDataId, UserSession userSession) {
this.dbEngine = dbEngine;
this.masterId = dataId;
this.masterParentId = parentDataId;
this.instert = dataId == 0;
this.userSession = userSession;
}

public void build(BpmDataset dataset, SwMap body, UserSession us) {
masterDataset = dataset;
build(dataset, body, masterId, masterParentId);
List<BpmDataset> slaves = dataset.getOneToOneDataset();
if (slaves != null) {
for (BpmDataset slave : slaves) {
long slaveId = body.readLong(slave.getIdField().getName(), 0L);
build(slave, body, slaveId, null);
}
}
}

private void build(BpmDataset dataset, SwMap body, long dataId, Long parentDataId) {
AbstractUpdateSqlBuilder sqlBuilder;
if (dataId == 0) {
// insert
sqlBuilder = SqlBuilder.createInsert(dataset.getDatabase(), dataset.getTable());

if (masterId == 0) {
masterId = dbEngine.nextId();
if (dataset.getIdField() != null) {
body.put(dataset.getIdField().getName(), masterId);
}
}
// remove: 放到后面统一处理
// sqlBuilder.add(dataset.getIdFieldName(), masterId);

// if (parentDataId != null && parentDataId > 0) {
// BpmField parentIdField = dataset.findFieldByRefType(UiEnum.FieldRefType.PARENT_ID);
// if (parentIdField != null) {
// sqlBuilder.add(parentIdField.getFieldName(), parentDataId);
// }
// }
} else {
// update
sqlBuilder = SqlBuilder.createUpdate(dataset.getDatabase(), dataset.getTable());
sqlBuilder.addWhere(dataset.readIdFieldName(), masterId);
}

cardTreeDataBuilder = null;

for (Map.Entry<String, BpmField> entry: dataset.getFields().entrySet()) {
BpmField bpmField = entry.getValue();

String fieldName = bpmField.getFieldName();
// 只读和虚拟控件不进行保存
if (!bpmField.isReadonly() && StringUtils.isNotBlank(fieldName)) {
if (dataset.getIdField() == bpmField) {
// id字段新增才需要设置值
if (dataId == 0) {
sqlBuilder.add(fieldName, masterId);
}
} else {
Object fieldValue = body.get(bpmField.getName());

validField(bpmField, fieldValue);

if (bpmField.isLookupManyToMay()) {
// 中间表数据修改
buildManyToMany(dataset, bpmField, (String) fieldValue);
} else {
// 处理String空串为NULL值
if (fieldValue != null) {
if (fieldValue instanceof String && StringUtils.isBlank((String) fieldValue)) {
fieldValue = null;
}
}

// 处理默认值字段和计算字段
switch (bpmField.getRefType()) {
case UiEnum.FieldRefType.SITE_ID:
if (dataId == 0) {
// 新增才保存数据
sqlBuilder.add(fieldName, userSession.getSiteId());
}
break;
case UiEnum.FieldRefType.CREATE_TIME:
if (dataId == 0) {
// 新增才保存数据
sqlBuilder.add(fieldName, loadLastTime());
}
break;
case UiEnum.FieldRefType.LAST_TIME:
sqlBuilder.add(fieldName, loadLastTime());
break;
case UiEnum.FieldRefType.PARENT_ID:
sqlBuilder.add(fieldName, fieldValue);
updateCardTreeData(UiEnum.FieldRefType.PARENT_ID, fieldName, fieldValue);
break;
case UiEnum.FieldRefType.PARENT_ID_LIST:
updateCardTreeData(UiEnum.FieldRefType.PARENT_ID_LIST, fieldName, fieldValue);
break;
case UiEnum.FieldRefType.TREE_LEVEL:
updateCardTreeData(UiEnum.FieldRefType.TREE_LEVEL, fieldName, fieldValue);
break;
default:
sqlBuilder.add(fieldName, fieldValue);
break;
}
}
}
}
}

saveCardTreeData(dataset, dataId, sqlBuilder);

sqlBuilders.add(sqlBuilder);
}

private void updateCardTreeData(int type, String fieldName, Object fieldValue) {
if (cardTreeDataBuilder == null) {
cardTreeDataBuilder = new CardTreeDataBuilder(dbEngine);
}

cardTreeDataBuilder.add(type, fieldName, fieldValue);
}

private void saveCardTreeData(BpmDataset dataset, long dataId, AbstractUpdateSqlBuilder sqlBuilder) {
if (cardTreeDataBuilder != null) {
AbstractUpdateSqlBuilder newSqlBuilder = cardTreeDataBuilder.save(dataset, dataId, sqlBuilder);
cardTreeDataBuilder = null;

if (newSqlBuilder != null) {
sqlBuilders.add(newSqlBuilder);
}
}
}

private Long loadLastTime() {
if (now == null) {
now = DateUtil.nowDateTimeLong();
}

return now;
}

private void validField(BpmField bpmField, Object fieldValue) {
if (bpmField.isRequired()) {
if (fieldValue == null || StringUtils.isBlank(fieldValue.toString())) {
// 对应前端的验证错误对象 ValidateError(message, field)
addFieldError(bpmField.getName(), bpmField.getLabel() + "必须填写");
return;
}
}

if (fieldValue != null && StringUtils.isNotBlank(bpmField.getValidPatten())) {
if (!Pattern.matches(bpmField.getValidPatten(), fieldValue.toString())) {
if (StringUtils.isNotBlank(bpmField.getValidMessage())) {
addFieldError(bpmField.getName(), bpmField.getValidMessage());
} else {
addFieldError(bpmField.getName(), bpmField.getLabel() + "格式不正确");
}
}
}
}

private void addFieldError(String field, String message) {
if (this.fieldErrors == null) {
this.fieldErrors = new ArrayList<>();
}

this.fieldErrors.add(new BpmFieldError(field, message));
}

private void buildManyToMany(BpmDataset dataset, BpmField bpmField, String newValue) {
BpmFieldLookup lookup = (BpmFieldLookup) bpmField.getLookup();

// 读取旧记录
Set<String> oldIds = dbEngine.queryStringSet("SELECT " + lookup.getMiddleValueField() + " FROM " + dataset.getDatabase() + "." + lookup.getMiddleTable()
+ " WHERE " + lookup.getMiddleKeyField() + "=?", masterId);
Set<String> newIds = toIdSet(newValue);

for (String newId: newIds) {
if (!oldIds.remove(newId)) {
// insert
InsertSqlBuilder sqlBuilder = SqlBuilder.createInsert(dataset.getDatabase(), lookup.getMiddleTable());
sqlBuilder.add(lookup.getMiddleIdField(), dbEngine.nextId());
sqlBuilder.add(lookup.getMiddleKeyField(), masterId);
sqlBuilder.add(lookup.getMiddleValueField(), newId);
sqlBuilders.add(sqlBuilder);
}
}

for (String oldId: oldIds) {
// delete
DeleteSqlBuilder sqlBuilder = SqlBuilder.createDelete(dataset.getDatabase(), lookup.getMiddleTable());
sqlBuilder.addWhere(lookup.getMiddleKeyField(), masterId);
sqlBuilder.addWhere(lookup.getMiddleValueField(), oldId);
sqlBuilders.add(sqlBuilder);
}
}

private Set<String> toIdSet(String str) {
Set<String> result = new HashSet<>();

if (StringUtils.isNotBlank(str)) {
Collections.addAll(result, str.split(","));
}

return result;
}

public long update() {
if (sqlBuilders.size() > 1) {
dbEngine.doTrans(() -> {
for (AbstractUpdateSqlBuilder sqlBuilder : sqlBuilders) {
sqlBuilder.update(dbEngine);
}

return true;
});
} else {
for (AbstractUpdateSqlBuilder sqlBuilder : sqlBuilders) {
sqlBuilder.update(dbEngine);
}
}

return masterId;
}

public SwMap update(SwMap data) {
if (data == null) {
data = new SwMap();
}

for (AbstractUpdateSqlBuilder sqlBuilder : sqlBuilders) {
sqlBuilder.updateMap(data);
}

return data;
}

public String getTableName() {
return masterDataset.fullName();
}

public boolean hasFieldErrors() {
return this.fieldErrors != null;
}

public static CardDataBuilder create(DbEngine dbEngine, BpmDataset dataset, SwMap body, UserSession us) {
long dataId = body.readLong(IParamConst.PARAM_ID, 0L);
Long parentDataId = body.readLong(IParamConst.PARAM_PARENT_ID);
CardDataBuilder cardDataBuilder = new CardDataBuilder(dbEngine, dataId, parentDataId, us);

cardDataBuilder.build(dataset, body, us);

if (cardDataBuilder.hasFieldErrors()) {
throw new BpmValidException(cardDataBuilder.getFieldErrors());
}

return cardDataBuilder;
}
}

+ 0
- 134
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/CardTreeDataBuilder.java Переглянути файл

@@ -1,134 +0,0 @@
package cc.smtweb.system.bpm.core.ui.builder;

import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.sqlbuilder.AbstractSelectSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.AbstractUpdateSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder;
import cc.smtweb.system.bpm.core.exception.BpmDataException;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum;
import org.apache.commons.lang3.StringUtils;

public class CardTreeDataBuilder {
private Long parentId;
private String fieldParentId;
private String fieldParentIdList;
private String fieldLevel;
private DbEngine dbEngine;

public CardTreeDataBuilder(DbEngine dbEngine) {
this.dbEngine = dbEngine;
}

public void add(int type, String fieldName, Object fieldValue) {
switch (type) {
case UiEnum.FieldRefType.PARENT_ID:
parentId = readLong(fieldValue);
fieldParentId = fieldName;
break;
case UiEnum.FieldRefType.PARENT_ID_LIST:
fieldParentIdList = fieldName;
break;
case UiEnum.FieldRefType.TREE_LEVEL:
fieldLevel = fieldName;
break;
default:
throw new IllegalStateException("Unexpected value: " + type);
}
}

public static Long readLong(Object s) {
if (s != null) {
if (s instanceof Number) {
return ((Number) s).longValue();
} else {
String value = s.toString();
if (StringUtils.isNotBlank(value)) {
return Long.parseLong(value);
}
}
}

return null;
}

public AbstractUpdateSqlBuilder save(BpmDataset dataset, long dataId, AbstractUpdateSqlBuilder sqlBuilder) {
if (fieldParentId != null) {
if (fieldParentIdList == null && fieldLevel == null) {
return null;
}

if (fieldParentIdList == null || fieldLevel == null) {
throw new BpmDataException("必须同时设置parentIdList和level作用字段");
}

// TODO 检测需要同时设置idList和level
String idFileName = dataset.readIdFieldName();
String parentIdList = null;
int treeLevel = 0;
if (parentId == null) {
sqlBuilder.add(fieldParentIdList, "");
sqlBuilder.add(fieldLevel, 0);
parentIdList = parentId + "-";
} else {
// 读取SQL
AbstractSelectSqlBuilder select = SqlBuilder.createSelect(dataset.getDatabase(), dataset.getTable());
select.add(fieldParentIdList + " parentIdList");
select.add(fieldLevel + " level");

select.addWhere(idFileName, parentId);

TreeItemVO parentVO = select.queryEntity(dbEngine, TreeItemVO.class);
if (parentVO != null) {
parentIdList = parentVO.getParentIdList() + parentId + "-";
treeLevel = parentVO.getLevel() + 1;
sqlBuilder.add(fieldParentIdList, parentIdList);
sqlBuilder.add(fieldLevel, treeLevel);
} else {
throw new BpmDataException("not find parent by " + dataset.getTable() + "." + idFileName + "=" + parentId);
}
}

// 如果parentId有修改,需要处理所有下级的 parentIdList 和 level
if (dataId != 0) {
AbstractSelectSqlBuilder select = SqlBuilder.createSelect(dataset.getDatabase(), dataset.getTable());
select.add(fieldParentIdList, parentIdList);
select.add(fieldParentId + " parentId");
select.add(fieldLevel + " level");
select.addWhere(idFileName, dataId);

TreeItemVO curVO = select.queryEntity(dbEngine, TreeItemVO.class);
if (curVO != null) {
if (!LongEquals(curVO.getParentId(), parentId)) {
parentIdList = parentIdList + dataId + "-";
// update table set parentIdList=CONCAT('1-2-4-', SUBSTR(parentIdList, 6)) where parentIdList like "1-2-3-%", level = level + 1;
UpdateSqlBuilder sb = SqlBuilder.createUpdate(dataset.getDatabase(), dataset.getTable());
sb.add(String.format("%s=CONCAT('%s', SUBSTR(%s, %d))", fieldParentIdList, parentIdList, fieldParentIdList, curVO.getParentIdList().length() + 1),
UpdateSqlBuilder.VALUE_INVALID);
if (curVO.getLevel() > treeLevel) {
sb.add(String.format("%s=%s + %d", fieldLevel, fieldLevel, curVO.getLevel() - treeLevel), UpdateSqlBuilder.VALUE_INVALID);
} else if (curVO.getLevel() < treeLevel) {
sb.add(String.format("%s=%s - %d", fieldLevel, fieldLevel, treeLevel - curVO.getLevel()), UpdateSqlBuilder.VALUE_INVALID);
}
sb.addWhere(fieldParentIdList, curVO.getParentIdList() + "%", " like ");

return sb;
}
} else {
throw new BpmDataException("not find data by " + dataset.getTable() + "." + idFileName + "=" + dataId);
}
}
}

return null;
}

private static boolean LongEquals(Long oldValue, Long newValue) {
if (oldValue != null) {
return oldValue.equals(newValue);
}

return newValue == null;
}
}

+ 0
- 106
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/SqlUtil.java Переглянути файл

@@ -1,106 +0,0 @@
package cc.smtweb.system.bpm.core.ui.builder;

import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;

import java.util.List;
import java.util.function.Function;

public class SqlUtil {
// 包含
static final int OP_SUB = 1;
// 全匹配
static final int OP_ALL = 2;
// 前匹配
static final int OP_BEGIN = 3;
// 后匹配
static final int OP_END = 4;
// 等于
static final int OP_EQUAL = 5;
// 不等于
static final int OP_NOT_EQUAL = 6;
// 大于
static final int OP_GRATER = 7;
// 大于等于
static final int OP_NOT_LESS = 8;
// 小于
static final int OP_LESS = 9;
// 小于等于
static final int OP_NOT_GRATER = 10;

// 查询参数
public static final String PN_FILTER = "filter";
public static final String PN_SEARCH = "search";
public static final String PN_SEARCH_TYPE = "searchType";

private SqlUtil(){}

public static void addSqlWhere(SqlBuilder sqlBuilder, String field, int op, Object keyword) {
if (keyword instanceof String) {
keyword = ((String) keyword).trim();
}

switch (op) {
default:
case OP_EQUAL:
case OP_ALL:
sqlBuilder.addWhere(field, keyword, "=");
break;
case OP_NOT_EQUAL:
sqlBuilder.addWhere(field, keyword, "<>");
break;
case OP_GRATER:
sqlBuilder.addWhere(field, keyword, ">");
break;
case OP_NOT_LESS:
sqlBuilder.addWhere(field, keyword, ">=");
break;
case OP_LESS:
sqlBuilder.addWhere(field, keyword, "<");
break;
case OP_NOT_GRATER:
sqlBuilder.addWhere(field, keyword, "<=");
break;
case OP_SUB:
sqlBuilder.addWhere(field, "%" + keyword + "%", " like ");
break;
case OP_BEGIN:
sqlBuilder.addWhere(field, "%" + keyword, " like ");
break;
case OP_END:
sqlBuilder.addWhere(field, keyword + "%", " like ");
break;
}
}

public static String makeSummaryField(String rule, String fieldName) {
switch (rule) {
case "${count}":
return "count(" + fieldName + ")";
case "${sum}":
return "sum(" + fieldName + ")";
case "${avg}":
return "avg(" + fieldName + ")";
case "${min}":
return "min(" + fieldName + ")";
case "${max}":
return "max(" + fieldName + ")";
default:
return rule;
}
}

public static <T> String join(List<T> list, Function<T, String> action) {
if (list.isEmpty()) {
return null;
}

StringBuilder sb = new StringBuilder();
for (T t: list) {
sb.append(action.apply(t)).append(',');
}

sb.setLength(sb.length() - 1);

return sb.toString();
}
}

+ 0
- 207
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/TreeDataBuilder.java Переглянути файл

@@ -1,207 +0,0 @@
package cc.smtweb.system.bpm.core.ui.builder;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.sqlbuilder.AbstractSelectSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.system.bpm.core.exception.BpmException;
import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.IParamConst;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmField;
import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum;
import cc.smtweb.system.bpm.engine.ui.entity.po.DynFormLogPO;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* 数据模型处理,读取和排序处理
*/
@Getter
public class TreeDataBuilder {
private BpmField idField = null;
private BpmField parentField = null;
private BpmField orderField = null;
private BpmField titleField = null;
private BpmDataset dataset;
private Long parentId;
private Long[] orders;
private String idName;

public static TreeDataBuilder create(BpmPageContext ctx) {
SwMap body = ctx.getBody();
Long parentId = body.readLong(IParamConst.PARAM_PARENT_ID);
Long[] orders = body.readLongArray(IParamConst.PARAM_ORDERS);

if (orders == null) {
throw new BpmException(IParamConst.PARAM_ORDERS + " 参数必填");
}

TreeDataBuilder treeDataBuilder = new TreeDataBuilder(ctx.getDataset(), parentId, orders);

if (treeDataBuilder.getParentField() == null) {
throw new BpmException("dataset未设置‘上级ID’字段");
}

if (treeDataBuilder.getOrderField() == null) {
throw new BpmException("dataset未设置‘排序’字段");
}
return treeDataBuilder;
}

public TreeDataBuilder(BpmDataset dataset, Long parentId, Long[] orders) {
this.dataset = dataset;
this.parentId = parentId;
this.orders = orders;
for (Map.Entry<String, BpmField> entry: dataset.getFields().entrySet()) {
BpmField bpmField = entry.getValue();

switch (bpmField.getRefType()) {
case UiEnum.FieldRefType.ID:
idField = bpmField;
break;
case UiEnum.FieldRefType.PARENT_ID:
parentField = bpmField;
break;
case UiEnum.FieldRefType.ORDER:
orderField = bpmField;
break;
case UiEnum.FieldRefType.TITLE:
titleField = bpmField;
break;
default:
break;
}
}

idName = idField != null ? idField.getName() : IParamConst.PARAM_ID;
}

public AbstractSelectSqlBuilder tableSqlBuilder() {
AbstractSelectSqlBuilder sqlBuilder = SqlBuilder.createSelect(dataset.getDatabase(), dataset.getTable());

if (idField != null) {
sqlBuilder.add(idField.getFieldName() + " " + idField.getName());
} else {
sqlBuilder.add(dataset.readIdFieldName() + " id");
}
sqlBuilder.add(parentField.getFieldName() + " " + parentField.getName());
sqlBuilder.add(titleField.getFieldName() + " " + titleField.getName());

if (orderField != null) {
sqlBuilder.addOrderBy(orderField.getFieldName() + "," + dataset.readIdFieldName());
} else {
sqlBuilder.addOrderBy(dataset.readIdFieldName());
}

return sqlBuilder;
}

public SwMap mapTreeFields(BpmDataset dataset, DynFormLogPO po) {
if (StringUtils.isNotBlank(po.getDflContent())) {
SwMap item = new SwMap();
SwMap entity = JsonUtil.parse(po.getDflContent(), SwMap.class);

item.put(parentField.getName(), entity.get(parentField.getFieldName()));
item.put(titleField.getName(), entity.get(titleField.getFieldName()));
item.put("id", po.getDflId());

return item;
}

return null;
}

public SwMap updateOrder(DynFormLogPO po, Long parentId, int order) {
SwMap entity;
if (StringUtils.isNotBlank(po.getDflContent())) {
entity = JsonUtil.parse(po.getDflContent(), SwMap.class);
} else {
entity = new SwMap();
}

entity.put(this.parentField.getFieldName(), parentId);
entity.put(this.orderField.getFieldName(), order);

return entity;
}

public static boolean longEquals(Long l1, Long l2) {
if (l1 != null) {
return l1.equals(l2);
}

return l2 == null;
}

private void addChild(SwMap parent, SwMap item) {
List<SwMap> children = readChildren(parent);

if (children == null) {
children = new ArrayList<>();
parent.put(IParamConst.TREE_CHILDREN, children);
}

children.add(item);
}

private boolean findAndAdd(SwMap parent, SwMap item) {
if (longEquals(parent.readLong(idName), item.readLong(parentField.getName()))) {
addChild(parent, item);
return true;
} else {
List<SwMap> children = readChildren(parent);

if (children != null) {
for (SwMap child : children) {
if (findAndAdd(child, item)) {
return true;
}
}
}
}

return false;
}

private List<SwMap> readChildren(SwMap parent) {
return (List<SwMap>) parent.get(IParamConst.TREE_CHILDREN);
}

// 读取树结构
public List<SwMap> buildTree(List<SwMap> list, boolean forceAdd) {
SwMap root = new SwMap();

if (list != null) {
for (SwMap item: list) {
if (!findAndAdd(root, item)) {
for (SwMap it: list) {
// TODO IParamConst.PARAM_ID => idField.getId()
if (longEquals(it.readLong(idName), item.readLong(parentField.getName()))) {
addChild(it, item);
item = null;
break;
}
}

// not find item parent
if (item != null && forceAdd) {
addChild(root, item);
}
}
}
}

List<SwMap> result = readChildren(root);

if (result == null) {
result = new ArrayList<>();
}

return result;
}
}

+ 0
- 10
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/TreeItemVO.java Переглянути файл

@@ -1,10 +0,0 @@
package cc.smtweb.system.bpm.core.ui.builder;

import lombok.Data;

@Data
public class TreeItemVO {
private Long parentId;
private String parentIdList;
private int level;
}

+ 0
- 20
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/dataset/DateFieldFormater.java Переглянути файл

@@ -1,20 +0,0 @@
package cc.smtweb.system.bpm.core.ui.dataset;


import cc.smtweb.framework.core.util.DateUtil;

public class DateFieldFormater extends FieldFormatter {

public DateFieldFormater(String name) {
super(name);
}

@Override
public String format(Object value) {
if (value instanceof Number) {
return DateUtil.formatDate(((Number) value).longValue());
}

return "";
}
}

+ 0
- 20
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/dataset/DateTimeFieldFormater.java Переглянути файл

@@ -1,20 +0,0 @@
package cc.smtweb.system.bpm.core.ui.dataset;


import cc.smtweb.framework.core.util.DateUtil;

public class DateTimeFieldFormater extends FieldFormatter {

public DateTimeFieldFormater(String name) {
super(name);
}

@Override
public String format(Object value) {
if (value instanceof Number) {
return DateUtil.formatDateTime(((Number) value).longValue());
}

return "";
}
}

+ 0
- 42
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/dataset/FieldFormatTool.java Переглянути файл

@@ -1,42 +0,0 @@
package cc.smtweb.system.bpm.core.ui.dataset;

import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmField;
import org.apache.commons.lang3.StringUtils;

/**
* 字段格式化工具
*
* @author xkliu
*/
public class FieldFormatTool {
public static boolean needFormat(BpmField bpmField) {
return StringUtils.isNotBlank(bpmField.getDisplayFormat());
}

public static FieldFormatter buildFormatter(BpmField bpmField) {

switch (bpmField.getType()) {
case BpmField.TYPE_DATE:
return new DateFieldFormater(bpmField.getName());
case BpmField.TYPE_DATE_TIME:
return new DateTimeFieldFormater(bpmField.getName());
default:
return new FieldFormatter(bpmField.getName());
}
}

public static void fixDisplayFormat(BpmField bpmField) {
if (StringUtils.isBlank(bpmField.getDisplayFormat())) {
switch (bpmField.getType()) {
case BpmField.TYPE_DATE:
bpmField.setDisplayFormat("yyyy-MM-dd");
break;
case BpmField.TYPE_DATE_TIME:
bpmField.setDisplayFormat("yyyy-MM-dd HH:mm:ss");
break;
default:
break;
}
}
}
}

+ 0
- 16
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/dataset/FieldFormatter.java Переглянути файл

@@ -1,16 +0,0 @@
package cc.smtweb.system.bpm.core.ui.dataset;

import lombok.Getter;

public class FieldFormatter {
@Getter
private String name;

FieldFormatter(String name) {
this.name = name;
}

public String format(Object value) {
return value.toString();
}
}

+ 0
- 43
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/entity/BpmPage.java Переглянути файл

@@ -1,43 +0,0 @@
package cc.smtweb.system.bpm.core.ui.entity;

import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.core.ui.entity.form.BpmForm;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
public class BpmPage implements Serializable {
private long id;
private String fullName;
private int modelType;
private boolean isDeploy = true;
private Boolean destroyOnClose;
// 数据集
private List<BpmDataset> datasets = new ArrayList<>();
// 界面
private List<BpmForm> forms = new ArrayList<>();

public BpmDataset findDatasetByName(String name) {
if (StringUtils.isNotBlank(name)) {
for (BpmDataset dataset : datasets) {
if (name.equals(dataset.getName())) {
return dataset;
}
}
}

return null;
}

public BpmDataset findMasterDataset() {
return datasets.get(0);
}

public void addDataset(BpmDataset dataset) {
datasets.add(dataset);
}
}

+ 0
- 33
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/entity/dataset/AbstractBpmFieldLookup.java Переглянути файл

@@ -1,33 +0,0 @@
package cc.smtweb.system.bpm.core.ui.entity.dataset;

import cc.smtweb.system.bpm.engine.ui.entity.consts.MappingTypeEnum;
import lombok.Getter;

public abstract class AbstractBpmFieldLookup {
@Getter
private final String db;

@Getter
private final String table;

@Getter
private final boolean number;

/**
* lookup对象类型
* @return Lookup对象类型
*/
public abstract int type();

public AbstractBpmFieldLookup(String dbName, String table, boolean isNumber) {
this.db = dbName;
this.table = table;
this.number = isNumber;
}

public abstract MappingTypeEnum getMappingType();

public boolean isManyToMany() {
return MappingTypeEnum.manyToMany.equals(getMappingType());
}
}

+ 0
- 186
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/entity/dataset/BpmDataset.java Переглянути файл

@@ -1,186 +0,0 @@
package cc.smtweb.system.bpm.core.ui.entity.dataset;

import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* BPM界面引擎后台执行用到的对象
* @author xkliu
*/
@Data
public class BpmDataset {
public static final int DATA_MODEL_CARD = 1;
public static final int DATA_MODEL_LIST = 2;
public static final int DATA_MODEL_TREE = 3;

private String id;
private String name;
private String database;
private String table;
/** 主键字段名 */
private BpmField idField;

private String fieldPrefix;
// 字段列表,name => UiField
private Map<String, BpmField> fields = new HashMap<>();
// 是否只读
private boolean readonly;
// 是否有统计字段
private boolean useSummary;
// 是否有查找字段
private boolean useLookup;
// 外键关联属性
private AbstractBpmFieldLookup lookup;
// 与主表的映射关系
private BpmMasterMapping masterMapping = new BpmMasterMapping();
// 1:1 映射的从表
private List<BpmDataset> oneToOneDataset;
// 数据模型
private int dataModel;

// 是否有级联数据集,TODO: 分离前台界面需要的参数
// private boolean cascade;

private String customApi;

private boolean initData;

private BpmDatasetSql sql;

public void addField(BpmField bpmField) {
fields.put(bpmField.getName(), bpmField);

String summary = bpmField.getSummary();
if (StringUtils.isNotBlank(summary)) {
this.useSummary = true;
}

if (bpmField.getLookup() != null) {
this.useLookup = true;
}

if (bpmField.getRefType() == UiEnum.FieldRefType.ID) {
setIdField(bpmField);
// props.setIdField(bpmField.getName());
}
}

public BpmField addField(String fieldName, String name) {
return addField(fieldName, name, 0);
}

public BpmField addField(String fieldName, String name, int refType) {
BpmField bpmField = null;
if (StringUtils.isNotBlank(fieldName)) {
bpmField = new BpmField();
bpmField.setId(name);
bpmField.setFieldName(fieldName);
bpmField.setName(name);
bpmField.setRefType(refType);
this.addField(bpmField);
}

return bpmField;
}

public BpmField findFieldByName(String name) {
return fields.get(name);
}

public BpmField findFieldById(String fieldId) {
return findFieldById(fieldId, false);
}

public BpmField findFieldById(String fieldId, boolean findSlave) {
if (StringUtils.isNotBlank(fieldId)) {
for (BpmField field : fields.values()) {
if (fieldId.equals(field.getId())) {
return field;
}
}
}

if(findSlave && this.oneToOneDataset != null) {
for (BpmDataset slave: this.oneToOneDataset) {
BpmField field = slave.findFieldById(fieldId);
if (field != null) {
return field;
}
}
}

return null;
}

public String fullName() {
return database + "." + table;
}

// public String getFieldPrefix() {
// return props.getFieldPrefix();
// }
//
// public String getId() {
// return props.getId();
// }

// public BpmField findFieldByRefType(int refType) {
// for (Map.Entry<String, BpmField> entry: fields.entrySet()) {
// BpmField bpmField = entry.getValue();
//
// if (bpmField.getRefType() == refType) {
// return bpmField;
// }
// }
//
// return null;
// }

public BpmField findFieldByFieldName(String fieldName) {
if (fieldName != null) {
for (Map.Entry<String, BpmField> entry : fields.entrySet()) {
BpmField bpmField = entry.getValue();

if (fieldName.equals(bpmField.getFieldName())) {
return bpmField;
}
}
}

return null;
}

public void addOneToOneDataset(BpmDataset slave) {
if (oneToOneDataset == null) {
oneToOneDataset = new ArrayList<>();
}

oneToOneDataset.add(slave);
}

// public BpmDataset findById(String datasetId) {
// if (datasetId.equals(getProps().getId())) {
// return this;
// }
//
// if (this.oneToOneDataset != null) {
// for (BpmDataset slave: this.oneToOneDataset) {
// if (datasetId.equals(slave.getProps().getId())) {
// return slave;
// }
// }
// }
//
// return null;
// }

public String readIdFieldName() {
return idField != null ? idField.getFieldName() : null;
}
}

+ 0
- 10
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/entity/dataset/BpmDatasetSql.java Переглянути файл

@@ -1,10 +0,0 @@
package cc.smtweb.system.bpm.core.ui.entity.dataset;

import lombok.Data;

@Data
public class BpmDatasetSql {
private String select;
private String insert;
private String update;
}

Деякі файли не було показано, через те що забагато файлів було змінено

Завантаження…
Відмінити
Зберегти