From a92b6f6175b1401071e5fb3bd9fab8a2a3b72011 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 01 九月 2023 14:34:28 +0800
Subject: [PATCH] version
---
inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java | 38 ++++++++++++++++++++++++++++++--------
1 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java
index 4f5f9c1..0e54519 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java
@@ -1,7 +1,9 @@
package com.yuanchu.limslaboratory.service.impl;
+import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Snowflake;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -132,6 +134,7 @@
RawMaterial rawMaterial = new RawMaterial();
rawMaterial.setId(inspectionVo.getId());
rawMaterial.setType(1);
+ rawMaterial.setInspectionDate(DateUtil.date());
rawMaterial.setSurveyor(userMapper.selectById(id).getName());
rawMaterialMapper.updateById(rawMaterial);
}
@@ -156,7 +159,12 @@
inspectionMaterialMapper.insert(inspectionMaterial);
/*鏂板妫�楠岄」鐩〃*/
//鏍规嵁鏍峰搧鍚嶇О缂栧彿浠ュ強鍨嬪彿瑙勬牸鑾峰彇鍨嬪彿id
- Integer specificationId = getSpecificationId(inspectionVo.getName(), inspectionVo.getMcode(), inspectionVo.getSpecifications());
+ Integer specificationId = null;
+ if(ObjectUtils.isNotEmpty(inspectionVo.getSpecificationId())){
+ specificationId =Integer.parseInt(inspectionVo.getSpecificationId());
+ }else{
+ specificationId=getSpecificationId(inspectionVo.getName(), inspectionVo.getMcode(), inspectionVo.getSpecifications());
+ }
//濡傛灉璇曢獙椤圭洰瀛楁涓嶄负绌哄垯鎸夎瀛楁鐨勯」鐩繘琛屽尮閰�
if (ObjectUtils.isNotEmpty(inspectionVo.getExperiment())) {
//鑾峰彇璇曢獙椤圭洰淇℃伅(缁撴瀯,瀵肩嚎澶栧緞)
@@ -194,7 +202,10 @@
return inspection.getId();
}
//濡傛灉璇曢獙椤圭洰涓虹┖鍒欐寜鐓у瀷鍙穒d鍦ㄦ爣鍑嗗簱閲岄潰鍏ㄩ儴鍖归厤
- List<Product> productList = productMapper.selectList(Wrappers.<Product>query().eq("specifications_id", specificationId));
+ List<Product> productList =
+ productMapper.selectList(Wrappers.<Product>query()
+ .eq("specifications_id", specificationId)
+ .eq("version",inspectionVo.getVersion()));
//灏嗘煡璇㈢殑椤圭洰淇℃伅鏋勫缓鎴愭楠岄」鐩�
ArrayList<InspectionProduct> list = new ArrayList<>();
for (Product product : productList) {
@@ -233,7 +244,8 @@
BeanUtils.copyProperties(inspectionMaterial, inspectDetailVo);
/*鏌ヨ妫�楠屽崟閲岄潰鐨勬楠岄」鐩�,骞跺皝瑁呭埌RawInspectVo瀵硅薄涓�*/
LambdaQueryWrapper<InspectionProduct> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(InspectionProduct::getInspectionMaterialId, inspectionMaterial.getId());
+ queryWrapper
+ .eq(InspectionProduct::getInspectionMaterialId, inspectionMaterial.getId());
List<InspectionProduct> inspectionProducts = inspectionProductMapper.selectList(queryWrapper);
//杩欓噷鏌ュ埌鐨勮澶噄d鍜屾楠屽憳id瑕佹煡璇㈠悕绉�
List<InsProductVo> insProductVos = inspectionProducts.stream().map(insProduct -> {
@@ -242,16 +254,15 @@
BeanUtils.copyProperties(insProduct, insProductVo);
//鑾峰彇璁惧鍚�(鍓嶆彁鏄鏋滃瓨鍦�)
if (insProduct.getInstrumentId() != null) {
- String equipmentName = instrumentService.getById(insProduct.getInstrumentId()).getEquipmentName();
- insProductVo.setInstrumentName(equipmentName);
+ insProductVo.setInstrumentId(insProduct.getInstrumentId());
}
//鑾峰彇鐢ㄦ埛鍚�(鍓嶆彁鏄鏋滃瓨鍦�)
- if (insProduct.getUserId() != null) {
- String userName = userMapper.selectById(insProduct.getUserId()).getName();
- insProductVo.setUserName(userName);
+ if (insProduct.getUserProId() != null) {
+ insProductVo.setUserId(insProduct.getUserProId());
}
//椤圭洰鍏宠仈鐗╂枡id
insProductVo.setInspectionMaterialId(inspectionMaterial.getId());
+ insProductVo.setId(insProduct.getId());
return insProductVo;
}).collect(Collectors.toList());
inspectDetailVo.setInsProducts(insProductVos);
@@ -286,12 +297,23 @@
return "淇濆瓨鎴愬姛!";
}
+ @Override
+ public boolean chooseEquipment(Integer id, Integer equipmentId) {
+ UpdateWrapper<InspectionProduct>inspectionProductUpdateWrapper=new UpdateWrapper<>();
+ inspectionProductUpdateWrapper.lambda().set(InspectionProduct::getInstrumentId,equipmentId)
+ .eq(InspectionProduct::getId,id);
+ return inspectionProductMapper.update(null,inspectionProductUpdateWrapper)>0;
+ }
+
/*鏍规嵁鏍峰搧鍚嶇О,鏍峰搧缂栧彿,鍨嬪彿瑙勬牸鑾峰彇鍨嬪彿id*/
private Integer getSpecificationId(String name, String mcode, String specification) {
//鑾峰彇鐗╂枡id
Material material = materialMapper.selectOne(Wrappers.<Material>query()
.eq("name", name)
.eq("code", mcode));
+ if (Objects.isNull(material)){
+ return null;
+ }
//鑾峰彇瑙勬牸鍚嶇О鍜屽瀷鍙峰悕绉�
String[] split = specification.split("-");
String stName = split[0];
--
Gitblit v1.9.3