|
@@ -277,9 +277,26 @@ public class TBDingController {
|
|
@RequestMapping(value = "/ding_find_all_sop", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/ding_find_all_sop", method = RequestMethod.POST)
|
|
@ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = DingElementResult.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = DingElementResult.class)})
|
|
@OperationLog
|
|
@OperationLog
|
|
- public Result findDingAllSop(@ApiParam(value = "服务单元id", required = true) @RequestParam String serviceUnitId) {
|
|
|
|
|
|
+ public Result findDingAllSop() {
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
- List<SopInfoResult> list = tbSopInfoService.findFlowByServiceId(SystemConstant.convertIdToLong(serviceUnitId), requestUser.getId());
|
|
|
|
- return ResultUtil.ok(list);
|
|
|
|
|
|
+ List<DingSopInfo> resultList = new ArrayList<>();
|
|
|
|
+ List<SopInfoResult> list = tbSopInfoService.findFlowByServiceId(null, requestUser.getId());
|
|
|
|
+ List<Long> serviceUnitIdList = list.stream().map(SopInfoResult::getServiceId).distinct().collect(Collectors.toList());
|
|
|
|
+ for (Long serviceUnitId : serviceUnitIdList) {
|
|
|
|
+ DingSopInfo cell = new DingSopInfo();
|
|
|
|
+ TBService service = tbServiceService.getById(serviceUnitId);
|
|
|
|
+ if (Objects.isNull(service)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到服务单元");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ cell.setServiceUnitId(serviceUnitId);
|
|
|
|
+ cell.setServiceUnitName(service.getName());
|
|
|
|
+ List<SopInfoResult> sopInServiceList = list.stream()
|
|
|
|
+ .filter(e -> serviceUnitId.equals(e.getServiceId()))
|
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
|
+ cell.setSopInfo(sopInServiceList);
|
|
|
|
+ resultList.add(cell);
|
|
|
|
+ }
|
|
|
|
+ return ResultUtil.ok(resultList);
|
|
}
|
|
}
|
|
}
|
|
}
|