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

新增根据objectId获取动态表单信息的接口

上级 169631dc
......@@ -134,6 +134,9 @@ public class ActivitiModelServiceImpl implements ActivitiModelService{
@Autowired
private DsFormPageDao dsFormPageDao;
@Autowired
private DsFormPageSequenceDao dsFormPageSequenceDao;
@Autowired
public JedisClientService jedisClient;
......@@ -1790,7 +1793,7 @@ public class ActivitiModelServiceImpl implements ActivitiModelService{
dsFormPageDao.insertDsFormPageData(beans);//插入DsFormPageData表
Map<String, Object> entity = dsFormPageService.getDsFormPageSequence(userId, pageId, map.get("message").toString(), StringUtils.EMPTY);
entity.put("sequenceId", sequenceId);
dsFormPageDao.insertDsFormPageSequence(Arrays.asList(entity));
dsFormPageSequenceDao.insertDsFormPageSequence(Arrays.asList(entity));
}else{
outputObject.setreturnMessage(map.get("message").toString());
}
......
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.controller;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -34,8 +34,6 @@ public interface ActModleTypeDao {
public List<Map<String, Object>> queryAllDsForm(Map<String, Object> map) throws Exception;
public List<Map<String, Object>> queryDsFormMationToEdit( Map<String, Object> map) throws Exception;
public int editDsFormMationBySequenceId(Map<String, Object> m) throws Exception;
public void editDsFormMationBySequenceIdAndProcessInstanceId(Map<String, Object> job) throws Exception;
......
......@@ -14,6 +14,7 @@ import com.skyeye.common.util.DateUtil;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.eve.dao.ActModelDao;
import com.skyeye.eve.dao.ActModleTypeDao;
import com.skyeye.eve.dao.DsFormPageDao;
import com.skyeye.eve.service.ActModleTypeService;
import com.skyeye.jedis.JedisClientService;
import org.activiti.engine.RepositoryService;
......@@ -26,6 +27,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
......@@ -60,6 +62,9 @@ public class ActModleTypeServiceImpl implements ActModleTypeService {
@Autowired
private RuntimeService runtimeService;
@Autowired
private DsFormPageDao dsFormPageDao;
public static enum ActModelTypeState{
START_NEW(1, "新建"),
START_UP(2, "上线"),
......@@ -574,7 +579,6 @@ public class ActModleTypeServiceImpl implements ActModleTypeService {
* @return void 返回类型
* @throws
*/
@SuppressWarnings("unchecked")
@Override
public void queryActModleUpStateByUpStateType(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
......@@ -626,7 +630,8 @@ public class ActModleTypeServiceImpl implements ActModleTypeService {
@Override
public void queryDsFormMationToEdit(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> beans = actModleTypeDao.queryDsFormMationToEdit(map);
String id = map.get("id").toString();
List<Map<String, Object>> beans = dsFormPageDao.queryDsFormPageDataListBySequenceId(Arrays.asList(id));
outputObject.setBeans(beans);
outputObject.settotal(beans.size());
}
......@@ -641,7 +646,6 @@ public class ActModleTypeServiceImpl implements ActModleTypeService {
* @return void 返回类型
* @throws
*/
@SuppressWarnings("unchecked")
@Override
@Transactional(value="transactionManager")
public void editDsFormMationBySequenceId(InputObject inputObject, OutputObject outputObject) throws Exception {
......
......@@ -11,7 +11,7 @@ import com.skyeye.activiti.service.ActivitiModelService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.eve.dao.PageSequenceDao;
import com.skyeye.eve.dao.DsFormPageSequenceDao;
import com.skyeye.eve.service.DsFormPageService;
import com.skyeye.eve.service.PageSequenceService;
import com.skyeye.jedis.JedisClientService;
......@@ -37,7 +37,7 @@ import java.util.Map;
public class PageSequenceServiceImpl implements PageSequenceService{
@Autowired
private PageSequenceDao pageSequenceDao;
private DsFormPageSequenceDao dsFormPageSequenceDao;
@Autowired
private ActivitiModelService activitiModelService;
......@@ -63,7 +63,7 @@ public class PageSequenceServiceImpl implements PageSequenceService{
Map<String, Object> map = inputObject.getParams();
map.put("userId", inputObject.getLogParams().get("id"));
Page pages = PageHelper.startPage(Integer.parseInt(map.get("page").toString()), Integer.parseInt(map.get("limit").toString()));
List<Map<String, Object>> beans = pageSequenceDao.queryDsFormISDraftListByUser(map);
List<Map<String, Object>> beans = dsFormPageSequenceDao.queryDsFormISDraftListByUser(map);
outputObject.setBeans(beans);
outputObject.settotal(pages.getTotal());
}
......@@ -83,12 +83,12 @@ public class PageSequenceServiceImpl implements PageSequenceService{
public void deleteDsFormISDraftByUser(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
map.put("userId", inputObject.getLogParams().get("id"));
Map<String, Object> bean = pageSequenceDao.queryDsFormStateById(map);
Map<String, Object> bean = dsFormPageSequenceDao.queryDsFormStateById(map);
if(bean != null && !bean.isEmpty()){
//删除表单提交序列表数据
pageSequenceDao.deleteDsFormISDraftByUser(map);
dsFormPageSequenceDao.deleteDsFormISDraftByUser(map);
//删除表单数据提交数据
pageSequenceDao.deleteDsFormContentISDraftByUser(map);
dsFormPageSequenceDao.deleteDsFormContentISDraftByUser(map);
}else{
outputObject.setreturnMessage("该数据状态已改变或不属于当前登录账号.");
}
......@@ -107,7 +107,7 @@ public class PageSequenceServiceImpl implements PageSequenceService{
@Override
public void queryDsFormISDraftToEditById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> beans = pageSequenceDao.queryDsFormISDraftToEditById(map);
List<Map<String, Object>> beans = dsFormPageSequenceDao.queryDsFormISDraftToEditById(map);
outputObject.setBeans(beans);
outputObject.settotal(beans.size());
}
......@@ -130,7 +130,7 @@ public class PageSequenceServiceImpl implements PageSequenceService{
List<Map<String, Object>> json = JSONUtil.toList(str, null);
for(int i = 0; i < json.size(); i++){
Map<String, Object> jObject = json.get(i);// 遍历 jsonarray 数组,把每一个对象转成 json 对象
pageSequenceDao.editDsFormISDraftById(jObject);
dsFormPageSequenceDao.editDsFormISDraftById(jObject);
}
}
}
......@@ -151,7 +151,7 @@ public class PageSequenceServiceImpl implements PageSequenceService{
Map<String, Object> user = inputObject.getLogParams();
map.put("userId", user.get("id"));
//查询为草稿状态的提交项
Map<String, Object> bean = pageSequenceDao.queryDsFormStateById(map);
Map<String, Object> bean = dsFormPageSequenceDao.queryDsFormStateById(map);
if(bean != null && !bean.isEmpty()){
if(!bean.containsKey("actKey") || ToolUtil.isBlank(bean.get("actKey").toString())){
outputObject.setreturnMessage("该表单还未绑定工作流,请联系管理员.");
......@@ -161,7 +161,7 @@ public class PageSequenceServiceImpl implements PageSequenceService{
List<Map<String, Object>> items = dsFormPageService.getDsFormPageContentByFormId(map.get("pageId").toString());
// 获取数据
Map<String, Object> subFormData = new HashMap<>();
List<Map<String, Object>> rows = pageSequenceDao.queryDsFormContentBySequenceId(map);
List<Map<String, Object>> rows = dsFormPageSequenceDao.queryDsFormContentBySequenceId(map);
for(Map<String, Object> row : rows){
for(Map<String, Object> item : items){
if(row.get("rowId").toString().equals(item.get("id").toString())){
......@@ -178,7 +178,7 @@ public class PageSequenceServiceImpl implements PageSequenceService{
if("0".equals(map.get("code").toString())){
//请求成功
map.put("processInId", map.get("message"));
pageSequenceDao.editDsFormISDraftToSubApprovalById(map);
dsFormPageSequenceDao.editDsFormISDraftToSubApprovalById(map);
}else{
outputObject.setreturnMessage(map.get("message").toString());
}
......@@ -200,7 +200,7 @@ public class PageSequenceServiceImpl implements PageSequenceService{
@Override
public void queryDsFormISDraftDetailsById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> rows = pageSequenceDao.queryDsFormISDraftDetailsById(map);
List<Map<String, Object>> rows = dsFormPageSequenceDao.queryDsFormISDraftDetailsById(map);
outputObject.setBeans(rows);
outputObject.settotal(rows.size());
}
......
......@@ -125,33 +125,7 @@
FROM
ds_form_page a
</select>
<select id="queryDsFormMationToEdit" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.content_id contentId,
a.id `name`,
a.title labelContent,
a.placeholder,
a.`value`,
a.text,
CONCAT('layui-col-xs', a.default_width) defaultWidth,
a.page_id pageId,
a.html_content htmlContent,
a.js_content jsContent,
a.order_by orderBy,
IFNULL(a.key_id, '') keyId,
IFNULL(a.associated_data_types,'') associatedDataTypes,
IFNULL(a.a_data,'') aData,
IFNULL(a.display_template,'') templateContent,
a.`require`
FROM
ds_form_page_data a
WHERE a.sequence_id = #{id}
ORDER BY
a.order_by ASC
</select>
<update id="editDsFormMationBySequenceId" parameterType="java.util.Map">
UPDATE ds_form_page_data
<set>
......
......@@ -237,5 +237,17 @@ public class DsFormPageController {
dsFormPageService.saveDsFormDataList(inputObject, outputObject);
}
/**
* 根据objectId获取动态表单信息
*
* @param inputObject
* @param outputObject
* @throws Exception
*/
@RequestMapping("/post/DsFormPageController/queryDsFormDataListByObjectId")
@ResponseBody
public void queryDsFormDataListByObjectId(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormPageService.queryDsFormDataListByObjectId(inputObject, outputObject);
}
}
......@@ -51,8 +51,8 @@ public interface DsFormPageDao {
public Map<String, Object> queryFromDsFormPageContent(@Param("pageContentId") String pageContentId) throws Exception;
public int insertDsFormPageSequence(List<Map<String, Object>> pageSequence) throws Exception;
public int insertDsFormPageData(List<Map<String, Object>> beans) throws Exception;
List<Map<String, Object>> queryDsFormPageDataListBySequenceId(@Param("sequenceIds") List<String> sequenceIds) throws Exception;
}
......@@ -4,6 +4,8 @@
package com.skyeye.eve.dao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
......@@ -17,7 +19,7 @@ import java.util.Map;
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface PageSequenceDao {
public interface DsFormPageSequenceDao {
public List<Map<String, Object>> queryDsFormISDraftListByUser(Map<String, Object> map) throws Exception;
......@@ -37,4 +39,8 @@ public interface PageSequenceDao {
public List<Map<String, Object>> queryDsFormISDraftDetailsById(Map<String, Object> map) throws Exception;
int insertDsFormPageSequence(List<Map<String, Object>> pageSequence) throws Exception;
List<Map<String, Object>> queryDsFormPageSequenceListByObjectId(@Param("objectId") String objectId) throws Exception;
}
......@@ -69,4 +69,5 @@ public interface DsFormPageService {
Map<String, Object> getDsFormPageData(String pageContentId, String value, String text, String showType,
String sequenceId, String userId) throws Exception;
void queryDsFormDataListByObjectId(InputObject inputObject, OutputObject outputObject) throws Exception;
}
......@@ -16,6 +16,7 @@ import com.skyeye.common.util.DateUtil;
import com.skyeye.common.util.HttpClient;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.eve.dao.DsFormPageDao;
import com.skyeye.eve.dao.DsFormPageSequenceDao;
import com.skyeye.eve.service.DsFormPageService;
import com.skyeye.jedis.JedisClientService;
import org.apache.commons.lang3.StringUtils;
......@@ -25,10 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
*
......@@ -50,6 +48,9 @@ public class DsFormPageServiceImpl implements DsFormPageService {
@Autowired
public JedisClientService jedisClient;
@Autowired
private DsFormPageSequenceDao dsFormPageSequenceDao;
/**
*
......@@ -348,7 +349,7 @@ public class DsFormPageServiceImpl implements DsFormPageService {
}
/**
* 根据code获取动表单信息
* 根据code获取动表单信息
*
* @param inputObject
* @param outputObject
......@@ -403,7 +404,7 @@ public class DsFormPageServiceImpl implements DsFormPageService {
}
// 插入ds_form_page_sequence表
if(!pageSequence.isEmpty()){
dsFormPageDao.insertDsFormPageSequence(pageSequence);
dsFormPageSequenceDao.insertDsFormPageSequence(pageSequence);
}
}
......@@ -417,6 +418,7 @@ public class DsFormPageServiceImpl implements DsFormPageService {
* @return
* @throws Exception
*/
@Override
public Map<String, Object> getDsFormPageSequence(String userId, String dsFormPageId, String processInstanceId, String objectId) {
Map<String, Object> sequence = new HashMap<>();
sequence.put("sequenceId", ToolUtil.getSurFaceId());
......@@ -443,4 +445,23 @@ public class DsFormPageServiceImpl implements DsFormPageService {
return data;
}
/**
* 根据objectId获取动态表单信息
*
* @param inputObject
* @param outputObject
* @throws Exception
*/
@Override
public void queryDsFormDataListByObjectId(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
String objectId = map.get("objectId").toString();
List<Map<String, Object>> dsFormList = dsFormPageSequenceDao.queryDsFormPageSequenceListByObjectId(objectId);
for(Map<String, Object> bean: dsFormList) {
bean.put("content", dsFormPageDao.queryDsFormPageDataListBySequenceId(Arrays.asList(bean.get("sequenceId").toString())));
}
outputObject.setBeans(dsFormList);
outputObject.settotal(dsFormList.size());
}
}
......@@ -244,15 +244,6 @@
AND b.id = a.form_content_id
</select>
<insert id="insertDsFormPageSequence" parameterType="java.util.Map">
INSERT INTO ds_form_page_sequence
(id, page_id, process_instance_id, create_id, create_time, object_id)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.sequenceId}, #{item.pageId}, #{item.processInstanceId}, #{item.createId}, #{item.createTime}, #{item.objectId})
</foreach>
</insert>
<insert id="insertDsFormPageData" parameterType="java.util.Map">
INSERT INTO ds_form_page_data
(id, content_id, sequence_id, page_id, title, placeholder, `require`, html_content, js_content,
......@@ -266,4 +257,38 @@
</foreach>
</insert>
<select id="queryDsFormPageDataListBySequenceId" resultType="java.util.Map">
SELECT
a.id,
a.sequence_id sequenceId,
a.id `name`,
a.title labelContent,
a.content_id contentId,
a.placeholder,
a.`value`,
a.text,
a.show_type showType,
CONCAT('layui-col-xs', a.default_width) defaultWidth,
a.page_id pageId,
a.html_content htmlContent,
a.js_content jsContent,
a.order_by orderBy,
IFNULL(a.key_id, '') keyId,
IFNULL(a.editable_node_id, '') editableNodeId,
IFNULL(a.editable_node_name, '') editableNodeName,
IFNULL(a.associated_data_types,'') associatedDataTypes,
IFNULL(a.a_data,'') aData,
IFNULL(a.display_template,'') templateContent,
a.`require`
FROM
ds_form_page_data a
WHERE 1=1
<if test="sequenceIds != null and sequenceIds.size() &gt; 0">
<foreach collection="sequenceIds" item="id" separator="," open=" AND a.sequence_id in(" close=")">
#{id}
</foreach>
</if>
ORDER BY a.order_by ASC
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.skyeye.eve.dao.PageSequenceDao">
<mapper namespace="com.skyeye.eve.dao.DsFormPageSequenceDao">
<select id="queryDsFormISDraftListByUser" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
......@@ -127,5 +127,27 @@
a.sequence_id = #{id}
ORDER BY a.order_by ASC
</select>
<insert id="insertDsFormPageSequence" parameterType="java.util.Map">
INSERT INTO ds_form_page_sequence
(id, page_id, process_instance_id, create_id, create_time, object_id)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.sequenceId}, #{item.pageId}, #{item.processInstanceId}, #{item.createId}, #{item.createTime}, #{item.objectId})
</foreach>
</insert>
<select id="queryDsFormPageSequenceListByObjectId" resultType="java.util.Map">
SELECT
a.id sequenceId,
a.page_id id,
b.page_name pageName,
b.page_num pageNum
FROM
ds_form_page_sequence a,
ds_form_page b
WHERE a.object_id = #{objectId}
AND a.page_id = b.id
</select>
</mapper>
\ No newline at end of file
......@@ -164,6 +164,9 @@
<property id="dataJson" name="dataJson" ref="required,json" var="数据" />
<property id="objectId" name="objectId" ref="required" var="需要绑定的id" />
</url>
<url id="dsformpage015" path="/post/DsFormPageController/queryDsFormDataListByObjectId" val="根据objectId获取动态表单信息" allUse="2" method="GET" groupName="表单页面设计接口">
<property id="objectId" name="objectId" ref="required" var="绑定的id" />
</url>
<!-- 动态表单页面设计结束 -->
<!-- 动态表单页面分类开始 -->
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册