shudonghui 1 年之前
父節點
當前提交
c07a011045
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      sop-api/src/main/java/com/qmth/sop/server/api/ServiceAnalyseController.java

+ 2 - 2
sop-api/src/main/java/com/qmth/sop/server/api/ServiceAnalyseController.java

@@ -168,7 +168,7 @@ public class ServiceAnalyseController {
     @ApiResponses({@ApiResponse(code = 200, message = "项目调配完成进度", response = Long.class) })
     public Result allocation(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId) {
         List<UserArchivesAllocationResult> crmAllocation = serviceAnalyseService.findCrmAllocation(serviceUnitId, null, null);
-        return ResultUtil.ok(crmAllocation.stream().filter(e->e.getDistributed()<e.getQuota()).count()*100/crmAllocation.size());
+        return ResultUtil.ok(crmAllocation.isEmpty() ?0:crmAllocation.stream().filter(e->e.getDistributed()<e.getQuota()).count()/crmAllocation.size());
     }
 
     /**
@@ -182,7 +182,7 @@ public class ServiceAnalyseController {
         List<UserArchivesAllocationResult> list = serviceAnalyseService.findCrmAllocation(serviceUnitId, null, null);
         int quota = list.stream().mapToInt(UserArchivesAllocationResult::getQuota).sum();
         int distributed = list.stream().mapToInt(UserArchivesAllocationResult::getDistributed).sum();
-        return ResultUtil.ok(distributed*100/quota);
+        return ResultUtil.ok(quota==0?0:distributed/quota);
     }
 
     /**