浏览代码

Merge remote-tracking branch 'origin/zx_1026_1111' into zx_1026_1111

zouxuan 1 年之前
父节点
当前提交
90d999a700

+ 24 - 19
mec-application/src/main/java/com/ym/mec/web/controller/open/OpenDouble11StaticsController.java

@@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.rmi.MarshalledObject;
 import java.text.ParsePosition;
 import java.text.ParsePosition;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.ArrayList;
@@ -148,9 +149,27 @@ public class OpenDouble11StaticsController extends BaseController {
         }
         }
         setQueryParam(query, configParam);
         setQueryParam(query, configParam);
 
 
+        List<Double11StaticWrapper.SaleAmountAndUser> saleAmount = studentPaymentOrderDao.saleStaticsByOrgId(query);
+        Map<Integer, Double11StaticWrapper.SaleAmountAndUser> idDataMap = saleAmount.stream()
+                .collect(Collectors.toMap(Double11StaticWrapper.SaleAmountAndUser::getOrganId, Function.identity()));
+
+        List<Double11StaticWrapper.SaleAmountAndUser> result = orgIdMap.entrySet().stream()
+                .map(next -> {
+                    if(idDataMap.containsKey(next.getKey())){
+                        Double11StaticWrapper.SaleAmountAndUser saleAmountAndUser = idDataMap.get(next.getKey());
+                        saleAmountAndUser.setOrganName(next.getValue().getName());
+                        return saleAmountAndUser;
+                    }
+
+                    Double11StaticWrapper.SaleAmountAndUser statics = new Double11StaticWrapper.SaleAmountAndUser();
+                    statics.setOrganId(next.getKey());
+                    statics.setOrganName(next.getValue().getName());
+                    statics.setActualAmount(new BigDecimal(0));
+                    statics.setBalancePaymentAmount(new BigDecimal(0));
+                    statics.setUserPurchaseNumber(0);
+                    return statics;
+                }).collect(Collectors.toList());
 
 
-        List<Double11StaticWrapper.SaleAmountAndUser> result = studentPaymentOrderDao.saleStaticsByOrgId(query);
-        result.forEach(next -> next.setOrganName(orgIdMap.getOrDefault(next.getOrganId(), new Organization()).getName()));
         String orderBy = Optional.ofNullable(query.getOrderBy()).orElse("saleAmount");
         String orderBy = Optional.ofNullable(query.getOrderBy()).orElse("saleAmount");
         int asc = Optional.ofNullable(query.getAsc()).orElse(0);
         int asc = Optional.ofNullable(query.getAsc()).orElse(0);
         if ("saleAmount".equals(orderBy)) {
         if ("saleAmount".equals(orderBy)) {
@@ -170,20 +189,6 @@ public class OpenDouble11StaticsController extends BaseController {
                 }
                 }
             });
             });
         }
         }
-
-//        Double11StaticWrapper.SaleAmountAndUser total = new Double11StaticWrapper.SaleAmountAndUser();
-//        total.setOrganName("总部");
-//        double acAmount = result.stream().map(Double11StaticWrapper.SaleAmountAndUser::getActualAmount)
-//                .mapToDouble(BigDecimal::doubleValue).sum();
-//        total.setActualAmount(new BigDecimal(acAmount));
-//        double baAmount = result.stream().map(Double11StaticWrapper.SaleAmountAndUser::getBalancePaymentAmount)
-//                .mapToDouble(BigDecimal::doubleValue).sum();
-//        total.setBalancePaymentAmount(new BigDecimal(baAmount));
-//        int totalUser = result.stream().map(Double11StaticWrapper.SaleAmountAndUser::getUserPurchaseNumber)
-//                .mapToInt(Integer::intValue).sum();
-//        total.setUserPurchaseNumber(totalUser);
-//
-//        result.add(0, total);
         return R.from(result);
         return R.from(result);
     }
     }
 
 
@@ -255,15 +260,15 @@ public class OpenDouble11StaticsController extends BaseController {
             query.setType(OrderTypeEnum.SMALL_CLASS_TO_BUY);
             query.setType(OrderTypeEnum.SMALL_CLASS_TO_BUY);
             query.setActivityId(configParam.getV1());
             query.setActivityId(configParam.getV1());
         } else if (saleStaticsType == 2) {
         } else if (saleStaticsType == 2) {
-            // 乐理
+            // 1v2
             query.setGroupType(GroupType.VIP);
             query.setGroupType(GroupType.VIP);
             query.setType(OrderTypeEnum.SMALL_CLASS_TO_BUY);
             query.setType(OrderTypeEnum.SMALL_CLASS_TO_BUY);
             query.setActivityId(configParam.getV2());
             query.setActivityId(configParam.getV2());
         } else if (saleStaticsType == 3) {
         } else if (saleStaticsType == 3) {
             // 乐理
             // 乐理
             query.setGroupType(GroupType.LIVE);
             query.setGroupType(GroupType.LIVE);
-            query.setType(OrderTypeEnum.LIVE_BUY);
-            query.setActivityId(configParam.getTheoryLive());
+            query.setType(OrderTypeEnum.LIVE_GROUP_BUY);
+            query.setMusicGroupId(configParam.getTheoryLive());
         } else if (saleStaticsType == 4) {
         } else if (saleStaticsType == 4) {
             // 云教练
             // 云教练
             query.setGroupType(GroupType.MEMBER);
             query.setGroupType(GroupType.MEMBER);