diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelTableService.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelTableService.java index 4936a5f..e2849fa 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelTableService.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelTableService.java @@ -8,6 +8,7 @@ import cc.smtweb.framework.core.db.cache.ModelTableCache; import cc.smtweb.framework.core.db.vo.ModelTable; import cc.smtweb.framework.core.mvc.service.*; import cc.smtweb.framework.core.session.UserSession; +import cc.smtweb.system.bpm.web.design.form.CodeBuildHandler; /** * Created by Akmm at 2022/3/22 9:12 @@ -44,4 +45,17 @@ public class ModelTableService extends AbstractCompService { return R.error("操作失败!", e); } } + + //生成bean + public R buildBean(@SwBody SwMap params, UserSession us) { + CodeBuildHandler handler = new CodeBuildHandler(); + if (params == null) params = new SwMap(); + if (us == null) us = UserSession.createSys(); + handler.init(params, us); + try { + return handler.buildBeanByTable(); + } catch (Exception e) { + return R.error("操作失败!", e); + } + } } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java index 5453203..92c3202 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java @@ -65,6 +65,7 @@ public interface FlowConst { public static IntEnumBean WAIT = instance.addEnum(0, "待办"); public static IntEnumBean HANDLE = instance.addEnum(1, "办理中"); public static IntEnumBean SUBMIT = instance.addEnum(2, "已提交"); + public static IntEnumBean INTERRUPT = instance.addEnum(7, "已终止"); public static IntEnumBean DISUSE = instance.addEnum(8, "已作废"); public static IntEnumBean REJECT = instance.addEnum(9, "已驳回"); } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java index 0468f44..6775efa 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java @@ -60,6 +60,44 @@ public class CodeBuildHandler extends AbstractHandler { return R.success(); } + public R buildBeanByTable() { + userName = String.valueOf(us.getUserId()); + + //页面id + long tableId = params.readLong("tableId"); + ModelTable table = ModelTableCache.getInstance().get(tableId); + if (table == null) throw new BizException("未找到指定的表定义(" + table + ")!"); + + String moduleName = ModelProjectCache.getInstance().getModule(table.getPrjId()); + if (StringUtils.isEmpty(moduleName)) throw new BizException("此项目未定义Module!"); + if (moduleName.equals("bpm")) { + packageName = "cc.smtweb.system.bpm.web"; + } else { + packageName = "cc.smtweb.biz." + moduleName + ".web"; + } + BpmConfigBean bpmConfigBean = SpringUtil.getBean(BpmConfigBean.class); + Map mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath(), bpmConfigBean.getMode()); + if (mapIdeaModules == null || mapIdeaModules.isEmpty()) + throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!"); + codePath = mapIdeaModules.get(moduleName); + if (StringUtils.isEmpty(codePath)) { + throw new BizException("没有找到对应项目在idea中Module的路径(" + moduleName + ")!"); + } + codePath += "/src/main/java/"; + //加上目录 + String cn = ModelCatalogCache.getInstance().getFullName(table.getMcId()); + if (StringUtils.isNotEmpty(cn)) { + packageName += "." + cn; + } + + codePath += packageName.replaceAll("\\.", "/"); + new File(codePath).mkdirs(); + + buildJavaTable(tableId, true, table.isNeedCache()); + + return R.success(); + } + public R buildJsCode() { userName = String.valueOf(us.getUserId()); //页面id @@ -100,7 +138,8 @@ public class CodeBuildHandler extends AbstractHandler { } BpmConfigBean bpmConfigBean = SpringUtil.getBean(BpmConfigBean.class); Map mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath(), bpmConfigBean.getMode()); - if (mapIdeaModules == null || mapIdeaModules.isEmpty()) throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!"); + if (mapIdeaModules == null || mapIdeaModules.isEmpty()) + throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!"); codePath = mapIdeaModules.get(moduleName); if (StringUtils.isEmpty(codePath)) { throw new BizException("没有找到对应项目在idea中Module的路径(" + moduleName + ")!"); @@ -177,11 +216,11 @@ public class CodeBuildHandler extends AbstractHandler { if (StringUtils.isEmpty(sName)) { //模块名称 form = ModelFormCache.getInstance().get(form.getParent()); - if(form == null){ + if (form == null) { throw new BizException("页面设置未定义服务名!" + form.getTitle()); } sName = form.getService(); - if(StringUtils.isEmpty(sName)){ + if (StringUtils.isEmpty(sName)) { throw new BizException("模块设置未定义服务名!" + form.getTitle()); } } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelForm.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelForm.java index 8f060d0..509750a 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelForm.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelForm.java @@ -230,6 +230,6 @@ public class ModelForm extends DefaultEntity { //返回单据类型id public long getBillType() { - return getOpts().readLong("billType"); + return getOpts().readLong(ModelFormHelper.KEY_BILL_TYPE); } } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java index f6493e8..4e0f3c6 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java @@ -27,6 +27,7 @@ import java.util.*; */ public class ModelFormHelper { public static final String KEY_EVENT_PATH = "eventPath"; + public static final String KEY_BILL_TYPE = "billType"; //分组类别-list public static final String PAGE_TYPE_LIST = "list"; //分组类别-card diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormLoadHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormLoadHandler.java index 6ee7725..14f03a6 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormLoadHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormLoadHandler.java @@ -1,6 +1,7 @@ package cc.smtweb.system.bpm.web.design.form; import cc.smtweb.framework.core.common.R; +import cc.smtweb.framework.core.common.SwConsts; import cc.smtweb.framework.core.exception.BizException; import cc.smtweb.framework.core.exception.SwException; import cc.smtweb.framework.core.common.SwMap; @@ -32,6 +33,12 @@ public class ModelFormLoadHandler extends DefaultLoadHandler { if (StringUtils.isEmpty(id)) id = params.readString("pageName"); ModelForm bean = ModelFormHelper.getFromCache(id); if (bean == null) throw new BizException("没有找到指定的页面定义信息!id=" + id); + long billType = bean.getBillType(); + if (billType > 0L) { + SwMap opts = bean.getOpts(); +// opts.put(ModelFormHelper.KEY_BILL_TYPE + SwConsts.TEXT_SUFFIX, BillTypeCache.); + } + return bean; } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/BaseModelWorker.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/BaseModelWorker.java index 30761e3..0803ae5 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/BaseModelWorker.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/BaseModelWorker.java @@ -1,5 +1,6 @@ package cc.smtweb.system.bpm.web.design.form.model; +import cc.smtweb.framework.core.common.SwConsts; import cc.smtweb.framework.core.common.SwEnum; import cc.smtweb.framework.core.common.SwMap; import cc.smtweb.framework.core.db.DbEngine; @@ -29,6 +30,7 @@ public class BaseModelWorker { SwMap opts = bean.getOpts(); if (opts != null) { opts.remove(ModelFormHelper.KEY_EVENT_PATH); + opts.remove(ModelFormHelper.KEY_BILL_TYPE + SwConsts.TEXT_SUFFIX); bean.setOption(JsonUtil.encodeString(opts)); } if (bean.getType() == SwEnum.FormType.MODULE.value) { diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java index 597e11e..e5185f7 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java @@ -1,11 +1,12 @@ package cc.smtweb.system.bpm.web.engine.flow.entity; import cc.smtweb.framework.core.annotation.SwTable; +import cc.smtweb.framework.core.common.SwMap; import cc.smtweb.framework.core.db.impl.DefaultEntity; /** - * Created by Akmm at 2022/5/23 14:25 - * 审批意见 + * Created by 1 at 2022-08-25 17:35:03 + * 实体【[流程审批意见](WF_COMMENT)】的Entity类 */ @SwTable("WF_COMMENT") public class Comment extends DefaultEntity { @@ -15,51 +16,94 @@ public class Comment extends DefaultEntity { super(ENTITY_NAME); } + /** 主键 */ public long getId() { return getLong("cmt_id"); } - public void setId(long cmtId) { - put("cmt_id", cmtId); + /** 主键 */ + public void setId(long cmt_id) { + put("cmt_id", cmt_id); } - + /** 流程id */ public long getPriId() { return getLong("cmt_pri_id"); } - public void setPriId(long cmtPriId) { - put("cmt_pri_id", cmtPriId); + /** 流程id */ + public void setPriId(long cmt_pri_id) { + put("cmt_pri_id", cmt_pri_id); } - + /** 任务id */ public long getTskId() { return getLong("cmt_tsk_id"); } - public void setTskId(long cmtTskId) { - put("cmt_tsk_id", cmtTskId); + /** 任务id */ + public void setTskId(long cmt_tsk_id) { + put("cmt_tsk_id", cmt_tsk_id); + } + /** 步骤id */ + public long getActId() { + return getLong("cmt_act_id"); } - public long getUserId() { - return getLong("cmt_user_id"); + /** 步骤id */ + public void setActId(long cmt_act_id) { + put("cmt_act_id", cmt_act_id); + } + /** 主办人 */ + public long getHandler() { + return getLong("cmt_handler"); } - public void setUserId(long cmtUserId) { - put("cmt_user_id", cmtUserId); + /** 主办人 */ + public void setHandler(long cmt_handler) { + put("cmt_handler", cmt_handler); + } + /** 开始时间 */ + public long getStartTime() { + return getLong("cmt_start_time"); } - public String getContent() { - return getStr("cmt_content"); + /** 开始时间 */ + public void setStartTime(long cmt_start_time) { + put("cmt_start_time", cmt_start_time); + } + /** 签收时间 */ + public long getHandlerTime() { + return getLong("cmt_handler_time"); } - public void setContent(String cmtContent) { - put("cmt_content", cmtContent); + /** 签收时间 */ + public void setHandlerTime(long cmt_handler_time) { + put("cmt_handler_time", cmt_handler_time); + } + /** 结束时间 */ + public long getEndTime() { + return getLong("cmt_end_time"); } - public long getTime() { - return getLong("cmt_time"); + /** 结束时间 */ + public void setEndTime(long cmt_end_time) { + put("cmt_end_time", cmt_end_time); + } + /** 审批意见 */ + public String getComment() { + return getStr("cmt_comment"); + } + + /** 审批意见 */ + public void setComment(String cmt_comment) { + put("cmt_comment", cmt_comment); + } + /** 状态 */ + public int getStatu() { + return getInt("cmt_statu"); } - public void setTime(long cmtTime) { - put("cmt_time", cmtTime); + /** 状态 */ + public void setStatu(int cmt_statu) { + put("cmt_statu", cmt_statu); } } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.java index 4b602c8..bf103eb 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.java @@ -71,6 +71,14 @@ public class Task extends DefaultEntity { put("tsk_start_time", tskStartTime); } + public long getHandler_time() { + return getLong("tsk_handler_time"); + } + + public void setHandler_time(long tsk_handler_time) { + put("tsk_handler_time", tsk_handler_time); + } + public long getEndTime() { return getLong("tsk_end_time"); } @@ -87,12 +95,12 @@ public class Task extends DefaultEntity { put("tsk_statu", tskStatu); } - public String getSubmitIdea() { - return getStr("tsk_submit_idea"); + public String getComment() { + return getStr("comment"); } - public void setSubmitIdea(String tskSubmitIdea) { - put("tsk_submit_idea", tskSubmitIdea); + public void setComment(String comment) { + put("comment", comment); } public boolean isMake() { diff --git a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java index 3301b11..a2efd9a 100644 --- a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java +++ b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java @@ -28,6 +28,8 @@ public interface SwConsts { String PARAM_ROWS = "rows"; String TOTAL_KEY = "total_count"; String DEF_DB_NAME = "sys"; + //id自动对应的文本的后缀 + String TEXT_SUFFIX = "_text"; String DEF_PWD = "abc@123456"; //初始密码 String LOGIN_VERIFY_CODE = "_VERIFY_CODE"; diff --git a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityHelper.java b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityHelper.java index 90a6e9f..742a3cc 100644 --- a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityHelper.java +++ b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityHelper.java @@ -2,6 +2,7 @@ package cc.smtweb.framework.core.db; import cc.smtweb.framework.core.cache.AbstractCache; import cc.smtweb.framework.core.cache.CacheManager; +import cc.smtweb.framework.core.common.SwConsts; import cc.smtweb.framework.core.common.SwEnum; import cc.smtweb.framework.core.common.SwMap; import cc.smtweb.framework.core.db.cache.ModelTableCache; @@ -129,7 +130,7 @@ public class EntityHelper { String sn = (String) dao.readValue(b, l.getLinkNameField()); if (StringUtils.isNotEmpty(sn)) names += "," + sn; } - bean.put(fieldName + "_text", names.length() > 1 ? names.substring(1) : ""); + bean.put(fieldName + SwConsts.TEXT_SUFFIX, names.length() > 1 ? names.substring(1) : ""); } else { List list = mapIds.computeIfAbsent(l.getLinkTable().getName(), k -> new ArrayList<>()); Collections.addAll(list, ids); @@ -160,7 +161,7 @@ public class EntityHelper { String sn = mapV.get(sId); if (StringUtils.isNotEmpty(sn)) names += "," + sn; } - bean.put(fieldName + "_text", names.substring(1)); + bean.put(fieldName + SwConsts.TEXT_SUFFIX, names.substring(1)); } } @@ -189,7 +190,7 @@ public class EntityHelper { final String fieldName = getFieldAlias(mapFieldAlias, field.getName()); String value = bean.readString(fieldName); if (StringUtils.isNotEmpty(value)) { - bean.put(fieldName + "_text", formatter.format(value)); + bean.put(fieldName + SwConsts.TEXT_SUFFIX, formatter.format(value)); } } } @@ -223,9 +224,9 @@ public class EntityHelper { if (StringUtils.isNotEmpty(sn)) names += "," + sn; } if (StringUtils.isNotEmpty(names)) { - row.put(fieldName + "_text", names.substring(1)); + row.put(fieldName + SwConsts.TEXT_SUFFIX, names.substring(1)); } else { - row.put(fieldName + "_text", ""); + row.put(fieldName + SwConsts.TEXT_SUFFIX, ""); } } else { List list = mapIds.computeIfAbsent(l.getLinkTable().getName(), k -> new ArrayList<>()); @@ -259,7 +260,7 @@ public class EntityHelper { String sn = mapV.get(sId); if (StringUtils.isNotEmpty(sn)) names += "," + sn; } - row.put(fieldName + "_text", names.substring(1)); + row.put(fieldName + SwConsts.TEXT_SUFFIX, names.substring(1)); } } } diff --git a/smtweb-framework/core/src/main/resources/流程定义.json b/smtweb-framework/core/src/main/resources/流程定义.json index 75c1f0e..5e92dda 100644 --- a/smtweb-framework/core/src/main/resources/流程定义.json +++ b/smtweb-framework/core/src/main/resources/流程定义.json @@ -539,6 +539,7 @@ "label": "活动名称", "page": "表单定义", "canEdit": "是否可编辑", + "canEnd": "不同意时,允许直接结束 true/false", "needSign": "是否需要会签", "buttons": [ {