List of usage examples for org.dom4j Document getRootElement
Element getRootElement();
From source file:com.ah.be.parameter.BeParaModuleDefImpl.java
public void insertDefaultCustomReportField() { try {/*from w w w . j a v a 2s . c o m*/ long rowCount = QueryUtil.findRowCount(AhCustomReportField.class, null); if (rowCount > 0) { return; } List<AhCustomReportField> reportFields = new ArrayList<>(); SAXReader reader = new SAXReader(); String docName = AhDirTools.getHmRoot() + "resources" + File.separator + "customReport" + File.separator + "custom_report_table.xml"; Document doc = reader.read(new File(docName)); Element root = doc.getRootElement(); List<?> rootLst = root.elements(); for (Object obj : rootLst) { List<?> rowlst = ((Element) obj).elements(); AhCustomReportField reportField = new AhCustomReportField(); for (int j = 0; j < rowlst.size(); j++) { Element elm = (Element) rowlst.get(j); // String name = elm.attributeValue("name"); String value = elm.attributeValue("value"); if (j == 0) { reportField.setId(Long.parseLong(value)); } else if (j == 1) { reportField.setType(Integer.parseInt(value)); } else if (j == 2) { reportField.setDetailType(Integer.parseInt(value)); } else if (j == 3) { reportField.setTableName(value); } else if (j == 4) { reportField.setTableField(value); } else if (j == 5) { reportField.setFieldString(value); } else if (j == 6) { reportField.setStrUnit(value); } else if (j == 7) { reportField.setDescription(value); } } reportFields.add(reportField); } root.clearContent(); doc.clearContent(); QueryUtil.bulkCreateBos(reportFields); } catch (Exception e) { setDebugMessage("insert default custom report field: ", e); } }
From source file:com.ah.be.performance.db.TablePartitionProcessor.java
private void init() { try {/*w ww . j av a2 s.co m*/ File f = new File(TABLE_PARTITION_CONF_FILE); SAXReader reader = new SAXReader(); Document doc = reader.read(f); Element root = doc.getRootElement(); Element cata = null; int catalog = 1; for (Iterator<?> i = root.elementIterator(); i.hasNext();) { //for catalog cata = (Element) i.next(); String enable = cata.elementText("enable"); if (enable != null && enable.equalsIgnoreCase("false")) continue; int default_maxtime = Integer.parseInt(cata.elementTextTrim("default_maxtime")); int default_interval = Integer.parseInt(cata.elementTextTrim("default_interval")); int table_partition_number = Integer.parseInt(cata.elementTextTrim("table_partition_number")); int default_max_record = Integer.parseInt(cata.elementTextTrim("default_max_record")); int default_max_record_per_partition = Integer .parseInt(cata.elementTextTrim("default_max_record_per_partition")); int maxtime_policy = Integer.parseInt(cata.elementTextTrim("maxtime_policy")); int interval_policy = Integer.parseInt(cata.elementTextTrim("interval_policy")); int max_record_policy = Integer.parseInt(cata.elementTextTrim("max_record_policy")); addTableCatalogInfo(catalog, default_maxtime, default_interval, table_partition_number, default_max_record, default_max_record_per_partition, maxtime_policy, interval_policy, max_record_policy); List<?> tableElements = cata.elements("table"); //for table in catalog for (int j = 0; j < tableElements.size(); j++) { Element table = (Element) tableElements.get(j); String tableName = table.attributeValue("name"); String schemaName = table.elementTextTrim("schemaname"); String timeField = table.elementTextTrim("timefield"); addTableInfo(schemaName, tableName, timeField, catalog); } catalog++; } } catch (Exception e) { BeLogTools.error(HmLogConst.M_PERFORMANCE_TABLEPARTITION, "Fail to init table partition configure file", e); } }
From source file:com.ah.ui.actions.config.USBModemAction.java
private List<USBModem> readUSBConfigFile(Document document) { List<USBModem> usbModemLst = new ArrayList<USBModem>(); Element root = document.getRootElement(); if (root != null) { for (Iterator<?> it = root.elementIterator(); it.hasNext();) { Element element = (Element) it.next(); if ("modems".equals(element.getName())) { for (Iterator<?> it1 = element.elementIterator(); it1.hasNext();) { Element element1 = (Element) it1.next(); if ("modem".equals(element1.getName())) { usbModemLst.add(readUSBModem(element1)); }/* w w w . jav a 2 s.c o m*/ } } } } return usbModemLst; }
From source file:com.ah.ui.actions.hiveap.HiveApFileAction.java
/** * Get the image product name and version from the header xml string * *@param lineStr -/* w w w .j a va2s . co m*/ *@return HiveApImageInfo */ private HiveApImageInfo getImageInfoHead(String lineStr) { try { if (!lineStr.startsWith("#!/bin/bash") || !lineStr.contains("<Image-Header") || !lineStr.contains("</Image-Header>") || !lineStr.contains("<Firmware>") || !lineStr.contains("</Firmware>")) { return null; } HiveApImageInfo info = new HiveApImageInfo(); SAXReader reader = new SAXReader(); String docName = lineStr.substring(lineStr.indexOf("<Firmware>"), lineStr.indexOf("</Firmware>") + "</Firmware>".length()); Document doc = reader.read(new StringReader(docName)); Element roota = doc.getRootElement(); Iterator<?> iter = roota.elementIterator(); Element foo; while (iter.hasNext()) { foo = (Element) iter.next(); // get product name if (foo.getName().equalsIgnoreCase("Product")) { info.setProductName(foo.getStringValue()); // get image version } else if (foo.getName().equalsIgnoreCase("Version")) { iter = foo.elementIterator(); while (iter.hasNext()) { foo = (Element) iter.next(); if (foo.getName().equalsIgnoreCase("External")) { iter = foo.elementIterator(); while (iter.hasNext()) { foo = (Element) iter.next(); // get major version if (foo.getName().equalsIgnoreCase("Major")) { info.setMajorVersion(foo.getStringValue()); // get minor version } else if (foo.getName().equalsIgnoreCase("Minor")) { info.setMinorVersion(foo.getStringValue()); // get release version } else if (foo.getName().equalsIgnoreCase("Release")) { info.setRelVersion(foo.getStringValue()); // get patch string } else if (foo.getName().equalsIgnoreCase("Patch")) { try { info.setImageUid(Integer.parseInt(foo.getStringValue())); } catch (NumberFormatException nfe) { info.setImageUid(0); } } } } } } } String regex = "^\\d+\\.+\\d+r\\d+\\w*$"; // check the product name and version format if ("".equals(info.getProductName()) || !Pattern.matches(regex, info.getImageVersion().trim())) { return null; } com.ah.be.config.image.ImageManager.updateHiveApImageInfo(info); return info; } catch (Exception ex) { log.error("checkImageInfo : ", ex.getMessage()); return null; } }
From source file:com.aisino2.icksystem.action.KongJianDiaoYongAction.java
public void kongJianDiaoYong() { HttpServletRequest request = ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); try {/*from w w w . j a v a 2 s . c o m*/ if (isUserStr(type) && "verifycardid".equals(type)) { // ??? // --- if (isUserStr(cardid)) { // modify on 2010-08-13 by mds begin //cardid = cardid.replace("-", ""); // ?? - ? // modify on 2010-08-13 by mds end Icksl icksl = new Icksl(); icksl.setIckh(cardid); String isDxr = ickslService.sfDxr(icksl); if (isUserStr(isDxr)) { renderText(response, isDxr); } } else { renderText(response, "FALSE"); // } renderText(response, ""); } // ???? - OK if (isUserStr(type) && "islogout".equals(type)) { if (isUserStr(cardid)) { // modify on 2010-08-13 by mds begin //cardid = cardid.replace("-", ""); // ?? - ? // modify on 2010-08-13 by mds end Icksl icksl = new Icksl(); icksl.setIckh(cardid); icksl = ickslService.getIcksl(icksl); // ?? ?? if ("7".equals(icksl.getZkztbs()) || "8".equals(icksl.getZkztbs()) || "9".equals(icksl.getZkztbs())) { renderText(response, "TRUE"); } } else { renderText(response, ""); // 09.06.09 ?? ? } renderText(response, ""); } // ?? - OK if (isUserStr(type) && "offlineversion".equals(type)) { Globalpar globalpar = new Globalpar(); Globalpar temp = null; // globalpar.setGlobalparcode("offline-bbhtest"); // globalpar.setGlobalparcode("offline-bbh"); List globList = CacheManager.getCacheGlobalpar(globalpar); if (globList != null && globList.size() > 0) { temp = (Globalpar) globList.get(0); } String OfflineVersion = temp.getGlobalparvalue().trim().replaceAll(",", "").substring(0, 4); renderText(response, OfflineVersion); } // prjwebcontrol.ocx - OK if (isUserStr(type) && "prjwebcontrol".equals(type)) { // String httpHead = request.getScheme() + "://" // + request.getServerName() + ":" // + request.getServerPort() + request.getContextPath() // + "/"; // String prjWebControlPatch = httpHead // + "active/prjWebControl.ocx"; String activePatch = "";// active? activePatch = QjblUtil.queryQjblVal("active-url"); String prjWebControlPatch = activePatch + "prjWebControl.ocx"; String exeDataString = ""; try { URL fileurl = new URL(prjWebControlPatch); exeDataString = fileToBase64(fileurl); } catch (Exception e) { e.printStackTrace(); } if (exeDataString == null) { exeDataString = ""; } renderText(response, exeDataString); } // - OK if (isUserStr(type) && "offline".equals(type)) { // String httpHead = request.getScheme() + "://" // + request.getServerName() + ":" // + request.getServerPort() + request.getContextPath() // + "/"; // String offlineExePatch = httpHead + "active/offline.exe"; String activePatch = "";// active? activePatch = QjblUtil.queryQjblVal("active-url"); String offlineExePatch = activePatch + "offline.exe"; String exeDataString = ""; try { URL fileurl = new URL(offlineExePatch); exeDataString = fileToBase64(fileurl); } catch (Exception e) { e.printStackTrace(); } if (exeDataString == null) { exeDataString = ""; } renderText(response, exeDataString); } // prjupdate.exe - OK if (isUserStr(type) && "prjupdate".equals(type)) { // String httpHead = request.getScheme() + "://" // + request.getServerName() + ":" // + request.getServerPort() + request.getContextPath() // + "/"; // String offlineExePatch = httpHead + "active/prjupdate.exe"; String activePatch = "";// active? activePatch = QjblUtil.queryQjblVal("active-url"); String prjupdateExePatch = activePatch + "prjupdate.exe"; String exeDataString = ""; try { URL fileurl = new URL(prjupdateExePatch); exeDataString = fileToBase64(fileurl); } catch (Exception e) { e.printStackTrace(); } if (exeDataString == null) { exeDataString = ""; } renderText(response, exeDataString); } // ?? - ?? ?? - OK if (isUserStr(type) && "upload".equals(type)) { //? Icksl icksl = null; Date sksjDates = null; String yjFlag = ""; // 0 1 2?? 3 ? String yjyy = ""; // String dwlb = ""; //?? ? String dwlbdm = ""; //??? ? Dict_item dict_item = new Dict_item(); dict_item.setDict_code("dm_ickyjyy"); SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); if (isUserStr(value)) { value = value.replace('_', '+'); value = value.replace('$', '='); value = getFromBASE64(value); String[] valueArray = value.split("%"); String skzdzc = QjblUtil.queryQjblVal("skzdzc");//? 0-? 1- for (int index = 0; index < valueArray.length; index++) { yjFlag = "";// ? yjyy = "";// ? icksl = null;// ? sksjDates = null;// ? String dantiaoString = valueArray[index]; dantiaoString = dantiaoString.replace("$", "%"); String[] dantiaoArray = dantiaoString.split("%"); // String eg = // "CHN$??$J024103030004000253$$$$$$20090615155236$2048070716$?$J023200000003$"; // String eg = // "CHN$$J014103020003090001$310106197709090823$2$$$20090619134629$690744610$$J044101050005$"; String qybm = String.valueOf(dantiaoArray[11]); //qybm=qybm.substring(1, 12); Qyjbxx qyjbxx = new Qyjbxx(); if (qybm.startsWith("N")) { qyjbxx.setQybm(qybm.substring(1, 12)); } else { qyjbxx.setQybm(qybm); } qyjbxx = qyjbxxService.getQyjbxx(qyjbxx); Date sxsj = null;// ? ,? Integer ryid = null; // ,? String kh = null; String sksj = String.valueOf(dantiaoArray[8]); sksj = sksj.substring(0, 4) + "-" + sksj.substring(4, 6) + "-" + sksj.substring(6, 8) + " " + sksj.substring(8, 10) + ":" + sksj.substring(10, 12) + ":" + sksj.substring(12, 14); sksjDates = stringToDate(sksj, "yyyy-MM-dd HH:mm:ss"); String ickh = String.valueOf(dantiaoArray[9]); String cyrybh = dantiaoArray[2]; String zjhm = dantiaoArray[3]; int qyryid = 0; //?? 20100903?? if (skzdzc == null || "".equals(skzdzc) || "1".equals(skzdzc)) { if (qyjbxx != null) { int qyid = qyjbxx.getQyid(); Qyryxx qyryxx = new Qyryxx(); //?14????????? 20110131 mds if (StringUtil.isNotEmpty(cyrybh) && cyrybh.length() == 14) qyryxx.setZjhm(zjhm); else qyryxx.setCyrybh(cyrybh); qyryxx = qyryxxService.getQyryxx(qyryxx); if (qyryxx != null) { qyryid = qyryxx.getRyid(); int qyrrxxQyid = qyryxx.getQyid(); dwlb = qyryxx.getCylb(); dwlbdm = qyryxx.getCylbdm(); //? if (Integer.parseInt(qyryxx.getZt()) < 90 && qyrrxxQyid != qyid) { qyryxx.setQyid(qyid); Date rzrq = modifyCyryRzrq(qyryxx, sksjDates); qyryxx.setRzrq(rzrq); qyryxx.setCyryzt(""); qyryxx.setCyryztdm("11"); qyryxx.setKh(ickh); ickslService.updateIckslByryzc(qyryxx);//t_icksl } else if (Integer.parseInt(qyryxx.getZt()) < 90 && qyrrxxQyid == qyid) { if (qyryxx.getRzrq() == null) { Date rzrq = modifyCyryRzrq(qyryxx, sksjDates); qyryxx.setRzrq(rzrq); qyryxx.setCzlx(""); qyryxx.setCzr(qyryxx.getQybm()); qyryxxService.updateQyryxxOnly(qyryxx); } } } } } else { if (qyjbxx != null) { int qyid = qyjbxx.getQyid(); Qyryxx qyryxx = new Qyryxx(); //?14????????? 20110131 mds if (StringUtil.isNotEmpty(cyrybh) && cyrybh.length() == 14) qyryxx.setZjhm(zjhm); else qyryxx.setCyrybh(cyrybh); qyryxx = qyryxxService.getQyryxx(qyryxx); if (qyryxx != null) { qyryid = qyryxx.getRyid(); int qyrrxxQyid = qyryxx.getQyid(); dwlb = qyryxx.getCylb(); dwlbdm = qyryxx.getCylbdm(); if (Integer.parseInt(qyryxx.getZt()) < 90 && qyryxx.getRzrq() == null) { Date rzrq = modifyCyryRzrq(qyryxx, sksjDates); qyryxx.setRzrq(rzrq); qyryxx.setCzlx(""); qyryxx.setCzr(qyryxx.getQybm()); qyryxxService.updateQyryxxOnly(qyryxx); } } } } // ????14??,?ICKH? --modify at 20100610 /* 20100817????????????IC?????? if (cyrybh != null && cyrybh.length() == 14) { // service?ickh?? icksl = new Icksl(); icksl.setIckh(ickh); icksl = ickslService.getIckslCyrybh(icksl); if (icksl != null) { cyrybh = icksl.getCyrybh(); kh = icksl.getKh(); icksllsh = icksl.getIckslid(); } }*/ /** * ?20100817?IC??????? * ?? ---start--- */ int icksllsh = 0; // service?ickh?? icksl = new Icksl(); icksl.setIckh(ickh); icksl = ickslService.getIckslCyrybh(icksl); if (icksl != null) { cyrybh = icksl.getCyrybh(); kh = icksl.getKh(); icksllsh = icksl.getIckslid(); } /** * IC????????? * 2010-08-16 mds */ else { Icksl ickslTemp = new Icksl(); ickslTemp.setIckh(ickh); ickslService.updateIckslIckh(ickslTemp); } /** * ?20100817?IC??????? * ?? ---end--- */ if (dantiaoArray.length > 12) { kh = dantiaoArray[12]; } // String jczt =dantiaoArray[dantiaoArray.length]; if (qyjbxx != null) { int qyid = qyjbxx.getQyid(); Qyryskjl qyryskjl = new Qyryskjl(); qyryskjl.setQyid(qyid); qyryskjl.setIckh(ickh); // ?? - ? , qyryskjl.setSksj(sksjDates); qyryskjl.setScsj(new Date()); qyryskjl.setCyrybh(cyrybh); if (dantiaoArray.length > 12) { qyryskjl.setKh(dantiaoArray[12]); } // 102025start qyryskjl.setQybm(qyjbxx.getQybm()); qyryskjl.setHylb(qyjbxx.getHylb()); qyryskjl.setHylbdm(qyjbxx.getHylbdm()); // end // --modify on 20100610 if (icksl != null) { qyryskjl.setKh(kh); qyryskjl.setIcksllsh(icksllsh); } // --modify on 20100610 if ("N".equals(qyjbxx.getHylbdm())) { qyryskjl.setJczt(dantiaoArray[dantiaoArray.length - 1]); qyryskjl.setDwlb(dwlb); qyryskjl.setDwlbdm(dwlbdm); qyryskjl = qyryskjlService.insertQyryskjl(qyryskjl); Qyskfbxx qyskfbxx = new Qyskfbxx(); qyryskjl.setRyid(qyryid); qyryskjl.setGxdwbm(qyjbxx.getGxdwbm()); qyryskjl.setGxdwmc(qyjbxx.getGxdwmc()); qyryskjl.setQymc(qyjbxx.getQymc()); qyskfbxx.insertqyskfb(qyryskjl); } else { qyryskjl = qyryskjlService.insertQyryskjl(qyryskjl); } // ?? Integer ickslid = null; String ickslslh = null;// ?? Icksl ickslOne = new Icksl(); // modify on 2010-08-13 by mds begin //ickslOne.setIckh(String.valueOf(dantiaoArray[9]).replace("-", "")); ickslOne.setIckh(String.valueOf(dantiaoArray[9])); // modify on 2010-08-13 by mds end List list = ickslService.getListIcksl(ickslOne); if (list == null || list.size() == 0) { yjFlag = "2";// ? ?? //?? } else { icksl = new Icksl(); // modify on 2010-08-13 by mds begin //icksl.setIckh(String.valueOf(dantiaoArray[9]).replace("-", "")); // ?? - ? icksl.setIckh(String.valueOf(dantiaoArray[9])); // modify on 2010-08-13 by mds end icksl.setCyrybh(dantiaoArray[2]); icksl = ickslService.getIckslyj(icksl); if (icksl == null) { yjFlag = "2"; } // ? ?? //?? else { ickslid = icksl.getIckslid(); // sxsj = icksl.getIckzxsj(); // ickslh = icksl.getIckslh(); ryid = icksl.getRyid(); Qyryxx qyryxx = new Qyryxx(); qyryxx.setRyid(ryid); qyryxx.setScbz(0); qyryxx = qyryxxService.getQyryxx(qyryxx); if (kh == null) { kh = icksl.getKh(); } if ("7".equals(icksl.getZkztbs()) || "8".equals(icksl.getZkztbs()) || "9".equals(icksl.getZkztbs())) { if ("9".equals(icksl.getZkztbs())) { yjFlag = "3"; // ? sxsj = icksl.getYxqhzrq(); } else { yjFlag = "0"; // ? sxsj = icksl.getIckzxsj(); } } else if (!"7".equals(icksl.getZkztbs()) && !"8".equals(icksl.getZkztbs()) && !"9".equals(icksl.getZkztbs())) { String sksjtemp = sksj.substring(0, 10); Date sksjDate = stringToDate(sksjtemp, "yyyy-MM-dd"); if (sksjDate.compareTo(icksl.getYxqhzrq()) >= 0) { yjFlag = "1"; // ? sxsj = icksl.getYxqhzrq(); } } else if ("1".endsWith(qyryxx.getYjbz())) { yjFlag = "4"; // ?? sxsj = qyryxx.getYjsj(); } // ???icksl??qyryskjl if (qyryskjl.getKh() == null) { qyryskjl.setKh(kh); } qyryskjl.setIcksllsh(ickslid); qyryskjlService.updateQyryskjl(qyryskjl); } } } else { yjFlag = "2"; // ? //?? } if (!"".equals(yjFlag)) { // ? Ickyj tempIckyj = new Ickyj(); // Qyryxx cyryxx = new Qyryxx(); Wgcyryxx wgcyryxx = new Wgcyryxx(); if (icksl != null) { cyryxx.setRyid(icksl.getRyid()); cyryxx = qyryxxService.getQyryxx(cyryxx); tempIckyj.setIckh(icksl.getIckh()); } if ("2".equals(yjFlag)) { // ?? cyryxx.setCyrybh(dantiaoArray[2]); cyryxx = qyryxxService.getQyryxx(cyryxx); tempIckyj.setCyrybh(dantiaoArray[2]); // modify on 2010-08-13 by mds begin //tempIckyj.setIckh(String.valueOf(dantiaoArray[9]).replace("-", "")); // ??- ? tempIckyj.setIckh(String.valueOf(dantiaoArray[9])); // modify on 2010-08-13 by mds end } if (cyryxx != null) { tempIckyj.setXmpy(cyryxx.getXm()); tempIckyj.setXb(cyryxx.getXb()); tempIckyj.setCyzj(cyryxx.getCyzj()); tempIckyj.setZjhm(cyryxx.getZjhm()); tempIckyj.setCylb(cyryxx.getCylb()); tempIckyj.setCylbdm(cyryxx.getCylbdm()); tempIckyj.setXmpy(cyryxx.getXmpy()); tempIckyj.setCyrybh(cyryxx.getCyrybh()); tempIckyj.setXm(cyryxx.getXm()); tempIckyj.setCyzjdm(cyryxx.getCyzjdm()); ryid = cyryxx.getRyid(); wgcyryxx.setRyid(cyryxx.getRyid()); wgcyryxx = wgcyryxxService.getWgcyryxx(wgcyryxx); if (wgcyryxx != null) { tempIckyj.setYwm(wgcyryxx.getYwm()); tempIckyj.setYwx(wgcyryxx.getYwx()); tempIckyj.setWgrjyxkz(wgcyryxx.getWgrjyxkz()); } } qybm = "?"; String qymc = "?"; String gxdwdm = "?"; String gxdwmc = "?"; String dsjgdm = "?"; String fxjdm = "?"; String dsjgmc = "?"; String fxjmc = "?"; if (qyjbxx != null) { qybm = qyjbxx.getQybm(); qymc = qyjbxx.getQymc(); gxdwdm = qyjbxx.getGxdwbm(); gxdwmc = qyjbxx.getGxdwmc(); String qybmTemp = qybm.substring(3, qybm.length()); dsjgdm = qybmTemp.substring(0, 4) + "00000000"; fxjdm = qybmTemp.substring(0, 6) + "000000"; dsjgmc = ""; fxjmc = ""; // ? ? >>> ??? = N; // N?4?+80=??N?6?+60=?(6.19?) Department userDepartment = new Department(); userDepartment.setDepartcode(dsjgdm); // userDepartment = departmentService.getDepartment(userDepartment); dsjgmc = (userDepartment != null) ? userDepartment.getDepartname() : "?"; userDepartment = new Department(); userDepartment.setDepartcode(fxjdm); // userDepartment = departmentService.getDepartment(userDepartment); fxjmc = (userDepartment != null) ? userDepartment.getDepartname() : "?"; tempIckyj.setQyid(qyjbxx.getQyid()); } // ??? tempIckyj.setQybm(qybm); tempIckyj.setQymc(qymc); tempIckyj.setGxdwdm(gxdwdm); tempIckyj.setGxdwmc(gxdwmc); tempIckyj.setDsjgdm(dsjgdm); tempIckyj.setDsjgmc(dsjgmc); tempIckyj.setFxjdm(fxjdm); tempIckyj.setFxjmc(fxjmc); if (!"".equals(yjFlag)) { // dict_item.setFact_value(yjFlag); List list = CacheManager.getCacheDictitem(dict_item); if (list != null && list.size() > 0) { yjyy = ((Dict_item) list.get(0)).getDisplay_name(); } } tempIckyj.setSksj(sksjDates); tempIckyj.setYjyy(yjyy); tempIckyj.setSxsj(sxsj); tempIckyj.setRyid(ryid); tempIckyj.setKh(kh); ickyjService.insertIckyj(tempIckyj); tempIckyj = null; } } } renderText(response, "OK"); } // - OK if (isUserStr(type) && "reg".equals(type)) { Qyjbxx qyjbxx = new Qyjbxx(); qyjbxx.setQybm(id); qyjbxx = qyjbxxService.getQyjbxx(qyjbxx); if (qyjbxx != null) { int qyid = qyjbxx.getQyid(); Qyryxx qyryxx = new Qyryxx(); Icksl icksl = new Icksl(); //?14????????? 20110131 mds if (StringUtil.isNotEmpty(cyrybh) && cyrybh.length() == 14) qyryxx.setZjhm(gmsfhm); else qyryxx.setCyrybh(cyrybh); try { qyryxx = qyryxxService.getQyryxx(qyryxx); icksl.setRyid(qyryxx.getRyid()); icksl.setIckh(cardid); icksl.setZxbz("0"); icksl = ickslService.getIckslyj(icksl); if (icksl != null) { if (qyryxx != null) { int qyrrxxQyid = qyryxx.getQyid(); // ??? 20100914 if (90 > Integer.parseInt(qyryxx.getZt())) { if (qyrrxxQyid == qyid) { renderText(response, ""); } else { qyryxx.setQyid(qyid); qyryxx.setRzrq(new Date()); ickslService.updateIckslByryzc(qyryxx);// t_icksl, renderText(response, "?"); } } else { renderText(response, "???"); } } else { renderText(response, "?"); } } else { renderText(response, "????"); } } catch (Exception e) { renderText(response, "??"); } } else { renderText(response, "?"); } } // ? - ? - OK if (isUserStr(type) && "message".equals(type)) { Map map = new HashMap(); map.put("jsdwbm", id); // ? - jsdwbm map.put("csck", "0"); // / map.put("gqbs", "0"); Page page = xctbService.getcsListForPage(map, 1, 10, null, null); if (page.getData().size() > 0) { renderText(response, "TRUE"); } else { renderText(response, "FALSE"); } } // IC? 20?? - OK if (isUserStr(type) && "history".equals(type)) { String skkssj1 = RespDateByDay(-20); Date sksjf = stringToDate(skkssj1, "yyyy-MM-dd"); Date sksjt = new Date(); Qyjbxx qyjbxx = new Qyjbxx(); qyjbxx.setQybm(id); qyjbxx = qyjbxxService.getQyjbxx(qyjbxx); if (qyjbxx == null) { renderText(response, "<CSMC></CSMC>", 1); } else { /** ****************modify on 20100721********************* */ /* * int csid = qyjbxx.getQyid(); Map map = new HashMap(); * map.put("qybm", id); map.put("cyrybh", cyrybh); * map.put("sksjf", sksjf); map.put("sksjt", sksjt); Page * page = qyryskjlService.getListForPage(map, 1, 10, null, * null); int total = page.getTotalRows(); page = * qyryskjlService .getListForPage(map, 1, total, null, * null); List list = page.getData(); */ Qyryskjl setQyryskjl = new Qyryskjl(); setQyryskjl.setQybm(id); setQyryskjl.setCyrybh(cyrybh); setQyryskjl.setSksjf(sksjf); setQyryskjl.setSksjt(sksjt); List list = qyryskjlService.getListQyryskjl(setQyryskjl); /** ****************modify on 20100721********************* */ String fanhuiString = "<CSMC></CSMC>"; if (list != null && list.size() > 0) { fanhuiString = "<CSMC>" + qyjbxx.getQymc() + "</CSMC>"; for (int index = 0; index < list.size(); index++) { Qyryskjl qyryskjl = (Qyryskjl) list.get(index); fanhuiString += "<RECORD>" + dateToString(qyryskjl.getSksj(), "yyyy-MM-dd HH:mm:ss") + kongGe(6) + qyryskjl.getCyrybh() + kongGe(6) + qyryskjl.getXm() + "</RECORD>"; } } renderText(response, fanhuiString, 1); } } // ? - OK if (isUserStr(type) && "connect".equals(type)) { renderText(response, "OK"); } // ?? -OK if (isUserStr(type) && "date".equals(type)) { try { String fanhuiString = dateToString(new Date(), "yyyyMMddHHmmss"); Globalpar globalpar = new Globalpar(); Globalpar temp = null; // globalpar.setGlobalparcode("offline-bbhtest"); // globalpar.setGlobalparcode("offline-bbh"); // List globList = CacheManager.getCacheGlobalpar(globalpar); if (globList != null && globList.size() > 0) { temp = (Globalpar) globList.get(0); } fanhuiString += "$" + temp.getGlobalparvalue().replaceAll(",", ""); // globalpar.setGlobalparcode("prjweb-bbhtest"); globalpar.setGlobalparcode("prjweb-bbh"); globList = CacheManager.getCacheGlobalpar(globalpar); if (globList != null && globList.size() > 0) { temp = (Globalpar) globList.get(0); } fanhuiString += "$" + temp.getGlobalparvalue().replaceAll(",", ""); globalpar.setGlobalparcode("gsweb-bbh"); globList = CacheManager.getCacheGlobalpar(globalpar); if (globList != null && globList.size() > 0) { temp = (Globalpar) globList.get(0); } fanhuiString += "$" + temp.getGlobalparvalue().replaceAll(",", ""); renderText(response, fanhuiString); } catch (Exception e) { e.printStackTrace(); response.getWriter().write(""); } } // 13 - login 14 - login2 - OK if ((isUserStr(type) && "login".equals(type)) || (isUserStr(type) && "login2".equals(type))) { String userType = ""; if ("login".equals(type)) { userType = "13"; } if ("login2".equals(type)) { userType = "14"; } User user = new User(); user.setUseraccount(id); user = userService.checkUser(user); if (user != null) { String password = user.getPassword(); String type = user.getUsertype(); if (password.equals(EncryptUtil.getMD5Code(pwd))) { // ? if (type.contains(userType)) { // ? if ("13".equals(type)) { String qykfkg = QjblUtil.queryQjblVal("qykf-kg"); if ("1".equals(qykfkg)) { // ? try { String content = wsdlResult(user.getUseraccount()); Document doc = DocumentHelper.parseText(content); Element root = doc.getRootElement(); String isright = root.element("ISVERIFY").getText(); if ("1".equals(isright)) { renderText(response, "OK"); } else { renderText(response, "ERROR??"); } } catch (Exception e) { e.printStackTrace(); renderText(response, "ERROR???"); } } else { renderText(response, "OK"); } } else { renderText(response, "OK"); } } else { // ?? renderText(response, "NOTOK"); } } else { renderText(response, "FALSE"); } } else { renderText(response, "FALSE"); } } // 2009-12-11 add // type=verify&id=&devicetype= // <OUTPUT>TRUE</OUTPUT><OUTPUT></OUTPUT> // ????<OUTPUT>TRUE???</OUTPUT> // ???????? if (isUserStr(type) && "verify".equals(type)) { User user = new User(); user.setUseraccount(id); try { user = userService.checkUser(user); } catch (Exception e) { e.printStackTrace(); renderText(response, ""); } if (user != null) { String qykfkg = QjblUtil.queryQjblVal("qykf-kg"); String sksblx = QjblUtil.queryQjblVal("deviceType");// ? if (!sksblx.equals(devicetype)) { renderText(response, "?"); } else { if ("1".equals(qykfkg)) { // ? try { String content = wsdlResult(user.getUseraccount()); Document doc = DocumentHelper.parseText(content); Element root = doc.getRootElement(); String isright = root.element("ISVERIFY").getText(); String endDate = root.element("ENDDATE").getText(); if ("1".equals(isright)) { int difday = difDay(endDate); if (difday < 31) { renderText(response, "TRUE???"); } else { renderText(response, "TRUE"); } } else { renderText(response, "??"); } } catch (Exception e) { e.printStackTrace(); renderText(response, "???"); } } else { renderText(response, "TRUE"); } } } else { renderText(response, "???"); } } // ??- OK if (isUserStr(type) && "coding".equals(type)) { StringBuffer condingString = new StringBuffer("<output>"); Dict dict = new Dict(); dict.setKongjianDicts("'dm_mz','dm_gj(lgy)','dm_xzqh'"); List list = dictService.getListDict(dict); if (list != null && list.size() > 0) { for (int index = 0; index < list.size(); index++) { dict = (Dict) list.get(index); // 15342003,???,DICTIONARY,DI_SN,DI_CVALUE,DI_SELNO,DI_MNEMONIC,DI_PROMPT,DI_DFID=1330,,,,WLGLZT,,1 condingString.append(nullCheck(String.valueOf(dict.getDict_id())) + "," + nullCheck(dict.getDict_name()) + "," + nullCheck(dict.getDict_itemtablename()) + "," + "DI_SN" + "," + "DI_CVALUE" + "," + "DI_SELNO" + "," + "DI_MNEMONIC" + "," + "DI_PROMPT" + "," + "DI_DFID=" + dict.getDict_id() + "," + "" + "," + "" + "," + "" + "," + nullCheck(dict.getDict_simplepin()) + "," + "" + "," + nullCheck(dict.getDict_versionid() + "\r\n")); } } condingString.append("</output>"); renderText(response, condingString.toString(), 1); } // ????- OK if (isUserStr(type) && "dict".equals(type)) { Dict dict = new Dict(); dict.setDict_id(Integer.parseInt(coid)); List list = dict_itemService.getOfflineDict_item(dict); StringBuffer returnString = new StringBuffer("<output>"); if (list != null && list.size() > 0) { for (int index = 0; index < list.size(); index++) { Dict_item dict_item = (Dict_item) list.get(index); returnString.append(nullCheck(String.valueOf(dict_item.getItem_id())) + "," + nullCheck(dict_item.getDisplay_name()) + "," + nullCheck(dict_item.getItem_simplepin()) + "," + nullCheck(dict_item.getFact_value()) + "," + coid + "\r\n"); } } returnString.append("</output>"); renderText(response, returnString.toString(), 1); } // ??config?? if (isUserStr(type) && "password".equals(type)) { String password = QjblUtil.queryQjblVal("offline-config-password"); renderText(response, password); } // ?offline?(0??1??) if (isUserStr(type) && "logintype".equals(type)) { String logintype = QjblUtil.queryQjblVal("login-type"); renderText(response, logintype); } //?? if (isUserStr(type) && "policecardlogin".equals(type) || "culturecardlogin".equals(type)) { Map map = new HashMap(); map.put("tableName", "t_mjjczsl"); map.put("zkztbs", "5"); map.put("mjjczbh", jcz); map.put("xgbz", "0"); boolean jczexit = systemService.isExit(map); if (jczexit) { String deptJcz = StringUtil.trimEven0(gajg); Qyjbxx qyjbxx = new Qyjbxx(); qyjbxx.setQybm(id); qyjbxx = qyjbxxService.getQyjbxx(qyjbxx); String deptQyxx = qyjbxx.getGxdwbm(); String mjjcqxms = QjblUtil.queryQjblVal("mjjcqxms"); String kzxljcqk = QjblUtil.queryQjblVal("kzxljcqk"); if (mjjcqxms.equals("2")) { if (deptQyxx.indexOf(deptJcz) == 0) { if ("0".equals(url)) { renderText(response, "OK"); } else { if ("1".equals(kzxljcqk)) { renderText(response, "URL=basic/jfglsystem/JcqkAdd-offline.jsp"); } else { renderText(response, "URL=basic/mjjczsystem/RcjcMjjczSk.jsp"); } } } else { renderText(response, "???"); } } else { if ("0".equals(url)) { renderText(response, "OK"); } else { if ("1".equals(kzxljcqk)) { renderText(response, "URL=basic/jfglsystem/JcqkAdd-offline.jsp"); } else { renderText(response, "URL=basic/mjjczsystem/RcjcMjjczSk.jsp"); } } } } else { if ("policecardlogin".equals(type)) { renderText(response, "??"); } else { renderText(response, "??"); } } } //???? if (isUserStr(type) && "unioncardlogin".equals(type)) { Map map = new HashMap(); map.put("tableName", "t_mjjczsl"); map.put("zkztbs", "5"); map.put("mjjczbh", jcz); map.put("xgbz", "0"); boolean jczexit = systemService.isExit(map); if (jczexit) { String deptJcz = StringUtil.trimEven0(gajg); Qyjbxx qyjbxx = new Qyjbxx(); qyjbxx.setQybm(id); qyjbxx = qyjbxxService.getQyjbxx(qyjbxx); String deptQyxx = qyjbxx.getGxdwbm(); String mjjcqxms = QjblUtil.queryQjblVal("mjjcqxms"); String kzxljcqk = QjblUtil.queryQjblVal("kzxljcqk"); if (mjjcqxms.equals("2")) { if (deptQyxx.indexOf(deptJcz) == 0) { if ("1".equals(url)) { renderText(response, "UNION=basic/jfglsystem/JcqkUnionAdd-offline.jsp"); } else { renderText(response, "OK"); } } else { renderText(response, "???"); } } else { if ("1".equals(url)) { renderText(response, "UNION=basic/jfglsystem/JcqkUnionAdd-offline.jsp"); } else { renderText(response, "OK"); } } } else { renderText(response, "??"); } } //?offline?connect?config??offline? if (isUserStr(type) && "para".equals(type)) { //?connect? String timeControl = QjblUtil.queryQjblVal("offline-config-timeControl"); //?config?? String password = QjblUtil.queryQjblVal("offline-config-password"); //?offline? String logintype = QjblUtil.queryQjblVal("login-type"); StringBuffer returnString = new StringBuffer("<OUTPUT>"); returnString.append(timeControl); returnString.append("$"); returnString.append(password); returnString.append("$"); returnString.append(logintype); returnString.append("</OUTPUT>"); renderText(response, returnString.toString(), 1); } } catch (Exception e) { e.printStackTrace(); renderText(response, "??"); } }
From source file:com.aisino2.sysadmin.action.LoginAction.java
/** * ? ?/*www . j ava 2 s .c o m*/ * @param logUser * @return */ public boolean kefuValidater(User logUser, HttpSession session) { boolean res = true; String userType = logUser.getUsertype(); String qykfkg = QjblUtil.queryQjblVal("qykf-kg"); Map mapUse = queryKfsqUserType("qysqUserType"); //??UserType Map mapTg = queryKfsqUserType("qysqTiaoGuoUserType"); //?UserType if ("1".equals(qykfkg) && !isContentsUserType(mapTg, userType) && isContentsUserType(mapUse, userType)) { //? try { String content = wsdlResult(queryQybm(logUser).getSsdwbm()); Document doc = DocumentHelper.parseText(content); Element root = doc.getRootElement(); String isright = root.element("ISVERIFY").getText(); String endDate = root.element("ENDDATE").getText(); if ("1".equals(isright)) { long difday = difDay(endDate); if (difday < 31) { session.setAttribute("shouquanEndDate", "?:" + endDate + " " + QjblUtil.queryQjblVal("qykf-xxtxbc")); } } else { result = "?"; res = false; } } catch (Exception e) { e.printStackTrace(); result = "??"; res = false; } } return res; }
From source file:com.alibaba.citrus.dev.handler.util.DomUtil.java
License:Open Source License
/** ?xml??dom */ public static Element readDocument(String name, URL url, ElementFilter filter) throws Exception, IOException { Document doc = SchemaUtil.readDocument(url.openStream(), name, true); org.dom4j.Element dom4jRootElement = doc.getRootElement(); return copy(dom4jRootElement, filter); }
From source file:com.alibaba.citrus.springext.impl.SchemaImpl.java
License:Open Source License
/** * ?schema??/*w w w . j a v a 2 s. c o m*/ * <ol> * <li>targetNamespace</li> * <li>include name</li> * </ol> */ @Override protected void doAnalyze() { Document doc = getDocument(); // ??null org.dom4j.Element root = doc.getRootElement(); // return if not a schema file if (!W3C_XML_SCHEMA_NS_URI.equals(root.getNamespaceURI()) || !"schema".equals(root.getName())) { return; } // parse targetNamespace if (parsingTargetNamespace) { Attribute attr = root.attribute("targetNamespace"); if (attr != null) { targetNamespace = trimToNull(attr.getStringValue()); } } // parse include Namespace xsd = DocumentHelper.createNamespace("xsd", W3C_XML_SCHEMA_NS_URI); QName includeName = DocumentHelper.createQName("include", xsd); List<String> includeNames = createLinkedList(); // for each <xsd:include> for (Iterator<?> i = root.elementIterator(includeName); i.hasNext();) { org.dom4j.Element includeElement = (org.dom4j.Element) i.next(); String schemaLocation = trimToNull(includeElement.attributeValue("schemaLocation")); if (schemaLocation != null) { includeNames.add(schemaLocation); } } includes = includeNames.toArray(new String[includeNames.size()]); // parse xsd:element QName elementName = DocumentHelper.createQName("element", xsd); // for each <xsd:element> for (Iterator<?> i = root.elementIterator(elementName); i.hasNext();) { Element element = new ElementImpl((org.dom4j.Element) i.next()); if (element.getName() != null) { this.elements.put(element.getName(), element); } } }
From source file:com.alibaba.citrus.springext.support.SchemaUtil.java
License:Open Source License
/** schemaincludes */ public static Transformer getTransformerWhoRemovesIncludes() { return new Transformer() { public void transform(Document document, String systemId) { Element root = document.getRootElement(); // <xsd:schema> if (W3C_XML_SCHEMA_NS_URI.equals(root.getNamespaceURI()) && "schema".equals(root.getName())) { // for each <xsd:include> for (Iterator<?> i = root.elementIterator(XSD_INCLUDE); i.hasNext();) { i.next();/*from w w w. j a v a2 s. c o m*/ i.remove(); } } } }; }
From source file:com.alibaba.citrus.springext.support.SchemaUtil.java
License:Open Source License
/** schema?includes */ public static Transformer getTransformerWhoAddsIndirectIncludes(final Map<String, Schema> includes) { return new Transformer() { public void transform(Document document, String systemId) { Element root = document.getRootElement(); root.addNamespace("xsd", W3C_XML_SCHEMA_NS_URI); // <xsd:schema> if (W3C_XML_SCHEMA_NS_URI.equals(root.getNamespaceURI()) && "schema".equals(root.getName())) { Namespace xsd = DocumentHelper.createNamespace("xsd", W3C_XML_SCHEMA_NS_URI); QName includeName = DocumentHelper.createQName("include", xsd); // for each <xsd:include> for (Iterator<?> i = root.elementIterator(includeName); i.hasNext();) { i.next();//from w w w . j av a 2s . c o m i.remove(); } // includes @SuppressWarnings("unchecked") List<Node> nodes = root.elements(); int i = 0; for (Schema includedSchema : includes.values()) { Element includeElement = DocumentHelper.createElement(includeName); nodes.add(i++, includeElement); includeElement.addAttribute("schemaLocation", includedSchema.getName()); } } } }; }