From 1123d12eb51d23edcd4a39660ef8cd47802b931d Mon Sep 17 00:00:00 2001 From: kongzy <kongzy> Date: 星期二, 30 一月 2024 11:06:32 +0800 Subject: [PATCH] change config --- src/main/java/com/nanometer/smartlab/controller/ApprovalMngController.java | 89 ++++++++++++++++++++++++++++++-------------- 1 files changed, 60 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/nanometer/smartlab/controller/ApprovalMngController.java b/src/main/java/com/nanometer/smartlab/controller/ApprovalMngController.java index 3b541bc..09f5862 100644 --- a/src/main/java/com/nanometer/smartlab/controller/ApprovalMngController.java +++ b/src/main/java/com/nanometer/smartlab/controller/ApprovalMngController.java @@ -93,7 +93,8 @@ String id=getUserId(); SysUser sysUser = sysUserService.getSysUser(id); // 不是管理员时 - if (sysUser.getSeeFlag().getKey() != SeeFlag.MANAGE.getKey()) { + if (sysUser.getSeeFlag().getKey() != SeeFlag.MANAGE.getKey() + && sysUser.getSeeFlag().getKey() != SeeFlag.LEADING.getKey()) { this.approvalFlag=false; }else { this.approvalFlag=true; @@ -175,26 +176,49 @@ return; } - this.dangerousFlag = false; + this.dangerousFlag = false;//二级审批标志 this.adminApproveUserId = null; + Map<Integer,Integer> checkMap=new HashMap<>(); for (OpeApply opeApply : this.selectedList) { if (!this.opeApplyService.isApplyPendingApproval(opeApply)) { FacesUtils.warn("只有待审批状态的数据可以审批。"); return; } - + String currentUserId = getUserId(); + if(StringUtils.isNotBlank(opeApply.getBeforeApproveUserId())&&!opeApply.getApproveUserId().equalsIgnoreCase(currentUserId)){ + FacesUtils.warn("提示您已审批完成,请等待二级审批者审批"); + return; + } /* if (DangerousFlag.DANGEROUS == opeApply.getReagent().getDangerousFlag()) { if (!"15fc90a1f7bf43bda01313904b543195".equals(this.getUser().getRoleId())) { dangerousFlag = true; } }*/ - String controlProducts = opeApply.getReagent().getControlProducts(); - if (StringUtils.isNotBlank(controlProducts)) { - String baseMetaValue = baseMetaService.getBaseMetaValue(controlProducts); - if (StringUtils.isNotBlank(baseMetaValue) && !"15fc90a1f7bf43bda01313904b543195".equals(this.getUser().getRoleId())) { + if(getActiveEnv().equalsIgnoreCase("gslab")){//姑苏实验室打开二级审批 + if(StringUtils.isBlank(opeApply.getBeforeApproveUserId())){ dangerousFlag = true; } + }else{//其他情形:管制品打开二级审批 + String controlProducts = opeApply.getReagent().getControlProducts(); + if (StringUtils.isNotBlank(controlProducts)) { + String baseMetaValue = baseMetaService.getBaseMetaValue(controlProducts); + if (StringUtils.isNotBlank(baseMetaValue) &&StringUtils.isBlank(opeApply.getBeforeApproveUserId())) { + dangerousFlag = true; + } + if(StringUtils.isNotBlank(baseMetaValue)) { + checkMap.put(1, 1); + }else{ + checkMap.put(0, 1); + } + }else{ + checkMap.put(0,1); + } } + + } + if(checkMap.size()>1){ + FacesUtils.warn("不允许管制品和非管制品同时审批"); + return; } this.memo = null; @@ -210,14 +234,12 @@ return; } - if (this.dangerousFlag) { - if (this.adminApproveUserId == null || "".equalsIgnoreCase(this.adminApproveUserId)) { - FacesUtils.warn("请选择系统管理员审批。"); - return; - } + if (this.dangerousFlag &&(this.adminApproveUserId == null || "".equalsIgnoreCase(this.adminApproveUserId))) { + FacesUtils.warn("请选择系统管理员审批。"); + return; } - + String currentUserId = getUserId(); List<String> applyIds = new ArrayList<>(); List<String> adminApplyIds = new ArrayList<>(); List<String> firstUserIds = new ArrayList<>(); @@ -228,20 +250,23 @@ applyIds.add(opeApply.getId()); }*/ - System.out.println("管制品========="+opeApply.getReagent().getControlProducts()); String baseMetaValue = baseMetaService.getBaseMetaValue(opeApply.getReagent().getControlProducts()); - if (this.dangerousFlag && StringUtils.isNotBlank(baseMetaValue)) { + //if (this.dangerousFlag && StringUtils.isNotBlank(baseMetaValue)) { + if (this.dangerousFlag&& StringUtils.isBlank(opeApply.getBeforeApproveUserId())) { adminApplyIds.add(opeApply.getId()); firstUserIds.add(opeApply.getApproveUserId()); } else { applyIds.add(opeApply.getId()); } + if(StringUtils.isNotBlank(opeApply.getBeforeApproveUserId())&&!opeApply.getApproveUserId().equalsIgnoreCase(currentUserId)){ + FacesUtils.warn("提示您已审批完成,请等待二级审批者审批"); + return; + } } - System.out.println("adminApplyIds=========="+adminApplyIds); - System.out.println(applyIds); boolean result = this.opeApplyService.updateSelectedOpeApplyStatus(memo, applyIds, adminApproveUserId, adminApplyIds,firstUserIds); FacesUtils.info("已批准。"); RequestContext.getCurrentInstance().execute("PF('approvalDialog').hide()"); + RequestContext.getCurrentInstance().update("approvalMngForm:approvalMngDataTable"); } catch (Exception e) { logger.error("操作失败。", e); FacesUtils.warn("操作失败。"); @@ -260,16 +285,21 @@ FacesUtils.warn("请将拒绝理由输入在批注中。"); return; } - + String currentUserId = getUserId(); List<String> applyIds = new ArrayList<String>(); for (OpeApply opeApply : this.selectedList) { applyIds.add(opeApply.getId()); + if(StringUtils.isNotBlank(opeApply.getBeforeApproveUserId())&&!opeApply.getApproveUserId().equalsIgnoreCase(currentUserId)){ + FacesUtils.warn("二级审批无权限"); + return; + } } this.opeApplyService.updateOpeApplyStatus(ApplyStatus.REFUSE, this.memo, applyIds); FacesUtils.info("已拒绝。"); RequestContext.getCurrentInstance().execute("PF('approvalDialog').hide()"); + RequestContext.getCurrentInstance().update("approvalMngForm:approvalMngDataTable"); } catch (Exception e) { logger.error("操作失败。", e); FacesUtils.warn("操作失败。"); @@ -466,22 +496,23 @@ /*} catch (Exception e) { logger.error(e); }*/ + selectedList = null; return list; } @Override public OpeApply getRowData(String rowKey) { - Iterator<OpeApply> iterator = this.iterator(); - if (iterator != null) { - OpeApply oa = null; - while (iterator.hasNext()) { - oa = iterator.next(); - if (rowKey.equals(oa.getId())) { - return oa; - } - } - } - return null; +// Iterator<OpeApply> iterator = this.iterator(); +// if (iterator != null) { +// OpeApply oa = null; +// while (iterator.hasNext()) { +// oa = iterator.next(); +// if (rowKey.equals(oa.getId())) { +// return oa; +// } +// } +// } + return opeApplyService.getOpeApply(rowKey); } }; } -- Gitblit v1.9.2