master
parent
97632ce613
commit
1ddf2ced03
|
|
@ -158,13 +158,13 @@ public class PersonnelPlanLogController extends AbstractCommonFileController{
|
|||
|
||||
PersonnelPlanLogStatisticsVo vo = new PersonnelPlanLogStatisticsVo();
|
||||
|
||||
Map<Integer, PersonnelPlanLogStatisticsVo.EchartsData> map1 = Maps.newHashMap();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int month = calendar.get(Calendar.MONTH) + 1;
|
||||
// Map<Integer, PersonnelPlanLogStatisticsVo.EchartsData> map1 = 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.setNumberOfPeriods2(plans.stream().mapToInt(PersonnelPlan::getNum).sum());
|
||||
vo.setPersonNum1(planLogs.stream().mapToInt(PersonnelPlanLog::getNumPeople).sum());
|
||||
vo.setPersonNum2(plans.stream()
|
||||
.map(
|
||||
|
|
@ -172,27 +172,44 @@ public class PersonnelPlanLogController extends AbstractCommonFileController{
|
|||
).mapToInt(Integer::intValue).sum()
|
||||
);
|
||||
|
||||
for (int i = 1; i <= month; i++) {
|
||||
PersonnelPlanLogStatisticsVo.EchartsData echartsData1 = map1.get(i);
|
||||
if (Objects.isNull(echartsData1)) {
|
||||
echartsData1 = new PersonnelPlanLogStatisticsVo.EchartsData();
|
||||
}
|
||||
int finalI = i;
|
||||
List<PersonnelPlanLog> list = planLogs.stream()
|
||||
.filter(item ->
|
||||
{
|
||||
calendar.setTime(item.getPlanDate());
|
||||
return month == finalI;
|
||||
})
|
||||
.toList();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
List<PersonnelPlanLogStatisticsVo.EchartsData> logStatPerMonth = new ArrayList<>();
|
||||
for (int i = 0; i < 12; i++) {
|
||||
int month = i; //calendar的月份是从0开始
|
||||
List<PersonnelPlanLog> logsPerMonth = planLogs.stream().filter(log -> {
|
||||
Date planDate = log.getPlanDate();
|
||||
calendar.setTime(planDate);
|
||||
return month == calendar.get(Calendar.MONTH);
|
||||
}).toList();
|
||||
|
||||
echartsData1.setMonth(finalI)
|
||||
.setNum1(list.stream().mapToInt(PersonnelPlanLog::getNumPeople).sum())
|
||||
.setNum2(list.size());
|
||||
map1.put(i, echartsData1);
|
||||
//month num1实际人数 num2实际期数
|
||||
PersonnelPlanLogStatisticsVo.EchartsData chartItem = new PersonnelPlanLogStatisticsVo.EchartsData();
|
||||
chartItem.setMonth(i + 1); //calendar的月份是从0开始
|
||||
chartItem.setNum1(logsPerMonth.stream().mapToInt(PersonnelPlanLog::getNumPeople).sum());
|
||||
chartItem.setNum2(logsPerMonth.size());
|
||||
|
||||
logStatPerMonth.add(chartItem);
|
||||
// PersonnelPlanLogStatisticsVo.EchartsData echartsData1 = map1.get(i);
|
||||
// if (Objects.isNull(echartsData1)) {
|
||||
// echartsData1 = new PersonnelPlanLogStatisticsVo.EchartsData();
|
||||
// }
|
||||
// int finalI = i;
|
||||
// List<PersonnelPlanLog> list = planLogs.stream()
|
||||
// .filter(item ->
|
||||
// {
|
||||
// calendar.setTime(item.getPlanDate());
|
||||
// return month == finalI;
|
||||
// })
|
||||
// .toList();
|
||||
//
|
||||
// echartsData1.setMonth(finalI)
|
||||
// .setNum1(list.stream().mapToInt(PersonnelPlanLog::getNumPeople).sum())
|
||||
// .setNum2(list.size());
|
||||
// map1.put(i, echartsData1);
|
||||
}
|
||||
vo.setList1(logStatPerMonth);
|
||||
}
|
||||
vo.setList1(map1.values().stream().toList());
|
||||
|
||||
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,18 +124,32 @@ public class SzTreatmentBasisController{
|
|||
.filter(o -> 0L == o.getPId())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Iterator<SzTreatmentBasis> iterator = parentList.iterator();
|
||||
while (iterator.hasNext()){
|
||||
SzTreatmentBasis node = iterator.next();
|
||||
Long id = node.getId();
|
||||
if (!listMap.containsKey(id) && Integer.valueOf(0).equals(node.getDisplay())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
parentList.forEach(this::trim);
|
||||
parentList.removeIf(node -> CollectionUtils.isEmpty(node.getChildren()));
|
||||
|
||||
return R.ok(parentList);
|
||||
}
|
||||
|
||||
private boolean trim(SzTreatmentBasis node) {
|
||||
List<SzTreatmentBasis> children = node.getChildren();
|
||||
boolean isMiddleNode = false;
|
||||
if (CollectionUtils.isNotEmpty(children)) {
|
||||
isMiddleNode = true;
|
||||
Iterator<SzTreatmentBasis> iterator = children.iterator();
|
||||
// while (iterator.hasNext()) {
|
||||
// SzTreatmentBasis child = iterator.next();
|
||||
// boolean f = trim(child);
|
||||
// if (f) {
|
||||
// iterator.remove();
|
||||
// }
|
||||
// }
|
||||
children.removeIf(this::trim);
|
||||
}
|
||||
//没有子节点的节点,且display是0,是末端节点;没有子节点的节点,且曾经有过子节点,是中间节点
|
||||
//末端节点的display是0就删,中间节点没有子节点就删
|
||||
return CollectionUtils.isEmpty(children) && (Integer.valueOf(0).equals(node.getDisplay()) || isMiddleNode);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ public class PersonnelPlanLogStatisticsVo {
|
|||
@Schema(description="实际期数")
|
||||
private Integer num2 = 0;
|
||||
|
||||
@Deprecated
|
||||
@Schema(description="完成率")
|
||||
private BigDecimal rate = BigDecimal.ZERO;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue