Browse Source

初始

master
郑根木 2 years ago
parent
commit
18caf23b48
62 changed files with 660 additions and 259 deletions
  1. +8
    -5
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/AbstractCache.java
  2. +1
    -5
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/cache/ModelDatabaseCache.java
  3. +2
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/cache/ModelTableCache.java
  4. +13
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/jdbc/AbsDbWorker.java
  5. +15
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/jdbc/IDbWorker.java
  6. +73
    -4
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/jdbc/JdbcEngine.java
  7. +74
    -43
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/jdbc/JdbcTrans.java
  8. +2
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/def/FieldType.java
  9. +14
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/def/TableType.java
  10. +49
    -10
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractCompService.java
  11. +4
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractDelHandler.java
  12. +46
    -91
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java
  13. +5
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractLoadHandler.java
  14. +35
    -10
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractSaveHandler.java
  15. +62
    -5
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java
  16. +2
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/IHandler.java
  17. +83
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/TreeHelper.java
  18. +0
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/bind/BpmPageContextEditor.java
  19. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/CardDataBuilder.java
  20. +4
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/CardTreeDataBuilder.java
  21. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/TreeDataBuilder.java
  22. +0
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/entity/form/BpmWidget.java
  23. +0
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/service/card/AbstractDatasetCardService.java
  24. +0
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/service/list/AbstractDatasetListService.java
  25. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/service/list/DatasetListWorker.java
  26. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/impl/AbstractTaskCardService.java
  27. +2
    -4
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/impl/dao/TaskDao.java
  28. +0
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/impl/entity/ProcessLogPO.java
  29. +0
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/impl/entity/ProcessPO.java
  30. +0
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/runtime/ProcessInfo.java
  31. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/runtime/ProcessInstance.java
  32. +0
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/task/TaskInfo.java
  33. +0
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/ui/codegen/VmTool.java
  34. +3
    -3
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/ui/loader/json/JsonDatasetDecoder.java
  35. +0
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/BpmAutoConfiguration.java
  36. +1
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/ProcessEngineImpl.java
  37. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/action/service/BpmActionCardService.java
  38. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/action/service/BpmActionListService.java
  39. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/action/service/BpmActionTreeService.java
  40. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/cache/BpmPageCache.java
  41. +0
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/dao/AbstractDatasetPlugin.java
  42. +2
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/dao/DatasetListDao.java
  43. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/dao/DatasetTreeDao.java
  44. +88
    -0
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/catalog/ModelCatalog.java
  45. +32
    -0
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/catalog/ModelCatalogService.java
  46. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/codegen/AbstractCodeService.java
  47. +2
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/codegen/JavaCodeService.java
  48. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspDbCardService.java
  49. +2
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelCardService.java
  50. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelConfigService.java
  51. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelExportService.java
  52. +0
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/modelcatalog/AspModelCatalogListService.java
  53. +0
    -3
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewAppListService.java
  54. +2
    -8
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/project/ModelProjectService.java
  55. +0
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/task/service/BpmTaskCardService.java
  56. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/ui/dynform/DynFormCardService.java
  57. +2
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/ui/dynform/DynFormListService.java
  58. +0
    -2
      smtweb-system/sw-system-bpm/src/main/resources/codegen/vm/events.ts.vm
  59. +4
    -4
      smtweb-system/sw-system-bpm/src/main/resources/codegen/vm/index.vue.vm
  60. +9
    -10
      smtweb-system/sw-system-bpm/src/test/java/cc/smtweb/system/bpm/test/BuildJavaBean.java
  61. +0
    -1
      smtweb-system/sw-system-bpm/src/test/java/cc/smtweb/system/bpm/test/codegen/test/VuegenTest.java
  62. +4
    -3
      smtweb-system/sw-system-bpm/src/test/java/cc/smtweb/system/bpm/test/codegen/test/YamlToJsonTest.java

+ 8
- 5
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/cache/AbstractCache.java View File

