Commit 7c5131da authored by 王飞's avatar 王飞

1、计算统计数据

parent 0d930ed5
......@@ -16,6 +16,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -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));
//审查细则(条)
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;
//标准条款(条)
int standardsNum = 0;
// carReviewTask.setDetails(detailsNum);
// 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) {
standard.setPassed(1);
standardsNum ++;
List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
for(ReviewKeyPoint keypoint : keyPointList) {
List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList();
List<ReviewDetails> details = getDetailsByStandard(standard);
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) {
detailsNum ++;
ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
if(reviewDetailsResult == null || reviewDetailsResult.getPassed() == 0) {
standard.setPassed(reviewDetailsResult.getPassed());
detailsPassNum ++;
standardsPassNum ++;
return detailsNum;
}
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
reviewDetailsResult.setEnterpriseName(reviewEnterpriseArchive.getEnterpriseName());
private long calculateDetailsPass(List<ReviewStandard> standards, Map<Long, ReviewDetailsResult> resultMap) {
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);
carReviewTask.setDetailsPass(((long)detailsPassNum/(long)detailsNum));
carReviewTask.setStandards(standardsNum);
carReviewTask.setStandardsPass(((long)standardsPassNum/(long)standardsNum));
carReviewTask.setPerson(relationList.size());
List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
for(ReviewKeyPoint keyPoint : keyPointList) {
details.addAll(keyPoint.getReviewDetailsList());
}
return details;
}
private boolean detailsIsPass(ReviewDetails reviewDetails, Map<Long, ReviewDetailsResult> resultMap) {
ReviewDetailsResult result = resultMap.get(reviewDetails.getId());
return result.getPassed() == 1;
}
@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