Commit 86e82397 authored by 高滢's avatar 高滢
parents c0f611b1 5b7b4985
......@@ -153,7 +153,6 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("问卷签名图片地址")
private String imagesUrl;
@TableField(exist = false)
@ApiModelProperty("审查细则(条)")
private Integer details;
......@@ -161,7 +160,6 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("审查细则符合率")
private Double detailsPass;
@TableField(exist = false)
@ApiModelProperty("标准条款(条)")
private Integer standards;
......@@ -173,4 +171,8 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("参与审查人数(人)")
private Integer person;
@TableField(exist = false)
@ApiModelProperty("企业名称")
private String enterpriseName;
}
......@@ -87,8 +87,8 @@ public class ReviewDetailsResult implements Serializable {
private Long reviewEnterpriseArchiveId;
@TableField(exist = false)
@ApiModelProperty("企业名称")
private String enterpriseName;
@ApiModelProperty("文件名称")
private String fileName;
}
......@@ -157,7 +157,6 @@ public class SystemReviewTask {
@ApiModelProperty("签名图片地址")
private String imagesUrl;
@TableField(exist = false)
@ApiModelProperty("审查细则(条)")
private Integer details;
......@@ -165,7 +164,6 @@ public class SystemReviewTask {
@ApiModelProperty("审查细则符合率")
private Double detailsPass;
@TableField(exist = false)
@ApiModelProperty("标准条款(条)")
private Integer standards;
......@@ -177,4 +175,8 @@ public class SystemReviewTask {
@ApiModelProperty("参与审查人数(人)")
private Integer person;
@TableField(exist = false)
@ApiModelProperty("企业名称")
private String enterpriseName;
}
......@@ -20,7 +20,7 @@ public interface ReviewDetailsMapper extends BaseMapper<ReviewDetails> {
*/
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查询细则列表
List<ReviewDetails> findByKeyPointId(@Param("keyPointId") Long keyPointId);
......
......@@ -20,7 +20,7 @@ public interface TaskMapper extends BaseMapper<Task> {
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);
......
......@@ -25,7 +25,7 @@ public interface TaskService extends IService<Task> {
* @param request
* @return
*/
List<TaskFindResponse> findPending(TaskFindPendingRequest request);
List<TaskFindResponse> findPending(TaskFindPendingRequest request,Long userId);
/**
* 查询完成的任务
......
package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.domain.ReviewDetailsResult;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.domain.TaskUserRelation;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.mapper.TaskUserRelationMapper;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.web.response.CarReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
......@@ -11,7 +19,13 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.ruoyi.common.DataStatisticsUtils.calculateStandardsPass;
@Transactional
@Service
......@@ -23,6 +37,18 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi
@Autowired
private ApplicationContext applicationContext;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Autowired
private TaskMapper taskMapper;
// FINISH状态下
// 1.standard字段使用task中归档的问卷
......@@ -32,6 +58,15 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi
public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) {
CarReviewTaskViewResponse response = new CarReviewTaskViewResponse();
response.setCarReviewTask(carReviewTask);
// 获取问卷
List<ReviewStandard> carStandardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
// 获取当前问卷答案
List<ReviewDetailsResult> carResults = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
// 车型审查
setCarDataStatistics(carStandardTree,carResults,carReviewTask);
return response;
}
......@@ -50,6 +85,19 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi
throw new ServiceException("不能提交一个结束的任务", HttpStatus.ERROR);
}
private void setCarDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results, CarReviewTask carReviewTask) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
BigDecimal standardPass = new BigDecimal((calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards())*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
public void afterPropertiesSet() throws Exception {
strategyCarReviewTaskContext.putResource(CarReviewTask.TASK_STATUS_FINISH, applicationContext.getBean(this.getClass()));
......
......@@ -89,16 +89,6 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
// 任务样品关系
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);
......@@ -108,6 +98,12 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
// 查询场景变更任务便于提醒用户场景变动
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();
......@@ -128,7 +124,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(carReviewTask.getId(),CarReviewTask.TYPE);
List<ReviewTaskInbox> inboxList = reviewTaskInboxMapper.findConfirmListByTaskId(carReviewTask.getId());
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){
throw new ServiceException("存在未确认的场景变更信息,请确认", HttpStatus.ERROR);
}else {
......@@ -180,7 +176,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
}
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
reviewDetailsResult.setEnterpriseName(reviewEnterpriseArchive.getEnterpriseName());
reviewDetailsResult.setFileName(reviewEnterpriseArchive.getFileName());
}
details.setResult(reviewDetailsResult);
}
......@@ -191,13 +187,15 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
carReviewTask.setStandards(DataStatisticsUtils.calculateStandards(standards));
BigDecimal standardPass = new BigDecimal(calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards());
carReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
BigDecimal standardPass = new BigDecimal((calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards())*100);
carReviewTask.setStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
carReviewTask.setDetails(DataStatisticsUtils.calculateDetails(standards));
BigDecimal detailsPass = new BigDecimal(DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) carReviewTask.getDetails());
carReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
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());
carReviewTaskMapper.updateById(carReviewTask);
}
......
package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.mapper.*;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.web.response.CarReviewTaskViewResponse;
import com.ruoyi.web.response.DataStatisticsResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
......@@ -22,12 +21,15 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.swing.table.TableModel;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.ruoyi.common.DataStatisticsUtils.calculateStandardsPass;
@Transactional
@Service
public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, InitializingBean {
......@@ -47,6 +49,15 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
@Autowired
private TaskStateFacade taskStateFacade;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
// SIGNED状态下
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
......@@ -55,7 +66,18 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) {
CarReviewTaskViewResponse response = new CarReviewTaskViewResponse();
carReviewTask.setImagesUrl("/vehicle-quality-review-oss/2024/03/04/qianzi1_20240304104011A001.jpg,/vehicle-quality-review-oss/2024/03/04/qianzi2_20240304104121A002.jpg");
// 获取问卷
List<ReviewStandard> carStandardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
// 获取当前问卷答案
List<ReviewDetailsResult> carResults = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
// 车型审查
setCarDataStatistics(carStandardTree,carResults,carReviewTask);
response.setCarReviewTask(carReviewTask);
return response;
}
......@@ -97,6 +119,19 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
}
private void setCarDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results, CarReviewTask carReviewTask) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
BigDecimal standardPass = new BigDecimal((calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards())*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
public void afterPropertiesSet() throws Exception {
......
package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.ReviewDetailsResult;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.domain.TaskUserRelation;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.mapper.TaskUserRelationMapper;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategySystemReviewTask;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
......@@ -11,7 +19,11 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Transactional
@Service
......@@ -22,6 +34,18 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask,
@Autowired
private ApplicationContext applicationContext;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Autowired
private TaskMapper taskMapper;
@Override
public void doStart(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能开始一个已完成的任务", HttpStatus.ERROR);
......@@ -50,11 +74,34 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask,
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
// 获取问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
// 获取当前问卷答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 体系审查
setSystemDataStatistics(standardTree,results,systemReviewTask);
response.setSystemReviewTask(systemReviewTask);
return response;
}
private void setSystemDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results, SystemReviewTask systemReviewTask) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()));
BigDecimal standardPass = new BigDecimal((DataStatisticsUtils.calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards())*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
public void afterPropertiesSet() throws Exception {
strategySystemReviewTaskContext.putResource(SystemReviewTask.STATUS_FINISH, applicationContext.getBean(this.getClass()));
......
......@@ -88,7 +88,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(systemReviewTask.getId(),SystemReviewTask.TYPE);
List<ReviewTaskInbox> inboxList = reviewTaskInboxMapper.findConfirmListByTaskId(systemReviewTask.getId());
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){
throw new ServiceException("存在未确认的场景变更信息,请确认", HttpStatus.ERROR);
} else {
......@@ -132,16 +132,6 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
// 任务样品关系
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);
......@@ -151,6 +141,13 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
// 查询场景变更任务便于提醒用户场景变动
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();
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
}
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
reviewDetailsResult.setEnterpriseName(reviewEnterpriseArchive.getEnterpriseName());
reviewDetailsResult.setFileName(reviewEnterpriseArchive.getFileName());
}
details.setResult(reviewDetailsResult);
}
......@@ -188,12 +185,14 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()));
systemReviewTask.setStandards(DataStatisticsUtils.calculateStandards(standards));
BigDecimal standardPass = new BigDecimal(DataStatisticsUtils.calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards());
systemReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
BigDecimal standardPass = new BigDecimal((DataStatisticsUtils.calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards())*100);
systemReviewTask.setStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
systemReviewTask.setDetails(DataStatisticsUtils.calculateDetails(standards));
BigDecimal detailsPass = new BigDecimal(DataStatisticsUtils.calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails());
systemReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
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());
systemReviewTaskMapper.updateById(systemReviewTask);
}
......
package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.mapper.*;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategySystemReviewTask;
import com.ruoyi.web.response.DataStatisticsResponse;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -21,6 +20,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -46,6 +46,15 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
@Autowired
private TaskStateFacade taskStateFacade;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Override
public void doStart(SystemReviewTask systemReviewTask) {
......@@ -97,11 +106,33 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
systemReviewTask.setImagesUrl("/vehicle-quality-review-oss/2024/03/04/qianzi1_20240304104011A001.jpg,/vehicle-quality-review-oss/2024/03/04/qianzi2_20240304104121A002.jpg");
// 获取问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
// 获取当前问卷答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 体系审查
setSystemDataStatistics(standardTree,results,systemReviewTask);
response.setSystemReviewTask(systemReviewTask);
return response;
}
private void setSystemDataStatistics(List<ReviewStandard> standards, List<ReviewDetailsResult> results, SystemReviewTask systemReviewTask) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()));
BigDecimal standardPass = new BigDecimal((DataStatisticsUtils.calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards())*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
public void afterPropertiesSet() throws Exception {
......
......@@ -176,14 +176,16 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
}
@Override
public List<TaskFindResponse> findPending(TaskFindPendingRequest request) {
List<TaskFindResponse> responses = taskMapper.findPending(request);
public List<TaskFindResponse> findPending(TaskFindPendingRequest request,Long userId) {
List<TaskFindResponse> responses = taskMapper.findPending(request,userId);
for (TaskFindResponse response : responses) {
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) {
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;
......@@ -334,10 +336,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
List<TaskFindResponse> responses = taskMapper.findByUserId(request,userId);
for (TaskFindResponse response : responses) {
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) {
response.setCarReview(reviewDetailsMapper.count(response.getCarReviewTaskId(),CarReviewTask.TYPE));
response.setCarReview((double)reviewDetailsMapper.count(response.getCarReviewTaskId(),CarReviewTask.TYPE));
}
}
return responses;
......@@ -628,14 +630,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
response.setSystemStandardsPassNum(DataStatisticsUtils.calculateStandardsPass(standards, resultMap));
response.setSystemStandardsNoPassNum(DataStatisticsUtils.calculateStandardsNoPass(standards, resultMap));
response.setSystemStandardsUnderNum(response.getSystemStandards() -response.getSystemStandardsPassNum() - response.getSystemStandardsNoPassNum());
BigDecimal standardPass = new BigDecimal(response.getSystemStandardsPassNum() / (double) response.getSystemStandards());
response.setSystemStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
BigDecimal standardPass = new BigDecimal((response.getSystemStandardsPassNum() / (double) response.getSystemStandards())*100);
response.setSystemStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
response.setSystemDetails(DataStatisticsUtils.calculateDetails(standards));
response.setSystemDetailsPassNum(DataStatisticsUtils.calculateDetailsPass(standards, resultMap));
response.setSystemDetailsNoPassNum(DataStatisticsUtils.calculateDetailsNoPass(standards, resultMap));
response.setSystemDetailsUnderNum(response.getSystemDetails() - response.getSystemDetailsPassNum() - response.getSystemDetailsNoPassNum());
BigDecimal detailsPass = new BigDecimal(response.getSystemDetailsPassNum() / (double) response.getSystemDetails());
response.setSystemDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
BigDecimal detailsPass = new BigDecimal((response.getSystemDetailsPassNum() / (double) response.getSystemDetails())*100);
response.setSystemDetailsPass(detailsPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
}
......@@ -646,14 +648,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
response.setCarStandardsPassNum(DataStatisticsUtils.calculateStandardsPass(standards, resultMap));
response.setCarStandardsNoPassNum(DataStatisticsUtils.calculateStandardsNoPass(standards, resultMap));
response.setCarStandardsUnderNum(response.getCarStandards() -response.getCarStandardsPassNum() - response.getCarStandardsNoPassNum());
BigDecimal standardPass = new BigDecimal(response.getCarStandardsPassNum() / (double) response.getCarStandards());
response.setCarStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
BigDecimal standardPass = new BigDecimal((response.getCarStandardsPassNum() / (double) response.getCarStandards())*100);
response.setCarStandardsPass(standardPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
response.setCarDetails(DataStatisticsUtils.calculateDetails(standards));
response.setCarDetailsPassNum(DataStatisticsUtils.calculateDetailsPass(standards, resultMap));
response.setCarDetailsNoPassNum(DataStatisticsUtils.calculateDetailsNoPass(standards, resultMap));
response.setCarDetailsUnderNum(response.getCarDetails() - response.getCarDetailsPassNum() - response.getCarDetailsNoPassNum());
BigDecimal detailsPass = new BigDecimal(response.getCarDetailsPassNum() / (double) response.getCarDetails());
response.setCarDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
BigDecimal detailsPass = new BigDecimal((response.getCarDetailsPassNum() / (double) response.getCarDetails())*100);
response.setCarDetailsPass(detailsPass.setScale(1,BigDecimal.ROUND_UP).doubleValue());
}
......
......@@ -5,8 +5,10 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.domain.Task;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.TaskService;
import com.ruoyi.service.TaskState;
import org.springframework.beans.factory.InitializingBean;
......@@ -16,6 +18,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
@Transactional
@Service
......@@ -33,6 +36,12 @@ public class TaskStatePending extends TaskStateAdapter implements TaskState, Ini
@Autowired
private ApplicationContext applicationContext;
@Autowired
private SystemReviewTaskMapper systemReviewTaskMapper;
@Autowired
private CarReviewTaskMapper carReviewTaskMapper;
@Override
......@@ -43,16 +52,7 @@ public class TaskStatePending extends TaskStateAdapter implements TaskState, Ini
@Override
public void doSubmit(Task task) {
long subTaskCount = 0;
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) {
if (task.getPointer() < task.getMaxPointer()) {
task.setTaskStatus(Task.TASK_STATUS_PENDING);
task.setRunStatus(Task.RUN_STATUS_RUNNABLE);
} else {
......
......@@ -118,7 +118,7 @@ public class TaskController extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = "/findPending")
public TableDataInfo<TaskFindResponse> findPending(@Validated @RequestBody TaskFindPendingRequest request) {
startPage(request);
return getDataTable(taskService.findPending(request));
return getDataTable(taskService.findPending(request,getUserId()));
}
@ApiOperation("查询已归档任务")
......
......@@ -62,7 +62,7 @@ public class TaskFindResponse {
private String reviewStatus;
@ApiModelProperty("体系审查任务进度")
private Long systemReview;
private Double systemReview;
@ApiModelProperty("体系问卷任务开始时间")
private Date systemTaskBeginTime;
......@@ -74,7 +74,7 @@ public class TaskFindResponse {
private String carReviewStatus;
@ApiModelProperty("车型审查任务进度")
private Long carReview;
private Double carReview;
@ApiModelProperty("车辆问卷任务开始时间")
private Date carTaskBeginTime;
......@@ -86,5 +86,5 @@ public class TaskFindResponse {
private String carTestStatus;
@ApiModelProperty("测试任务进度")
private Long carTest;
private Double carTest;
}
......@@ -64,7 +64,6 @@
</if>
<if test="contactNumber != null and contactNumber != ''">and ae.contact_number like concat('%', #{contactNumber}, '%')</if>
</where>
order by ae.create_time desc
</select>
<select id="selectAutomobileEnterpriseById" parameterType="Long" resultMap="AutomobileEnterpriseResult">
......
......@@ -24,6 +24,8 @@
<result property="submitId" column="submit_id" jdbcType="BIGINT"/>
<result property="submitName" column="submit_name" jdbcType="VARCHAR"/>
<result property="imagesUrl" column="images_url" jdbcType="VARCHAR"/>
<result property="details" column="details" jdbcType="INTEGER"/>
<result property="standards" column="standards" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -38,18 +40,18 @@
images_url
</sql>
<select id="findListByReviewStatus" resultType="com.ruoyi.domain.CarReviewTask">
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,create_time,leader_id,leader,standard_id,name,standard_no,file,submit_id,submit_name,images_url
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,create_time,leader_id,leader,standard_id,name,standard_no,file,submit_id,submit_name,images_url,details,standards
FROM t_car_review_task WHERE review_status = #{reviewStatus} AND task_status = 'PENDING'
</select>
<select id="findListByTaskStatus" resultType="com.ruoyi.domain.CarReviewTask">
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,create_time,leader_id,leader,standard_id,name,standard_no,file,submit_id,submit_name,images_url
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,create_time,leader_id,leader,standard_id,name,standard_no,file,submit_id,submit_name,images_url,details,standards
FROM t_car_review_task WHERE task_status = #{taskStatus}
</select>
<select id="findByDetailsResult" resultType="com.ruoyi.domain.CarReviewTask">
SELECT tr.id,tr.task_no,tr.task_status,tr.task_initiator,tr.task_initiator_dept,
tr.task_result,tr.task_begin_time,tr.task_end_time,tr.standard,tr.create_time,
tr.leader_id,tr.leader,tr.standard_id,tr.name,tr.standard_no,tr.file,tr.submit_id,
tr.submit_name,tr.images_url
tr.submit_name,tr.images_url,tr.details,tr.standards
FROM t_car_review_task tr
LEFT JOIN t_review_details_result trdr ON tr.id = trdr.task_id
WHERE trdr.review_details_id = #{detailId} and tr.task_status = 'PENDING'
......
......@@ -22,7 +22,7 @@
AND trs.type = #{type}
</select>
<select id="count" resultType="long">
<select id="count" resultType="double">
SELECT
IFNULL((SELECT COUNT(*) FROM t_review_details_result WHERE task_id = #{taskId}), 0) /
IFNULL((SELECT COUNT(*) FROM t_review_details trd
......
......@@ -24,16 +24,18 @@
<result property="submitById" column="submit_by_id" jdbcType="BIGINT"/>
<result property="submitByName" column="submit_by_name" jdbcType="VARCHAR"/>
<result property="imagesUrl" column="images_url" jdbcType="VARCHAR"/>
<result property="details" column="details" jdbcType="INTEGER"/>
<result property="standards" column="standards" jdbcType="INTEGER"/>
</resultMap>
<select id="findListByStatus" resultMap="BaseResultMap">
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, create_time,leader,leader_id, standard_id, name, standard_no, file, submit_by_id, submit_by_name,images_url
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, create_time,leader,leader_id, standard_id, name, standard_no, file, submit_by_id, submit_by_name,images_url,details,standards
FROM t_system_review_task WHERE task_status = #{status}
ORDER BY create_time DESC
</select>
<select id="findListInProcess" resultMap="BaseResultMap">
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, create_time,leader,leader_id, standard_id, name, standard_no, file, submit_by_id, submit_by_name,images_url
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, create_time,leader,leader_id, standard_id, name, standard_no, file, submit_by_id, submit_by_name,images_url,details,standards
FROM t_system_review_task WHERE task_status IN ('NEW','PENDING')
ORDER BY create_time DESC
</select>
......@@ -41,7 +43,7 @@
SELECT ts.id, ts.task_no, ts.task_status, ts.task_initiator, ts.task_initiator_dept,
ts.task_result, ts.task_begin_time, ts.task_end_time, ts.standard, ts.create_time,
ts.leader,ts.leader_id, ts.standard_id, ts.name, ts.standard_no, ts.file, ts.submit_by_id,
ts.submit_by_name,ts.images_url
ts.submit_by_name,ts.images_url,ts.details,ts.standards
FROM t_system_review_task ts
LEFT JOIN t_review_details_result trdr ON ts.id = trdr.task_id
WHERE trdr.review_details_id = #{detailId} and ts.task_status = 'PENDING'
......
......@@ -99,24 +99,27 @@
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
<where>
t.task_status IN ("NEW","PENDING")
<if test="standardId != null and standardId != ''">
and t.standard_id = #{standardId}
t.id IN (
SELECT task_id FROM t_task_user_relation WHERE user_id = #{userId}
)
and t.task_status IN ("NEW","PENDING")
<if test="request.standardId != null and request.standardId != ''">
and t.standard_id = #{request.standardId}
</if>
<if test="taskNo != null and taskNo != ''">
and t.task_no like concat('%',#{taskNo},'%')
<if test="request.taskNo != null and request.taskNo != ''">
and t.task_no like concat('%',#{request.taskNo},'%')
</if>
<if test="taskName != null and taskName != ''">
and t.task_name like concat('%',#{taskName},'%')
<if test="request.taskName != null and request.taskName != ''">
and t.task_name like concat('%',#{request.taskName},'%')
</if>
<if test="productModel != null and productModel != ''">
and t.product_model like concat('%',#{productModel},'%')
<if test="request.productModel != null and request.productModel != ''">
and t.product_model like concat('%',#{request.productModel},'%')
</if>
<if test="inspectionItem != null and inspectionItem != ''">
<if test="request.inspectionItem != null and request.inspectionItem != ''">
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
(#{inspectionItem} = 'grfis' AND t.car_review_task_id IS NOT NULL)
(#{request.inspectionItem} = 'grfis' AND t.car_review_task_id IS NOT NULL)
)
</if>
</where>
......
......@@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* 菜单权限表 sys_menu
*
*
* @author ruoyi
*/
public class SysMenu extends BaseEntity
......@@ -53,7 +53,7 @@ public class SysMenu extends BaseEntity
/** 显示状态(0显示 1隐藏) */
private String visible;
/** 菜单状态(0正常 1停用) */
private String status;
......@@ -63,6 +63,19 @@ public class SysMenu extends BaseEntity
/** 菜单图标 */
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>();
......@@ -232,7 +245,7 @@ public class SysMenu extends BaseEntity
{
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......@@ -254,6 +267,7 @@ public class SysMenu extends BaseEntity
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("secondaryMenuName", getSecondaryMenuName())
.toString();
}
}
......@@ -5,7 +5,7 @@ import java.util.List;
/**
* 路由配置信息
*
*
* @author ruoyi
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
......@@ -21,6 +21,11 @@ public class RouterVo
*/
private String path;
/**
* 二级菜单名称
*/
private String secondaryMenuName;
/**
* 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
*/
......@@ -56,6 +61,14 @@ public class RouterVo
*/
private List<RouterVo> children;
public String getSecondaryMenuName() {
return secondaryMenuName;
}
public void setSecondaryMenuName(String secondaryMenuName) {
this.secondaryMenuName = secondaryMenuName;
}
public String getName()
{
return name;
......
......@@ -27,7 +27,7 @@ import com.ruoyi.system.service.ISysMenuService;
/**
* 菜单 业务层处理
*
*
* @author ruoyi
*/
@Service
......@@ -46,7 +46,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 根据用户查询系统菜单列表
*
*
* @param userId 用户ID
* @return 菜单列表
*/
......@@ -58,7 +58,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 查询系统菜单列表
*
*
* @param menu 菜单信息
* @return 菜单列表
*/
......@@ -81,7 +81,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 根据用户ID查询权限
*
*
* @param userId 用户ID
* @return 权限列表
*/
......@@ -102,7 +102,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 根据角色ID查询权限
*
*
* @param roleId 角色ID
* @return 权限列表
*/
......@@ -123,7 +123,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 根据用户ID查询菜单
*
*
* @param userId 用户名称
* @return 菜单列表
*/
......@@ -144,7 +144,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 根据角色ID查询菜单树信息
*
*
* @param roleId 角色ID
* @return 选中菜单列表
*/
......@@ -157,7 +157,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 构建前端路由所需要的菜单
*
*
* @param menus 菜单列表
* @return 路由列表
*/
......@@ -169,6 +169,7 @@ public class SysMenuServiceImpl implements ISysMenuService
{
RouterVo router = new RouterVo();
router.setHidden("1".equals(menu.getVisible()));
router.setSecondaryMenuName(menu.getSecondaryMenuName());
router.setName(getRouteName(menu));
router.setPath(getRouterPath(menu));
router.setComponent(getComponent(menu));
......@@ -215,7 +216,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 构建前端所需要树结构
*
*
* @param menus 菜单列表
* @return 树结构列表
*/
......@@ -243,7 +244,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 构建前端所需要下拉树结构
*
*
* @param menus 菜单列表
* @return 下拉树结构列表
*/
......@@ -256,7 +257,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 根据菜单ID查询信息
*
*
* @param menuId 菜单ID
* @return 菜单信息
*/
......@@ -268,7 +269,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 是否存在菜单子节点
*
*
* @param menuId 菜单ID
* @return 结果
*/
......@@ -281,7 +282,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 查询菜单使用数量
*
*
* @param menuId 菜单ID
* @return 结果
*/
......@@ -294,7 +295,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 新增保存菜单信息
*
*
* @param menu 菜单信息
* @return 结果
*/
......@@ -306,7 +307,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 修改保存菜单信息
*
*
* @param menu 菜单信息
* @return 结果
*/
......@@ -318,7 +319,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 删除菜单管理信息
*
*
* @param menuId 菜单ID
* @return 结果
*/
......@@ -330,7 +331,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 校验菜单名称是否唯一
*
*
* @param menu 菜单信息
* @return 结果
*/
......@@ -348,7 +349,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 获取路由名称
*
*
* @param menu 菜单信息
* @return 路由名称
*/
......@@ -365,7 +366,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 获取路由地址
*
*
* @param menu 菜单信息
* @return 路由地址
*/
......@@ -393,7 +394,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 获取组件信息
*
*
* @param menu 菜单信息
* @return 组件信息
*/
......@@ -417,7 +418,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 是否为菜单内部跳转
*
*
* @param menu 菜单信息
* @return 结果
*/
......@@ -429,7 +430,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 是否为内链组件
*
*
* @param menu 菜单信息
* @return 结果
*/
......@@ -440,7 +441,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 是否为parent_view组件
*
*
* @param menu 菜单信息
* @return 结果
*/
......@@ -451,7 +452,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 根据父节点的ID获取所有子节点
*
*
* @param list 分类表
* @param parentId 传入的父节点ID
* @return String
......@@ -474,7 +475,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 递归列表
*
*
* @param list 分类表
* @param t 子节点
*/
......@@ -520,7 +521,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 内链域名特殊字符替换
*
*
* @return 替换后的内链域名
*/
public String innerLinkReplaceEach(String path)
......
......@@ -25,13 +25,14 @@
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="remark" column="remark" />
<result property="secondaryMenuName" column="secondary_menu_name" />
</resultMap>
<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
</sql>
<select id="selectMenuList" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
<where>
......@@ -47,13 +48,13 @@
</where>
order by parent_id, order_num
</select>
<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
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByUserId" parameterType="SysMenu" 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
from sys_menu m
......@@ -72,7 +73,7 @@
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuTreeByUserId" parameterType="Long" 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
from sys_menu m
......@@ -83,7 +84,7 @@
where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByRoleId" resultType="Long">
select m.menu_id
from sys_menu m
......@@ -94,7 +95,7 @@
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuPerms" resultType="String">
select distinct m.perms
from sys_menu m
......@@ -110,28 +111,28 @@
left join sys_role r on r.role_id = ur.role_id
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
</select>
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
where m.status = '0' and rm.role_id = #{roleId}
</select>
<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
where menu_id = #{menuId}
</select>
<select id="hasChildByMenuId" resultType="Integer">
select count(1) from sys_menu where parent_id = #{menuId}
select count(1) from sys_menu where parent_id = #{menuId}
</select>
<select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
where menu_name=#{menuName} and parent_id = #{parentId} limit 1
</select>
<update id="updateMenu" parameterType="SysMenu">
update sys_menu
<set>
......@@ -194,9 +195,9 @@
sysdate()
)
</insert>
<delete id="deleteMenuById" parameterType="Long">
delete from sys_menu where menu_id = #{menuId}
</delete>
</mapper>
\ No newline at end of file
</mapper>
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