1. 升级 3.0.35 补全 bpm api

This commit is contained in:
chenbowen
2025-09-24 15:28:40 +08:00
parent 7cbcd15399
commit af60a8c020
20 changed files with 969 additions and 2 deletions

View File

@@ -0,0 +1,79 @@
package com.zt.plat.module.bpm.api.definition;
import com.zt.plat.framework.common.enums.CommonStatusEnum;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.bpm.api.definition.dto.BpmCategoryPageReqDTO;
import com.zt.plat.module.bpm.api.definition.dto.BpmCategoryRespDTO;
import com.zt.plat.module.bpm.api.definition.dto.BpmCategorySaveReqDTO;
import com.zt.plat.module.bpm.controller.admin.definition.vo.category.BpmCategoryPageReqVO;
import com.zt.plat.module.bpm.controller.admin.definition.vo.category.BpmCategorySaveReqVO;
import com.zt.plat.module.bpm.dal.dataobject.definition.BpmCategoryDO;
import com.zt.plat.module.bpm.service.definition.BpmCategoryService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
/**
* BPM 流程分类 Api 实现类
*
* @author ZT
*/
@RestController
@Validated
public class BpmCategoryApiImpl implements BpmCategoryApi {
@Resource
private BpmCategoryService categoryService;
@Override
public CommonResult<Long> createCategory(@Valid BpmCategorySaveReqDTO createReqDTO) {
BpmCategorySaveReqVO createReqVO = BeanUtils.toBean(createReqDTO, BpmCategorySaveReqVO.class);
return success(categoryService.createCategory(createReqVO));
}
@Override
public CommonResult<Boolean> updateCategory(@Valid BpmCategorySaveReqDTO updateReqDTO) {
BpmCategorySaveReqVO updateReqVO = BeanUtils.toBean(updateReqDTO, BpmCategorySaveReqVO.class);
categoryService.updateCategory(updateReqVO);
return success(true);
}
@Override
public CommonResult<Boolean> updateCategorySortBatch(List<Long> ids) {
categoryService.updateCategorySortBatch(ids);
return success(true);
}
@Override
public CommonResult<Boolean> deleteCategory(Long id) {
categoryService.deleteCategory(id);
return success(true);
}
@Override
public CommonResult<BpmCategoryRespDTO> getCategory(Long id) {
BpmCategoryDO category = categoryService.getCategory(id);
return success(BeanUtils.toBean(category, BpmCategoryRespDTO.class));
}
@Override
public CommonResult<PageResult<BpmCategoryRespDTO>> getCategoryPage(@Valid BpmCategoryPageReqDTO pageReqDTO) {
BpmCategoryPageReqVO pageReqVO = BeanUtils.toBean(pageReqDTO, BpmCategoryPageReqVO.class);
PageResult<BpmCategoryDO> pageResult = categoryService.getCategoryPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, BpmCategoryRespDTO.class));
}
@Override
public CommonResult<List<BpmCategoryRespDTO>> getCategorySimpleList() {
List<BpmCategoryDO> list = categoryService.getCategoryListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(BeanUtils.toBean(list, BpmCategoryRespDTO.class));
}
}

View File

@@ -0,0 +1,76 @@
package com.zt.plat.module.bpm.api.definition;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.bpm.api.definition.dto.BpmFormPageReqDTO;
import com.zt.plat.module.bpm.api.definition.dto.BpmFormRespDTO;
import com.zt.plat.module.bpm.api.definition.dto.BpmFormSaveReqDTO;
import com.zt.plat.module.bpm.controller.admin.definition.vo.form.BpmFormPageReqVO;
import com.zt.plat.module.bpm.controller.admin.definition.vo.form.BpmFormSaveReqVO;
import com.zt.plat.module.bpm.dal.dataobject.definition.BpmFormDO;
import com.zt.plat.module.bpm.service.definition.BpmFormService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
/**
* 动态表单 Api 实现类
*
* @author ZT
*/
@RestController
@Validated
public class BpmFormApiImpl implements BpmFormApi {
@Resource
private BpmFormService formService;
@Override
public CommonResult<Long> createForm(@Valid BpmFormSaveReqDTO createReqDTO) {
BpmFormSaveReqVO createReqVO = BeanUtils.toBean(createReqDTO, BpmFormSaveReqVO.class);
return success(formService.createForm(createReqVO));
}
@Override
public CommonResult<Boolean> updateForm(@Valid BpmFormSaveReqDTO updateReqDTO) {
BpmFormSaveReqVO updateReqVO = BeanUtils.toBean(updateReqDTO, BpmFormSaveReqVO.class);
formService.updateForm(updateReqVO);
return success(true);
}
@Override
public CommonResult<Boolean> deleteForm(Long id) {
formService.deleteForm(id);
return success(true);
}
@Override
public CommonResult<BpmFormRespDTO> getForm(Long id) {
BpmFormDO form = formService.getForm(id);
return success(BeanUtils.toBean(form, BpmFormRespDTO.class));
}
@Override
public CommonResult<PageResult<BpmFormRespDTO>> getFormPage(BpmFormPageReqDTO pageReqDTO) {
BpmFormPageReqVO pageReqVO = BeanUtils.toBean(pageReqDTO, BpmFormPageReqVO.class);
PageResult<BpmFormDO> pageResult = formService.getFormPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, BpmFormRespDTO.class));
}
@Override
public CommonResult<List<BpmFormRespDTO>> getFormSimpleList() {
List<BpmFormDO> list = formService.getFormList();
// 只返回 id、name 字段
List<BpmFormRespDTO> dtoList = list.stream()
.map(formDO -> new BpmFormRespDTO().setId(formDO.getId()).setName(formDO.getName()))
.collect(java.util.stream.Collectors.toList());
return success(dtoList);
}
}

View File

@@ -0,0 +1,41 @@
package com.zt.plat.module.bpm.api.definition;
import com.zt.plat.framework.common.enums.CommonStatusEnum;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.bpm.api.definition.dto.BpmUserGroupRespDTO;
import com.zt.plat.module.bpm.dal.dataobject.definition.BpmUserGroupDO;
import com.zt.plat.module.bpm.service.definition.BpmUserGroupService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
/**
* 用户组 Api 实现类
*
* @author ZT
*/
@RestController
@Validated
public class BpmUserGroupApiImpl implements BpmUserGroupApi {
@Resource
private BpmUserGroupService userGroupService;
@Override
public CommonResult<BpmUserGroupRespDTO> getUserGroup(Long id) {
BpmUserGroupDO userGroup = userGroupService.getUserGroup(id);
return success(BeanUtils.toBean(userGroup, BpmUserGroupRespDTO.class));
}
@Override
public CommonResult<List<BpmUserGroupRespDTO>> getUserGroupSimpleList() {
List<BpmUserGroupDO> list = userGroupService.getUserGroupListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(BeanUtils.toBean(list, BpmUserGroupRespDTO.class));
}
}