提交 69a8c1b7 authored 作者: Matrix's avatar Matrix

fix(核查模块): 修复了省待办的空指针bug

修复了省待办的空指针bug
上级 82d43132
...@@ -783,9 +783,11 @@ public class DeviceCheckController { ...@@ -783,9 +783,11 @@ public class DeviceCheckController {
return new ResultObj<>(resultIds, "自动核查任务发起成功"); return new ResultObj<>(resultIds, "自动核查任务发起成功");
} }
@ApiOperation(value = "根据地区ID获取下级的单位", notes = "根据地区ID获取下级的单位") @ApiOperation(value = "根据地区ID获取下级的单位", notes = "根据地区ID获取下级的单位")
@GetMapping("/under/{areaId}") @GetMapping("/under/{areaId}")
public ResponseEntity getUnitsUnderAreaId(@PathVariable Integer areaId) { public ResponseEntity getUnitsUnderAreaId(@PathVariable Integer areaId,@RequestParam(defaultValue = "true") boolean filter) {
//1.获取child AreaId List //1.获取child AreaId List
List<Integer> areaIds = areaRepo.findAllByFatherId(areaId).stream() List<Integer> areaIds = areaRepo.findAllByFatherId(areaId).stream()
.map(Area::getId) .map(Area::getId)
...@@ -794,11 +796,17 @@ public class DeviceCheckController { ...@@ -794,11 +796,17 @@ public class DeviceCheckController {
//2. 根据childId 获得对应的unit //2. 根据childId 获得对应的unit
List<Units> unitsList = unitsRepo.findAllByAreaIdIn(areaIds); List<Units> unitsList = unitsRepo.findAllByAreaIdIn(areaIds);
return ResponseEntity.ok(unitsList); // 根据filter 决定是否将没有数据的装备给过滤掉
if (filter){
unitsList = unitsList.stream()
.filter(unit -> deviceRepo.findAllByOwnUnit(unit.getName()).size() != 0)
.collect(toList());
}
return ResponseEntity.ok(unitsList);
} }
@ApiOperation(value = "检查地区是否发起核查", notes = "检查地区是否发起核查") @ApiOperation(value = "检查地区是否可以发起核查", notes = "检查地区是否可以发起核查")
@PostMapping("/checkPossible") @PostMapping("/checkPossible")
public ResponseEntity checkPossible(@RequestBody UnitIds unitIds) { public ResponseEntity checkPossible(@RequestBody UnitIds unitIds) {
List<String> unitNames = unitIds.getIds().stream() List<String> unitNames = unitIds.getIds().stream()
...@@ -1718,6 +1726,7 @@ public class DeviceCheckController { ...@@ -1718,6 +1726,7 @@ public class DeviceCheckController {
TaskBto cityDoneTask = new TaskBto(CONFIRM_STAT_0.id, provTitle + "统计数据确认任务", parentTaskId, ".", CONFIRM_CHECK_STAT.id, statId, provId, 0); TaskBto cityDoneTask = new TaskBto(CONFIRM_STAT_0.id, provTitle + "统计数据确认任务", parentTaskId, ".", CONFIRM_CHECK_STAT.id, statId, provId, 0);
cityDoneTask.getInvolveUserIdList().add(0); cityDoneTask.getInvolveUserIdList().add(0);
cityDoneTask.setCurrentPoint(cityDoneTask.getCurrentPoint() + 1); cityDoneTask.setCurrentPoint(cityDoneTask.getCurrentPoint() + 1);
cityDoneTask.setCustomInfo("");
cityDoneTask = taskService.start(cityDoneTask); cityDoneTask = taskService.start(cityDoneTask);
log.info("[核查模块] 统计确认待办任务生成成功, id为 : {}", cityDoneTask.getId()); log.info("[核查模块] 统计确认待办任务生成成功, id为 : {}", cityDoneTask.getId());
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论