| | |
| | | |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.nanometer.smartlab.entity.BaseMeta; |
| | | 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.log4j.Logger; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | |
| | | @Resource |
| | | private SysLaboratoryService sysLaboratoryService; |
| | | @Resource |
| | | private SysLaboratoryContainerService sysLaboratoryContainerService; |
| | | @Resource |
| | | private BaseMetaService baseMetaService; |
| | | @Resource |
| | | private SysProjectService sysProjectService; |
| | | /** |
| | | * 数据源 |
| | | */ |
| | |
| | | private List<SysLaboratory> selectedList; |
| | | private String type; |
| | | private String name; |
| | | private String project; |
| | | |
| | | private int action; |
| | | |
| | |
| | | this.sysLaboratory = this.sysLaboratoryService.getSysLaboratory(this.selectedList.get(0).getId()); |
| | | this.action = Constants.ACTION_EDIT; |
| | | RequestContext.getCurrentInstance().execute("PF('dialog').show()"); |
| | | } |
| | | |
| | | public void exportLab2Excel(){ |
| | | try { |
| | | List<Map> list = sysLaboratoryService.exportLabList(type, name,project); |
| | | sysLaboratoryService.exportLab2Excel(list); |
| | | FacesUtils.info("导出成功"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | FacesUtils.warn("导出失败"); |
| | | } |
| | | } |
| | | |
| | | public void uploadFile(FileUploadEvent event) { |
| | |
| | | |
| | | } |
| | | valuesList.add(cellInfo); |
| | | |
| | | |
| | | } |
| | | if (valuesList.size() != 8){ |
| | | break; |
| | | } |
| | | System.out.println("value : "+valuesList); |
| | | SysLaboratory laboratory=new SysLaboratory(); |
| | |
| | | laboratory.setLocation1(valuesList.get(4)); |
| | | laboratory.setLocation2(valuesList.get(5)); |
| | | laboratory.setDepartment(returnDepartId(departList,valuesList.get(6))); |
| | | |
| | | if (valuesList.size() > 7 && !valuesList.get(7).replace(" ","").isEmpty()){ |
| | | List<String> projects = Arrays.asList(valuesList.get(7).split(",")); |
| | | for (String project : projects) { |
| | | //不存再就直接推出 |
| | | if (!sysProjectService.isExistProject(project)) { |
| | | throw new Exception("课题组不存在,(" + i + "行)"); |
| | | } |
| | | } |
| | | //都存在就设置 |
| | | laboratory.setProject(valuesList.get(7).replace(" ","")); |
| | | }else{ |
| | | laboratory.setProject(null); |
| | | } |
| | | sysLaboratories.add(laboratory); |
| | | } |
| | | sysLaboratoryService.insertSysReagentList(sysLaboratories); |
| | |
| | | return; |
| | | } |
| | | |
| | | //实体类重新获取项目组信息 |
| | | sysLaboratory.setProject(null); |
| | | sysLaboratory.getProject(); |
| | | this.sysLaboratoryService.updateSysLaboratory(sysLaboratory); |
| | | |
| | | FacesUtils.info("修改成功。"); |
| | |
| | | } |
| | | |
| | | this.sysLaboratoryService.deleteSysLaboratory(this.selectedList); |
| | | this.sysLaboratoryContainerService.delBySlcIds(this.selectedList); |
| | | |
| | | FacesUtils.info("删除成功。"); |
| | | } catch (Exception e) { |
| | |
| | | Map<String, Object> filters) { |
| | | List<SysLaboratory> list = null; |
| | | try { |
| | | int count = sysLaboratoryService.getSysLaboratoryTotalCount(type, name); |
| | | int count = sysLaboratoryService.getSysLaboratoryTotalCount(type, name,project); |
| | | this.setRowCount(count); |
| | | if (count > 0) { |
| | | list = sysLaboratoryService.getSysLaboratoryList(type, name, first, pageSize); |
| | | list = sysLaboratoryService.getSysLaboratoryList(type, name,project, first, pageSize); |
| | | } |
| | | selectedList = new ArrayList<> (); |
| | | } catch (Exception e) { |
| | | logger.error(e); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public SysLaboratory getRowData(String rowKey) { |
| | | Iterator<SysLaboratory> iterator = this.iterator(); |
| | | if (iterator != null) { |
| | | SysLaboratory su = null; |
| | | while (iterator.hasNext()) { |
| | | su = iterator.next(); |
| | | if (rowKey.equals(su.getId())) { |
| | | return su; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | // Iterator<SysLaboratory> iterator = this.iterator(); |
| | | // if (iterator != null) { |
| | | // SysLaboratory su = null; |
| | | // while (iterator.hasNext()) { |
| | | // su = iterator.next(); |
| | | // if (rowKey.equals(su.getId())) { |
| | | // return su; |
| | | // } |
| | | // } |
| | | // } |
| | | return sysLaboratoryService.getSysLaboratory(rowKey); |
| | | } |
| | | }; |
| | | } |
| | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getProject() { |
| | | return project; |
| | | } |
| | | |
| | | public void setProject(String project) { |
| | | this.project = project; |
| | | } |
| | | } |