Browse Source

DecimalUtil优化

tags/24080901
WendyYang 7 months ago
parent
commit
acb887a27a
3 changed files with 7 additions and 4 deletions
  1. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/util/DecimalUtil.java
  2. +3
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/controller/WorkbenchController.java
  3. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java

+ 2
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/util/DecimalUtil.java View File

@@ -8,6 +8,7 @@ import java.math.RoundingMode;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Objects;
import java.util.function.Function;

/**
@@ -31,6 +32,7 @@ public class DecimalUtil {
return objs.stream()
.map(w -> Arrays.stream(functions)
.map(f -> f.apply(w))
.filter(Objects::nonNull)
.reduce(BigDecimal::add)
.orElse(BigDecimal.ZERO))
.reduce(BigDecimal::add)


+ 3
- 2
hz-pm-api/src/main/java/com/hz/pm/api/workbench/controller/WorkbenchController.java View File

@@ -46,8 +46,9 @@ public class WorkbenchController {

@GetMapping("/projectTotalView")
@ApiOperation("获取项目总览")
public ProjectTotalViewVO projectTotalView(@RequestParam(required = false) Long unitId) {
return workbenchManage.projectTotalView(unitId);
public ProjectTotalViewVO projectTotalView(@RequestParam(required = false) Long unitId,
@RequestParam(required = false) Integer projectYear) {
return workbenchManage.projectTotalView(unitId, projectYear);
}

}

+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java View File

@@ -353,7 +353,7 @@ public class WorkbenchManage {
return "催办成功了" + employees.length + "个人";
}

public ProjectTotalViewVO projectTotalView(Long unitId) {
public ProjectTotalViewVO projectTotalView(Long unitId, Integer projectYear) {
ProjectTotalViewVO retDetail = new ProjectTotalViewVO();
if (unitId == null) {
unitId = LoginUserUtil.loginUserDetail().getMhUnitId();
@@ -381,7 +381,7 @@ public class WorkbenchManage {
.map(w -> StrUtil.split(w.getReplaceType(), ","))
.flatMap(Collection::stream)
.collect(Collectors.groupingBy(w -> {
if (NumberUtil.isNumber(w)) {
if (!NumberUtil.isNumber(w)) {
return "其他";
} else {
return GovSystemReplaceTypeEnum.get(Integer.parseInt(w))


Loading…
Cancel
Save