增加应收应付中间表
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
package com.ruoyi.price.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** 应收主表 prc_income_bill(与 prc_order_bill 一对一) */
|
||||||
|
@Data
|
||||||
|
public class PrcIncomeBill implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 应收主表ID */
|
||||||
|
private String incomeBillId;
|
||||||
|
/** 计费订单ID */
|
||||||
|
private String billId;
|
||||||
|
/** 币种 */
|
||||||
|
private String currency;
|
||||||
|
/** 产品价合计 */
|
||||||
|
private BigDecimal productAmount;
|
||||||
|
/** 红线价合计 */
|
||||||
|
private BigDecimal redlineAmount;
|
||||||
|
/** 销售价合计(当前计费结果) */
|
||||||
|
private BigDecimal salesAmount;
|
||||||
|
/** 应收合计(当前等于销售价) */
|
||||||
|
private BigDecimal incomeTotal;
|
||||||
|
/** 业务员/销售员 */
|
||||||
|
private String belongSaler;
|
||||||
|
/** 销售员编码 */
|
||||||
|
private String belongSalerCode;
|
||||||
|
/** 结算员 */
|
||||||
|
private String settlementMan;
|
||||||
|
/** 结算员编码 */
|
||||||
|
private String settlementManCode;
|
||||||
|
private String createBy;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
private String updateBy;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import java.util.Date;
|
|||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/** receivable fee detail prc_income_bill_fee */
|
/** 应收费用明细 prc_income_bill_fee */
|
||||||
@Data
|
@Data
|
||||||
public class PrcIncomeBillFee implements Serializable
|
public class PrcIncomeBillFee implements Serializable
|
||||||
{
|
{
|
||||||
@@ -14,6 +14,8 @@ public class PrcIncomeBillFee implements Serializable
|
|||||||
|
|
||||||
private String feeId;
|
private String feeId;
|
||||||
private String billId;
|
private String billId;
|
||||||
|
/** 应收主表ID */
|
||||||
|
private String incomeBillId;
|
||||||
private String feeType;
|
private String feeType;
|
||||||
private String feeName;
|
private String feeName;
|
||||||
private Long scId;
|
private Long scId;
|
||||||
|
|||||||
@@ -29,8 +29,12 @@ public class PrcOrderBill extends BaseEntity
|
|||||||
private List<String> transferNos;
|
private List<String> transferNos;
|
||||||
/** 所属销售员 */
|
/** 所属销售员 */
|
||||||
private String belongSaler;
|
private String belongSaler;
|
||||||
|
/** 销售员编码 */
|
||||||
|
private String belongSalerCode;
|
||||||
/** 结算员 */
|
/** 结算员 */
|
||||||
private String settlementMan;
|
private String settlementMan;
|
||||||
|
/** 结算员编码 */
|
||||||
|
private String settlementManCode;
|
||||||
/** 客服员 */
|
/** 客服员 */
|
||||||
private String serviceMan;
|
private String serviceMan;
|
||||||
private Long customerId;
|
private Long customerId;
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.ruoyi.price.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** 应付主表 prc_pay_bill(与 prc_order_bill 一对一) */
|
||||||
|
@Data
|
||||||
|
public class PrcPayBill implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 应付主表ID */
|
||||||
|
private String payBillId;
|
||||||
|
/** 计费订单ID */
|
||||||
|
private String billId;
|
||||||
|
/** 币种 */
|
||||||
|
private String currency;
|
||||||
|
/** 产品价合计 */
|
||||||
|
private BigDecimal productAmount;
|
||||||
|
/** 红线价合计 */
|
||||||
|
private BigDecimal redlineAmount;
|
||||||
|
/** 成本价合计(当前计费结果) */
|
||||||
|
private BigDecimal costAmount;
|
||||||
|
/** 应付合计(当前等于成本价) */
|
||||||
|
private BigDecimal payTotal;
|
||||||
|
/** 业务员/销售员 */
|
||||||
|
private String belongSaler;
|
||||||
|
/** 销售员编码 */
|
||||||
|
private String belongSalerCode;
|
||||||
|
/** 结算员 */
|
||||||
|
private String settlementMan;
|
||||||
|
/** 结算员编码 */
|
||||||
|
private String settlementManCode;
|
||||||
|
private String createBy;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
private String updateBy;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import java.util.Date;
|
|||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/** payable fee detail prc_pay_bill_fee */
|
/** 应付费用明细 prc_pay_bill_fee */
|
||||||
@Data
|
@Data
|
||||||
public class PrcPayBillFee implements Serializable
|
public class PrcPayBillFee implements Serializable
|
||||||
{
|
{
|
||||||
@@ -14,6 +14,8 @@ public class PrcPayBillFee implements Serializable
|
|||||||
|
|
||||||
private String feeId;
|
private String feeId;
|
||||||
private String billId;
|
private String billId;
|
||||||
|
/** 应付主表ID */
|
||||||
|
private String payBillId;
|
||||||
private String feeType;
|
private String feeType;
|
||||||
private String feeName;
|
private String feeName;
|
||||||
private Long scId;
|
private Long scId;
|
||||||
|
|||||||
@@ -25,8 +25,12 @@ public class TmsPriceBillRequest extends TmsPriceQuoteRequest
|
|||||||
private String transferNo;
|
private String transferNo;
|
||||||
/** 所属销售员 */
|
/** 所属销售员 */
|
||||||
private String belongSaler;
|
private String belongSaler;
|
||||||
|
/** 销售员编码 */
|
||||||
|
private String belongSalerCode;
|
||||||
/** 结算员 */
|
/** 结算员 */
|
||||||
private String settlementMan;
|
private String settlementMan;
|
||||||
|
/** 结算员编码 */
|
||||||
|
private String settlementManCode;
|
||||||
/** 客服员 */
|
/** 客服员 */
|
||||||
private String serviceMan;
|
private String serviceMan;
|
||||||
private String customerName;
|
private String customerName;
|
||||||
|
|||||||
@@ -77,8 +77,12 @@ public class TmsPriceQuoteResult implements Serializable
|
|||||||
private String transferNo;
|
private String transferNo;
|
||||||
/** 所属销售员 */
|
/** 所属销售员 */
|
||||||
private String belongSaler;
|
private String belongSaler;
|
||||||
|
/** 销售员编码 */
|
||||||
|
private String belongSalerCode;
|
||||||
/** 结算员 */
|
/** 结算员 */
|
||||||
private String settlementMan;
|
private String settlementMan;
|
||||||
|
/** 结算员编码 */
|
||||||
|
private String settlementManCode;
|
||||||
/** 客服员 */
|
/** 客服员 */
|
||||||
private String serviceMan;
|
private String serviceMan;
|
||||||
private String customerCode;
|
private String customerCode;
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.price.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.price.domain.PrcIncomeBill;
|
||||||
|
|
||||||
|
/** prc_income_bill mapper */
|
||||||
|
public interface PrcIncomeBillMapper
|
||||||
|
{
|
||||||
|
PrcIncomeBill selectByBillId(String billId);
|
||||||
|
|
||||||
|
PrcIncomeBill selectByIncomeBillId(String incomeBillId);
|
||||||
|
|
||||||
|
int insertPrcIncomeBill(PrcIncomeBill row);
|
||||||
|
|
||||||
|
int updatePrcIncomeBill(PrcIncomeBill row);
|
||||||
|
|
||||||
|
int upsertPrcIncomeBill(PrcIncomeBill row);
|
||||||
|
|
||||||
|
int deleteByBillId(String billId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.price.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.price.domain.PrcPayBill;
|
||||||
|
|
||||||
|
/** prc_pay_bill mapper */
|
||||||
|
public interface PrcPayBillMapper
|
||||||
|
{
|
||||||
|
PrcPayBill selectByBillId(String billId);
|
||||||
|
|
||||||
|
PrcPayBill selectByPayBillId(String payBillId);
|
||||||
|
|
||||||
|
int insertPrcPayBill(PrcPayBill row);
|
||||||
|
|
||||||
|
int updatePrcPayBill(PrcPayBill row);
|
||||||
|
|
||||||
|
int upsertPrcPayBill(PrcPayBill row);
|
||||||
|
|
||||||
|
int deleteByBillId(String billId);
|
||||||
|
}
|
||||||
@@ -27,7 +27,9 @@ public class OracleOrderBillMapper
|
|||||||
req.setTrackingNo(firstStr(row, "ORG_ORDER_ID", "TRACK_ID", "BARCODE_NUMBER", "CUSTOMER_TRACK_ID"));
|
req.setTrackingNo(firstStr(row, "ORG_ORDER_ID", "TRACK_ID", "BARCODE_NUMBER", "CUSTOMER_TRACK_ID"));
|
||||||
req.setTransferNo(firstStr(row, "TRANSFER_ORDER_ID"));
|
req.setTransferNo(firstStr(row, "TRANSFER_ORDER_ID"));
|
||||||
req.setBelongSaler(firstStr(row, "BELONG_SALER_OLD"));
|
req.setBelongSaler(firstStr(row, "BELONG_SALER_OLD"));
|
||||||
|
req.setBelongSalerCode(firstStr(row, "BELONG_SALER_CODE", "SALER_CODE"));
|
||||||
req.setSettlementMan(firstStr(row, "SETTLEMENT_MAN_OLD"));
|
req.setSettlementMan(firstStr(row, "SETTLEMENT_MAN_OLD"));
|
||||||
|
req.setSettlementManCode(firstStr(row, "SETTLEMENT_MAN_CODE", "SETTLEMENT_CODE"));
|
||||||
req.setServiceMan(firstStr(row, "SERVICE_MAN_OLD"));
|
req.setServiceMan(firstStr(row, "SERVICE_MAN_OLD"));
|
||||||
req.setUpstreamRow(row);
|
req.setUpstreamRow(row);
|
||||||
req.setCustomerCode(firstStr(row, "CUSTOMER_CODE"));
|
req.setCustomerCode(firstStr(row, "CUSTOMER_CODE"));
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ import com.ruoyi.price.domain.PrcOrderBill;
|
|||||||
import com.ruoyi.price.domain.vo.TmsPriceBillRequest;
|
import com.ruoyi.price.domain.vo.TmsPriceBillRequest;
|
||||||
import com.ruoyi.price.domain.vo.TmsPriceQuoteResult;
|
import com.ruoyi.price.domain.vo.TmsPriceQuoteResult;
|
||||||
|
|
||||||
/** Order billing: persist prc_order_bill + prc_income_bill_fee. Same price match as quote. */
|
/** 订单计费:落库 prc_order_bill + prc_income_bill/+fee + prc_pay_bill/+fee。 */
|
||||||
public interface IPrcOrderBillService
|
public interface IPrcOrderBillService
|
||||||
{
|
{
|
||||||
TmsPriceQuoteResult bill(TmsPriceBillRequest request);
|
TmsPriceQuoteResult bill(TmsPriceBillRequest request);
|
||||||
|
|||||||
+128
-5
@@ -20,9 +20,11 @@ import com.ruoyi.common.exception.ServiceException;
|
|||||||
import com.ruoyi.common.utils.MessageUtils;
|
import com.ruoyi.common.utils.MessageUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.sign.Md5Utils;
|
import com.ruoyi.common.utils.sign.Md5Utils;
|
||||||
|
import com.ruoyi.price.domain.PrcIncomeBill;
|
||||||
import com.ruoyi.price.domain.PrcIncomeBillFee;
|
import com.ruoyi.price.domain.PrcIncomeBillFee;
|
||||||
import com.ruoyi.price.domain.PrcOrderBill;
|
import com.ruoyi.price.domain.PrcOrderBill;
|
||||||
import com.ruoyi.price.domain.PrcOrderBillExt;
|
import com.ruoyi.price.domain.PrcOrderBillExt;
|
||||||
|
import com.ruoyi.price.domain.PrcPayBill;
|
||||||
import com.ruoyi.price.domain.PrcPayBillFee;
|
import com.ruoyi.price.domain.PrcPayBillFee;
|
||||||
import com.ruoyi.price.domain.vo.TmsPriceBillRequest;
|
import com.ruoyi.price.domain.vo.TmsPriceBillRequest;
|
||||||
import com.ruoyi.price.domain.vo.TmsPriceQuoteFeeLine;
|
import com.ruoyi.price.domain.vo.TmsPriceQuoteFeeLine;
|
||||||
@@ -30,9 +32,11 @@ import com.ruoyi.price.domain.vo.TmsPriceQuoteResult;
|
|||||||
import com.ruoyi.price.enums.BillCreditArrearsStatus;
|
import com.ruoyi.price.enums.BillCreditArrearsStatus;
|
||||||
import com.ruoyi.price.enums.BillCustomerActiveStatus;
|
import com.ruoyi.price.enums.BillCustomerActiveStatus;
|
||||||
import com.ruoyi.price.mapper.PrcIncomeBillFeeMapper;
|
import com.ruoyi.price.mapper.PrcIncomeBillFeeMapper;
|
||||||
|
import com.ruoyi.price.mapper.PrcIncomeBillMapper;
|
||||||
import com.ruoyi.price.mapper.PrcOrderBillExtMapper;
|
import com.ruoyi.price.mapper.PrcOrderBillExtMapper;
|
||||||
import com.ruoyi.price.mapper.PrcOrderBillMapper;
|
import com.ruoyi.price.mapper.PrcOrderBillMapper;
|
||||||
import com.ruoyi.price.mapper.PrcPayBillFeeMapper;
|
import com.ruoyi.price.mapper.PrcPayBillFeeMapper;
|
||||||
|
import com.ruoyi.price.mapper.PrcPayBillMapper;
|
||||||
import com.ruoyi.price.oracle.OracleOrderBillExtFiller;
|
import com.ruoyi.price.oracle.OracleOrderBillExtFiller;
|
||||||
import com.ruoyi.price.search.EsBizLogSupport;
|
import com.ruoyi.price.search.EsBizLogSupport;
|
||||||
import com.ruoyi.price.search.EsLogType;
|
import com.ruoyi.price.search.EsLogType;
|
||||||
@@ -59,9 +63,15 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PrcIncomeBillFeeMapper incomeBillFeeMapper;
|
private PrcIncomeBillFeeMapper incomeBillFeeMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PrcIncomeBillMapper incomeBillMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PrcPayBillFeeMapper payBillFeeMapper;
|
private PrcPayBillFeeMapper payBillFeeMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PrcPayBillMapper payBillMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBillSearchStore billSearchStore;
|
private IBillSearchStore billSearchStore;
|
||||||
|
|
||||||
@@ -220,7 +230,9 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
|||||||
bill.setTrackingNo(request.getTrackingNo());
|
bill.setTrackingNo(request.getTrackingNo());
|
||||||
bill.setTransferNo(request.getTransferNo());
|
bill.setTransferNo(request.getTransferNo());
|
||||||
bill.setBelongSaler(request.getBelongSaler());
|
bill.setBelongSaler(request.getBelongSaler());
|
||||||
|
bill.setBelongSalerCode(request.getBelongSalerCode());
|
||||||
bill.setSettlementMan(request.getSettlementMan());
|
bill.setSettlementMan(request.getSettlementMan());
|
||||||
|
bill.setSettlementManCode(request.getSettlementManCode());
|
||||||
bill.setServiceMan(request.getServiceMan());
|
bill.setServiceMan(request.getServiceMan());
|
||||||
String customerActiveStatus = result == null ? null : result.getCustomerActiveStatus();
|
String customerActiveStatus = result == null ? null : result.getCustomerActiveStatus();
|
||||||
if (StringUtils.isEmpty(customerActiveStatus))
|
if (StringUtils.isEmpty(customerActiveStatus))
|
||||||
@@ -296,16 +308,26 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
|||||||
{
|
{
|
||||||
orderBillMapper.updatePrcOrderBill(bill);
|
orderBillMapper.updatePrcOrderBill(bill);
|
||||||
incomeBillFeeMapper.deleteByBillId(bill.getBillId());
|
incomeBillFeeMapper.deleteByBillId(bill.getBillId());
|
||||||
|
payBillFeeMapper.deleteByBillId(bill.getBillId());
|
||||||
}
|
}
|
||||||
List<PrcIncomeBillFee> fees = toFeeRows(bill.getBillId(), result);
|
PrcIncomeBill incomeBill = persistIncomeBill(bill);
|
||||||
|
List<PrcIncomeBillFee> fees = toFeeRows(bill.getBillId(),
|
||||||
|
incomeBill == null ? null : incomeBill.getIncomeBillId(), result);
|
||||||
if (!fees.isEmpty())
|
if (!fees.isEmpty())
|
||||||
{
|
{
|
||||||
incomeBillFeeMapper.insertBatch(fees);
|
incomeBillFeeMapper.insertBatch(fees);
|
||||||
}
|
}
|
||||||
String syncJson = toRequestJson(request);
|
PrcPayBill payBill = persistPayBill(bill);
|
||||||
|
List<PrcPayBillFee> payFees = toPayFeeRows(bill.getBillId(),
|
||||||
|
payBill == null ? null : payBill.getPayBillId(), result);
|
||||||
|
if (!payFees.isEmpty())
|
||||||
|
{
|
||||||
|
payBillFeeMapper.insertBatch(payFees);
|
||||||
|
}
|
||||||
|
String requestJson = toRequestJson(request);
|
||||||
persistBillExt(bill, request.getUpstreamRow());
|
persistBillExt(bill, request.getUpstreamRow());
|
||||||
result.setRequestJson(syncJson);
|
result.setRequestJson(requestJson);
|
||||||
billSearchStore.save(EsLogType.BILL, orderNo, syncJson, toResponseJson(result));
|
billSearchStore.save(EsLogType.BILL, orderNo, requestJson, toResponseJson(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -472,7 +494,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
|||||||
return v == null ? BigDecimal.ZERO : v;
|
return v == null ? BigDecimal.ZERO : v;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<PrcIncomeBillFee> toFeeRows(String billId, TmsPriceQuoteResult result)
|
private List<PrcIncomeBillFee> toFeeRows(String billId, String incomeBillId, TmsPriceQuoteResult result)
|
||||||
{
|
{
|
||||||
List<PrcIncomeBillFee> fees = new ArrayList<PrcIncomeBillFee>();
|
List<PrcIncomeBillFee> fees = new ArrayList<PrcIncomeBillFee>();
|
||||||
if (result.getFeeDetails() == null)
|
if (result.getFeeDetails() == null)
|
||||||
@@ -484,6 +506,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
|||||||
PrcIncomeBillFee fee = new PrcIncomeBillFee();
|
PrcIncomeBillFee fee = new PrcIncomeBillFee();
|
||||||
fee.setFeeId(UUID.randomUUID().toString());
|
fee.setFeeId(UUID.randomUUID().toString());
|
||||||
fee.setBillId(billId);
|
fee.setBillId(billId);
|
||||||
|
fee.setIncomeBillId(incomeBillId);
|
||||||
fee.setFeeType(line.getFeeType());
|
fee.setFeeType(line.getFeeType());
|
||||||
fee.setFeeName(line.getFeeName());
|
fee.setFeeName(line.getFeeName());
|
||||||
fee.setScId(line.getScId() == null ? 0L : line.getScId());
|
fee.setScId(line.getScId() == null ? 0L : line.getScId());
|
||||||
@@ -496,6 +519,104 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
|||||||
return fees;
|
return fees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 应收主表与订单计费一对一落库;当前写入销售价/应收合计,产品价/红线价预留。 */
|
||||||
|
private PrcIncomeBill persistIncomeBill(PrcOrderBill bill)
|
||||||
|
{
|
||||||
|
if (bill == null || StringUtils.isEmpty(bill.getBillId()))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
BigDecimal sales = nz(bill.getIncomeTotal());
|
||||||
|
PrcIncomeBill existed = incomeBillMapper.selectByBillId(bill.getBillId());
|
||||||
|
PrcIncomeBill row = existed == null ? new PrcIncomeBill() : existed;
|
||||||
|
if (existed == null)
|
||||||
|
{
|
||||||
|
row.setIncomeBillId(UUID.randomUUID().toString());
|
||||||
|
row.setBillId(bill.getBillId());
|
||||||
|
row.setCreateBy(bill.getCreateBy());
|
||||||
|
}
|
||||||
|
row.setCurrency(StringUtils.isEmpty(bill.getCurrency()) ? "CNY" : bill.getCurrency());
|
||||||
|
// 产品价/红线价预留
|
||||||
|
row.setSalesAmount(sales);
|
||||||
|
row.setIncomeTotal(sales);
|
||||||
|
row.setBelongSaler(bill.getBelongSaler());
|
||||||
|
row.setBelongSalerCode(bill.getBelongSalerCode());
|
||||||
|
row.setSettlementMan(bill.getSettlementMan());
|
||||||
|
row.setSettlementManCode(bill.getSettlementManCode());
|
||||||
|
row.setUpdateBy(bill.getUpdateBy());
|
||||||
|
if (existed == null)
|
||||||
|
{
|
||||||
|
incomeBillMapper.insertPrcIncomeBill(row);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
incomeBillMapper.updatePrcIncomeBill(row);
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List<PrcPayBillFee> toPayFeeRows(String billId, String payBillId, TmsPriceQuoteResult result)
|
||||||
|
{
|
||||||
|
List<PrcPayBillFee> fees = new ArrayList<PrcPayBillFee>();
|
||||||
|
if (result.getPayFeeDetails() == null)
|
||||||
|
{
|
||||||
|
return fees;
|
||||||
|
}
|
||||||
|
for (TmsPriceQuoteFeeLine line : result.getPayFeeDetails())
|
||||||
|
{
|
||||||
|
PrcPayBillFee fee = new PrcPayBillFee();
|
||||||
|
fee.setFeeId(UUID.randomUUID().toString());
|
||||||
|
fee.setBillId(billId);
|
||||||
|
fee.setPayBillId(payBillId);
|
||||||
|
fee.setFeeType(line.getFeeType());
|
||||||
|
fee.setFeeName(line.getFeeName());
|
||||||
|
fee.setScId(line.getScId() == null ? 0L : line.getScId());
|
||||||
|
fee.setAmount(line.getAmount() == null ? BigDecimal.ZERO : line.getAmount());
|
||||||
|
fee.setCurrency(line.getCurrency());
|
||||||
|
fee.setRoundMode(line.getRoundMode());
|
||||||
|
fee.setRemark(line.getRemark());
|
||||||
|
fees.add(fee);
|
||||||
|
}
|
||||||
|
return fees;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 应付主表与订单计费一对一落库;当前写入成本价/应付合计,产品价/红线价预留。 */
|
||||||
|
private PrcPayBill persistPayBill(PrcOrderBill bill)
|
||||||
|
{
|
||||||
|
if (bill == null || StringUtils.isEmpty(bill.getBillId()))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
BigDecimal pay = nz(bill.getPayTotal());
|
||||||
|
PrcPayBill existed = payBillMapper.selectByBillId(bill.getBillId());
|
||||||
|
PrcPayBill row = existed == null ? new PrcPayBill() : existed;
|
||||||
|
if (existed == null)
|
||||||
|
{
|
||||||
|
row.setPayBillId(UUID.randomUUID().toString());
|
||||||
|
row.setBillId(bill.getBillId());
|
||||||
|
row.setCreateBy(bill.getCreateBy());
|
||||||
|
}
|
||||||
|
row.setCurrency(StringUtils.isEmpty(bill.getCurrency()) ? "CNY" : bill.getCurrency());
|
||||||
|
// 产品价/红线价预留
|
||||||
|
row.setCostAmount(pay);
|
||||||
|
row.setPayTotal(pay);
|
||||||
|
row.setBelongSaler(bill.getBelongSaler());
|
||||||
|
row.setBelongSalerCode(bill.getBelongSalerCode());
|
||||||
|
row.setSettlementMan(bill.getSettlementMan());
|
||||||
|
row.setSettlementManCode(bill.getSettlementManCode());
|
||||||
|
row.setUpdateBy(bill.getUpdateBy());
|
||||||
|
if (existed == null)
|
||||||
|
{
|
||||||
|
payBillMapper.insertPrcPayBill(row);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
payBillMapper.updatePrcPayBill(row);
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
private TmsPriceQuoteResult toResult(PrcOrderBill bill, List<PrcIncomeBillFee> incomeFees,
|
private TmsPriceQuoteResult toResult(PrcOrderBill bill, List<PrcIncomeBillFee> incomeFees,
|
||||||
List<PrcPayBillFee> payFees)
|
List<PrcPayBillFee> payFees)
|
||||||
{
|
{
|
||||||
@@ -609,7 +730,9 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
|||||||
r.setTrackingNo(bill.getTrackingNo());
|
r.setTrackingNo(bill.getTrackingNo());
|
||||||
r.setTransferNo(bill.getTransferNo());
|
r.setTransferNo(bill.getTransferNo());
|
||||||
r.setBelongSaler(bill.getBelongSaler());
|
r.setBelongSaler(bill.getBelongSaler());
|
||||||
|
r.setBelongSalerCode(bill.getBelongSalerCode());
|
||||||
r.setSettlementMan(bill.getSettlementMan());
|
r.setSettlementMan(bill.getSettlementMan());
|
||||||
|
r.setSettlementManCode(bill.getSettlementManCode());
|
||||||
r.setServiceMan(bill.getServiceMan());
|
r.setServiceMan(bill.getServiceMan());
|
||||||
r.setCustomerName(bill.getCustomerName());
|
r.setCustomerName(bill.getCustomerName());
|
||||||
r.setCustomerActiveStatus(bill.getCustomerActiveStatus());
|
r.setCustomerActiveStatus(bill.getCustomerActiveStatus());
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<resultMap type="PrcIncomeBillFee" id="PrcIncomeBillFeeResult">
|
<resultMap type="PrcIncomeBillFee" id="PrcIncomeBillFeeResult">
|
||||||
<id property="feeId" column="fee_id" />
|
<id property="feeId" column="fee_id" />
|
||||||
<result property="billId" column="bill_id" />
|
<result property="billId" column="bill_id" />
|
||||||
|
<result property="incomeBillId" column="income_bill_id" />
|
||||||
<result property="feeType" column="fee_type" />
|
<result property="feeType" column="fee_type" />
|
||||||
<result property="feeName" column="fee_name" />
|
<result property="feeName" column="fee_name" />
|
||||||
<result property="scId" column="sc_id" />
|
<result property="scId" column="sc_id" />
|
||||||
@@ -18,14 +19,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectByBillId" parameterType="String" resultMap="PrcIncomeBillFeeResult">
|
<select id="selectByBillId" parameterType="String" resultMap="PrcIncomeBillFeeResult">
|
||||||
select fee_id, bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
select fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||||
from prc_income_bill_fee
|
from prc_income_bill_fee
|
||||||
where bill_id = #{billId}
|
where bill_id = #{billId}
|
||||||
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE'), fee_id
|
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE'), fee_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByBillIds" resultMap="PrcIncomeBillFeeResult">
|
<select id="selectByBillIds" resultMap="PrcIncomeBillFeeResult">
|
||||||
select fee_id, bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
select fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||||
from prc_income_bill_fee
|
from prc_income_bill_fee
|
||||||
where bill_id in
|
where bill_id in
|
||||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
||||||
@@ -36,18 +37,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<insert id="insertPrcIncomeBillFee" parameterType="PrcIncomeBillFee">
|
<insert id="insertPrcIncomeBillFee" parameterType="PrcIncomeBillFee">
|
||||||
insert into prc_income_bill_fee (
|
insert into prc_income_bill_fee (
|
||||||
fee_id, bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||||
) values (
|
) values (
|
||||||
#{feeId}, #{billId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
#{feeId}, #{billId}, #{incomeBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertBatch" parameterType="java.util.List">
|
<insert id="insertBatch" parameterType="java.util.List">
|
||||||
insert into prc_income_bill_fee (
|
insert into prc_income_bill_fee (
|
||||||
fee_id, bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||||
) values
|
) values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.feeId}, #{item.billId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
(#{item.feeId}, #{item.billId}, #{item.incomeBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
||||||
#{item.currency}, #{item.roundMode}, #{item.remark}, sysdate())
|
#{item.currency}, #{item.roundMode}, #{item.remark}, sysdate())
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.price.mapper.PrcIncomeBillMapper">
|
||||||
|
|
||||||
|
<resultMap type="PrcIncomeBill" id="PrcIncomeBillResult">
|
||||||
|
<id property="incomeBillId" column="income_bill_id" />
|
||||||
|
<result property="billId" column="bill_id" />
|
||||||
|
<result property="currency" column="currency" />
|
||||||
|
<result property="productAmount" column="product_amount" />
|
||||||
|
<result property="redlineAmount" column="redline_amount" />
|
||||||
|
<result property="salesAmount" column="sales_amount" />
|
||||||
|
<result property="incomeTotal" column="income_total" />
|
||||||
|
<result property="belongSaler" column="belong_saler" />
|
||||||
|
<result property="belongSalerCode" column="belong_saler_code" />
|
||||||
|
<result property="settlementMan" column="settlement_man" />
|
||||||
|
<result property="settlementManCode" column="settlement_man_code" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectPrcIncomeBillVo">
|
||||||
|
select income_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||||
|
sales_amount, income_total,
|
||||||
|
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||||
|
create_by, create_time, update_by, update_time
|
||||||
|
from prc_income_bill
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectByBillId" parameterType="String" resultMap="PrcIncomeBillResult">
|
||||||
|
<include refid="selectPrcIncomeBillVo"/>
|
||||||
|
where bill_id = #{billId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByIncomeBillId" parameterType="String" resultMap="PrcIncomeBillResult">
|
||||||
|
<include refid="selectPrcIncomeBillVo"/>
|
||||||
|
where income_bill_id = #{incomeBillId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertPrcIncomeBill" parameterType="PrcIncomeBill">
|
||||||
|
insert into prc_income_bill (
|
||||||
|
income_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||||
|
sales_amount, income_total,
|
||||||
|
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||||
|
create_by, create_time
|
||||||
|
) values (
|
||||||
|
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||||
|
#{salesAmount}, #{incomeTotal},
|
||||||
|
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||||
|
#{createBy}, sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updatePrcIncomeBill" parameterType="PrcIncomeBill">
|
||||||
|
update prc_income_bill
|
||||||
|
set currency = #{currency},
|
||||||
|
product_amount = #{productAmount},
|
||||||
|
redline_amount = #{redlineAmount},
|
||||||
|
sales_amount = #{salesAmount},
|
||||||
|
income_total = #{incomeTotal},
|
||||||
|
belong_saler = #{belongSaler},
|
||||||
|
belong_saler_code = #{belongSalerCode},
|
||||||
|
settlement_man = #{settlementMan},
|
||||||
|
settlement_man_code = #{settlementManCode},
|
||||||
|
update_by = #{updateBy},
|
||||||
|
update_time = sysdate()
|
||||||
|
where bill_id = #{billId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="upsertPrcIncomeBill" parameterType="PrcIncomeBill">
|
||||||
|
insert into prc_income_bill (
|
||||||
|
income_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||||
|
sales_amount, income_total,
|
||||||
|
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||||
|
create_by, create_time
|
||||||
|
) values (
|
||||||
|
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||||
|
#{salesAmount}, #{incomeTotal},
|
||||||
|
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||||
|
#{createBy}, sysdate()
|
||||||
|
)
|
||||||
|
on duplicate key update
|
||||||
|
currency = values(currency),
|
||||||
|
product_amount = values(product_amount),
|
||||||
|
redline_amount = values(redline_amount),
|
||||||
|
sales_amount = values(sales_amount),
|
||||||
|
income_total = values(income_total),
|
||||||
|
belong_saler = values(belong_saler),
|
||||||
|
belong_saler_code = values(belong_saler_code),
|
||||||
|
settlement_man = values(settlement_man),
|
||||||
|
settlement_man_code = values(settlement_man_code),
|
||||||
|
update_by = values(update_by),
|
||||||
|
update_time = sysdate()
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<delete id="deleteByBillId" parameterType="String">
|
||||||
|
delete from prc_income_bill where bill_id = #{billId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -13,7 +13,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="trackingNo" column="tracking_no" />
|
<result property="trackingNo" column="tracking_no" />
|
||||||
<result property="transferNo" column="transfer_no" />
|
<result property="transferNo" column="transfer_no" />
|
||||||
<result property="belongSaler" column="belong_saler" />
|
<result property="belongSaler" column="belong_saler" />
|
||||||
|
<result property="belongSalerCode" column="belong_saler_code" />
|
||||||
<result property="settlementMan" column="settlement_man" />
|
<result property="settlementMan" column="settlement_man" />
|
||||||
|
<result property="settlementManCode" column="settlement_man_code" />
|
||||||
<result property="serviceMan" column="service_man" />
|
<result property="serviceMan" column="service_man" />
|
||||||
<result property="customerId" column="customer_id" />
|
<result property="customerId" column="customer_id" />
|
||||||
<result property="customerCode" column="customer_code" />
|
<result property="customerCode" column="customer_code" />
|
||||||
@@ -72,7 +74,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectPrcOrderBillVo">
|
<sql id="selectPrcOrderBillVo">
|
||||||
select bill_id, bill_key, order_no, tracking_no, transfer_no, belong_saler, settlement_man, service_man,
|
select bill_id, bill_key, order_no, tracking_no, transfer_no,
|
||||||
|
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man,
|
||||||
customer_id, customer_code, customer_name,
|
customer_id, customer_code, customer_name,
|
||||||
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
|
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
|
||||||
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
|
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
|
||||||
@@ -344,7 +347,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill">
|
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill">
|
||||||
insert into prc_order_bill (
|
insert into prc_order_bill (
|
||||||
bill_id, bill_key, order_no, tracking_no, transfer_no, belong_saler, settlement_man, service_man,
|
bill_id, bill_key, order_no, tracking_no, transfer_no,
|
||||||
|
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man,
|
||||||
customer_id, customer_code, customer_name,
|
customer_id, customer_code, customer_name,
|
||||||
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
|
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
|
||||||
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
|
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
|
||||||
@@ -357,7 +361,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
customer_active_status, credit_arrears_status, round_mode,
|
customer_active_status, credit_arrears_status, round_mode,
|
||||||
create_time
|
create_time
|
||||||
) values (
|
) values (
|
||||||
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo}, #{belongSaler}, #{settlementMan}, #{serviceMan},
|
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
|
||||||
|
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode}, #{serviceMan},
|
||||||
#{customerId}, #{customerCode}, #{customerName},
|
#{customerId}, #{customerCode}, #{customerName},
|
||||||
#{pieces}, #{actualWeight}, #{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
|
#{pieces}, #{actualWeight}, #{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
|
||||||
#{shipperName}, #{consigneeName}, #{destPostcode}, #{warehouseCode}, #{orderTime}, #{orderRemark},
|
#{shipperName}, #{consigneeName}, #{destPostcode}, #{warehouseCode}, #{orderTime}, #{orderRemark},
|
||||||
@@ -378,7 +383,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
tracking_no = #{trackingNo},
|
tracking_no = #{trackingNo},
|
||||||
transfer_no = #{transferNo},
|
transfer_no = #{transferNo},
|
||||||
belong_saler = #{belongSaler},
|
belong_saler = #{belongSaler},
|
||||||
|
belong_saler_code = #{belongSalerCode},
|
||||||
settlement_man = #{settlementMan},
|
settlement_man = #{settlementMan},
|
||||||
|
settlement_man_code = #{settlementManCode},
|
||||||
service_man = #{serviceMan},
|
service_man = #{serviceMan},
|
||||||
customer_id = #{customerId},
|
customer_id = #{customerId},
|
||||||
customer_code = #{customerCode},
|
customer_code = #{customerCode},
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<resultMap type="PrcPayBillFee" id="PrcPayBillFeeResult">
|
<resultMap type="PrcPayBillFee" id="PrcPayBillFeeResult">
|
||||||
<id property="feeId" column="fee_id" />
|
<id property="feeId" column="fee_id" />
|
||||||
<result property="billId" column="bill_id" />
|
<result property="billId" column="bill_id" />
|
||||||
|
<result property="payBillId" column="pay_bill_id" />
|
||||||
<result property="feeType" column="fee_type" />
|
<result property="feeType" column="fee_type" />
|
||||||
<result property="feeName" column="fee_name" />
|
<result property="feeName" column="fee_name" />
|
||||||
<result property="scId" column="sc_id" />
|
<result property="scId" column="sc_id" />
|
||||||
@@ -18,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectByBillId" parameterType="String" resultMap="PrcPayBillFeeResult">
|
<select id="selectByBillId" parameterType="String" resultMap="PrcPayBillFeeResult">
|
||||||
select fee_id, bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
select fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||||
from prc_pay_bill_fee
|
from prc_pay_bill_fee
|
||||||
where bill_id = #{billId}
|
where bill_id = #{billId}
|
||||||
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE'), fee_id
|
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE'), fee_id
|
||||||
@@ -26,18 +27,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<insert id="insertPrcPayBillFee" parameterType="PrcPayBillFee">
|
<insert id="insertPrcPayBillFee" parameterType="PrcPayBillFee">
|
||||||
insert into prc_pay_bill_fee (
|
insert into prc_pay_bill_fee (
|
||||||
fee_id, bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||||
) values (
|
) values (
|
||||||
#{feeId}, #{billId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
#{feeId}, #{billId}, #{payBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertBatch" parameterType="java.util.List">
|
<insert id="insertBatch" parameterType="java.util.List">
|
||||||
insert into prc_pay_bill_fee (
|
insert into prc_pay_bill_fee (
|
||||||
fee_id, bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||||
) values
|
) values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.feeId}, #{item.billId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
(#{item.feeId}, #{item.billId}, #{item.payBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
||||||
#{item.currency}, #{item.roundMode}, #{item.remark}, sysdate())
|
#{item.currency}, #{item.roundMode}, #{item.remark}, sysdate())
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.price.mapper.PrcPayBillMapper">
|
||||||
|
|
||||||
|
<resultMap type="PrcPayBill" id="PrcPayBillResult">
|
||||||
|
<id property="payBillId" column="pay_bill_id" />
|
||||||
|
<result property="billId" column="bill_id" />
|
||||||
|
<result property="currency" column="currency" />
|
||||||
|
<result property="productAmount" column="product_amount" />
|
||||||
|
<result property="redlineAmount" column="redline_amount" />
|
||||||
|
<result property="costAmount" column="cost_amount" />
|
||||||
|
<result property="payTotal" column="pay_total" />
|
||||||
|
<result property="belongSaler" column="belong_saler" />
|
||||||
|
<result property="belongSalerCode" column="belong_saler_code" />
|
||||||
|
<result property="settlementMan" column="settlement_man" />
|
||||||
|
<result property="settlementManCode" column="settlement_man_code" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectPrcPayBillVo">
|
||||||
|
select pay_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||||
|
cost_amount, pay_total,
|
||||||
|
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||||
|
create_by, create_time, update_by, update_time
|
||||||
|
from prc_pay_bill
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectByBillId" parameterType="String" resultMap="PrcPayBillResult">
|
||||||
|
<include refid="selectPrcPayBillVo"/>
|
||||||
|
where bill_id = #{billId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByPayBillId" parameterType="String" resultMap="PrcPayBillResult">
|
||||||
|
<include refid="selectPrcPayBillVo"/>
|
||||||
|
where pay_bill_id = #{payBillId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertPrcPayBill" parameterType="PrcPayBill">
|
||||||
|
insert into prc_pay_bill (
|
||||||
|
pay_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||||
|
cost_amount, pay_total,
|
||||||
|
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||||
|
create_by, create_time
|
||||||
|
) values (
|
||||||
|
#{payBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||||
|
#{costAmount}, #{payTotal},
|
||||||
|
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||||
|
#{createBy}, sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updatePrcPayBill" parameterType="PrcPayBill">
|
||||||
|
update prc_pay_bill
|
||||||
|
set currency = #{currency},
|
||||||
|
product_amount = #{productAmount},
|
||||||
|
redline_amount = #{redlineAmount},
|
||||||
|
cost_amount = #{costAmount},
|
||||||
|
pay_total = #{payTotal},
|
||||||
|
belong_saler = #{belongSaler},
|
||||||
|
belong_saler_code = #{belongSalerCode},
|
||||||
|
settlement_man = #{settlementMan},
|
||||||
|
settlement_man_code = #{settlementManCode},
|
||||||
|
update_by = #{updateBy},
|
||||||
|
update_time = sysdate()
|
||||||
|
where bill_id = #{billId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="upsertPrcPayBill" parameterType="PrcPayBill">
|
||||||
|
insert into prc_pay_bill (
|
||||||
|
pay_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||||
|
cost_amount, pay_total,
|
||||||
|
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||||
|
create_by, create_time
|
||||||
|
) values (
|
||||||
|
#{payBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||||
|
#{costAmount}, #{payTotal},
|
||||||
|
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||||
|
#{createBy}, sysdate()
|
||||||
|
)
|
||||||
|
on duplicate key update
|
||||||
|
currency = values(currency),
|
||||||
|
product_amount = values(product_amount),
|
||||||
|
redline_amount = values(redline_amount),
|
||||||
|
cost_amount = values(cost_amount),
|
||||||
|
pay_total = values(pay_total),
|
||||||
|
belong_saler = values(belong_saler),
|
||||||
|
belong_saler_code = values(belong_saler_code),
|
||||||
|
settlement_man = values(settlement_man),
|
||||||
|
settlement_man_code = values(settlement_man_code),
|
||||||
|
update_by = values(update_by),
|
||||||
|
update_time = sysdate()
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<delete id="deleteByBillId" parameterType="String">
|
||||||
|
delete from prc_pay_bill where bill_id = #{billId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
-- prc_order_bill / prc_income_bill:增加销售员、结算员编码
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
ALTER TABLE prc_order_bill
|
||||||
|
ADD COLUMN belong_saler_code VARCHAR(64) DEFAULT NULL COMMENT '销售员编码' AFTER belong_saler,
|
||||||
|
ADD COLUMN settlement_man_code VARCHAR(64) DEFAULT NULL COMMENT '结算员编码' AFTER settlement_man;
|
||||||
|
|
||||||
|
ALTER TABLE prc_income_bill
|
||||||
|
ADD COLUMN belong_saler_code VARCHAR(64) DEFAULT NULL COMMENT '销售员编码' AFTER belong_saler,
|
||||||
|
ADD COLUMN settlement_man_code VARCHAR(64) DEFAULT NULL COMMENT '结算员编码' AFTER settlement_man;
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
-- 与 prc_order_bill 一对一(bill_id UNIQUE)
|
-- 与 prc_order_bill 一对一(bill_id UNIQUE)
|
||||||
-- 价格层:产品价 / 红线价 / 销售价(当前计费结果)
|
-- 价格层:产品价 / 红线价 / 销售价(当前计费结果)
|
||||||
-- 人员:业务员、结算员
|
-- 人员:业务员、结算员
|
||||||
-- 说明:本脚本仅建表;确认后再改 Java/费用表关联
|
-- 说明:计费落库时写入;费用明细关联 income_bill_id
|
||||||
-- =====================================================================
|
-- =====================================================================
|
||||||
SET NAMES utf8mb4;
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
@@ -21,7 +21,9 @@ CREATE TABLE IF NOT EXISTS prc_income_bill (
|
|||||||
|
|
||||||
-- 人员
|
-- 人员
|
||||||
belong_saler VARCHAR(64) DEFAULT NULL COMMENT '业务员/销售员',
|
belong_saler VARCHAR(64) DEFAULT NULL COMMENT '业务员/销售员',
|
||||||
|
belong_saler_code VARCHAR(64) DEFAULT NULL COMMENT '销售员编码',
|
||||||
settlement_man VARCHAR(64) DEFAULT NULL COMMENT '结算员',
|
settlement_man VARCHAR(64) DEFAULT NULL COMMENT '结算员',
|
||||||
|
settlement_man_code VARCHAR(64) DEFAULT NULL COMMENT '结算员编码',
|
||||||
|
|
||||||
create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
|
create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
|
||||||
create_time DATETIME NOT NULL COMMENT '创建时间',
|
create_time DATETIME NOT NULL COMMENT '创建时间',
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
-- prc_income_bill_fee 增加应收主表关联 income_bill_id
|
||||||
|
-- 保留 bill_id 以兼容既有按订单计费查询 / AR
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
ALTER TABLE prc_income_bill_fee
|
||||||
|
ADD COLUMN income_bill_id VARCHAR(36) DEFAULT NULL COMMENT '应收主表ID,对应 prc_income_bill.income_bill_id' AFTER bill_id,
|
||||||
|
ADD KEY idx_income_fee_income_bill (income_bill_id);
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
-- =====================================================================
|
||||||
|
-- 应付主表 prc_pay_bill
|
||||||
|
-- 位于 prc_order_bill(订单主表)与 prc_pay_bill_fee(应付费用明细)之间
|
||||||
|
-- 与 prc_order_bill 一对一(bill_id UNIQUE)
|
||||||
|
-- 价格层:产品价 / 红线价 / 成本价(当前计费结果)
|
||||||
|
-- 人员:业务员、结算员
|
||||||
|
-- 说明:计费落库时写入;费用明细关联 pay_bill_id
|
||||||
|
-- =====================================================================
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS prc_pay_bill (
|
||||||
|
pay_bill_id VARCHAR(36) NOT NULL COMMENT '应付主表ID',
|
||||||
|
bill_id VARCHAR(36) NOT NULL COMMENT '计费订单ID,对应 prc_order_bill.bill_id,一对一',
|
||||||
|
currency VARCHAR(10) DEFAULT 'CNY' COMMENT '币种',
|
||||||
|
|
||||||
|
-- 价格层(后续统计;当前计费写入应付合计)
|
||||||
|
product_amount DECIMAL(18,4) DEFAULT NULL COMMENT '产品价合计',
|
||||||
|
redline_amount DECIMAL(18,4) DEFAULT NULL COMMENT '红线价合计',
|
||||||
|
cost_amount DECIMAL(18,4) DEFAULT NULL COMMENT '成本价合计(当前计费结果)',
|
||||||
|
pay_total DECIMAL(18,4) DEFAULT NULL COMMENT '应付合计(当前等于成本价)',
|
||||||
|
|
||||||
|
-- 人员
|
||||||
|
belong_saler VARCHAR(64) DEFAULT NULL COMMENT '业务员/销售员',
|
||||||
|
belong_saler_code VARCHAR(64) DEFAULT NULL COMMENT '销售员编码',
|
||||||
|
settlement_man VARCHAR(64) DEFAULT NULL COMMENT '结算员',
|
||||||
|
settlement_man_code VARCHAR(64) DEFAULT NULL COMMENT '结算员编码',
|
||||||
|
|
||||||
|
create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
|
||||||
|
create_time DATETIME NOT NULL COMMENT '创建时间',
|
||||||
|
update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
|
||||||
|
update_time DATETIME DEFAULT NULL COMMENT '更新时间',
|
||||||
|
|
||||||
|
PRIMARY KEY (pay_bill_id),
|
||||||
|
UNIQUE KEY uk_pay_bill_order_bill (bill_id),
|
||||||
|
KEY idx_pay_bill_saler (belong_saler),
|
||||||
|
KEY idx_pay_bill_settlement (settlement_man),
|
||||||
|
CONSTRAINT fk_pay_bill_order_bill FOREIGN KEY (bill_id) REFERENCES prc_order_bill (bill_id) ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='应付主表(订单计费与应付费用中间层,与订单一对一)';
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
-- prc_pay_bill_fee 增加应付主表关联 pay_bill_id
|
||||||
|
-- 保留 bill_id 以兼容既有按订单计费查询
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
ALTER TABLE prc_pay_bill_fee
|
||||||
|
ADD COLUMN pay_bill_id VARCHAR(36) DEFAULT NULL COMMENT '应付主表ID,对应 prc_pay_bill.pay_bill_id' AFTER bill_id,
|
||||||
|
ADD KEY idx_pay_fee_pay_bill (pay_bill_id);
|
||||||
@@ -127,7 +127,9 @@ const columns = [
|
|||||||
{ label: '额度欠费', prop: 'creditArrearsStatus', align: 'center', width: 100, slot: 'creditArrearsStatus' },
|
{ label: '额度欠费', prop: 'creditArrearsStatus', align: 'center', width: 100, slot: 'creditArrearsStatus' },
|
||||||
{ label: '下单时间', prop: 'orderTime', align: 'center', width: 170, parseTime: true },
|
{ label: '下单时间', prop: 'orderTime', align: 'center', width: 170, parseTime: true },
|
||||||
{ label: '销售员', prop: 'belongSaler', minWidth: 100, showOverflowTooltip: true },
|
{ label: '销售员', prop: 'belongSaler', minWidth: 100, showOverflowTooltip: true },
|
||||||
|
{ label: '销售员编码', prop: 'belongSalerCode', minWidth: 110, showOverflowTooltip: true },
|
||||||
{ label: '结算员', prop: 'settlementMan', minWidth: 100, showOverflowTooltip: true },
|
{ label: '结算员', prop: 'settlementMan', minWidth: 100, showOverflowTooltip: true },
|
||||||
|
{ label: '结算员编码', prop: 'settlementManCode', minWidth: 110, showOverflowTooltip: true },
|
||||||
// { label: '客服员', prop: 'serviceMan', minWidth: 100, showOverflowTooltip: true },
|
// { label: '客服员', prop: 'serviceMan', minWidth: 100, showOverflowTooltip: true },
|
||||||
{ label: '操作', prop: 'action', align: 'center', width: 90, fixed: 'right', slot: 'action', showInToolbar: false }
|
{ label: '操作', prop: 'action', align: 'center', width: 90, fixed: 'right', slot: 'action', showInToolbar: false }
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user