|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package cn.iocoder.yudao.module.accounting.controller.admin.flow;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
|
|
|
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;
|
|
|
|
@ -9,6 +10,8 @@ import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.*;
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.convert.flow.FlowConvert;
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.flow.FlowDO;
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.service.flow.FlowService;
|
|
|
|
|
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
|
|
|
|
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
|
|
|
|
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
|
|
|
|
import cn.iocoder.yudao.module.setting.service.passwords.PasswordsService;
|
|
|
|
|
import com.alibaba.druid.util.StringUtils;
|
|
|
|
@ -53,28 +56,23 @@ public class FlowController {
|
|
|
|
|
@Operation(summary = "创建审批流程")
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('archives:flow:create')")
|
|
|
|
|
public CommonResult<Long> createFlow(@Valid @RequestBody FlowCreateReqVO createReqVO) {
|
|
|
|
|
createReqVO.setFlowCode(execute());
|
|
|
|
|
return success(flowService.createFlow(createReqVO));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 账簿上传
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@PostMapping("/upload")
|
|
|
|
|
@Operation(summary = "上传审批流程图")
|
|
|
|
|
@Operation(summary = "上传审批流程img")
|
|
|
|
|
@Parameter(name = "multipartFile", description = "文件", required = true)
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('archives:flow:create')")
|
|
|
|
|
public Long uploadAccountingBook(@RequestPart("multipartFile") MultipartFile multipartFile) {
|
|
|
|
|
FlowCreateReqVO vo = new FlowCreateReqVO();
|
|
|
|
|
try {
|
|
|
|
|
String uri = fileService.createFile(multipartFile.getName(), multipartFile.getOriginalFilename(), multipartFile.getBytes());
|
|
|
|
|
vo.setSuffix(multipartFile.getOriginalFilename())
|
|
|
|
|
.setFileUrl(uri)
|
|
|
|
|
.setFileAp(uri)
|
|
|
|
|
.setFlowCode(execute());
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return flowService.createFlow(vo);
|
|
|
|
|
public CommonResult<FileDO> upload(@RequestParam("multipartFile") MultipartFile multipartFile) throws IOException {
|
|
|
|
|
String fileUrl = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream()));
|
|
|
|
|
FilePageReqVO pageReqVO = new FilePageReqVO();
|
|
|
|
|
String lastSegment = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
|
|
|
|
|
pageReqVO.setPath(lastSegment);
|
|
|
|
|
PageResult<FileDO> filePage = fileService.getFilePage(pageReqVO);
|
|
|
|
|
return success(filePage.getList().get(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|