Commit 3d40a9f4 authored by wdy's avatar wdy

Merge branch 'wangdingyi' into 'dev'

总任务数据统计修改

See merge request !166
parents 7cf48bec ddf91dea
...@@ -592,6 +592,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -592,6 +592,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
if (task.getSystemReviewTaskId() != null) { if (task.getSystemReviewTaskId() != null) {
systemReviewTaskService.view(task.getSystemReviewTaskId());
SystemReviewTask systemReviewTask = systemReviewTaskMapper.selectById(task.getSystemReviewTaskId()); SystemReviewTask systemReviewTask = systemReviewTaskMapper.selectById(task.getSystemReviewTaskId());
// 获取最新问卷 // 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM); List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
...@@ -600,13 +602,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -600,13 +602,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId()); List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 体系审查 // 体系审查
setSystemDataStatistics(standardTree,results,response); setSystemDataStatistics(standardTree,results,response,systemReviewTask);
return response; return response;
} }
if (task.getCarReviewTaskId() != null) { if (task.getCarReviewTaskId() != null) {
carReviewTaskService.viewReviewTask(task.getCarReviewTaskId());
CarReviewTask carReviewTask = carReviewTaskMapper.selectById(task.getCarReviewTaskId()); CarReviewTask carReviewTask = carReviewTaskMapper.selectById(task.getCarReviewTaskId());
// 获取最新问卷 // 获取最新问卷
...@@ -616,7 +620,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -616,7 +620,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
List<ReviewDetailsResult> carResults = reviewDetailsResultService.findByTaskId(carReviewTask.getId()); List<ReviewDetailsResult> carResults = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
// 车型审查 // 车型审查
setCarDataStatistics(carStandardTree,carResults,response); setCarDataStatistics(carStandardTree,carResults,response,carReviewTask);
return response; return response;
...@@ -627,16 +631,22 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -627,16 +631,22 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
private void setSystemDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results,DataStatisticsResponse response) { private void setSystemDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results,DataStatisticsResponse response,SystemReviewTask systemReviewTask) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1)); Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
response.setSystemStandards(DataStatisticsUtils.calculateStandards(standards)); if (Objects.equals(systemReviewTask.getTaskStatus(), SystemReviewTask.STATUS_NEW)) {
response.setSystemStandards(DataStatisticsUtils.calculateStandards(standards));
response.setSystemDetails(DataStatisticsUtils.calculateDetails(standards));
} else {
response.setSystemStandards(systemReviewTask.getStandards());
response.setSystemDetails(systemReviewTask.getDetails());
}
response.setSystemStandardsPassNum(DataStatisticsUtils.calculateStandardsPass(standards, resultMap)); response.setSystemStandardsPassNum(DataStatisticsUtils.calculateStandardsPass(standards, resultMap));
response.setSystemStandardsNoPassNum(DataStatisticsUtils.calculateStandardsNoPass(standards, resultMap)); response.setSystemStandardsNoPassNum(DataStatisticsUtils.calculateStandardsNoPass(standards, resultMap));
response.setSystemStandardsUnderNum(response.getSystemStandards() -response.getSystemStandardsPassNum() - response.getSystemStandardsNoPassNum()); response.setSystemStandardsUnderNum(response.getSystemStandards() -response.getSystemStandardsPassNum() - response.getSystemStandardsNoPassNum());
BigDecimal standardPass = new BigDecimal((response.getSystemStandardsPassNum() / (double) response.getSystemStandards())*100); BigDecimal standardPass = new BigDecimal((response.getSystemStandardsPassNum() / (double) response.getSystemStandards())*100);
response.setSystemStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue()); response.setSystemStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
response.setSystemDetails(DataStatisticsUtils.calculateDetails(standards));
response.setSystemDetailsPassNum(DataStatisticsUtils.calculateDetailsPass(standards, resultMap)); response.setSystemDetailsPassNum(DataStatisticsUtils.calculateDetailsPass(standards, resultMap));
response.setSystemDetailsNoPassNum(DataStatisticsUtils.calculateDetailsNoPass(standards, resultMap)); response.setSystemDetailsNoPassNum(DataStatisticsUtils.calculateDetailsNoPass(standards, resultMap));
response.setSystemDetailsUnderNum(response.getSystemDetails() - response.getSystemDetailsPassNum() - response.getSystemDetailsNoPassNum()); response.setSystemDetailsUnderNum(response.getSystemDetails() - response.getSystemDetailsPassNum() - response.getSystemDetailsNoPassNum());
...@@ -645,16 +655,21 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -645,16 +655,21 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
private void setCarDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results,DataStatisticsResponse response) { private void setCarDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results,DataStatisticsResponse response,CarReviewTask carReviewTask) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1)); Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
response.setCarStandards(DataStatisticsUtils.calculateStandards(standards)); if (Objects.equals(carReviewTask.getTaskStatus(), CarReviewTask.TASK_STATUS_NEW)) {
response.setCarStandards(DataStatisticsUtils.calculateStandards(standards));
response.setCarDetails(DataStatisticsUtils.calculateDetails(standards));
} else {
response.setCarStandards(carReviewTask.getStandards());
response.setCarDetails(carReviewTask.getDetails());
}
response.setCarStandardsPassNum(DataStatisticsUtils.calculateStandardsPass(standards, resultMap)); response.setCarStandardsPassNum(DataStatisticsUtils.calculateStandardsPass(standards, resultMap));
response.setCarStandardsNoPassNum(DataStatisticsUtils.calculateStandardsNoPass(standards, resultMap)); response.setCarStandardsNoPassNum(DataStatisticsUtils.calculateStandardsNoPass(standards, resultMap));
response.setCarStandardsUnderNum(response.getCarStandards() -response.getCarStandardsPassNum() - response.getCarStandardsNoPassNum()); response.setCarStandardsUnderNum(response.getCarStandards() -response.getCarStandardsPassNum() - response.getCarStandardsNoPassNum());
BigDecimal standardPass = new BigDecimal((response.getCarStandardsPassNum() / (double) response.getCarStandards())*100); BigDecimal standardPass = new BigDecimal((response.getCarStandardsPassNum() / (double) response.getCarStandards())*100);
response.setCarStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue()); response.setCarStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
response.setCarDetails(DataStatisticsUtils.calculateDetails(standards));
response.setCarDetailsPassNum(DataStatisticsUtils.calculateDetailsPass(standards, resultMap)); response.setCarDetailsPassNum(DataStatisticsUtils.calculateDetailsPass(standards, resultMap));
response.setCarDetailsNoPassNum(DataStatisticsUtils.calculateDetailsNoPass(standards, resultMap)); response.setCarDetailsNoPassNum(DataStatisticsUtils.calculateDetailsNoPass(standards, resultMap));
response.setCarDetailsUnderNum(response.getCarDetails() - response.getCarDetailsPassNum() - response.getCarDetailsNoPassNum()); response.setCarDetailsUnderNum(response.getCarDetails() - response.getCarDetailsPassNum() - response.getCarDetailsNoPassNum());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment