|
@@ -16,7 +16,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
import com.fjhx.common.entity.AvailableStockBo;
|
|
import com.fjhx.common.entity.AvailableStockBo;
|
|
import com.fjhx.common.service.file.FtpFileService;
|
|
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.Assert;
|
|
import com.fjhx.common.utils.excel.ExcelImgUtils;
|
|
import com.fjhx.common.utils.excel.ExcelImgUtils;
|
|
import com.fjhx.common.utils.excel.util.ExcelUtil;
|
|
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.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.imageio.IIOException;
|
|
import javax.imageio.ImageIO;
|
|
import javax.imageio.ImageIO;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.awt.image.BufferedImage;
|
|
import java.awt.image.BufferedImage;
|
|
@@ -100,8 +100,14 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
List<ProductInfoVo> records = page.getRecords();
|
|
List<ProductInfoVo> records = page.getRecords();
|
|
|
|
|
|
|
|
+ setPageInfo(records);
|
|
|
|
+
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setPageInfo(List<ProductInfoVo> records) {
|
|
if (records.size() == 0) {
|
|
if (records.size() == 0) {
|
|
- return page;
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
|
|
List<ProductClassify> productClassifyList = productClassifyService.list();
|
|
List<ProductClassify> productClassifyList = productClassifyService.list();
|
|
@@ -132,12 +138,13 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
record.setClassifyName(productClassify.getName());
|
|
record.setClassifyName(productClassify.getName());
|
|
|
|
|
|
List<String> classifyNameGroup = new ArrayList<>();
|
|
List<String> classifyNameGroup = new ArrayList<>();
|
|
-
|
|
|
|
while (productClassify != null) {
|
|
while (productClassify != null) {
|
|
classifyNameGroup.add(0, productClassify.getName());
|
|
classifyNameGroup.add(0, productClassify.getName());
|
|
productClassify = productClassifyMap.get(productClassify.getParentId());
|
|
productClassify = productClassifyMap.get(productClassify.getParentId());
|
|
}
|
|
}
|
|
record.setClassifyNameGroup(classifyNameGroup);
|
|
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) -> {
|
|
this.attributeAssign(records, ProductInfo::getAttrRawMaterialId, (item, product) -> {
|
|
item.setAttrRawMaterialName(product.getName());
|
|
item.setAttrRawMaterialName(product.getName());
|
|
});
|
|
});
|
|
-
|
|
|
|
- return page;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private IWrapper<ProductInfo> getPageWrapper(ProductInfoSelectDto dto) {
|
|
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<ProductInfoVo> productInfoList = baseMapper.getList(wrapper);
|
|
List<Long> pIds = productInfoList.stream().map(ProductInfo::getId).collect(Collectors.toList());
|
|
List<Long> pIds = productInfoList.stream().map(ProductInfo::getId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
+ setPageInfo(productInfoList);
|
|
|
|
+
|
|
//处理产品图片
|
|
//处理产品图片
|
|
Map<Long, List<FileInfoVo>> fileMap = ObsFileUtil.getFileMap(pIds, 0);
|
|
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> frontLinesMap = DictUtils.getDictMap("front_lines");
|
|
Map<String, String> backLinesMap = DictUtils.getDictMap("back_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 length = productInfo.getLength();
|
|
BigDecimal width = productInfo.getWidth();
|
|
BigDecimal width = productInfo.getWidth();
|
|
@@ -1158,7 +1125,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
width = ObjectUtil.isEmpty(width) ? BigDecimal.ZERO : width;
|
|
width = ObjectUtil.isEmpty(width) ? BigDecimal.ZERO : width;
|
|
height = ObjectUtil.isEmpty(height) ? BigDecimal.ZERO : height;
|
|
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());
|
|
List<FileInfoVo> fileInfoVoList = fileMap.get(productInfo.getId());
|
|
if (ObjectUtil.isNotEmpty(fileInfoVoList)) {
|
|
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);
|
|
WriteCellData<Void> voidWriteCellData = ExcelImgUtils.imageCells(baos.toByteArray(), imgWidth, imgHeight, 10.0 * 5.8, 50.0);
|
|
bo.setProductImg(voidWriteCellData);
|
|
bo.setProductImg(voidWriteCellData);
|
|
}
|
|
}
|
|
|
|
+ } catch (IIOException iioe) {
|
|
|
|
+ log.error(iioe.getMessage());
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
|
+ log.error("导出失败" + e.getMessage(), e);
|
|
throw new ServiceException("导出失败" + e.getMessage());
|
|
throw new ServiceException("导出失败" + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1195,10 +1165,22 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
bo.setReverseTexture(backLinesMap.getOrDefault(productInfo.getReverseTexture(), productInfo.getReverseTexture()));
|
|
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);
|
|
productExcelExportBoList.add(bo);
|
|
}
|
|
}
|