public void runAll(String dataPath, String logPath) { FileUtil fileData = new FileUtil(dataPath, "out", false); FileUtil fileLog = new FileUtil(logPath, "out", false); dalian = new Dalian(fileLog); System.out.println("Process jiabi data start."); int onepage = 1000; long count = jiabiBaseDao.count(); for (int i = 0; i <= count / onepage; i++) { long t1 = System.currentTimeMillis(); Page<SimJiabiBaseInfo> readPage = jiabiBaseDao.findAll(new PageRequest(i, onepage)); long t2 = System.currentTimeMillis(); System.out.println("找1000个的时间:" + (t2 - t1)); for (SimJiabiBaseInfo jbi : readPage.getContent()) { HashMap<String, HashMap<Integer, Double>> ans = getSim(jbi.getFmid()); if (ans != null && ans.size() != 0) MapHelper.write("J" + jbi.getFmid(), ans, fileData); } System.out.println( "The number of completed items: " + (i * onepage + readPage.getContent().size())); } fileData.close(); fileLog.close(); System.out.println("Process jiabi data end."); }
public HashMap<String, HashMap<Integer, Double>> getSim(Long fmid) { result = new HashMap<String, HashMap<Integer, Double>>(); SimJiabiBaseInfo jbi = jiabiBaseDao.findByFmid(fmid); // 只和年版类型相同的假币进行比较 String valueModuleType = getValueModuleType(jbi.getDenominationType().getValue_moduleType()); if (valueModuleType == null) return null; long t1 = System.currentTimeMillis(); SimDenominationType insDenominationType = simDenominationTypeDao.findByCode(jbi.getDenominationType().getCode()); long t2 = System.currentTimeMillis(); System.out.println("找年版类型相同的假币的时间:" + (t2 - t1)); Set<SimJiabiBaseInfo> candidateJiabi = insDenominationType.getJiabiBaseInfos(); for (SimJiabiBaseInfo aa : candidateJiabi) { if (aa.getJiabiBasePics().size() != 0) break; } // 白光正面 if (checkPicType(jbi.getJiabiBasePics(), 0)) { List<String> jiabiIDs = getJiabiIDbyPicType(candidateJiabi, 0); if (jiabiIDs.size() != 0) calculateSim(jbi.getFmid(), jiabiIDs, 0, valueModuleType); } // 紫光正面 if (checkPicType(jbi.getJiabiBasePics(), 1)) { List<String> jiabiIDs = getJiabiIDbyPicType(candidateJiabi, 1); if (jiabiIDs.size() != 0) calculateSim(jbi.getFmid(), jiabiIDs, 1, valueModuleType); } // 紫光反面 if (checkPicType(jbi.getJiabiBasePics(), 2)) { List<String> jiabiIDs = getJiabiIDbyPicType(candidateJiabi, 2); if (jiabiIDs.size() != 0) calculateSim(jbi.getFmid(), jiabiIDs, 2, valueModuleType); } return result; }