From e97b55310155a2dd691bd698a10295a4d867f60c Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期五, 17 四月 2026 15:55:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/qm/service/impl/QmJudgeServiceImpl.java | 61 ++++++++++++++++++++++++++++++
1 files changed, 60 insertions(+), 1 deletions(-)
diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/qm/service/impl/QmJudgeServiceImpl.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/qm/service/impl/QmJudgeServiceImpl.java
index 55b949c..e6edd0e 100644
--- a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/qm/service/impl/QmJudgeServiceImpl.java
+++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/qm/service/impl/QmJudgeServiceImpl.java
@@ -1,5 +1,6 @@
package org.dromara.qa.qm.service.impl;
+import org.dromara.common.core.service.JudgeService;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -19,6 +20,13 @@
import org.dromara.qa.qm.service.IQmStdService;
import org.dromara.qa.qm.mapper.QmStdMapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import org.dromara.qa.qm.domain.QmCheckitem;
+import org.dromara.qa.qm.domain.QmJudgeDetails;
+import org.dromara.qa.qm.mapper.QmCheckitemMapper;
+import org.dromara.qa.qm.mapper.QmJudgeDetailsMapper;
+import org.springframework.transaction.annotation.Transactional;
+
import java.util.List;
import java.util.Map;
import java.util.Collection;
@@ -35,10 +43,12 @@
@Slf4j
@RequiredArgsConstructor
@Service
-public class QmJudgeServiceImpl implements IQmJudgeService {
+public class QmJudgeServiceImpl implements IQmJudgeService, JudgeService {
private final QmJudgeMapper baseMapper;
private final QmStdMapper qmStdMapper;
+ private final QmCheckitemMapper qmCheckitemMapper;
+ private final QmJudgeDetailsMapper qmJudgeDetailsMapper;
/**
* 鏌ヨ鍒ゅ畾渚濇嵁
@@ -127,12 +137,52 @@
* @return 鏄惁鏂板鎴愬姛
*/
@Override
+ @Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(QmJudgeBo bo) {
QmJudge add = MapstructUtils.convert(bo, QmJudge.class);
+ if (add.getCdate() == null) {
+ add.setCdate(new java.util.Date());
+ }
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
+
+ // 1. 鏍规嵁 stdCod 鏌ヨ鍚敤鐨勮绋嬫楠岄」鐩�
+ LambdaQueryWrapper<QmCheckitem> itemLqw = Wrappers.lambdaQuery();
+ itemLqw.eq(QmCheckitem::getStdCode, bo.getStdCod());
+ itemLqw.eq(QmCheckitem::getEnable, 1L);
+ itemLqw.ne(QmCheckitem::getDel, 1L);
+ List<QmCheckitem> checkitems = qmCheckitemMapper.selectList(itemLqw);
+
+ if (!checkitems.isEmpty()) {
+ List<QmJudgeDetails> detailsList = checkitems.stream().map(item -> {
+ QmJudgeDetails detail = new QmJudgeDetails();
+ detail.setJudgeId(add.getId());
+ detail.setItemCod(item.getId());
+ detail.setItemName(item.getItemName());
+ detail.setValue3(0.0);
+ detail.setValue1(0.0);
+ detail.setValue2(0.0);
+ detail.setLocation(item.getLocation());
+ detail.setCls(item.getCheckLevel());
+ detail.setStdscore(item.getScore() != null ? item.getScore() : 0.0);
+ detail.setIsmix(item.getIsmix() != null ? item.getIsmix() : 0L);
+ detail.setRid(item.getRid());
+ detail.setCategory(item.getCategory());
+ detail.setDecisionDes(item.getItemDes());
+ return detail;
+ }).collect(Collectors.toList());
+ qmJudgeDetailsMapper.insertBatch(detailsList);
+ }
+
+ // 2. 灏嗗師鏉ュ瓨鍦ㄧ殑鐩稿悓鐗╂枡鐗屽彿鍜岀被鍨嬬殑渚濇嵁璁剧疆涓虹鐢�
+ LambdaUpdateWrapper<QmJudge> updateWrapper = Wrappers.lambdaUpdate();
+ updateWrapper.set(QmJudge::getStatus, 0L)
+ .eq(QmJudge::getMatCode, bo.getMatCode())
+ .eq(QmJudge::getCategory, bo.getCategory())
+ .ne(QmJudge::getId, add.getId());
+ baseMapper.update(null, updateWrapper);
}
return flag;
}
@@ -171,4 +221,13 @@
}
return baseMapper.deleteByIds(ids) > 0;
}
+
+ @Override
+ public String selectJudgeNameByCode(String judgeCode) {
+ QmJudgeVo qmJudgeVo = baseMapper.selectVoById(judgeCode);
+ if(qmJudgeVo!=null){
+ return qmJudgeVo.getJudgeName();
+ }
+ return null;
+ }
}
--
Gitblit v1.9.3