Commit 6f8e8acae0f24b68f48c1b125837073e2c6b9dff
Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/activiti
Showing
20 changed files
with
654 additions
and
7 deletions
.gitattributes
0 → 100644
| 1 | +*.sql linguist-language=java | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/WlFormController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.controller.form; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.*; | |
| 4 | +import cn.iocoder.yudao.adminserver.modules.activiti.convert.form.WfFormConvert; | |
| 5 | +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm; | |
| 6 | +import cn.iocoder.yudao.adminserver.modules.activiti.service.form.WfFormService; | |
| 7 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 8 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 10 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 11 | +import io.swagger.annotations.Api; | |
| 12 | +import io.swagger.annotations.ApiImplicitParam; | |
| 13 | +import io.swagger.annotations.ApiOperation; | |
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | +import org.springframework.validation.annotation.Validated; | |
| 16 | +import org.springframework.web.bind.annotation.*; | |
| 17 | + | |
| 18 | +import javax.annotation.Resource; | |
| 19 | +import javax.servlet.http.HttpServletResponse; | |
| 20 | +import javax.validation.Valid; | |
| 21 | +import java.io.IOException; | |
| 22 | +import java.util.Collection; | |
| 23 | +import java.util.List; | |
| 24 | + | |
| 25 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 26 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | |
| 27 | + | |
| 28 | +// TODO @风里雾里: Os=》Wf,/os 改成 /wl 开头。目前这个模块,咱先定位成给工作流用的 | |
| 29 | +@Api(tags = "动态表单") | |
| 30 | +@RestController | |
| 31 | +@RequestMapping("/wl/form") | |
| 32 | +@Validated | |
| 33 | +public class WlFormController { | |
| 34 | + | |
| 35 | + @Resource | |
| 36 | + private WfFormService formService; | |
| 37 | + | |
| 38 | + @PostMapping("/create") | |
| 39 | + @ApiOperation("创建动态表单") | |
| 40 | + @PreAuthorize("@ss.hasPermission('os:form:create')") | |
| 41 | + public CommonResult<Long> createForm(@Valid @RequestBody WfFormCreateReqVO createReqVO) { | |
| 42 | + return success(formService.createForm(createReqVO)); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @PutMapping("/update") | |
| 46 | + @ApiOperation("更新动态表单") | |
| 47 | + @PreAuthorize("@ss.hasPermission('os:form:update')") | |
| 48 | + public CommonResult<Boolean> updateForm(@Valid @RequestBody WfFormUpdateReqVO updateReqVO) { | |
| 49 | + formService.updateForm(updateReqVO); | |
| 50 | + return success(true); | |
| 51 | + } | |
| 52 | + | |
| 53 | + @DeleteMapping("/delete") | |
| 54 | + @ApiOperation("删除动态表单") | |
| 55 | + @ApiImplicitParam(name = "id", value = "编号", required = true) | |
| 56 | + @PreAuthorize("@ss.hasPermission('os:form:delete')") | |
| 57 | + public CommonResult<Boolean> deleteForm(@RequestParam("id") Long id) { | |
| 58 | + formService.deleteForm(id); | |
| 59 | + return success(true); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @GetMapping("/get") | |
| 63 | + @ApiOperation("获得动态表单") | |
| 64 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | |
| 65 | + @PreAuthorize("@ss.hasPermission('os:form:query')") | |
| 66 | + public CommonResult<WfFormRespVO> getForm(@RequestParam("id") Long id) { | |
| 67 | + WfForm form = formService.getForm(id); | |
| 68 | + return success(WfFormConvert.INSTANCE.convert(form)); | |
| 69 | + } | |
| 70 | + | |
| 71 | + @GetMapping("/list") | |
| 72 | + @ApiOperation("获得动态表单列表") | |
| 73 | + @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) | |
| 74 | + @PreAuthorize("@ss.hasPermission('os:form:query')") | |
| 75 | + public CommonResult<List<WfFormRespVO>> getFormList(@RequestParam("ids") Collection<Long> ids) { | |
| 76 | + List<WfForm> list = formService.getFormList(ids); | |
| 77 | + return success(WfFormConvert.INSTANCE.convertList(list)); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @GetMapping("/page") | |
| 81 | + @ApiOperation("获得动态表单分页") | |
| 82 | + @PreAuthorize("@ss.hasPermission('os:form:query')") | |
| 83 | + public CommonResult<PageResult<WfFormRespVO>> getFormPage(@Valid WfFormPageReqVO pageVO) { | |
| 84 | + PageResult<WfForm> pageResult = formService.getFormPage(pageVO); | |
| 85 | + return success(WfFormConvert.INSTANCE.convertPage(pageResult)); | |
| 86 | + } | |
| 87 | + | |
| 88 | + @GetMapping("/export-excel") | |
| 89 | + @ApiOperation("导出动态表单 Excel") | |
| 90 | + @PreAuthorize("@ss.hasPermission('os:form:export')") | |
| 91 | + @OperateLog(type = EXPORT) | |
| 92 | + public void exportFormExcel(@Valid WfFormExportReqVO exportReqVO, | |
| 93 | + HttpServletResponse response) throws IOException { | |
| 94 | + List<WfForm> list = formService.getFormList(exportReqVO); | |
| 95 | + // 导出 Excel | |
| 96 | + List<WfFormExcelVO> datas = WfFormConvert.INSTANCE.convertList02(list); | |
| 97 | + ExcelUtils.write(response, "动态表单.xls", "数据", WfFormExcelVO.class, datas); | |
| 98 | + } | |
| 99 | + | |
| 100 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import io.swagger.annotations.*; | |
| 5 | +import javax.validation.constraints.*; | |
| 6 | + | |
| 7 | +/** | |
| 8 | +* 动态表单 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 9 | +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 10 | +*/ | |
| 11 | +@Data | |
| 12 | +public class WfFormBaseVO { | |
| 13 | + | |
| 14 | + @ApiModelProperty(value = "表单名称", required = true) | |
| 15 | + @NotNull(message = "表单名称不能为空") | |
| 16 | + private String name; | |
| 17 | + | |
| 18 | + @ApiModelProperty(value = "商户状态", required = true) | |
| 19 | + @NotNull(message = "商户状态不能为空") | |
| 20 | + private Integer status; | |
| 21 | + | |
| 22 | + @ApiModelProperty(value = "表单JSON") | |
| 23 | + private String formJson; | |
| 24 | + | |
| 25 | + @ApiModelProperty(value = "备注") | |
| 26 | + private String remark; | |
| 27 | + | |
| 28 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import io.swagger.annotations.*; | |
| 5 | + | |
| 6 | +@ApiModel("动态表单创建 Request VO") | |
| 7 | +@Data | |
| 8 | +@EqualsAndHashCode(callSuper = true) | |
| 9 | +@ToString(callSuper = true) | |
| 10 | +public class WfFormCreateReqVO extends WfFormBaseVO { | |
| 11 | + | |
| 12 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | + | |
| 6 | +import com.alibaba.excel.annotation.ExcelProperty; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 动态表单 Excel VO | |
| 10 | + * | |
| 11 | + * @author 芋艿 | |
| 12 | + */ | |
| 13 | +@Data | |
| 14 | +public class WfFormExcelVO { | |
| 15 | + | |
| 16 | + @ExcelProperty("表单编号") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @ExcelProperty("表单名称") | |
| 20 | + private String name; | |
| 21 | + | |
| 22 | + @ExcelProperty("商户状态") | |
| 23 | + private Integer status; | |
| 24 | + | |
| 25 | + @ExcelProperty("表单JSON") | |
| 26 | + private String formJson; | |
| 27 | + | |
| 28 | + @ExcelProperty("备注") | |
| 29 | + private String remark; | |
| 30 | + | |
| 31 | + @ExcelProperty("创建时间") | |
| 32 | + private Date createTime; | |
| 33 | + | |
| 34 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormExportReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.annotations.*; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 8 | + | |
| 9 | +@ApiModel(value = "动态表单 Excel 导出 Request VO", description = "参数和 OsFormPageReqVO 是一致的") | |
| 10 | +@Data | |
| 11 | +public class WfFormExportReqVO { | |
| 12 | + | |
| 13 | + @ApiModelProperty(value = "表单名称") | |
| 14 | + private String name; | |
| 15 | + | |
| 16 | + @ApiModelProperty(value = "商户状态") | |
| 17 | + private Integer status; | |
| 18 | + | |
| 19 | + @ApiModelProperty(value = "表单JSON") | |
| 20 | + private String formJson; | |
| 21 | + | |
| 22 | + @ApiModelProperty(value = "备注") | |
| 23 | + private String remark; | |
| 24 | + | |
| 25 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 26 | + @ApiModelProperty(value = "开始创建时间") | |
| 27 | + private Date beginCreateTime; | |
| 28 | + | |
| 29 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 30 | + @ApiModelProperty(value = "结束创建时间") | |
| 31 | + private Date endCreateTime; | |
| 32 | + | |
| 33 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.annotations.*; | |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 9 | + | |
| 10 | +@ApiModel("动态表单分页 Request VO") | |
| 11 | +@Data | |
| 12 | +@EqualsAndHashCode(callSuper = true) | |
| 13 | +@ToString(callSuper = true) | |
| 14 | +public class WfFormPageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @ApiModelProperty(value = "表单名称") | |
| 17 | + private String name; | |
| 18 | + | |
| 19 | + @ApiModelProperty(value = "商户状态") | |
| 20 | + private Integer status; | |
| 21 | + | |
| 22 | + @ApiModelProperty(value = "表单JSON") | |
| 23 | + private String formJson; | |
| 24 | + | |
| 25 | + @ApiModelProperty(value = "备注") | |
| 26 | + private String remark; | |
| 27 | + | |
| 28 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 29 | + @ApiModelProperty(value = "开始创建时间") | |
| 30 | + private Date beginCreateTime; | |
| 31 | + | |
| 32 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 33 | + @ApiModelProperty(value = "结束创建时间") | |
| 34 | + private Date endCreateTime; | |
| 35 | + | |
| 36 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.annotations.*; | |
| 6 | + | |
| 7 | +@ApiModel("动态表单 Response VO") | |
| 8 | +@Data | |
| 9 | +@EqualsAndHashCode(callSuper = true) | |
| 10 | +@ToString(callSuper = true) | |
| 11 | +public class WfFormRespVO extends WfFormBaseVO { | |
| 12 | + | |
| 13 | + @ApiModelProperty(value = "表单编号", required = true) | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @ApiModelProperty(value = "创建时间", required = true) | |
| 17 | + private Date createTime; | |
| 18 | + | |
| 19 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/form/vo/WfFormUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import io.swagger.annotations.*; | |
| 5 | +import javax.validation.constraints.*; | |
| 6 | + | |
| 7 | +@ApiModel("动态表单更新 Request VO") | |
| 8 | +@Data | |
| 9 | +@EqualsAndHashCode(callSuper = true) | |
| 10 | +@ToString(callSuper = true) | |
| 11 | +public class WfFormUpdateReqVO extends WfFormBaseVO { | |
| 12 | + | |
| 13 | + @ApiModelProperty(value = "表单编号", required = true) | |
| 14 | + @NotNull(message = "表单编号不能为空") | |
| 15 | + private Long id; | |
| 16 | + | |
| 17 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/form/WfFormConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.convert.form; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormCreateReqVO; | |
| 4 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExcelVO; | |
| 5 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormRespVO; | |
| 6 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormUpdateReqVO; | |
| 7 | +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm; | |
| 8 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | +import org.mapstruct.Mapper; | |
| 10 | +import org.mapstruct.factory.Mappers; | |
| 11 | + | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 动态表单 Convert | |
| 16 | + * | |
| 17 | + * @author 芋艿 | |
| 18 | + */ | |
| 19 | +@Mapper | |
| 20 | +public interface WfFormConvert { | |
| 21 | + | |
| 22 | + WfFormConvert INSTANCE = Mappers.getMapper(WfFormConvert.class); | |
| 23 | + | |
| 24 | + WfForm convert(WfFormCreateReqVO bean); | |
| 25 | + | |
| 26 | + WfForm convert(WfFormUpdateReqVO bean); | |
| 27 | + | |
| 28 | + WfFormRespVO convert(WfForm bean); | |
| 29 | + | |
| 30 | + List<WfFormRespVO> convertList(List<WfForm> list); | |
| 31 | + | |
| 32 | + PageResult<WfFormRespVO> convertPage(PageResult<WfForm> page); | |
| 33 | + | |
| 34 | + List<WfFormExcelVO> convertList02(List<WfForm> list); | |
| 35 | + | |
| 36 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/form/WfForm.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | |
| 8 | +import lombok.*; | |
| 9 | + | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 工作流的表单定义 | |
| 14 | + * 用于工作流的申请表单,需要动态配置的场景 | |
| 15 | + * | |
| 16 | + * @author 芋道源码 | |
| 17 | + */ | |
| 18 | +@TableName(value = "wf_form", autoResultMap = true) | |
| 19 | +@Data | |
| 20 | +@EqualsAndHashCode(callSuper = true) | |
| 21 | +@ToString(callSuper = true) | |
| 22 | +@Builder | |
| 23 | +@NoArgsConstructor | |
| 24 | +@AllArgsConstructor | |
| 25 | +public class WfForm extends BaseDO { | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 编号 | |
| 29 | + */ | |
| 30 | + @TableId | |
| 31 | + private Long id; | |
| 32 | + /** | |
| 33 | + * 表单名 | |
| 34 | + */ | |
| 35 | + private String name; | |
| 36 | + /** | |
| 37 | + * 状态 | |
| 38 | + */ | |
| 39 | + private Integer status; | |
| 40 | + /** | |
| 41 | + * 表单JSON | |
| 42 | + */ | |
| 43 | + private String formJson; | |
| 44 | + /** | |
| 45 | + * 表单配置 | |
| 46 | + * | |
| 47 | + * 目前直接将 https://github.com/JakHuang/form-generator 生成的 JSON 串,直接保存 | |
| 48 | + * 定义:https://github.com/JakHuang/form-generator/issues/46 | |
| 49 | + */ | |
| 50 | + @TableField(typeHandler = JacksonTypeHandler.class) | |
| 51 | + private List<String> fields; | |
| 52 | + /** | |
| 53 | + * 备注 | |
| 54 | + */ | |
| 55 | + private String remark; | |
| 56 | + | |
| 57 | +} | |
| 0 | 58 | \ No newline at end of file | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/form/WfFormData.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 6 | +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | |
| 7 | +import lombok.*; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | +import java.util.Map; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 工作流的表单结果 | |
| 14 | + * 用户每次填写工作流的申请表单时,会保存一条记录到该表】 | |
| 15 | + * | |
| 16 | + * @author 芋道源码 | |
| 17 | + */ | |
| 18 | +@TableName(value = "wf_form", autoResultMap = true) | |
| 19 | +@Data | |
| 20 | +@EqualsAndHashCode(callSuper = true) | |
| 21 | +@ToString(callSuper = true) | |
| 22 | +@Builder | |
| 23 | +@NoArgsConstructor | |
| 24 | +@AllArgsConstructor | |
| 25 | +public class WfFormData extends BaseDO { | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 编号 | |
| 29 | + */ | |
| 30 | + private Long id; | |
| 31 | + /** | |
| 32 | + * 表单编号 | |
| 33 | + * | |
| 34 | + * 关联 {@link WfForm#getId()} | |
| 35 | + */ | |
| 36 | + private Long formId; | |
| 37 | + /** | |
| 38 | + * 状态 | |
| 39 | + */ | |
| 40 | + private Integer status; | |
| 41 | + /** | |
| 42 | + * 表单配置 | |
| 43 | + * | |
| 44 | + * 冗余 {@link WfForm#getFields()} | |
| 45 | + * 主要考虑,表单是可以修改的 | |
| 46 | + */ | |
| 47 | + @TableField(typeHandler = JacksonTypeHandler.class) | |
| 48 | + private List<String> fields; | |
| 49 | + /** | |
| 50 | + * 表单值 | |
| 51 | + */ | |
| 52 | + @TableField(typeHandler = JacksonTypeHandler.class) | |
| 53 | + private Map<String, Object> values; | |
| 54 | + | |
| 55 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/mysql/form/WfFormMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.form; | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExportReqVO; | |
| 6 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormPageReqVO; | |
| 7 | +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm; | |
| 8 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 10 | +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | |
| 11 | +import org.apache.ibatis.annotations.Mapper; | |
| 12 | + | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 动态表单 Mapper | |
| 17 | + * | |
| 18 | + * @author 风里雾里 | |
| 19 | + */ | |
| 20 | +@Mapper | |
| 21 | +public interface WfFormMapper extends BaseMapperX<WfForm> { | |
| 22 | + | |
| 23 | + default PageResult<WfForm> selectPage(WfFormPageReqVO reqVO) { | |
| 24 | + return selectPage(reqVO, new QueryWrapperX<WfForm>() | |
| 25 | + .likeIfPresent("name", reqVO.getName()) | |
| 26 | + .eqIfPresent("status", reqVO.getStatus()) | |
| 27 | + .eqIfPresent("form_json", reqVO.getFormJson()) | |
| 28 | + .eqIfPresent("remark", reqVO.getRemark()) | |
| 29 | + .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 30 | + .orderByDesc("id") ); | |
| 31 | + } | |
| 32 | + | |
| 33 | + default List<WfForm> selectList(WfFormExportReqVO reqVO) { | |
| 34 | + return selectList(new QueryWrapperX<WfForm>() | |
| 35 | + .likeIfPresent("name", reqVO.getName()) | |
| 36 | + .eqIfPresent("status", reqVO.getStatus()) | |
| 37 | + .eqIfPresent("form_json", reqVO.getFormJson()) | |
| 38 | + .eqIfPresent("remark", reqVO.getRemark()) | |
| 39 | + .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 40 | + .orderByDesc("id") ); | |
| 41 | + } | |
| 42 | + | |
| 43 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/enums/form/WfFormErrorCodeConstants.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.enums.form; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.exception.ErrorCode; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * activiti 系统 错误码枚举类 | |
| 7 | + * | |
| 8 | + * 003 activiti | |
| 9 | + * 001 oa | |
| 10 | + * activiti 系统,使用 1-003-000-000 段 | |
| 11 | + */ | |
| 12 | +public interface WfFormErrorCodeConstants { | |
| 13 | + ErrorCode FORM_NOT_EXISTS = new ErrorCode(1003001002, "动态表单不存在"); | |
| 14 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/form/WfFormService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.service.form; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormCreateReqVO; | |
| 4 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExportReqVO; | |
| 5 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormPageReqVO; | |
| 6 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormUpdateReqVO; | |
| 7 | +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm; | |
| 8 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | + | |
| 10 | +import java.util.*; | |
| 11 | +import javax.validation.*; | |
| 12 | + | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 动态表单 Service 接口 | |
| 16 | + * | |
| 17 | + * TODO @风里雾里 | |
| 18 | + */ | |
| 19 | +public interface WfFormService { | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 创建动态表单 | |
| 23 | + * | |
| 24 | + * @param createReqVO 创建信息 | |
| 25 | + * @return 编号 | |
| 26 | + */ | |
| 27 | + Long createForm(@Valid WfFormCreateReqVO createReqVO); | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 更新动态表单 | |
| 31 | + * | |
| 32 | + * @param updateReqVO 更新信息 | |
| 33 | + */ | |
| 34 | + void updateForm(@Valid WfFormUpdateReqVO updateReqVO); | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 删除动态表单 | |
| 38 | + * | |
| 39 | + * @param id 编号 | |
| 40 | + */ | |
| 41 | + void deleteForm(Long id); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 获得动态表单 | |
| 45 | + * | |
| 46 | + * @param id 编号 | |
| 47 | + * @return 动态表单 | |
| 48 | + */ | |
| 49 | + WfForm getForm(Long id); | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 获得动态表单列表 | |
| 53 | + * | |
| 54 | + * @param ids 编号 | |
| 55 | + * @return 动态表单列表 | |
| 56 | + */ | |
| 57 | + List<WfForm> getFormList(Collection<Long> ids); | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 获得动态表单分页 | |
| 61 | + * | |
| 62 | + * @param pageReqVO 分页查询 | |
| 63 | + * @return 动态表单分页 | |
| 64 | + */ | |
| 65 | + PageResult<WfForm> getFormPage(WfFormPageReqVO pageReqVO); | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 获得动态表单列表, 用于 Excel 导出 | |
| 69 | + * | |
| 70 | + * @param exportReqVO 查询条件 | |
| 71 | + * @return 动态表单列表 | |
| 72 | + */ | |
| 73 | + List<WfForm> getFormList(WfFormExportReqVO exportReqVO); | |
| 74 | + | |
| 75 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/form/impl/WfFormServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.activiti.service.form.impl; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormCreateReqVO; | |
| 4 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExportReqVO; | |
| 5 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormPageReqVO; | |
| 6 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormUpdateReqVO; | |
| 7 | +import cn.iocoder.yudao.adminserver.modules.activiti.convert.form.WfFormConvert; | |
| 8 | +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm; | |
| 9 | +import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.form.WfFormMapper; | |
| 10 | +import cn.iocoder.yudao.adminserver.modules.activiti.service.form.WfFormService; | |
| 11 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 12 | +import org.springframework.stereotype.Service; | |
| 13 | +import org.springframework.validation.annotation.Validated; | |
| 14 | + | |
| 15 | +import javax.annotation.Resource; | |
| 16 | +import java.util.Collection; | |
| 17 | +import java.util.List; | |
| 18 | + | |
| 19 | +import static cn.iocoder.yudao.adminserver.modules.activiti.enums.form.WfFormErrorCodeConstants.FORM_NOT_EXISTS; | |
| 20 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * 动态表单 Service 实现类 | |
| 24 | + * | |
| 25 | + * TODO @风里雾里 | |
| 26 | + */ | |
| 27 | +@Service | |
| 28 | +@Validated | |
| 29 | +public class WfFormServiceImpl implements WfFormService { | |
| 30 | + | |
| 31 | + @Resource | |
| 32 | + private WfFormMapper formMapper; | |
| 33 | + | |
| 34 | + @Override | |
| 35 | + public Long createForm(WfFormCreateReqVO createReqVO) { | |
| 36 | + // 插入 | |
| 37 | + WfForm form = WfFormConvert.INSTANCE.convert(createReqVO); | |
| 38 | + formMapper.insert(form); | |
| 39 | + // 返回 | |
| 40 | + return form.getId(); | |
| 41 | + } | |
| 42 | + | |
| 43 | + @Override | |
| 44 | + public void updateForm(WfFormUpdateReqVO updateReqVO) { | |
| 45 | + // 校验存在 | |
| 46 | + this.validateFormExists(updateReqVO.getId()); | |
| 47 | + // 更新 | |
| 48 | + WfForm updateObj = WfFormConvert.INSTANCE.convert(updateReqVO); | |
| 49 | + formMapper.updateById(updateObj); | |
| 50 | + } | |
| 51 | + | |
| 52 | + @Override | |
| 53 | + public void deleteForm(Long id) { | |
| 54 | + // 校验存在 | |
| 55 | + this.validateFormExists(id); | |
| 56 | + // 删除 | |
| 57 | + formMapper.deleteById(id); | |
| 58 | + } | |
| 59 | + | |
| 60 | + private void validateFormExists(Long id) { | |
| 61 | + if (formMapper.selectById(id) == null) { | |
| 62 | + throw exception(FORM_NOT_EXISTS); | |
| 63 | + } | |
| 64 | + } | |
| 65 | + | |
| 66 | + @Override | |
| 67 | + public WfForm getForm(Long id) { | |
| 68 | + return formMapper.selectById(id); | |
| 69 | + } | |
| 70 | + | |
| 71 | + @Override | |
| 72 | + public List<WfForm> getFormList(Collection<Long> ids) { | |
| 73 | + return formMapper.selectBatchIds(ids); | |
| 74 | + } | |
| 75 | + | |
| 76 | + @Override | |
| 77 | + public PageResult<WfForm> getFormPage(WfFormPageReqVO pageReqVO) { | |
| 78 | + return formMapper.selectPage(pageReqVO); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @Override | |
| 82 | + public List<WfForm> getFormList(WfFormExportReqVO exportReqVO) { | |
| 83 | + return formMapper.selectList(exportReqVO); | |
| 84 | + } | |
| 85 | + | |
| 86 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/dict/SysDictTypeController.java
| ... | ... | @@ -60,7 +60,7 @@ public class SysDictTypeController { |
| 60 | 60 | |
| 61 | 61 | @ApiOperation("/获得字典类型的分页列表") |
| 62 | 62 | @GetMapping("/page") |
| 63 | - @PreAuthorize("@ss.hasPermission('system:dict:quey')") | |
| 63 | + @PreAuthorize("@ss.hasPermission('system:dict:query')") | |
| 64 | 64 | public CommonResult<PageResult<SysDictTypeRespVO>> pageDictTypes(@Valid SysDictTypePageReqVO reqVO) { |
| 65 | 65 | return success(SysDictTypeConvert.INSTANCE.convertPage(dictTypeService.getDictTypePage(reqVO))); |
| 66 | 66 | } |
| ... | ... | @@ -68,7 +68,7 @@ public class SysDictTypeController { |
| 68 | 68 | @ApiOperation("/查询字典类型详细") |
| 69 | 69 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 70 | 70 | @GetMapping(value = "/get") |
| 71 | - @PreAuthorize("@ss.hasPermission('system:dict:quey')") | |
| 71 | + @PreAuthorize("@ss.hasPermission('system:dict:query')") | |
| 72 | 72 | public CommonResult<SysDictTypeRespVO> getDictType(@RequestParam("id") Long id) { |
| 73 | 73 | return success(SysDictTypeConvert.INSTANCE.convert(dictTypeService.getDictType(id))); |
| 74 | 74 | } |
| ... | ... | @@ -83,7 +83,7 @@ public class SysDictTypeController { |
| 83 | 83 | |
| 84 | 84 | @ApiOperation("导出数据类型") |
| 85 | 85 | @GetMapping("/export") |
| 86 | - @PreAuthorize("@ss.hasPermission('system:dict:quey')") | |
| 86 | + @PreAuthorize("@ss.hasPermission('system:dict:query')") | |
| 87 | 87 | @OperateLog(type = EXPORT) |
| 88 | 88 | public void export(HttpServletResponse response, @Valid SysDictTypeExportReqVO reqVO) throws IOException { |
| 89 | 89 | List<SysDictTypeDO> list = dictTypeService.getDictTypeList(reqVO); | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/notice/SysNoticeController.java
| ... | ... | @@ -56,7 +56,7 @@ public class SysNoticeController { |
| 56 | 56 | |
| 57 | 57 | @GetMapping("/page") |
| 58 | 58 | @ApiOperation("获取通知公告列表") |
| 59 | - @PreAuthorize("@ss.hasPermission('system:notice:quey')") | |
| 59 | + @PreAuthorize("@ss.hasPermission('system:notice:query')") | |
| 60 | 60 | public CommonResult<PageResult<SysNoticeRespVO>> pageNotices(@Validated SysNoticePageReqVO reqVO) { |
| 61 | 61 | return success(SysNoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO))); |
| 62 | 62 | } |
| ... | ... | @@ -64,7 +64,7 @@ public class SysNoticeController { |
| 64 | 64 | @GetMapping("/get") |
| 65 | 65 | @ApiOperation("获得通知公告") |
| 66 | 66 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 67 | - @PreAuthorize("@ss.hasPermission('system:notice:quey')") | |
| 67 | + @PreAuthorize("@ss.hasPermission('system:notice:query')") | |
| 68 | 68 | public CommonResult<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) { |
| 69 | 69 | return success(SysNoticeConvert.INSTANCE.convert(noticeService.getNotice(id))); |
| 70 | 70 | } | ... | ... |
yudao-admin-server/src/main/resources/application-local.yaml
| ... | ... | @@ -47,13 +47,13 @@ spring: |
| 47 | 47 | url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT |
| 48 | 48 | driver-class-name: com.mysql.jdbc.Driver |
| 49 | 49 | username: root |
| 50 | - password: root | |
| 50 | + password: 123456 | |
| 51 | 51 | slave: # 模拟从库,可根据自己需要修改 |
| 52 | 52 | name: ruoyi-vue-pro |
| 53 | 53 | url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT |
| 54 | 54 | driver-class-name: com.mysql.jdbc.Driver |
| 55 | 55 | username: root |
| 56 | - password: root | |
| 56 | + password: 123456 | |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | activiti: | ... | ... |