From 7ef86c14c09ca66ebdb2f24ea0980c04666dfb8c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 30 Dec 2021 20:23:50 +0800 Subject: [PATCH] =?UTF-8?q?WfForm=20=3D=E3=80=8BBpmForm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activiti/convert/form/WfFormConvert.java | 36 -------- .../activiti/dal/dataobject/form/WfForm.java | 57 ------------ .../dal/dataobject/form/WfFormData.java | 55 ------------ .../enums/form/WfFormErrorCodeConstants.java | 14 --- .../modules/activiti/package-info.java | 2 - .../activiti/service/form/WfFormService.java | 75 ---------------- .../service/form/impl/WfFormServiceImpl.java | 86 ------------------- .../controller/form/BpmFormController.java} | 61 +++++++------ .../controller/form/vo/BpmFormBaseVO.java} | 4 +- .../form/vo/BpmFormCreateReqVO.java} | 4 +- .../controller/form/vo/BpmFormExcelVO.java} | 10 +-- .../form/vo/BpmFormExportReqVO.java} | 4 +- .../controller/form/vo/BpmFormPageReqVO.java} | 4 +- .../controller/form/vo/BpmFormRespVO.java} | 4 +- .../form/vo/BpmFormUpdateReqVO.java} | 4 +- .../bpm/convert/form/BpmFormConvert.java | 36 ++++++++ .../bpm/dal/dataobject/form/BpmForm.java | 8 ++ .../bpm/dal/dataobject/form/BpmFormData.java | 6 +- .../dal/mysql/form/BpmFormMapper.java} | 23 +++-- .../bpm/enums/BpmErrorCodeConstants.java | 6 +- .../bpm/service/form/BpmFormService.java | 76 ++++++++++++++++ .../bpm/service/form/BpmFormServiceImpl.java | 85 ++++++++++++++++++ .../config/YudaoActivitiConfiguration.java | 19 +--- 23 files changed, 275 insertions(+), 404 deletions(-) delete mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/form/WfFormConvert.java delete mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/form/WfForm.java delete mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/form/WfFormData.java delete mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/enums/form/WfFormErrorCodeConstants.java delete mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/package-info.java delete mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/form/WfFormService.java delete mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/form/impl/WfFormServiceImpl.java rename yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/{activiti/controller/form/WlFormController.java => bpm/controller/form/BpmFormController.java} (53%) rename yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/{activiti/controller/form/vo/WfFormBaseVO.java => bpm/controller/form/vo/BpmFormBaseVO.java} (87%) rename yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/{activiti/controller/form/vo/WfFormCreateReqVO.java => bpm/controller/form/vo/BpmFormCreateReqVO.java} (56%) rename yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/{activiti/controller/form/vo/WfFormExcelVO.java => bpm/controller/form/vo/BpmFormExcelVO.java} (77%) rename yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/{activiti/controller/form/vo/WfFormExportReqVO.java => bpm/controller/form/vo/BpmFormExportReqVO.java} (90%) rename yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/{activiti/controller/form/vo/WfFormPageReqVO.java => bpm/controller/form/vo/BpmFormPageReqVO.java} (89%) rename yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/{activiti/controller/form/vo/WfFormRespVO.java => bpm/controller/form/vo/BpmFormRespVO.java} (74%) rename yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/{activiti/controller/form/vo/WfFormUpdateReqVO.java => bpm/controller/form/vo/BpmFormUpdateReqVO.java} (72%) create mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/form/BpmFormConvert.java rename yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/{activiti/dal/mysql/form/WfFormMapper.java => bpm/dal/mysql/form/BpmFormMapper.java} (58%) create mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormService.java create mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormServiceImpl.java diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/form/WfFormConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/form/WfFormConvert.java deleted file mode 100644 index ad07fafe8..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/form/WfFormConvert.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.convert.form; - -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormCreateReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExcelVO; -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormRespVO; -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormUpdateReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -/** - * 动态表单 Convert - * - * @author 芋艿 - */ -@Mapper -public interface WfFormConvert { - - WfFormConvert INSTANCE = Mappers.getMapper(WfFormConvert.class); - - WfForm convert(WfFormCreateReqVO bean); - - WfForm convert(WfFormUpdateReqVO bean); - - WfFormRespVO convert(WfForm bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/form/WfForm.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/form/WfForm.java deleted file mode 100644 index 0fa276d76..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/form/WfForm.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form; - -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; -import lombok.*; - -import java.util.List; - -/** - * 工作流的表单定义 - * 用于工作流的申请表单,需要动态配置的场景 - * - * @author 芋道源码 - */ -@TableName(value = "wf_form", autoResultMap = true) -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class WfForm extends BaseDO { - - /** - * 编号 - */ - @TableId - private Long id; - /** - * 表单名 - */ - private String name; - /** - * 状态 - */ - private Integer status; - /** - * 表单JSON - */ - private String formJson; - /** - * 表单配置 - * - * 目前直接将 https://github.com/JakHuang/form-generator 生成的 JSON 串,直接保存 - * 定义:https://github.com/JakHuang/form-generator/issues/46 - */ - @TableField(typeHandler = JacksonTypeHandler.class) - private List fields; - /** - * 备注 - */ - private String remark; - -} \ No newline at end of file diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/form/WfFormData.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/form/WfFormData.java deleted file mode 100644 index 507a26ec6..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/form/WfFormData.java +++ /dev/null @@ -1,55 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form; - -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; -import lombok.*; - -import java.util.List; -import java.util.Map; - -/** - * 工作流的表单结果 - * 用户每次填写工作流的申请表单时,会保存一条记录到该表】 - * - * @author 芋道源码 - */ -@TableName(value = "wf_form", autoResultMap = true) -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class WfFormData extends BaseDO { - - /** - * 编号 - */ - private Long id; - /** - * 表单编号 - * - * 关联 {@link WfForm#getId()} - */ - private Long formId; - /** - * 状态 - */ - private Integer status; - /** - * 表单配置 - * - * 冗余 {@link WfForm#getFields()} - * 主要考虑,表单是可以修改的 - */ - @TableField(typeHandler = JacksonTypeHandler.class) - private List fields; - /** - * 表单值 - */ - @TableField(typeHandler = JacksonTypeHandler.class) - private Map values; - -} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/enums/form/WfFormErrorCodeConstants.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/enums/form/WfFormErrorCodeConstants.java deleted file mode 100644 index a771441d1..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/enums/form/WfFormErrorCodeConstants.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.enums.form; - -import cn.iocoder.yudao.framework.common.exception.ErrorCode; - -/** - * activiti 系统 错误码枚举类 - * - * 003 activiti - * 001 oa - * activiti 系统,使用 1-003-000-000 段 - */ -public interface WfFormErrorCodeConstants { - ErrorCode FORM_NOT_EXISTS = new ErrorCode(1003001002, "动态表单不存在"); -} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/package-info.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/package-info.java deleted file mode 100644 index 94828f5a7..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/package-info.java +++ /dev/null @@ -1,2 +0,0 @@ -// TODO @芋艿:思考下 activiti、oa 的定位,边界,模块的拆分 -package cn.iocoder.yudao.adminserver.modules.activiti; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/form/WfFormService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/form/WfFormService.java deleted file mode 100644 index 80f60631a..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/form/WfFormService.java +++ /dev/null @@ -1,75 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.service.form; - -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormCreateReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExportReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormPageReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormUpdateReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import java.util.*; -import javax.validation.*; - - -/** - * 动态表单 Service 接口 - * - * TODO @风里雾里 - */ -public interface WfFormService { - - /** - * 创建动态表单 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createForm(@Valid WfFormCreateReqVO createReqVO); - - /** - * 更新动态表单 - * - * @param updateReqVO 更新信息 - */ - void updateForm(@Valid WfFormUpdateReqVO updateReqVO); - - /** - * 删除动态表单 - * - * @param id 编号 - */ - void deleteForm(Long id); - - /** - * 获得动态表单 - * - * @param id 编号 - * @return 动态表单 - */ - WfForm getForm(Long id); - - /** - * 获得动态表单列表 - * - * @param ids 编号 - * @return 动态表单列表 - */ - List getFormList(Collection ids); - - /** - * 获得动态表单分页 - * - * @param pageReqVO 分页查询 - * @return 动态表单分页 - */ - PageResult getFormPage(WfFormPageReqVO pageReqVO); - - /** - * 获得动态表单列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 动态表单列表 - */ - List getFormList(WfFormExportReqVO exportReqVO); - -} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/form/impl/WfFormServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/form/impl/WfFormServiceImpl.java deleted file mode 100644 index 84f335050..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/form/impl/WfFormServiceImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.service.form.impl; - -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormCreateReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExportReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormPageReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormUpdateReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.convert.form.WfFormConvert; -import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm; -import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.form.WfFormMapper; -import cn.iocoder.yudao.adminserver.modules.activiti.service.form.WfFormService; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.annotation.Resource; -import java.util.Collection; -import java.util.List; - -import static cn.iocoder.yudao.adminserver.modules.activiti.enums.form.WfFormErrorCodeConstants.FORM_NOT_EXISTS; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; - -/** - * 动态表单 Service 实现类 - * - * TODO @风里雾里 - */ -@Service -@Validated -public class WfFormServiceImpl implements WfFormService { - - @Resource - private WfFormMapper formMapper; - - @Override - public Long createForm(WfFormCreateReqVO createReqVO) { - // 插入 - WfForm form = WfFormConvert.INSTANCE.convert(createReqVO); - formMapper.insert(form); - // 返回 - return form.getId(); - } - - @Override - public void updateForm(WfFormUpdateReqVO updateReqVO) { - // 校验存在 - this.validateFormExists(updateReqVO.getId()); - // 更新 - WfForm updateObj = WfFormConvert.INSTANCE.convert(updateReqVO); - formMapper.updateById(updateObj); - } - - @Override - public void deleteForm(Long id) { - // 校验存在 - this.validateFormExists(id); - // 删除 - formMapper.deleteById(id); - } - - private void validateFormExists(Long id) { - if (formMapper.selectById(id) == null) { - throw exception(FORM_NOT_EXISTS); - } - } - - @Override - public WfForm getForm(Long id) { - return formMapper.selectById(id); - } - - @Override - public List getFormList(Collection ids) { - return formMapper.selectBatchIds(ids); - } - - @Override - public PageResult getFormPage(WfFormPageReqVO pageReqVO) { - return formMapper.selectPage(pageReqVO); - } - - @Override - public List getFormList(WfFormExportReqVO exportReqVO) { - return formMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/WlFormController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/BpmFormController.java similarity index 53% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/WlFormController.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/BpmFormController.java index f2e795c64..98b5061b3 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/WlFormController.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/BpmFormController.java @@ -1,9 +1,9 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.controller.form; +package cn.iocoder.yudao.adminserver.modules.bpm.controller.form; -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.*; -import cn.iocoder.yudao.adminserver.modules.activiti.convert.form.WfFormConvert; -import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm; -import cn.iocoder.yudao.adminserver.modules.activiti.service.form.WfFormService; +import cn.iocoder.yudao.adminserver.modules.bpm.convert.form.BpmFormConvert; +import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmForm; +import cn.iocoder.yudao.adminserver.modules.bpm.service.form.BpmFormService; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.*; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; @@ -25,27 +25,26 @@ import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; -// TODO @风里雾里: Os=》Wf,/os 改成 /wl 开头。目前这个模块,咱先定位成给工作流用的 @Api(tags = "动态表单") @RestController -@RequestMapping("/wl/form") +@RequestMapping("/bpm/form") @Validated -public class WlFormController { +public class BpmFormController { @Resource - private WfFormService formService; + private BpmFormService formService; @PostMapping("/create") @ApiOperation("创建动态表单") - @PreAuthorize("@ss.hasPermission('os:form:create')") - public CommonResult createForm(@Valid @RequestBody WfFormCreateReqVO createReqVO) { + @PreAuthorize("@ss.hasPermission('bpm:form:create')") + public CommonResult createForm(@Valid @RequestBody BpmFormCreateReqVO createReqVO) { return success(formService.createForm(createReqVO)); } @PutMapping("/update") @ApiOperation("更新动态表单") - @PreAuthorize("@ss.hasPermission('os:form:update')") - public CommonResult updateForm(@Valid @RequestBody WfFormUpdateReqVO updateReqVO) { + @PreAuthorize("@ss.hasPermission('bpm:form:update')") + public CommonResult updateForm(@Valid @RequestBody BpmFormUpdateReqVO updateReqVO) { formService.updateForm(updateReqVO); return success(true); } @@ -53,7 +52,7 @@ public class WlFormController { @DeleteMapping("/delete") @ApiOperation("删除动态表单") @ApiImplicitParam(name = "id", value = "编号", required = true) - @PreAuthorize("@ss.hasPermission('os:form:delete')") + @PreAuthorize("@ss.hasPermission('bpm:form:delete')") public CommonResult deleteForm(@RequestParam("id") Long id) { formService.deleteForm(id); return success(true); @@ -62,39 +61,39 @@ public class WlFormController { @GetMapping("/get") @ApiOperation("获得动态表单") @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) - @PreAuthorize("@ss.hasPermission('os:form:query')") - public CommonResult getForm(@RequestParam("id") Long id) { - WfForm form = formService.getForm(id); - return success(WfFormConvert.INSTANCE.convert(form)); + @PreAuthorize("@ss.hasPermission('bpm:form:query')") + public CommonResult getForm(@RequestParam("id") Long id) { + BpmForm form = formService.getForm(id); + return success(BpmFormConvert.INSTANCE.convert(form)); } @GetMapping("/list") @ApiOperation("获得动态表单列表") @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) - @PreAuthorize("@ss.hasPermission('os:form:query')") - public CommonResult> getFormList(@RequestParam("ids") Collection ids) { - List list = formService.getFormList(ids); - return success(WfFormConvert.INSTANCE.convertList(list)); + @PreAuthorize("@ss.hasPermission('bpm:form:query')") + public CommonResult> getFormList(@RequestParam("ids") Collection ids) { + List list = formService.getFormList(ids); + return success(BpmFormConvert.INSTANCE.convertList(list)); } @GetMapping("/page") @ApiOperation("获得动态表单分页") - @PreAuthorize("@ss.hasPermission('os:form:query')") - public CommonResult> getFormPage(@Valid WfFormPageReqVO pageVO) { - PageResult pageResult = formService.getFormPage(pageVO); - return success(WfFormConvert.INSTANCE.convertPage(pageResult)); + @PreAuthorize("@ss.hasPermission('bpm:form:query')") + public CommonResult> getFormPage(@Valid BpmFormPageReqVO pageVO) { + PageResult pageResult = formService.getFormPage(pageVO); + return success(BpmFormConvert.INSTANCE.convertPage(pageResult)); } @GetMapping("/export-excel") @ApiOperation("导出动态表单 Excel") - @PreAuthorize("@ss.hasPermission('os:form:export')") + @PreAuthorize("@ss.hasPermission('bpm:form:export')") @OperateLog(type = EXPORT) - public void exportFormExcel(@Valid WfFormExportReqVO exportReqVO, + public void exportFormExcel(@Valid BpmFormExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = formService.getFormList(exportReqVO); + List list = formService.getFormList(exportReqVO); // 导出 Excel - List datas = WfFormConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "动态表单.xls", "数据", WfFormExcelVO.class, datas); + List datas = BpmFormConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "动态表单.xls", "数据", BpmFormExcelVO.class, datas); } } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormBaseVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormBaseVO.java similarity index 87% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormBaseVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormBaseVO.java index b3fe5d871..56674a412 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormBaseVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; +package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo; import lombok.*; import io.swagger.annotations.*; @@ -9,7 +9,7 @@ import javax.validation.constraints.*; * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class WfFormBaseVO { +public class BpmFormBaseVO { @ApiModelProperty(value = "表单名称", required = true) @NotNull(message = "表单名称不能为空") diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormCreateReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormCreateReqVO.java similarity index 56% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormCreateReqVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormCreateReqVO.java index 7f989a33c..79e9ee55d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormCreateReqVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormCreateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; +package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo; import lombok.*; import io.swagger.annotations.*; @@ -7,6 +7,6 @@ import io.swagger.annotations.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class WfFormCreateReqVO extends WfFormBaseVO { +public class BpmFormCreateReqVO extends BpmFormBaseVO { } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormExcelVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormExcelVO.java similarity index 77% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormExcelVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormExcelVO.java index 111c19e1e..542758677 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormExcelVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormExcelVO.java @@ -1,9 +1,9 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; - -import lombok.*; -import java.util.*; +package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo; import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; /** * 动态表单 Excel VO @@ -11,7 +11,7 @@ import com.alibaba.excel.annotation.ExcelProperty; * @author 芋艿 */ @Data -public class WfFormExcelVO { +public class BpmFormExcelVO { @ExcelProperty("表单编号") private Long id; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormExportReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormExportReqVO.java similarity index 90% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormExportReqVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormExportReqVO.java index 358a38821..eb9228332 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormExportReqVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; +package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo; import lombok.*; import java.util.*; @@ -8,7 +8,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ApiModel(value = "动态表单 Excel 导出 Request VO", description = "参数和 OsFormPageReqVO 是一致的") @Data -public class WfFormExportReqVO { +public class BpmFormExportReqVO { @ApiModelProperty(value = "表单名称") private String name; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormPageReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormPageReqVO.java similarity index 89% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormPageReqVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormPageReqVO.java index 8cbdc077f..870235fd9 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormPageReqVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; +package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo; import lombok.*; import java.util.*; @@ -11,7 +11,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class WfFormPageReqVO extends PageParam { +public class BpmFormPageReqVO extends PageParam { @ApiModelProperty(value = "表单名称") private String name; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormRespVO.java similarity index 74% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormRespVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormRespVO.java index 779284be5..e0424dbe2 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormRespVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; +package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo; import lombok.*; import java.util.*; @@ -8,7 +8,7 @@ import io.swagger.annotations.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class WfFormRespVO extends WfFormBaseVO { +public class BpmFormRespVO extends BpmFormBaseVO { @ApiModelProperty(value = "表单编号", required = true) private Long id; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormUpdateReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormUpdateReqVO.java similarity index 72% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormUpdateReqVO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormUpdateReqVO.java index 4a3bf4e2d..89bb759ee 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormUpdateReqVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormUpdateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; +package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo; import lombok.*; import io.swagger.annotations.*; @@ -8,7 +8,7 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class WfFormUpdateReqVO extends WfFormBaseVO { +public class BpmFormUpdateReqVO extends BpmFormBaseVO { @ApiModelProperty(value = "表单编号", required = true) @NotNull(message = "表单编号不能为空") diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/form/BpmFormConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/form/BpmFormConvert.java new file mode 100644 index 000000000..a7764dc04 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/form/BpmFormConvert.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.adminserver.modules.bpm.convert.form; + +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormCreateReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormExcelVO; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormRespVO; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormUpdateReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmForm; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 动态表单 Convert + * + * @author 芋艿 + */ +@Mapper +public interface BpmFormConvert { + + BpmFormConvert INSTANCE = Mappers.getMapper(BpmFormConvert.class); + + BpmForm convert(BpmFormCreateReqVO bean); + + BpmForm convert(BpmFormUpdateReqVO bean); + + BpmFormRespVO convert(BpmForm bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/form/BpmForm.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/form/BpmForm.java index d780b526b..49967f295 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/form/BpmForm.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/form/BpmForm.java @@ -33,6 +33,14 @@ public class BpmForm extends BaseDO { * 表单名 */ private String name; + /** + * 状态 + */ + private Integer status; + /** + * 表单JSON + */ + private String formJson; /** * 表单配置 * diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/form/BpmFormData.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/form/BpmFormData.java index 6fa978720..59daa510c 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/form/BpmFormData.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/form/BpmFormData.java @@ -15,7 +15,7 @@ import java.util.Map; * * @author 芋道源码 */ -@TableName(value = "wf_form", autoResultMap = true) +@TableName(value = "bpm_form_data", autoResultMap = true) @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @@ -34,6 +34,10 @@ public class BpmFormData extends BaseDO { * 关联 {@link BpmForm#getId()} */ private Long formId; + /** + * 状态 + */ + private Integer status; /** * 表单配置 * diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/mysql/form/WfFormMapper.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/form/BpmFormMapper.java similarity index 58% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/mysql/form/WfFormMapper.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/form/BpmFormMapper.java index 99bb312fc..268eff62c 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/mysql/form/WfFormMapper.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/form/BpmFormMapper.java @@ -1,10 +1,9 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.form; +package cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.form; - -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExportReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormPageReqVO; -import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormExportReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormPageReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmForm; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; @@ -18,26 +17,26 @@ import java.util.List; * @author 风里雾里 */ @Mapper -public interface WfFormMapper extends BaseMapperX { +public interface BpmFormMapper extends BaseMapperX { - default PageResult selectPage(WfFormPageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() + default PageResult selectPage(BpmFormPageReqVO reqVO) { + return selectPage(reqVO, new QueryWrapperX() .likeIfPresent("name", reqVO.getName()) .eqIfPresent("status", reqVO.getStatus()) .eqIfPresent("form_json", reqVO.getFormJson()) .eqIfPresent("remark", reqVO.getRemark()) .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc("id") ); + .orderByDesc("id")); } - default List selectList(WfFormExportReqVO reqVO) { - return selectList(new QueryWrapperX() + default List selectList(BpmFormExportReqVO reqVO) { + return selectList(new QueryWrapperX() .likeIfPresent("name", reqVO.getName()) .eqIfPresent("status", reqVO.getStatus()) .eqIfPresent("form_json", reqVO.getFormJson()) .eqIfPresent("remark", reqVO.getRemark()) .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc("id") ); + .orderByDesc("id")); } } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java index 4caab34e8..92f986092 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java @@ -23,11 +23,13 @@ public interface BpmErrorCodeConstants { ErrorCode OA_HR_POST_NOT_EXISTS = new ErrorCode(1003001006, "HR岗位未设置"); ErrorCode OA_DAY_LEAVE_ERROR = new ErrorCode(1003001007, "请假天数必须>=1"); - - // ========== OA 工作流模块 1-004-001-000 ========== + // ========== OA 工作流模块 1-003-002-000 ========== ErrorCode BPMN_MODEL_EDITOR_SOURCE_NOT_EXISTS = new ErrorCode(1004001001, "模型数据为空,请先成功设计流程并保存"); ErrorCode BPMN_MODEL_ERROR = new ErrorCode(1004001002, "工作流模型异常"); ErrorCode BPMN_MODEL_PROCESS_NOT_EXISTS = new ErrorCode(1004001003, "流程数据为空"); ErrorCode BPMN_PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1004001004, "流程定义不存在"); + // ========== 动态表单模块 1-003-003-000 ========== + ErrorCode BPM_FORM_NOT_EXISTS = new ErrorCode(1003001002, "动态表单不存在"); + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormService.java new file mode 100644 index 000000000..154e002a1 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormService.java @@ -0,0 +1,76 @@ +package cn.iocoder.yudao.adminserver.modules.bpm.service.form; + +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormCreateReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormExportReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormPageReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormUpdateReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmForm; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + + +/** + * 动态表单 Service 接口 + * + * @author @风里雾里 + */ +public interface BpmFormService { + + /** + * 创建动态表单 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createForm(@Valid BpmFormCreateReqVO createReqVO); + + /** + * 更新动态表单 + * + * @param updateReqVO 更新信息 + */ + void updateForm(@Valid BpmFormUpdateReqVO updateReqVO); + + /** + * 删除动态表单 + * + * @param id 编号 + */ + void deleteForm(Long id); + + /** + * 获得动态表单 + * + * @param id 编号 + * @return 动态表单 + */ + BpmForm getForm(Long id); + + /** + * 获得动态表单列表 + * + * @param ids 编号 + * @return 动态表单列表 + */ + List getFormList(Collection ids); + + /** + * 获得动态表单分页 + * + * @param pageReqVO 分页查询 + * @return 动态表单分页 + */ + PageResult getFormPage(BpmFormPageReqVO pageReqVO); + + /** + * 获得动态表单列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 动态表单列表 + */ + List getFormList(BpmFormExportReqVO exportReqVO); + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormServiceImpl.java new file mode 100644 index 000000000..03a8be84e --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormServiceImpl.java @@ -0,0 +1,85 @@ +package cn.iocoder.yudao.adminserver.modules.bpm.service.form; + +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormCreateReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormExportReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormPageReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormUpdateReqVO; +import cn.iocoder.yudao.adminserver.modules.bpm.convert.form.BpmFormConvert; +import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmForm; +import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.form.BpmFormMapper; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.BPM_FORM_NOT_EXISTS; +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; + +/** + * 动态表单 Service 实现类 + * + * @author 风里雾里 + */ +@Service +@Validated +public class BpmFormServiceImpl implements BpmFormService { + + @Resource + private BpmFormMapper formMapper; + + @Override + public Long createForm(BpmFormCreateReqVO createReqVO) { + // 插入 + BpmForm form = BpmFormConvert.INSTANCE.convert(createReqVO); + formMapper.insert(form); + // 返回 + return form.getId(); + } + + @Override + public void updateForm(BpmFormUpdateReqVO updateReqVO) { + // 校验存在 + this.validateFormExists(updateReqVO.getId()); + // 更新 + BpmForm updateObj = BpmFormConvert.INSTANCE.convert(updateReqVO); + formMapper.updateById(updateObj); + } + + @Override + public void deleteForm(Long id) { + // 校验存在 + this.validateFormExists(id); + // 删除 + formMapper.deleteById(id); + } + + private void validateFormExists(Long id) { + if (formMapper.selectById(id) == null) { + throw exception(BPM_FORM_NOT_EXISTS); + } + } + + @Override + public BpmForm getForm(Long id) { + return formMapper.selectById(id); + } + + @Override + public List getFormList(Collection ids) { + return formMapper.selectBatchIds(ids); + } + + @Override + public PageResult getFormPage(BpmFormPageReqVO pageReqVO) { + return formMapper.selectPage(pageReqVO); + } + + @Override + public List getFormList(BpmFormExportReqVO exportReqVO) { + return formMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-activiti/src/main/java/cn/iocoder/yudao/framework/activiti/config/YudaoActivitiConfiguration.java b/yudao-framework/yudao-spring-boot-starter-activiti/src/main/java/cn/iocoder/yudao/framework/activiti/config/YudaoActivitiConfiguration.java index 4af1e2f45..e3b802c15 100644 --- a/yudao-framework/yudao-spring-boot-starter-activiti/src/main/java/cn/iocoder/yudao/framework/activiti/config/YudaoActivitiConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-activiti/src/main/java/cn/iocoder/yudao/framework/activiti/config/YudaoActivitiConfiguration.java @@ -1,14 +1,11 @@ package cn.iocoder.yudao.framework.activiti.config; -import lombok.AllArgsConstructor; import org.activiti.image.ProcessDiagramGenerator; import org.activiti.image.impl.DefaultProcessDiagramGenerator; -import org.activiti.spring.SpringProcessEngineConfiguration; import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer; import org.apache.ibatis.session.SqlSessionFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Component; @Configuration public class YudaoActivitiConfiguration { @@ -24,19 +21,9 @@ public class YudaoActivitiConfiguration { /** * ProcessEngineConfigurationConfigurer 实现类,设置使用 MyBatis SqlSessionFactory */ - @Component - @AllArgsConstructor - public static class SqlSessionFactoryProcessEngineConfigurationConfigurer - implements ProcessEngineConfigurationConfigurer { - - private final SqlSessionFactory sqlSessionFactory; - - @Override - public void configure(SpringProcessEngineConfiguration springProcessEngineConfiguration) { - springProcessEngineConfiguration.setSqlSessionFactory(sqlSessionFactory); - } - + @Bean + public ProcessEngineConfigurationConfigurer processEngineConfigurationConfigurer(SqlSessionFactory sqlSessionFactory) { + return springProcessEngineConfiguration -> springProcessEngineConfiguration.setSqlSessionFactory(sqlSessionFactory); } - }