Commit 86e82397 authored by 高滢's avatar 高滢
parents c0f611b1 5b7b4985
...@@ -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;
} }
...@@ -87,8 +87,8 @@ public class ReviewDetailsResult implements Serializable { ...@@ -87,8 +87,8 @@ public class ReviewDetailsResult implements Serializable {
private Long reviewEnterpriseArchiveId; private Long reviewEnterpriseArchiveId;
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty("企业名称") @ApiModelProperty("文件名称")
private String enterpriseName; private String fileName;
} }
...@@ -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);
......
...@@ -20,7 +20,7 @@ public interface TaskMapper extends BaseMapper<Task> { ...@@ -20,7 +20,7 @@ public interface TaskMapper extends BaseMapper<Task> {
List<Task> findList(TaskListRequest request); List<Task> findList(TaskListRequest request);
List<TaskFindResponse> findPending(TaskFindPendingRequest request); List<TaskFindResponse> findPending(@Param("request")TaskFindPendingRequest request,@Param("userId")Long userId);
List<Task> findFinish(TaskFindFinishRequest request); List<Task> findFinish(TaskFindFinishRequest request);
......
...@@ -25,7 +25,7 @@ public interface TaskService extends IService<Task> { ...@@ -25,7 +25,7 @@ public interface TaskService extends IService<Task> {
* @param request * @param request
* @return * @return
*/ */
List<TaskFindResponse> findPending(TaskFindPendingRequest request); List<TaskFindResponse> findPending(TaskFindPendingRequest request,Long userId);
/** /**
* 查询完成的任务 * 查询完成的任务
......
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()));
......
...@@ -89,16 +89,6 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -89,16 +89,6 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
// 任务样品关系 // 任务样品关系
List<TaskSampleRelation> relations = taskSampleRelationMapper.selectByTaskId(taskMapper.findByCarReviewTaskId(carReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE); List<TaskSampleRelation> relations = taskSampleRelationMapper.selectByTaskId(taskMapper.findByCarReviewTaskId(carReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
if (results.size() != 0 && results != null) {
for (ReviewDetailsResult reviewDetailsResult : results) {
if (reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() == null && relations.size() != 0 && relations != null) {
TaskSampleRelation taskSampleRelation = relations.get(0);
Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
reviewDetailsResult.setEnterpriseName(sample.getManufacturingEnterprise());
}
}
}
// 绑定问卷与答案 // 绑定问卷与答案
setDetailsResult(standardTree, results,carReviewTask); setDetailsResult(standardTree, results,carReviewTask);
...@@ -108,6 +98,12 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -108,6 +98,12 @@ 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();
...@@ -128,7 +124,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -128,7 +124,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 {
...@@ -180,7 +176,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -180,7 +176,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
} }
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) { if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId()); ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
reviewDetailsResult.setEnterpriseName(reviewEnterpriseArchive.getEnterpriseName()); reviewDetailsResult.setFileName(reviewEnterpriseArchive.getFileName());
} }
details.setResult(reviewDetailsResult); details.setResult(reviewDetailsResult);
} }
...@@ -191,13 +187,15 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -191,13 +187,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.不查询场景变更任务
...@@ -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())*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 {
...@@ -132,16 +132,6 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -132,16 +132,6 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
// 任务样品关系 // 任务样品关系
List<TaskSampleRelation> relations = taskSampleRelationMapper.selectByTaskId(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE); List<TaskSampleRelation> relations = taskSampleRelationMapper.selectByTaskId(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
if (results.size() != 0 && results != null) {
for (ReviewDetailsResult reviewDetailsResult : results) {
if (reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() == null && relations.size() != 0 && relations != null) {
TaskSampleRelation taskSampleRelation = relations.get(0);
Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
reviewDetailsResult.setEnterpriseName(sample.getManufacturingEnterprise());
}
}
}
// 绑定问卷与答案 // 绑定问卷与答案
setDetailsResult(standardTree, results, systemReviewTask); setDetailsResult(standardTree, results, systemReviewTask);
...@@ -151,6 +141,13 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -151,6 +141,13 @@ 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"); systemReviewTask.setImagesUrl("/vehicle-quality-review-oss/2024/03/04/qianzi1_20240304104011A001.jpg,/vehicle-quality-review-oss/2024/03/04/qianzi2_20240304104121A002.jpg");
...@@ -178,7 +175,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -178,7 +175,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
} }
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) { if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId()); ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
reviewDetailsResult.setEnterpriseName(reviewEnterpriseArchive.getEnterpriseName()); reviewDetailsResult.setFileName(reviewEnterpriseArchive.getFileName());
} }
details.setResult(reviewDetailsResult); details.setResult(reviewDetailsResult);
} }
...@@ -188,12 +185,14 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -188,12 +185,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) {
...@@ -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())*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 {
......
...@@ -176,14 +176,16 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -176,14 +176,16 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
@Override @Override
public List<TaskFindResponse> findPending(TaskFindPendingRequest request) { public List<TaskFindResponse> findPending(TaskFindPendingRequest request,Long userId) {
List<TaskFindResponse> responses = taskMapper.findPending(request); List<TaskFindResponse> responses = taskMapper.findPending(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)); 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;
...@@ -628,14 +630,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -628,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());
} }
...@@ -646,14 +648,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -646,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,16 +52,7 @@ public class TaskStatePending extends TaskStateAdapter implements TaskState, Ini ...@@ -43,16 +52,7 @@ public class TaskStatePending extends TaskStateAdapter implements TaskState, Ini
@Override @Override
public void doSubmit(Task task) { public void doSubmit(Task task) {
long subTaskCount = 0; if (task.getPointer() < task.getMaxPointer()) {
if(task.getSystemReviewTaskId() != null) {
subTaskCount = reviewDetailsMapper.count(task.getSystemReviewTaskId(), SystemReviewTask.TYPE);
}
if(task.getCarReviewTaskId() != null) {
subTaskCount = reviewDetailsMapper.count(task.getCarReviewTaskId(), CarReviewTask.TYPE);
}
if(subTaskCount > 0) {
task.setTaskStatus(Task.TASK_STATUS_PENDING); task.setTaskStatus(Task.TASK_STATUS_PENDING);
task.setRunStatus(Task.RUN_STATUS_RUNNABLE); task.setRunStatus(Task.RUN_STATUS_RUNNABLE);
} else { } else {
......
...@@ -118,7 +118,7 @@ public class TaskController extends BaseController { ...@@ -118,7 +118,7 @@ public class TaskController extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = "/findPending") @RequestMapping(method = RequestMethod.POST, value = "/findPending")
public TableDataInfo<TaskFindResponse> findPending(@Validated @RequestBody TaskFindPendingRequest request) { public TableDataInfo<TaskFindResponse> findPending(@Validated @RequestBody TaskFindPendingRequest request) {
startPage(request); startPage(request);
return getDataTable(taskService.findPending(request)); return getDataTable(taskService.findPending(request,getUserId()));
} }
@ApiOperation("查询已归档任务") @ApiOperation("查询已归档任务")
......
...@@ -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;
} }
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
</if> </if>
<if test="contactNumber != null and contactNumber != ''">and ae.contact_number like concat('%', #{contactNumber}, '%')</if> <if test="contactNumber != null and contactNumber != ''">and ae.contact_number like concat('%', #{contactNumber}, '%')</if>
</where> </where>
order by ae.create_time desc
</select> </select>
<select id="selectAutomobileEnterpriseById" parameterType="Long" resultMap="AutomobileEnterpriseResult"> <select id="selectAutomobileEnterpriseById" parameterType="Long" resultMap="AutomobileEnterpriseResult">
......
...@@ -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'
......
...@@ -99,24 +99,27 @@ ...@@ -99,24 +99,27 @@
left join t_system_review_task srt on t.system_review_task_id = srt.id left join t_system_review_task srt on t.system_review_task_id = srt.id
left join t_car_review_task crt on t.car_review_task_id = crt.id left join t_car_review_task crt on t.car_review_task_id = crt.id
<where> <where>
t.task_status IN ("NEW","PENDING") t.id IN (
<if test="standardId != null and standardId != ''"> SELECT task_id FROM t_task_user_relation WHERE user_id = #{userId}
and t.standard_id = #{standardId} )
and t.task_status IN ("NEW","PENDING")
<if test="request.standardId != null and request.standardId != ''">
and t.standard_id = #{request.standardId}
</if> </if>
<if test="taskNo != null and taskNo != ''"> <if test="request.taskNo != null and request.taskNo != ''">
and t.task_no like concat('%',#{taskNo},'%') and t.task_no like concat('%',#{request.taskNo},'%')
</if> </if>
<if test="taskName != null and taskName != ''"> <if test="request.taskName != null and request.taskName != ''">
and t.task_name like concat('%',#{taskName},'%') and t.task_name like concat('%',#{request.taskName},'%')
</if> </if>
<if test="productModel != null and productModel != ''"> <if test="request.productModel != null and request.productModel != ''">
and t.product_model like concat('%',#{productModel},'%') and t.product_model like concat('%',#{request.productModel},'%')
</if> </if>
<if test="inspectionItem != null and inspectionItem != ''"> <if test="request.inspectionItem != null and request.inspectionItem != ''">
AND( AND(
(#{inspectionItem} = 'sraif' AND t.system_review_task_id IS NOT NULL) (#{request.inspectionItem} = 'sraif' AND t.system_review_task_id IS NOT NULL)
OR OR
(#{inspectionItem} = 'grfis' AND t.car_review_task_id IS NOT NULL) (#{request.inspectionItem} = 'grfis' AND t.car_review_task_id IS NOT NULL)
) )
</if> </if>
</where> </where>
......
...@@ -63,6 +63,19 @@ public class SysMenu extends BaseEntity ...@@ -63,6 +63,19 @@ public class SysMenu extends BaseEntity
/** 菜单图标 */ /** 菜单图标 */
private String icon; private String icon;
/**
* 二级菜单名称
*/
private String secondaryMenuName;
public String getSecondaryMenuName() {
return secondaryMenuName;
}
public void setSecondaryMenuName(String secondaryMenuName) {
this.secondaryMenuName = secondaryMenuName;
}
/** 子菜单 */ /** 子菜单 */
private List<SysMenu> children = new ArrayList<SysMenu>(); private List<SysMenu> children = new ArrayList<SysMenu>();
...@@ -254,6 +267,7 @@ public class SysMenu extends BaseEntity ...@@ -254,6 +267,7 @@ public class SysMenu extends BaseEntity
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.append("secondaryMenuName", getSecondaryMenuName())
.toString(); .toString();
} }
} }
...@@ -21,6 +21,11 @@ public class RouterVo ...@@ -21,6 +21,11 @@ public class RouterVo
*/ */
private String path; private String path;
/**
* 二级菜单名称
*/
private String secondaryMenuName;
/** /**
* 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现 * 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
*/ */
...@@ -56,6 +61,14 @@ public class RouterVo ...@@ -56,6 +61,14 @@ public class RouterVo
*/ */
private List<RouterVo> children; private List<RouterVo> children;
public String getSecondaryMenuName() {
return secondaryMenuName;
}
public void setSecondaryMenuName(String secondaryMenuName) {
this.secondaryMenuName = secondaryMenuName;
}
public String getName() public String getName()
{ {
return name; return name;
......
...@@ -169,6 +169,7 @@ public class SysMenuServiceImpl implements ISysMenuService ...@@ -169,6 +169,7 @@ public class SysMenuServiceImpl implements ISysMenuService
{ {
RouterVo router = new RouterVo(); RouterVo router = new RouterVo();
router.setHidden("1".equals(menu.getVisible())); router.setHidden("1".equals(menu.getVisible()));
router.setSecondaryMenuName(menu.getSecondaryMenuName());
router.setName(getRouteName(menu)); router.setName(getRouteName(menu));
router.setPath(getRouterPath(menu)); router.setPath(getRouterPath(menu));
router.setComponent(getComponent(menu)); router.setComponent(getComponent(menu));
......
...@@ -25,10 +25,11 @@ ...@@ -25,10 +25,11 @@
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="secondaryMenuName" column="secondary_menu_name" />
</resultMap> </resultMap>
<sql id="selectMenuVo"> <sql id="selectMenuVo">
select menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time select menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time, secondary_menu_name
from sys_menu from sys_menu
</sql> </sql>
...@@ -49,7 +50,7 @@ ...@@ -49,7 +50,7 @@
</select> </select>
<select id="selectMenuTreeAll" resultMap="SysMenuResult"> <select id="selectMenuTreeAll" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time, m.secondary_menu_name
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0 from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
order by m.parent_id, m.order_num order by m.parent_id, m.order_num
</select> </select>
......
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