public void execDrawnSima(String issueNumber) throws SQLException { // 获取开奖信息 SrcDataBean srcDataBean = this.getRecordByIssueNumber(issueNumber); // 获取预测计划 Fast3SiMa fast3SiMa = getSiMaYuceRecordByIssueCode(issueNumber); // 判断中出情况 if (fast3SiMa != null) { if (!issueNumber.equals(fast3SiMa.getDrownIssueNumber())) { // 避免反复执行该段代码,有时重启程序时可能有的问题 String status = judgeDownStatus(srcDataBean, fast3SiMa); // 将状态结果入库,并判断是否需要生成新的计划 if (status == "1") { // 预测结果中出 fast3SiMa.setDrownCycle(fast3SiMa.getDrownCycle() + 1); fast3SiMa.setDrownIssueNumber(issueNumber); fast3SiMa.setDrownNumber( Integer.toString(srcDataBean.getNo1()) + Integer.toString(srcDataBean.getNo2()) + Integer.toString(srcDataBean.getNo3())); fast3SiMa.setStatus(status); // 更新结果内容 this.updateDanMaStatus(fast3SiMa); // 中出后立即启动新的预测计划 execSima(issueNumber, fast3SiMa); } else { fast3SiMa.setDrownCycle(fast3SiMa.getDrownCycle() + 1); fast3SiMa.setDrownIssueNumber(issueNumber); fast3SiMa.setDrownNumber( Integer.toString(srcDataBean.getNo1()) + Integer.toString(srcDataBean.getNo2()) + Integer.toString(srcDataBean.getNo3())); fast3SiMa.setStatus(status); this.updateDanMaStatus(fast3SiMa); if (fast3SiMa.getDrownCycle() == 3) { execSima(issueNumber, fast3SiMa); } } } } else { execSima(issueNumber, fast3SiMa); } }
/** * @param number * @param fast3DanMa * @return 判断中出状态 */ private String judgeDownStatus(SrcDataBean number, Fast3SiMa fast3SiMa) { String status = "1"; // 假设中出 int[] numArr = {number.getNo1(), number.getNo2(), number.getNo3()}; String drownPlan = fast3SiMa.getDrownPlan(); for (int i = 0; i < numArr.length; i++) { if (drownPlan.indexOf(Integer.toString(numArr[i])) >= 0) { continue; } else { status = "0"; // 没中 break; } } // System.out.println("status="+status); return status; }
/** * 通过最近20天数据统计出现次数 * * @param noList * @return */ public List<Fast3Count> getTimesForNumber(List<SrcDataBean> noList) { List<Fast3Count> fast3CountList = new ArrayList<Fast3Count>(); // 一维0 代表最近7期出现次数,1为最近14期出现次数,2为最近20天出现次数 int[] arr3 = {0, 0, 0, 0, 0, 0}; int[] arr5 = {0, 0, 0, 0, 0, 0}; int[] arr7 = {0, 0, 0, 0, 0, 0}; int i = 0; for (SrcDataBean no : noList) { int[] temp = {no.getNo1(), no.getNo2(), no.getNo3()}; Integer[] numIntArr = getUniqueArr(temp); if (i < 9) { for (int j = 0; j < numIntArr.length; j++) { arr3[numIntArr[j] - 1]++; } } if (i < 15) { for (int j = 0; j < numIntArr.length; j++) { arr5[numIntArr[j] - 1]++; } } if (i < 21) { for (int j = 0; j < numIntArr.length; j++) { arr7[numIntArr[j] - 1]++; } } i++; } for (int j = 0; j < 6; j++) { Fast3Count fast3Count = new Fast3Count(); fast3Count.setNumber(j + 1); fast3Count.setCount7(arr3[j]); fast3Count.setCount14(arr5[j]); fast3Count.setCount20(arr7[j]); fast3CountList.add(fast3Count); } return fast3CountList; }