Merge remote-tracking branch '惠信/qms/develop' into qms/develop
This commit is contained in:
commit
59337c4fbb
|
|
@ -97,7 +97,49 @@ public class QmsIssueTicketControllerService {
|
|||
User handlerUser = userService.getById(request.getHandlerUserId());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(handlerUser)).throwMessage("负责人不存在");
|
||||
|
||||
// 4. 更新工单状态和审批人信息
|
||||
// 4. 校验工单必填字段完整性
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(ticket.getTicketTitle()))
|
||||
.throwMessage("工单标题不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(ticket.getProjectNo()))
|
||||
.throwMessage("工程编号不能为空");
|
||||
VUtil.trueThrowBusinessError(ticket.getIncidentType() == null)
|
||||
.throwMessage("事故类型不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(ticket.getExceptionCode()))
|
||||
.throwMessage("异常代码不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(ticket.getImpactQuantity()))
|
||||
.throwMessage("影响数量不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(ticket.getIncidentLocation()))
|
||||
.throwMessage("事件地点不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(ticket.getIncidentDescription()))
|
||||
.throwMessage("事件描述不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(ticket.getIncidentReason()))
|
||||
.throwMessage("事件原因不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(ticket.getIncidentConsequence()))
|
||||
.throwMessage("事件后果不能为空");
|
||||
|
||||
// 5. 校验工单图片字段完整性(如果有图片的话)
|
||||
if (StrUtil.isNotBlank(ticket.getImageIds())) {
|
||||
List<Long> imageIds = Arrays.stream(ticket.getImageIds().split(","))
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.map(String::trim)
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isNotEmpty(imageIds)) {
|
||||
List<FileUploadRecord> fileRecords = fileUploadRecordService.lambdaQuery()
|
||||
.in(FileUploadRecord::getId, imageIds)
|
||||
.list();
|
||||
|
||||
for (FileUploadRecord record : fileRecords) {
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(record.getFileName()))
|
||||
.throwMessage("图片文件名不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(record.getUrl()))
|
||||
.throwMessage("图片URL不能为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 6. 更新工单状态和审批人信息
|
||||
issueTicketService.lambdaUpdate()
|
||||
.eq(QmsIssueTicket::getId, request.getId())
|
||||
.set(QmsIssueTicket::getStatus, (short) 1) // 状态:1=处理中
|
||||
|
|
@ -530,12 +572,12 @@ public class QmsIssueTicketControllerService {
|
|||
|
||||
QmsIssueTicket entity = new QmsIssueTicket()
|
||||
.setSourceType((short) 2)
|
||||
.setStatus((short) 0) // 待流转状态
|
||||
.setTicketNo(ticketNo)
|
||||
.setTicketTitle(request.getTicketTitle())
|
||||
.setProjectNo(request.getProjectNo())
|
||||
.setIncidentType(request.getIncidentType())
|
||||
.setExceptionCode(request.getExceptionCode())
|
||||
.setUnqualifiedQty(request.getUnqualifiedQty())
|
||||
.setImpactQuantity(request.getImpactQuantity())
|
||||
.setIncidentLocation(request.getIncidentLocation())
|
||||
.setIncidentDescription(request.getIncidentDescription())
|
||||
|
|
@ -572,10 +614,51 @@ public class QmsIssueTicketControllerService {
|
|||
User handlerUser = userService.getById(request.getHandlerUserId());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(handlerUser)).throwMessage("负责人不存在");
|
||||
|
||||
// 2. 自动生成工单编号
|
||||
// 2. 校验请求必填字段完整性
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(request.getTicketTitle()))
|
||||
.throwMessage("工单标题不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(request.getProjectNo()))
|
||||
.throwMessage("工程编号不能为空");
|
||||
VUtil.trueThrowBusinessError(request.getIncidentType() == null)
|
||||
.throwMessage("事故类型不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(request.getExceptionCode()))
|
||||
.throwMessage("异常代码不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(request.getImpactQuantity()))
|
||||
.throwMessage("影响数量不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(request.getIncidentLocation()))
|
||||
.throwMessage("事件地点不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(request.getIncidentDescription()))
|
||||
.throwMessage("事件描述不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(request.getIncidentReason()))
|
||||
.throwMessage("事件原因不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(request.getIncidentConsequence()))
|
||||
.throwMessage("事件后果不能为空");
|
||||
|
||||
// 3. 校验图片字段完整性(如果有图片的话)
|
||||
if (CollectionUtil.isNotEmpty(request.getImages())) {
|
||||
List<Long> imageIds = request.getImages().stream()
|
||||
.map(FileUploadVO::getId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isNotEmpty(imageIds)) {
|
||||
List<FileUploadRecord> fileRecords = fileUploadRecordService.lambdaQuery()
|
||||
.in(FileUploadRecord::getId, imageIds)
|
||||
.list();
|
||||
|
||||
for (FileUploadRecord record : fileRecords) {
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(record.getFileName()))
|
||||
.throwMessage("图片文件名不能为空");
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(record.getUrl()))
|
||||
.throwMessage("图片URL不能为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 自动生成工单编号
|
||||
String ticketNo = basdeSerialNumberControllerService.generateSerialNumber(37);
|
||||
|
||||
// 3. 创建工单实体(直接设置为处理中状态)
|
||||
// 5. 创建工单实体(直接设置为处理中状态)
|
||||
QmsIssueTicket entity = new QmsIssueTicket()
|
||||
.setSourceType((short) 2)
|
||||
.setTicketNo(ticketNo)
|
||||
|
|
@ -583,7 +666,6 @@ public class QmsIssueTicketControllerService {
|
|||
.setProjectNo(request.getProjectNo())
|
||||
.setIncidentType(request.getIncidentType())
|
||||
.setExceptionCode(request.getExceptionCode())
|
||||
.setUnqualifiedQty(request.getUnqualifiedQty())
|
||||
.setImpactQuantity(request.getImpactQuantity())
|
||||
.setIncidentLocation(request.getIncidentLocation())
|
||||
.setIncidentDescription(request.getIncidentDescription())
|
||||
|
|
@ -726,33 +808,28 @@ public class QmsIssueTicketControllerService {
|
|||
pageData.setPage((int) resultPage.getCurrent());
|
||||
pageData.setPageSize((int) resultPage.getSize());
|
||||
|
||||
// 统计工单总数(不考虑过滤条件)
|
||||
Long totalCount = issueTicketService.lambdaQuery()
|
||||
.eq(QmsIssueTicket::getSourceType, (short) 2)
|
||||
.eq(QmsIssueTicket::getCreateUserId, currentUserId)
|
||||
.count();
|
||||
|
||||
// 统计待处理数(status=0)
|
||||
// 统计工单各状态数量(只统计 sourceType=2 且当前用户创建的工单)
|
||||
Long pendingCount = issueTicketService.lambdaQuery()
|
||||
.eq(QmsIssueTicket::getSourceType, (short) 2)
|
||||
.eq(QmsIssueTicket::getCreateUserId, currentUserId)
|
||||
.eq(QmsIssueTicket::getStatus, (short) 0)
|
||||
.count();
|
||||
|
||||
// 统计处理中数(status=1)
|
||||
Long processingCount = issueTicketService.lambdaQuery()
|
||||
.eq(QmsIssueTicket::getSourceType, (short) 2)
|
||||
.eq(QmsIssueTicket::getCreateUserId, currentUserId)
|
||||
.eq(QmsIssueTicket::getStatus, (short) 1)
|
||||
.count();
|
||||
|
||||
// 统计已完成数(status=2)
|
||||
Long completedCount = issueTicketService.lambdaQuery()
|
||||
.eq(QmsIssueTicket::getSourceType, (short) 2)
|
||||
.eq(QmsIssueTicket::getCreateUserId, currentUserId)
|
||||
.eq(QmsIssueTicket::getStatus, (short) 2)
|
||||
.count();
|
||||
|
||||
// 工单总数 = 待处理 + 处理中 + 已完成
|
||||
long totalCount = pendingCount + processingCount + completedCount;
|
||||
|
||||
// 设置统计字段
|
||||
pageData.setTotalCount(totalCount);
|
||||
pageData.setPendingCount(pendingCount);
|
||||
|
|
|
|||
|
|
@ -222,6 +222,8 @@ public class QmsPdiStatusItemControllerService {
|
|||
record.setFileName(pic.getLocalPath().getFileName().toString());
|
||||
record.setFileType("image/png");
|
||||
record.setUrl(imageUrl);
|
||||
record.setSource((short) 0); // 关联类型:0=通用
|
||||
record.setSourceId(0L); // 关联ID:0=无关联
|
||||
record.setFrom("PDI检测项导入");
|
||||
record.setCreateBy(UserUtil.getUserName());
|
||||
record.setCreateTime(LocalDateTime.now());
|
||||
|
|
|
|||
|
|
@ -35,11 +35,6 @@ public class QmsIssueTicketAddAndDispatchQO {
|
|||
*/
|
||||
private String exceptionCode;
|
||||
|
||||
/**
|
||||
* 不合格数量
|
||||
*/
|
||||
private Integer unqualifiedQty;
|
||||
|
||||
/**
|
||||
* 影响数量
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -35,11 +35,6 @@ public class QmsIssueTicketAddQO {
|
|||
*/
|
||||
private String exceptionCode;
|
||||
|
||||
/**
|
||||
* 不合格数量
|
||||
*/
|
||||
private Integer unqualifiedQty;
|
||||
|
||||
/**
|
||||
* 影响数量
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ public class QmsPdiInspectionResultsSearchQO {
|
|||
*/
|
||||
private String taskNo;
|
||||
|
||||
/**
|
||||
* 任务状态(可选):0=待流转,1=质检中,2=已完成,3=待流转(逾期)
|
||||
*/
|
||||
private Integer inspectionEnable;
|
||||
|
||||
/**
|
||||
* 当前登录用户ID(内部使用,用于权限过滤)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@
|
|||
<if test="request.taskNo != null and request.taskNo != ''">
|
||||
AND t.task_no = #{request.taskNo}
|
||||
</if>
|
||||
<!-- 任务状态筛选 -->
|
||||
<if test="request.inspectionEnable != null">
|
||||
AND t.inspection_enable = #{request.inspectionEnable}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t.id DESC
|
||||
</select>
|
||||
|
|
|
|||
Loading…
Reference in New Issue