use of com.whoiszxl.dto.PurchaseSettlementOrderDTO in project shopzz by whoiszxl.
the class PurchaseSettlementOrderServiceImpl method createPurchaseSettlementOrder.
@Override
public boolean createPurchaseSettlementOrder(PurchaseOrderDTO purchaseOrderDTO) {
// 1. 将采购入库单的数据填充到采购结算单中
PurchaseSettlementOrderDTO settlementOrderDTO = purchaseOrderDTO.clone(PurchaseSettlementOrderDTO.class);
settlementOrderDTO.setId(null);
settlementOrderDTO.setStatus(null);
settlementOrderDTO.setTotalSettlementAmount(BigDecimal.ZERO);
settlementOrderDTO.setPurchaseOrderId(purchaseOrderDTO.getId());
settlementOrderDTO.setComment("");
// 2. 将采购入库条目信息填充到采购结算条目中
List<PurchaseSettlementOrderItemDTO> items = new ArrayList<>();
for (PurchaseOrderItemDTO purchaseOrderItemDTO : purchaseOrderDTO.getItems()) {
PurchaseSettlementOrderItemDTO item = purchaseOrderItemDTO.clone(PurchaseSettlementOrderItemDTO.class);
item.setId(null);
items.add(item);
}
settlementOrderDTO.setItems(items);
// 3. 将采购结算单与条目新增到数据库
this.savePurchaseSettlementOrderAndItem(settlementOrderDTO);
// 4. 更新采购单的状态为待结算
PurchaseOrderDTO updateParams = purchaseOrderService.getPurchaseOrderById(settlementOrderDTO.getPurchaseOrderId());
purchaseOrderService.updateStatus(updateParams.getId(), PurchaseOrderStatusConstants.WAIT_FOR_SETTLEMENT);
return true;
}
use of com.whoiszxl.dto.PurchaseSettlementOrderDTO in project shopzz by whoiszxl.
the class PurchaseSettlementOrderServiceImpl method getPurchaseSettlementOrderById.
@Override
public PurchaseSettlementOrderDTO getPurchaseSettlementOrderById(Long id) {
// 1. 查询采购结算单
PurchaseSettlementOrder purchaseSettlementOrder = this.getById(id);
PurchaseSettlementOrderDTO purchaseSettlementOrderDTO = purchaseSettlementOrder.clone(PurchaseSettlementOrderDTO.class);
// 2. 查询采购结算单条目
QueryWrapper queryWrapper = new QueryWrapper<PurchaseSettlementOrderItem>();
queryWrapper.eq("purchase_settlement_order_id", id);
List<PurchaseSettlementOrderItem> itemList = purchaseSettlementOrderItemService.list(queryWrapper);
List<PurchaseSettlementOrderItemDTO> purchaseSettlementOrderItemDTOS = BeanCopierUtils.copyListProperties(itemList, PurchaseSettlementOrderItemDTO::new);
purchaseSettlementOrderDTO.setItems(purchaseSettlementOrderItemDTOS);
return purchaseSettlementOrderDTO;
}
Aggregations