Skip to content

Commit

Permalink
Merge pull request #208 from Jzow/master
Browse files Browse the repository at this point in the history
Add shipments and storage summary api and views
  • Loading branch information
Jzow authored Nov 20, 2023
2 parents cdc2064 + 61dbda4 commit cd86ffb
Show file tree
Hide file tree
Showing 13 changed files with 785 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Builder
Expand All @@ -39,8 +40,11 @@ public class ShipmentsSummaryVO {

private String productUnit;

private Integer ShipmentsNumber;
private Integer shipmentsNumber;

@JsonSerialize(using = BigDecimalSerializerBO.class)
private BigDecimal ShipmentsAmount;
private BigDecimal shipmentsAmount;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Builder
Expand All @@ -43,4 +44,7 @@ public class StorageSummaryVO {

@JsonSerialize(using = BigDecimalSerializerBO.class)
private BigDecimal storageAmount;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public interface CommonService {

String getProductName(Long productId);

String getProductCategoryName(Long productCategoryId);

String getWarehouseName(Long warehouseId);

String getMemberName(Long memberId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.tencentcloudapi.sms.v20190711.SmsClient;
import com.tencentcloudapi.sms.v20190711.models.SendSmsRequest;
import com.wansenai.bo.FileDataBO;
import com.wansenai.entities.product.ProductCategory;
import com.wansenai.entities.warehouse.Warehouse;
import com.wansenai.mappers.system.SysFileMapper;
import com.wansenai.service.BaseService;
Expand Down Expand Up @@ -728,6 +729,13 @@ public String getProductName(Long productId) {
.orElse(NullString);
}

@Override
public String getProductCategoryName(Long productCategoryId) {
return Optional.ofNullable(productCategoryService.getById(productCategoryId))
.map(ProductCategory::getCategoryName)
.orElse(NullString);
}

@Override
public String getWarehouseName(Long warehouseId) {
return Optional.ofNullable(warehouseService.getById(warehouseId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ public Response<String> addOrUpdatePurchaseOrder(PurchaseOrderDTO purchaseOrderD
.taxIncludedAmount(item.getTaxTotalPrice())
.remark(item.getRemark())
.updateBy(userId)
.createTime(LocalDateTime.now())
.updateTime(LocalDateTime.now())
.build())
.collect(Collectors.toList());
Expand Down Expand Up @@ -702,6 +703,7 @@ public Response<String> addOrUpdatePurchaseStorage(PurchaseStorageDTO purchaseSt
.taxAmount(item.getTaxAmount())
.taxIncludedAmount(item.getTaxTotalPrice())
.updateBy(userId)
.createTime(LocalDateTime.now())
.updateTime(LocalDateTime.now())
.build())
.collect(Collectors.toList());
Expand Down Expand Up @@ -1005,6 +1007,7 @@ public Response<String> addOrUpdatePurchaseRefund(PurchaseRefundDTO purchaseRefu
.taxAmount(item.getTaxAmount())
.taxIncludedAmount(item.getTaxTotalPrice())
.updateBy(userId)
.createTime(LocalDateTime.now())
.updateTime(LocalDateTime.now())
.build())
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ public Response<String> addOrUpdateRetailShipments(RetailShipmentsDTO shipmentsD
.productBarcode(item.getBarCode())
.warehouseId(item.getWarehouseId())
.updateBy(userId)
.createTime(LocalDateTime.now())
.updateTime(LocalDateTime.now())
.build())
.collect(Collectors.toList());
Expand Down Expand Up @@ -650,6 +651,7 @@ public Response<String> addOrUpdateRetailRefund(RetailRefundDTO refundDTO) {
.productBarcode(item.getBarCode())
.warehouseId(item.getWarehouseId())
.updateBy(userId)
.createTime(LocalDateTime.now())
.updateTime(LocalDateTime.now())
.build())
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ public Response<String> addOrUpdateSaleShipments(SaleShipmentsDTO shipmentsDTO)
.taxAmount(item.getTaxAmount())
.taxIncludedAmount(item.getTaxTotalPrice())
.updateBy(userId)
.createTime(LocalDateTime.now())
.updateTime(LocalDateTime.now())
.build())
.collect(Collectors.toList());
Expand All @@ -718,11 +719,9 @@ public Response<String> addOrUpdateSaleShipments(SaleShipmentsDTO shipmentsDTO)
var accountBalance = account.getCurrentAmount();
var thisCollectAmount = shipmentsDTO.getThisCollectAmount();
var beforeChangeAmount = beforeReceipt.stream()
.map(item -> item.getTotalAmount())
.map(ReceiptSaleSub::getTotalAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
if (beforeChangeAmount != null) {
accountBalance = accountBalance.subtract(beforeChangeAmount);
}
accountBalance = accountBalance.subtract(beforeChangeAmount);
if (thisCollectAmount != null) {
accountBalance = accountBalance.add(thisCollectAmount);
}
Expand Down Expand Up @@ -1010,6 +1009,7 @@ public Response<String> addOrUpdateSaleRefund(SaleRefundDTO refundDTO) {
.taxAmount(item.getTaxAmount())
.taxIncludedAmount(item.getTaxTotalPrice())
.updateBy(userId)
.createTime(LocalDateTime.now())
.updateTime(LocalDateTime.now())
.build())
.collect(Collectors.toList());
Expand Down
Loading

0 comments on commit cd86ffb

Please sign in to comment.