Browse Source

流程引擎-新增

4.0
郑根木 2 years ago
parent
commit
27e80a8f71
8 changed files with 43 additions and 9 deletions
  1. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProc.java
  2. +2
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormDelHandler.java
  3. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java
  4. +5
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java
  5. +3
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java
  6. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/LoginHelper.java
  7. +2
    -2
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/session/UserSession.java
  8. +28
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/JsonUtil.java

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

@@ -25,7 +25,7 @@ public class ModelProc extends DefaultEntity {
if (procInfo == null) {
synchronized ("ModelProc_" + getId()) {
if (procInfo == null) {
procInfo = JsonUtil.parse(getContent(), ProcInfo.class);
procInfo = JsonUtil.parse(getContent(), "model", ProcInfo.class);
}
}
}


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

@@ -28,7 +28,8 @@ public class ModelFormDelHandler extends DefaultDelHandler<ModelForm> {
@Override
protected void delDb() {
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(ModelForm.class);
Set<ModelForm> list = new HashSet<>(ModelFormCache.getInstance().getListByModule(id));
Set<ModelForm> l1 = ModelFormCache.getInstance().getListByModule(id);
Set<ModelForm> list = l1 != null ? new HashSet<>(l1) : null;
if (CommUtil.isEmpty(list)) {
listDeled = null;
dao.deleteEntity(id);


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java View File

@@ -25,7 +25,7 @@ import java.util.ArrayList;
/**
* Created by Akmm at 2022-08-26 17:15
*/
public class FlowSingleLoadHandler<T extends DefaultEntity> extends LCSingleLoadHandler implements FlowListener {
public class FlowSingleLoadHandler extends LCSingleLoadHandler implements FlowListener {
protected FlowInstance flowInstance;

@Override


+ 5
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java View File

@@ -1,5 +1,6 @@
package cc.smtweb.system.bpm.web.engine.model.flow.listcard.single;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler;

@@ -8,5 +9,8 @@ import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler
* 带流程的简单卡片之保存
*/
public class FlowSingleSaveHandler<T extends DefaultEntity> extends LCSingleSaveHandler<T> {
@Override
public R save() {
return super.save();
}
}

+ 3
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java View File

@@ -1,6 +1,7 @@
package cc.smtweb.system.bpm.web.engine.model.flow.listcard.single;

import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleDelHandler;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleLoadHandler;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler;
@@ -14,12 +15,12 @@ import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleService;
public class FlowSingleService extends LCSingleService {
@Override
protected LCSingleSaveHandler getSaveHandler() {
return super.getSaveHandler();
return new FlowSingleSaveHandler();
}

@Override
protected LCSingleLoadHandler getLoadHandler() {
return super.getLoadHandler();
return new FlowSingleLoadHandler();
}

@Override


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/LoginHelper.java View File

@@ -32,7 +32,7 @@ public class LoginHelper {
}

if ("admin".equals(loginPO.getUsername())) {
return new UserSession(1);
return UserSession.createSys();
}

if (StringUtils.isBlank(loginPO.getPassword())) {


+ 2
- 2
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/session/UserSession.java View File

@@ -71,8 +71,8 @@ public class UserSession implements Serializable {

public static UserSession createSys() {
UserSession us = new UserSession();
us.userId = 1;
us.partyId = 1;
us.userId = 1L;
us.partyId = 1L;
us.terminalType = 0;
return us;
}


+ 28
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/JsonUtil.java View File

@@ -4,7 +4,9 @@ import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.exception.JsonParseException;
import cc.smtweb.framework.core.util.jackson.*;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JavaType;
@@ -101,6 +103,7 @@ public class JsonUtil {

public static <T> T parse(String str, Class<T> clazz) {
try {

if (StringUtils.isBlank(str)) {
return null;
} else {
@@ -112,6 +115,31 @@ public class JsonUtil {
}

/**
* 解析指定json节点
* @param str 完整json串
* @param nodePath 待解析节点路径,如a.b.c
* @param clazz
* @return
* @param <T>
*/
public static <T> T parse(String str, String nodePath, Class<T> clazz) {
try {
if (StringUtils.isBlank(str)) {
return null;
}
JsonNode node = OBJECT_MAPPER.readTree(str);
String[] nodes = nodePath.split("\\.");
for (String s: nodes) {
node = node.get(s);
if (node == null) return null;
}
return OBJECT_MAPPER.treeToValue(node, clazz);
} catch (Exception e) {
throw new JsonParseException("can't convert this json to " + clazz + " type", e);
}
}

/**
* 将Map对象转换为Bean对象
*
* @param map Map对象


Loading…
Cancel
Save