Commit 1a1b4234 authored by 盖献康's avatar 盖献康

Merge branch 'dev' of...

Merge branch 'dev' of ssh://gitlab.91isoft.com:10022/wangfei/vehicle-quality-review into gaixiankang
parents 4ffea6b0 960f6683
......@@ -26,8 +26,6 @@ public class Task {
@TableField(exist = false)
public static final String STATUS_NEW = "NEW";
@TableField(exist = false)
public static final String STATUS_PENDING = "PENDING";
@TableField(exist = false)
public static final String STATUS_FINISH = "FINISH";
@TableField(exist = false)
......@@ -58,7 +56,7 @@ public class Task {
@ApiModelProperty("任务名称")
private String taskName;
@ApiModelProperty("任务状态(NEW、PENDING、FINISH)")
@ApiModelProperty("任务状态(NEW、FINISH)")
private String taskStatus;
@ApiModelProperty("产品名称")
......
......@@ -18,4 +18,6 @@ public interface ReviewDetailsMapper extends BaseMapper<ReviewDetails> {
* @return
*/
List<ReviewDetails> findNoResult(@Param("taskId") Long taskId);
Long count (@Param("taskId")Long taskId, @Param("type")String type);
}
......@@ -2,7 +2,10 @@ package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.Task;
import com.ruoyi.web.request.TaskFindFinishRequest;
import com.ruoyi.web.request.TaskFindPendingRequest;
import com.ruoyi.web.request.TaskListRequest;
import com.ruoyi.web.response.TaskFindPendingResponse;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -12,4 +15,8 @@ import java.util.List;
public interface TaskMapper extends BaseMapper<Task> {
List<Task> findList(TaskListRequest request);
List<TaskFindPendingResponse> findPending(TaskFindPendingRequest request);
List<Task> findFinish(TaskFindFinishRequest request);
}
......@@ -2,8 +2,9 @@ package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.Task;
import com.ruoyi.web.request.TaskCreateRequest;
import com.ruoyi.web.request.TaskListRequest;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.TaskFindPendingResponse;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -17,4 +18,22 @@ public interface TaskService extends IService<Task> {
List<Task> findList(TaskListRequest request);
void createTask(TaskCreateRequest request);
/**
* 查询进行中的任务
* @param request
* @return
*/
List<TaskFindPendingResponse> findPending(TaskFindPendingRequest request);
/**
* 查询完成的任务
* @param request
* @return
*/
List<Task> findFinish(TaskFindFinishRequest request);
void editTask(TaskEditRequest request);
void deleteTask(TaskDeleteRequest request);
}
......@@ -140,7 +140,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
for(ReviewDetails details : reviewDetailsList) {
ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
if(reviewDetailsResult.getPassed() != 0) {
if(reviewDetailsResult != null && reviewDetailsResult.getPassed() != 0) {
standard.setPassed(reviewDetailsResult.getPassed());
}
details.setResult(reviewDetailsResult);
......
......@@ -147,7 +147,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
for(ReviewDetails details : reviewDetailsList) {
ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
if(reviewDetailsResult.getPassed() != 0) {
if(reviewDetailsResult != null && reviewDetailsResult.getPassed() != 0) {
standard.setPassed(reviewDetailsResult.getPassed());
}
details.setResult(reviewDetailsResult);
......
......@@ -8,11 +8,14 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.service.*;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.request.TaskCreateRequest;
import com.ruoyi.web.request.TaskListRequest;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.TaskFindPendingResponse;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -46,6 +49,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Autowired
private CarReviewTaskService carReviewTaskService;
@Autowired
private SystemReviewTaskMapper systemReviewTaskMapper;
@Autowired
private CarReviewTaskMapper carReviewTaskMapper;
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
@Override
public List<Task> findList(TaskListRequest request) {
return taskMapper.findList(request);
......@@ -107,6 +119,63 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
}
@Override
public List<TaskFindPendingResponse> findPending(TaskFindPendingRequest request) {
List<TaskFindPendingResponse> responses = taskMapper.findPending(request);
for (TaskFindPendingResponse response : responses) {
if (response.getSystemReviewTaskId() != null) {
response.setSystemReview(reviewDetailsMapper.count(response.getSystemReviewTaskId(),"system"));
}
if (response.getCarReviewTaskId() != null) {
response.setCarReview(reviewDetailsMapper.count(response.getCarReviewTaskId(),"car"));
}
}
return responses;
}
@Override
public List<Task> findFinish(TaskFindFinishRequest request) {
return taskMapper.findFinish(request);
}
@Override
public void editTask(TaskEditRequest request) {
// 找到审查组长
TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors();
for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) {
leader = auditor;
break;
}
}
// 构建并保存任务信息
// 总任务
Task task = new Task();
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
BeanUtils.copyBeanProp(task, request);
taskService.updateById(task);
// 构建并保存该任务所关联的审核组信息
for(TaskUserRelation auditor : auditors) {
auditor.setTaskId(task.getId());
}
taskUserRelationService.updateBatchById(auditors);
}
@Override
public void deleteTask(TaskDeleteRequest request) {
Task task = taskMapper.selectById(request.getId());
systemReviewTaskMapper.deleteById(task.getSystemReviewTaskId());
carReviewTaskMapper.deleteById(task.getCarReviewTaskId());
taskMapper.deleteById(request.getId());
}
public Long saveSystemReview(TaskCreateRequest request,SysUser initiator,Standard standard,TaskUserRelation leader) {
// 构建并保存任务信息
......
......@@ -10,9 +10,8 @@ import com.ruoyi.domain.Task;
import com.ruoyi.domain.TaskUserRelation;
import com.ruoyi.service.TaskService;
import com.ruoyi.service.TaskUserRelationService;
import com.ruoyi.web.request.TaskCreateRequest;
import com.ruoyi.web.request.TaskGetInfoRequest;
import com.ruoyi.web.request.TaskListRequest;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.TaskFindPendingResponse;
import com.ruoyi.web.response.TaskGetInfoResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -72,4 +71,42 @@ public class TaskController extends BaseController {
return R.ok(response);
}
@ApiOperation("查询处理中的任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findPending")
public TableDataInfo<TaskFindPendingResponse> findPending(@Validated @RequestBody TaskFindPendingRequest request) {
startPage(request);
return getDataTable(taskService.findPending(request));
}
@ApiOperation("查询完成的任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findFinish")
public TableDataInfo<Task> findFinish(@Validated @RequestBody TaskFindFinishRequest request) {
startPage(request);
return getDataTable(taskService.findFinish(request));
}
@ApiOperation("编辑任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "编辑任务", businessType = BusinessType.UPDATE)
@RequestMapping(method = RequestMethod.POST, value = "/editTask")
public R<String> editTask(@Validated @RequestBody TaskEditRequest request) {
taskService.editTask(request);
return R.ok();
}
@ApiOperation("删除任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "删除任务", businessType = BusinessType.DELETE)
@RequestMapping(method = RequestMethod.POST, value = "/deleteTask")
public R<String> deleteTask(@Validated @RequestBody TaskDeleteRequest request) {
taskService.deleteTask(request);
return R.ok();
}
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "TaskDeleteRequest", description = "删除任务")
@Data
public class TaskDeleteRequest {
@ApiModelProperty("ID")
private Long id;
}
package com.ruoyi.web.request;
import com.ruoyi.domain.TaskUserRelation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@ApiModel(value = "TaskEditRequest", description = "编辑总任务")
@Data
public class TaskEditRequest {
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("小组成员")
private List<TaskUserRelation> auditors;
@ApiModelProperty("任务编号")
private String taskNo;
@ApiModelProperty("任务名称")
private String taskName;
@ApiModelProperty("产品名称")
private String productName;
@ApiModelProperty("产品型号")
private String productModel;
@ApiModelProperty("委托单位")
private String entrustedUnit;
@ApiModelProperty("委托单位地址")
private String entrustedUnitAddress;
@ApiModelProperty("委托单位电话")
private String entrustedUnitPhone;
@ApiModelProperty("委托单位邮政编码")
private String entrustedUnitCode;
@ApiModelProperty("车辆类型")
private String carType;
@ApiModelProperty("车辆识别码")
private String carIdentificationCode;
@ApiModelProperty("保密等级")
private String confidentialityLevel;
@ApiModelProperty("样品名称")
private String sampleName;
@ApiModelProperty("生产企业")
private String productionEnterprise;
@ApiModelProperty("送样者")
private String sampleSender;
@ApiModelProperty("送样日期")
private Date sendDate;
@ApiModelProperty("样品数量")
private String sampleNumber;
@ApiModelProperty("生产日期")
private Date productionDate;
@ApiModelProperty("商标")
private String trademark;
@ApiModelProperty("检验依据")
private String inspectionBasis;
@ApiModelProperty("选择的任务")
List<String> taskList;
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel(value = "TaskFindFinishRequest", description = "查询完成的总任务")
@Data
public class TaskFindFinishRequest extends PageDomain {
@ApiModelProperty("任务编号")
private String taskNo;
@ApiModelProperty("名称关键词")
private String taskName;
@ApiModelProperty("任务开始时间")
private Date taskBeginTime;
@ApiModelProperty("任务结束时间")
private Date taskEndTime;
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel(value = "TaskFindPendingRequest", description = "查询进行中总任务")
@Data
public class TaskFindPendingRequest extends PageDomain {
@ApiModelProperty("任务编号")
private String taskNo;
@ApiModelProperty("名称关键词")
private String taskName;
@ApiModelProperty("任务开始时间")
private Date taskBeginTime;
@ApiModelProperty("子任务状态")
private String subStatus;
}
package com.ruoyi.web.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "TaskFindPendingResponse", description = "进行中的总任务")
@Data
public class TaskFindPendingResponse {
@ApiModelProperty("主键")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
@ApiModelProperty("体系审查任务id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long systemReviewTaskId;
@ApiModelProperty("车辆检查任务id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long carReviewTaskId;
@ApiModelProperty("任务编号")
private String taskNo;
@ApiModelProperty("任务名称")
private String taskName;
@ApiModelProperty("任务状态(NEW、PENDING、FINISH)")
private String taskStatus;
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审核组长id")
private Long leaderId;
@ApiModelProperty("审核组长姓名")
private String leader;
@ApiModelProperty("体系审查任务状态")
private String reviewStatus;
@ApiModelProperty("车型审查任务状态")
private String carReviewStatus;
@ApiModelProperty("测试任务状态")
private String carTestStatus;
@ApiModelProperty("体系审查任务进度")
private Long systemReview;
@ApiModelProperty("车型审查任务进度")
private Long carReview;
@ApiModelProperty("测试任务进度")
private Long carTest;
}
......@@ -17,4 +17,13 @@
<select id="findNoResult" resultType="com.ruoyi.domain.ReviewDetails">
SELECT * FROM t_review_details WHERE id NOT IN (SELECT review_details_id FROM t_review_details_result WHERE task_id = #{taskId})
</select>
<select id="count" resultType="long">
SELECT
IFNULL((SELECT COUNT(*) FROM t_review_details_result WHERE task_id = #{taskId}), 0) /
IFNULL((SELECT COUNT(*) FROM t_review_details trd
INNER JOIN t_review_keypoint trk ON trk.id = trd.review_keypoint_id
INNER JOIN t_review_standard trs ON trs.id = trk.review_standard_id
WHERE trs.type = #{type}), 1) AS resultOverSum
</select>
</mapper>
......@@ -16,10 +16,10 @@
FROM t_standard
<where>
<if test="params.name != null and params.name != ''">
name like concat('%',#{params.name},'%')
and name like concat('%',#{params.name},'%')
</if>
<if test="params.standardNo != null and params.standardNo != ''">
standard_no = #{params.standardNo}
and standard_no = #{params.standardNo}
</if>
</where>
</select>
......
......@@ -41,6 +41,20 @@
<result property="file" column="file" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="ResponseMap" type="com.ruoyi.web.response.TaskFindPendingResponse">
<id property="id" column="id" jdbcType="BIGINT"/>
<id property="systemReviewTaskId" column="system_review_task_id" jdbcType="BIGINT"/>
<id property="carReviewTaskId" column="car_review_task_id" jdbcType="BIGINT"/>
<result property="taskNo" column="task_no" jdbcType="VARCHAR"/>
<result property="taskName" column="task_name" jdbcType="VARCHAR"/>
<result property="taskStatus" column="task_status" jdbcType="VARCHAR"/>
<result property="leaderId" column="leader_id" jdbcType="BIGINT"/>
<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="carTestStatus" column="car_test_status" jdbcType="VARCHAR"/>
</resultMap>
<select id="findList" parameterType="com.ruoyi.web.request.TaskListRequest" resultMap="BaseResultMap">
SELECT id, system_review_task_id, car_review_task_id,
task_no,task_name,task_status,product_name,product_model,
......@@ -63,6 +77,55 @@
</where>
order by create_time desc
</select>
<select id="findPending" parameterType="com.ruoyi.web.request.TaskFindPendingRequest" resultMap="ResponseMap">
SELECT t.id, t.system_review_task_id, t.car_review_task_id,
t.task_no,t.task_name,t.task_status,
t.leader_id,t.leader,
t.task_begin_time,
srt.task_status review_status,
crt.review_status car_review_status,
crt.test_status car_test_status
FROM t_task t
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="taskNo != null and taskNo != ''">
and t.task_no = #{taskNo}
</if>
<if test="taskName != null and taskName != ''">
and t.task_name like concat('%',#{taskName},'%')
</if>
<if test="taskBeginTime != null and taskBeginTime != ''">
and t.task_begin_time = #{taskBeginTime}
</if>
<if test="subStatus != null and subStatus != ''">
and review_status = #{subStatus} OR car_review_status = #{subStatus} OR car_test_status = #{subStatus}
</if>
</where>
</select>
<select id="findFinish" parameterType="com.ruoyi.web.request.TaskFindFinishRequest" resultType="com.ruoyi.domain.Task">
SELECT t.id, t.system_review_task_id, t.car_review_task_id,
t.task_no,t.task_name,t.task_status,
t.leader_id,t.leader,
t.task_begin_time,t.task_end_time
FROM t_task t
<where>
t.task_status IN ("FINISH")
<if test="taskNo != null and taskNo != ''">
and t.task_no = #{taskNo}
</if>
<if test="taskName != null and taskName != ''">
and t.task_name like concat('%',#{taskName},'%')
</if>
<if test="taskBeginTime != null and taskBeginTime != ''">
and t.task_begin_time = #{taskBeginTime}
</if>
<if test="taskEndTime != null and taskEndTime != ''">
and t.task_end_time = #{taskEndTime}
</if>
</where>
</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