培训记录统计补充计划培训期数和人数
parent
34bb5043dc
commit
73fc33f5b9
|
|
@ -146,38 +146,37 @@ public class PersonnelPlanLogController extends AbstractCommonFileController{
|
|||
if (year < 1970 || year > LocalDate.now().getYear()) {
|
||||
throw new IllegalArgumentException("年份不合法");
|
||||
}
|
||||
//plan planLog
|
||||
Date stm = DateUtil.convertStringToDate(year + "-01-01 00:00:00");
|
||||
Date etm = DateUtil.convertStringToDate(year + "-12-31 23:59:59");
|
||||
List<PersonnelPlanLog> planLogs = service.lambdaQuery()
|
||||
.between(PersonnelPlanLog::getPlanDate, stm, etm)
|
||||
.list();
|
||||
// List<PersonnelPlan> plans = planService.lambdaQuery()
|
||||
// .nested(o -> o.between(PersonnelPlan::getStm, stm, etm).or().between(PersonnelPlan::getEtm, stm, etm))
|
||||
// .list();
|
||||
List<PersonnelPlan> plans = planService.lambdaQuery()
|
||||
.between(PersonnelPlan::getStm, stm, etm)
|
||||
.list();
|
||||
|
||||
PersonnelPlanLogStatisticsVo vo = new PersonnelPlanLogStatisticsVo();
|
||||
|
||||
// 实际
|
||||
Map<Integer, PersonnelPlanLogStatisticsVo.EchartsData> map1 = Maps.newHashMap();
|
||||
|
||||
// 计划
|
||||
// Map<Integer, PersonnelPlanLogStatisticsVo.EchartsData> map2 = Maps.newHashMap();
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
int month = calendar.get(Calendar.MONTH) + 1;
|
||||
if (CollectionUtils.isNotEmpty(planLogs)) {
|
||||
|
||||
vo.setNumberOfPeriods1(planLogs.size());
|
||||
vo.setNumberOfPeriods2(plans.size());
|
||||
vo.setPersonNum1(planLogs.stream().mapToInt(PersonnelPlanLog::getNumPeople).sum());
|
||||
vo.setPersonNum2(plans.stream()
|
||||
.map(
|
||||
item -> item.getNumPeople() * item.getNum()
|
||||
).mapToInt(Integer::intValue).sum()
|
||||
);
|
||||
|
||||
for (int i = 1; i <= month; i++) {
|
||||
PersonnelPlanLogStatisticsVo.EchartsData echartsData1 = map1.get(i);
|
||||
// PersonnelPlanLogStatisticsVo.EchartsData echartsData2 = map2.get(i);
|
||||
|
||||
if (Objects.isNull(echartsData1)) {
|
||||
echartsData1 = new PersonnelPlanLogStatisticsVo.EchartsData();
|
||||
}
|
||||
// if (Objects.isNull(echartsData2)) {
|
||||
// echartsData2 = new PersonnelPlanLogStatisticsVo.EchartsData();
|
||||
// }
|
||||
int finalI = i;
|
||||
List<PersonnelPlanLog> list = planLogs.stream()
|
||||
.filter(item ->
|
||||
|
|
@ -191,57 +190,9 @@ public class PersonnelPlanLogController extends AbstractCommonFileController{
|
|||
.setNum1(list.stream().mapToInt(PersonnelPlanLog::getNumPeople).sum())
|
||||
.setNum2(list.size());
|
||||
map1.put(i, echartsData1);
|
||||
|
||||
// echartsData2
|
||||
// .setMonth(finalI)
|
||||
// .setNum1(list.size());
|
||||
// map2.put(i, echartsData2);
|
||||
}
|
||||
}
|
||||
|
||||
// if (CollectionUtils.isNotEmpty(plans)) {
|
||||
// vo.setNumberOfPeriods2(plans.stream().mapToInt(PersonnelPlan::getNum).sum());
|
||||
// // 期数乘人数
|
||||
// vo.setPersonNum2(plans.stream().mapToInt(o -> o.getNumPeople() * o.getNum()).sum());
|
||||
//
|
||||
// for (int i = 1; i <= month; i++) {
|
||||
// PersonnelPlanLogStatisticsVo.EchartsData echartsData1 = map1.get(i);
|
||||
// if (Objects.isNull(echartsData1)) {
|
||||
// echartsData1 = new PersonnelPlanLogStatisticsVo.EchartsData();
|
||||
// }
|
||||
// PersonnelPlanLogStatisticsVo.EchartsData echartsData2 = map2.get(i);
|
||||
// if (Objects.isNull(echartsData2)) {
|
||||
// echartsData2 = new PersonnelPlanLogStatisticsVo.EchartsData();
|
||||
// }
|
||||
// int finalI = i;
|
||||
// List<PersonnelPlan> list = plans.stream()
|
||||
// .filter(item ->
|
||||
// {
|
||||
// calendar.setTime(item.getStm());
|
||||
// return month == finalI;
|
||||
// }).toList();
|
||||
//
|
||||
// echartsData1.setMonth(finalI)
|
||||
// .setNum2(list.stream().mapToInt(PersonnelPlan::getNumPeople).sum());
|
||||
//
|
||||
// if ( echartsData1.getNum1() > 0 && echartsData1.getNum2() > 0){
|
||||
// echartsData1.setRate(new BigDecimal(echartsData1.getNum1()).divide(new BigDecimal(echartsData1.getNum2()), 4, RoundingMode.HALF_UP));
|
||||
// }
|
||||
// map1.put(i, echartsData1);
|
||||
//
|
||||
// echartsData2
|
||||
// .setMonth(finalI)
|
||||
// .setNum2(list.size());
|
||||
//
|
||||
// if (echartsData1.getNum1() > 0 && echartsData1.getNum2() > 0){
|
||||
// echartsData2.setRate(new BigDecimal(echartsData2.getNum1()).divide(new BigDecimal(echartsData2.getNum2()), 4, RoundingMode.HALF_UP));
|
||||
// }
|
||||
// map2.put(i, echartsData2);
|
||||
// }
|
||||
// }
|
||||
|
||||
vo.setList1(map1.values().stream().toList());
|
||||
// vo.setList2(map2.values().stream().toList());
|
||||
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue