Compare commits
2 Commits
e0e59a83fd
...
b6fed0ec51
| Author | SHA1 | Date |
|---|---|---|
|
|
b6fed0ec51 | |
|
|
f4657f70d3 |
|
|
@ -49,7 +49,7 @@ public class QmsIssueTicketController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 新增PDI检测工单
|
||||
* 新增PDI检测工单(平板使用)
|
||||
* 同步创建工单,异步创建工单处理记录
|
||||
*/
|
||||
@PostMapping("addPdiTicket")
|
||||
|
|
|
|||
|
|
@ -491,51 +491,44 @@ public class QmsIssueTicketControllerService {
|
|||
QmsPdiTicketDetailVO vo = new QmsPdiTicketDetailVO();
|
||||
vo.setTicketNo(ticket.getTicketNo());
|
||||
vo.setTicketTitle(ticket.getTicketTitle());
|
||||
vo.setProjectNo(ticket.getProjectNo());
|
||||
vo.setIncidentType(ticket.getIncidentType());
|
||||
vo.setExceptionCode(ticket.getExceptionCode());
|
||||
vo.setUnqualifiedQty(ticket.getUnqualifiedQty());
|
||||
vo.setCreator(ticket.getCreateUserName());
|
||||
vo.setCreateTime(ticket.getCreateTime());
|
||||
vo.setStatus(ticket.getStatus());
|
||||
|
||||
// 查询工单类型:PDI-新机检测 或 PDI-库存检测
|
||||
if (ticket.getSourceId() != null) {
|
||||
QmsPdiTaskRecord taskRecord = taskRecordService.getById(ticket.getSourceId());
|
||||
if (taskRecord != null && taskRecord.getDetectionRulesId() != null) {
|
||||
QmsPdiDetectionRules detectionRules = detectionRulesService.getById(taskRecord.getDetectionRulesId());
|
||||
if (detectionRules != null && detectionRules.getInspectionType() != null) {
|
||||
String inspectionTypeStr = detectionRules.getInspectionType() == 0 ? "新机检测" : "库存检测";
|
||||
vo.setTicketType("PDI-" + inspectionTypeStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查询处理记录列表
|
||||
List<QmsIssueTicketProcess> processes = issueTicketProcessService.lambdaQuery()
|
||||
.eq(QmsIssueTicketProcess::getIssueTicketId, id)
|
||||
.list();
|
||||
|
||||
// 收集所有不合格质检项
|
||||
List<QmsPdiTicketDetailVO.UnqualifiedItemVO> unqualifiedItems = new ArrayList<>();
|
||||
// 构建不合格检测项列表(每项关联处理信息)
|
||||
List<QmsPdiTicketDetailVO.InspectionItemVO> inspectionItems = new ArrayList<>();
|
||||
String rootCause = null;
|
||||
List<QmsPdiTicketDetailVO.MeasureVO> temporaryMeasures = new ArrayList<>();
|
||||
List<QmsPdiTicketDetailVO.MeasureVO> permanentMeasures = new ArrayList<>();
|
||||
|
||||
List<QmsPdiTicketDetailVO.ProcessVO> processVOList = processes.stream().map(process -> {
|
||||
QmsPdiTicketDetailVO.ProcessVO processVO = new QmsPdiTicketDetailVO.ProcessVO();
|
||||
processVO.setId(process.getId());
|
||||
processVO.setHandlerUserId(process.getHandlerUserId());
|
||||
processVO.setHandlerUserName(process.getHandlerUserName());
|
||||
|
||||
// 查询处理人所属部门
|
||||
if (process.getHandlerUserId() != null) {
|
||||
UserInterior userInterior = userInteriorService.lambdaQuery()
|
||||
.eq(UserInterior::getUserId, process.getHandlerUserId())
|
||||
.one();
|
||||
if (userInterior != null && userInterior.getDeptId() != null) {
|
||||
Department department = departmentService.getById(userInterior.getDeptId());
|
||||
if (department != null) {
|
||||
processVO.setHandlerDeptId(department.getId());
|
||||
processVO.setHandlerDeptName(department.getName());
|
||||
}
|
||||
}
|
||||
for (QmsIssueTicketProcess process : processes) {
|
||||
// 提取根本原因(取第一条)
|
||||
if (rootCause == null && StrUtil.isNotBlank(process.getRootCause())) {
|
||||
rootCause = process.getRootCause();
|
||||
}
|
||||
|
||||
processVO.setRootCause(process.getRootCause());
|
||||
processVO.setTaskResultIds(process.getTaskResultIds());
|
||||
processVO.setApprovalStatus(process.getApprovalStatus());
|
||||
processVO.setApprovalOpinion(process.getApprovalOpinion());
|
||||
processVO.setApprovalUserId(process.getApprovalUserId());
|
||||
processVO.setApprovalUserName(process.getApprovalUserName());
|
||||
processVO.setApprovalTime(process.getApprovalTime());
|
||||
processVO.setProcessTime(process.getApprovalTime());
|
||||
processVO.setLeaderApprovalResult(process.getLeaderApprovalResult());
|
||||
processVO.setLeaderApprovalOpinion(process.getLeaderApprovalOpinion());
|
||||
processVO.setLeaderUserId(process.getLeaderUserId());
|
||||
processVO.setLeaderUserName(process.getLeaderUserName());
|
||||
processVO.setLeaderApprovalTime(process.getLeaderApprovalTime());
|
||||
|
||||
// 查询不合格质检项(inspectionItemResults=false)
|
||||
// 查询该处理记录关联的不合格检测项
|
||||
if (StrUtil.isNotBlank(process.getTaskResultIds())) {
|
||||
String[] taskIds = process.getTaskResultIds().split(",");
|
||||
for (String taskId : taskIds) {
|
||||
|
|
@ -581,15 +574,34 @@ public class QmsIssueTicketControllerService {
|
|||
.collect(Collectors.toMap(FileUploadRecord::getId, r -> r, (a, b) -> a));
|
||||
}
|
||||
|
||||
// 查询处理人部门信息
|
||||
Long handlerDeptId = null;
|
||||
String handlerDeptName = null;
|
||||
if (process.getHandlerUserId() != null) {
|
||||
UserInterior userInterior = userInteriorService.lambdaQuery()
|
||||
.eq(UserInterior::getUserId, process.getHandlerUserId())
|
||||
.one();
|
||||
if (userInterior != null && userInterior.getDeptId() != null) {
|
||||
Department department = departmentService.getById(userInterior.getDeptId());
|
||||
if (department != null) {
|
||||
handlerDeptId = department.getId();
|
||||
handlerDeptName = department.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final Map<Long, QmsPdiDetectionRulesStatusItem> finalStatusItemMap = statusItemMap;
|
||||
final Map<Long, FileUploadRecord> finalExampleImageMap = exampleImageMap;
|
||||
final Long finalHandlerDeptId = handlerDeptId;
|
||||
final String finalHandlerDeptName = handlerDeptName;
|
||||
|
||||
for (QmsPdiInspectionResults result : unqualifiedResults) {
|
||||
QmsPdiTicketDetailVO.UnqualifiedItemVO itemVO = new QmsPdiTicketDetailVO.UnqualifiedItemVO();
|
||||
QmsPdiTicketDetailVO.InspectionItemVO itemVO = new QmsPdiTicketDetailVO.InspectionItemVO();
|
||||
itemVO.setId(result.getId());
|
||||
itemVO.setInspectionItemId(result.getInspectionItemId());
|
||||
itemVO.setInspectionItemType(result.getInspectionItemType());
|
||||
itemVO.setInspectionItemImage(parseImageList(result.getInspectionItemImage()));
|
||||
itemVO.setInspectionItemResults(result.getInspectionItemResults());
|
||||
itemVO.setRemark(result.getRemark());
|
||||
itemVO.setInspectorId(result.getInspectorId());
|
||||
itemVO.setInspectionTime(result.getInspectionTime());
|
||||
|
|
@ -617,18 +629,34 @@ public class QmsIssueTicketControllerService {
|
|||
}
|
||||
}
|
||||
|
||||
unqualifiedItems.add(itemVO);
|
||||
// 填充处理信息
|
||||
itemVO.setHandlerUserId(process.getHandlerUserId());
|
||||
itemVO.setHandlerUserName(process.getHandlerUserName());
|
||||
itemVO.setHandlerDeptId(finalHandlerDeptId);
|
||||
itemVO.setHandlerDeptName(finalHandlerDeptName);
|
||||
itemVO.setProcessTime(process.getApprovalTime());
|
||||
itemVO.setProcessStatus(process.getApprovalStatus());
|
||||
itemVO.setApprovalUserId(process.getApprovalUserId());
|
||||
itemVO.setApprovalUserName(process.getApprovalUserName());
|
||||
itemVO.setApprovalTime(process.getApprovalTime());
|
||||
itemVO.setApprovalStatus(process.getApprovalStatus());
|
||||
|
||||
inspectionItems.add(itemVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查询措施列表
|
||||
// 查询措施列表,按措施类型区分临时/永久
|
||||
List<QmsIssueTicketProcessMeasure> measures = issueTicketProcessMeasureService.lambdaQuery()
|
||||
.eq(QmsIssueTicketProcessMeasure::getIssueTicketProcessId, process.getId())
|
||||
.list();
|
||||
|
||||
List<QmsPdiTicketDetailVO.MeasureVO> measureVOList = measures.stream().map(measure -> {
|
||||
// 查询字典项ID
|
||||
Long temporaryTypeId = dictionaryItemService.getIdByCode("MeasureType", "TemporaryCorrectiveMeasures");
|
||||
Long permanentTypeId = dictionaryItemService.getIdByCode("MeasureType", "PermanentCorrectiveMeasures");
|
||||
|
||||
for (QmsIssueTicketProcessMeasure measure : measures) {
|
||||
QmsPdiTicketDetailVO.MeasureVO measureVO = new QmsPdiTicketDetailVO.MeasureVO();
|
||||
measureVO.setId(measure.getId());
|
||||
measureVO.setMeasureTypeId(measure.getMeasureTypeId());
|
||||
|
|
@ -637,22 +665,50 @@ public class QmsIssueTicketControllerService {
|
|||
measureVO.setPlanDate(measure.getPlanDate());
|
||||
measureVO.setConfirmDate(measure.getConfirmDate());
|
||||
measureVO.setRemark(measure.getRemark());
|
||||
return measureVO;
|
||||
}).toList();
|
||||
|
||||
processVO.setMeasures(measureVOList);
|
||||
return processVO;
|
||||
}).toList();
|
||||
// 根据measureTypeId区分临时措施和永久措施
|
||||
if (measure.getMeasureTypeId() != null) {
|
||||
if (measure.getMeasureTypeId().equals(temporaryTypeId)) {
|
||||
temporaryMeasures.add(measureVO);
|
||||
} else if (measure.getMeasureTypeId().equals(permanentTypeId)) {
|
||||
permanentMeasures.add(measureVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 构建处理人信息(按部门分组)
|
||||
Map<String, List<String>> handlers = new HashMap<>();
|
||||
for (QmsIssueTicketProcess process : processes) {
|
||||
if (process.getHandlerUserId() != null) {
|
||||
UserInterior userInterior = userInteriorService.lambdaQuery()
|
||||
.eq(UserInterior::getUserId, process.getHandlerUserId())
|
||||
.one();
|
||||
if (userInterior != null && userInterior.getDeptId() != null) {
|
||||
Department department = departmentService.getById(userInterior.getDeptId());
|
||||
if (department != null) {
|
||||
String deptName = department.getName();
|
||||
handlers.computeIfAbsent(deptName, k -> new ArrayList<>())
|
||||
.add(process.getHandlerUserName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vo.setInspectionItems(inspectionItems);
|
||||
vo.setHandlers(handlers);
|
||||
vo.setRootCause(rootCause);
|
||||
vo.setTemporaryMeasures(temporaryMeasures);
|
||||
vo.setPermanentMeasures(permanentMeasures);
|
||||
vo.setSignatures(new HashMap<>());
|
||||
|
||||
vo.setProcesses(processVOList);
|
||||
vo.setUnqualifiedItems(unqualifiedItems);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询本人的PDI工单详情
|
||||
* 校验当前登录人为工单创建者,或在处理记录中为处理人/审批人/上级领导
|
||||
* 工单创建者返回全部处理记录,其他人仅返回自己相关的处理记录及措施
|
||||
* 工单创建者返回全部检测项,其他人仅返回自己作为处理人的检测项
|
||||
*/
|
||||
public QmsPdiTicketMyDetailVO getMyPdiTicketDetail(Long id) {
|
||||
Long currentUserId = UserUtil.getUserId();
|
||||
|
|
@ -670,47 +726,211 @@ public class QmsIssueTicketControllerService {
|
|||
.eq(QmsIssueTicketProcess::getIssueTicketId, id)
|
||||
.list();
|
||||
} else {
|
||||
// 非创建者:仅返回自己相关的处理记录
|
||||
// 非创建者:仅返回自己作为处理人的记录
|
||||
processes = issueTicketProcessService.lambdaQuery()
|
||||
.eq(QmsIssueTicketProcess::getIssueTicketId, id)
|
||||
.and(w -> w
|
||||
.eq(QmsIssueTicketProcess::getHandlerUserId, currentUserId)
|
||||
.or().eq(QmsIssueTicketProcess::getApprovalUserId, currentUserId)
|
||||
.or().eq(QmsIssueTicketProcess::getLeaderUserId, currentUserId)
|
||||
)
|
||||
.eq(QmsIssueTicketProcess::getHandlerUserId, currentUserId)
|
||||
.list();
|
||||
}
|
||||
|
||||
// 构建返回VO
|
||||
QmsPdiTicketMyDetailVO vo = new QmsPdiTicketMyDetailVO();
|
||||
BeanUtil.copyProperties(ticket, vo);
|
||||
|
||||
// 将 imageIds 转换为图片详情列表
|
||||
vo.setTicketNo(ticket.getTicketNo());
|
||||
vo.setProjectNo(ticket.getTicketNo()); // 工程编号使用工单编号
|
||||
vo.setIncidentType(ticket.getIncidentType());
|
||||
vo.setExceptionCode(ticket.getExceptionCode());
|
||||
vo.setUnqualifiedQty(ticket.getUnqualifiedQty());
|
||||
vo.setRemark(ticket.getRemark());
|
||||
vo.setCreator(ticket.getCreateUserName());
|
||||
vo.setCreateTime(ticket.getCreateTime());
|
||||
vo.setStatus(ticket.getStatus());
|
||||
vo.setImages(parseImageList(ticket.getImageIds()));
|
||||
|
||||
// 构建处理记录列表
|
||||
List<QmsPdiTicketMyDetailVO.ProcessVO> processVOList = processes.stream().map(process -> {
|
||||
QmsPdiTicketMyDetailVO.ProcessVO processVO = new QmsPdiTicketMyDetailVO.ProcessVO();
|
||||
BeanUtil.copyProperties(process, processVO);
|
||||
// 设置处理时间(使用审批时间)
|
||||
processVO.setProcessTime(process.getApprovalTime());
|
||||
// 生成主题:机型编号+订单编号+出厂检测/库存检测+检测版本号
|
||||
if (ticket.getSourceId() != null) {
|
||||
QmsPdiTaskRecord taskRecord = taskRecordService.getById(ticket.getSourceId());
|
||||
if (taskRecord != null && taskRecord.getDetectionRulesId() != null) {
|
||||
QmsPdiDetectionRules detectionRules = detectionRulesService.getById(taskRecord.getDetectionRulesId());
|
||||
if (detectionRules != null) {
|
||||
String inspectionTypeStr = detectionRules.getInspectionType() != null && detectionRules.getInspectionType() == 0 ? "新机检测" : "库存检测";
|
||||
vo.setTicketTitle(detectionRules.getMachineNo() + "-" + detectionRules.getOrderNo() + "-" + inspectionTypeStr + "-" + detectionRules.getInspectionVersion());
|
||||
vo.setTicketType("PDI-" + inspectionTypeStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查询该处理记录下的措施列表
|
||||
// 查询当前登录人相关的检测项
|
||||
List<QmsPdiTicketMyDetailVO.InspectionItemVO> inspectionItems = new ArrayList<>();
|
||||
String rootCause = null;
|
||||
List<QmsPdiTicketMyDetailVO.MeasureVO> temporaryMeasures = new ArrayList<>();
|
||||
List<QmsPdiTicketMyDetailVO.MeasureVO> permanentMeasures = new ArrayList<>();
|
||||
|
||||
// 查询字典项:临时措施和永久措施的类型ID
|
||||
Long temporaryTypeId = dictionaryItemService.getIdByCode("MeasureType", "TemporaryCorrectiveMeasures");
|
||||
Long permanentTypeId = dictionaryItemService.getIdByCode("MeasureType", "PermanentCorrectiveMeasures");
|
||||
|
||||
for (QmsIssueTicketProcess process : processes) {
|
||||
// 提取根本原因
|
||||
if (rootCause == null && StrUtil.isNotBlank(process.getRootCause())) {
|
||||
rootCause = process.getRootCause();
|
||||
}
|
||||
|
||||
// 查询处理记录关联的不合格检测项
|
||||
if (StrUtil.isNotBlank(process.getTaskResultIds())) {
|
||||
List<Long> resultIds = Arrays.stream(process.getTaskResultIds().split(","))
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.map(String::trim)
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<QmsPdiInspectionResults> unqualifiedResults = inspectionResultsService.lambdaQuery()
|
||||
.in(QmsPdiInspectionResults::getId, resultIds)
|
||||
.eq(QmsPdiInspectionResults::getInspectionItemResults, false)
|
||||
.list();
|
||||
|
||||
// 查询检测规则状态项(部件描述、检查内容等)
|
||||
Map<Long, QmsPdiDetectionRulesStatusItem> statusItemMap = new HashMap<>();
|
||||
if (CollectionUtil.isNotEmpty(unqualifiedResults)) {
|
||||
List<Long> inspectionItemIds = unqualifiedResults.stream()
|
||||
.map(QmsPdiInspectionResults::getInspectionItemId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
if (CollectionUtil.isNotEmpty(inspectionItemIds)) {
|
||||
List<QmsPdiDetectionRulesStatusItem> statusItems = detectionRulesStatusItemService.lambdaQuery()
|
||||
.in(QmsPdiDetectionRulesStatusItem::getInspectionItemId, inspectionItemIds)
|
||||
.list();
|
||||
statusItemMap = statusItems.stream()
|
||||
.collect(Collectors.toMap(QmsPdiDetectionRulesStatusItem::getInspectionItemId, item -> item, (a, b) -> a));
|
||||
}
|
||||
}
|
||||
|
||||
// 查询图片详情
|
||||
Map<Long, FileUploadRecord> fileUploadRecordMap = new HashMap<>();
|
||||
List<Long> allImageIds = unqualifiedResults.stream()
|
||||
.filter(r -> StrUtil.isNotBlank(r.getInspectionItemImage()))
|
||||
.flatMap(r -> Arrays.stream(r.getInspectionItemImage().split(",")))
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.map(String::trim)
|
||||
.map(Long::valueOf)
|
||||
.distinct()
|
||||
.toList();
|
||||
if (CollectionUtil.isNotEmpty(allImageIds)) {
|
||||
List<FileUploadRecord> fileRecords = fileUploadRecordService.lambdaQuery()
|
||||
.in(FileUploadRecord::getId, allImageIds)
|
||||
.list();
|
||||
fileUploadRecordMap = fileRecords.stream()
|
||||
.collect(Collectors.toMap(FileUploadRecord::getId, record -> record, (a, b) -> a));
|
||||
}
|
||||
|
||||
for (QmsPdiInspectionResults result : unqualifiedResults) {
|
||||
QmsPdiTicketMyDetailVO.InspectionItemVO itemVO = new QmsPdiTicketMyDetailVO.InspectionItemVO();
|
||||
itemVO.setId(result.getId());
|
||||
itemVO.setInspectionItemId(result.getInspectionItemId());
|
||||
itemVO.setInspectionItemType(result.getInspectionItemType());
|
||||
itemVO.setInspectionItemResults(result.getInspectionItemResults());
|
||||
itemVO.setRemark(result.getRemark());
|
||||
itemVO.setInspectorId(result.getInspectorId());
|
||||
itemVO.setInspectionTime(result.getInspectionTime());
|
||||
itemVO.setInspectionBy(result.getInspectionBy());
|
||||
|
||||
// 填充检测项信息(仅type=0/1/3)
|
||||
if (result.getInspectionItemType() != null && result.getInspectionItemType() != 2) {
|
||||
QmsPdiDetectionRulesStatusItem statusItem = statusItemMap.get(result.getInspectionItemId());
|
||||
if (statusItem != null) {
|
||||
itemVO.setComponentsDes(statusItem.getComponentsDes());
|
||||
itemVO.setInspectionContent(statusItem.getInspectionContent());
|
||||
if (StrUtil.isNotBlank(statusItem.getInspectionImage())) {
|
||||
String exampleUrl = Arrays.stream(statusItem.getInspectionImage().split(","))
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.map(String::trim)
|
||||
.map(Long::valueOf)
|
||||
.map(fileUploadRecordMap::get)
|
||||
.filter(Objects::nonNull)
|
||||
.map(FileUploadRecord::getUrl)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
itemVO.setInspectionExampleImage(exampleUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 解析现场上传图片
|
||||
if (StrUtil.isNotBlank(result.getInspectionItemImage())) {
|
||||
List<QmsPdiTaskRecordDetailVO.FileDetailVO> imageDetails = Arrays.stream(result.getInspectionItemImage().split(","))
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.map(String::trim)
|
||||
.map(Long::valueOf)
|
||||
.map(fileUploadRecordMap::get)
|
||||
.filter(Objects::nonNull)
|
||||
.map(file -> new QmsPdiTaskRecordDetailVO.FileDetailVO()
|
||||
.setId(file.getId())
|
||||
.setUrl(file.getUrl())
|
||||
.setFileName(file.getFileName()))
|
||||
.collect(Collectors.toList());
|
||||
itemVO.setInspectionItemImage(imageDetails);
|
||||
}
|
||||
|
||||
// 填充处理信息
|
||||
itemVO.setHandlerUserId(process.getHandlerUserId());
|
||||
itemVO.setHandlerUserName(process.getHandlerUserName());
|
||||
itemVO.setProcessTime(process.getApprovalTime());
|
||||
itemVO.setProcessStatus(process.getApprovalStatus());
|
||||
itemVO.setApprovalUserId(process.getApprovalUserId());
|
||||
itemVO.setApprovalUserName(process.getApprovalUserName());
|
||||
itemVO.setApprovalTime(process.getApprovalTime());
|
||||
itemVO.setApprovalStatus(process.getApprovalStatus());
|
||||
|
||||
// 查询处理人部门信息
|
||||
if (process.getHandlerUserId() != null) {
|
||||
UserInterior userInterior = userInteriorService.lambdaQuery()
|
||||
.eq(UserInterior::getUserId, process.getHandlerUserId())
|
||||
.one();
|
||||
if (userInterior != null && userInterior.getDeptId() != null) {
|
||||
itemVO.setHandlerDeptId(userInterior.getDeptId());
|
||||
Department department = departmentService.getById(userInterior.getDeptId());
|
||||
if (department != null) {
|
||||
itemVO.setHandlerDeptName(department.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inspectionItems.add(itemVO);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询措施列表
|
||||
List<QmsIssueTicketProcessMeasure> measures = issueTicketProcessMeasureService.lambdaQuery()
|
||||
.eq(QmsIssueTicketProcessMeasure::getIssueTicketProcessId, process.getId())
|
||||
.list();
|
||||
|
||||
List<QmsPdiTicketMyDetailVO.MeasureVO> measureVOList = measures.stream().map(measure -> {
|
||||
for (QmsIssueTicketProcessMeasure measure : measures) {
|
||||
QmsPdiTicketMyDetailVO.MeasureVO measureVO = new QmsPdiTicketMyDetailVO.MeasureVO();
|
||||
BeanUtil.copyProperties(measure, measureVO);
|
||||
return measureVO;
|
||||
}).toList();
|
||||
measureVO.setId(measure.getId());
|
||||
measureVO.setMeasureTypeId(measure.getMeasureTypeId());
|
||||
measureVO.setMeasureContent(measure.getMeasureContent());
|
||||
measureVO.setChargeUser(measure.getChargeUser());
|
||||
measureVO.setPlanDate(measure.getPlanDate());
|
||||
measureVO.setConfirmDate(measure.getConfirmDate());
|
||||
measureVO.setRemark(measure.getRemark());
|
||||
|
||||
processVO.setMeasures(measureVOList);
|
||||
return processVO;
|
||||
}).toList();
|
||||
// 根据measureTypeId区分临时措施和永久措施
|
||||
if (measure.getMeasureTypeId() != null) {
|
||||
if (measure.getMeasureTypeId().equals(temporaryTypeId)) {
|
||||
temporaryMeasures.add(measureVO);
|
||||
} else if (measure.getMeasureTypeId().equals(permanentTypeId)) {
|
||||
permanentMeasures.add(measureVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vo.setInspectionItems(inspectionItems);
|
||||
vo.setRootCause(rootCause);
|
||||
vo.setTemporaryMeasures(temporaryMeasures);
|
||||
vo.setPermanentMeasures(permanentMeasures);
|
||||
vo.setSignatures(new HashMap<>());
|
||||
|
||||
vo.setProcesses(processVOList);
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@ public class QmsIssueTicketProcessMeasureControllerService {
|
|||
QmsIssueTicketProcess process = issueTicketProcessService.getById(request.getId());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(process)).throwMessage("工单处理记录不存在");
|
||||
|
||||
// 校验:领导已同意时不允许修改
|
||||
if (process.getLeaderApprovalResult() != null && process.getLeaderApprovalResult() == 1) {
|
||||
throw new NflgException(STATE.BusinessError, "领导已审批同意,不允许修改");
|
||||
}
|
||||
|
||||
// 更新工单处理记录
|
||||
issueTicketProcessService.lambdaUpdate()
|
||||
.eq(QmsIssueTicketProcess::getId, request.getId())
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* PDI工单详情
|
||||
|
|
@ -18,27 +19,82 @@ public class QmsPdiTicketDetailVO {
|
|||
private String ticketNo;
|
||||
|
||||
/**
|
||||
* 工单标题
|
||||
* 工单标题(主题)
|
||||
*/
|
||||
private String ticketTitle;
|
||||
|
||||
/**
|
||||
* 工程编号
|
||||
*/
|
||||
private String projectNo;
|
||||
|
||||
/**
|
||||
* 事故类型:0=一般,1=较严重,2=严重
|
||||
*/
|
||||
private Short incidentType;
|
||||
|
||||
/**
|
||||
* 异常代码
|
||||
*/
|
||||
private String exceptionCode;
|
||||
|
||||
/**
|
||||
* 不合格数量
|
||||
*/
|
||||
private Integer unqualifiedQty;
|
||||
|
||||
/**
|
||||
* 提交人(创建人)
|
||||
*/
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 反馈时间(创建时间)
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 工单状态:0=待流转,1=处理中,2=已完成
|
||||
*/
|
||||
private Short status;
|
||||
|
||||
/**
|
||||
* 不合格质检项列表
|
||||
* 工单类型(PDI-新机检测 或 PDI-库存检测)
|
||||
*/
|
||||
private List<UnqualifiedItemVO> unqualifiedItems;
|
||||
private String ticketType;
|
||||
|
||||
/**
|
||||
* 处理记录列表
|
||||
* 不合格质检项列表(每项关联处理信息)
|
||||
*/
|
||||
private List<ProcessVO> processes;
|
||||
private List<InspectionItemVO> inspectionItems;
|
||||
|
||||
/**
|
||||
* 处理人信息(按部门分组)
|
||||
*/
|
||||
private Map<String, List<String>> handlers;
|
||||
|
||||
/**
|
||||
* 根本原因
|
||||
*/
|
||||
private String rootCause;
|
||||
|
||||
/**
|
||||
* 临时纠正措施列表
|
||||
*/
|
||||
private List<MeasureVO> temporaryMeasures;
|
||||
|
||||
/**
|
||||
* 永久纠正措施列表
|
||||
*/
|
||||
private List<MeasureVO> permanentMeasures;
|
||||
|
||||
/**
|
||||
* 相关人员签字(按部门)
|
||||
*/
|
||||
private Map<String, String> signatures;
|
||||
|
||||
@Data
|
||||
public static class UnqualifiedItemVO {
|
||||
public static class InspectionItemVO {
|
||||
|
||||
/**
|
||||
* 质检结果记录ID
|
||||
|
|
@ -75,11 +131,6 @@ public class QmsPdiTicketDetailVO {
|
|||
*/
|
||||
private List<QmsPdiTaskRecordDetailVO.FileDetailVO> inspectionItemImage;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 质检人ID
|
||||
*/
|
||||
|
|
@ -94,20 +145,16 @@ public class QmsPdiTicketDetailVO {
|
|||
* 质检人
|
||||
*/
|
||||
private String inspectionBy;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ProcessVO {
|
||||
|
||||
/**
|
||||
* 处理记录ID
|
||||
* 检测结果:true=合格,false=不合格
|
||||
*/
|
||||
private Long id;
|
||||
private Boolean inspectionItemResults;
|
||||
|
||||
/**
|
||||
* 处理人ID
|
||||
* 备注
|
||||
*/
|
||||
private Long handlerUserId;
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 处理人姓名
|
||||
|
|
@ -115,7 +162,37 @@ public class QmsPdiTicketDetailVO {
|
|||
private String handlerUserName;
|
||||
|
||||
/**
|
||||
* 处理人所属部门ID
|
||||
* 处理时间
|
||||
*/
|
||||
private LocalDateTime processTime;
|
||||
|
||||
/**
|
||||
* 处理状态:0=通过,1=驳回
|
||||
*/
|
||||
private Short processStatus;
|
||||
|
||||
/**
|
||||
* 审核人姓名
|
||||
*/
|
||||
private String approvalUserName;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
private LocalDateTime approvalTime;
|
||||
|
||||
/**
|
||||
* 审核状态:0=通过,1=驳回
|
||||
*/
|
||||
private Short approvalStatus;
|
||||
|
||||
/**
|
||||
* 处理人ID(内部使用)
|
||||
*/
|
||||
private Long handlerUserId;
|
||||
|
||||
/**
|
||||
* 处理人所属部门ID(内部使用)
|
||||
*/
|
||||
private Long handlerDeptId;
|
||||
|
||||
|
|
@ -125,74 +202,9 @@ public class QmsPdiTicketDetailVO {
|
|||
private String handlerDeptName;
|
||||
|
||||
/**
|
||||
* 根本原因
|
||||
*/
|
||||
private String rootCause;
|
||||
|
||||
/**
|
||||
* 任务结果ID,多个用逗号分隔
|
||||
*/
|
||||
private String taskResultIds;
|
||||
|
||||
/**
|
||||
* 审批状态:0=通过,1=驳回
|
||||
*/
|
||||
private Short approvalStatus;
|
||||
|
||||
/**
|
||||
* 审批意见
|
||||
*/
|
||||
private String approvalOpinion;
|
||||
|
||||
/**
|
||||
* 审批人ID
|
||||
* 审核人ID(内部使用)
|
||||
*/
|
||||
private Long approvalUserId;
|
||||
|
||||
/**
|
||||
* 审批人姓名
|
||||
*/
|
||||
private String approvalUserName;
|
||||
|
||||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
private LocalDateTime approvalTime;
|
||||
|
||||
/**
|
||||
* 处理时间(使用审批时间)
|
||||
*/
|
||||
private LocalDateTime processTime;
|
||||
|
||||
/**
|
||||
* 上级领导审批结果:0=驳回,1=同意
|
||||
*/
|
||||
private Short leaderApprovalResult;
|
||||
|
||||
/**
|
||||
* 上级领导审批意见
|
||||
*/
|
||||
private String leaderApprovalOpinion;
|
||||
|
||||
/**
|
||||
* 上级领导ID
|
||||
*/
|
||||
private Long leaderUserId;
|
||||
|
||||
/**
|
||||
* 上级领导姓名
|
||||
*/
|
||||
private String leaderUserName;
|
||||
|
||||
/**
|
||||
* 上级领导审批时间
|
||||
*/
|
||||
private LocalDateTime leaderApprovalTime;
|
||||
|
||||
/**
|
||||
* 措施列表
|
||||
*/
|
||||
private List<MeasureVO> measures;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 本人PDI工单详情VO(含工单全部字段 + 当前登录人相关的处理记录及措施)
|
||||
|
|
@ -131,7 +132,44 @@ public class QmsPdiTicketMyDetailVO {
|
|||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
// ===== 当前登录人相关的处理记录列表 =====
|
||||
/**
|
||||
* 提交人(创建人)
|
||||
*/
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 工单类型(PDI-新机检测 或 PDI-库存检测)
|
||||
*/
|
||||
private String ticketType;
|
||||
|
||||
// ===== 当前登录人相关的检测项列表(每项内联处理信息) =====
|
||||
|
||||
/**
|
||||
* 不合格质检项列表(每项关联处理信息)
|
||||
*/
|
||||
private List<InspectionItemVO> inspectionItems;
|
||||
|
||||
/**
|
||||
* 根本原因
|
||||
*/
|
||||
private String rootCause;
|
||||
|
||||
/**
|
||||
* 临时纠正措施列表
|
||||
*/
|
||||
private List<MeasureVO> temporaryMeasures;
|
||||
|
||||
/**
|
||||
* 永久纠正措施列表
|
||||
*/
|
||||
private List<MeasureVO> permanentMeasures;
|
||||
|
||||
/**
|
||||
* 相关人员签字(按部门)
|
||||
*/
|
||||
private Map<String, String> signatures;
|
||||
|
||||
// ===== 旧的处理记录列表(保留兼容) =====
|
||||
|
||||
/**
|
||||
* 处理记录列表(仅当前登录人相关)
|
||||
|
|
@ -259,4 +297,118 @@ public class QmsPdiTicketMyDetailVO {
|
|||
*/
|
||||
private String remark;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class InspectionItemVO {
|
||||
|
||||
/**
|
||||
* 质检结果记录ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 检验项ID
|
||||
*/
|
||||
private Long inspectionItemId;
|
||||
|
||||
/**
|
||||
* 检验项类型:0=静态检测项,1=动态检测项,2=装车前检测项,3=特殊检测项
|
||||
*/
|
||||
private Integer inspectionItemType;
|
||||
|
||||
/**
|
||||
* 部件描述(仅type=0/1/3有)
|
||||
*/
|
||||
private String componentsDes;
|
||||
|
||||
/**
|
||||
* 检查核实内容(仅type=0/1/3有)
|
||||
*/
|
||||
private String inspectionContent;
|
||||
|
||||
/**
|
||||
* 检测示例图URL(仅type=0/1/3有)
|
||||
*/
|
||||
private String inspectionExampleImage;
|
||||
|
||||
/**
|
||||
* 检验现场图片详情列表
|
||||
*/
|
||||
private List<QmsPdiTaskRecordDetailVO.FileDetailVO> inspectionItemImage;
|
||||
|
||||
/**
|
||||
* 质检人ID
|
||||
*/
|
||||
private String inspectorId;
|
||||
|
||||
/**
|
||||
* 质检时间
|
||||
*/
|
||||
private LocalDateTime inspectionTime;
|
||||
|
||||
/**
|
||||
* 质检人
|
||||
*/
|
||||
private String inspectionBy;
|
||||
|
||||
/**
|
||||
* 检测结果:true=合格,false=不合格
|
||||
*/
|
||||
private Boolean inspectionItemResults;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 处理人姓名
|
||||
*/
|
||||
private String handlerUserName;
|
||||
|
||||
/**
|
||||
* 处理时间
|
||||
*/
|
||||
private LocalDateTime processTime;
|
||||
|
||||
/**
|
||||
* 处理状态:0=通过,1=驳回
|
||||
*/
|
||||
private Short processStatus;
|
||||
|
||||
/**
|
||||
* 审核人姓名
|
||||
*/
|
||||
private String approvalUserName;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
private LocalDateTime approvalTime;
|
||||
|
||||
/**
|
||||
* 审核状态:0=通过,1=驳回
|
||||
*/
|
||||
private Short approvalStatus;
|
||||
|
||||
/**
|
||||
* 处理人ID(内部使用)
|
||||
*/
|
||||
private Long handlerUserId;
|
||||
|
||||
/**
|
||||
* 处理人所属部门ID(内部使用)
|
||||
*/
|
||||
private Long handlerDeptId;
|
||||
|
||||
/**
|
||||
* 处理人所属部门名称
|
||||
*/
|
||||
private String handlerDeptName;
|
||||
|
||||
/**
|
||||
* 审核人ID(内部使用)
|
||||
*/
|
||||
private Long approvalUserId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue