|
@@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.time.DayOfWeek;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
@@ -95,7 +96,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
indexBaseDatas = new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
- Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = indexBaseDatas.stream().collect(Collectors.groupingBy(IndexBaseMonthData::getDataType));
|
|
|
+ Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = indexBaseDatas.stream().filter(d->Objects.nonNull(d.getDataType())).collect(Collectors.groupingBy(IndexBaseMonthData::getDataType));
|
|
|
|
|
|
for (IndexDataType dataType : IndexDataType.values()) {
|
|
|
if(typeDateMap.containsKey(dataType)){
|
|
@@ -129,9 +130,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
currentMonthDate = currentMonthDate.plusDays(1);
|
|
|
}
|
|
|
typeDateMapEntry.getValue().sort(Comparator.comparing(IndexBaseMonthData::getMonth));
|
|
|
- if(IndexDataType.ACTIVATION_RATE.equals(typeDateMapEntry.getKey())||IndexDataType.HOMEWORK_CREATE_RATE.equals(typeDateMapEntry.getKey())
|
|
|
- ||IndexDataType.HOMEWORK_SUBMIT_RATE.equals(typeDateMapEntry.getKey())||IndexDataType.HOMEWORK_COMMENT_RATE.equals(typeDateMapEntry.getKey())
|
|
|
- ||IndexDataType.STUDENT_CONVERSION.equals(typeDateMapEntry.getKey())){
|
|
|
+ if(typeDateMapEntry.getKey().getPercent()){
|
|
|
for (IndexBaseMonthData indexBaseMonthData : typeDateMapEntry.getValue()) {
|
|
|
if(indexBaseMonthData.getTotalNum().compareTo(BigDecimal.ZERO)==0){
|
|
|
indexBaseMonthData.setPercent(BigDecimal.ZERO);
|
|
@@ -150,15 +149,12 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
}
|
|
|
result.add(indexBaseData);
|
|
|
}
|
|
|
- countStudentConvertData(result, currentMonth);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Map<String, List<IndexBaseDto>> indexBaseDataTask(String dayStr) {
|
|
|
- Map<String, List<IndexBaseDto>> result = new HashMap<>();
|
|
|
-
|
|
|
+ public void indexBaseDataTask(String dayStr) {
|
|
|
LocalDate nowDate = LocalDate.now();
|
|
|
|
|
|
List<Organization> allOrgans = organizationDao.findAllOrgans();
|
|
@@ -171,149 +167,58 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
dayStr = nowDate.plusDays(-1).toString();
|
|
|
}
|
|
|
|
|
|
- //运营数据
|
|
|
- saveData(indexBaseMonthDataDao.getSchoolData(dayStr), dayStr, IndexDataType.SCHOOL);
|
|
|
- saveData(indexBaseMonthDataDao.getMusicData(dayStr), dayStr, IndexDataType.MUSIC_GROUP_NUM);
|
|
|
- saveData(indexBaseMonthDataDao.getMusicStudentData(dayStr, null), dayStr, IndexDataType.MUSIC_GROUP_STUDENT);
|
|
|
- saveData(indexBaseMonthDataDao.getOtherStudentData(dayStr), dayStr, IndexDataType.OTHER_STUDENT);
|
|
|
+ LocalDate day = LocalDate.parse(dayStr, DateUtil.dateFormatter);
|
|
|
+ LocalDate monday = day.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
|
|
|
|
|
|
- //业务数据
|
|
|
+ //学员数据
|
|
|
+ saveData(indexBaseMonthDataDao.getStudentRegistrationData(dayStr), dayStr, IndexDataType.STUDENT_REGISTRATION_NUM);
|
|
|
+ saveData(indexBaseMonthDataDao.getChargeStudentChangeData(dayStr), dayStr, IndexDataType.CHARGE_STUDENT_CHANGE_RATE);
|
|
|
saveData(indexBaseMonthDataDao.getStudentSignUpData(dayStr), dayStr, IndexDataType.ACTIVATION_RATE);
|
|
|
- saveData(indexBaseMonthDataDao.getHomeworkData(dayStr, null), dayStr, IndexDataType.HOMEWORK_CREATE_RATE);
|
|
|
- saveData(indexBaseMonthDataDao.getHomeworkData(dayStr, "submit"), dayStr, IndexDataType.HOMEWORK_SUBMIT_RATE);
|
|
|
- saveData(indexBaseMonthDataDao.getHomeworkData(dayStr, "comment"), dayStr, IndexDataType.HOMEWORK_COMMENT_RATE);
|
|
|
|
|
|
- //经营数据
|
|
|
- saveData(null, dayStr, IndexDataType.SHOULD_INCOME_MONEY);
|
|
|
- saveData(null, dayStr, IndexDataType.ANTICIPATED_INCOME_MONEY);
|
|
|
- saveData(null, dayStr, IndexDataType.SHOULD_EXPEND_MONEY);
|
|
|
- saveData(null, dayStr, IndexDataType.ANTICIPATED_EXPEND_MONEY);
|
|
|
- saveData(null, dayStr, IndexDataType.REVENUE_MONEY);
|
|
|
+ //运营数据
|
|
|
+ saveData(indexBaseMonthDataDao.getSchoolData(dayStr), dayStr, IndexDataType.SCHOOL);
|
|
|
+ saveData(indexBaseMonthDataDao.getMusicData(dayStr), dayStr, IndexDataType.PROGRESS_MUSIC_GROUP_NUM);
|
|
|
|
|
|
//人事数据
|
|
|
saveData(indexBaseMonthDataDao.getTeacherData(dayStr, null, null), dayStr, IndexDataType.TEACHER_NUM);
|
|
|
saveData(indexBaseMonthDataDao.getTeacherData(dayStr, JobNatureEnum.FULL_TIME, null), dayStr, IndexDataType.FULL_TIME_NUM);
|
|
|
saveData(indexBaseMonthDataDao.getTeacherData(dayStr, JobNatureEnum.PART_TIME, null), dayStr, IndexDataType.PART_TIME_NUM);
|
|
|
- saveData(indexBaseMonthDataDao.getTeacherData(dayStr, null, true), dayStr, IndexDataType.DIMISSION_NUM);
|
|
|
+// saveData(indexBaseMonthDataDao.getTeacherData(dayStr, null, true), dayStr, IndexDataType.DIMISSION_NUM);
|
|
|
|
|
|
- //学员变动
|
|
|
- saveData(indexBaseMonthDataDao.getMusicStudentData(dayStr, "ADD"), dayStr, IndexDataType.NEWLY_STUDENT_NUM);
|
|
|
- saveData(indexBaseMonthDataDao.getMusicStudentData(dayStr, "QUIT"), dayStr, IndexDataType.QUIT_MUSIC_GROUP_STUDENT_NUM);
|
|
|
- saveData(indexBaseMonthDataDao.getMusicGroupPreRegistrationStudentData(dayStr), dayStr, IndexDataType.STUDENT_CONVERSION_PRE_STUDENT_NUM);
|
|
|
- saveData(indexBaseMonthDataDao.getMusicGroupStudentFromPreData(dayStr, null), dayStr, IndexDataType.STUDENT_CONVERSION_STUDENT_NUM);
|
|
|
- saveData(indexBaseMonthDataDao.getMusicGroupStudentFromPreData(dayStr, PaymentStatusEnum.YES), dayStr, IndexDataType.STUDENT_CONVERSION_PAYMENT_STUDENT_NUM);
|
|
|
- List<Integer> studentIds = indexBaseMonthDataDao.getMusicGroupStudentIdFromPre(dayStr, PaymentStatusEnum.YES);
|
|
|
- List<IndexBaseMonthData> convertStudentNum = new ArrayList<>();
|
|
|
- if(!CollectionUtils.isEmpty(studentIds)){
|
|
|
- convertStudentNum = indexBaseMonthDataDao.getStudentConversionData(dayStr, studentIds);
|
|
|
- }
|
|
|
- saveData(convertStudentNum, dayStr, IndexDataType.STUDENT_CONVERSION_VIP_PRACTICE_STUDENT_NUM);
|
|
|
+ //剩余课时
|
|
|
+ saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, null, CourseStatusEnum.OVER), dayStr, IndexDataType.SURPLUS_COURSE_NUM);
|
|
|
+ saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, GroupType.MUSIC, CourseStatusEnum.OVER), dayStr, IndexDataType.SURPLUS_MUSIC_COURSE_NUM);
|
|
|
+ saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, GroupType.VIP, CourseStatusEnum.OVER), dayStr, IndexDataType.SURPLUS_VIP_COURSE_NUM);
|
|
|
+ saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, GroupType.PRACTICE, CourseStatusEnum.OVER), dayStr, IndexDataType.SURPLUS_PRACTICE_COURSE_NUM);
|
|
|
|
|
|
- //课程数据
|
|
|
- saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, GroupType.MUSIC), dayStr, IndexDataType.MUSIC_GROUP_COURSE);
|
|
|
- saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, GroupType.VIP), dayStr, IndexDataType.VIP_GROUP_COURSE);
|
|
|
- saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, GroupType.PRACTICE), dayStr, IndexDataType.PRACTICE_GROUP_COURSE);
|
|
|
+ //已消耗课时
|
|
|
+ saveData(indexBaseMonthDataDao.getGroupSurplusCourseData(dayStr, null, CourseStatusEnum.OVER), dayStr, IndexDataType.OVER_COURSE_NUM);
|
|
|
+ saveData(indexBaseMonthDataDao.getGroupSurplusCourseData(dayStr, GroupType.MUSIC, CourseStatusEnum.OVER), dayStr, IndexDataType.OVER_MUSIC_COURSE_NUM);
|
|
|
+ saveData(indexBaseMonthDataDao.getGroupSurplusCourseData(dayStr, GroupType.VIP, CourseStatusEnum.OVER), dayStr, IndexDataType.OVER_VIP_COURSE_NUM);
|
|
|
+ saveData(indexBaseMonthDataDao.getGroupSurplusCourseData(dayStr, GroupType.PRACTICE, CourseStatusEnum.OVER), dayStr, IndexDataType.OVER_PRACTICE_COURSE_NUM);
|
|
|
|
|
|
- //财务数据
|
|
|
+ //经营数据
|
|
|
saveData(indexBaseMonthDataDao.getFinancePayData(dayStr),dayStr,IndexDataType.FINANCE_PAY);
|
|
|
saveData(indexBaseMonthDataDao.getFinanceBalanceData(dayStr),dayStr,IndexDataType.FINANCE_BALANCE_AMOUNT);
|
|
|
saveData(indexBaseMonthDataDao.getFinanceActualData(dayStr),dayStr,IndexDataType.FINANCE_AMOUNT);
|
|
|
|
|
|
- return result;
|
|
|
- }
|
|
|
+ //业务数据
|
|
|
+ saveData(indexBaseMonthDataDao.getHomeworkData(dayStr, null), monday.toString(), IndexDataType.HOMEWORK_CREATE_RATE);
|
|
|
+ saveData(indexBaseMonthDataDao.getHomeworkData(dayStr, "submit"), monday.toString(), IndexDataType.HOMEWORK_SUBMIT_RATE);
|
|
|
+ saveData(indexBaseMonthDataDao.getHomeworkData(dayStr, "comment"), monday.toString(), IndexDataType.HOMEWORK_COMMENT_RATE);
|
|
|
|
|
|
- private void countStudentConvertData(List<IndexBaseDto> result, Date currentMonth){
|
|
|
- List<IndexBaseMonthData> convertData = new ArrayList<>();
|
|
|
-
|
|
|
- Map<IndexDataType, IndexBaseDto> typeDataMap = result.stream().collect(Collectors.toMap(IndexBaseDto::getDataType, i -> i, (i1, i2) -> i1));
|
|
|
- List<IndexBaseMonthData> preStudentNum = new ArrayList<>();
|
|
|
- if(typeDataMap.containsKey(IndexDataType.STUDENT_CONVERSION_PRE_STUDENT_NUM)){
|
|
|
- preStudentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_PRE_STUDENT_NUM).getIndexMonthData();
|
|
|
- }
|
|
|
-
|
|
|
- IndexBaseMonthData preStudentNumData = new IndexBaseMonthData();
|
|
|
- preStudentNumData = preStudentNum.stream().max(Comparator.comparing(IndexBaseMonthData::getMonth)).get();
|
|
|
-// preStudentNumData.setMonth(currentMonth);
|
|
|
- preStudentNumData.setDataType(IndexDataType.STUDENT_CONVERSION_PRE_STUDENT_NUM);
|
|
|
- preStudentNumData.setTitle(IndexDataType.STUDENT_CONVERSION_PRE_STUDENT_NUM.getMsg());
|
|
|
-// preStudentNumData.setTotalNum(preStudentNum.stream().map(IndexBaseMonthData::getTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-// preStudentNumData.setActivateNum(preStudentNum.stream().map(IndexBaseMonthData::getActivateNum).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-// preStudentNumData.setPercent(preStudentNumData.getActivateNum());
|
|
|
-
|
|
|
- List<IndexBaseMonthData> studentNum = new ArrayList<>();
|
|
|
- if(typeDataMap.containsKey(IndexDataType.STUDENT_CONVERSION_STUDENT_NUM)){
|
|
|
- studentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_STUDENT_NUM).getIndexMonthData();
|
|
|
- }
|
|
|
-
|
|
|
- IndexBaseMonthData studentNumData = new IndexBaseMonthData();
|
|
|
- studentNumData = studentNum.stream().max(Comparator.comparing(IndexBaseMonthData::getMonth)).get();
|
|
|
-// studentNumData.setMonth(currentMonth);
|
|
|
- studentNumData.setDataType(IndexDataType.STUDENT_CONVERSION_STUDENT_NUM);
|
|
|
- studentNumData.setTitle(IndexDataType.STUDENT_CONVERSION_STUDENT_NUM.getMsg());
|
|
|
-// studentNumData.setTotalNum(studentNum.stream().map(IndexBaseMonthData::getTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-// studentNumData.setActivateNum(studentNum.stream().map(IndexBaseMonthData::getActivateNum).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-
|
|
|
- List<IndexBaseMonthData> paymentStudentNum = new ArrayList<>();
|
|
|
- if(typeDataMap.containsKey(IndexDataType.STUDENT_CONVERSION_PAYMENT_STUDENT_NUM)){
|
|
|
- paymentStudentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_PAYMENT_STUDENT_NUM).getIndexMonthData();
|
|
|
- }
|
|
|
-
|
|
|
- IndexBaseMonthData paymentStudentNumData = new IndexBaseMonthData();
|
|
|
- paymentStudentNumData = paymentStudentNum.stream().max(Comparator.comparing(IndexBaseMonthData::getMonth)).get();
|
|
|
-// paymentStudentNumData.setMonth(currentMonth);
|
|
|
- paymentStudentNumData.setDataType(IndexDataType.STUDENT_CONVERSION_PAYMENT_STUDENT_NUM);
|
|
|
- paymentStudentNumData.setTitle(IndexDataType.STUDENT_CONVERSION_PAYMENT_STUDENT_NUM.getMsg());
|
|
|
-// paymentStudentNumData.setTotalNum(paymentStudentNum.stream().map(IndexBaseMonthData::getTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-// paymentStudentNumData.setActivateNum(paymentStudentNum.stream().map(IndexBaseMonthData::getActivateNum).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-
|
|
|
- List<IndexBaseMonthData> convertStudentNum = new ArrayList<>();
|
|
|
- if(typeDataMap.containsKey(IndexDataType.STUDENT_CONVERSION_VIP_PRACTICE_STUDENT_NUM)){
|
|
|
- convertStudentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_VIP_PRACTICE_STUDENT_NUM).getIndexMonthData();
|
|
|
- }
|
|
|
-
|
|
|
- IndexBaseMonthData convertStudentNumData = new IndexBaseMonthData();
|
|
|
- convertStudentNumData = convertStudentNum.stream().max(Comparator.comparing(IndexBaseMonthData::getMonth)).get();
|
|
|
-// convertStudentNumData.setMonth(currentMonth);
|
|
|
- convertStudentNumData.setDataType(IndexDataType.STUDENT_CONVERSION_VIP_PRACTICE_STUDENT_NUM);
|
|
|
- convertStudentNumData.setTitle(IndexDataType.STUDENT_CONVERSION_VIP_PRACTICE_STUDENT_NUM.getMsg());
|
|
|
-// convertStudentNumData.setTotalNum(convertStudentNum.stream().map(IndexBaseMonthData::getTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-// convertStudentNumData.setActivateNum(convertStudentNum.stream().map(IndexBaseMonthData::getActivateNum).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-
|
|
|
- if(true){
|
|
|
- studentNumData.setPercent(studentNumData.getActivateNum());
|
|
|
- paymentStudentNumData.setPercent(paymentStudentNumData.getActivateNum());
|
|
|
- convertStudentNumData.setPercent(convertStudentNumData.getActivateNum());
|
|
|
- }else if(preStudentNumData.getActivateNum().compareTo(BigDecimal.ZERO)==0){
|
|
|
- studentNumData.setPercent(BigDecimal.ZERO);
|
|
|
- paymentStudentNumData.setPercent(BigDecimal.ZERO);
|
|
|
- convertStudentNumData.setPercent(BigDecimal.ZERO);
|
|
|
- }else{
|
|
|
- studentNumData.setPercent(studentNumData.getActivateNum().divide(preStudentNumData.getActivateNum(), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
|
|
|
- if(studentNumData.getActivateNum().compareTo(BigDecimal.ZERO)==0){
|
|
|
- paymentStudentNumData.setPercent(BigDecimal.ZERO);
|
|
|
- convertStudentNumData.setPercent(BigDecimal.ZERO);
|
|
|
- }else{
|
|
|
- paymentStudentNumData.setPercent(paymentStudentNumData.getActivateNum().divide(studentNumData.getActivateNum(), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
|
|
|
- if(paymentStudentNumData.getActivateNum().compareTo(BigDecimal.ZERO)==0){
|
|
|
- convertStudentNumData.setPercent(BigDecimal.ZERO);
|
|
|
- }else{
|
|
|
- convertStudentNumData.setPercent(convertStudentNumData.getActivateNum().divide(paymentStudentNumData.getActivateNum(), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ //课程数据
|
|
|
+ saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, GroupType.MUSIC, CourseStatusEnum.OVER), dayStr, IndexDataType.MUSIC_GROUP_COURSE);
|
|
|
+ saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, GroupType.VIP, CourseStatusEnum.OVER), dayStr, IndexDataType.VIP_GROUP_COURSE);
|
|
|
+ saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, GroupType.PRACTICE, CourseStatusEnum.OVER), dayStr, IndexDataType.PRACTICE_GROUP_COURSE);
|
|
|
|
|
|
- convertData.add(preStudentNumData);
|
|
|
- convertData.add(studentNumData);
|
|
|
- convertData.add(paymentStudentNumData);
|
|
|
- convertData.add(convertStudentNumData);
|
|
|
- IndexBaseDto indexBaseData = new IndexBaseDto(IndexDataType.STUDENT_CONVERSION, IndexDataType.STUDENT_CONVERSION.getMsg());
|
|
|
- indexBaseData.setIndexMonthData(convertData, currentMonth);
|
|
|
- if(paymentStudentNumData.getActivateNum().compareTo(BigDecimal.ZERO)==0){
|
|
|
- indexBaseData.setPercent(convertStudentNumData.getPercent());
|
|
|
- }else{
|
|
|
- indexBaseData.setPercent(convertStudentNumData.getActivateNum().divide(paymentStudentNumData.getActivateNum(), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
|
|
|
- }
|
|
|
- result.add(indexBaseData);
|
|
|
+ //学员变动
|
|
|
+ saveData(indexBaseMonthDataDao.getAddStudentRegistrationData(dayStr), dayStr, IndexDataType.ADD_STUDENT_REGISTRATION_NUM);
|
|
|
+ saveData(indexBaseMonthDataDao.getMusicStudentData(dayStr, null), dayStr, IndexDataType.MUSIC_GROUP_STUDENT);
|
|
|
+ saveData(null, dayStr, IndexDataType.NEWLY_STUDENT_NUM);
|
|
|
+ saveData(null, dayStr, IndexDataType.QUIT_MUSIC_GROUP_STUDENT_NUM);
|
|
|
+ saveData(indexBaseMonthDataDao.getOtherStudentData(dayStr), dayStr, IndexDataType.VIP_PRACTICE_STUDENT_NUM);
|
|
|
+ saveData(indexBaseMonthDataDao.getVipPracticeAddStudentData(dayStr), dayStr, IndexDataType.VIP_PRACTICE_ADD_STUDENT_NUM);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -328,14 +233,31 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
dataList = new ArrayList<>();
|
|
|
}
|
|
|
Set<Integer> hasOrganIds = dataList.stream().map(IndexBaseMonthData::getOrganId).collect(Collectors.toSet());
|
|
|
+
|
|
|
+ boolean specialType = IndexDataType.NEWLY_STUDENT_NUM.equals(indexDataType)||IndexDataType.QUIT_MUSIC_GROUP_STUDENT_NUM.equals(indexDataType);
|
|
|
+ Set<Integer> ignoreOrganIds = new HashSet<>();
|
|
|
+ if(specialType){
|
|
|
+ List<IndexBaseMonthData> indexBaseDatas = indexBaseMonthDataDao.getWithDayAndDataType(dayStr, indexDataType);
|
|
|
+ if(!CollectionUtils.isEmpty(indexBaseDatas)) {
|
|
|
+ ignoreOrganIds = indexBaseDatas.stream().map(IndexBaseMonthData::getOrganId).collect(Collectors.toSet());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for (Integer organId : this.organIds.get()) {
|
|
|
if(hasOrganIds.contains(organId)){
|
|
|
continue;
|
|
|
}
|
|
|
+ if(specialType&&ignoreOrganIds.contains(organId)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
dataList.add(new IndexBaseMonthData(date, organId));
|
|
|
}
|
|
|
- indexBaseMonthDataDao.deleteWithMonthAndType(Arrays.asList(dayStr), indexDataType);
|
|
|
- indexBaseMonthDataDao.batchInsertWithDataType(dataList, indexDataType);
|
|
|
+ if(!IndexDataType.NEWLY_STUDENT_NUM.equals(indexDataType)&&!IndexDataType.QUIT_MUSIC_GROUP_STUDENT_NUM.equals(indexDataType)){
|
|
|
+ indexBaseMonthDataDao.deleteWithMonthAndType(Arrays.asList(dayStr), indexDataType);
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(dataList)){
|
|
|
+ indexBaseMonthDataDao.batchInsertWithDataType(dataList, indexDataType);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|