审批流程
parent
6ebf951a71
commit
53dbc16020
@ -0,0 +1,102 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.flow;
|
||||
|
||||
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.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.archives.controller.admin.flow.vo.*;
|
||||
import cn.iocoder.yudao.module.archives.dal.dataobject.flow.FlowDO;
|
||||
import cn.iocoder.yudao.module.archives.convert.flow.FlowConvert;
|
||||
import cn.iocoder.yudao.module.archives.service.flow.FlowService;
|
||||
|
||||
@Tag(name = "管理后台 - 审批流程")
|
||||
@RestController
|
||||
@RequestMapping("/archives/flow")
|
||||
@Validated
|
||||
public class FlowController {
|
||||
|
||||
@Resource
|
||||
private FlowService flowService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建审批流程")
|
||||
@PreAuthorize("@ss.hasPermission('archives:flow:create')")
|
||||
public CommonResult<Long> createFlow(@Valid @RequestBody FlowCreateReqVO createReqVO) {
|
||||
return success(flowService.createFlow(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新审批流程")
|
||||
@PreAuthorize("@ss.hasPermission('archives:flow:update')")
|
||||
public CommonResult<Boolean> updateFlow(@Valid @RequestBody FlowUpdateReqVO updateReqVO) {
|
||||
flowService.updateFlow(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除审批流程")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('archives:flow:delete')")
|
||||
public CommonResult<Boolean> deleteFlow(@RequestParam("id") Long id) {
|
||||
flowService.deleteFlow(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得审批流程")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('archives:flow:query')")
|
||||
public CommonResult<FlowRespVO> getFlow(@RequestParam("id") Long id) {
|
||||
FlowDO flow = flowService.getFlow(id);
|
||||
return success(FlowConvert.INSTANCE.convert(flow));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得审批流程列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('archives:flow:query')")
|
||||
public CommonResult<List<FlowRespVO>> getFlowList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<FlowDO> list = flowService.getFlowList(ids);
|
||||
return success(FlowConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得审批流程分页")
|
||||
@PreAuthorize("@ss.hasPermission('archives:flow:query')")
|
||||
public CommonResult<PageResult<FlowRespVO>> getFlowPage(@Valid FlowPageReqVO pageVO) {
|
||||
PageResult<FlowDO> pageResult = flowService.getFlowPage(pageVO);
|
||||
return success(FlowConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出审批流程 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('archives:flow:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportFlowExcel(@Valid FlowExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<FlowDO> list = flowService.getFlowList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<FlowExcelVO> datas = FlowConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "审批流程.xls", "数据", FlowExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.flow.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 审批流程创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FlowCreateReqVO extends FlowBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.flow.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 审批流程 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class FlowExcelVO {
|
||||
|
||||
@ExcelProperty("主键Id")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("OA/ERP流程编号")
|
||||
private String flowCode;
|
||||
|
||||
@ExcelProperty("凭证id")
|
||||
private Long voucherId;
|
||||
|
||||
@ExcelProperty("凭证号")
|
||||
private String voucherNum;
|
||||
|
||||
@ExcelProperty("业务id")
|
||||
private Long businessId;
|
||||
|
||||
@ExcelProperty("业务类型")
|
||||
private String businessType;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ExcelProperty("业务实体id")
|
||||
private Long companyId;
|
||||
|
||||
@ExcelProperty("业务实体")
|
||||
private String company;
|
||||
|
||||
@ExcelProperty("删除状态")
|
||||
private String delStatus;
|
||||
|
||||
@ExcelProperty("文件后缀")
|
||||
private String suffix;
|
||||
|
||||
@ExcelProperty("文件地址")
|
||||
private String fileUrl;
|
||||
|
||||
@ExcelProperty("绝对路径")
|
||||
private String fileAp;
|
||||
|
||||
@ExcelProperty("流程号")
|
||||
private String flowId;
|
||||
|
||||
@ExcelProperty("摘要")
|
||||
private String note;
|
||||
|
||||
@ExcelProperty("部门id")
|
||||
private Long deptId;
|
||||
|
||||
@ExcelProperty("部门名称")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty("归档id")
|
||||
private Long archiveId;
|
||||
|
||||
@ExcelProperty("归档状态")
|
||||
private String archiveState;
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.flow.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 = "管理后台 - 审批流程分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FlowPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "OA/ERP流程编号")
|
||||
private String flowCode;
|
||||
|
||||
@Schema(description = "凭证id", example = "19145")
|
||||
private Long voucherId;
|
||||
|
||||
@Schema(description = "凭证号")
|
||||
private String voucherNum;
|
||||
|
||||
@Schema(description = "业务id", example = "21987")
|
||||
private Long businessId;
|
||||
|
||||
@Schema(description = "业务类型", example = "2")
|
||||
private String businessType;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "业务实体id", example = "8805")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "业务实体")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "删除状态", example = "2")
|
||||
private String delStatus;
|
||||
|
||||
@Schema(description = "文件后缀")
|
||||
private String suffix;
|
||||
|
||||
@Schema(description = "文件地址", example = "https://www.iocoder.cn")
|
||||
private String fileUrl;
|
||||
|
||||
@Schema(description = "绝对路径")
|
||||
private String fileAp;
|
||||
|
||||
@Schema(description = "流程号", example = "13373")
|
||||
private String flowId;
|
||||
|
||||
@Schema(description = "摘要")
|
||||
private String note;
|
||||
|
||||
@Schema(description = "部门id", example = "31515")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "部门名称", example = "张三")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "归档id", example = "3820")
|
||||
private Long archiveId;
|
||||
|
||||
@Schema(description = "归档状态")
|
||||
private String archiveState;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.flow.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 审批流程 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FlowRespVO extends FlowBaseVO {
|
||||
|
||||
@Schema(description = "主键Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3083")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.flow.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 审批流程更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FlowUpdateReqVO extends FlowBaseVO {
|
||||
|
||||
@Schema(description = "主键Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3083")
|
||||
@NotNull(message = "主键Id不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.archives.convert.flow;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.archives.controller.admin.flow.vo.*;
|
||||
import cn.iocoder.yudao.module.archives.dal.dataobject.flow.FlowDO;
|
||||
|
||||
/**
|
||||
* 审批流程 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface FlowConvert {
|
||||
|
||||
FlowConvert INSTANCE = Mappers.getMapper(FlowConvert.class);
|
||||
|
||||
FlowDO convert(FlowCreateReqVO bean);
|
||||
|
||||
FlowDO convert(FlowUpdateReqVO bean);
|
||||
|
||||
FlowRespVO convert(FlowDO bean);
|
||||
|
||||
List<FlowRespVO> convertList(List<FlowDO> list);
|
||||
|
||||
PageResult<FlowRespVO> convertPage(PageResult<FlowDO> page);
|
||||
|
||||
List<FlowExcelVO> convertList02(List<FlowDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package cn.iocoder.yudao.module.archives.dal.dataobject.flow;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 审批流程 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("archives_flow")
|
||||
@KeySequence("archives_flow_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FlowDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键Id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* OA/ERP流程编号
|
||||
*/
|
||||
private String flowCode;
|
||||
/**
|
||||
* 凭证id
|
||||
*/
|
||||
private Long voucherId;
|
||||
/**
|
||||
* 凭证号
|
||||
*/
|
||||
private String voucherNum;
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private Long businessId;
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private String businessType;
|
||||
/**
|
||||
* 业务实体id
|
||||
*/
|
||||
private Long companyId;
|
||||
/**
|
||||
* 业务实体
|
||||
*/
|
||||
private String company;
|
||||
/**
|
||||
* 删除状态
|
||||
*/
|
||||
private String delStatus;
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
private String suffix;
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
private String fileUrl;
|
||||
/**
|
||||
* 绝对路径
|
||||
*/
|
||||
private String fileAp;
|
||||
/**
|
||||
* 流程号
|
||||
*/
|
||||
private String flowId;
|
||||
/**
|
||||
* 摘要
|
||||
*/
|
||||
private String note;
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
private Long deptId;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
/**
|
||||
* 归档id
|
||||
*/
|
||||
private Long archiveId;
|
||||
/**
|
||||
* 归档状态
|
||||
*/
|
||||
private String archiveState;
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package cn.iocoder.yudao.module.archives.dal.mysql.flow;
|
||||
|
||||
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.archives.dal.dataobject.flow.FlowDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.archives.controller.admin.flow.vo.*;
|
||||
|
||||
/**
|
||||
* 审批流程 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface FlowMapper extends BaseMapperX<FlowDO> {
|
||||
|
||||
default PageResult<FlowDO> selectPage(FlowPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<FlowDO>()
|
||||
.eqIfPresent(FlowDO::getFlowCode, reqVO.getFlowCode())
|
||||
.eqIfPresent(FlowDO::getVoucherId, reqVO.getVoucherId())
|
||||
.eqIfPresent(FlowDO::getVoucherNum, reqVO.getVoucherNum())
|
||||
.eqIfPresent(FlowDO::getBusinessId, reqVO.getBusinessId())
|
||||
.eqIfPresent(FlowDO::getBusinessType, reqVO.getBusinessType())
|
||||
.betweenIfPresent(FlowDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(FlowDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(FlowDO::getCompany, reqVO.getCompany())
|
||||
.eqIfPresent(FlowDO::getDelStatus, reqVO.getDelStatus())
|
||||
.eqIfPresent(FlowDO::getSuffix, reqVO.getSuffix())
|
||||
.eqIfPresent(FlowDO::getFileUrl, reqVO.getFileUrl())
|
||||
.eqIfPresent(FlowDO::getFileAp, reqVO.getFileAp())
|
||||
.eqIfPresent(FlowDO::getFlowId, reqVO.getFlowId())
|
||||
.eqIfPresent(FlowDO::getNote, reqVO.getNote())
|
||||
.eqIfPresent(FlowDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(FlowDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(FlowDO::getArchiveId, reqVO.getArchiveId())
|
||||
.eqIfPresent(FlowDO::getArchiveState, reqVO.getArchiveState())
|
||||
.orderByDesc(FlowDO::getId));
|
||||
}
|
||||
|
||||
default List<FlowDO> selectList(FlowExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<FlowDO>()
|
||||
.eqIfPresent(FlowDO::getFlowCode, reqVO.getFlowCode())
|
||||
.eqIfPresent(FlowDO::getVoucherId, reqVO.getVoucherId())
|
||||
.eqIfPresent(FlowDO::getVoucherNum, reqVO.getVoucherNum())
|
||||
.eqIfPresent(FlowDO::getBusinessId, reqVO.getBusinessId())
|
||||
.eqIfPresent(FlowDO::getBusinessType, reqVO.getBusinessType())
|
||||
.betweenIfPresent(FlowDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(FlowDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(FlowDO::getCompany, reqVO.getCompany())
|
||||
.eqIfPresent(FlowDO::getDelStatus, reqVO.getDelStatus())
|
||||
.eqIfPresent(FlowDO::getSuffix, reqVO.getSuffix())
|
||||
.eqIfPresent(FlowDO::getFileUrl, reqVO.getFileUrl())
|
||||
.eqIfPresent(FlowDO::getFileAp, reqVO.getFileAp())
|
||||
.eqIfPresent(FlowDO::getFlowId, reqVO.getFlowId())
|
||||
.eqIfPresent(FlowDO::getNote, reqVO.getNote())
|
||||
.eqIfPresent(FlowDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(FlowDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(FlowDO::getArchiveId, reqVO.getArchiveId())
|
||||
.eqIfPresent(FlowDO::getArchiveState, reqVO.getArchiveState())
|
||||
.orderByDesc(FlowDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.archives.service.flow;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.archives.controller.admin.flow.vo.*;
|
||||
import cn.iocoder.yudao.module.archives.dal.dataobject.flow.FlowDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 审批流程 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface FlowService {
|
||||
|
||||
/**
|
||||
* 创建审批流程
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createFlow(@Valid FlowCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新审批流程
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateFlow(@Valid FlowUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除审批流程
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteFlow(Long id);
|
||||
|
||||
/**
|
||||
* 获得审批流程
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 审批流程
|
||||
*/
|
||||
FlowDO getFlow(Long id);
|
||||
|
||||
/**
|
||||
* 获得审批流程列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 审批流程列表
|
||||
*/
|
||||
List<FlowDO> getFlowList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得审批流程分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 审批流程分页
|
||||
*/
|
||||
PageResult<FlowDO> getFlowPage(FlowPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得审批流程列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 审批流程列表
|
||||
*/
|
||||
List<FlowDO> getFlowList(FlowExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.archives.service.flow;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.archives.controller.admin.flow.vo.*;
|
||||
import cn.iocoder.yudao.module.archives.dal.dataobject.flow.FlowDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.archives.convert.flow.FlowConvert;
|
||||
import cn.iocoder.yudao.module.archives.dal.mysql.flow.FlowMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.archives.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 审批流程 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class FlowServiceImpl implements FlowService {
|
||||
|
||||
@Resource
|
||||
private FlowMapper flowMapper;
|
||||
|
||||
@Override
|
||||
public Long createFlow(FlowCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
FlowDO flow = FlowConvert.INSTANCE.convert(createReqVO);
|
||||
flowMapper.insert(flow);
|
||||
// 返回
|
||||
return flow.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFlow(FlowUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateFlowExists(updateReqVO.getId());
|
||||
// 更新
|
||||
FlowDO updateObj = FlowConvert.INSTANCE.convert(updateReqVO);
|
||||
flowMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFlow(Long id) {
|
||||
// 校验存在
|
||||
validateFlowExists(id);
|
||||
// 删除
|
||||
flowMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateFlowExists(Long id) {
|
||||
if (flowMapper.selectById(id) == null) {
|
||||
throw exception(FLOW_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowDO getFlow(Long id) {
|
||||
return flowMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowDO> getFlowList(Collection<Long> ids) {
|
||||
return flowMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<FlowDO> getFlowPage(FlowPageReqVO pageReqVO) {
|
||||
return flowMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowDO> getFlowList(FlowExportReqVO exportReqVO) {
|
||||
return flowMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue