Commit d57d1e54 authored by 王飞's avatar 王飞

Merge branch 'dev' into wangfei

parents 5d1f63ec 3ba8ba44
......@@ -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);
taskMapper.deleteById(temporaryStorageTask.getId());
TaskGetInfoResponse temporaryStorageTask = taskService.getByUserId(loginUser.getUserId());
if(temporaryStorageTask != null) {
taskMapper.deleteById(temporaryStorageTask.getId());
}
}
@Override
......@@ -219,24 +220,26 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
BeanUtils.copyBeanProp(task, request);
Task oldTask = taskMapper.selectById(request.getId());
if(request.getTaskList().contains(Task.SUB_TASK_GRFIS) && oldTask.getCarReviewTaskId() == null) {
// 保存车型审查问卷任务
TaskCreateRequest createRequest = new TaskCreateRequest();
BeanUtils.copyBeanProp(createRequest, request);
task.setCarReviewTaskId(saveCarReview(createRequest,initiator,standard,leader));
}
if ( !request.getTaskList().contains(Task.SUB_TASK_GRFIS) && oldTask.getCarReviewTaskId() != null) {
carReviewTaskMapper.deleteById(oldTask.getCarReviewTaskId());
}
if(request.getTaskList().contains(Task.SUB_TASK_SRAIF) && oldTask.getSystemReviewTaskId() == null) {
// 保存体系审查任务
TaskCreateRequest createRequest = new TaskCreateRequest();
BeanUtils.copyBeanProp(createRequest, request);
task.setSystemReviewTaskId(saveSystemReview(createRequest,initiator,standard,leader));
}
if ( !request.getTaskList().contains(Task.SUB_TASK_SRAIF) && oldTask.getSystemReviewTaskId() != null) {
systemReviewTaskMapper.deleteById(oldTask.getSystemReviewTaskId());
if (task.getTaskStatus() == Task.TASK_STATUS_NEW) {
if(request.getTaskList().contains(Task.SUB_TASK_GRFIS) && oldTask.getCarReviewTaskId() == null) {
// 保存车型审查问卷任务
TaskCreateRequest createRequest = new TaskCreateRequest();
BeanUtils.copyBeanProp(createRequest, request);
task.setCarReviewTaskId(saveCarReview(createRequest,initiator,standard,leader));
}
if ( !request.getTaskList().contains(Task.SUB_TASK_GRFIS) && oldTask.getCarReviewTaskId() != null) {
carReviewTaskMapper.deleteById(oldTask.getCarReviewTaskId());
}
if(request.getTaskList().contains(Task.SUB_TASK_SRAIF) && oldTask.getSystemReviewTaskId() == null) {
// 保存体系审查任务
TaskCreateRequest createRequest = new TaskCreateRequest();
BeanUtils.copyBeanProp(createRequest, request);
task.setSystemReviewTaskId(saveSystemReview(createRequest,initiator,standard,leader));
}
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,25 @@ 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());
for (ReviewEnterpriseArchive reviewEnterpriseArchive : reviewEnterpriseArchiveList) {
reviewEnterpriseArchive.setEnterpriseName(sample1.getManufacturingEnterprise());
}
if (!Objects.equals(oldSample.getManufacturingEnterprise(), newSample.getManufacturingEnterprise())){
// 留档文件
List<ReviewEnterpriseArchive> reviewEnterpriseArchiveList = reviewEnterpriseArchiveMapper.findList(request.getId());
reviewEnterpriseArchiveService.updateBatchById(reviewEnterpriseArchiveList);
if (reviewEnterpriseArchiveList.size() != 0 && reviewEnterpriseArchiveList != null) {
for (ReviewEnterpriseArchive reviewEnterpriseArchive : reviewEnterpriseArchiveList) {
reviewEnterpriseArchive.setEnterpriseName(newSample.getManufacturingEnterprise());
}
// 车辆对应的留档文件
List<ReviewEnterpriseArchive> reviewEnterpriseArchiveList1 = reviewEnterpriseArchiveMapper.findList(task1.getCarReviewTaskId());
for (ReviewEnterpriseArchive reviewEnterpriseArchive1 : reviewEnterpriseArchiveList1) {
reviewEnterpriseArchive1.setEnterpriseName(sample1.getManufacturingEnterprise());
reviewEnterpriseArchiveService.updateBatchById(reviewEnterpriseArchiveList);
}
reviewEnterpriseArchiveService.updateBatchById(reviewEnterpriseArchiveList1);
}
}
}
......
......@@ -46,7 +46,7 @@ public class AutomobileEnterpriseController extends BaseController
@PostMapping("/list")
public TableDataInfo<AutomobileEnterprise> list(@Validated @RequestBody AutomobileEnterpriseListRequest request)
{
startPage();
startPage(request);
List<AutomobileEnterprise> list = automobileEnterpriseService.selectAutomobileEnterpriseList(request);
return getDataTable(list);
}
......
......@@ -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