Commit 5bd7f4c2 authored by wdy's avatar wdy

Merge branch 'wangdingyi' into 'dev'

问卷数据统计

See merge request !153
parents 4077aff2 ba84491b
......@@ -153,7 +153,6 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("问卷签名图片地址")
private String imagesUrl;
@TableField(exist = false)
@ApiModelProperty("审查细则(条)")
private Integer details;
......@@ -161,7 +160,6 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("审查细则符合率")
private Double detailsPass;
@TableField(exist = false)
@ApiModelProperty("标准条款(条)")
private Integer standards;
......
......@@ -157,7 +157,6 @@ public class SystemReviewTask {
@ApiModelProperty("签名图片地址")
private String imagesUrl;
@TableField(exist = false)
@ApiModelProperty("审查细则(条)")
private Integer details;
......@@ -165,7 +164,6 @@ public class SystemReviewTask {
@ApiModelProperty("审查细则符合率")
private Double detailsPass;
@TableField(exist = false)
@ApiModelProperty("标准条款(条)")
private Integer standards;
......
package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
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.web.response.CarReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
......@@ -11,7 +19,13 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
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
@Service
......@@ -23,6 +37,18 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi
@Autowired
private ApplicationContext applicationContext;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Autowired
private TaskMapper taskMapper;
// FINISH状态下
// 1.standard字段使用task中归档的问卷
......@@ -32,6 +58,15 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi
public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) {
CarReviewTaskViewResponse response = new CarReviewTaskViewResponse();
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;
}
......@@ -50,6 +85,19 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi
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
public void afterPropertiesSet() throws Exception {
strategyCarReviewTaskContext.putResource(CarReviewTask.TASK_STATUS_FINISH, applicationContext.getBean(this.getClass()));
......
......@@ -198,6 +198,8 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
carReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
carReviewTask.setPerson(relationList.size());
carReviewTaskMapper.updateById(carReviewTask);
}
......
package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.mapper.*;
import com.ruoyi.service.ReviewDetailsResultService;
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.DataStatisticsResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
......@@ -22,12 +21,15 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.swing.table.TableModel;
import java.math.BigDecimal;
import java.util.Date;
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
@Service
public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, InitializingBean {
......@@ -47,6 +49,15 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
@Autowired
private TaskStateFacade taskStateFacade;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
// SIGNED状态下
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
......@@ -55,7 +66,18 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) {
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");
// 获取问卷
List<ReviewStandard> carStandardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
// 获取当前问卷答案
List<ReviewDetailsResult> carResults = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
// 车型审查
setCarDataStatistics(carStandardTree,carResults,carReviewTask);
response.setCarReviewTask(carReviewTask);
return response;
}
......@@ -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
public void afterPropertiesSet() throws Exception {
......
package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
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.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.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
......@@ -11,7 +19,11 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Transactional
@Service
......@@ -22,6 +34,18 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask,
@Autowired
private ApplicationContext applicationContext;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Autowired
private TaskMapper taskMapper;
@Override
public void doStart(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能开始一个已完成的任务", HttpStatus.ERROR);
......@@ -50,11 +74,34 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask,
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
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);
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
public void afterPropertiesSet() throws Exception {
strategySystemReviewTaskContext.putResource(SystemReviewTask.STATUS_FINISH, applicationContext.getBean(this.getClass()));
......
......@@ -194,6 +194,8 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
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());
systemReviewTaskMapper.updateById(systemReviewTask);
}
......
package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.mapper.*;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategySystemReviewTask;
import com.ruoyi.web.response.DataStatisticsResponse;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -21,6 +20,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -46,6 +46,15 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
@Autowired
private TaskStateFacade taskStateFacade;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Override
public void doStart(SystemReviewTask systemReviewTask) {
......@@ -97,11 +106,33 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
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");
// 获取问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
// 获取当前问卷答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 体系审查
setSystemDataStatistics(standardTree,results,systemReviewTask);
response.setSystemReviewTask(systemReviewTask);
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
public void afterPropertiesSet() throws Exception {
......
......@@ -24,6 +24,8 @@
<result property="submitId" column="submit_id" jdbcType="BIGINT"/>
<result property="submitName" column="submit_name" 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>
<sql id="Base_Column_List">
......@@ -38,18 +40,18 @@
images_url
</sql>
<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'
</select>
<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}
</select>
<select id="findByDetailsResult" resultType="com.ruoyi.domain.CarReviewTask">
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.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
LEFT JOIN t_review_details_result trdr ON tr.id = trdr.task_id
WHERE trdr.review_details_id = #{detailId} and tr.task_status = 'PENDING'
......
......@@ -24,16 +24,18 @@
<result property="submitById" column="submit_by_id" jdbcType="BIGINT"/>
<result property="submitByName" column="submit_by_name" 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>
<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}
ORDER BY create_time DESC
</select>
<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')
ORDER BY create_time DESC
</select>
......@@ -41,7 +43,7 @@
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.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
LEFT JOIN t_review_details_result trdr ON ts.id = trdr.task_id
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