From 2bbd50fb56275986e2a8658c373686d56804b99b Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期五, 29 八月 2025 14:14:52 +0800 Subject: [PATCH] yml配置 --- inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java | 329 +++++++++++++++++++++++++++++------------------------- 1 files changed, 174 insertions(+), 155 deletions(-) diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java index 186e0a1..ed3d251 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java @@ -10,21 +10,21 @@ import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; -import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; import com.ruoyi.basic.mapper.StandardProductListMapper; +import com.ruoyi.basic.mapper.StructureItemParameterMapper; import com.ruoyi.basic.pojo.IfsInventoryQuantity; import com.ruoyi.basic.pojo.StandardProductList; +import com.ruoyi.basic.pojo.StructureItemParameter; import com.ruoyi.basic.pojo.StructureTestObject; import com.ruoyi.common.constant.InsOrderTypeConstants; +import com.ruoyi.common.core.domain.Result; import com.ruoyi.common.core.domain.entity.User; import com.ruoyi.common.numgen.NumberGenerator; import com.ruoyi.common.utils.*; @@ -37,11 +37,6 @@ import com.ruoyi.inspect.service.InsProductService; import com.ruoyi.inspect.service.InsSampleService; import com.ruoyi.inspect.vo.InsOrderPrintingVo; -import com.ruoyi.inspect.vo.SampleDefectsFatherVo; -import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours; -import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary; -import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursTemporaryService; -import com.ruoyi.system.mapper.CustomMapper; import com.ruoyi.system.mapper.UserMapper; import lombok.AllArgsConstructor; import org.apache.commons.lang3.StringUtils; @@ -84,17 +79,15 @@ private final NumberGenerator<InsOrder> numberGenerator; private InsReportMapper insReportMapper; private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper; - private IfsApiUtils ifsApiUtils; private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper; private StandardProductListMapper standardProductListMapper; - private AuxiliaryOutputWorkingHoursTemporaryService auxiliaryOutputWorkingHoursTemporaryService; + private StructureItemParameterMapper structureItemParameterMapper; //鑾峰彇妫�楠屼笅鍗曟暟鎹� @Override public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) { - //todo: 鍙湅鎴戝垽鏂叏閮�,涓汉,缁勭粐鐨勬潈闄� String laboratory = null; // 鍒ゆ柇鏄惁鏄叏閮� String isOrderAll = null; @@ -160,43 +153,9 @@ spotCheckQuarterItemMapper.updateById(spotCheckQuarterItem); } - - // 鍒涘缓宸ユ椂鏆傚瓨 - // 缂撳瓨鏍峰搧id, 缂栧彿map - Map<Integer, String> sampleMap = insSamples.stream().collect(Collectors.toMap(InsSample::getId, InsSample::getSampleCode)); - List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() - .in(InsProduct::getInsSampleId, ids) - .eq(InsProduct::getState, 1)); - List<AuxiliaryOutputWorkingHoursTemporary> outputWorkingHours = insProductList.stream().map(insProduct -> { - AuxiliaryOutputWorkingHoursTemporary auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHoursTemporary(); - auxiliaryOutputWorkingHours.setInspectionItemClass(insProduct.getInspectionItemClass());//妫�娴嬮」鍒嗙被 - auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//妫�娴嬬埗椤� - auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//妫�娴嬪瓙椤� - auxiliaryOutputWorkingHours.setSample(sampleMap.get(insProduct.getInsSampleId()));//鏍峰搧缂栧彿 - auxiliaryOutputWorkingHours.setOrderId(order.getId());//璁㈠崟id - auxiliaryOutputWorkingHours.setOrderNo(order.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 - - return auxiliaryOutputWorkingHours; - }).collect(Collectors.toList()); - auxiliaryOutputWorkingHoursTemporaryService.saveBatch(outputWorkingHours); - return 1; } + public static String getWeek(String dayStr) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -232,6 +191,19 @@ default: return "鏈煡"; } + } + + + // 濡傛灉浣犱娇鐢� Java 8+锛屼篃鍙互鐢� Stream API 绠�鍖栦唬鐮侊細 + public List<StandardProductList> findMissingItemsWithStream(List<StandardProductList> standardList, + List<InsProduct> insList) { + Set<Integer> insIds = insList.stream() + .map(InsProduct::getStructureItemParameterId) + .collect(Collectors.toSet()); + + return standardList.stream() + .filter(product -> !insIds.contains(product.getStructureItemParameterId())) + .collect(Collectors.toList()); } @Override @@ -574,105 +546,7 @@ */ @Override public void getIfsOrder() { - HashMap<String, Object> map = new HashMap<>(); - map.put("LOCATION_NO","1302"); - map.put("STATE_DB","To be Inspected"); - List<Map<String, Object>> inventory = ifsApiUtils.getInventory(JSONUtil.toJsonStr(map)); - if(inventory.size() == 0) { - return; - } - // 杩涜淇濆瓨 - for (Map<String, Object> map1 : inventory) { - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // 鏃堕棿鏍煎紡鍖� - IfsInventoryQuantity ifsInventoryQuantity = new IfsInventoryQuantity(); - ifsInventoryQuantity.setContract(map1.get("CONTRACT") == null ? "" : map1.get("CONTRACT").toString()); // 鍩� - ifsInventoryQuantity.setPartNo(map1.get("PART_NO") == null ? "" : map1.get("PART_NO").toString() ); // 闆朵欢鍙� - ifsInventoryQuantity.setPartDesc(map1.get("PART_DESC") == null ? "" : map1.get("PART_DESC").toString()); // 闆朵欢鎻忚堪 - ifsInventoryQuantity.setOrderNo(map1.get("ORDER_NO") == null ? "" : map1.get("ORDER_NO").toString()); // 璁㈠崟鍙� - ifsInventoryQuantity.setLineNo(map1.get("LINE_NO") == null ? "" : map1.get("LINE_NO").toString()); // 琛屽彿 - ifsInventoryQuantity.setReleaseNo(map1.get("RELEASE_NO") == null ? "" : map1.get("RELEASE_NO").toString()); // 涓嬭揪鍙� - ifsInventoryQuantity.setReceiptNo(Integer.parseInt(map1.get("RECEIPT_NO") == null ? "" : map1.get("RECEIPT_NO").toString())); // 鎺ユ敹鍙� - ifsInventoryQuantity.setStatus(map1.get("STATE") == null ? "" : map1.get("STATE").toString()); // 鐘舵�佹弿杩� - ifsInventoryQuantity.setStatusDb(map1.get("STATE_DB") == null ? "" : map1.get("STATE_DB").toString()); // 鐘舵�� - if(map1.get("QTY_ARRIVED") != null) { - ifsInventoryQuantity.setQtyArrived(new BigDecimal(map1.get("QTY_ARRIVED").toString())); // 鎶佃揪鐨勯噰璐暟閲� - } - if(map1.get("QTY_INSPECTED") != null) { - ifsInventoryQuantity.setQtyInspected(new BigDecimal(map1.get("QTY_INSPECTED").toString())); // 宸叉楠岀殑璐拱鏁伴噺 - } - if(map1.get("QTY_TO_INSPECT") != null) { - ifsInventoryQuantity.setQtyToInspect(new BigDecimal(map1.get("QTY_TO_INSPECT").toString())); // 瑕佹楠岀殑閲囪喘鏁伴噺 - } - if(map1.get("INV_QTY_IN_STORE") != null) { - ifsInventoryQuantity.setInvQtyInStore(new BigDecimal(map1.get("INV_QTY_IN_STORE").toString())); // 鎶佃揪鐨勫簱瀛樻暟閲� - } - if(map1.get("PUR_QTY_IN_STORE") != null) { - ifsInventoryQuantity.setPurQtyInStore(new BigDecimal( map1.get("PUR_QTY_IN_STORE").toString())); // 鎶佃揪鐨勯噰璐暟閲� - - } - ifsInventoryQuantity.setSupplierId(map1.get("SUPPLIER_ID") == null ? "" : map1.get("SUPPLIER_ID").toString()); // 渚涘簲鍟咺D - ifsInventoryQuantity.setSupplierName(map1.get("SUPPLIER_NAME") == null ? "" : map1.get("SUPPLIER_NAME").toString()); // 渚涘簲鍟嗗悕绉� - ifsInventoryQuantity.setConfigurationId(map1.get("CONFIGURATION_ID") == null ? "" : map1.get("CONFIGURATION_ID").toString()); // 閰嶇疆鏍囪瘑 - ifsInventoryQuantity.setLotBatchNo(map1.get("LOT_BATCH_NO") == null ? "" : map1.get("LOT_BATCH_NO").toString()); // 鎵规鍙� - ifsInventoryQuantity.setUpdateBatchNo(map1.get("LOT_BATCH_NO") == null ? "" : map1.get("LOT_BATCH_NO").toString()); // 鎵规鍙� - ifsInventoryQuantity.setWaivDevRejNo(map1.get("WAIV_DEV_REJ_NO") == null ? "" : map1.get("WAIV_DEV_REJ_NO").toString()); // WDR鍙� - ifsInventoryQuantity.setActivitySeq(map1.get("ACTIVITY_SEQ") == null ? null : Integer.parseInt(map1.get("ACTIVITY_SEQ").toString())); // 娲诲姩搴忓垪 - ifsInventoryQuantity.setSerialNo(map1.get("SERIAL_NO") == null ? "" : map1.get("SERIAL_NO").toString()); // 搴忓垪鍙� - ifsInventoryQuantity.setLocationNo(map1.get("LOCATION_NO") == null ? "" : map1.get("LOCATION_NO").toString()); // 搴撲綅鍙� - ifsInventoryQuantity.setEngChgLevel(map1.get("ENG_CHG_LEVEL") == null ? "" : map1.get("ENG_CHG_LEVEL").toString()); // 鐗堟湰鍙� - ifsInventoryQuantity.setReceiver(map1.get("RECEIVER") == null ? "" : map1.get("RECEIVER").toString()); // 鎺ユ敹浜� - ifsInventoryQuantity.setReceiverName(map1.get("RECEIVER_NAME") == null ? "" : map1.get("RECEIVER_NAME").toString()); // 鎺ユ敹浜哄悕绉� - ifsInventoryQuantity.setBuyerCode(map1.get("BUYER_CODE") == null ? "" : map1.get("BUYER_CODE").toString()); // 閲囪喘鍛� - ifsInventoryQuantity.setBuyerName(map1.get("BUYER_NAME") == null ? "" : map1.get("BUYER_NAME").toString()); // 閲囪喘鍛樺悕绉� - - if(map1.get("ARRIVE_DATE") != null) { - ifsInventoryQuantity.setArriveDate(LocalDateTime.parse(map1.get("ARRIVE_DATE").toString(),dateTimeFormatter)); // 瀹為檯鍒拌揣鏃ユ湡 - } - if(map1.get("DELIVERY_DATE") != null) { - ifsInventoryQuantity.setDeliveryDate(LocalDateTime.parse(map1.get("DELIVERY_DATE").toString(),dateTimeFormatter)); // 瀹為檯浜よ揣鏃ユ湡 - } - if(map1.get("PRODUCT_DATE") != null) { - ifsInventoryQuantity.setProductDate(LocalDateTime.parse(map1.get("PRODUCT_DATE").toString(),dateTimeFormatter)); // 鐢熶骇鏃ユ湡 - - } - if(map1.get("INVALID_DATE") != null) { - ifsInventoryQuantity.setInvalidDate(LocalDateTime.parse(map1.get("INVALID_DATE").toString(),dateTimeFormatter)); // 澶辨晥鏃ユ湡 - } - if(map1.get("APPROVED_DATE") != null) { - ifsInventoryQuantity.setApprovedDate(LocalDateTime.parse(map1.get("APPROVED_DATE").toString(),dateTimeFormatter)); // 瀹℃壒鏃ユ湡 - } - ifsInventoryQuantity.setReqCeater(map1.get("REQ_CEATER") == null ? "" : map1.get("REQ_CEATER").toString()); // 閲囪喘鐢宠鍒涘缓浜� - ifsInventoryQuantity.setReqCeaterName(map1.get("REQ_CEATER_NAME") == null ? "" : map1.get("REQ_CEATER_NAME").toString()); // 閲囪喘鐢宠鍒涘缓浜哄悕绉� - ifsInventoryQuantity.setLineRemarks(map1.get("LINE_REMARKS") == null ? "" : map1.get("LINE_REMARKS").toString()); // 閲囪喘璁㈠崟琛屽娉� - ifsInventoryQuantity.setBuyUnitMeas(map1.get("BUY_UNIT_MEAS") == null ? "" : map1.get("BUY_UNIT_MEAS").toString()); // 閲囪喘鍗曚綅 - ifsInventoryQuantity.setReceiverDate(LocalDateTime.now()); // 鎺ユ敹鏃ユ湡 - ifsInventoryQuantity.setIsSource(1); - ifsInventoryQuantity.setState(0); - - IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>() - .eq(IfsInventoryQuantity::getOrderNo, ifsInventoryQuantity.getOrderNo()) - .eq(IfsInventoryQuantity::getLineNo, ifsInventoryQuantity.getLineNo()) - .eq(IfsInventoryQuantity::getReleaseNo, ifsInventoryQuantity.getReleaseNo()) - .eq(IfsInventoryQuantity::getReceiptNo, ifsInventoryQuantity.getReceiptNo()) - .eq(IfsInventoryQuantity::getLocationNo, ifsInventoryQuantity.getLocationNo()) - .eq(IfsInventoryQuantity::getLotBatchNo, ifsInventoryQuantity.getLotBatchNo()) - .eq(IfsInventoryQuantity::getSerialNo, ifsInventoryQuantity.getSerialNo()) - .eq(IfsInventoryQuantity::getEngChgLevel, ifsInventoryQuantity.getEngChgLevel()) - .eq(IfsInventoryQuantity::getWaivDevRejNo, ifsInventoryQuantity.getWaivDevRejNo()) - .eq(IfsInventoryQuantity::getActivitySeq, ifsInventoryQuantity.getActivitySeq()) - ); - if(Objects.isNull(one)) { - - ifsInventoryQuantity.setIsFirst(0); - // 鏌ヨ浜т笟閾炬娴嬫暟鎹� - String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(), - ifsInventoryQuantity.getLineNo(), - ifsInventoryQuantity.getReleaseNo()); - ifsInventoryQuantity.setIndustryChain(industryChainAttrFields); - - ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); - } - } + return; } /** @@ -902,6 +776,10 @@ // 淇敼妫�楠岄」 for (SampleProductDto sampleProductDto : insOrderUpdateDto.getSampleProduct()) { + insSampleService.update(Wrappers.<InsSample>lambdaUpdate() + .eq(InsSample::getId, sampleProductDto.getId()) + .set(InsSample::getSpecialStandardMethod, sampleProductDto.getSpecialStandardMethod())); + insProductService.updateBatchById(sampleProductDto.getInsProduct()); } @@ -937,7 +815,8 @@ // 鏌ヨ鏍囧噯鏍� List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() .eq(StandardProductList::getStandardMethodListId, insProduct.getStandardMethodListId()) - .eq(StandardProductList::getTree, tree)); + .eq(StandardProductList::getTree, tree) + .orderByAsc(StandardProductList::getSort)); for (StandardProductList standardProductList : standardProductLists) { standardProductList.setId(null); } @@ -962,6 +841,7 @@ product.setCreateUser(null); product.setUpdateTime(null); product.setUpdateUser(null); + product.setSection(null); product.setInsSampleId(omitOrderProductDto.getInsSampleId()); if (StringUtils.isBlank(product.getCableTag())) { product.setCableTag(null); @@ -986,16 +866,21 @@ */ @Override public void rawAllInsOrderExport(SampleOrderDto sampleOrderDto, HttpServletResponse response) { - //鍒ゆ柇鍏ㄩ儴,涓汉,缁勭粐鐨勬潈闄� - //todo:浠呯湅鎴戣幏鍙栧綋鍓嶄汉鎵�灞炲疄楠屽id - String laboratory = null; - // 鍒ゆ柇鏄惁鏄叏閮� - String isOrderAll = null; - if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) { - isOrderAll = "1"; - sampleOrderDto.setState(null); + List<SampleOrderDto> sampleOrderDtoList = new ArrayList<>(); + if (StringUtils.isNotBlank(sampleOrderDto.getIds())) { + List<String> orderIds = StrUtil.split(sampleOrderDto.getIds(), ","); + sampleOrderDtoList = insOrderMapper.getInsOrderExportByIds(orderIds); + } else { + String laboratory = null; + // 鍒ゆ柇鏄惁鏄叏閮� + String isOrderAll = null; + if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) { + isOrderAll = "1"; + sampleOrderDto.setState(null); + } + sampleOrderDto.setIds(null); + sampleOrderDtoList = insOrderMapper.rawAllInsOrderExport(QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll); } - List<SampleOrderDto> sampleOrderDtoList = insOrderMapper.rawAllInsOrderExport(QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll); // 鍒ゆ柇鏄惁鏄笉鍚堟牸, 涓嶅悎鏍兼煡璇笉鍚堟牸椤� for (SampleOrderDto orderDto : sampleOrderDtoList) { @@ -1028,6 +913,140 @@ } } + /** + * 淇敼鏍峰搧鍨嬪彿 + * @param insSample + */ + @Override + public void updateSampleModel(InsSample insSample) { + // 鍒ゆ柇褰撳墠璁㈠崟鏄惁鐢熸垚浜嗘姤鍛�, 鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀瑰崟鍙� + Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery() + .eq(InsReport::getInsOrderId, insSample.getInsOrderId())); + if (count > 0 ) { + throw new ErrorException("褰撳墠璁㈠崟宸茬粡鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀圭紪鍙�"); + } + + insSampleService.update(Wrappers.<InsSample>lambdaUpdate() + .eq(InsSample::getId, insSample.getId()) + .set(InsSample::getModel, insSample.getModel())); + } + + /** + * 鏌ヨ褰撳墠鏃堕棿鏄惁娌℃湁璇ユ娴嬮」鐨勬娊鏍疯鍒� + * @param sampleList + * @param insOrder + * @return + */ + @Override + public Result judgeNotSpotCheckOrder(List<SampleProductDto> sampleList, InsOrder insOrder) { + // todo: 涓嬪崟鍒ゆ柇鎶芥牱璁″垝鐨勫敮涓�鎬� + if (insOrder.getQuarterItemId() != null) { + Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() + .eq(InsOrder::getQuarterItemId, insOrder.getQuarterItemId()) + .notIn(InsOrder::getState, -1 ,2 ,3)); + if (quarterItemCount > 0) { + throw new ErrorException("璇ユ娊鏍疯鍒掑凡琚粦瀹氳繃"); + } + } + + // 鍒ゆ柇鏄惁鏄娊鏍锋娴� + if (insOrder.getOrderType().equals(InsOrderTypeConstants.SPOT_CHECK)) { + Set<String> monthMessageSet = new HashSet<>(); + Set<String> quarterMessageSet = new HashSet<>(); + Set<String> yearMessageSet = new HashSet<>(); + + String formatTime = "yyyy-MM-dd HH:mm:ss"; + // 鏌ヨ褰撳墠鎵�鏈夋牱鍝佺殑妫�楠岄」 + for (SampleProductDto sampleProductDto : sampleList) { + List<StandardProductList> standardProductList = getProductTreeBySampleId(sampleProductDto.getId()); + + Set<Integer> insIds = sampleProductDto.getInsProduct().stream() + .map(InsProduct::getStructureItemParameterId) + .collect(Collectors.toSet()); + + List<StandardProductList> productLists = standardProductList.stream() + .filter(product -> !insIds.contains(product.getStructureItemParameterId())) + .collect(Collectors.toList()); + + // 鏌ヨ妫�楠岄」鍩虹琛�, 鏌ヨ鏄惁鏈夋湀搴�, 瀛e害, 骞村害鐨勬楠岄」 + List<StructureItemParameter> itemParameterList = structureItemParameterMapper.selectList(Wrappers.<StructureItemParameter>lambdaQuery() + .in(StructureItemParameter::getId, productLists.stream().map(StandardProductList::getStructureItemParameterId).collect(Collectors.toList()))); + + for (StructureItemParameter item : itemParameterList) { + if (StringUtils.isNotBlank(item.getSpotCheckType())) { + switch (item.getSpotCheckType()) { + case "1": // 鏈堝害 + // 鏌ヨ褰撴湀鏄惁鏈夎妫�娴嬮」鐨勬娊鏍疯鍒� + // 褰撴湀寮�濮嬫椂闂� + DateTime monthStart = DateUtil.beginOfMonth(DateUtil.date()); + String monthStartTime = monthStart.toString(formatTime); + // 褰撴湀缁撴潫鏃堕棿 + DateTime monthEnd = DateUtil.endOfMonth(DateUtil.date()); + String monthEndTime = monthEnd.toString(formatTime); + Integer count = insOrderMapper.selectNotSpotCheckOrder(item.getId(), monthStartTime, monthEndTime); + if (count == 0) { + String monthMessage = item.getInspectionItemClass() + + item.getInspectionItem() + + item.getInspectionItemSubclass(); + monthMessageSet.add(monthMessage); + } + break; + case "2": // 瀛e害 + DateTime quarterStart = DateUtil.beginOfQuarter(DateUtil.date()); + String quarterStartTime = quarterStart.toString(formatTime); + // 褰撴湀缁撴潫鏃堕棿 + DateTime quarterEnd = DateUtil.endOfQuarter(DateUtil.date()); + String quarterEndTime = quarterEnd.toString(formatTime); + Integer quarterCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), quarterStartTime, quarterEndTime); + if (quarterCount == 0) { + String quarterMessage = item.getInspectionItemClass() + + item.getInspectionItem() + + item.getInspectionItemSubclass(); + quarterMessageSet.add(quarterMessage); + } + + break; + case "3": // 骞村害 + DateTime yearStart = DateUtil.beginOfQuarter(DateUtil.date()); + String yearStartTime = yearStart.toString(formatTime); + // 褰撴湀缁撴潫鏃堕棿 + DateTime yearEnd = DateUtil.endOfQuarter(DateUtil.date()); + String yearEndTime = yearEnd.toString(formatTime); + Integer yearCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), yearStartTime, yearEndTime); + if (yearCount == 0) { + String yearMessage = item.getInspectionItemClass() + + item.getInspectionItem() + + item.getInspectionItemSubclass(); + yearMessageSet.add(yearMessage); + } + + break; + } + } + } + } + + String message = ""; + if (CollectionUtils.isNotEmpty(monthMessageSet)) { + message += StrUtil.format("<p>妫�楠岄」<span style=\"color: red\">{}</span>褰撴湀杩樻湭杩涜鎶芥牱妫�娴�, 璇锋煡鐪嬫槸鍚﹂渶瑕佹坊鍔犲綋鍓嶆楠岄」</p>", CollUtil.join(monthMessageSet, ", ")); + } + + if (CollectionUtils.isNotEmpty(quarterMessageSet)) { + message += StrUtil.format("<p>妫�楠岄」<span style=\"color: red\">{}</span>褰撳墠瀛e害杩樻湭杩涜鎶芥牱妫�娴�, 璇风湅鏄惁闇�瑕佹坊鍔犲綋鍓嶆楠岄」</p>", CollUtil.join(quarterMessageSet, ", ")); + } + + if (CollectionUtils.isNotEmpty(yearMessageSet)) { + message += StrUtil.format("<p>妫�楠岄」<span style=\"color: red\">{}</span>浠婂勾杩樻湭杩涜鎶芥牱妫�娴�, 璇风湅鏄惁闇�瑕佹坊鍔犲綋鍓嶆楠岄」</p>", CollUtil.join(yearMessageSet, ", ")); + } + + if (StringUtils.isNotBlank(message)) { + return Result.success(false, message); + } + } + return Result.success(true); + + } + } -- Gitblit v1.9.3