|
@@ -3,11 +3,18 @@ package cc.smtweb.system.bpm.web.design.preview; |
|
|
import cc.smtweb.framework.core.common.R; |
|
|
import cc.smtweb.framework.core.common.R; |
|
|
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.common.SwException; |
|
|
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.framework.core.util.CommUtil; |
|
|
import cc.smtweb.system.bpm.util.TreeDataUtil; |
|
|
import cc.smtweb.system.bpm.util.TreeDataUtil; |
|
|
|
|
|
import cc.smtweb.system.bpm.web.design.form.ModelForm; |
|
|
|
|
|
import cc.smtweb.system.bpm.web.design.form.ModelFormCache; |
|
|
import cc.smtweb.system.bpm.web.design.preview.entity.MenuVO; |
|
|
import cc.smtweb.system.bpm.web.design.preview.entity.MenuVO; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Comparator; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
@SwService |
|
|
@SwService |
|
@@ -16,25 +23,25 @@ public class PreviewMenuTreeService { |
|
|
private DbEngine dbEngine; |
|
|
private DbEngine dbEngine; |
|
|
|
|
|
|
|
|
public R treeAll(@SwParam("module") String module, UserSession us) { |
|
|
public R treeAll(@SwParam("module") String module, UserSession us) { |
|
|
Long mcId = dbEngine.queryLong("select mc_id from sw_bpm.asp_model_catalog where mc_module=? and mc_site_id=?", module, us.getSiteId()); |
|
|
|
|
|
if (mcId == null) { |
|
|
|
|
|
return R.error(module + " 模块不存在!"); |
|
|
|
|
|
|
|
|
// long prj_id = StringUtils.isNotEmpty(module) ? Long.parseLong(module) : 0L; |
|
|
|
|
|
List<ModelForm> listForm = new ArrayList<>(ModelFormCache.getInstance().getAll()); |
|
|
|
|
|
listForm.sort((o1, o2) -> CommUtil.chineseCompare(o1.getTitle(), o2.getTitle())); |
|
|
|
|
|
if (listForm.isEmpty()) throw new SwException("此项目无页面设计!"); |
|
|
|
|
|
|
|
|
|
|
|
List<MenuVO> list = new ArrayList<>(listForm.size()); |
|
|
|
|
|
for (ModelForm form: listForm) { |
|
|
|
|
|
MenuVO menu = new MenuVO(); |
|
|
|
|
|
menu.setId(form.getId()); |
|
|
|
|
|
menu.setName(form.getTitle()); |
|
|
|
|
|
menu.setPath("/bpm/" + form.getId()); |
|
|
|
|
|
// menu.setParentId(-1L); |
|
|
|
|
|
list.add(menu); |
|
|
} |
|
|
} |
|
|
/* |
|
|
|
|
|
* id: "11", |
|
|
|
|
|
* name: "用户管理", |
|
|
|
|
|
* icon: "", |
|
|
|
|
|
* path: "/bpm/uc.system.user.list", |
|
|
|
|
|
*/ |
|
|
|
|
|
String sql = "select model_id id, model_parent_id parent_id, model_key path, model_name name from sw_bpm.asp_model" + |
|
|
|
|
|
" where model_mc_id=? and model_type=? and model_site_id=? order by model_order, model_id"; |
|
|
|
|
|
List<MenuVO> list = dbEngine.query(sql, MenuVO.class, mcId, 3, us.getSiteId()); |
|
|
|
|
|
|
|
|
|
|
|
MenuVO root = new MenuVO(); |
|
|
MenuVO root = new MenuVO(); |
|
|
root.setName("项目"); |
|
|
root.setName("项目"); |
|
|
root.setPath(module); |
|
|
root.setPath(module); |
|
|
List<MenuVO> data = TreeDataUtil.buildTree(root, list, MenuVO.createTreeHandler()); |
|
|
List<MenuVO> data = TreeDataUtil.buildTree(root, list, MenuVO.createTreeHandler()); |
|
|
fixPath(data, "/bpm/" + module); |
|
|
|
|
|
|
|
|
|
|
|
return R.success(data); |
|
|
return R.success(data); |
|
|
} |
|
|
} |
|
|