增加客户流水

This commit is contained in:
chuzhichao 2023-05-04 19:03:44 +08:00
parent 2fbfdf8af2
commit a3f575b931
3 changed files with 46 additions and 0 deletions

View File

@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModelProperty;
import com.ruoyi.common.core.domain.BaseAudit; import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data; import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
/** /**
* 客户对象 wms_customer * 客户对象 wms_customer
* *
@ -28,6 +31,18 @@ public class Customer extends BaseAudit {
@Excel(name = "客户名称") @Excel(name = "客户名称")
private String customerName; private String customerName;
@ApiModelProperty("开户行")
@Excel(name = "开户行")
private String bankName;
@ApiModelProperty("银行卡号")
@Excel(name = "银行卡号")
private String bankAccount;
@ApiModelProperty("应付款")
@Excel(name = "应付款")
private BigDecimal receivableAmount;
@ApiModelProperty("客户地址") @ApiModelProperty("客户地址")
@Excel(name = "客户地址") @Excel(name = "客户地址")
private String address; private String address;

View File

@ -2,6 +2,9 @@ package com.cyl.wms.pojo.dto;
import com.ruoyi.common.core.domain.BaseAudit; import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
/** /**
* 客户 DTO 对象 * 客户 DTO 对象
* *
@ -12,6 +15,9 @@ public class CustomerDTO extends BaseAudit {
private Long id; private Long id;
private String customerNo; private String customerNo;
private String customerName; private String customerName;
private String bankName;
private String bankAccount;
private BigDecimal receivableAmount;
private String address; private String address;
private String mobile; private String mobile;
private String tel; private String tel;

View File

@ -23,6 +23,7 @@ import com.cyl.wms.pojo.vo.form.ShipmentOrderFrom;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -65,6 +66,8 @@ public class ShipmentOrderService {
private InventoryHistoryService inventoryHistoryService; private InventoryHistoryService inventoryHistoryService;
@Autowired @Autowired
private InventoryService inventoryService; private InventoryService inventoryService;
@Autowired
private CustomerTransactionService customerTransactionService;
/** /**
* 查询出库单 * 查询出库单
@ -198,6 +201,8 @@ public class ShipmentOrderService {
order.setCreateTime(LocalDateTime.now()); order.setCreateTime(LocalDateTime.now());
res = shipmentOrderMapper.insert(order); res = shipmentOrderMapper.insert(order);
saveDetails(order.getId(), order.getDetails()); saveDetails(order.getId(), order.getDetails());
//保存订单金额到客户流水表
saveOrUpdatePayAmount(order);
return res; return res;
} }
// 2. 编辑 // 2. 编辑
@ -259,6 +264,9 @@ public class ShipmentOrderService {
shipmentOrderDetailMapper.delete(qw); shipmentOrderDetailMapper.delete(qw);
saveDetails(order.getId(), order.getDetails()); saveDetails(order.getId(), order.getDetails());
//保存订单金额到客户流水表
saveOrUpdatePayAmount(order);
// 2.2 更新出库单 // 2.2 更新出库单
//判断出库单的整体状态 //判断出库单的整体状态
Set<Integer> statusList = order.getDetails().stream().map(it -> it.getShipmentOrderStatus()).collect(Collectors.toSet()); Set<Integer> statusList = order.getDetails().stream().map(it -> it.getShipmentOrderStatus()).collect(Collectors.toSet());
@ -272,6 +280,23 @@ public class ShipmentOrderService {
} }
/**
* 保存订单金额到用户流水表
*
* @param shipmentOrder 出库单
*/
private void saveOrUpdatePayAmount(ShipmentOrder shipmentOrder) {
//todo 更换用户
//todo 删除出库单
CustomerTransaction customerTransaction = new CustomerTransaction();
customerTransaction.setCustomerId(String.valueOf(shipmentOrder.getCustomerId()));
customerTransaction.setTransactionType(CustomerTransaction.SHIPMENT);
customerTransaction.setTransactionAmount(shipmentOrder.getReceivableAmount());
customerTransaction.setShipmentOrderId(shipmentOrder.getId().intValue());
customerTransaction.setTransactionCode("TS-" + DateUtils.randomId());
customerTransactionService.insert(customerTransaction);
}
private void saveDetails(Long orderId, List<ShipmentOrderDetailVO> details) { private void saveDetails(Long orderId, List<ShipmentOrderDetailVO> details) {
if (!CollUtil.isEmpty(details)) { if (!CollUtil.isEmpty(details)) {
details.forEach(it -> it.setShipmentOrderId(orderId)); details.forEach(it -> it.setShipmentOrderId(orderId));