From a265e62ac86c31a7e63ead82bf5f2300ebe5108f Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期日, 13 四月 2025 16:34:31 +0800 Subject: [PATCH] 不合格复测调整 --- inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 297 +++++++++++++++++++++++++---------------------------------- 1 files changed, 127 insertions(+), 170 deletions(-) diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java index f8d709c..de04143 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java @@ -72,6 +72,7 @@ import java.math.RoundingMode; import java.nio.file.Files; import java.nio.file.Paths; +import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; @@ -115,8 +116,6 @@ private InsProductUserMapper insProductUserMapper; @Resource private AuxiliaryOutputWorkingHoursService auxiliaryOutputWorkingHoursService; - @Resource - private AuxiliaryOutputWorkingHoursTemporaryService auxiliaryOutputWorkingHoursTemporaryService; @Resource private AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper; @Resource @@ -259,16 +258,13 @@ List<InsProduct> insProducts = new ArrayList<>(); switch (dto.getType()) { case 0: - insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), null); - //鏍峰搧 - break; case 4: - //鐢电紗閰嶇疆 - insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), null); + //濮旀墭 + insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag()); break; case 5: //鍘熸潗鏂欎笅鍗� - insProducts = insSampleMapper.getInsProduct6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag(), null); + insProducts = insSampleMapper.getInsProduct6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag()); break; } if (BeanUtil.isEmpty(insProducts)) { @@ -527,55 +523,60 @@ // 娣诲姞璁惧璁板綍 threadPoolTaskExecutor.execute(() -> { - InsOrder order = insOrderMapper.selectById(insSample.getInsOrderId()); - User user = userMapper.selectById(userId); - // 鏌ヨ璁惧浣跨敤璁板綍鏌ヨ璇ヨ鍗曠殑浣跨敤璁板綍 - List<InsOrderDeviceRecordDto> deviceRecordDtoList = insOrderDeviceRecordMapper.selectDeviceNumber(insSample.getInsOrderId()); - Set<String> recordCodeset = deviceRecordDtoList.stream().map(InsOrderDeviceRecordDto::getManagementNumber).collect(Collectors.toSet()); + // 娣诲姞璁惧浣跨敤璁板綍 + addDeviceRecord(insSample, userId); + }); + } - // 鑾峰彇璁㈠崟璁惧缂栧彿 - List<InsProductResult> resultList = insProductResultMapper.selectResultByOrderId(insSample.getInsOrderId()); - Set<String> deviceCodeSet = new HashSet<>(); - for (InsProductResult result : resultList) { - // 娣诲姞璁惧缂栧彿 - List<JSONObject> jsonObjects = JSON.parseArray(result.getEquipValue(), JSONObject.class); - for (JSONObject jsonObject : jsonObjects) { - if (!"".equals(jsonObject.get("v") + "")) { - List<String> v = StrUtil.split(jsonObject.get("v") + "", "锛�"); - deviceCodeSet.addAll(v); - } + private synchronized void addDeviceRecord(InsSample insSample, Integer userId) { + InsOrder order = insOrderMapper.selectById(insSample.getInsOrderId()); + User user = userMapper.selectById(userId); + // 鏌ヨ璁惧浣跨敤璁板綍鏌ヨ璇ヨ鍗曠殑浣跨敤璁板綍 + List<InsOrderDeviceRecordDto> deviceRecordDtoList = insOrderDeviceRecordMapper.selectDeviceNumber(insSample.getInsOrderId()); + Set<String> recordCodeset = deviceRecordDtoList.stream().map(InsOrderDeviceRecordDto::getManagementNumber).collect(Collectors.toSet()); + + // 鑾峰彇璁㈠崟璁惧缂栧彿 + List<InsProductResult> resultList = insProductResultMapper.selectResultByOrderId(insSample.getInsOrderId()); + Set<String> deviceCodeSet = new HashSet<>(); + for (InsProductResult result : resultList) { + // 娣诲姞璁惧缂栧彿 + List<JSONObject> jsonObjects = JSON.parseArray(result.getEquipValue(), JSONObject.class); + for (JSONObject jsonObject : jsonObjects) { + if (!"".equals(jsonObject.get("v") + "")) { + List<String> v = StrUtil.split(jsonObject.get("v") + "", "锛�"); + deviceCodeSet.addAll(v); } } - // 1.鍒ゆ柇鏄惁鏈夋病鏈夋坊鍔犵殑浣跨敤璁板綍 - Set<String> orderDeviceNumbers = getDeviceDifference(deviceCodeSet, recordCodeset); - // 娣诲姞浣跨敤璁板綍, 鏍规嵁缂栧彿鏌ヨ璁惧id - if (CollectionUtils.isNotEmpty(orderDeviceNumbers)) { - List<Integer> orderDeviceIds = insOrderDeviceRecordMapper.selectDeviceIdsByNumbers(orderDeviceNumbers); - List<InsOrderDeviceRecord> collect = orderDeviceIds.stream().map(deviceId -> { - InsOrderDeviceRecord insOrderDeviceRecord = new InsOrderDeviceRecord(); - insOrderDeviceRecord.setInsOrderId(insSample.getInsOrderId()); - insOrderDeviceRecord.setDeviceId(deviceId); - insOrderDeviceRecord.setSampleCode(order.getEntrustCode()); - insOrderDeviceRecord.setUseBefore(1); - insOrderDeviceRecord.setUseAfter(1); - insOrderDeviceRecord.setUsePerson(user.getName()); - insOrderDeviceRecord.setUsePersonId(user.getId()); - return insOrderDeviceRecord; - }).collect(Collectors.toList()); + } + // 1.鍒ゆ柇鏄惁鏈夋病鏈夋坊鍔犵殑浣跨敤璁板綍 + Set<String> orderDeviceNumbers = getDeviceDifference(deviceCodeSet, recordCodeset); + // 娣诲姞浣跨敤璁板綍, 鏍规嵁缂栧彿鏌ヨ璁惧id + if (CollectionUtils.isNotEmpty(orderDeviceNumbers)) { + List<Integer> orderDeviceIds = insOrderDeviceRecordMapper.selectDeviceIdsByNumbers(orderDeviceNumbers); + List<InsOrderDeviceRecord> collect = orderDeviceIds.stream().map(deviceId -> { + InsOrderDeviceRecord insOrderDeviceRecord = new InsOrderDeviceRecord(); + insOrderDeviceRecord.setInsOrderId(insSample.getInsOrderId()); + insOrderDeviceRecord.setDeviceId(deviceId); + insOrderDeviceRecord.setSampleCode(order.getEntrustCode()); + insOrderDeviceRecord.setUseBefore(1); + insOrderDeviceRecord.setUseAfter(1); + insOrderDeviceRecord.setUsePerson(user.getName()); + insOrderDeviceRecord.setUsePersonId(user.getId()); + return insOrderDeviceRecord; + }).collect(Collectors.toList()); - insOrderDeviceRecordService.saveBatch(collect); + insOrderDeviceRecordService.saveBatch(collect); - } + } - // 2.鍒ゆ柇鏄惁鍙栨秷浜嗚澶囦娇鐢� - Set<String> repoprNumbers = getDeviceDifference(recordCodeset, deviceCodeSet); - if (CollectionUtils.isNotEmpty(repoprNumbers)) { - List<Integer> reportDeviceIds = insOrderDeviceRecordMapper.selectDeviceIdsByNumbers(repoprNumbers); - insOrderDeviceRecordMapper.delete(Wrappers.<InsOrderDeviceRecord>lambdaQuery() - .in(InsOrderDeviceRecord::getDeviceId, reportDeviceIds) - .eq(InsOrderDeviceRecord::getInsOrderId, insSample.getInsOrderId())); - } - }); + // 2.鍒ゆ柇鏄惁鍙栨秷浜嗚澶囦娇鐢� + Set<String> repoprNumbers = getDeviceDifference(recordCodeset, deviceCodeSet); + if (CollectionUtils.isNotEmpty(repoprNumbers)) { + List<Integer> reportDeviceIds = insOrderDeviceRecordMapper.selectDeviceIdsByNumbers(repoprNumbers); + insOrderDeviceRecordMapper.delete(Wrappers.<InsOrderDeviceRecord>lambdaQuery() + .in(InsOrderDeviceRecord::getDeviceId, reportDeviceIds) + .eq(InsOrderDeviceRecord::getInsOrderId, insSample.getInsOrderId())); + } } private static Set<String> getDeviceDifference(Set<String> number1, Set<String> number2) { @@ -674,7 +675,7 @@ } /** - * todo: 娓呴櫎娌℃湁浣跨敤鐨勬楠岄」 + * todo: 鍘熷璁板綍妯℃澘娓呴櫎娌℃湁浣跨敤鐨勬楠岄」(鏆傛椂鏈塨ug鏃犳硶浣跨敤) * @param sheet * @param itemNameList */ @@ -949,7 +950,7 @@ // 鏌ヨifs淇℃伅鑾峰彇鑾峰彇鍓�10涓緵搴斿晢涓�鏍风殑, 妫�楠岄」涓�鏍蜂俊鎭� threadPoolTaskExecutor.execute(() -> { // 娣诲姞鍒嗘瀽鏁版嵁 - addAnalysis(productList, ifsInventoryQuantity, order); + addAnalysis(productList, ifsInventoryQuantity, order, userName); }); @@ -977,13 +978,13 @@ * @param ifsInventoryQuantity * @param order */ - private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order) { + private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String userName) { for (InsProduct insProduct : productList) { - // todo: 鏆傛椂鍒ゆ柇鏄惁鏄�佸寲 - if (insProduct.getInspectionItem().contains("鑰佸寲")) { + // 鍒ゆ柇鏄惁鏄暟鍊肩被鍨� + if (insProduct.getInspectionValueType().equals("1") && insProduct.getInsResult().equals(1)) { List<InsProductDeviationWarningDetail> insProductAnalysisDtoList = insProductMapper.selectAnalysis(insProduct, ifsInventoryQuantity.getSupplierName()); - if (insProductAnalysisDtoList.size() < 10) { + if (insProductAnalysisDtoList.size() < 5) { continue; } @@ -1020,6 +1021,7 @@ deviationWarningDetail.setSampleCode(insProduct.getSampleCode()); deviationWarningDetail.setSupplierName(ifsInventoryQuantity.getSupplierName()); deviationWarningDetail.setTestValue(insProduct.getLastValue()); + deviationWarningDetail.setDetectionTime(insProduct.getCreateTime()); deviationWarningDetail.setIsIssue(1); insProductAnalysisDtoList.add(deviationWarningDetail); @@ -1031,22 +1033,26 @@ insProductDeviationWarningDetailService.saveBatch(insProductAnalysisDtoList); + //鍙戦�佷紒涓氬井淇℃秷鎭�氱煡 妫�楠岄」棰勮棰勮閫氱煡 + try { + String message = ""; + message += "妫�楠岄」棰勮棰勮閫氱煡"; + message += "\n濮旀墭缂栧彿: " + order.getEntrustCode(); + message += "\n鏍峰搧鍚嶇О: " + order.getSample(); + message += "\n瑙勬牸鍨嬪彿: " + order.getPartDetail(); + message += "\n鎵规鍙�: " + ifsInventoryQuantity.getUpdateBatchNo(); + message += "\n渚涘簲鍟嗗悕绉�: " + ifsInventoryQuantity.getSupplierName(); + message += "\n妫�楠岄」: " + insProduct.getInspectionItem() + insProduct.getInspectionItemSubclass(); + message += "\n鍋忓樊瓒呰繃浜� 10%"; + // 鍙戦�佺粰鎻愪氦浜� + WxCpUtils.inform(userName, message, null); -// String message = ""; -// message += "妫�楠屼换鍔″鏍搁�氱煡"; -// message += "\n鎻愪氦浜�: " + userName; -// message += "\n濮旀墭缂栧彿: " + order.getEntrustCode(); -// message += "\n鏍峰搧鍚嶇О: " + insSample.getModel(); -// message += "\n瑙勬牸鍨嬪彿: " + order.getPartDetail(); -// if (ifsInventoryQuantity != null) { -// message += "\n鎵规鍙�: " + ifsInventoryQuantity.getUpdateBatchNo(); -// } -// //鍙戦�佷紒涓氬井淇℃秷鎭�氱煡 鎻愪氦澶嶆牳 -// try { -// WxCpUtils.inform(sendUserAccount, message, null); -// } catch (Exception e) { -// throw new RuntimeException(e); -// } + // todo: 鍙戦�佺粰妫�娴嬩腑蹇冧富浠�(鍥哄畾姝�) + WxCpUtils.inform("ZT-004704", message, null); + } catch (Exception e) { + e.printStackTrace(); + log.error("鍋忓樊棰勮浼佷笟寰俊閫氱煡鎶ラ敊"); + } } } } @@ -1072,7 +1078,10 @@ double target = Double.parseDouble(targetStr); double deviationPercent = Math.abs(target - average) / average * 100; - return deviationPercent; + // 淇濈暀涓や綅灏忔暟 + DecimalFormat df = new DecimalFormat("#.00"); + String formatted = df.format(deviationPercent); + return Double.parseDouble(formatted); } /** @@ -1310,36 +1319,14 @@ } /** - * 鑾峰彇涓嶅悎鏍兼暟鎹� - * @return - */ - @Override - public List<InsProduct> getInsProductUnqualified(InsOrderPlanProductDto dto) { - List<InsProduct> insProducts = new ArrayList<>(); - switch (dto.getType()) { - case 0: - //鏍峰搧 - insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), "1"); - break; - case 4: - //鐢电紗閰嶇疆 - insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), "1"); - break; - case 5: - //鍘熸潗鏂欎笅鍗� - insProducts = insSampleMapper.getInsProduct6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag(), "1"); - break; - } - return insProducts; - } - - /** * 鏂板涓嶅悎鏍煎娴嬪唴瀹� * @param ids * @return */ @Override - public boolean addDisqualificationRetest(List<Integer> ids) { + public boolean addDisqualificationRetest(List<InsProduct> insProductsList) { + List<Integer> ids = insProductsList.stream().map(InsProduct::getId).collect(Collectors.toList()); + // 鍒ゆ柇涔嬪墠鏄惁娣诲姞杩� Long count = insUnqualifiedRetestProductMapper.selectCount(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery() .in(InsUnqualifiedRetestProduct::getInsProductId, ids)); @@ -1360,38 +1347,29 @@ } @Override - public List<InsProduct> getInsProductUnqualifiedRetest(Integer id, Integer type, String laboratory, String cableTag, String rawMaterialTag, String retestTag) { + public List<InsProduct> getInsProductUnqualifiedRetest(InsOrderPlanProductDto dto) { List<InsProduct> insProducts = new ArrayList<>(); - switch (type) { + switch (dto.getType()) { case 0: - //鏍峰搧 - insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest1(id, laboratory, retestTag); - break; case 4: - //鐢电紗閰嶇疆 - insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest5(id, laboratory, cableTag, retestTag); + //濮旀墭 + insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), dto.getRetestTag()); break; case 5: //鍘熸潗鏂欎笅鍗� - insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest6(id, laboratory, rawMaterialTag, retestTag); + insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag(), dto.getRetestTag()); break; } if (BeanUtil.isEmpty(insProducts)) { return null; } - InsOrder order = insOrderMapper.selectFirstSubmit(id); + InsOrder order = insOrderMapper.selectFirstSubmit(dto.getId()); getTemplateThing(order, Collections.unmodifiableList(insProducts)); return insProducts; } - /** - * 淇濆瓨涓嶅悎鏍煎娴嬫楠屽唴瀹� - * @param currentTable - * @param orderId - * @param sonLaboratory - */ @Override @Transactional(rollbackFor = Exception.class) public void saveUnqualifiedContext(Map<String, Object> insContext, Integer currentTable, Integer currentSampleId, Integer orderId, String sonLaboratory) { @@ -1409,13 +1387,12 @@ BeanUtil.copyProperties(oldResults.get(0), newResult); } newResult.setRetestProductId(Integer.parseInt(k)); - + /*鏍¢獙涓�涓媟esult琛�*/ if (oldResults.size() > 1) { for (int i = 1; i < oldResults.size(); i++) { insUnqualifiedRetestResultMapper.deleteById(oldResults.get(i)); } } - //妫�楠屽�� if (jo.get("insValue") != null) { JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue"))); @@ -1446,6 +1423,8 @@ for (Object o : jsonArray2) { JSONObject comValue = JSON.parseObject(JSON.toJSONString(o)); Map<String, Object> map = new HashMap<>(); + map.put("r", JSON.toJSONString(comValue.get("r"))); + map.put("c", JSON.toJSONString(comValue.get("c"))); map.put("v", JSON.parseObject(JSON.toJSONString(comValue.get("v"))).get("v")); cv.add(map); } @@ -1508,41 +1487,18 @@ insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId())); - InsSample insSample = insSampleMapper.selectById(insProductMapper.selectById(insProduct.getId()).getInsSampleId()); - insSample.setInsState(1); - Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() - .eq(InsProduct::getInsSampleId, insSample.getId())); - Long l1 = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() - .eq(InsProduct::getInsSampleId, insSample.getId()) - .and(wrapper -> wrapper - .isNotNull(InsProduct::getInsResult) - .or() - .ne(InsProduct::getInsResult, 2) - )); - if (Objects.equals(l, l1)) { - insSample.setInsState(2); - } - insSampleMapper.updateById(insSample); /*鏍¢獙涓�涓媟esult琛�*/ List<InsUnqualifiedRetestResult> insProductResults = insUnqualifiedRetestResultMapper.selectList(Wrappers.<InsUnqualifiedRetestResult>lambdaQuery() - .eq(InsUnqualifiedRetestResult::getRetestProductId, insProduct.getId())); + .eq(InsUnqualifiedRetestResult::getRetestProductId, product.getId())); if (insProductResults.size() > 1) { for (int i = 1; i < insProductResults.size(); i++) { insUnqualifiedRetestResultMapper.deleteById(insProductResults.get(i)); } } + } }); - String sampleIdStr = insContext.keySet().stream().findFirst().orElse(null); - if (sampleIdStr != null) { - int count = insProductMapper.selectInsProductCountByOrderId(orderId); - if (count == 0) { - insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate() - .eq(InsOrderState::getInsOrderId, orderId) - .eq(InsOrderState::getLaboratory, sonLaboratory) - .set(InsOrderState::getInsState, 2)); - } - } + } /** @@ -4440,42 +4396,43 @@ return; } - //棣栧厛鍒ゆ柇褰撳墠浜虹殑褰撳墠鏃堕棿鏄惁鏄帓鐝椂闂村唴,濡傛灉涓嶆槸灏辨槸鍔犵彮 - LocalDateTime today = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT); - //鏍¢獙濡傛灉杩欎釜浜鸿繖涓娴嬮」鐩凡缁忔坊鍔犺繃浜� List<AuxiliaryOutputWorkingHours> count2s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() .eq(AuxiliaryOutputWorkingHours::getCheck, userId) .eq(AuxiliaryOutputWorkingHours::getInsProductId, insProduct.getId())); if (CollectionUtils.isNotEmpty(count2s)) { - auxiliaryOutputWorkingHoursMapper.deleteBatchIds(count2s.stream().map(auxiliaryOutputWorkingHours -> auxiliaryOutputWorkingHours.getId()).collect(Collectors.toList())); - } - if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && StringUtils.isNotBlank(insProduct.getLastValue())) { - AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours(); - auxiliaryOutputWorkingHours.setInspectionItemClass(insProduct.getInspectionItemClass());//妫�娴嬮」鍒嗙被 - auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//妫�娴嬬埗椤� - auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//妫�娴嬪瓙椤� - auxiliaryOutputWorkingHours.setSample(insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode());//鏍峰搧缂栧彿 - auxiliaryOutputWorkingHours.setOrderId(insOrder.getId());//璁㈠崟id - auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//闈炲姞鐝鎵樺崟鍙� - auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//闈炲姞鐝伐鏃� - auxiliaryOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲� - auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : BigDecimal.ZERO).add(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : BigDecimal.ZERO));//浜ч噺宸ユ椂 - 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))));//鍛ㄦ - auxiliaryOutputWorkingHours.setCheck(userId);//妫�娴嬩汉 - auxiliaryOutputWorkingHours.setPrice(insProduct.getPrice());//鍗曚环 - auxiliaryOutputWorkingHours.setSampleId(insProduct.getInsSampleId());//鏍峰搧id - auxiliaryOutputWorkingHours.setInsProductId(insProduct.getId());//妫�楠岄」id + for (AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours : count2s) { + auxiliaryOutputWorkingHours.setCheck(userId);//妫�娴嬩汉 + } + auxiliaryOutputWorkingHoursService.updateBatchById(count2s); + } else { + if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && StringUtils.isNotBlank(insProduct.getLastValue())) { + AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours(); + auxiliaryOutputWorkingHours.setInspectionItemClass(insProduct.getInspectionItemClass());//妫�娴嬮」鍒嗙被 + auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//妫�娴嬬埗椤� + auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//妫�娴嬪瓙椤� + auxiliaryOutputWorkingHours.setSample(insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode());//鏍峰搧缂栧彿 + auxiliaryOutputWorkingHours.setOrderId(insOrder.getId());//璁㈠崟id + auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//闈炲姞鐝鎵樺崟鍙� + auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//闈炲姞鐝伐鏃� + auxiliaryOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲� + auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : BigDecimal.ZERO).add(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : BigDecimal.ZERO));//浜ч噺宸ユ椂 + 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))));//鍛ㄦ + auxiliaryOutputWorkingHours.setCheck(userId);//妫�娴嬩汉 + auxiliaryOutputWorkingHours.setPrice(insProduct.getPrice());//鍗曚环 + auxiliaryOutputWorkingHours.setSampleId(insProduct.getInsSampleId());//鏍峰搧id + auxiliaryOutputWorkingHours.setInsProductId(insProduct.getId());//妫�楠岄」id - auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); + auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); + } } } -- Gitblit v1.9.3