|
|
@ -1,5 +1,9 @@
|
|
|
|
package cn.iocoder.yudao.module.archives.controller.admin.flow;
|
|
|
|
package cn.iocoder.yudao.module.archives.controller.admin.flow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.setting.service.passwords.PasswordsService;
|
|
|
|
|
|
|
|
import com.alibaba.druid.util.StringUtils;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
@ -8,9 +12,10 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.*;
|
|
|
|
|
|
|
|
import javax.validation.*;
|
|
|
|
import javax.validation.*;
|
|
|
|
import javax.servlet.http.*;
|
|
|
|
import javax.servlet.http.*;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
|
|
|
@ -27,6 +32,8 @@ import cn.iocoder.yudao.module.archives.controller.admin.flow.vo.*;
|
|
|
|
import cn.iocoder.yudao.module.archives.dal.dataobject.flow.FlowDO;
|
|
|
|
import cn.iocoder.yudao.module.archives.dal.dataobject.flow.FlowDO;
|
|
|
|
import cn.iocoder.yudao.module.archives.convert.flow.FlowConvert;
|
|
|
|
import cn.iocoder.yudao.module.archives.convert.flow.FlowConvert;
|
|
|
|
import cn.iocoder.yudao.module.archives.service.flow.FlowService;
|
|
|
|
import cn.iocoder.yudao.module.archives.service.flow.FlowService;
|
|
|
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import sun.security.util.Password;
|
|
|
|
|
|
|
|
|
|
|
|
@Tag(name = "管理后台 - 审批流程")
|
|
|
|
@Tag(name = "管理后台 - 审批流程")
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
@ -37,6 +44,13 @@ public class FlowController {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private FlowService flowService;
|
|
|
|
private FlowService flowService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private FileService fileService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private PasswordsService passwordsService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
|
@PostMapping("/create")
|
|
|
|
@Operation(summary = "创建审批流程")
|
|
|
|
@Operation(summary = "创建审批流程")
|
|
|
|
@PreAuthorize("@ss.hasPermission('archives:flow:create')")
|
|
|
|
@PreAuthorize("@ss.hasPermission('archives:flow:create')")
|
|
|
@ -44,6 +58,55 @@ public class FlowController {
|
|
|
|
return success(flowService.createFlow(createReqVO));
|
|
|
|
return success(flowService.createFlow(createReqVO));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 账簿上传
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@PostMapping("/upload")
|
|
|
|
|
|
|
|
@Operation(summary = "上传审批流程图")
|
|
|
|
|
|
|
|
@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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 填值规则Demo:生成订单号
|
|
|
|
|
|
|
|
* 【测试示例】
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public String execute(){
|
|
|
|
|
|
|
|
String prefix = "LC";
|
|
|
|
|
|
|
|
//订单前缀默认为CN 如果规则参数不为空,则取自定义前缀
|
|
|
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
|
|
|
|
|
|
|
String formatDateTime = now.format(formatter);
|
|
|
|
|
|
|
|
String value = prefix + formatDateTime;
|
|
|
|
|
|
|
|
// 根据formData的值的不同,生成不同的订单号
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(formatDateTime)) {
|
|
|
|
|
|
|
|
value += formatDateTime;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/downloadXml")
|
|
|
|
|
|
|
|
@Operation(summary = "获得审批流程分页")
|
|
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('archives:accounting-report:query')")
|
|
|
|
|
|
|
|
public void getAccountingReportPage(@Valid FlowPageReqVO pageVO, HttpServletResponse response) throws IOException {
|
|
|
|
|
|
|
|
PageResult<FlowDO> pageResult = flowService.getFlowPage(pageVO);
|
|
|
|
|
|
|
|
PageResult<FlowRespVO> voPageResult = FlowConvert.INSTANCE.convertPage(pageResult);
|
|
|
|
|
|
|
|
String jsonString = JSONObject.toJSONString(voPageResult);
|
|
|
|
|
|
|
|
passwordsService.jsonToXmlConverter(response,pageVO.getInputPassword(),jsonString);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PutMapping("/update")
|
|
|
|
@PutMapping("/update")
|
|
|
|
@Operation(summary = "更新审批流程")
|
|
|
|
@Operation(summary = "更新审批流程")
|
|
|
|
@PreAuthorize("@ss.hasPermission('archives:flow:update')")
|
|
|
|
@PreAuthorize("@ss.hasPermission('archives:flow:update')")
|
|
|
|