Ver a proveniência

Merge remote-tracking branch 'origin/4.0' into 4.0

4.0
lip há 2 anos
ascendente
cometimento
ba2673c9a6
7 ficheiros alterados com 126 adições e 81 eliminações
  1. +11
    -24
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcService.java
  2. +14
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java
  3. +36
    -55
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java
  4. +2
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/AuthService.java
  5. +2
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/LoginAckVO.java
  6. +1
    -1
      smtweb-framework/bpm/src/main/resources/static/template/default/model_card_flow.ftl
  7. +60
    -1
      smtweb-framework/bpm/src/main/resources/static/template/default/model_card_ms.ftl

+ 11
- 24
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcService.java Ver ficheiro

@@ -52,37 +52,24 @@ public class ModelProcService extends AbstractCompService {
}

//加载工作流的列表字段
public R loadProcInstFields(@SwBody SwMap params, UserSession us) {
ModelTable table = ModelTableCache.getInstance().getByName(ProcInst.ENTITY_NAME);
if (table == null) return R.error("没有找到表定义信息(table=" + ProcInst.ENTITY_NAME + ")!");

public R loadFlowListFields (@SwBody SwMap params, UserSession us) {
List<SwMap> ret = new ArrayList<>();
for (ModelField field : table.getFields()) {
SwMap col = new SwMap(2);
ModelFormHelper.buildFieldInfo(table, field, col);
ret.add(col);
}
SwMap col = new SwMap();
col.put("name", "selTaskId");
col.put("dataType", SwEnum.DataType.ID.value);
col.put("title", "选中的任务id");
col.put("table", table.getId());
col.put("table_text", table.getTitle());
ret.add(col);
ModelFormHelper.buildTableFields(ret, ProcInst.ENTITY_NAME);
return R.success(ret);
}
public R loadFlowCardFields(@SwBody SwMap params, UserSession us) {
List<SwMap> ret = new ArrayList<>();
ModelFormHelper.buildTableFields(ret, ProcInst.ENTITY_NAME);
ret.add(buildField("selTaskId", SwEnum.DataType.ID.value, "选中任务"));

return R.success(ret);
}

//加载审批意见的列表字段
public R loadCommentFields(@SwBody SwMap params, UserSession us) {
ModelTable table = ModelTableCache.getInstance().getByName(Comment.ENTITY_NAME);
if (table == null) return R.error("没有找到表定义信息(table=" + Comment.ENTITY_NAME + ")!");

List<SwMap> ret = new ArrayList<>();
for (ModelField field : table.getFields()) {
SwMap col = new SwMap(2);
ModelFormHelper.buildFieldInfo(table, field, col);
ret.add(col);
}
ModelFormHelper.buildTableFields(ret, Comment.ENTITY_NAME);
ret.add(buildField("cmt_act_code", SwEnum.DataType.CODE.value, "活动编号"));
ret.add(buildField("cmt_act_text", SwEnum.DataType.NAME.value, "活动名称"));
return R.success(ret);


+ 14
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java Ver ficheiro

@@ -1,11 +1,13 @@
package cc.smtweb.system.bpm.web.design.form;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.exception.SwException;
import cc.smtweb.framework.core.mvc.variable.SwVariableFactory;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.JsonUtil;
@@ -18,6 +20,7 @@ import cc.smtweb.system.bpm.util.IdeaUtil;
import cc.smtweb.system.bpm.web.design.db.ModelCatalogCache;
import cc.smtweb.system.bpm.web.design.db.ModelProjectCache;
import cc.smtweb.system.bpm.web.design.form.define.*;
import cc.smtweb.system.bpm.web.engine.flow.entity.Comment;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.commons.lang3.StringUtils;

@@ -513,6 +516,17 @@ public class ModelFormHelper {
}
}

public static void buildTableFields(List<SwMap> ret, String tableName) {
ModelTable table = ModelTableCache.getInstance().getByName(tableName);
if (table == null) throw new SwException("没有找到表定义信息(table=" + tableName + ")!");

for (ModelField field : table.getFields()) {
SwMap col = new SwMap(2);
ModelFormHelper.buildFieldInfo(table, field, col);
ret.add(col);
}
}

/**
* 页面设计时,返回的字段信息,带控件
*


+ 36
- 55
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java Ver ficheiro

@@ -52,6 +52,9 @@ public class FlowInstance {

private FlowListener listener;

//提交驳回等之后的,属于我的新任务
private Task nextMyTask;

public static FlowInstance createById(UserSession us, FlowListener listener, long billId, long taskId) {
FlowInstance flowInstance = new FlowInstance(listener, us);
flowInstance.load(billId, taskId);
@@ -261,9 +264,13 @@ public class FlowInstance {
for (Task act : list) {
//如果办理人是当前用户,则置此任务为当前任务
//我办理中的任务:非待办,且是我的任务
if (act.getStatu() == FlowConst.ActivityStatu.WAIT.value && FlowHelper.isMyWaitedTask(act.getId(), us.getUserId())) {
//我的待办任务,设下值,为后面的按钮判断减轻负担
act.setHandler(us.getUserId());
if (act.getId() == actInst.getId()) {
act = actInst;

if (act.getStatu() == FlowConst.ActivityStatu.WAIT.value && FlowHelper.isMyWaitedTask(act.getId(), us.getUserId())) {
//我的待办任务,设下值,为后面的按钮判断减轻负担
act.setHandler(us.getUserId());
}
}
//如果当前任务为待办理,那么要找其前置任务,作为活动任务,方便取回
if (act.getStatu() == FlowConst.ActivityStatu.WAIT.value && !act.isReject() && !act.isRetake()) {
@@ -528,13 +535,8 @@ public class FlowInstance {
actInst.setStatu(FlowConst.ActivityStatu.SUBMIT.value);
actInst.setRetake(false);

if (listInsertTask.size() > 0) {
procInst.setTaskId(listInsertTask.get(0).getEntityId());
procInst.setActName(listInsertTask.get(0).getActName());
} else {
procInst.setTaskId(actInst.getEntityId());
procInst.setActName(actInst.getActName());
}
procInst.setTaskId(listInsertTask.get(0).getEntityId());
procInst.setActName(listInsertTask.get(0).getActName());

if (new_acts.size() == 1 && new_acts.get(0).getType() == FlowConst.ActivityType.END.value) {
procInst.setStatu(FlowConst.InstanceStatu.FINISH.value);
@@ -544,7 +546,6 @@ public class FlowInstance {
}

//保存入库
if (!listInsertTask.isEmpty()) {
getTaskDao().batchInsertEntity(listInsertTask);
getCandidateDao().batchInsertEntity(listInsertCand);
getTaskRelDao().batchInsertEntity(listTaskRel);
@@ -552,13 +553,16 @@ public class FlowInstance {
if (!listTaskComment.isEmpty()) {
getCommentDao().batchInsertEntity(listTaskComment);
}
}
getTaskDao().updateEntity(actInst);
getProcInstDao().updateEntity(procInst);

updateComment(comment, FlowConst.Button.SUBMIT.value);
buildBillLog(FlowConst.Button.SUBMIT.value, comment, actInst, listInsertTask);
listener.afterSubmit(actInst, listInsertTask);

//设置当前步骤
actInst = nextMyTask != null ? nextMyTask : listInsertTask.get(0);
}

/**
@@ -646,6 +650,9 @@ public class FlowInstance {
}
for (Long user_id : listHander) {
// if (act.getHandler().getIgnore() && user_id == submit_user) continue;
if (nextMyTask == null && user_id == us.getUserId()) {
nextMyTask = task;
}
Candidate cand = new Candidate();
cand.init();
cand.setEntityId(DbEngine.getInstance().nextId());
@@ -679,34 +686,7 @@ public class FlowInstance {
}
Activity activityEntity = procDef.getProcInfo().findActivity(actInst.getActId());
EntityDao<Task> taskDao = getTaskDao();
if (activityEntity.getType() == FlowConst.ActivityType.END.value) {//从结束取回
List<Task> new_acts = provider.findBeforeTasks(actInst.getId());
Task old_act = (Task) actInst.clone();
old_act.setEntityId(actInst.getEntityId());

actInst = new_acts.get(0);
actInst.setHandler(user_id);
actInst.setStartTime(DateUtil.nowDateTimeLong());
actInst.setStatu(FlowConst.ActivityStatu.HANDLE.value);
if (actInst.isMake()) {
actInst.setHandler(user_id);
}

procInst.setTaskId(actInst.getEntityId());
procInst.setActName(actInst.getActName());
procInst.setStatu(actInst.isMake() ? FlowConst.InstanceStatu.BEGIN.value: FlowConst.InstanceStatu.RUNING.value);

taskDao.updateEntity(actInst);
taskDao.deleteEntity(old_act);
getTaskRelDao().deleteEntity("where trl_src_task_id=?", old_act.getId());
getProcInstDao().updateEntity(procInst);
getCommentDao().deleteEntity("where cmt_tsk_id=?", old_act.getId());
new_acts.clear();
new_acts.add(old_act);
buildBillLog(FlowConst.Button.RETAKE.value, "TODO", actInst, new_acts);
listener.afterRetake(actInst, new_acts);
// comp.transCallback(FlowConst.Button.RETAKE.value, actInst, new_acts);
} else {
List<Task> new_acts = provider.findAfterTasks(actInst.getId());

for (Task act : new_acts) {
@@ -734,7 +714,6 @@ public class FlowInstance {
updateComment(null, FlowConst.Button.RETAKE.value);
buildBillLog(FlowConst.Button.RETAKE.value, "TODO", actInst, new_acts);
listener.afterRetake(actInst, new_acts);
}
}

/**
@@ -767,6 +746,7 @@ public class FlowInstance {
//待新增任务候选人
List<Candidate> listInsertCand = new ArrayList<>();

nextMyTask = null;
//校验完毕,接下来干活。
//并发考虑:找到此任务的前置任务,创建对应的新任务,原流程其他未办理任务删除,办理中及已提交的,置为
for (String dstTaskId : dstTasks) {
@@ -778,31 +758,30 @@ public class FlowInstance {
buildRejectTask(toTask, listInsertTask, listInsertCand, listTaskRel, listTaskComment);
}
actInst.setStatu(FlowConst.ActivityStatu.REJECT.value);
if (listInsertTask.size() > 0) {
procInst.setTaskId(listInsertTask.get(0).getEntityId());
procInst.setActName(listInsertTask.get(0).getActName());
} else {
procInst.setTaskId(actInst.getEntityId());
procInst.setActName(actInst.getActName());
}

procInst.setTaskId(listInsertTask.get(0).getEntityId());
procInst.setActName(listInsertTask.get(0).getActName());

//先停止其他待办或办理中的任务
FlowHelper.stopTask(procInst.getId(), actInst.getId());
//保存入库
if (!listInsertTask.isEmpty()) {
getTaskDao().batchInsertEntity(listInsertTask);
getCandidateDao().batchInsertEntity(listInsertCand);
getTaskRelDao().batchInsertEntity(listTaskRel);

if (!listTaskComment.isEmpty()) {
getCommentDao().batchInsertEntity(listTaskComment);
}
getTaskDao().batchInsertEntity(listInsertTask);
getCandidateDao().batchInsertEntity(listInsertCand);
getTaskRelDao().batchInsertEntity(listTaskRel);

if (!listTaskComment.isEmpty()) {
getCommentDao().batchInsertEntity(listTaskComment);
}

getTaskDao().updateEntity(actInst);
getProcInstDao().updateEntity(procInst);

updateComment(comment, FlowConst.Button.REJECT.value);
buildBillLog(FlowConst.Button.SUBMIT.value, comment, actInst, listInsertTask);
listener.afterSubmit(actInst, listInsertTask);

actInst = nextMyTask != null ? nextMyTask: listInsertTask.get(0);
}

private void buildRejectTask(Task oldTask, List<Task> listInsertTask, List<Candidate> listInsertCand, List<TaskRel> listTaskRel, List<Comment> listTaskComment) {
@@ -827,7 +806,9 @@ public class FlowInstance {
cand.setPriId(task.getPriId());
cand.setTskId(task.getId());
cand.setUserId(oldTask.getHandler());

if (nextMyTask == null && task.getHandler() == us.getUserId()) {
nextMyTask = task;
}
listInsertCand.add(cand);

//创建新的审批意见


+ 2
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/AuthService.java Ver ficheiro

@@ -87,6 +87,8 @@ public class AuthService {
loginAckVO.setDesc(user.getSign());
loginAckVO.setToken(sessionManager.login(userSession));
loginAckVO.setUserLevel(user.getLevel() + "");
loginAckVO.setUserNicky(user.getNicky());
loginAckVO.setUserTel(user.getTel());
data.put("user", loginAckVO);
data.put("token", loginAckVO.getToken());
data.put("isOk", true);


+ 2
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/LoginAckVO.java Ver ficheiro

@@ -12,4 +12,6 @@ public class LoginAckVO {
private String desc;
private String token;
private String userLevel; //102100内部用户/102101外部用户/102102公众用户
private String userNicky;
private String userTel;
}

+ 1
- 1
smtweb-framework/bpm/src/main/resources/static/template/default/model_card_flow.ftl Ver ficheiro

@@ -106,7 +106,7 @@
"size": "default",
"hideLabel": true,
"dataset": "flow",
"field": "pri_task_id"
"field": "selTaskId"
},
"events": {
"on-change": "onTaskChange"


+ 60
- 1
smtweb-framework/bpm/src/main/resources/static/template/default/model_card_ms.ftl Ver ficheiro

@@ -85,7 +85,66 @@
},
"events": {}
}
<#if field_has_next>,</#if>
<#if field_has_next>
<#if (param.masterCol lte 1 )>
<#if (field.desc != "")>
,{
"id": "id${newId()}",
"type": "fx-label",
"props": {
"label": "${field.desc}",
"labelWidth": 0,
"affixError": true,
"labelAlign": "left"
}
}
,{
"id": "id${newId()}",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
<#else>
,{
"id": "id${newId()}",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
,{
"id": "id${newId()}",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
</#if>
</#if>
<#if (param.masterCol = 2 && ((field_index+1) % 2 = 0 ) )>
,{
"id": "id${newId()}",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
</#if>
,
</#if>
</#list>
]
},


Carregando…
Cancelar
Guardar