优化 导出文件名称
This commit is contained in:
parent
66ec59f5f9
commit
ea0ce9540b
|
|
@ -1190,8 +1190,8 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
if(FuncUtil.isEmpty(entryDOS)){
|
||||
throw exception(ErrorCodeConstants.SALE_ORDER_NOT_FILE_EXPORT);
|
||||
}
|
||||
List<Long> id = new ArrayList<>();
|
||||
Map<Long,String> codeMap = new HashMap<>();
|
||||
List<Long> entryIds = new ArrayList<>();
|
||||
Map<String,String> codeMap = new HashMap<>();
|
||||
for (SaleOrderEntryDO entryDO : entryDOS) {
|
||||
Long materialId = entryDO.getMaterialId();
|
||||
ProductInfoDO infoDO = productInfoMapper.selectById(materialId);
|
||||
|
|
@ -1199,18 +1199,18 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
String templateType = infoDO.getTemplateType();
|
||||
if("1".equals(templateType)){
|
||||
// 有模板物料
|
||||
id.add(entryDO.getId());
|
||||
entryIds.add(entryDO.getId());
|
||||
String code = infoDO.getCode();
|
||||
codeMap.put(entryDO.getId(), code);
|
||||
codeMap.put(entryDO.getId().toString(), code);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(FuncUtil.isEmpty(id)){
|
||||
if(FuncUtil.isEmpty(entryIds)){
|
||||
throw exception(ErrorCodeConstants.SALE_ORDER_NOT_FILE_EXPORT);
|
||||
}
|
||||
// 获取 sku
|
||||
LambdaQueryWrapper<SaleOrderSkuDO> skuWrapper = new LambdaQueryWrapper<>();
|
||||
skuWrapper.in(SaleOrderSkuDO::getEntryId, id);
|
||||
skuWrapper.in(SaleOrderSkuDO::getEntryId, entryIds);
|
||||
skuWrapper.eq(SaleOrderSkuDO::getDeleted, false);
|
||||
List<SaleOrderSkuDO> skuDOS = skuOrderSkuMapper.selectList(skuWrapper);
|
||||
if(FuncUtil.isEmpty(skuDOS)){
|
||||
|
|
@ -1225,6 +1225,7 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
System.out.println("创建目录:"+pathUrl);
|
||||
file1.mkdirs();
|
||||
}
|
||||
System.out.println("codeMap"+codeMap);
|
||||
List<File> files = new ArrayList<>();
|
||||
List<String> delFiles = new ArrayList<>();
|
||||
for (SaleOrderSkuDO skuDO : skuDOS) {
|
||||
|
|
@ -1232,7 +1233,7 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
if(FuncUtil.isNotEmpty(sourceFile)){
|
||||
// 生成文件
|
||||
Long entryId = skuDO.getEntryId();
|
||||
String s = FuncUtil.toStr(codeMap.get(entryId),skuDO.getId().toString());
|
||||
String s = FuncUtil.toStr(codeMap.get(entryId.toString()),skuDO.getId().toString());
|
||||
Integer orderQty = skuDO.getOrderQty();
|
||||
String name = DateUtil.format(LocalDateTime.now(), "yyyyMMdd")
|
||||
+"-"+IdUtil.simpleUUID().substring(0, 4);
|
||||
|
|
@ -1243,7 +1244,6 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String htmlText = HttpUtil.get(sourceFile);
|
||||
FileUtil.writeString(htmlText, templatePath2, "UTF-8");
|
||||
File file = FileUtil.file(templatePath2);
|
||||
|
|
@ -1254,7 +1254,6 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
if(FuncUtil.isEmpty(files)){
|
||||
throw exception(ErrorCodeConstants.SALE_ORDER_NOT_FILE_EXPORT);
|
||||
}
|
||||
System.out.println("files:"+files);
|
||||
|
||||
String zipFileName = StrUtil.format(pathUrl + "/订单稿件_{}.zip", new Date().getTime());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue