mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-05 22:04:06 +08:00
BPM Form 表单的完善
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.form;
|
||||
|
||||
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.dataobject.form.BpmFormDO;
|
||||
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;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -16,14 +14,11 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
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;
|
||||
|
||||
@Api(tags = "动态表单")
|
||||
@RestController
|
||||
@@ -63,7 +58,7 @@ public class BpmFormController {
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('bpm:form:query')")
|
||||
public CommonResult<BpmFormRespVO> getForm(@RequestParam("id") Long id) {
|
||||
BpmForm form = formService.getForm(id);
|
||||
BpmFormDO form = formService.getForm(id);
|
||||
return success(BpmFormConvert.INSTANCE.convert(form));
|
||||
}
|
||||
|
||||
@@ -72,7 +67,7 @@ public class BpmFormController {
|
||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
||||
@PreAuthorize("@ss.hasPermission('bpm:form:query')")
|
||||
public CommonResult<List<BpmFormRespVO>> getFormList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<BpmForm> list = formService.getFormList(ids);
|
||||
List<BpmFormDO> list = formService.getFormList(ids);
|
||||
return success(BpmFormConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@@ -80,7 +75,7 @@ public class BpmFormController {
|
||||
@ApiOperation("获得动态表单分页")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:form:query')")
|
||||
public CommonResult<PageResult<BpmFormRespVO>> getFormPage(@Valid BpmFormPageReqVO pageVO) {
|
||||
PageResult<BpmForm> pageResult = formService.getFormPage(pageVO);
|
||||
PageResult<BpmFormDO> pageResult = formService.getFormPage(pageVO);
|
||||
return success(BpmFormConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
|
@@ -11,18 +11,15 @@ import javax.validation.constraints.*;
|
||||
@Data
|
||||
public class BpmFormBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "表单名称", required = true)
|
||||
@ApiModelProperty(value = "表单名称", required = true, example = "芋道")
|
||||
@NotNull(message = "表单名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "商户状态", required = true)
|
||||
@NotNull(message = "商户状态不能为空")
|
||||
@ApiModelProperty(value = "表单状态", required = true, notes = "参见 CommonStatusEnum 枚举", example = "1")
|
||||
@NotNull(message = "表单状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "表单JSON")
|
||||
private String formJson;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
@ApiModelProperty(value = "备注", example = "我是备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
@@ -3,10 +3,21 @@ package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo;
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("动态表单创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmFormCreateReqVO extends BpmFormBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "表单的配置", required = true, notes = "JSON 字符串")
|
||||
@NotNull(message = "表单的配置不能为空")
|
||||
private String conf;
|
||||
|
||||
@ApiModelProperty(value = "表单项的数组", required = true, notes = "JSON 字符串的数组")
|
||||
@NotNull(message = "表单项的数组不能为空")
|
||||
private List<String> fields;
|
||||
|
||||
}
|
||||
|
@@ -1,34 +0,0 @@
|
||||
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
|
||||
*
|
||||
* @author 芋艿
|
||||
*/
|
||||
@Data
|
||||
public class BpmFormExcelVO {
|
||||
|
||||
@ExcelProperty("表单编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("表单名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("商户状态")
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty("表单JSON")
|
||||
private String formJson;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel(value = "动态表单 Excel 导出 Request VO", description = "参数和 BpmFormPageReqVO 是一致的")
|
||||
@Data
|
||||
public class BpmFormExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "表单名称")
|
||||
private String name;
|
||||
|
||||
}
|
@@ -13,7 +13,7 @@ import lombok.ToString;
|
||||
@ToString(callSuper = true)
|
||||
public class BpmFormPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "表单名称")
|
||||
@ApiModelProperty(value = "表单名称", example = "芋道")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
@@ -1,8 +1,14 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.annotations.*;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("动态表单 Response VO")
|
||||
@Data
|
||||
@@ -10,8 +16,15 @@ import io.swagger.annotations.*;
|
||||
@ToString(callSuper = true)
|
||||
public class BpmFormRespVO extends BpmFormBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "表单编号", required = true)
|
||||
@ApiModelProperty(value = "表单编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "表单的配置", required = true, notes = "JSON 字符串")
|
||||
@NotNull(message = "表单的配置不能为空")
|
||||
private String conf;
|
||||
|
||||
@ApiModelProperty(value = "表单项的数组", required = true, notes = "JSON 字符串的数组")
|
||||
@NotNull(message = "表单项的数组不能为空")
|
||||
private List<String> fields;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo;
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("动态表单更新 Request VO")
|
||||
@Data
|
||||
@@ -10,8 +11,16 @@ import javax.validation.constraints.*;
|
||||
@ToString(callSuper = true)
|
||||
public class BpmFormUpdateReqVO extends BpmFormBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "表单编号", required = true)
|
||||
@ApiModelProperty(value = "表单编号", required = true, example = "1024")
|
||||
@NotNull(message = "表单编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "表单的配置", required = true, notes = "JSON 字符串")
|
||||
@NotNull(message = "表单的配置不能为空")
|
||||
private String conf;
|
||||
|
||||
@ApiModelProperty(value = "表单项的数组", required = true, notes = "JSON 字符串的数组")
|
||||
@NotNull(message = "表单项的数组不能为空")
|
||||
private List<String> fields;
|
||||
|
||||
}
|
||||
|
@@ -1,10 +1,9 @@
|
||||
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.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
@@ -21,16 +20,14 @@ public interface BpmFormConvert {
|
||||
|
||||
BpmFormConvert INSTANCE = Mappers.getMapper(BpmFormConvert.class);
|
||||
|
||||
BpmForm convert(BpmFormCreateReqVO bean);
|
||||
BpmFormDO convert(BpmFormCreateReqVO bean);
|
||||
|
||||
BpmForm convert(BpmFormUpdateReqVO bean);
|
||||
BpmFormDO convert(BpmFormUpdateReqVO bean);
|
||||
|
||||
BpmFormRespVO convert(BpmForm bean);
|
||||
BpmFormRespVO convert(BpmFormDO bean);
|
||||
|
||||
List<BpmFormRespVO> convertList(List<BpmForm> list);
|
||||
List<BpmFormRespVO> convertList(List<BpmFormDO> list);
|
||||
|
||||
PageResult<BpmFormRespVO> convertPage(PageResult<BpmForm> page);
|
||||
|
||||
List<BpmFormExcelVO> convertList02(List<BpmForm> list);
|
||||
PageResult<BpmFormRespVO> convertPage(PageResult<BpmFormDO> page);
|
||||
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BpmForm extends BaseDO {
|
||||
public class BpmFormDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
@@ -37,12 +37,12 @@ public class BpmForm extends BaseDO {
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
// /**
|
||||
// * 表单JSON
|
||||
// */
|
||||
// private String formJson;
|
||||
/**
|
||||
* 表单配置
|
||||
* 表单的配置
|
||||
*/
|
||||
private String conf;
|
||||
/**
|
||||
* 表单项的数组
|
||||
*
|
||||
* 目前直接将 https://github.com/JakHuang/form-generator 生成的 JSON 串,直接保存
|
||||
* 定义:https://github.com/JakHuang/form-generator/issues/46
|
@@ -22,7 +22,7 @@ import java.util.Map;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BpmFormData extends BaseDO {
|
||||
public class BpmFormDataDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
@@ -31,7 +31,7 @@ public class BpmFormData extends BaseDO {
|
||||
/**
|
||||
* 表单编号
|
||||
*
|
||||
* 关联 {@link BpmForm#getId()}
|
||||
* 关联 {@link BpmFormDO#getId()}
|
||||
*/
|
||||
private Long formId;
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ public class BpmFormData extends BaseDO {
|
||||
/**
|
||||
* 表单配置
|
||||
*
|
||||
* 冗余 {@link BpmForm#getFields()}
|
||||
* 冗余 {@link BpmFormDO#getFields()}
|
||||
* 主要考虑,表单是可以修改的
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
@@ -1,26 +1,23 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.form;
|
||||
|
||||
|
||||
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.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO;
|
||||
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;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 动态表单 Mapper
|
||||
*
|
||||
* @author 风里雾里
|
||||
*/
|
||||
@Mapper
|
||||
public interface BpmFormMapper extends BaseMapperX<BpmForm> {
|
||||
public interface BpmFormMapper extends BaseMapperX<BpmFormDO> {
|
||||
|
||||
default PageResult<BpmForm> selectPage(BpmFormPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<BpmForm>()
|
||||
default PageResult<BpmFormDO> selectPage(BpmFormPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<BpmFormDO>()
|
||||
.likeIfPresent("name", reqVO.getName())
|
||||
.orderByDesc("id"));
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ 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.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.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -46,7 +46,7 @@ public interface BpmFormService {
|
||||
* @param id 编号
|
||||
* @return 动态表单
|
||||
*/
|
||||
BpmForm getForm(Long id);
|
||||
BpmFormDO getForm(Long id);
|
||||
|
||||
/**
|
||||
* 获得动态表单列表
|
||||
@@ -54,7 +54,7 @@ public interface BpmFormService {
|
||||
* @param ids 编号
|
||||
* @return 动态表单列表
|
||||
*/
|
||||
List<BpmForm> getFormList(Collection<Long> ids);
|
||||
List<BpmFormDO> getFormList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得动态表单分页
|
||||
@@ -62,6 +62,6 @@ public interface BpmFormService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 动态表单分页
|
||||
*/
|
||||
PageResult<BpmForm> getFormPage(BpmFormPageReqVO pageReqVO);
|
||||
PageResult<BpmFormDO> getFormPage(BpmFormPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.service.form;
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.service.form.impl;
|
||||
|
||||
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.dataobject.form.BpmFormDO;
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.form.BpmFormMapper;
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.service.form.BpmFormService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -33,7 +33,7 @@ public class BpmFormServiceImpl implements BpmFormService {
|
||||
@Override
|
||||
public Long createForm(BpmFormCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
BpmForm form = BpmFormConvert.INSTANCE.convert(createReqVO);
|
||||
BpmFormDO form = BpmFormConvert.INSTANCE.convert(createReqVO);
|
||||
formMapper.insert(form);
|
||||
// 返回
|
||||
return form.getId();
|
||||
@@ -44,7 +44,7 @@ public class BpmFormServiceImpl implements BpmFormService {
|
||||
// 校验存在
|
||||
this.validateFormExists(updateReqVO.getId());
|
||||
// 更新
|
||||
BpmForm updateObj = BpmFormConvert.INSTANCE.convert(updateReqVO);
|
||||
BpmFormDO updateObj = BpmFormConvert.INSTANCE.convert(updateReqVO);
|
||||
formMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@@ -63,17 +63,17 @@ public class BpmFormServiceImpl implements BpmFormService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmForm getForm(Long id) {
|
||||
public BpmFormDO getForm(Long id) {
|
||||
return formMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmForm> getFormList(Collection<Long> ids) {
|
||||
public List<BpmFormDO> getFormList(Collection<Long> ids) {
|
||||
return formMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BpmForm> getFormPage(BpmFormPageReqVO pageReqVO) {
|
||||
public PageResult<BpmFormDO> getFormPage(BpmFormPageReqVO pageReqVO) {
|
||||
return formMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
Reference in New Issue
Block a user