yzc преди 1 година
родител
ревизия
219ffc5984

+ 57 - 0
hx-item/src/main/java/com/fjhx/item/entity/product/bo/ProductExcelExportBo.java

@@ -7,6 +7,8 @@ import com.alibaba.excel.metadata.data.WriteCellData;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+
 @Getter
 @Setter
 @ContentRowHeight(50)
@@ -35,4 +37,59 @@ public class ProductExcelExportBo {
     @ColumnWidth(15)
     @ExcelProperty("生产图片")
     private String prodImgPath;
+    //====================================================================
+    @ColumnWidth(15)
+    @ExcelProperty("业务公司")
+    private String companyName;
+    @ColumnWidth(15)
+    @ExcelProperty("产品分类")
+    private String productClassifyNames;
+    @ColumnWidth(15)
+    @ExcelProperty("产品英文名")
+    private String nameEnglish;
+    @ColumnWidth(15)
+    @ExcelProperty("计量单位")
+    private String unit;
+    @ColumnWidth(15)
+    @ExcelProperty("海关编码")
+    private String hsCode;
+    @ColumnWidth(15)
+    @ExcelProperty("色卡号")
+    private String colorCardCode;
+    @ColumnWidth(15)
+    @ExcelProperty("净重")
+    private BigDecimal netWeight;
+    @ColumnWidth(15)
+    @ExcelProperty("产品描述")
+    private String remark;
+    @ColumnWidth(15)
+    @ExcelProperty("销售价")
+    private BigDecimal price;
+    @ColumnWidth(15)
+    @ExcelProperty("工厂供货价")
+    private BigDecimal factoryPrice;
+    @ColumnWidth(15)
+    @ExcelProperty("平铺价")
+    private BigDecimal flatPrice;
+    @ColumnWidth(15)
+    @ExcelProperty("业务供货价")
+    private BigDecimal businessCostPrice;
+    @ColumnWidth(15)
+    @ExcelProperty("LOGO长")
+    private BigDecimal logoLength;
+    @ColumnWidth(15)
+    @ExcelProperty("LOGO宽")
+    private BigDecimal logoWidth;
+    @ColumnWidth(15)
+    @ExcelProperty("几色印刷")
+    private Integer colorCount;
+    @ColumnWidth(15)
+    @ExcelProperty("是否折叠")
+    private String isFold;
+    @ColumnWidth(15)
+    @ExcelProperty("包装要求")
+    private String packAsk;
+    @ColumnWidth(15)
+    @ExcelProperty("是否定制")
+    private String isCustomized;
 }

+ 1 - 1
hx-item/src/main/java/com/fjhx/item/entity/product/po/ProductInfo.java

