李宇
2021-08-18 c3510da29a7974c6af7ff3de1ade3db429d6f848
src/main/java/com/nanometer/smartlab/controller/ApplyMngController.java
@@ -5,6 +5,7 @@
import com.nanometer.smartlab.entity.SysReagent;
import com.nanometer.smartlab.entity.SysUser;
import com.nanometer.smartlab.entity.enumtype.ApplyStatus;
import com.nanometer.smartlab.entity.enumtype.ValidFlag;
import com.nanometer.smartlab.exception.BusinessException;
import com.nanometer.smartlab.service.*;
import com.nanometer.smartlab.util.Constants;
@@ -239,7 +240,7 @@
            if(selectedList!=null&&selectedList.size()>0){
                realDataList=selectedList;
            }else {
                realDataList=opeApplyService.getOpeApplyList(reagentName, startDeadline, endDeadline, status, getUserId(), null, queryCAS, null, null,null,applyUserName);
                realDataList=opeApplyService.getOpeApplyList(reagentName, startDeadline, endDeadline, status, getUserId(), null, queryCAS, null, null,null,applyUserName,(byte)1);
            }
             List<String> headerList = new ArrayList<>();
@@ -501,10 +502,10 @@
                public List<OpeApply> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
                    List<OpeApply> list = null;
                    try {
                        int count = opeApplyService.getOpeApplyTotalCount(reagentName, startDeadline, endDeadline, status, getUserId(), null, queryCAS,null,applyUserName);
                        int count = opeApplyService.getOpeApplyTotalCount(reagentName, startDeadline, endDeadline, status, getUserId(), null, queryCAS,null,applyUserName,(byte)1);
                        this.setRowCount(count);
                        if (count > 0) {
                            list = opeApplyService.getOpeApplyList(reagentName, startDeadline, endDeadline, status, getUserId(), null, queryCAS, first, pageSize,null,applyUserName);
                            list = opeApplyService.getOpeApplyList(reagentName, startDeadline, endDeadline, status, getUserId(), null, queryCAS, first, pageSize,null,applyUserName,(byte)1);
                            for(int i=0;i<list.size();i++){
                                if(list.get(i).getBeforeApproveUserId()!=null&&!list.get(i).getBeforeApproveUserId().equals("")){
                                    String name=list.get(i).getApproveUserName();
@@ -519,22 +520,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);
                }
            };
        }
@@ -562,17 +564,17 @@
                @Override
                public SysReagent getRowData(String rowKey) {
                    Iterator<SysReagent> iterator = this.iterator();
                    if (iterator != null) {
                        SysReagent sr = null;
                        while (iterator.hasNext()) {
                            sr = iterator.next();
                            if (rowKey.equals(sr.getId())) {
                                return sr;
                            }
                        }
                    }
                    return null;
//                    Iterator<SysReagent> iterator = this.iterator();
//                    if (iterator != null) {
//                        SysReagent sr = null;
//                        while (iterator.hasNext()) {
//                            sr = iterator.next();
//                            if (rowKey.equals(sr.getId())) {
//                                return sr;
//                            }
//                        }
//                    }
                    return sysReagentService.getRowData(rowKey);
                }
            };
        }
@@ -601,17 +603,17 @@
                @Override
                public SysReagent getRowData(String rowKey) {
                    Iterator<SysReagent> iterator = this.iterator();
                    if (iterator != null) {
                        SysReagent sr = null;
                        while (iterator.hasNext()) {
                            sr = iterator.next();
                            if (rowKey.equals(sr.getId())) {
                                return sr;
                            }
                        }
                    }
                    return null;
//                    Iterator<SysReagent> iterator = this.iterator();
//                    if (iterator != null) {
//                        SysReagent sr = null;
//                        while (iterator.hasNext()) {
//                            sr = iterator.next();
//                            if (rowKey.equals(sr.getId())) {
//                                return sr;
//                            }
//                        }
//                    }
                    return sysReagentService.getRowData(rowKey);
                }
            };
        }
@@ -629,12 +631,13 @@
                        String applyUserId = getUserId();
                        int count = 0;
                        if (StringUtils.isNotBlank(applyUserId)) {
                            count = opeApplyService.getOpeApplyTotalCount(null, null, null, null, applyUserId, null, null,applyCode,null);
                            count = opeApplyService.getOpeApplyTotalCount(null, null, null, null, applyUserId, null, null,applyCode,null,(byte)1);
                        }
                        this.setRowCount(count);
                        if (count > 0) {
                            list = opeApplyService.getOpeApplyList(null, null, null, null, applyUserId, null, null, first, pageSize,applyCode,null);
                            list = opeApplyService.getOpeApplyList(null, null, null, null, applyUserId, null, null, first, pageSize,applyCode,null,(byte)1);
                        }
                        selectedList = null;
                    } catch (Exception e) {
                        logger.error(e);
                    }
@@ -643,17 +646,17 @@
                @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);
                }
            };
        }
@@ -741,7 +744,17 @@
            //申请一个申购编号
            String applyCode = this.sysSequenceService.getApplyCode();
            for (OpeApply opeApply : this.applyNewList) {
                if (opeApply.getReagent().getValidFlag() == null
                        ||opeApply.getReagent().getValidFlag().equals(ValidFlag.INVALID)){
                    FacesUtils.warn(opeApply.getReagent().getName()+",该试剂已删除,请选择其他试剂");
                    return;
                }
                if (opeApply.getReagent().getType() == 1
                        && (opeApply.getReagent().getSupplierFlag() == null
                        || opeApply.getReagent().getSupplierFlag().equals(ValidFlag.INVALID))){
                    FacesUtils.warn(opeApply.getReagent().getName()+",该试剂供应商已删除,请选择其他试剂");
                    return;
                }
                opeApply.setId(IDUtils.uuid());
                opeApply.setApplyCode(applyCode);
                opeApply.setApplyUserId(applyUser.getId());