超时任务转办修改
This commit is contained in:
parent
70846b6adf
commit
3a38918a39
|
|
@ -63,6 +63,15 @@ public class QmsIncomingInspectionTaskController extends BaseController {
|
|||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 超时任务领导转办
|
||||
*/
|
||||
@PostMapping("leader-transfer")
|
||||
public ApiResult<Void> leaderTransfer(@Valid @RequestBody QmsIncomingInspectionTaskLeaderTransferQO request) {
|
||||
incomingInspectionTaskControllerService.leaderTransfer(request);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询来料检测任务记录
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.nflg.wms.common.pojo.ApiResult;
|
|||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskInspectionResultQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordDefectSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordLeaderTransferQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordStatusItemDetailQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordTransferQO;
|
||||
|
|
@ -42,6 +43,15 @@ public class QmsPdiTaskRecordController extends BaseController {
|
|||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 超时任务领导转办
|
||||
*/
|
||||
@PostMapping("leader-transfer")
|
||||
public ApiResult<Void> leaderTransfer(@Valid @RequestBody QmsPdiTaskRecordLeaderTransferQO request) {
|
||||
taskRecordControllerService.leaderTransfer(request);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询检测任务列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -115,6 +115,12 @@ public class IncomingInspectionTaskControllerService {
|
|||
@Resource
|
||||
private IQmsIncomingInspectionTaskQrService incomingInspectionTaskQrService;
|
||||
|
||||
@Resource
|
||||
private IUserInteriorService userInteriorService;
|
||||
|
||||
@Resource
|
||||
private IDepartmentService departmentService;
|
||||
|
||||
/**
|
||||
* 来料检验申请(对外接口)
|
||||
* 业务规则:
|
||||
|
|
@ -740,7 +746,7 @@ public class IncomingInspectionTaskControllerService {
|
|||
.eq(QmsQualityInspector::getInspectionType, 1)
|
||||
.last("LIMIT 1")
|
||||
.one();
|
||||
return incomingInspectionTaskService.todoSearch(request, Objects.isNull(inspector) ? 0 : inspector.getId());
|
||||
return incomingInspectionTaskService.todoSearch(request, Objects.isNull(inspector) ? 0 : inspector.getId(), userId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -755,10 +761,7 @@ public class IncomingInspectionTaskControllerService {
|
|||
.eq(QmsQualityInspector::getInspectionType, 1)
|
||||
.last("LIMIT 1")
|
||||
.one();
|
||||
if (Objects.isNull(inspector)) {
|
||||
return new QmsIncomingInspectionTaskCountVO();
|
||||
}
|
||||
return incomingInspectionTaskService.countByCurrentUser(inspector.getId());
|
||||
return incomingInspectionTaskService.countByCurrentUser(Objects.isNull(inspector) ? 0 : inspector.getId(), userId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -808,6 +811,50 @@ public class IncomingInspectionTaskControllerService {
|
|||
.update();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void leaderTransfer(QmsIncomingInspectionTaskLeaderTransferQO request) {
|
||||
QmsIncomingInspectionTask task = incomingInspectionTaskService.getById(request.getId());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(task)).throwMessage("任务不存在");
|
||||
VUtil.trueThrowBusinessError(!Objects.equals(task.getIsOverdue(), true)).throwMessage("仅允许转办超时任务");
|
||||
VUtil.trueThrowBusinessError(Objects.equals(task.getInspectionStatus(), (short) 2)).throwMessage("已检状态的任务不允许转办");
|
||||
|
||||
User assigneeUser = userService.getById(request.getAssigneeId());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(assigneeUser)).throwMessage("转办人用户信息不存在");
|
||||
|
||||
Long currentUserId = UserUtil.getUserId();
|
||||
Long handlerUserId = getIncomingTaskHandlerUserId(task);
|
||||
VUtil.trueThrowBusinessError(!isDirectLeader(currentUserId, handlerUserId)).throwMessage("只有当前处理人的直属领导才能转办超时任务");
|
||||
|
||||
incomingInspectionTaskService.lambdaUpdate()
|
||||
.eq(QmsIncomingInspectionTask::getId, task.getId())
|
||||
.ne(QmsIncomingInspectionTask::getInspectionStatus, (short) 2)
|
||||
.set(QmsIncomingInspectionTask::getAssigneeId, assigneeUser.getId())
|
||||
.set(QmsIncomingInspectionTask::getUpdateUserId, currentUserId)
|
||||
.set(QmsIncomingInspectionTask::getUpdateUserName, UserUtil.getUserName())
|
||||
.set(QmsIncomingInspectionTask::getUpdateTime, LocalDateTime.now())
|
||||
.update();
|
||||
}
|
||||
|
||||
private Long getIncomingTaskHandlerUserId(QmsIncomingInspectionTask task) {
|
||||
Long handlerInspectorId = Objects.nonNull(task.getAgentId()) ? task.getAgentId() : task.getInspectorId();
|
||||
QmsQualityInspector handler = qualityInspectorService.getById(handlerInspectorId);
|
||||
return handler == null ? null : handler.getUserId();
|
||||
}
|
||||
|
||||
private boolean isDirectLeader(Long leaderUserId, Long userId) {
|
||||
if (leaderUserId == null || userId == null) {
|
||||
return false;
|
||||
}
|
||||
UserInterior userInterior = userInteriorService.lambdaQuery()
|
||||
.eq(UserInterior::getUserId, userId)
|
||||
.one();
|
||||
if (userInterior == null || userInterior.getDeptId() == null) {
|
||||
return false;
|
||||
}
|
||||
Department department = departmentService.getById(userInterior.getDeptId());
|
||||
return department != null && Objects.equals(department.getHeadUserId(), leaderUserId);
|
||||
}
|
||||
|
||||
public List<QmsIncomingInspectionTaskRecord> getRecords(Long taskId) {
|
||||
return incomingInspectionTaskRecordService.lambdaQuery()
|
||||
.eq(QmsIncomingInspectionTaskRecord::getTaskId, taskId)
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@ import com.nflg.wms.common.exception.NflgException;
|
|||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskInspectionResultQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordDefectSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordLeaderTransferQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordStatusItemDetailQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordTransferQO;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskInspectionResultVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordDetailVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordDefectPageVO;
|
||||
|
|
@ -26,6 +28,7 @@ import com.nflg.wms.repository.entity.QmsPdiInspectionResults;
|
|||
import com.nflg.wms.repository.entity.QmsPdiTaskRecord;
|
||||
import com.nflg.wms.repository.entity.FileUploadRecord;
|
||||
import com.nflg.wms.repository.entity.User;
|
||||
import com.nflg.wms.repository.entity.UserInterior;
|
||||
import com.nflg.wms.repository.service.IQmsPdiComponentAnagementService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiDetectionRulesDeliveryItemService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiDetectionRulesService;
|
||||
|
|
@ -33,7 +36,10 @@ import com.nflg.wms.repository.service.IQmsPdiDetectionRulesStatusItemService;
|
|||
import com.nflg.wms.repository.service.IQmsPdiInspectionResultsService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiTaskRecordService;
|
||||
import com.nflg.wms.repository.service.IFileUploadRecordService;
|
||||
import com.nflg.wms.repository.service.IDepartmentService;
|
||||
import com.nflg.wms.repository.service.IUserService;
|
||||
import com.nflg.wms.repository.service.IUserInteriorService;
|
||||
import com.nflg.wms.repository.entity.Department;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -77,6 +83,12 @@ public class QmsPdiTaskRecordControllerService {
|
|||
@Resource
|
||||
private IQmsPdiComponentAnagementService componentAnagementService;
|
||||
|
||||
@Resource
|
||||
private IUserInteriorService userInteriorService;
|
||||
|
||||
@Resource
|
||||
private IDepartmentService departmentService;
|
||||
|
||||
// ========================= 转办 =========================
|
||||
|
||||
/**
|
||||
|
|
@ -98,6 +110,56 @@ public class QmsPdiTaskRecordControllerService {
|
|||
/**
|
||||
* 分页查询(关联检测规则、质检人、帮办人)
|
||||
*/
|
||||
public void leaderTransfer(QmsPdiTaskRecordLeaderTransferQO request) {
|
||||
QmsPdiTaskRecord record = taskRecordService.getById(request.getId());
|
||||
if (Objects.isNull(record)) {
|
||||
throw new NflgException(STATE.BusinessError, "检测任务记录不存在");
|
||||
}
|
||||
if (!Objects.equals(record.getOverdue(), true)) {
|
||||
throw new NflgException(STATE.BusinessError, "仅允许转办超时任务");
|
||||
}
|
||||
if (Objects.nonNull(record.getDetectionCompletionTime()) || Objects.equals(record.getInspectionEnable(), 2)) {
|
||||
throw new NflgException(STATE.BusinessError, "已完成状态的任务不允许转办");
|
||||
}
|
||||
|
||||
User assignee = userService.getById(request.getAssigneeId());
|
||||
if (Objects.isNull(assignee)) {
|
||||
throw new NflgException(STATE.BusinessError, "转办人用户信息不存在");
|
||||
}
|
||||
|
||||
QmsPdiDetectionRules rules = detectionRulesService.getById(record.getDetectionRulesId());
|
||||
if (Objects.isNull(rules) || Objects.isNull(rules.getInspectorId())) {
|
||||
throw new NflgException(STATE.BusinessError, "检测规则或质检人不存在");
|
||||
}
|
||||
|
||||
Long currentUserId = UserUtil.getUserId();
|
||||
boolean canTransfer = isDirectLeader(currentUserId, rules.getInspectorId())
|
||||
|| isDirectLeader(currentUserId, record.getAssistantId());
|
||||
if (!canTransfer) {
|
||||
throw new NflgException(STATE.BusinessError, "只有当前处理人的直属领导才能转办超时任务");
|
||||
}
|
||||
|
||||
taskRecordService.lambdaUpdate()
|
||||
.eq(QmsPdiTaskRecord::getId, record.getId())
|
||||
.isNull(QmsPdiTaskRecord::getDetectionCompletionTime)
|
||||
.set(QmsPdiTaskRecord::getAssigneeId, assignee.getId())
|
||||
.update();
|
||||
}
|
||||
|
||||
private boolean isDirectLeader(Long leaderUserId, Long userId) {
|
||||
if (leaderUserId == null || userId == null) {
|
||||
return false;
|
||||
}
|
||||
UserInterior userInterior = userInteriorService.lambdaQuery()
|
||||
.eq(UserInterior::getUserId, userId)
|
||||
.one();
|
||||
if (userInterior == null || userInterior.getDeptId() == null) {
|
||||
return false;
|
||||
}
|
||||
Department department = departmentService.getById(userInterior.getDeptId());
|
||||
return department != null && Objects.equals(department.getHeadUserId(), leaderUserId);
|
||||
}
|
||||
|
||||
public PageData<QmsPdiTaskRecordPageVO> search(QmsPdiTaskRecordSearchQO request) {
|
||||
// 填充当前登录用户ID(用于数据权限过滤)
|
||||
Page<QmsPdiTaskRecordPageVO> page = taskRecordService.search(request);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 来料检测超时任务领导转办参数
|
||||
*/
|
||||
@Data
|
||||
public class QmsIncomingInspectionTaskLeaderTransferQO {
|
||||
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
@NotNull(message = "任务ID不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 转办人ID(user.id)
|
||||
*/
|
||||
@NotNull(message = "转办人不能为空")
|
||||
private Long assigneeId;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* PDI超时任务领导转办参数
|
||||
*/
|
||||
@Data
|
||||
public class QmsPdiTaskRecordLeaderTransferQO {
|
||||
|
||||
/**
|
||||
* 任务记录ID
|
||||
*/
|
||||
@NotNull(message = "任务记录ID不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 转办人ID(user.id)
|
||||
*/
|
||||
@NotNull(message = "转办人不能为空")
|
||||
private Long assigneeId;
|
||||
}
|
||||
|
|
@ -176,6 +176,16 @@ public class QmsIncomingInspectionTaskVO {
|
|||
*/
|
||||
private String agentName;
|
||||
|
||||
/**
|
||||
* 转办人ID(user.id)
|
||||
*/
|
||||
private Long assigneeId;
|
||||
|
||||
/**
|
||||
* 转办人姓名
|
||||
*/
|
||||
private String assigneeName;
|
||||
|
||||
private String currentHandlerName;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -55,6 +55,16 @@ public class QmsPdiInspectionResultsPageVO {
|
|||
*/
|
||||
private Integer inspectionEnable;
|
||||
|
||||
/**
|
||||
* 转办人ID(user.id)
|
||||
*/
|
||||
private Long assigneeId;
|
||||
|
||||
/**
|
||||
* 转办人姓名
|
||||
*/
|
||||
private String assigneeName;
|
||||
|
||||
private String currentHandlerName;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -85,6 +85,16 @@ public class QmsPdiTaskRecordDefectPageVO {
|
|||
*/
|
||||
private Long assistantId;
|
||||
|
||||
/**
|
||||
* 转办人ID(user.id)
|
||||
*/
|
||||
private Long assigneeId;
|
||||
|
||||
/**
|
||||
* 转办人姓名
|
||||
*/
|
||||
private String assigneeName;
|
||||
|
||||
private String currentHandlerName;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -75,6 +75,16 @@ public class QmsPdiTaskRecordPageVO {
|
|||
*/
|
||||
private String assistantName;
|
||||
|
||||
/**
|
||||
* 转办人ID(user.id)
|
||||
*/
|
||||
private Long assigneeId;
|
||||
|
||||
/**
|
||||
* 转办人姓名
|
||||
*/
|
||||
private String assigneeName;
|
||||
|
||||
private String currentHandlerName;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -147,6 +147,11 @@ public class QmsIncomingInspectionTask implements Serializable {
|
|||
*/
|
||||
private String agentName;
|
||||
|
||||
/**
|
||||
* 转办人id
|
||||
*/
|
||||
private Long assigneeId;
|
||||
|
||||
/**
|
||||
* 送检时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -52,6 +52,11 @@ public class QmsPdiTaskRecord implements Serializable {
|
|||
*/
|
||||
private Long assistantId;
|
||||
|
||||
/**
|
||||
* 转办人id
|
||||
*/
|
||||
private Long assigneeId;
|
||||
|
||||
/**
|
||||
* 送检时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,15 +7,16 @@ import com.nflg.wms.common.pojo.qo.QmsIncomingInspectionTaskSearchQO;
|
|||
import com.nflg.wms.common.pojo.qo.QmsIncomingInspectionTaskTodoSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsIncomingInspectionTaskVO;
|
||||
import com.nflg.wms.repository.entity.QmsIncomingInspectionTask;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 来料检测任务 Mapper
|
||||
*/
|
||||
public interface QmsIncomingInspectionTaskMapper extends BaseMapper<QmsIncomingInspectionTask> {
|
||||
|
||||
IPage<QmsIncomingInspectionTaskVO> search(QmsIncomingInspectionTaskSearchQO request, Page<Object> page);
|
||||
IPage<QmsIncomingInspectionTaskVO> search(@Param("request") QmsIncomingInspectionTaskSearchQO request, Page<Object> page);
|
||||
|
||||
IPage<QmsIncomingInspectionTaskVO> todoSearch(QmsIncomingInspectionTaskTodoSearchQO request, Page<Object> page, Long inspectorId);
|
||||
IPage<QmsIncomingInspectionTaskVO> todoSearch(@Param("request") QmsIncomingInspectionTaskTodoSearchQO request, Page<Object> page, @Param("inspectorId") Long inspectorId, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 根据id查询任务详情
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public interface IQmsIncomingInspectionTaskService extends IService<QmsIncomingI
|
|||
* @param inspectorId 质检人员id
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<QmsIncomingInspectionTaskVO> todoSearch(QmsIncomingInspectionTaskTodoSearchQO request, Long inspectorId);
|
||||
IPage<QmsIncomingInspectionTaskVO> todoSearch(QmsIncomingInspectionTaskTodoSearchQO request, Long inspectorId, Long userId);
|
||||
|
||||
/**
|
||||
* 转办
|
||||
|
|
@ -39,7 +39,7 @@ public interface IQmsIncomingInspectionTaskService extends IService<QmsIncomingI
|
|||
* @param inspectorId 质检人员id
|
||||
* @return 任务数量统计
|
||||
*/
|
||||
QmsIncomingInspectionTaskCountVO countByCurrentUser(Long inspectorId);
|
||||
QmsIncomingInspectionTaskCountVO countByCurrentUser(Long inspectorId, Long userId);
|
||||
|
||||
/**
|
||||
* 根据id查询任务详情
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ public class QmsIncomingInspectionTaskServiceImpl extends ServiceImpl<QmsIncomin
|
|||
}
|
||||
|
||||
@Override
|
||||
public IPage<QmsIncomingInspectionTaskVO> todoSearch(QmsIncomingInspectionTaskTodoSearchQO request, Long inspectorId) {
|
||||
return baseMapper.todoSearch(request, new Page<>(request.getPage(), request.getPageSize()), inspectorId);
|
||||
public IPage<QmsIncomingInspectionTaskVO> todoSearch(QmsIncomingInspectionTaskTodoSearchQO request, Long inspectorId, Long userId) {
|
||||
return baseMapper.todoSearch(request, new Page<>(request.getPage(), request.getPageSize()), inspectorId, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -37,12 +37,14 @@ public class QmsIncomingInspectionTaskServiceImpl extends ServiceImpl<QmsIncomin
|
|||
}
|
||||
|
||||
@Override
|
||||
public QmsIncomingInspectionTaskCountVO countByCurrentUser(Long inspectorId) {
|
||||
public QmsIncomingInspectionTaskCountVO countByCurrentUser(Long inspectorId, Long userId) {
|
||||
List<QmsIncomingInspectionTask> list = lambdaQuery()
|
||||
.select(QmsIncomingInspectionTask::getInspectionStatus, QmsIncomingInspectionTask::getIsOverdue)
|
||||
.and(a -> a.eq(QmsIncomingInspectionTask::getInspectorId, inspectorId)
|
||||
.or()
|
||||
.eq(QmsIncomingInspectionTask::getAgentId, inspectorId)
|
||||
.or()
|
||||
.eq(QmsIncomingInspectionTask::getAssigneeId, userId)
|
||||
)
|
||||
.list();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@
|
|||
t.inspector_name,
|
||||
t.agent_id,
|
||||
t.agent_name,
|
||||
t.assignee_id,
|
||||
au.user_name AS assignee_name,
|
||||
CASE
|
||||
WHEN au.user_name IS NOT NULL THEN au.user_name
|
||||
WHEN t.agent_name IS NOT NULL AND t.inspector_name IS NOT NULL AND t.agent_name != t.inspector_name
|
||||
THEN t.agent_name || ';' || t.inspector_name
|
||||
ELSE COALESCE(t.agent_name, t.inspector_name)
|
||||
|
|
@ -54,6 +57,7 @@
|
|||
LEFT JOIN qms_qc_material m ON t.material_id = m.id
|
||||
LEFT JOIN qms_inspection_standard s ON t.inspection_standard_id = s.id
|
||||
LEFT JOIN qms_incoming_inspection_task t2 ON t.related_task_id = t2.id
|
||||
LEFT JOIN "user" au ON au.id = t.assignee_id
|
||||
<where>
|
||||
<if test="request.dataType != null">
|
||||
AND t.data_type = #{request.dataType}
|
||||
|
|
@ -138,7 +142,10 @@
|
|||
t.inspector_name,
|
||||
t.agent_id,
|
||||
t.agent_name,
|
||||
t.assignee_id,
|
||||
au.user_name AS assignee_name,
|
||||
CASE
|
||||
WHEN au.user_name IS NOT NULL THEN au.user_name
|
||||
WHEN t.agent_name IS NOT NULL AND t.inspector_name IS NOT NULL AND t.agent_name != t.inspector_name
|
||||
THEN t.agent_name || ';' || t.inspector_name
|
||||
ELSE COALESCE(t.agent_name, t.inspector_name)
|
||||
|
|
@ -157,6 +164,7 @@
|
|||
LEFT JOIN qms_qc_material m ON t.material_id = m.id
|
||||
LEFT JOIN qms_inspection_standard s ON t.inspection_standard_id = s.id
|
||||
LEFT JOIN qms_incoming_inspection_task t2 ON t.related_task_id = t2.id
|
||||
LEFT JOIN "user" au ON au.id = t.assignee_id
|
||||
<where>
|
||||
<choose>
|
||||
<when test="request.isOverdue != null">
|
||||
|
|
@ -166,7 +174,7 @@
|
|||
t.inspection_status = #{request.inspectionStatus}
|
||||
</when>
|
||||
</choose>
|
||||
AND (t.inspector_id = #{inspectorId} OR t.agent_id = #{inspectorId})
|
||||
AND (t.inspector_id = #{inspectorId} OR t.agent_id = #{inspectorId} OR t.assignee_id = #{userId})
|
||||
<if test="request.key != null and request.key != ''">
|
||||
AND (m.material_no ilike concat('%', #{request.key}, '%')
|
||||
or m.material_desc ilike concat('%', #{request.key}, '%')
|
||||
|
|
@ -208,7 +216,10 @@
|
|||
t.inspector_name,
|
||||
t.agent_id,
|
||||
t.agent_name,
|
||||
t.assignee_id,
|
||||
au.user_name AS assignee_name,
|
||||
CASE
|
||||
WHEN au.user_name IS NOT NULL THEN au.user_name
|
||||
WHEN t.agent_name IS NOT NULL AND t.inspector_name IS NOT NULL AND t.agent_name != t.inspector_name
|
||||
THEN t.agent_name || ';' || t.inspector_name
|
||||
ELSE COALESCE(t.agent_name, t.inspector_name)
|
||||
|
|
@ -233,6 +244,7 @@
|
|||
LEFT JOIN qms_qc_material m ON t.material_id = m.id
|
||||
LEFT JOIN qms_inspection_standard s ON t.inspection_standard_id = s.id
|
||||
LEFT JOIN qms_incoming_inspection_task t2 ON t.related_task_id = t2.id
|
||||
LEFT JOIN "user" au ON au.id = t.assignee_id
|
||||
WHERE t.id = #{id}
|
||||
</select>
|
||||
|
||||
|
|
@ -246,15 +258,17 @@
|
|||
SELECT COUNT(1)
|
||||
FROM qms_incoming_inspection_task qiit
|
||||
INNER JOIN qms_quality_inspector qqi ON qiit.inspector_id=qqi."id"
|
||||
LEFT JOIN qms_quality_inspector agent ON qiit.agent_id=agent."id"
|
||||
INNER JOIN "user" u ON u."id"=qqi.user_id
|
||||
WHERE u."id"=#{userId} AND qiit.inspection_type=0 AND qiit.inspection_status < 2
|
||||
WHERE (u."id"=#{userId} OR agent.user_id=#{userId} OR qiit.assignee_id=#{userId}) AND qiit.inspection_type=0 AND qiit.inspection_status < 2
|
||||
</select>
|
||||
|
||||
<select id="getInventoryTodoNumByUserId" resultType="java.lang.Long">
|
||||
SELECT COUNT(1)
|
||||
FROM qms_incoming_inspection_task qiit
|
||||
INNER JOIN qms_quality_inspector qqi ON qiit.inspector_id=qqi."id"
|
||||
LEFT JOIN qms_quality_inspector agent ON qiit.agent_id=agent."id"
|
||||
INNER JOIN "user" u ON u."id"=qqi.user_id
|
||||
WHERE u."id"=#{userId} AND qiit.inspection_type=1 AND qiit.inspection_status < 2
|
||||
WHERE (u."id"=#{userId} OR agent.user_id=#{userId} OR qiit.assignee_id=#{userId}) AND qiit.inspection_type=1 AND qiit.inspection_status < 2
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,10 @@
|
|||
t.submission_time AS submissionTime,
|
||||
t.required_completion_time AS requiredCompletionTime,
|
||||
t.inspection_enable AS inspectionEnable,
|
||||
t.assignee_id AS assigneeId,
|
||||
uass.user_name AS assigneeName,
|
||||
CASE
|
||||
WHEN uass.user_name IS NOT NULL THEN uass.user_name
|
||||
WHEN ua.user_name IS NOT NULL AND ui.user_name IS NOT NULL AND ua.user_name != ui.user_name
|
||||
THEN ua.user_name || ';' || ui.user_name
|
||||
ELSE COALESCE(ua.user_name, ui.user_name)
|
||||
|
|
@ -24,10 +27,11 @@
|
|||
LEFT JOIN qms_pdi_detection_rules r ON r.id = t.detection_rules_id
|
||||
LEFT JOIN "user" ui ON ui.id = r.inspector_id
|
||||
LEFT JOIN "user" ua ON ua.id = t.assistant_id
|
||||
LEFT JOIN "user" uass ON uass.id = t.assignee_id
|
||||
<where>
|
||||
<!-- 权限过滤:只能看自己是帮办人或质检负责人的任务单 -->
|
||||
<if test="request.userId != null">
|
||||
AND (t.assistant_id = #{request.userId} OR r.inspector_id = #{request.userId})
|
||||
AND (t.assistant_id = #{request.userId} OR r.inspector_id = #{request.userId} OR t.assignee_id = #{request.userId})
|
||||
</if>
|
||||
<!-- 关键字模糊匹配:机型编号、订单编号、机台编号、任务单号 -->
|
||||
<if test="request.key != null and request.key != ''">
|
||||
|
|
@ -61,7 +65,10 @@
|
|||
t.submission_time AS submissionTime,
|
||||
t.required_completion_time AS requiredCompletionTime,
|
||||
t.inspection_enable AS inspectionEnable,
|
||||
t.assignee_id AS assigneeId,
|
||||
uass.user_name AS assigneeName,
|
||||
CASE
|
||||
WHEN uass.user_name IS NOT NULL THEN uass.user_name
|
||||
WHEN ua.user_name IS NOT NULL AND ui.user_name IS NOT NULL AND ua.user_name != ui.user_name
|
||||
THEN ua.user_name || ';' || ui.user_name
|
||||
ELSE COALESCE(ua.user_name, ui.user_name)
|
||||
|
|
@ -71,9 +78,10 @@
|
|||
LEFT JOIN qms_pdi_detection_rules r ON r.id = t.detection_rules_id
|
||||
LEFT JOIN "user" ui ON ui.id = r.inspector_id
|
||||
LEFT JOIN "user" ua ON ua.id = t.assistant_id
|
||||
LEFT JOIN "user" uass ON uass.id = t.assignee_id
|
||||
<where>
|
||||
<if test="request.userId != null">
|
||||
AND (t.assistant_id = #{request.userId} OR r.inspector_id = #{request.userId})
|
||||
AND (t.assistant_id = #{request.userId} OR r.inspector_id = #{request.userId} OR t.assignee_id = #{request.userId})
|
||||
</if>
|
||||
<if test="request.taskStatus != null and request.taskStatus != 9">
|
||||
AND t.inspection_enable = #{request.taskStatus}
|
||||
|
|
@ -97,7 +105,7 @@
|
|||
LEFT JOIN qms_pdi_detection_rules r ON r.id = t.detection_rules_id
|
||||
<where>
|
||||
<if test="userId != null">
|
||||
AND (t.assistant_id = #{userId} OR r.inspector_id = #{userId})
|
||||
AND (t.assistant_id = #{userId} OR r.inspector_id = #{userId} OR t.assignee_id = #{userId})
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@
|
|||
t.inspection_inspection AS inspectionInspection,
|
||||
ui.user_name AS inspectorName,
|
||||
ua.user_name AS assistantName,
|
||||
t.assignee_id AS assigneeId,
|
||||
uass.user_name AS assigneeName,
|
||||
CASE
|
||||
WHEN uass.user_name IS NOT NULL THEN uass.user_name
|
||||
WHEN ua.user_name IS NOT NULL AND ui.user_name IS NOT NULL AND ua.user_name != ui.user_name
|
||||
THEN ua.user_name || ';' || ui.user_name
|
||||
ELSE COALESCE(ua.user_name, ui.user_name)
|
||||
|
|
@ -32,6 +35,7 @@
|
|||
LEFT JOIN qms_pdi_detection_rules r ON r.id = t.detection_rules_id
|
||||
LEFT JOIN "user" ui ON ui.id = r.inspector_id
|
||||
LEFT JOIN "user" ua ON ua.id = t.assistant_id
|
||||
LEFT JOIN "user" uass ON uass.id = t.assignee_id
|
||||
<where>
|
||||
<if test="request.inspectionType != null">
|
||||
AND r.inspection_type = #{request.inspectionType}
|
||||
|
|
@ -83,7 +87,10 @@
|
|||
r.inspector_id AS inspectorId,
|
||||
ua.user_name AS assistantName,
|
||||
t.assistant_id AS assistantId,
|
||||
t.assignee_id AS assigneeId,
|
||||
uass.user_name AS assigneeName,
|
||||
CASE
|
||||
WHEN uass.user_name IS NOT NULL THEN uass.user_name
|
||||
WHEN ua.user_name IS NOT NULL AND ui.user_name IS NOT NULL AND ua.user_name != ui.user_name
|
||||
THEN ua.user_name || ';' || ui.user_name
|
||||
ELSE COALESCE(ua.user_name, ui.user_name)
|
||||
|
|
@ -104,6 +111,7 @@
|
|||
LEFT JOIN qms_pdi_detection_rules r ON r.id = t.detection_rules_id
|
||||
LEFT JOIN "user" ui ON ui.id = r.inspector_id
|
||||
LEFT JOIN "user" ua ON ua.id = t.assistant_id
|
||||
LEFT JOIN "user" uass ON uass.id = t.assignee_id
|
||||
LEFT JOIN qms_issue_ticket it ON it.source_type = 1 AND it.source_id = t.id
|
||||
<where>
|
||||
<!-- 固定条件:已完成/待流转,且(总体不合格 或 存在不合格检测项) -->
|
||||
|
|
@ -145,7 +153,7 @@
|
|||
FROM qms_pdi_task_record qptr
|
||||
INNER JOIN qms_pdi_detection_rules qpdr ON qptr.detection_rules_id=qpdr."id"
|
||||
INNER JOIN "user" u ON u."id"=qpdr.inspector_id
|
||||
WHERE u."id"=#{userId} AND qpdr.inspection_type=0 AND qptr.inspection_enable < 2
|
||||
WHERE (u."id"=#{userId} OR qptr.assistant_id=#{userId} OR qptr.assignee_id=#{userId}) AND qpdr.inspection_type=0 AND qptr.inspection_enable < 2
|
||||
</select>
|
||||
|
||||
<select id="getInventoryTodoNumByUserId" resultType="java.lang.Long">
|
||||
|
|
@ -153,6 +161,6 @@
|
|||
FROM qms_pdi_task_record qptr
|
||||
INNER JOIN qms_pdi_detection_rules qpdr ON qptr.detection_rules_id=qpdr."id"
|
||||
INNER JOIN "user" u ON u."id"=qpdr.inspector_id
|
||||
WHERE u."id"=#{userId} AND qpdr.inspection_type=1 AND qptr.inspection_enable < 2
|
||||
WHERE (u."id"=#{userId} OR qptr.assistant_id=#{userId} OR qptr.assignee_id=#{userId}) AND qpdr.inspection_type=1 AND qptr.inspection_enable < 2
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue