郑根木 2 år sedan
förälder
incheckning
dd6e06e1d6
25 ändrade filer med 73 tillägg och 175 borttagningar
  1. +17
    -42
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractCompService.java
  2. +3
    -4
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractDelHandler.java
  3. +1
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractHandler.java
  4. +5
    -10
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java
  5. +2
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractLoadHandler.java
  6. +9
    -6
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractSaveHandler.java
  7. +3
    -9
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractTreeHandler.java
  8. +2
    -2
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultComboHandler.java
  9. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultDelHandler.java
  10. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultListHandler.java
  11. +1
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultLoadHandler.java
  12. +3
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java
  13. +2
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/IWorker.java
  14. +8
    -41
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcService.java
  15. +1
    -5
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormService.java
  16. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/table/ModelCatalogService.java
  17. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/table/ModelDatabaseService.java
  18. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/table/ModelProjectService.java
  19. +1
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/table/ModelTableService.java
  20. +1
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageAddHandler.java
  21. +0
    -6
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageDelHandler.java
  22. +1
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageLoadOneHandler.java
  23. +0
    -5
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageSaveHandler.java
  24. +5
    -20
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageService.java
  25. +3
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowService.java

+ 17
- 42
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractCompService.java Visa fil

@@ -18,10 +18,10 @@ public abstract class AbstractCompService {
public final static String TYPE_SAVE = "save";
public final static String TYPE_DEL = "del";

protected abstract IHandler createHandler(String type);
protected abstract AbstractHandler createHandler(String type);

protected IHandler getHandler(SwMap params, UserSession us, String type) throws Exception {
IHandler handler = createHandler(type);
protected AbstractHandler getHandler(SwMap params, UserSession us, String type) throws Exception {
AbstractHandler handler = createHandler(type);
if (handler == null) throw new SwException("暂不支持此类服务:" + type);
if (params == null) params = new SwMap();
if (us == null) us = UserSession.createSys();
@@ -29,10 +29,10 @@ public abstract class AbstractCompService {
return handler;
}

protected R pageHandler(SwMap params, UserSession us, String type) {
protected R pageHandler(SwMap params, UserSession us, String type, IWorker worker) {
try {
IHandler handler = getHandler(params, us, type);
return handler.doWork();
AbstractHandler handler = getHandler(params, us, type);
return worker.doWork(handler);
} catch (Exception e) {
return R.error("操作失败!", e);
}
@@ -40,81 +40,56 @@ public abstract class AbstractCompService {

//保存
public R save(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_SAVE);
return pageHandler(params, us, TYPE_SAVE, handler -> ((AbstractSaveHandler)handler).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);
}
return pageHandler(params, us, TYPE_SAVE, handler -> ((AbstractSaveHandler)handler).changeParent());
}

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

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

//列表数据
public R list(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_LIST);
return pageHandler(params, us, TYPE_LIST, handler -> ((AbstractListHandler)handler).listData());
}

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

//combo数据
public R combo(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_COMBO);
return pageHandler(params, us, TYPE_COMBO, handler -> ((DefaultComboHandler)handler).listData());
}

//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);
}
return pageHandler(params, us, TYPE_COMBO, handler -> ((DefaultComboHandler)handler).getTotal());
}

//combo数据过滤
public R comboFilter(@SwBody SwMap params, UserSession us) {
try {
DefaultComboHandler handler = (DefaultComboHandler) getHandler(params, us, TYPE_COMBO);
return handler.filter();
} catch (Exception e) {
return R.error("操作失败!", e);
}
return pageHandler(params, us, TYPE_COMBO, handler -> ((DefaultComboHandler)handler).filter());
}

//树数据
public R tree(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_TREE);
return pageHandler(params, us, TYPE_COMBO, handler -> ((AbstractTreeHandler<Object>)handler).data());
}

//树过滤
public R treeFilter(@SwBody SwMap params, UserSession us) {
try {
AbstractTreeHandler handler = (AbstractTreeHandler) getHandler(params, us, TYPE_TREE);
return handler.filter();
} catch (Exception e) {
return R.error("操作失败!", e);
}
return pageHandler(params, us, TYPE_COMBO, handler -> ((AbstractTreeHandler<Object>)handler).filter());
}
}

+ 3
- 4
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractDelHandler.java Visa fil

