Merge remote-tracking branch 'origin/main'

new
JiilingLee 1 year ago
commit e46c996889

@ -1,5 +1,9 @@
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 javax.annotation.Resource;
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.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
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.convert.flow.FlowConvert;
import cn.iocoder.yudao.module.archives.service.flow.FlowService;
import org.springframework.web.multipart.MultipartFile;
import sun.security.util.Password;
@Tag(name = "管理后台 - 审批流程")
@RestController
@ -37,6 +44,13 @@ public class FlowController {
@Resource
private FlowService flowService;
@Resource
private FileService fileService;
@Resource
private PasswordsService passwordsService;
@PostMapping("/create")
@Operation(summary = "创建审批流程")
@PreAuthorize("@ss.hasPermission('archives:flow:create')")
@ -44,6 +58,55 @@ public class FlowController {
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")
@Operation(summary = "更新审批流程")
@PreAuthorize("@ss.hasPermission('archives:flow:update')")

@ -66,4 +66,7 @@ public class FlowBaseVO {
@Schema(description = "归档状态")
private String archiveState;
@Schema(description = "密码")
String inputPassword;
}

@ -70,4 +70,7 @@ public class FlowPageReqVO extends PageParam {
@Schema(description = "归档状态")
private String archiveState;
@Schema(description = "密码")
String inputPassword;
}

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.archives.dal.dataobject.flow;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
@ -7,6 +8,7 @@ import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import lombok.experimental.Accessors;
/**
* DO
@ -16,6 +18,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@TableName("archives_flow")
@KeySequence("archives_flow_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@ -97,4 +100,9 @@ public class FlowDO extends BaseDO {
*/
private String archiveState;
/**
*
*/
String password;
}

Loading…
Cancel
Save