Browse Source

模块的生成代码支持

master
郑根木 2 years ago
parent
commit
a593230e7d
2 changed files with 26 additions and 10 deletions
  1. +3
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java
  2. +23
    -10
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java

+ 3
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java View File

@@ -111,6 +111,9 @@ public class CodeBuildHandler extends AbstractHandler {
if (StringUtils.isNotEmpty(cn)) { if (StringUtils.isNotEmpty(cn)) {
packageName += "." + cn; packageName += "." + cn;
} }
String pn = ModelFormHelper.getFormParentName(form);
if (StringUtils.isNotEmpty(pn)) packageName += "." + pn;

codePath += packageName.replaceAll("\\.", "/"); codePath += packageName.replaceAll("\\.", "/");
new File(codePath).mkdirs(); new File(codePath).mkdirs();
} }


+ 23
- 10
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java View File

@@ -232,7 +232,7 @@ public class ModelFormHelper {
field.put("linkDb", filter.linkDb); field.put("linkDb", filter.linkDb);
field.put("linkField", filter.linkField); field.put("linkField", filter.linkField);
field.put("value", filter.value); field.put("value", filter.value);
field.put("trigger",filter.trigger);
field.put("trigger", filter.trigger);
} }
} }
} }
@@ -386,6 +386,10 @@ public class ModelFormHelper {
String ep = moduleName; String ep = moduleName;
String cn = ModelCatalogCache.getInstance().getFullName(bean.getMcId()); String cn = ModelCatalogCache.getInstance().getFullName(bean.getMcId());
if (StringUtils.isNotEmpty(cn)) ep = ep + "." + cn; if (StringUtils.isNotEmpty(cn)) ep = ep + "." + cn;

String pn = ModelFormHelper.getFormParentName(bean);
if (StringUtils.isNotEmpty(pn)) ep += "." + pn;

return ep; return ep;
} }
return ""; return "";
@@ -393,6 +397,7 @@ public class ModelFormHelper {


/** /**
* 根据向导生成model * 根据向导生成model
*
* @param form * @param form
* @param tmplId * @param tmplId
*/ */
@@ -422,7 +427,7 @@ public class ModelFormHelper {
} }
String widgetRef = ""; String widgetRef = "";
if (!setWidget.isEmpty()) { if (!setWidget.isEmpty()) {
for (long s: setWidget) {
for (long s : setWidget) {
widgetRef += ",\"" + s + "\""; widgetRef += ",\"" + s + "\"";
} }
widgetRef = widgetRef.substring(1); widgetRef = widgetRef.substring(1);
@@ -490,23 +495,31 @@ public class ModelFormHelper {
return (form != null) ? form.getEntityId() : 0L; return (form != null) ? form.getEntityId() : 0L;
} }


//js文件的路径
public String getJsPath(ModelForm form) {
/*//js文件的路径
public static String getJsPath(ModelForm form) {
if (form == null) throw new BizException("页面定义对象不能为空!"); if (form == null) throw new BizException("页面定义对象不能为空!");
String moduleName = ModelProjectCache.getInstance().getModule(form.getPrjId()); String moduleName = ModelProjectCache.getInstance().getModule(form.getPrjId());
BpmConfigBean bpmConfigBean = SpringUtil.getBean(BpmConfigBean.class); BpmConfigBean bpmConfigBean = SpringUtil.getBean(BpmConfigBean.class);
Map<String, String> mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath()); Map<String, String> mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath());
if (mapIdeaModules == null || mapIdeaModules.isEmpty()) throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!");
String codeJavaPath = mapIdeaModules.get(moduleName);
if (StringUtils.isEmpty(codeJavaPath)) {
if (mapIdeaModules == null || mapIdeaModules.isEmpty())
throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!");
String codePath = mapIdeaModules.get(moduleName);
if (StringUtils.isEmpty(codePath)) {
throw new BizException("没有找到对应项目在idea中Module的路径(" + moduleName + ")!"); throw new BizException("没有找到对应项目在idea中Module的路径(" + moduleName + ")!");
} }
codeJavaPath += "/src/main/resources/static/event/" + moduleName + "/";
codePath += "/src/main/resources/static/event/" + moduleName + "/";
//加上目录 //加上目录
String cn = ModelCatalogCache.getInstance().getFullName(form.getMcId()); String cn = ModelCatalogCache.getInstance().getFullName(form.getMcId());
if (StringUtils.isNotEmpty(cn)) { if (StringUtils.isNotEmpty(cn)) {
codeJavaPath += cn.replaceAll("\\.", "/");
codePath += cn.replaceAll("\\.", "/");
} }
return codeJavaPath;
return codePath;
}*/

public static String getFormParentName(ModelForm form) {
if (form.getParent() <= 0) return null;
ModelForm pf = ModelFormCache.getInstance().get(form.getParent());
if (pf != null) return pf.getName();
return null;
} }
} }

Loading…
Cancel
Save