Commit 7df404b7 authored by 陈 挺's avatar 陈 挺
Browse files

【销售台账】销售报表,借货订单的采购出现过转售的采购订单号单元格数据会显示为空

No related merge requests found
Pipeline #12951 passed with stages
in 12 minutes and 51 seconds
Showing with 38 additions and 0 deletions
+38 -0
......@@ -539,7 +539,14 @@ public class FinancialLedgerServiceImpl extends ServiceImpl<FinancialLedgerDao,
String orderNo = originalOrder.stream().map(Orders::getOrderNo).collect(Collectors.joining(","));
excel.setOrderNo(orderNo);
buyOrder = BeanUtil.copyProperties(originalOrder.get(0), OrdersDTO.class);
}else{
Orders orders = ordersService.recurseOriginalOrder(order.getOrderId());
if(Objects.nonNull(orders)){
excel.setOrderNo(orders.getOrderNo());
buyOrder = BeanUtil.copyProperties(orders,OrdersDTO.class);
}
}
// 计算买出售一笔所还的保证金
BigDecimal bondPrice = BigDecimal.ZERO;
if (buyOrder != null) {
......@@ -552,6 +559,8 @@ public class FinancialLedgerServiceImpl extends ServiceImpl<FinancialLedgerDao,
bondPrice = MoneyUtil.divide(bondAmount, buyOrder.getNum());
}
}
excel.setSellOrderNo(ordersDTO.getOrderNo());
// 缩写获取
List<GoodsProduct> collect = list.stream().filter(n -> n.getGoodsProductId().equals(ordersDTO.getGoodsProductId())).collect(Collectors.toList());
......
......@@ -1049,5 +1049,12 @@ public interface OrdersService extends IService<Orders> {
* @return
*/
List<String> batchNoTicketMark(OrdersTicketDTO dto);
/**
* 多级订单递归查找一个原始采购单
* @param orderId
* @return
*/
Orders recurseOriginalOrder(String orderId);
}
......@@ -10,6 +10,7 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
......@@ -1378,6 +1379,27 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
return notMarkOrderNos;
}
@Override
public Orders recurseOriginalOrder(String orderId) {
List<OrderRelation> list = orderRelationService.list(new LambdaQueryWrapper<OrderRelation>().eq(OrderRelation::getAfterOrderId, orderId));
if (CollectionUtils.isNotEmpty(list)) {
OrderRelation relation = list.get(0);
String orderIds = relation.getOriginalOrderId();
String preOrderId = relation.getPreOrderId();
String afterOrderId = relation.getAfterOrderId();
if (StringUtils.isBlank(orderIds)) {
return recurseOriginalOrder(preOrderId);
} else if (preOrderId.equals(afterOrderId)) {
return null;
} else {
String[] split = orderIds.split(",");
orderId = split[0];
return getById(orderId);
}
}
return null;
}
@Override
public List<OilTransferVO> oilTransferList(OilTransferDTO oilTransferDTO) {
return this.baseMapper.oilTransferList(oilTransferDTO);
......
Supports Markdown
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