Commit 6e731c28 authored by 盖献康's avatar 盖献康

Merge branch 'wangdingyi' into 'dev'

新建任务

See merge request !138
parents 13cc92c6 b9641c30
......@@ -18,7 +18,7 @@ public interface TaskService extends IService<Task> {
*/
List<Task> findList(TaskListRequest request);
void createTask(TaskCreateRequest request,Long userId);
void createTask(TaskCreateRequest request);
/**
* 查询进行中的任务
......
......@@ -92,7 +92,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
}
@Override
public void createTask(TaskCreateRequest request,Long userId) {
public void createTask(TaskCreateRequest request) {
// 构建任务创建者
LoginUser loginUser = SecurityUtils.getLoginUser();
......@@ -167,9 +167,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
taskStateFacade.doCreate(task, request.getTaskList());
TaskGetInfoResponse temporaryStorageTask = taskService.getByUserId(userId);
TaskGetInfoResponse temporaryStorageTask = taskService.getByUserId(loginUser.getUserId());
if(temporaryStorageTask != null) {
taskMapper.deleteById(temporaryStorageTask.getId());
}
}
@Override
......@@ -219,7 +220,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
BeanUtils.copyBeanProp(task, request);
Task oldTask = taskMapper.selectById(request.getId());
if (task.getTaskStatus() == Task.TASK_STATUS_NEW) {
if(request.getTaskList().contains(Task.SUB_TASK_GRFIS) && oldTask.getCarReviewTaskId() == null) {
// 保存车型审查问卷任务
TaskCreateRequest createRequest = new TaskCreateRequest();
......@@ -238,6 +239,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
if ( !request.getTaskList().contains(Task.SUB_TASK_SRAIF) && oldTask.getSystemReviewTaskId() != null) {
systemReviewTaskMapper.deleteById(oldTask.getSystemReviewTaskId());
}
taskStateFacade.doCreate(task, request.getTaskList());
}
taskService.updateById(task);
......@@ -280,31 +283,22 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
if (sampleRelations.size() != 0 && sampleRelations != null) {
// 获取之前的第一个企业名称
TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
Sample oldSample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
// 获取编辑任务后的第一个企业名称
TaskSampleRelation taskSampleRelation1 = relations.get(0);
Sample sample1 = sampleManagementMapper.selectSampleManagementById(taskSampleRelation1.getSampleId());
TaskSampleRelation newTaskSampleRelation = relations.get(0);
Sample newSample = sampleManagementMapper.selectSampleManagementById(newTaskSampleRelation.getSampleId());
// 第一个企业名称不相同则修改
if (!Objects.equals(sample.getManufacturingEnterprise(), sample1.getManufacturingEnterprise())){
Task task1 = taskMapper.selectById(request.getId());
// 体系审查对应的留档文件
List<ReviewEnterpriseArchive> reviewEnterpriseArchiveList = reviewEnterpriseArchiveMapper.findList(task1.getSystemReviewTaskId());
if (!Objects.equals(oldSample.getManufacturingEnterprise(), newSample.getManufacturingEnterprise())){
// 留档文件
List<ReviewEnterpriseArchive> reviewEnterpriseArchiveList = reviewEnterpriseArchiveMapper.findList(request.getId());
for (ReviewEnterpriseArchive reviewEnterpriseArchive : reviewEnterpriseArchiveList) {
reviewEnterpriseArchive.setEnterpriseName(sample1.getManufacturingEnterprise());
reviewEnterpriseArchive.setEnterpriseName(newSample.getManufacturingEnterprise());
}
reviewEnterpriseArchiveService.updateBatchById(reviewEnterpriseArchiveList);
// 车辆对应的留档文件
List<ReviewEnterpriseArchive> reviewEnterpriseArchiveList1 = reviewEnterpriseArchiveMapper.findList(task1.getCarReviewTaskId());
for (ReviewEnterpriseArchive reviewEnterpriseArchive1 : reviewEnterpriseArchiveList1) {
reviewEnterpriseArchive1.setEnterpriseName(sample1.getManufacturingEnterprise());
}
reviewEnterpriseArchiveService.updateBatchById(reviewEnterpriseArchiveList1);
}
}
}
......
......@@ -58,7 +58,7 @@ public class TaskController extends BaseController {
@Log(title = "总任务", businessType = BusinessType.INSERT)
@RequestMapping(method = RequestMethod.POST, value = "/add")
public R<String> createTask(@Validated @RequestBody TaskCreateRequest request) {
taskService.createTask(request,getUserId());
taskService.createTask(request);
return R.ok();
}
......
......@@ -27,6 +27,9 @@ public class TaskFindResponse {
@ApiModelProperty("标准名称(检验依据)")
private String name;
@ApiModelProperty("标准号")
private String standardNo;
@ApiModelProperty("任务编号")
private String taskNo;
......
......@@ -58,6 +58,7 @@
<result property="leader" column="leader" jdbcType="VARCHAR"/>
<result property="reviewStatus" column="review_status" jdbcType="VARCHAR"/>
<result property="carReviewStatus" column="car_review_status" jdbcType="VARCHAR"/>
<result property="standardNo" column="standard_no" jdbcType="BIGINT"/>
</resultMap>
<select id="findList" parameterType="com.ruoyi.web.request.TaskListRequest" resultMap="BaseResultMap">
......@@ -87,6 +88,7 @@
t.leader_id,t.leader,
t.task_begin_time,
t.product_model,
t.standard_no,
srt.task_begin_time system_task_begin_time,
srt.task_end_time system_task_end_time,
srt.task_status review_status,
......@@ -167,6 +169,7 @@
t.leader_id,t.leader,
t.task_begin_time,
t.task_end_time,
t.standard_no,
srt.task_begin_time system_task_begin_time,
srt.task_end_time system_task_end_time,
srt.task_status review_status,
......
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