From 6ab1565a1a86623af925719935d605e875d98af4 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期五, 23 十月 2026 18:08:56 +0800
Subject: [PATCH] 设备核查计划:设备档案变更即时登记计划明细,提前核查复用待核查明细并回写档案,已完成记录不可覆盖;新增附件字段、明细固定排序与删除保护;人员查询新增包含admin的类型;检验保存/提交按页面模板校验,复核驳回按检验室删除复核人
---
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 193 +++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 180 insertions(+), 13 deletions(-)
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
index 50d6ad8..9e1e3c2 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -49,6 +49,7 @@
import com.ruoyi.inspect.util.ReportSignaturePictureUtils;
import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo;
import com.ruoyi.inspect.vo.InsOrderPlanVO;
+import com.ruoyi.inspect.vo.QualityMonitorRawContext;
import com.ruoyi.inspect.vo.InsSampleUserVO;
import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper;
import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
@@ -224,6 +225,10 @@
if (Objects.isNull(entity)) {
return false;
}
+ InsOrder claimOrder = insOrderMapper.selectById(entity.getInsSampleId());
+ if (claimOrder != null && "QUALITY_MONITOR".equals(claimOrder.getTaskSource())) {
+ throw new ErrorException("璐ㄩ噺鐩戞帶浠诲姟鐢辫鍒掓寚瀹氭娴嬪憳锛屼笉鑳借棰�");
+ }
Integer userId = SecurityUtils.getUserId().intValue();
InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 0, entity.getSonLaboratory());
return insSampleUserMapper.insert(insSampleUser) > 0;
@@ -360,7 +365,7 @@
}
}
map.put("errorMsg", collect);
- map.put("missingExportItems", getMissingTemplateExportValues(orderId));
+ map.put("missingExportItems", getMissingTemplateExportValues(orderId, laboratory));
map.put("unInsOrderCount", 0L);
return map;
}
@@ -613,6 +618,16 @@
if (dto.getOrderId() == null || dto.getSampleId() == null || dto.getTemplateId() == null) {
throw new ErrorException("璁㈠崟銆佹牱鍝佸拰妯℃澘涓嶈兘涓虹┖");
}
+ InsOrder sourceOrder = insOrderMapper.selectById(dto.getOrderId());
+ if (sourceOrder != null && "QUALITY_MONITOR".equals(sourceOrder.getTaskSource())
+ && !Objects.equals(sourceOrder.getState(), 1)) {
+ throw new ErrorException("宸插彇娑堢殑璐ㄩ噺鐩戞帶浠诲姟涓嶈兘濉啓鍘熷璁板綍");
+ }
+ if (sourceOrder != null && "QUALITY_MONITOR".equals(sourceOrder.getTaskSource())
+ && !Objects.equals(SecurityUtils.getUserId().intValue(),
+ insOrderMapper.selectQualityMonitorInspectorId(dto.getOrderId()))) {
+ throw new ErrorException("鍙湁璁″垝鎸囧畾鐨勬娴嬪憳鍙互濉啓璐ㄩ噺鐩戞帶鍘熷璁板綍");
+ }
InsSample sample = insSampleMapper.selectById(dto.getSampleId());
if (sample == null || !Objects.equals(sample.getInsOrderId(), dto.getOrderId())) {
throw new ErrorException("鏍峰搧涓嶅睘浜庡綋鍓嶆楠屽崟");
@@ -634,10 +649,11 @@
JSONObject values = JSON.parseObject(JSON.toJSONString(dto.getValues() == null
? Collections.emptyMap() : dto.getValues()));
- // 妫�楠屾湡闂撮〉闈㈠睍绀虹殑鏄爣鍑嗙淮鎶や腑鐨勬渶鏂版ā鏉匡紝淇濆瓨鏍¢獙蹇呴』浣跨敤鍚屼竴浠芥ā鏉匡紝
- // 閬垮厤妯℃澘鏂板鈥滃鍑哄�尖�濇壒娉ㄥ悗浠嶆寜涓嬪崟鏃剁殑鏃у揩鐓ц鎶ユ湭閰嶇疆銆�
- String currentTemplateThing = getCurrentTemplateThing(snapshot);
- List<String> exportValueCoordinates = getExportValueCoordinates(currentTemplateThing).values().stream()
+ // 淇濆瓨鏃跺繀椤讳娇鐢ㄩ〉闈㈠綋鍓嶅睍绀虹殑妯℃澘锛氬緟妫�銆佸湪妫�闃舵灞曠ず鏍囧噯缁存姢涓殑瀹炴椂妯℃澘锛�
+ // 澶嶆牳銆侀┏鍥為樁娈靛睍绀鸿鍗曞揩鐓э紱鍚﹀垯妯℃澘鍦ㄦ楠岄�斾腑琚慨鏀瑰悗浼氬彇閿欏鍑哄�煎崟鍏冩牸銆�
+ boolean useSnapshot = useSnapshotTemplate(dto.getOrderId(), getCurrentUserLaboratory(dto.getOrderId()));
+ String pageTemplateThing = getPageTemplateThing(snapshot, useSnapshot);
+ List<String> exportValueCoordinates = getExportValueCoordinates(pageTemplateThing).values().stream()
.flatMap(Collection::stream)
.distinct()
.collect(Collectors.toList());
@@ -874,8 +890,8 @@
}
/**
- * 妫�楠屼繚瀛樸�佹彁浜ゆ牎楠岃鍙栨爣鍑嗙淮鎶や腑鐨勫疄鏃舵ā鏉匡紱妯℃澘宸茶鍒犻櫎鎴栧唴瀹逛负绌烘椂鎵嶅洖閫�璁㈠崟蹇収銆�
- * 妫�楠屽畬鎴愬悗鐨勫睍绀哄拰鎶ュ憡浠嶇敱璁㈠崟蹇収璐熻矗锛屼笉浼氶殢鏍囧噯妯℃澘鍚庣画淇敼鑰屽彉鍖栥��
+ * 璇诲彇鏍囧噯缁存姢涓殑瀹炴椂妯℃澘锛涙ā鏉垮凡琚垹闄ゆ垨鍐呭涓虹┖鏃舵墠鍥為��璁㈠崟蹇収銆�
+ * 浠呯敤浜庢楠屽浠嶅浜庡緟妫�銆佸湪妫�闃舵锛堥〉闈㈠睍绀哄疄鏃舵ā鏉匡級鐨勪繚瀛樹笌鏍¢獙銆�
*/
private String getCurrentTemplateThing(InsOrderStandardTemplate snapshot) {
if (snapshot != null && snapshot.getTemplateId() != null) {
@@ -888,9 +904,53 @@
}
/**
+ * 妫�楠屽崟椤甸潰鍦ㄦ楠屽杩涘叆澶嶆牳鍙婁箣鍚庣姸鎬佹椂灞曠ず璁㈠崟蹇収锛屽鍑哄�肩殑淇濆瓨鍜屾彁浜ゆ牎楠屽繀椤讳笌椤甸潰
+ * 浣跨敤鍚屼竴浠芥ā鏉匡紱鍚﹀垯鏍囧噯妯℃澘鍦ㄦ楠岄�斾腑琚慨鏀瑰悗锛屽巻鍙插崟鎹細鎸夋柊鍧愭爣璇诲彇蹇収鏁版嵁鑰岃鎶ヤ负绌恒��
+ */
+ private String getPageTemplateThing(InsOrderStandardTemplate snapshot, boolean useSnapshot) {
+ if (useSnapshot && snapshot != null && StrUtil.isNotBlank(snapshot.getThing())) {
+ return snapshot.getThing();
+ }
+ return getCurrentTemplateThing(snapshot);
+ }
+
+ /**
+ * 涓庢楠屽崟椤甸潰 getTemplateThing 鐨勫垽瀹氫繚鎸佷竴鑷达細妫�楠屽鐘舵�佽繘鍏ュ鏍革紙2锛夊強涔嬪悗鏃朵娇鐢ㄨ鍗曞揩鐓с��
+ * 鎸囨淳璁板綍閲岀殑瀹為獙瀹ゅ悕绉板彲鑳藉拰鐘舵�佽涓嶄竴鑷达紙濡傗�滃叏閮ㄢ�濓級锛屾鏃堕��鍥炴寜璁㈠崟鏁翠綋鐘舵�佸垽瀹氥��
+ */
+ private boolean useSnapshotTemplate(Integer orderId, String laboratory) {
+ if (StringUtils.isNotBlank(laboratory)) {
+ InsOrderState state = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery()
+ .eq(InsOrderState::getInsOrderId, orderId)
+ .eq(InsOrderState::getLaboratory, laboratory)
+ .last("limit 1"));
+ if (state != null) {
+ return state.getInsState() != null && state.getInsState() >= 2;
+ }
+ }
+ return insOrderStateMapper.selectList(Wrappers.<InsOrderState>lambdaQuery()
+ .eq(InsOrderState::getInsOrderId, orderId))
+ .stream()
+ .anyMatch(state -> state.getInsState() != null && state.getInsState() >= 2);
+ }
+
+ /**
+ * 鍙栧綋鍓嶇櫥褰曚汉鍦ㄨ璁㈠崟涓婃渶杩戜竴鏉℃寚娲捐褰曟墍灞炵殑妫�楠屽锛涙湭鎸囨淳璐﹀彿杩斿洖 null锛岀敱鐘舵�佸垽瀹氬厹搴曘��
+ */
+ private String getCurrentUserLaboratory(Integer orderId) {
+ Integer userId = SecurityUtils.getUserId().intValue();
+ InsSampleUser sampleUser = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery()
+ .eq(InsSampleUser::getInsSampleId, orderId)
+ .eq(InsSampleUser::getUserId, userId)
+ .orderByDesc(InsSampleUser::getId)
+ .last("limit 1"));
+ return sampleUser == null ? null : sampleUser.getSonLaboratory();
+ }
+
+ /**
* 鐩寸粦妯℃澘璁㈠崟鍙牎楠屾瘡涓�滃鍑哄�尖�濇壒娉ㄦ墍鍦ㄥ尯鍩熷彸渚х揣閭诲崟鍏冩牸锛屼笉浣跨敤妫�楠岄」鐘舵�佹垨 last_value 鍒ゅ畾銆�
*/
- private List<String> getMissingTemplateExportValues(Integer orderId) {
+ private List<String> getMissingTemplateExportValues(Integer orderId, String laboratory) {
List<InsOrderStandardTemplate> snapshots = insOrderStandardTemplateService.list(
Wrappers.<InsOrderStandardTemplate>lambdaQuery()
.eq(InsOrderStandardTemplate::getInsOrderId, orderId)
@@ -900,9 +960,10 @@
missing.add("褰撳墠璁㈠崟鏈壘鍒板師濮嬭褰曟ā鏉垮揩鐓�");
return missing;
}
+ boolean useSnapshot = useSnapshotTemplate(orderId, laboratory);
for (InsOrderStandardTemplate snapshot : snapshots) {
Integer templateId = snapshot.getTemplateId();
- List<String> coordinates = getExportValueCoordinates(getCurrentTemplateThing(snapshot)).values().stream()
+ List<String> coordinates = getExportValueCoordinates(getPageTemplateThing(snapshot, useSnapshot)).values().stream()
.flatMap(Collection::stream)
.distinct()
.collect(Collectors.toList());
@@ -1027,6 +1088,10 @@
//浜ゆ帴
@Override
public int upPlanUser(Integer userId, Integer orderId, String sonLaboratory) {
+ InsOrder handoffOrder = insOrderMapper.selectById(orderId);
+ if (handoffOrder != null && "QUALITY_MONITOR".equals(handoffOrder.getTaskSource())) {
+ throw new ErrorException("璐ㄩ噺鐩戞帶浠诲姟妫�娴嬪憳鐢辫鍒掓寚瀹氾紝涓嶈兘鐩存帴浜ゆ帴");
+ }
InsSampleUser insSampleUser = new InsSampleUser();
insSampleUser.setUserId(userId);
insSampleUser.setInsSampleId(orderId);
@@ -1211,6 +1276,23 @@
InsOrder order = insOrderMapper.selectOne(Wrappers.<InsOrder>lambdaQuery()
.eq(InsOrder::getId, orderId)
.last("FOR UPDATE"));
+ if (order == null) throw new ErrorException("妫�楠屼换鍔′笉瀛樺湪");
+ if ("QUALITY_MONITOR".equals(order.getTaskSource()) && !Objects.equals(order.getState(), 1)) {
+ throw new ErrorException("宸插彇娑堢殑璐ㄩ噺鐩戞帶浠诲姟涓嶈兘鎻愪氦");
+ }
+ if ("QUALITY_MONITOR".equals(order.getTaskSource())
+ && (verifyUser == null || userMapper.selectById(verifyUser) == null)) {
+ throw new ErrorException("璇烽�夋嫨璐ㄩ噺鐩戞帶浠诲姟澶嶆牳浜�");
+ }
+ if ("QUALITY_MONITOR".equals(order.getTaskSource())
+ && Objects.equals(verifyUser, insOrderMapper.selectQualityMonitorInspectorId(orderId))) {
+ throw new ErrorException("妫�娴嬪憳涓嶈兘澶嶆牳鑷繁鐨勮川閲忕洃鎺у師濮嬭褰�");
+ }
+ if ("QUALITY_MONITOR".equals(order.getTaskSource())
+ && !Objects.equals(SecurityUtils.getUserId().intValue(),
+ insOrderMapper.selectQualityMonitorInspectorId(orderId))) {
+ throw new ErrorException("鍙湁璁″垝鎸囧畾鐨勬娴嬪憳鍙互鎻愪氦璐ㄩ噺鐩戞帶浠诲姟");
+ }
boolean isInspectionReport = Objects.equals(INSPECTION_REPORT, reportType);
registerInsResults = isInspectionReport && Boolean.TRUE.equals(registerInsResults);
// 1. 濮旀墭缂栧彿鍏ㄥ眬鍞竴锛屾彁浜ゅ鏍告椂鍐嶆鏍¢獙锛岄槻姝㈠苟鍙戞垨鍘嗗彶鏁版嵁缁曡繃鐢熸垚鏍¢獙銆�
@@ -1237,7 +1319,7 @@
boolean directTemplateOrder = isDirectTemplateOrder(orderId);
List<InsProduct> insProducts;
if (directTemplateOrder) {
- List<String> missingExportValues = getMissingTemplateExportValues(orderId);
+ List<String> missingExportValues = getMissingTemplateExportValues(orderId, laboratory);
if (!missingExportValues.isEmpty()) {
throw new ErrorException("妯℃澘涓殑瀵煎嚭鍊间笉鑳戒负绌猴細\n" + String.join("\n", missingExportValues));
}
@@ -1623,6 +1705,8 @@
refreshed.setRemark(standardTemplate == null ? oldSnapshot.getRemark() : standardTemplate.getRemark());
refreshed.setThing(standardTemplate == null ? oldSnapshot.getThing() : standardTemplate.getThing());
refreshed.setRecordValues(templateRecordValuesMap.get(templateId));
+ refreshed.setDeviceDefaultsInitialized(oldSnapshot == null ? 0
+ : oldSnapshot.getDeviceDefaultsInitialized());
refreshed.setTemperature(templateTemperatureMap.get(templateId));
refreshed.setHumidity(templateHumidityMap.get(templateId));
// 鍒锋柊妯℃澘缁撴瀯鏃跺繀椤讳繚鐣欐楠岄樁娈靛~鍐欑殑涓氬姟鏁版嵁锛岄伩鍏嶈繘鍏ュ鏍稿悗鍥炴樉涓虹┖銆�
@@ -1675,11 +1759,25 @@
if (orderId == null || laboratory == null || type == null) {
throw new ErrorException("澶嶆牳鍙傛暟涓嶅畬鏁�");
}
+ InsOrder verifyOrder = insOrderMapper.selectById(orderId);
+ if (verifyOrder == null) throw new ErrorException("妫�楠屼换鍔′笉瀛樺湪");
+ if ("QUALITY_MONITOR".equals(verifyOrder.getTaskSource()) && !Objects.equals(verifyOrder.getState(), 1)) {
+ throw new ErrorException("宸插彇娑堢殑璐ㄩ噺鐩戞帶浠诲姟涓嶈兘澶嶆牳");
+ }
ensureDirectTemplateOrderState(orderId);
InsOrderState currentState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery()
.eq(InsOrderState::getInsOrderId, orderId)
.eq(InsOrderState::getLaboratory, laboratory)
.last("limit 1"));
+ if ("QUALITY_MONITOR".equals(verifyOrder.getTaskSource())
+ && (currentState == null || currentState.getVerifyUser() == null
+ || !Objects.equals(SecurityUtils.getUserId().intValue(), currentState.getVerifyUser()))) {
+ throw new ErrorException("鍙湁鎻愪氦鏃舵寚瀹氱殑澶嶆牳浜哄彲浠ュ鏍歌川閲忕洃鎺т换鍔�");
+ }
+ if ("QUALITY_MONITOR".equals(verifyOrder.getTaskSource()) && Objects.equals(type, 1)
+ && currentState != null && Objects.equals(currentState.getInsState(), 5)) {
+ return 1;
+ }
InsReport existingReport = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery()
.eq(InsReport::getInsOrderId, orderId)
.last("limit 1"));
@@ -1738,6 +1836,24 @@
insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
.eq(InsOrder::getId, orderId)
.set(InsOrder::getInsState, 5));
+
+ // 璐ㄩ噺鐩戞帶浠诲姟鍙繚鐣欏師濮嬭褰曪紝鍚庣画鐢辫川閲忕洃鎺ц瘎浠峰畬鎴愬綊妗c��
+ if ("QUALITY_MONITOR".equals(order.getTaskSource())) {
+ Integer evaluatorId = insOrderMapper.selectQualityMonitorEvaluatorId(orderId);
+ if (evaluatorId != null) {
+ InformationNotification notice = new InformationNotification();
+ notice.setCreateUser(insProductMapper.selectUserById(SecurityUtils.getUserId().intValue()).get("name"));
+ notice.setSenderId(SecurityUtils.getUserId().intValue());
+ notice.setConsigneeId(evaluatorId);
+ notice.setMessageType("2");
+ notice.setTheme("璐ㄩ噺鐩戞帶璇勪环閫氱煡");
+ notice.setContent("璐ㄩ噺鐩戞帶浠诲姟 " + order.getEntrustCode() + " 鐨勫師濮嬭褰曞凡澶嶆牳锛岃濉啓璇勪环璁板綍");
+ notice.setViewStatus(false);
+ notice.setJumpPath(MenuJumpPathConstants.QUALITY_MONITOR);
+ informationNotificationService.addInformationNotification(notice);
+ }
+ return 1;
+ }
// 妫�楠屼汉鍛樻彁浜ゅ鏍告椂涓嶇敓鎴愭姤鍛婏紱鍏ㄩ儴璇曢獙瀹ゅ鏍搁�氳繃鍚庣敓鎴愭姤鍛娿��
if (report == null || StringUtils.isBlank(report.getUrl())) {
@@ -1812,9 +1928,17 @@
} else {
- //澶嶆牳涓嶉�氳繃灏嗘妸澶嶆牳鐨勮礋璐d汉鍘绘帀
- Integer id = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, orderId).orderByDesc(InsSampleUser::getId).last("limit 1")).getId();
- insSampleUserMapper.deleteById(id);
+ // 澶嶆牳涓嶉�氳繃鍙幓鎺夋湰妫�楠屽鏈鎻愪氦鐨勫鏍歌礋璐d汉锛涙寜澶嶆牳浜虹姸鎬佸拰妫�楠屽瀹氫綅锛�
+ // 閬垮厤璇垹鍏朵粬妫�楠屽鐨勮褰曟垨妫�楠屼汉鍛樿褰曘��
+ InsSampleUser reviewerRow = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery()
+ .eq(InsSampleUser::getInsSampleId, orderId)
+ .eq(InsSampleUser::getState, 1)
+ .eq(InsSampleUser::getSonLaboratory, laboratory)
+ .orderByDesc(InsSampleUser::getId)
+ .last("limit 1"));
+ if (reviewerRow != null) {
+ insSampleUserMapper.deleteById(reviewerRow.getId());
+ }
// 褰撳墠瀹℃牳浜�
Integer currentUserId = SecurityUtils.getUserId().intValue();
@@ -1877,6 +2001,11 @@
* 鍏煎淇涓婄嚎鍓嶅凡缁忎笅鍙戙�佷絾鍥犳病鏈� ins_product 鑰岀己灏戜换鍔$姸鎬佺殑鐩寸粦妯℃澘璁㈠崟銆�
*/
private void ensureDirectTemplateOrderState(Integer orderId) {
+ InsOrder order = insOrderMapper.selectById(orderId);
+ // 鏈笅鍙戠殑鍗曡繕娌¤繘鍏ユ楠屼换鍔★紝鏌ョ湅鍘熷璁板綍涓嶈兘鎻愬墠鍒涘缓浠诲姟鐘舵�併��
+ if (order == null || order.getSendTime() == null) {
+ return;
+ }
if (!isDirectTemplateOrder(orderId)) {
return;
}
@@ -2009,6 +2138,10 @@
* @param orderId
*/
private void generateReport(Integer orderId, Integer reportType, Integer writeUserId) {
+ InsOrder sourceOrder = insOrderMapper.selectById(orderId);
+ if (sourceOrder != null && "QUALITY_MONITOR".equals(sourceOrder.getTaskSource())) {
+ throw new ErrorException("璐ㄩ噺鐩戞帶妫�楠屼换鍔′笉鐢熸垚鎶ュ憡");
+ }
/*鏍峰搧涓嬬殑椤圭洰鍙鏈変竴涓」鐩笉鍚堟牸鍒欐楠岀粨鏋滀负0,鍚﹀垯涓�1*/
//杩欓噷鐨刬nsSamples鏄鍗曚笅鐨勬墍鏈夋牱鍝佸寘鎷�("/")
List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId));
@@ -3774,6 +3907,40 @@
/**
* 鏂拌仛鐩寸粦妯℃澘璁㈠崟锛氭ā鏉夸腑姣忎竴涓�滃鍑哄�尖�濇壒娉ㄩ兘瀵瑰簲鎶ュ憡涓殑涓�鏉℃娴嬮」鐩��
*/
+ @Override
+ public List<Map<String, String>> getQualityMonitorRawResults(Integer orderId) {
+ requireReviewedQualityMonitorOrder(orderId);
+ return buildTemplateDetectionResultRows(orderId);
+ }
+
+ @Override
+ public QualityMonitorRawContext getQualityMonitorRawContext(Integer orderId) {
+ requireReviewedQualityMonitorOrder(orderId);
+ QualityMonitorRawContext context = new QualityMonitorRawContext();
+ List<InsOrderStandardTemplate> snapshots = insOrderStandardTemplateService.list(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, orderId)
+ .orderByAsc(InsOrderStandardTemplate::getSort, InsOrderStandardTemplate::getId));
+ context.setDetectionDates(snapshots.stream().map(InsOrderStandardTemplate::getDetectionTime)
+ .filter(Objects::nonNull).distinct().sorted().collect(Collectors.toList()));
+ List<Integer> deviceIds = insOrderTemplateDeviceMapper.selectDeviceIdsByOrderId(orderId);
+ if (CollectionUtils.isNotEmpty(deviceIds)) {
+ context.setDevices(insOrderMapper.selectDeviceListByIds(new LinkedHashSet<>(deviceIds)));
+ }
+ return context;
+ }
+
+ private void requireReviewedQualityMonitorOrder(Integer orderId) {
+ InsOrder order = insOrderMapper.selectById(orderId);
+ if (order == null || !"QUALITY_MONITOR".equals(order.getTaskSource())
+ || !Objects.equals(order.getInsState(), 5)) {
+ throw new ErrorException("璐ㄦ帶浠诲姟鍘熷璁板綍澶嶆牳閫氳繃鍚庢墠鑳借鍙栨娴嬫暟鎹�");
+ }
+ Long pendingCount = insOrderStateMapper.selectCount(Wrappers.<InsOrderState>lambdaQuery()
+ .eq(InsOrderState::getInsOrderId, orderId).ne(InsOrderState::getInsState, 5));
+ if (pendingCount > 0) throw new ErrorException("璐ㄦ帶浠诲姟浠嶆湁鏈鏍哥殑鍘熷璁板綍");
+ }
+
private List<Map<String, String>> buildTemplateDetectionResultRows(Integer orderId) {
List<InsOrderStandardTemplate> snapshots = insOrderStandardTemplateService.list(
Wrappers.<InsOrderStandardTemplate>lambdaQuery()
--
Gitblit v1.9.3