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