| | |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.nanometer.smartlab.entity.BaseMeta; |
| | | import com.nanometer.smartlab.entity.SysProject; |
| | | import com.nanometer.smartlab.entity.SysReagent; |
| | | import com.nanometer.smartlab.service.BaseMetaService; |
| | | import com.nanometer.smartlab.service.SysLaboratoryContainerService; |
| | | import com.nanometer.smartlab.service.SysProjectService; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.log4j.Logger; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | |
| | | /** |
| | | * 数据模型 |
| | | */ |
| | | private SysLaboratory sysLaboratory; |
| | | private SysLaboratory sysLaboratory=new SysLaboratory(); |
| | | /** |
| | | * 选中的list |
| | | */ |
| | |
| | | RequestContext.getCurrentInstance().execute("PF('dialog').show()"); |
| | | } |
| | | |
| | | public String getProjectName(String project){ |
| | | if(StringUtils.isBlank(project)){ |
| | | return ""; |
| | | } |
| | | List<String> idstrs = Arrays.asList(project.split(",")); |
| | | List<Long> ids=idstrs.stream().map(item -> Long.valueOf(item)).collect(Collectors.toList()); |
| | | List<SysProject> projects=this.sysProjectService.getProjectByIds(ids); |
| | | if(projects==null||projects.size()==0){ |
| | | return ""; |
| | | } |
| | | List<String> projectNames=projects.stream().map(SysProject::getProjectName).collect(Collectors.toList()); |
| | | return String.join(",",projectNames); |
| | | } |
| | | public void exportLab2Excel(){ |
| | | try { |
| | | List<Map> list = sysLaboratoryService.exportLabList(type, name,project); |
| | | List<SysLaboratory> list = sysLaboratoryService.exportLabList(type, name,project); |
| | | sysLaboratoryService.exportLab2Excel(list); |
| | | FacesUtils.info("导出成功"); |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | } |
| | | |
| | | public String returnTypeId(List<BaseMeta> list,String name){ |
| | | String id=""; |
| | | public Long returnTypeId(List<BaseMeta> list,String name){ |
| | | Long id=null; |
| | | for(int i=0;i<list.size();i++){ |
| | | if(name.equals(list.get(i).getMetaValue())){ |
| | | id=list.get(i).getId(); |
| | |
| | | return id; |
| | | } |
| | | |
| | | public String returnDepartId(List<BaseMeta> list,String name){ |
| | | String id=""; |
| | | public Long returnDepartId(List<BaseMeta> list,String name){ |
| | | Long id=null; |
| | | for(int i=0;i<list.size();i++){ |
| | | if(name.equals(list.get(i).getMetaValue())){ |
| | | id=list.get(i).getId(); |
| | |
| | | } |
| | | |
| | | //实体类重新获取项目组信息 |
| | | sysLaboratory.setProject(null); |
| | | sysLaboratory.getProject(); |
| | | // sysLaboratory.setProject(null); |
| | | // sysLaboratory.getProject(); |
| | | this.sysLaboratoryService.updateSysLaboratory(sysLaboratory); |
| | | |
| | | FacesUtils.info("修改成功。"); |
| | |
| | | // } |
| | | // } |
| | | // } |
| | | return sysLaboratoryService.getSysLaboratory(rowKey); |
| | | Long id=Long.valueOf(rowKey); |
| | | return sysLaboratoryService.getSysLaboratory(id); |
| | | } |
| | | }; |
| | | } |