private void createMaxMissFiles( JSONObject miss1, JSONObject miss2, JSONObject miss3, JSONObject miss4, JSONObject miss5) { JSONObject root = new JSONObject(); Map<String, Integer> missDataMap = MapSortUtil.sortByIntegerValueDesc(miss1); root.put("num_1_b", getMaxMissObj(missDataMap)); missDataMap = MapSortUtil.sortByIntegerValueAsc(miss1); root.put("num_1_s", getMaxMissObj(missDataMap)); missDataMap = MapSortUtil.sortByIntegerValueDesc(miss2); root.put("num_2_b", getMaxMissObj(missDataMap)); missDataMap = MapSortUtil.sortByIntegerValueAsc(miss2); root.put("num_2_s", getMaxMissObj(missDataMap)); missDataMap = MapSortUtil.sortByIntegerValueDesc(miss3); root.put("num_3_b", getMaxMissObj(missDataMap)); missDataMap = MapSortUtil.sortByIntegerValueAsc(miss3); root.put("num_3_s", getMaxMissObj(missDataMap)); missDataMap = MapSortUtil.sortByIntegerValueDesc(miss4); root.put("num_4_b", getMaxMissObj(missDataMap)); missDataMap = MapSortUtil.sortByIntegerValueAsc(miss4); root.put("num_4_s", getMaxMissObj(missDataMap)); missDataMap = MapSortUtil.sortByIntegerValueDesc(miss5); root.put("num_5_b", getMaxMissObj(missDataMap)); missDataMap = MapSortUtil.sortByIntegerValueAsc(miss5); root.put("num_5_s", getMaxMissObj(missDataMap)); WriteHTMLUtil.writeHtm( "/js/analyse/" + getLottery().getKey() + "/", "qyh_max_miss.js", "qyh_max_miss=" + root + ";", "UTF-8"); }
@Override public void createMissFiles() { JSONObject resultRoot = new JSONObject(); JSONObject numRoot = new JSONObject(); JSONObject weizhi1_miss_root = new JSONObject(); JSONObject weizhi2_miss_root = new JSONObject(); JSONObject weizhi3_miss_root = new JSONObject(); JSONObject weizhi4_miss_root = new JSONObject(); JSONObject weizhi5_miss_root = new JSONObject(); List<QyhMissDataInfo> list = missDataEntityManager.getLastMissDatas(200); Collections.reverse(list); JSONObject num_1_miss = new JSONObject(); JSONObject num_2_miss = new JSONObject(); JSONObject num_3_miss = new JSONObject(); JSONObject num_4_miss = new JSONObject(); JSONObject num_5_miss = new JSONObject(); // 创建遗漏文件 for (QyhMissDataInfo info : list) { JSONObject miss = new JSONObject(); Map<String, Integer> map = info.getMissDataMap(); // .getMissDataContent().toMap(); for (int i = 1; i <= 23; i++) { String field = "num" + i; miss.put(i, map.get(field)); } for (int t = 0; t < 5; t++) { JSONObject weizhi_miss = new JSONObject(); for (int i = 1; i <= 23; i++) { String field = "miss_" + t + "_" + i; weizhi_miss.put(i, map.get(field)); } if (t == 0) { weizhi1_miss_root.put(info.getPeriodNumber(), weizhi_miss); num_1_miss = weizhi_miss; } else if (t == 1) { weizhi2_miss_root.put(info.getPeriodNumber(), weizhi_miss); num_2_miss = weizhi_miss; } else if (t == 2) { weizhi3_miss_root.put(info.getPeriodNumber(), weizhi_miss); num_3_miss = weizhi_miss; } else if (t == 3) { weizhi4_miss_root.put(info.getPeriodNumber(), weizhi_miss); num_4_miss = weizhi_miss; } else if (t == 4) { weizhi5_miss_root.put(info.getPeriodNumber(), weizhi_miss); num_5_miss = weizhi_miss; } } numRoot.put(info.getPeriodNumber(), miss); resultRoot.put(info.getPeriodNumber(), formatResult(info.getResult())); } createMaxMissFiles(num_1_miss, num_2_miss, num_3_miss, num_4_miss, num_5_miss); WriteHTMLUtil.writeHtm( "/js/analyse/" + getLottery().getKey() + "/", "miss_1.js", "miss_data=" + weizhi1_miss_root.toString(), "UTF-8"); WriteHTMLUtil.writeHtm( "/js/analyse/" + getLottery().getKey() + "/", "miss_2.js", "miss_data=" + weizhi2_miss_root.toString(), "UTF-8"); WriteHTMLUtil.writeHtm( "/js/analyse/" + getLottery().getKey() + "/", "miss_3.js", "miss_data=" + weizhi3_miss_root.toString(), "UTF-8"); WriteHTMLUtil.writeHtm( "/js/analyse/" + getLottery().getKey() + "/", "miss_4.js", "miss_data=" + weizhi4_miss_root.toString(), "UTF-8"); WriteHTMLUtil.writeHtm( "/js/analyse/" + getLottery().getKey() + "/", "miss_5.js", "miss_data=" + weizhi5_miss_root.toString(), "UTF-8"); WriteHTMLUtil.writeHtm( "/js/analyse/" + getLottery().getKey() + "/", "qyhdata.js", "dataQyh=" + resultRoot.toString() + ";function getdata(){return dataQyh;}", "UTF-8"); WriteHTMLUtil.writeHtm( "/js/analyse/" + getLottery().getKey() + "/", "qyh_num.js", "qyhNum=" + numRoot.toString(), "UTF-8"); }