Commit de922c7c authored by 盖献康's avatar 盖献康

Merge branch 'dev' of...

Merge branch 'dev' of ssh://gitlab.91isoft.com:10022/wangfei/vehicle-quality-review into gaixiankang
parents 6cc681b4 6cc9875b
...@@ -62,8 +62,8 @@ public class DataStatisticsUtils { ...@@ -62,8 +62,8 @@ public class DataStatisticsUtils {
isPass = false; isPass = false;
} }
if(passed == ReviewStandard.PASSED) { if(passed == ReviewStandard.NO_PASSED) {
isPass = false; isPass = true;
} }
......
...@@ -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;
...@@ -173,4 +171,8 @@ public class CarReviewTask implements Serializable { ...@@ -173,4 +171,8 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("参与审查人数(人)") @ApiModelProperty("参与审查人数(人)")
private Integer person; private Integer person;
@TableField(exist = false)
@ApiModelProperty("企业名称")
private String enterpriseName;
} }
...@@ -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;
...@@ -177,4 +175,8 @@ public class SystemReviewTask { ...@@ -177,4 +175,8 @@ public class SystemReviewTask {
@ApiModelProperty("参与审查人数(人)") @ApiModelProperty("参与审查人数(人)")
private Integer person; private Integer person;
@TableField(exist = false)
@ApiModelProperty("企业名称")
private String enterpriseName;
} }
...@@ -20,7 +20,7 @@ public interface ReviewDetailsMapper extends BaseMapper<ReviewDetails> { ...@@ -20,7 +20,7 @@ public interface ReviewDetailsMapper extends BaseMapper<ReviewDetails> {
*/ */
List<ReviewDetails> findNoResult(@Param("taskId") Long taskId, @Param("type") String type); List<ReviewDetails> findNoResult(@Param("taskId") Long taskId, @Param("type") String type);
Long count (@Param("taskId")Long taskId, @Param("type")String type); Double count (@Param("taskId")Long taskId, @Param("type")String type);
// 根据要点id查询细则列表 // 根据要点id查询细则列表
List<ReviewDetails> findByKeyPointId(@Param("keyPointId") Long keyPointId); List<ReviewDetails> findByKeyPointId(@Param("keyPointId") Long keyPointId);
......
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())*100);
carReviewTask.setStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
BigDecimal detailsPass = new BigDecimal((DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) carReviewTask.getDetails())*100);
carReviewTask.setDetailsPass(detailsPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
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()));
......
...@@ -108,9 +108,16 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -108,9 +108,16 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
// 查询场景变更任务便于提醒用户场景变动 // 查询场景变更任务便于提醒用户场景变动
List<ReviewSceneChangeTask> lastChanges = reviewSceneChangeTaskService.findLastChangeByTaskId(carReviewTask.getId()); List<ReviewSceneChangeTask> lastChanges = reviewSceneChangeTaskService.findLastChangeByTaskId(carReviewTask.getId());
List<TaskSampleRelation> sampleRelations = taskSampleRelationMapper.selectByTaskId(taskMapper.findByCarReviewTaskId(carReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
carReviewTask.setEnterpriseName(sample.getManufacturingEnterprise());
// 构建返回结果 // 构建返回结果
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");
response.setCarReviewTask(carReviewTask); response.setCarReviewTask(carReviewTask);
response.setReviewSceneChangeTasks(lastChanges); response.setReviewSceneChangeTasks(lastChanges);
...@@ -127,7 +134,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -127,7 +134,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(carReviewTask.getId(),CarReviewTask.TYPE); List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(carReviewTask.getId(),CarReviewTask.TYPE);
List<ReviewTaskInbox> inboxList = reviewTaskInboxMapper.findConfirmListByTaskId(carReviewTask.getId()); List<ReviewTaskInbox> inboxList = reviewTaskInboxMapper.findConfirmListByTaskId(carReviewTask.getId());
if (detailsList.size() != 0 && detailsList != null) { if (detailsList.size() != 0 && detailsList != null) {
throw new ServiceException("存在未填写的问卷,请填写完整", HttpStatus.ERROR, detailsList); throw new ServiceException("存在未填写的表单,请填写完整", HttpStatus.ERROR, detailsList);
} else if (inboxList.size() != 0 && inboxList != null){ } else if (inboxList.size() != 0 && inboxList != null){
throw new ServiceException("存在未确认的场景变更信息,请确认", HttpStatus.ERROR); throw new ServiceException("存在未确认的场景变更信息,请确认", HttpStatus.ERROR);
}else { }else {
...@@ -190,13 +197,15 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -190,13 +197,15 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId())); List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
carReviewTask.setStandards(DataStatisticsUtils.calculateStandards(standards)); carReviewTask.setStandards(DataStatisticsUtils.calculateStandards(standards));
BigDecimal standardPass = new BigDecimal(calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards()); BigDecimal standardPass = new BigDecimal((calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards())*100);
carReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100); carReviewTask.setStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
carReviewTask.setDetails(DataStatisticsUtils.calculateDetails(standards)); carReviewTask.setDetails(DataStatisticsUtils.calculateDetails(standards));
BigDecimal detailsPass = new BigDecimal(DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) carReviewTask.getDetails()); BigDecimal detailsPass = new BigDecimal((DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) carReviewTask.getDetails())*100);
carReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100); carReviewTask.setDetailsPass(detailsPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
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.不查询场景变更任务
...@@ -54,7 +65,19 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi ...@@ -54,7 +65,19 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
@Override @Override
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");
// 获取问卷
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;
} }
...@@ -96,6 +119,19 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi ...@@ -96,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())*100);
carReviewTask.setStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
BigDecimal detailsPass = new BigDecimal((DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) carReviewTask.getDetails())*100);
carReviewTask.setDetailsPass(detailsPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
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())*100);
systemReviewTask.setStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
BigDecimal detailsPass = new BigDecimal((DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails())*100);
systemReviewTask.setDetailsPass(detailsPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
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()));
......
...@@ -88,7 +88,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -88,7 +88,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(systemReviewTask.getId(),SystemReviewTask.TYPE); List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(systemReviewTask.getId(),SystemReviewTask.TYPE);
List<ReviewTaskInbox> inboxList = reviewTaskInboxMapper.findConfirmListByTaskId(systemReviewTask.getId()); List<ReviewTaskInbox> inboxList = reviewTaskInboxMapper.findConfirmListByTaskId(systemReviewTask.getId());
if (detailsList.size() != 0 && detailsList != null) { if (detailsList.size() != 0 && detailsList != null) {
throw new ServiceException("存在未填写的问卷,请填写完整", HttpStatus.ERROR, detailsList); throw new ServiceException("存在未填写的表单,请填写完整", HttpStatus.ERROR, detailsList);
} else if (inboxList.size() != 0 && inboxList != null){ } else if (inboxList.size() != 0 && inboxList != null){
throw new ServiceException("存在未确认的场景变更信息,请确认", HttpStatus.ERROR); throw new ServiceException("存在未确认的场景变更信息,请确认", HttpStatus.ERROR);
} else { } else {
...@@ -151,8 +151,16 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -151,8 +151,16 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
// 查询场景变更任务便于提醒用户场景变动 // 查询场景变更任务便于提醒用户场景变动
List<ReviewSceneChangeTask> lastChanges = reviewSceneChangeTaskService.findLastChangeByTaskId(systemReviewTask.getId()); List<ReviewSceneChangeTask> lastChanges = reviewSceneChangeTaskService.findLastChangeByTaskId(systemReviewTask.getId());
List<TaskSampleRelation> sampleRelations = taskSampleRelationMapper.selectByTaskId(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
systemReviewTask.setEnterpriseName(sample.getManufacturingEnterprise());
// 构建返回结果 // 构建返回结果
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");
response.setSystemReviewTask(systemReviewTask); response.setSystemReviewTask(systemReviewTask);
response.setReviewSceneChangeTasks(lastChanges); response.setReviewSceneChangeTasks(lastChanges);
...@@ -187,12 +195,14 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -187,12 +195,14 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId())); List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()));
systemReviewTask.setStandards(DataStatisticsUtils.calculateStandards(standards)); systemReviewTask.setStandards(DataStatisticsUtils.calculateStandards(standards));
BigDecimal standardPass = new BigDecimal(DataStatisticsUtils.calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards()); BigDecimal standardPass = new BigDecimal((DataStatisticsUtils.calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards())*100);
systemReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100); systemReviewTask.setStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
systemReviewTask.setDetails(DataStatisticsUtils.calculateDetails(standards)); systemReviewTask.setDetails(DataStatisticsUtils.calculateDetails(standards));
BigDecimal detailsPass = new BigDecimal(DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails()); BigDecimal detailsPass = new BigDecimal((DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails())*100);
systemReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100); systemReviewTask.setDetailsPass(detailsPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
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) {
...@@ -96,11 +105,34 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask, ...@@ -96,11 +105,34 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
@Override @Override
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");
// 获取问卷
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())*100);
systemReviewTask.setStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
BigDecimal detailsPass = new BigDecimal((DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails())*100);
systemReviewTask.setDetailsPass(detailsPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
systemReviewTask.setPerson(relationList.size());
}
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
......
...@@ -180,10 +180,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -180,10 +180,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
List<TaskFindResponse> responses = taskMapper.findPending(request); List<TaskFindResponse> responses = taskMapper.findPending(request);
for (TaskFindResponse response : responses) { for (TaskFindResponse response : responses) {
if (response.getSystemReviewTaskId() != null) { if (response.getSystemReviewTaskId() != null) {
response.setSystemReview(reviewDetailsMapper.count(response.getSystemReviewTaskId(),SystemReviewTask.TYPE)); BigDecimal num = new BigDecimal(((double)reviewDetailsMapper.count(response.getSystemReviewTaskId(),SystemReviewTask.TYPE))* 100);
response.setSystemReview(num.setScale(1,BigDecimal.ROUND_UP).doubleValue() );
} }
if (response.getCarReviewTaskId() != null) { if (response.getCarReviewTaskId() != null) {
response.setCarReview(reviewDetailsMapper.count(response.getCarReviewTaskId(),CarReviewTask.TYPE)); BigDecimal num = new BigDecimal(((double)reviewDetailsMapper.count(response.getCarReviewTaskId(),CarReviewTask.TYPE)) * 100);
response.setCarReview(num.setScale(1,BigDecimal.ROUND_UP).doubleValue());
} }
} }
return responses; return responses;
...@@ -334,10 +336,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -334,10 +336,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
List<TaskFindResponse> responses = taskMapper.findByUserId(request,userId); List<TaskFindResponse> responses = taskMapper.findByUserId(request,userId);
for (TaskFindResponse response : responses) { for (TaskFindResponse response : responses) {
if (response.getSystemReviewTaskId() != null) { if (response.getSystemReviewTaskId() != null) {
response.setSystemReview(reviewDetailsMapper.count(response.getSystemReviewTaskId(),SystemReviewTask.TYPE)); response.setSystemReview((double)reviewDetailsMapper.count(response.getSystemReviewTaskId(),SystemReviewTask.TYPE));
} }
if (response.getCarReviewTaskId() != null) { if (response.getCarReviewTaskId() != null) {
response.setCarReview(reviewDetailsMapper.count(response.getCarReviewTaskId(),CarReviewTask.TYPE)); response.setCarReview((double)reviewDetailsMapper.count(response.getCarReviewTaskId(),CarReviewTask.TYPE));
} }
} }
return responses; return responses;
...@@ -582,13 +584,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -582,13 +584,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
public DataStatisticsResponse dataStatistics(TaskGetInfoRequest request) { public DataStatisticsResponse dataStatistics(TaskGetInfoRequest request) {
Task task = taskMapper.selectById(request.getId()); Task task = taskMapper.selectById(request.getId());
SystemReviewTask systemReviewTask = systemReviewTaskMapper.selectById(task.getSystemReviewTaskId());
CarReviewTask carReviewTask = carReviewTaskMapper.selectById(task.getCarReviewTaskId());
DataStatisticsResponse response = new DataStatisticsResponse(); DataStatisticsResponse response = new DataStatisticsResponse();
if (task.getSystemReviewTaskId() != null) {
SystemReviewTask systemReviewTask = systemReviewTaskMapper.selectById(task.getSystemReviewTaskId());
// 获取最新问卷 // 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM); List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
...@@ -598,6 +598,13 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -598,6 +598,13 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 体系审查 // 体系审查
setSystemDataStatistics(standardTree,results,response); setSystemDataStatistics(standardTree,results,response);
return response;
}
if (task.getCarReviewTaskId() != null) {
CarReviewTask carReviewTask = carReviewTaskMapper.selectById(task.getCarReviewTaskId());
// 获取最新问卷 // 获取最新问卷
List<ReviewStandard> carStandardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR); List<ReviewStandard> carStandardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
...@@ -608,6 +615,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -608,6 +615,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
setCarDataStatistics(carStandardTree,carResults,response); setCarDataStatistics(carStandardTree,carResults,response);
return response; return response;
}
return null;
} }
...@@ -618,14 +630,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -618,14 +630,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
response.setSystemStandardsPassNum(DataStatisticsUtils.calculateStandardsPass(standards, resultMap)); response.setSystemStandardsPassNum(DataStatisticsUtils.calculateStandardsPass(standards, resultMap));
response.setSystemStandardsNoPassNum(DataStatisticsUtils.calculateStandardsNoPass(standards, resultMap)); response.setSystemStandardsNoPassNum(DataStatisticsUtils.calculateStandardsNoPass(standards, resultMap));
response.setSystemStandardsUnderNum(response.getSystemStandards() -response.getSystemStandardsPassNum() - response.getSystemStandardsNoPassNum()); response.setSystemStandardsUnderNum(response.getSystemStandards() -response.getSystemStandardsPassNum() - response.getSystemStandardsNoPassNum());
BigDecimal standardPass = new BigDecimal(response.getSystemStandardsPassNum() / (double) response.getSystemStandards()); BigDecimal standardPass = new BigDecimal((response.getSystemStandardsPassNum() / (double) response.getSystemStandards())*100);
response.setSystemStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100); response.setSystemStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
response.setSystemDetails(DataStatisticsUtils.calculateDetails(standards)); response.setSystemDetails(DataStatisticsUtils.calculateDetails(standards));
response.setSystemDetailsPassNum(DataStatisticsUtils.calculateDetailsPass(standards, resultMap)); response.setSystemDetailsPassNum(DataStatisticsUtils.calculateDetailsPass(standards, resultMap));
response.setSystemDetailsNoPassNum(DataStatisticsUtils.calculateDetailsNoPass(standards, resultMap)); response.setSystemDetailsNoPassNum(DataStatisticsUtils.calculateDetailsNoPass(standards, resultMap));
response.setSystemDetailsUnderNum(response.getSystemDetails() - response.getSystemDetailsPassNum() - response.getSystemDetailsNoPassNum()); response.setSystemDetailsUnderNum(response.getSystemDetails() - response.getSystemDetailsPassNum() - response.getSystemDetailsNoPassNum());
BigDecimal detailsPass = new BigDecimal(response.getSystemDetailsPassNum() / (double) response.getSystemDetails()); BigDecimal detailsPass = new BigDecimal((response.getSystemDetailsPassNum() / (double) response.getSystemDetails())*100);
response.setSystemDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100); response.setSystemDetailsPass(detailsPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
} }
...@@ -636,14 +648,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -636,14 +648,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
response.setCarStandardsPassNum(DataStatisticsUtils.calculateStandardsPass(standards, resultMap)); response.setCarStandardsPassNum(DataStatisticsUtils.calculateStandardsPass(standards, resultMap));
response.setCarStandardsNoPassNum(DataStatisticsUtils.calculateStandardsNoPass(standards, resultMap)); response.setCarStandardsNoPassNum(DataStatisticsUtils.calculateStandardsNoPass(standards, resultMap));
response.setCarStandardsUnderNum(response.getCarStandards() -response.getCarStandardsPassNum() - response.getCarStandardsNoPassNum()); response.setCarStandardsUnderNum(response.getCarStandards() -response.getCarStandardsPassNum() - response.getCarStandardsNoPassNum());
BigDecimal standardPass = new BigDecimal(response.getCarStandardsPassNum() / (double) response.getCarStandards()); BigDecimal standardPass = new BigDecimal((response.getCarStandardsPassNum() / (double) response.getCarStandards())*100);
response.setCarStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100); response.setCarStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
response.setCarDetails(DataStatisticsUtils.calculateDetails(standards)); response.setCarDetails(DataStatisticsUtils.calculateDetails(standards));
response.setCarDetailsPassNum(DataStatisticsUtils.calculateDetailsPass(standards, resultMap)); response.setCarDetailsPassNum(DataStatisticsUtils.calculateDetailsPass(standards, resultMap));
response.setCarDetailsNoPassNum(DataStatisticsUtils.calculateDetailsNoPass(standards, resultMap)); response.setCarDetailsNoPassNum(DataStatisticsUtils.calculateDetailsNoPass(standards, resultMap));
response.setCarDetailsUnderNum(response.getCarDetails() - response.getCarDetailsPassNum() - response.getCarDetailsNoPassNum()); response.setCarDetailsUnderNum(response.getCarDetails() - response.getCarDetailsPassNum() - response.getCarDetailsNoPassNum());
BigDecimal detailsPass = new BigDecimal(response.getCarDetailsPassNum() / (double) response.getCarDetails()); BigDecimal detailsPass = new BigDecimal((response.getCarDetailsPassNum() / (double) response.getCarDetails())*100);
response.setCarDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100); response.setCarDetailsPass(detailsPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
} }
......
...@@ -5,8 +5,10 @@ import com.ruoyi.common.exception.ServiceException; ...@@ -5,8 +5,10 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.CarReviewTask; import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.domain.SystemReviewTask; import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.domain.Task; import com.ruoyi.domain.Task;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.mapper.ReviewDetailsMapper; import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.TaskService; import com.ruoyi.service.TaskService;
import com.ruoyi.service.TaskState; import com.ruoyi.service.TaskState;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
...@@ -16,6 +18,7 @@ import org.springframework.stereotype.Service; ...@@ -16,6 +18,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Objects;
@Transactional @Transactional
@Service @Service
...@@ -33,6 +36,12 @@ public class TaskStatePending extends TaskStateAdapter implements TaskState, Ini ...@@ -33,6 +36,12 @@ public class TaskStatePending extends TaskStateAdapter implements TaskState, Ini
@Autowired @Autowired
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
@Autowired
private SystemReviewTaskMapper systemReviewTaskMapper;
@Autowired
private CarReviewTaskMapper carReviewTaskMapper;
@Override @Override
...@@ -43,12 +52,16 @@ public class TaskStatePending extends TaskStateAdapter implements TaskState, Ini ...@@ -43,12 +52,16 @@ public class TaskStatePending extends TaskStateAdapter implements TaskState, Ini
@Override @Override
public void doSubmit(Task task) { public void doSubmit(Task task) {
long subTaskCount = 0; Double subTaskCount = 0.0;
SystemReviewTask systemReviewTask = systemReviewTaskMapper.selectById(task.getSystemReviewTaskId());
CarReviewTask carReviewTask = carReviewTaskMapper.selectById(task.getCarReviewTaskId());
if(task.getSystemReviewTaskId() != null) { if(task.getSystemReviewTaskId() != null && !Objects.equals(systemReviewTask.getTaskStatus(), SystemReviewTask.STATUS_NEW)) {
subTaskCount = reviewDetailsMapper.count(task.getSystemReviewTaskId(), SystemReviewTask.TYPE); subTaskCount = reviewDetailsMapper.count(task.getSystemReviewTaskId(), SystemReviewTask.TYPE);
} }
if(task.getCarReviewTaskId() != null) { if(task.getCarReviewTaskId() != null && !Objects.equals(carReviewTask.getTaskStatus(), CarReviewTask.TASK_STATUS_NEW)) {
subTaskCount = reviewDetailsMapper.count(task.getCarReviewTaskId(), CarReviewTask.TYPE); subTaskCount = reviewDetailsMapper.count(task.getCarReviewTaskId(), CarReviewTask.TYPE);
} }
......
...@@ -62,7 +62,7 @@ public class TaskFindResponse { ...@@ -62,7 +62,7 @@ public class TaskFindResponse {
private String reviewStatus; private String reviewStatus;
@ApiModelProperty("体系审查任务进度") @ApiModelProperty("体系审查任务进度")
private Long systemReview; private Double systemReview;
@ApiModelProperty("体系问卷任务开始时间") @ApiModelProperty("体系问卷任务开始时间")
private Date systemTaskBeginTime; private Date systemTaskBeginTime;
...@@ -74,7 +74,7 @@ public class TaskFindResponse { ...@@ -74,7 +74,7 @@ public class TaskFindResponse {
private String carReviewStatus; private String carReviewStatus;
@ApiModelProperty("车型审查任务进度") @ApiModelProperty("车型审查任务进度")
private Long carReview; private Double carReview;
@ApiModelProperty("车辆问卷任务开始时间") @ApiModelProperty("车辆问卷任务开始时间")
private Date carTaskBeginTime; private Date carTaskBeginTime;
...@@ -86,5 +86,5 @@ public class TaskFindResponse { ...@@ -86,5 +86,5 @@ public class TaskFindResponse {
private String carTestStatus; private String carTestStatus;
@ApiModelProperty("测试任务进度") @ApiModelProperty("测试任务进度")
private Long carTest; private Double carTest;
} }
...@@ -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'
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
AND trs.type = #{type} AND trs.type = #{type}
</select> </select>
<select id="count" resultType="long"> <select id="count" resultType="double">
SELECT SELECT
IFNULL((SELECT COUNT(*) FROM t_review_details_result WHERE task_id = #{taskId}), 0) / IFNULL((SELECT COUNT(*) FROM t_review_details_result WHERE task_id = #{taskId}), 0) /
IFNULL((SELECT COUNT(*) FROM t_review_details trd IFNULL((SELECT COUNT(*) FROM t_review_details trd
......
...@@ -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