|
|
@@ -58,6 +58,35 @@ public class CodeBuildHandler extends AbstractHandler { |
|
|
|
return R.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public R buildJsCode() { |
|
|
|
userName = String.valueOf(us.getUserId()); |
|
|
|
//页面id |
|
|
|
long pageId = params.readLong("pageId"); |
|
|
|
ModelForm form = ModelFormCache.getInstance().get(pageId); |
|
|
|
if (form == null) throw new BizException("未找到指定的页面定义(" + pageId + ")!"); |
|
|
|
String moduleName = ModelProjectCache.getInstance().getModule(form.getPrjId()); |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(moduleName) || SwConsts.DEF_DB_NAME.equals(moduleName) || moduleName.equals("bpm")) { |
|
|
|
moduleName = "sw-system-bpm"; |
|
|
|
} |
|
|
|
BpmConfigBean bpmConfigBean = SpringUtil.getBean(BpmConfigBean.class); |
|
|
|
Map<String, String> mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath()); |
|
|
|
if (mapIdeaModules == null || mapIdeaModules.isEmpty()) throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!"); |
|
|
|
codeJavaPath = mapIdeaModules.get(moduleName); |
|
|
|
if (StringUtils.isEmpty(codeJavaPath)) { |
|
|
|
throw new BizException("没有找到对应项目在idea中Module的路径(" + moduleName + ")!"); |
|
|
|
} |
|
|
|
codeJavaPath += "/src/main/resources/"; |
|
|
|
//加上目录 |
|
|
|
String cn = ModelCatalogCache.getInstance().getFullName(form.getMcId()); |
|
|
|
if (StringUtils.isNotEmpty(cn)) { |
|
|
|
codeJavaPath += cn.replaceAll("\\.", "/"); |
|
|
|
} |
|
|
|
new File(codeJavaPath).mkdirs(); |
|
|
|
|
|
|
|
return R.success(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 构建java代码路径 |
|
|
|
* |
|
|
@@ -89,6 +118,12 @@ public class CodeBuildHandler extends AbstractHandler { |
|
|
|
} |
|
|
|
codeJavaPath += packageName.replaceAll("\\.", "/"); |
|
|
|
new File(codeJavaPath).mkdirs(); |
|
|
|
|
|
|
|
SwMap model = new SwMap(); |
|
|
|
model.put("user", userName); |
|
|
|
model.put("sysTime", DateUtil.nowDateTime()); |
|
|
|
model.put("title", form.getTitle()); |
|
|
|
CodeGenerator.getInstance().generateJsEvent(model, codeJavaPath + "/" + form.getName() + ".js"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|