|
@@ -0,0 +1,113 @@
|
|
|
|
+package com.ym.mec.biz.service.impl;
|
|
|
|
+
|
|
|
|
+import com.sun.org.apache.xerces.internal.xs.StringList;
|
|
|
|
+import com.ym.mec.biz.dal.dao.IndexDao;
|
|
|
|
+import com.ym.mec.biz.dal.dto.IndexBaseDto;
|
|
|
|
+import com.ym.mec.biz.dal.dto.IndexBaseMonthDto;
|
|
|
|
+import com.ym.mec.biz.service.IndexService;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
+
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @Author Joburgess
|
|
|
|
+ * @Date 2021/1/7 0007
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+public class IndexServiceImpl implements IndexService {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IndexDao indexDao;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, List<IndexBaseDto>> getIndexBaseData(Set<String> dataTypes, String organIdsStr, String startMonth, String endMonth) {
|
|
|
|
+ Map<String, List<IndexBaseDto>> result = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isBlank(startMonth)){
|
|
|
|
+ LocalDateTime nowDateTime = LocalDateTime.now();
|
|
|
|
+ startMonth = nowDateTime.getYear() + "-01";
|
|
|
|
+ endMonth = null;
|
|
|
|
+ }
|
|
|
|
+ Set<Integer> organIds = null;
|
|
|
|
+ if(StringUtils.isNotBlank(organIdsStr)){
|
|
|
|
+ organIds = Arrays.stream(organIdsStr.split(",")).map(Integer::new).collect(Collectors.toSet());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(dataTypes.contains("ALL") || dataTypes.contains("OPERATION_DATA")){
|
|
|
|
+ //运营数据
|
|
|
|
+ List<IndexBaseDto> operationData = new LinkedList<>();
|
|
|
|
+ operationData.add(new IndexBaseDto("合作单位"));
|
|
|
|
+ operationData.add(new IndexBaseDto("乐团数量"));
|
|
|
|
+ operationData.add(new IndexBaseDto("乐团学员"));
|
|
|
|
+ operationData.add(new IndexBaseDto("其他学员"));
|
|
|
|
+ result.put("OPERATION_DATA", operationData);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(dataTypes.contains("ALL") || dataTypes.contains("BUSINESS_DATA")){
|
|
|
|
+ //业务数据
|
|
|
|
+ List<IndexBaseDto> businessData = new LinkedList<>();
|
|
|
|
+ businessData.add(getUserSignUpDate(new IndexBaseDto("激活率"), organIds, startMonth, endMonth));
|
|
|
|
+ businessData.add(getHomeworkDate(new IndexBaseDto("作业布置率"), organIds, startMonth, endMonth, "assign"));
|
|
|
|
+ businessData.add(getHomeworkDate(new IndexBaseDto("作业提交率"), organIds, startMonth, endMonth, "submit"));
|
|
|
|
+ businessData.add(getHomeworkDate(new IndexBaseDto("作业点评率"), organIds, startMonth, endMonth, "comment"));
|
|
|
|
+ result.put("BUSINESS_DATA", businessData);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(dataTypes.contains("ALL") || dataTypes.contains("FINANCE_DATA")){
|
|
|
|
+ //财务数据
|
|
|
|
+ List<IndexBaseDto> financeData = new LinkedList<>();
|
|
|
|
+ financeData.add(new IndexBaseDto("应收金额"));
|
|
|
|
+ financeData.add(new IndexBaseDto("预收金额"));
|
|
|
|
+ financeData.add(new IndexBaseDto("预付金额"));
|
|
|
|
+ financeData.add(new IndexBaseDto("应付金额"));
|
|
|
|
+ financeData.add(new IndexBaseDto("营收金额"));
|
|
|
|
+ result.put("FINANCE_DATA", financeData);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(dataTypes.contains("ALL") || dataTypes.contains("PERSONNEL_DATA")){
|
|
|
|
+ //人事数据
|
|
|
|
+ List<IndexBaseDto> personnelData = new LinkedList<>();
|
|
|
|
+ personnelData.add(new IndexBaseDto("老师总数"));
|
|
|
|
+ personnelData.add(new IndexBaseDto("全职人数"));
|
|
|
|
+ personnelData.add(new IndexBaseDto("兼职人数"));
|
|
|
|
+ personnelData.add(new IndexBaseDto("离职人数"));
|
|
|
|
+ result.put("PERSONNEL_DATA", personnelData);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(dataTypes.contains("ALL") || dataTypes.contains("STUDENT_VARIATION")){
|
|
|
|
+ //学员变动
|
|
|
|
+ List<IndexBaseDto> studentVariation = new LinkedList<>();
|
|
|
|
+ studentVariation.add(new IndexBaseDto("新增学员"));
|
|
|
|
+ studentVariation.add(new IndexBaseDto("退团学员"));
|
|
|
|
+ studentVariation.add(new IndexBaseDto("学员转化"));
|
|
|
|
+ result.put("STUDENT_VARIATION", studentVariation);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(dataTypes.contains("ALL") || dataTypes.contains("COURSE_DATA")){
|
|
|
|
+ //本月课程
|
|
|
|
+ List<IndexBaseDto> courseData = new LinkedList<>();
|
|
|
|
+ courseData.add(new IndexBaseDto("乐团课"));
|
|
|
|
+ courseData.add(new IndexBaseDto("VIP课"));
|
|
|
|
+ courseData.add(new IndexBaseDto("网管课"));
|
|
|
|
+ result.put("COURSE_DATA", courseData);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private IndexBaseDto getUserSignUpDate(IndexBaseDto indexBaseData, Set<Integer> organIds, String startMonth, String endMonth){
|
|
|
|
+ indexBaseData.setIndexMonthData(indexDao.getStudentSignUpData(organIds, startMonth, endMonth));
|
|
|
|
+ return indexBaseData;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private IndexBaseDto getHomeworkDate(IndexBaseDto indexBaseData, Set<Integer> organIds, String startMonth, String endMonth, String type){
|
|
|
|
+ indexBaseData.setIndexMonthData(indexDao.getHomeworkDate(organIds, startMonth, endMonth, type));
|
|
|
|
+ return indexBaseData;
|
|
|
|
+ }
|
|
|
|
+}
|