Bladeren bron

云教练活动

zouxuan 4 jaren geleden
bovenliggende
commit
86a051c556
1 gewijzigde bestanden met toevoegingen van 24 en 5 verwijderingen
  1. 24 5
      mec-web/src/main/java/com/ym/mec/web/controller/education/ActivityController.java

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

@@ -8,22 +8,23 @@ import com.ym.mec.biz.dal.dto.LuckStatisDto;
 import com.ym.mec.biz.dal.dto.OrderStatisDto;
 import com.ym.mec.biz.dal.dto.OrganMaxAmountDto;
 import com.ym.mec.biz.dal.entity.Organization;
+import com.ym.mec.biz.dal.page.CloudTeacherActiveQueryInfo;
+import com.ym.mec.biz.service.OrganizationService;
+import com.ym.mec.biz.service.StudentService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @RequestMapping("activity")
@@ -36,6 +37,10 @@ public class ActivityController extends BaseController {
     private SporadicChargeInfoDao sporadicChargeInfoDao;
     @Autowired
     private StudentRegistrationDao studentRegistrationDao;
+    @Autowired
+    private OrganizationService organizationService;
+    @Autowired
+    private StudentService studentService;
 
     @ApiOperation(value = "分部双11活动统计")
     @GetMapping("/doubleEleven2020Statis")
@@ -103,4 +108,18 @@ public class ActivityController extends BaseController {
         luckStatisDto.setScale(totalMoney.multiply(new BigDecimal(100)).divide(totalMaxAmount, 2, BigDecimal.ROUND_HALF_UP));
         return succeed(luckStatisDto);
     }
+
+    @ApiOperation(value = "云教练活动统计")
+    @GetMapping("/countCloudTeacherActive")
+    public Object countCloudTeacherActive(CloudTeacherActiveQueryInfo queryInfo) throws Exception {
+        List<Organization> organizations = organizationService.queryEmployeeOrgan(null);
+        List<Integer> organIds = new ArrayList<>();
+        if(StringUtils.isNotBlank(queryInfo.getOrganIds())){
+            organIds = Arrays.stream(queryInfo.getOrganIds().split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList());
+        }else if(!CollectionUtils.isEmpty(organizations)){
+            organIds = organizations.stream().map(Organization::getId).collect(Collectors.toList());
+        }
+        List<Integer> ids = organIds.stream().filter(id -> !OrganizationService.EXCLUDE_ORGAN_IDS.contains(id)).collect(Collectors.toList());
+        return succeed(studentService.countCloudTeacherActive(ids, queryInfo));
+    }
 }