@@ -214,7 +214,7 @@ public class ProductInfo extends BasePo {
     private String colorCardCode;
     //-------------------------------------------
     /**
-     * 出场价
+     * 出场价 工厂供货价
      */
     private BigDecimal factoryPrice;
     /**

+ 33 - 51
hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java

@@ -16,7 +16,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.common.entity.AvailableStockBo;
 import com.fjhx.common.service.file.FtpFileService;
-import com.fjhx.common.service.file.impl.FtpFileServiceImpl;
 import com.fjhx.common.utils.Assert;
 import com.fjhx.common.utils.excel.ExcelImgUtils;
 import com.fjhx.common.utils.excel.util.ExcelUtil;
@@ -53,6 +52,7 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.imageio.IIOException;
 import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletResponse;
 import java.awt.image.BufferedImage;
@@ -100,8 +100,14 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
 
         List<ProductInfoVo> records = page.getRecords();
 
+        setPageInfo(records);
+
+        return page;
+    }
+
+    private void setPageInfo(List<ProductInfoVo> records) {
         if (records.size() == 0) {
-            return page;
+            return;
         }
 
         List<ProductClassify> productClassifyList = productClassifyService.list();
@@ -132,12 +138,13 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
             record.setClassifyName(productClassify.getName());
 
             List<String> classifyNameGroup = new ArrayList<>();
-
             while (productClassify != null) {
                 classifyNameGroup.add(0, productClassify.getName());
                 productClassify = productClassifyMap.get(productClassify.getParentId());
             }
             record.setClassifyNameGroup(classifyNameGroup);
+            String classifyNames = classifyNameGroup.stream().collect(Collectors.joining(">"));
+            record.setProductClassifyNames(classifyNames);
 
 
             //赋值原材料信息
@@ -156,8 +163,6 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         this.attributeAssign(records, ProductInfo::getAttrRawMaterialId, (item, product) -> {
             item.setAttrRawMaterialName(product.getName());
         });
-
-        return page;
     }
 
     private IWrapper<ProductInfo> getPageWrapper(ProductInfoSelectDto dto) {
@@ -733,47 +738,6 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
             );
 
         }
-
-
-        //-------------------------------------
-
-//        List<ProductAvailableRecord> availableRecordList = new ArrayList<>();
-
-//            BigDecimal availableQuantityNew;
-//            BigDecimal edQuantity = inOutBo.getQuantity();
-
-
-//            if (inOutType.equals(InOutType.IN)) {
-//                availableQuantityNew = availableQuantity.add(inOutBo.getQuantity());
-//            } else if (inOutType.equals(InOutType.OUT)) {
-//                availableQuantityNew = availableQuantity.subtract(inOutBo.getQuantity());
-//            } else if (inOutType.equals(InOutType.EQ)) {
-//                availableQuantityNew = inOutBo.getQuantity();
-//
-//                edQuantity = availableQuantityNew.subtract(availableQuantity);
-//            } else {
-//                throw new ServiceException("未知类型");
-//            }
-
-//            productStockInfoService.update(q -> q
-//                    .eq(ProductStockInfo::getId, productStockInfoId)
-//                    .set(ProductStockInfo::getAvailableQuantity, availableQuantityNew)
-//                    .set(BasePo::getUpdateTime, new Date())
-//                    .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
-//            );
-
-//            //保存操作记录
-//            ProductAvailableRecord productAvailableRecord = new ProductAvailableRecord();
-//            productAvailableRecord.setBeforeQuantity(productStockInfo.getAvailableQuantity());
-//            productAvailableRecord.setAfterQuantity(availableQuantityNew);
-//            productAvailableRecord.setEditQuantity(edQuantity);
-//            productAvailableRecord.setBusinessId(businessId);
-//            productAvailableRecord.setBusinessType(businessType.getType());
-//            productAvailableRecord.setProductId(inOutBo.getProductId());
-//            productAvailableRecord.setCompanyId(companyId);
-//
-//            availableRecordList.add(productAvailableRecord);
-//        productAvailableRecordService.saveBatch(availableRecordList);
     }
 
     /**
@@ -1141,6 +1105,8 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         List<ProductInfoVo> productInfoList = baseMapper.getList(wrapper);
         List<Long> pIds = productInfoList.stream().map(ProductInfo::getId).collect(Collectors.toList());
 
+        setPageInfo(productInfoList);
+
         //处理产品图片
         Map<Long, List<FileInfoVo>> fileMap = ObsFileUtil.getFileMap(pIds, 0);
 
@@ -1148,8 +1114,9 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
 
         Map<String, String> frontLinesMap = DictUtils.getDictMap("front_lines");
         Map<String, String> backLinesMap = DictUtils.getDictMap("back_lines");
+        Map<String, String> packAskMap = DictUtils.getDictMap("pack_ask");
 
-        for (ProductInfo productInfo : productInfoList) {
+        for (ProductInfoVo productInfo : productInfoList) {
             //处理长宽高
             BigDecimal length = productInfo.getLength();
             BigDecimal width = productInfo.getWidth();
@@ -1158,7 +1125,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
             width = ObjectUtil.isEmpty(width) ? BigDecimal.ZERO : width;
             height = ObjectUtil.isEmpty(height) ? BigDecimal.ZERO : height;
 
-            ProductExcelExportBo bo = new ProductExcelExportBo();
+            ProductExcelExportBo bo = BeanUtil.copyProperties(productInfo, ProductExcelExportBo.class);
             //获取产品图片信息
             List<FileInfoVo> fileInfoVoList = fileMap.get(productInfo.getId());
             if (ObjectUtil.isNotEmpty(fileInfoVoList)) {
@@ -1180,7 +1147,10 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
                         WriteCellData<Void> voidWriteCellData = ExcelImgUtils.imageCells(baos.toByteArray(), imgWidth, imgHeight, 10.0 * 5.8, 50.0);
                         bo.setProductImg(voidWriteCellData);
                     }
+                } catch (IIOException iioe) {
+                    log.error(iioe.getMessage());
                 } catch (IOException e) {
+                    log.error("导出失败" + e.getMessage(), e);
                     throw new ServiceException("导出失败" + e.getMessage());
                 }
             }
@@ -1195,10 +1165,22 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
             bo.setReverseTexture(backLinesMap.getOrDefault(productInfo.getReverseTexture(), productInfo.getReverseTexture()));
 
             //赋值生产图片
-            List<String> prodImgList = ftpFileService.getFileList(productInfo.getProdImgPath());
-            if (ObjectUtil.isNotEmpty(prodImgList)) {
-                bo.setProdImgPath(FtpFileServiceImpl.fileServiceUrl + prodImgList.get(0));
+//            List<String> prodImgList = ftpFileService.getFileList(productInfo.getProdImgPath());
+//            if (ObjectUtil.isNotEmpty(prodImgList)) {
+//                bo.setProdImgPath(FtpFileServiceImpl.fileServiceUrl + prodImgList.get(0));
+//            }
+            bo.setProdImgPath(productInfo.getProdImgPath());
+
+            //是否折叠
+            if (ObjectUtil.isNotEmpty(bo.getIsFold())) {
+                bo.setIsFold("1".equals(bo.getIsFold()) ? "是" : "否");
+            }
+            //是否定制
+            if (ObjectUtil.isNotEmpty(bo.getIsCustomized())) {
+                bo.setIsCustomized("1".equals(bo.getIsCustomized()) ? "是" : "否");
             }
+            //包装要求
+            bo.setPackAsk(packAskMap.get(bo.getPackAsk()));
 
             productExcelExportBoList.add(bo);
         }

+ 8 - 1
hx-item/src/main/resources/mapper/product/ProductInfoMapper.xml

@@ -43,7 +43,14 @@
                pi.flat_price,
                pi.factory_price,
                pi.attr_raw_material_id,
-               pi.business_cost_price
+               pi.business_cost_price,
+               pi.color_card_code,
+               pi.logo_length,
+               pi.logo_width,
+               pi.color_count,
+               pi.is_fold,
+               pi.pack_ask,
+               pi.is_customized
         FROM product_info pi
                  LEFT JOIN (SELECT IF(SUM(IF(type = 1, 1, 0)) > 0, 1, 0) AS isRawMaterial,
                                    pbd.product_id