package com.nanometer.smartlab.controller; import com.nanometer.smartlab.entity.OpeApply; import com.nanometer.smartlab.entity.SysProject; 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; import com.nanometer.smartlab.util.FacesUtils; import com.nanometer.smartlab.util.IDUtils; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.primefaces.context.RequestContext; import org.primefaces.event.FileUploadEvent; import org.primefaces.event.SelectEvent; import org.primefaces.event.TabChangeEvent; import org.primefaces.model.LazyDataModel; import org.primefaces.model.SortOrder; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import javax.faces.event.AjaxBehaviorEvent; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; import java.sql.Timestamp; import java.util.*; /** * Created by johnny on 17/12/12. */ @Controller @Scope("session") public class ApplyMngController extends BaseController { private static Logger logger = Logger.getLogger(ApplyMngController.class); @Resource private OpeApplyService opeApplyService; @Resource private MenuController menuController; @Resource private SysReagentService sysReagentService; @Resource private SysUserService sysUserService; @Resource private SysSequenceService sysSequenceService; @Resource private SysProjectService sysProjectService; @Resource private BaseMetaService baseMetaService; private LazyDataModel dataModel; private OpeApply opeApply; private List selectedList; private String reagentName; private String queryCAS; private String applyUserName; private Timestamp startDeadline; private Timestamp endDeadline; private Integer status; private Integer favor; private List statusSelectList; private String controlProduct; private LazyDataModel reagentDataModel; private LazyDataModel reagentFavorDataModel; private String applyNewReagentName; private String applyNewCas; private String applyNewSn; private SysReagent selectReagent; private int tabValue; private boolean isFlush = false; public SysReagent getSelectReagent() { return selectReagent; } public void setSelectReagent(SysReagent selectReagent) { try { sysUserService.updateUserFavor(selectReagent, getUser()); this.isFlush = true; } catch (Exception e) { e.printStackTrace(); FacesUtils.warn(e.getMessage()); } this.selectReagent = selectReagent; } public String getApplyUserName() { return applyUserName; } public void setApplyUserName(String applyUserName) { this.applyUserName = applyUserName; } public String getApplyNewSn() { return applyNewSn; } public void setApplyNewSn(String applyNewSn) { this.applyNewSn = applyNewSn; } private List approveUserSelectList; private SysReagent sysReagent; private LazyDataModel applyHistoryDataModel; // 新建申购List private List applyNewList; // 新建申购model已选List private List applyNewSelectedList; // 新建申购List编辑flag(1: 新建 2:修改) private int applyEditFlag = Constants.ACTION_ADD; private int action; private List sysProjectList; private String applyCode; public void initNewPage() { this.initApproveUserSelectList(); } public void initApproveUserSelectList() { this.approveUserSelectList = this.sysUserService.getHasProjectSysUserList(this.getUserDepartment(),this.getUserProject()); if (!CollectionUtils.isEmpty(this.approveUserSelectList)){ if(this.selectedList == null){ this.sysProjectList = sysProjectService.getSysProjectList(this.approveUserSelectList.get(0).getId()); }else{ this.sysProjectList = sysProjectService.getSysProjectList(this.selectedList.get(0).getApproveUserId()); } } } public void onNewBtnClick() { /*List list=opeApplyService.getOpeApplyList(null,null,null,null,null,null,null,null,null,null); for(int i=0;i 1) { FacesUtils.warn("只能选择一个数据进行修改。"); return; } if (!this.opeApplyService.isApplyPendingApproval(this.selectedList.get(0))) { FacesUtils.warn("只有待审批状态的数据可以修改。"); return; } this.opeApply = this.opeApplyService.getOpeApply(this.selectedList.get(0).getId()); this.action = Constants.ACTION_EDIT; this.menuController.goToPage(Constants.PAGE_APPLY_MNG_NEW, Constants.PAGE_APPLY_MNG); } public void onDeleteBtnClick() { try { if (this.selectedList == null || this.selectedList.size() == 0) { FacesUtils.warn("请选择数据。"); return; } for (OpeApply oa : this.selectedList) { if (!this.opeApplyService.isApplyPendingApproval(oa)) { FacesUtils.warn("只有待审批状态的数据可以删除。"); return; } } this.opeApplyService.deleteOpeApply(this.selectedList); FacesUtils.info("删除成功。"); } catch (Exception e) { logger.error("操作失败。", e); FacesUtils.warn("操作失败。"); } } public void onExportFileBtnClickNew(){ ServletOutputStream out = null; InputStream is = null; try { FacesContext ctx = FacesContext.getCurrentInstance(); ctx.responseComplete(); String contentType = "application/x-download"; HttpServletResponse response = (HttpServletResponse) ctx .getExternalContext().getResponse(); response.setContentType(contentType); StringBuffer contentDisposition = new StringBuffer(); contentDisposition.append("attachment;"); contentDisposition.append("filename=\""); contentDisposition.append("申购管理.xls"); contentDisposition.append("\""); response.setHeader( "Content-Disposition", new String(contentDisposition.toString().getBytes( System.getProperty("file.encoding")), "ISO8859-1")); out = response.getOutputStream(); Map tempMap = new HashMap(); List realDataList = new ArrayList<>(); //map=null; if(selectedList!=null&&selectedList.size()>0){ realDataList=selectedList; }else { realDataList=opeApplyService.getOpeApplyList(reagentName, startDeadline,controlProduct, endDeadline, status, getUserId(), null, queryCAS, null, null,null,applyUserName,(byte)1); } List headerList = new ArrayList<>(); headerList.add("申购编号"); headerList.add("产品编号"); headerList.add("试剂名称"); headerList.add("管制品"); headerList.add("规格型号"); headerList.add("包装"); headerList.add("含税售价"); headerList.add("CAS号"); headerList.add("危险性质"); headerList.add("供应商"); headerList.add("厂家"); headerList.add("试剂类型"); headerList.add("申购数量"); headerList.add("申购人"); headerList.add("申购人课题组"); headerList.add("申购人部门"); headerList.add("申购日期"); headerList.add("一级审批者"); headerList.add("二级审批者"); headerList.add("订单状态"); headerList.add("审批批注"); HSSFWorkbook hssfWorkbook =exportExcelNew(headerList, realDataList); hssfWorkbook.write(out); out.flush(); ctx.responseComplete(); }catch (Exception e) { if(is!=null){ try { is.close(); } catch (IOException e1) { e1.printStackTrace(); } } if(out!=null){ try { out.close(); } catch (IOException e1) { e1.printStackTrace(); } } e.printStackTrace(); }finally { if (is != null) { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } if (out != null) { try { out.close(); } catch (IOException e) { e.printStackTrace(); } } } } public void uploadApply(FileUploadEvent event){ try { opeApplyService.importApply(event, getUser()); FacesUtils.info("导入成功"); } catch (BusinessException e) { FacesUtils.warn(e.getMessage()); } catch (Exception e) { e.printStackTrace(); FacesUtils.warn("导入失败,请联系管理员"); } } public HSSFWorkbook exportExcelNew(List headerList, List dataList) { HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Integer total = null; HSSFSheet sheet = hssfWorkbook.createSheet("申购详情"); HSSFRow titlerRow = sheet.createRow(0); for(int i = 0; i < headerList.size(); i++) { titlerRow.createCell(i).setCellValue(headerList.get(i)); } for (int i = 0; i < dataList.size(); i++) { System.out.println(dataList.get(i)); HSSFRow dataRow = sheet.createRow(i + 1); dataRow.createCell(0).setCellValue(dataList.get(i).getApplyCode()== null ? "": String.valueOf(dataList.get(i).getApplyCode())); dataRow.createCell(1).setCellValue(dataList.get(i).getReagent().getProductSn()== null ? "": String.valueOf(dataList.get(i).getReagent().getProductSn())); dataRow.createCell(2).setCellValue(dataList.get(i).getReagent().getName()== null ? "": String.valueOf(dataList.get(i).getReagent().getName())); dataRow.createCell(3).setCellValue(dataList.get(i).getReagent().getControlProducts()== null ? "": String.valueOf(baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getControlProducts()))); dataRow.createCell(4).setCellValue(dataList.get(i).getReagent().getReagentFormat()== null ? "": String.valueOf(baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getReagentFormat()))); dataRow.createCell(5).setCellValue(dataList.get(i).getReagent().getMainMetering()== null ? "": String.valueOf(dataList.get(i).getReagent().getMainMetering())+baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getReagentUnit())); dataRow.createCell(6).setCellValue(dataList.get(i).getReagent().getPrice()== null ? "": String.valueOf(dataList.get(i).getReagent().getPrice())); dataRow.createCell(7).setCellValue(dataList.get(i).getReagent().getCas()== null ? "": String.valueOf(dataList.get(i).getReagent().getCas())); dataRow.createCell(8).setCellValue(dataList.get(i).getReagent().getReagentCharacter()== null ? "": String.valueOf(baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getReagentCharacter()))); dataRow.createCell(9).setCellValue(dataList.get(i).getReagent().getSupplierName()== null ? "": String.valueOf(dataList.get(i).getReagent().getSupplierName())); dataRow.createCell(10).setCellValue(dataList.get(i).getReagent().getProductHomeName()== null ? "": String.valueOf(dataList.get(i).getReagent().getProductHomeName())); dataRow.createCell(11).setCellValue(dataList.get(i).getReagent().getReagentType()== null ? "": String.valueOf(baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getReagentType()))); dataRow.createCell(12).setCellValue(String.valueOf(dataList.get(i).getNum())); dataRow.createCell(13).setCellValue(String.valueOf(dataList.get(i).getApplyUserName())); dataRow.createCell(14).setCellValue(dataList.get(i).getApplyUserProject() == null?"":String.valueOf(dataList.get(i).getApplyUserProject())); dataRow.createCell(15).setCellValue(dataList.get(i).getApplyUserDepartment() == null?"":String.valueOf(dataList.get(i).getApplyUserDepartment())); dataRow.createCell(16).setCellValue(String.valueOf(dataList.get(i).getCreateTime())); // SysUser u=sysUserService.getSysUser(dataList.get(i).getApproveUserId()); dataRow.createCell(17).setCellValue(String.valueOf(dataList.get(i).getFirName())); if(dataList.get(i).getBeforeApproveUserId()!=null && !dataList.get(i).getBeforeApproveUserId().equals("")){ //u=sysUserService.getSysUser(dataList.get(i).getBeforeApproveUserId()); dataRow.createCell(18).setCellValue(String.valueOf(dataList.get(i).getApproveUserName())); } //dataRow.createCell(14).setCellValue(String.valueOf(u.getName())); dataRow.createCell(19).setCellValue(String.valueOf(dataList.get(i).getStatus().getText())); dataRow.createCell(20).setCellValue(dataList.get(i).getMemo()==null ?"":String.valueOf(dataList.get(i).getMemo())); } return hssfWorkbook; } public void handleCancel() { try { if (this.selectedList == null || this.selectedList.size() == 0) { FacesUtils.warn("请选择数据。"); return; } for (OpeApply oa : this.selectedList) { if (!this.opeApplyService.isApplyPendingApproval(oa)) { FacesUtils.warn("只有待审批状态的数据可以取消。"); return; } } for (OpeApply ope:this.selectedList) { this.opeApplyService.cancelApply(ApplyStatus.CANCEL,ope.getId()); } FacesUtils.info("取消成功。"); } catch (Exception e) { logger.error("操作失败。", e); FacesUtils.warn("操作失败。"); } } public void onCancelBtnClick() { this.menuController.backToPage(); } public void onResetBtnClick() { this.opeApply = new OpeApply(); this.opeApply.setReagent(new SysReagent()); } public void onSaveBtnClick() { try { // 新建 if (this.action == Constants.ACTION_ADD) { if (this.opeApply == null) { FacesUtils.warn("新建对象为空。"); return; } if (this.opeApply.getReagent() == null || StringUtils.isBlank(this.opeApply.getReagent().getId())) { FacesUtils.warn("请选择申购产品。"); return; } SysUser applyUser = this.getUser(); if (applyUser == null) { FacesUtils.warn("当前登陆用户信息未能找到。"); return; } this.opeApply.setApplyCode(this.sysSequenceService.getApplyCode()); this.opeApply.setApplyUserId(applyUser.getId()); //this.opeApply.setStatus(ApplyStatus.PENDING_APPROVAL); this.opeApplyService.insertOpeApply(this.opeApply); if(getActiveEnv().equalsIgnoreCase("gslab")){//姑苏实验室先进入待审批状态,然后再进入价格确认状态 this.opeApply.setStatus(ApplyStatus.PENDING_APPROVAL); }else{ this.opeApply.setStatus(ApplyStatus.Price_CONFIRM); } FacesUtils.info("新建成功。"); this.menuController.backToPage(); } else if (this.action == Constants.ACTION_EDIT) { if (this.opeApply == null) { FacesUtils.warn("修改对象为空。"); return; } if (this.opeApply.getReagent() == null || StringUtils.isBlank(this.opeApply.getReagent().getId())) { FacesUtils.warn("请选择申购产品。"); return; } this.opeApplyService.updateOpeApply(this.opeApply); FacesUtils.info("修改成功。"); this.menuController.backToPage(); } } catch (Exception e) { logger.error("操作失败。", e); FacesUtils.warn("操作失败。"); } } public void onTabChange(TabChangeEvent event) { if ("reagent".equals(event.getTab().getId())) { tabValue = 0; if (isFlush){ RequestContext.getCurrentInstance().execute("document.querySelector('.reagentSearch').click()"); isFlush = false; } }else if ("applyHistory".equals(event.getTab().getId())){ tabValue = 1; }else{ tabValue = 2; } } public void onReagentNewBtnClick() { this.sysReagent = new SysReagent(); } public void onReagentSaveBtnClick() { try { if (this.sysReagent == null) { FacesUtils.warn("新建对象为空。"); return; } this.sysReagent.setId(IDUtils.uuid()); this.sysReagentService.insertSysReagent(this.sysReagent); FacesUtils.info("新建成功。"); RequestContext.getCurrentInstance().execute("PF('dialog').hide()"); } catch (Exception e) { logger.error("操作失败。", e); FacesUtils.warn("操作失败。"); } } public void onReagentRowSelect(SelectEvent event) { this.opeApply = new OpeApply(); this.opeApply.setReagent((SysReagent) event.getObject()); if (this.action == Constants.ACTION_ADD) { this.applyEditFlag = Constants.ACTION_ADD; RequestContext.getCurrentInstance().execute("PF('applyDialog').show()"); } } public void onApplyHistoryRowSelect(SelectEvent event) { this.opeApply = new OpeApply(); this.opeApply = (OpeApply) event.getObject(); if (this.action == Constants.ACTION_ADD) { this.applyEditFlag = Constants.ACTION_ADD; RequestContext.getCurrentInstance().execute("PF('applyDialog').show()"); } } public LazyDataModel getDataModel() { if (this.dataModel == null) { this.dataModel = new LazyDataModel() { @Override public List load(int first, int pageSize, String sortField, SortOrder sortOrder, Map filters) { List list = null; try { int count = opeApplyService.getOpeApplyTotalCount(reagentName, startDeadline,controlProduct, endDeadline, status, getUserId(), null, queryCAS,null,applyUserName,(byte)1); this.setRowCount(count); if (count > 0) { list = opeApplyService.getOpeApplyList(reagentName, startDeadline,controlProduct, endDeadline, status, getUserId(), null, queryCAS, first, pageSize,null,applyUserName,(byte)1); for(int i=0;i 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); } }; } return dataModel; } public LazyDataModel getReagentDataModel() { if (this.reagentDataModel == null) { this.reagentDataModel = new LazyDataModel() { @Override public List load(int first, int pageSize, String sortField, SortOrder sortOrder, Map filters) { List list = null; try { int count = sysReagentService.reagentCount(getUser(), applyNewReagentName, applyNewCas, null, applyNewSn); this.setRowCount(count); if (count > 0) { list = sysReagentService.reagentList(getUser(), applyNewReagentName, applyNewCas, null, applyNewSn, first, pageSize,count); } } catch (Exception e) { logger.error(e); } return list; } @Override public SysReagent getRowData(String rowKey) { // Iterator 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); } }; } return reagentDataModel; } public LazyDataModel getReagentFavorDataModel() { if (this.reagentFavorDataModel == null) { this.reagentFavorDataModel = new LazyDataModel() { @Override public List load(int first, int pageSize, String sortField, SortOrder sortOrder, Map filters) { List list = null; try { int count = sysReagentService.favorCount(getUser(), null, null, null,null,1); this.setRowCount(count); if (count > 0) { list = sysReagentService.favorList(getUser(),null, null,null, null,1, first, pageSize); } } catch (Exception e) { logger.error(e); } return list; } @Override public SysReagent getRowData(String rowKey) { // Iterator 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); } }; } return reagentFavorDataModel; } public LazyDataModel getApplyHistoryDataModel() { if (this.applyHistoryDataModel == null) { this.applyHistoryDataModel = new LazyDataModel() { @Override public List load(int first, int pageSize, String sortField, SortOrder sortOrder, Map filters) { List list = null; try { String applyUserId = getUserId(); int count = 0; if (StringUtils.isNotBlank(applyUserId)) { count = opeApplyService.getOpeApplyTotalCount(null, null, null,null, null, applyUserId, null, null,applyCode,null,(byte)1); } this.setRowCount(count); if (count > 0) { list = opeApplyService.getOpeApplyList(null, null,null, null, null, applyUserId, null, null, first, pageSize,applyCode,null,(byte)1); } selectedList = null; } catch (Exception e) { logger.error(e); } return list; } @Override public OpeApply getRowData(String rowKey) { // Iterator 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); } }; } return applyHistoryDataModel; } /** * 新建申购List_重置 */ public void onResetBtnClickForNewP() { this.applyNewList = new ArrayList(); } /** * 新建申购List_修改 */ public void onEditBtnClickForNewP() { if (this.applyNewSelectedList == null || this.applyNewSelectedList.size() == 0) { FacesUtils.warn("请选择数据。"); return; } if (this.applyNewSelectedList.size() > 1) { FacesUtils.warn("只能选择一个数据进行修改。"); return; } this.applyEditFlag = Constants.ACTION_EDIT; this.opeApply = this.applyNewSelectedList.get(0); RequestContext.getCurrentInstance().execute("PF('applyDialog').show()"); } /** * 新建申购List_删除 */ public void onDeleteBtnClickForNewP() { if (this.applyNewSelectedList == null || this.applyNewSelectedList.size() == 0) { FacesUtils.warn("请选择数据。"); return; } List selectedIds = new ArrayList(); for (OpeApply oa : this.applyNewSelectedList) { selectedIds.add(oa.getReagent().getId()); } Iterator it = this.applyNewList.iterator(); while (it.hasNext()) { OpeApply ope = it.next(); if (selectedIds.contains(ope.getReagent().getId())) { it.remove(); } } this.applyNewSelectedList = null; FacesUtils.info("删除成功。"); } /** * 新建申购List_保存 */ public void onSaveBtnClickForNewP() { try { if (this.applyNewList == null || this.applyNewList.size() == 0) { FacesUtils.warn("新建对象为空。"); return; } SysUser applyUser = this.getUser(); if (applyUser == null) { FacesUtils.warn("当前登陆用户信息未能找到。"); return; } //申请一个申购编号 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()); if(getActiveEnv().equalsIgnoreCase("gslab")){//姑苏实验室先进入待审批状态,然后再进入价格确认状态 opeApply.setStatus(ApplyStatus.PENDING_APPROVAL); }else{ opeApply.setStatus(ApplyStatus.Price_CONFIRM); } } this.opeApplyService.insertOpeApplyList(this.applyNewList); FacesUtils.info("新建成功。"); this.menuController.backToPage(); } catch (Exception e) { logger.error("操作失败。", e); FacesUtils.warn("操作失败。"); } } /** * 新建申购dialog_取消 */ public void onCancelBtnClickNew() { this.opeApply = new OpeApply(); RequestContext.getCurrentInstance().execute("PF('applyDialog').hide()"); } /** * 新建申购dialog_增加 */ public void onSaveBtnClickNew() { if (this.opeApply.getReagent() == null || StringUtils.isBlank(this.opeApply.getReagent().getId())) { FacesUtils.warn("请选择申购产品。"); RequestContext.getCurrentInstance().execute("PF('applyDialog').hide()"); return; } if (this.applyEditFlag == Constants.ACTION_ADD) { if (this.applyNewList.stream().filter(apply -> apply.getReagent().getId().equals(this.opeApply.getReagent().getId())).count() > 0) { FacesUtils.warn("该试剂已被增加!"); } else { this.applyNewList.add(this.opeApply); FacesUtils.info("增加成功。"); } } this.opeApply = new OpeApply(); RequestContext.getCurrentInstance().execute("PF('applyDialog').hide()"); } /** * 一键批量增加 按钮 */ public void onBatchSaveBtnClickNew() { if (this.selectedList.isEmpty()) { FacesUtils.warn("请选择申购产品。"); return; } //检查是否试剂已经加入列表 for(OpeApply opeapply:this.selectedList){ if (this.applyNewList.stream().filter(apply -> apply.getReagent().getId().equals(opeapply.getReagent().getId())).count() > 0) { FacesUtils.warn("名为:"+opeapply.getReagent().getName()+"的试剂已被增加!"); return; } } this.applyNewList.addAll(this.selectedList); FacesUtils.info("增加成功。"); } /** * 审批者名称取得 */ public String getUserName(String approveUserId) { if (!StringUtils.isEmpty(approveUserId)) { for (SysUser user : this.approveUserSelectList) { if (user.getId().equals(approveUserId)) { return user.getName(); } } } return ""; } public String getProjectName(String projectId) { String projectName = null; if (!CollectionUtils.isEmpty(this.sysProjectList)) { Optional first = this.sysProjectList.parallelStream().filter(sysProject -> StringUtils.isNotBlank(projectId) && StringUtils.isNotBlank(sysProject.getProjectId()) && projectId.equals(sysProject.getProjectId())).findFirst(); if (first.isPresent()) { projectName = first.get().getProjectName(); } } return projectName; } public void changeCharge(AjaxBehaviorEvent event) { this.sysProjectList = sysProjectService.getSysProjectList(this.opeApply.getApproveUserId()); } public OpeApply getOpeApply() { return opeApply; } public void setOpeApply(OpeApply opeApply) { this.opeApply = opeApply; } public List getSelectedList() { return selectedList; } public void setSelectedList(List selectedList) { this.selectedList = selectedList; } public String getReagentName() { return reagentName; } public void setReagentName(String reagentName) { this.reagentName = reagentName; } public Timestamp getStartDeadline() { return startDeadline; } public void setStartDeadline(Timestamp startDeadline) { this.startDeadline = startDeadline; } public Timestamp getEndDeadline() { return endDeadline; } public void setEndDeadline(Timestamp endDeadline) { this.endDeadline = endDeadline; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public String getApplyNewReagentName() { return applyNewReagentName; } public void setApplyNewReagentName(String applyNewReagentName) { this.applyNewReagentName = applyNewReagentName; } public String getApplyNewCas() { return applyNewCas; } public void setApplyNewCas(String applyNewCas) { this.applyNewCas = applyNewCas; } public int getAction() { return action; } public SysReagent getSysReagent() { return sysReagent; } public void setSysReagent(SysReagent sysReagent) { this.sysReagent = sysReagent; } public List getStatusSelectList() { if (this.statusSelectList == null) { this.statusSelectList = Arrays.asList(ApplyStatus.values()); } return statusSelectList; } public List getApproveUserSelectList() { if (this.approveUserSelectList == null) { initApproveUserSelectList(); } return approveUserSelectList; } public List getApplyNewList() { return applyNewList; } public void setApplyNewList(List applyNewList) { this.applyNewList = applyNewList; } public List getApplyNewSelectedList() { return applyNewSelectedList; } public void setApplyNewSelectedList(List applyNewSelectedList) { this.applyNewSelectedList = applyNewSelectedList; } public int getApplyEditFlag() { return applyEditFlag; } public String getQueryCAS() { return queryCAS; } public void setQueryCAS(String queryCAS) { this.queryCAS = queryCAS; } public List getSysProjectList() { return sysProjectList; } public void setSysProjectList(List sysProjectList) { this.sysProjectList = sysProjectList; } public String getApplyCode() { return applyCode; } public void setApplyCode(String applyCode) { this.applyCode = applyCode; } public int getTabValue() { return tabValue; } public void setTabValue(int tabValue) { this.tabValue = tabValue; } public String getControlProduct() { return controlProduct; } public void setControlProduct(String controlProduct) { this.controlProduct = controlProduct; } }