Browse Source

页面+BillType,表定义加buildBean

4.0
郑根木 2 years ago
parent
commit
5008555ef6
12 changed files with 156 additions and 36 deletions
  1. +14
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelTableService.java
  2. +1
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java
  3. +42
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java
  4. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelForm.java
  5. +1
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java
  6. +7
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormLoadHandler.java
  7. +2
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/BaseModelWorker.java
  8. +66
    -22
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java
  9. +12
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.java
  10. +2
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java
  11. +7
    -6
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityHelper.java
  12. +1
    -0
      smtweb-framework/core/src/main/resources/流程定义.json

+ 14
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelTableService.java View File

@@ -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);
}
}
}

+ 1
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java View File

@@ -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, "已驳回");
}


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

@@ -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<String, String> 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<String, String> 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());
}
}


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelForm.java View File

@@ -230,6 +230,6 @@ public class ModelForm extends DefaultEntity {

//返回单据类型id
public long getBillType() {
return getOpts().readLong("billType");
return getOpts().readLong(ModelFormHelper.KEY_BILL_TYPE);
}
}

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

@@ -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


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

@@ -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<ModelForm> {
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;
}



+ 2
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/BaseModelWorker.java View File

@@ -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) {


+ 66
- 22
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java View File

@@ -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);
}
}

+ 12
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.java View File

@@ -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() {


+ 2
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java View File

@@ -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";


+ 7
- 6
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityHelper.java View File

@@ -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<String> 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<Long> 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));
}
}
}


+ 1
- 0
smtweb-framework/core/src/main/resources/流程定义.json View File

@@ -539,6 +539,7 @@
"label": "活动名称",
"page": "表单定义",
"canEdit": "是否可编辑",
"canEnd": "不同意时,允许直接结束 true/false",
"needSign": "是否需要会签",
"buttons": [
{


Loading…
Cancel
Save