Browse Source

增加双十一接口

周箭河 5 years ago
parent
commit
80c30afa13

+ 7 - 5
mec-web/src/main/java/com/ym/mec/web/controller/education/ActivityController.java

@@ -62,12 +62,13 @@ public class ActivityController extends BaseController {
                     break;
                     break;
                 }
                 }
             }
             }
-            if (order.getEstimatedNums() > 0) {
-                order.setScale(new BigDecimal(order.getNums()).multiply(new BigDecimal(100)).divide(new BigDecimal(order.getEstimatedNums()), 2, BigDecimal.ROUND_HALF_UP));
-            }
             totalEstimatedNums += order.getEstimatedNums();
             totalEstimatedNums += order.getEstimatedNums();
             totalNum += order.getNums();
             totalNum += order.getNums();
             totalMoney = totalMoney.add(order.getMoney());
             totalMoney = totalMoney.add(order.getMoney());
+            if (order.getEstimatedNums() <= 0) {
+                order.setEstimatedNums(1);
+            }
+            order.setScale(new BigDecimal(order.getNums()).multiply(new BigDecimal(100)).divide(new BigDecimal(order.getEstimatedNums()), 2, BigDecimal.ROUND_HALF_UP));
         }
         }
         orders.sort(Comparator.comparing(OrderStatisDto::getMoney).reversed());
         orders.sort(Comparator.comparing(OrderStatisDto::getMoney).reversed());
 
 
@@ -76,9 +77,10 @@ public class ActivityController extends BaseController {
         luckStatisDto.setTotalEstimatedNums(totalEstimatedNums);
         luckStatisDto.setTotalEstimatedNums(totalEstimatedNums);
         luckStatisDto.setTotalNum(totalNum);
         luckStatisDto.setTotalNum(totalNum);
         luckStatisDto.setTotalMoney(totalMoney);
         luckStatisDto.setTotalMoney(totalMoney);
-        if (luckStatisDto.getTotalEstimatedNums() > 0) {
-            luckStatisDto.setScale(new BigDecimal(totalNum).multiply(new BigDecimal(100)).divide(new BigDecimal(totalEstimatedNums), 2, BigDecimal.ROUND_HALF_UP));
+        if (luckStatisDto.getTotalEstimatedNums() <= 0) {
+            totalEstimatedNums = 1;
         }
         }
+        luckStatisDto.setScale(new BigDecimal(totalNum).multiply(new BigDecimal(100)).divide(new BigDecimal(totalEstimatedNums), 2, BigDecimal.ROUND_HALF_UP));
         return succeed(luckStatisDto);
         return succeed(luckStatisDto);
     }
     }
 }
 }