|
@@ -0,0 +1,96 @@
|
|
|
|
|
+package cn.iocoder.yudao.module.bpm.controller.admin.oa.business;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.module.bpm.controller.admin.oa.business.vo.OaBusinessPageReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.bpm.controller.admin.oa.business.vo.OaBusinessRespVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.bpm.controller.admin.oa.business.vo.OaBusinessSaveReqVO;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
+
|
|
|
|
|
+import javax.validation.*;
|
|
|
|
|
+import javax.servlet.http.*;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.business.OaBusinessDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.bpm.service.oa.business.OaBusinessService;
|
|
|
|
|
+
|
|
|
|
|
+@Tag(name = "管理后台 - 出差流程信息")
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/bpm/oa-business")
|
|
|
|
|
+@Validated
|
|
|
|
|
+public class OaBusinessController {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private OaBusinessService oaBusinessService;
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/create")
|
|
|
|
|
+ @Operation(summary = "创建出差流程信息")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:oa-business:create')")
|
|
|
|
|
+ public CommonResult<Long> createOaBusiness(@Valid @RequestBody OaBusinessSaveReqVO createReqVO) {
|
|
|
|
|
+ return success(oaBusinessService.createOaBusiness(createReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/update")
|
|
|
|
|
+ @Operation(summary = "更新出差流程信息")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:oa-business:update')")
|
|
|
|
|
+ public CommonResult<Boolean> updateOaBusiness(@Valid @RequestBody OaBusinessSaveReqVO updateReqVO) {
|
|
|
|
|
+ oaBusinessService.updateOaBusiness(updateReqVO);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @DeleteMapping("/delete")
|
|
|
|
|
+ @Operation(summary = "删除出差流程信息")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:oa-business:delete')")
|
|
|
|
|
+ public CommonResult<Boolean> deleteOaBusiness(@RequestParam("id") Long id) {
|
|
|
|
|
+ oaBusinessService.deleteOaBusiness(id);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/get")
|
|
|
|
|
+ @Operation(summary = "获得出差流程信息")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:oa-business:query')")
|
|
|
|
|
+ public CommonResult<OaBusinessRespVO> getOaBusiness(@RequestParam("id") Long id) {
|
|
|
|
|
+ OaBusinessDO oaBusiness = oaBusinessService.getOaBusiness(id);
|
|
|
|
|
+ return success(BeanUtils.toBean(oaBusiness, OaBusinessRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/page")
|
|
|
|
|
+ @Operation(summary = "获得出差流程信息分页")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:oa-business:query')")
|
|
|
|
|
+ public CommonResult<PageResult<OaBusinessRespVO>> getOaBusinessPage(@Valid OaBusinessPageReqVO pageReqVO) {
|
|
|
|
|
+ PageResult<OaBusinessDO> pageResult = oaBusinessService.getOaBusinessPage(pageReqVO);
|
|
|
|
|
+ return success(BeanUtils.toBean(pageResult, OaBusinessRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/export-excel")
|
|
|
|
|
+ @Operation(summary = "导出出差流程信息 Excel")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('bpm:oa-business:export')")
|
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
+ public void exportOaBusinessExcel(@Valid OaBusinessPageReqVO pageReqVO,
|
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ List<OaBusinessDO> list = oaBusinessService.getOaBusinessPage(pageReqVO).getList();
|
|
|
|
|
+ // 导出 Excel
|
|
|
|
|
+ ExcelUtils.write(response, "出差流程信息.xls", "数据", OaBusinessRespVO.class,
|
|
|
|
|
+ BeanUtils.toBean(list, OaBusinessRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|