| | |
| | | |
| | | 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.SysLaboratory; |
| | | import com.nanometer.smartlab.service.SysLaboratoryService; |
| | | import com.nanometer.smartlab.service.*; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.log4j.Logger; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | |
| | | |
| | | import com.nanometer.smartlab.entity.SysController; |
| | | import com.nanometer.smartlab.entity.SysLaboratoryContainer; |
| | | import com.nanometer.smartlab.service.BaseMetaService; |
| | | import com.nanometer.smartlab.service.SysControllerService; |
| | | import com.nanometer.smartlab.service.SysLaboratoryContainerService; |
| | | import com.nanometer.smartlab.util.Constants; |
| | | import com.nanometer.smartlab.util.FacesUtils; |
| | | |
| | |
| | | private BaseMetaService baseMetaService; |
| | | @Resource |
| | | private SysLaboratoryService sysLaboratoryService; |
| | | @Resource |
| | | private SysProjectService sysProjectService; |
| | | /** |
| | | * 数据源 |
| | | */ |
| | |
| | | /** |
| | | * 数据模型 |
| | | */ |
| | | private SysLaboratoryContainer sysLaboratoryContainer; |
| | | private SysLaboratoryContainer sysLaboratoryContainer=new SysLaboratoryContainer(); |
| | | /** |
| | | * 选中的list |
| | | */ |
| | |
| | | return; |
| | | } |
| | | |
| | | sysLaboratoryContainer.setProject(null); |
| | | sysLaboratoryContainer.getProject(); |
| | | // sysLaboratoryContainer.setProject(null); |
| | | // sysLaboratoryContainer.getProject(); |
| | | |
| | | this.sysLaboratoryContainerService.updateSysLaboratoryContainer(sysLaboratoryContainer); |
| | | |
| | |
| | | public void export2Excel(){ |
| | | |
| | | try { |
| | | List<Map> list = sysLaboratoryContainerService.exportExcelList(laboratoryType, laboratoryName); |
| | | List<Map> list = sysLaboratoryContainerService.exportExcelList(laboratoryType, laboratoryName,project,controllerName); |
| | | sysLaboratoryContainerService.export2Excel(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | valuesList.add(cellInfo); |
| | | } |
| | | if (valuesList.size() != 10){ |
| | | break; |
| | | } |
| | | System.out.println("value : "+valuesList); |
| | | SysLaboratoryContainer sysLaboratoryContainer=new SysLaboratoryContainer(); |
| | | sysLaboratoryContainer.setLaboratoryId(getLabId(sysLaboratories,valuesList.get(0))); |
| | | sysLaboratoryContainer.setControllerCode(getConCode(sysControllers,valuesList.get(1))); |
| | | sysLaboratoryContainer.setContainerCode(valuesList.get(2)); |
| | | sysLaboratoryContainer.setType(getBaseMetaId(typeList,valuesList.get(3))); |
| | | sysLaboratoryContainer.setInfoCode(valuesList.get(4)); |
| | | sysLaboratoryContainer.setStructure(getBaseMetaId(struList,valuesList.get(5))); |
| | | sysLaboratoryContainer.setName(valuesList.get(6)); |
| | | if(valuesList.get(3).equals("智能柜")){ |
| | | sysLaboratoryContainer.setCharacterLeft(getBaseMetaId(charList,valuesList.get(7))); |
| | | sysLaboratoryContainer.setCharacterRight(getBaseMetaId(charList,valuesList.get(8))); |
| | | if (!valuesList.get(1).replace(" ","").isEmpty()){ |
| | | List<String> projects = Arrays.asList(valuesList.get(1).split(",")); |
| | | for (String project : projects) { |
| | | //不存再就直接推出 |
| | | if (!sysProjectService.isExistProject(project)) { |
| | | throw new Exception("课题组不存在,(" + i + "行)"); |
| | | } |
| | | } |
| | | //都存在就设置 |
| | | sysLaboratoryContainer.setProject(valuesList.get(1).replace(" ","")); |
| | | }else{ |
| | | sysLaboratoryContainer.setProject(null); |
| | | } |
| | | sysLaboratoryContainer.setControllerCode(getConCode(sysControllers,valuesList.get(2))); |
| | | sysLaboratoryContainer.setContainerCode(valuesList.get(3)); |
| | | sysLaboratoryContainer.setType(getBaseMetaId(typeList,valuesList.get(4))); |
| | | sysLaboratoryContainer.setInfoCode(valuesList.get(5)); |
| | | sysLaboratoryContainer.setStructure(getBaseMetaId(struList,valuesList.get(6))); |
| | | sysLaboratoryContainer.setName(valuesList.get(7)); |
| | | if(valuesList.get(4).equals("智能柜")){ |
| | | sysLaboratoryContainer.setCharacterLeft(getBaseMetaId(charList,valuesList.get(8))); |
| | | sysLaboratoryContainer.setCharacterRight(getBaseMetaId(charList,valuesList.get(9))); |
| | | } |
| | | sysLaboratoryContainers.add(sysLaboratoryContainer); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public String getBaseMetaId(List<BaseMeta> list,String name){ |
| | | String id=""; |
| | | public Long getBaseMetaId(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 getLabId(List<SysLaboratory> list,String name){ |
| | | String id=""; |
| | | public Long getLabId(List<SysLaboratory> list,String name){ |
| | | Long id=null; |
| | | for(int i=0;i<list.size();i++){ |
| | | if(list.get(i).getName().equals(name)){ |
| | | id=list.get(i).getId(); |
| | |
| | | List<SysLaboratoryContainer> list = null; |
| | | try { |
| | | int count = sysLaboratoryContainerService.getSysLaboratoryContainerTotalCount(laboratoryType, |
| | | laboratoryName,null,project,controllerName); |
| | | laboratoryName,null,project); |
| | | this.setRowCount(count); |
| | | if (count > 0) { |
| | | list = sysLaboratoryContainerService.getSysLaboratoryContainerList(laboratoryType, |
| | | laboratoryName,null,project,controllerName, first, pageSize); |
| | | laboratoryName,null,project, first, pageSize); |
| | | } |
| | | selectedList = new ArrayList<> (); |
| | | } catch (Exception e) { |
| | | logger.error(e); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public SysLaboratoryContainer getRowData(String rowKey) { |
| | | Iterator<SysLaboratoryContainer> iterator = this.iterator(); |
| | | if (iterator != null) { |
| | | SysLaboratoryContainer su = null; |
| | | while (iterator.hasNext()) { |
| | | su = iterator.next(); |
| | | if (rowKey.equals(su.getId())) { |
| | | return su; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | // Iterator<SysLaboratoryContainer> iterator = this.iterator(); |
| | | // if (iterator != null) { |
| | | // SysLaboratoryContainer su = null; |
| | | // while (iterator.hasNext()) { |
| | | // su = iterator.next(); |
| | | // if (rowKey.equals(su.getId())) { |
| | | // return su; |
| | | // } |
| | | // } |
| | | // } |
| | | Long id=Long.valueOf(rowKey); |
| | | return sysLaboratoryContainerService.getSysLaboratoryContainer(id); |
| | | } |
| | | }; |
| | | } |
| | |
| | | } |
| | | |
| | | public List<SysController> getControllers() { |
| | | if(controllers == null) |
| | | { |
| | | this.controllers = sysControllerService.getAllControllerList(); |
| | | } |
| | | |
| | | return controllers; |
| | | } |
| | | |