|
|
@@ -19,6 +19,7 @@ import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
@@ -44,20 +45,20 @@ public class PbCseFeeobjupdateServiceImpl extends MPJBaseServiceImpl<PbCseFeeobj
|
|
|
if(dto.getYearMonth() != null && !dto.getYearMonth().equals("")){
|
|
|
LocalDate date = LocalDate.parse(dto.getYearMonth() + "-01"); // 假设给定日期为2022年9月15日
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
- // 获取月份的第一天
|
|
|
- LocalDate firstDayOfMonth = date.withDayOfMonth(1);
|
|
|
+ // 获取上月的最后一天
|
|
|
+ LocalDate firstDayOfMonth = date.minusMonths(1).withDayOfMonth(date.minusMonths(1).lengthOfMonth());
|
|
|
firstDayOfMonthStr = firstDayOfMonth.format(formatter);
|
|
|
- // 获取月份的最后一天
|
|
|
- LocalDate lastDayOfMonth = date.withDayOfMonth(date.lengthOfMonth());
|
|
|
+ // 获取下月的第一天
|
|
|
+ LocalDate lastDayOfMonth = date.plusMonths(1).withDayOfMonth(1);
|
|
|
lastDayOfMonthStr = lastDayOfMonth.format(formatter);
|
|
|
}else {
|
|
|
LocalDate today = LocalDate.now();
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
// 获取月份的第一天
|
|
|
- LocalDate firstDayOfMonth = today.withDayOfMonth(1);
|
|
|
+ LocalDate firstDayOfMonth = today.minusMonths(1).withDayOfMonth(today.minusMonths(1).lengthOfMonth());
|
|
|
firstDayOfMonthStr = firstDayOfMonth.format(formatter);
|
|
|
// 获取月份的最后一天
|
|
|
- LocalDate lastDayOfMonth = today.withDayOfMonth(today.lengthOfMonth());
|
|
|
+ LocalDate lastDayOfMonth = today.plusMonths(1).withDayOfMonth(1);
|
|
|
lastDayOfMonthStr = lastDayOfMonth.format(formatter);
|
|
|
}
|
|
|
|
|
|
@@ -77,6 +78,12 @@ public class PbCseFeeobjupdateServiceImpl extends MPJBaseServiceImpl<PbCseFeeobj
|
|
|
if(pbCseFeeobjupdateByYearMonthList != null && !pbCseFeeobjupdateByYearMonthList.isEmpty()) {
|
|
|
//每日招生人数
|
|
|
Map<String, Long> cratetime = pbCseFeeobjupdateByYearMonthList.stream().collect(Collectors.groupingBy(pbCseFeeobjupdate -> pbCseFeeobjupdate.getCratetime().substring(0,10), Collectors.counting()));
|
|
|
+ if(!cratetime.isEmpty()){
|
|
|
+ cratetime = cratetime.entrySet().stream()
|
|
|
+ .sorted(Map.Entry.comparingByKey())
|
|
|
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
|
|
|
+ (e1, e2) -> e1, LinkedHashMap::new));
|
|
|
+ }
|
|
|
List<EnrollmentStatisticsInfoKeyValue> cratetimeRes = new ArrayList<>();
|
|
|
for (Map.Entry<String, Long> entry : cratetime.entrySet()) {
|
|
|
cratetimeRes.add(new EnrollmentStatisticsInfoKeyValue(entry.getKey(), entry.getValue()));
|
|
|
@@ -103,10 +110,10 @@ public class PbCseFeeobjupdateServiceImpl extends MPJBaseServiceImpl<PbCseFeeobj
|
|
|
//获取所有学生的信息
|
|
|
MPJLambdaWrapper<PbCseFeeobjupdate> pbCseFeeobjupdateMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
pbCseFeeobjupdateMPJLambdaWrapper
|
|
|
+ .disableSubLogicDel()
|
|
|
.distinct()
|
|
|
.select("ifnull(t2.name,t.specname) as specname")
|
|
|
.selectAs(PbCseFeeobjupdate::getPersonalid, PbCseFeeobjupdate::getPersonalid)
|
|
|
- .selectAs(PbCseFeeobjupdate::getSpecname, PbCseFeeobjupdate::getSpecname)
|
|
|
.selectAs(PbCseFeeobjupdate::getResourcename, PbCseFeeobjupdate::getResourcename)
|
|
|
.selectAs(PbCseFeeobjupdate::getQuartername, PbCseFeeobjupdate::getQuartername)
|
|
|
.selectAs(PbCseFeeobjupdate::getSex, PbCseFeeobjupdate::getSex)
|
|
|
@@ -189,16 +196,17 @@ public class PbCseFeeobjupdateServiceImpl extends MPJBaseServiceImpl<PbCseFeeobj
|
|
|
//收费项目情况统计
|
|
|
Map<String, Long> pbVXssfdetailMap = pbVXssfdetails.stream().collect(Collectors.groupingBy(PbVXssfdetail::getFeeitemname, Collectors.counting()));
|
|
|
List<ChargingSituationVo> chargingSituationVoRes = new ArrayList<>();
|
|
|
+ DecimalFormat df = new DecimalFormat("#.##");
|
|
|
for (Map.Entry<String, Long> entry : pbVXssfdetailMap.entrySet()) {
|
|
|
chargingSituationVoRes.add(new ChargingSituationVo(){{
|
|
|
setFeeitemname(entry.getKey());
|
|
|
setPaid(entry.getValue());
|
|
|
if(entry.getKey().equals("普通中专、职业高中、成人中专普通宿舍") && !accommodationType.isEmpty() && accommodationType.get("住宿") != null){
|
|
|
setUnpaid(accommodationType.get("住宿") - entry.getValue());
|
|
|
- setRateOfPayment(entry.getValue()/accommodationType.get("住宿")*100 + "%");
|
|
|
+ setRateOfPayment(df.format((double)entry.getValue()/accommodationType.get("住宿")*100) + "%");
|
|
|
} else {
|
|
|
setUnpaid(result.getRegistrationPopulation() - entry.getValue());
|
|
|
- setRateOfPayment(entry.getValue()/result.getRegistrationPopulation()*100 + "%");
|
|
|
+ setRateOfPayment(df.format((double)entry.getValue()/result.getRegistrationPopulation()*100) + "%");
|
|
|
}
|
|
|
}});
|
|
|
}
|