From 54c480e3632fbc6fc821786e2b473bceb2f0ae4e Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期六, 22 三月 2025 15:35:29 +0800
Subject: [PATCH] 天线的电路总报告保留两位小数
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 572 +++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 495 insertions(+), 77 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
index 5036ca7..5497fbe 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -17,16 +17,17 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.common.GetLook;
import com.yuanchu.mom.common.PrintChina;
-import com.yuanchu.mom.dto.InsOrderPlanDTO;
-import com.yuanchu.mom.dto.InsProductResultDto;
-import com.yuanchu.mom.dto.SampleProductDto;
-import com.yuanchu.mom.dto.SubmitPlanDto;
+import com.yuanchu.mom.dto.*;
import com.yuanchu.mom.exception.ErrorException;
import com.yuanchu.mom.mapper.*;
import com.yuanchu.mom.pojo.*;
import com.yuanchu.mom.service.*;
import com.yuanchu.mom.utils.*;
import com.yuanchu.mom.vo.*;
+import org.apache.poi.hwpf.usermodel.*;
+import org.apache.poi.ss.usermodel.CellValue;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Value;
@@ -35,6 +36,7 @@
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
+import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.nio.file.Files;
@@ -48,6 +50,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
+
+import org.apache.poi.hwpf.HWPFDocument;
/**
* 妫�楠屼换鍔�-涓氬姟瀹炵幇灞�
@@ -78,6 +82,8 @@
private ShiftTimeMapper shiftTimeMapper;
@Resource
private PerformanceShiftMapper performanceShiftMapper;
+ @Resource
+ private WarehouseHistoryMapper warehouseHistoryMapper;
@Resource
private WarehouseService warehouseService;
@@ -87,6 +93,9 @@
@Resource
WordUtils wordUtils;
+
+ @Resource
+ private InsReportMapper insReportMapper;
@Resource
private InsProductResultMapper insProductResultMapper;
@@ -120,6 +129,9 @@
@Resource
FuSheUtils fuSheUtils;
+
+ @Resource
+ DianLuUtils dianLuUtils;
@Override
public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) {
@@ -177,6 +189,12 @@
if (BeanUtil.isEmpty(order.getInsTime())) {
insOrder.setInsTime(LocalDateTime.now());//璁㈠崟鐨勬楠屾椂闂�
insOrderMapper.updateById(insOrder);
+ }
+ InsOrderState orderState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery()
+ .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
+ .eq(InsOrderState::getInsSampleId, sampleId)
+ .eq(InsOrderState::getLaboratory, laboratory));
+ if (ObjectUtils.isEmpty(orderState.getInsTime())) {
//鏇存柊妫�楠屼换鍔¤〃鐨勬楠屾椂闂�
insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate()
.eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
@@ -290,13 +308,14 @@
sampleId = insOrderFile.getInsSampleId();
insOrderFile.setInsSampleId(null);
}
- IPage<InsOrderFile> insOrderFileIPage = insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile), insOrderId, sonLaboratory,sampleId);
+ IPage<InsOrderFile> insOrderFileIPage = insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile), insOrderId, sonLaboratory, sampleId);
map.put("body", insOrderFileIPage);
return map;
}
@Override
- public int uploadFile(Integer orderId, MultipartFile file, String sonLaboratory, Integer sampleId) {
+ public Object uploadFile(Integer orderId, MultipartFile file, String sonLaboratory, Integer sampleId) {
+ InsOrder insOrder = insOrderMapper.selectById(orderId);
String urlString;
String pathName;
String path;
@@ -306,6 +325,9 @@
insOrderFile.setInsOrderId(orderId);
if (ObjectUtils.isNotEmpty(sampleId)) {
insOrderFile.setInsSampleId(sampleId);
+ }
+ if (ObjectUtils.isNotEmpty(sonLaboratory)) {
+ insOrderFile.setSonLaboratory(sonLaboratory);
}
insOrderFile.setFileName(filename);
if (contentType != null && contentType.startsWith("image/")) {
@@ -322,24 +344,33 @@
if (!realpath.exists()) {
realpath.mkdirs();
}
- pathName = UUID.randomUUID() + "_"+file.getOriginalFilename().replace("#", "&");
+ pathName = UUID.randomUUID() + "_" + file.getOriginalFilename().replace("#", "&");
urlString = realpath + "/" + pathName;
file.transferTo(new File(urlString));
insOrderFile.setFileUrl(pathName);
insOrderFileMapper.insert(insOrderFile);
- //濡傛灉鏄緪灏勮瘯楠�(杩戝満/杩滅▼涓婁紶鐨刢sv鏂囦欢)
String[] split = filename.split("\\.");
- if (ObjectUtils.isNotEmpty(sonLaboratory) && (sonLaboratory.equals("杩戝満") || sonLaboratory.equals("杩滃満")) &&
- split[split.length - 1].equals("csv")) {
- //鍒ゆ柇鏄摢绉峜sv鏂囦欢,鏄惁鏈夆�斺��
- if (sonLaboratory.equals("杩戝満")) {
- fuSheUtils.getFuSheWord1(sonLaboratory, insOrderFile);
- } else {
- fuSheUtils.getFuSheWord2(sonLaboratory, insOrderFile);
- }
+ if (ObjectUtils.isNotEmpty(sonLaboratory) && sonLaboratory.equals("杩戝満") && split[split.length - 1].equals("csv")) {
+ fuSheUtils.getFuSheWord1(sonLaboratory, insOrderFile);
+ } else if (ObjectUtils.isNotEmpty(sonLaboratory) && sonLaboratory.equals("杩滃満") && split[split.length - 1].equals("xlsx")) {
+ fuSheUtils.getFuSheWord2(sonLaboratory, insOrderFile);
+ } else if (ObjectUtils.isNotEmpty(sonLaboratory) && sonLaboratory.equals("鐢佃矾璇曢獙") && split[split.length - 1].equals("xlsx") && filename.contains("浜よ皟")) {
+ dianLuUtils.readDianLuFile1(sampleId, insOrderFile);
+ } else if (ObjectUtils.isNotEmpty(sonLaboratory) && sonLaboratory.equals("鐢佃矾璇曢獙") && split[split.length - 1].equals("csv") && filename.contains("椹绘尝")) {
+ dianLuUtils.readDianLuFile2(sampleId, insOrderFile);
+ } else if (ObjectUtils.isNotEmpty(sonLaboratory) && sonLaboratory.equals("鐢佃矾璇曢獙") && split[split.length - 1].equals("csv") && insOrder.getSampleType().equals("鏃犳簮鍣ㄤ欢")) {
+ dianLuUtils.readDianLuFile3(sampleId, insOrderFile);
+ }
+ // 鐢佃矾瀹為獙杩斿洖鏂囦欢鍚�
+ if(ObjectUtils.isNotEmpty(sonLaboratory) && sonLaboratory.equals("鐢佃矾璇曢獙")){
+ return pathName;
+ }
+ // 闇囧姩doc鏂囦欢瑙f瀽
+ if(filename.contains(".doc") && sonLaboratory.equals("鎸姩")){
+ return docAnalysis(urlString,orderId,sampleId,file.getOriginalFilename());
}
} catch (Exception e) {
- System.err.println("闄勪欢涓婁紶閿欒");
+ throw new ErrorException(e.getMessage());
}
return 0;
}
@@ -363,12 +394,15 @@
//鎵爜鎶ユ
@Override
- public int scanInsOrderState(String sonLaboratory, String sampleCode, String trees) {
+ public int scanInsOrderState(String sonLaboratory, String sampleCode, String trees, String entrustCode) {
/*鏍峰搧鍏ュ簱*/
- warehouseService.inWarehouse(trees, sampleCode);
+ warehouseService.inWarehouse(trees, sampleCode, entrustCode);
/*鏂板妫�楠屼换鍔�*/
//鍏堝垽鏂鏍峰搧鏄惁鏈夎繖涓珯鐐圭殑椤圭洰
- InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getSampleCode, sampleCode));
+ List<InsOrder> insOrders = insOrderMapper.selectList(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getEntrustCode, entrustCode));
+ InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getSampleCode, sampleCode)
+ .eq(InsSample::getInsOrderId, insOrders.get(0).getId()));
List<String> collect = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
.eq(InsProduct::getState, 1)
.eq(InsProduct::getInsSampleId, insSample.getId())).stream().map(InsProduct::getSonLaboratory).collect(Collectors.toList());
@@ -396,7 +430,7 @@
} else {
InsOrderState insOrderState = new InsOrderState();
insOrderState.setInsOrderId(insSample.getInsOrderId());
- insOrderState.setInsOrderId(insSample.getId());
+ insOrderState.setInsSampleId(insSample.getId());
insOrderState.setLaboratory(sonLaboratory);
insOrderState.setInsState(0);
insOrderState.setNum(1);//鍒濆鏄涓�娆�
@@ -407,10 +441,13 @@
//鎵爜鍑哄簱
@Override
- public int outInsOrderState(String sonLaboratory, String sampleCode) {
+ public int outInsOrderState(String sonLaboratory, String sampleCode, String entrustCode) {
//鍒ゆ柇璇ユ牱鍝佺殑妫�楠屼换鍔℃槸鍚﹀凡缁忕粨鏉�(缁х画璇曢獙鎴栬�呮槸缁撴潫璇曢獙)
//鍏堝垽鏂鏍峰搧鏄惁鏈夎繖涓珯鐐圭殑椤圭洰
- InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getSampleCode, sampleCode));
+ List<InsOrder> insOrders = insOrderMapper.selectList(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getEntrustCode, entrustCode));
+ InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getSampleCode, sampleCode)
+ .eq(InsSample::getInsOrderId, insOrders.get(0).getId()));
List<String> collect = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
.eq(InsProduct::getState, 1)
.eq(InsProduct::getInsSampleId, insSample.getId())).stream().map(InsProduct::getSonLaboratory).collect(Collectors.toList());
@@ -432,7 +469,7 @@
}
}
boolean a = true;
- warehouseService.outWarehouse(sampleCode, a);
+ warehouseService.outWarehouse(sampleCode, a, entrustCode);
return 0;
}
@@ -475,11 +512,60 @@
//鑾峰彇鏈�鍚庝竴琛岀殑num锛屽嵆鎬昏鏁般�傛澶勪粠0寮�濮�
int maxRow = sheet.getLastRowNum();
for (int row = 0; row <= maxRow; row++) {
+ XSSFRow xssfRow = sheet.getRow(row);
//鑾峰彇鏈�鍚庡崟鍏冩牸num锛屽嵆鎬诲崟鍏冩牸鏁� ***娉ㄦ剰锛氭澶勪粠1寮�濮嬭鏁�***
int maxRol = sheet.getRow(row).getLastCellNum();
StringBuilder aLine = new StringBuilder();
- for (int rol = 0; rol < maxRol; rol++) {
+ /*for (int rol = 0; rol < maxRol; rol++) {
aLine.append(sheet.getRow(row).getCell(rol)).append(",");
+ }*/
+ for (int rol = 0; rol < maxRol; rol++) {
+ XSSFCell cell = xssfRow.getCell(rol);
+ if (cell == null) {
+ aLine.append(",");
+ } else {
+ switch (cell.getCellType()) {
+ case FORMULA:
+ // 璁$畻鍏紡骞惰幏鍙栫粨鏋�
+ CellValue cellValue = xssfWorkbook.getCreationHelper().createFormulaEvaluator().evaluate(cell);
+ switch (cellValue.getCellType()) {
+ case NUMERIC:
+ String formattedValue = String.format("%.4f", cellValue.getNumberValue());
+ aLine.append(formattedValue);
+ break;
+ case STRING:
+ aLine.append(cellValue.getStringValue());
+ break;
+ case BOOLEAN:
+ aLine.append(cellValue.getBooleanValue());
+ break;
+ case ERROR:
+ aLine.append("#ERR!");
+ break;
+ default:
+ aLine.append("");
+ break;
+ }
+ break;
+ case NUMERIC:
+ String formattedValue = String.format("%.4f", cell.getNumericCellValue());
+ aLine.append(formattedValue);
+ break;
+ case STRING:
+ aLine.append(cell.getStringCellValue());
+ break;
+ case BOOLEAN:
+ aLine.append(cell.getBooleanCellValue());
+ break;
+ case ERROR:
+ aLine.append("#ERR!");
+ break;
+ default:
+ aLine.append("");
+ break;
+ }
+ aLine.append(",");
+ }
}
String substring = aLine.substring(0, aLine.length() - 1);
result.append(substring).append("\n");
@@ -577,6 +663,16 @@
}
} catch (Exception e) {
result.setAfterCheck("");//''
+ }
+ //瀹為獙缁撴灉
+ try {
+ JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("testResult")));
+ if (resValue.get("v") != null) {
+ Object o = JSON.parseObject(JSON.toJSONString(resValue.get("v"))).get("v");
+ result.setTestResult(o.equals("") ? null : (o.toString()));
+ }
+ } catch (Exception e) {
+ result.setTestResult("");//''
}
//璁惧缂栧彿
if (jo.get("equipValue") != null) {
@@ -679,22 +775,23 @@
throw new ErrorException("棰戠巼涓嶈兘涓虹┖");
}
Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
+ //鏌ヨ鏍峰搧淇℃伅
+ InsSample insSample = insSampleMapper.selectById(insProductResultDtos.getSampleId());
//鏌ヨ妫�楠屽崟淇℃伅
- InsOrder insOrder = insOrderMapper.selectById(insProductResultDtos.getOrderId());
InsOrderState orderState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery()
- .eq(InsOrderState::getInsOrderId, insProductResultDtos.getOrderId())
+ .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
.eq(InsOrderState::getInsSampleId, insProductResultDtos.getSampleId())
.eq(InsOrderState::getLaboratory, insProductResultDtos.getSonLaboratory())
.orderByDesc(InsOrderState::getId)
.last("LIMIT 1"));// 纭繚鍙彇涓�鏉¤褰�
- //鏌ヨ鏍峰搧淇℃伅
- InsSample insSample = insSampleMapper.selectById(insProductResultDtos.getSampleId());
List<Integer> list = new ArrayList<>();
/*鏂板妫�楠岄」鐩楠屽�艰褰曡〃(閲囧彇鍏堝垹鍚庡)*/
insProductResult2Mapper.delete(Wrappers.<InsProductResult2>lambdaQuery()
.in(InsProductResult2::getInsProductId, insProductResultDtos.getInsProductResult2s().stream().map(InsProductResult2::getInsProductId).distinct().collect(Collectors.toList()))
.eq(InsProductResult2::getNum, orderState.getNum())
.eq(InsProductResult2::getFrequency, insProductResultDtos.getFrequency()));
+ List<InsProductResult2> result2s = new ArrayList<>();
+ List<InsProductUser> insProductUsers = new ArrayList<>();
for (InsProductResult2 insProductResult2 : insProductResultDtos.getInsProductResult2s()) {
InsProduct insProduct = new InsProduct();
insProduct.setId(insProductResult2.getInsProductId());//椤圭洰id
@@ -730,8 +827,9 @@
//缁撹
int ressult = 1;
String valueStr = insProductResult2.getValue();
+ String regex = "[\u4e00-\u9fa5]";
if (!insProduct.getAsk().contains(",")) {
- if (insProduct.getAsk().equals("/")) {
+ if (insProduct.getAsk().equals("/") || Pattern.compile(regex).matcher(insProduct.getAsk()).find()) {
ressult = 3; //涓嶅垽瀹�
} else if (!isValueValid(valueStr, new String[]{insProduct.getAsk()})) {
ressult = 0; //涓嶅悎鏍�
@@ -771,10 +869,13 @@
}
result2.setCreateUser(userId);
result2.setUpdateUser(userId);
- insProductResult2Mapper.insert(result2);
- insProduct.setUpdateUser(userId);
- insProductMapper.updateById(insProduct);
- insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId()));
+ result2s.add(result2);
+ //insProductResult2Mapper.insert(result2);
+ //insProduct.setUpdateUser(userId);
+ //insProducts.add(insProduct);
+ //insProductMapper.updateById(insProduct);
+ insProductUsers.add(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId()));
+ //insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId()));
/*鏇存柊鏍峰搧鐨勬楠岀姸鎬�*/
insSample.setInsState(1);
Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
@@ -790,18 +891,139 @@
//濡傛灉鎵�鏈夐」鐩兘鏈夌粨璁�,閭d箞璇ユ牱鍝佺姸鎬佸凡妫�
insSample.setInsState(2);
}
- insSampleMapper.updateById(insSample);
}
+ insProductResult2Mapper.saveBatch(result2s);
+ insProductUserMapper.saveBatch(insProductUsers);
+ insSampleMapper.updateById(insSample);
/*鍒ゆ柇璇ョ珯鐐圭殑妫�楠岄」鐩槸鍚﹀叏閮ㄥ凡妫�*/
- int count = insProductMapper.selectInsProductCountByOrderId(insProductResultDtos.getOrderId());
+ int count = insProductMapper.selectInsProductCountByOrderId(insSample.getInsOrderId());
if (count == 0) {
insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate()
- .eq(InsOrderState::getInsOrderId, insProductResultDtos.getOrderId())
+ .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
.eq(InsOrderState::getInsSampleId, insProductResultDtos.getSampleId())
.eq(InsOrderState::getLaboratory, insProductResultDtos.getSonLaboratory())
.set(InsOrderState::getInsState, 2));
}
return list;
+ }
+
+ //鐢佃矾璇曢獙鐨勪繚瀛樻楠屽唴瀹�(杩斿洖/鎻愪氦)
+ @Override
+ public int saveInsContext2s(InsProductResultDtos insProductResultDtos) {
+ for (InsProductResultDto insProductResultDto : insProductResultDtos.getInsProductResultDtos()) {
+ saveInsContext2(insProductResultDto);
+ }
+ return 1;
+ }
+
+ /**
+ * 闇囧姩doc鏂囦欢瑙f瀽
+ * @param urlString
+ * @param orderId
+ * @param sampleId
+ * @param originFileName
+ * @return
+ */
+ private Map<String, String> docAnalysis(String urlString,Integer orderId,Integer sampleId,String originFileName) {
+ Map<String, String> analysisMap = new HashMap<>();
+ try {
+ File file = new File(urlString);
+ HWPFDocument document = new HWPFDocument(new FileInputStream(file));
+ Range range = document.getRange();
+ TableIterator tableIterator = new TableIterator(range);
+ List<Table> tableList = new ArrayList<>();
+ while (tableIterator.hasNext()) {
+ tableList.add(tableIterator.next());
+ }
+ for (int tableIndex = 0; tableIndex < tableList.size(); tableIndex++) {
+ // 鍙栫涓�涓〃鍗曢檺鍒跺弬鏁扮殑 鎸姩鍙板瀷鍙枫�佽繍鍔ㄩ儴浠剁瓑鏁堣川閲忋�佽瘯浠惰川閲忔暟鍊�
+ if(tableIndex == 0){
+ Table table = tableList.get(0);
+ for (int i = 0; i < table.numRows(); i++) {
+ String columnText = ObjectUtils.isEmpty(table.getRow(i).getCell(0))? "" : table.getRow(i).getCell(0).text();
+ String columnValue = ObjectUtils.isEmpty(table.getRow(i).getCell(1))? "" : table.getRow(i).getCell(1).text();
+ if(columnValue.contains("\u0007")){
+ columnValue = columnValue.replace("\u0007","");
+ }
+ if(columnText.contains("\u0007")){
+ columnText = columnText.replace("\u0007","");
+ }
+ if(columnText.equals("鎸姩鍙板瀷鍙�")){
+ analysisMap.put("11",columnValue);
+ }
+ if(columnText.equals("杩愬姩閮ㄤ欢绛夋晥璐ㄩ噺")){
+ analysisMap.put("12",columnValue);
+ }
+ if(columnText.equals("璇曚欢璐ㄩ噺")){
+ analysisMap.put("1",columnValue);
+ }
+ }
+ }
+ //鍙栫涓�涓〃鍗曡緭鍏ラ�氶亾鍙傛暟绗竴鏉℃暟鎹�
+ if(tableIndex == 1){
+ Table table = tableList.get(1);
+ if(ObjectUtils.isNotEmpty(table)&& table.numRows() > 0){
+ String columnValue = ObjectUtils.isEmpty(table.getRow(1).getCell(2))? "" : table.getRow(1).getCell(2).text();
+ if(columnValue.contains("\u0007")){
+ columnValue = columnValue.replace("\u0007","");
+ }
+ analysisMap.put("9",columnValue);
+ }
+ }
+ // 鍙栨渶鍚庝竴涓〃鍗曠涓夌鍥涜淇℃伅
+ if(tableIndex == tableList.size() - 1){
+ Table table = tableList.get(tableIndex);
+ for (int i = 0; i < table.numRows(); i++) {
+ String columnText = ObjectUtils.isEmpty(table.getRow(i).getCell(0))? "" : table.getRow(i).getCell(0).text();
+ String columnValue = ObjectUtils.isEmpty(table.getRow(i).getCell(1))? "" : table.getRow(i).getCell(1).text();
+ if(columnValue.contains("\u0007")){
+ columnValue = columnValue.replace("\u0007","");
+ }
+ if(columnText.contains("\u0007")){
+ columnText = columnText.replace("\u0007","");
+ }
+ if(columnText.contains("鎬昏繍琛屾椂闂�")){
+ analysisMap.put("13",columnValue);
+ }
+ if(columnText.contains("璇曢獙鎵鏁�")){
+ analysisMap.put("10",columnValue);
+ }
+ }
+ }
+ }
+ // 鍥剧墖缁戝畾
+ List<Picture> pictureList = document.getPicturesTable().getAllPictures();
+ String[] split = originFileName.split("\\.");
+ String docName = "";
+ if(null != split && split.length > 0){
+ docName = split[0];
+ }
+ for (Picture picture : pictureList) {
+ byte[] pictureData = picture.getContent();
+ File imgDir = new File(imgUrl);
+ if (!imgDir.exists()) {
+ imgDir.mkdirs();
+ }
+ String filename = docName + "_" + UUID.randomUUID()+".png";
+ File pictureFile = new File(imgUrl + File.separatorChar + filename);
+ // 鍒涘缓杈撳嚭娴佷互灏嗗浘鐗囨暟鎹啓鍏ュ埌鎸囧畾璺緞
+ try (OutputStream outputStream = new FileOutputStream(pictureFile)) {
+ // 鍐欏叆鏁版嵁
+ outputStream.write(pictureData);
+ }
+ InsOrderFile insOrderFile = new InsOrderFile();
+ insOrderFile.setInsOrderId(orderId);
+ insOrderFile.setInsSampleId(sampleId);
+ insOrderFile.setSonLaboratory("鎸姩");
+ insOrderFile.setType(1);
+ insOrderFile.setFileName(filename);
+ insOrderFile.setFileUrl(filename);
+ insOrderFileMapper.insert(insOrderFile);
+ }
+ }catch (Exception e){
+ log.error(e.getMessage());
+ }
+ return analysisMap;
}
//娓╂箍搴﹁瘯楠�+鍔熺巼璇曢獙鐨勪繚瀛樻楠屽唴瀹�
@@ -830,19 +1052,19 @@
}
}
// 澶勭悊鍏朵粬姣旇緝鏉′欢
- if (ask.startsWith(">")) {
+ if (ask.startsWith(">") || ask.startsWith("锛�")) {
double threshold = Double.parseDouble(ask.substring(1));
return s > threshold;
} else if (ask.startsWith("鈮�")) {
double threshold = Double.parseDouble(ask.substring(1));
return s >= threshold;
- } else if (ask.startsWith("<")) {
+ } else if (ask.startsWith("<")|| ask.startsWith("锛�")) {
double threshold = Double.parseDouble(ask.substring(1));
return s < threshold;
} else if (ask.startsWith("鈮�")) {
double threshold = Double.parseDouble(ask.substring(1));
return s <= threshold;
- } else if (ask.equals("=")) {
+ } else if (ask.equals("=")|| ask.startsWith("锛�")) {
double exactValue = Double.parseDouble(ask.substring(1));
return s == exactValue;
}
@@ -866,7 +1088,7 @@
if (ObjectUtils.isEmpty(s)) {
continue;
}
- double numericValue = Double.parseDouble(s);
+ double numericValue = Math.abs(Double.parseDouble(s));
boolean valid = Arrays.stream(valuesToCheck)
.allMatch(v -> getResult(numericValue, v));
if (!valid) {
@@ -889,7 +1111,7 @@
@Override
@Transactional(rollbackFor = Exception.class)
- public int verifyPlan(Integer sampleId, String laboratory, Integer type, String tell) throws IOException {
+ public int verifyPlan(Integer sampleId, String laboratory, Integer type, String tell) {
LocalDateTime now = LocalDateTime.now();
Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
List<InsUnPass> insUnPasses = new ArrayList<>();
@@ -952,7 +1174,7 @@
.set(InsOrderState::getCreateTime, LocalDateTime.now()));
break;
case 1:
- //缁х画璇曢獙:璇ョ珯鐐逛换鍔$粨鏉�(鍙互鍐嶆鎵爜妫�楠�)锛�
+ //缁х画璇曢獙:璇ユ牱鍝佽绔欑偣浠诲姟缁撴潫(鍙互鍐嶆鎵爜妫�楠�)锛�
insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate()
.eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
.eq(InsOrderState::getInsSampleId, sampleId)
@@ -971,14 +1193,18 @@
.set(InsOrderState::getVerifyTell, tell)
.set(InsOrderState::getVerifyUser, userId));
//濡傛灉璁㈠崟绫诲瀷鏄師鐞嗘牱鏈�,鍒欒璁㈠崟鐩存帴闂幆
- if (insOrder.getFormType().equals("鍘熺悊鏍锋満")) {
- //鍑哄簱
- try {
- outInsOrderState(laboratory, insSample.getSampleCode());
- } catch (Exception e) {
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, insSample.getInsOrderId()));
+ for (InsSample sample : insSamples) {
+ try{
+ outInsOrderState(laboratory, sample.getSampleCode(), insOrder.getEntrustCode());
+ }catch (Exception e){
}
}
+ /*鐢熸垚瀵瑰簲鐨勬楠屾姤鍛�*/
+ List<InsReportDto1> insReportDto1s=insOrderUserMapper.selectInsReportDto1(insOrder.getId());
+ createReport(insOrder.getId(),insReportDto1s);
+ //璇ヨ鍗曢棴鐜�
insOrder.setState(4);
insOrderMapper.updateById(insOrder);
break;
@@ -987,7 +1213,113 @@
return 1;
}
- private void getTemplateThing(Set<Integer> set, Map<Integer, String> map2, List<InsProduct> insProducts) {
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int verifyPlan2(Integer sampleId, String laboratory, Integer type, String tell) {
+ Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
+ InsSample insSample = insSampleMapper.selectById(sampleId);
+ InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId());
+ /*type=0 鍐嶆璇曢獙; type=1 缁х画璇曢獙 ; type=2 缁撴潫璇曢獙*/
+ // 鏌ヨ鏍规嵁 id 鍊掑簭鎺掑垪鐨勭涓�鏉¤褰�
+ InsOrderState record = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery()
+ .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
+ .eq(InsOrderState::getInsSampleId, sampleId)
+ .eq(InsOrderState::getLaboratory, laboratory)
+ .orderByDesc(InsOrderState::getId)
+ .last("LIMIT 1")); // 纭繚鍙彇涓�鏉¤褰�
+ if (record != null) {
+ switch (type) {
+ case 0:
+ //鍐嶆璇曢獙:璇ュ崟瀛愰��鍥炲埌妫�楠岀姸鎬�(鎺掑簭鏀规垚褰撳墠鐨勬渶鍚�),娆℃暟閫掑(淇濈暀浠ュ墠鐨勬暟鎹�)锛�
+ insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate()
+ .eq(InsOrderState::getId, record.getId())
+ .set(InsOrderState::getInsTime, LocalDateTime.now())
+ .set(InsOrderState::getInsState, 4)
+ .set(InsOrderState::getVerifyTell, tell)
+ .set(InsOrderState::getVerifyUser, userId)
+ .set(InsOrderState::getNum, record.getNum() + 1)//娆℃暟鍔�1
+ .set(InsOrderState::getCreateTime, LocalDateTime.now()));
+ break;
+ case 1:
+ //缁х画璇曢獙:璇ユ牱鍝佽绔欑偣浠诲姟缁撴潫(鍙互鍐嶆鎵爜妫�楠�)锛�
+ //鍏堝垽鏂笂涓�涓鏍告槸浠�涔堢粨璁�
+ if (record.getInsState()==4){
+ insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate()
+ .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
+ .eq(InsOrderState::getInsSampleId, sampleId)
+ .eq(InsOrderState::getLaboratory, laboratory)
+ .set(InsOrderState::getInsState, 6)
+ .set(InsOrderState::getVerifyTell, tell)
+ .set(InsOrderState::getNum, record.getNum() - 1)//娆℃暟-1
+ .set(InsOrderState::getVerifyUser, userId));
+ }else {
+ insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate()
+ .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
+ .eq(InsOrderState::getInsSampleId, sampleId)
+ .eq(InsOrderState::getLaboratory, laboratory)
+ .set(InsOrderState::getInsState, 6)
+ .set(InsOrderState::getVerifyTell, tell)
+ .set(InsOrderState::getVerifyUser, userId));
+ }
+ break;
+ case 2:
+ //缁撴潫璇曢獙:姝ゅ鎵樺崟鍋滄璇曢獙(鏃犳硶鍐嶆妫�楠�)銆�
+ //鍏堝垽鏂笂涓�涓鏍告槸浠�涔堢粨璁�
+ if (record.getInsState()==4){
+ insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate()
+ .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
+ .eq(InsOrderState::getInsSampleId, sampleId)
+ .eq(InsOrderState::getLaboratory, laboratory)
+ .set(InsOrderState::getInsState, 5)
+ .set(InsOrderState::getNum, record.getNum() - 1)//娆℃暟-1
+ .set(InsOrderState::getVerifyTell, tell)
+ .set(InsOrderState::getVerifyUser, userId));
+ }else {
+ insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate()
+ .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
+ .eq(InsOrderState::getInsSampleId, sampleId)
+ .eq(InsOrderState::getLaboratory, laboratory)
+ .set(InsOrderState::getInsState, 5)
+ .set(InsOrderState::getVerifyTell, tell)
+ .set(InsOrderState::getVerifyUser, userId));
+ }
+ //鍑哄簱
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, insSample.getInsOrderId()));
+ for (InsSample sample : insSamples) {
+ try{
+ outInsOrderState(laboratory, sample.getSampleCode(), insOrder.getEntrustCode());
+ }catch (Exception e){
+ }
+ }
+ /*鐢熸垚瀵瑰簲鐨勬楠屾姤鍛�*/
+ List<InsReportDto1> insReportDto1s=insOrderUserMapper.selectInsReportDto1(insOrder.getId());
+ createReport(insOrder.getId(),insReportDto1s);
+ //璁㈠崟闂幆
+ insOrder.setState(4);
+ insOrderMapper.updateById(insOrder);
+ break;
+ }
+ }
+ return 1;
+ }
+
+
+ /*鐢熸垚瀵瑰簲鐨勬楠屾姤鍛�*/
+ private void createReport(Integer orderId,List<InsReportDto1> insReportDto1s){
+ for (InsReportDto1 insReportDto1 : insReportDto1s) {
+ if (ObjectUtils.isNotEmpty(insReportDto1.getInsReportDto2s())){
+ wordUtils.generateReport(orderId, insReportDto1);
+// try{
+// wordUtils.generateReport(orderId, insReportDto1);
+// }catch (Exception e){
+// throw new ErrorException("鎶ュ憡鏍煎紡鐢熸垚鏈夎,璇疯仈绯荤鐞嗗憳!");
+// }
+ }
+ }
+ }
+
+ private void getTemplateThing
+ (Set<Integer> set, Map<Integer, String> map2, List<InsProduct> insProducts) {
for (InsProduct product : insProducts) {
if (product.getTemplateId() == null) {
product.setTemplate(new ArrayList<>());
@@ -1025,6 +1357,7 @@
InsOrderUser insOrderUser = new InsOrderUser();
insOrderUser.setInsOrderStateId(orderState.getId());
insOrderUser.setSubmitUser(getLook.selectPowerByMethodAndUserId(null).get("userId"));
+ insOrderUser.setInsTime(orderState.getInsTime());
insOrderUser.setSubmitTime(LocalDateTime.now());
insOrderUser.setNum(orderState.getNum());
insOrderUser.setNote(ObjectUtils.isNotEmpty(submitPlanDto.getNote()) ? submitPlanDto.getNote() : null);
@@ -1033,13 +1366,18 @@
List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
.eq(InsProduct::getInsSampleId, insSample.getId())
.eq(InsProduct::getSonLaboratory, submitPlanDto.getLaboratory())
+ .and(wrapper -> wrapper
+ .isNull(InsProduct::getInsResult)
+ .or()
+ .eq(InsProduct::getInsResult, 2)
+ )
.eq(InsProduct::getState, 1));
if (insProducts.size() > 0) {
String str = "";
int count = 0;
for (InsProduct product : insProducts) {
- //杈愬皠璇曢獙,娓╂箍搴﹁瘯楠�,鍔熺巼璇曢獙鐨勬楠岄」鐩�,涓嶉渶瑕佸幓鎵嬪姩濉啓妫�楠屽��,鍙渶瑕佷笂浼犺〃鏍兼枃浠跺氨鍙互浜�,鍚庡彴鎻愪氦鐨勬椂鍊欐牎楠岃烦杩囪繖涓楠岄」鐩�
- if (product.getInspectionItem().equals("杈愬皠璇曢獙") || product.getInspectionItem().equals("娓╂箍搴﹁瘯楠�") || product.getInspectionItem().equals("鍔熺巼璇曢獙")) {
+ //娓╂箍搴﹁瘯楠�,鍔熺巼璇曢獙鐨勬楠岄」鐩�,涓嶉渶瑕佸幓鎵嬪姩濉啓妫�楠屽��,鍙渶瑕佷笂浼犺〃鏍兼枃浠跺氨鍙互浜�,鍚庡彴鎻愪氦鐨勬椂鍊欐牎楠岃烦杩囪繖涓楠岄」鐩�
+ if ( product.getInspectionItem().equals("娓╂箍搴﹁瘯楠�") || product.getInspectionItem().equals("鍔熺巼璇曢獙")) {
product.setInsResult(3);//涓嶅垽瀹�
insProductMapper.updateById(product);
continue;
@@ -1078,27 +1416,12 @@
info.setCreateUser(insProductMapper.selectUserById(userId).get("name"));
info.setMessageType("2");
info.setTheme("澶嶆牳閫氱煡");
- info.setContent("鎮ㄦ湁涓�鏉℃楠屼换鍔″緟澶嶆牳娑堟伅");
+ info.setContent("鎮ㄦ湁涓�鏉℃楠屼换鍔″緟澶嶆牳娑堟伅,璁㈠崟鍙锋槸锛�" + insOrder.getEntrustCode() + ",鏍峰搧鍚嶇О涓猴細" + insSample.getSample());
info.setSenderId(userId);
info.setConsigneeId(submitPlanDto.getVerifyUser());
info.setViewStatus(false);
info.setJumpPath("b1-inspect-order-plan");
informationNotificationService.addInformationNotification(info);
- // todo 浼佷笟寰俊娑堟伅鎺ㄩ�丂zss
- HashMap<String, Object> map = new HashMap<>();
- String account = userMapper.selectById(submitPlanDto.getVerifyUser()).getAccount();
- map.put("touser", account);//鎺ユ敹娑堟伅鎴愬憳鐨勮处鍙�'ZT-031292'杩欑绫诲瀷(濡傛灉鏈夊涓敤'|'鍒嗛殧)
- map.put("toparty", "");//鎺ユ敹閮ㄩ棬id
- map.put("totag", "");//娑堟伅鏍囩id
- map.put("msgtype", "text");//娑堟伅绫诲瀷 text:鏂囨湰
- map.put("agentid", 1000517);//搴旂敤id
- HashMap<String, Object> hashMap = new HashMap<>();
- hashMap.put("content", "鎮ㄦ湁涓�鏉℃楠屼换鍔″緟澶嶆牳娑堟伅,璁㈠崟鍙锋槸锛�" + insOrder.getEntrustCode() + ",璇峰墠寰�LIMS绯荤粺鏌ョ湅銆�<a href=\"https://ztwxlims.ztt.cn:7443/enter\">涓ぉ閫氫俊LIMS绯荤粺 </a>");
- map.put("text", hashMap);//娑堟伅鍐呭
- map.put("safe", 0);//鏄惁淇濆瘑娑堟伅.0鍚�
- map.put("enable_id_trans", 0);//鏄惁寮�鍚痠d杞瘧.0鍚�
- map.put("enable_duplicate_check", 0);//鏄惁寮�鍚噸澶嶆秷鎭鏌�.0鍚�
- qywxApi.send(map);
//澶嶆牳浜�--妫�楠屽崟鐩稿叧璐熻矗浜�
InsSampleUser insSampleUser = new InsSampleUser();
insSampleUser.setUserId(submitPlanDto.getVerifyUser());
@@ -1108,18 +1431,22 @@
insSampleUserMapper.insert(insSampleUser);
/*鐢熸垚鐢佃矾璇曢獙鐨勭珯鐐规姤鍛婂苟涓婁紶鍒伴檮浠朵腑*/
if (submitPlanDto.getLaboratory().equals("鐢佃矾璇曢獙")) {
- //wordUtils.generateWord(submitPlanDto.getTerm(), orderState);
- //todo 鐢佃矾绔欑偣鎶ュ憡 姝e紡搴撻儴缃叉斁寮�
- try {
+ if (!insOrder.getSampleType().equals("鏃犳簮鍣ㄤ欢")) {
wordUtils.generateWord(submitPlanDto.getTerm(), orderState);
- } catch (Exception e) {
- throw new ErrorException("鐢佃矾璇曢獙鐨勭珯鐐规姤鍛婄敓鎴愭湁璇�,璇疯仈绯诲紑鍙戜汉鍛樿皟鏁�!");
+ } else {
+ wordUtils.generateWord2(submitPlanDto.getTerm(), orderState);
}
+ //todo 鐢佃矾绔欑偣鎶ュ憡 姝e紡搴撻儴缃叉斁寮�
+// try {
+// if (!insOrder.getSampleType().equals("鏃犳簮鍣ㄤ欢")) {
+// wordUtils.generateWord(submitPlanDto.getTerm(), orderState);
+// }else {
+// wordUtils.generateWord2(submitPlanDto.getTerm(), orderState);
+// }
+// } catch (Exception e) {
+// throw new ErrorException("鐢佃矾璇曢獙鐨勭珯鐐规姤鍛婄敓鎴愭湁璇�,璇疯仈绯诲紑鍙戜汉鍛樿皟鏁�!");
+// }
}
- /*// 鍒犻櫎鏁伴噰閲囬泦娆℃暟
- String key = "frequency" + ":" + submitPlanDto.getEntrustCode() + ":*";
- RedisUtil.delsLike(key);*/
-
/*鐢熸垚浜ч噺宸ユ椂*/
//鏍¢獙濡傛灉杩欎釜浜鸿繖涓娴嬮」鐩凡缁忔坊鍔犺繃浜嗗垯涓嶉渶瑕佸啀鏂板
//棣栧厛鍒ゆ柇褰撳墠浜虹殑褰撳墠鏃堕棿鏄惁鏄帓鐝椂闂村唴,濡傛灉涓嶆槸灏辨槸鍔犵彮
@@ -1164,14 +1491,105 @@
DateTime parse = DateUtil.parse(localDateTime.format(formatter));
auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//鏄熸湡
auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//鍛ㄦ
- auxiliaryOutputWorkingHours.setCheck(userId);//妫�娴嬩汉
auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours);
}
}
}
+
+ // todo 浼佷笟寰俊娑堟伅鎺ㄩ�丂zss
+ HashMap<String, Object> map = new HashMap<>();
+ String account = userMapper.selectById(submitPlanDto.getVerifyUser()).getAccount();
+ map.put("touser", account);//鎺ユ敹娑堟伅鎴愬憳鐨勮处鍙�'ZT-031292'杩欑绫诲瀷(濡傛灉鏈夊涓敤'|'鍒嗛殧)
+ map.put("toparty", "");//鎺ユ敹閮ㄩ棬id
+ map.put("totag", "");//娑堟伅鏍囩id
+ map.put("msgtype", "text");//娑堟伅绫诲瀷 text:鏂囨湰
+ map.put("agentid", 1000517);//搴旂敤id
+ HashMap<String, Object> hashMap = new HashMap<>();
+ hashMap.put("content", "鎮ㄦ湁涓�鏉℃楠屼换鍔″緟澶嶆牳娑堟伅,璁㈠崟鍙锋槸锛�" + insOrder.getEntrustCode() + ",鏍峰搧鍚嶇О涓猴細" + insSample.getSample() +
+ ",璇峰墠寰�LIMS绯荤粺鏌ョ湅銆傝鐐瑰嚮<a href=\"https://ztwxlims.ztt.cn:7443/enter\">涓ぉ閫氫俊LIMS绯荤粺 </a>");
+ map.put("text", hashMap);//娑堟伅鍐呭
+ map.put("safe", 0);//鏄惁淇濆瘑娑堟伅.0鍚�
+ map.put("enable_id_trans", 0);//鏄惁寮�鍚痠d杞瘧.0鍚�
+ map.put("enable_duplicate_check", 0);//鏄惁寮�鍚噸澶嶆秷鎭鏌�.0鍚�
+ qywxApi.send(map);
return 1;
}
+ @Override
+ public int cancelSubmitPlan(Integer orderStateId) {
+ InsOrderState orderState = insOrderStateMapper.selectById(orderStateId);
+ InsOrder insOrder = insOrderMapper.selectById(orderState.getInsOrderId());
+ InsSample insSample = insSampleMapper.selectById(orderState.getInsSampleId());
+ /*鍒犻櫎璁板綍妫�楠屼换鍔℃瘡娆$殑澶囨敞淇℃伅*/
+ insOrderUserMapper.delete(Wrappers.<InsOrderUser>lambdaQuery()
+ .eq(InsOrderUser::getInsOrderStateId, orderState.getId())
+ .eq(InsOrderUser::getNum, orderState.getNum()));
+ //鎾ら攢鎻愪氦
+ insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate()
+ .eq(InsOrderState::getInsOrderId, orderState.getInsOrderId())
+ .eq(InsOrderState::getInsSampleId, orderState.getInsSampleId())
+ .eq(InsOrderState::getLaboratory, orderState.getLaboratory())
+ .set(InsOrderState::getInsState, 2));
+ Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
+ //LIMS绯荤粺娑堟伅鎺ㄩ��
+ InformationNotification info = new InformationNotification();
+ info.setCreateUser(insProductMapper.selectUserById(userId).get("name"));
+ info.setMessageType("2");
+ info.setTheme("澶嶆牳鎾ら攢閫氱煡");
+ info.setContent("鎮ㄦ湁涓�鏉℃楠屼换鍔″緟澶嶆牳宸叉挙閿�鐨勬秷鎭�,璁㈠崟鍙锋槸锛�" + insOrder.getEntrustCode() + ",鏍峰搧鍚嶇О涓猴細" + insSample.getSample());
+ info.setSenderId(userId);
+ info.setConsigneeId(orderState.getVerifyUser());
+ info.setViewStatus(false);
+ info.setJumpPath("b1-inspect-order-plan");
+ informationNotificationService.addInformationNotification(info);
+ //鍒犻櫎澶嶆牳浜�--妫�楠屽崟鐩稿叧璐熻矗浜�
+ insSampleUserMapper.delete(Wrappers.<InsSampleUser>lambdaQuery()
+ .eq(InsSampleUser::getState, 1)
+ .eq(InsSampleUser::getSonLaboratory, orderState.getLaboratory())
+ .eq(InsSampleUser::getUserId, orderState.getVerifyUser())
+ .eq(InsSampleUser::getInsSampleId, orderState.getInsSampleId()));
+ //鍒犻櫎鐢熸垚鐨勬姤鍛�
+ if (orderState.getLaboratory().equals("鐢佃矾璇曢獙")) {
+ List<InsOrderFile> insOrderFiles = insOrderFileMapper.selectList(Wrappers.<InsOrderFile>lambdaQuery()
+ .eq(InsOrderFile::getType, 2)
+ .like(InsOrderFile::getFileName, "鐢佃矾鍙傛暟.docx")
+ .eq(InsOrderFile::getInsOrderId, insOrder.getId())
+ .eq(InsOrderFile::getInsSampleId, orderState.getInsSampleId())
+ .eq(InsOrderFile::getSonLaboratory, orderState.getLaboratory()));
+ for (InsOrderFile insOrderFile : insOrderFiles) {
+ File file = new File(wordUrl + "/" + insOrderFile.getFileUrl());
+ file.delete();
+ insOrderFileMapper.deleteById(insOrderFile.getId());
+ }
+ }
+
+ /*鍒犻櫎鐢熸垚浜ч噺宸ユ椂*/
+ List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsSampleId, insSample.getId()));
+ List<Integer> productIds = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList());
+ auxiliaryOutputWorkingHoursMapper.delete(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
+ .eq(AuxiliaryOutputWorkingHours::getSample, insSample.getSampleCode())
+ .in(AuxiliaryOutputWorkingHours::getInsProductId, productIds)
+ .eq(AuxiliaryOutputWorkingHours::getNum, orderState.getNum()));
+
+ // todo 浼佷笟寰俊娑堟伅鎺ㄩ�丂zss
+ HashMap<String, Object> map = new HashMap<>();
+ String account = userMapper.selectById(orderState.getVerifyUser()).getAccount();
+ map.put("touser", account);//鎺ユ敹娑堟伅鎴愬憳鐨勮处鍙�'ZT-031292'杩欑绫诲瀷(濡傛灉鏈夊涓敤'|'鍒嗛殧)
+ map.put("toparty", "");//鎺ユ敹閮ㄩ棬id
+ map.put("totag", "");//娑堟伅鏍囩id
+ map.put("msgtype", "text");//娑堟伅绫诲瀷 text:鏂囨湰
+ map.put("agentid", 1000517);//搴旂敤id
+ HashMap<String, Object> hashMap = new HashMap<>();
+ hashMap.put("content", "鎮ㄦ湁涓�鏉″鏍哥殑娑堟伅宸叉挙閿�,璁㈠崟鍙锋槸锛�" + insOrder.getEntrustCode() + ",鏍峰搧鍚嶇О涓猴細" + insSample.getSample() +
+ ",璇峰墠寰�LIMS绯荤粺鏌ョ湅銆傝鐐瑰嚮<a href=\"https://ztwxlims.ztt.cn:7443/enter\">涓ぉ閫氫俊LIMS绯荤粺 </a>");
+ map.put("text", hashMap);//娑堟伅鍐呭
+ map.put("safe", 0);//鏄惁淇濆瘑娑堟伅.0鍚�
+ map.put("enable_id_trans", 0);//鏄惁寮�鍚痠d杞瘧.0鍚�
+ map.put("enable_duplicate_check", 0);//鏄惁寮�鍚噸澶嶆秷鎭鏌�.0鍚�
+ qywxApi.send(map);
+ return 0;
+ }
+
public static String getWeek(String dayStr) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
--
Gitblit v1.9.3