Commit 438c138d by 谢海旭

【ID1012425】一个活动只能关联一个未禁用的实例

1 parent 01c6f081
......@@ -145,7 +145,11 @@ public class SopInstService {
if (CollectionUtils.isEmpty(sopInsts)) {
return null;
}
Assert.state(sopInsts.size() < 2, "根据查询条件找到多条记录,请检查参数是否有误!");
if (sopInsts.size() > 1) {
throw new AdminException(ResultEnum.PARAM_ERROR.getCode(), "根据查询条件找到多条记录,请检查参数是否有误!");
}
return getSopInstOtherInfo(sopInsts.get(0));
}
......@@ -195,6 +199,16 @@ public class SopInstService {
return result;
}
Object activityId = customData.get("activityId");
if (!Objects.isNull(activityId)) {
HashMap<String, Object> tMap = new HashMap<>();
tMap.put("activityId", activityId);
SopInstDTO existInst = getOneByCustomData(tMap);
if (Objects.nonNull(existInst)) {
throw new AdminException(ResultEnum.PARAM_ERROR.getCode(), String.format("该活动已关联‘%s’实例,不能再关联", existInst.getInstName()));
}
}
sopInstMapper.updateInstParamCustomData(instId, customData);
//发送字段数据变更通知消息
......@@ -260,7 +274,9 @@ public class SopInstService {
public void add(SopInstDTO sopInstDTO) {
String tplId = sopInstDTO.getTplId();
SopTplDTO sopTplDTO = sopTplMapper.getById(tplId);
Assert.state(sopTplDTO != null, "模板不存在!");
if (Objects.isNull(sopTplDTO)) {
throw new AdminException(ResultEnum.PARAM_ERROR.getCode(), "模板不存在!");
}
SopTplNode nodeQuery = new SopTplNode();
nodeQuery.setTplId(tplId);
......
......@@ -56,7 +56,7 @@
ORDER BY si.inst_status DESC, si.create_time DESC
</select>
<select id="selectByCustomData" resultType="cn.com.glsx.process.modules.entity.SopInst">
<select id="selectByCustomData" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM sop_inst
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!