@@ -13,15 +13,14 @@ import lombok.extern.slf4j.Slf4j;
public abstract class AbstractDelHandler extends AbstractHandler{
protected long id;

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

checkValid();
DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work() {
del();
delDb();
}

@Override
@@ -48,7 +47,7 @@ public abstract class AbstractDelHandler extends AbstractHandler{
}

protected abstract void checkValid();
protected abstract void del();
protected abstract void delDb();
protected void saveSuccess() {}
protected void saveFailed() {}
}

+ 1
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractHandler.java Visa fil

@@ -6,11 +6,10 @@ import cc.smtweb.framework.core.session.UserSession;
/**
* Created by Akmm at 2022/3/2 19:44
*/
public abstract class AbstractHandler implements IHandler {
public abstract class AbstractHandler {
protected SwMap params;
protected UserSession us;

@Override
public void init(SwMap params, UserSession us) {
this.params = params;
this.us = us;


+ 5
- 10
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java Visa fil

@@ -28,11 +28,6 @@ public abstract class AbstractListHandler extends AbstractHandler {

private SessionCache sessionCache;

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

protected String getCompId() {
return this.getClass().getSimpleName();
}
@@ -55,7 +50,7 @@ public abstract class AbstractListHandler extends AbstractHandler {
sessionCache.remove(getCompId() + "." + key);
}

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

@@ -80,7 +75,7 @@ public abstract class AbstractListHandler extends AbstractHandler {
}

afterQuery(listData);
return SwListData.create(listData, rows);
return R.success(SwListData.create(listData, rows));
}

protected SqlPara buildSumSqlPara() {
@@ -132,7 +127,7 @@ public abstract class AbstractListHandler extends AbstractHandler {
}
}

protected SqlPara buildDataSql() throws Exception {
protected SqlPara buildDataSql() {
//从缓存里看看有没有保存的sql缓存;
SqlPara sqlParaInCache = getCache(KEY_SQLPARA); //缓存里面的对象;
boolean query = sqlParaInCache == null || params.readBool("query");
@@ -179,7 +174,7 @@ public abstract class AbstractListHandler extends AbstractHandler {
*
* @throws Exception
*/
protected void buildParam() throws Exception {
protected void buildParam() {

}

@@ -195,7 +190,7 @@ public abstract class AbstractListHandler extends AbstractHandler {
protected void afterQuery(List<SwMap> listData) {
}

protected abstract SqlPara buildSqlPara() throws Exception;
protected abstract SqlPara buildSqlPara();

//构建合计字段
private List<FooterField> getFooterFields() {


+ 2
- 3
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractLoadHandler.java Visa fil

@@ -7,8 +7,7 @@ import cc.smtweb.framework.core.common.R;
*/
public abstract class AbstractLoadHandler<T> extends AbstractHandler {

@Override
public R doWork() throws Exception {
public R load() {
long id = readId();
T bean;
if (id <= 0L) {
@@ -27,7 +26,7 @@ public abstract class AbstractLoadHandler<T> extends AbstractHandler {
return params.readLong("id", 0L);
}

protected abstract T createComp() throws Exception;
protected abstract T createComp();

protected abstract T loadComp(long id);
}

+ 9
- 6
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractSaveHandler.java Visa fil

@@ -15,8 +15,8 @@ public abstract class AbstractSaveHandler<T> extends AbstractHandler {
protected boolean isNew;


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

isNew = id <= 0L;
@@ -33,7 +33,7 @@ public abstract class AbstractSaveHandler<T> extends AbstractHandler {
DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work(){
save();
saveDb();
}

@Override
@@ -66,7 +66,7 @@ public abstract class AbstractSaveHandler<T> extends AbstractHandler {
protected abstract void checkValid();

//保存到数据库
protected abstract void save();
protected abstract void saveDb();

//保存成功之后
protected void saveSuccess() {
@@ -77,8 +77,11 @@ public abstract class AbstractSaveHandler<T> extends AbstractHandler {
}

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

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

//树,改变父亲
public abstract R changeParent();
}

+ 3
- 9
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractTreeHandler.java Visa fil

@@ -13,24 +13,18 @@ import java.util.List;
*/
@Slf4j
public abstract class AbstractTreeHandler<T> extends AbstractHandler {

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

//树过滤
public R filter() throws Exception {
public R filter() {
List<T> rows = filterData();
List<SwMap> listRet = buildNodes(rows, true);
return R.success(listRet);
}

protected List<SwMap> data() throws Exception {
public R data() {
List<T> rows = getChildren(params.readLong("parent_id"));
List<SwMap> listRet = buildNodes(rows, params.readBool("lazy"));

return listRet;
return R.success(listRet);
}

//搜索


+ 2
- 2
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultComboHandler.java Visa fil

@@ -23,11 +23,11 @@ public class DefaultComboHandler<T extends DefaultEntity> extends DefaultListHan
super(tableName);
}

public R filter() throws Exception {
public R filter() {
return R.success(filterData());
}

protected SwListData filterData() throws Exception {
protected SwListData filterData() {
String text = params.readString("text");
if (StringUtils.isEmpty(text)) throw new SwException("没有搜素内容!");



+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultDelHandler.java Visa fil

@@ -27,7 +27,7 @@ public class DefaultDelHandler<T extends DefaultEntity> extends AbstractDelHandl
}

@Override
protected void del() {
protected void delDb() {
EntityDao dao = DbEngine.getInstance().findDao(tableName);
dao.deleteEntity(id);
}


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultListHandler.java Visa fil

@@ -25,7 +25,7 @@ public class DefaultListHandler<T extends DefaultEntity> extends AbstractListHan
}

@Override
protected SqlPara buildSqlPara() throws Exception {
protected SqlPara buildSqlPara() {
EntityDao dao = DbEngine.getInstance().findDao(tableName);
StringBuilder sql = new StringBuilder(512);
List<Object> args = new ArrayList<>();


+ 1
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultLoadHandler.java Visa fil

@@ -20,7 +20,7 @@ public class DefaultLoadHandler<T extends DefaultEntity> extends AbstractLoadHan
}

@Override
protected T createComp() throws Exception {
protected T createComp() {
final EntityDao<T> dao = DbEngine.getInstance().findDao(tableName);
T bean = dao.createBean();
ModelTable table = ModelTableCache.getInstance().getByName(tableName);


+ 3
- 3
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java Visa fil

@@ -31,7 +31,7 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractSaveHan
}

@Override
protected T createComp() throws Exception {
protected T createComp() {
final EntityDao<T> dao = DbEngine.getInstance().findDao(tableName);
T bean = dao.createBean();
ModelTable table = ModelTableCache.getInstance().getByName(tableName);
@@ -84,7 +84,7 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractSaveHan
}

@Override
protected void save() {
protected void saveDb() {
EntityDao<T> dao = DbEngine.getInstance().findDao(tableName);
if (isNew) {
dao.insertEntity(bean);
@@ -134,7 +134,7 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractSaveHan
}

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



smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/IHandler.java → smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/IWorker.java Visa fil

@@ -8,7 +8,6 @@ import cc.smtweb.framework.core.session.UserSession;
* Created by Akmm at 2022/3/2 19:01
* 所有handler的接口
*/
public interface IHandler {
void init(SwMap params, UserSession us);
R doWork() throws Exception;
public interface IWorker {
R doWork(AbstractHandler handler);
}

+ 8
- 41
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcService.java Visa fil

@@ -6,10 +6,7 @@ import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.mvc.service.AbstractCompService;
import cc.smtweb.framework.core.mvc.service.DefaultDelHandler;
import cc.smtweb.framework.core.mvc.service.DefaultListHandler;
import cc.smtweb.framework.core.mvc.service.IHandler;
import cc.smtweb.framework.core.mvc.service.*;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.SqlUtil;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
@@ -27,7 +24,7 @@ import java.util.List;
@SwService
public class ModelProcService extends AbstractCompService {
@Override
protected IHandler createHandler(String type) {
protected AbstractHandler createHandler(String type) {
switch (type) {
case TYPE_LOAD:
return new ModelFormLoadHandler();
@@ -44,62 +41,32 @@ public class ModelProcService extends AbstractCompService {

//保存数据集
public R saveDataset(@SwBody SwMap params, UserSession us) {
try {
ModelFormSaveHandler handler = (ModelFormSaveHandler) getHandler(params, us, TYPE_SAVE);
return handler.saveDataset();
} catch (Exception e) {
return R.error("操作失败!", e);
}
return pageHandler(params, us, TYPE_SAVE, handler -> ((ModelFormSaveHandler)handler).saveDataset());
}

//加载数据集
public R loadDataset(@SwBody SwMap params, UserSession us) {
try {
ModelFormLoadHandler handler = (ModelFormLoadHandler) getHandler(params, us, TYPE_LOAD);
return handler.loadDataset();
} catch (Exception e) {
return R.error("操作失败!", e);
}
return pageHandler(params, us, TYPE_LOAD, handler -> ((ModelFormLoadHandler)handler).loadDataset());
}

//保存页面模型
public R saveModel(@SwBody SwMap params, UserSession us) {
try {
ModelFormSaveHandler handler = (ModelFormSaveHandler) getHandler(params, us, TYPE_SAVE);
return handler.saveModel();
} catch (Exception e) {
return R.error("操作失败!", e);
}
return pageHandler(params, us, TYPE_SAVE, handler -> ((ModelFormSaveHandler)handler).saveModel());
}

//加载页面模型
public R loadModel(@SwBody SwMap params, UserSession us) {
try {
ModelFormLoadHandler handler = (ModelFormLoadHandler) getHandler(params, us, TYPE_LOAD);
return handler.loadModel();
} catch (Exception e) {
return R.error("操作失败!", e);
}
return pageHandler(params, us, TYPE_LOAD, handler -> ((ModelFormLoadHandler)handler).loadModel());
}

//加载引擎用页面模型
public R model(@SwBody SwMap params, UserSession us) {
try {
ModelFormLoadHandler handler = (ModelFormLoadHandler) getHandler(params, us, TYPE_LOAD);
return handler.loadForm();
} catch (Exception e) {
return R.error("操作失败!", e);
}
return pageHandler(params, us, TYPE_LOAD, handler -> ((ModelFormLoadHandler)handler).loadForm());
}

//获取页面使用的控件的filter信息
public R loadWidgetFilter(@SwBody SwMap params, UserSession us) {
try {
ModelFormLoadHandler handler = (ModelFormLoadHandler) getHandler(params, us, TYPE_LOAD);
return handler.loadWidgetFilter();
} catch (Exception e) {
return R.error("操作失败!", e);
}
return pageHandler(params, us, TYPE_LOAD, handler -> ((ModelFormLoadHandler)handler).loadWidgetFilter());
}

//获取自定义sql的字段信息,去库里查


+ 1
- 5
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormService.java Visa fil

@@ -10,12 +10,8 @@ import cc.smtweb.framework.core.mvc.service.*;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.SqlUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

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

@@ -25,7 +21,7 @@ import java.util.List;
@SwService
public class ModelFormService extends AbstractCompService {
@Override
protected IHandler createHandler(String type) {
protected AbstractHandler createHandler(String type) {
switch (type) {
case TYPE_LOAD:
return new ModelFormLoadHandler();


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/table/ModelCatalogService.java Visa fil

@@ -11,7 +11,7 @@ import cc.smtweb.framework.core.mvc.service.*;
@SwService
public class ModelCatalogService extends AbstractCompService {
@Override
protected IHandler createHandler(String type) {
protected AbstractHandler createHandler(String type) {
switch (type) {
case TYPE_LOAD:
return new DefaultLoadHandler<ModelCatalog>(ModelCatalog.ENTITY_NAME);


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/table/ModelDatabaseService.java Visa fil

@@ -11,7 +11,7 @@ import cc.smtweb.framework.core.mvc.service.*;
@SwService
public class ModelDatabaseService extends AbstractCompService {
@Override
protected IHandler createHandler(String type) {
protected AbstractHandler createHandler(String type) {
switch (type) {
case TYPE_LOAD:
return new DefaultLoadHandler<ModelCatalog>(ModelDatabase.ENTITY_NAME);


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/table/ModelProjectService.java Visa fil

@@ -11,7 +11,7 @@ import cc.smtweb.framework.core.mvc.service.*;
@SwService
public class ModelProjectService extends AbstractCompService {
@Override
protected IHandler createHandler(String type) {
protected AbstractHandler createHandler(String type) {
switch (type) {
case TYPE_LOAD:
return new DefaultLoadHandler<ModelProject>(ModelProject.ENTITY_NAME);


+ 1
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/table/ModelTableService.java Visa fil

@@ -5,7 +5,6 @@ import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.vo.ModelCatalog;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.mvc.service.*;
import cc.smtweb.framework.core.session.UserSession;
@@ -16,7 +15,7 @@ import cc.smtweb.framework.core.session.UserSession;
@SwService
public class ModelTableService extends AbstractCompService {
@Override
protected IHandler createHandler(String type) {
protected AbstractHandler createHandler(String type) {
switch (type) {
case TYPE_LOAD:
return new DefaultLoadHandler<ModelTable>(ModelTable.ENTITY_NAME);


+ 1
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageAddHandler.java Visa fil

@@ -15,8 +15,7 @@ import java.util.Map;
*/
public class DynPageAddHandler extends AbstractDynPageHandler {

@Override
public R doWork() throws Exception {
public R add() {
//返回的数据,以dataset.name为key,查出的结果(bean或list)为value
Map<String, Object> mapRet = new HashMap<>();
for (PageDataset dataSet : datasets.list) {


+ 0
- 6
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageDelHandler.java Visa fil

@@ -25,12 +25,6 @@ import java.util.Map;
* 删除操作
*/
public class DynPageDelHandler extends AbstractDynPageHandler {

@Override
public R doWork() throws Exception {
return delAll();
}

/**
* 删除指定数据集,入参{pageId, dataset, id}
*


+ 1
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageLoadOneHandler.java Visa fil

@@ -28,8 +28,7 @@ public class DynPageLoadOneHandler extends AbstractDynPageHandler {
//对应的数据集定义
private PageDataset pageDataSet;

@Override
public R doWork() throws Exception {
public R load() throws Exception {
dbName = params.readString("dataset");
filter = (SwMap)params.get("filter");



+ 0
- 5
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageSaveHandler.java Visa fil

@@ -30,11 +30,6 @@ import java.util.*;
public class DynPageSaveHandler extends AbstractDynPageHandler {
private Map<String, List<DefaultEntity>> mapTreeBean = new HashMap<>();

@Override
public R doWork() {
return saveAll();
}

/**
* 保存指定数据集操作,入参:{pageId,dataset:"", data:{form:{},list: {total:0,rows:[]}}, filter:{}}
*/


+ 5
- 20
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageService.java Visa fil

@@ -16,7 +16,7 @@ public class DynPageService extends AbstractCompService {
public final static String TYPE_ADD = "add";

@Override
protected IHandler createHandler(String type) {
protected AbstractHandler createHandler(String type) {
switch (type) {
case TYPE_ADD:
return new DynPageAddHandler();
@@ -32,36 +32,21 @@ public class DynPageService extends AbstractCompService {

//新增
public R add(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_ADD);
return pageHandler(params, us, TYPE_ADD, handler -> ((DynPageAddHandler)handler).add());
}

//保存指定数据集
public R saveOne(@SwBody SwMap params, UserSession us) {
try {
DynPageSaveHandler handler = (DynPageSaveHandler) getHandler(params, us, TYPE_SAVE);
return handler.saveOne();
} catch (Exception e) {
return R.error("操作失败!", e);
}
return pageHandler(params, us, TYPE_SAVE, handler -> ((DynPageSaveHandler)handler).saveOne());
}

//删除指定数据集
public R delOne(@SwBody SwMap params, UserSession us) {
try {
DynPageDelHandler handler = (DynPageDelHandler) getHandler(params, us, TYPE_DEL);
return handler.delOne();
} catch (Exception e) {
return R.error("操作失败!", e);
}
return pageHandler(params, us, TYPE_DEL, handler -> ((DynPageDelHandler)handler).delOne());
}

//列表总记录数及合计栏
public R total(@SwBody SwMap params, UserSession us) {
try {
DynPageLoadOneHandler handler = (DynPageLoadOneHandler) getHandler(params, us, TYPE_LOAD);
return handler.getTotal();
} catch (Exception e) {
return R.error("操作失败!", e);
}
return pageHandler(params, us, TYPE_LOAD, handler -> ((DynPageLoadOneHandler)handler).getTotal());
}
}

+ 3
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowService.java Visa fil

@@ -1,7 +1,8 @@
package cc.smtweb.system.bpm.web.engine.flow;

import cc.smtweb.framework.core.mvc.service.AbstractCompService;
import cc.smtweb.framework.core.mvc.service.IHandler;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.framework.core.mvc.service.IWorker;

/**
* Created by Akmm at 2022/5/24 14:21
@@ -9,7 +10,7 @@ import cc.smtweb.framework.core.mvc.service.IHandler;
*/
public class FlowService extends AbstractCompService {
@Override
protected IHandler createHandler(String type) {
protected AbstractHandler createHandler(String type) {
return null;
}
}

Laddar…
Avbryt
Spara