@@ -30,6 +30,9 @@ import java.util.concurrent.TimeUnit;
*/ */
@Slf4j @Slf4j
public abstract class AbstractCache<T extends Serializable> implements ISwCache<String, T> { public abstract class AbstractCache<T extends Serializable> implements ISwCache<String, T> {
//树节点按parent的key
public static final String KEY_PARENT_ID = "pr";

protected final static int LS_NONE = 0; protected final static int LS_NONE = 0;
protected final static int LS_LOADING = 1; protected final static int LS_LOADING = 1;
protected final static int LS_LOADED = 2; protected final static int LS_LOADED = 2;
@@ -238,7 +241,7 @@ public abstract class AbstractCache<T extends Serializable> implements ISwCache<
* @param key * @param key
* @return * @return
*/ */
protected T getForRemove(String key) {
public T getOrg(String key) {
return cacheOrg.get(key); return cacheOrg.get(key);
} }


@@ -248,7 +251,7 @@ public abstract class AbstractCache<T extends Serializable> implements ISwCache<
* @param key * @param key
*/ */
protected void doRemove(String key) { protected void doRemove(String key) {
T bean = getForRemove(key);
T bean = getOrg(key);
if (bean != null) { if (bean != null) {
for (Map.Entry<String, IGetBeanKey<T>> entry : mapListReg.entrySet()) { for (Map.Entry<String, IGetBeanKey<T>> entry : mapListReg.entrySet()) {
doRemoveList(entry.getKey(), getBeanKey(entry.getValue(), bean), bean); doRemoveList(entry.getKey(), getBeanKey(entry.getValue(), bean), bean);
@@ -334,7 +337,7 @@ public abstract class AbstractCache<T extends Serializable> implements ISwCache<
*/ */
public final void reset(T bean) { public final void reset(T bean) {
final String id = getId(bean); final String id = getId(bean);
T b = getForRemove(id);
T b = getOrg(id);
if (b != null) { if (b != null) {
cache.put(id, b); cache.put(id, b);
} }
@@ -356,7 +359,7 @@ public abstract class AbstractCache<T extends Serializable> implements ISwCache<
* @param key * @param key
* @return * @return
*/ */
protected final T localGetByKey(String rk, String key) {
protected final T getByKey(String rk, String key) {
Map<String, T> map = mapMapLocal.get(rk); Map<String, T> map = mapMapLocal.get(rk);
if (map != null) { if (map != null) {
return map.get(key); return map.get(key);
@@ -364,7 +367,7 @@ public abstract class AbstractCache<T extends Serializable> implements ISwCache<
return null; return null;
} }


public final Set<T> localGetListByKey(String rk, String key) {
public final Set<T> getListByKey(String rk, String key) {
return mapListLocal.get(rk + split_char + key); return mapListLocal.get(rk + split_char + key);
} }




+ 1
- 5
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/cache/ModelDatabaseCache.java View File

@@ -6,11 +6,7 @@ import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao; import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.vo.ModelDatabase; import cc.smtweb.framework.core.db.vo.ModelDatabase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.RowMapper;


import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List; import java.util.List;


/** /**
@@ -40,6 +36,6 @@ public class ModelDatabaseCache extends AbstractCache<ModelDatabase> {
} }


public final ModelDatabase getByName(String key) { public final ModelDatabase getByName(String key) {
return localGetByKey(mk, key);
return getByKey(mk, key);
} }
} }

+ 2
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/cache/ModelTableCache.java View File

@@ -85,9 +85,9 @@ public class ModelTableCache extends AbstractCache<ModelTable> {
} }


public final ModelTable getByName(String key) { public final ModelTable getByName(String key) {
return localGetByKey(mk, key.toUpperCase());
return getByKey(mk, key.toUpperCase());
} }
public final Set<ModelTable> getDbTables(long dbId) { public final Set<ModelTable> getDbTables(long dbId) {
return localGetListByKey(md, String.valueOf(dbId));
return getListByKey(md, String.valueOf(dbId));
} }
} }

+ 13
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/jdbc/AbsDbWorker.java View File

@@ -0,0 +1,13 @@
package cc.smtweb.framework.core.db.jdbc;

/**
* Created by Akmm at 14-2-15 下午1:51
* 数据库事务操作方法类
*/
public abstract class AbsDbWorker implements IDbWorker {
@Override
public void doAfterDbCommit() throws Exception {}

@Override
public void doAfterDbRollback() throws Exception {}
}

+ 15
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/jdbc/IDbWorker.java View File

@@ -0,0 +1,15 @@
package cc.smtweb.framework.core.db.jdbc;

/**
* Created by Akmm at 14-2-3 下午4:52
* 数据库事务操作方法类
*/
public interface IDbWorker {
public void work() throws Exception;

//数据库提交完后的业务或缓存处理
public void doAfterDbCommit() throws Exception;

//数据库回滚后的业务或缓存处理
public void doAfterDbRollback() throws Exception;
}

+ 73
- 4
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/jdbc/JdbcEngine.java View File

@@ -13,14 +13,15 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.ResultSetExtractor; import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;


import javax.sql.DataSource; import javax.sql.DataSource;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;


@@ -30,6 +31,7 @@ import java.util.function.Supplier;
public class JdbcEngine { public class JdbcEngine {
private final static String DB_TYPE_MYSQL = "mysql"; private final static String DB_TYPE_MYSQL = "mysql";


private Map<Thread, JdbcTrans> mapThreadTrans = new ConcurrentHashMap<>();
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
private DataSourceTransactionManager dataSourceTransactionManager; private DataSourceTransactionManager dataSourceTransactionManager;
private IdGenerator idGenerator; private IdGenerator idGenerator;
@@ -321,6 +323,73 @@ public class JdbcEngine {
return false; return false;
} }


public void beginTrans() throws Exception {
Thread t = Thread.currentThread();
JdbcTrans jdbcTrans = mapThreadTrans.get(t);
if (jdbcTrans != null) {
jdbcTrans.inc();
return;
}
mapThreadTrans.put(t, openTrans());
}

public void commit() throws Exception {
Thread t = Thread.currentThread();
JdbcTrans tm = this.mapThreadTrans.get(t);
if (tm == null) throw new Exception("当前没有开启事务。");
if (tm.canCommit()) {
tm.doEnd("commit");
tm.commit();
this.mapThreadTrans.remove(t);
}
}

public void recTransLog() {
for (JdbcTrans tm: mapThreadTrans.values()) {
tm.doEnd("process");
}
}

public void rollback(Exception e) throws Exception {
Thread t = Thread.currentThread();
JdbcTrans tm = mapThreadTrans.get(t);
if (tm == null) throw new Exception("当前没有开启事务。");
if (tm.canCommit()) {
tm.doEnd("rollback");
mapThreadTrans.remove(t);
tm.rollback();
}
if (e != null) throw e;
}

public void doTrans(IDbWorker dbWorker) throws Exception {
beginTrans();
try {
dbWorker.work();
commit();
} catch (Exception e) {
rollback(e);
dbWorker.doAfterDbRollback();
throw e;
}
dbWorker.doAfterDbCommit();
}

//独立事务
public void doTransSingle(IDbWorker worker) throws Exception {
JdbcTrans jdbcTrans = openTrans();
try {
worker.work();
jdbcTrans.commit();
} catch (Exception e) {
jdbcTrans.rollback();
worker.doAfterDbRollback();
throw e;
}
worker.doAfterDbCommit();
}


/** /**
* 获取原始数据库连接执行命令 * 获取原始数据库连接执行命令
* *


+ 74
- 43
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/jdbc/JdbcTrans.java View File

@@ -1,56 +1,87 @@
package cc.smtweb.framework.core.db.jdbc; package cc.smtweb.framework.core.db.jdbc;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition; import org.springframework.transaction.support.DefaultTransactionDefinition;


import java.util.concurrent.atomic.AtomicInteger;

/** /**
* JDBC事务处理类,可以在try中使用自动结束事务 * JDBC事务处理类,可以在try中使用自动结束事务
*
* @author xkliu * @author xkliu
*/ */
public class JdbcTrans implements AutoCloseable { public class JdbcTrans implements AutoCloseable {
private DataSourceTransactionManager transactionManager;
private TransactionStatus status;

/**
* 构造事务执行
* @param transactionManager spring事务管理对象
*/
public JdbcTrans(DataSourceTransactionManager transactionManager) {
this.transactionManager = transactionManager;
// 事务定义类
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
// 返回事务对象
this.status = transactionManager.getTransaction(def);
}

/**
* 回滚事务
*/
public void rollback() {
if (status != null) {
transactionManager.rollback(status);
status = null;
}
}

/**
* 提交事务
*/
public void commit() {
if (status != null) {
transactionManager.commit(status);
status = null;
}
}

/**
* 实现自动关闭,回滚方式结束事务
*/
@Override
public void close() {
this.rollback();
}

private Logger logger = LoggerFactory.getLogger("trans");
protected long time = System.currentTimeMillis();
protected String info = Thread.currentThread().getStackTrace()[6].getFileName() + "::::" + Thread.currentThread().getStackTrace()[6].getLineNumber();
private AtomicInteger count = new AtomicInteger(1);

public int getCount() {
return count.get();
}

public void inc() {
count.incrementAndGet();
}

public boolean canCommit() {
return count.decrementAndGet() == 0;
}

public void doEnd(String ei) {
long t = System.currentTimeMillis() - time;
if (t > 10000L) {
logger.info(info + "::::::" + t + "::::::" + ei);
}
}

private DataSourceTransactionManager transactionManager;
private TransactionStatus status;

/**
* 构造事务执行
*
* @param transactionManager spring事务管理对象
*/
public JdbcTrans(DataSourceTransactionManager transactionManager) {
this.transactionManager = transactionManager;
// 事务定义类
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
// 返回事务对象
this.status = transactionManager.getTransaction(def);
}

/**
* 回滚事务
*/
public void rollback() {
if (status != null) {
transactionManager.rollback(status);
status = null;
}
}

/**
* 提交事务
*/
public void commit() {
if (status != null) {
transactionManager.commit(status);
status = null;
}
}

/**
* 实现自动关闭,回滚方式结束事务
*/
@Override
public void close() {
this.rollback();
}
} }

+ 2
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/def/FieldType.java View File

@@ -9,6 +9,8 @@ public enum FieldType {
ID, ID,
// 上级ID,树结构需要 // 上级ID,树结构需要
PARENT_ID, PARENT_ID,
//级次码
LEVEL_CODE,
// 排序字段,树结构需要 // 排序字段,树结构需要
ORDER, ORDER,
// 编码字段 // 编码字段


+ 14
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/vo/def/TableType.java View File

@@ -0,0 +1,14 @@
package cc.smtweb.framework.core.db.vo.def;

/**
* Created by Akmm at 2022/3/17 17:02
*/
public class TableType {
//0-普通表,1 树型表 2 编码表 9-虚拟抽象表 11 视图
public static final int TYPE_GENERAL = 0;
public static final int TYPE_TREE = 1;
public static final int TYPE_CODE = 2;
public static final int TYPE_ABSTACT = 3;
public static final int TYPE_VIEW = 3;

}

+ 49
- 10
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractCompService.java View File

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


import cc.smtweb.framework.core.R; import cc.smtweb.framework.core.R;
import cc.smtweb.framework.core.SwException;
import cc.smtweb.framework.core.SwMap; import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.annotation.SwBody; import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwService; import cc.smtweb.framework.core.annotation.SwService;
@@ -17,45 +18,83 @@ import java.util.Map;
*/ */
public abstract class AbstractCompService { public abstract class AbstractCompService {
public final static String TYPE_LIST = "list"; public final static String TYPE_LIST = "list";
public final static String TYPE_COMBO = "combo";
public final static String TYPE_TREE = "tree";
public final static String TYPE_LOAD = "load"; public final static String TYPE_LOAD = "load";
public final static String TYPE_SAVE = "save"; public final static String TYPE_SAVE = "save";
public final static String TYPE_DEL = "del"; public final static String TYPE_DEL = "del";


protected abstract IHandler createHanlder(String type); protected abstract IHandler createHanlder(String type);


private R pageHandler(SwMap params, UserSession us, String type) {
try {
IHandler handler = createHanlder(type);
private IHandler getHandler(SwMap params, UserSession us, String type) throws Exception {
IHandler handler = createHanlder(type);
if (handler == null) throw new SwException("暂不支持此类服务:" + type);
if (params == null) params = new SwMap(); if (params == null) params = new SwMap();
if (us == null) us = UserSession.createSys(); if (us == null) us = UserSession.createSys();
return handler.doWork(params, us);
handler.init(params, us);
return handler;
}

private R pageHandler(SwMap params, UserSession us, String type) {
try {
IHandler handler = getHandler(params, us, type);
return handler.doWork();
} catch (Exception e) { } catch (Exception e) {
return R.error("操作失败!", e); return R.error("操作失败!", e);
} }
} }


//保存
public R save(@SwBody SwMap params, UserSession us) { public R save(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_SAVE); return pageHandler(params, us, TYPE_SAVE);
} }


//树,换爹
public R trcp(@SwBody SwMap params, UserSession us) {
try {
DefaultSaveHandler handler = (DefaultSaveHandler)getHandler(params, us,TYPE_SAVE);
return handler.changeParent();
} catch (Exception e) {
return R.error("操作失败!", e);
}
}

//读取
public R load(@SwBody SwMap params, UserSession us) { public R load(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_LOAD); return pageHandler(params, us, TYPE_LOAD);
} }

//删除
public R del(@SwBody SwMap params, UserSession us) { public R del(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_DEL); return pageHandler(params, us, TYPE_DEL);
} }

//列表数据
public R list(@SwBody SwMap params, UserSession us) { public R list(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_LIST); return pageHandler(params, us, TYPE_LIST);
} }
public R getTotal(@SwBody SwMap params, UserSession us) {
//列表总记录数及合计栏
public R listTotal(@SwBody SwMap params, UserSession us) {
try { try {
AbstractListHandler handler = (AbstractListHandler)createHanlder(TYPE_LIST);
return handler.getTotal(params, us);
AbstractListHandler handler = (AbstractListHandler)getHandler(params, us, TYPE_LIST);
return handler.getTotal();
} catch (Exception e) { } catch (Exception e) {
return R.error("操作失败!", e); return R.error("操作失败!", e);
} }
} }
//combo数据
public R combo(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_COMBO);
}
//combo总记录数及合计栏
public R comboTotal(@SwBody SwMap params, UserSession us) {
try {
AbstractListHandler handler = (AbstractListHandler)getHandler(params, us, TYPE_COMBO);
return handler.getTotal();
} catch (Exception e) {
return R.error("操作失败!", e);
}
}
//树数据
public R tree(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_TREE);
}
} }

+ 4
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractDelHandler.java View File

@@ -17,10 +17,13 @@ public abstract class AbstractDelHandler<T> implements IHandler{
protected long id; protected long id;


@Override @Override
public R doWork(SwMap params, UserSession us) throws Exception {
public void init(SwMap params, UserSession us) {
this.params = params; this.params = params;
this.us = us; this.us = us;
}


@Override
public R doWork() throws Exception {
id = readId(); id = readId();


checkValid(); checkValid();


+ 46
- 91
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java View File

@@ -7,10 +7,8 @@ import cc.smtweb.framework.core.cache.SessionCacheFactory;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.mvc.service.list.FooterField; import cc.smtweb.framework.core.mvc.service.list.FooterField;
import cc.smtweb.framework.core.session.UserSession; import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.NumberUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor; import org.springframework.jdbc.core.ResultSetExtractor;


import java.sql.ResultSet; import java.sql.ResultSet;
@@ -32,24 +30,46 @@ public abstract class AbstractListHandler implements IHandler {


protected SwMap params; protected SwMap params;
protected UserSession us; protected UserSession us;
private SessionCache cacheBean;
private List<FooterField> footerFields = null;

// private SqlPara sqlPara = null;
private SessionCache sessionCache;


@Override @Override
public R doWork(SwMap params, UserSession us) throws Exception {
public void init(SwMap params, UserSession us) {
this.params = params; this.params = params;
this.us = us; this.us = us;
}


@Override
public R doWork() throws Exception {
return R.success(listData()); return R.success(listData());
} }


protected String getCompId() {
return this.getClass().getSimpleName();
}

protected <T> T getCache(String key) {
if (sessionCache == null)
sessionCache = SessionCacheFactory.getInstance().getUserCache(us.getUserId());
return sessionCache.get(getCompId() + "." + key);
}

protected void setCache(String key, Object v) {
if (sessionCache == null)
sessionCache = SessionCacheFactory.getInstance().getUserCache(us.getUserId());
sessionCache.put(getCompId() + "." + key, v);
}

protected void removeCache(String key) {
if (sessionCache == null)
sessionCache = SessionCacheFactory.getInstance().getUserCache(us.getUserId());
sessionCache.remove(getCompId() + "." + key);
}

protected SwListData listData() throws Exception { protected SwListData listData() throws Exception {
List<SwMap> listData = new ArrayList<>(); List<SwMap> listData = new ArrayList<>();
SqlPara sqlPara = buildDataSql(); SqlPara sqlPara = buildDataSql();


int rows = params.readInt("rows", 20);
int rows = params.readInt("rows", 0);
int page = params.readInt("page", 1); int page = params.readInt("page", 1);
String sort = params.readString("sort"); String sort = params.readString("sort");
String order = params.readString("order"); String order = params.readString("order");
@@ -74,13 +94,12 @@ public abstract class AbstractListHandler implements IHandler {
} }


protected SqlPara buildSumSqlPara() { protected SqlPara buildSumSqlPara() {
final SessionCache userCache = getCacheBean();
SqlPara sqlPara = userCache.get(KEY_SQLPARA);
SqlPara sqlPara = getCache(KEY_SQLPARA);
if (sqlPara == null) return null; if (sqlPara == null) return null;


getFooterFields();
List<FooterField> footerFields = getFooterFields();
StringBuilder sql = new StringBuilder(128); StringBuilder sql = new StringBuilder(128);
sql.append("select count(1) F_1");
sql.append("select count(1) total_count");
int n = 2; int n = 2;
for (FooterField cn : footerFields) { for (FooterField cn : footerFields) {
if (!FooterField.STATIC_TEXT.equals(cn.type)) { if (!FooterField.STATIC_TEXT.equals(cn.type)) {
@@ -93,7 +112,7 @@ public abstract class AbstractListHandler implements IHandler {
} }
if (FooterField.SUM_TYPE_COUNT.equals(cn.type)) if (FooterField.SUM_TYPE_COUNT.equals(cn.type))
sql.append("distinct "); sql.append("distinct ");
sql.append(cn.field).append(") F_").append(n++);
sql.append(cn.field).append(") ").append(cn.field);
} }
} }
sql.append(" from (").append(sqlPara.getSqlNoOrderBy()).append(") xxxxxz"); sql.append(" from (").append(sqlPara.getSqlNoOrderBy()).append(") xxxxxz");
@@ -101,70 +120,21 @@ public abstract class AbstractListHandler implements IHandler {
return new SqlPara(sql.toString(), sqlPara.paras); return new SqlPara(sql.toString(), sqlPara.paras);
} }


public R getTotal(SwMap params, UserSession us) {
public R getTotal() {
try { try {
this.params = params;
this.us = us;

final SessionCache userCache = getCacheBean();
SqlPara sqlParaSum = userCache.get(KEY_SQLPARA_SUM);
SqlPara sqlParaSum = getCache(KEY_SQLPARA_SUM);
if (sqlParaSum == null) { if (sqlParaSum == null) {
Map<String, Object> map = userCache.get(KEY_PARAMS);
Map<String, Object> map = getCache(KEY_PARAMS);
if (map != null) params.putAll(map); if (map != null) params.putAll(map);
sqlParaSum = buildSumSqlPara(); sqlParaSum = buildSumSqlPara();
} }
if (sqlParaSum == null) return R.success(); if (sqlParaSum == null) return R.success();
userCache.put(KEY_SQLPARA_SUM, sqlParaSum);

setCache(KEY_SQLPARA_SUM, sqlParaSum);


Map<String, Object> mapFooter = new HashMap<>();
getFooterFields();

int total = DbEngine.getInstance().query(sqlParaSum.sql, new ResultSetExtractor<Integer>() {
public Integer extractData(ResultSet rs) throws SQLException {
try {
for (FooterField c : footerFields) {
if (FooterField.STATIC_TEXT.equals(c.type))
mapFooter.put(c.field, c.text);
}
int count = 0;

if (rs.next()) {
count = rs.getInt(1);
int n = 2;
for (FooterField c : footerFields) {
switch (c.type) {
case FooterField.STATIC_TEXT:
mapFooter.put(c.field, c.text);
break;
case FooterField.SUM_TYPE_COUNT:
case FooterField.SUM_TYPE_COUNT_ALL:
mapFooter.put(c.field, String.valueOf(rs.getInt(n++)));
break;
case FooterField.SUM_TYPE_SUM_NUM:
mapFooter.put(c.field, String.valueOf(rs.getInt(n++)));
break;
default:
mapFooter.put(c.field, rs.getDouble(n++));
break;
}
}
} else {
for (FooterField c : footerFields) {
if (FooterField.STATIC_TEXT.equals(c.type))
mapFooter.put(c.field, c.text);
}
}
return count;
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
return 0;
}
}
}, sqlParaSum.paras);
Map<String, Object> mapFooter = DbEngine.getInstance().queryEntity(sqlParaSum.sql, Map.class, sqlParaSum.paras);


R r = R.success(); R r = R.success();
r.put("total", total);
r.put("total", mapFooter.get("total_count"));
r.put("footer", mapFooter); r.put("footer", mapFooter);
return r; return r;
} catch (Exception e) { } catch (Exception e) {
@@ -172,25 +142,12 @@ public abstract class AbstractListHandler implements IHandler {
} }
} }



public SessionCache getCacheBean() {
if (cacheBean == null)
cacheBean = SessionCacheFactory.getInstance().getUserCache(us.getUserId());
return cacheBean;
}

public void clearCache() {
getCacheBean().clear();
}

protected SqlPara buildDataSql() throws Exception { protected SqlPara buildDataSql() throws Exception {
SessionCache userCache = getCacheBean();

//从缓存里看看有没有保存的sql缓存; //从缓存里看看有没有保存的sql缓存;
SqlPara sqlParaInCache = getCacheBean().get(KEY_SQLPARA); //缓存里面的对象;
SqlPara sqlParaInCache = getCache(KEY_SQLPARA); //缓存里面的对象;
boolean query = sqlParaInCache == null || params.readBool("query"); boolean query = sqlParaInCache == null || params.readBool("query");
if (!query) { if (!query) {
Map<String, Object> map = userCache.get(KEY_PARAMS);
Map<String, Object> map = getCache(KEY_PARAMS);
if (map == null) query = true; if (map == null) query = true;
else { else {
Map<String, Object> params = getCachedParams(); Map<String, Object> params = getCachedParams();
@@ -214,14 +171,14 @@ public abstract class AbstractListHandler implements IHandler {
//缓存里面没有对象,重新构建查询条件,重新计算汇总数; //缓存里面没有对象,重新构建查询条件,重新计算汇总数;
buildParam();//构造过滤条件,设默认值 buildParam();//构造过滤条件,设默认值
sqlPara = buildSqlPara(); //重新构建查询对象; sqlPara = buildSqlPara(); //重新构建查询对象;
userCache.remove(KEY_SQLPARA_SUM);
removeCache(KEY_SQLPARA_SUM);


userCache.put(KEY_SQLPARA, sqlPara);
userCache.put(KEY_PARAMS, getCachedParams());//不缓存页码之类的东东,避免下次请求时,页码又回去了
setCache(KEY_SQLPARA, sqlPara);
setCache(KEY_PARAMS, getCachedParams());//不缓存页码之类的东东,避免下次请求时,页码又回去了
} else { } else {
sqlPara = sqlParaInCache; sqlPara = sqlParaInCache;


Map<String, Object> map = userCache.get(KEY_PARAMS);
Map<String, Object> map = getCache(KEY_PARAMS);
if (map != null) params.putAll(map); if (map != null) params.putAll(map);
} }
return sqlPara; return sqlPara;
@@ -252,10 +209,8 @@ public abstract class AbstractListHandler implements IHandler {


//构建合计字段 //构建合计字段
private List<FooterField> getFooterFields() { private List<FooterField> getFooterFields() {
if (footerFields == null) {
footerFields = new ArrayList<>();
buildFooterFields(footerFields);
}
List<FooterField> footerFields = new ArrayList<>();
buildFooterFields(footerFields);
return footerFields; return footerFields;
} }




+ 5
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractLoadHandler.java View File

@@ -12,9 +12,13 @@ public abstract class AbstractLoadHandler<T> implements IHandler {
protected UserSession us; protected UserSession us;


@Override @Override
public R doWork(SwMap params, UserSession us) throws Exception {
public void init(SwMap params, UserSession us) {
this.params = params; this.params = params;
this.us = us; this.us = us;
}

@Override
public R doWork() throws Exception {
long id = readId(); long id = readId();
T bean; T bean;
if (id <= 0L) { if (id <= 0L) {


+ 35
- 10
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractSaveHandler.java View File

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


import cc.smtweb.framework.core.R; import cc.smtweb.framework.core.R;
import cc.smtweb.framework.core.SwException;
import cc.smtweb.framework.core.SwMap; import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.session.UserSession; import cc.smtweb.framework.core.session.UserSession;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;


@@ -11,17 +13,20 @@ import lombok.extern.slf4j.Slf4j;
* 保存 * 保存
*/ */
@Slf4j @Slf4j
public abstract class AbstractSaveHandler<T> implements IHandler{
public abstract class AbstractSaveHandler<T> implements IHandler {
protected SwMap params; protected SwMap params;
protected UserSession us; protected UserSession us;
protected T bean; protected T bean;
protected boolean isNew; protected boolean isNew;


@Override @Override
public R doWork(SwMap params, UserSession us) throws Exception {
public void init(SwMap params, UserSession us) {
this.params = params; this.params = params;
this.us = us; this.us = us;
}


@Override
public R doWork() throws Exception {
long id = readId(); long id = readId();


isNew = id <= 0L; isNew = id <= 0L;
@@ -32,15 +37,20 @@ public abstract class AbstractSaveHandler<T> implements IHandler{
} }
readFromPage(); readFromPage();
checkValid(); checkValid();
DbEngine.getInstance().doTrans(() -> {
try {
DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work() throws Exception {
save(); save();
}

@Override
public void doAfterDbCommit() throws Exception {
saveSuccess(); saveSuccess();
return true;
} catch (Exception e) {
}

@Override
public void doAfterDbRollback() throws Exception {
saveFailed(); saveFailed();
log.error("保存失败!", e);
return false;
} }
}); });
return R.success(bean); return R.success(bean);
@@ -48,18 +58,33 @@ public abstract class AbstractSaveHandler<T> implements IHandler{


/** /**
* 读取页面传回来的id * 读取页面传回来的id
*
* @return * @return
*/ */
protected long readId() { protected long readId() {
return params.readLong("id", 0L); return params.readLong("id", 0L);
} }


//从页面读取数据
protected abstract void readFromPage(); protected abstract void readFromPage();

//保存前的校验
protected abstract void checkValid() throws Exception; protected abstract void checkValid() throws Exception;

//保存到数据库
protected abstract void save() throws Exception; protected abstract void save() throws Exception;
protected void saveSuccess() {}
protected void saveFailed() {}


//保存成功之后
protected void saveSuccess() {
}

//保存失败之后
protected void saveFailed() {
}

//构建一个新对象
protected abstract T createComp() throws Exception; protected abstract T createComp() throws Exception;

//从数据库读取
protected abstract T loadComp(long id) throws Exception; protected abstract T loadComp(long id) throws Exception;
} }

+ 62
- 5
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java View File

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


import cc.smtweb.framework.core.R;
import cc.smtweb.framework.core.SwException; import cc.smtweb.framework.core.SwException;
import cc.smtweb.framework.core.cache.AbstractCache; import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager; import cc.smtweb.framework.core.cache.CacheManager;
@@ -7,11 +8,17 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao; import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache; import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity; import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField; import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelIndex; import cc.smtweb.framework.core.db.vo.ModelIndex;
import cc.smtweb.framework.core.db.vo.ModelTable; import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.db.vo.def.FieldType;
import cc.smtweb.framework.core.db.vo.def.TableType;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;


import java.util.Collection;
import java.util.List;

/** /**
* Created by Akmm at 2022/3/2 19:52 * Created by Akmm at 2022/3/2 19:52
* 默认实体实现 * 默认实体实现
@@ -19,6 +26,8 @@ import org.apache.commons.lang3.StringUtils;
public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractSaveHandler<T> { public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractSaveHandler<T> {
protected String tableName; protected String tableName;


private List<T> listTreeBean = null;

public DefaultSaveHandler(String tableName) { public DefaultSaveHandler(String tableName) {
this.tableName = tableName; this.tableName = tableName;
} }
@@ -44,14 +53,14 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractSaveHan
@Override @Override
protected void checkValid() throws Exception { protected void checkValid() throws Exception {
ModelTable table = ModelTableCache.getInstance().getByName(tableName); ModelTable table = ModelTableCache.getInstance().getByName(tableName);
for (ModelField field: table.getFields()) {
for (ModelField field : table.getFields()) {
if (field.isNotNull() && StringUtils.isEmpty(bean.getStr(field.getName()))) { if (field.isNotNull() && StringUtils.isEmpty(bean.getStr(field.getName()))) {
throw new SwException(field.getTitle() + "不能为空!"); throw new SwException(field.getTitle() + "不能为空!");
} }
} }


EntityDao dao = DbEngine.getInstance().findDao(tableName); EntityDao dao = DbEngine.getInstance().findDao(tableName);
for (ModelIndex mi: table.getIndexes()) {
for (ModelIndex mi : table.getIndexes()) {
if (mi.isUnique()) { if (mi.isUnique()) {
dao.checkUnique(bean, mi.getFields().split(",")); dao.checkUnique(bean, mi.getFields().split(","));
} }
@@ -59,22 +68,32 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractSaveHan
} }


@Override @Override
protected void save() {
EntityDao dao = DbEngine.getInstance().findDao(tableName);
protected void save() throws Exception {
EntityDao<T> dao = DbEngine.getInstance().findDao(tableName);
if (isNew) { if (isNew) {
dao.insertEntity(bean); dao.insertEntity(bean);
} else { } else {
dao.updateEntity(bean); dao.updateEntity(bean);

listTreeBean = new TreeHelper<T>(tableName).resetTreeLevel(bean);
} }
} }



@Override @Override
protected void saveSuccess() { protected void saveSuccess() {
super.saveSuccess(); super.saveSuccess();
ModelTable table = ModelTableCache.getInstance().getByName(tableName); ModelTable table = ModelTableCache.getInstance().getByName(tableName);
if (table.isNeedCache()) { if (table.isNeedCache()) {
AbstractCache<T> cache = CacheManager.getIntance().getCache(tableName); AbstractCache<T> cache = CacheManager.getIntance().getCache(tableName);
cache.put(bean);
//树型表,父亲改变了,要多处理下缓存;还有个东东:级次码
if (listTreeBean != null && !listTreeBean.isEmpty()) {
for (T b : listTreeBean) {
cache.put(b);
}
} else {
cache.put(bean);
}
} }
} }


@@ -87,4 +106,42 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractSaveHan
cache.reset(bean); cache.reset(bean);
} }
} }

//树,改变父亲
protected R changeParent() throws Exception {
ModelTable table = ModelTableCache.getInstance().getByName(tableName);
if (table.getType() != TableType.TYPE_TREE) throw new SwException("非树型表,不支持更改父节点");

long id = params.readLong("id");
long parentId = params.readLong("parent_id");

AbstractCache<T> cache = CacheManager.getIntance().getCache(tableName);
if (table.isNeedCache()) {
bean = cache.get(id);
} else {
bean = loadComp(id);
}
//不考虑没有级次码等情况,这个在表设计时校验
ModelField fieldParentCode = table.findFieldByType(FieldType.PARENT_ID);

bean.put(fieldParentCode.getName(), parentId);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work() throws Exception {
EntityDao dao = DbEngine.getInstance().findDao(tableName);
dao.updateEntity(bean, fieldParentCode.getName());
}

@Override
public void doAfterDbCommit() throws Exception {
saveSuccess();
}

@Override
public void doAfterDbRollback() throws Exception {
saveFailed();
}
});
return R.success();
}
} }

+ 2
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/IHandler.java View File

@@ -9,5 +9,6 @@ import cc.smtweb.framework.core.session.UserSession;
* 所有handler的接口 * 所有handler的接口
*/ */
public interface IHandler { public interface IHandler {
R doWork(SwMap params, UserSession us) throws Exception;
void init(SwMap params, UserSession us);
R doWork() throws Exception;
} }

+ 83
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/TreeHelper.java View File

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

import cc.smtweb.framework.core.SwException;
import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.db.vo.def.FieldType;
import cc.smtweb.framework.core.db.vo.def.TableType;

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

/**
* Created by Akmm at 2022/3/17 19:56
*/
public class TreeHelper<T extends DefaultEntity> {

private String tableName;

private ModelTable table;
private AbstractCache<T> cache;
private EntityDao<T> dao;

private String fieldParent;
private String fieldLevelCode;

public TreeHelper(String tableName) {
this.tableName = tableName;
table = ModelTableCache.getInstance().getByName(tableName);
cache = CacheManager.getIntance().getCache(tableName);
dao = DbEngine.getInstance().findDao(tableName);

ModelField field = table.findFieldByType(FieldType.PARENT_ID);
fieldParent = field.getName();
field = table.findFieldByType(FieldType.LEVEL_CODE);
fieldLevelCode = field.getName();
}

public long getParentId(T bean) {
return bean.getLong(fieldParent);
}

public String getLevelCode(T bean) {
return bean.getStr(fieldLevelCode);
}

public Collection<T> getChildren(T bean) {
return cache.getListByKey(AbstractCache.KEY_PARENT_ID, String.valueOf(bean.getEntityId()));
}

public List<T> resetTreeLevel(T bean) throws Exception {
List<T> list = new ArrayList<>();
if (table.getType() != TableType.TYPE_TREE) return list;
if (!table.isNeedCache()) throw new SwException("请定义为需要缓存!");

T oldBean = cache.get(bean.getEntityId());
if (bean.getLong(fieldParent) != oldBean.getLong(fieldParent)) {
resetParentChildren(bean, list);
}
return list;
}

private void resetParentChildren(T bean, List<T> list) throws Exception {
T parent = cache.get(getParentId(bean));
if (parent != null) {
bean.put(fieldLevelCode, getLevelCode(parent) + "-" + parent.getEntityId());
dao.updateEntity(bean, fieldLevelCode);
list.add(bean);
}
Collection<T> children = getChildren(bean);
if (children != null && !children.isEmpty()) {
for (T child : children) {
resetParentChildren(child, list);
}
}
}
}

+ 0
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/bind/BpmPageContextEditor.java View File

@@ -1,7 +1,6 @@
package cc.smtweb.system.bpm.core.ui.bind; package cc.smtweb.system.bpm.core.ui.bind;


import cc.smtweb.framework.core.SwMap; import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.mvc.controller.IBeanContext; import cc.smtweb.framework.core.mvc.controller.IBeanContext;
import cc.smtweb.framework.core.mvc.controller.IEditor; import cc.smtweb.framework.core.mvc.controller.IEditor;
import cc.smtweb.system.bpm.core.exception.BpmException; import cc.smtweb.system.bpm.core.exception.BpmException;
@@ -10,7 +9,6 @@ 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.BpmPage;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset; import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.spring.cache.BpmPageCache; import cc.smtweb.system.bpm.spring.cache.BpmPageCache;
import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao;


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


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/CardDataBuilder.java View File

@@ -8,11 +8,11 @@ import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;
import cc.smtweb.framework.core.session.UserSession; import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.DateUtil; 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.exception.BpmValidException;
import cc.smtweb.system.bpm.core.ui.IParamConst; 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.BpmDataset;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmField; import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmField;
import cc.smtweb.system.bpm.core.exception.BpmFieldError;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmFieldLookup; import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmFieldLookup;
import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum; import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum;
import lombok.Getter; import lombok.Getter;


+ 4
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/CardTreeDataBuilder.java View File

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


import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.sqlbuilder.*;
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.exception.BpmDataException;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset; import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum; import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum;


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/builder/TreeDataBuilder.java View File

@@ -5,8 +5,8 @@ import cc.smtweb.framework.core.db.sqlbuilder.AbstractSelectSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;
import cc.smtweb.framework.core.util.JsonUtil; import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.system.bpm.core.exception.BpmException; import cc.smtweb.system.bpm.core.exception.BpmException;
import cc.smtweb.system.bpm.core.ui.IParamConst;
import cc.smtweb.system.bpm.core.ui.BpmPageContext; 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.BpmDataset;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmField; 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.consts.UiEnum;


+ 0
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/entity/form/BpmWidget.java View File

@@ -2,7 +2,6 @@ package cc.smtweb.system.bpm.core.ui.entity.form;


import cc.smtweb.framework.core.SwMap; import cc.smtweb.framework.core.SwMap;
import cc.smtweb.system.bpm.engine.ui.entity.vo.widiget.UiControlDataVO; import cc.smtweb.system.bpm.engine.ui.entity.vo.widiget.UiControlDataVO;
import cc.smtweb.system.bpm.engine.ui.entity.vo.widiget.UiControlVO;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;




+ 0
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/service/card/AbstractDatasetCardService.java View File

@@ -9,7 +9,6 @@ import cc.smtweb.system.bpm.core.ui.dataset.FieldFormatTool;
import cc.smtweb.system.bpm.core.ui.dataset.FieldFormatter; import cc.smtweb.system.bpm.core.ui.dataset.FieldFormatter;
import cc.smtweb.system.bpm.core.ui.entity.dataset.*; import cc.smtweb.system.bpm.core.ui.entity.dataset.*;
import cc.smtweb.system.bpm.core.ui.service.AbstractDatasetService; import cc.smtweb.system.bpm.core.ui.service.AbstractDatasetService;
import cc.smtweb.system.bpm.engine.entity.DictPO;
import cc.smtweb.system.bpm.engine.ui.entity.consts.MappingTypeEnum; import cc.smtweb.system.bpm.engine.ui.entity.consts.MappingTypeEnum;
import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum; import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;


+ 0
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/service/list/AbstractDatasetListService.java View File

@@ -9,7 +9,6 @@ import cc.smtweb.system.bpm.core.ui.dataset.FieldFormatTool;
import cc.smtweb.system.bpm.core.ui.dataset.FieldFormatter; import cc.smtweb.system.bpm.core.ui.dataset.FieldFormatter;
import cc.smtweb.system.bpm.core.ui.entity.dataset.*; import cc.smtweb.system.bpm.core.ui.entity.dataset.*;
import cc.smtweb.system.bpm.core.ui.service.AbstractDatasetService; import cc.smtweb.system.bpm.core.ui.service.AbstractDatasetService;
import cc.smtweb.system.bpm.engine.entity.DictPO;
import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum; import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum;


import java.util.*; import java.util.*;


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/core/ui/service/list/DatasetListWorker.java View File

@@ -1,8 +1,8 @@
package cc.smtweb.system.bpm.core.ui.service.list; package cc.smtweb.system.bpm.core.ui.service.list;


import cc.smtweb.framework.core.SwMap; import cc.smtweb.framework.core.SwMap;
import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.BpmMapData; import cc.smtweb.system.bpm.core.ui.BpmMapData;
import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset; import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmFieldLookup; import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmFieldLookup;
import cc.smtweb.system.bpm.core.ui.service.DatasetWorker; import cc.smtweb.system.bpm.core.ui.service.DatasetWorker;


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/impl/AbstractTaskCardService.java View File

@@ -5,9 +5,9 @@ import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.annotation.SwBody; import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwParam; import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.db.vo.ModelField; import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable; import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.engine.process.impl.entity.CommitTaskVO; import cc.smtweb.system.bpm.engine.process.impl.entity.CommitTaskVO;
import cc.smtweb.system.bpm.engine.process.impl.entity.LoadTaskAckVO; import cc.smtweb.system.bpm.engine.process.impl.entity.LoadTaskAckVO;
import cc.smtweb.system.bpm.engine.process.impl.entity.LoadTaskVO; import cc.smtweb.system.bpm.engine.process.impl.entity.LoadTaskVO;


+ 2
- 4
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/impl/dao/TaskDao.java View File

@@ -1,17 +1,15 @@
package cc.smtweb.system.bpm.engine.process.impl.dao; package cc.smtweb.system.bpm.engine.process.impl.dao;


import cc.smtweb.framework.core.SwMap; import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.db.DbEngine; 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.cache.ModelTableCache;
import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.util.DateUtil; import cc.smtweb.framework.core.util.DateUtil;
import cc.smtweb.system.bpm.core.exception.BpmObjectNotFoundException;
import cc.smtweb.system.bpm.core.exception.BpmLockRevException; import cc.smtweb.system.bpm.core.exception.BpmLockRevException;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.system.bpm.core.exception.BpmObjectNotFoundException;
import cc.smtweb.system.bpm.engine.process.impl.entity.ProcessLogPO; import cc.smtweb.system.bpm.engine.process.impl.entity.ProcessLogPO;
import cc.smtweb.system.bpm.engine.process.impl.entity.ProcessPO; import cc.smtweb.system.bpm.engine.process.impl.entity.ProcessPO;
import cc.smtweb.system.bpm.engine.process.impl.entity.TaskPO; import cc.smtweb.system.bpm.engine.process.impl.entity.TaskPO;


+ 0
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/impl/entity/ProcessLogPO.java View File

@@ -2,8 +2,6 @@ package cc.smtweb.system.bpm.engine.process.impl.entity;


import lombok.Data; import lombok.Data;


import java.sql.Timestamp;

@Data @Data
public class ProcessLogPO { public class ProcessLogPO {
private Long plId; private Long plId;


+ 0
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/impl/entity/ProcessPO.java View File

@@ -2,8 +2,6 @@ package cc.smtweb.system.bpm.engine.process.impl.entity;


import lombok.Data; import lombok.Data;


import java.sql.Timestamp;

@Data @Data
public class ProcessPO { public class ProcessPO {
private Long processId; private Long processId;


+ 0
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/runtime/ProcessInfo.java View File

@@ -2,8 +2,6 @@ package cc.smtweb.system.bpm.engine.process.runtime;


import lombok.Data; import lombok.Data;


import java.sql.Timestamp;

@Data @Data
public class ProcessInfo { public class ProcessInfo {
protected Long id; protected Long id;


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/runtime/ProcessInstance.java View File

@@ -1,8 +1,8 @@
package cc.smtweb.system.bpm.engine.process.runtime; package cc.smtweb.system.bpm.engine.process.runtime;


import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.util.JsonUtil; import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.system.bpm.core.exception.BpmObjectNotFoundException; import cc.smtweb.system.bpm.core.exception.BpmObjectNotFoundException;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.system.bpm.engine.process.vo.Flow; import cc.smtweb.system.bpm.engine.process.vo.Flow;
import cc.smtweb.system.bpm.engine.process.vo.FlowAction; import cc.smtweb.system.bpm.engine.process.vo.FlowAction;
import cc.smtweb.system.bpm.engine.process.vo.FlowConnection; import cc.smtweb.system.bpm.engine.process.vo.FlowConnection;


+ 0
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/process/task/TaskInfo.java View File

@@ -2,8 +2,6 @@ package cc.smtweb.system.bpm.engine.process.task;


import lombok.Data; import lombok.Data;


import java.sql.Timestamp;

@Data @Data
public class TaskInfo { public class TaskInfo {
protected long id; protected long id;


+ 0
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/ui/codegen/VmTool.java View File

@@ -1,7 +1,6 @@
package cc.smtweb.system.bpm.engine.ui.codegen; package cc.smtweb.system.bpm.engine.ui.codegen;


import cc.smtweb.framework.core.util.jackson.*; import cc.smtweb.framework.core.util.jackson.*;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.system.bpm.util.CodeGenUtil; import cc.smtweb.system.bpm.util.CodeGenUtil;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;


+ 3
- 3
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/engine/ui/loader/json/JsonDatasetDecoder.java View File

@@ -2,6 +2,9 @@ package cc.smtweb.system.bpm.engine.ui.loader.json;


import cc.smtweb.framework.core.db.cache.ModelDatabaseCache; import cc.smtweb.framework.core.db.cache.ModelDatabaseCache;
import cc.smtweb.framework.core.db.cache.ModelTableCache; import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.vo.ModelDatabase;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.util.MapUtil; import cc.smtweb.framework.core.util.MapUtil;
import cc.smtweb.system.bpm.core.exception.ModelLoaderError; import cc.smtweb.system.bpm.core.exception.ModelLoaderError;
import cc.smtweb.system.bpm.core.ui.IParamConst; import cc.smtweb.system.bpm.core.ui.IParamConst;
@@ -9,9 +12,6 @@ import cc.smtweb.system.bpm.core.ui.dataset.FieldFormatTool;
import cc.smtweb.system.bpm.core.ui.entity.BpmPage; import cc.smtweb.system.bpm.core.ui.entity.BpmPage;
import cc.smtweb.system.bpm.core.ui.entity.dataset.*; import cc.smtweb.system.bpm.core.ui.entity.dataset.*;
import cc.smtweb.system.bpm.engine.AbstractLoader; import cc.smtweb.system.bpm.engine.AbstractLoader;
import cc.smtweb.framework.core.db.vo.ModelDatabase;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.system.bpm.engine.ui.entity.consts.MappingTypeEnum; import cc.smtweb.system.bpm.engine.ui.entity.consts.MappingTypeEnum;
import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum; import cc.smtweb.system.bpm.engine.ui.entity.consts.UiEnum;
import cc.smtweb.system.bpm.engine.ui.entity.vo.dataset.FzDatasetPropsVO; import cc.smtweb.system.bpm.engine.ui.entity.vo.dataset.FzDatasetPropsVO;


+ 0
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/BpmAutoConfiguration.java View File

@@ -9,7 +9,6 @@ import cc.smtweb.system.bpm.core.ui.bind.BpmMapAttrEditor;
import cc.smtweb.system.bpm.core.ui.bind.BpmPageContextEditor; import cc.smtweb.system.bpm.core.ui.bind.BpmPageContextEditor;
import cc.smtweb.system.bpm.spring.action.BpmEventDao; import cc.smtweb.system.bpm.spring.action.BpmEventDao;
import cc.smtweb.system.bpm.spring.action.BpmEventLoader; import cc.smtweb.system.bpm.spring.action.BpmEventLoader;
import cc.smtweb.system.bpm.spring.cache.BpmPageCache;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;


+ 1
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/ProcessEngineImpl.java View File

@@ -1,8 +1,8 @@
package cc.smtweb.system.bpm.spring; package cc.smtweb.system.bpm.spring;


import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.system.bpm.core.exception.BpmObjectNotFoundException;
import cc.smtweb.system.bpm.core.exception.BpmIlegalArgumentException; import cc.smtweb.system.bpm.core.exception.BpmIlegalArgumentException;
import cc.smtweb.system.bpm.core.exception.BpmObjectNotFoundException;
import cc.smtweb.system.bpm.engine.process.impl.dao.TaskDao; import cc.smtweb.system.bpm.engine.process.impl.dao.TaskDao;
import cc.smtweb.system.bpm.engine.process.impl.entity.CommitTaskUserVO; import cc.smtweb.system.bpm.engine.process.impl.entity.CommitTaskUserVO;
import cc.smtweb.system.bpm.engine.process.runtime.*; import cc.smtweb.system.bpm.engine.process.runtime.*;
@@ -13,7 +13,6 @@ import cc.smtweb.system.bpm.engine.process.vo.FlowConnection;
import cc.smtweb.system.bpm.engine.process.vo.FlowNode; import cc.smtweb.system.bpm.engine.process.vo.FlowNode;
import cc.smtweb.system.bpm.engine.ui.IFormDataStore; import cc.smtweb.system.bpm.engine.ui.IFormDataStore;
import cc.smtweb.system.bpm.engine.ui.impl.FormDataStoreImpl; import cc.smtweb.system.bpm.engine.ui.impl.FormDataStoreImpl;
import cc.smtweb.system.bpm.spring.cache.BpmFlowCache;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;




+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/action/service/BpmActionCardService.java View File

@@ -4,8 +4,8 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.system.bpm.core.ui.BpmPageContext; import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.service.DatasetApiInvoker; import cc.smtweb.system.bpm.core.ui.service.DatasetApiInvoker;
import cc.smtweb.system.bpm.core.ui.service.card.AbstractDatasetCardService; import cc.smtweb.system.bpm.core.ui.service.card.AbstractDatasetCardService;
import cc.smtweb.system.bpm.core.ui.service.card.DatasetCardWorker;
import cc.smtweb.system.bpm.core.ui.service.card.DatasetCardAgentWorker; import cc.smtweb.system.bpm.core.ui.service.card.DatasetCardAgentWorker;
import cc.smtweb.system.bpm.core.ui.service.card.DatasetCardWorker;
import cc.smtweb.system.bpm.spring.dao.DatasetCardDao; import cc.smtweb.system.bpm.spring.dao.DatasetCardDao;
import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao; import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao;
import lombok.Setter; import lombok.Setter;


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/action/service/BpmActionListService.java View File

@@ -4,8 +4,8 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.system.bpm.core.ui.BpmPageContext; import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.service.DatasetApiInvoker; import cc.smtweb.system.bpm.core.ui.service.DatasetApiInvoker;
import cc.smtweb.system.bpm.core.ui.service.list.AbstractDatasetListService; import cc.smtweb.system.bpm.core.ui.service.list.AbstractDatasetListService;
import cc.smtweb.system.bpm.core.ui.service.list.DatasetListWorker;
import cc.smtweb.system.bpm.core.ui.service.list.DatasetListAgentWorker; import cc.smtweb.system.bpm.core.ui.service.list.DatasetListAgentWorker;
import cc.smtweb.system.bpm.core.ui.service.list.DatasetListWorker;
import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao; import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao;
import cc.smtweb.system.bpm.spring.dao.DatasetListDao; import cc.smtweb.system.bpm.spring.dao.DatasetListDao;
import lombok.Setter; import lombok.Setter;


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/action/service/BpmActionTreeService.java View File

@@ -4,8 +4,8 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.system.bpm.core.ui.BpmPageContext; import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.service.DatasetApiInvoker; import cc.smtweb.system.bpm.core.ui.service.DatasetApiInvoker;
import cc.smtweb.system.bpm.core.ui.service.tree.AbstractDatasetTreeService; import cc.smtweb.system.bpm.core.ui.service.tree.AbstractDatasetTreeService;
import cc.smtweb.system.bpm.core.ui.service.tree.DatasetTreeWorker;
import cc.smtweb.system.bpm.core.ui.service.tree.DatasetTreeAgentWorker; import cc.smtweb.system.bpm.core.ui.service.tree.DatasetTreeAgentWorker;
import cc.smtweb.system.bpm.core.ui.service.tree.DatasetTreeWorker;
import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao; import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao;
import cc.smtweb.system.bpm.spring.dao.DatasetTreeDao; import cc.smtweb.system.bpm.spring.dao.DatasetTreeDao;
import lombok.Setter; import lombok.Setter;


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/cache/BpmPageCache.java View File

@@ -145,7 +145,7 @@ public class BpmPageCache extends AbstractCache<BpmPage> {
} }


public BpmPage getByOtherKey(String otherKey) { public BpmPage getByOtherKey(String otherKey) {
BpmPage bean = localGetByKey(fn, otherKey);
BpmPage bean = getByKey(fn, otherKey);
if (bean == null) { if (bean == null) {
bean = loadFromOtherKey(otherKey); bean = loadFromOtherKey(otherKey);
if (bean != null) { if (bean != null) {


+ 0
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/dao/AbstractDatasetPlugin.java View File

@@ -1,7 +1,6 @@
package cc.smtweb.system.bpm.spring.dao; package cc.smtweb.system.bpm.spring.dao;


import cc.smtweb.framework.core.SwMap; import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.sqlbuilder.AbstractSelectSqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.AbstractSelectSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;


+ 2
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/dao/DatasetListDao.java View File

@@ -2,10 +2,10 @@ package cc.smtweb.system.bpm.spring.dao;


import cc.smtweb.framework.core.SwMap; import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.db.sqlbuilder.AbstractSelectSqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.AbstractSelectSqlBuilder;
import cc.smtweb.system.bpm.core.ui.IParamConst;
import cc.smtweb.system.bpm.core.ui.BpmKeyValue; import cc.smtweb.system.bpm.core.ui.BpmKeyValue;
import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.BpmMapData; import cc.smtweb.system.bpm.core.ui.BpmMapData;
import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.IParamConst;
import cc.smtweb.system.bpm.core.ui.builder.SqlUtil; import cc.smtweb.system.bpm.core.ui.builder.SqlUtil;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset; import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmFieldFilter; import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmFieldFilter;


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/spring/dao/DatasetTreeDao.java View File

@@ -2,8 +2,8 @@ package cc.smtweb.system.bpm.spring.dao;


import cc.smtweb.framework.core.SwMap; import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.db.sqlbuilder.AbstractSelectSqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.AbstractSelectSqlBuilder;
import cc.smtweb.system.bpm.core.ui.IParamConst;
import cc.smtweb.system.bpm.core.ui.BpmPageContext; import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.IParamConst;
import cc.smtweb.system.bpm.core.ui.builder.TreeDataBuilder; import cc.smtweb.system.bpm.core.ui.builder.TreeDataBuilder;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset; import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.engine.entity.AspModelTreeVO; import cc.smtweb.system.bpm.engine.entity.AspModelTreeVO;


+ 88
- 0
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/catalog/ModelCatalog.java View File

@@ -0,0 +1,88 @@
package cc.smtweb.system.bpm.web.design.catalog;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.db.impl.DefaultEntity;

/**
* Created by Akmm at 2022/3/1 15:35
*/
@SwTable("ASP_MODEL_CATALOG")
public class ModelCatalog extends DefaultEntity {
public static final String ENTITY_NAME = "ASP_MODEL_CATALOG";

public ModelCatalog() {
super(ENTITY_NAME);
}

private long getMcId() {
return getLong("mc_id");
}

private void setMcId(long mcId) {
put("mc_id", mcId);
}

private long getMcParentId() {
return getLong("mc_parent_id");
}

private void setMcParentId(long mcParentId) {
put("mc_parent_id", mcParentId);
}

private String getMcCode() {
return getStr("mc_code");
}

private void setMcCode(String mcCode) {
put("mc_code", mcCode);
}

private String getMcName() {
return getStr("mc_name");
}

private void setMcName(String mcName) {
put("mc_name", mcName);
}

private long getMcPrjId() {
return getLong("mc_prj_id");
}

private void setMcPrjId(long mcPrjId) {
put("mc_prj_id", mcPrjId);
}

private long getMcCreateUid() {
return getLong("mc_create_uid");
}

private void setMcCreateUid(long mcCreateUid) {
put("mc_create_uid", mcCreateUid);
}

private long getMcUpdateUid() {
return getLong("mc_update_uid");
}

private void setMcUpdateUid(long mcUpdateUid) {
put("mc_update_uid", mcUpdateUid);
}

private long getMcCreateAt() {
return getLong("mc_create_at");
}

private void setMcCreateAt(long mcCreateAt) {
put("mc_create_at", mcCreateAt);
}

private long getMcUpdateAt() {
return getLong("mc_update_at");
}

private void setMcUpdateAt(long mcUpdateAt) {
put("mc_update_at", mcUpdateAt);
}
}

+ 32
- 0
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/catalog/ModelCatalogService.java View File

@@ -0,0 +1,32 @@
package cc.smtweb.system.bpm.web.design.catalog;

import cc.smtweb.framework.core.R;
import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.mvc.service.*;
import cc.smtweb.framework.core.session.UserSession;

/**
* Created by Akmm at 2022/3/1 17:00
* 项目服务类
*/
@SwService
public class ModelCatalogService extends AbstractCompService {
@Override
protected IHandler createHanlder(String type) {
switch (type) {
case TYPE_LOAD:
return new DefaultLoadHandler<ModelCatalog>(ModelCatalog.ENTITY_NAME);
case TYPE_SAVE:
return new DefaultSaveHandler<>(ModelCatalog.ENTITY_NAME);
case TYPE_DEL:
return new DefaultDelHandler<>(ModelCatalog.ENTITY_NAME);
case TYPE_LIST:
return new DefaultListHandler<>(ModelCatalog.ENTITY_NAME);
case TYPE_COMBO:
return new DefaultListHandler<>(ModelCatalog.ENTITY_NAME);
}
return null;
}
}

+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/codegen/AbstractCodeService.java View File

@@ -3,9 +3,9 @@ package cc.smtweb.system.bpm.web.design.codegen;
import cc.smtweb.framework.core.annotation.SwParam; import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.system.bpm.engine.entity.AspModelTreeVO; import cc.smtweb.system.bpm.engine.entity.AspModelTreeVO;
import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao;
import cc.smtweb.system.bpm.util.ITreeDataLevelHandler; import cc.smtweb.system.bpm.util.ITreeDataLevelHandler;
import cc.smtweb.system.bpm.util.TreeDataUtil; import cc.smtweb.system.bpm.util.TreeDataUtil;
import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao;


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




+ 2
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/codegen/JavaCodeService.java View File

@@ -6,6 +6,8 @@ import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.cache.ModelDatabaseCache; import cc.smtweb.framework.core.db.cache.ModelDatabaseCache;
import cc.smtweb.framework.core.db.cache.ModelTableCache; import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.vo.ModelDatabase;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.session.UserSession; import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.file.FilePathGenerator; import cc.smtweb.framework.file.FilePathGenerator;
import cc.smtweb.system.bpm.core.exception.ModelLoaderError; import cc.smtweb.system.bpm.core.exception.ModelLoaderError;
@@ -13,8 +15,6 @@ import cc.smtweb.system.bpm.core.ui.entity.BpmPage;
import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset; import cc.smtweb.system.bpm.core.ui.entity.dataset.BpmDataset;
import cc.smtweb.system.bpm.core.ui.entity.form.BpmForm; import cc.smtweb.system.bpm.core.ui.entity.form.BpmForm;
import cc.smtweb.system.bpm.core.ui.entity.form.BpmWidget; import cc.smtweb.system.bpm.core.ui.entity.form.BpmWidget;
import cc.smtweb.framework.core.db.vo.ModelDatabase;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.system.bpm.engine.entity.AspModelTreeVO; import cc.smtweb.system.bpm.engine.entity.AspModelTreeVO;
import cc.smtweb.system.bpm.engine.ui.codegen.DefaultVelocityEngine; import cc.smtweb.system.bpm.engine.ui.codegen.DefaultVelocityEngine;
import cc.smtweb.system.bpm.engine.ui.entity.yaml.YamlDataset; import cc.smtweb.system.bpm.engine.ui.entity.yaml.YamlDataset;


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspDbCardService.java View File

@@ -7,13 +7,13 @@ import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.cache.ModelDatabaseCache; import cc.smtweb.framework.core.db.cache.ModelDatabaseCache;
import cc.smtweb.framework.core.db.cache.ModelTableCache; import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.config.DesignConfig;
import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder;
import cc.smtweb.framework.core.db.vo.ModelDatabase; import cc.smtweb.framework.core.db.vo.ModelDatabase;
import cc.smtweb.framework.core.session.UserSession; import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.DateUtil; import cc.smtweb.framework.core.util.DateUtil;
import cc.smtweb.framework.core.db.config.DesignConfig;
import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao; import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;




+ 2
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelCardService.java View File

@@ -5,6 +5,7 @@ import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwParam; import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService; import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.config.DesignConfig;
import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder; import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder;
@@ -19,12 +20,11 @@ import cc.smtweb.system.bpm.engine.ui.loader.IPageRouter;
import cc.smtweb.system.bpm.engine.ui.loader.TreePageRouter; import cc.smtweb.system.bpm.engine.ui.loader.TreePageRouter;
import cc.smtweb.system.bpm.engine.ui.loader.UiMobileLoader; import cc.smtweb.system.bpm.engine.ui.loader.UiMobileLoader;
import cc.smtweb.system.bpm.engine.ui.loader.UiPcLoader; import cc.smtweb.system.bpm.engine.ui.loader.UiPcLoader;
import cc.smtweb.framework.core.db.config.DesignConfig;
import cc.smtweb.system.bpm.spring.cache.BpmFlowCache; import cc.smtweb.system.bpm.spring.cache.BpmFlowCache;
import cc.smtweb.system.bpm.spring.cache.BpmPageCache; import cc.smtweb.system.bpm.spring.cache.BpmPageCache;
import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao;
import cc.smtweb.system.bpm.util.ITreeDataLevelHandler; import cc.smtweb.system.bpm.util.ITreeDataLevelHandler;
import cc.smtweb.system.bpm.util.TreeDataUtil; import cc.smtweb.system.bpm.util.TreeDataUtil;
import cc.smtweb.system.bpm.spring.dao.DatasetConfigDao;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;




+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelConfigService.java View File

@@ -4,8 +4,8 @@ import cc.smtweb.framework.core.R;
import cc.smtweb.framework.core.SwMap; import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.annotation.SwParam; import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService; import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.system.bpm.spring.BpmConfigBean;
import cc.smtweb.framework.core.db.config.DesignConfig; import cc.smtweb.framework.core.db.config.DesignConfig;
import cc.smtweb.system.bpm.spring.BpmConfigBean;
import cc.smtweb.system.bpm.util.YamlUtil; import cc.smtweb.system.bpm.util.YamlUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelExportService.java View File

@@ -3,8 +3,8 @@ package cc.smtweb.system.bpm.web.design.model;
import cc.smtweb.framework.core.annotation.SwParam; import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService; import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.jdbc.IdGenerator;
import cc.smtweb.framework.core.db.config.DesignConfig; import cc.smtweb.framework.core.db.config.DesignConfig;
import cc.smtweb.framework.core.db.jdbc.IdGenerator;
import cc.smtweb.system.bpm.spring.cache.BpmFlowCache; import cc.smtweb.system.bpm.spring.cache.BpmFlowCache;
import cc.smtweb.system.bpm.spring.cache.BpmPageCache; import cc.smtweb.system.bpm.spring.cache.BpmPageCache;




+ 0
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/modelcatalog/AspModelCatalogListService.java View File

@@ -6,7 +6,6 @@ import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.session.UserSession; import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.engine.entity.AspModelCatalogPO; import cc.smtweb.system.bpm.engine.entity.AspModelCatalogPO;
import cc.smtweb.system.bpm.web.design.preview.entity.AppVO;


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




+ 0
- 3
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewAppListService.java View File

@@ -5,10 +5,7 @@ import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService; import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.session.UserSession; import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.engine.entity.AspModelCatalogPO;
import cc.smtweb.system.bpm.util.TreeDataUtil;
import cc.smtweb.system.bpm.web.design.preview.entity.AppVO; import cc.smtweb.system.bpm.web.design.preview.entity.AppVO;
import cc.smtweb.system.bpm.web.design.preview.entity.MenuVO;


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




+ 2
- 8
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/project/ModelProjectService.java View File

@@ -1,15 +1,7 @@
package cc.smtweb.system.bpm.web.design.project; package cc.smtweb.system.bpm.web.design.project;


import cc.smtweb.framework.core.R;
import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService; import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.mvc.service.*; import cc.smtweb.framework.core.mvc.service.*;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.engine.entity.AspModelPO;


/** /**
* Created by Akmm at 2022/3/1 17:00 * Created by Akmm at 2022/3/1 17:00
@@ -28,6 +20,8 @@ public class ModelProjectService extends AbstractCompService {
return new DefaultDelHandler<>(ModelProject.ENTITY_NAME); return new DefaultDelHandler<>(ModelProject.ENTITY_NAME);
case TYPE_LIST: case TYPE_LIST:
return new DefaultListHandler<>(ModelProject.ENTITY_NAME); return new DefaultListHandler<>(ModelProject.ENTITY_NAME);
case TYPE_COMBO:
return new DefaultListHandler<>(ModelProject.ENTITY_NAME);
} }
return null; return null;
} }


+ 0
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/task/service/BpmTaskCardService.java View File

@@ -2,7 +2,6 @@ package cc.smtweb.system.bpm.web.task.service;


import cc.smtweb.framework.core.SwMap; import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.annotation.SwService; import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.config.DesignConfig;
import cc.smtweb.framework.core.db.vo.ModelField; import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable; import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.db.vo.def.DataType; import cc.smtweb.framework.core.db.vo.def.DataType;


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/ui/dynform/DynFormCardService.java View File

@@ -3,7 +3,7 @@ package cc.smtweb.system.bpm.web.ui.dynform;
import cc.smtweb.framework.core.annotation.SwParam; import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService; import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.system.bpm.core.ui.BpmPageContext; import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.service.card.*;
import cc.smtweb.system.bpm.core.ui.service.card.AbstractDatasetCardService;
import cc.smtweb.system.bpm.core.ui.service.card.DatasetCardWorker; import cc.smtweb.system.bpm.core.ui.service.card.DatasetCardWorker;
import cc.smtweb.system.bpm.spring.dao.DatasetCardDao; import cc.smtweb.system.bpm.spring.dao.DatasetCardDao;
import cc.smtweb.system.bpm.web.ui.dao.JsonDatasetCardDao; import cc.smtweb.system.bpm.web.ui.dao.JsonDatasetCardDao;


+ 2
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/ui/dynform/DynFormListService.java View File

@@ -2,8 +2,9 @@ package cc.smtweb.system.bpm.web.ui.dynform;


import cc.smtweb.framework.core.annotation.SwParam; import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService; import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.system.bpm.core.ui.service.list.*;
import cc.smtweb.system.bpm.core.ui.BpmPageContext; import cc.smtweb.system.bpm.core.ui.BpmPageContext;
import cc.smtweb.system.bpm.core.ui.service.list.AbstractDatasetListService;
import cc.smtweb.system.bpm.core.ui.service.list.DatasetListWorker;
import cc.smtweb.system.bpm.spring.dao.DatasetListDao; import cc.smtweb.system.bpm.spring.dao.DatasetListDao;
import cc.smtweb.system.bpm.web.ui.dao.JsonDatasetListDao; import cc.smtweb.system.bpm.web.ui.dao.JsonDatasetListDao;




+ 0
- 2
smtweb-system/sw-system-bpm/src/main/resources/codegen/vm/events.ts.vm View File

@@ -1,5 +1,3 @@
import { usePageDatasets } from "/@/sw-form";

export default { export default {
create({ pageDataset }) { create({ pageDataset }) {
this.pageDataset = pageDataset; this.pageDataset = pageDataset;


+ 4
- 4
smtweb-system/sw-system-bpm/src/main/resources/codegen/vm/index.vue.vm View File

@@ -36,11 +36,11 @@
</template> </template>


<script lang="ts"> <script lang="ts">
import { usePageEngineEx, tabRouter } from "sw-widget";
import datasets from "./dataset";
import eventObject from "./event";
import {tabRouter, usePageEngineEx} from "sw-widget";
import datasets from "./dataset";
import eventObject from "./event";


export default {
export default {
name: "$pageRef.routerName", name: "$pageRef.routerName",
props: { props: {
id: { id: {


+ 9
- 10
smtweb-system/sw-system-bpm/src/test/java/cc/smtweb/system/bpm/test/BuildJavaBean.java View File

@@ -1,6 +1,5 @@
package cc.smtweb.system.bpm.test; package cc.smtweb.system.bpm.test;


import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.system.bpm.util.CodeGenUtil; import cc.smtweb.system.bpm.util.CodeGenUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.Test; import org.junit.Test;
@@ -12,15 +11,15 @@ import org.junit.Test;
public class BuildJavaBean { public class BuildJavaBean {
@Test @Test
public void buildBean() { public void buildBean() {
String str = "`prj_id` bigint(20) NOT NULL DEFAULT '-1',\n" +
" `prj_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '项目名称',\n" +
" `prj_depends` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '依赖其他的项目',\n" +
" `prj_desc` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '项目描述',\n" +
" `prj_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态:0 启用,1 禁用',\n" +
" `prj_create_uid` bigint(20) DEFAULT NULL,\n" +
" `prj_update_uid` bigint(20) DEFAULT NULL,\n" +
" `prj_create_at` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',\n" +
" `prj_update_at` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',";
String str = "`mc_id` bigint(20) NOT NULL,\n" +
" `mc_parent_id` bigint(20) DEFAULT NULL COMMENT '-1',\n" +
" `mc_code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,\n" +
" `mc_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT '项目名称',\n" +
" `mc_prj_id` bigint(20) NOT NULL DEFAULT '-1',\n" +
" `mc_create_uid` bigint(20) DEFAULT NULL,\n" +
" `mc_update_uid` bigint(20) DEFAULT NULL,\n" +
" `mc_create_at` bigint(20) NOT NULL DEFAULT '0',\n" +
" `mc_update_at` bigint(20) NOT NULL DEFAULT '0',";
String[] ss = str.split("\n"); String[] ss = str.split("\n");
for (String s: ss) { for (String s: ss) {
String[] s0 = s.trim().split(" "); String[] s0 = s.trim().split(" ");


+ 0
- 1
smtweb-system/sw-system-bpm/src/test/java/cc/smtweb/system/bpm/test/codegen/test/VuegenTest.java View File

@@ -1,7 +1,6 @@
package cc.smtweb.system.bpm.test.codegen.test; package cc.smtweb.system.bpm.test.codegen.test;


import cc.smtweb.system.bpm.core.ui.entity.BpmPage; import cc.smtweb.system.bpm.core.ui.entity.BpmPage;
import cc.smtweb.system.bpm.engine.ui.loader.UiPcLoader;
import org.apache.velocity.Template; import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext; import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.app.VelocityEngine;


+ 4
- 3
smtweb-system/sw-system-bpm/src/test/java/cc/smtweb/system/bpm/test/codegen/test/YamlToJsonTest.java View File

@@ -4,10 +4,11 @@ import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.system.bpm.util.YamlUtil; import cc.smtweb.system.bpm.util.YamlUtil;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;



import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.HashMap; import java.util.HashMap;


public class YamlToJsonTest { public class YamlToJsonTest {


Loading…
Cancel
Save