Commit 0512d02b authored by pengxin's avatar pengxin

数据集详情版本管理模块提交

parent f54e1196
package com.yice.webadmin.app.constant;
public final class MongoConstant {
public static final String COLLECT_NAME = "DATASET-DATA-";
public static final String DATA = "data";
public static final String VERSION = "versionId";
public static final String CREATE_TIME = "createTime";
}
package com.yice.webadmin.app.controller;
import com.github.pagehelper.page.PageMethod;
import com.yice.common.core.annotation.MyRequestBody;
import com.yice.common.core.constant.ErrorCodeEnum;
import com.yice.common.core.object.MyPageData;
import com.yice.common.core.object.MyPageParam;
import com.yice.common.core.object.ResponseResult;
import com.yice.common.core.util.MyCommonUtil;
import com.yice.common.core.util.MyModelUtil;
import com.yice.common.core.util.MyPageUtil;
import com.yice.common.log.annotation.OperationLog;
import com.yice.common.log.model.constant.SysOperationLogType;
import com.yice.webadmin.app.data.DatasetData;
import com.yice.webadmin.app.dto.DatasetDataDto;
import com.yice.webadmin.app.service.DatasetDataService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 数据集版本操作控制器类。
*
* @author linking
* @date 2023-04-13
*/
@Api(tags = "数据集版本详情管理接口")
@Slf4j
@RestController
@RequestMapping("/admin/app/datasetData")
public class DatasetDataController {
@Autowired
private DatasetDataService datasetDataService;
/**
* 更新数据集版本数据。
*
* @param datasetMongoDto 更新对象。
* @return 应答结果对象。
*/
@OperationLog(type = SysOperationLogType.UPDATE)
@PostMapping("/update")
public ResponseResult<Void> update(@MyRequestBody DatasetDataDto datasetMongoDto) {
String errorMessage = MyCommonUtil.getModelValidationError(datasetMongoDto, true);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
DatasetData datasetData = MyModelUtil.copyTo(datasetMongoDto, DatasetData.class);
datasetDataService.update(datasetData);
return ResponseResult.success();
}
/**
* 删除数据集版本数据。
*
* @param id 删除对象主键Id。
* @return 应答结果对象。
*/
@OperationLog(type = SysOperationLogType.DELETE)
@PostMapping("/delete")
public ResponseResult<Void> delete(
@MyRequestBody String id,
@MyRequestBody Long versionId) {
if (MyCommonUtil.existBlankArgument(id)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_ID_EXIST);
}
if (MyCommonUtil.existBlankArgument(versionId)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_VERSION_EXIST);
}
Long result = datasetDataService.remove(id,versionId);
if(result == 0) {
return ResponseResult.error(ErrorCodeEnum.INVALID_DELETE_ARGUMENT);
}
return ResponseResult.success();
}
/**
* 根据版本id,查询该数据集列表
* @param versionId 版本标识
* @param pageParam 分页参数
* @return
*/
@PostMapping("/list")
public ResponseResult<MyPageData<DatasetData>> list(
@MyRequestBody Long versionId,
@MyRequestBody MyPageParam pageParam) {
if (MyCommonUtil.existBlankArgument(versionId)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_VERSION_EXIST);
}
if (pageParam != null) {
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
}
List<DatasetData> datasetDataList = datasetDataService.list(versionId, pageParam);
Long count = datasetDataService.count(versionId);
return ResponseResult.success(MyPageUtil.makeResponseData(datasetDataList, count));
}
/**
* 查看指定数据集版本对象详情。
* @param id 主键标识。
* @param versionId 指定对象主键Id。
* @return 应答结果对象,包含对象详情。
*/
@GetMapping("/view")
public ResponseResult<DatasetData> view(
@RequestParam String id,
@RequestParam Long versionId) {
if (MyCommonUtil.existBlankArgument(id)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_ID_EXIST);
}
if (MyCommonUtil.existBlankArgument(versionId)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_VERSION_EXIST);
}
DatasetData datasetData = datasetDataService.view(id, versionId);
if (datasetData == null) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
}
return ResponseResult.success(datasetData);
}
}
...@@ -16,12 +16,12 @@ import com.yice.common.core.util.MyPageUtil; ...@@ -16,12 +16,12 @@ import com.yice.common.core.util.MyPageUtil;
import com.yice.common.log.annotation.OperationLog; import com.yice.common.log.annotation.OperationLog;
import com.yice.common.log.model.constant.SysOperationLogType; import com.yice.common.log.model.constant.SysOperationLogType;
import com.yice.webadmin.app.config.PythonConfig; import com.yice.webadmin.app.config.PythonConfig;
import com.yice.webadmin.app.data.DatasetData;
import com.yice.webadmin.app.dto.DatasetDetailDto; import com.yice.webadmin.app.dto.DatasetDetailDto;
import com.yice.webadmin.app.dto.DatasetVersionDto; import com.yice.webadmin.app.dto.DatasetVersionDto;
import com.yice.webadmin.app.model.DatasetDetail; import com.yice.webadmin.app.model.DatasetDetail;
import com.yice.webadmin.app.model.DatasetManage;
import com.yice.webadmin.app.model.DatasetVersion; import com.yice.webadmin.app.model.DatasetVersion;
import com.yice.webadmin.app.service.DatasetManageService; import com.yice.webadmin.app.service.DatasetDataService;
import com.yice.webadmin.app.service.DatasetVersionService; import com.yice.webadmin.app.service.DatasetVersionService;
import com.yice.webadmin.app.util.Sha1Util; import com.yice.webadmin.app.util.Sha1Util;
import com.yice.webadmin.app.vo.DatasetVersionVo; import com.yice.webadmin.app.vo.DatasetVersionVo;
...@@ -42,10 +42,7 @@ import java.nio.charset.StandardCharsets; ...@@ -42,10 +42,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/** /**
* 数据集版本操作控制器类。 * 数据集版本操作控制器类。
...@@ -62,7 +59,7 @@ public class DatasetVersionController { ...@@ -62,7 +59,7 @@ public class DatasetVersionController {
@Autowired @Autowired
private DatasetVersionService datasetVersionService; private DatasetVersionService datasetVersionService;
@Autowired @Autowired
private DatasetManageService datasetManageService; private DatasetDataService datasetMongoService;
@Autowired @Autowired
private PythonConfig pythonConfig; private PythonConfig pythonConfig;
...@@ -245,7 +242,7 @@ public class DatasetVersionController { ...@@ -245,7 +242,7 @@ public class DatasetVersionController {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST, errorMessage);
} }
DatasetVersion datasetVersion = this.datasetVersionService.getById(versionId); DatasetVersion datasetVersion = this.datasetVersionService.getById(versionId);
String fullName = this.saveDatasetFile(importFile, datasetVersion.getVersionName()); String fullName = this.saveDatasetFile(importFile, datasetVersion.getVersionName(),versionId);
datasetVersion.setFileUrl(fullName); datasetVersion.setFileUrl(fullName);
datasetVersion.setInputStatus(1); datasetVersion.setInputStatus(1);
datasetVersion.setDataVolume(Long.valueOf(JSON.parseArray(new String(importFile.getBytes(), StandardCharsets.UTF_8)).size())); datasetVersion.setDataVolume(Long.valueOf(JSON.parseArray(new String(importFile.getBytes(), StandardCharsets.UTF_8)).size()));
...@@ -259,10 +256,11 @@ public class DatasetVersionController { ...@@ -259,10 +256,11 @@ public class DatasetVersionController {
* @param importFile 导入的文件。 * @param importFile 导入的文件。
* @return 保存的本地文件名。 * @return 保存的本地文件名。
*/ */
private String saveDatasetFile(MultipartFile importFile, String versionName) throws IOException { private String saveDatasetFile(MultipartFile importFile, String versionName, Long versionId) throws IOException {
String fullName = pythonConfig.getDatasetFileBaseDir() + versionName + ".json"; String fullName = pythonConfig.getDatasetFileBaseDir() + versionName + ".json";
byte[] bytes = null;
try { try {
byte[] bytes = importFile.getBytes(); bytes = importFile.getBytes();
Path path = Paths.get(fullName); Path path = Paths.get(fullName);
// 如果没有files文件夹,则创建 // 如果没有files文件夹,则创建
if (!Files.isWritable(path)) { if (!Files.isWritable(path)) {
...@@ -274,6 +272,22 @@ public class DatasetVersionController { ...@@ -274,6 +272,22 @@ public class DatasetVersionController {
log.error("Failed to write imported file [" + importFile.getOriginalFilename() + " ].", e); log.error("Failed to write imported file [" + importFile.getOriginalFilename() + " ].", e);
throw e; throw e;
} }
try {
// 或者指定字符集进行转换,替换"UTF-8"为你想要使用的字符集
String result = new String(bytes, "UTF-8");
//先删除数据集
datasetMongoService.delete(versionId);
//保存到mongodb中
datasetMongoService.save(new DatasetData(null, versionId, result, new Date()));
}catch (Exception ex) {
log.error("Failed to write mongodb database [" + importFile.getOriginalFilename() + " ].", ex);
throw ex;
}
File file = new File(pythonConfig.getDatasetFileBaseDir(), pythonConfig.getDatasetInfo()); File file = new File(pythonConfig.getDatasetFileBaseDir(), pythonConfig.getDatasetInfo());
if (!file.exists()){ if (!file.exists()){
file.createNewFile(); file.createNewFile();
......
package com.yice.webadmin.app.data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
@Data
@ApiModel
@NoArgsConstructor
@AllArgsConstructor
@Document(collection = "DATASET-DATA")
public class DatasetData {
@Id
@ApiModelProperty(name = "_id",value = "文档标识")
private String _id;
@ApiModelProperty(name = "versionId",value = "版本标识")
private Long versionId;
@ApiModelProperty(name = "data",value = "json格式数据")
private String data;
@ApiModelProperty(name = "createTime",value="创建时间")
private Date createTime;
}
package com.yice.webadmin.app.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* DatasetDataDto视图对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("DatasetMongoDto视图对象")
@Data
public class DatasetDataDto {
/**
* 文档标识
*/
@ApiModelProperty(value = "文档标识")
private String _id;
/**
* 版本标识。
*/
@ApiModelProperty(value = "版本标识")
private Long versionId;
/**
* json数据。
*/
@ApiModelProperty(value = "json格式数据")
private String data;
/**
* json数据。
*/
@ApiModelProperty(value="创建时间")
private Date createTime;
}
package com.yice.webadmin.app.service;
import com.yice.common.core.object.MyPageParam;
import com.yice.webadmin.app.data.DatasetData;
import java.util.List;
/**
* 数据集版本数据操作服务接口。
*
* @author linking
* @date 2023-04-13
*/
public interface DatasetDataService {
/**
* 保存新增对象。
*
* @param datasetData 新增对象。
* @return 返回新增对象。
*/
void save(DatasetData datasetData);
/**
* 删除该数据集。
*
* @param versionId 版本标识。
* @return 返回受影响的行数。
*/
Long delete(Long versionId);
/**
* 根据id查询该条信息。
*
* @param id 文档标识。
* @param versionId 版本标识。
* @return 返回查看对象。
*/
DatasetData view(String id, Long versionId);
/**
* 查询列表集合总条数
* @param versionId 版本标识
* @return 返回总条数
*/
Long count(Long versionId);
/**
* 查询列表集合
* @param versionId 版本标识
* @param pageParam 页码参数
* @return 返回查看对象列表
*/
List<DatasetData> list(Long versionId, MyPageParam pageParam);
/**
* 更新数据对象。
*
* @param datasetData 更新的对象。
* @return 返回修改后的对象。
*/
void update(DatasetData datasetData);
/**
* 删除指定数据。
*
* @param id 主键Id。
* @param versionId 版本标识。
* @return 返回受影响的行数。
*/
Long remove(String id,Long versionId);
}
package com.yice.webadmin.app.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.yice.common.core.object.MyPageParam;
import com.yice.webadmin.app.constant.MongoConstant;
import com.yice.webadmin.app.data.DatasetData;
import com.yice.webadmin.app.service.DatasetDataService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 数据集版本数据操作服务类。
*
* @author linking
* @date 2023-04-13
*/
@Slf4j
@Service("datasetDataService")
public class DatasetDataServiceImpl implements DatasetDataService {
@Autowired
private MongoTemplate mongoTemplate;
/**
* 保存新增对象。
*
* @param datasetData 新增对象。
* @return 返回新增对象。
*/
public void save(DatasetData datasetData) {
if (StringUtils.isNotBlank(datasetData.getData())) {
List<Document> documents = new ArrayList<>();
JSONArray jsonArray = JSONArray.parseArray(datasetData.getData());
if (null != jsonArray && jsonArray.size() > 0) {
for (int i = 0; i < jsonArray.size(); i++) {
Document document = new Document(MongoConstant.DATA, jsonArray.getJSONObject(i))
.append(MongoConstant.VERSION, datasetData.getVersionId())
.append(MongoConstant.CREATE_TIME, datasetData.getCreateTime());
documents.add(document);
}
}
mongoTemplate.insert(documents, MongoConstant.COLLECT_NAME + datasetData.getVersionId());
}
}
/**
* 查询列表集合
* @param versionId 版本标识
* @param pageParam 页码参数
* @return 返回查看对象列表
*/
public List<DatasetData> list(Long versionId, MyPageParam pageParam) {
Query query = new Query(Criteria.where(MongoConstant.VERSION).is(versionId))
.skip((pageParam.getPageNum() - 1) * pageParam.getPageSize())
.limit(pageParam.getPageSize());
return mongoTemplate.find(query, DatasetData.class,
MongoConstant.COLLECT_NAME + versionId);
}
/**
* 查询列表集合总条数
* @param versionId 版本标识
* @return 返回总条数
*/
public Long count(Long versionId) {
Query query = new Query(Criteria.where(MongoConstant.VERSION).is(versionId));
return mongoTemplate.count(query, DatasetData.class,
MongoConstant.COLLECT_NAME + versionId);
}
/**
* 根据id查询该条信息。
*
* @param id 文档标识。
* @param versionId 版本标识。
* @return 返回查看对象。
*/
public DatasetData view(String id, Long versionId) {
return mongoTemplate.findById(id, DatasetData.class,
MongoConstant.COLLECT_NAME + versionId);
}
/**
* 更新数据对象。
*
* @param datasetData 更新的对象。
* @return 成功返回true,否则false。
*/
public void update(DatasetData datasetData) {
mongoTemplate.save(datasetData,
MongoConstant.COLLECT_NAME + datasetData.getVersionId());
}
/**
* 删除指定数据。
*
* @param id 文档标识。
* @param versionId 版本标识。
* @return 返回受影响的行数。
*/
public Long remove(String id, Long versionId) {
Query query = new Query(Criteria.where("_id").is(id));
return mongoTemplate.remove(query, DatasetData.class,
MongoConstant.COLLECT_NAME + versionId).getDeletedCount();
}
/**
* 删除该数据集。
*
* @param versionId 版本标识。
* @return 返回受影响的行数。
*/
public Long delete(Long versionId) {
Query query = new Query(Criteria.where(MongoConstant.VERSION).is(versionId));
return mongoTemplate.remove(query, DatasetData.class,
MongoConstant.COLLECT_NAME + versionId).getDeletedCount();
}
}
package com.yice.webadmin.app.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* DatasetMongoDto视图对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("DatasetDataVo视图对象")
@Data
public class DatasetDataVo {
/**
* 文档标识
*/
@ApiModelProperty(value = "文档标识")
private String _id;
/**
* 版本标识。
*/
@ApiModelProperty(value = "版本标识")
private Long versionId;
/**
* json数据。
*/
@ApiModelProperty(value = "json格式数据")
private String data;
/**
* json数据。
*/
@ApiModelProperty(value="创建时间")
private Date createTime;
}
...@@ -42,6 +42,14 @@ spring: ...@@ -42,6 +42,14 @@ spring:
suffix: .ftl suffix: .ftl
main: main:
allow-circular-references: true allow-circular-references: true
data:
mongodb:
uri: mongodb://root:123456@192.168.0.36:27017/
database: imp
authentication-database: admin
auto-index-creation: true
connections-num-min-size: 5
connections-num-max-size: 10
mybatis-plus: mybatis-plus:
mapper-locations: classpath:com/yice/webadmin/*/dao/mapper/*Mapper.xml,com/yice/common/log/dao/mapper/*Mapper.xml mapper-locations: classpath:com/yice/webadmin/*/dao/mapper/*Mapper.xml,com/yice/common/log/dao/mapper/*Mapper.xml
......
...@@ -32,6 +32,9 @@ public enum ErrorCodeEnum { ...@@ -32,6 +32,9 @@ public enum ErrorCodeEnum {
NO_ACCESS_PERMISSION("当前用户没有访问权限,请核对!"), NO_ACCESS_PERMISSION("当前用户没有访问权限,请核对!"),
NO_OPERATION_PERMISSION("当前用户没有操作权限,请核对!"), NO_OPERATION_PERMISSION("当前用户没有操作权限,请核对!"),
ARGUMENT_NULL_ID_EXIST("数据验证失败,接口ID参数存在空值,请核对!"),
ARGUMENT_NULL_VERSION_EXIST("数据验证失败,接口版本标识参数存在空值,请核对!"),
PASSWORD_ERR("密码错误,请重试!"), PASSWORD_ERR("密码错误,请重试!"),
INVALID_USERNAME_PASSWORD("用户名或密码错误,请重试!"), INVALID_USERNAME_PASSWORD("用户名或密码错误,请重试!"),
INVALID_ACCESS_TOKEN("无效的用户访问令牌!"), INVALID_ACCESS_TOKEN("无效的用户访问令牌!"),
...@@ -40,6 +43,8 @@ public enum ErrorCodeEnum { ...@@ -40,6 +43,8 @@ public enum ErrorCodeEnum {
INVALID_TENANT_STATUS("当前租户为不可用状态,请刷新后重试!"), INVALID_TENANT_STATUS("当前租户为不可用状态,请刷新后重试!"),
INVALID_USER_TENANT("当前用户并不属于当前租户,请刷新后重试!"), INVALID_USER_TENANT("当前用户并不属于当前租户,请刷新后重试!"),
INVALID_DELETE_ARGUMENT("删除失败或者不存在,请刷新后重试!"),
HAS_CHILDREN_DATA("数据验证失败,子数据存在,请刷新后重试!"), HAS_CHILDREN_DATA("数据验证失败,子数据存在,请刷新后重试!"),
DATA_VALIDATED_FAILED("数据验证失败,请核对!"), DATA_VALIDATED_FAILED("数据验证失败,请核对!"),
UPLOAD_FILE_FAILED("文件上传失败,请联系管理员!"), UPLOAD_FILE_FAILED("文件上传失败,请联系管理员!"),
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>common</artifactId>
<groupId>com.yice</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>common-flow</artifactId>
<version>1.0.0</version>
<name>common-flow</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.yice</groupId>
<artifactId>common-datafilter</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.yice</groupId>
<artifactId>common-sequence</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.yice</groupId>
<artifactId>common-log</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.yice</groupId>
<artifactId>common-swagger</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-basic</artifactId>
<version>${flowable.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.yice.common.flow.base.service;
import com.yice.common.flow.model.FlowWorkOrder;
/**
* 工作流在线表单的服务接口。
*
* @author linking
* @date 2023-04-13
*/
public interface BaseFlowOnlineService {
/**
* 更新在线表单主表数据的流程状态字段值。
*
* @param workOrder 工单对象。
*/
void updateFlowStatus(FlowWorkOrder workOrder);
/**
* 根据工单对象级联删除业务数据。
*
* @param workOrder 工单对象。
*/
void deleteBusinessData(FlowWorkOrder workOrder);
}
package com.yice.common.flow.config;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
/**
* common-flow模块的自动配置引导类。
*
* @author linking
* @date 2023-04-13
*/
@EnableConfigurationProperties({FlowProperties.class})
public class FlowAutoConfig {
}
package com.yice.common.flow.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* 工作流的配置对象。
*
* @author linking
* @date 2023-04-13
*/
@Data
@ConfigurationProperties(prefix = "common-flow")
public class FlowProperties {
/**
* 工作落工单操作接口的URL前缀。
*/
private String urlPrefix;
}
package com.yice.common.flow.constant;
import java.util.HashMap;
import java.util.Map;
/**
* 工作流任务触发BUTTON。
*
* @author linking
* @date 2023-04-13
*/
public final class FlowApprovalType {
/**
* 保存。
*/
public static final String SAVE = "save";
/**
* 同意。
*/
public static final String AGREE = "agree";
/**
* 拒绝。
*/
public static final String REFUSE = "refuse";
/**
* 驳回。
*/
public static final String REJECT = "reject";
/**
* 撤销。
*/
public static final String REVOKE = "revoke";
/**
* 指派。
*/
public static final String TRANSFER = "transfer";
/**
* 多实例会签。
*/
public static final String MULTI_SIGN = "multi_sign";
/**
* 会签同意。
*/
public static final String MULTI_AGREE = "multi_agree";
/**
* 会签拒绝。
*/
public static final String MULTI_REFUSE = "multi_refuse";
/**
* 会签弃权。
*/
public static final String MULTI_ABSTAIN = "multi_abstain";
/**
* 多实例加签。
*/
public static final String MULTI_CONSIGN = "multi_consign";
/**
* 多实例减签。
*/
public static final String MULTI_MINUS_SIGN = "multi_minus_sign";
/**
* 中止。
*/
public static final String STOP = "stop";
/**
* 干预。
*/
public static final String INTERVENE = "intervene";
/**
* 自由跳转。
*/
public static final String FREE_JUMP = "free_jump";
private static final Map<Object, String> DICT_MAP = new HashMap<>(2);
static {
DICT_MAP.put(SAVE, "保存");
DICT_MAP.put(AGREE, "同意");
DICT_MAP.put(REFUSE, "拒绝");
DICT_MAP.put(REJECT, "驳回");
DICT_MAP.put(REVOKE, "撤销");
DICT_MAP.put(TRANSFER, "指派");
DICT_MAP.put(MULTI_SIGN, "多实例会签");
DICT_MAP.put(MULTI_AGREE, "会签同意");
DICT_MAP.put(MULTI_REFUSE, "会签拒绝");
DICT_MAP.put(MULTI_ABSTAIN, "会签弃权");
DICT_MAP.put(MULTI_CONSIGN, "多实例加签");
DICT_MAP.put(MULTI_MINUS_SIGN, "多实例减签");
DICT_MAP.put(STOP, "中止");
DICT_MAP.put(INTERVENE, "干预");
DICT_MAP.put(FREE_JUMP, "自由跳转");
}
/**
* 判断参数是否为当前常量字典的合法值。
*
* @param value 待验证的参数值。
* @return 合法返回true,否则false。
*/
public static boolean isValid(Integer value) {
return value != null && DICT_MAP.containsKey(value);
}
/**
* 私有构造函数,明确标识该常量类的作用。
*/
private FlowApprovalType() {
}
}
package com.yice.common.flow.constant;
import java.util.HashMap;
import java.util.Map;
/**
* 待办任务回退类型。
*
* @author linking
* @date 2023-04-13
*/
public final class FlowBackType {
/**
* 驳回。
*/
public static final int REJECT = 0;
/**
* 撤回。
*/
public static final int REVOKE = 1;
private static final Map<Object, String> DICT_MAP = new HashMap<>(2);
static {
DICT_MAP.put(REJECT, "驳回");
DICT_MAP.put(REVOKE, "撤回");
}
/**
* 判断参数是否为当前常量字典的合法值。
*
* @param value 待验证的参数值。
* @return 合法返回true,否则false。
*/
public static boolean isValid(Integer value) {
return value != null && DICT_MAP.containsKey(value);
}
/**
* 私有构造函数,明确标识该常量类的作用。
*/
private FlowBackType() {
}
}
package com.yice.common.flow.constant;
import java.util.HashMap;
import java.util.Map;
/**
* 内置的流程审批状态。
*
* @author linking
* @date 2023-04-13
*/
public class FlowBuiltinApprovalStatus {
/**
* 同意。
*/
public static final int AGREED = 1;
/**
* 拒绝。
*/
public static final int REFUSED = 2;
/**
* 会签同意。
*/
public static final int MULTI_AGREED = 3;
/**
* 会签拒绝。
*/
public static final int MULTI_REFUSED = 4;
private static final Map<Object, String> DICT_MAP = new HashMap<>(2);
static {
DICT_MAP.put(AGREED, "同意");
DICT_MAP.put(REFUSED, "拒绝");
DICT_MAP.put(MULTI_AGREED, "会签同意");
DICT_MAP.put(MULTI_REFUSED, "会签拒绝");
}
/**
* 判断参数是否为当前常量字典的合法值。
*
* @param value 待验证的参数值。
* @return 合法返回true,否则false。
*/
public static boolean isValid(Integer value) {
return value != null && DICT_MAP.containsKey(value);
}
/**
* 私有构造函数,明确标识该常量类的作用。
*/
private FlowBuiltinApprovalStatus() {
}
}
package com.yice.common.flow.constant;
/**
* 工作流中的常量数据。
*
* @author linking
* @date 2023-04-13
*/
public class FlowConstant {
/**
* 标识流程实例启动用户的变量名。
*/
public static final String START_USER_NAME_VAR = "${startUserName}";
/**
* 流程实例发起人变量名。
*/
public static final String PROC_INSTANCE_INITIATOR_VAR = "initiator";
/**
* 流程实例中发起人用户的变量名。
*/
public static final String PROC_INSTANCE_START_USER_NAME_VAR = "startUserName";
/**
* 流程任务的指定人变量。
*/
public static final String TASK_APPOINTED_ASSIGNEE_VAR = "appointedAssignee";
/**
* 操作类型变量。
*/
public static final String OPERATION_TYPE_VAR = "operationType";
/**
* 提交用户。
*/
public static final String SUBMIT_USER_VAR = "submitUser";
/**
* 多任务拒绝数量变量。
*/
public static final String MULTI_REFUSE_COUNT_VAR = "multiRefuseCount";
/**
* 多任务同意数量变量。
*/
public static final String MULTI_AGREE_COUNT_VAR = "multiAgreeCount";
/**
* 多任务弃权数量变量。
*/
public static final String MULTI_ABSTAIN_COUNT_VAR = "multiAbstainCount";
/**
* 会签发起任务。
*/
public static final String MULTI_SIGN_START_TASK_VAR = "multiSignStartTask";
/**
* 会签任务总数量。
*/
public static final String MULTI_SIGN_NUM_OF_INSTANCES_VAR = "multiNumOfInstances";
/**
* 会签任务执行的批次Id。
*/
public static final String MULTI_SIGN_TASK_EXECUTION_ID_VAR = "taskExecutionId";
/**
* 多实例实例数量变量。
*/
public static final String NUMBER_OF_INSTANCES_VAR = "nrOfInstances";
/**
* 多实例已完成实例数量变量。
*/
public static final String NUMBER_OF_COMPLETED_INSTANCES_VAR = "nrOfCompletedInstances";
/**
* 多任务指派人列表变量。
*/
public static final String MULTI_ASSIGNEE_LIST_VAR = "assigneeList";
/**
* 上级部门领导审批变量。
*/
public static final String GROUP_TYPE_UP_DEPT_POST_LEADER_VAR = "upDeptPostLeader";
/**
* 本部门领导审批变量。
*/
public static final String GROUP_TYPE_DEPT_POST_LEADER_VAR = "deptPostLeader";
/**
* 所有部门岗位审批变量。
*/
public static final String GROUP_TYPE_ALL_DEPT_POST_VAR = "allDeptPost";
/**
* 本部门岗位审批变量。
*/
public static final String GROUP_TYPE_SELF_DEPT_POST_VAR = "selfDeptPost";
/**
* 同级部门岗位审批变量。
*/
public static final String GROUP_TYPE_SIBLING_DEPT_POST_VAR = "siblingDeptPost";
/**
* 上级部门岗位审批变量。
*/
public static final String GROUP_TYPE_UP_DEPT_POST_VAR = "upDeptPost";
/**
* 任意部门关联的岗位审批变量。
*/
public static final String GROUP_TYPE_DEPT_POST_VAR = "deptPost";
/**
* 指定角色分组变量。
*/
public static final String GROUP_TYPE_ROLE_VAR = "role";
/**
* 指定部门分组变量。
*/
public static final String GROUP_TYPE_DEPT_VAR = "dept";
/**
* 指定用户分组变量。
*/
public static final String GROUP_TYPE_USER_VAR = "user";
/**
* 指定审批人。
*/
public static final String GROUP_TYPE_ASSIGNEE = "ASSIGNEE";
/**
* 岗位。
*/
public static final String GROUP_TYPE_POST = "POST";
/**
* 上级部门领导审批。
*/
public static final String GROUP_TYPE_UP_DEPT_POST_LEADER = "UP_DEPT_POST_LEADER";
/**
* 本部门岗位领导审批。
*/
public static final String GROUP_TYPE_DEPT_POST_LEADER = "DEPT_POST_LEADER";
/**
* 本部门岗位前缀。
*/
public static final String SELF_DEPT_POST_PREFIX = "SELF_DEPT_";
/**
* 上级部门岗位前缀。
*/
public static final String UP_DEPT_POST_PREFIX = "UP_DEPT_";
/**
* 同级部门岗位前缀。
*/
public static final String SIBLING_DEPT_POST_PREFIX = "SIBLING_DEPT_";
/**
* 当前流程实例所有任务的抄送数据前缀。
*/
public static final String COPY_DATA_MAP_PREFIX = "copyDataMap_";
/**
* 作为临时变量存入任务变量JSONObject对象时的key。
*/
public static final String COPY_DATA_KEY = "copyDataKey";
/**
* 流程中业务快照数据中,主表数据的Key。
*/
public static final String MASTER_DATA_KEY = "masterData";
/**
* 流程中业务快照数据中,关联从表数据的Key。
*/
public static final String SLAVE_DATA_KEY = "slaveData";
/**
* 流程任务的最近更新状态的Key。
*/
public static final String LATEST_APPROVAL_STATUS_KEY = "latestApprovalStatus";
/**
* 流程用户任务待办之前的通知类型的Key。
*/
public static final String USER_TASK_NOTIFY_TYPES_KEY = "flowNotifyTypeList";
/**
* 流程用户任务自动跳过类型的Key。
*/
public static final String USER_TASK_AUTO_SKIP_KEY = "autoSkipType";
/**
* 流程用户任务驳回类型的Key。
*/
public static final String USER_TASK_REJECT_TYPE_KEY = "rejectType";
/**
* 驳回时携带的变量数据。
*/
public static final String REJECT_TO_SOURCE_DATA_VAR = "rejectData";
/**
* 驳回时携带的变量数据。
*/
public static final String REJECT_BACK_TO_SOURCE_DATA_VAR = "rejectBackData";
/**
* 指定审批人。
*/
public static final String DELEGATE_ASSIGNEE_VAR = "delegateAssignee";
/**
* 私有构造函数,明确标识该常量类的作用。
*/
private FlowConstant() {
}
}
package com.yice.common.flow.constant;
import java.util.HashMap;
import java.util.Map;
/**
* 工作流任务类型。
*
* @author linking
* @date 2023-04-13
*/
public final class FlowTaskStatus {
/**
* 已提交。
*/
public static final int SUBMITTED = 0;
/**
* 审批中。
*/
public static final int APPROVING = 1;
/**
* 被拒绝。
*/
public static final int REFUSED = 2;
/**
* 已结束。
*/
public static final int FINISHED = 3;
/**
* 提前停止。
*/
public static final Integer STOPPED = 4;
/**
* 已取消。
*/
public static final Integer CANCELLED = 5;
/**
* 保存草稿。
*/
public static final Integer DRAFT = 6;
private static final Map<Object, String> DICT_MAP = new HashMap<>(2);
static {
DICT_MAP.put(SUBMITTED, "已提交");
DICT_MAP.put(APPROVING, "审批中");
DICT_MAP.put(REFUSED, "被拒绝");
DICT_MAP.put(FINISHED, "已结束");
DICT_MAP.put(STOPPED, "提前停止");
DICT_MAP.put(CANCELLED, "已取消");
DICT_MAP.put(DRAFT, "保存草稿");
}
/**
* 判断参数是否为当前常量字典的合法值。
*
* @param value 待验证的参数值。
* @return 合法返回true,否则false。
*/
public static boolean isValid(Integer value) {
return value != null && DICT_MAP.containsKey(value);
}
/**
* 私有构造函数,明确标识该常量类的作用。
*/
private FlowTaskStatus() {
}
}
package com.yice.common.flow.constant;
import java.util.HashMap;
import java.util.Map;
/**
* 工作流任务类型。
*
* @author linking
* @date 2023-04-13
*/
public final class FlowTaskType {
/**
* 其他类型任务。
*/
public static final int OTHER_TYPE = 0;
/**
* 用户任务。
*/
public static final int USER_TYPE = 1;
private static final Map<Object, String> DICT_MAP = new HashMap<>(2);
static {
DICT_MAP.put(OTHER_TYPE, "其他任务类型");
DICT_MAP.put(USER_TYPE, "用户任务类型");
}
/**
* 判断参数是否为当前常量字典的合法值。
*
* @param value 待验证的参数值。
* @return 合法返回true,否则false。
*/
public static boolean isValid(Integer value) {
return value != null && DICT_MAP.containsKey(value);
}
/**
* 私有构造函数,明确标识该常量类的作用。
*/
private FlowTaskType() {
}
}
package com.yice.common.flow.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import com.github.pagehelper.page.PageMethod;
import com.yice.common.flow.vo.*;
import com.yice.common.flow.dto.*;
import com.yice.common.flow.model.*;
import com.yice.common.flow.service.*;
import com.yice.common.core.object.*;
import com.yice.common.core.util.*;
import com.yice.common.core.constant.*;
import com.yice.common.core.annotation.MyRequestBody;
import com.yice.common.core.validator.UpdateGroup;
import com.yice.common.log.annotation.OperationLog;
import com.yice.common.log.model.constant.SysOperationLogType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import javax.validation.groups.Default;
/**
* 工作流流程变量接口。
*
* @author linking
* @date 2023-04-13
*/
@Api(tags = "工作流流程变量接口")
@Slf4j
@RestController
@RequestMapping("${common-flow.urlPrefix}/flowEntryVariable")
@ConditionalOnProperty(name = "common-flow.operationEnabled", havingValue = "true")
public class FlowEntryVariableController {
@Autowired
private FlowEntryVariableService flowEntryVariableService;
/**
* 新增流程变量数据。
*
* @param flowEntryVariableDto 新增对象。
* @return 应答结果对象,包含新增对象主键Id。
*/
@ApiOperationSupport(ignoreParameters = {"flowEntryVariableDto.variableId"})
@OperationLog(type = SysOperationLogType.ADD)
@PostMapping("/add")
public ResponseResult<Long> add(@MyRequestBody FlowEntryVariableDto flowEntryVariableDto) {
String errorMessage = MyCommonUtil.getModelValidationError(flowEntryVariableDto);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
FlowEntryVariable flowEntryVariable = MyModelUtil.copyTo(flowEntryVariableDto, FlowEntryVariable.class);
flowEntryVariable = flowEntryVariableService.saveNew(flowEntryVariable);
return ResponseResult.success(flowEntryVariable.getVariableId());
}
/**
* 更新流程变量数据。
*
* @param flowEntryVariableDto 更新对象。
* @return 应答结果对象。
*/
@OperationLog(type = SysOperationLogType.UPDATE)
@PostMapping("/update")
public ResponseResult<Void> update(@MyRequestBody FlowEntryVariableDto flowEntryVariableDto) {
String errorMessage = MyCommonUtil.getModelValidationError(flowEntryVariableDto, Default.class, UpdateGroup.class);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
FlowEntryVariable flowEntryVariable = MyModelUtil.copyTo(flowEntryVariableDto, FlowEntryVariable.class);
FlowEntryVariable originalFlowEntryVariable = flowEntryVariableService.getById(flowEntryVariable.getVariableId());
if (originalFlowEntryVariable == null) {
// NOTE: 修改下面方括号中的话述
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
}
if (!flowEntryVariableService.update(flowEntryVariable, originalFlowEntryVariable)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
}
return ResponseResult.success();
}
/**
* 删除流程变量数据。
*
* @param variableId 删除对象主键Id。
* @return 应答结果对象。
*/
@OperationLog(type = SysOperationLogType.DELETE)
@PostMapping("/delete")
public ResponseResult<Void> delete(@MyRequestBody Long variableId) {
String errorMessage;
if (MyCommonUtil.existBlankArgument(variableId)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
}
// 验证关联Id的数据合法性
FlowEntryVariable originalFlowEntryVariable = flowEntryVariableService.getById(variableId);
if (originalFlowEntryVariable == null) {
// NOTE: 修改下面方括号中的话述
errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
}
if (!flowEntryVariableService.remove(variableId)) {
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
}
return ResponseResult.success();
}
/**
* 列出符合过滤条件的流程变量列表。
*
* @param flowEntryVariableDtoFilter 过滤对象。
* @param orderParam 排序参数。
* @param pageParam 分页参数。
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/list")
public ResponseResult<MyPageData<FlowEntryVariableVo>> list(
@MyRequestBody FlowEntryVariableDto flowEntryVariableDtoFilter,
@MyRequestBody MyOrderParam orderParam,
@MyRequestBody MyPageParam pageParam) {
if (pageParam != null) {
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
}
FlowEntryVariable flowEntryVariableFilter = MyModelUtil.copyTo(flowEntryVariableDtoFilter, FlowEntryVariable.class);
String orderBy = MyOrderParam.buildOrderBy(orderParam, FlowEntryVariable.class);
List<FlowEntryVariable> flowEntryVariableList =
flowEntryVariableService.getFlowEntryVariableListWithRelation(flowEntryVariableFilter, orderBy);
return ResponseResult.success(MyPageUtil.makeResponseData(flowEntryVariableList, FlowEntryVariable.INSTANCE));
}
/**
* 查看指定流程变量对象详情。
*
* @param variableId 指定对象主键Id。
* @return 应答结果对象,包含对象详情。
*/
@GetMapping("/view")
public ResponseResult<FlowEntryVariableVo> view(@RequestParam Long variableId) {
if (MyCommonUtil.existBlankArgument(variableId)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
}
FlowEntryVariable flowEntryVariable = flowEntryVariableService.getByIdWithRelation(variableId, MyRelationParam.full());
if (flowEntryVariable == null) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
}
FlowEntryVariableVo flowEntryVariableVo = FlowEntryVariable.INSTANCE.fromModel(flowEntryVariable);
return ResponseResult.success(flowEntryVariableVo);
}
}
package com.yice.common.flow.controller;
import io.swagger.annotations.Api;
import com.alibaba.fastjson.JSONObject;
import com.yice.common.core.annotation.MyRequestBody;
import com.yice.common.core.object.*;
import com.yice.common.core.constant.ErrorCodeEnum;
import com.yice.common.core.util.MyPageUtil;
import com.yice.common.flow.model.constant.FlowMessageType;
import com.yice.common.flow.model.FlowMessage;
import com.yice.common.flow.service.FlowMessageService;
import com.yice.common.flow.vo.FlowMessageVo;
import com.github.pagehelper.page.PageMethod;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 工作流消息接口。
*
* @author linking
* @date 2023-04-13
*/
@Api(tags = "工作流消息接口")
@Slf4j
@RestController
@RequestMapping("${common-flow.urlPrefix}/flowMessage")
@ConditionalOnProperty(name = "common-flow.operationEnabled", havingValue = "true")
public class FlowMessageController {
@Autowired
private FlowMessageService flowMessageService;
/**
* 获取当前用户的未读消息总数。
* NOTE:白名单接口。
*
* @return 应答结果对象,包含当前用户的未读消息总数。
*/
@GetMapping("/getMessageCount")
public ResponseResult<JSONObject> getMessageCount() {
JSONObject resultData = new JSONObject();
resultData.put("remindingMessageCount", flowMessageService.countRemindingMessageListByUser());
resultData.put("copyMessageCount", flowMessageService.countCopyMessageByUser());
return ResponseResult.success(resultData);
}
/**
* 获取当前用户的催办消息列表。
* 不仅仅包含,其中包括当前用户所属角色、部门和岗位的候选组催办消息。
* NOTE:白名单接口。
*
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/listRemindingTask")
public ResponseResult<MyPageData<FlowMessageVo>> listRemindingTask(@MyRequestBody MyPageParam pageParam) {
if (pageParam != null) {
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
}
List<FlowMessage> flowMessageList = flowMessageService.getRemindingMessageListByUser();
return ResponseResult.success(MyPageUtil.makeResponseData(flowMessageList, FlowMessage.INSTANCE));
}
/**
* 获取当前用户的抄送消息列表。
* 不仅仅包含,其中包括当前用户所属角色、部门和岗位的候选组抄送消息。
* NOTE:白名单接口。
*
* @param read true表示已读,false表示未读。
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/listCopyMessage")
public ResponseResult<MyPageData<FlowMessageVo>> listCopyMessage(
@MyRequestBody MyPageParam pageParam, @MyRequestBody Boolean read) {
if (pageParam != null) {
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
}
List<FlowMessage> flowMessageList = flowMessageService.getCopyMessageListByUser(read);
return ResponseResult.success(MyPageUtil.makeResponseData(flowMessageList, FlowMessage.INSTANCE));
}
/**
* 读取抄送消息,同时更新当前用户对指定抄送消息的读取状态。
*
* @param messageId 消息Id。
* @return 应答结果对象。
*/
@PostMapping("/readCopyTask")
public ResponseResult<Void> readCopyTask(@MyRequestBody Long messageId) {
String errorMessage;
// 验证流程任务的合法性。
FlowMessage flowMessage = flowMessageService.getById(messageId);
if (flowMessage == null) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
}
if (flowMessage.getMessageType() != FlowMessageType.COPY_TYPE) {
errorMessage = "数据验证失败,当前消息不是抄送类型消息!";
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
if (!flowMessageService.isCandidateIdentityOnMessage(messageId)) {
errorMessage = "数据验证失败,当前用户没有权限访问该消息!";
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
flowMessageService.readCopyTask(messageId);
return ResponseResult.success();
}
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowCategory;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* FlowCategory数据操作访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowCategoryMapper extends BaseDaoMapper<FlowCategory> {
/**
* 获取过滤后的对象列表。
*
* @param flowCategoryFilter 主表过滤对象。
* @param orderBy 排序字符串,order by从句的参数。
* @return 对象列表。
*/
List<FlowCategory> getFlowCategoryList(
@Param("flowCategoryFilter") FlowCategory flowCategoryFilter, @Param("orderBy") String orderBy);
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowEntry;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* FlowEntry数据操作访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowEntryMapper extends BaseDaoMapper<FlowEntry> {
/**
* 获取过滤后的对象列表。
*
* @param flowEntryFilter 主表过滤对象。
* @param orderBy 排序字符串,order by从句的参数。
* @return 对象列表。
*/
List<FlowEntry> getFlowEntryList(
@Param("flowEntryFilter") FlowEntry flowEntryFilter, @Param("orderBy") String orderBy);
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowEntryPublish;
/**
* 数据操作访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowEntryPublishMapper extends BaseDaoMapper<FlowEntryPublish> {
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowEntryPublishVariable;
import java.util.List;
/**
* 数据操作访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowEntryPublishVariableMapper extends BaseDaoMapper<FlowEntryPublishVariable> {
/**
* 批量插入流程发布的变量列表。
*
* @param entryPublishVariableList 流程发布的变量列表。
*/
void insertList(List<FlowEntryPublishVariable> entryPublishVariableList);
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowEntryVariable;
import org.apache.ibatis.annotations.Param;
import java.util.*;
/**
* 流程变量数据操作访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowEntryVariableMapper extends BaseDaoMapper<FlowEntryVariable> {
/**
* 获取过滤后的对象列表。
*
* @param flowEntryVariableFilter 主表过滤对象。
* @param orderBy 排序字符串,order by从句的参数。
* @return 对象列表。
*/
List<FlowEntryVariable> getFlowEntryVariableList(
@Param("flowEntryVariableFilter") FlowEntryVariable flowEntryVariableFilter,
@Param("orderBy") String orderBy);
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowMessageCandidateIdentity;
import org.apache.ibatis.annotations.Param;
/**
* 流程任务消息的候选身份数据操作访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowMessageCandidateIdentityMapper extends BaseDaoMapper<FlowMessageCandidateIdentity> {
/**
* 删除指定流程实例的消息关联数据。
*
* @param processInstanceId 流程实例Id。
*/
void deleteByProcessInstanceId(@Param("processInstanceId") String processInstanceId);
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowMessageIdentityOperation;
import org.apache.ibatis.annotations.Param;
/**
* 流程任务消息所属用户的操作数据操作访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowMessageIdentityOperationMapper extends BaseDaoMapper<FlowMessageIdentityOperation> {
/**
* 删除指定流程实例的消息关联数据。
*
* @param processInstanceId 流程实例Id。
*/
void deleteByProcessInstanceId(@Param("processInstanceId") String processInstanceId);
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowMessage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* 工作流消息数据操作访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowMessageMapper extends BaseDaoMapper<FlowMessage> {
/**
* 获取指定用户和身份分组Id集合的催办消息列表。
*
* @param tenantId 租户Id。
* @param appCode 应用编码。
* @param loginName 用户的登录名。与流程任务的assignee精确匹配。
* @param groupIdSet 用户身份分组Id集合。
* @return 查询后的催办消息列表。
*/
List<FlowMessage> getRemindingMessageListByUser(
@Param("tenantId") Long tenantId,
@Param("appCode") String appCode,
@Param("loginName") String loginName,
@Param("groupIdSet") Set<String> groupIdSet);
/**
* 获取指定用户和身份分组Id集合的抄送消息列表。
*
* @param tenantId 租户Id。
* @param appCode 应用编码。
* @param loginName 用户登录名。
* @param groupIdSet 用户身份分组Id集合。
* @param read true表示已读,false表示未读。
* @return 查询后的抄送消息列表。
*/
List<FlowMessage> getCopyMessageListByUser(
@Param("tenantId") Long tenantId,
@Param("appCode") String appCode,
@Param("loginName") String loginName,
@Param("groupIdSet") Set<String> groupIdSet,
@Param("read") Boolean read);
/**
* 计算当前用户催办消息的数量。
*
* @param tenantId 租户Id。
* @param appCode 应用编码。
* @param loginName 用户登录名。
* @param groupIdSet 用户身份分组Id集合。
* @return 数据数量。
*/
int countRemindingMessageListByUser(
@Param("tenantId") Long tenantId,
@Param("appCode") String appCode,
@Param("loginName") String loginName,
@Param("groupIdSet") Set<String> groupIdSet);
/**
* 计算当前用户未读抄送消息的数量。
*
* @param tenantId 租户Id。
* @param appCode 应用编码。
* @param loginName 用户登录名。
* @param groupIdSet 用户身份分组Id集合。
* @return 数据数量
*/
int countCopyMessageListByUser(
@Param("tenantId") Long tenantId,
@Param("appCode") String appCode,
@Param("loginName") String loginName,
@Param("groupIdSet") Set<String> groupIdSet);
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowMultiInstanceTrans;
/**
* 流程多实例任务执行流水访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowMultiInstanceTransMapper extends BaseDaoMapper<FlowMultiInstanceTrans> {
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowTaskComment;
/**
* 流程任务批注数据操作访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowTaskCommentMapper extends BaseDaoMapper<FlowTaskComment> {
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowTaskExt;
import java.util.List;
/**
* 流程任务扩展数据操作访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowTaskExtMapper extends BaseDaoMapper<FlowTaskExt> {
/**
* 批量插入流程任务扩展信息列表。
*
* @param flowTaskExtList 流程任务扩展信息列表。
*/
void insertList(List<FlowTaskExt> flowTaskExtList);
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowTransProducer;
/**
* 事务性业务数据生产者访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowTransProducerMapper extends BaseDaoMapper<FlowTransProducer> {
}
package com.yice.common.flow.dao;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowWorkOrderExt;
/**
* 工作流工单扩展数据操作访问接口。
*
* @author linking
* @date 2023-04-13
*/
public interface FlowWorkOrderExtMapper extends BaseDaoMapper<FlowWorkOrderExt> {
}
package com.yice.common.flow.dao;
import com.yice.common.core.annotation.EnableDataPerm;
import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.flow.model.FlowWorkOrder;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.*;
/**
* 工作流工单表数据操作访问接口。
* 如果当前系统支持数据权限过滤,当前用户必须要能看自己的工单数据,所以需要把EnableDataPerm
* 的mustIncludeUserRule参数设置为true,即便当前用户的数据权限中并不包含DataPermRuleType.TYPE_USER_ONLY,
* 数据过滤拦截组件也会自动补偿该类型的数据权限,以便当前用户可以看到自己发起的工单。
*
* @author linking
* @date 2023-04-13
*/
@EnableDataPerm(mustIncludeUserRule = true)
public interface FlowWorkOrderMapper extends BaseDaoMapper<FlowWorkOrder> {
/**
* 获取过滤后的对象列表。
*
* @param flowWorkOrderFilter 主表过滤对象。
* @param orderBy 排序字符串,order by从句的参数。
* @return 对象列表。
*/
List<FlowWorkOrder> getFlowWorkOrderList(
@Param("flowWorkOrderFilter") FlowWorkOrder flowWorkOrderFilter, @Param("orderBy") String orderBy);
/**
* 计算指定前缀工单编码的最大值。
*
* @param prefix 工单编码前缀。
* @return 该工单编码前缀的最大值。
*/
@Select("SELECT MAX(work_order_code) FROM zz_flow_work_order WHERE work_order_code LIKE '${prefix}'")
String getMaxWorkOrderCodeByPrefix(@Param("prefix") String prefix);
/**
* 根据工单编码查询指定工单,查询过程也会考虑逻辑删除的数据。
* @param workOrderCode 工单编码。
* @return
*/
@Select("SELECT COUNT(*) FROM zz_flow_work_order WHERE work_order_code = #{workOrderCode}")
int getCountByWorkOrderCode(@Param("workOrderCode") String workOrderCode);
}
<?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.yice.common.flow.dao.FlowCategoryMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowCategory">
<id column="category_id" jdbcType="BIGINT" property="categoryId"/>
<result column="tenant_id" jdbcType="BIGINT" property="tenantId"/>
<result column="app_code" jdbcType="VARCHAR" property="appCode"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="show_order" jdbcType="INTEGER" property="showOrder"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
</resultMap>
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
<sql id="filterRef">
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
<include refid="com.yice.common.flow.dao.FlowCategoryMapper.inputFilterRef"/>
</sql>
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
<sql id="inputFilterRef">
<if test="flowCategoryFilter != null">
<if test="flowCategoryFilter.tenantId == null">
AND zz_flow_category.tenant_id IS NULL
</if>
<if test="flowCategoryFilter.tenantId != null">
AND zz_flow_category.tenant_id = #{flowCategoryFilter.tenantId}
</if>
<if test="flowCategoryFilter.appCode == null">
AND zz_flow_category.app_code IS NULL
</if>
<if test="flowCategoryFilter.appCode != null">
AND zz_flow_category.app_code = #{flowCategoryFilter.appCode}
</if>
<if test="flowCategoryFilter.name != null and flowCategoryFilter.name != ''">
AND zz_flow_category.name = #{flowCategoryFilter.name}
</if>
<if test="flowCategoryFilter.code != null and flowCategoryFilter.code != ''">
AND zz_flow_category.code = #{flowCategoryFilter.code}
</if>
</if>
</sql>
<select id="getFlowCategoryList" resultMap="BaseResultMap" parameterType="com.yice.common.flow.model.FlowCategory">
SELECT * FROM zz_flow_category
<where>
<include refid="filterRef"/>
</where>
<if test="orderBy != null and orderBy != ''">
ORDER BY ${orderBy}
</if>
</select>
</mapper>
<?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.yice.common.flow.dao.FlowEntryMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowEntry">
<id column="entry_id" jdbcType="BIGINT" property="entryId"/>
<result column="tenant_id" jdbcType="BIGINT" property="tenantId"/>
<result column="app_code" jdbcType="VARCHAR" property="appCode"/>
<result column="process_definition_name" jdbcType="VARCHAR" property="processDefinitionName"/>
<result column="process_definition_key" jdbcType="VARCHAR" property="processDefinitionKey"/>
<result column="category_id" jdbcType="BIGINT" property="categoryId"/>
<result column="main_entry_publish_id" jdbcType="BIGINT" property="mainEntryPublishId"/>
<result column="latest_publish_time" jdbcType="TIMESTAMP" property="latestPublishTime"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="bpmn_xml" jdbcType="LONGVARCHAR" property="bpmnXml"/>
<result column="diagram_type" jdbcType="INTEGER" property="diagramType"/>
<result column="bind_form_type" jdbcType="INTEGER" property="bindFormType"/>
<result column="page_id" jdbcType="BIGINT" property="pageId"/>
<result column="default_form_id" jdbcType="BIGINT" property="defaultFormId"/>
<result column="default_router_name" jdbcType="VARCHAR" property="defaultRouterName"/>
<result column="encoded_rule" jdbcType="VARCHAR" property="encodedRule"/>
<result column="extension_data" jdbcType="VARCHAR" property="extensionData"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
</resultMap>
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
<sql id="filterRef">
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
<include refid="com.yice.common.flow.dao.FlowEntryMapper.inputFilterRef"/>
</sql>
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
<sql id="inputFilterRef">
<if test="flowEntryFilter != null">
<if test="flowEntryFilter.tenantId == null">
AND zz_flow_entry.tenant_id IS NULL
</if>
<if test="flowEntryFilter.tenantId != null">
AND zz_flow_entry.tenant_id = #{flowEntryFilter.tenantId}
</if>
<if test="flowEntryFilter.appCode == null">
AND zz_flow_entry.app_code IS NULL
</if>
<if test="flowEntryFilter.appCode != null">
AND zz_flow_entry.app_code = #{flowEntryFilter.appCode}
</if>
<if test="flowEntryFilter.processDefinitionName != null and flowEntryFilter.processDefinitionName != ''">
AND zz_flow_entry.process_definition_name = #{flowEntryFilter.processDefinitionName}
</if>
<if test="flowEntryFilter.processDefinitionKey != null and flowEntryFilter.processDefinitionKey != ''">
AND zz_flow_entry.process_definition_key = #{flowEntryFilter.processDefinitionKey}
</if>
<if test="flowEntryFilter.categoryId != null">
AND zz_flow_entry.category_id = #{flowEntryFilter.categoryId}
</if>
<if test="flowEntryFilter.status != null">
AND zz_flow_entry.status = #{flowEntryFilter.status}
</if>
</if>
</sql>
<select id="getFlowEntryList" resultMap="BaseResultMap" parameterType="com.yice.common.flow.model.FlowEntry">
SELECT
entry_id,
app_code,
process_definition_name,
process_definition_key,
category_id,
main_entry_publish_id,
latest_publish_time,
status,
diagram_type,
bind_form_type,
page_id,
default_form_id,
default_router_name,
encoded_rule,
extension_data,
update_time,
update_user_id,
create_time,
create_user_id
FROM
zz_flow_entry
<where>
<include refid="filterRef"/>
</where>
<if test="orderBy != null and orderBy != ''">
ORDER BY ${orderBy}
</if>
</select>
</mapper>
<?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.yice.common.flow.dao.FlowEntryPublishMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowEntryPublish">
<id column="entry_publish_id" jdbcType="BIGINT" property="entryPublishId"/>
<result column="entry_id" jdbcType="BIGINT" property="entryId"/>
<result column="deploy_id" jdbcType="VARCHAR" property="deployId"/>
<result column="process_definition_id" jdbcType="VARCHAR" property="processDefinitionId"/>
<result column="publish_version" jdbcType="INTEGER" property="publishVersion"/>
<result column="active_status" jdbcType="BOOLEAN" property="activeStatus"/>
<result column="main_version" jdbcType="BOOLEAN" property="mainVersion"/>
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
<result column="publish_time" jdbcType="TIMESTAMP" property="publishTime"/>
<result column="init_task_info" jdbcType="VARCHAR" property="initTaskInfo"/>
<result column="analyzed_node_json" jdbcType="VARCHAR" property="analyzedNodeJson"/>
</resultMap>
</mapper>
<?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.yice.common.flow.dao.FlowEntryPublishVariableMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowEntryPublishVariable">
<id column="variable_id" jdbcType="BIGINT" property="variableId"/>
<result column="entry_publish_id" jdbcType="BIGINT" property="entryPublishId"/>
<result column="variable_name" jdbcType="VARCHAR" property="variableName"/>
<result column="show_name" jdbcType="VARCHAR" property="showName"/>
<result column="variable_type" jdbcType="INTEGER" property="variableType"/>
<result column="bind_datasource_id" jdbcType="BIGINT" property="bindDatasourceId"/>
<result column="bind_relation_id" jdbcType="BIGINT" property="bindRelationId"/>
<result column="bind_column_id" jdbcType="BIGINT" property="bindColumnId"/>
<result column="builtin" jdbcType="BOOLEAN" property="builtin"/>
</resultMap>
<insert id="insertList">
INSERT INTO zz_flow_entry_publish_variable VALUES
<foreach collection="list" index="index" item="item" separator="," >
(#{item.variableId},
#{item.entryPublishId},
#{item.variableName},
#{item.showName},
#{item.variableType},
#{item.bindDatasourceId},
#{item.bindRelationId},
#{item.bindColumnId},
#{item.builtin})
</foreach>
</insert>
</mapper>
<?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.yice.common.flow.dao.FlowEntryVariableMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowEntryVariable">
<id column="variable_id" jdbcType="BIGINT" property="variableId"/>
<result column="entry_id" jdbcType="BIGINT" property="entryId"/>
<result column="variable_name" jdbcType="VARCHAR" property="variableName"/>
<result column="show_name" jdbcType="VARCHAR" property="showName"/>
<result column="variable_type" jdbcType="INTEGER" property="variableType"/>
<result column="bind_datasource_id" jdbcType="BIGINT" property="bindDatasourceId"/>
<result column="bind_relation_id" jdbcType="BIGINT" property="bindRelationId"/>
<result column="bind_column_id" jdbcType="BIGINT" property="bindColumnId"/>
<result column="builtin" jdbcType="BOOLEAN" property="builtin"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap>
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
<sql id="filterRef">
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
<include refid="com.yice.common.flow.dao.FlowEntryVariableMapper.inputFilterRef"/>
</sql>
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
<sql id="inputFilterRef">
<if test="flowEntryVariableFilter != null">
<if test="flowEntryVariableFilter.entryId != null">
AND zz_flow_entry_variable.entry_id = #{flowEntryVariableFilter.entryId}
</if>
</if>
</sql>
<select id="getFlowEntryVariableList" resultMap="BaseResultMap" parameterType="com.yice.common.flow.model.FlowEntryVariable">
SELECT * FROM zz_flow_entry_variable
<where>
<include refid="filterRef"/>
</where>
<if test="orderBy != null and orderBy != ''">
ORDER BY ${orderBy}
</if>
</select>
</mapper>
<?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.yice.common.flow.dao.FlowMessageCandidateIdentityMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowMessageCandidateIdentity">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="message_id" jdbcType="BIGINT" property="messageId"/>
<result column="candidate_type" jdbcType="VARCHAR" property="candidateType"/>
<result column="candidate_id" jdbcType="VARCHAR" property="candidateId"/>
</resultMap>
<delete id="deleteByProcessInstanceId">
DELETE FROM zz_flow_msg_candidate_identity a
WHERE EXISTS (SELECT * FROM zz_flow_message b
WHERE a.message_id = b.message_id AND b.process_instance_id = #{processInstanceId})
</delete>
</mapper>
<?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.yice.common.flow.dao.FlowMessageIdentityOperationMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowMessageIdentityOperation">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="message_id" jdbcType="BIGINT" property="messageId"/>
<result column="login_name" jdbcType="VARCHAR" property="loginName"/>
<result column="operation_type" jdbcType="INTEGER" property="operationType"/>
<result column="operation_time" jdbcType="TIMESTAMP" property="operationTime"/>
</resultMap>
<delete id="deleteByProcessInstanceId">
DELETE FROM zz_flow_msg_identity_operation a
WHERE EXISTS (SELECT * FROM zz_flow_message b
WHERE a.message_id = b.message_id AND b.process_instance_id = #{processInstanceId})
</delete>
</mapper>
<?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.yice.common.flow.dao.FlowMessageMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowMessage">
<id column="message_id" jdbcType="BIGINT" property="messageId"/>
<result column="tenant_id" jdbcType="BIGINT" property="tenantId"/>
<result column="app_code" jdbcType="VARCHAR" property="appCode"/>
<result column="message_type" jdbcType="TINYINT" property="messageType"/>
<result column="message_content" jdbcType="VARCHAR" property="messageContent"/>
<result column="remind_count" jdbcType="INTEGER" property="remindCount"/>
<result column="work_order_id" jdbcType="BIGINT" property="workOrderId"/>
<result column="process_definition_id" jdbcType="VARCHAR" property="processDefinitionId"/>
<result column="process_definition_key" jdbcType="VARCHAR" property="processDefinitionKey"/>
<result column="process_definition_name" jdbcType="VARCHAR" property="processDefinitionName"/>
<result column="process_instance_id" jdbcType="VARCHAR" property="processInstanceId"/>
<result column="process_instance_initiator" jdbcType="VARCHAR" property="processInstanceInitiator"/>
<result column="task_id" jdbcType="VARCHAR" property="taskId"/>
<result column="task_definition_key" jdbcType="VARCHAR" property="taskDefinitionKey"/>
<result column="task_name" jdbcType="VARCHAR" property="taskName"/>
<result column="task_start_time" jdbcType="TIMESTAMP" property="taskStartTime"/>
<result column="task_assignee" jdbcType="VARCHAR" property="taskAssignee"/>
<result column="task_finished" jdbcType="BOOLEAN" property="taskFinished"/>
<result column="business_data_shot" jdbcType="LONGVARCHAR" property="businessDataShot"/>
<result column="online_form_data" jdbcType="BOOLEAN" property="onlineFormData"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
<result column="create_username" jdbcType="VARCHAR" property="createUsername"/>
</resultMap>
<sql id="filterRef">
<if test="tenantId == null">
AND a.tenant_id IS NULL
</if>
<if test="tenantId != null">
AND a.tenant_id = #{tenantId}
</if>
<if test="appCode == null">
AND a.app_code IS NULL
</if>
<if test="appCode != null">
AND a.app_code = #{appCode}
</if>
</sql>
<select id="getRemindingMessageListByUser" resultMap="BaseResultMap">
SELECT a.* FROM zz_flow_message a
<where>
<include refid="filterRef"/>
AND a.task_finished = false
AND a.message_type = 0
AND (a.task_assignee = #{loginName} OR EXISTS (SELECT * FROM zz_flow_msg_candidate_identity b
WHERE a.message_id = b.message_id AND b.candidate_id IN
<foreach collection="groupIdSet" index="index" item="item" separator="," open="(" close=")">
#{item}
</foreach>))
</where>
ORDER BY a.update_time DESC
</select>
<select id="getCopyMessageListByUser" resultMap="BaseResultMap">
SELECT a.* FROM zz_flow_message a
<where>
<include refid="filterRef"/>
AND a.message_type = 1
AND EXISTS (SELECT * FROM zz_flow_msg_candidate_identity b
WHERE a.message_id = b.message_id AND b.candidate_id IN
<foreach collection="groupIdSet" index="index" item="item" separator="," open="(" close=")">
#{item}
</foreach>)
<if test="!read">
AND NOT EXISTS (SELECT * FROM zz_flow_msg_identity_operation c
WHERE a.message_id = c.message_id AND c.login_name = #{loginName})
</if>
<if test="read">
AND EXISTS (SELECT * FROM zz_flow_msg_identity_operation c
WHERE a.message_id = c.message_id AND c.login_name = #{loginName})
</if>
</where>
ORDER BY a.update_time DESC
</select>
<select id="countRemindingMessageListByUser" resultType="java.lang.Integer">
SELECT COUNT(1) FROM zz_flow_message a
<where>
<include refid="filterRef"/>
AND a.task_finished = false
AND a.message_type = 0
AND (a.task_assignee = #{loginName} OR EXISTS (SELECT * FROM zz_flow_msg_candidate_identity b
WHERE a.message_id = b.message_id AND b.candidate_id IN
<foreach collection="groupIdSet" index="index" item="item" separator="," open="(" close=")">
#{item}
</foreach>))
</where>
</select>
<select id="countCopyMessageListByUser" resultType="java.lang.Integer">
SELECT COUNT(1) FROM zz_flow_message a
<where>
<include refid="filterRef"/>
AND a.message_type = 1
AND EXISTS (SELECT * FROM zz_flow_msg_candidate_identity b
WHERE a.message_id = b.message_id AND b.candidate_id IN
<foreach collection="groupIdSet" index="index" item="item" separator="," open="(" close=")">
#{item}
</foreach>)
AND NOT EXISTS (SELECT * FROM zz_flow_msg_identity_operation c
WHERE a.message_id = c.message_id AND c.login_name = #{loginName})
</where>
</select>
</mapper>
<?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.yice.common.flow.dao.FlowMultiInstanceTransMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowMultiInstanceTrans">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="process_instance_id" jdbcType="VARCHAR" property="processInstanceId"/>
<result column="task_id" jdbcType="VARCHAR" property="taskId"/>
<result column="task_key" jdbcType="VARCHAR" property="taskKey"/>
<result column="multi_instance_exec_id" jdbcType="VARCHAR" property="multiInstanceExecId"/>
<result column="execution_id" jdbcType="VARCHAR" property="executionId"/>
<result column="assignee_list" jdbcType="LONGVARCHAR" property="assigneeList"/>
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
<result column="create_login_name" jdbcType="VARCHAR" property="createLoginName"/>
<result column="create_username" jdbcType="VARCHAR" property="createUsername"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap>
</mapper>
<?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.yice.common.flow.dao.FlowTaskCommentMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowTaskComment">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="process_instance_id" jdbcType="VARCHAR" property="processInstanceId"/>
<result column="task_id" jdbcType="VARCHAR" property="taskId"/>
<result column="task_key" jdbcType="VARCHAR" property="taskKey"/>
<result column="task_name" jdbcType="VARCHAR" property="taskName"/>
<result column="target_task_key" jdbcType="VARCHAR" property="targetTaskKey"/>
<result column="execution_id" jdbcType="VARCHAR" property="executionId"/>
<result column="multi_instance_exec_id" jdbcType="VARCHAR" property="multiInstanceExecId"/>
<result column="approval_type" jdbcType="VARCHAR" property="approvalType"/>
<result column="delegate_assignee" jdbcType="VARCHAR" property="delegateAssignee"/>
<result column="custom_business_data" jdbcType="LONGVARCHAR" property="customBusinessData"/>
<result column="task_comment" jdbcType="VARCHAR" property="taskComment"/>
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
<result column="create_login_name" jdbcType="VARCHAR" property="createLoginName"/>
<result column="create_username" jdbcType="VARCHAR" property="createUsername"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap>
</mapper>
<?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.yice.common.flow.dao.FlowTaskExtMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowTaskExt">
<result column="process_definition_id" jdbcType="VARCHAR" property="processDefinitionId"/>
<result column="task_id" jdbcType="VARCHAR" property="taskId"/>
<result column="operation_list_json" jdbcType="LONGVARCHAR" property="operationListJson"/>
<result column="variable_list_json" jdbcType="LONGVARCHAR" property="variableListJson"/>
<result column="assignee_list_json" jdbcType="LONGVARCHAR" property="assigneeListJson"/>
<result column="group_type" jdbcType="VARCHAR" property="groupType"/>
<result column="dept_post_list_json" jdbcType="VARCHAR" property="deptPostListJson"/>
<result column="role_ids" jdbcType="VARCHAR" property="roleIds"/>
<result column="dept_ids" jdbcType="VARCHAR" property="deptIds"/>
<result column="candidate_usernames" jdbcType="VARCHAR" property="candidateUsernames"/>
<result column="copy_list_json" jdbcType="VARCHAR" property="copyListJson"/>
<result column="extra_data_json" jdbcType="VARCHAR" property="extraDataJson"/>
</resultMap>
<insert id="insertList">
INSERT INTO zz_flow_task_ext VALUES
<foreach collection="list" index="index" item="item" separator="," >
(#{item.processDefinitionId},
#{item.taskId},
#{item.operationListJson},
#{item.variableListJson},
#{item.assigneeListJson},
#{item.groupType},
#{item.deptPostListJson},
#{item.roleIds},
#{item.deptIds},
#{item.candidateUsernames},
#{item.copyListJson},
#{item.extraDataJson})
</foreach>
</insert>
</mapper>
<?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.yice.common.flow.dao.FlowTransProducerMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowTransProducer">
<id column="trans_id" jdbcType="BIGINT" property="transId"/>
<result column="app_code" jdbcType="VARCHAR" property="appCode"/>
<result column="dblink_id" jdbcType="BIGINT" property="dblinkId"/>
<result column="process_instance_id" jdbcType="VARCHAR" property="processInstanceId"/>
<result column="task_id" jdbcType="VARCHAR" property="taskId"/>
<result column="task_key" jdbcType="VARCHAR" property="taskKey"/>
<result column="task_name" jdbcType="VARCHAR" property="taskName"/>
<result column="task_comment" jdbcType="VARCHAR" property="taskComment"/>
<result column="url" jdbcType="VARCHAR" property="url"/>
<result column="init_method" jdbcType="VARCHAR" property="initMethod"/>
<result column="trace_id" jdbcType="VARCHAR" property="traceId"/>
<result column="sql_data" jdbcType="LONGVARCHAR" property="sqlData"/>
<result column="try_times" jdbcType="INTEGER" property="tryTimes"/>
<result column="error_reason" jdbcType="LONGVARCHAR" property="errorReason"/>
<result column="create_login_name" jdbcType="VARCHAR" property="createUsername"/>
<result column="create_username" jdbcType="VARCHAR" property="createLoginName"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap>
</mapper>
<?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.yice.common.flow.dao.FlowWorkOrderExtMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowWorkOrderExt">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="work_order_id" jdbcType="BIGINT" property="workOrderId"/>
<result column="draft_data" jdbcType="LONGVARCHAR" property="draftData"/>
<result column="business_data" jdbcType="LONGVARCHAR" property="businessData"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
</resultMap>
</mapper>
<?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.yice.common.flow.dao.FlowWorkOrderMapper">
<resultMap id="BaseResultMap" type="com.yice.common.flow.model.FlowWorkOrder">
<id column="work_order_id" jdbcType="BIGINT" property="workOrderId"/>
<result column="tenant_id" jdbcType="BIGINT" property="tenantId"/>
<result column="app_code" jdbcType="VARCHAR" property="appCode"/>
<result column="work_order_code" jdbcType="VARCHAR" property="workOrderCode"/>
<result column="process_definition_key" jdbcType="VARCHAR" property="processDefinitionKey"/>
<result column="process_definition_name" jdbcType="VARCHAR" property="processDefinitionName"/>
<result column="process_definition_id" jdbcType="VARCHAR" property="processDefinitionId"/>
<result column="process_instance_id" jdbcType="VARCHAR" property="processInstanceId"/>
<result column="online_table_id" jdbcType="BIGINT" property="onlineTableId"/>
<result column="table_name" jdbcType="VARCHAR" property="tableName"/>
<result column="business_key" jdbcType="VARCHAR" property="businessKey"/>
<result column="latest_approval_status" jdbcType="INTEGER" property="latestApprovalStatus"/>
<result column="flow_status" jdbcType="INTEGER" property="flowStatus"/>
<result column="submit_username" jdbcType="VARCHAR" property="submitUsername"/>
<result column="dept_id" jdbcType="BIGINT" property="deptId"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
</resultMap>
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
<sql id="filterRef">
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
<include refid="com.yice.common.flow.dao.FlowWorkOrderMapper.inputFilterRef"/>
AND zz_flow_work_order.deleted_flag = ${@com.yice.common.core.constant.GlobalDeletedFlag@NORMAL}
</sql>
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
<sql id="inputFilterRef">
<if test="flowWorkOrderFilter != null">
<if test="flowWorkOrderFilter.tenantId == null">
AND zz_flow_work_order.tenant_id IS NULL
</if>
<if test="flowWorkOrderFilter.tenantId != null">
AND zz_flow_work_order.tenant_id = #{flowWorkOrderFilter.tenantId}
</if>
<if test="flowWorkOrderFilter.appCode == null">
AND zz_flow_work_order.app_code IS NULL
</if>
<if test="flowWorkOrderFilter.appCode != null">
AND zz_flow_work_order.app_code = #{flowWorkOrderFilter.appCode}
</if>
<if test="flowWorkOrderFilter.workOrderCode != null and flowWorkOrderFilter.workOrderCode != ''">
AND zz_flow_work_order.work_order_code = #{flowWorkOrderFilter.workOrderCode}
</if>
<if test="flowWorkOrderFilter.processDefinitionKey != null and flowWorkOrderFilter.processDefinitionKey != ''">
AND zz_flow_work_order.process_definition_key = #{flowWorkOrderFilter.processDefinitionKey}
</if>
<if test="flowWorkOrderFilter.latestApprovalStatus != null">
AND zz_flow_work_order.latest_approval_status = #{flowWorkOrderFilter.latestApprovalStatus}
</if>
<if test="flowWorkOrderFilter.flowStatus != null">
AND zz_flow_work_order.flow_status = #{flowWorkOrderFilter.flowStatus}
</if>
<if test="flowWorkOrderFilter.createTimeStart != null and flowWorkOrderFilter.createTimeStart != ''">
AND zz_flow_work_order.create_time &gt;= #{flowWorkOrderFilter.createTimeStart}
</if>
<if test="flowWorkOrderFilter.createTimeEnd != null and flowWorkOrderFilter.createTimeEnd != ''">
AND zz_flow_work_order.create_time &lt;= #{flowWorkOrderFilter.createTimeEnd}
</if>
<if test="flowWorkOrderFilter.createUserId != null">
AND zz_flow_work_order.create_user_id = #{flowWorkOrderFilter.createUserId}
</if>
</if>
</sql>
<select id="getFlowWorkOrderList" resultMap="BaseResultMap" parameterType="com.yice.common.flow.model.FlowWorkOrder">
SELECT * FROM zz_flow_work_order
<where>
<include refid="filterRef"/>
</where>
<if test="orderBy != null and orderBy != ''">
ORDER BY ${orderBy}
</if>
</select>
</mapper>
package com.yice.common.flow.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yice.common.core.validator.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 流程分类的Dto对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("流程分类的Dto对象")
@Data
public class FlowCategoryDto {
/**
* 主键Id。
*/
@ApiModelProperty(value = "主键Id")
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
private Long categoryId;
/**
* 显示名称。
*/
@ApiModelProperty(value = "显示名称")
@NotBlank(message = "数据验证失败,显示名称不能为空!")
private String name;
/**
* 分类编码。
*/
@ApiModelProperty(value = "分类编码")
@NotBlank(message = "数据验证失败,分类编码不能为空!")
private String code;
/**
* 实现顺序。
*/
@ApiModelProperty(value = "实现顺序")
@NotNull(message = "数据验证失败,实现顺序不能为空!")
private Integer showOrder;
}
package com.yice.common.flow.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yice.common.core.validator.ConstDictRef;
import com.yice.common.core.validator.UpdateGroup;
import com.yice.common.flow.model.constant.FlowBindFormType;
import com.yice.common.flow.model.constant.FlowEntryStatus;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 流程的Dto对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("流程的Dto对象")
@Data
public class FlowEntryDto {
/**
* 主键Id。
*/
@ApiModelProperty(value = "主键Id")
@NotNull(message = "数据验证失败,主键不能为空!", groups = {UpdateGroup.class})
private Long entryId;
/**
* 流程名称。
*/
@ApiModelProperty(value = "流程名称")
@NotBlank(message = "数据验证失败,流程名称不能为空!")
private String processDefinitionName;
/**
* 流程标识Key。
*/
@ApiModelProperty(value = "流程标识Key")
@NotBlank(message = "数据验证失败,流程标识Key不能为空!")
private String processDefinitionKey;
/**
* 流程分类。
*/
@ApiModelProperty(value = "流程分类")
@NotNull(message = "数据验证失败,流程分类不能为空!")
private Long categoryId;
/**
* 流程状态。
*/
@ApiModelProperty(value = "流程状态")
@ConstDictRef(constDictClass = FlowEntryStatus.class, message = "数据验证失败,工作流状态为无效值!")
private Integer status;
/**
* 流程定义的xml。
*/
@ApiModelProperty(value = "流程定义的xml")
private String bpmnXml;
/**
* 流程图类型。0: 普通流程图,1: 钉钉风格的流程图。
*/
@ApiModelProperty(value = "流程图类型。0: 普通流程图,1: 钉钉风格的流程图。")
private Integer diagramType;
/**
* 绑定表单类型。
*/
@ApiModelProperty(value = "绑定表单类型")
@ConstDictRef(constDictClass = FlowBindFormType.class, message = "数据验证失败,工作流绑定表单类型为无效值!")
@NotNull(message = "数据验证失败,工作流绑定表单类型不能为空!")
private Integer bindFormType;
/**
* 在线表单的页面Id。
*/
@ApiModelProperty(value = "在线表单的页面Id")
private Long pageId;
/**
* 在线表单的缺省路由名称。
*/
@ApiModelProperty(value = "在线表单的缺省路由名称")
private String defaultRouterName;
/**
* 在线表单Id。
*/
@ApiModelProperty(value = "在线表单Id")
private Long defaultFormId;
/**
* 工单表编码字段的编码规则,如果为空则不计算工单编码。
*/
@ApiModelProperty(value = "工单表编码字段的编码规则")
private String encodedRule;
/**
* 流程的自定义扩展数据(JSON格式)。
*/
@ApiModelProperty(value = "流程的自定义扩展数据")
private String extensionData;
}
package com.yice.common.flow.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yice.common.core.validator.ConstDictRef;
import com.yice.common.core.validator.UpdateGroup;
import com.yice.common.flow.model.constant.FlowVariableType;
import lombok.Data;
import javax.validation.constraints.*;
/**
* 流程变量Dto对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("流程变量Dto对象")
@Data
public class FlowEntryVariableDto {
/**
* 主键Id。
*/
@ApiModelProperty(value = "主键Id")
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
private Long variableId;
/**
* 流程Id。
*/
@ApiModelProperty(value = "流程Id")
@NotNull(message = "数据验证失败,流程Id不能为空!")
private Long entryId;
/**
* 变量名。
*/
@ApiModelProperty(value = "变量名")
@NotBlank(message = "数据验证失败,变量名不能为空!")
private String variableName;
/**
* 显示名。
*/
@ApiModelProperty(value = "显示名")
@NotBlank(message = "数据验证失败,显示名不能为空!")
private String showName;
/**
* 流程变量类型。
*/
@ApiModelProperty(value = "流程变量类型")
@ConstDictRef(constDictClass = FlowVariableType.class, message = "数据验证失败,流程变量类型为无效值!")
@NotNull(message = "数据验证失败,流程变量类型不能为空!")
private Integer variableType;
/**
* 绑定数据源Id。
*/
@ApiModelProperty(value = "绑定数据源Id")
private Long bindDatasourceId;
/**
* 绑定数据源关联Id。
*/
@ApiModelProperty(value = "绑定数据源关联Id")
private Long bindRelationId;
/**
* 绑定字段Id。
*/
@ApiModelProperty(value = "绑定字段Id")
private Long bindColumnId;
/**
* 是否内置。
*/
@ApiModelProperty(value = "是否内置")
@NotNull(message = "数据验证失败,是否内置不能为空!")
private Boolean builtin;
}
package com.yice.common.flow.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 工作流通知消息Dto对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("工作流通知消息Dto对象")
@Data
public class FlowMessageDto {
/**
* 消息类型。
*/
@ApiModelProperty(value = "消息类型")
private Integer messageType;
/**
* 工单Id。
*/
@ApiModelProperty(value = "工单Id")
private Long workOrderId;
/**
* 流程名称。
*/
@ApiModelProperty(value = "流程名称")
private String processDefinitionName;
/**
* 流程任务名称。
*/
@ApiModelProperty(value = "流程任务名称")
private String taskName;
/**
* 更新时间范围过滤起始值(>=)。
*/
@ApiModelProperty(value = "updateTime 范围过滤起始值")
private String updateTimeStart;
/**
* 更新时间范围过滤结束值(<=)。
*/
@ApiModelProperty(value = "updateTime 范围过滤结束值")
private String updateTimeEnd;
}
package com.yice.common.flow.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 流程任务的批注。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("流程任务的批注")
@Data
public class FlowTaskCommentDto {
/**
* 流程任务触发按钮类型,内置值可参考FlowTaskButton。
*/
@ApiModelProperty(value = "流程任务触发按钮类型")
@NotNull(message = "数据验证失败,任务的审批类型不能为空!")
private String approvalType;
/**
* 流程任务的批注内容。
*/
@ApiModelProperty(value = "流程任务的批注内容")
@NotBlank(message = "数据验证失败,任务审批内容不能为空!")
private String taskComment;
/**
* 委托指定人,比如加签、转办等。
*/
@ApiModelProperty(value = "委托指定人,比如加签、转办等")
private String delegateAssignee;
}
package com.yice.common.flow.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 工作流工单Dto对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("工作流工单Dto对象")
@Data
public class FlowWorkOrderDto {
/**
* 工单编码。
*/
@ApiModelProperty(value = "工单编码")
private String workOrderCode;
/**
* 流程状态。参考FlowTaskStatus常量值对象。
*/
@ApiModelProperty(value = "流程状态")
private Integer flowStatus;
/**
* createTime 范围过滤起始值(>=)。
*/
@ApiModelProperty(value = "createTime 范围过滤起始值")
private String createTimeStart;
/**
* createTime 范围过滤结束值(<=)。
*/
@ApiModelProperty(value = "createTime 范围过滤结束值")
private String createTimeEnd;
}
package com.yice.common.flow.exception;
/**
* 流程操作异常。
*
* @author linking
* @date 2023-04-13
*/
public class FlowOperationException extends RuntimeException {
/**
* 构造函数。
*/
public FlowOperationException() {
}
/**
* 构造函数。
*
* @param throwable 引发异常对象。
*/
public FlowOperationException(Throwable throwable) {
super(throwable);
}
/**
* 构造函数。
*
* @param msg 错误信息。
*/
public FlowOperationException(String msg) {
super(msg);
}
}
package com.yice.common.flow.listener;
import com.yice.common.flow.constant.FlowConstant;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;
import java.util.Map;
/**
* 当用户任务的候选组为本部门领导岗位时,该监听器会在任务创建时,获取当前流程实例发起人的部门领导。
* 并将其指派为当前任务的候选组。
*
* @author linking
* @date 2023-04-13
*/
@Slf4j
public class DeptPostLeaderListener implements TaskListener {
@Override
public void notify(DelegateTask delegateTask) {
Map<String, Object> variables = delegateTask.getVariables();
if (variables.get(FlowConstant.GROUP_TYPE_DEPT_POST_LEADER_VAR) == null) {
delegateTask.setAssignee(variables.get(FlowConstant.PROC_INSTANCE_START_USER_NAME_VAR).toString());
}
}
}
package com.yice.common.flow.listener;
import cn.hutool.core.util.StrUtil;
import com.yice.common.core.object.GlobalThreadLocal;
import com.yice.common.core.util.ApplicationContextHolder;
import com.yice.common.flow.model.FlowWorkOrder;
import com.yice.common.flow.service.FlowWorkOrderService;
import com.yice.common.flow.constant.FlowTaskStatus;
import com.yice.common.flow.util.FlowCustomExtFactory;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
/**
* 流程实例监听器,在流程实例结束的时候,需要完成一些自定义的业务行为。如:
* 1. 更新流程工单表的审批状态字段。
* 2. 业务数据同步。
*
* @author linking
* @date 2023-04-13
*/
@Slf4j
public class FlowFinishedListener implements ExecutionListener {
private final transient FlowWorkOrderService flowWorkOrderService =
ApplicationContextHolder.getBean(FlowWorkOrderService.class);
private final transient FlowCustomExtFactory flowCustomExtFactory =
ApplicationContextHolder.getBean(FlowCustomExtFactory.class);
@Override
public void notify(DelegateExecution execution) {
if (!StrUtil.equals("end", execution.getEventName())) {
return;
}
boolean enabled = GlobalThreadLocal.setDataFilter(false);
try {
String processInstanceId = execution.getProcessInstanceId();
FlowWorkOrder workOrder = flowWorkOrderService.getFlowWorkOrderByProcessInstanceId(processInstanceId);
if (workOrder == null) {
return;
}
int flowStatus = FlowTaskStatus.FINISHED;
if (workOrder.getFlowStatus().equals(FlowTaskStatus.CANCELLED)
|| workOrder.getFlowStatus().equals(FlowTaskStatus.STOPPED)) {
flowStatus = workOrder.getFlowStatus();
}
workOrder.setFlowStatus(flowStatus);
// 更新流程工单中的流程状态。
flowWorkOrderService.updateFlowStatusByProcessInstanceId(processInstanceId, flowStatus);
if (workOrder.getOnlineTableId() != null) {
// 处理在线表单工作流的自定义状态更新。
flowCustomExtFactory.getOnlineBusinessDataExtHelper().updateFlowStatus(workOrder);
} else {
// 处理路由表单工作里的自定义状态更新。
flowCustomExtFactory.getBusinessDataExtHelper().updateFlowStatus(workOrder);
}
if (flowStatus == FlowTaskStatus.FINISHED) {
// 在线表单不支持该功能,仅限于路由表单工作流可用。
// 可以自行实现审批完成后,将审批中已经通过的数据,同步到业务发布表。
flowCustomExtFactory.getBusinessDataExtHelper().triggerSync(workOrder);
}
} finally {
GlobalThreadLocal.setDataFilter(enabled);
}
}
}
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment