提交 3a19011c 编写于 作者: doc_wei's avatar doc_wei

动态表单整合工作流完成

上级 15c6c585
...@@ -77,22 +77,6 @@ public class ActivitiModelController { ...@@ -77,22 +77,6 @@ public class ActivitiModelController {
activitiModelService.editActivitiModelToDeploy(inputObject, outputObject); activitiModelService.editActivitiModelToDeploy(inputObject, outputObject);
} }
/**
*
* @Title: editActivitiModelToStartProcess
* @Description: 启动流程
* @param inputObject
* @param outputObject
* @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ActivitiModelController/editActivitiModelToStartProcess")
@ResponseBody
public void editActivitiModelToStartProcess(InputObject inputObject, OutputObject outputObject) throws Exception{
activitiModelService.editActivitiModelToStartProcess(inputObject, outputObject);
}
/** /**
* *
* @Title: deleteActivitiModelById * @Title: deleteActivitiModelById
......
...@@ -29,8 +29,6 @@ public interface ActivitiModelService { ...@@ -29,8 +29,6 @@ public interface ActivitiModelService {
public void editActivitiModelToDeploy(InputObject inputObject, OutputObject outputObject) throws Exception; public void editActivitiModelToDeploy(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editActivitiModelToStartProcess(InputObject inputObject, OutputObject outputObject) throws Exception;
public void deleteActivitiModelById(InputObject inputObject, OutputObject outputObject) throws Exception; public void deleteActivitiModelById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void deleteReleasedActivitiModelById(InputObject inputObject, OutputObject outputObject) throws Exception; public void deleteReleasedActivitiModelById(InputObject inputObject, OutputObject outputObject) throws Exception;
......
...@@ -254,55 +254,6 @@ public class ActivitiModelServiceImpl implements ActivitiModelService{ ...@@ -254,55 +254,6 @@ public class ActivitiModelServiceImpl implements ActivitiModelService{
LOGGER.info("流程【{}】成功发布", processName); LOGGER.info("流程【{}】成功发布", processName);
} }
/**
* @Title: editActivitiModelToStartProcess
* @Description: 启动流程
* @param inputObject
* @param outputObject
* @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
@ActivitiAndBaseTransaction(value = {"activitiTransactionManager", "transactionManager"})
public void editActivitiModelToStartProcess(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> user = inputObject.getLogParams();
// 流程定义的key
String keyName = map.get("keyName").toString();
/**
* jsonStr参数介绍
* name: "",----标题
* value: "",----值
* orderBy: 1,----排序,值越大越往后
* showType: 1----展示类型:1.文本展示;2.附件展示;3.富文本展示;4.图片上传;5.表格展示
* proportion: 6----展示比例,前端界面百分比分为12份
* editableNodeId:可编辑节点Id
* editableNodeName:可编辑节点名称
* formItemType: 原始表单类型
* formItem:表单内容
*/
String str = map.get("jsonStr").toString();
if(ToolUtil.isBlank(str)){
outputObject.setreturnMessage("数据不能为空.");
}else{
try{
// 流程存在的时候才能执行
if(judgeProcessKeyIsLive(keyName)){
// 启动流程
startProcess(str, user, keyName, "");
outputObject.setBean(map);
}else{
LOGGER.info("this processDefinitionKey's [{}] process is non-exits", keyName);
outputObject.setreturnMessage("任务发起失败,不存在该流程模型.");
}
}catch(Exception e){
LOGGER.warn("start Process failed", e);
outputObject.setreturnMessage("任务发起失败.");
}
}
}
/** /**
* 启动流程 * 启动流程
* *
...@@ -438,6 +389,17 @@ public class ActivitiModelServiceImpl implements ActivitiModelService{ ...@@ -438,6 +389,17 @@ public class ActivitiModelServiceImpl implements ActivitiModelService{
/** /**
* 启动流程--其他方法调用 * 启动流程--其他方法调用
* *
* jsonStr参数介绍
* * name: "",----标题
* * value: "",----值
* * orderBy: 1,----排序,值越大越往后
* * showType: 1----展示类型:1.文本展示;2.附件展示;3.富文本展示;4.图片上传;5.表格展示
* * proportion: 6----展示比例,前端界面百分比分为12份
* * editableNodeId:可编辑节点Id
* * editableNodeName:可编辑节点名称
* * formItemType: 原始表单类型
* * formItem:表单内容
*
* @param map * @param map
* @param user 用户信息 * @param user 用户信息
* @param id 数据id * @param id 数据id
...@@ -449,18 +411,6 @@ public class ActivitiModelServiceImpl implements ActivitiModelService{ ...@@ -449,18 +411,6 @@ public class ActivitiModelServiceImpl implements ActivitiModelService{
String keyName = map.get("keyName").toString(); String keyName = map.get("keyName").toString();
map.put("code", "-1"); map.put("code", "-1");
String message = ""; String message = "";
/**
* jsonStr参数介绍
* name: "",----标题
* value: "",----值
* orderBy: 1,----排序,值越大越往后
* showType: 1----展示类型:1.文本展示;2.附件展示;3.富文本展示;4.图片上传;5.表格展示
* proportion: 6----展示比例,前端界面百分比分为12份
* editableNodeId:可编辑节点Id
* editableNodeName:可编辑节点名称
* formItemType: 原始表单类型
* formItem:表单内容
*/
String str = JSONUtil.toJsonStr(map.get("jsonStr"));//前端传来的数据json串 String str = JSONUtil.toJsonStr(map.get("jsonStr"));//前端传来的数据json串
if(ToolUtil.isBlank(str)){//如果数据为空 if(ToolUtil.isBlank(str)){//如果数据为空
message = "数据不能为空."; message = "数据不能为空.";
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
package com.skyeye.activiti.service.impl; package com.skyeye.activiti.service.impl;
import cn.hutool.json.JSONUtil; import com.gexin.fastjson.JSON;
import com.skyeye.activiti.service.ActivitiModelService; import com.skyeye.activiti.service.ActivitiModelService;
import com.skyeye.activiti.service.DsFormActivitiService; import com.skyeye.activiti.service.DsFormActivitiService;
import com.skyeye.annotation.transaction.ActivitiAndBaseTransaction; import com.skyeye.annotation.transaction.ActivitiAndBaseTransaction;
...@@ -15,14 +15,12 @@ import com.skyeye.eve.dao.ActUserProcessInstanceIdDao; ...@@ -15,14 +15,12 @@ import com.skyeye.eve.dao.ActUserProcessInstanceIdDao;
import com.skyeye.eve.dao.DsFormPageDataDao; import com.skyeye.eve.dao.DsFormPageDataDao;
import com.skyeye.eve.dao.DsFormPageSequenceDao; import com.skyeye.eve.dao.DsFormPageSequenceDao;
import com.skyeye.eve.service.DsFormPageService; import com.skyeye.eve.service.DsFormPageService;
import net.sf.json.JSONArray;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/** /**
* @ClassName: DsFormActivitiServiceImpl * @ClassName: DsFormActivitiServiceImpl
...@@ -68,42 +66,54 @@ public class DsFormActivitiServiceImpl implements DsFormActivitiService { ...@@ -68,42 +66,54 @@ public class DsFormActivitiServiceImpl implements DsFormActivitiService {
public void insertDSFormProcess(InputObject inputObject, OutputObject outputObject) throws Exception { public void insertDSFormProcess(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams(); Map<String, Object> map = inputObject.getParams();
Map<String, Object> user = inputObject.getLogParams(); Map<String, Object> user = inputObject.getLogParams();
String userId = user.get("id").toString();
String str = map.get("jsonStr").toString();//前端传来的数据json串 String str = map.get("jsonStr").toString();//前端传来的数据json串
if(ToolUtil.isBlank(str)){//如果数据为空 String pageId = map.get("pageId").toString();
outputObject.setreturnMessage("数据不能为空."); try{
}else{ // 1.构造动态表单的数据
try{ List<Map<String, Object>> jsonArray = JSONArray.fromObject(str);
List<Map<String, Object>> beans = new ArrayList<Map<String,Object>>(); String sequenceId = ToolUtil.getSurFaceId();
List<Map<String, Object>> jsonArray = new ArrayList<>(); List<Map<String, Object>> pageDatas = getDsFormPageData(jsonArray, sequenceId, userId);
Map<String, Map<String, Object>> jOb = JSONUtil.toBean(str, null); // 2.将动态表单的数据构造成工作流需要的数据
//遍历数据存入JSONArray集合 String actData = getActDataByDsFormData(pageDatas);
for(String key : jOb.keySet()){ map.put("jsonStr", actData);
jsonArray.add(jOb.get(key)); activitiModelService.editActivitiModelToStartProcessByMap(map, user, sequenceId);
} if("0".equals(map.get("code").toString())){//启动流程成功
String sequenceId = ToolUtil.getSurFaceId(); dsFormPageDataDao.insertDsFormPageData(pageDatas);//插入DsFormPageData表
String userId = user.get("id").toString(); Map<String, Object> entity = dsFormPageService.getDsFormPageSequence(userId, pageId, map.get("message").toString(), StringUtils.EMPTY);
String pageId = ""; entity.put("sequenceId", sequenceId);
for (Map<String, Object> item : jsonArray) { dsFormPageSequenceDao.insertDsFormPageSequence(Arrays.asList(entity));
String pageContentId = item.get("rowId").toString(); }else{
String value = item.containsKey("value") == true ? item.get("value").toString() : ""; outputObject.setreturnMessage(map.get("message").toString());
String text = item.containsKey("text") == true ? item.get("text").toString() : "";
Map<String, Object> m = dsFormPageService.getDsFormPageData(pageContentId, value, text, item.get("showType").toString(), sequenceId, userId);
pageId = m.get("pageId").toString();
beans.add(m);
}
activitiModelService.editActivitiModelToStartProcessByMap(map, user, sequenceId);
if("0".equals(map.get("code").toString())){//启动流程成功
dsFormPageDataDao.insertDsFormPageData(beans);//插入DsFormPageData表
Map<String, Object> entity = dsFormPageService.getDsFormPageSequence(userId, pageId, map.get("message").toString(), StringUtils.EMPTY);
entity.put("sequenceId", sequenceId);
dsFormPageSequenceDao.insertDsFormPageSequence(Arrays.asList(entity));
}else{
outputObject.setreturnMessage(map.get("message").toString());
}
}catch(Exception e){
outputObject.setreturnMessage("任务发起失败.");
} }
}catch(Exception e){
outputObject.setreturnMessage("任务发起失败.");
}
}
private String getActDataByDsFormData(List<Map<String, Object>> pageDatas) {
Map<String, Object> result = new HashMap<>();
for(Map<String, Object> bean: pageDatas){
bean.put("formItem", bean);
bean.put("name", bean.get("title"));
bean.put("proportion", bean.get("defaultWidth"));
bean.put("rowId", bean.get("contentId"));
result.put(bean.get("contentId").toString(), bean);
}
return JSON.toJSONString(result);
}
private List<Map<String, Object>> getDsFormPageData(List<Map<String, Object>> jsonArray, String sequenceId, String userId) throws Exception {
List<Map<String, Object>> pageDatas = new ArrayList<>();
for (Map<String, Object> item : jsonArray) {
String pageContentId = item.get("rowId").toString();
String value = item.containsKey("value") == true ? item.get("value").toString() : "";
String text = item.containsKey("text") == true ? item.get("text").toString() : "";
Map<String, Object> pageData = dsFormPageService.getDsFormPageData(pageContentId, value, text, item.get("showType").toString(), sequenceId, userId);
pageData.put("formItemType", item.get("controlType"));
pageDatas.add(pageData);
} }
return pageDatas;
} }
/** /**
......
...@@ -650,28 +650,24 @@ public class ActModleTypeServiceImpl implements ActModleTypeService { ...@@ -650,28 +650,24 @@ public class ActModleTypeServiceImpl implements ActModleTypeService {
@Transactional(value="transactionManager") @Transactional(value="transactionManager")
public void editDsFormMationBySequenceId(InputObject inputObject, OutputObject outputObject) throws Exception { public void editDsFormMationBySequenceId(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams(); Map<String, Object> map = inputObject.getParams();
String str = map.get("jsonStr").toString();//前端传来的数据json串
String taskId = map.get("taskId").toString();//任务id String taskId = map.get("taskId").toString();//任务id
String processInstanceId = map.get("processInstanceId").toString();//流程id String processInstanceId = map.get("processInstanceId").toString();//流程id
if(ToolUtil.isJson(str)){ List<Map<String, Object>> json = JSONUtil.toList(map.get("jsonStr").toString(), null);
List<Map<String, Object>> json = JSONUtil.toList(str, null);
Map<String, Object> params = (Map<String, Object>) taskService.getVariable(taskId, "baseTask"); Map<String, Object> params = (Map<String, Object>) taskService.getVariable(taskId, "baseTask");
String contentId = "";
Map<String, Object> cenBean; for(int i = 0; i < json.size(); i++){
for(int i = 0; i < json.size(); i++){ Map<String, Object> jObject = json.get(i);// 遍历 jsonarray 数组,把每一个对象转成 json 对象
Map<String, Object> jObject = json.get(i);// 遍历 jsonarray 数组,把每一个对象转成 json 对象 actModleTypeDao.editDsFormMationBySequenceId(jObject);
actModleTypeDao.editDsFormMationBySequenceId(jObject); String pageDataId = jObject.get("rowId").toString();
contentId = jObject.get("contentId").toString(); if(params.containsKey(pageDataId)){
System.out.println(contentId); Map<String, Object> cenBean = (Map<String, Object>) params.get(pageDataId);
if(params.containsKey(contentId)){ cenBean.put("text", jObject.get("text"));
cenBean = (Map<String, Object>) params.get(contentId); cenBean.put("value", jObject.get("value"));
cenBean.put("text", jObject.get("text")); params.put(pageDataId, cenBean);
cenBean.put("value", jObject.get("value")); }
params.put(contentId, cenBean);
}
}
runtimeService.setVariable(processInstanceId, "baseTask", params);
} }
runtimeService.setVariable(processInstanceId, "baseTask", params);
} }
/** /**
......
...@@ -132,13 +132,10 @@ public class PageSequenceServiceImpl implements PageSequenceService{ ...@@ -132,13 +132,10 @@ public class PageSequenceServiceImpl implements PageSequenceService{
public void editDsFormISDraftById(InputObject inputObject, OutputObject outputObject) throws Exception { public void editDsFormISDraftById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams(); Map<String, Object> map = inputObject.getParams();
String str = map.get("jsonStr").toString();//前端传来的数据json串 String str = map.get("jsonStr").toString();//前端传来的数据json串
if(ToolUtil.isJson(str)){ List<Map<String, Object>> json = JSONUtil.toList(str, null);
List<Map<String, Object>> json = JSONUtil.toList(str, null); json.forEach(bean -> {
for(int i = 0; i < json.size(); i++){ dsFormPageSequenceDao.editDsFormISDraftById(bean);
Map<String, Object> jObject = json.get(i);// 遍历 jsonarray 数组,把每一个对象转成 json 对象 });
dsFormPageSequenceDao.editDsFormISDraftById(jObject);
}
}
} }
/** /**
...@@ -156,7 +153,7 @@ public class PageSequenceServiceImpl implements PageSequenceService{ ...@@ -156,7 +153,7 @@ public class PageSequenceServiceImpl implements PageSequenceService{
Map<String, Object> map = inputObject.getParams(); Map<String, Object> map = inputObject.getParams();
Map<String, Object> user = inputObject.getLogParams(); Map<String, Object> user = inputObject.getLogParams();
map.put("userId", user.get("id")); map.put("userId", user.get("id"));
//查询为草稿状态的提交项 // 查询为草稿状态的提交项
Map<String, Object> bean = dsFormPageSequenceDao.queryDsFormStateById(map); Map<String, Object> bean = dsFormPageSequenceDao.queryDsFormStateById(map);
if(bean != null && !bean.isEmpty()){ if(bean != null && !bean.isEmpty()){
if(!bean.containsKey("actKey") || ToolUtil.isBlank(bean.get("actKey").toString())){ if(!bean.containsKey("actKey") || ToolUtil.isBlank(bean.get("actKey").toString())){
......
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
a.id, a.id,
a.title, a.title,
a.act_id actId, a.act_id actId,
IF ( IFNULL( a.page_url, '' ) = '', '../../tpl/actmodelpage/dsFormPageModel.html', a.page_url ) pageUrl, IF ( IFNULL( a.page_url, '' ) = '', '../../tpl/dsFormPageSequence/dsFormPageSequenceDraftProcessAdd.html', a.page_url ) pageUrl,
a.background_color backgroundColor, a.background_color backgroundColor,
IFNULL(a.ds_form_id, '') dsFormId, IFNULL(a.ds_form_id, '') dsFormId,
a.menu_icon_type menuIconType, a.menu_icon_type menuIconType,
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
a.id, a.id,
a.title, a.title,
a.act_id actId, a.act_id actId,
IF ( IFNULL( a.page_url, '' ) = '', '../../tpl/actmodelpage/dsFormPageModel.html', a.page_url ) pageUrl, IF ( IFNULL( a.page_url, '' ) = '', '../../tpl/dsFormPageSequence/dsFormPageSequenceDraftProcessAdd.html', a.page_url ) pageUrl,
a.background_color backgroundColor, a.background_color backgroundColor,
IFNULL(a.ds_form_id, '') dsFormId, IFNULL(a.ds_form_id, '') dsFormId,
a.menu_icon_type menuIconType, a.menu_icon_type menuIconType,
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
<select id="queryStartProcessNotSubByUserId" parameterType="java.util.Map" resultType="java.util.Map"> <select id="queryStartProcessNotSubByUserId" parameterType="java.util.Map" resultType="java.util.Map">
SELECT SELECT
a.process_instance_id processInstanceId, a.process_instance_id processInstanceId,
IFNULL(b.id, "") sequenceId, IFNULL(b.id, '') sequenceId,
a.create_time createTime, a.create_time createTime,
a.data_id dataId, a.data_id dataId,
IF(IFNULL(c.edit_page_url, '') = '', '../../tpl/myactiviti/myactivitiedit.html', c.edit_page_url) pageUrl, IF(IFNULL(c.edit_page_url, '') = '', '../../tpl/dsFormPageSequence/dsFormPageSequenceDraftProcessEditToAct.html', c.edit_page_url) pageUrl,
c.title taskType, c.title taskType,
IF(IFNULL(c.revoke_mapping, '') = '', 'dsformrevoke001', c.revoke_mapping) revokeMapping IF(IFNULL(c.revoke_mapping, '') = '', 'dsformrevoke001', c.revoke_mapping) revokeMapping
FROM FROM
......
...@@ -16,10 +16,6 @@ ...@@ -16,10 +16,6 @@
<url id="activitimode003" path="/post/ActivitiModelController/editActivitiModelToDeploy" val="发布模型为流程定义" allUse="1" groupName="工作流操作"> <url id="activitimode003" path="/post/ActivitiModelController/editActivitiModelToDeploy" val="发布模型为流程定义" allUse="1" groupName="工作流操作">
<property id="modelId" name="modelId" ref="required" var="模型id"/> <property id="modelId" name="modelId" ref="required" var="模型id"/>
</url> </url>
<url id="activitimode004" path="/post/ActivitiModelController/editActivitiModelToStartProcess" val="启动流程" allUse="2" groupName="工作流操作">
<property id="keyName" name="keyName" ref="required" var="模型key"/>
<property id="jsonStr" name="jsonStr" ref="required" var="form表单数据json串"/>
</url>
<url id="activitimode006" path="/post/ActivitiModelController/deleteActivitiModelById" val="删除模型" allUse="1" groupName="工作流操作"> <url id="activitimode006" path="/post/ActivitiModelController/deleteActivitiModelById" val="删除模型" allUse="1" groupName="工作流操作">
<property id="rowId" name="id" ref="required" var="模型id"/> <property id="rowId" name="id" ref="required" var="模型id"/>
</url> </url>
...@@ -123,15 +119,16 @@ ...@@ -123,15 +119,16 @@
</url> </url>
<!-- 工作流用户相关操作结束 --> <!-- 工作流用户相关操作结束 -->
<!-- 动态表单审核中撤销开始 --> <!-- 动态表单工作流开始 -->
<url id="activitimode022" path="/post/DsFormActivitiController/insertDSFormProcess" val="动态表单类型的工作流提交审批" allUse="2" groupName="动态表单工作流操作"> <url id="activitimode022" path="/post/DsFormActivitiController/insertDSFormProcess" val="动态表单类型的工作流提交审批" allUse="2" groupName="动态表单工作流操作">
<property id="keyName" name="keyName" ref="required" var="模型key"/> <property id="keyName" name="keyName" ref="required" var="模型key"/>
<property id="pageId" name="pageId" ref="required" var="页面id"/>
<property id="jsonStr" name="jsonStr" ref="required" var="form表单数据json串"/> <property id="jsonStr" name="jsonStr" ref="required" var="form表单数据json串"/>
</url> </url>
<url id="dsformrevoke001" path="/post/DsFormActivitiController/editDsFormContentToRevokeByProcessInstanceId" val="动态表单类型的工作流进行撤销操作" allUse="2" groupName="动态表单工作流操作"> <url id="dsformrevoke001" path="/post/DsFormActivitiController/editDsFormContentToRevokeByProcessInstanceId" val="动态表单类型的工作流进行撤销操作" allUse="2" groupName="动态表单工作流操作">
<property id="processInstanceId" name="processInstanceId" ref="required" var="流程id" /> <property id="processInstanceId" name="processInstanceId" ref="required" var="流程id" />
</url> </url>
<!-- 动态表单审核中撤销结束 --> <!-- 动态表单工作流结束 -->
<!-- 动态表单草稿操作开始 --> <!-- 动态表单草稿操作开始 -->
<url id="pagesequence001" path="/post/PageSequenceController/queryDsFormISDraftListByUser" val="获取所有草稿状态的动态表单提交项" allUse="2"> <url id="pagesequence001" path="/post/PageSequenceController/queryDsFormISDraftListByUser" val="获取所有草稿状态的动态表单提交项" allUse="2">
...@@ -147,7 +144,7 @@ ...@@ -147,7 +144,7 @@
<property id="rowId" name="id" ref="required" var="表单提交序列id" /> <property id="rowId" name="id" ref="required" var="表单提交序列id" />
</url> </url>
<url id="pagesequence004" path="/post/PageSequenceController/editDsFormISDraftById" val="编辑动态表单(无工作流)" allUse="2"> <url id="pagesequence004" path="/post/PageSequenceController/editDsFormISDraftById" val="编辑动态表单(无工作流)" allUse="2">
<property id="jsonStr" name="jsonStr" ref="required" var="form表单数据json串"/> <property id="jsonStr" name="jsonStr" ref="required,json" var="form表单数据json串"/>
</url> </url>
<url id="pagesequence005" path="/post/PageSequenceController/editDsFormISDraftToSubApprovalById" val="按钮直接提交审批" allUse="2"> <url id="pagesequence005" path="/post/PageSequenceController/editDsFormISDraftToSubApprovalById" val="按钮直接提交审批" allUse="2">
<property id="rowId" name="id" ref="required" var="表单提交序列id" /> <property id="rowId" name="id" ref="required" var="表单提交序列id" />
......
...@@ -29,7 +29,7 @@ public interface DsFormPageSequenceDao { ...@@ -29,7 +29,7 @@ public interface DsFormPageSequenceDao {
List<Map<String, Object>> queryDsFormISDraftToEditById(Map<String, Object> map) throws Exception; List<Map<String, Object>> queryDsFormISDraftToEditById(Map<String, Object> map) throws Exception;
int editDsFormISDraftById(Map<String, Object> map) throws Exception; int editDsFormISDraftById(Map<String, Object> map);
int editDsFormISDraftToSubApprovalById(Map<String, Object> map) throws Exception; int editDsFormISDraftToSubApprovalById(Map<String, Object> map) throws Exception;
......
...@@ -8,7 +8,9 @@ import cn.hutool.json.JSONUtil; ...@@ -8,7 +8,9 @@ import cn.hutool.json.JSONUtil;
import com.gexin.fastjson.JSONObject; import com.gexin.fastjson.JSONObject;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.skyeye.cache.redis.RedisCache;
import com.skyeye.common.constans.Constants; import com.skyeye.common.constans.Constants;
import com.skyeye.common.constans.RedisConstants;
import com.skyeye.common.constans.SystemFoundationSettingsConstants; import com.skyeye.common.constans.SystemFoundationSettingsConstants;
import com.skyeye.common.object.InputObject; import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject; import com.skyeye.common.object.OutputObject;
...@@ -51,10 +53,13 @@ public class DsFormPageServiceImpl implements DsFormPageService { ...@@ -51,10 +53,13 @@ public class DsFormPageServiceImpl implements DsFormPageService {
private DsFormPageDataDao dsFormPageDataDao; private DsFormPageDataDao dsFormPageDataDao;
@Autowired @Autowired
public JedisClientService jedisClient; private JedisClientService jedisClient;
@Autowired @Autowired
private DsFormPageSequenceDao dsFormPageSequenceDao; private DsFormPageSequenceDao dsFormPageSequenceDao;
@Autowired
private RedisCache redisCache;
/** /**
* *
...@@ -330,8 +335,8 @@ public class DsFormPageServiceImpl implements DsFormPageService { ...@@ -330,8 +335,8 @@ public class DsFormPageServiceImpl implements DsFormPageService {
@Override @Override
public void queryDsFormContentListByPageId(InputObject inputObject, OutputObject outputObject) throws Exception { public void queryDsFormContentListByPageId(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams(); Map<String, Object> map = inputObject.getParams();
String pageId = map.get("").toString(); String pageId = map.get("pageId").toString();
List<Map<String, Object>> beans = getDsFormPageContentByFormId(pageId); List<Map<String, Object>> beans = this.getDsFormPageContentByFormId(pageId);
if(!beans.isEmpty()){ if(!beans.isEmpty()){
outputObject.setBeans(beans); outputObject.setBeans(beans);
outputObject.settotal(beans.size()); outputObject.settotal(beans.size());
...@@ -340,16 +345,15 @@ public class DsFormPageServiceImpl implements DsFormPageService { ...@@ -340,16 +345,15 @@ public class DsFormPageServiceImpl implements DsFormPageService {
@Override @Override
public List<Map<String, Object>> getDsFormPageContentByFormId(String dsFormPageId) throws Exception { public List<Map<String, Object>> getDsFormPageContentByFormId(String dsFormPageId) throws Exception {
List<Map<String, Object>> beans; String cacheKey = Constants.dsFormContentListByPageId(dsFormPageId);
if(ToolUtil.isBlank(jedisClient.get(Constants.dsFormContentListByPageId(dsFormPageId)))){ return redisCache.getList(cacheKey, key -> {
// 若缓存中无值,从数据库中查询 try {
beans = dsFormPageDao.queryDsFormContentListByPageId(dsFormPageId); return dsFormPageDao.queryDsFormContentListByPageId(dsFormPageId);
// 将从数据库中查来的内容存到缓存中 } catch (Exception ee) {
jedisClient.set(Constants.dsFormContentListByPageId(dsFormPageId), JSONUtil.toJsonStr(beans)); LOGGER.warn("getDsFormPageContentByFormId failed, dsFormPageId is {}.", dsFormPageId, ee);
}else{ }
beans = JSONUtil.toList(jedisClient.get(Constants.dsFormContentListByPageId(dsFormPageId)), null); return null;
} }, RedisConstants.THIRTY_DAY_SECONDS);
return beans;
} }
/** /**
......
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
a.editable_node_name editableNodeName, a.editable_node_name editableNodeName,
'' formItemType, '' formItemType,
a.order_by orderBy, a.order_by orderBy,
IF(IFNULL(a.key_id, '') = '', a.content_id, a.key_id) keyId a.content_id keyId
FROM FROM
ds_form_page_data a ds_form_page_data a
WHERE WHERE
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册