From 681ebad558051dd3b18c379b5c06b23bc08c0761 Mon Sep 17 00:00:00 2001
From: 李林 <z1292839451@163.com>
Date: 星期五, 14 六月 2024 18:08:10 +0800
Subject: [PATCH] 标准库导入
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java | 140 ++++++++++++++++++++++++++++++++--
performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryWorkingHoursDayController.java | 2
inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml | 3
inspect-server/src/main/resources/mapper/StandardProductListMapper.xml | 14 +++
inspect-server/src/main/resources/mapper/StandardTreeMapper.xml | 16 +++
cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java | 2
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java | 1
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java | 1
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java | 6 +
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java | 4 +
inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java | 2
performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java | 1
cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java | 16 +++
13 files changed, 195 insertions(+), 13 deletions(-)
diff --git a/cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java b/cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java
index 0bcb4ac..cf1347c 100644
--- a/cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java
+++ b/cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java
@@ -223,6 +223,7 @@
db_str = structureItemParameterService.getOne(Wrappers.lambdaQuery(StructureItemParameter.class)
.eq(StructureItemParameter::getInspectionItem, str.getInspectionItem())
.eq(StructureItemParameter::getSample, str.getSample())
+ .last("limit 1")
);
} catch (Exception e) {
throw new ErrorException("閲嶅鏌ヨ锛�" + str.getInspectionItem());
@@ -233,6 +234,7 @@
.eq(StructureItemParameter::getInspectionItem, str.getInspectionItem())
.eq(StructureItemParameter::getSample, str.getSample())
.eq(StructureItemParameter::getInspectionItemSubclass, str.getInspectionItemSubclass())
+ .last("limit 1")
);
} catch (Exception e) {
throw new ErrorException("閲嶅鏌ヨ锛�" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
@@ -282,7 +284,7 @@
if (list1.get(13) == null) {
str.setPrice(null);
} else {
- str.setPrice(BigDecimal.valueOf(Long.parseLong((list1.get(13).toString()))));
+ str.setPrice(list1.get(13) + "");
}
if (list1.get(14) == null) {
@@ -334,6 +336,18 @@
} else {
str.setTemplateId(null);
}
+ try {
+ if (list1.get(22) != null) {
+ str.setInspectionItemClass(list1.get(22) + "");
+ }
+ } catch (Exception e) {
+ }
+ try {
+ if (list1.get(23) != null) {
+ str.setInspectionItemClassEn(list1.get(23) + "");
+ }
+ } catch (Exception e) {
+ }
lists.add(str);
}
});
diff --git a/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java b/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
index 9d59109..fac6580 100644
--- a/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
+++ b/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
@@ -46,7 +46,7 @@
@ValueTableShow(4)
@ApiModelProperty(value = "鍗曚环(鍏�)")
- private BigDecimal price;
+ private String price;
@ApiModelProperty(value = "鍦烘墍")
private String laboratory;
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java
index e9d4f44..24fa385 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java
@@ -31,6 +31,7 @@
List<StandardMethodList> selectListEnum();
+ Integer getStandardMethodId(String code);
}
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java
index 3d5d0bf..a264777 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java
@@ -14,6 +14,7 @@
IPage<StandardProductList> standardProductListIPage(Integer id, String tree, IPage<StandardProductList> iPage, String laboratory, String item, String items);
+ StandardProductList getOne(Integer standardMethodListId, String inspectionItem, String sample, String inspectionItemSubclass, String model);
}
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
index 2cf473b..088b697 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
@@ -1,6 +1,7 @@
package com.yuanchu.mom.mapper;
import com.yuanchu.mom.dto.FactoryDto;
+import com.yuanchu.mom.dto.SampleDto;
import com.yuanchu.mom.dto.SampleTypeDto;
import com.yuanchu.mom.pojo.StandardMethodList;
import com.yuanchu.mom.pojo.StandardProductList;
@@ -8,6 +9,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
+import java.util.Map;
/**
* @author Administrator
@@ -34,6 +36,10 @@
List<StandardProductList> selectStandardProductListByTree3(String tree, String sample, String model, String trees);
List<SampleTypeDto> getStandardTree2();
+
+ List<SampleDto> getStandardTree3(String sampleType);
+
+ String getLaboratory(String str);
}
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java b/inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java
index 84529ec..b5cbfc7 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java
@@ -23,4 +23,6 @@
List<StandardMethodList> selectStandardMethodEnum();
+ Integer getStandardMethodId(String code);
+
}
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java
index 83a74fd..82d1f22 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java
@@ -136,6 +136,10 @@
return standardMethodListMapper.selectListEnum();
}
+ @Override
+ public Integer getStandardMethodId(String code) {
+ return baseMapper.getStandardMethodId(code);
+ }
}
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
index 3977838..f96abd5 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
@@ -1,29 +1,34 @@
package com.yuanchu.mom.service.impl;
+import cn.hutool.core.lang.Console;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.dto.FactoryDto;
+import com.yuanchu.mom.dto.LaboratoryDto;
import com.yuanchu.mom.dto.SampleTypeDto;
-import com.yuanchu.mom.mapper.StandardMethodListMapper;
+import com.yuanchu.mom.exception.ErrorException;
import com.yuanchu.mom.mapper.StandardProductListMapper;
import com.yuanchu.mom.mapper.StandardTreeMapper;
import com.yuanchu.mom.pojo.StandardProductList;
+import com.yuanchu.mom.pojo.StandardTemplate;
import com.yuanchu.mom.pojo.StandardTree;
-import com.yuanchu.mom.service.StandardMethodListService;
-import com.yuanchu.mom.service.StandardProductListService;
-import com.yuanchu.mom.service.StandardTreeService;
+import com.yuanchu.mom.service.*;
import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
/**
* @author Administrator
@@ -37,17 +42,29 @@
private StandardTreeMapper standardTreeMapper;
- private StandardMethodListMapper standardMethodListMapper;
-
private StandardMethodListService standardMethodListService;
private StandardProductListMapper standardProductListMapper;
private StandardProductListService standardProductListService;
+ private StandardTemplateService standardTemplateService;
+
+ private EnumService enumService;
+
@Override
public List<FactoryDto> selectStandardTreeList() {
- return standardTreeMapper.selectStandardTreeList();
+ List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeList();
+ for (FactoryDto factoryDto : factoryDtos) {
+ for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
+ for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) {
+ if (sampleTypeDto.getChildren().size() == 0) {
+ sampleTypeDto.setChildren(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue()));
+ }
+ }
+ }
+ }
+ return factoryDtos;
}
@Override
@@ -117,7 +134,7 @@
@Override
@Transactional(rollbackFor = Exception.class)
public int upStandardProducts(Map<String, Object> product) {
- List<Integer> ids = JSON.parseArray(product.get("ids")+"");
+ List<Integer> ids = JSON.parseArray(product.get("ids") + "");
StandardProductList productList = JSON.parseObject(JSON.toJSONString(product.get("standardProductList")), StandardProductList.class);
standardProductListMapper.update(productList, Wrappers.<StandardProductList>lambdaUpdate().in(StandardProductList::getId, ids));
return 1;
@@ -132,6 +149,7 @@
}
@Override
+ @Transactional(rollbackFor = Exception.class)
public void inExcelOfTree(MultipartFile file) {
InputStream inputStream;
try {
@@ -139,10 +157,114 @@
} catch (IOException e) {
throw new RuntimeException(e);
}
+ List<StandardProductList> lists = new ArrayList<>();
+ AtomicReference<String> laboratory = new AtomicReference<>();
ExcelUtil.readBySax(inputStream, 0, (i, l, list) -> {
- System.out.println(list);
+ StandardProductList str = new StandardProductList();
+ if (i == 0 && l == 1) {
+ laboratory.set(standardTreeMapper.getLaboratory(list.get(1) + ""));
+ if (laboratory.get() == null) {
+ throw new ErrorException("妫�楠屽璞′笉瀛樺湪锛�" + list.get(1));
+ }
+ }
if (i == 0 && l >= 1) {
+ Integer standardMethodId = standardMethodListService.getStandardMethodId(list.get(0) + "");
+ if (standardMethodId == null) {
+ throw new ErrorException("鏍囧噯缂栧彿涓嶅瓨鍦細" + list.get(0));
+ }
+ str.setStandardMethodListId(standardMethodId);
+ str.setSampleType(list.get(1) + "");
+ if (list.get(2) != null) {
+ str.setSample(list.get(2) + "");
+ } else {
+ str.setSample(null);
+ }
+ if (list.get(3) != null) {
+ str.setModel(list.get(3) + "");
+ Long aLong = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery()
+ .eq(StandardTree::getModel, str.getModel())
+ .eq(StandardTree::getSampleType, list.get(1) + ""));
+ if (aLong == 0) {
+ StandardTree standardTree = new StandardTree();
+ standardTree.setFactory("涓ぉ绉戞妧妫�娴嬩腑蹇�");
+ standardTree.setLaboratory(laboratory.get());
+ standardTree.setSampleType(str.getSampleType());
+ standardTree.setSample(str.getSample());
+ standardTree.setModel(str.getModel());
+ standardTreeMapper.insert(standardTree);
+ }
+ } else {
+ str.setModel(null);
+ }
+ str.setInspectionItem(list.get(4) + "");
+ if (list.get(6) == null) {
+ str.setInspectionItemSubclass(null);
+ } else {
+ str.setInspectionItemSubclass(list.get(6).toString());
+ }
+ StandardProductList db_str;
+ try {
+ db_str = standardProductListMapper.getOne(str.getStandardMethodListId(),str.getInspectionItem(),str.getSample(),str.getInspectionItemSubclass(),str.getModel());
+ } catch (Exception e) {
+ throw new ErrorException("閲嶅鏌ヨ锛�" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
+ }
+ if (ObjectUtils.isNotEmpty(db_str)) {
+ str.setId(db_str.getId());
+ str.setStructureItemParameterId(db_str.getStructureItemParameterId());
+ }
+ if (list.get(8) != null) {
+ StringBuilder buffer = new StringBuilder();
+ String input = list.get(8).toString();
+ buffer.append("[");
+ String[] values = input.split("銆�");
+ for (String value : values) {
+ buffer.append("\"").append(value.trim()).append("\",");
+ }
+ buffer.deleteCharAt(buffer.length() - 1);
+ buffer.append("]");
+ str.setMethod(buffer.toString());
+ }
+ if (list.get(11) == null) {
+ str.setTell(null);
+ } else {
+ str.setTell(list.get(11).toString());
+ }
+
+ if (list.get(12) == null) {
+ str.setAsk(null);
+ } else {
+ str.setAsk(list.get(12).toString());
+ }
+
+ if (list.get(13) == null) {
+ str.setPrice(null);
+ } else {
+ str.setPrice((list.get(13).toString()));
+ }
+
+ if (list.get(14) == null) {
+ str.setManHour(null);
+ } else {
+ str.setManHour(list.get(14).toString());
+ }
+
+ StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list.get(21)));
+ if (standTempIdByName != null) {
+ str.setTemplateId(standTempIdByName.getId());
+ } else {
+ throw new ErrorException("妯℃澘涓嶅瓨鍦細" + list.get(21));
+ }
+
+ str.setState(1);
+ lists.add(str);
+ }
+ });
+ lists.forEach(a->{
+ if(a.getId() != null){
+ standardProductListMapper.updateById(a);
+ }else{
+ standardProductListMapper.insert(a);
}
});
}
diff --git a/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml b/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml
index 721b82c..54caf1b 100644
--- a/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml
+++ b/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml
@@ -93,4 +93,7 @@
OR structure_test_object_id = '[]'
)
</select>
+ <select id="getStandardMethodId" resultType="java.lang.Integer">
+ select id from standard_method where code = #{code}
+ </select>
</mapper>
diff --git a/inspect-server/src/main/resources/mapper/StandardProductListMapper.xml b/inspect-server/src/main/resources/mapper/StandardProductListMapper.xml
index 5735cfd..a696171 100644
--- a/inspect-server/src/main/resources/mapper/StandardProductListMapper.xml
+++ b/inspect-server/src/main/resources/mapper/StandardProductListMapper.xml
@@ -43,4 +43,18 @@
and inspection_item_subclass = #{items}
</if>
</select>
+ <select id="getOne" resultType="com.yuanchu.mom.pojo.StandardProductList">
+ select * from standard_product_list
+ where standard_method_list_id = #{standardMethodListId}
+ and inspection_item = #{inspectionItem}
+ <if test="sample!=null">
+ and sample = #{sample}
+ </if>
+ <if test="inspectionItemSubclass!=null">
+ and inspection_item_subclass = #{inspectionItemSubclass}
+ </if>
+ <if test="model!=null">
+ and model = #{model}
+ </if>
+ </select>
</mapper>
diff --git a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
index 982cc12..9b04568 100644
--- a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
+++ b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -56,8 +56,7 @@
from laboratory l
left join structure_test_object sto on sto.laboratory_id = l.id
left join product p on p.object_id = sto.id
- left join standard_tree st on st.laboratory = l.laboratory_name
- and st.sample_type = sto.specimen_name
+ left join standard_tree st on st.sample_type = sto.specimen_name
and st.sample = p.name
order by l.id,CAST(sto.code AS DECIMAL),p.id,ISNULL(st.id),st.id
</select>
@@ -251,4 +250,17 @@
OR sample LIKE CONCAT('%', #{tree}, '%')
)
</select>
+ <select id="getStandardTree3" resultType="com.yuanchu.mom.dto.SampleDto">
+ select model label,
+ model value
+ from standard_tree
+ where sample_type = #{sampleType}
+ and sample is null
+ </select>
+ <select id="getLaboratory" resultType="java.lang.String">
+ select l.laboratory_name
+ from structure_test_object sto
+ left join laboratory l on sto.laboratory_id = l.id
+ where sto.specimen_name = #{str}
+ </select>
</mapper>
diff --git a/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java b/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java
index 7be9807..c558ea3 100644
--- a/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java
+++ b/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java
@@ -46,6 +46,7 @@
return Result.success(auxiliaryOutputWorkingHoursService.selectAuxiliaryOutputWorkingHours(page, entity));
}
+ @ValueClassify("宸ユ椂绠$悊")
@ApiOperation(value = "缁熻浜ч噺宸ユ椂姹囨�诲拰杈呭姪宸ユ椂姹囨��")
@PostMapping("/collectWorkingHours")
public Result collectWorkingHours(){
diff --git a/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryWorkingHoursDayController.java b/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryWorkingHoursDayController.java
index 70f9af3..e65f7e3 100644
--- a/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryWorkingHoursDayController.java
+++ b/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryWorkingHoursDayController.java
@@ -48,12 +48,14 @@
return Result.success(auxiliaryWorkingHoursDayService.selectAuxiliaryWorkingHoursDay(page, entity));
}
+ @ValueClassify("宸ユ椂绠$悊")
@ApiOperation(value = "鏍规嵁缂栧彿鏌ヨ杈呭姪宸ユ椂閰嶇疆淇℃伅")
@PostMapping("/selectAuxiliaryWorkingHoursByNumber")
public Result selectAuxiliaryWorkingHoursByNumber(String number) {
return Result.success(auxiliaryWorkingHoursDayService.selectAuxiliaryWorkingHoursByNumber(number));
}
+ @ValueClassify("宸ユ椂绠$悊")
@ApiOperation(value = "鏍规嵁缂栧彿褰撳墠鐢ㄦ埛淇℃伅鏌ヨ鎵�鍦ㄧ彮娆�")
@PostMapping("/selectshiftByUser")
public Result selectshiftByUser(LocalDateTime dateTime) {
--
Gitblit v1.9.3