Commit 0d930ed5 authored by 王飞's avatar 王飞

Merge branch 'wangdingyi' into 'dev'

任务数据统计

See merge request !113
parents 070f8e7d da15b7f2
...@@ -153,4 +153,24 @@ public class CarReviewTask implements Serializable { ...@@ -153,4 +153,24 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("问卷签名图片地址") @ApiModelProperty("问卷签名图片地址")
private String imagesUrl; private String imagesUrl;
@TableField(exist = false)
@ApiModelProperty("审查细则(条)")
private Integer details;
@TableField(exist = false)
@ApiModelProperty("审查细则符合率")
private Long detailsPass;
@TableField(exist = false)
@ApiModelProperty("标准条款(条)")
private Integer standards;
@TableField(exist = false)
@ApiModelProperty("标准条款通过率")
private Long standardsPass;
@TableField(exist = false)
@ApiModelProperty("参与审查人数(人)")
private Integer person;
} }
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.*; import com.ruoyi.domain.*;
import com.ruoyi.mapper.*; import com.ruoyi.mapper.*;
import com.ruoyi.service.ReviewDetailsResultService; import com.ruoyi.service.*;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.web.response.CarReviewTaskViewResponse; import com.ruoyi.web.response.CarReviewTaskViewResponse;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
...@@ -65,6 +64,18 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -65,6 +64,18 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
@Autowired @Autowired
private ReviewEnterpriseArchiveMapper reviewEnterpriseArchiveMapper; private ReviewEnterpriseArchiveMapper reviewEnterpriseArchiveMapper;
@Autowired
private ReviewKeyPointService reviewKeyPointService;
@Autowired
private ReviewDetailsService reviewDetailsService;
@Autowired
private ReviewStandardMapper reviewStandardMapper;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
// PENDING状态下 // PENDING状态下
// 1.standard字段查询当前最新问卷 // 1.standard字段查询当前最新问卷
// 2.查询场景变更任务 // 2.查询场景变更任务
...@@ -74,6 +85,30 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -74,6 +85,30 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
// 获取最新问卷 // 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR); List<ReviewStandard> standardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
List<ReviewStandard> reviewStandardList = reviewStandardMapper.findListByStandardIdAndType(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR); // 查询审查标准
List<ReviewKeyPoint> reviewKeyPointList = reviewKeyPointService.findByStandardList(reviewStandardList); // 查询审查要点
List<ReviewDetails> reivewDetailsList = reviewDetailsService.findByKeyPointsList(reviewKeyPointList); // 查询审查细则
// for(ReviewStandard standard : standardTree) {
// standard.setPassed(0);
// 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());
// standardsPassNum ++;
// detailsPassNum ++;
// }
// }
// }
// }
// 获取当前问卷答案 // 获取当前问卷答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(carReviewTask.getId()); List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
...@@ -91,7 +126,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -91,7 +126,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
} }
// 绑定问卷与答案 // 绑定问卷与答案
setDetailsResult(standardTree, results); setDetailsResult(standardTree, results,carReviewTask);
// 赋值给任务 // 赋值给任务
carReviewTask.setStandard(standardTree); carReviewTask.setStandard(standardTree);
...@@ -129,7 +164,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -129,7 +164,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(carReviewTask.getId()); List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
// 3. 将最终问卷归档到 standard 字段 // 3. 将最终问卷归档到 standard 字段
setDetailsResult(standardTree, results); setDetailsResult(standardTree, results,carReviewTask);
carReviewTask.setStandard(standardTree); carReviewTask.setStandard(standardTree);
// 4. 修改任务状态为 SIGNED 待签字 // 4. 修改任务状态为 SIGNED 待签字
...@@ -152,21 +187,38 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -152,21 +187,38 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
} }
private void setDetailsResult(List<ReviewStandard> standards, List<ReviewDetailsResult> results) { private void setDetailsResult(List<ReviewStandard> standards, List<ReviewDetailsResult> results, 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));
//审查细则(条)
int detailsNum = 0;
//审查细则符合数
int detailsPassNum = 0;
//标准条款(条)
int standardsNum = 0;
//标准条款通过数
int standardsPassNum = 0;
for(ReviewStandard standard : standards) { for(ReviewStandard standard : standards) {
standard.setPassed(0); standard.setPassed(1);
standardsNum ++;
List<ReviewKeyPoint> keyPointList = standard.getKeyPointList(); List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
for(ReviewKeyPoint keypoint : keyPointList) { for(ReviewKeyPoint keypoint : keyPointList) {
List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList(); List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList();
for(ReviewDetails details : reviewDetailsList) { for(ReviewDetails details : reviewDetailsList) {
detailsNum ++;
ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId()); ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
if(reviewDetailsResult != null && reviewDetailsResult.getPassed() != 0) { if(reviewDetailsResult == null || reviewDetailsResult.getPassed() == 0) {
standard.setPassed(reviewDetailsResult.getPassed()); standard.setPassed(reviewDetailsResult.getPassed());
detailsPassNum ++;
standardsPassNum ++;
} }
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) { if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId()); ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
...@@ -176,6 +228,16 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -176,6 +228,16 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
} }
} }
} }
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
carReviewTask.setDetails(detailsNum);
carReviewTask.setDetailsPass(((long)detailsPassNum/(long)detailsNum));
carReviewTask.setStandards(standardsNum);
carReviewTask.setStandardsPass(((long)standardsPassNum/(long)standardsNum));
carReviewTask.setPerson(relationList.size());
} }
@Override @Override
......
...@@ -160,7 +160,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -160,7 +160,7 @@ 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));
for(ReviewStandard standard : standards) { for(ReviewStandard standard : standards) {
standard.setPassed(0); standard.setPassed(1);
List<ReviewKeyPoint> keyPointList = standard.getKeyPointList(); List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
for(ReviewKeyPoint keypoint : keyPointList) { for(ReviewKeyPoint keypoint : keyPointList) {
...@@ -168,8 +168,8 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -168,8 +168,8 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
for(ReviewDetails details : reviewDetailsList) { for(ReviewDetails details : reviewDetailsList) {
ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId()); ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
if(reviewDetailsResult != null && reviewDetailsResult.getPassed() != 0) { if(reviewDetailsResult == null || reviewDetailsResult.getPassed() == 0) {
standard.setPassed(reviewDetailsResult.getPassed()); standard.setPassed(0);
} }
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) { if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId()); ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
......
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