Java tutorial
package cn.com.szgao.enterprise; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.StringReader; import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.border.EtchedBorder; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.codehaus.jackson.JsonNode; import org.codehaus.jackson.JsonProcessingException; import org.codehaus.jackson.map.ObjectMapper; import org.wltea.analyzer.lucene.IKAnalyzer; import com.couchbase.client.java.Bucket; import com.couchbase.client.java.document.JsonDocument; import com.couchbase.client.java.document.json.JsonObject; import com.fasterxml.uuid.Generators; import com.fasterxml.uuid.impl.NameBasedGenerator; import com.google.gson.Gson; import com.hankcs.hanlp.HanLP; import com.hankcs.hanlp.corpus.tag.Nature; import com.hankcs.hanlp.seg.common.Term; import cn.com.szgao.dto.AbnormalVO; import cn.com.szgao.dto.BranchVO; import cn.com.szgao.dto.BusinessDirectoryVO; import cn.com.szgao.dto.ChangeVO; import cn.com.szgao.dto.CodeVO; import cn.com.szgao.dto.DocumentVO; import cn.com.szgao.dto.EnterpriseListVO; import cn.com.szgao.dto.EnterpriseVO; import cn.com.szgao.dto.HolderDetailDtlVO; import cn.com.szgao.dto.HolderDetailVO; import cn.com.szgao.dto.HolderVO; import cn.com.szgao.dto.IllegalVO; import cn.com.szgao.dto.IndustryVO; import cn.com.szgao.dto.MainManagerVO; import cn.com.szgao.dto.MortgageVO; import cn.com.szgao.dto.PledgeDetVO; import cn.com.szgao.dto.PledgeVO; import cn.com.szgao.dto.PrCiCouVO; import cn.com.szgao.dto.PunishmentDetVO; import cn.com.szgao.dto.PunishmentVO; import cn.com.szgao.dto.RemarkVO; import cn.com.szgao.dto.ReportAssetVO; import cn.com.szgao.dto.ReportBaseVO; import cn.com.szgao.dto.ReportGuaranteeVO; import cn.com.szgao.dto.ReportInvestVO; import cn.com.szgao.dto.ReportStockEventItemVO; import cn.com.szgao.dto.ReportVO; import cn.com.szgao.dto.ReportWebVO; import cn.com.szgao.dto.ReporteEventItemVO; import cn.com.szgao.dto.SpotCheckVO; import cn.com.szgao.dto.TempHolderVO; import cn.com.szgao.dto.TempMainManagerVO; import cn.com.szgao.util.ConfigUtils; import cn.com.szgao.util.DateUtils; import cn.com.szgao.util.FileUtils; import cn.com.szgao.util.ObjectUtils; import cn.com.szgao.util.PrCiCouText; import cn.com.szgao.util.StringUtils; import cn.com.szgao.wash.data.AdministrationUtils; import cn.com.szgao.wash.data.DataUtils; import net.sf.json.JSONArray; import net.sf.json.JSONObject; /** * json json * @author liuming * @Date 201671 ?12:03:22 */ @SuppressWarnings("unused") public class FileIntoDataBase2p5WashJson { public FileIntoDataBase2p5WashJson() { } // public FileIntoDataBase2p5(Logger log) { // this.log = log; // } private static Logger log = LogManager.getLogger(FileIntoDataBase2p5WashJson.class.getName()); static { PropertyConfigurator.configure(ConfigUtils.getPropertyValue("log4j.propertiespath")); } /** * json */ Gson gs = new Gson(); /** * */ DataUtils utils = new DataUtils(); /** * ?? */ AdministrationUtils u = new AdministrationUtils(); // // private static Logger log; // ??UUID NameBasedGenerator nbg = Generators.nameBasedGenerator(NameBasedGenerator.NAMESPACE_DNS); // // ? // Map<String, JSONArray> reportMap = new HashMap<String, JSONArray>(); // // ?ID? // // List<String> companyIdList = new ArrayList<String>(); // // ?? // JSONArray recordArray = null; // // ?? // List<JSONArray> pledgeList = new ArrayList<JSONArray>(); // // ? // JSONArray punishmentArray = null; // // ? // JSONArray punishDetArray = null; /** * ?ID? */ List<String> companyIdList = new ArrayList<String>(); int count = 0; /** * ? * * @param file * @throws ParseException * @throws IOException */ public void show(File file, int startNum) throws IOException, ParseException { System.out.println(file.getPath()); if (file.isFile()) { count += 1; log.info("---------------?:" + count + "---??" + Thread.currentThread().getName() + "---" + file.getPath()); try { readFileByLines(file, startNum); } catch (Exception e) { e.printStackTrace(); } // file.delete(); return; } File[] files = file.listFiles(); if (null != files) { for (File fi : files) { if (fi.isFile()) { count += 1; log.info("---------------------?:" + count + "---??" + Thread.currentThread().getName() + "---" + fi.getPath()); try { readFileByLines(fi, startNum); } catch (Exception e) { e.printStackTrace(); log.info(e); } // fi.delete(); } else if (fi.isDirectory()) { show(fi, startNum); } else { continue; } } } } int SUMM = 0; @SuppressWarnings("rawtypes") private void readFileByLines(File file, int startNum) throws Exception { // ?? int basicSum = 0; // ?? int regSum = 0; // ??? String batchNum = file.getName(); // StringBuffer sb = new StringBuffer(); // FileReader fr = new FileReader(file); // int ch = 0; // while((ch = fr.read())!=-1 ) // { // sb.append((char)ch); // } // fr.close(); // fr = null; // BufferedWriter fw = null; String encoding_from = "UTF-8";// GB18030 // String encoding_to = "UTF-8"; BufferedReader reader = null; try { // ? GB18030 // InputStreamReader isr = new InputStreamReader(new // FileInputStream(file), "UTF-8"); // InputStreamReader isr = new InputStreamReader(new // FileInputStream(file), "GBK"); InputStreamReader isr = new InputStreamReader(new FileInputStream(file), encoding_from); reader = new BufferedReader(isr); } catch (FileNotFoundException e1) { e1.printStackTrace(); } String tempT = null; int readNum = 0; // D:\??\160407\ // String ss = file.getPath().substring(file.getPath().indexOf("data") + // 4); // String ss2 = file.getPath().substring(file.getPath().indexOf("data") // + 5, file.getPath().lastIndexOf("\\")); // String folderPath = "D:/??_2/" + ss2; String filePath = file.getPath().replace("??", "??_3"); // // FileUtils.newFolder(folderPath); File fileS = new File(filePath); FileUtils.mkFile(fileS); String encoding_from1 = "UTF-8"; BufferedWriter fw = null; try { if (!fileS.exists()) { try { fileS.createNewFile(); } catch (IOException e) { e.printStackTrace(); log.error(e); } fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileS, true), encoding_from1)); // ???? } else { fileS.delete(); fileS = new File(filePath); fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileS, true), encoding_from1)); // ???? } } catch (FileNotFoundException e1) { e1.printStackTrace(); } String filePathUn = file.getPath().replace("??", "?_"); File fileSUn = new File(filePathUn); FileUtils.mkFile(fileSUn); String encoding_from1U = "UTF-8"; BufferedWriter fwUn = null; try { if (!fileSUn.exists()) { try { fileSUn.createNewFile(); } catch (IOException e) { e.printStackTrace(); log.error(e); } fwUn = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(fileSUn, true), encoding_from1U)); // ???? } else { fileSUn.delete(); fileSUn = new File(filePathUn); fwUn = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(fileSUn, true), encoding_from1U)); // ???? } } catch (FileNotFoundException e1) { e1.printStackTrace(); } int M = 1;// 1M? while ((tempT = reader.readLine()) != null) { // tempT=""; readNum++; SUMM++; System.out.println(SUMM); // if(readNum<34431){ // continue; // } // if(readNum==34431){ // // writerString(fwUn, tempT); // break; // } if (readNum < startNum) { continue; } if (tempT == null || tempT == "") { continue; } JSONObject temJson = null; EnterpriseVO enterVO = new EnterpriseVO(); try { temJson = JSONObject.fromObject(tempT); } catch (Exception e) { log.error("json:" + file.getPath() + "----" + tempT); continue; } try { enterVO = gs.fromJson(tempT, EnterpriseVO.class); } catch (Exception e) { log.error("jsonvo:" + file.getPath() + "----" + tempT); continue; } if (enterVO == null) { continue; } // ??? ??? ? ??>3 ? 1 ?2 ?? 0 try { if (StringUtils.isNull(enterVO.getCompany())) { enterVO.setCompanyType(0); } else { if (enterVO.getCompany().length() > 3) { enterVO.setCompanyType(1); } else { enterVO.setCompanyType(2); } } } catch (Exception e) { log.error("------------------------------------------ ???:" + "----" + tempT); } // ?? String scope = enterVO.getScope(); if (!StringUtils.isNull(scope)) { scope = scope.replaceAll("[ \r\t^]", ""); if (scope.length() > 5) { String temp = ""; // System.out.println(scope); // if (scope.substring(scope.length() - 5).contains("^")) { // temp = scope.substring(scope.length() - 5).replace("^", ""); // scope = scope.substring(0, scope.length() - 5) + temp; // } else { temp = scope.substring(scope.length() - 5).replaceAll("[#*+]", ""); scope = scope.substring(0, scope.length() - 5) + temp; // } } enterVO.setScope(scope); } // ? // ? String industry = null; String industryId = null; // ? Analyzer anal = new IKAnalyzer(); String indu = removeBlank(enterVO.getScope()); System.out.println("------ ??>>>>> " + indu); IndustryVO ivo = new IndustryVO(); // IndustryVO ivo1 = null; if (StringUtils.isNull(industry)) { if (!StringUtils.isNull(indu)) { String[] sourceStrArray = indu.split("[;.:,]");// ? for (String str : sourceStrArray) { System.out.println("------ ? " + str); if (StringUtils.isNull(str)) { continue; } if ("???".equals(str) || "??".equals(str) || "??".equals(str)) { continue; } // ? ivo = getIndustry(str); if (!StringUtils.isNull(ivo.getIndustry_id())) { break; } // // ?"?"? if (str.indexOf("?") != -1) { String[] arrStrD = str.split("?"); for (int i = 0; i < arrStrD.length; i++) { if (!StringUtils.isNull(arrStrD[i])) { ivo = getIndustry(arrStrD[i]); if (!StringUtils.isNull(ivo.getIndustry_id())) { break; } } if (null == ivo.getIndustry_id()) { System.out.println("-----------IK ?1"); // ik? ivo = getIndustryVOFromIk(arrStrD[i]); break; } } } else { System.out.println("-----------IK ?2"); // ik? ivo = getIndustryVOFromIk(str); } // if (!StringUtils.isNull(ivo.getIndustry_id())) { // break; // } // // // ? ik? // if (null == ivo.getIndustry_id()) { // ivo = getIndustryVOFromIk(str); // } if (!StringUtils.isNull(ivo.getIndustry_id())) { break; } } } } if (null != ivo) { System.out.println(ivo.getIn_name() + " -- " + ivo.getIndustry_name()); enterVO.setIndustry(ivo.getIndustry_name()); enterVO.setIndustryId(ivo.getIndustry_id()); if (StringUtils.isNull(enterVO.getIndustryId())) { writerString(fwUn, ": " + enterVO.getScope() + " | " + file.getPath() + " | " + enterVO.getCompany() + " | " + enterVO.getBatchNum()); } } // writerString(fw, StringUtils.GSON.toJson(enterVO)); writerString(fw, StringUtils.GSON .toJson(enterVO.getIndustry() + " | " + enterVO.getScope() + " | " + enterVO.getCompany())); } } /** * * * @param enterVO * @return */ public static EnterpriseVO washEnterpriseVO(EnterpriseVO enterVO) throws IOException { if (!StringUtils.isNull(enterVO.getCompany())) { enterVO.setCompany(deleteMoreFuhao(enterVO.getCompany())); } // ?? String scope = enterVO.getScope(); if (!StringUtils.isNull(scope)) { scope = scope.replaceAll("[ \r\t^]", ""); if (scope.length() > 5) { String temp = ""; // System.out.println(scope); // if (scope.substring(scope.length() - 5).contains("^")) { // temp = scope.substring(scope.length() - 5).replace("^", ""); // scope = scope.substring(0, scope.length() - 5) + temp; // } else { temp = scope.substring(scope.length() - 5).replaceAll("[#*+]", ""); scope = scope.substring(0, scope.length() - 5) + temp; // } } enterVO.setScope(scope); } String regCapital = enterVO.getRegCapital(); // ?   if (!StringUtils.isNull(regCapital)) { String capital = enterVO.getRegCapital().replaceAll("[ \r\t\n]", ""); // enterVO.setRegCapital(capital); enterVO.setRegCapitalO(capital); Double regCapitalN = getBankingDouble(capital); if (null != regCapitalN) { enterVO.setRegCapitalN(regCapitalN); enterVO.setRegCapital(null); if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("")) { enterVO.setUnit("?"); } else if (regCapital.contains("?")) { enterVO.setUnit("??"); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("?")) { enterVO.setUnit("?"); } else if (regCapital.contains("?")) { enterVO.setUnit("?"); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("?")) { enterVO.setUnit("?"); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else if (regCapital.contains("")) { enterVO.setUnit(""); } else { enterVO.setUnit("?"); } } } // ? String industry = null; String industryId = null; /* * if (!StringUtils.isNull(enterVO.getCompany())) { String key = * StringUtils.NBG.generate(enterVO.getCompany()).toString(); * JsonDocument queryDoc = ExecutorsText.bucket.get(key, 60, * TimeUnit.MINUTES); * * if (null == queryDoc) { // System.out.println( * "NULL queryDoc-------------------- " + // key); // * System.out.println("NULL queryDoc-------------------- " + // key); * * } else { BusinessDirectoryVO vo = * StringUtils.GSON.fromJson(queryDoc.content().toString(), * BusinessDirectoryVO.class); if * (!StringUtils.isNull(vo.getIndustry())) { industry = * vo.getIndustry(); } } } */ // ? Analyzer anal = new IKAnalyzer(); String indu = removeBlank(enterVO.getScope()); IndustryVO ivo = null; IndustryVO ivo1 = null; if (StringUtils.isNull(industry)) { if (!StringUtils.isNull(indu)) { String[] sourceStrArray = indu.split("[;.:,]");// ? for (String str : sourceStrArray) { // System.out.println("-- " + str); if (StringUtils.isNull(str)) { continue; } // ? ivo = getIndustry(str); if (!StringUtils.isNull(ivo.getIndustry_id())) { break; } // // ?"?"? // if (str.indexOf("?") != -1) { // String[] arrStrD = str.split("?"); // for (int i = 0; i < arrStrD.length; i++) { // if (!StringUtils.isNull(arrStrD[i])) { // ivo = getIndustry(arrStrD[i]); // if (!StringUtils.isNull(ivo.getIndustry_id())) { // break; // } // } // if (null == ivo.getIndustry_id()) { // // ik? // ivo = getIndustryVOFromIk(arrStrD[i]); // break; // } // } // } // // if (!StringUtils.isNull(ivo.getIndustry_id())) { // break; // } // // // ? ik? // if (null == ivo.getIndustry_id()) { // ivo = getIndustryVOFromIk(str); // } // // if (!StringUtils.isNull(ivo.getIndustry_id())) { // break; // } } } } if (null != ivo) { enterVO.setIndustry(ivo.getIndustry_name()); enterVO.setIndustryId(ivo.getIndustry_id()); } if (!StringUtils.isNull(enterVO.getRegNum())) { if (enterVO.getRegNum().indexOf("\u0000") != -1) { enterVO.setRegNum(enterVO.getRegNum().substring(0, enterVO.getRegNum().indexOf("\u0000"))); } } enterVO.setHolder(WashEtp.clearHolder(enterVO));// enterVO.setPunishment(WashEtp.clearPunishment(enterVO));// ? enterVO.setChange(WashEtp.clearChangeItem(enterVO));// ? enterVO.setReport(WashEtp.clearReport(enterVO));// return enterVO; } /** * ? 0 ? 1 ? * * @param listiv * @param flag * @return * @return IndustryVO * @author liuming * @date 201662 ?11:17:00 */ public static IndustryVO getfirstSortStringArray(List<IndustryVO> listiv, int flag) { // String[]str = new String[]{}; IndustryVO vo = null; if (listiv.size() == 0) { return null; } if (listiv.size() == 1) { return listiv.get(0); } String in_name1 = null; String in_name2 = null; IndustryVO temp = null; for (int ia = 0; ia < listiv.size(); ia++) { for (int j = listiv.size() - 1; j > ia; j--) { if (flag == 1) { in_name1 = listiv.get(ia).getIn_name(); in_name2 = listiv.get(j).getIn_name(); if (in_name1.length() < in_name2.length()) { temp = listiv.get(ia); listiv.set(ia, listiv.get(j)); listiv.set(j, temp); } } if (flag == 0) { if (listiv.get(ia).getIn_name().length() < listiv.get(j).getIn_name().length()) { temp = listiv.get(ia); listiv.set(ia, listiv.get(j)); listiv.set(j, temp); } } } } if (listiv.size() > 1) { return listiv.get(0); } return vo; } /** * ?? industry_name ----vo */ static String[] arr_mapVN_N = null; static { arr_mapVN_N = new String[ExecutorsText.mapVN_N.entrySet().size()]; int i1 = 0; for (Entry<String, IndustryVO> entry : ExecutorsText.mapVN_N.entrySet()) { arr_mapVN_N[i1] = entry.getKey(); i1++; } StringUtils.sortStringArray(arr_mapVN_N, 1); } static String[] arr_mapV_N = null; static { arr_mapV_N = new String[ExecutorsText.mapV_N.entrySet().size()]; int i1 = 0; for (Entry<String, IndustryVO> entry : ExecutorsText.mapV_N.entrySet()) { arr_mapV_N[i1] = entry.getKey(); i1++; } StringUtils.sortStringArray(arr_mapV_N, 1); } static String[] arr_mapN_N = null; static { arr_mapN_N = new String[ExecutorsText.mapN_N.entrySet().size()]; int i1 = 0; for (Entry<String, IndustryVO> entry : ExecutorsText.mapN_N.entrySet()) { arr_mapN_N[i1] = entry.getKey(); i1++; } StringUtils.sortStringArray(arr_mapN_N, 1); } /** * in_name ----- vo ???? */ static String[] arr_mapV_AND_N = null; static { arr_mapV_AND_N = new String[ExecutorsText.mapV_AND_N.entrySet().size()]; int i1 = 0; for (Entry<String, IndustryVO> entry : ExecutorsText.mapV_AND_N.entrySet()) { arr_mapV_AND_N[i1] = entry.getKey(); i1++; } StringUtils.sortStringArray(arr_mapV_AND_N, 1); } /** * ? * * @param str * @return * @return IndustryVO * @author liuming * @date 201661 ?6:03:17 */ public static IndustryVO getIndustry(String str) { IndustryVO vo = new IndustryVO(); // System.out.println(str); if (StringUtils.isNull(str)) { return vo; } String industry = null; String industryId = null; // sortStringArray for (int i = 0; i < arr_mapVN_N.length; i++) { if (!StringUtils.isNull(arr_mapVN_N[i])) { if (str.indexOf(arr_mapVN_N[i]) != -1) {//? return ExecutorsText.mapVN_N.get(arr_mapVN_N[i]); } } } //??? for (int i = 0; i < arr_mapV_AND_N.length; i++) { if (!StringUtils.isNull(arr_mapV_AND_N[i])) { if (str.indexOf(arr_mapV_AND_N[i]) != -1) {//? return ExecutorsText.mapV_AND_N.get(arr_mapV_AND_N[i]); } } } // //??? // for (int i = 0; i < arr_mapV_N.length; i++) { // if(!StringUtils.isNull(arr_mapV_N[i])){ // // if (str.indexOf(arr_mapV_N[i])!=-1 ) {//? // return ExecutorsText.mapV_N.get(arr_mapV_N[i]); // } // } // } // // //?????? // for (int i = 0; i < arr_mapN_N.length; i++) { // if(!StringUtils.isNull(arr_mapN_N[i])){ // // if (str.indexOf(arr_mapN_N[i])!=-1 ) {//? // return ExecutorsText.mapN_N.get(arr_mapN_N[i]); // } // } // } // for (Entry<String, IndustryVO> entry : ExecutorsText.mapVN_N.entrySet()) { // // System.out.println("keyV= " + entry.getKey() + " and // // value= " + entry.getValue()); // if (entry.getValue() != null && entry.getKey() != null && !"".equals(entry.getKey())) { //// if (str.equals(entry.getKey())) { // if (str.indexOf( entry.getKey())!=-1 ) {//? // // industry = entry.getValue().getIndustry_name(); // industryId = entry.getValue().getIndustry_id(); // return entry.getValue(); // } // } // } // // if (null == industry) { // for (Entry<String, IndustryVO> entry : ExecutorsText.mapV_N.entrySet()) { // // System.out.println("keyV= " + entry.getKey() + " and // // value= " + entry.getValue()); // if (entry.getValue() != null && entry.getKey() != null && !"".equals(entry.getKey())) { // if (str.indexOf( entry.getKey())!=-1 ) {//? // industry = entry.getValue().getIndustry_name(); // industryId = entry.getValue().getIndustry_id(); // // return entry.getValue(); // } // } // } // } // // if (null == industry) { // for (Entry<String, IndustryVO> entry : ExecutorsText.mapN_N.entrySet()) { // // System.out.println("keyN= " + entry.getKey() + " // // and value= " + entry.getValue()); // if (entry.getValue() != null && entry.getKey() != null && !"".equals(entry.getKey())) { // if (str.indexOf( entry.getKey())!=-1 ) {//? // industry = entry.getValue().getIndustry_name(); // industryId = entry.getValue().getIndustry_id(); // return entry.getValue(); // } // } // } // } return vo; } /** * ?? * * @param str * @return */ public static String getBanking(String str) { if (null == str || "".equals(str)) { return null; } str = str.replaceAll(" ", ""); if ("".equals(str)) { return null; } String[] regsQ = { ",", ".", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }; String[] rs = str.split(""); StringBuffer sb = new StringBuffer(); for (int i = 0; i < rs.length; i++) { String jj = rs[i]; for (int j = 0; j < regsQ.length; j++) { if (jj.equals(regsQ[j])) { sb.append(regsQ[j]); break; } } } String rel = sb.toString().replace(",", ""); return rel; } public static Double getBankingDouble(String str) { if (null == str || "".equals(str)) { return null; } str = str.replaceAll(" ", ""); if ("".equals(str)) { return null; } String[] regsQ = { ",", ".", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }; String[] rs = str.split(""); StringBuffer sb = new StringBuffer(); for (int i = 0; i < rs.length; i++) { String jj = rs[i]; for (int j = 0; j < regsQ.length; j++) { if (jj.equals(regsQ[j])) { sb.append(regsQ[j]); break; } } } String rel = sb.toString().replace(",", ""); if (!StringUtils.isNull(rel) && StringUtils.isNumericDecimal(rel)) { // BigDecimal b = new BigDecimal(rel); // Double f1 = b.setScale(3, // BigDecimal.ROUND_HALF_UP).doubleValue(); // System.out.println(f1); // return f1; // DecimalFormat df = new DecimalFormat("#.###"); // Double get_double = Double.parseDouble(df.format(rel)); // return get_double; return Double.valueOf(rel); } else { return null; } } /** * ?? * * @param holderAndDetList * @param companyId * @return */ @SuppressWarnings("rawtypes") public static List<HolderVO> getHolderAndDetList(List<TempHolderVO> holderAndDetList, String companyId) { List<HolderVO> holderList = new ArrayList<HolderVO>(); List<HolderDetailVO> holderDetList = new ArrayList<HolderDetailVO>(); List<HolderVO> holder = new ArrayList<HolderVO>(); if (null != holderAndDetList && holderAndDetList.size() > 0) { HolderVO holderVo = null; HolderDetailVO detailVo = null; List<HolderDetailDtlVO> holderDetailDtl = new ArrayList<HolderDetailDtlVO>(); for (TempHolderVO vo : holderAndDetList) { // String keyHolder = UUID.randomUUID().toString();// ID holderVo = new HolderVO(); holderVo.setHolderId(keyHolder);// ID holderVo.setCompanyId(companyId);// ? holderVo.setHolder(vo.getHolder());// ?? holderVo.setType(vo.getType());// holderVo.setLicenseType(vo.getLicenseType());// ? holderVo.setLicenseNum(vo.getLicenseNum()); // ?? holderVo.setEquityPart(vo.getEquityPart());// ? // holderVo.setRemark(vo.getRemark()); // holderVo.getRemark().setBucketName(holderLabelName);// // ?? holderList.add(holderVo);// ? // detailVo = new HolderDetailVO();// detailVo.setHolder(vo.getHolder());// ?? // detailVo.setType(vo.getType());// detailVo.setHolderId(keyHolder);// ID detailVo.setConCapital(vo.getConCapital());// ? detailVo.setFactCapital(vo.getFactCapital());// ? // detailVo.setSubcriCapital(vo.getSubcriCapital()); // detailVo.setConMethod(vo.getConMethod()); // detailVo.setConsidDate(vo.getConsidDate()); // detailVo.setActualCapital(vo.getActualCapital()); // detailVo.setActualDate(vo.getActualDate()); // detailVo.setFactMethod(vo.getFactMethod());// ? // detailVo.getRemark().setBucketName(holderDetLabelName); detailVo.setRemark(vo.getRemark()); HolderDetailDtlVO holderDetailDtlVO = new HolderDetailDtlVO(); holderDetailDtlVO.setActualCapital(vo.getActualCapital());// ? holderDetailDtlVO.setActualDate(vo.getActualDate());// holderDetailDtlVO.setFactMethod(vo.getFactMethod());// ? holderDetailDtlVO.setConMethod(vo.getConMethod());// ? holderDetailDtlVO.setConsidDate(vo.getConsidDate());// holderDetailDtlVO.setSubcriCapital(vo.getSubcriCapital());// ? holderDetailDtlVO.setHolder(vo.getHolder()); holderDetailDtl.add(holderDetailDtlVO); detailVo.setHolderDetailDtl(holderDetailDtl); holderDetList.add(detailVo); } } holderAndDetList = null; JsonObject jsonObject = null; JsonDocument doc = null; List<HolderDetailVO> lHolderDetailVOs = null; List<HolderDetailDtlVO> lHolderDetailDtlVOs = null; // if (null != holderList && holderList.size() > 0) { for (HolderVO holderVO : holderList) { // ID String key = holderVO.getHolderId(); // holderVO.setHolderId(null); // if("".equals(holderVO.getRemark().getBucketName() )){ // continue; // } String holderVO_name1 = holderVO.getHolder(); lHolderDetailVOs = new ArrayList<HolderDetailVO>(); if (null != holderDetList && holderDetList.size() > 0) { for (HolderDetailVO detVO : holderDetList) { String holderVO_name2 = detVO.getHolder(); if (null != holderVO_name1 && null != holderVO_name2) { if (holderVO_name1.equals(holderVO_name2)) { lHolderDetailDtlVOs = new ArrayList<HolderDetailDtlVO>(); List<HolderDetailDtlVO> sL = detVO.getHolderDetailDtl(); if (sL != null && sL.size() > 0) { for (Iterator iterator = sL.iterator(); iterator.hasNext();) { HolderDetailDtlVO hdd = (HolderDetailDtlVO) iterator.next(); String temp_holder = hdd.getHolder(); if (null != temp_holder) { if (holderVO_name1.equals(temp_holder)) { lHolderDetailDtlVOs.add(hdd); } } } } detVO.setHolderDetailDtl(lHolderDetailDtlVOs); lHolderDetailVOs.add(detVO); } } lHolderDetailDtlVOs = null; } } holderVO.setHolderDetail(lHolderDetailVOs); holder.add(holderVO); /* * jsonObject = JsonObject.fromJson(gs.toJson(holderVO)); doc = * JsonDocument.create(key, jsonObject); * //createJsonDocument("etp_holder_e", doc);// etp_holder_e * jsonObject = null; doc = null; */ } } return holder; } /** * ? ? * * @param holderAndDetList * @param companyId * @return */ public static List<HolderVO> getHolderAndDetList2(List<TempHolderVO> holderAndDetList, List<TempHolderVO> holderAndDetList2, String companyId) { List<HolderVO> holderList = new ArrayList<HolderVO>(); if (null != holderAndDetList && holderAndDetList.size() > 0) { HolderVO holderVo = null; HolderDetailVO detailVo = null; for (TempHolderVO vo : holderAndDetList) { List<HolderDetailVO> holderDetList = new ArrayList<HolderDetailVO>(); List<HolderDetailDtlVO> holderDetailDtl = new ArrayList<HolderDetailDtlVO>(); // String keyHolder = UUID.randomUUID().toString();// ID holderVo = new HolderVO(); holderVo.setHolderId(keyHolder);// ID holderVo.setCompanyId(companyId);// ? holderVo.setHolder(vo.getHolder());// ?? holderVo.setType(vo.getType());// holderVo.setLicenseType(vo.getLicenseType());// ? holderVo.setLicenseNum(vo.getLicenseNum()); // ?? holderVo.setEquityPart(vo.getEquityPart());// ? // holderVo.setRemark(vo.getRemark()); // holderVo.getRemark().setBucketName(holderLabelName);// // ?? String holder1 = vo.getHolder(); if (null != holderAndDetList2 && holderAndDetList2.size() > 0) { for (TempHolderVO vo2 : holderAndDetList2) { String holder2 = vo2.getHolder(); if (null != holder2 && !"".equals(holder2) && null != holder1 && !"".equals(holder1)) { if (holder1.equals(holder2)) { // detailVo = new HolderDetailVO();// detailVo.setHolder(vo2.getHolder());// ?? detailVo.setHolderId(keyHolder);// ID detailVo.setConCapital(vo2.getConCapital());// ? detailVo.setFactCapital(vo2.getFactCapital());// ? detailVo.setRemark(vo2.getRemark()); HolderDetailDtlVO holderDetailDtlVO = new HolderDetailDtlVO(); holderDetailDtlVO.setActualCapital(vo2.getActualCapital());// ? holderDetailDtlVO.setActualDate(vo2.getActualDate());// holderDetailDtlVO.setFactMethod(vo2.getFactMethod());// ? holderDetailDtlVO.setConMethod(vo2.getConMethod());// ? holderDetailDtlVO.setConsidDate(vo2.getConsidDate());// holderDetailDtlVO.setSubcriCapital(vo2.getSubcriCapital());// ? holderDetailDtlVO.setHolder(vo2.getHolder()); holderDetailDtl.add(holderDetailDtlVO); detailVo.setHolderDetailDtl(holderDetailDtl); holderDetList.add(detailVo); } } } } holderVo.setHolderDetail(holderDetList); holderList.add(holderVo);// ? } } return holderList; } /** * ??? * * @param baseObj * ?? * @param companyId * ?ID * @param jsonArray * json * @throws ParseException */ @SuppressWarnings("rawtypes") public EnterpriseVO insertBaseInfo(JSONObject baseObj, String companyId, JSONObject obj) throws Exception { // ? EnterpriseVO enterVO = new EnterpriseVO(); // ???? RemarkVO remarkVO = new RemarkVO(); remarkVO.setBucketName("?"); // json JsonObject jsonObject = null; JsonDocument doc = null; // key?? Iterator keyIter = baseObj.keys(); while (keyIter.hasNext()) { String key = keyIter.next().toString(); String value = baseObj.get(key).toString(); if (null != value && "null".equals(value)) { value = null; } // if ("??".equals(key) && null == value) { value = obj.get("compname").toString(); } if (key.contains("?")) { enterVO.setRegNum(value); // ? // ? // String pccityArray[] = listCountryCityProvince(value); // if (null != pccityArray[0]) { // enterVO.setProvince(pccityArray[0]);// ? // } // if (null != pccityArray[1]) { // enterVO.setCity(pccityArray[1]);// // } // if (null != pccityArray[2]) { // enterVO.setArea(pccityArray[2]);// // } clearRegNum(enterVO);// ??,? } // else if ("?".equals(key) || "?/?".equals(key) || // "?/?".equals(key)||"???".equals(key)) { // enterVO.setRegNum(value); // } else if ("??".equals(key) || "???".equals(key) || "???".equals(key) || key.startsWith("???")) { enterVO.setCompany(value); } else if (key.contains("?")) {// ?1 enterVO.setCreditCode(value); } else if (key.contains("")) {// ? enterVO.setType(value); } else if ("".equals(key) || "".equals(key) || "".equals(key) || "??".equals(key) || "/??".equals(key) || "?".equals(key) || "".equals(key) || key.startsWith("") || key.startsWith("??") || key.startsWith("")) {// // if (null != enterVO.getCompany()) { remarkVO.setLegalRep(key); enterVO.setLegalRep(value); // } } else if ("?".equals(key) || key.contains("")) {// ??? ? // if (null != value) { enterVO.setLocation(value.replace(" ", "")); } } else if ("".equals(key) || "??".equals(key) || "".equals(key)) { // // remarkVO.setRegCapital(key); enterVO.setRegCapital(value); } else if ("?".equals(key) || "".equals(key)) { enterVO.setRegDate(DateUtils.toYMDOfChaStr_ESZZ2(value)); } else if (key.contains("?")) {// ?? ??()? remarkVO.setStartTime(key); enterVO.setStartTime(DateUtils.toYMDOfChaStr_ESZZ2(value)); } else if (key.contains("?")) {// ?? remarkVO.setEndTime(key); enterVO.setEndTime(DateUtils.toYMDOfChaStr_ESZZ2(value)); } else if (key.contains("")) { enterVO.setScope(value); } else if ("".equals(key)) { enterVO.setRegOffice(value); } else if ("".equals(key)) { enterVO.setApproveDate(DateUtils.toYMDOfChaStr_ESZZ2(value)); } else if ("?".equals(key) || "???".equals(key)) { enterVO.setRegState(value); } else if ("?".equals(key) || "".equals(key) || "?/".equals(key) || key.startsWith("?") || key.startsWith("")) { enterVO.setRevokeDate(DateUtils.toYMDOfChaStr_ESZZ2(value)); } else if ("??".equals(key)) { enterVO.setComposition(value); } else if (key.contains("??")) {// ?? enterVO.setCurrency(value); } } // String companyIdN = getCompanyId(enterVO); enterVO.setCompanyId(companyIdN); // ? // if (null == enterVO.getProvince() && null == enterVO.getCity()) { // if (null != enterVO.getLocation()) { // if (0 != enterVO.getLocation().hashCode()) { // // ?? // String admin[] = doAdmin(u.enterp2(enterVO.getLocation())); // enterVO.setProvince(admin[0]); // enterVO.setCity(admin[1]); // enterVO.setArea(admin[2]); // } // } // } // if (null == enterVO.getProvince() && null == enterVO.getCity()) { // if (null != enterVO.getRegOffice()) { // if (0 != enterVO.getRegOffice().hashCode()) { // // // String admin[] = doAdmin(u.enterp2(enterVO.getRegOffice())); // enterVO.setProvince(admin[0]); // enterVO.setCity(admin[1]); // enterVO.setArea(admin[2]); // } // } else { // // ??? // if (null != enterVO.getCompany()) { // if (0 != enterVO.getCompany().hashCode()) { // String array[] = doAdmin(u.enterp(enterVO.getCompany())); // enterVO.setProvince(array[0]); // enterVO.setCity(array[1]); // enterVO.setArea(array[2]); // } // } else { // enterVO.setProvince(obj.get("province").toString()); // } // } // } JSONObject jsobj = obj.getJSONObject("datas"); JSONArray jyfwArray = null; // ???? if (jsobj.containsKey("???")) { jyfwArray = jsobj.getJSONArray("???"); } else if (jsobj.containsKey("?")) { jyfwArray = jsobj.getJSONArray("?"); } if (null != jyfwArray) { JSONObject jyfwObject = jyfwArray.getJSONObject(0); Iterator it = jyfwObject.keys(); while (it.hasNext()) { enterVO.setScope(jyfwObject.get(it.next().toString()).toString()); } } // enterVO.setRemark(remarkVO); if (obj.containsKey("url")) { String url = obj.getString("url"); if (null != url && 0 != url.hashCode()) { enterVO.setUrl(url); } } /* * jsonObject = JsonObject.fromJson(gs.toJson(enterVO)); enterVO = null; * doc = JsonDocument.create(companyId, jsonObject); */ // createJsonDocument("etp_t", doc);// etp_t jsonObject = null; return enterVO; } /** * ? */ public void createJsonDocument(String name, JsonDocument doc) { if (null == doc) { return; } Bucket bucket = ClusterUtil.commonBucket(name); while (true) { try { log.info("json:" + doc.toString()); bucket.upsert(doc, 1, TimeUnit.MINUTES); break; } catch (Exception e) { System.out.println(":" + e.getMessage()); System.out.println("?:" + doc.toString()); } } } /** * ? * * @param holderArray * ? * @param bucketName???? * @param companyId * ?ID */ @SuppressWarnings("rawtypes") public void holder(JSONArray holderArray, String bucketName, String companyId) { if (null != holderArray && holderArray.size() > 0) { HolderVO holderVO = null; RemarkVO remarkVO = null; JsonObject jsonObject = null; JsonDocument doc = null; for (int i = 0; i < holderArray.size(); i++) { holderVO = new HolderVO(); holderVO.setCompanyId(companyId); remarkVO = new RemarkVO(); remarkVO.setBucketName(bucketName);// ???? JSONObject tuziObj = holderArray.getJSONObject(i); Iterator tuziIter = tuziObj.keys(); while (tuziIter.hasNext()) { String tuziKey = tuziIter.next().toString(); if ("".equals(tuziKey) || "??".equals(tuziKey) || "?".equals(tuziKey) || tuziKey.contains("/???") || tuziKey.contains("/?") || tuziKey.contains("/??") || tuziKey.contains("?") || tuziKey.contains("/") || tuziKey.contains("/??") || tuziKey.contains("/??") || "?".equals(tuziKey) || "".equals(tuziKey) || "??".equals(tuziKey) || "".equals(tuziKey) || "??".equals(tuziKey) || "??".equals(tuziKey)) { remarkVO.setHolder(tuziKey); holderVO.setHolder(tuziObj.get(tuziKey).toString()); } // ? ??????/? else if ("".equals(tuziKey) || "".equals(tuziKey) || "?".equals(tuziKey) || "?".equals(tuziKey) || "?".equals(tuziKey) || "".equals(tuziKey) || "/?".equals(tuziKey)) { remarkVO.setType(tuziKey); holderVO.setType(tuziObj.get(tuziKey).toString()); } // ?/? ???? else if ("?/?".equals(tuziKey) || "??".equals(tuziKey)) { holderVO.setLicenseType(tuziObj.get(tuziKey).toString()); } // ?/??? ?????? else if ("?/???".equals(tuziKey) || "????".equals(tuziKey)) { holderVO.setLicenseNum(tuziObj.get(tuziKey).toString()); } // equityPart ? else if ("?".equals(tuziKey) || "?".equals(tuziKey)) { holderVO.setEquityPart(tuziObj.get(tuziKey).toString()); } } holderVO.setRemark(remarkVO); // jsonObject = JsonObject.fromJson(gs.toJson(holderVO)); doc = JsonDocument.create(UUID.randomUUID().toString(), jsonObject); // createJsonDocument("etp_holder_e", doc);// etp_holder_e jsonObject = null; doc = null; } } } /** * ? * * @param date * @return * @throws ParseException */ public String formatDate(String date) throws ParseException { String result = null; SimpleDateFormat sf = null; if (null != date) { // yyyyMMdd if (date.contains("") && date.contains("")) { result = date; return result; } String yyymmdd = "^[12]\\d{3}(0\\d|1[0-2])([0-2]\\d|3[01])$";// yyyyMMdd String yyyy_mm_dd = "^[0-9]{4}-[0-9]{1,}-[0-9]{1,}$";// yyyy-MM-dd String yyyy = "^\\d{4}\\/\\d{1,}\\/\\d{1,}$";// yyyy/MM/dd // yyyyMMdd Pattern pattern = Pattern.compile(yyymmdd); Matcher matcher = pattern.matcher(date); if (matcher.matches()) { sf = new SimpleDateFormat("yyyyMMdd"); Date d = sf.parse(date); sf = null; sf = new SimpleDateFormat("yyyyMMdd"); result = sf.format(d); sf = null; } else { // yyyy-MM-dd pattern = Pattern.compile(yyyy_mm_dd); matcher = pattern.matcher(date); if (matcher.matches()) { sf = new SimpleDateFormat("yyyy-MM-dd"); Date d = sf.parse(date); sf = null; sf = new SimpleDateFormat("yyyyMMdd"); result = sf.format(d); sf = null; } else { // yyyy/MM/dd pattern = Pattern.compile(yyyy); matcher = pattern.matcher(date); if (matcher.matches()) { sf = new SimpleDateFormat("yyyy/MM/dd"); Date d = sf.parse(date); sf = null; sf = new SimpleDateFormat("yyyyMMdd"); result = sf.format(d); sf = null; } else { int index_xie = date.indexOf("/"); int index_mao = date.indexOf(":"); if (4 == index_xie && -1 != index_mao) { String newDate = date.substring(0, date.indexOf(" ")); // yyyy/MM/dd hh:mm:ss pattern = Pattern.compile(yyyy); matcher = pattern.matcher(newDate); if (matcher.matches()) { sf = new SimpleDateFormat("yyyy/MM/dd"); Date d = sf.parse(newDate); sf = null; sf = new SimpleDateFormat("yyyyMMdd"); result = sf.format(d); sf = null; } } // ?Mon Apr 22 00:00:00 CST 2013? if (date.contains("CST")) { sf = new SimpleDateFormat("yyyyMMdd"); @SuppressWarnings("deprecation") Date dt = new Date(date); result = sf.format(dt); sf = null; dt = null; } } } } } return result; } /** * ??? * * @param mholderArray * ?? * @param bucketName * ?? * @param companyId * ?ID */ @SuppressWarnings("rawtypes") public List<MainManagerVO> insertMholder(JSONArray mholderArray, String bucketName, String companyId) { // List<MainManagerVO> mainManager=new ArrayList<MainManagerVO>(); List<MainManagerVO> maiList2 = new ArrayList<MainManagerVO>(); // ?? ???????????? if (!mholderArray.isEmpty()) { ObjectMapper mapper = new ObjectMapper(); // ???? Iterator iter = mholderArray.iterator(); JsonNode node = null; // ?? Object mholderObject = null; // ???? Iterator<String> keyIter = null; MainManagerVO mainVO = null; RemarkVO remarkVO = null; // ?? TempMainManagerVO tempVO = null; // json JsonObject jsonObject = null; JsonDocument doc = null; try { while (iter.hasNext()) { // ?? tempVO = new TempMainManagerVO(); tempVO.setCompanyId(companyId); /* * remarkVO = new RemarkVO(); * remarkVO.setBucketName(bucketName); * tempVO.setRemarkVO(remarkVO); remarkVO = null; */ mholderObject = iter.next(); node = mapper.readTree(mholderObject.toString()); keyIter = node.getFieldNames(); while (keyIter.hasNext()) { String key = keyIter.next().toString(); String value = node.get(key).getTextValue(); // ?? ????4 if ("??".equals(key)) { if ("".equals(value) || null == value || "null".equals(value) || " ".equals(value)) { continue; } tempVO.setManagerName1(value); } else if ("??4".equals(key)) { if ("".equals(value) || null == value || "null".equals(value) || " ".equals(value)) { continue; } tempVO.setManagerName2(value); } else if ("??7".equals(key)) { if ("".equals(value) || null == value || "null".equals(value) || " ".equals(value)) { continue; } tempVO.setManagerName3(value); } else if ("?".equals(key)) { if ("".equals(value) || null == value || "null".equals(value) || " ".equals(value)) { continue; } tempVO.setPosition1(value); } else if ("?5".equals(key)) { if ("".equals(value) || null == value || "null".equals(value) || " ".equals(value)) { continue; } tempVO.setPosition2(value); } else if ("?8".equals(key)) { if ("".equals(value) || null == value || "null".equals(value) || " ".equals(value)) { continue; } tempVO.setPosition3(value); } } // ??json?key // if (null != tempVO.getManagerName1() && null != tempVO.getPosition1()) { mainVO = new MainManagerVO(); mainVO.setRemark(tempVO.getRemarkVO()); mainVO.setCompanyId(tempVO.getCompanyId()); mainVO.setManagerName(tempVO.getManagerName1()); mainVO.setPosition(tempVO.getPosition1()); maiList2.add(mainVO); /* * jsonObject = JsonObject.fromJson(gs.toJson(mainVO)); * mainVO = null; doc = * JsonDocument.create(UUID.randomUUID().toString(), * jsonObject); //createJsonDocument("etp_mhold_e", * doc);// etp_mhold_e jsonObject = null; // * bucket=null; doc = null; */ } if (null != tempVO.getManagerName2() && null != tempVO.getPosition2()) { mainVO = new MainManagerVO(); mainVO.setRemark(tempVO.getRemarkVO()); mainVO.setCompanyId(tempVO.getCompanyId()); mainVO.setManagerName(tempVO.getManagerName2()); mainVO.setPosition(tempVO.getPosition2()); maiList2.add(mainVO); /* * jsonObject = JsonObject.fromJson(gs.toJson(mainVO)); * mainVO = null; doc = * JsonDocument.create(UUID.randomUUID().toString(), * jsonObject); * * Bucket bucket = * ClusterUtil.commonBucket("etp_mhold_e"); * bucket.upsert(doc); * * //createJsonDocument("etp_mhold_e", doc);// * etp_mhold_e jsonObject = null; // bucket=null; doc = * null; */ } if (null != tempVO.getManagerName3() && null != tempVO.getPosition3()) { mainVO = new MainManagerVO(); mainVO.setRemark(tempVO.getRemarkVO()); mainVO.setCompanyId(tempVO.getCompanyId()); mainVO.setManagerName(tempVO.getManagerName3()); mainVO.setPosition(tempVO.getPosition3()); maiList2.add(mainVO); /* * jsonObject = JsonObject.fromJson(gs.toJson(mainVO)); * mainVO = null; doc = * JsonDocument.create(UUID.randomUUID().toString(), * jsonObject); * * Bucket bucket = * ClusterUtil.commonBucket("etp_mhold_e"); * bucket.upsert(doc); * * //createJsonDocument("etp_mhold_e", doc);// * etp_mhold_e jsonObject = null; // bucket=null; doc = * null; */ } mainVO = null; } tempVO = null; } catch (JsonProcessingException e) { log.info(e); } catch (IOException e) { log.info(e); } finally { mapper = null; iter = null; node = null; mholderObject = null; keyIter = null; } } return maiList2; } /** * ??? ? ? * * @param changArray * ?? * @param before * ?? * @param after * ?? * @param companyId * ?ID * @throws ParseException */ @SuppressWarnings("rawtypes") public List<ChangeVO> insertChange(JSONArray changArray, String companyId, List<String> beforeList, List<String> afterList) throws ParseException { List<ChangeVO> change = new ArrayList<ChangeVO>(); if (!changArray.isEmpty()) { RemarkVO remarkVO = null; // ? ChangeVO changeVO = null; // json JsonObject jsonObject = null; JsonDocument doc = null; int count = 0; int countH = 0; for (int i = 0; i < changArray.size(); i++) { remarkVO = new RemarkVO(); remarkVO.setBucketName("??"); changeVO = new ChangeVO(); changeVO.setCompanyId(companyId); // changeVO.setRemark(remarkVO); JSONObject obj = changArray.getJSONObject(i); Iterator iter = obj.keys(); Iterator iterT = obj.keys(); boolean flag = false; while (iterT.hasNext()) { String key = iterT.next().toString(); String value = obj.get(key).toString(); if (null != value && !"?".equals(value) && !"".equals(value) && !"null".equals(value) && !"".equals(value) && !"?".equals(value)) { if ("??".equals(key)) { // ???? if ("".equals(value.trim())) { flag = true; break; } } } } while (iter.hasNext()) { String key = iter.next().toString(); String value = obj.get(key).toString(); if (null != value && !"?".equals(value) && !"".equals(value) && !"null".equals(value) && !"".equals(value) && !"?".equals(value)) { if ("?".equals(key)) { changeVO.setChangeEvent(value); } else if ("??".equals(key)) { // ???? if ("".equals(value.trim())) { flag = true; count += 1; if (count <= beforeList.size()) { changeVO.setChangeBefore(beforeList.get(count - 1)); // changeVO.setChangeBefore(deleteMoreFuhao(beforeList.get(count // - 1))); } } else { // changeVO.setChangeBefore(deleteMoreFuhao(value)); changeVO.setChangeBefore(value); } } else if ("??".equals(key)) { // ? if (!flag) { // changeVO.setChangeAfter(deleteMoreFuhao(value)); changeVO.setChangeAfter(value); } else { changeVO.setChangeDate(DateUtils.toYMDOfChaStr_ESZZ2(value)); countH++; if (countH <= afterList.size()) { changeVO.setChangeAfter(afterList.get(countH - 1)); // changeVO.setChangeAfter(deleteMoreFuhao(afterList.get(count // - 1))); } } } else if ("?".equals(key)) { if (!flag) { changeVO.setChangeDate(DateUtils.toYMDOfChaStr_ESZZ2(value)); } } } } // if (null != changeVO) { // if (null != changeVO && null != // changeVO.getChangeEvent()) { change.add(changeVO); // jsonObject = JsonObject.fromJson(gs.toJson(changeVO)); // doc = JsonDocument.create(UUID.randomUUID().toString(), // jsonObject); // // createJsonDocument("etp_event_item_e", doc); // bucket=null; } remarkVO = null; changeVO = null; jsonObject = null; doc = null; } } beforeList = null; beforeList = new ArrayList<String>(); afterList = null; afterList = new ArrayList<String>(); return change; } /** * * * @param bucket * * @param doc * */ public void commonInsert(Bucket bucket, JsonDocument doc) { try { bucket.upsert(doc); } catch (Exception e) { log.info(e); while (true) { try { bucket.upsert(doc); break; } catch (Exception ee) { log.info(ee); } } } } /** * * * @param adminiCode * * @return ? */ public String[] listCountryCityProvince(String adminiCode) { // 0~2??? String[] countryCityProvince = new String[3]; if (null != adminiCode) { if (adminiCode.length() < 6) { return countryCityProvince; } // ?? adminiCode = adminiCode.substring(0, 6); // adminiCode if (DataUtils.adminCountryMap.containsKey(adminiCode)) { // ???ID String array[] = DataUtils.adminCountryMap.get(adminiCode); countryCityProvince[2] = array[0];// ?? if (null != array[1]) { int cityId = Integer.parseInt(array[1]); // ID: '','','?','' if (cityId == 400 || cityId == 401 || cityId == 402 || cityId == 403) { String provinceName = utils.listProvinceNameByProvinceId(cityId); if (null != provinceName) { countryCityProvince[0] = provinceName;// ?? return countryCityProvince; } } // listProvinceNameByProvinceId Map<String, Integer> cityProvinceMap = utils.listCityProvinceIdByCityId(cityId); // ?? Set<String> cityNameSet = cityProvinceMap.keySet(); Iterator<String> iter = cityNameSet.iterator(); if (iter.hasNext()) { countryCityProvince[1] = iter.next();// ?? cityNameSet = null; iter = null; } // ?ID Collection<Integer> conllection = cityProvinceMap.values(); Iterator<Integer> iterator = conllection.iterator(); if (iterator.hasNext()) { String provinceName = utils.listProvinceNameByProvinceId(iterator.next()); if (null != provinceName) { countryCityProvince[0] = provinceName;// ??? iterator = null; conllection = null; } } } } else if (DataUtils.adminCityMap.containsKey(adminiCode)) { String array[] = DataUtils.adminCityMap.get(adminiCode); countryCityProvince[1] = array[0];// ?? int provinceId = Integer.parseInt(array[1]);// ?ID String provinceName = utils.listProvinceNameByProvinceId(provinceId); if (null != provinceName) { countryCityProvince[0] = provinceName;// ??? } } else if (DataUtils.adminProvinceMap.containsKey(adminiCode)) { countryCityProvince[0] = DataUtils.adminProvinceMap.get(adminiCode);// ??? } } return countryCityProvince; } /** * ? * * @param admin * * @return */ public String[] doAdmin(String admin[]) { if (null != admin[0] || null != admin[1]) { if (null != admin[1] && (admin[1].equals("") || admin[1].equals("") || admin[1].equals("?") || admin[1].equals(""))) { admin[0] = admin[1]; admin[1] = null; } } return admin; } /** * ? * * @param doTemp * @return */ public static String deleteMoreFuhao(String doTemp) { if (null == doTemp || doTemp == "") { return null; } return doTemp.replace(" ", "").replace(";", "").replace("\r", "").replace("\t", "").replace("\n", "") .replace(" ", "").replace("\"", ""); } public static void writerString(BufferedWriter fw, String str) { try { // fw.append(str + "\n"); fw.append(str + System.getProperty("line.separator")); // fw.newLine(); fw.flush(); // } catch (Exception e) { log.error("" + e.getMessage()); } finally { // if (fw != null) { // try { // fw.close(); // } catch (IOException e) { // e.printStackTrace(); // } // } } } /** * ??? 1 ? 0 ?? * * @param tuziArray * @return * @throws ParseException */ @SuppressWarnings("rawtypes") public String holderConDel(JSONArray tuziArray) throws ParseException { String flag = "0"; if (null != tuziArray && tuziArray.size() > 0) { for (int i = 0; i < tuziArray.size(); i++) { JSONObject tuziObj = tuziArray.getJSONObject(i); Iterator tuziIter = tuziObj.keys(); while (tuziIter.hasNext()) { String key = tuziIter.next().toString(); // String value = tuziObj.get(key).toString(); // if(null != value && "null".equals(value)) // { // value = null; // continue; // } if (key.contains("")) { flag = "1"; break; } } } } return flag; } /** * ? * * @param tuziArray * @param bucketName * @param companyId * @return * @throws ParseException */ @SuppressWarnings("rawtypes") public List<TempHolderVO> getholderAndDetList(JSONArray tuziArray, String bucketName, String companyId) throws ParseException { List<TempHolderVO> getholderAndDetList = new ArrayList<TempHolderVO>(); if (null != tuziArray && tuziArray.size() > 0) { // HolderVO holderVO = null; // HolderDetailVO holderDetVO = null; TempHolderVO tempVO = null; RemarkVO remarkVO = null; JsonObject jsonObject = null; JsonDocument doc = null; for (int i = 0; i < tuziArray.size(); i++) { tempVO = new TempHolderVO();// remarkVO = new RemarkVO();// remarkVO.setBucketName(bucketName);// ???? JSONObject tuziObj = tuziArray.getJSONObject(i); Iterator tuziIter = tuziObj.keys(); while (tuziIter.hasNext()) { String key = tuziIter.next().toString(); String value = tuziObj.get(key).toString(); if (null != value && "null".equals(value)) { value = null; // ?? // continue; } // if ("".equals(key) || "??".equals(key) || "?".equals(key) || key.contains("/???") || key.contains("/?") || key.contains("/??") || key.contains("?") || key.contains("/") || key.contains("/??") || key.contains("/??") || "?".equals(key) || "".equals(key) || "??".equals(key) || "".equals(key) || "??".equals(key) || "??".equals(key)) { remarkVO.setHolder(key); tempVO.setHolder(deleteMoreFuhao(value)); } // ? ??????/? else if ("".equals(key) || "".equals(key) || "?".equals(key) || "?".equals(key) || "?".equals(key) || "".equals(key) || "/?".equals(key)) { remarkVO.setType(key); tempVO.setType(deleteMoreFuhao(value)); } // ?/? ???? else if ("?/?".equals(key) || "??".equals(key)) { tempVO.setLicenseType(deleteMoreFuhao(value)); } // ?/??? ?????? else if ("?/???".equals(key) || "????".equals(key)) { tempVO.setLicenseNum(deleteMoreFuhao(value)); } // equityPart ? else if ("?".equals(key) || "?".equals(key)) { tempVO.setEquityPart(deleteMoreFuhao(value)); } // ?( else if ("?()".equals(key) || "?".equals(key)) { tempVO.setConCapital(value); } // ?( else if ("?()".equals(key) || "?".equals(key)) { tempVO.setFactCapital(value); } // ? ???() // else if ("?".equals(key) || "?()".equals(key) // || "?".equals(key) // || "?".equals(key) || "?()".equals(key)) { // tempVO.setSubcriCapital(value); // } else if ("?".equals(key) || "?()".equals(key) || "?".equals(key)) { tempVO.setSubcriCapital(value); } // ? ???? else if ("?".equals(key) || "?".equals(key) || "".equals(key)) { tempVO.setConMethod(value); } // ?? else if ("".equals(key) || "".equals(key)) { tempVO.setConsidDate(formatDate(value)); } // ? ???()? // else if ("?".equals(key) || "?()".equals(key) // || "?()".equals(key) // || "".equals(key) || "?".equals(key) || // "?".equals(key)) { // tempVO.setActualCapital(value); // } else if ("?".equals(key) || "?()".equals(key) || "".equals(key) || "?".equals(key)) { tempVO.setActualCapital(value); } // ? ?????6 else if ("?".equals(key) || "?".equals(key) || "?6".equals(key)) { tempVO.setFactMethod(value); } // ??? else if ("".equals(key) || "".equals(key) || "".equals(key)) { tempVO.setActualDate(formatDate(value)); } } getholderAndDetList.add(tempVO); } } return getholderAndDetList; } /** * * * @param branckArray * * @param companyId */ @SuppressWarnings("unchecked") public List<BranchVO> doBranch(JSONArray branchArray, String companyId) { List<BranchVO> branch = new ArrayList<BranchVO>(); if (branchArray.isEmpty()) { return branch; } BranchVO branchVO = null; JSONObject obj = null; // CouchBaseJSON JsonObject jsonObject = null; // CouchBaseDocument JsonDocument doc = null; for (int i = 0; i < branchArray.size(); i++) { branchVO = new BranchVO(); obj = branchArray.getJSONObject(i); if (null != obj) { Iterator<String> iter = obj.keys(); RemarkVO remark = new RemarkVO(); while (iter.hasNext()) { String key = iter.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("?")) { branchVO.setRegNum(obj.getString(key)); remark.setRegNum(key); } else if (key.contains("??")) { branchVO.setCompany(obj.getString(key)); } else if (key.contains("")) { branchVO.setRegOfficel(obj.getString(key)); } } if (null != branchVO) { // remark.setBucketName("?"); // branchVO.setRemark(remark); branchVO.setCompanyId(companyId); branch.add(branchVO); /* * remark = null; jsonObject = * JsonObject.fromJson(gs.toJson(branchVO)); doc = * JsonDocument.create(nbg.generate(companyId+i).toString(), * jsonObject); createJsonDocument("etp_branch_e",doc);// * jsonObject = null; doc = null; branchVO = null; */ } } } return branch; } /** * ??? * * @param abnormalArray * @param companyId */ @SuppressWarnings("unchecked") public List<AbnormalVO> doAbnormal(JSONArray abnormalArray, String companyId) { List<AbnormalVO> abnormal = new ArrayList<AbnormalVO>(); if (abnormalArray.isEmpty()) { return abnormal; } AbnormalVO abnorVO = null; RemarkVO remark = null; JSONObject obj = null; // CouchBaseJSON JsonObject jsonObject = null; // CouchBaseDocument JsonDocument doc = null; for (int i = 0; i < abnormalArray.size(); i++) { obj = abnormalArray.getJSONObject(i); abnorVO = new AbnormalVO(); if (null != obj) { Iterator<String> iter = obj.keys(); remark = new RemarkVO(); while (iter.hasNext()) { String key = iter.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("????") || key.contains("???")) { abnorVO.setRecordCause(obj.getString(key)); } else if (key.contains("") || key.contains("")) { abnorVO.setRecordDate(obj.getString(key)); } else if (key.contains("????") || key.contains("???")) { abnorVO.setRemoveCause(obj.getString(key)); } else if (key.contains("") || key.contains("??")) { abnorVO.setRemoveDate(obj.getString(key)); } else if (key.contains("")) { abnorVO.setDecideOffice(obj.getString(key)); } } abnorVO.setCompanyId(companyId); // remark.setBucketName("???"); // abnorVO.setRemark(remark); remark = null; // // jsonObject = JsonObject.fromJson(gs.toJson(abnorVO)); // doc = JsonDocument.create(UUID.randomUUID().toString(), // jsonObject); // createJsonDocument("etp_abnormal_e",doc);// // abnorVO = null; jsonObject = null; doc = null; abnormal.add(abnorVO); } } return abnormal; } /** * ?? * * @param breakLawArray * ??? * @param companyId * ?ID */ @SuppressWarnings("unchecked") public List<IllegalVO> breakLaw(JSONArray breakLawArray, String companyId) { List<IllegalVO> illegal = new ArrayList<IllegalVO>(); if (breakLawArray.isEmpty()) { return illegal; } IllegalVO illegalVO = null; RemarkVO remark = null; JSONObject obj = null; // CouchBaseJSON JsonObject jsonObject = null; // CouchBaseDocument JsonDocument doc = null; for (int i = 0; i < breakLawArray.size(); i++) { obj = breakLawArray.getJSONObject(i); illegalVO = new IllegalVO(); if (null != obj) { Iterator<String> iter = obj.keys(); remark = new RemarkVO(); while (iter.hasNext()) { String key = iter.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("??????") || key.contains("??????")) { illegalVO.setIllegalCause(value); } else if (key.contains("") || key.contains("")) { illegalVO.setRecordDate(value); } else if (key.contains("??????") || (key.contains("??") && key.contains(""))) { illegalVO.setRemoveCause(value); } else if (key.contains("") || key.contains("??")) { illegalVO.setRemoveDate(value); } else if (key.contains("")) { illegalVO.setDecideOffice(value); } } // remark.setBucketName("???"); illegalVO.setCompanyId(companyId); // illegalVO.setRemark(remark); // remark = null; illegal.add(illegalVO); // jsonObject = JsonObject.fromJson(gs.toJson(illegalVO)); // illegalVO = null; // doc = // JsonDocument.create((nbg.generate("???"+i)).toString(), // jsonObject); // illegalVO = null; // createJsonDocument("etp_illelnfo_e",doc);//:?? // jsonObject = null; // doc = null; } } return illegal; } /** * ??? * * @param companyId * ?ID * @throws ParseException */ @SuppressWarnings({ "unchecked" }) public List<PledgeVO> stockPledge(String companyId, JSONArray recordArray, List<JSONArray> pledgeList) throws ParseException { List<PledgeVO> pledge = new ArrayList<PledgeVO>(); // ?? PledgeVO pleVO = null; JSONObject obj = null; // CouchBaseJSON JsonObject jsonObject = null; // CouchBaseDocument JsonDocument doc = null; for (int i = 0; i < recordArray.size(); i++) { obj = recordArray.getJSONObject(i); pleVO = new PledgeVO(); if (null != obj) { Iterator<String> iter = obj.keys(); while (iter.hasNext()) { String key = iter.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("?")) // ? { pleVO.setRecordNum(value); } else if (key.contains("")) // { pleVO.setPledgor(value);// pledgor } else if (key.contains("?") || key.contains("???")) // ?/??? { pleVO.setPledgorNum(value); if (null != pleVO && null != pleVO.getPledgorNum()) { pleVO.setPledgeeNum(value); } } else if (key.contains("??")) // ?? { pleVO.setPledgeAmount(value); } else if (key.contains("?")) // ? { pleVO.setPledgee(value); } else if (key.contains("")) // ? { pleVO.setRecordDate(formatDate(value)); } else if (key.contains("?")) // ? { pleVO.setState(value); } else if (key.contains("")) // ? { if (value.contains("")) { if (null != pledgeList) { if (!pledgeList.isEmpty()) { // ??1 JSONArray array = pledgeList.get(0); pledgeList.remove(0);// ????1 List<PledgeDetVO> detList = doPledgeDet(array);// ???? if (!detList.isEmpty()) { pleVO.setPledgeDetList(detList); } detList = null; } } } } } pledge.add(pleVO); // ?? // jsonObject = JsonObject.fromJson(gs.toJson(pleVO)); // pleVO = null; // doc = // JsonDocument.create(nbg.generate(companyId+i).toString(), // jsonObject); // createJsonDocument("etp_remise_e",doc); // jsonObject = null; // doc = null; } } return pledge; } /** * ??? * * @param array * @return * @throws ParseException */ @SuppressWarnings({ "unchecked" }) public List<PledgeDetVO> doPledgeDet(JSONArray array) throws ParseException { List<PledgeDetVO> detList = new ArrayList<PledgeDetVO>(); JSONObject obj = null; PledgeDetVO pledgeDetVO = null; for (int i = 0; i < array.size(); i++) { obj = array.getJSONObject(i); Iterator<String> itert = obj.keys(); pledgeDetVO = new PledgeDetVO(); while (itert.hasNext()) { String keys = itert.next(); String values = obj.getString(keys); if (keys.contains("")) // ? { pledgeDetVO.setChangeDate(formatDate(values)); } else if (keys.contains("")) // ? { pledgeDetVO.setChangeContent(values); } } detList.add(pledgeDetVO); pledgeDetVO = null; obj = null; } return detList; } /** * ? * * @param companyId * @param punishmentArray */ @SuppressWarnings("unchecked") public List<PunishmentVO> doPunishment(String companyId, JSONArray punishmentArray, JSONArray punishDetArray) { List<PunishmentVO> punishment = new ArrayList<PunishmentVO>(); if (punishmentArray.isEmpty()) { return punishment; } PunishmentVO punishVO = null; PunishmentDetVO detVO = null; JSONObject obj = null; // CouchBaseJSON JsonObject jsonObject = null; // CouchBaseDocument JsonDocument doc = null; for (int i = 0; i < punishmentArray.size(); i++) { punishVO = new PunishmentVO(); obj = punishmentArray.getJSONObject(i); if (null != obj) { Iterator<String> iter = obj.keys(); while (iter.hasNext()) { String key = iter.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("?")) // ? { punishVO.setPunishNum(value); } else if (key.contains("")) // ? { punishVO.setIllegalType(value); } else if (key.contains("")) // { punishVO.setPunishContent(value); } else if (key.contains("")) // ?? { punishVO.setPunishOffice(value); } else if (key.contains("")) // { punishVO.setPunishDate(value); } else if (key.contains("")) // { punishVO.setPublicationDate(value); } else if (key.contains("")) // { if (value.equals("")) { if (null != punishDetArray && !punishDetArray.isEmpty()) // ? { JSONObject detObject = punishDetArray.getJSONObject(0); punishDetArray.remove(0);// detVO = doPunishmentDet(detObject);// ?? if (null != detVO) { punishVO.setDetail(detVO); } } } } } punishment.add(punishVO); // xieke // jsonObject = JsonObject.fromJson(gs.toJson(punishVO)); // doc = // JsonDocument.create(nbg.generate(companyId+i).toString(), // jsonObject); // createJsonDocument("etp_punish_e",doc); // jsonObject = null; // doc = null; } } return punishment; } /** * ?? * * @param detObject * @return */ @SuppressWarnings("unchecked") public PunishmentDetVO doPunishmentDet(JSONObject detObject) { PunishmentDetVO detVO = null; if (!detObject.isEmpty()) { detVO = new PunishmentDetVO(); Iterator<String> itert = detObject.keys(); while (itert.hasNext()) { String key = itert.next(); String value = detObject.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("?")) // ? { detVO.setPunishNum(value); } else if (key.contains("??")) // ?? { detVO.setCompany(value); } else if (key.contains("?")) // ? { detVO.setRegNum(value); } else if ("".contains(key) || "".contains(key) || "".contains(key) || "??".contains(key) || "?".contains(key) || "".contains(key) || key.contains("") || key.contains("??")) { detVO.setLegalRep(value); } else if (key.contains("")) // ? { detVO.setIllegalType(value); } else if (key.contains("")) // { detVO.setPunishContent(value); } else if (key.contains("")) // ?? { detVO.setPunishOffice(value); } else if (key.contains("")) // { detVO.setPunishDate(value); } else if (key.contains("")) // { detVO.setDecision(value); } } } return detVO; } /** * ? * * @param checkArray * ?? * @param companyId * ?ID * @throws ParseException */ @SuppressWarnings("unchecked") public List<SpotCheckVO> doCheck(JSONArray checkArray, String companyId) throws ParseException { List<SpotCheckVO> spotCheck = new ArrayList<SpotCheckVO>(); if (checkArray.isEmpty()) { return spotCheck; } SpotCheckVO checkVO = null; JSONObject obj = null; // CouchBaseJSON JsonObject jsonObject = null; // CouchBaseDocument JsonDocument doc = null; for (int i = 0; i < checkArray.size(); i++) { checkVO = new SpotCheckVO(); obj = checkArray.getJSONObject(i); if (null != obj) { Iterator<String> iter = obj.keys(); while (iter.hasNext()) { String key = iter.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("")) // { checkVO.setCheckOffice(value); } else if (key.contains("")) // { checkVO.setCheckType(value); } else if (key.contains("")) // { checkVO.setCheckDate(formatDate(value)); } else if (key.contains("")) // { checkVO.setCheckResult(value); } } } checkVO.setCompanyId(companyId); spotCheck.add(checkVO); // /* * jsonObject = JsonObject.fromJson(gs.toJson(checkVO)); checkVO = * null; doc = * JsonDocument.create(nbg.generate(companyId+i).toString(), * jsonObject); createJsonDocument("etp_check_e",doc); jsonObject = * null; doc = null; */ } return spotCheck; } /** * ? */ public List<ReportVO> yearReportInsertDataBase(String companyId, Map<String, JSONArray> reportMap) { List<ReportVO> report = new ArrayList<ReportVO>(); // 2015 label ? Map<String, Map<String, JSONArray>> map = new HashMap<String, Map<String, JSONArray>>(); // \r\n\t\t2014 ? Map<String, JSONArray> valueMap = null; if (null != reportMap && reportMap.size() > 0) { Set<String> keySet = reportMap.keySet(); Iterator<String> iter = keySet.iterator(); while (iter.hasNext()) { String key = iter.next(); // ?2013?2014 String year = key.substring(key.lastIndexOf("\t") + 1, key.indexOf("")); if (!map.containsKey(year)) { valueMap = new HashMap<String, JSONArray>(); valueMap.put(key, reportMap.get(key)); map.put(year, valueMap); valueMap = null; } else { valueMap = map.get(year); valueMap.put(key, reportMap.get(key)); map.put(year, valueMap); valueMap = null; } } } if (!map.isEmpty()) { // 2014?2013 Set<String> keySet = map.keySet(); Iterator<String> itera = keySet.iterator(); // ReportVO reportVO = null; // CouchBaseJSON JsonObject jsonObject = null; // CouchBaseDocument JsonDocument doc = null; // ?????JSONArray Map<String, JSONArray> contenMap = null; while (itera.hasNext()) { String reportName = itera.next();// 2015?2014 reportVO = new ReportVO(); List<ReporteEventItemVO> eventItemList = null;// List<ReportStockEventItemVO> stockEventList = null;// ?? List<ReportInvestVO> investList = null; // -?? List<HolderDetailVO> holderDetailList = null;// ? List<ReportWebVO> webList = null; // ? List<ReportGuaranteeVO> guaranteeList = null;// ?????? ReportAssetVO asset = null; // ?? ReportBaseVO baseVO = null; // ? contenMap = map.get(reportName); // ?????? Set<String> contSet = contenMap.keySet(); Iterator<String> it = contSet.iterator(); while (it.hasNext()) { String label = it.next(); // ? if (label.contains("")) { eventItemList = doEventItem(contenMap.get(label)); } else if (label.contains("")) { investList = doInvest(contenMap.get(label)); } else if (label.contains("??")) { stockEventList = doStock(contenMap.get(label)); } else if (label.contains("")) // ?????? { holderDetailList = doHolderDetail(contenMap.get(label)); } else if (label.contains("?") || label.contains("??")) { asset = doAsset(contenMap.get(label)); } else if (label.contains("")) { webList = doWeb(contenMap.get(label)); } else if (label.contains("?")) { baseVO = doBase(contenMap.get(label)); } else if (label.contains("?")) // ?????? // 2013?????? { guaranteeList = doGuarantee(contenMap.get(label)); } // else if(label.contains("?")){//2014? // // } } // ?? if (null != eventItemList && eventItemList.size() > 0) { reportVO.setEventItemList(eventItemList); } // ??? if (null != stockEventList && stockEventList.size() > 0) { reportVO.setStockEventList(stockEventList); } // ?? if (null != investList && investList.size() > 0) { reportVO.setInvestList(investList); } // ?? if (null != holderDetailList && holderDetailList.size() > 0) { reportVO.setHolderDetailList(holderDetailList); } // ? if (null != webList && webList.size() > 0) { reportVO.setWebList(webList); } // ? if (null != guaranteeList && guaranteeList.size() > 0) { reportVO.setGuaranteeList(guaranteeList); } // ?? if (null != asset) { reportVO.setAsset(asset); } if (null != baseVO) { reportVO.setBase(baseVO); } if (null != reportVO) { reportVO.setReportName(reportName + ""); reportVO.setCompanyId(companyId); // jsonObject = JsonObject.fromJson(gs.toJson(reportVO)); // System.out.println(gs.toJson(reportVO)); // reportVO = null; // doc // =JsonDocument.create(nbg.generate(reportName).toString(), // jsonObject); // createJsonDocument("etp_rept_c",doc);// report.add(reportVO); jsonObject = null; doc = null; eventItemList = null; stockEventList = null; investList = null; holderDetailList = null; webList = null; asset = null; baseVO = null; } } } return report; } /** * - * * @param eventArray * * @return ? */ @SuppressWarnings("unchecked") public List<ReporteEventItemVO> doEventItem(JSONArray eventArray) { if (eventArray.isEmpty()) { return null; } List<ReporteEventItemVO> eventItemList = null; ReporteEventItemVO eventItemVO = null;// JSONObject obj = null; eventItemList = new ArrayList<ReporteEventItemVO>(); for (int i = 0; i < eventArray.size(); i++) { obj = eventArray.getJSONObject(i); if (null != obj) { eventItemVO = new ReporteEventItemVO(); Iterator<String> itt = obj.keys(); while (itt.hasNext()) { String key = itt.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("")) { eventItemVO.setChangeEvent(obj.getString(key)); } else if (key.contains("?")) { eventItemVO.setChangeBefore(obj.getString(key)); } else if (key.contains("?")) { eventItemVO.setChangeAfter(obj.getString(key)); } else if (key.contains("")) { eventItemVO.setChangeAfter(obj.getString(key)); } } if (!ObjectUtils.isFieldValueNull(eventItemVO)) { /* * RemarkVO remark = new RemarkVO(); * remark.setBucketName(""); * eventItemVO.setRemark(remark); remark = null; */ eventItemList.add(eventItemVO); eventItemVO = null; } } } return eventItemList; } /** * -? * * @param inverstArray * ? * @return ?? */ @SuppressWarnings("unchecked") public List<ReportInvestVO> doInvest(JSONArray inverstArray) { if (inverstArray.isEmpty()) { return null; } List<ReportInvestVO> investList = new ArrayList<ReportInvestVO>(); ReportInvestVO investVO = null;// new ReportInvestVO() JSONObject obj = null; for (int i = 0; i < inverstArray.size(); i++) { obj = inverstArray.getJSONObject(i); if (null != obj) { investVO = new ReportInvestVO(); Iterator<String> iter = obj.keys(); while (iter.hasNext()) { String key = iter.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("??")) // ????? { investVO.setInvestTarget(obj.getString(key)); } else if (key.contains("?")) // ?/? { investVO.setRegNum(obj.getString(key)); } } if (!ObjectUtils.isFieldValueNull(investVO)) { RemarkVO remark = new RemarkVO(); remark.setBucketName("?"); investVO.setRemark(remark); remark = null; investList.add(investVO); investVO = null; } } } return investList; } /** * -??? * * @param stockArray * ??? * @return */ @SuppressWarnings("unchecked") public List<ReportStockEventItemVO> doStock(JSONArray stockArray) { if (stockArray.isEmpty()) { return null; } List<ReportStockEventItemVO> stockEventList = new ArrayList<ReportStockEventItemVO>(); ReportStockEventItemVO stockVO = null; JSONObject obj = null; for (int i = 0; i < stockArray.size(); i++) { obj = stockArray.getJSONObject(i); if (null != obj) { stockVO = new ReportStockEventItemVO(); Iterator<String> iter = obj.keys(); while (iter.hasNext()) { String key = iter.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("?") || key.contains("") || key.contains("?") || key.contains("")) { stockVO.setFounderMember(obj.getString(key)); } else if (key.contains("???")) { stockVO.setUpbefRatio(obj.getString(key)); } else if (key.contains("???")) { stockVO.setUpaftRatio(obj.getString(key)); } else if (key.contains("??")) { stockVO.setUpdateDate(obj.getString(key)); } } if (!ObjectUtils.isFieldValueNull(stockVO)) { /* * RemarkVO remark = new RemarkVO(); * remark.setBucketName("???"); * stockVO.setRemark(remark); remark = null; */ stockEventList.add(stockVO); stockVO = null; } } } return stockEventList; } /** * - ? * * @param detailArray * ? * @return ?? */ @SuppressWarnings("unchecked") public List<HolderDetailVO> doHolderDetail(JSONArray detailArray) { if (detailArray.isEmpty()) { return null; } List<HolderDetailVO> detailList = new ArrayList<HolderDetailVO>(); RemarkVO remarkVO = null; HolderDetailVO detailVO = null; for (int i = 0; i < detailArray.size(); i++) { remarkVO = new RemarkVO(); detailVO = new HolderDetailVO(); JSONObject chziObj = detailArray.getJSONObject(i); if (null != chziObj) { Iterator<String> chziIter = chziObj.keys(); while (chziIter.hasNext()) { // key String chziKey = chziIter.next().toString(); String value = chziObj.getString(chziKey); if (null != value && value.hashCode() == 0) { continue; } if (chziKey.contains("") || "??".equals(chziKey) || chziKey.contains("?") || chziKey.contains("?") || chziKey.contains("") || chziKey.contains("")) { remarkVO.setHolder(chziKey); detailVO.setHolder(value); } if ("?".equals(chziKey) || "?()".equals(chziKey) || "?".equals(chziKey)) { detailVO.setSubcriCapital(value); } else if ("?".equals(chziKey) || "".equals(chziKey)) { detailVO.setConMethod(value); } else if ("".equals(chziKey) || "".equals(chziKey)) { detailVO.setConsidDate(value); } else if ("?".equals(chziKey) || "?()".equals(chziKey) || "".equals(chziKey) || "?".equals(chziKey)) { detailVO.setActualCapital(value); } else if ("?".equals(chziKey) || "?".equals(chziKey) || "?6".equals(chziKey) || "?".equals(chziKey)) { detailVO.setFactMethod(value); } else if ("".equals(chziKey) || "".equals(chziKey) || "".equals(chziKey) || "".equals(chziKey)) { detailVO.setActualDate(value); } else if ("".equals(chziKey)) { detailVO.setInvestType(value); } } if (!ObjectUtils.isFieldValueNull(detailVO)) { /* * remarkVO.setBucketName("??"); * detailVO.setRemark(remarkVO); remarkVO = null; */ detailList.add(detailVO); detailVO = null; } } } return detailList; } /** * -??\?? * * @param assetArray * ?? * @return ?? */ @SuppressWarnings("unchecked") public ReportAssetVO doAsset(JSONArray assetArray) { if (assetArray.isEmpty()) { return null; } ReportAssetVO assetVO = null; JSONObject obj = assetArray.getJSONObject(0);// ? if (null != obj) { assetVO = new ReportAssetVO(); Iterator<String> iter = obj.keys(); while (iter.hasNext()) { String key = iter.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("?")) { assetVO.setTotalAsset(obj.getString(key)); } else if (key.contains("??")) { assetVO.setOwnerInterest(obj.getString(key)); } else if (key.contains("?")) {// ?? assetVO.setMainTotalSale(obj.getString(key)); } else if (key.contains("?") || key.contains("?")) { assetVO.setTotalSale(obj.getString(key)); } else if (key.contains("?") || key.contains("?")) { assetVO.setProfit(obj.getString(key)); } else if (key.contains("")) { assetVO.setNetProfit(obj.getString(key)); } else if (key.contains("?") || key.contains("?")) { assetVO.setTotalTax(obj.getString(key)); } else if (key.contains("?")) { assetVO.setTotalDebt(obj.getString(key)); } } if (!ObjectUtils.isFieldValueNull(assetVO)) { /* * RemarkVO remark = new RemarkVO(); * remark.setBucketName("??"); assetVO.setRemark(remark); * remark = null; */ return assetVO; } } return assetVO; } /** * -??? * * @param webArray * ??? * @return ???? */ @SuppressWarnings("unchecked") public List<ReportWebVO> doWeb(JSONArray webArray) { if (webArray.isEmpty()) { return null; } List<ReportWebVO> webList = new ArrayList<ReportWebVO>(); ReportWebVO webVO = null;// new ReportWebVO(); JSONObject obj = null; for (int i = 0; i < webArray.size(); i++) { webVO = new ReportWebVO(); obj = webArray.getJSONObject(i); if (null != obj) { Iterator<String> iter = obj.keys(); while (iter.hasNext()) { String key = iter.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("")) { webVO.setSiteType(value); } else if (key.contains("??")) { webVO.setSiteName(value); } else if (key.contains("?")) { webVO.setUrl(value); } } if (!ObjectUtils.isFieldValueNull(webVO)) { /* * RemarkVO remark = new RemarkVO(); * remark.setBucketName("?"); webVO.setRemark(remark); * remark = null; */ webList.add(webVO); webVO = null; } } } return webList; } /** * -? * * @param baseArray * @return */ @SuppressWarnings("unchecked") public ReportBaseVO doBase(JSONArray baseArray) { if (baseArray.isEmpty()) { return null; } ReportBaseVO baseVO = null; JSONObject obj = baseArray.getJSONObject(0); if (null != obj) { baseVO = new ReportBaseVO(); RemarkVO remark = new RemarkVO(); Iterator<String> iter = obj.keys(); while (iter.hasNext()) { String key = iter.next(); if (key.contains("?")) { baseVO.setRegNum(obj.getString(key)); remark.setRegNum(key); } else if (key.contains("??")) { baseVO.setCompany(obj.getString(key)); } else if (key.contains("?")) { baseVO.setTel(obj.getString(key)); } else if (key.contains("?") || key.contains("")) { baseVO.setZip(obj.getString(key)); } else if (key.contains("?")) { baseVO.setLocation(obj.getString(key)); } else if (key.contains("") || key.contains("Email") || key.contains("email")) { baseVO.setEmail(obj.getString(key)); } // ???????????? else if (key.contains("??")) { baseVO.setMakeOver(obj.getString(key)); } else if (key.contains("???")) { baseVO.setRegState(obj.getString(key)); } else if (key.contains("") || key.contains("")) { baseVO.setHasWeb(obj.getString(key)); } // ?????????? else if (key.contains("??") || key.contains("")) { baseVO.setInvest(obj.getString(key)); } else if (key.contains("")) { baseVO.setHeadCount(obj.getString(key)); } else if (key.contains("")) // { baseVO.setSubordination(obj.getString(key)); } } /* * remark.setBucketName("?"); baseVO.setRemark(remark); remark = * null; */ } return baseVO; } /** * -?? * * @param guaranteeArray * ?? * @return ??? */ @SuppressWarnings("unchecked") public List<ReportGuaranteeVO> doGuarantee(JSONArray guaranteeArray) { if (guaranteeArray.isEmpty()) { return null; } List<ReportGuaranteeVO> guaranteeList = new ArrayList<ReportGuaranteeVO>(); ReportGuaranteeVO guaranteeVO = null; JSONObject obj = null; for (int i = 0; i < guaranteeArray.size(); i++) { guaranteeVO = new ReportGuaranteeVO(); obj = guaranteeArray.getJSONObject(i); if (null != obj) { Iterator<String> iter = obj.keys(); while (iter.hasNext()) { String key = iter.next(); String value = obj.getString(key); if (null != value && value.hashCode() == 0) { continue; } if (key.contains("?")) { guaranteeVO.setLoaner(obj.getString(key)); } else if (key.contains("")) { guaranteeVO.setDebtor(obj.getString(key)); } else if (key.contains("?")) // ?? { guaranteeVO.setDebtType(obj.getString(key)); } else if (key.contains("?")) // ?? { guaranteeVO.setDebtAmount(obj.getString(key)); } else if (key.contains("?")) // ? { guaranteeVO.setPerformTerm(obj.getString(key)); } else if (key.contains("")) // ?? { guaranteeVO.setEnsureTerm(obj.getString(key)); } else if (key.contains("?")) // ??? { guaranteeVO.setEnsureMethod(obj.getString(key)); } else if (key.contains("")) // ??? { guaranteeVO.setEnsureScope(obj.getString(key)); } } if (!ObjectUtils.isFieldValueNull(guaranteeVO)) { /* * RemarkVO remark = new RemarkVO(); * remark.setBucketName("??????"); * guaranteeVO.setRemark(remark); remark = null; */ guaranteeList.add(guaranteeVO); guaranteeVO = null; } } } return guaranteeList; } /** * ? //2015-09-02T04:07:01.658587+08:00 * * @param obj * @return */ public String getCreateTime(JSONObject obj) { String jsbTime = null; if (null != obj) { if (obj.containsKey("create_times")) { jsbTime = (String) obj.get("create_times"); } } // 2015-09-02T04:07:01.658587+08:00 String temp = DateUtils.toYMDOfChaStr_ESZZ2(jsbTime); if (null == temp) { temp = DateUtils.getDateyyyyMMddhhmmssZZ(); } return temp; } /** * ???? * * @param regNum * @return truefalse? */ public boolean validRegNum(String regNum) { // ??? List<CodeVO> code = getregNumList(regNum); if (null == code || (null != code && code.size() == 0)) { return false; } code = null; return true; } /** * ??? * * @param value * @return */ public List<CodeVO> getregNumList(String value) { // ? Pattern pattern2 = Pattern.compile("[0-9a-zA-Z]*"); if (null == value) { return null; } List<CodeVO> list = new ArrayList<CodeVO>(); String code = value.replaceAll(" \r\t", "").replace(" ", "").replace("\r\t", "").replace(" ", ""); if (code.length() == 15 || code.length() == 13) { if (pattern2.matcher(code).matches()) { // ? list.add(new CodeVO(code, 1)); } else { if (code.substring(code.length() - 1, code.length()).equals("?") || code.substring(0, 1).equals("?")) { // ? list.add(new CodeVO(code, 1)); } } return list; } else if (code.length() == 18) { if (!pattern2.matcher(code).matches()) { return null; } // ? list.add(new CodeVO(code, 2)); return list; } else { // ???? return getCodes(code); } } /** * ?? * * @param value * @return */ public List<CodeVO> getCodes(String value) { // ? Pattern pattern = Pattern.compile("[0-9a-zA-Z\u4e00-\u9fa5]*"); // ? Pattern pattern2 = Pattern.compile("[0-9a-zA-Z]*"); Matcher matcher = null; StringBuffer sb = new StringBuffer(); String[] a = value.split(""); for (String c : a) { matcher = pattern.matcher(c); if (matcher.matches()) { sb.append(c); } else { sb.append(","); } } a = sb.toString().split(","); sb = null; List<CodeVO> list = new ArrayList<CodeVO>(); for (String c : a) { if (null != c && !"".equals(c)) { if (c.length() <= 4) { continue; } if (c.length() == 15 || c.length() == 13) { if (pattern2.matcher(c).matches()) { // ? list.add(new CodeVO(c, 1)); } else { if (c.substring(c.length() - 1, c.length()).equals("?") || c.substring(0, 1).equals("?")) { // ? list.add(new CodeVO(c, 1)); } } } else if (c.length() == 18) { // if(!pattern2.matcher(c).matches()){continue;} // ? list.add(new CodeVO(c, 2)); } else if (c.substring(c.length() - 1, c.length()).equals("?") || c.substring(0, 1).equals("?")) { // ? list.add(new CodeVO(c, 1)); } } } pattern = null; pattern2 = null; return list; } /** * ?? * * @param enterVO */ public void clearRegNum(EnterpriseVO enterVO) { if (null == enterVO) { return; } // ??? List<CodeVO> code = getregNumList(enterVO.getRegNum()); if (null != code && code.size() > 0) { for (CodeVO co : code) { if (co.getStatus() == 1) { // ? enterVO.setRegNum(co.getCode()); } else { // ? enterVO.setCreditCode(co.getCode()); } } code.clear(); code = null; } else { code = getregNumList(enterVO.getCreditCode()); if (null != code && code.size() > 0) { for (CodeVO co : code) { if (co.getStatus() == 1) { // ? enterVO.setRegNum(co.getCode()); } else { // ? enterVO.setCreditCode(co.getCode()); } } code.clear(); code = null; } } // ? if (null != enterVO.getRegNum()) { PrCiCouVO vo = getAdmin(enterVO.getRegNum());// ? if (null != vo) { if (null != vo.getProvince()) { enterVO.setProvince(vo.getProvince());// ? } if (null != vo.getCity()) { enterVO.setCity(vo.getCity());// } if (null != vo.getCountry()) { enterVO.setArea(vo.getCountry());// } } } // ?? if (null == enterVO.getCity() && null == enterVO.getArea() && null != enterVO.getCreditCode()) { PrCiCouVO vo = getAdmin(enterVO.getCreditCode());// ? if (null != vo) { if (null != vo.getProvince()) { enterVO.setProvince(vo.getProvince());// ? } if (null != vo.getCity()) { enterVO.setCity(vo.getCity());// } if (null != vo.getCountry()) { enterVO.setArea(vo.getCountry());// } } else { // if (null != enterVO.getRegOffice()) { if (0 != enterVO.getRegOffice().hashCode()) { // String admin[] = doAdmin(new AdministrationUtils().enterp2(enterVO.getRegOffice())); enterVO.setProvince(admin[0]); enterVO.setCity(admin[1]); enterVO.setArea(admin[2]); admin = null; } } // ? if (null == enterVO.getProvince() && null == enterVO.getCity()) { if (null != enterVO.getLocation()) { if (0 != enterVO.getLocation().hashCode()) { // ?? String admin[] = doAdmin(u.enterp2(enterVO.getLocation())); enterVO.setProvince(admin[0]); enterVO.setCity(admin[1]); enterVO.setArea(admin[2]); } } } // ??? if (null == enterVO.getProvince() && null == enterVO.getCity()) { if (null != enterVO.getCompany()) { if (0 != enterVO.getCompany().hashCode()) { String array[] = doAdmin(u.enterp(enterVO.getCompany())); enterVO.setProvince(array[0]); enterVO.setCity(array[1]); enterVO.setArea(array[2]); } } else { // enterVO.setProvince(obj.get("province").toString()); } } } } } /** * ???? 15 13 ---- ? 18 --? * * @param regNum * @return */ public PrCiCouVO getAdmin(String regNum) { List<CodeVO> code = PrCiCouText.getregNumList(regNum); PrCiCouVO f = null; for (CodeVO ce : code) { try { // ? if (ce.getStatus() == 1) { String va = ce.getCode().substring(0, 6); f = PrCiCouText.prcicouName(va); } else { // ? String va = ce.getCode().substring(2, 8); // 2?? f = PrCiCouText.prcicouName(va); } if (null != f) { return f; } } catch (Exception e) { e.printStackTrace(); log.error("getAdmin:" + e); } } return null; } public String getCompanyId(EnterpriseVO vo) { String companyId = null; if (!StringUtils.isNull(vo.getRegNum())) { // ??? List<CodeVO> code = getregNumList(vo.getRegNum()); if (null != code && code.size() > 0) { for (CodeVO co : code) { // System.out.println(co.getCode() + ":" + co.getStatus()); if (co.getStatus() == 1) { // ? companyId = nbg.generate(co.getCode()).toString(); } else { // ? companyId = nbg.generate(co.getCode()).toString(); } } code.clear(); code = null; } else { companyId = nbg.generate(vo.getCompany() + vo.getLocation()).toString(); } } else { companyId = nbg.generate(vo.getCompany() + vo.getLocation()).toString(); } return companyId; } public String getCompanyId(EnterpriseVO vo, String num) { String companyId = null; if (!StringUtils.isNull(num)) { // ??? List<CodeVO> code = getregNumList(vo.getRegNum()); if (null != code && code.size() > 0) { for (CodeVO co : code) { // System.out.println(co.getCode() + ":" + co.getStatus()); if (co.getStatus() == 1) { // ? companyId = nbg.generate(co.getCode()).toString(); } else { // ? companyId = nbg.generate(co.getCode()).toString(); } } code.clear(); code = null; } else { companyId = nbg.generate(vo.getCompany() + vo.getLocation()).toString(); } } else { companyId = nbg.generate(vo.getCompany() + vo.getLocation()).toString(); } return companyId; } /** * () ? * * @param str * @return */ public static String removeBlank(String str) { if (StringUtils.isNull(str)) { return null; } String sss = str; sss = sss.replace("(", "").replace(")", "").replace("?", "").replace("", "").replace("[", "") .replace("]", "").replace("", "").replace("?", ""); try { int a1 = sss.indexOf(""); int b1 = sss.indexOf("") + 1; int num = 0; char[] chars = sss.toCharArray(); for (int i = 0; i < chars.length; i++) { if ('' == chars[i]) { num++; } } for (int i = 0; i < num; i++) { if (a1 != -1) { if (b1 != -1 && b1 != 0 && a1 < b1) { sss = sss.substring(0, a1) + sss.substring(b1); a1 = sss.indexOf(""); b1 = sss.indexOf("") + 1; if (b1 < a1) { String temp = sss.substring(a1); if (temp.indexOf("") != -1) { int tempi = temp.indexOf("") + 1; b1 = a1 + tempi; } } } } } } catch (Exception e) { return sss; } return sss; } /** * ik?? * * @param str * @return * @return IndustryVO * @author liuming * @date 2016629 ?2:36:09 */ public static IndustryVO getIndustryVOFromIk(String str) { // ? Analyzer anal = new IKAnalyzer(); IndustryVO ivo = new IndustryVO(); IndustryVO ivo1 = new IndustryVO(); StringReader reader = new StringReader(str); // ? TokenStream ts = null; ts = anal.tokenStream("", reader); CharTermAttribute term = ts.getAttribute(CharTermAttribute.class); try { ts.reset(); String strs = ""; // ???? while (ts.incrementToken()) { String temp = term.toString(); if (!StringUtils.isNull(temp)) { // getIndustry(temp); strs += term.toString() + "|"; // System.out.print(term.toString() + "|" ); } } reader.close(); String[] arrStr1 = strs.split("\\|"); StringUtils.sortStringArray(arrStr1, 1);// ? List<IndustryVO> listiv = new ArrayList<IndustryVO>(); List<IndustryVO> listiv_v = new ArrayList<IndustryVO>(); List<IndustryVO> listiv_n = new ArrayList<IndustryVO>(); for (int i = 0; i < arrStr1.length; i++) { String temp = arrStr1[i]; if (!StringUtils.isNull(temp)) { ivo1 = getIndustry(temp); if (!StringUtils.isNull(ivo1.getIndustry_id())) { listiv.add(ivo1); // break; } } } // ????? // if (listiv.size() > 0) { // for (IndustryVO industryVO : listiv) { // if ("V".equals(industryVO.getFlag())) { // listiv_v.add(industryVO); // } else { // listiv_n.add(industryVO); // } // } // } // ??? if (listiv.size() > 0) { ivo = getfirstSortStringArray(listiv, 1); } // if (listiv_v.size() > 0) { // ivo = getfirstSortStringArray(listiv_v, 1); // } // if (listiv_n.size() > 0) { // ivo = getfirstSortStringArray(listiv_n, 1); // } } catch (IOException e) { e.printStackTrace(); } return ivo; } }