瀏覽代碼

优化: 1、目录树支持参数exc_depend 排除依赖的项目

2、加载页面模型的参数改为pageName: module.pageName
master
FLYPHT 2 年之前
父節點
當前提交
40f9e1852a
共有 6 個文件被更改,包括 42 次插入10 次删除
  1. +7
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelCatalogTreeHandler.java
  2. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelCatalogTreeHelper.java
  3. +17
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormCache.java
  4. +6
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormLoadHandler.java
  5. +9
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormService.java
  6. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java

+ 7
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelCatalogTreeHandler.java 查看文件

@@ -31,7 +31,7 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>
private long prj_id;//所属项目
private int type;//查询类型:0-目录;1-表定义;2-页面定义
private boolean exc_empty;//排除空目录,type非目录时有效
private boolean exc_depend;//排除依赖项目的目录
private ModelCatalogTreeHelper mcTreeHelper = null;

//模块子页面,暂存
@@ -43,6 +43,7 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>
type = params.readInt("type");
prj_id = params.readLong("prj_id");
exc_empty = params.readBool("exc_empty");
exc_depend = params.readBool("exc_depend");
mcTreeHelper = (ModelCatalogTreeHelper) TreeHelper.getTreeHelper(ModelCatalog.ENTITY_NAME, ModelCatalogTreeHelper.class);
}

@@ -56,7 +57,7 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>

@Override
protected List<DefaultEntity> filterData() {
Set<Long> setId = ModelProjectCache.getInstance().getDependsPrjIds(prj_id);
Set<Long> setId =exc_depend ? new HashSet<>(Arrays.asList(prj_id)) : ModelProjectCache.getInstance().getDependsPrjIds(prj_id);
if (setId.isEmpty()) return new ArrayList<>();
String sqlPrjId = CommUtil.getSqlInIds(setId);

@@ -93,7 +94,7 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>

@Override
protected List<DefaultEntity> getChildren(long id) {
List<ModelCatalog> list = mcTreeHelper.getChildren(id, prj_id, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName()));
List<ModelCatalog> list = mcTreeHelper.getChildren(id, prj_id,exc_depend, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName()));
List<DefaultEntity> listRet;
if (type != TYPE_CATALOG && exc_empty) {//排除空目录
listRet = cleanEmpty(list);
@@ -141,7 +142,7 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>
addPageChildren(listRet, mc.getId(), type);
}
if (!listRet.isEmpty()) return true;
List<ModelCatalog> list = mcTreeHelper.getChildren(mc.getId(), prj_id, null);
List<ModelCatalog> list = mcTreeHelper.getChildren(mc.getId(), prj_id,exc_depend,null);
if (list == null || list.isEmpty()) return false;
for (ModelCatalog c : list) {
if (hasChildren(c)) return true;
@@ -223,6 +224,8 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>
} else if (bean instanceof ModelForm) {
final ModelForm form = (ModelForm) bean;
node.put("type", form.getType() + 2);
// 返回页面名称
bean.put("pageName",ModelProjectCache.getInstance().getModule(((ModelForm) bean).getPrjId())+"."+((ModelForm) bean).getName());
//是模块,需要加子页面
if (form.getType() == SwEnum.FormType.MODULE.value) {
List<DefaultEntity> lf = mapFormChild.get(form.getEntityId());


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelCatalogTreeHelper.java 查看文件

@@ -17,11 +17,11 @@ public class ModelCatalogTreeHelper extends TreeHelper<ModelCatalog> {
super(ModelCatalog.ENTITY_NAME);
}

public List<ModelCatalog> getChildren(long id, long prj_id, Comparator<ModelCatalog> comparator) {
public List<ModelCatalog> getChildren(long id, long prj_id,boolean exc_depend, Comparator<ModelCatalog> comparator) {
if (id > 0) {
return getChildren(id, comparator);
}
Set<Long> setId = ModelProjectCache.getInstance().getDependsPrjIds(prj_id);
Set<Long> setId = exc_depend ? new HashSet<>(Arrays.asList(prj_id)) : ModelProjectCache.getInstance().getDependsPrjIds(prj_id);
if (setId.isEmpty()) return new ArrayList<>();
Set<ModelCatalog> set = new HashSet<>();



+ 17
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormCache.java 查看文件

@@ -7,6 +7,8 @@ import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.util.PubUtil;
import cc.smtweb.system.bpm.web.design.db.ModelProjectCache;

import java.util.ArrayList;
import java.util.Comparator;
@@ -23,13 +25,14 @@ public class ModelFormCache extends AbstractEntityCache<ModelForm> {
private final static String mc = "c";
private final static String mt = "t";
private final static String ms = "s";
private final static String mn = "mn";
public static ModelFormCache getInstance() {
return CacheManager.getIntance().getCache(ModelFormCache.class);
}

public ModelFormCache() {
regMap(mk, k-> k.getName().toUpperCase());
regMap(mn, k-> ModelProjectCache.getInstance().getModule(k.getPrjId())+"-"+k.getName().toUpperCase());
regList(mp, k-> String.valueOf(k.getPrjId()));
regList(mc, k-> String.valueOf(k.getMcId()));
regList(ms, k-> String.valueOf(k.getParent()));
@@ -90,4 +93,17 @@ public class ModelFormCache extends AbstractEntityCache<ModelForm> {
ModelForm form = get(id);
return form != null ? form.getTitle() : String.valueOf(id);
}

/**
* 根据末模块名称和页面名称获取 页面模型
* @param module
* @param pageName
* @return ModelForm
*/
public ModelForm getByName(String module,String pageName){
if(PubUtil.isEmptyStr(module)||PubUtil.isEmptyStr(pageName)){
return null;
}
return getByKey(mn,module+"-"+pageName.toUpperCase());
}
}

+ 6
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormLoadHandler.java 查看文件

@@ -63,7 +63,12 @@ public class ModelFormLoadHandler extends DefaultLoadHandler<ModelForm> {
if (bean == null) throw new BizException("没有找到指定定义信息!id=" + id);
return R.success(ModelFormHelper.buildEngineModel(bean, params, us));
}

// 页面引擎-获取页面模型
public R loadForm(String module, String pageName) {
ModelForm bean = ModelFormCache.getInstance().getByName(module,pageName);
if (bean == null) throw new BizException("没有找到指定定义信息!module=" + module+",pageName="+pageName);
return R.success(ModelFormHelper.buildEngineModel(bean, params, us));
}
//获取页面使用的控件的filter信息
public R loadWidgetFilter() {
long id = params.readLong("id");


+ 9
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormService.java 查看文件

@@ -109,7 +109,15 @@ public class ModelFormService extends AbstractCompService {
public R model(@SwBody SwMap params, UserSession us) {
try {
ModelFormLoadHandler handler = (ModelFormLoadHandler) getHandler(params, us, TYPE_LOAD);
return handler.loadForm();
String page = params.readString("id","");
String [] array = page.split("\\.");
String module = "";
String pageName = "";
if(array.length==2){
module = array[0];
pageName = array[1];
}
return handler.loadForm(module,pageName);
} catch (Exception e) {
return R.error("操作失败!", e);
}


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java 查看文件

@@ -54,7 +54,7 @@ public class PreviewMenuTreeService {
MenuVO menu = new MenuVO();
menu.setId(form.getId());
menu.setName(form.getTitle());
menu.setPath("/bpm/" + form.getId());
menu.setPath("/bpm/" + module+"."+form.getName());
menu.setParentId(form.getMcId());

setMenuChildren(map.get(form.getMcId()), menu);


Loading…
取消
儲存