培训记录管理统计查询修改
parent
06baa58f5f
commit
1c9008c34f
|
|
@ -27,8 +27,6 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -153,16 +151,16 @@ public class PersonnelPlanLogController extends AbstractCommonFileController{
|
|||
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()
|
||||
// .nested(o -> o.between(PersonnelPlan::getStm, stm, etm).or().between(PersonnelPlan::getEtm, stm, etm))
|
||||
// .list();
|
||||
PersonnelPlanLogStatisticsVo vo = new PersonnelPlanLogStatisticsVo();
|
||||
|
||||
// 实际
|
||||
Map<Integer, PersonnelPlanLogStatisticsVo.EchartsData> map1 = Maps.newHashMap();
|
||||
|
||||
// 计划
|
||||
Map<Integer, PersonnelPlanLogStatisticsVo.EchartsData> map2 = Maps.newHashMap();
|
||||
// Map<Integer, PersonnelPlanLogStatisticsVo.EchartsData> map2 = Maps.newHashMap();
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
|
|
@ -172,14 +170,14 @@ public class PersonnelPlanLogController extends AbstractCommonFileController{
|
|||
vo.setPersonNum1(planLogs.stream().mapToInt(PersonnelPlanLog::getNumPeople).sum());
|
||||
for (int i = 1; i <= month; i++) {
|
||||
PersonnelPlanLogStatisticsVo.EchartsData echartsData1 = map1.get(i);
|
||||
PersonnelPlanLogStatisticsVo.EchartsData echartsData2 = map2.get(i);
|
||||
// PersonnelPlanLogStatisticsVo.EchartsData echartsData2 = map2.get(i);
|
||||
|
||||
if (Objects.isNull(echartsData1)) {
|
||||
echartsData1 = new PersonnelPlanLogStatisticsVo.EchartsData();
|
||||
}
|
||||
if (Objects.isNull(echartsData2)) {
|
||||
echartsData2 = new PersonnelPlanLogStatisticsVo.EchartsData();
|
||||
}
|
||||
// if (Objects.isNull(echartsData2)) {
|
||||
// echartsData2 = new PersonnelPlanLogStatisticsVo.EchartsData();
|
||||
// }
|
||||
int finalI = i;
|
||||
List<PersonnelPlanLog> list = planLogs.stream()
|
||||
.filter(item ->
|
||||
|
|
@ -190,59 +188,60 @@ public class PersonnelPlanLogController extends AbstractCommonFileController{
|
|||
.toList();
|
||||
|
||||
echartsData1.setMonth(finalI)
|
||||
.setNum1(list.stream().mapToInt(PersonnelPlanLog::getNumPeople).sum());
|
||||
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)
|
||||
.setNum1(list.stream().mapToInt(PersonnelPlanLog::getNumPeople).sum())
|
||||
.setNum2(list.size());
|
||||
map1.put(i, echartsData1);
|
||||
|
||||
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);
|
||||
// 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());
|
||||
// vo.setList2(map2.values().stream().toList());
|
||||
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,10 +46,12 @@ public class PersonnelPlanLogStatisticsVo {
|
|||
@Schema(description="月份")
|
||||
private Integer month;
|
||||
|
||||
@Schema(description="实际数据")
|
||||
// @Schema(description="实际数据")
|
||||
@Schema(description="实际人数")
|
||||
private Integer num1 = 0;
|
||||
|
||||
@Schema(description="计划数据")
|
||||
// @Schema(description="计划数据")
|
||||
@Schema(description="实际期数")
|
||||
private Integer num2 = 0;
|
||||
|
||||
@Schema(description="完成率")
|
||||
|
|
|
|||
Loading…
Reference in New Issue