Browse Source

feat:首页改版

Joburgess 4 years ago
parent
commit
fdec9a8749

+ 21 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -50,8 +50,9 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	public List<IndexBaseDto> getIndexBaseData(String dataTypesStr, String organIdsStr, String startMonth, String endMonth) {
 		List<IndexBaseDto> result = new ArrayList<>();
 
+		LocalDate nowDateTime = LocalDate.now();
+		nowDateTime.withDayOfMonth(1);
 		if(StringUtils.isBlank(startMonth)){
-			LocalDateTime nowDateTime = LocalDateTime.now();
 			startMonth = nowDateTime.getYear() + "-01";
 			endMonth = null;
 		}
@@ -69,8 +70,27 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			return result;
 		}
 
+		LocalDate startMonthDate = LocalDate.parse(startMonth + "-01", DateUtil.dateFormatter);
+
 		Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = indexBaseDatas.stream().collect(Collectors.groupingBy(IndexBaseMonthData::getDataType));
 		for (Map.Entry<IndexDataType, List<IndexBaseMonthData>> typeDateMapEntry : typeDateMap.entrySet()) {
+			Set<String> hasMonths = typeDateMapEntry.getValue().stream().map(d -> DateUtil.dateToString(d.getMonth(), "%Y-%m-%d")).collect(Collectors.toSet());
+			LocalDate currentMonthDate = startMonthDate;
+			while (currentMonthDate.compareTo(nowDateTime)<=0){
+				if(hasMonths.contains(currentMonthDate.toString())){
+					currentMonthDate = currentMonthDate.plusMonths(1);
+					continue;
+				}
+				IndexBaseMonthData indexBaseMonthData = new IndexBaseMonthData();
+				indexBaseMonthData.setMonth(Date.from(currentMonthDate.atStartOfDay(DateUtil.zoneId).toInstant()));
+				indexBaseMonthData.setTotalNum(BigDecimal.ONE);
+				indexBaseMonthData.setActivateNum(BigDecimal.ZERO);
+				indexBaseMonthData.setPercent(BigDecimal.ZERO);
+				indexBaseMonthData.setDataType(typeDateMapEntry.getKey());
+				typeDateMapEntry.getValue().add(indexBaseMonthData);
+				currentMonthDate = currentMonthDate.plusMonths(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_SUBMIT_RATE.equals(typeDateMapEntry.getKey())
 					||IndexDataType.STUDENT_CONVERSION.equals(typeDateMapEntry.getKey())){

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -149,9 +149,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			throw new BizException("乐团查询失败,请检查参数");
 		}
 		
-//		if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS && musicGroup.getStatus() != MusicGroupStatusEnum.PRE_BUILD_FEE) {
-//			throw new BizException("创建失败:乐团当前状态不能创建缴费");
-//		}
+		if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS && musicGroup.getStatus() != MusicGroupStatusEnum.PRE_BUILD_FEE) {
+			throw new BizException("创建失败:乐团当前状态不能创建缴费");
+		}
 		
 		SysUser sysUser = sysUserFeignService.queryUserInfo();
 		if (sysUser == null) {