gu ji shi ge shi hua de wen ti

jingwei
wangxuanran 2023-06-07 11:46:25 +08:00
commit cf0af8919e
10 changed files with 492 additions and 34 deletions

View File

@ -1,19 +1,26 @@
package com.customization.youhong.taibao.trisubreq.impl;
import aiyh.utils.Util;
import aiyh.utils.entity.ModelTableInfo;
import aiyh.utils.excention.CustomerException;
import aiyh.utils.recordset.MapperBuilderSql;
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestEntity;
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestToDataConfig;
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestToDataMapping;
import com.customization.youhong.taibao.trisubreq.impl.entity.WorkflowBaseDataEntity;
import com.engine.core.cfg.annotation.ServiceDynamicProxy;
import com.engine.core.impl.aop.AbstractServiceProxy;
import com.engine.workflow.service.SubRequestService;
import com.engine.workflow.service.impl.SubRequestServiceImpl;
import ebu7common.youhong.ai.bean.Builder;
import org.apache.log4j.Logger;
import weaver.workflow.request.DiffWfTriggerSetting;
import weaver.workflow.request.SameWfTriggerSetting;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -44,14 +51,18 @@ public class TriSubRequestAfterInterceptImpl extends AbstractServiceProxy implem
@Override
public void triSubRequestAfter(int i) {
// 查询所有的子流程
List<SubRequestEntity> subRequestEntities = mapper.selectSubRequestByMainRequest(i);
if (CollectionUtil.isEmpty(subRequestEntities)) {
return;
}
List<SubRequestToDataConfig> subRequestToDataConfigs = mapper.selectConfig();
String mainWorkflowId = mapper.selectWorkflowId(i);
// 查询配置信息
List<SubRequestToDataConfig> subRequestToDataConfigs = mapper.selectConfig(mainWorkflowId);
if (CollectionUtil.isEmpty(subRequestToDataConfigs)) {
return;
}
// 按照流程类型分组,主要作用于不同流程的触发操作
Map<String, SubRequestToDataConfig> collect = subRequestToDataConfigs
.stream()
.collect(
@ -59,20 +70,100 @@ public class TriSubRequestAfterInterceptImpl extends AbstractServiceProxy implem
SubRequestToDataConfig::getWorkflowType,
value -> value
));
List<Map<String, Object>> requestDataList = new ArrayList<>();
// 查询出所有子流程的数据信息
List<WorkflowBaseDataEntity> requestDataList = new ArrayList<>();
for (SubRequestEntity subRequestEntity : subRequestEntities) {
// 查询流程对应的配置信息
Map<String, Object> requestData = getRequestData(subRequestEntity);
requestDataList.add(requestData);
WorkflowBaseDataEntity build = Builder.builder(WorkflowBaseDataEntity::new)
.with(WorkflowBaseDataEntity::setRequestId, subRequestEntity.getRequestId())
.with(WorkflowBaseDataEntity::setWorkflowId, subRequestEntity.getWorkflowId())
.with(WorkflowBaseDataEntity::setData, requestData)
.build();
requestDataList.add(build);
}
if (CollectionUtil.isEmpty(requestDataList)) {
return;
}
// 更具requestId转换map
Map<String, WorkflowBaseDataEntity> requestDataMap = requestDataList.stream().collect(Collectors.toMap(
WorkflowBaseDataEntity::getRequestId,
value -> value
));
// 查询主流程数据信息
Map<String, Object> mainRequestData = mapper.selectRequestBase(Util.null2String(i));
for (SubRequestEntity subRequestEntity : subRequestEntities) {
// 根据workflowId获取配置信息
SubRequestToDataConfig subRequestToDataConfig = collect.get(subRequestEntity.getWorkflowId());
WorkflowBaseDataEntity workflowBaseDataEntity = requestDataMap.get(subRequestEntity.getRequestId());
Map<String, Object> data = workflowBaseDataEntity.getData();
String conditionUpdate = subRequestToDataConfig.getConditionUpdate();
ModelTableInfo modelTableInfo = subRequestToDataConfig.getModelTableInfo();
String modelId = "";
Map<String, Object> updateMap = null;
String id = "";
// 没有更新条件,不需要更新数据信息
if (StrUtil.isBlank(conditionUpdate)) {
modelId = mapper.selectModelId(conditionUpdate, modelTableInfo.getTableName(), mainRequestData, data);
id = modelId;
}
if (StrUtil.isNotBlank(modelId)) {
// 查询到数据,需要更新数据信息
List<SubRequestToDataMapping> updateMappings = subRequestToDataConfig.getUpdateMappings();
updateMap = tidyUpData(updateMappings, mainRequestData, data);
} else {
// 没有数据,需要插入
List<SubRequestToDataMapping> mappings = subRequestToDataConfig.getMappings();
updateMap = tidyUpData(mappings, mainRequestData, data);
int modeDataId = Util.getModeDataId(subRequestToDataConfig.getModelTable(), 1);
id = Util.null2String(modeDataId);
}
String updateSql = MapperBuilderSql.builderUpdateSql(subRequestToDataConfig.getModelTable(), updateMap);
updateSql += " where id = #{id}";
updateMap.put("id", id);
boolean flag = mapper.updateModelData(updateSql, updateMap);
if (!flag) {
log.info("流程转数据数据信息更新失败!" + updateSql);
} else {
Util.rebuildModeDataShare(1, subRequestToDataConfig.getModelTable(), Integer.valueOf(id));
}
}
}
/**
* <h2></h2>
*
* @param mappings
* @param mainRequestData
* @param data
* @return
*/
private Map<String, Object> tidyUpData(List<SubRequestToDataMapping> mappings,
Map<String, Object> mainRequestData,
Map<String, Object> data) {
Map<String, Object> result = new HashMap<>(mappings.size());
for (SubRequestToDataMapping mapping : mappings) {
Integer dataSource = mapping.getDataSource();
Object value = null;
if (dataSource == 0) {
// 主流程数据
value = mainRequestData.get(mapping.getMainWorkflowField().getFieldName());
} else {
// 子流程数据
value = data.get(mapping.getWorkflowField().getFieldName());
}
result.put(mapping.getModelField().getTableName(), value);
}
return result;
}
/**
* <h2></h2>
*
* @param subRequestEntity
* @return
*/
private Map<String, Object> getRequestData(SubRequestEntity subRequestEntity) {
String tableName = subRequestEntity.getWorkflowTable();
Map<String, Object> requestData = mapper.selectWorkflowData(tableName, subRequestEntity.getRequestId());

View File

@ -52,10 +52,10 @@ public interface TriSubRequestAfterMapper {
*
* @return
*/
@Select("select * from uf_sub_wf_to_mode")
@Select("select * from uf_sub_wf_to_mode where workflow_type_1 = #{workflowId}")
@Associations({
@Association(
property = "modelTableName",
property = "modelTableInfo",
column = "model_table",
select = "aiyh.utils.mapper.UtilMapper.selectModelTableInfo",
id = @Id(value = Integer.class)
@ -66,9 +66,14 @@ public interface TriSubRequestAfterMapper {
property = "mappings",
column = "id",
id = @Id(value = String.class, methodId = 1)
),
@CollectionMapping(
property = "updateMappings",
column = "id",
id = @Id(value = String.class, methodId = 2)
)
})
List<SubRequestToDataConfig> selectConfig();
List<SubRequestToDataConfig> selectConfig(@ParamMapper("workflowId") String workflowId);
/**
@ -91,10 +96,46 @@ public interface TriSubRequestAfterMapper {
column = "workflow_field",
select = "aiyh.utils.mapper.UtilMapper.selectFieldInfo",
id = @Id(value = Integer.class)
),
@Association(
property = "mainWorkflowField",
column = "main_workflow_field",
select = "aiyh.utils.mapper.UtilMapper.selectFieldInfo",
id = @Id(value = Integer.class)
)
})
List<SubRequestToDataMapping> selectConfigDt(String mainId);
/**
* <h2>2</h2>
*
* @param mainId id
* @return 2
*/
@CollectionMethod(value = 2, desc = "查询配置表明细2信息")
@Select("select * from uf_sub_wf_to_mode_dt2 where mainid = #{mainId}")
@Associations({
@Association(
property = "modelField",
column = "model_field",
select = "aiyh.utils.mapper.UtilMapper.selectFieldInfo",
id = @Id(value = Integer.class)
),
@Association(
property = "workflowField",
column = "workflow_field",
select = "aiyh.utils.mapper.UtilMapper.selectFieldInfo",
id = @Id(value = Integer.class)
),
@Association(
property = "mainWorkflowField",
column = "main_workflow_field",
select = "aiyh.utils.mapper.UtilMapper.selectFieldInfo",
id = @Id(value = Integer.class)
)
})
List<SubRequestToDataMapping> selectConfigDt2(String mainId);
/**
* <h2></h2>
*
@ -113,4 +154,39 @@ public interface TriSubRequestAfterMapper {
*/
@Select("select * from workflow_requestbase where requestid = #{requestId}")
Map<String, Object> selectRequestBase(@ParamMapper("requestId") String requestId);
/**
* <h2>id</h2>
*
* @param conditionUpdate
* @param tableName
* @param mainRequestData
* @param data
* @return
*/
@Select("select * from $t{tableName} where $t{conditionUpdate}")
String selectModelId(
@ParamMapper("conditionUpdate") String conditionUpdate,
@ParamMapper("tableName") String tableName,
@ParamMapper("main") Map<String, Object> mainRequestData,
@ParamMapper("sub") Map<String, Object> data);
/**
* <h2></h2>
*
* @param updateSql sql
* @param updateMap
*/
@Update(custom = true)
boolean updateModelData(@SqlString String updateSql, Map<String, Object> updateMap);
/**
* <h2>id</h2>
*
* @param i id
* @return id
*/
@Select("select WORKFLOWID from workflow_requestbase where requestid = #{requestId}")
String selectWorkflowId(@ParamMapper("requestId") int i);
}

View File

@ -23,14 +23,21 @@ public class SubRequestToDataConfig {
/** 流程 */
private String workflowType;
/** 子流程 */
private String workflowType1;
/** 建模 */
private String modelTable;
/** 更新条件 */
private String conditionUpdate;
/** 建模表 */
private ModelTableInfo modelTableName;
private ModelTableInfo modelTableInfo;
/** 插入字段映射 */
private List<SubRequestToDataMapping> mappings;
/** 更新字段映射 */
private List<SubRequestToDataMapping> updateMappings;
}

View File

@ -26,4 +26,10 @@ public class SubRequestToDataMapping {
private FieldViewInfo modelField;
/** 流程字段 */
private FieldViewInfo workflowField;
/** 主流程字段 */
private FieldViewInfo mainWorkflowField;
/** 数据来源 */
private Integer dataSource;
}

View File

@ -0,0 +1,30 @@
package com.customization.youhong.taibao.trisubreq.impl.entity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.Map;
/**
* <h1></h1>
*
* <p>create: 2023/6/7 10:06</p>
*
* @author youHong.ai
*/
@Getter
@Setter
@ToString
public class WorkflowBaseDataEntity {
/** 流程ID */
private String workflowId;
/** 请求id */
private String requestId;
/** 流程数据 */
private Map<String, Object> data;
}

View File

@ -9,6 +9,7 @@ import lombok.Setter;
import lombok.ToString;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
import weaver.soa.workflow.request.RequestService;
import weaver.youhong.ai.geerde.action.submitfirst.mapper.AutoSubmitFirstMapper;
import java.util.Arrays;
@ -77,6 +78,8 @@ public class AutoSubmitFirstAction extends SafeCusBaseAction {
}
int creatorId = requestInfo.getRequestManager().getCreater();
String finalNodesStr = nodesStr;
RequestService requestService = new RequestService();
// requestService.setSubmitToNodeid();
Util.submitWorkflowThread(Integer.parseInt(requestId), creatorId,
"", 60, flag -> {
oneRequestLock.remove(requestId);

View File

@ -12,7 +12,9 @@ import weaver.youhong.ai.intellectualproperty.action.CaElectronicSignatureAction
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.Base64;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* <h1></h1>
@ -34,7 +36,11 @@ public class FileToBase64CusGetValue implements CusInterfaceGetValue {
if (currentValue.split(",").length > 1) {
throw new CustomerException("签章文件有且只能有一个文件!");
}
DocImageInfo docImageInfo = Util.selectImageInfoByDocId(currentValue);
List<DocImageInfo> docImageInfoList = Util.selectImageInfoByDocIds(currentValue);
DocImageInfo docImageInfo = findMaxImageFileId(docImageInfoList);
if (Objects.isNull(docImageInfo)) {
throw new CustomerException("未找到实体文件数据!");
}
InputStream inputStream = ImageFileManager.getInputStreamById(docImageInfo.getImageFileId());
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
@ -51,4 +57,18 @@ public class FileToBase64CusGetValue implements CusInterfaceGetValue {
throw new CustomerException("convert file to base64 fail!");
}
}
public DocImageInfo findMaxImageFileId(List<DocImageInfo> list) {
DocImageInfo maxImageFileIdObj = null;
Integer maxImageFileId = null;
for (DocImageInfo obj : list) {
if (maxImageFileId == null || obj.getImageFileId() > maxImageFileId) {
maxImageFileId = obj.getImageFileId();
maxImageFileIdObj = obj;
}
}
return maxImageFileIdObj;
}
}

View File

@ -33,6 +33,56 @@ from workflow_billdetailtable bill
join workflow_base base on base.formid = bill.billid;
-- 流程和建模字段视图更具流程和建模的billid可以查询流程和建模中的字段信息
-- 初始化基础参数
DROP TABLE IF EXISTS cus_workflow_base_field_assist;
CREATE TABLE cus_workflow_base_field_assist
(
id INT PRIMARY KEY,
fieldname VARCHAR(255) NOT NULL,
indexdesc VARCHAR(255) NOT NULL,
tablename VARCHAR(255) NOT NULL,
billid INT NOT NULL,
showtablename VARCHAR(255) NOT NULL,
fieldhtmltype VARCHAR(255) NOT NULL,
fieldtype INT NOT NULL
);
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-999, 'requestname', '请求名称requestname', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-998, 'creater', '创建人creater', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-997, 'createdate', '创建日期createdate', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-996, 'createtime', '创建时间createtime', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-995, 'requestmark', '请求说明requestmark', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-994, 'messagetype', '消息提醒messagetype', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-993, 'mainrequestid', '主流程的请求idmainrequestid', 'workflow_requestbase', 999, 'main table', '单行文本',
'1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-992, 'ecology_pinyin_search', 'ecology_拼音_搜索ecology_pinyin_search', 'workflow_requestbase', 999,
'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-991, 'requestnamenew', '带标题字段的请求标题requestnamenew', 'workflow_requestbase', 999, 'main table',
'单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-990, 'requestid', '请求idrequestid', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-989, 'workflowid', '工作流idworkflowid', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
-- 创建试图
create
or replace view workflow_field_table_view as
select wb.id,
@ -62,7 +112,10 @@ select wb.id,
else '附件上传' end) fieldhtmltype,
wb.FIELDHTMLTYPE fieldtype
from workflow_billfield wb
left join htmllabelindex ht on wb.fieldlabel = ht.id;
left join htmllabelindex ht on wb.fieldlabel = ht.id
union all
select *
from cus_workflow_base_field_assist;
-- 建模表信息视图
create
@ -73,6 +126,27 @@ from workflow_bill bill
where bill.id < 0
and bill.tablename like 'uf%';
-- 流程建模表信息
CREATE
or replace VIEW workflow_mode_table_view
AS
select bill.ID id,
bill.TABLENAME tablename,
base.WORKFLOWNAME indexdesc,
'workflow' tabletype
from (
workflow_bill bill join workflow_base base on ((base.FORMID = bill.ID))
)
union all
select bill.ID id,
bill.TABLENAME tablename,
hti.INDEXDESC indexdesc,
'mode' tabletype
from (
workflow_bill bill left join htmllabelindex hti on ((hti.ID = bill.NAMELABEL))
)
where ((bill.ID < 0) and (bill.TABLENAME like 'uf%'));
-- 流程节点信息视图
create
or replace view workflow_node_info_view as

View File

@ -36,6 +36,60 @@ from workflow_billdetailtable bill
/
-- 流程和建模字段视图更具流程和建模的billid可以查询流程和建模中的字段信息
-- 准备基础数据
BEGIN
-- 判断表是否存在
FOR i IN (SELECT * FROM user_tables WHERE table_name = 'cus_workflow_base_field_assist') LOOP
-- 存在则删除表
EXECUTE IMMEDIATE 'DROP TABLE cus_workflow_base_field_assist';
END LOOP;
-- 不存在或删除成功后则创建表
EXECUTE IMMEDIATE '
CREATE TABLE cus_workflow_base_field_assist
(id NUMBER(10) PRIMARY KEY, fieldname VARCHAR2(255) NOT NULL, indexdesc VARCHAR2(255) NOT NULL, tablename VARCHAR2(255) NOT NULL, billid NUMBER(10) NOT NULL, showtablename VARCHAR2(255) NOT NULL, fieldhtmltype VARCHAR2(255) NOT NULL, fieldtype NUMBER(10) NOT NULL)
';
END;
/
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-999, 'requestname', '请求名称requestname', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-998, 'creater', '创建人creater', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-997, 'createdate', '创建日期createdate', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-996, 'createtime', '创建时间createtime', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-995, 'requestmark', '请求说明requestmark', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-994, 'messagetype', '消息提醒messagetype', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-993, 'mainrequestid', '主流程的请求idmainrequestid', 'workflow_requestbase', 999, 'main table', '单行文本',
'1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-992, 'ecology_pinyin_search', 'ecology_拼音_搜索ecology_pinyin_search', 'workflow_requestbase', 999,
'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-991, 'requestnamenew', '带标题字段的请求标题requestnamenew', 'workflow_requestbase', 999, 'main table',
'单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-990, 'requestid', '请求idrequestid', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-989, 'workflowid', '工作流idworkflowid', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
-- 创建试图
create
or replace view workflow_field_table_view as
select wb.id,
@ -65,7 +119,9 @@ select wb.id,
else '附件上传' end) fieldhtmltype
from workflow_billfield wb
left join htmllabelindex ht on wb.fieldlabel = ht.id
/
union all
select *
from cus_workflow_base_field_assist /
-- 建模表信息视图
create
@ -76,6 +132,27 @@ from workflow_bill bill
where bill.id < 0
and bill.tablename like 'uf%'
/
-- 流程建模表信息
CREATE
or replace VIEW workflow_mode_table_view
AS
select bill.ID id,
bill.TABLENAME tablename,
base.WORKFLOWNAME indexdesc,
'workflow' tabletype
from (
workflow_bill bill join workflow_base base on ((base.FORMID = bill.ID))
)
union all
select bill.ID id,
bill.TABLENAME tablename,
hti.INDEXDESC indexdesc,
'mode' tabletype
from (
workflow_bill bill left join htmllabelindex hti on ((hti.ID = bill.NAMELABEL))
)
where ((bill.ID < 0) and (bill.TABLENAME like 'uf%'))
/
-- 流程节点信息视图
create

View File

@ -41,6 +41,54 @@ from workflow_billdetailtable bill
join workflow_base base on base.formid = bill.billid go
-- 流程和建模字段视图更具流程和建模的billid可以查询流程和建模中的字段信息
-- 准备基础数据
DROP TABLE IF EXISTS cus_workflow_base_field_assist go
CREATE TABLE cus_workflow_base_field_assist
(
id INT PRIMARY KEY,
fieldname VARCHAR(255) NOT NULL,
indexdesc VARCHAR(255) NOT NULL,
tablename VARCHAR(255) NOT NULL,
billid INT NOT NULL,
showtablename VARCHAR(255) NOT NULL,
fieldhtmltype VARCHAR(255) NOT NULL,
fieldtype INT NOT NULL
)go
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-999, 'requestname', '请求名称requestname', 'workflow_requestbase', 999, 'main table', '单行文本', '1') go
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-998, 'creater', '创建人creater', 'workflow_requestbase', 999, 'main table', '单行文本', '1');
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-997, 'createdate', '创建日期createdate', 'workflow_requestbase', 999, 'main table', '单行文本', '1') go
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-996, 'createtime', '创建时间createtime', 'workflow_requestbase', 999, 'main table', '单行文本', '1') go
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-995, 'requestmark', '请求说明requestmark', 'workflow_requestbase', 999, 'main table', '单行文本', '1') go
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-994, 'messagetype', '消息提醒messagetype', 'workflow_requestbase', 999, 'main table', '单行文本', '1') go
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-993, 'mainrequestid', '主流程的请求idmainrequestid', 'workflow_requestbase', 999, 'main table', '单行文本', '1') go
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-992, 'ecology_pinyin_search', 'ecology_拼音_搜索ecology_pinyin_search', 'workflow_requestbase', 999, 'main table', '单行文本', '1') go
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-991, 'requestnamenew', '带标题字段的请求标题requestnamenew', 'workflow_requestbase', 999, 'main table', '单行文本', '1') go
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-990, 'requestid', '请求idrequestid', 'workflow_requestbase', 999, 'main table', '单行文本', '1') go
INSERT INTO cus_workflow_base_field_assist(id, fieldname, indexdesc, tablename, billid, showtablename, fieldhtmltype,
fieldtype)
VALUES (-989, 'workflowid', '工作流idworkflowid', 'workflow_requestbase', 999, 'main table', '单行文本', '1') go
-- 创建试图
if exists (select * from sysobjects where name = 'workflow_field_table_view')
drop view workflow_field_table_view
go
@ -71,7 +119,10 @@ select wb.id,
when wb.FIELDHTMLTYPE = '5' then '选择框'
else '附件上传' end) fieldhtmltype
from workflow_billfield wb
left join htmllabelindex ht on wb.fieldlabel = ht.id go
left join htmllabelindex ht on wb.fieldlabel = ht.id
union all
select *
from cus_workflow_base_field_assist go
-- 建模表信息视图
if exists (select * from sysobjects where name = 'mode_bill_info_view')
@ -84,6 +135,29 @@ from workflow_bill bill
where bill.id < 0
and bill.tablename like 'uf%' go
-- 流程建模表信息
if exists (select * from sysobjects where name = 'workflow_mode_table_view')
drop view workflow_field_table_view
go
CREATE VIEW workflow_mode_table_view
AS
select bill.ID id,
bill.TABLENAME tablename,
base.WORKFLOWNAME indexdesc,
'workflow' tabletype
from (
workflow_bill bill join workflow_base base on ((base.FORMID = bill.ID))
)
union all
select bill.ID id,
bill.TABLENAME tablename,
hti.INDEXDESC indexdesc,
'mode' tabletype
from (
workflow_bill bill left join htmllabelindex hti on ((hti.ID = bill.NAMELABEL))
)
where ((bill.ID < 0) and (bill.TABLENAME like 'uf%')) go
-- 流程节点信息视图
if exists (select * from sysobjects where name = 'workflow_node_info_view')
drop view workflow_node_info_view