diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java index aa34033..015c7a7 100644 --- a/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java @@ -25,7 +25,7 @@ /** * 编号 */ - private String equipmentNo; + private String manufactureNo; /** * 数量 diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java index aa34033..015c7a7 100644 --- a/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java @@ -25,7 +25,7 @@ /** * 编号 */ - private String equipmentNo; + private String manufactureNo; /** * 数量 diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java index 032f80e..9de055e 100644 --- a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java @@ -506,36 +506,17 @@ @Override public void exportFile(List standardInfos, Boolean pdf, HttpServletResponse response) throws Exception { AtomicInteger seqCounter = new AtomicInteger(1); - List infoList = new ArrayList<>(); List value = standardInfos.stream().sorted( Comparator.comparing(BizEquipmentStandardInfo::getId) .thenComparing(BizEquipmentStandardInfo::getMajorType)).collect(Collectors.toList()); - int seq = 0; - long prevId = -1; - for (BizEquipmentStandardInfo standardInfo : value) { - long currentId = standardInfo.getId(); - if (prevId != currentId) { - seq = seqCounter.getAndIncrement(); - } - standardInfo.setSeq(seq); - DictCodeUtils.convertDictCodeToName(standardInfo); - QueryWrapper itemQueryWrapper = new QueryWrapper<>(); - itemQueryWrapper.eq("standard_id", standardInfo.getId()); - List itemList = carryoutItemMapper.selectList(itemQueryWrapper); - if (!CollectionUtils.isEmpty(itemList)) { - String itemName = itemList.stream().map(BizEquipmentStandardCarryoutItem::getItemName).collect(Collectors.joining("、")); - standardInfo.setItemName(itemName); - } - infoList.add(standardInfo); - prevId = currentId; - } + StandardEquipmentSupport support = new StandardEquipmentSupport(); - Map> labMap = infoList.stream().filter(l -> Objects.nonNull(l.getLabCode())).collect(Collectors.groupingBy(BizEquipmentStandardInfo::getLabCode)); + Map> labMap = value.stream().filter(l -> Objects.nonNull(l.getLabCode())).collect(Collectors.groupingBy(BizEquipmentStandardInfo::getLabCode)); List xcLab = null; List hkLab = null; //需要保证文件合并时顺序性,如下 //1.西昌技术能力范围表 -> 2.海口技术能力范围表 -> 3.测量标准装置及其配套设备一览表(西昌) -> 4.测量标准装置及其配套设备一览表(海口) - ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, infoList.size(), 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(100)); + ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, value.size(), 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(100)); String rootFileName = "标准装置台账" + new SimpleDateFormat("yyyyMMddHHmm").format(new Date()); List fileList = new ArrayList<>(); List> futures = new ArrayList<>(); @@ -543,7 +524,28 @@ //有西昌实验室的数据,需要找到西昌实验室的技术能力范围表 Map map = new HashMap<>(); xcLab = labMap.get("X"); - map.put("xcLab", xcLab); + List infoList = new ArrayList<>(); + int seq = 0; + long prevId = -1; + for (BizEquipmentStandardInfo standardInfo : xcLab) { + long currentId = standardInfo.getId(); + if (prevId != currentId) { + seq = seqCounter.getAndIncrement(); + } + standardInfo.setSeq(seq); + DictCodeUtils.convertDictCodeToName(standardInfo); + QueryWrapper itemQueryWrapper = new QueryWrapper<>(); + itemQueryWrapper.eq("standard_id", standardInfo.getId()); + List itemList = carryoutItemMapper.selectList(itemQueryWrapper); + if (!CollectionUtils.isEmpty(itemList)) { + String itemName = itemList.stream().map(BizEquipmentStandardCarryoutItem::getItemName) + .filter(StringUtils::isNotBlank).collect(Collectors.joining("、")); + standardInfo.setItemName(itemName); + } + infoList.add(standardInfo); + prevId = currentId; + } + map.put("xcLab", infoList); support.replaceSlash(map); //添加打印任务 //自定义文件名称,并添加到临时集合中,所有线程并发执行完后进行合并 @@ -566,7 +568,28 @@ //有海口实验室的数据,需要找到海口实验室的技术能力范围表 Map map = new HashMap<>(); hkLab = labMap.get("H"); - map.put("hkLab", hkLab); + List infoList = new ArrayList<>(); + int seq = 0; + long prevId = -1; + for (BizEquipmentStandardInfo standardInfo : hkLab) { + long currentId = standardInfo.getId(); + if (prevId != currentId) { + seq = seqCounter.getAndIncrement(); + } + standardInfo.setSeq(seq); + DictCodeUtils.convertDictCodeToName(standardInfo); + QueryWrapper itemQueryWrapper = new QueryWrapper<>(); + itemQueryWrapper.eq("standard_id", standardInfo.getId()); + List itemList = carryoutItemMapper.selectList(itemQueryWrapper); + if (!CollectionUtils.isEmpty(itemList)) { + String itemName = itemList.stream().map(BizEquipmentStandardCarryoutItem::getItemName) + .filter(StringUtils::isNotBlank).collect(Collectors.joining("、")); + standardInfo.setItemName(itemName); + } + infoList.add(standardInfo); + prevId = currentId; + } + map.put("hkLab", infoList); support.replaceSlash(map); //添加打印任务 String fileName = TECHNICAL_CAPABILITIES_HAIKOU + ".docx"; @@ -590,6 +613,7 @@ for (Map.Entry> entry : entrySet) { List standardInfoList = entry.getValue(); List equipmentInfos = null; + String technologyFile = null; for (BizEquipmentStandardInfo standardInfo : standardInfoList) { //测量标准装置及其配套设备一览表(西昌实验室) standardInfo.setCreateTime(DateUtil.format(DateUtil.parse(standardInfo.getCreateTime()), "yyyy.MM.dd")); @@ -599,15 +623,15 @@ queryWrapper.eq(BizEquipmentStandardTechnologyRelation::getStandardNo, standardInfo.getStandardNo()); List technologyRelations = technologyRelationMapper.selectList(queryWrapper); String technology = technologyRelations.stream().map(BizEquipmentStandardTechnologyRelation::getFileAttachment).collect(Collectors.joining("\t\n")); - String noSuffixTechnology = this.subFileSuffix(technology); + technologyFile = this.subFileSuffix(technology); for (BizEquipmentInfo equipmentInfo : equipmentInfos) { equipmentInfo.setModel(equipmentInfo.getManufacturer() + "/" + equipmentInfo.getModel()); - equipmentInfo.setTechnicalFile(noSuffixTechnology); } } Map map = new HashMap<>(); map.put("list", standardInfoList); map.put("equipmentList", equipmentInfos); + map.put("technologyFile",technologyFile); support.replaceSlash(map); //添加打印任务 String snowflake = String.valueOf(snowflakeUtil.nextId()); @@ -634,6 +658,7 @@ for (Map.Entry> entry : entrySet) { List standardInfoList = entry.getValue(); List equipmentInfos = null; + String technologyFile = null; for (BizEquipmentStandardInfo standardInfo : standardInfoList) { //测量标准装置及其配套设备一览表(海口实验室) standardInfo.setCreateTime(DateUtil.format(DateUtil.parse(standardInfo.getCreateTime()), "yyyy.MM.dd")); @@ -643,14 +668,15 @@ queryWrapper.eq(BizEquipmentStandardTechnologyRelation::getStandardNo, standardInfo.getStandardNo()); List technologyRelations = technologyRelationMapper.selectList(queryWrapper); String technology = technologyRelations.stream().map(BizEquipmentStandardTechnologyRelation::getFileAttachment).collect(Collectors.joining("、")); - String noSuffixTechnology = this.subFileSuffix(technology); + technologyFile = this.subFileSuffix(technology); for (BizEquipmentInfo equipmentInfo : equipmentInfos) { - equipmentInfo.setTechnicalFile(noSuffixTechnology); + equipmentInfo.setModel(equipmentInfo.getManufacturer() + "/" + equipmentInfo.getModel()); } } Map map = new HashMap<>(); map.put("list", standardInfoList); map.put("equipmentList", equipmentInfos); + map.put("technologyFile",technologyFile); support.replaceSlash(map); //添加打印任务 String snowflake = String.valueOf(snowflakeUtil.nextId()); diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java index aa34033..015c7a7 100644 --- a/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java @@ -25,7 +25,7 @@ /** * 编号 */ - private String equipmentNo; + private String manufactureNo; /** * 数量 diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java index 032f80e..9de055e 100644 --- a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java @@ -506,36 +506,17 @@ @Override public void exportFile(List standardInfos, Boolean pdf, HttpServletResponse response) throws Exception { AtomicInteger seqCounter = new AtomicInteger(1); - List infoList = new ArrayList<>(); List value = standardInfos.stream().sorted( Comparator.comparing(BizEquipmentStandardInfo::getId) .thenComparing(BizEquipmentStandardInfo::getMajorType)).collect(Collectors.toList()); - int seq = 0; - long prevId = -1; - for (BizEquipmentStandardInfo standardInfo : value) { - long currentId = standardInfo.getId(); - if (prevId != currentId) { - seq = seqCounter.getAndIncrement(); - } - standardInfo.setSeq(seq); - DictCodeUtils.convertDictCodeToName(standardInfo); - QueryWrapper itemQueryWrapper = new QueryWrapper<>(); - itemQueryWrapper.eq("standard_id", standardInfo.getId()); - List itemList = carryoutItemMapper.selectList(itemQueryWrapper); - if (!CollectionUtils.isEmpty(itemList)) { - String itemName = itemList.stream().map(BizEquipmentStandardCarryoutItem::getItemName).collect(Collectors.joining("、")); - standardInfo.setItemName(itemName); - } - infoList.add(standardInfo); - prevId = currentId; - } + StandardEquipmentSupport support = new StandardEquipmentSupport(); - Map> labMap = infoList.stream().filter(l -> Objects.nonNull(l.getLabCode())).collect(Collectors.groupingBy(BizEquipmentStandardInfo::getLabCode)); + Map> labMap = value.stream().filter(l -> Objects.nonNull(l.getLabCode())).collect(Collectors.groupingBy(BizEquipmentStandardInfo::getLabCode)); List xcLab = null; List hkLab = null; //需要保证文件合并时顺序性,如下 //1.西昌技术能力范围表 -> 2.海口技术能力范围表 -> 3.测量标准装置及其配套设备一览表(西昌) -> 4.测量标准装置及其配套设备一览表(海口) - ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, infoList.size(), 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(100)); + ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, value.size(), 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(100)); String rootFileName = "标准装置台账" + new SimpleDateFormat("yyyyMMddHHmm").format(new Date()); List fileList = new ArrayList<>(); List> futures = new ArrayList<>(); @@ -543,7 +524,28 @@ //有西昌实验室的数据,需要找到西昌实验室的技术能力范围表 Map map = new HashMap<>(); xcLab = labMap.get("X"); - map.put("xcLab", xcLab); + List infoList = new ArrayList<>(); + int seq = 0; + long prevId = -1; + for (BizEquipmentStandardInfo standardInfo : xcLab) { + long currentId = standardInfo.getId(); + if (prevId != currentId) { + seq = seqCounter.getAndIncrement(); + } + standardInfo.setSeq(seq); + DictCodeUtils.convertDictCodeToName(standardInfo); + QueryWrapper itemQueryWrapper = new QueryWrapper<>(); + itemQueryWrapper.eq("standard_id", standardInfo.getId()); + List itemList = carryoutItemMapper.selectList(itemQueryWrapper); + if (!CollectionUtils.isEmpty(itemList)) { + String itemName = itemList.stream().map(BizEquipmentStandardCarryoutItem::getItemName) + .filter(StringUtils::isNotBlank).collect(Collectors.joining("、")); + standardInfo.setItemName(itemName); + } + infoList.add(standardInfo); + prevId = currentId; + } + map.put("xcLab", infoList); support.replaceSlash(map); //添加打印任务 //自定义文件名称,并添加到临时集合中,所有线程并发执行完后进行合并 @@ -566,7 +568,28 @@ //有海口实验室的数据,需要找到海口实验室的技术能力范围表 Map map = new HashMap<>(); hkLab = labMap.get("H"); - map.put("hkLab", hkLab); + List infoList = new ArrayList<>(); + int seq = 0; + long prevId = -1; + for (BizEquipmentStandardInfo standardInfo : hkLab) { + long currentId = standardInfo.getId(); + if (prevId != currentId) { + seq = seqCounter.getAndIncrement(); + } + standardInfo.setSeq(seq); + DictCodeUtils.convertDictCodeToName(standardInfo); + QueryWrapper itemQueryWrapper = new QueryWrapper<>(); + itemQueryWrapper.eq("standard_id", standardInfo.getId()); + List itemList = carryoutItemMapper.selectList(itemQueryWrapper); + if (!CollectionUtils.isEmpty(itemList)) { + String itemName = itemList.stream().map(BizEquipmentStandardCarryoutItem::getItemName) + .filter(StringUtils::isNotBlank).collect(Collectors.joining("、")); + standardInfo.setItemName(itemName); + } + infoList.add(standardInfo); + prevId = currentId; + } + map.put("hkLab", infoList); support.replaceSlash(map); //添加打印任务 String fileName = TECHNICAL_CAPABILITIES_HAIKOU + ".docx"; @@ -590,6 +613,7 @@ for (Map.Entry> entry : entrySet) { List standardInfoList = entry.getValue(); List equipmentInfos = null; + String technologyFile = null; for (BizEquipmentStandardInfo standardInfo : standardInfoList) { //测量标准装置及其配套设备一览表(西昌实验室) standardInfo.setCreateTime(DateUtil.format(DateUtil.parse(standardInfo.getCreateTime()), "yyyy.MM.dd")); @@ -599,15 +623,15 @@ queryWrapper.eq(BizEquipmentStandardTechnologyRelation::getStandardNo, standardInfo.getStandardNo()); List technologyRelations = technologyRelationMapper.selectList(queryWrapper); String technology = technologyRelations.stream().map(BizEquipmentStandardTechnologyRelation::getFileAttachment).collect(Collectors.joining("\t\n")); - String noSuffixTechnology = this.subFileSuffix(technology); + technologyFile = this.subFileSuffix(technology); for (BizEquipmentInfo equipmentInfo : equipmentInfos) { equipmentInfo.setModel(equipmentInfo.getManufacturer() + "/" + equipmentInfo.getModel()); - equipmentInfo.setTechnicalFile(noSuffixTechnology); } } Map map = new HashMap<>(); map.put("list", standardInfoList); map.put("equipmentList", equipmentInfos); + map.put("technologyFile",technologyFile); support.replaceSlash(map); //添加打印任务 String snowflake = String.valueOf(snowflakeUtil.nextId()); @@ -634,6 +658,7 @@ for (Map.Entry> entry : entrySet) { List standardInfoList = entry.getValue(); List equipmentInfos = null; + String technologyFile = null; for (BizEquipmentStandardInfo standardInfo : standardInfoList) { //测量标准装置及其配套设备一览表(海口实验室) standardInfo.setCreateTime(DateUtil.format(DateUtil.parse(standardInfo.getCreateTime()), "yyyy.MM.dd")); @@ -643,14 +668,15 @@ queryWrapper.eq(BizEquipmentStandardTechnologyRelation::getStandardNo, standardInfo.getStandardNo()); List technologyRelations = technologyRelationMapper.selectList(queryWrapper); String technology = technologyRelations.stream().map(BizEquipmentStandardTechnologyRelation::getFileAttachment).collect(Collectors.joining("、")); - String noSuffixTechnology = this.subFileSuffix(technology); + technologyFile = this.subFileSuffix(technology); for (BizEquipmentInfo equipmentInfo : equipmentInfos) { - equipmentInfo.setTechnicalFile(noSuffixTechnology); + equipmentInfo.setModel(equipmentInfo.getManufacturer() + "/" + equipmentInfo.getModel()); } } Map map = new HashMap<>(); map.put("list", standardInfoList); map.put("equipmentList", equipmentInfos); + map.put("technologyFile",technologyFile); support.replaceSlash(map); //添加打印任务 String snowflake = String.valueOf(snowflakeUtil.nextId()); diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentTransportPackingServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentTransportPackingServiceImpl.java index e479cc9..8e8f08e 100644 --- a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentTransportPackingServiceImpl.java +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentTransportPackingServiceImpl.java @@ -202,28 +202,34 @@ DictCodeUtils.convertDictCodeToName(transportPacking); List detailThingList = new ArrayList<>(); - List bizEquipmentInfos = bizEquipmentInfoMapper.selectList(null); - for (BizEquipmentInfo bizEquipmentInfo : bizEquipmentInfos) { - DictCodeUtils.convertDictCodeToName(bizEquipmentInfo); - } - Map bizResourceStaffMap = bizEquipmentInfos - .stream() - .filter(e -> StringUtils.isNotEmpty(e.getCategoryName()) && StringUtils.isNotEmpty(e.getEquipmentNo())) - .collect(Collectors.toMap(BizEquipmentInfo::getEquipmentNo, BizEquipmentInfo::getCategoryName, (e1, e2) -> e1)); +// List bizEquipmentInfos = bizEquipmentInfoMapper.selectList(null); +// for (BizEquipmentInfo bizEquipmentInfo : bizEquipmentInfos) { +// DictCodeUtils.convertDictCodeToName(bizEquipmentInfo); +// } +// Map bizResourceStaffMap = bizEquipmentInfos +// .stream() +// .filter(e -> StringUtils.isNotEmpty(e.getCategoryName()) && StringUtils.isNotEmpty(e.getManufactureNo())) +// .collect(Collectors.toMap(BizEquipmentInfo::getManufactureNo, BizEquipmentInfo::getCategoryName, (e1, e2) -> e1)); //处理文档对应的包装箱编号 for (TransportPackingThingDetailDTO packingThingDetailDTO : packingThingList) { for (BizEquipmentTransportPackingThing bizEquipmentTransport : packingThingDetailDTO.getEquipmentList()) { - detailThingList.add(TransportPackingThingDetailDoc.builder() + TransportPackingThingDetailDoc detailDoc = TransportPackingThingDetailDoc.builder() .packageNo(packingThingDetailDTO.getPackageNo()) .equipmentNameModel(bizEquipmentTransport.getEquipmentName()) - .equipmentNo(bizEquipmentTransport.getEquipmentNo()) .quantity(bizEquipmentTransport.getQuantity()) - .major(StringUtils.isNotEmpty(bizEquipmentTransport.getEquipmentNo()) ? bizResourceStaffMap.get(bizEquipmentTransport.getEquipmentNo()) : "") + .manufactureNo("/") + //暂无所属专业字段 + .major("/") .packageUser(bizEquipmentTransport.getPackageUser()) - .build()); + .build(); + if (bizEquipmentTransport.getEquipmentId() != null) { + BizEquipmentInfo equipmentInfo = bizEquipmentInfoMapper.selectById(bizEquipmentTransport.getEquipmentId()); + detailDoc.setManufactureNo(equipmentInfo.getManufactureNo()); + } + detailThingList.add(detailDoc); } } - if(StringUtils.isNotEmpty(transportPacking.getPackingTime())){ + if (StringUtils.isNotEmpty(transportPacking.getPackingTime())) { try { transportPacking.setPackingTime(new SimpleDateFormat("yyyy年MM月dd日").format(new SimpleDateFormat("yyyy-MM-dd").parse(transportPacking.getPackingTime()))); } catch (Exception e) { diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java index aa34033..015c7a7 100644 --- a/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/equipment/TransportPackingThingDetailDoc.java @@ -25,7 +25,7 @@ /** * 编号 */ - private String equipmentNo; + private String manufactureNo; /** * 数量 diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java index 032f80e..9de055e 100644 --- a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentStandardInfoServiceImpl.java @@ -506,36 +506,17 @@ @Override public void exportFile(List standardInfos, Boolean pdf, HttpServletResponse response) throws Exception { AtomicInteger seqCounter = new AtomicInteger(1); - List infoList = new ArrayList<>(); List value = standardInfos.stream().sorted( Comparator.comparing(BizEquipmentStandardInfo::getId) .thenComparing(BizEquipmentStandardInfo::getMajorType)).collect(Collectors.toList()); - int seq = 0; - long prevId = -1; - for (BizEquipmentStandardInfo standardInfo : value) { - long currentId = standardInfo.getId(); - if (prevId != currentId) { - seq = seqCounter.getAndIncrement(); - } - standardInfo.setSeq(seq); - DictCodeUtils.convertDictCodeToName(standardInfo); - QueryWrapper itemQueryWrapper = new QueryWrapper<>(); - itemQueryWrapper.eq("standard_id", standardInfo.getId()); - List itemList = carryoutItemMapper.selectList(itemQueryWrapper); - if (!CollectionUtils.isEmpty(itemList)) { - String itemName = itemList.stream().map(BizEquipmentStandardCarryoutItem::getItemName).collect(Collectors.joining("、")); - standardInfo.setItemName(itemName); - } - infoList.add(standardInfo); - prevId = currentId; - } + StandardEquipmentSupport support = new StandardEquipmentSupport(); - Map> labMap = infoList.stream().filter(l -> Objects.nonNull(l.getLabCode())).collect(Collectors.groupingBy(BizEquipmentStandardInfo::getLabCode)); + Map> labMap = value.stream().filter(l -> Objects.nonNull(l.getLabCode())).collect(Collectors.groupingBy(BizEquipmentStandardInfo::getLabCode)); List xcLab = null; List hkLab = null; //需要保证文件合并时顺序性,如下 //1.西昌技术能力范围表 -> 2.海口技术能力范围表 -> 3.测量标准装置及其配套设备一览表(西昌) -> 4.测量标准装置及其配套设备一览表(海口) - ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, infoList.size(), 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(100)); + ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, value.size(), 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(100)); String rootFileName = "标准装置台账" + new SimpleDateFormat("yyyyMMddHHmm").format(new Date()); List fileList = new ArrayList<>(); List> futures = new ArrayList<>(); @@ -543,7 +524,28 @@ //有西昌实验室的数据,需要找到西昌实验室的技术能力范围表 Map map = new HashMap<>(); xcLab = labMap.get("X"); - map.put("xcLab", xcLab); + List infoList = new ArrayList<>(); + int seq = 0; + long prevId = -1; + for (BizEquipmentStandardInfo standardInfo : xcLab) { + long currentId = standardInfo.getId(); + if (prevId != currentId) { + seq = seqCounter.getAndIncrement(); + } + standardInfo.setSeq(seq); + DictCodeUtils.convertDictCodeToName(standardInfo); + QueryWrapper itemQueryWrapper = new QueryWrapper<>(); + itemQueryWrapper.eq("standard_id", standardInfo.getId()); + List itemList = carryoutItemMapper.selectList(itemQueryWrapper); + if (!CollectionUtils.isEmpty(itemList)) { + String itemName = itemList.stream().map(BizEquipmentStandardCarryoutItem::getItemName) + .filter(StringUtils::isNotBlank).collect(Collectors.joining("、")); + standardInfo.setItemName(itemName); + } + infoList.add(standardInfo); + prevId = currentId; + } + map.put("xcLab", infoList); support.replaceSlash(map); //添加打印任务 //自定义文件名称,并添加到临时集合中,所有线程并发执行完后进行合并 @@ -566,7 +568,28 @@ //有海口实验室的数据,需要找到海口实验室的技术能力范围表 Map map = new HashMap<>(); hkLab = labMap.get("H"); - map.put("hkLab", hkLab); + List infoList = new ArrayList<>(); + int seq = 0; + long prevId = -1; + for (BizEquipmentStandardInfo standardInfo : hkLab) { + long currentId = standardInfo.getId(); + if (prevId != currentId) { + seq = seqCounter.getAndIncrement(); + } + standardInfo.setSeq(seq); + DictCodeUtils.convertDictCodeToName(standardInfo); + QueryWrapper itemQueryWrapper = new QueryWrapper<>(); + itemQueryWrapper.eq("standard_id", standardInfo.getId()); + List itemList = carryoutItemMapper.selectList(itemQueryWrapper); + if (!CollectionUtils.isEmpty(itemList)) { + String itemName = itemList.stream().map(BizEquipmentStandardCarryoutItem::getItemName) + .filter(StringUtils::isNotBlank).collect(Collectors.joining("、")); + standardInfo.setItemName(itemName); + } + infoList.add(standardInfo); + prevId = currentId; + } + map.put("hkLab", infoList); support.replaceSlash(map); //添加打印任务 String fileName = TECHNICAL_CAPABILITIES_HAIKOU + ".docx"; @@ -590,6 +613,7 @@ for (Map.Entry> entry : entrySet) { List standardInfoList = entry.getValue(); List equipmentInfos = null; + String technologyFile = null; for (BizEquipmentStandardInfo standardInfo : standardInfoList) { //测量标准装置及其配套设备一览表(西昌实验室) standardInfo.setCreateTime(DateUtil.format(DateUtil.parse(standardInfo.getCreateTime()), "yyyy.MM.dd")); @@ -599,15 +623,15 @@ queryWrapper.eq(BizEquipmentStandardTechnologyRelation::getStandardNo, standardInfo.getStandardNo()); List technologyRelations = technologyRelationMapper.selectList(queryWrapper); String technology = technologyRelations.stream().map(BizEquipmentStandardTechnologyRelation::getFileAttachment).collect(Collectors.joining("\t\n")); - String noSuffixTechnology = this.subFileSuffix(technology); + technologyFile = this.subFileSuffix(technology); for (BizEquipmentInfo equipmentInfo : equipmentInfos) { equipmentInfo.setModel(equipmentInfo.getManufacturer() + "/" + equipmentInfo.getModel()); - equipmentInfo.setTechnicalFile(noSuffixTechnology); } } Map map = new HashMap<>(); map.put("list", standardInfoList); map.put("equipmentList", equipmentInfos); + map.put("technologyFile",technologyFile); support.replaceSlash(map); //添加打印任务 String snowflake = String.valueOf(snowflakeUtil.nextId()); @@ -634,6 +658,7 @@ for (Map.Entry> entry : entrySet) { List standardInfoList = entry.getValue(); List equipmentInfos = null; + String technologyFile = null; for (BizEquipmentStandardInfo standardInfo : standardInfoList) { //测量标准装置及其配套设备一览表(海口实验室) standardInfo.setCreateTime(DateUtil.format(DateUtil.parse(standardInfo.getCreateTime()), "yyyy.MM.dd")); @@ -643,14 +668,15 @@ queryWrapper.eq(BizEquipmentStandardTechnologyRelation::getStandardNo, standardInfo.getStandardNo()); List technologyRelations = technologyRelationMapper.selectList(queryWrapper); String technology = technologyRelations.stream().map(BizEquipmentStandardTechnologyRelation::getFileAttachment).collect(Collectors.joining("、")); - String noSuffixTechnology = this.subFileSuffix(technology); + technologyFile = this.subFileSuffix(technology); for (BizEquipmentInfo equipmentInfo : equipmentInfos) { - equipmentInfo.setTechnicalFile(noSuffixTechnology); + equipmentInfo.setModel(equipmentInfo.getManufacturer() + "/" + equipmentInfo.getModel()); } } Map map = new HashMap<>(); map.put("list", standardInfoList); map.put("equipmentList", equipmentInfos); + map.put("technologyFile",technologyFile); support.replaceSlash(map); //添加打印任务 String snowflake = String.valueOf(snowflakeUtil.nextId()); diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentTransportPackingServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentTransportPackingServiceImpl.java index e479cc9..8e8f08e 100644 --- a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentTransportPackingServiceImpl.java +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/equipment/BizEquipmentTransportPackingServiceImpl.java @@ -202,28 +202,34 @@ DictCodeUtils.convertDictCodeToName(transportPacking); List detailThingList = new ArrayList<>(); - List bizEquipmentInfos = bizEquipmentInfoMapper.selectList(null); - for (BizEquipmentInfo bizEquipmentInfo : bizEquipmentInfos) { - DictCodeUtils.convertDictCodeToName(bizEquipmentInfo); - } - Map bizResourceStaffMap = bizEquipmentInfos - .stream() - .filter(e -> StringUtils.isNotEmpty(e.getCategoryName()) && StringUtils.isNotEmpty(e.getEquipmentNo())) - .collect(Collectors.toMap(BizEquipmentInfo::getEquipmentNo, BizEquipmentInfo::getCategoryName, (e1, e2) -> e1)); +// List bizEquipmentInfos = bizEquipmentInfoMapper.selectList(null); +// for (BizEquipmentInfo bizEquipmentInfo : bizEquipmentInfos) { +// DictCodeUtils.convertDictCodeToName(bizEquipmentInfo); +// } +// Map bizResourceStaffMap = bizEquipmentInfos +// .stream() +// .filter(e -> StringUtils.isNotEmpty(e.getCategoryName()) && StringUtils.isNotEmpty(e.getManufactureNo())) +// .collect(Collectors.toMap(BizEquipmentInfo::getManufactureNo, BizEquipmentInfo::getCategoryName, (e1, e2) -> e1)); //处理文档对应的包装箱编号 for (TransportPackingThingDetailDTO packingThingDetailDTO : packingThingList) { for (BizEquipmentTransportPackingThing bizEquipmentTransport : packingThingDetailDTO.getEquipmentList()) { - detailThingList.add(TransportPackingThingDetailDoc.builder() + TransportPackingThingDetailDoc detailDoc = TransportPackingThingDetailDoc.builder() .packageNo(packingThingDetailDTO.getPackageNo()) .equipmentNameModel(bizEquipmentTransport.getEquipmentName()) - .equipmentNo(bizEquipmentTransport.getEquipmentNo()) .quantity(bizEquipmentTransport.getQuantity()) - .major(StringUtils.isNotEmpty(bizEquipmentTransport.getEquipmentNo()) ? bizResourceStaffMap.get(bizEquipmentTransport.getEquipmentNo()) : "") + .manufactureNo("/") + //暂无所属专业字段 + .major("/") .packageUser(bizEquipmentTransport.getPackageUser()) - .build()); + .build(); + if (bizEquipmentTransport.getEquipmentId() != null) { + BizEquipmentInfo equipmentInfo = bizEquipmentInfoMapper.selectById(bizEquipmentTransport.getEquipmentId()); + detailDoc.setManufactureNo(equipmentInfo.getManufactureNo()); + } + detailThingList.add(detailDoc); } } - if(StringUtils.isNotEmpty(transportPacking.getPackingTime())){ + if (StringUtils.isNotEmpty(transportPacking.getPackingTime())) { try { transportPacking.setPackingTime(new SimpleDateFormat("yyyy年MM月dd日").format(new SimpleDateFormat("yyyy-MM-dd").parse(transportPacking.getPackingTime()))); } catch (Exception e) { diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/listeners/register/module/GenericFilePrintProcessor.java b/casic-metering-service/src/main/java/com/casic/missiles/service/listeners/register/module/GenericFilePrintProcessor.java index bc59c72..2ddf9f9 100644 --- a/casic-metering-service/src/main/java/com/casic/missiles/service/listeners/register/module/GenericFilePrintProcessor.java +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/listeners/register/module/GenericFilePrintProcessor.java @@ -10,6 +10,7 @@ import com.casic.missiles.exception.BusinessException; import com.casic.missiles.model.file.ModuleFieldConfig; import com.casic.missiles.model.file.ModuleTemplatePrintConfig; +import com.casic.missiles.utils.SnowflakeUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; @@ -39,7 +40,9 @@ throw new BusinessException(BusinessExceptionEnum.MODULE_CONFIG_PRINT); }); //根据打印模板配置,初始化文件打印注册信息 - moduleIdValue = ObjectUtils.isEmpty(moduleIdValue) ? (Long) customParam.get("id") : moduleIdValue; + SnowflakeUtil snowflakeUtil = new SnowflakeUtil(); + long id = snowflakeUtil.nextId(); + moduleIdValue = ObjectUtils.isEmpty(moduleIdValue) ? id : moduleIdValue; FilePrintRegister filePrintRegister = initialization(templateFileDir, moduleIdValue, moduleTemplatePrintConfig); log.debug("执行定制化参数,初始化的模板参数为{}", JSON.toJSON(filePrintRegister)); if (customParam != null) {