Administrator
2025-07-18 4888ef96061e19769427bf52b0a644da7910331e
src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java
@@ -1239,4 +1239,125 @@
        return new FebsResponse().success().data(objectObjectHashMap);
    }
    @Override
    public AdminClothesPrintOrderVo printOrderEvent(AdminClothesPrintOrderDto dto) {
        AdminClothesPrintOrderVo vo = new AdminClothesPrintOrderVo();
        ClothesOrder order = clothesOrderMapper.selectById(dto.getId());
        if (ObjectUtil.isNotNull(order)){
            vo.setOrderNo(order.getOrderNo());
        }
        ClothesType clothesType = clothesTypeMapper.selectById(order.getTypeId());
        if (ObjectUtil.isNotNull(clothesType)) {
            vo.setTypeName(clothesType.getName());
            vo.setTypeFront(clothesType.getImageFront());
            vo.setTypeBack(clothesType.getImageBack());
        }
        List<ClothesOrderItem> clothesOrderItems = clothesOrderItemMapper.selectList(
                Wrappers.lambdaQuery(ClothesOrderItem.class)
                        .eq(ClothesOrderItem::getOrderId, order.getId())
        );
        if(CollUtil.isNotEmpty(clothesOrderItems)){
            String nullStr = "暂无";
            List<AdminClothesPrintLocationVo> locations = new ArrayList<>();
            List<AdminClothesPrintPatternVo> patterns = new ArrayList<>();
            for (ClothesOrderItem item : clothesOrderItems){
                if (ClothesOrderItemEnum.CLOTH.getCode() == item.getType()) {
                    ClothesCloth cloth = clothesClothMapper.selectById(item.getItemId());
                    if (ObjectUtil.isNotNull(cloth)) {
                        vo.setClothCode(cloth.getCode());
                        vo.setClothName(cloth.getName());
                    }else{
                        vo.setClothCode(nullStr);
                        vo.setClothName(nullStr);
                    }
                    continue;
                } else if (ClothesOrderItemEnum.SIZE.getCode() == item.getType()) {
                    ClothesSize size = clothesSizeMapper.selectById(item.getItemId());
                    if (ObjectUtil.isNotNull(size)) {
                        vo.setSizeName(size.getName());
                        vo.setSizeCode(size.getCode());
                    }else {
                        vo.setSizeName(nullStr);
                        vo.setSizeCode(nullStr);
                    }
                    continue;
                } else if (ClothesOrderItemEnum.LOCATION.getCode() == item.getType()) {
                    AdminClothesPrintLocationVo locationVo = new AdminClothesPrintLocationVo();
                    ClothesLocation location = clothesLocationMapper.selectById(item.getItemId());
                    if (ObjectUtil.isNotNull(location)) {
                        locationVo.setLocationName(location.getName());
                        locationVo.setLocationCode(location.getCode());
                        JSON parse = JSONUtil.parse(item.getRemark());
                        locationVo.setLocationText(parse.getByPath("text", String.class));
                        locationVo.setLocationImage(parse.getByPath("file", String.class));
                    }else{
                        locationVo.setLocationName(nullStr);
                        locationVo.setLocationCode(nullStr);
                        locationVo.setLocationText(nullStr);
                        locationVo.setLocationImage(nullStr);
                    }
                    locations.add(locationVo);
                    vo.setLocations( locations);
                    continue;
                } else if (ClothesOrderItemEnum.PATTERN.getCode() == item.getType()) {
                    AdminClothesPrintPatternVo patternVo = new AdminClothesPrintPatternVo();
                    ClothesPattern pattern = clothesPatternMapper.selectById(item.getItemId());
                    if (ObjectUtil.isNotNull(pattern)) {
                        patternVo.setPatternName(pattern.getName());
                        patternVo.setPatternCode(pattern.getCode());
                        JSON parse = JSONUtil.parse(item.getRemark());
                        patternVo.setPatternText(parse.getByPath("text", String.class));
                        patternVo.setPatternImage(parse.getByPath("file", String.class));
                    }else{
                        patternVo.setPatternName(nullStr);
                        patternVo.setPatternCode(nullStr);
                        patternVo.setPatternText(nullStr);
                        patternVo.setPatternImage(nullStr);
                    }
                    patterns.add(patternVo);
                    vo.setPatterns( patterns);
                    continue;
                } else if (ClothesOrderItemEnum.ART.getCode() == item.getType()) {
                    ClothesArt art = clothesArtMapper.selectById(item.getItemId());
                    if (ObjectUtil.isNotNull(art)) {
                        vo.setArtName(art.getName());
                        vo.setArtCode(art.getCode());
                    }else{
                        vo.setArtName(nullStr);
                        vo.setArtCode(nullStr);
                    }
                    continue;
                } else if (ClothesOrderItemEnum.CUSTOMIZE.getCode() == item.getType()) {
                    AdminClothesPrintMemberStatureVo memberStature = new AdminClothesPrintMemberStatureVo();
                    ClothesMemberStature clothesMemberStature = clothesMemberStatureMapper.selectById(item.getItemId());
                    if (ObjectUtil.isNotNull(clothesMemberStature)) {
                        memberStature.setName(clothesMemberStature.getName());
                        memberStature.setHeightLine(clothesMemberStature.getHeightLine());
                        memberStature.setBustLine(clothesMemberStature.getBustLine());
                        memberStature.setWaistLine(clothesMemberStature.getWaistLine());
                        memberStature.setWideLine(clothesMemberStature.getWideLine());
                        memberStature.setHipLine(clothesMemberStature.getHipLine());
                    }else{
                        memberStature.setName(nullStr);
                        memberStature.setHeightLine(BigDecimal.ZERO);
                        memberStature.setBustLine(BigDecimal.ZERO);
                        memberStature.setWaistLine(BigDecimal.ZERO);
                        memberStature.setWideLine(BigDecimal.ZERO);
                        memberStature.setHipLine(BigDecimal.ZERO);
                    }
                    vo.setMemberStature(memberStature);
                    continue;
                } else {
                    continue;
                }
            }
        }
        return vo;
    }
}