Commit 72976dc8 authored by lanbaoming's avatar lanbaoming

2024-06-06提交

parent 5680fecb
...@@ -24,7 +24,9 @@ public class BpmOrderRevokeSplitOrderResultListener extends BpmProcessInstanceRe ...@@ -24,7 +24,9 @@ public class BpmOrderRevokeSplitOrderResultListener extends BpmProcessInstanceRe
@Override @Override
protected void onEvent(BpmProcessInstanceResultEvent event) { protected void onEvent(BpmProcessInstanceResultEvent event) {
log.info("-------------------撤销拆单审核回调-------------------------{},{}", event.getBusinessKey(), event.getResult()); log.info("-------------------撤销拆单审核回调-------------------------{},{}",
event.getBusinessKey(), event.getResult());
orderSplitService.revokeSplitApplyCallback(event.getBusinessKey(), orderSplitService.revokeSplitApplyCallback(event.getBusinessKey(),
event.getResult()); event.getResult());
} }
......
...@@ -40,7 +40,9 @@ import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*; ...@@ -40,7 +40,9 @@ import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*;
*/ */
@Service @Service
@Validated @Validated
public class OrderMutualServiceImpl extends AbstractService<OrderMutualMapper, OrderMutualDO> implements OrderMutualService { public class OrderMutualServiceImpl extends AbstractService<OrderMutualMapper,
OrderMutualDO> implements OrderMutualService {
@Resource @Resource
private OrderMutualMapper mutualMapper; private OrderMutualMapper mutualMapper;
......
...@@ -6104,6 +6104,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -6104,6 +6104,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 删除子拆单的放货记录 // 删除子拆单的放货记录
orderCargoControlPickMapper.delete(new LambdaQueryWrapper<OrderCargoControlPickDO>().eq(OrderCargoControlPickDO::getOrderId, splitOrderId)); orderCargoControlPickMapper.delete(new LambdaQueryWrapper<OrderCargoControlPickDO>().eq(OrderCargoControlPickDO::getOrderId, splitOrderId));
} }
// 处理关联关系 // 处理关联关系
orderGuanlianService.dealGuanlianByOrderId(parentOrderId, orderIds, 2); orderGuanlianService.dealGuanlianByOrderId(parentOrderId, orderIds, 2);
// 处理互斥关系 // 处理互斥关系
......
...@@ -1562,7 +1562,7 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord ...@@ -1562,7 +1562,7 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord
// 根据母订单id删除相关拆单信息 // 根据母订单id删除相关拆单信息
splitItemMapper.deleteByOrderId(parentOrder.getOrderId()); splitItemMapper.deleteByOrderId(parentOrder.getOrderId());
splitMapper.deleteByOrderId(parentOrder.getOrderId()); splitMapper.deleteByOrderId(parentOrder.getOrderId());
// 删除已撤销的拆单 // 删除已撤销的拆单 lanbm 2024-06-05 处理审批流BUG
orderService.deleteOrderByParentOrderId(parentOrder.getOrderId(), orderService.deleteOrderByParentOrderId(parentOrder.getOrderId(),
childrenOrderList); childrenOrderList);
......
package cn.iocoder.yudao.module.shipment.dto; package cn.iocoder.yudao.module.shipment.dto;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -9,55 +10,123 @@ import java.util.Date; ...@@ -9,55 +10,123 @@ import java.util.Date;
@Data @Data
public class LoadDto { public class LoadDto {
/*
序号 0
*/
@ExcelProperty("id") @ExcelProperty("id")
private String id; private String id;
/*
订单号 1
*/
@ExcelProperty("orderNo") @ExcelProperty("orderNo")
private String orderNo; private String orderNo;
/*
唛头 2
*/
@ExcelProperty("marks") @ExcelProperty("marks")
private String marks; private String marks;
/*
获取描述 3
*/
@ExcelProperty("prodTitleZh") @ExcelProperty("prodTitleZh")
private String prodTitleZh; private String prodTitleZh;
/*
数量 4
*/
@ExcelProperty("quantity")
private Integer quantity;
/*
品牌 5
*/
@ExcelProperty("brand") @ExcelProperty("brand")
private String brand; private String brand;
/*
备案 6
*/
@ExcelProperty("productRecord") @ExcelProperty("productRecord")
private String productRecord; private String productRecord;
/*
特性 7
*/
@ExcelProperty("prodAttrIds")
private String prodAttrIds;
/*
总件数 8
*/
@ExcelProperty("sumNum") @ExcelProperty("sumNum")
private Integer sumNum; private Integer sumNum;
/*
单位 9
*/
@ExcelProperty("unit") @ExcelProperty("unit")
private String unit; private String unit;
/*
总体积 10
*/
@ExcelProperty("sumVolume") @ExcelProperty("sumVolume")
private BigDecimal sumVolume; private BigDecimal sumVolume;
/*
总重量 11
*/
@ExcelProperty("sumWeight") @ExcelProperty("sumWeight")
private BigDecimal sumWeight; private BigDecimal sumWeight;
/*
包装类型 12
*/
@ExcelProperty("packageType") @ExcelProperty("packageType")
private String packageType; private String packageType;
/*
材质 13
*/
@ExcelProperty("material") @ExcelProperty("material")
private String material; private String material;
/*
用途 14
*/
@ExcelProperty("usageIds")
private String usageIds;
/*
合单 15
*/
@ExcelProperty("merge") @ExcelProperty("merge")
private String merge; private String merge;
/*
关联订单 16
*/
@ExcelProperty("relateOrder") @ExcelProperty("relateOrder")
private String relateOrder; private String relateOrder;
/*
报关方式 17
*/
@ExcelProperty("customsType") @ExcelProperty("customsType")
private String customsType; private String customsType;
/*
货值 18
*/
@ExcelProperty("worth") @ExcelProperty("worth")
private BigDecimal worth; private BigDecimal worth;
@ExcelProperty("quantity")
private Integer quantity;
} }
...@@ -22,7 +22,9 @@ import cn.iocoder.yudao.module.order.service.order.*; ...@@ -22,7 +22,9 @@ import cn.iocoder.yudao.module.order.service.order.*;
import cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService; import cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService;
import cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInBackItemDo; import cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInBackItemDo;
import cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInBackVO; import cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInBackVO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO;
import cn.iocoder.yudao.module.product.dal.dataobject.productbrank.ProductBrankDO; import cn.iocoder.yudao.module.product.dal.dataobject.productbrank.ProductBrankDO;
import cn.iocoder.yudao.module.product.service.product.ProductAttrService;
import cn.iocoder.yudao.module.product.service.productbrank.ProductBrankService; import cn.iocoder.yudao.module.product.service.productbrank.ProductBrankService;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxApprovalDO; import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxApprovalDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO; import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO;
...@@ -64,6 +66,7 @@ import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.HAVE_NOT ...@@ -64,6 +66,7 @@ import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.HAVE_NOT
/** /**
* 自编号订单excel导出监听 * 自编号订单excel导出监听
* lanbm 2024-06-05 修改模板样式和添加列字段
* *
* @author zhengYi * @author zhengYi
*/ */
...@@ -103,8 +106,8 @@ public class ShipmentLoadExcelExportListener { ...@@ -103,8 +106,8 @@ public class ShipmentLoadExcelExportListener {
@Resource @Resource
private OrderService orderService; private OrderService orderService;
// @Value("${ue.templates-url}") @Resource
// private String path; private ProductAttrService productAttrService;
/** /**
* 订单导出监听 * 订单导出监听
...@@ -112,63 +115,129 @@ public class ShipmentLoadExcelExportListener { ...@@ -112,63 +115,129 @@ public class ShipmentLoadExcelExportListener {
* @param event 编号记录 * @param event 编号记录
*/ */
@EventListener(ShipmentLoadExcelExportPushEvent.class) @EventListener(ShipmentLoadExcelExportPushEvent.class)
public void shipmentLoadExcelExportPushEvent(ShipmentLoadExcelExportPushEvent event) { public void shipmentLoadExcelExportPushEvent(
ShipmentLoadExcelExportPushEvent event) {
if (StringUtils.isNotBlank(event.getRequestParams())) { if (StringUtils.isNotBlank(event.getRequestParams())) {
try { try {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATA_FORMAT); DateTimeFormatter formatter =
DateTimeFormatter.ofPattern(DATA_FORMAT);
String nowTime = formatter.format(LocalDateTime.now()); String nowTime = formatter.format(LocalDateTime.now());
String dir = ueProperties.getTempDir().concat("/load/excel/"); String dir = ueProperties.getTempDir().concat("/load/excel/");
String fileName = event.getUserId().toString().concat(StrUtil.DASHED).concat(event.getUserType().toString()).concat(StrUtil.DASHED).concat(nowTime).concat("shipment_load.xlsx"); String fileName = event.getUserId().
toString().concat(StrUtil.DASHED).
concat(event.getUserType().toString()).
concat(StrUtil.DASHED).concat(nowTime).
concat("shipment_load.xlsx");
InputStream inputStream = null; InputStream inputStream = null;
inputStream = getClass().getClassLoader().getResourceAsStream(ueProperties.getTemplatesUrl() + "/load.xlsx"); //获取模板 2024-06-05 添加注释
inputStream = getClass().getClassLoader().
getResourceAsStream(
ueProperties.getTemplatesUrl() + "/load.xlsx");
Map headMap = new HashMap(); Map headMap = new HashMap();
JSONObject jsonObject = JSONObject.parseObject(event.getRequestParams()); JSONObject jsonObject =
JSONObject.parseObject(event.getRequestParams());
Long shipmentId = jsonObject.getLong("shipmentId"); Long shipmentId = jsonObject.getLong("shipmentId");
List<BoxPreloadGoodsBackVO> goodsItemList = boxPreloadGoodsService.getShipGoodItemList(shipmentId); List<BoxPreloadGoodsBackVO> goodsItemList =
boxPreloadGoodsService.getShipGoodItemList(shipmentId);
if (CollectionUtil.isEmpty(goodsItemList)) { if (CollectionUtil.isEmpty(goodsItemList)) {
event.setResult(HAVE_NOT_PRELOAD_GOODS.getMsg()); event.setResult(HAVE_NOT_PRELOAD_GOODS.getMsg());
} }
BoxDO box = boxService.getBox(shipmentId); BoxDO box = boxService.getBox(shipmentId);
CabinetDO cabinet = cabinetService.getCabinet(box.getCabinetId()); CabinetDO cabinet = cabinetService.getCabinet(box.getCabinetId());
BoxApprovalDO boxApprovalDO = boxApprovalService.getOne(new LambdaQueryWrapperX<BoxApprovalDO>().eq(BoxApprovalDO::getShipmentId, shipmentId).eq(BoxApprovalDO::getApprovalType, 2).last("limit 1")); BoxApprovalDO boxApprovalDO =
boxApprovalService.getOne(
new LambdaQueryWrapperX<BoxApprovalDO>().
eq(BoxApprovalDO::getShipmentId, shipmentId).
eq(BoxApprovalDO::getApprovalType, 2).
last("limit 1"));
headMap.put("selfNo", box.getSelfNo()); headMap.put("selfNo", box.getSelfNo());
headMap.put("ctnNo",box.getCubNo()); headMap.put("ctnNo", box.getCubNo());
if(cabinet != null) { if (cabinet != null) {
headMap.put("cabinetName", cabinet.getName()); headMap.put("cabinetName", cabinet.getName());
} }
headMap.put("exportDate", DateUtils.formatDate(new Date())); headMap.put("exportDate", DateUtils.formatDate(new Date()));
if (boxApprovalDO != null) { if (boxApprovalDO != null) {
headMap.put("date", DateUtils.formatDate(boxApprovalDO.getCreateTime())); headMap.put("date",
DateUtils.formatDate(boxApprovalDO.getCreateTime()));
} }
File fileDir = new File(dir); File fileDir = new File(dir);
if (!fileDir.exists()){ if (!fileDir.exists()) {
// 不存在则创建一个目录 // 不存在则创建一个目录
fileDir.mkdirs(); fileDir.mkdirs();
} }
ExcelWriter excelWriter = EasyExcel.write(dir + fileName).withTemplate(inputStream).build(); //write 写入的文件路径
//withTemplate 使用的模板
ExcelWriter excelWriter =
EasyExcel.write(dir + fileName).
withTemplate(inputStream).build();
WriteSheet sheet = EasyExcel.writerSheet(0).build(); WriteSheet sheet = EasyExcel.writerSheet(0).build();
excelWriter.fill(headMap, sheet); excelWriter.fill(headMap, sheet);
if (box.getLdStatus() != null && box.getLdStatus()>=43) {//43、已装柜、待封柜
//商品属性获取 lanbm 2024-06-05 add
List<ProductAttrDO> ProductAttrList =
productAttrService.getProductAttrList();
Map<Long, String> ProductAttrMap = null;
if (CollectionUtil.isEmpty(ProductAttrList) == false) {
ProductAttrMap = ProductAttrList.stream().
collect(Collectors.toMap(ProductAttrDO::getId,
ProductAttrDO::getAttrName));
}
//end 商品属性获取 lanbm 2024-06-05 add
if (box.getLdStatus() != null && box.getLdStatus() >= 43) {
//43、已装柜、待封柜
//以secId排序 //以secId排序
goodsItemList.sort(Comparator.comparing(BoxPreloadGoodsBackVO::getSecId).thenComparing(BoxPreloadGoodsBackVO::getTidanNum).thenComparing(BoxPreloadGoodsBackVO::getId)); goodsItemList.sort(Comparator.comparing(
BoxPreloadGoodsBackVO::getSecId).
thenComparing(BoxPreloadGoodsBackVO::getTidanNum).
thenComparing(BoxPreloadGoodsBackVO::getId));
int allTotalNum = 0; int allTotalNum = 0;
BigDecimal allTotalVolume = new BigDecimal(0); BigDecimal allTotalVolume = new BigDecimal(0);
BigDecimal allTotalWeight = new BigDecimal(0); BigDecimal allTotalWeight = new BigDecimal(0);
List<Long> secCount = goodsItemList.stream().map(BoxPreloadGoodsBackVO::getSecId).distinct().sorted().collect(Collectors.toList()); List<Long> secCount =
goodsItemList.stream().
map(BoxPreloadGoodsBackVO::getSecId).
distinct().sorted().collect(Collectors.toList());
if (!CollectionUtils.isEmpty(secCount)) { if (!CollectionUtils.isEmpty(secCount)) {
for (int i=0;i<secCount.size();i++){ for (int i = 0; i < secCount.size(); i++) {
List<String> list1 = new ArrayList(); List<String> list1 = new ArrayList();
List<List<String>> headList = new ArrayList<>(); List<List<String>> headList = new ArrayList<>();
String head = ""; String head = "";
if (i == 0) { if (i == 0) {
head = "第"+ NumberUtils.int2chineseNum(i+1) +"部分(Be loaded inside of the container)"; head = "第" + NumberUtils.int2chineseNum(i + 1)
+ "部分(Be loaded inside of the container)";
} else { } else {
head = "第"+NumberUtils.int2chineseNum(i+1)+"部分(after "+ NumberUtils.format(i+1)+" parts)"; head = "第" + NumberUtils.int2chineseNum(i + 1)
+ "部分(after " + NumberUtils.format(i + 1) + " parts)";
} }
list1.add(head); list1.add(head);
headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1);
headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1); headList.add(list1);
headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1);headList.add(list1); headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
headList.add(list1);
List<LoadDto> list = new ArrayList<>(); List<LoadDto> list = new ArrayList<>();
...@@ -176,71 +245,112 @@ public class ShipmentLoadExcelExportListener { ...@@ -176,71 +245,112 @@ public class ShipmentLoadExcelExportListener {
BigDecimal totalVolume = new BigDecimal(0); BigDecimal totalVolume = new BigDecimal(0);
BigDecimal totalWeight = new BigDecimal(0); BigDecimal totalWeight = new BigDecimal(0);
Map<String,Integer> numMap = new HashMap(); Map<String, Integer> numMap = new HashMap();
Long part = secCount.get(i); Long part = secCount.get(i);
//以订单ID分组 //以订单ID分组
Map<Long, List<BoxPreloadGoodsBackVO>> orderMap = goodsItemList.stream().filter(item -> item.getSecId().longValue()==part.longValue() && StringUtils.isNotBlank(item.getWarehouseInInfo())) Map<Long, List<BoxPreloadGoodsBackVO>> orderMap =
.collect(Collectors.groupingBy(BoxPreloadGoodsBackVO::getOrderId,LinkedHashMap::new,Collectors.toList())); goodsItemList.stream().filter(item -> item.getSecId().longValue() == part.longValue() &&
StringUtils.isNotBlank(item.getWarehouseInInfo()))
.collect(Collectors.groupingBy(BoxPreloadGoodsBackVO::getOrderId,
LinkedHashMap::new, Collectors.toList()));
//registerWriteHandler(new XXXStrategy(需要的参数))
//自定义单元格合并策略
WriteTable writeTable = EasyExcel.writerTable(i) WriteTable writeTable = EasyExcel.writerTable(i)
.registerWriteHandler(new CustomMergeStrategy(orderMap,null,null,0,true)) .registerWriteHandler(new CustomMergeStrategy(orderMap, null, null, 0, true))
.registerWriteHandler(new CustomMergeStrategy(orderMap,null,null,1,true)) .registerWriteHandler(new CustomMergeStrategy(orderMap, null, null, 1, true))
.registerWriteHandler(new CustomMergeStrategy(orderMap,null,null,2,true)) .registerWriteHandler(new CustomMergeStrategy(orderMap, null, null, 2, true))
.registerWriteHandler(new CustomMergeStrategy(orderMap,null,null,7,true)) .registerWriteHandler(new CustomMergeStrategy(orderMap, null, null, 7, true))
.registerWriteHandler(new CustomMergeStrategy(orderMap,null,null,10,true)) .registerWriteHandler(new CustomMergeStrategy(orderMap, null, null, 10, true))
.registerWriteHandler(new CustomMergeStrategy(orderMap,null,null,12,true)) .registerWriteHandler(new CustomMergeStrategy(orderMap, null, null, 12, true))
.registerWriteHandler(new CustomMergeStrategy(orderMap,null,null,13,true)) .registerWriteHandler(new CustomMergeStrategy(orderMap, null, null, 13, true))
.registerWriteHandler(new CustomMergeStrategy(orderMap,null,null,14,true)) .registerWriteHandler(new CustomMergeStrategy(orderMap, null, null, 14, true))
.automaticMergeHead(true).head(headList).needHead(true).build(); .automaticMergeHead(true).head(headList).needHead(true).build();
for (Map.Entry<Long, List<BoxPreloadGoodsBackVO>> entry : orderMap.entrySet()) { for (Map.Entry<Long, List<BoxPreloadGoodsBackVO>> entry : orderMap.entrySet()) {
Long orderId = entry.getKey(); Long orderId = entry.getKey();
OrderBackInfoDto orderInfo = orderQueryService.info(orderId); OrderBackInfoDto orderInfo = orderQueryService.info(orderId);
List<BoxPreloadGoodsBackVO> boxPreload = entry.getValue(); List<BoxPreloadGoodsBackVO> boxPreload = entry.getValue();
List<OrderItemDO> orderItems = boxPreload.stream().map(item -> orderItemService.getOrderItem(item.getOrderItemId())).collect(Collectors.toList()); List<OrderItemDO> orderItems =
for(OrderItemDO item : orderItems) { boxPreload.stream().map(item -> orderItemService.
List<OrderWarehouseInDO> orderWarehouseInDOS = orderWarehouseInService.selectList(OrderWarehouseInDO::getOrderItemId, item.getOrderItemId()); getOrderItem(item.getOrderItemId())).
collect(Collectors.toList());
for (OrderItemDO item : orderItems) {
List<OrderWarehouseInDO> orderWarehouseInDOS =
orderWarehouseInService.selectList(
OrderWarehouseInDO::getOrderItemId,
item.getOrderItemId());
LoadDto preloadDto = new LoadDto(); LoadDto preloadDto = new LoadDto();
preloadDto.setOrderNo(orderInfo.getOrderNo()); preloadDto.setOrderNo(orderInfo.getOrderNo());
if (numMap.get(orderInfo.getOrderNo()) != null) { if (numMap.get(orderInfo.getOrderNo()) != null) {
preloadDto.setId(String.valueOf(numMap.get(orderInfo.getOrderNo()))); preloadDto.setId(String.valueOf(numMap.get(orderInfo.getOrderNo())));
} else { } else {
preloadDto.setId(String.valueOf(numMap.size()+1)); preloadDto.setId(String.valueOf(numMap.size() + 1));
numMap.put(orderInfo.getOrderNo(),numMap.size()+1); numMap.put(orderInfo.getOrderNo(), numMap.size() + 1);
} }
preloadDto.setMarks(orderInfo.getMarks()); preloadDto.setMarks(orderInfo.getMarks());
List<OrderGuanlianDO> guanlianList = orderGuanlianService.getGuanlianListByOrderId(orderInfo.getOrderId()); List<OrderGuanlianDO> guanlianList =
orderGuanlianService.getGuanlianListByOrderId(
orderInfo.getOrderId());
//rIdList为此订单的所有关联订单 //rIdList为此订单的所有关联订单
List<Long> rIdList = new ArrayList<>(); List<Long> rIdList = new ArrayList<>();
for (OrderGuanlianDO orderGuanlianDO : guanlianList) { for (OrderGuanlianDO orderGuanlianDO : guanlianList) {
Long oId = orderGuanlianDO.getOrderId(); Long oId = orderGuanlianDO.getOrderId();
Long rId = orderGuanlianDO.getRelateOrderId(); Long rId = orderGuanlianDO.getRelateOrderId();
if(oId.equals(orderId)) { if (oId.equals(orderId)) {
rIdList.add((rId)); rIdList.add((rId));
} else if(rId.equals(orderId)) { } else if (rId.equals(orderId)) {
rIdList.add(oId); rIdList.add(oId);
} }
} }
if (CollectionUtil.isNotEmpty(rIdList)) { if (CollectionUtil.isNotEmpty(rIdList)) {
List<OrderDO> orderDOS = orderService.selectList(OrderDO::getOrderId, rIdList); List<OrderDO> orderDOS =
orderService.selectList(OrderDO::getOrderId, rIdList);
if (CollectionUtil.isNotEmpty(orderDOS)) { if (CollectionUtil.isNotEmpty(orderDOS)) {
preloadDto.setRelateOrder(orderDOS.stream().map(OrderDO::getOrderNo).collect(Collectors.joining(","))); preloadDto.setRelateOrder(orderDOS.stream().map(
OrderDO::getOrderNo).collect(Collectors.joining(",")));
} }
} }
preloadDto.setProdTitleZh(item.getProdTitleZh()+ " " +item.getProdTitleEn()); preloadDto.setProdTitleZh(item.getProdTitleZh() + " " + item.getProdTitleEn());
preloadDto.setMerge(orderInfo.getOldNumbers()); preloadDto.setMerge(orderInfo.getOldNumbers());
ProductBrankDO productBrank = productBrankService.getProductBrank(item.getBrand()); ProductBrankDO productBrank =
if(productBrank!=null && StringUtils.isNotBlank(productBrank.getTitleZh())){ productBrankService.getProductBrank(item.getBrand());
if (productBrank != null && StringUtils.isNotBlank(productBrank.getTitleZh())) {
preloadDto.setBrand(productBrank.getTitleZh()); preloadDto.setBrand(productBrank.getTitleZh());
} }
if(StringUtils.isNotBlank(item.getMaterial())){ //材质
preloadDto.setMaterial(DictFrameworkUtils.getDictDataFromCache("product_material",item.getMaterial()+"").getLabel()); if (StringUtils.isNotBlank(item.getMaterial())) {
preloadDto.setMaterial(
DictFrameworkUtils.getDictDataFromCache("product_material",
item.getMaterial() + "").getLabel());
} }
if(productBrank !=null && productBrank.getFiling()!=null){ //品牌
preloadDto.setProductRecord(productBrank.getFiling().equals("0")? "N":"Y"); if (productBrank != null && productBrank.getFiling() != null) {
preloadDto.setProductRecord(productBrank.getFiling().equals("0") ? "N" : "Y");
}
//用途
if (item.getUsageIds() == null || item.getUsageIds().length() == 0) {
preloadDto.setUsageIds("");
} else {
//在缓存数据字典中获取用途信息
String sUserdName = DictFrameworkUtils.getDictDataFromCache(
"order_item_usage",
item.getUsageIds() + "").getLabel();
preloadDto.setUsageIds(sUserdName);
} }
//商品特性赋值 lanbm 2024-06-05 add
String sR = getAttrName(item, ProductAttrMap);
preloadDto.setProdAttrIds(sR);
preloadDto.setSumNum(item.getWarehouseInInfoVO().getCartonsNum()); preloadDto.setSumNum(item.getWarehouseInInfoVO().getCartonsNum());
if(CollectionUtil.isNotEmpty(orderWarehouseInDOS)){
if (CollectionUtil.isNotEmpty(orderWarehouseInDOS)) {
String warehousingSpecificationType = orderWarehouseInDOS.stream().map(j -> { String warehousingSpecificationType = orderWarehouseInDOS.stream().map(j -> {
return DictFrameworkUtils.getDictDataFromCache("warehousing_specification_type", j.getSpecificationType() + "").getLabel(); return DictFrameworkUtils.getDictDataFromCache("warehousing_specification_type", j.getSpecificationType() + "").getLabel();
}).distinct().collect(Collectors.joining("/")); }).distinct().collect(Collectors.joining("/"));
...@@ -252,8 +362,10 @@ public class ShipmentLoadExcelExportListener { ...@@ -252,8 +362,10 @@ public class ShipmentLoadExcelExportListener {
} }
preloadDto.setSumVolume(item.getWarehouseInInfoVO().getVolume()); preloadDto.setSumVolume(item.getWarehouseInInfoVO().getVolume());
preloadDto.setSumWeight(item.getWarehouseInInfoVO().getWeight()); preloadDto.setSumWeight(item.getWarehouseInInfoVO().getWeight());
if(orderInfo.getCustomsType()!=null){ if (orderInfo.getCustomsType() != null) {
preloadDto.setCustomsType(DictFrameworkUtils.getDictDataFromCache("customs_type",orderInfo.getCustomsType()+"").getLabel()); preloadDto.setCustomsType(
DictFrameworkUtils.getDictDataFromCache("customs_type",
orderInfo.getCustomsType() + "").getLabel());
} }
preloadDto.setWorth(item.getWorth()); preloadDto.setWorth(item.getWorth());
preloadDto.setQuantity(item.getWarehouseInInfoVO().getQuantityAll()); preloadDto.setQuantity(item.getWarehouseInInfoVO().getQuantityAll());
...@@ -272,7 +384,7 @@ public class ShipmentLoadExcelExportListener { ...@@ -272,7 +384,7 @@ public class ShipmentLoadExcelExportListener {
allTotalNum = allTotalNum + totalNum; allTotalNum = allTotalNum + totalNum;
allTotalVolume = allTotalVolume.add(totalVolume); allTotalVolume = allTotalVolume.add(totalVolume);
allTotalWeight = allTotalWeight.add(totalWeight); allTotalWeight = allTotalWeight.add(totalWeight);
if(i==secCount.size()-1){ if (i == secCount.size() - 1) {
LoadDto preloadDto1 = new LoadDto(); LoadDto preloadDto1 = new LoadDto();
preloadDto1.setId("IN TOTAL"); preloadDto1.setId("IN TOTAL");
preloadDto1.setSumNum(allTotalNum); preloadDto1.setSumNum(allTotalNum);
...@@ -280,11 +392,12 @@ public class ShipmentLoadExcelExportListener { ...@@ -280,11 +392,12 @@ public class ShipmentLoadExcelExportListener {
preloadDto1.setSumWeight(allTotalWeight); preloadDto1.setSumWeight(allTotalWeight);
list.add(preloadDto1); list.add(preloadDto1);
} }
excelWriter.write(list,sheet,writeTable); excelWriter.write(list, sheet, writeTable);
} }
} }
} }
excelWriter.finish(); excelWriter.finish();
inputStream.close(); inputStream.close();
// 获取到临时文件 // 获取到临时文件
...@@ -302,14 +415,47 @@ public class ShipmentLoadExcelExportListener { ...@@ -302,14 +415,47 @@ public class ShipmentLoadExcelExportListener {
event.setFileName(fileDO.getPath()); event.setFileName(fileDO.getPath());
event.setUrl(fileDO.getUrl()); event.setUrl(fileDO.getUrl());
event.setFileId(fileDO.getId()); event.setFileId(fileDO.getId());
} catch (Exception e) {
// TODO 测试阶段打印堆栈错误信息,便于分析原因 } catch(Exception e){
e.printStackTrace(); e.printStackTrace();
event.setResult(e.getMessage()); event.setResult(e.getMessage());
} }
} else { } else
{
event.setResult("param fail"); event.setResult("param fail");
} }
}
/*
lanbm 2024-06-05 添加商品属性转换函数
*/
private String getAttrName(OrderItemDO item, Map<Long, String> ProductAttrMap) {
String sReult = "";
//lanbm 2024-06-05添加商品特性
if (item.getProdAttrIds() == null || item.getProdAttrIds().length() == 0) {
return sReult;
} else {
if (ProductAttrMap == null) {
return sReult;
} else {
String sAttrName = "";
List<String> resultList = Arrays.asList(
item.getProdAttrIds().split(","));
for (String sId : resultList
) {
Long l = Long.parseLong(sId);
if (sAttrName.length() != 0) {
sAttrName += "," + ProductAttrMap.get(l);
} else {
sAttrName += ProductAttrMap.get(l);
}
}
sReult = sAttrName;
}
}
//end lanbm 2024-06-05添加商品特性
return sReult;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment