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

Merge branch 'dev' of...

Merge branch 'dev' of ssh://gitlab.91isoft.com:10022/wangfei/vehicle-quality-review into gaixiankang
parents d987ede0 6d11cada
...@@ -113,6 +113,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -113,6 +113,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
return taskMapper.findList(request); return taskMapper.findList(request);
} }
/**
* 创建任务
* @param request
*/
@Override @Override
public void createTask(TaskCreateRequest request) { public void createTask(TaskCreateRequest request) {
...@@ -148,9 +152,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -148,9 +152,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
} }
Long sum = taskMapper.findTaskName(request.getTaskName());
// TODO 任务名称验重 // TODO 任务名称验重
// Long sum = taskMapper.findTaskName(request.getTaskName());
// if (sum > 0) { // if (sum > 0) {
// throw new ServiceException("任务名称重复,请检查", HttpStatus.ERROR); // throw new ServiceException("任务名称重复,请检查", HttpStatus.ERROR);
// } else { // } else {
...@@ -201,9 +204,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -201,9 +204,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
taskService.save(task); taskService.save(task);
// 总任务包含车型试验,添加任务-场景关联信息
// saveTaskScenario(task.getId(), request.getTestScenarioList());
// 构建并保存该任务所关联的审核组信息 // 构建并保存该任务所关联的审核组信息
saveUserRelation(auditors,task); saveUserRelation(auditors,task);
...@@ -220,6 +220,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -220,6 +220,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// } // }
} }
/**
* 查询用户待办任务
* @param request
* @param userId
* @return
*/
@Override @Override
public List<TaskFindResponse> findPending(TaskFindPendingRequest request,Long userId) { public List<TaskFindResponse> findPending(TaskFindPendingRequest request,Long userId) {
List<TaskFindResponse> responses = taskMapper.findPending(request,userId); List<TaskFindResponse> responses = taskMapper.findPending(request,userId);
...@@ -237,17 +243,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -237,17 +243,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
List<CarReviewTask> carReviewTaskList = carReviewTaskMapper.findByTaskList(responses); List<CarReviewTask> carReviewTaskList = carReviewTaskMapper.findByTaskList(responses);
setCarProgress(carReviewTaskList,responses); setCarProgress(carReviewTaskList,responses);
// 车型试验子任务列表
// List<ModelTestTask> modelTestTaskList = modelTestTaskMapper.findByTaskList(responses);
// setModelProgress(modelTestTaskList,responses);
// 设置车型试验进度 // 设置车型试验进度
setModelSchedule(responses); setModelSchedule(responses);
// 任务是否有选择场景 // 显示下一任务节点
// List<TaskScenarioResponse> scenarioResponseList = taskMapper.findByTaskList(responses);
// setTaskScenario(scenarioResponseList,responses);
for (TaskFindResponse response : responses) { for (TaskFindResponse response : responses) {
String[] taskList = response.getTaskList().split(","); String[] taskList = response.getTaskList().split(",");
if (response.getPointer() < taskList.length) { if (response.getPointer() < taskList.length) {
...@@ -262,6 +261,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -262,6 +261,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
return responses; return responses;
} }
/**
* 已归档任务
* @param request
* @return
*/
@Override @Override
public List<Task> findFinish(TaskFindFinishRequest request) { public List<Task> findFinish(TaskFindFinishRequest request) {
...@@ -277,12 +281,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -277,12 +281,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
return taskList; return taskList;
} }
/**
* 编辑任务
* @param request
*/
@Override @Override
public void editTask(TaskEditRequest request) { public void editTask(TaskEditRequest request) {
Task oldTask = taskMapper.findByName(request.getTaskName());
// TODO 任务名称验重 // TODO 任务名称验重
// Task oldTask = taskMapper.findByName(request.getTaskName());
// if (oldTask == null || Objects.equals(oldTask.getId(), request.getId())) { // if (oldTask == null || Objects.equals(oldTask.getId(), request.getId())) {
// 构建任务创建者 // 构建任务创建者
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
...@@ -307,7 +314,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -307,7 +314,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
setTaskList(request.getTaskList(),task); setTaskList(request.getTaskList(),task);
BeanUtils.copyBeanProp(task, request); BeanUtils.copyBeanProp(task, request);
// 子任务发变化 // 子任务发变化
changeSubTask(request,task,initiator,standard,leader); changeSubTask(request,task,initiator,standard,leader);
task.setMaxPointer(request.getTaskList().size()); task.setMaxPointer(request.getTaskList().size());
...@@ -334,6 +341,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -334,6 +341,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
/**
* 删除任务
* @param request
*/
@Override @Override
public void deleteTask(TaskDeleteRequest request) { public void deleteTask(TaskDeleteRequest request) {
Task task = taskMapper.selectById(request.getId()); Task task = taskMapper.selectById(request.getId());
...@@ -367,12 +378,22 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -367,12 +378,22 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
taskMapper.deleteById(request.getId()); taskMapper.deleteById(request.getId());
} }
/**
* 开始任务
* @param request
*/
@Override @Override
public void startTask(TaskStartRequest request) { public void startTask(TaskStartRequest request) {
Task task = taskMapper.selectById(request.getId()); Task task = taskMapper.selectById(request.getId());
taskStateFacade.doStart(task, request); taskStateFacade.doStart(task, request);
} }
/**
* 用户创建的任务
* @param request
* @param userId
* @return
*/
@Override @Override
public List<TaskFindResponse> findCreate(TaskFindRequest request,Long userId) { public List<TaskFindResponse> findCreate(TaskFindRequest request,Long userId) {
List<TaskFindResponse> responses = taskMapper.findByUserId(request,userId); List<TaskFindResponse> responses = taskMapper.findByUserId(request,userId);
...@@ -390,12 +411,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -390,12 +411,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
List<CarReviewTask> carReviewTaskList = carReviewTaskMapper.findByTaskList(responses); List<CarReviewTask> carReviewTaskList = carReviewTaskMapper.findByTaskList(responses);
setCarProgress(carReviewTaskList,responses); setCarProgress(carReviewTaskList,responses);
// 车型试验子任务列表
// List<ModelTestTask> modelTestTaskList = modelTestTaskMapper.findByTaskList(responses);
// setModelProgress(modelTestTaskList,responses);
// 设置车型试验进度 // 设置车型试验进度
setModelSchedule(responses); setModelSchedule(responses);
// 显示下一任务节点
for (TaskFindResponse response : responses) { for (TaskFindResponse response : responses) {
String[] taskList = response.getTaskList().split(","); String[] taskList = response.getTaskList().split(",");
if (response.getPointer() < taskList.length) { if (response.getPointer() < taskList.length) {
...@@ -409,6 +428,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -409,6 +428,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
return responses; return responses;
} }
/**
* 获取任务详情
* @param request
* @return
*/
@Override @Override
public TaskGetInfoResponse getInfo(TaskGetInfoRequest request) { public TaskGetInfoResponse getInfo(TaskGetInfoRequest request) {
...@@ -423,9 +447,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -423,9 +447,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
response.setTaskList(taskList); response.setTaskList(taskList);
} }
// 测试场景
// response.setTestScenarioList(selectTestScenarioList(task));
// 小组成员 // 小组成员
response.setAuditors(setAuditors(request.getId())); response.setAuditors(setAuditors(request.getId()));
...@@ -464,6 +485,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -464,6 +485,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
return list; return list;
} }
/**
* 已办任务
* @param request
* @param userId
* @return
*/
@Override @Override
public List<Task> findUserFinish(TaskFindFinishRequest request,Long userId) { public List<Task> findUserFinish(TaskFindFinishRequest request,Long userId) {
...@@ -479,82 +506,95 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -479,82 +506,95 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
return taskList; return taskList;
} }
/**
* 新增暂存任务
* @param request
*/
@Override @Override
public void temporaryStorageTask(TaskCreateRequest request) { public void temporaryStorageTask(TaskCreateRequest request) {
Long sum = taskMapper.findTaskName(request.getTaskName());
// TODO 任务名称验重 // TODO 任务名称验重
// Long sum = taskMapper.findTaskName(request.getTaskName());
// if (sum > 0) { // if (sum > 0) {
// throw new ServiceException("任务名称重复,请检查", HttpStatus.ERROR); // throw new ServiceException("任务名称重复,请检查", HttpStatus.ERROR);
// } else { // } else {
// 构建任务创建者 // 构建任务创建者
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser initiator = sysUserService.selectUserById(loginUser.getUserId()); TaskGetInfoResponse temporaryStorageTask = taskService.getByUserId(loginUser.getUserId());
Standard standard = standardService.findListById(request.getStandardId()); if (temporaryStorageTask != null) {
TaskEditRequest editRequest = new TaskEditRequest();
// 构建并保存任务信息 BeanUtils.copyBeanProp(editRequest,request);
// 总任务 editRequest.setId(temporaryStorageTask.getId());
Task task = new Task(); taskService.editTemporaryStorageTask(editRequest);
task.setTaskInitiatorId(loginUser.getUserId()); } else {
task.setTaskInitiator(initiator.getNickName()); SysUser initiator = sysUserService.selectUserById(loginUser.getUserId());
if (initiator.getDept() != null) { Standard standard = standardService.findListById(request.getStandardId());
task.setTaskInitiatorDept(initiator.getDept().getDeptName());
} // 构建并保存任务信息
task.setTaskStatus(Task.TASK_STATUS_TEMPORARILY); // 总任务
String joinTaskList = StringUtils.join(request.getTaskList(),","); Task task = new Task();
if (StrUtil.isNotEmpty(joinTaskList)) { task.setTaskInitiatorId(loginUser.getUserId());
task.setTaskList(joinTaskList); task.setTaskInitiator(initiator.getNickName());
} if (initiator.getDept() != null) {
BeanUtils.copyBeanProp(task, request); task.setTaskInitiatorDept(initiator.getDept().getDeptName());
}
task.setTaskStatus(Task.TASK_STATUS_TEMPORARILY);
String joinTaskList = StringUtils.join(request.getTaskList(),",");
if (StrUtil.isNotEmpty(joinTaskList)) {
task.setTaskList(joinTaskList);
}
BeanUtils.copyBeanProp(task, request);
if (standard != null) { if (standard != null) {
task.setName(standard.getName()); task.setName(standard.getName());
task.setStandardNo(standard.getStandardNo()); task.setStandardNo(standard.getStandardNo());
task.setFile(standard.getFile()); task.setFile(standard.getFile());
} }
// 找到审查组长 // 找到审查组长
TaskUserRelation leader = null; TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors(); List<TaskUserRelation> auditors = request.getAuditors();
if (auditors != null && auditors.size() != 0) { if (auditors != null && auditors.size() != 0) {
for(TaskUserRelation auditor : auditors) { for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) { if(auditor.getIsLeader() == 1) {
leader = auditor; leader = auditor;
break; break;
}
} }
}
// 任务组长 // 任务组长
task.setLeaderId(leader.getUserId()); task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName()); task.setLeader(leader.getName());
} }
// 暂存 // 暂存
taskService.save(task); taskService.save(task);
// 测试场景 // 保存任务与小组信息
// saveTaskScenario(task.getId(), request.getTestScenarioList()); saveUserRelation(auditors,task);
// 保存任务与小组信息 // 保存关联的整车样品信息和零部件样品信息
saveUserRelation(auditors,task); List<TaskSampleRelation> relations = request.getSample();
List<TaskSampleRelation> partRelations = request.getPartSample();
saveSampleRelation(relations,partRelations,task);
// 保存关联的整车样品信息和零部件样品信息 // 保存任务关联的文件信息
List<TaskSampleRelation> relations = request.getSample(); saveFileList(request.getFileList(),task);
List<TaskSampleRelation> partRelations = request.getPartSample(); }
saveSampleRelation(relations,partRelations,task);
// 保存任务关联的文件信息
saveFileList(request.getFileList(),task);
// } // }
} }
/**
* 编辑暂存
* @param request
*/
@Override @Override
public void editTemporaryStorageTask(TaskEditRequest request) { public void editTemporaryStorageTask(TaskEditRequest request) {
// Task oldTask = taskMapper.findByName(request.getTaskName());
// TODO 任务名称验重 // TODO 任务名称验重
// Task oldTask = taskMapper.findByName(request.getTaskName());
// if (oldTask == null || Objects.equals(oldTask.getId(), request.getId())) { // if (oldTask == null || Objects.equals(oldTask.getId(), request.getId())) {
// 构建任务创建者 // 构建任务创建者
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
...@@ -565,7 +605,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -565,7 +605,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 总任务 // 总任务
Task task = new Task(); Task task = new Task();
String joinTaskList = StringUtils.join(request.getTaskList(),","); String joinTaskList = StringUtils.join(request.getTaskList(),",");
task.setTaskList(joinTaskList); if (StrUtil.isNotEmpty(joinTaskList)) {
task.setTaskList(joinTaskList);
}
BeanUtils.copyBeanProp(task, request); BeanUtils.copyBeanProp(task, request);
if (standard != null) { if (standard != null) {
...@@ -574,9 +616,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -574,9 +616,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
task.setFile(standard.getFile()); task.setFile(standard.getFile());
} }
// taskScenarioRelationMapper.delete(new QueryWrapper<TaskScenarioRelation>().lambda().eq(TaskScenarioRelation::getTaskId, task.getId()));
// saveTaskScenario(task.getId(), request.getTestScenarioList());
// 找到审查组长 // 找到审查组长
TaskUserRelation leader = null; TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors(); List<TaskUserRelation> auditors = request.getAuditors();
...@@ -612,6 +651,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -612,6 +651,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
/**
* 获取用户暂存任务
* @param userId
* @return
*/
@Override @Override
public TaskGetInfoResponse getByUserId(Long userId) { public TaskGetInfoResponse getByUserId(Long userId) {
...@@ -627,9 +671,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -627,9 +671,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// response.setTaskList(taskList); // response.setTaskList(taskList);
// } // }
// 测试场景
// response.setTestScenarioList(selectTestScenarioList(task));
// 小组成员 // 小组成员
response.setAuditors(setAuditors(task.getId())); response.setAuditors(setAuditors(task.getId()));
...@@ -650,6 +691,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -650,6 +691,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
/**
* 根据子任务获取总任务详情
* @param request
* @return
*/
@Override @Override
public TaskGetInfoResponse getBySubtaskId(TaskSubGetInfoRequest request) { public TaskGetInfoResponse getBySubtaskId(TaskSubGetInfoRequest request) {
TaskGetInfoResponse response = new TaskGetInfoResponse(); TaskGetInfoResponse response = new TaskGetInfoResponse();
...@@ -673,6 +719,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -673,6 +719,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
/**
* 数据统计
* @param request
* @return
*/
@Override @Override
public DataStatisticsResponse dataStatistics(TaskGetInfoRequest request) { public DataStatisticsResponse dataStatistics(TaskGetInfoRequest request) {
......
...@@ -116,12 +116,12 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -116,12 +116,12 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
// 测试详情 // 测试详情
String testDetails = stepResultVO.getDescription(); String testDetails = stepResultVO.getDescription();
if (testDetails != null) { if (testDetails != null) {
convertMarkdownToHtml(testDetails); testDetails = convertMarkdownToHtml(testDetails);
} }
testDetailsVO += testDetails + "`"; testDetailsVO += testDetails + "<br> ";
} }
testDetailsVO = testDetailsVO.substring(0, testDetailsVO.length() - 1); testDetailsVO = testDetailsVO.substring(0, testDetailsVO.length() - 1);
testRecords.setTestMethod(StringUtils.join(stepList,"`")); testRecords.setTestMethod(StringUtils.join(stepList,"\n"));
testRecords.setTestDetails(testDetailsVO); testRecords.setTestDetails(testDetailsVO);
} }
...@@ -202,7 +202,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -202,7 +202,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
// 测试详情 // 测试详情
String testDetails = stepResultVO.getDescription(); String testDetails = stepResultVO.getDescription();
if (testDetails != null) { if (testDetails != null) {
convertMarkdownToHtml(testDetails); testDetails = convertMarkdownToHtml(testDetails);
} }
testDetailsVO += testDetails + "`"; testDetailsVO += testDetails + "`";
} }
...@@ -237,7 +237,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -237,7 +237,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
// jsoup标准化标签,生成闭合标签 // jsoup标准化标签,生成闭合标签
doc.outputSettings().syntax(org.jsoup.nodes.Document.OutputSettings.Syntax.xml); doc.outputSettings().syntax(org.jsoup.nodes.Document.OutputSettings.Syntax.xml);
doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml); doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml);
return doc.html(); return doc.body().html();
} }
@Override @Override
......
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