style(qms-admin): 统一 Java 源代码换行符格式
- 将控制器层和服务层源码统一为标准 LF 换行符
This commit is contained in:
parent
33553d12da
commit
8913b8d94b
|
|
@ -121,6 +121,17 @@ public class QmsIssueTicketController extends BaseController {
|
|||
return ApiResult.success(issueTicketControllerService.createAndQueryPdiTicket(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* PQC新建工单并返回不合格检测项
|
||||
* 1. 创建工单
|
||||
* 2. 查询任务的不合格检测项
|
||||
* 3. 返回工单ID、工单编号和不合格检测项列表
|
||||
*/
|
||||
@PostMapping("createAndQueryPqcTicket")
|
||||
public ApiResult<QmsPqcCreateTicketResultVO> createAndQueryPqcTicket(@Valid @RequestBody QmsPqcCreateAndQueryTicketQO request) {
|
||||
return ApiResult.success(issueTicketControllerService.createAndQueryPqcTicket(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 来料检测工单审核
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nflg.qms.admin.controller;
|
|||
|
||||
import com.nflg.qms.admin.service.QmsPqcTaskRecordControllerService;
|
||||
import com.nflg.wms.common.constant.STATE;
|
||||
import com.nflg.wms.common.exception.NflgException;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPqcTaskRecordDraftQO;
|
||||
|
|
@ -104,7 +105,7 @@ public class QmsPqcTaskRecordController {
|
|||
QmsPqcTaskRecordControllerService.SubmitResult result = pqcTaskRecordService.submit(request);
|
||||
|
||||
if (result.getType() == 1) {
|
||||
return ApiResult.error(STATE.BusinessError, "数据校验失败", result.getEmptyFields());
|
||||
throw new NflgException(STATE.BusinessError, "有未填写的自检项");
|
||||
} else if (result.getType() == 2) {
|
||||
return ApiResult.success(result.getUnqualifiedItems());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -512,6 +512,129 @@ public class QmsIssueTicketControllerService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public QmsPqcCreateTicketResultVO createAndQueryPqcTicket(@Valid QmsPqcCreateAndQueryTicketQO request) {
|
||||
Long userId = UserUtil.getUserId();
|
||||
String userName = UserUtil.getUserName();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
QmsPqcTaskRecord taskRecord = pqcTaskRecordService.getById(request.getTaskRecordId());
|
||||
if (Objects.isNull(taskRecord)) {
|
||||
throw new NflgException(STATE.BusinessError, "PQC检测任务记录不存在");
|
||||
}
|
||||
if (!Objects.equals(taskRecord.getStatus(), (short) 3)) {
|
||||
throw new NflgException(STATE.BusinessError, "只有已复核的PQC任务才能创建工单");
|
||||
}
|
||||
|
||||
QmsIssueTicket existingTicket = issueTicketService.lambdaQuery()
|
||||
.eq(QmsIssueTicket::getSourceType, (short) 3)
|
||||
.eq(QmsIssueTicket::getSourceId, request.getTaskRecordId())
|
||||
.one();
|
||||
if (existingTicket != null) {
|
||||
throw new NflgException(STATE.BusinessError,
|
||||
"该任务已存在工单(工单编号:" + existingTicket.getTicketNo() + "),请使用追加处理记录接口");
|
||||
}
|
||||
|
||||
List<QmsPqcTaskRecordDetails> allDetails = pqcTaskRecordDetailsService.lambdaQuery()
|
||||
.eq(QmsPqcTaskRecordDetails::getTaskId, request.getTaskRecordId())
|
||||
.list();
|
||||
if (CollectionUtil.isEmpty(allDetails)) {
|
||||
throw new NflgException(STATE.BusinessError, "PQC任务不存在检测项");
|
||||
}
|
||||
|
||||
List<QmsPqcTaskRecordDetails> unqualifiedDetails = allDetails.stream()
|
||||
.filter(detail -> Boolean.FALSE.equals(detail.getReviewEnable()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(unqualifiedDetails)) {
|
||||
throw new NflgException(STATE.BusinessError, "该任务不存在不合格检测项");
|
||||
}
|
||||
|
||||
QmsPqcInspectionPoint point = pqcInspectionPointService.getById(taskRecord.getInspectionPointId());
|
||||
String stepName = point != null ? StrUtil.blankToDefault(point.getStepName(), "") : "";
|
||||
String inspectionPointName = point != null ? StrUtil.blankToDefault(point.getInspectionPointName(), "") : "";
|
||||
String ticketNo = basdeSerialNumberControllerService.generateSerialNumber(41);
|
||||
String incidentDescription = buildPqcIncidentDescription(unqualifiedDetails);
|
||||
|
||||
QmsIssueTicket entity = new QmsIssueTicket()
|
||||
.setSourceType((short) 3)
|
||||
.setSourceId(request.getTaskRecordId())
|
||||
.setTicketNo(ticketNo)
|
||||
.setTicketTitle(taskRecord.getAufnr() + "-" + taskRecord.getNo() + "-" + stepName + "-" + inspectionPointName)
|
||||
.setProjectNo(taskRecord.getTaskNo())
|
||||
.setIncidentType(request.getIncidentType())
|
||||
.setIncidentDescription(incidentDescription)
|
||||
.setRemark(request.getRemark())
|
||||
.setUnqualifiedQty(unqualifiedDetails.size())
|
||||
.setStatus((short) 0)
|
||||
.setCreateUserId(userId)
|
||||
.setCreateUserName(userName)
|
||||
.setCreateTime(now)
|
||||
.setUpdateUserId(userId)
|
||||
.setUpdateUserName(userName)
|
||||
.setUpdateTime(now);
|
||||
issueTicketService.save(entity);
|
||||
|
||||
Set<Long> fileIds = new HashSet<>();
|
||||
Set<Long> itemIds = unqualifiedDetails.stream()
|
||||
.map(QmsPqcTaskRecordDetails::getInspectionPointItemId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
Map<Long, QmsPqcInspectionPointItems> itemMap = new HashMap<>();
|
||||
if (CollectionUtil.isNotEmpty(itemIds)) {
|
||||
itemMap = pqcInspectionPointItemsService.listByIds(itemIds).stream()
|
||||
.collect(Collectors.toMap(QmsPqcInspectionPointItems::getId, item -> item, (a, b) -> a));
|
||||
}
|
||||
final Map<Long, QmsPqcInspectionPointItems> finalItemMap = itemMap;
|
||||
|
||||
unqualifiedDetails.forEach(detail -> {
|
||||
collectFileIds(detail.getSelfTestAttachments(), fileIds);
|
||||
collectFileIds(detail.getReviewAttachments(), fileIds);
|
||||
QmsPqcInspectionPointItems item = finalItemMap.get(detail.getInspectionPointItemId());
|
||||
if (item != null) {
|
||||
collectFileIds(item.getInspectionImgUrl(), fileIds);
|
||||
}
|
||||
});
|
||||
|
||||
Map<Long, FileUploadRecord> fileMap = new HashMap<>();
|
||||
if (CollectionUtil.isNotEmpty(fileIds)) {
|
||||
fileMap = fileUploadRecordService.lambdaQuery()
|
||||
.in(FileUploadRecord::getId, fileIds)
|
||||
.list()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(FileUploadRecord::getId, r -> r, (a, b) -> a));
|
||||
}
|
||||
|
||||
List<QmsPqcCreateTicketUnqualifiedItemVO> unqualifiedItems = new ArrayList<>();
|
||||
for (QmsPqcTaskRecordDetails detail : unqualifiedDetails) {
|
||||
QmsPqcCreateTicketUnqualifiedItemVO itemVO = new QmsPqcCreateTicketUnqualifiedItemVO();
|
||||
itemVO.setTaskResultId(detail.getId());
|
||||
itemVO.setStepName(stepName);
|
||||
itemVO.setInspectionPointName(inspectionPointName);
|
||||
itemVO.setInspectionContent(finalItemMap.get(detail.getInspectionPointItemId()) != null
|
||||
? finalItemMap.get(detail.getInspectionPointItemId()).getInspectionContent()
|
||||
: null);
|
||||
itemVO.setInspectionExampleFiles(finalItemMap.get(detail.getInspectionPointItemId()) != null
|
||||
? parseCommonFileList(finalItemMap.get(detail.getInspectionPointItemId()).getInspectionImgUrl(), fileMap)
|
||||
: List.of());
|
||||
itemVO.setSelfTestData(detail.getSelfTestData());
|
||||
itemVO.setSelfTestFiles(parseCommonFileList(detail.getSelfTestAttachments(), fileMap));
|
||||
itemVO.setSelfTesterName(taskRecord.getSelfTesterName());
|
||||
itemVO.setSelfTestTime(detail.getSelfTestUploadTime());
|
||||
itemVO.setReviewResult(detail.getReviewEnable());
|
||||
itemVO.setReviewOpinion(detail.getReviewOpinion());
|
||||
itemVO.setReviewData(detail.getReviewData());
|
||||
itemVO.setReviewFiles(parseCommonFileList(detail.getReviewAttachments(), fileMap));
|
||||
itemVO.setReviewTime(detail.getReviewUploadTime());
|
||||
unqualifiedItems.add(itemVO);
|
||||
}
|
||||
|
||||
QmsPqcCreateTicketResultVO result = new QmsPqcCreateTicketResultVO();
|
||||
result.setTicketId(entity.getId());
|
||||
result.setTicketNo(ticketNo);
|
||||
result.setUnqualifiedItems(unqualifiedItems);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* PDI发起工单:查询任务的不合格检测项
|
||||
*/
|
||||
|
|
@ -2412,6 +2535,38 @@ public class QmsIssueTicketControllerService {
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<CommonFileDetailVO> parseCommonFileList(String fileIdsStr, Map<Long, FileUploadRecord> fileMap) {
|
||||
if (StrUtil.isBlank(fileIdsStr)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return Arrays.stream(fileIdsStr.split(","))
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.map(String::trim)
|
||||
.map(Long::valueOf)
|
||||
.map(fileMap::get)
|
||||
.filter(Objects::nonNull)
|
||||
.map(record -> {
|
||||
CommonFileDetailVO vo = new CommonFileDetailVO();
|
||||
vo.setId(record.getId());
|
||||
vo.setFileName(record.getFileName());
|
||||
vo.setFileType(record.getFileType());
|
||||
vo.setUrl(record.getUrl());
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void collectFileIds(String fileIdsStr, Set<Long> collector) {
|
||||
if (StrUtil.isBlank(fileIdsStr) || collector == null) {
|
||||
return;
|
||||
}
|
||||
Arrays.stream(fileIdsStr.split(","))
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.map(String::trim)
|
||||
.map(Long::valueOf)
|
||||
.forEach(collector::add);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换措施列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* PQC新建工单并查询不合格检测项
|
||||
*/
|
||||
@Data
|
||||
public class QmsPqcCreateAndQueryTicketQO {
|
||||
|
||||
/**
|
||||
* PQC检测任务记录ID
|
||||
*/
|
||||
@NotNull(message = "PQC检测任务记录ID不能为空")
|
||||
private Long taskRecordId;
|
||||
|
||||
/**
|
||||
* 事故类型:0=一般,1=较严重,2=严重
|
||||
*/
|
||||
@NotNull(message = "事故类型不能为空")
|
||||
private Short incidentType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotNull(message = "备注不能为空")
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* PQC新建工单并返回不合格检测项
|
||||
*/
|
||||
@Data
|
||||
public class QmsPqcCreateTicketResultVO {
|
||||
|
||||
/**
|
||||
* 工单ID
|
||||
*/
|
||||
private Long ticketId;
|
||||
|
||||
/**
|
||||
* 工单编号
|
||||
*/
|
||||
private String ticketNo;
|
||||
|
||||
/**
|
||||
* 不合格检测项列表
|
||||
*/
|
||||
private List<QmsPqcCreateTicketUnqualifiedItemVO> unqualifiedItems;
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* PQC新建工单返回的不合格检测项
|
||||
*/
|
||||
@Data
|
||||
public class QmsPqcCreateTicketUnqualifiedItemVO {
|
||||
|
||||
/**
|
||||
* 检测项明细ID
|
||||
*/
|
||||
private Long taskResultId;
|
||||
|
||||
/**
|
||||
* 步装名称
|
||||
*/
|
||||
private String stepName;
|
||||
|
||||
/**
|
||||
* 检查点名称
|
||||
*/
|
||||
private String inspectionPointName;
|
||||
|
||||
/**
|
||||
* 检查内容
|
||||
*/
|
||||
private String inspectionContent;
|
||||
|
||||
/**
|
||||
* 检测示例附件
|
||||
*/
|
||||
private List<CommonFileDetailVO> inspectionExampleFiles;
|
||||
|
||||
/**
|
||||
* 自检数据
|
||||
*/
|
||||
private String selfTestData;
|
||||
|
||||
/**
|
||||
* 自检附件
|
||||
*/
|
||||
private List<CommonFileDetailVO> selfTestFiles;
|
||||
|
||||
/**
|
||||
* 自检人
|
||||
*/
|
||||
private String selfTesterName;
|
||||
|
||||
/**
|
||||
* 自检日期
|
||||
*/
|
||||
private LocalDateTime selfTestTime;
|
||||
|
||||
/**
|
||||
* 复核结果
|
||||
*/
|
||||
private Boolean reviewResult;
|
||||
|
||||
/**
|
||||
* 复核意见
|
||||
*/
|
||||
private String reviewOpinion;
|
||||
|
||||
/**
|
||||
* 复核数据
|
||||
*/
|
||||
private String reviewData;
|
||||
|
||||
/**
|
||||
* 复核附件
|
||||
*/
|
||||
private List<CommonFileDetailVO> reviewFiles;
|
||||
|
||||
/**
|
||||
* 复核时间
|
||||
*/
|
||||
private LocalDateTime reviewTime;
|
||||
}
|
||||
Loading…
Reference in New Issue