|
@@ -1,6 +1,10 @@
|
|
|
package com.fjhx.item.service.product.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fjhx.common.utils.excel.util.ExcelUtil;
|
|
|
+import com.fjhx.item.entity.product.ProductBomDetailExcelBo;
|
|
|
+import com.fjhx.item.entity.product.dto.ProductBomDetailSelectDto;
|
|
|
import com.fjhx.item.entity.product.po.ProductBomDetail;
|
|
|
import com.fjhx.item.entity.product.vo.ProductBomDetailVo;
|
|
|
import com.fjhx.item.mapper.product.ProductBomDetailMapper;
|
|
@@ -10,6 +14,8 @@ import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@@ -30,6 +36,12 @@ public class ProductBomDetailServiceImpl extends ServiceImpl<ProductBomDetailMap
|
|
|
@Override
|
|
|
public List<ProductBomDetailVo> getList(IWrapper<Object> wrapper) {
|
|
|
List<ProductBomDetailVo> list = baseMapper.getList(wrapper);
|
|
|
+ //赋值产品信息
|
|
|
+ productInfoService.attributeAssign(list, ProductBomDetailVo::getProductId, (item, product) -> {
|
|
|
+ item.setProductName(product.getName());
|
|
|
+ item.setProductCode(product.getCustomCode());
|
|
|
+ });
|
|
|
+ //赋值物料信息
|
|
|
productInfoService.attributeAssign(list, ProductBomDetail::getMaterialId, (item, material) -> {
|
|
|
item.setMaterialName(material.getName());
|
|
|
item.setMaterialCode(material.getCustomCode());
|
|
@@ -41,6 +53,29 @@ public class ProductBomDetailServiceImpl extends ServiceImpl<ProductBomDetailMap
|
|
|
item.setMaterialColor(material.getColor());
|
|
|
item.setMaterialColorCardCode(material.getColorCardCode());
|
|
|
});
|
|
|
+
|
|
|
+ for (ProductBomDetailVo vo : list) {
|
|
|
+ if (vo.getMaterialLength() == null) {
|
|
|
+ vo.setMaterialLength(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if (vo.getMaterialWidth() == null) {
|
|
|
+ vo.setMaterialWidth(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if (vo.getMaterialHeight() == null) {
|
|
|
+ vo.setMaterialHeight(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ vo.setMaterialSpecDim(String.format("%s * %s * %s", vo.getMaterialLength(), vo.getMaterialWidth(), vo.getMaterialWidth()));
|
|
|
+ }
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportExcel(ProductBomDetailSelectDto dto, HttpServletResponse httpServletResponse) {
|
|
|
+ IWrapper wrapper = getWrapper();
|
|
|
+ List<ProductBomDetailVo> list = getList(wrapper);
|
|
|
+ List<ProductBomDetailExcelBo> stockExcelBos = BeanUtil.copyToList(list, ProductBomDetailExcelBo.class);
|
|
|
+ ExcelUtil.export(httpServletResponse, stockExcelBos, ProductBomDetailExcelBo.class);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|