kongzy
2023-11-28 59d9ea33f503e363f2e2941c7c00cc9dd9d9d1c7
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,7 +176,7 @@
            return;
        }
        this.dangerousFlag = false;
        this.dangerousFlag = false;//二级审批标志
        this.adminApproveUserId = null;
        for (OpeApply opeApply : this.selectedList) {
            if (!this.opeApplyService.isApplyPendingApproval(opeApply)) {
@@ -188,13 +189,22 @@
                    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;
                    }
                }
            }
        }
        this.memo = null;
@@ -228,20 +238,19 @@
                    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());
                }
            }
            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("操作失败。");
@@ -270,6 +279,7 @@
            FacesUtils.info("已拒绝。");
            RequestContext.getCurrentInstance().execute("PF('approvalDialog').hide()");
            RequestContext.getCurrentInstance().update("approvalMngForm:approvalMngDataTable");
        } catch (Exception e) {
            logger.error("操作失败。", e);
            FacesUtils.warn("操作失败。");
@@ -466,22 +476,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);
                }
            };
        }