Commit e5ccadd0 authored by wdy's avatar wdy

Merge branch 'wangdingyi' into 'dev'

查看问卷统计数据&编辑任务修改

See merge request !116
parents 258fe201 155e2314
...@@ -16,6 +16,7 @@ import org.springframework.context.ApplicationContext; ...@@ -16,6 +16,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -168,9 +169,11 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -168,9 +169,11 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId())); List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
carReviewTask.setStandards(calculateStandards(standards)); carReviewTask.setStandards(calculateStandards(standards));
carReviewTask.setStandardsPass( calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards()); BigDecimal standardPass = new BigDecimal(calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards());
carReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
carReviewTask.setDetails(calculateDetails(standards)); carReviewTask.setDetails(calculateDetails(standards));
carReviewTask.setDetailsPass((calculateDetailsPass(standards, resultMap) / (double) carReviewTask.getDetails())); BigDecimal detailsPass = new BigDecimal(calculateDetailsPass(standards, resultMap) / (double) carReviewTask.getDetails());
carReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
carReviewTask.setPerson(relationList.size()); carReviewTask.setPerson(relationList.size());
} }
......
...@@ -14,6 +14,8 @@ import org.springframework.context.ApplicationContext; ...@@ -14,6 +14,8 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -160,12 +162,14 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -160,12 +162,14 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
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));
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(systemReviewTask.getId())); List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()));
systemReviewTask.setStandards(calculateStandards(standards)); systemReviewTask.setStandards(calculateStandards(standards));
systemReviewTask.setStandardsPass( calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards()); BigDecimal standardPass = new BigDecimal(calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards());
systemReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
systemReviewTask.setDetails(calculateDetails(standards)); systemReviewTask.setDetails(calculateDetails(standards));
systemReviewTask.setDetailsPass((calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails())); BigDecimal detailsPass = new BigDecimal(calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails());
systemReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
systemReviewTask.setPerson(relationList.size()); systemReviewTask.setPerson(relationList.size());
} }
......
...@@ -337,16 +337,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta ...@@ -337,16 +337,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
SysUser initiator = sysUserService.selectUserById(loginUser.getUserId()); SysUser initiator = sysUserService.selectUserById(loginUser.getUserId());
Standard standard = standardService.findListById(request.getStandardId()); Standard standard = standardService.findListById(request.getStandardId());
// 找到审查组长
TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors();
for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) {
leader = auditor;
break;
}
}
// 构建并保存任务信息 // 构建并保存任务信息
// 总任务 // 总任务
Task task = new Task(); Task task = new Task();
...@@ -354,8 +344,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta ...@@ -354,8 +344,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
task.setTaskInitiator(initiator.getNickName()); task.setTaskInitiator(initiator.getNickName());
task.setTaskInitiatorDept(initiator.getDept().getDeptName()); task.setTaskInitiatorDept(initiator.getDept().getDeptName());
task.setTaskStatus(Task.TASK_STATUS_TEMPORARILY); task.setTaskStatus(Task.TASK_STATUS_TEMPORARILY);
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
task.setName(standard.getName()); task.setName(standard.getName());
task.setStandardNo(standard.getStandardNo()); task.setStandardNo(standard.getStandardNo());
task.setFile(standard.getFile()); task.setFile(standard.getFile());
...@@ -363,14 +351,32 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta ...@@ -363,14 +351,32 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
task.setTaskList(joinTaskList); task.setTaskList(joinTaskList);
BeanUtils.copyBeanProp(task, request); BeanUtils.copyBeanProp(task, request);
taskService.save(task); // 找到审查组长
TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors();
if (auditors.size() != 0 && auditors != null) {
for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) {
leader = auditor;
break;
}
}
// 构建并保存该任务所关联的审核组信息 // 构建并保存该任务所关联的审核组信息
for(TaskUserRelation auditor : auditors) { for(TaskUserRelation auditor : auditors) {
auditor.setTaskId(task.getId()); auditor.setTaskId(task.getId());
}
taskUserRelationService.saveBatch(auditors);
// 任务组长
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
} }
taskUserRelationService.saveBatch(auditors); // 暂存
taskService.save(task);
// 保存关联的整车样品信息 // 保存关联的整车样品信息
List<TaskSampleRelation> relations = request.getSample(); List<TaskSampleRelation> relations = request.getSample();
......
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