Merge branch 'master' of http://git.lionquexpress.com/wuweihua/BMS
This commit is contained in:
+14
@@ -89,6 +89,20 @@ public class BillingController extends BaseController
|
||||
return success(prcOrderBillService.listOrderNoOptions(keyword));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill')")
|
||||
@GetMapping("/bill/trackingNos")
|
||||
public AjaxResult trackingNoOptions(@RequestParam(value = "keyword", required = false) String keyword)
|
||||
{
|
||||
return success(prcOrderBillService.listTrackingNoOptions(keyword));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill')")
|
||||
@GetMapping("/bill/transferNos")
|
||||
public AjaxResult transferNoOptions(@RequestParam(value = "keyword", required = false) String keyword)
|
||||
{
|
||||
return success(prcOrderBillService.listTransferNoOptions(keyword));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill')")
|
||||
@GetMapping("/bill/{billId}")
|
||||
public AjaxResult getBill(@PathVariable String billId)
|
||||
|
||||
@@ -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 lombok.Data;
|
||||
|
||||
/** receivable fee detail prc_income_bill_fee */
|
||||
/** 应收费用明细 prc_income_bill_fee */
|
||||
@Data
|
||||
public class PrcIncomeBillFee implements Serializable
|
||||
{
|
||||
@@ -14,6 +14,8 @@ public class PrcIncomeBillFee implements Serializable
|
||||
|
||||
private String feeId;
|
||||
private String billId;
|
||||
/** 应收主表ID */
|
||||
private String incomeBillId;
|
||||
private String feeType;
|
||||
private String feeName;
|
||||
private Long scId;
|
||||
|
||||
@@ -21,12 +21,20 @@ public class PrcOrderBill extends BaseEntity
|
||||
/** 批量查询:多个订单号精确匹配(仅查询用,非表字段) */
|
||||
private List<String> orderNos;
|
||||
private String trackingNo;
|
||||
/** 批量查询:多个运单号精确匹配(仅查询用,非表字段) */
|
||||
private List<String> trackingNos;
|
||||
/** transfer order no */
|
||||
private String transferNo;
|
||||
/** 批量查询:多个转单号精确匹配(仅查询用,非表字段) */
|
||||
private List<String> transferNos;
|
||||
/** 所属销售员 */
|
||||
private String belongSaler;
|
||||
/** 销售员编码 */
|
||||
private String belongSalerCode;
|
||||
/** 结算员 */
|
||||
private String settlementMan;
|
||||
/** 结算员编码 */
|
||||
private String settlementManCode;
|
||||
/** 客服员 */
|
||||
private String serviceMan;
|
||||
private Long customerId;
|
||||
@@ -67,6 +75,10 @@ public class PrcOrderBill extends BaseEntity
|
||||
private String setType;
|
||||
private Integer bindPriority;
|
||||
private Long customerPricesetId;
|
||||
/** 套餐版本ID(prc_price_set_version.psv_id) */
|
||||
private Long psvId;
|
||||
/** 套餐明细ID(prc_price_set_detail.psd_id) */
|
||||
private Long psdId;
|
||||
private Long productCountryId;
|
||||
private BigDecimal weightMin;
|
||||
private BigDecimal weightMax;
|
||||
|
||||
@@ -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 lombok.Data;
|
||||
|
||||
/** payable fee detail prc_pay_bill_fee */
|
||||
/** 应付费用明细 prc_pay_bill_fee */
|
||||
@Data
|
||||
public class PrcPayBillFee implements Serializable
|
||||
{
|
||||
@@ -14,6 +14,8 @@ public class PrcPayBillFee implements Serializable
|
||||
|
||||
private String feeId;
|
||||
private String billId;
|
||||
/** 应付主表ID */
|
||||
private String payBillId;
|
||||
private String feeType;
|
||||
private String feeName;
|
||||
private Long scId;
|
||||
|
||||
@@ -25,8 +25,12 @@ public class TmsPriceBillRequest extends TmsPriceQuoteRequest
|
||||
private String transferNo;
|
||||
/** 所属销售员 */
|
||||
private String belongSaler;
|
||||
/** 销售员编码 */
|
||||
private String belongSalerCode;
|
||||
/** 结算员 */
|
||||
private String settlementMan;
|
||||
/** 结算员编码 */
|
||||
private String settlementManCode;
|
||||
/** 客服员 */
|
||||
private String serviceMan;
|
||||
private String customerName;
|
||||
|
||||
@@ -77,8 +77,12 @@ public class TmsPriceQuoteResult implements Serializable
|
||||
private String transferNo;
|
||||
/** 所属销售员 */
|
||||
private String belongSaler;
|
||||
/** 销售员编码 */
|
||||
private String belongSalerCode;
|
||||
/** 结算员 */
|
||||
private String settlementMan;
|
||||
/** 结算员编码 */
|
||||
private String settlementManCode;
|
||||
/** 客服员 */
|
||||
private String serviceMan;
|
||||
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);
|
||||
}
|
||||
@@ -20,6 +20,12 @@ public interface PrcOrderBillMapper
|
||||
/** 订单号下拉搜索:按关键词模糊匹配,返回去重后的订单号(按最近创建排序,限量返回) */
|
||||
public List<String> selectOrderNoOptions(@Param("keyword") String keyword, @Param("limit") int limit);
|
||||
|
||||
/** 运单号下拉搜索:按关键词模糊匹配,返回去重后的运单号(按最近创建排序,限量返回) */
|
||||
public List<String> selectTrackingNoOptions(@Param("keyword") String keyword, @Param("limit") int limit);
|
||||
|
||||
/** 转单号下拉搜索:按关键词模糊匹配,返回去重后的转单号(按最近创建排序,限量返回) */
|
||||
public List<String> selectTransferNoOptions(@Param("keyword") String keyword, @Param("limit") int limit);
|
||||
|
||||
/** 应收账单生成读取指定客户截止日期前的未出账订单计费快照。 */
|
||||
public List<PrcOrderBill> selectPrcOrderBillByCustomerPeriod(@Param("customerId") Long customerId,
|
||||
@Param("customerCode") String customerCode, @Param("orderOrTrackingNo") String orderOrTrackingNo,
|
||||
|
||||
@@ -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.setTransferNo(firstStr(row, "TRANSFER_ORDER_ID"));
|
||||
req.setBelongSaler(firstStr(row, "BELONG_SALER_OLD"));
|
||||
req.setBelongSalerCode(firstStr(row, "BELONG_SALER_CODE", "SALER_CODE"));
|
||||
req.setSettlementMan(firstStr(row, "SETTLEMENT_MAN_OLD"));
|
||||
req.setSettlementManCode(firstStr(row, "SETTLEMENT_MAN_CODE", "SETTLEMENT_CODE"));
|
||||
req.setServiceMan(firstStr(row, "SERVICE_MAN_OLD"));
|
||||
req.setUpstreamRow(row);
|
||||
req.setCustomerCode(firstStr(row, "CUSTOMER_CODE"));
|
||||
|
||||
+7
-1
@@ -5,7 +5,7 @@ import com.ruoyi.price.domain.PrcOrderBill;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceBillRequest;
|
||||
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
|
||||
{
|
||||
TmsPriceQuoteResult bill(TmsPriceBillRequest request);
|
||||
@@ -15,6 +15,12 @@ public interface IPrcOrderBillService
|
||||
/** 订单号下拉搜索选项(模糊匹配,去重限量) */
|
||||
List<String> listOrderNoOptions(String keyword);
|
||||
|
||||
/** 运单号下拉搜索选项(模糊匹配,去重限量) */
|
||||
List<String> listTrackingNoOptions(String keyword);
|
||||
|
||||
/** 转单号下拉搜索选项(模糊匹配,去重限量) */
|
||||
List<String> listTransferNoOptions(String keyword);
|
||||
|
||||
TmsPriceQuoteResult getBill(String billId);
|
||||
|
||||
TmsPriceQuoteResult getBillByOrderNo(String orderNo);
|
||||
|
||||
+154
-5
@@ -20,9 +20,11 @@ import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.sign.Md5Utils;
|
||||
import com.ruoyi.price.domain.PrcIncomeBill;
|
||||
import com.ruoyi.price.domain.PrcIncomeBillFee;
|
||||
import com.ruoyi.price.domain.PrcOrderBill;
|
||||
import com.ruoyi.price.domain.PrcOrderBillExt;
|
||||
import com.ruoyi.price.domain.PrcPayBill;
|
||||
import com.ruoyi.price.domain.PrcPayBillFee;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceBillRequest;
|
||||
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.BillCustomerActiveStatus;
|
||||
import com.ruoyi.price.mapper.PrcIncomeBillFeeMapper;
|
||||
import com.ruoyi.price.mapper.PrcIncomeBillMapper;
|
||||
import com.ruoyi.price.mapper.PrcOrderBillExtMapper;
|
||||
import com.ruoyi.price.mapper.PrcOrderBillMapper;
|
||||
import com.ruoyi.price.mapper.PrcPayBillFeeMapper;
|
||||
import com.ruoyi.price.mapper.PrcPayBillMapper;
|
||||
import com.ruoyi.price.oracle.OracleOrderBillExtFiller;
|
||||
import com.ruoyi.price.search.EsBizLogSupport;
|
||||
import com.ruoyi.price.search.EsLogType;
|
||||
@@ -59,9 +63,15 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
@Autowired
|
||||
private PrcIncomeBillFeeMapper incomeBillFeeMapper;
|
||||
|
||||
@Autowired
|
||||
private PrcIncomeBillMapper incomeBillMapper;
|
||||
|
||||
@Autowired
|
||||
private PrcPayBillFeeMapper payBillFeeMapper;
|
||||
|
||||
@Autowired
|
||||
private PrcPayBillMapper payBillMapper;
|
||||
|
||||
@Autowired
|
||||
private IBillSearchStore billSearchStore;
|
||||
|
||||
@@ -103,6 +113,8 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
query.setOrderNos(normalizeCodeList(query.getOrderNos()));
|
||||
query.setCustomerCodes(normalizeCodeList(query.getCustomerCodes()));
|
||||
query.setProductCodes(normalizeCodeList(query.getProductCodes()));
|
||||
query.setTrackingNos(normalizeCodeList(query.getTrackingNos()));
|
||||
query.setTransferNos(normalizeCodeList(query.getTransferNos()));
|
||||
return orderBillMapper.selectPrcOrderBillList(query);
|
||||
}
|
||||
|
||||
@@ -116,6 +128,26 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return orderBillMapper.selectOrderNoOptions(keyword.trim(), 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listTrackingNoOptions(String keyword)
|
||||
{
|
||||
if (StringUtils.isBlank(keyword))
|
||||
{
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return orderBillMapper.selectTrackingNoOptions(keyword.trim(), 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listTransferNoOptions(String keyword)
|
||||
{
|
||||
if (StringUtils.isBlank(keyword))
|
||||
{
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return orderBillMapper.selectTransferNoOptions(keyword.trim(), 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量编码归一化:逐个 trim、拆开误传的逗号/分号/空白分隔串、去空去重
|
||||
*/
|
||||
@@ -198,7 +230,9 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
bill.setTrackingNo(request.getTrackingNo());
|
||||
bill.setTransferNo(request.getTransferNo());
|
||||
bill.setBelongSaler(request.getBelongSaler());
|
||||
bill.setBelongSalerCode(request.getBelongSalerCode());
|
||||
bill.setSettlementMan(request.getSettlementMan());
|
||||
bill.setSettlementManCode(request.getSettlementManCode());
|
||||
bill.setServiceMan(request.getServiceMan());
|
||||
String customerActiveStatus = result == null ? null : result.getCustomerActiveStatus();
|
||||
if (StringUtils.isEmpty(customerActiveStatus))
|
||||
@@ -234,6 +268,8 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
bill.setSetType(result.getSetType());
|
||||
bill.setBindPriority(result.getBindPriority());
|
||||
bill.setCustomerPricesetId(result.getCustomerPricesetId());
|
||||
bill.setPsvId(result.getPsvId());
|
||||
bill.setPsdId(result.getPsdId());
|
||||
bill.setProductCountryId(result.getProductCountryId());
|
||||
bill.setWeightMin(result.getWeightMin());
|
||||
bill.setWeightMax(result.getWeightMax());
|
||||
@@ -274,16 +310,26 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
{
|
||||
orderBillMapper.updatePrcOrderBill(bill);
|
||||
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())
|
||||
{
|
||||
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());
|
||||
result.setRequestJson(syncJson);
|
||||
billSearchStore.save(EsLogType.BILL, orderNo, syncJson, toResponseJson(result));
|
||||
result.setRequestJson(requestJson);
|
||||
billSearchStore.save(EsLogType.BILL, orderNo, requestJson, toResponseJson(result));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -450,7 +496,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
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>();
|
||||
if (result.getFeeDetails() == null)
|
||||
@@ -462,6 +508,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
PrcIncomeBillFee fee = new PrcIncomeBillFee();
|
||||
fee.setFeeId(UUID.randomUUID().toString());
|
||||
fee.setBillId(billId);
|
||||
fee.setIncomeBillId(incomeBillId);
|
||||
fee.setFeeType(line.getFeeType());
|
||||
fee.setFeeName(line.getFeeName());
|
||||
fee.setScId(line.getScId() == null ? 0L : line.getScId());
|
||||
@@ -474,6 +521,104 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
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,
|
||||
List<PrcPayBillFee> payFees)
|
||||
{
|
||||
@@ -492,6 +637,8 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
r.setSetType(bill.getSetType());
|
||||
r.setBindPriority(bill.getBindPriority());
|
||||
r.setCustomerPricesetId(bill.getCustomerPricesetId());
|
||||
r.setPsvId(bill.getPsvId());
|
||||
r.setPsdId(bill.getPsdId());
|
||||
r.setProductCode(bill.getProductCode());
|
||||
r.setProductName(bill.getProductName());
|
||||
r.setCountryCode(bill.getCountryCode());
|
||||
@@ -587,7 +734,9 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
r.setTrackingNo(bill.getTrackingNo());
|
||||
r.setTransferNo(bill.getTransferNo());
|
||||
r.setBelongSaler(bill.getBelongSaler());
|
||||
r.setBelongSalerCode(bill.getBelongSalerCode());
|
||||
r.setSettlementMan(bill.getSettlementMan());
|
||||
r.setSettlementManCode(bill.getSettlementManCode());
|
||||
r.setServiceMan(bill.getServiceMan());
|
||||
r.setCustomerName(bill.getCustomerName());
|
||||
r.setCustomerActiveStatus(bill.getCustomerActiveStatus());
|
||||
|
||||
@@ -5,9 +5,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<mapper namespace="com.ruoyi.price.mapper.PrcIncomeBillFeeMapper">
|
||||
|
||||
<resultMap type="PrcIncomeBillFee" id="PrcIncomeBillFeeResult">
|
||||
<id property="feeId" column="fee_id" />
|
||||
<result property="billId" column="bill_id" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<id property="feeId" column="fee_id" />
|
||||
<result property="billId" column="bill_id" />
|
||||
<result property="incomeBillId" column="income_bill_id" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="feeName" column="fee_name" />
|
||||
<result property="scId" column="sc_id" />
|
||||
<result property="amount" column="amount" />
|
||||
@@ -18,14 +19,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<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
|
||||
where bill_id = #{billId}
|
||||
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE'), fee_id
|
||||
</select>
|
||||
|
||||
<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
|
||||
where bill_id in
|
||||
<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 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 (
|
||||
#{feeId}, #{billId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
||||
#{feeId}, #{billId}, #{incomeBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
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
|
||||
<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())
|
||||
</foreach>
|
||||
</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="transferNo" column="transfer_no" />
|
||||
<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="serviceMan" column="service_man" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="customerCode" column="customer_code" />
|
||||
@@ -46,6 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="setType" column="set_type" />
|
||||
<result property="bindPriority" column="bind_priority" />
|
||||
<result property="customerPricesetId" column="customer_priceset_id" />
|
||||
<result property="psvId" column="psv_id" />
|
||||
<result property="psdId" column="psd_id" />
|
||||
<result property="productCountryId" column="product_country_id" />
|
||||
<result property="weightMin" column="weight_min" />
|
||||
<result property="weightMax" column="weight_max" />
|
||||
@@ -72,13 +76,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<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,
|
||||
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
|
||||
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
|
||||
product_code, product_name, country_code, country_name, weight, biz_date, tms_id,
|
||||
match_source, match_message, price_set_id, price_set_code, price_set_name,
|
||||
set_type, bind_priority, customer_priceset_id, product_country_id,
|
||||
set_type, bind_priority, customer_priceset_id, psv_id, psd_id, product_country_id,
|
||||
weight_min, weight_max, weight_label, effective_date, charge_weight,
|
||||
freight_rate, base_freight_rate, discount_percent, registration_fee,
|
||||
freight_amount, surcharge_amount, income_total, pay_total, currency, ar_bill_status,
|
||||
@@ -117,6 +122,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
limit #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectTrackingNoOptions" resultType="String">
|
||||
select tracking_no
|
||||
from prc_order_bill
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
tracking_no like concat('%', #{keyword}, '%')
|
||||
</if>
|
||||
</where>
|
||||
group by tracking_no
|
||||
order by max(create_time) desc
|
||||
limit #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectTransferNoOptions" resultType="String">
|
||||
select transfer_no
|
||||
from prc_order_bill
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
transfer_no like concat('%', #{keyword}, '%')
|
||||
</if>
|
||||
</where>
|
||||
group by transfer_no
|
||||
order by max(create_time) desc
|
||||
limit #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcOrderBillList" parameterType="PrcOrderBill" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
<where>
|
||||
@@ -132,9 +163,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="trackingNo != null and trackingNo != ''">
|
||||
AND tracking_no like concat('%', #{trackingNo}, '%')
|
||||
</if>
|
||||
<if test="trackingNos != null and trackingNos.size() > 0">
|
||||
AND tracking_no IN
|
||||
<foreach collection="trackingNos" item="tno" open="(" separator="," close=")">
|
||||
#{tno}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="transferNo != null and transferNo != ''">
|
||||
AND transfer_no like concat('%', #{transferNo}, '%')
|
||||
</if>
|
||||
<if test="transferNos != null and transferNos.size() > 0">
|
||||
AND transfer_no IN
|
||||
<foreach collection="transferNos" item="rno" open="(" separator="," close=")">
|
||||
#{rno}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="customerActiveStatus != null and customerActiveStatus != ''">
|
||||
AND customer_active_status = #{customerActiveStatus}
|
||||
</if>
|
||||
@@ -306,26 +349,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill">
|
||||
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,
|
||||
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
|
||||
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
|
||||
product_code, product_name, country_code, country_name, weight, biz_date, tms_id,
|
||||
match_source, match_message, price_set_id, price_set_code, price_set_name,
|
||||
set_type, bind_priority, customer_priceset_id, product_country_id,
|
||||
set_type, bind_priority, customer_priceset_id, psv_id, psd_id, product_country_id,
|
||||
weight_min, weight_max, weight_label, effective_date, charge_weight,
|
||||
freight_rate, base_freight_rate, discount_percent, registration_fee,
|
||||
freight_amount, surcharge_amount, income_total, pay_total, currency, ar_bill_status,
|
||||
customer_active_status, credit_arrears_status, round_mode,
|
||||
create_time
|
||||
) values (
|
||||
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo}, #{belongSaler}, #{settlementMan}, #{serviceMan},
|
||||
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode}, #{serviceMan},
|
||||
#{customerId}, #{customerCode}, #{customerName},
|
||||
#{pieces}, #{actualWeight}, #{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
|
||||
#{shipperName}, #{consigneeName}, #{destPostcode}, #{warehouseCode}, #{orderTime}, #{orderRemark},
|
||||
#{productCode}, #{productName}, #{countryCode}, #{countryName}, #{weight}, #{bizDate}, #{tmsId},
|
||||
#{matchSource}, #{matchMessage}, #{priceSetId}, #{priceSetCode}, #{priceSetName},
|
||||
#{setType}, #{bindPriority}, #{customerPricesetId}, #{productCountryId},
|
||||
#{setType}, #{bindPriority}, #{customerPricesetId}, #{psvId}, #{psdId}, #{productCountryId},
|
||||
#{weightMin}, #{weightMax}, #{weightLabel}, #{effectiveDate}, #{chargeWeight},
|
||||
#{freightRate}, #{baseFreightRate}, #{discountPercent}, #{registrationFee},
|
||||
#{freightAmount}, #{surchargeAmount}, #{incomeTotal}, #{payTotal}, #{currency}, #{arBillStatus},
|
||||
@@ -340,7 +385,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
tracking_no = #{trackingNo},
|
||||
transfer_no = #{transferNo},
|
||||
belong_saler = #{belongSaler},
|
||||
belong_saler_code = #{belongSalerCode},
|
||||
settlement_man = #{settlementMan},
|
||||
settlement_man_code = #{settlementManCode},
|
||||
service_man = #{serviceMan},
|
||||
customer_id = #{customerId},
|
||||
customer_code = #{customerCode},
|
||||
@@ -375,6 +422,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
set_type = #{setType},
|
||||
bind_priority = #{bindPriority},
|
||||
customer_priceset_id = #{customerPricesetId},
|
||||
psv_id = #{psvId},
|
||||
psd_id = #{psdId},
|
||||
product_country_id = #{productCountryId},
|
||||
weight_min = #{weightMin},
|
||||
weight_max = #{weightMax},
|
||||
|
||||
@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="PrcPayBillFee" id="PrcPayBillFeeResult">
|
||||
<id property="feeId" column="fee_id" />
|
||||
<result property="billId" column="bill_id" />
|
||||
<result property="payBillId" column="pay_bill_id" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="feeName" column="fee_name" />
|
||||
<result property="scId" column="sc_id" />
|
||||
@@ -14,11 +15,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<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
|
||||
where bill_id = #{billId}
|
||||
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 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 (
|
||||
#{feeId}, #{billId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
||||
#{feeId}, #{billId}, #{payBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
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
|
||||
<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())
|
||||
</foreach>
|
||||
</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,8 @@
|
||||
-- prc_order_bill:增加套餐版本ID、套餐明细ID
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
ALTER TABLE prc_order_bill
|
||||
ADD COLUMN psv_id BIGINT DEFAULT NULL COMMENT '套餐版本ID,对应 prc_price_set_version.psv_id' AFTER customer_priceset_id,
|
||||
ADD COLUMN psd_id BIGINT DEFAULT NULL COMMENT '套餐明细ID,对应 prc_price_set_detail.psd_id' AFTER psv_id,
|
||||
ADD KEY idx_order_bill_psv (psv_id),
|
||||
ADD KEY idx_order_bill_psd (psd_id);
|
||||
@@ -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;
|
||||
@@ -0,0 +1,38 @@
|
||||
-- =====================================================================
|
||||
-- 应收主表 prc_income_bill
|
||||
-- 位于 prc_order_bill(订单主表)与 prc_income_bill_fee(应收费用明细)之间
|
||||
-- 与 prc_order_bill 一对一(bill_id UNIQUE)
|
||||
-- 价格层:产品价 / 红线价 / 销售价(当前计费结果)
|
||||
-- 人员:业务员、结算员
|
||||
-- 说明:计费落库时写入;费用明细关联 income_bill_id
|
||||
-- =====================================================================
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS prc_income_bill (
|
||||
income_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 '红线价合计',
|
||||
sales_amount DECIMAL(18,4) DEFAULT NULL COMMENT '销售价合计(当前计费结果)',
|
||||
income_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 (income_bill_id),
|
||||
UNIQUE KEY uk_income_bill_order_bill (bill_id),
|
||||
KEY idx_income_bill_saler (belong_saler),
|
||||
KEY idx_income_bill_settlement (settlement_man),
|
||||
CONSTRAINT fk_income_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_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);
|
||||
Reference in New Issue
Block a user