From 96051bb89c2f957d340a1173260c51cc2eb7749c Mon Sep 17 00:00:00 2001 From: Harry Yang Date: Tue, 3 Jan 2023 20:34:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=94=B3=E8=AF=B7=E9=83=A8?= =?UTF-8?q?=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/backend/ProcessController.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/cn/palmte/work/controller/backend/ProcessController.java b/src/main/java/cn/palmte/work/controller/backend/ProcessController.java index 4e408bb..7a6907b 100644 --- a/src/main/java/cn/palmte/work/controller/backend/ProcessController.java +++ b/src/main/java/cn/palmte/work/controller/backend/ProcessController.java @@ -482,11 +482,14 @@ public class ProcessController { entity.setTaxRate(form.getTaxRate()); entity.setContractNo(form.getContractNo()); entity.setContractName(form.getContractName()); - - entity.setApplyDept(form.getApplyDept()); entity.setSealTypes(SealTypeArray.of(form.getSealTypes())); entity.setAttachmentUri(JSON.toJSONString(form.getAttachments())); + entity.setApplyDept(form.getApplyDept()); + entity.setApplyDeptId(form.getApplyDeptId()); + entity.setApplyDeptLeaderId(form.getApplyDeptLeaderId()); + entity.setApplyDeptLeaderName(form.getApplyDeptLeaderName()); + entityManager.merge(entity); if (processType == ProcessType.sale_contract) { @@ -585,7 +588,8 @@ public class ProcessController { @ResponseBody @PostMapping("/query") - public Page list(@RequestBody ProcessQueryForm form, Pageable pageable) { + public Page list(@RequestBody ProcessQueryForm form, Pageable pageable, + @RequestParam(defaultValue = "false") boolean forAudit) { // 从 0 开始 PageRequest pageRequest = new PageRequest(pageable.getPageNumber() - 1, pageable.getPageSize(), new Sort(Sort.Direction.DESC, "lastUpdateAt", "createAt")); @@ -606,6 +610,10 @@ public class ProcessController { return repository.findAll(Example.of(projectProcess, exampleMatcher), pageRequest); } + private boolean isAdministrator(Admin admin) { + return admin != null && "admin".equals(admin.getUserName()); + } + // 审核 @Data static class AuditForm { @@ -646,7 +654,7 @@ public class ProcessController { if (admin == null) { throw ErrorMessageException.failed("权限不足"); } - if (Objects.equals("admin", admin.getUserName())) { + if (isAdministrator(admin)) { processService.revoke(id); } else {