审批人范围
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
This commit is contained in:
parent
b5377b23f4
commit
801cea737e
@ -171,6 +171,12 @@
|
||||
<version>1.6.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||
<!-- <artifactId>yudao-module-infra-biz</artifactId>-->
|
||||
<!-- <version>2.1.0-jdk8-snapshot</version>-->
|
||||
<!-- <scope>compile</scope>-->
|
||||
<!-- </dependency>-->
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -1,4 +1,5 @@
|
||||
package cn.iocoder.yudao.framework.common.util.elasticsearch;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
@ -41,10 +42,21 @@ import java.util.Map;
|
||||
* @author pch
|
||||
*/
|
||||
public class EsearchUtils {
|
||||
private static String ipStr = "192.168.1.28";
|
||||
// private static String ipStr = "192.168.1.28";
|
||||
private static String ipStr;
|
||||
private static int port = 9200;
|
||||
private static String modeStr = "http";
|
||||
private static RestHighLevelClient esClient = new RestHighLevelClient(RestClient.builder(new HttpHost(ipStr,port,modeStr)));
|
||||
private static RestHighLevelClient esClient;
|
||||
|
||||
public static void initialize(String ip) {
|
||||
ipStr = ip;
|
||||
// this.port = port;
|
||||
// modeStr = mode;
|
||||
esClient = new RestHighLevelClient(RestClient.builder(new HttpHost(ipStr,port,modeStr)));
|
||||
}
|
||||
|
||||
|
||||
// private static RestHighLevelClient esClient = new RestHighLevelClient(RestClient.builder(new HttpHost(ipStr,port,modeStr)));
|
||||
|
||||
public static <T> void saveIndex(long id,T createReqVO, String indexName) throws IOException {
|
||||
//String indexStatus = null;
|
||||
@ -62,9 +74,9 @@ public class EsearchUtils {
|
||||
esRequest.id(String.valueOf(id));
|
||||
|
||||
esRequest.source(knowObj.toJSONString(), XContentType.JSON);
|
||||
//System.out.println("========保存数据:" + knowObj.toJSONString());
|
||||
// System.out.println("========保存数据:" + knowObj.toJSONString());
|
||||
esRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL);
|
||||
//System.out.println("========保存结果:" + indexResult);
|
||||
// System.out.println("========保存结果:" + indexResult);
|
||||
try {
|
||||
IndexResponse indexResult = esClient.index(esRequest, RequestOptions.DEFAULT);
|
||||
//indexStatus = indexResult.status().toString();
|
||||
|
@ -93,4 +93,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ONLYOF_NOT_EXISTS = new ErrorCode(1_009_020_000 , "文件编辑不存在");
|
||||
// ========== 公共知识 1_009_021_000 ==========
|
||||
ErrorCode KNOWLEDGE_PUBLIC_NOT_EXISTS = new ErrorCode(1_009_021_000, "公共知识不存在");
|
||||
|
||||
// ========== BPM 表单工作流对应 1_009_022_000 ==========
|
||||
ErrorCode FORM_PROCESS_MAPPING_NOT_EXISTS = new ErrorCode(1_009_022_000, "BPM 表单工作流对应不存在");
|
||||
}
|
||||
|
@ -101,5 +101,17 @@
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
<artifactId>thymeleaf-spring5</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-infra-biz</artifactId>
|
||||
<version>2.1.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-infra-biz</artifactId>
|
||||
<version>2.1.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.formprocessmapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.formprocessmapping.vo.*;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.formprocessmapping.FormProcessMappingDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.formprocessmapping.FormProcessMappingService;
|
||||
|
||||
@Tag(name = "管理后台 - BPM 表单工作流对应")
|
||||
@RestController
|
||||
@RequestMapping("/bpm/form-process-mapping")
|
||||
@Validated
|
||||
public class FormProcessMappingController {
|
||||
|
||||
@Resource
|
||||
private FormProcessMappingService formProcessMappingService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建BPM 表单工作流对应")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:form-process-mapping:create')")
|
||||
public CommonResult<Long> createFormProcessMapping(@Valid @RequestBody FormProcessMappingSaveReqVO createReqVO) {
|
||||
return success(formProcessMappingService.createFormProcessMapping(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新BPM 表单工作流对应")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:form-process-mapping:update')")
|
||||
public CommonResult<Boolean> updateFormProcessMapping(@Valid @RequestBody FormProcessMappingSaveReqVO updateReqVO) {
|
||||
formProcessMappingService.updateFormProcessMapping(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除BPM 表单工作流对应")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('bpm:form-process-mapping:delete')")
|
||||
public CommonResult<Boolean> deleteFormProcessMapping(@RequestParam("id") Long id) {
|
||||
formProcessMappingService.deleteFormProcessMapping(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得BPM 表单工作流对应")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:form-process-mapping:query')")
|
||||
public CommonResult<FormProcessMappingRespVO> getFormProcessMapping(@RequestParam("id") Long id) {
|
||||
FormProcessMappingDO formProcessMapping = formProcessMappingService.getFormProcessMapping(id);
|
||||
return success(BeanUtils.toBean(formProcessMapping, FormProcessMappingRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得BPM 表单工作流对应分页")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:form-process-mapping:query')")
|
||||
public CommonResult<PageResult<FormProcessMappingRespVO>> getFormProcessMappingPage(@Valid FormProcessMappingPageReqVO pageReqVO) {
|
||||
PageResult<FormProcessMappingDO> pageResult = formProcessMappingService.getFormProcessMappingPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, FormProcessMappingRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出BPM 表单工作流对应 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:form-process-mapping:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportFormProcessMappingExcel(@Valid FormProcessMappingPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<FormProcessMappingDO> list = formProcessMappingService.getFormProcessMappingPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "BPM 表单工作流对应.xls", "数据", FormProcessMappingRespVO.class,
|
||||
BeanUtils.toBean(list, FormProcessMappingRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.formprocessmapping.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - BPM 表单工作流对应分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FormProcessMappingPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "映射名", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "流程信息")
|
||||
private String processKey;
|
||||
|
||||
@Schema(description = "表单的提交路径")
|
||||
private String formCustomCreatePath;
|
||||
|
||||
@Schema(description = "表单的查看路径")
|
||||
private String formCustomViewPath;
|
||||
|
||||
@Schema(description = "状态(0正常 1停用)", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.formprocessmapping.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
|
||||
@Schema(description = "管理后台 - BPM 表单工作流对应 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class FormProcessMappingRespVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7811")
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "映射名", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@ExcelProperty("映射名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "流程信息")
|
||||
@ExcelProperty("流程信息")
|
||||
private String processKey;
|
||||
|
||||
@Schema(description = "表单的提交路径")
|
||||
@ExcelProperty("表单的提交路径")
|
||||
private String formCustomCreatePath;
|
||||
|
||||
@Schema(description = "表单的查看路径")
|
||||
@ExcelProperty("表单的查看路径")
|
||||
private String formCustomViewPath;
|
||||
|
||||
@Schema(description = "状态(0正常 1停用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty(value = "状态(0正常 1停用)", converter = DictConvert.class)
|
||||
@DictFormat("common_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.formprocessmapping.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - BPM 表单工作流对应新增/修改 Request VO")
|
||||
@Data
|
||||
public class FormProcessMappingSaveReqVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7811")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "映射名", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotEmpty(message = "映射名不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "流程信息")
|
||||
private String processKey;
|
||||
|
||||
@Schema(description = "表单的提交路径")
|
||||
private String formCustomCreatePath;
|
||||
|
||||
@Schema(description = "表单的查看路径")
|
||||
private String formCustomViewPath;
|
||||
|
||||
@Schema(description = "状态(0正常 1停用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态(0正常 1停用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -40,9 +40,6 @@ public class KnowledgeSaveReqVO {
|
||||
|
||||
@Schema(description = "文件路径")
|
||||
private String[] filePath;
|
||||
// private List<JSONObject> filePath;
|
||||
// private List<String> filePath;
|
||||
|
||||
|
||||
@Schema(description = "评论列表")
|
||||
private List<CommentDO> comments;
|
||||
@ -53,4 +50,7 @@ public class KnowledgeSaveReqVO {
|
||||
|
||||
@Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}")
|
||||
private Map<String, List<Long>> startUserSelectAssignees;
|
||||
|
||||
@Schema(description = "流程定义key")
|
||||
private String processDefinitionKey;
|
||||
}
|
||||
|
@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.dataobject.formprocessmapping;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* BPM 表单工作流对应 DO
|
||||
*
|
||||
* @author 君风
|
||||
*/
|
||||
@TableName("bpm_form_process_mapping")
|
||||
@KeySequence("bpm_form_process_mapping_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FormProcessMappingDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 映射名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 流程信息
|
||||
*/
|
||||
private String processKey;
|
||||
/**
|
||||
* 表单的提交路径
|
||||
*/
|
||||
private String formCustomCreatePath;
|
||||
/**
|
||||
* 表单的查看路径
|
||||
*/
|
||||
private String formCustomViewPath;
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*
|
||||
* 枚举 {@link TODO common_status 对应的类}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.mysql.formprocessmapping;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.formprocessmapping.FormProcessMappingDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.formprocessmapping.vo.*;
|
||||
|
||||
/**
|
||||
* BPM 表单工作流对应 Mapper
|
||||
*
|
||||
* @author 君风
|
||||
*/
|
||||
@Mapper
|
||||
public interface FormProcessMappingMapper extends BaseMapperX<FormProcessMappingDO> {
|
||||
|
||||
default PageResult<FormProcessMappingDO> selectPage(FormProcessMappingPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<FormProcessMappingDO>()
|
||||
.likeIfPresent(FormProcessMappingDO::getName, reqVO.getName())
|
||||
.eqIfPresent(FormProcessMappingDO::getProcessKey, reqVO.getProcessKey())
|
||||
.eqIfPresent(FormProcessMappingDO::getFormCustomCreatePath, reqVO.getFormCustomCreatePath())
|
||||
.eqIfPresent(FormProcessMappingDO::getFormCustomViewPath, reqVO.getFormCustomViewPath())
|
||||
.eqIfPresent(FormProcessMappingDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(FormProcessMappingDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(FormProcessMappingDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.formprocessmapping;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.formprocessmapping.vo.*;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.formprocessmapping.FormProcessMappingDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* BPM 表单工作流对应 Service 接口
|
||||
*
|
||||
* @author 君风
|
||||
*/
|
||||
public interface FormProcessMappingService {
|
||||
|
||||
/**
|
||||
* 创建BPM 表单工作流对应
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createFormProcessMapping(@Valid FormProcessMappingSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新BPM 表单工作流对应
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateFormProcessMapping(@Valid FormProcessMappingSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除BPM 表单工作流对应
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteFormProcessMapping(Long id);
|
||||
|
||||
/**
|
||||
* 获得BPM 表单工作流对应
|
||||
*
|
||||
* @param id 编号
|
||||
* @return BPM 表单工作流对应
|
||||
*/
|
||||
FormProcessMappingDO getFormProcessMapping(Long id);
|
||||
|
||||
/**
|
||||
* 获得BPM 表单工作流对应分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return BPM 表单工作流对应分页
|
||||
*/
|
||||
PageResult<FormProcessMappingDO> getFormProcessMappingPage(FormProcessMappingPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.formprocessmapping;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.formprocessmapping.vo.*;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.formprocessmapping.FormProcessMappingDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.formprocessmapping.FormProcessMappingMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* BPM 表单工作流对应 Service 实现类
|
||||
*
|
||||
* @author 君风
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class FormProcessMappingServiceImpl implements FormProcessMappingService {
|
||||
|
||||
@Resource
|
||||
private FormProcessMappingMapper formProcessMappingMapper;
|
||||
|
||||
@Override
|
||||
public Long createFormProcessMapping(FormProcessMappingSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
FormProcessMappingDO formProcessMapping = BeanUtils.toBean(createReqVO, FormProcessMappingDO.class);
|
||||
formProcessMappingMapper.insert(formProcessMapping);
|
||||
// 返回
|
||||
return formProcessMapping.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFormProcessMapping(FormProcessMappingSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateFormProcessMappingExists(updateReqVO.getId());
|
||||
// 更新
|
||||
FormProcessMappingDO updateObj = BeanUtils.toBean(updateReqVO, FormProcessMappingDO.class);
|
||||
formProcessMappingMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFormProcessMapping(Long id) {
|
||||
// 校验存在
|
||||
validateFormProcessMappingExists(id);
|
||||
// 删除
|
||||
formProcessMappingMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateFormProcessMappingExists(Long id) {
|
||||
if (formProcessMappingMapper.selectById(id) == null) {
|
||||
throw exception(FORM_PROCESS_MAPPING_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FormProcessMappingDO getFormProcessMapping(Long id) {
|
||||
return formProcessMappingMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<FormProcessMappingDO> getFormProcessMappingPage(FormProcessMappingPageReqVO pageReqVO) {
|
||||
return formProcessMappingMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.service.config.ConfigService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
@ -46,7 +47,8 @@ import cn.iocoder.yudao.framework.common.util.elasticsearch.EsearchUtils;
|
||||
@Service
|
||||
@Validated
|
||||
public class KnowledgeServiceImpl implements KnowledgeService {
|
||||
public static final String PROCESS_KEY = "my-test-flow03";
|
||||
// public static final String PROCESS_KEY = "pch-qjgl-001";
|
||||
public static String PROCESS_KEY ="";
|
||||
@Resource
|
||||
private KnowledgeMapper knowledgeMapper;
|
||||
@Resource
|
||||
@ -58,14 +60,17 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
||||
private String indexName = "knows_index";
|
||||
|
||||
@Resource
|
||||
private RestHighLevelClient esClient;
|
||||
private ConfigService configService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createKnowledge(Long userId,KnowledgeSaveReqVO createReqVO){
|
||||
PROCESS_KEY = createReqVO.getProcessDefinitionKey();
|
||||
// 插入
|
||||
KnowledgeDO knowledge = BeanUtils.toBean(createReqVO, KnowledgeDO.class)
|
||||
.setUserId(userId).setFlowStatus(BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
knowledgeMapper.insert(knowledge);
|
||||
|
||||
// 插入子表
|
||||
createCommentList(knowledge.getId(), createReqVO.getComments());
|
||||
// 发起 BPM 流程
|
||||
@ -79,6 +84,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
||||
knowledgeMapper.updateById(new KnowledgeDO().setId(knowledge.getId()).setProcessInstanceId(processInstanceId));
|
||||
try {
|
||||
if (isEsFlag){
|
||||
EsearchUtils.initialize(configService.getConfigByKey("esearch.ip").getValue() );
|
||||
EsearchUtils.saveIndex(knowledge.getId(),createReqVO,indexName);
|
||||
}
|
||||
//saveIndex(createReqVO);
|
||||
@ -98,6 +104,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
||||
KnowledgeDO updateObj = BeanUtils.toBean(updateReqVO, KnowledgeDO.class);
|
||||
knowledgeMapper.updateById(updateObj);
|
||||
if (isEsFlag){
|
||||
EsearchUtils.initialize(configService.getConfigByKey("esearch.ip").getValue() );
|
||||
EsearchUtils.updateIndex(updateReqVO.getId(),updateReqVO,indexName);
|
||||
}
|
||||
// 更新子表
|
||||
@ -112,6 +119,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
||||
// 删除
|
||||
knowledgeMapper.deleteById(id);
|
||||
if (isEsFlag){
|
||||
EsearchUtils.initialize(configService.getConfigByKey("esearch.ip").getValue() );
|
||||
EsearchUtils.deleteKmsMainById(id,indexName);
|
||||
}
|
||||
// 删除子表
|
||||
|
Loading…
Reference in New Issue
Block a user