Commit bd8e432b authored by 王飞's avatar 王飞

Merge branch 'wangdingyi' into 'dev'

Id添加注解

See merge request !35
parents 48b172b3 f5aa997c
......@@ -118,6 +118,7 @@ public class CarReviewTask implements Serializable {
/**
* 审查组长id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审查组长id")
private Long leaderId;
......@@ -130,6 +131,7 @@ public class CarReviewTask implements Serializable {
/**
* 关联标准表id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("关联标准表id")
private Long standardId;
......@@ -178,6 +180,7 @@ public class CarReviewTask implements Serializable {
/**
* 车型问卷提交人id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("车型问卷提交人id")
private Long reviewSubmitId;
......
......@@ -36,6 +36,7 @@ public class ReviewDetails {
/**
* 审查要点id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审查要点id")
private Long reviewKeypointId;
......
......@@ -48,18 +48,21 @@ public class ReviewDetailsResult implements Serializable {
/**
* 关联到的细则id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("关联到的细则id")
private Long reviewDetailsId;
/**
* 关联的任务id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("关联的任务id")
private Long taskId;
/**
* 审核人id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审核人id")
private Long userId;
......
......@@ -36,6 +36,7 @@ public class ReviewKeyPoint {
/**
* 审查标准id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审查标准id")
private Long reviewStandardId;
......
......@@ -35,6 +35,7 @@ public class ReviewScene {
/**
* 审查细则id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审查细则id")
private Long reviewDetailsId;
......
......@@ -70,6 +70,7 @@ public class ReviewSceneChangeTask {
/**
* 审查标准id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审查标准id")
private Long standardId;
......@@ -88,6 +89,7 @@ public class ReviewSceneChangeTask {
/**
* 审查要点id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审查要点id")
private Long keypointId;
......@@ -100,6 +102,7 @@ public class ReviewSceneChangeTask {
/**
* 审查细则id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审查细则id")
private Long detailsId;
......@@ -142,6 +145,7 @@ public class ReviewSceneChangeTask {
/**
* 任务发起人Id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("任务发起人Id")
private Long taskInitiatorId;
......@@ -180,6 +184,7 @@ public class ReviewSceneChangeTask {
* 若为修改、删除任务时,此id在创建任务时赋值
* 若为新增任务时,此id在审批通过并保存新场景后赋值
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty(value = "审查场景id", notes = "1.若为修改、删除任务时,此id在创建任务时赋值; 2.若为新增任务时,此id在审批通过并保存新场景后赋值 ")
private Long reviewSceneId;
......
......@@ -38,12 +38,14 @@ public class ReviewSceneChangeTaskUserRelation {
/**
* 任务id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("任务id")
private Long taskId;
/**
* 用户id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("用户id")
private Long userId;
......@@ -77,4 +79,4 @@ public class ReviewSceneChangeTaskUserRelation {
@ApiModelProperty("部门名称")
private String dept;
}
\ No newline at end of file
}
......@@ -60,6 +60,7 @@ public class ReviewStandard {
/**
* 关联标准表id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("关联标准表id")
private Long standardId;
......
......@@ -29,12 +29,14 @@ public class ReviewTaskInbox {
/**
* 体系审查任务id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("体系审查任务id")
private Long reviewTaskId;
/**
* 场景变更任务id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("场景变更任务id")
private Long reviewSceneChangeTaskId;
......
......@@ -30,6 +30,7 @@ public class ReviewTaskUserRelation {
/**
* 用户id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("用户id")
private Long userId;
......
......@@ -100,6 +100,7 @@ public class SystemReviewTask {
/**
* 审核组长id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审核组长id")
private Long leaderId;
......@@ -118,6 +119,7 @@ public class SystemReviewTask {
/**
* 关联标准表id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long standardId;
/**
......@@ -138,6 +140,7 @@ public class SystemReviewTask {
/**
* 提交人id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long submitById;
/**
......
......@@ -17,6 +17,8 @@ import java.util.List;
public interface CarReviewTaskMapper extends BaseMapper<CarReviewTask> {
List<CarReviewTask> findListByReviewStatus(@Param("reviewStatus") String reviewStatus);
List<CarReviewTask> findListByTaskStatus(@Param("taskStatus") String taskStatus);
}
......
......@@ -53,12 +53,6 @@ public interface CarReviewTaskService extends IService<CarReviewTask> {
*/
List<CarReviewTask> findListByStatus(String status);
/**
* 查询处理中的任务
* @return
*/
List<CarReviewTask> findListInProcess();
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.*;
......@@ -129,18 +131,16 @@ public class CarReviewTaskServiceImpl extends ServiceImpl<CarReviewTaskMapper, C
@Override
public void submitReviewTask(CarReviewTaskSubmitRequest request) {
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(request.getTaskId());
CarReviewTask carReviewTask = carReviewTaskService.getById(request.getTaskId());
strategyCarReviewTaskContext.getResource(carReviewTask.getReviewStatus()).doSubmitReview(carReviewTask);
}
@Override
public List<CarReviewTask> findListByStatus(String status) {
return null;
return carReviewTaskMapper.findListByTaskStatus(status);
}
@Override
public List<CarReviewTask> findListInProcess() {
return null;
}
}
......
......@@ -8,7 +8,11 @@ import com.ruoyi.web.response.CarReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@Service
public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, InitializingBean {
@Autowired
......
......@@ -12,10 +12,14 @@ import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@Transactional
@Service
public class StrategyCarReviewTaskNew implements StrategyCarReviewTask, InitializingBean {
@Autowired
......
......@@ -8,7 +8,11 @@ import com.ruoyi.web.response.CarReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@Service
public class StrategyCarReviewTaskNone implements StrategyCarReviewTask, InitializingBean {
@Autowired
......
......@@ -6,6 +6,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.ReviewDetailsResultService;
......@@ -49,6 +50,9 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
@Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
// PENDING状态下
// 1.standard字段查询当前最新问卷
// 2.查询场景变更任务
......@@ -87,33 +91,40 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
@Override
public void doSubmitReview(CarReviewTask carReviewTask) {
// 1. 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
// 2. 所有细则必须有对应答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
// 3. 将最终问卷归档到 standard 字段
setDetailsResult(standardTree, results);
carReviewTask.setStandard(standardTree);
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(carReviewTask.getId());
// 4. 填充review_submit_time
carReviewTask.setReviewSubmitTime(new Date());
// 5. 修改任务状态为 FINISH
carReviewTask.setReviewStatus(CarReviewTask.REVIEW_STATUS_FINISH);
// 6. 填写当前用户id
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
carReviewTask.setReviewSubmitId(loginUser.getUserId());
carReviewTask.setReviewSubmitName(loginUser.getNickName());
// 7. 设置问卷结果
if (reviewDetailsResultMapper.findNotPass(carReviewTask.getId()) > 0) {
carReviewTask.setReviewResult("REJECT");
if (detailsList != null) {
throw new ServiceException("存在未填写的问卷,请填写完整", HttpStatus.ERROR, detailsList);
} else {
carReviewTask.setReviewResult("PASS");
// 1. 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
// 2. 所有细则必须有对应答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
// 3. 将最终问卷归档到 standard 字段
setDetailsResult(standardTree, results);
carReviewTask.setStandard(standardTree);
// 4. 填充review_submit_time
carReviewTask.setReviewSubmitTime(new Date());
// 5. 修改任务状态为 FINISH
carReviewTask.setReviewStatus(CarReviewTask.REVIEW_STATUS_FINISH);
// 6. 填写当前用户id
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
carReviewTask.setReviewSubmitId(loginUser.getUserId());
carReviewTask.setReviewSubmitName(loginUser.getNickName());
// 7. 设置问卷结果
if (reviewDetailsResultMapper.findNotPass(carReviewTask.getId()) > 0) {
carReviewTask.setReviewResult("REJECT");
} else {
carReviewTask.setReviewResult("PASS");
}
carReviewTaskMapper.updateById(carReviewTask);
}
carReviewTaskMapper.updateById(carReviewTask);
}
private void setDetailsResult(List<ReviewStandard> standards, List<ReviewDetailsResult> results) {
......
......@@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.*;
......@@ -45,6 +46,9 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
@Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
@Override
public void doStart(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能开始一个已经开始的任务", HttpStatus.ERROR);
......@@ -53,33 +57,38 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
@Override
public void doSubmit(SystemReviewTask systemReviewTask) {
// TODO
// 1. 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
// 2. 所有细则必须有对应答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 3. 将最终问卷归档到 standard 字段
setDetailsResult(standardTree, results);
systemReviewTask.setStandard(standardTree);
// 4. 填充task_end_time
systemReviewTask.setTaskEndTime(new Date());
// 5. 修改任务状态为 FINISH
systemReviewTask.setTaskStatus(SystemReviewTask.STATUS_FINISH);
// 6. 填写当前用户id
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
systemReviewTask.setSubmitById(loginUser.getUserId());
systemReviewTask.setSubmitByName(loginUser.getNickName());
// 7. 设置问卷结果
if (reviewDetailsResultMapper.findNotPass(systemReviewTask.getId()) > 0) {
systemReviewTask.setTaskResult("REJECT");
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(systemReviewTask.getId());
if (detailsList != null) {
throw new ServiceException("存在未填写的问卷,请填写完整", HttpStatus.ERROR, detailsList);
} else {
systemReviewTask.setTaskResult("PASS");
// 1. 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
// 2. 所有细则必须有对应答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 3. 将最终问卷归档到 standard 字段
setDetailsResult(standardTree, results);
systemReviewTask.setStandard(standardTree);
// 4. 填充task_end_time
systemReviewTask.setTaskEndTime(new Date());
// 5. 修改任务状态为 FINISH
systemReviewTask.setTaskStatus(SystemReviewTask.STATUS_FINISH);
// 6. 填写当前用户id
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
systemReviewTask.setSubmitById(loginUser.getUserId());
systemReviewTask.setSubmitByName(loginUser.getNickName());
// 7. 设置问卷结果
if (reviewDetailsResultMapper.findNotPass(systemReviewTask.getId()) > 0) {
systemReviewTask.setTaskResult("REJECT");
} else {
systemReviewTask.setTaskResult("PASS");
}
systemReviewTaskMapper.updateById(systemReviewTask);
}
systemReviewTaskMapper.updateById(systemReviewTask);
}
......
......@@ -120,13 +120,8 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
@Override
public void submit(SystemReviewTaskSubmitRequest request) {
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(request.getTaskId());
if (detailsList != null) {
throw new ServiceException("存在未填写的问卷,请填写完整", HttpStatus.ERROR, detailsList);
} else {
SystemReviewTask systemReviewTask = systemReviewTaskService.getById(request.getTaskId());
strategySystemReviewTaskContext.getResource(systemReviewTask.getTaskStatus()).doSubmit(systemReviewTask);
}
SystemReviewTask systemReviewTask = systemReviewTaskService.getById(request.getTaskId());
strategySystemReviewTaskContext.getResource(systemReviewTask.getTaskStatus()).doSubmit(systemReviewTask);
}
}
......
......@@ -3,11 +3,11 @@ package com.ruoyi.web;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.service.CarReviewTaskService;
import com.ruoyi.web.request.CarReviewTaskCreateRequest;
import com.ruoyi.web.request.CarReviewTaskViewRequest;
import com.ruoyi.web.request.SystemReviewTaskViewRequest;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.CarReviewTaskViewResponse;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import io.swagger.annotations.Api;
......@@ -40,7 +40,7 @@ public class CarReviewTaskController extends BaseController {
return R.ok();
}
@ApiOperation("查看车辆审查任务详情")
@ApiOperation("查看车辆问卷审查任务详情")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/view")
......@@ -49,5 +49,40 @@ public class CarReviewTaskController extends BaseController {
return R.ok(carReviewTaskViewResponse);
}
@ApiOperation("启动车辆问卷审查任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/startReview")
public R<String> startReview(@Validated @RequestBody CarReviewTaskStartRequest request) {
carReviewTaskService.startReviewTask(request);
return R.ok();
}
@ApiOperation("提交车辆问卷审查任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/submitReview")
public R<String> submitReview(@Validated @RequestBody CarReviewTaskSubmitRequest request) {
carReviewTaskService.submitReviewTask(request);
return R.ok();
}
@ApiOperation("查询处理中的任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findPending")
public TableDataInfo<CarReviewTask> findPending(@Validated @RequestBody CarReviewTaskFindPendingRequest request) {
startPage(request);
return getDataTable(carReviewTaskService.findListByStatus(CarReviewTask.TASK_STATUS_PENDING));
}
@ApiOperation("查询处理完成的任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findFinish")
public TableDataInfo<CarReviewTask> findFinish(@Validated @RequestBody CarReviewTaskFindFinishRequest request) {
startPage(request);
return getDataTable(carReviewTaskService.findListByStatus(CarReviewTask.TASK_STATUS_FINISH));
}
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
@ApiModel
public class CarReviewTaskFindFinishRequest extends PageDomain {
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
@ApiModel
public class CarReviewTaskFindPendingRequest extends PageDomain {
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "CarReviewTaskStartRequest", description = "启动车辆问卷审查任务")
@Data
public class CarReviewTaskStartRequest {
@ApiModelProperty("任务id")
private Long taskId;
}
......@@ -46,6 +46,10 @@
</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,biz_info,create_time,leader_id,leader,standard_id,name,standard_no,file,review_status,test_status,review_start_time,review_submit_time,review_submit_id,review_submit_name,review_result
FROM t_system_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 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,biz_info,create_time,leader_id,leader,standard_id,name,standard_no,file,review_status,test_status,review_start_time,review_submit_time,review_submit_id,review_submit_name,review_result
FROM t_car_review_task WHERE task_status = #{taskStatus}
</select>
</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