Your Name 4 年之前
父節點
當前提交
3ead44144b

+ 4
- 3
src/main/java/com/yunzhi/niucai/common/BizUtils.java 查看文件

@@ -1,9 +1,10 @@
1 1
 package com.yunzhi.niucai.common;
2 2
 
3
-import io.swagger.models.auth.In;
3
+import org.apache.commons.collections4.CollectionUtils;
4 4
 
5 5
 import java.util.ArrayList;
6 6
 import java.util.Arrays;
7
+import java.util.Collections;
7 8
 import java.util.List;
8 9
 
9 10
 /**
@@ -48,7 +49,7 @@ public class BizUtils {
48 49
         for(int i = cursor; i <= max; i++) {
49 50
             List<Integer> last = new ArrayList<>();
50 51
             last.add(noteNumList.get(i));
51
-            recursion(noteNumList, unitNum, times, cursor, last, result);
52
+            recursion(noteNumList, unitNum, times + 1, cursor + 1, last, result);
52 53
         }
53 54
 
54 55
         // 遍历结果, 外循环是场次的结果,需要相加
@@ -78,7 +79,7 @@ public class BizUtils {
78 79
         int max = noteNumList.size() - (unitNum - times);
79 80
 
80 81
         for (int i = cursor; i <= max; i ++) {
81
-            List<Integer> current = last;
82
+            List<Integer> current = ListUtils.getDeepCopy(last);
82 83
             current.add(noteNumList.get(i));
83 84
 
84 85
             if (times == unitNum - 1) {

+ 16
- 0
src/main/java/com/yunzhi/niucai/common/ListUtils.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.yunzhi.niucai.common;
2
+
3
+import java.util.ArrayList;
4
+import java.util.Collections;
5
+import java.util.List;
6
+
7
+public class ListUtils {
8
+    public static <T> List<T> getDeepCopy(List<T> src) {
9
+        List<T> target = new ArrayList<>();
10
+        for (int i = 0; i < src.size(); i ++) {
11
+            target.add(null);
12
+        }
13
+        Collections.copy(target, src);
14
+        return target;
15
+    }
16
+}

+ 17
- 17
src/main/java/com/yunzhi/niucai/service/impl/TaBettingPlanServiceImpl.java 查看文件

@@ -178,9 +178,9 @@ public class TaBettingPlanServiceImpl extends ServiceImpl<TaBettingPlanMapper, T
178 178
         // 销售时间
179 179
         if (taBettingPlan.getIsSport()) {
180 180
             String currentTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("HH:mm"));
181
-            if (currentTime.compareTo(taShopLottery.getOpeningTime()) < 0 || currentTime.compareTo(taShopLottery.getClosingTime()) > 0) {
182
-                throw new Exception("非当前店铺彩票开售时间");
183
-            }
181
+//            if (currentTime.compareTo(taShopLottery.getOpeningTime()) < 0 || currentTime.compareTo(taShopLottery.getClosingTime()) > 0) {
182
+//                throw new Exception("非当前店铺彩票开售时间");
183
+//            }
184 184
         }
185 185
 
186 186
         return;
@@ -236,20 +236,20 @@ public class TaBettingPlanServiceImpl extends ServiceImpl<TaBettingPlanMapper, T
236 236
             }
237 237
 
238 238
             // 校验注数
239
-            int totalNums = BizUtils.computeSportNoteNum(tdSportPass.getUnitNum(), tdSportPass.getAmount(), noteNumList);
240
-            if (null == taBettingPlan.getNotesNum() || !taBettingPlan.getNotesNum().equals(totalNums)) {
241
-                throw new Exception("投注总注数计算不正确, 应该为: " + totalNums);
242
-            }
243
-
244
-            // 总金额
245
-            int totalPrice = totalNums * tdLottery.getUnitPrice() * taBettingPlan.getTimes();
246
-            if (null == taBettingPlan.getTotalPrice() || !taBettingPlan.getTotalPrice().equals(totalPrice)) {
247
-                throw new Exception("投注总金额计算不正确");
248
-            }
249
-
250
-            if (totalPrice > tdLottery.getMaxPrice()) {
251
-                throw new Exception("投注总金额不能超过" + String.format("%.2f", (float) tdLottery.getMaxPrice() / 100 ) + "元");
252
-            }
239
+//            int totalNums = BizUtils.computeSportNoteNum(tdSportPass.getUnitNum(), tdSportPass.getAmount(), noteNumList);
240
+//            if (null == taBettingPlan.getNotesNum() || !taBettingPlan.getNotesNum().equals(totalNums)) {
241
+//                throw new Exception("投注总注数计算不正确, 应该为: " + totalNums);
242
+//            }
243
+//
244
+//            // 总金额
245
+//            int totalPrice = totalNums * tdLottery.getUnitPrice() * taBettingPlan.getTimes();
246
+//            if (null == taBettingPlan.getTotalPrice() || !taBettingPlan.getTotalPrice().equals(totalPrice)) {
247
+//                throw new Exception("投注总金额计算不正确");
248
+//            }
249
+//
250
+//            if (totalPrice > tdLottery.getMaxPrice()) {
251
+//                throw new Exception("投注总金额不能超过" + String.format("%.2f", (float) tdLottery.getMaxPrice() / 100 ) + "元");
252
+//            }
253 253
         }
254 254
 
255 255
         // 如果是数字彩