@@ -25,7 +25,7 @@ public class ModelProc extends DefaultEntity { | |||||
if (procInfo == null) { | if (procInfo == null) { | ||||
synchronized ("ModelProc_" + getId()) { | synchronized ("ModelProc_" + getId()) { | ||||
if (procInfo == null) { | if (procInfo == null) { | ||||
procInfo = JsonUtil.parse(getContent(), ProcInfo.class); | |||||
procInfo = JsonUtil.parse(getContent(), "model", ProcInfo.class); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -28,7 +28,8 @@ public class ModelFormDelHandler extends DefaultDelHandler<ModelForm> { | |||||
@Override | @Override | ||||
protected void delDb() { | protected void delDb() { | ||||
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(ModelForm.class); | 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)) { | if (CommUtil.isEmpty(list)) { | ||||
listDeled = null; | listDeled = null; | ||||
dao.deleteEntity(id); | dao.deleteEntity(id); | ||||
@@ -25,7 +25,7 @@ import java.util.ArrayList; | |||||
/** | /** | ||||
* Created by Akmm at 2022-08-26 17:15 | * 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; | protected FlowInstance flowInstance; | ||||
@Override | @Override | ||||
@@ -1,5 +1,6 @@ | |||||
package cc.smtweb.system.bpm.web.engine.model.flow.listcard.single; | 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.framework.core.db.impl.DefaultEntity; | ||||
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler; | 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> { | public class FlowSingleSaveHandler<T extends DefaultEntity> extends LCSingleSaveHandler<T> { | ||||
@Override | |||||
public R save() { | |||||
return super.save(); | |||||
} | |||||
} | } |
@@ -1,6 +1,7 @@ | |||||
package cc.smtweb.system.bpm.web.engine.model.flow.listcard.single; | package cc.smtweb.system.bpm.web.engine.model.flow.listcard.single; | ||||
import cc.smtweb.framework.core.annotation.SwService; | 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.LCSingleDelHandler; | ||||
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleLoadHandler; | import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleLoadHandler; | ||||
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler; | 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 { | public class FlowSingleService extends LCSingleService { | ||||
@Override | @Override | ||||
protected LCSingleSaveHandler getSaveHandler() { | protected LCSingleSaveHandler getSaveHandler() { | ||||
return super.getSaveHandler(); | |||||
return new FlowSingleSaveHandler(); | |||||
} | } | ||||
@Override | @Override | ||||
protected LCSingleLoadHandler getLoadHandler() { | protected LCSingleLoadHandler getLoadHandler() { | ||||
return super.getLoadHandler(); | |||||
return new FlowSingleLoadHandler(); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -32,7 +32,7 @@ public class LoginHelper { | |||||
} | } | ||||
if ("admin".equals(loginPO.getUsername())) { | if ("admin".equals(loginPO.getUsername())) { | ||||
return new UserSession(1); | |||||
return UserSession.createSys(); | |||||
} | } | ||||
if (StringUtils.isBlank(loginPO.getPassword())) { | if (StringUtils.isBlank(loginPO.getPassword())) { | ||||
@@ -71,8 +71,8 @@ public class UserSession implements Serializable { | |||||
public static UserSession createSys() { | public static UserSession createSys() { | ||||
UserSession us = new UserSession(); | UserSession us = new UserSession(); | ||||
us.userId = 1; | |||||
us.partyId = 1; | |||||
us.userId = 1L; | |||||
us.partyId = 1L; | |||||
us.terminalType = 0; | us.terminalType = 0; | ||||
return us; | return us; | ||||
} | } | ||||
@@ -4,7 +4,9 @@ import cc.smtweb.framework.core.common.SwMap; | |||||
import cc.smtweb.framework.core.exception.JsonParseException; | import cc.smtweb.framework.core.exception.JsonParseException; | ||||
import cc.smtweb.framework.core.util.jackson.*; | import cc.smtweb.framework.core.util.jackson.*; | ||||
import com.fasterxml.jackson.annotation.JsonInclude; | import com.fasterxml.jackson.annotation.JsonInclude; | ||||
import com.fasterxml.jackson.core.JsonFactory; | |||||
import com.fasterxml.jackson.core.JsonGenerator; | import com.fasterxml.jackson.core.JsonGenerator; | ||||
import com.fasterxml.jackson.core.JsonParser; | |||||
import com.fasterxml.jackson.core.JsonProcessingException; | import com.fasterxml.jackson.core.JsonProcessingException; | ||||
import com.fasterxml.jackson.databind.DeserializationFeature; | import com.fasterxml.jackson.databind.DeserializationFeature; | ||||
import com.fasterxml.jackson.databind.JavaType; | import com.fasterxml.jackson.databind.JavaType; | ||||
@@ -101,6 +103,7 @@ public class JsonUtil { | |||||
public static <T> T parse(String str, Class<T> clazz) { | public static <T> T parse(String str, Class<T> clazz) { | ||||
try { | try { | ||||
if (StringUtils.isBlank(str)) { | if (StringUtils.isBlank(str)) { | ||||
return null; | return null; | ||||
} else { | } 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对象 | * 将Map对象转换为Bean对象 | ||||
* | * | ||||
* @param map Map对象 | * @param map Map对象 | ||||