Commit c484370a authored by wdy's avatar wdy

问卷数据统计

parent dcc9db2f
...@@ -153,7 +153,6 @@ public class CarReviewTask implements Serializable { ...@@ -153,7 +153,6 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("问卷签名图片地址") @ApiModelProperty("问卷签名图片地址")
private String imagesUrl; private String imagesUrl;
@TableField(exist = false)
@ApiModelProperty("审查细则(条)") @ApiModelProperty("审查细则(条)")
private Integer details; private Integer details;
...@@ -161,7 +160,6 @@ public class CarReviewTask implements Serializable { ...@@ -161,7 +160,6 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("审查细则符合率") @ApiModelProperty("审查细则符合率")
private Double detailsPass; private Double detailsPass;
@TableField(exist = false)
@ApiModelProperty("标准条款(条)") @ApiModelProperty("标准条款(条)")
private Integer standards; private Integer standards;
......
...@@ -157,7 +157,6 @@ public class SystemReviewTask { ...@@ -157,7 +157,6 @@ public class SystemReviewTask {
@ApiModelProperty("签名图片地址") @ApiModelProperty("签名图片地址")
private String imagesUrl; private String imagesUrl;
@TableField(exist = false)
@ApiModelProperty("审查细则(条)") @ApiModelProperty("审查细则(条)")
private Integer details; private Integer details;
...@@ -165,7 +164,6 @@ public class SystemReviewTask { ...@@ -165,7 +164,6 @@ public class SystemReviewTask {
@ApiModelProperty("审查细则符合率") @ApiModelProperty("审查细则符合率")
private Double detailsPass; private Double detailsPass;
@TableField(exist = false)
@ApiModelProperty("标准条款(条)") @ApiModelProperty("标准条款(条)")
private Integer standards; private Integer standards;
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.CarReviewTask; import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.domain.ReviewDetailsResult;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.domain.TaskUserRelation;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.mapper.TaskUserRelationMapper;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategyCarReviewTask; import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.web.response.CarReviewTaskViewResponse; import com.ruoyi.web.response.CarReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
...@@ -11,7 +19,13 @@ import org.springframework.context.ApplicationContext; ...@@ -11,7 +19,13 @@ 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.List; import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.ruoyi.common.DataStatisticsUtils.calculateStandardsPass;
@Transactional @Transactional
@Service @Service
...@@ -23,6 +37,18 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi ...@@ -23,6 +37,18 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi
@Autowired @Autowired
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Autowired
private TaskMapper taskMapper;
// FINISH状态下 // FINISH状态下
// 1.standard字段使用task中归档的问卷 // 1.standard字段使用task中归档的问卷
...@@ -32,6 +58,15 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi ...@@ -32,6 +58,15 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi
public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) { public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) {
CarReviewTaskViewResponse response = new CarReviewTaskViewResponse(); CarReviewTaskViewResponse response = new CarReviewTaskViewResponse();
response.setCarReviewTask(carReviewTask); response.setCarReviewTask(carReviewTask);
// 获取问卷
List<ReviewStandard> carStandardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
// 获取当前问卷答案
List<ReviewDetailsResult> carResults = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
// 车型审查
setCarDataStatistics(carStandardTree,carResults,carReviewTask);
return response; return response;
} }
...@@ -50,6 +85,19 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi ...@@ -50,6 +85,19 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi
throw new ServiceException("不能提交一个结束的任务", HttpStatus.ERROR); throw new ServiceException("不能提交一个结束的任务", HttpStatus.ERROR);
} }
private void setCarDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results, CarReviewTask carReviewTask) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
BigDecimal standardPass = new BigDecimal(calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards());
carReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
BigDecimal detailsPass = new BigDecimal(DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) carReviewTask.getDetails());
carReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
carReviewTask.setPerson(relationList.size());
}
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
strategyCarReviewTaskContext.putResource(CarReviewTask.TASK_STATUS_FINISH, applicationContext.getBean(this.getClass())); strategyCarReviewTaskContext.putResource(CarReviewTask.TASK_STATUS_FINISH, applicationContext.getBean(this.getClass()));
......
...@@ -198,6 +198,8 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -198,6 +198,8 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
carReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100); carReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
carReviewTask.setPerson(relationList.size()); carReviewTask.setPerson(relationList.size());
carReviewTaskMapper.updateById(carReviewTask);
} }
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
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.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.*; import com.ruoyi.domain.*;
import com.ruoyi.mapper.CarReviewTaskMapper; import com.ruoyi.mapper.*;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.service.ReviewDetailsResultService; import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewSceneChangeTaskService; import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.service.ReviewStandardService; import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategyCarReviewTask; import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.web.response.CarReviewTaskViewResponse; import com.ruoyi.web.response.CarReviewTaskViewResponse;
import com.ruoyi.web.response.DataStatisticsResponse;
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;
...@@ -22,12 +21,15 @@ import org.springframework.stereotype.Service; ...@@ -22,12 +21,15 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.swing.table.TableModel; import javax.swing.table.TableModel;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.ruoyi.common.DataStatisticsUtils.calculateStandardsPass;
@Transactional @Transactional
@Service @Service
public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, InitializingBean { public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, InitializingBean {
...@@ -47,6 +49,15 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi ...@@ -47,6 +49,15 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
@Autowired @Autowired
private TaskStateFacade taskStateFacade; private TaskStateFacade taskStateFacade;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
// SIGNED状态下 // SIGNED状态下
// 1.standard字段使用task中归档的问卷 // 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务 // 2.不查询场景变更任务
...@@ -55,7 +66,18 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi ...@@ -55,7 +66,18 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) { public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) {
CarReviewTaskViewResponse response = new CarReviewTaskViewResponse(); CarReviewTaskViewResponse response = new CarReviewTaskViewResponse();
carReviewTask.setImagesUrl("/vehicle-quality-review-oss/2024/03/04/qianzi1_20240304104011A001.jpg,/vehicle-quality-review-oss/2024/03/04/qianzi2_20240304104121A002.jpg"); carReviewTask.setImagesUrl("/vehicle-quality-review-oss/2024/03/04/qianzi1_20240304104011A001.jpg,/vehicle-quality-review-oss/2024/03/04/qianzi2_20240304104121A002.jpg");
// 获取问卷
List<ReviewStandard> carStandardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
// 获取当前问卷答案
List<ReviewDetailsResult> carResults = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
// 车型审查
setCarDataStatistics(carStandardTree,carResults,carReviewTask);
response.setCarReviewTask(carReviewTask); response.setCarReviewTask(carReviewTask);
return response; return response;
} }
...@@ -97,6 +119,19 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi ...@@ -97,6 +119,19 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
} }
private void setCarDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results, CarReviewTask carReviewTask) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
BigDecimal standardPass = new BigDecimal(calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards());
carReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
BigDecimal detailsPass = new BigDecimal(DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) carReviewTask.getDetails());
carReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
carReviewTask.setPerson(relationList.size());
}
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.ReviewDetailsResult;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.domain.SystemReviewTask; import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.domain.TaskUserRelation;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.mapper.TaskUserRelationMapper;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategySystemReviewTask; import com.ruoyi.service.StrategySystemReviewTask;
import com.ruoyi.web.response.SystemReviewTaskViewResponse; import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
...@@ -11,7 +19,11 @@ import org.springframework.context.ApplicationContext; ...@@ -11,7 +19,11 @@ 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.List; import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Transactional @Transactional
@Service @Service
...@@ -22,6 +34,18 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask, ...@@ -22,6 +34,18 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask,
@Autowired @Autowired
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Autowired
private TaskMapper taskMapper;
@Override @Override
public void doStart(SystemReviewTask systemReviewTask) { public void doStart(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能开始一个已完成的任务", HttpStatus.ERROR); throw new ServiceException("不能开始一个已完成的任务", HttpStatus.ERROR);
...@@ -50,11 +74,34 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask, ...@@ -50,11 +74,34 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask,
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) { public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse(); SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
// 获取问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
// 获取当前问卷答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 体系审查
setSystemDataStatistics(standardTree,results,systemReviewTask);
response.setSystemReviewTask(systemReviewTask); response.setSystemReviewTask(systemReviewTask);
return response; return response;
} }
private void setSystemDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results, SystemReviewTask systemReviewTask) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()));
BigDecimal standardPass = new BigDecimal(DataStatisticsUtils.calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards());
systemReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
BigDecimal detailsPass = new BigDecimal(DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails());
systemReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
systemReviewTask.setPerson(relationList.size());
}
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
strategySystemReviewTaskContext.putResource(SystemReviewTask.STATUS_FINISH, applicationContext.getBean(this.getClass())); strategySystemReviewTaskContext.putResource(SystemReviewTask.STATUS_FINISH, applicationContext.getBean(this.getClass()));
......
...@@ -194,6 +194,8 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -194,6 +194,8 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
BigDecimal detailsPass = new BigDecimal(DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails()); BigDecimal detailsPass = new BigDecimal(DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails());
systemReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100); systemReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
systemReviewTask.setPerson(relationList.size()); systemReviewTask.setPerson(relationList.size());
systemReviewTaskMapper.updateById(systemReviewTask);
} }
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
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.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.*; import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsMapper; import com.ruoyi.mapper.*;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.service.ReviewDetailsResultService; import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewSceneChangeTaskService; import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.service.ReviewStandardService; import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategySystemReviewTask; import com.ruoyi.service.StrategySystemReviewTask;
import com.ruoyi.web.response.DataStatisticsResponse;
import com.ruoyi.web.response.SystemReviewTaskViewResponse; import com.ruoyi.web.response.SystemReviewTaskViewResponse;
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;
...@@ -21,6 +20,7 @@ import org.springframework.context.ApplicationContext; ...@@ -21,6 +20,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.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -46,6 +46,15 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask, ...@@ -46,6 +46,15 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
@Autowired @Autowired
private TaskStateFacade taskStateFacade; private TaskStateFacade taskStateFacade;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Override @Override
public void doStart(SystemReviewTask systemReviewTask) { public void doStart(SystemReviewTask systemReviewTask) {
...@@ -97,11 +106,33 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask, ...@@ -97,11 +106,33 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) { public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse(); SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
systemReviewTask.setImagesUrl("/vehicle-quality-review-oss/2024/03/04/qianzi1_20240304104011A001.jpg,/vehicle-quality-review-oss/2024/03/04/qianzi2_20240304104121A002.jpg"); systemReviewTask.setImagesUrl("/vehicle-quality-review-oss/2024/03/04/qianzi1_20240304104011A001.jpg,/vehicle-quality-review-oss/2024/03/04/qianzi2_20240304104121A002.jpg");
// 获取问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
// 获取当前问卷答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 体系审查
setSystemDataStatistics(standardTree,results,systemReviewTask);
response.setSystemReviewTask(systemReviewTask); response.setSystemReviewTask(systemReviewTask);
return response; return response;
} }
private void setSystemDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results, SystemReviewTask systemReviewTask) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()));
BigDecimal standardPass = new BigDecimal(DataStatisticsUtils.calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards());
systemReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
BigDecimal detailsPass = new BigDecimal(DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails());
systemReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
systemReviewTask.setPerson(relationList.size());
}
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
<result property="submitId" column="submit_id" jdbcType="BIGINT"/> <result property="submitId" column="submit_id" jdbcType="BIGINT"/>
<result property="submitName" column="submit_name" jdbcType="VARCHAR"/> <result property="submitName" column="submit_name" jdbcType="VARCHAR"/>
<result property="imagesUrl" column="images_url" jdbcType="VARCHAR"/> <result property="imagesUrl" column="images_url" jdbcType="VARCHAR"/>
<result property="details" column="details" jdbcType="INTEGER"/>
<result property="standards" column="standards" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -38,18 +40,18 @@ ...@@ -38,18 +40,18 @@
images_url images_url
</sql> </sql>
<select id="findListByReviewStatus" resultType="com.ruoyi.domain.CarReviewTask"> <select id="findListByReviewStatus" resultType="com.ruoyi.domain.CarReviewTask">
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,create_time,leader_id,leader,standard_id,name,standard_no,file,submit_id,submit_name,images_url SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,create_time,leader_id,leader,standard_id,name,standard_no,file,submit_id,submit_name,images_url,details,standards
FROM t_car_review_task WHERE review_status = #{reviewStatus} AND task_status = 'PENDING' FROM t_car_review_task WHERE review_status = #{reviewStatus} AND task_status = 'PENDING'
</select> </select>
<select id="findListByTaskStatus" resultType="com.ruoyi.domain.CarReviewTask"> <select id="findListByTaskStatus" resultType="com.ruoyi.domain.CarReviewTask">
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,create_time,leader_id,leader,standard_id,name,standard_no,file,submit_id,submit_name,images_url SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,create_time,leader_id,leader,standard_id,name,standard_no,file,submit_id,submit_name,images_url,details,standards
FROM t_car_review_task WHERE task_status = #{taskStatus} FROM t_car_review_task WHERE task_status = #{taskStatus}
</select> </select>
<select id="findByDetailsResult" resultType="com.ruoyi.domain.CarReviewTask"> <select id="findByDetailsResult" resultType="com.ruoyi.domain.CarReviewTask">
SELECT tr.id,tr.task_no,tr.task_status,tr.task_initiator,tr.task_initiator_dept, SELECT tr.id,tr.task_no,tr.task_status,tr.task_initiator,tr.task_initiator_dept,
tr.task_result,tr.task_begin_time,tr.task_end_time,tr.standard,tr.create_time, tr.task_result,tr.task_begin_time,tr.task_end_time,tr.standard,tr.create_time,
tr.leader_id,tr.leader,tr.standard_id,tr.name,tr.standard_no,tr.file,tr.submit_id, tr.leader_id,tr.leader,tr.standard_id,tr.name,tr.standard_no,tr.file,tr.submit_id,
tr.submit_name,tr.images_url tr.submit_name,tr.images_url,tr.details,tr.standards
FROM t_car_review_task tr FROM t_car_review_task tr
LEFT JOIN t_review_details_result trdr ON tr.id = trdr.task_id LEFT JOIN t_review_details_result trdr ON tr.id = trdr.task_id
WHERE trdr.review_details_id = #{detailId} and tr.task_status = 'PENDING' WHERE trdr.review_details_id = #{detailId} and tr.task_status = 'PENDING'
......
...@@ -24,16 +24,18 @@ ...@@ -24,16 +24,18 @@
<result property="submitById" column="submit_by_id" jdbcType="BIGINT"/> <result property="submitById" column="submit_by_id" jdbcType="BIGINT"/>
<result property="submitByName" column="submit_by_name" jdbcType="VARCHAR"/> <result property="submitByName" column="submit_by_name" jdbcType="VARCHAR"/>
<result property="imagesUrl" column="images_url" jdbcType="VARCHAR"/> <result property="imagesUrl" column="images_url" jdbcType="VARCHAR"/>
<result property="details" column="details" jdbcType="INTEGER"/>
<result property="standards" column="standards" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<select id="findListByStatus" resultMap="BaseResultMap"> <select id="findListByStatus" resultMap="BaseResultMap">
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, create_time,leader,leader_id, standard_id, name, standard_no, file, submit_by_id, submit_by_name,images_url SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, create_time,leader,leader_id, standard_id, name, standard_no, file, submit_by_id, submit_by_name,images_url,details,standards
FROM t_system_review_task WHERE task_status = #{status} FROM t_system_review_task WHERE task_status = #{status}
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
<select id="findListInProcess" resultMap="BaseResultMap"> <select id="findListInProcess" resultMap="BaseResultMap">
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, create_time,leader,leader_id, standard_id, name, standard_no, file, submit_by_id, submit_by_name,images_url SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, create_time,leader,leader_id, standard_id, name, standard_no, file, submit_by_id, submit_by_name,images_url,details,standards
FROM t_system_review_task WHERE task_status IN ('NEW','PENDING') FROM t_system_review_task WHERE task_status IN ('NEW','PENDING')
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
...@@ -41,7 +43,7 @@ ...@@ -41,7 +43,7 @@
SELECT ts.id, ts.task_no, ts.task_status, ts.task_initiator, ts.task_initiator_dept, SELECT ts.id, ts.task_no, ts.task_status, ts.task_initiator, ts.task_initiator_dept,
ts.task_result, ts.task_begin_time, ts.task_end_time, ts.standard, ts.create_time, ts.task_result, ts.task_begin_time, ts.task_end_time, ts.standard, ts.create_time,
ts.leader,ts.leader_id, ts.standard_id, ts.name, ts.standard_no, ts.file, ts.submit_by_id, ts.leader,ts.leader_id, ts.standard_id, ts.name, ts.standard_no, ts.file, ts.submit_by_id,
ts.submit_by_name,ts.images_url ts.submit_by_name,ts.images_url,ts.details,ts.standards
FROM t_system_review_task ts FROM t_system_review_task ts
LEFT JOIN t_review_details_result trdr ON ts.id = trdr.task_id LEFT JOIN t_review_details_result trdr ON ts.id = trdr.task_id
WHERE trdr.review_details_id = #{detailId} and ts.task_status = 'PENDING' WHERE trdr.review_details_id = #{detailId} and ts.task_status = 'PENDING'
......
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