public Integer getStart() { try { String sql = "select p from Terminfo p order by p.terminfoId desc"; Terminfo terminfo = (Terminfo) getHibernateTemplate().find(sql).get(0); return terminfo.getTerminfoId(); } catch (Exception ex) { System.out.println(ex.getMessage()); log.error("初始化终端信息中间表时出错!", ex); } return 0; }
/** 得到与当前组相关的所有终端号 */ public void GetAllTermno() { this.termnoList = new ArrayList<String>(); // 关联组 Organization org = (Organization) request.getSession().getAttribute("currentOrganization"); // 获得该组拥有的终端 List<Terminfo> terminfoSet = orgTermService.collectOrgTerms(org); Iterator<Terminfo> it = terminfoSet.iterator(); while (it.hasNext()) { Terminfo term = it.next(); if (term != null) { this.termnoList.add(term.getTermno()); } } }
/** * 通过终端信息得到终端所在地的地理属性名称 * * @param Terminfo terminfo * @return String */ public Places getLocation(Terminfo terminfo) { try { Integer placeId = terminfo.getPlaces().getPlacesId(); Places place = terminfoDefineService.findByPlaceId(placeId); LocationTypes location = gltmsumDefineService.findLocaitonByPlace(place); place.setLocationTypes(location); return place; } catch (Exception ex) { return null; } }
public void changeFormat() { Gltmsum gltmsum = null; this.gltmsumList = new ArrayList<Gltmsum>(); while (it.hasNext()) { Object[] rows = (Object[]) it.next(); gltmsum = new Gltmsum(); gltmsum.setDate(dateFormat(rows[0].toString())); Terminfo terminfo = terminfoDefineService.findByTerminfoId(Integer.parseInt(rows[1].toString())); if (getLocation(terminfo) != null) terminfo.setPlaces(getLocation(terminfo)); gltmsum.setTerminfo(terminfo); gltmsum.setCnt(Integer.parseInt(rows[4].toString())); gltmsum.setDays(Integer.parseInt(rows[5].toString())); gltmsum.setAmt( getCntPreDay(Integer.parseInt(rows[5].toString()), Integer.parseInt(rows[4].toString()))); this.gltmsumList.add(gltmsum); } }
/** * 通过终端信息得到终端所在地的名称 * * @param Terminfo terminfo * @return String */ public String getPlaceName(Terminfo terminfo) { Integer placeId = terminfo.getPlaces().getPlacesId(); String name = terminfoDefineService.findPlaceNameByPlaceId(placeId); return name; }