Commit 6d6fabcc authored by 王飞's avatar 王飞

Merge branch 'wangfei' into 'dev'

1、计算统计数据

See merge request !114
parents c7f55dfa 7c5131da
...@@ -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.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -191,53 +192,130 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -191,53 +192,130 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
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));
//审查细则(条) // //审查细则(条)
int detailsNum = 0; // int detailsNum = 0;
//
// //审查细则符合数
// int detailsPassNum = 0;
//
// //标准条款(条)
// int standardsNum = 0;
//
// //标准条款通过数
// int standardsPassNum = 0;
//
// for(ReviewStandard standard : standards) {
// standard.setPassed(1);
// standardsNum ++;
// List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
//
// for(ReviewKeyPoint keypoint : keyPointList) {
// List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList();
//
// for(ReviewDetails details : reviewDetailsList) {
// detailsNum ++;
// ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
// if(reviewDetailsResult == null || reviewDetailsResult.getPassed() == 0) {
// standard.setPassed(reviewDetailsResult.getPassed());
// detailsPassNum ++;
// standardsPassNum ++;
//
// }
// if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
// ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
// reviewDetailsResult.setEnterpriseName(reviewEnterpriseArchive.getEnterpriseName());
// }
// details.setResult(reviewDetailsResult);
// }
// }
// }
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
//审查细则符合数
int detailsPassNum = 0;
//标准条款(条) // carReviewTask.setDetails(detailsNum);
int standardsNum = 0; // carReviewTask.setDetailsPass(((long)detailsPassNum/(long)detailsNum));
// carReviewTask.setStandards(standardsNum);
// carReviewTask.setStandardsPass(((long)standardsPassNum/(long)standardsNum));
carReviewTask.setStandards(calculateStandards(standards));
carReviewTask.setStandardsPass(calculateStandardsPass(standards, resultMap) / (long) carReviewTask.getStandards());
carReviewTask.setDetails(calculateDetails(standards));
carReviewTask.setDetailsPass((calculateDetailsPass(standards, resultMap) / (long) carReviewTask.getDetails()));
carReviewTask.setPerson(relationList.size());
//标准条款通过数 }
int standardsPassNum = 0;
private int calculateStandards(List<ReviewStandard> standards) {
return standards.size();
}
private long calculateStandardsPass(List<ReviewStandard> standards, Map<Long, ReviewDetailsResult> resultMap) {
long standardsPass = 0;
for(ReviewStandard standard : standards) { for(ReviewStandard standard : standards) {
standard.setPassed(1);
standardsNum ++;
List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
for(ReviewKeyPoint keypoint : keyPointList) { List<ReviewDetails> details = getDetailsByStandard(standard);
List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList(); for(ReviewDetails reviewDetails : details) {
if(detailsIsPass(reviewDetails, resultMap)) {
standardsPass = standardsPass + 1;
}
}
}
return standardsPass;
}
private int calculateDetails(List<ReviewStandard> standards) {
//审查细则(条)
int detailsNum = 0;
for(ReviewStandard standard : standards) {
List<ReviewDetails> details = getDetailsByStandard(standard);
detailsNum = detailsNum + details.size();
}
for(ReviewDetails details : reviewDetailsList) { return detailsNum;
detailsNum ++;
ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
if(reviewDetailsResult == null || reviewDetailsResult.getPassed() == 0) {
standard.setPassed(reviewDetailsResult.getPassed());
detailsPassNum ++;
standardsPassNum ++;
} }
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId()); private long calculateDetailsPass(List<ReviewStandard> standards, Map<Long, ReviewDetailsResult> resultMap) {
reviewDetailsResult.setEnterpriseName(reviewEnterpriseArchive.getEnterpriseName());
long detailsPass = 0L;
for(ReviewStandard standard : standards) {
List<ReviewDetails> details = getDetailsByStandard(standard);
for(ReviewDetails reviewDetails : details) {
if(detailsIsPass(reviewDetails, resultMap)) {
detailsPass = detailsPass + 1;
} }
details.setResult(reviewDetailsResult);
} }
} }
return detailsPass;
} }
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId())); private List<ReviewDetails> getDetailsByStandard(ReviewStandard standard) {
List<ReviewDetails> details = new ArrayList();
carReviewTask.setDetails(detailsNum); List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
carReviewTask.setDetailsPass(((long)detailsPassNum/(long)detailsNum)); for(ReviewKeyPoint keyPoint : keyPointList) {
carReviewTask.setStandards(standardsNum); details.addAll(keyPoint.getReviewDetailsList());
carReviewTask.setStandardsPass(((long)standardsPassNum/(long)standardsNum)); }
carReviewTask.setPerson(relationList.size());
return details;
}
private boolean detailsIsPass(ReviewDetails reviewDetails, Map<Long, ReviewDetailsResult> resultMap) {
ReviewDetailsResult result = resultMap.get(reviewDetails.getId());
return result.getPassed() == 1;
} }
@Override @Override
......
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