From 4bc7776bc6c063a9bfb9806e4bf6db5bf22985b1 Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期一, 09 十二月 2024 16:10:01 +0800 Subject: [PATCH] 电路试验的互调报告解析 --- inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 104 +++++++++++++++++++++++++++++---------------------- 1 files changed, 59 insertions(+), 45 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 29394c6..28d5611 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 @@ -129,6 +129,9 @@ @Resource FuSheUtils fuSheUtils; + @Resource + DianLuUtils dianLuUtils; + @Override public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { Map<String, Object> map = new HashMap<>(); @@ -185,6 +188,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()) @@ -298,13 +307,13 @@ 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) { String urlString; String pathName; String path; @@ -333,21 +342,19 @@ 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); } } catch (Exception e) { System.err.println("闄勪欢涓婁紶閿欒"); @@ -374,12 +381,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()); @@ -418,10 +428,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()); @@ -443,7 +456,7 @@ } } boolean a = true; - warehouseService.outWarehouse(sampleCode, a); + warehouseService.outWarehouse(sampleCode, a, entrustCode); return 0; } @@ -789,7 +802,7 @@ //缁撹 int ressult = 1; String valueStr = insProductResult2.getValue(); - String regex ="[\u4e00-\u9fa5]"; + String regex = "[\u4e00-\u9fa5]"; if (!insProduct.getAsk().contains(",")) { if (insProduct.getAsk().equals("/") || Pattern.compile(regex).matcher(insProduct.getAsk()).find()) { ressult = 3; //涓嶅垽瀹� @@ -1034,7 +1047,10 @@ if (insOrder.getFormType().equals("鍘熺悊鏍锋満")) { //鍑哄簱 try { - outInsOrderState(laboratory, insSample.getSampleCode()); + List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, insSample.getInsOrderId())); + for (InsSample sample : insSamples) { + outInsOrderState(laboratory, sample.getSampleCode(), insOrder.getEntrustCode()); + } } catch (Exception e) { } @@ -1143,7 +1159,7 @@ 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); @@ -1158,12 +1174,13 @@ 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>"); + 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); + qywxApi.send(map); //澶嶆牳浜�--妫�楠屽崟鐩稿叧璐熻矗浜� InsSampleUser insSampleUser = new InsSampleUser(); insSampleUser.setUserId(submitPlanDto.getVerifyUser()); @@ -1181,9 +1198,6 @@ throw new ErrorException("鐢佃矾璇曢獙鐨勭珯鐐规姤鍛婄敓鎴愭湁璇�,璇疯仈绯诲紑鍙戜汉鍛樿皟鏁�!"); } } - /*// 鍒犻櫎鏁伴噰閲囬泦娆℃暟 - String key = "frequency" + ":" + submitPlanDto.getEntrustCode() + ":*"; - RedisUtil.delsLike(key);*/ /*鐢熸垚浜ч噺宸ユ椂*/ //鏍¢獙濡傛灉杩欎釜浜鸿繖涓娴嬮」鐩凡缁忔坊鍔犺繃浜嗗垯涓嶉渶瑕佸啀鏂板 @@ -1210,26 +1224,26 @@ } for (AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours : submitPlanDto.getAuxiliaryOutputWorkingHoursList()) { InsProduct insProduct = insProductMapper.selectById(auxiliaryOutputWorkingHours.getInsProductId()); - if (isWithinRange) { - //鍦ㄦ椂闂村唴灏辨槸姝e父涓婄彮 - auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//闈炲姞鐝鎵樺崟鍙� - auxiliaryOutputWorkingHours.setWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//闈炲姞鐝伐鏃� - auxiliaryOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲� - } else { - //鍔犵彮 - auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode());//鍔犵彮濮旀墭鍗曞彿 - auxiliaryOutputWorkingHours.setOvertimeWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//鍔犵彮宸ユ椂 - auxiliaryOutputWorkingHours.setOvertimeAmount(1);//鍔犵彮鏁伴噺 - } - auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//宸ユ椂鍒嗙粍 - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//鏃ユ湡 - LocalDateTime localDateTime = LocalDateTime.now(); - DateTime parse = DateUtil.parse(localDateTime.format(formatter)); - auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//鏄熸湡 - auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//鍛ㄦ - auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); + if (isWithinRange) { + //鍦ㄦ椂闂村唴灏辨槸姝e父涓婄彮 + auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//闈炲姞鐝鎵樺崟鍙� + auxiliaryOutputWorkingHours.setWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//闈炲姞鐝伐鏃� + auxiliaryOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲� + } else { + //鍔犵彮 + auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode());//鍔犵彮濮旀墭鍗曞彿 + auxiliaryOutputWorkingHours.setOvertimeWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//鍔犵彮宸ユ椂 + auxiliaryOutputWorkingHours.setOvertimeAmount(1);//鍔犵彮鏁伴噺 + } + auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//宸ユ椂鍒嗙粍 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//鏃ユ湡 + LocalDateTime localDateTime = LocalDateTime.now(); + DateTime parse = DateUtil.parse(localDateTime.format(formatter)); + auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//鏄熸湡 + auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//鍛ㄦ + auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); } } } -- Gitblit v1.9.3