增加客户流水
This commit is contained in:
parent
2fbfdf8af2
commit
a3f575b931
|
|
@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import com.ruoyi.common.core.domain.BaseAudit;
|
||||
import lombok.Data;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 客户对象 wms_customer
|
||||
*
|
||||
|
|
@ -28,6 +31,18 @@ public class Customer extends BaseAudit {
|
|||
@Excel(name = "客户名称")
|
||||
private String customerName;
|
||||
|
||||
@ApiModelProperty("开户行")
|
||||
@Excel(name = "开户行")
|
||||
private String bankName;
|
||||
|
||||
@ApiModelProperty("银行卡号")
|
||||
@Excel(name = "银行卡号")
|
||||
private String bankAccount;
|
||||
|
||||
@ApiModelProperty("应付款")
|
||||
@Excel(name = "应付款")
|
||||
private BigDecimal receivableAmount;
|
||||
|
||||
@ApiModelProperty("客户地址")
|
||||
@Excel(name = "客户地址")
|
||||
private String address;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.cyl.wms.pojo.dto;
|
|||
|
||||
import com.ruoyi.common.core.domain.BaseAudit;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 客户 DTO 对象
|
||||
*
|
||||
|
|
@ -12,6 +15,9 @@ public class CustomerDTO extends BaseAudit {
|
|||
private Long id;
|
||||
private String customerNo;
|
||||
private String customerName;
|
||||
private String bankName;
|
||||
private String bankAccount;
|
||||
private BigDecimal receivableAmount;
|
||||
private String address;
|
||||
private String mobile;
|
||||
private String tel;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.cyl.wms.pojo.vo.form.ShipmentOrderFrom;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -65,6 +66,8 @@ public class ShipmentOrderService {
|
|||
private InventoryHistoryService inventoryHistoryService;
|
||||
@Autowired
|
||||
private InventoryService inventoryService;
|
||||
@Autowired
|
||||
private CustomerTransactionService customerTransactionService;
|
||||
|
||||
/**
|
||||
* 查询出库单
|
||||
|
|
@ -198,6 +201,8 @@ public class ShipmentOrderService {
|
|||
order.setCreateTime(LocalDateTime.now());
|
||||
res = shipmentOrderMapper.insert(order);
|
||||
saveDetails(order.getId(), order.getDetails());
|
||||
//保存订单金额到客户流水表
|
||||
saveOrUpdatePayAmount(order);
|
||||
return res;
|
||||
}
|
||||
// 2. 编辑
|
||||
|
|
@ -259,6 +264,9 @@ public class ShipmentOrderService {
|
|||
shipmentOrderDetailMapper.delete(qw);
|
||||
saveDetails(order.getId(), order.getDetails());
|
||||
|
||||
//保存订单金额到客户流水表
|
||||
saveOrUpdatePayAmount(order);
|
||||
|
||||
// 2.2 更新出库单
|
||||
//判断出库单的整体状态
|
||||
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) {
|
||||
if (!CollUtil.isEmpty(details)) {
|
||||
details.forEach(it -> it.setShipmentOrderId(orderId));
|
||||
|
|
|
|||
Loading…
Reference in New Issue