修改计费信息表结构
This commit is contained in:
+6
-6
@@ -22,7 +22,7 @@ import com.ruoyi.price.domain.vo.TmsPriceQuoteResult;
|
||||
import com.ruoyi.price.search.EsBizLogSupport;
|
||||
import com.ruoyi.price.search.EsLogType;
|
||||
import com.ruoyi.price.search.IBillSearchStore;
|
||||
import com.ruoyi.price.service.IPrcBillService;
|
||||
import com.ruoyi.price.service.IPrcOrderBillService;
|
||||
import com.ruoyi.price.service.ITmsPriceQuoteService;
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ public class TmsPriceController extends BaseController
|
||||
private ITmsPriceQuoteService tmsPriceQuoteService;
|
||||
|
||||
@Autowired
|
||||
private IPrcBillService prcBillService;
|
||||
private IPrcOrderBillService prcOrderBillService;
|
||||
|
||||
@Autowired
|
||||
private TmsApiProperties tmsApiProperties;
|
||||
@@ -76,7 +76,7 @@ public class TmsPriceController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync order and persist receivable bill (prc_bill / prc_bill_fee).
|
||||
* Sync order and persist prc_order_bill / prc_income_bill_fee.
|
||||
* Same price match as quote. Same orderNo upserts.
|
||||
*/
|
||||
@PostMapping("/bill")
|
||||
@@ -93,12 +93,12 @@ public class TmsPriceController extends BaseController
|
||||
EsBizLogSupport.saveFail(billSearchStore, EsLogType.BILL, EsBizLogSupport.billFailBizId(request), request, e);
|
||||
throw e;
|
||||
}
|
||||
TmsPriceQuoteResult result = prcBillService.bill(request);
|
||||
TmsPriceQuoteResult result = prcOrderBillService.bill(request);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query receivable bill by orderNo after sync.
|
||||
* Query order bill by orderNo after sync.
|
||||
*/
|
||||
@GetMapping("/bill/by-order/{orderNo}")
|
||||
public AjaxResult getBillByOrder(
|
||||
@@ -107,7 +107,7 @@ public class TmsPriceController extends BaseController
|
||||
@RequestParam(value = "apiCode", required = false) String apiCode)
|
||||
{
|
||||
assertApiCode(headerApiCode, apiCode);
|
||||
return success(prcBillService.getBillByOrderNo(orderNo));
|
||||
return success(prcOrderBillService.getBillByOrderNo(orderNo));
|
||||
}
|
||||
|
||||
private void assertApiCode(String headerApiCode, String bodyApiCode)
|
||||
|
||||
+7
-7
@@ -13,12 +13,12 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.price.domain.PrcBill;
|
||||
import com.ruoyi.price.domain.PrcOrderBill;
|
||||
import com.ruoyi.price.domain.PrcQuote;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceBillRequest;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceQuoteRequest;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceQuoteResult;
|
||||
import com.ruoyi.price.service.IPrcBillService;
|
||||
import com.ruoyi.price.service.IPrcOrderBillService;
|
||||
import com.ruoyi.price.service.ITmsPriceQuoteService;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ public class BillingController extends BaseController
|
||||
private ITmsPriceQuoteService tmsPriceQuoteService;
|
||||
|
||||
@Autowired
|
||||
private IPrcBillService prcBillService;
|
||||
private IPrcOrderBillService prcOrderBillService;
|
||||
|
||||
/**
|
||||
* Historical quote list.
|
||||
@@ -71,10 +71,10 @@ public class BillingController extends BaseController
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill')")
|
||||
@GetMapping("/bill/list")
|
||||
public TableDataInfo billList(PrcBill query)
|
||||
public TableDataInfo billList(PrcOrderBill query)
|
||||
{
|
||||
startPage();
|
||||
List<PrcBill> list = prcBillService.selectBillList(query);
|
||||
List<PrcOrderBill> list = prcOrderBillService.selectBillList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@@ -82,14 +82,14 @@ public class BillingController extends BaseController
|
||||
@GetMapping("/bill/{billId}")
|
||||
public AjaxResult getBill(@PathVariable String billId)
|
||||
{
|
||||
return success(prcBillService.getBill(billId));
|
||||
return success(prcOrderBillService.getBill(billId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill')")
|
||||
@PostMapping("/bill")
|
||||
public AjaxResult bill(@Validated @RequestBody TmsPriceBillRequest request)
|
||||
{
|
||||
TmsPriceQuoteResult result = prcBillService.bill(request);
|
||||
TmsPriceQuoteResult result = prcOrderBillService.bill(request);
|
||||
return success(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
|
||||
/** receivable fee detail prc_income_bill_fee */
|
||||
@Data
|
||||
public class PrcIncomeBillFee implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String feeId;
|
||||
private String billId;
|
||||
private String feeType;
|
||||
private String feeName;
|
||||
private Long scId;
|
||||
private BigDecimal amount;
|
||||
private String currency;
|
||||
private String roundMode;
|
||||
private String remark;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
}
|
||||
+8
-4
@@ -8,10 +8,10 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/** receivable bill header prc_bill */
|
||||
/** order info header prc_order_bill */
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PrcBill extends BaseEntity
|
||||
public class PrcOrderBill extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -66,9 +66,13 @@ public class PrcBill extends BaseEntity
|
||||
private BigDecimal registrationFee;
|
||||
private BigDecimal freightAmount;
|
||||
private BigDecimal surchargeAmount;
|
||||
private BigDecimal payableTotal;
|
||||
/** receivable total */
|
||||
private BigDecimal incomeTotal;
|
||||
/** payable total */
|
||||
private BigDecimal payTotal;
|
||||
private String currency;
|
||||
private String roundMode;
|
||||
|
||||
private List<PrcBillFee> fees;
|
||||
private List<PrcIncomeBillFee> incomeFees;
|
||||
private List<PrcPayBillFee> payFees;
|
||||
}
|
||||
+2
-2
@@ -6,9 +6,9 @@ import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
/** receivable bill fee detail prc_bill_fee */
|
||||
/** payable fee detail prc_pay_bill_fee */
|
||||
@Data
|
||||
public class PrcBillFee implements Serializable
|
||||
public class PrcPayBillFee implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -47,6 +47,11 @@ public class TmsPriceQuoteResult implements Serializable
|
||||
private BigDecimal freightAmount;
|
||||
/** 附加费合计(按产品关联命中后汇总) */
|
||||
private BigDecimal surchargeAmount;
|
||||
/** receivable total (order bill) */
|
||||
private BigDecimal incomeTotal;
|
||||
/** payable total (order bill); also quote payable */
|
||||
private BigDecimal payTotal;
|
||||
/** quote / legacy field; same as incomeTotal for bill sync */
|
||||
private BigDecimal payableTotal;
|
||||
private String currency = "CNY";
|
||||
/** UP / DOWN / HALF_UP */
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.ruoyi.price.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.price.domain.PrcBillFee;
|
||||
|
||||
/** receivable bill fee detail mapper */
|
||||
public interface PrcBillFeeMapper
|
||||
{
|
||||
public List<PrcBillFee> selectByBillId(String billId);
|
||||
|
||||
public int insertPrcBillFee(PrcBillFee fee);
|
||||
|
||||
public int insertBatch(@Param("list") List<PrcBillFee> fees);
|
||||
|
||||
public int deleteByBillId(String billId);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.ruoyi.price.mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.price.domain.PrcBill;
|
||||
|
||||
/** receivable bill header mapper */
|
||||
public interface PrcBillMapper
|
||||
{
|
||||
public PrcBill selectPrcBillByOrderNo(String orderNo);
|
||||
|
||||
public PrcBill selectPrcBillById(String billId);
|
||||
|
||||
public List<PrcBill> selectPrcBillList(PrcBill bill);
|
||||
|
||||
public int insertPrcBill(PrcBill bill);
|
||||
|
||||
public int updatePrcBill(PrcBill bill);
|
||||
|
||||
public int updateBillAmounts(@Param("billId") String billId,
|
||||
@Param("surchargeAmount") BigDecimal surchargeAmount,
|
||||
@Param("payableTotal") BigDecimal payableTotal);
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.price.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.price.domain.PrcIncomeBillFee;
|
||||
|
||||
/** receivable bill fee mapper */
|
||||
public interface PrcIncomeBillFeeMapper
|
||||
{
|
||||
public List<PrcIncomeBillFee> selectByBillId(String billId);
|
||||
|
||||
public int insertPrcIncomeBillFee(PrcIncomeBillFee fee);
|
||||
|
||||
public int insertBatch(@Param("list") List<PrcIncomeBillFee> fees);
|
||||
|
||||
public int deleteByBillId(String billId);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ruoyi.price.mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.price.domain.PrcOrderBill;
|
||||
|
||||
/** order bill header mapper */
|
||||
public interface PrcOrderBillMapper
|
||||
{
|
||||
public PrcOrderBill selectPrcOrderBillByOrderNo(String orderNo);
|
||||
|
||||
public PrcOrderBill selectPrcOrderBillById(String billId);
|
||||
|
||||
public List<PrcOrderBill> selectPrcOrderBillList(PrcOrderBill bill);
|
||||
|
||||
public int insertPrcOrderBill(PrcOrderBill bill);
|
||||
|
||||
public int updatePrcOrderBill(PrcOrderBill bill);
|
||||
|
||||
public int updateOrderBillAmounts(@Param("billId") String billId,
|
||||
@Param("surchargeAmount") BigDecimal surchargeAmount,
|
||||
@Param("incomeTotal") BigDecimal incomeTotal,
|
||||
@Param("payTotal") BigDecimal payTotal);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.price.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.price.domain.PrcPayBillFee;
|
||||
|
||||
/** payable bill fee mapper */
|
||||
public interface PrcPayBillFeeMapper
|
||||
{
|
||||
public List<PrcPayBillFee> selectByBillId(String billId);
|
||||
|
||||
public int insertPrcPayBillFee(PrcPayBillFee fee);
|
||||
|
||||
public int insertBatch(@Param("list") List<PrcPayBillFee> fees);
|
||||
|
||||
public int deleteByBillId(String billId);
|
||||
}
|
||||
+4
-4
@@ -1,16 +1,16 @@
|
||||
package com.ruoyi.price.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.price.domain.PrcBill;
|
||||
import com.ruoyi.price.domain.PrcOrderBill;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceBillRequest;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceQuoteResult;
|
||||
|
||||
/** Receivable billing from synced orders. Same price match as quote, persist prc_bill. */
|
||||
public interface IPrcBillService
|
||||
/** Order billing: persist prc_order_bill + prc_income_bill_fee. Same price match as quote. */
|
||||
public interface IPrcOrderBillService
|
||||
{
|
||||
TmsPriceQuoteResult bill(TmsPriceBillRequest request);
|
||||
|
||||
List<PrcBill> selectBillList(PrcBill query);
|
||||
List<PrcOrderBill> selectBillList(PrcOrderBill query);
|
||||
|
||||
TmsPriceQuoteResult getBill(String billId);
|
||||
|
||||
+35
-29
@@ -16,30 +16,30 @@ 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.PrcBill;
|
||||
import com.ruoyi.price.domain.PrcBillFee;
|
||||
import com.ruoyi.price.domain.PrcIncomeBillFee;
|
||||
import com.ruoyi.price.domain.PrcOrderBill;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceBillRequest;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceQuoteFeeLine;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceQuoteResult;
|
||||
import com.ruoyi.price.mapper.PrcBillFeeMapper;
|
||||
import com.ruoyi.price.mapper.PrcBillMapper;
|
||||
import com.ruoyi.price.mapper.PrcIncomeBillFeeMapper;
|
||||
import com.ruoyi.price.mapper.PrcOrderBillMapper;
|
||||
import com.ruoyi.price.search.EsBizLogSupport;
|
||||
import com.ruoyi.price.search.EsLogType;
|
||||
import com.ruoyi.price.search.IBillSearchStore;
|
||||
import com.ruoyi.price.service.IPrcBillService;
|
||||
import com.ruoyi.price.service.IPrcOrderBillService;
|
||||
import com.ruoyi.price.service.ITmsPriceQuoteService;
|
||||
|
||||
@Service
|
||||
public class PrcBillServiceImpl implements IPrcBillService
|
||||
public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
{
|
||||
@Autowired
|
||||
private ITmsPriceQuoteService tmsPriceQuoteService;
|
||||
|
||||
@Autowired
|
||||
private PrcBillMapper billMapper;
|
||||
private PrcOrderBillMapper orderBillMapper;
|
||||
|
||||
@Autowired
|
||||
private PrcBillFeeMapper billFeeMapper;
|
||||
private PrcIncomeBillFeeMapper incomeBillFeeMapper;
|
||||
|
||||
@Autowired
|
||||
private IBillSearchStore billSearchStore;
|
||||
@@ -73,9 +73,9 @@ public class PrcBillServiceImpl implements IPrcBillService
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PrcBill> selectBillList(PrcBill query)
|
||||
public List<PrcOrderBill> selectBillList(PrcOrderBill query)
|
||||
{
|
||||
return billMapper.selectPrcBillList(query);
|
||||
return orderBillMapper.selectPrcOrderBillList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,12 +85,12 @@ public class PrcBillServiceImpl implements IPrcBillService
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
|
||||
}
|
||||
PrcBill bill = billMapper.selectPrcBillById(billId);
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
|
||||
if (bill == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
|
||||
}
|
||||
return toResult(bill, billFeeMapper.selectByBillId(billId));
|
||||
return toResult(bill, incomeBillFeeMapper.selectByBillId(billId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,12 +100,12 @@ public class PrcBillServiceImpl implements IPrcBillService
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.orderNoRequired"));
|
||||
}
|
||||
PrcBill bill = billMapper.selectPrcBillByOrderNo(orderNo.trim());
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillByOrderNo(orderNo.trim());
|
||||
if (bill == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
|
||||
}
|
||||
return toResult(bill, billFeeMapper.selectByBillId(bill.getBillId()));
|
||||
return toResult(bill, incomeBillFeeMapper.selectByBillId(bill.getBillId()));
|
||||
}
|
||||
|
||||
private void persistBill(TmsPriceBillRequest request, BigDecimal weight, Date bizDate,
|
||||
@@ -113,8 +113,8 @@ public class PrcBillServiceImpl implements IPrcBillService
|
||||
{
|
||||
String orderNo = request.getOrderNo();
|
||||
String billKey = Md5Utils.hash(orderNo);
|
||||
PrcBill existed = billMapper.selectPrcBillByOrderNo(orderNo);
|
||||
PrcBill bill = existed == null ? new PrcBill() : existed;
|
||||
PrcOrderBill existed = orderBillMapper.selectPrcOrderBillByOrderNo(orderNo);
|
||||
PrcOrderBill bill = existed == null ? new PrcOrderBill() : existed;
|
||||
if (existed == null)
|
||||
{
|
||||
bill.setBillId(UUID.randomUUID().toString());
|
||||
@@ -165,41 +165,45 @@ public class PrcBillServiceImpl implements IPrcBillService
|
||||
bill.setRegistrationFee(result.getRegistrationFee());
|
||||
bill.setFreightAmount(result.getFreightAmount());
|
||||
bill.setSurchargeAmount(result.getSurchargeAmount());
|
||||
bill.setPayableTotal(result.getPayableTotal());
|
||||
bill.setIncomeTotal(result.getPayableTotal());
|
||||
bill.setPayTotal(result.getPayTotal() == null ? BigDecimal.ZERO : result.getPayTotal());
|
||||
bill.setCurrency(result.getCurrency());
|
||||
bill.setRoundMode(result.getRoundMode());
|
||||
result.setBillId(bill.getBillId());
|
||||
result.setOrderNo(orderNo);
|
||||
result.setCustomerCode(request.getCustomerCode());
|
||||
result.setIncomeTotal(bill.getIncomeTotal());
|
||||
result.setPayTotal(bill.getPayTotal());
|
||||
result.setPayableTotal(bill.getIncomeTotal());
|
||||
fillResultOrder(result, bill);
|
||||
result.setFromCache(Boolean.valueOf(existed != null));
|
||||
if (existed == null)
|
||||
{
|
||||
billMapper.insertPrcBill(bill);
|
||||
orderBillMapper.insertPrcOrderBill(bill);
|
||||
}
|
||||
else
|
||||
{
|
||||
billMapper.updatePrcBill(bill);
|
||||
billFeeMapper.deleteByBillId(bill.getBillId());
|
||||
orderBillMapper.updatePrcOrderBill(bill);
|
||||
incomeBillFeeMapper.deleteByBillId(bill.getBillId());
|
||||
}
|
||||
List<PrcBillFee> fees = toFeeRows(bill.getBillId(), result);
|
||||
List<PrcIncomeBillFee> fees = toFeeRows(bill.getBillId(), result);
|
||||
if (!fees.isEmpty())
|
||||
{
|
||||
billFeeMapper.insertBatch(fees);
|
||||
incomeBillFeeMapper.insertBatch(fees);
|
||||
}
|
||||
billSearchStore.save(EsLogType.BILL, orderNo, toRequestJson(request), toResponseJson(result));
|
||||
}
|
||||
|
||||
private List<PrcBillFee> toFeeRows(String billId, TmsPriceQuoteResult result)
|
||||
private List<PrcIncomeBillFee> toFeeRows(String billId, TmsPriceQuoteResult result)
|
||||
{
|
||||
List<PrcBillFee> fees = new ArrayList<PrcBillFee>();
|
||||
List<PrcIncomeBillFee> fees = new ArrayList<PrcIncomeBillFee>();
|
||||
if (result.getFeeDetails() == null)
|
||||
{
|
||||
return fees;
|
||||
}
|
||||
for (TmsPriceQuoteFeeLine line : result.getFeeDetails())
|
||||
{
|
||||
PrcBillFee fee = new PrcBillFee();
|
||||
PrcIncomeBillFee fee = new PrcIncomeBillFee();
|
||||
fee.setFeeId(UUID.randomUUID().toString());
|
||||
fee.setBillId(billId);
|
||||
fee.setFeeType(line.getFeeType());
|
||||
@@ -214,7 +218,7 @@ public class PrcBillServiceImpl implements IPrcBillService
|
||||
return fees;
|
||||
}
|
||||
|
||||
private TmsPriceQuoteResult toResult(PrcBill bill, List<PrcBillFee> fees)
|
||||
private TmsPriceQuoteResult toResult(PrcOrderBill bill, List<PrcIncomeBillFee> fees)
|
||||
{
|
||||
TmsPriceQuoteResult r = new TmsPriceQuoteResult();
|
||||
r.setBillId(bill.getBillId());
|
||||
@@ -248,14 +252,16 @@ public class PrcBillServiceImpl implements IPrcBillService
|
||||
r.setRegistrationFee(bill.getRegistrationFee());
|
||||
r.setFreightAmount(bill.getFreightAmount());
|
||||
r.setSurchargeAmount(bill.getSurchargeAmount());
|
||||
r.setPayableTotal(bill.getPayableTotal());
|
||||
r.setIncomeTotal(bill.getIncomeTotal());
|
||||
r.setPayTotal(bill.getPayTotal());
|
||||
r.setPayableTotal(bill.getIncomeTotal());
|
||||
r.setCurrency(bill.getCurrency());
|
||||
r.setRoundMode(bill.getRoundMode());
|
||||
r.setBizDate(bill.getBizDate());
|
||||
List<TmsPriceQuoteFeeLine> lines = new ArrayList<TmsPriceQuoteFeeLine>();
|
||||
if (fees != null)
|
||||
{
|
||||
for (PrcBillFee fee : fees)
|
||||
for (PrcIncomeBillFee fee : fees)
|
||||
{
|
||||
TmsPriceQuoteFeeLine line = new TmsPriceQuoteFeeLine();
|
||||
line.setFeeType(fee.getFeeType());
|
||||
@@ -272,7 +278,7 @@ public class PrcBillServiceImpl implements IPrcBillService
|
||||
return r;
|
||||
}
|
||||
|
||||
private void fillResultOrder(TmsPriceQuoteResult r, PrcBill bill)
|
||||
private void fillResultOrder(TmsPriceQuoteResult r, PrcOrderBill bill)
|
||||
{
|
||||
r.setTrackingNo(bill.getTrackingNo());
|
||||
r.setCustomerName(bill.getCustomerName());
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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.PrcIncomeBillFeeMapper">
|
||||
|
||||
<resultMap type="PrcIncomeBillFee" id="PrcIncomeBillFeeResult">
|
||||
<id property="feeId" column="fee_id" />
|
||||
<result property="billId" column="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" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</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
|
||||
from prc_income_bill_fee
|
||||
where bill_id = #{billId}
|
||||
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE'), fee_id
|
||||
</select>
|
||||
|
||||
<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
|
||||
) values (
|
||||
#{feeId}, #{billId}, #{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
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.feeId}, #{item.billId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
||||
#{item.currency}, #{item.roundMode}, #{item.remark}, sysdate())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
delete from prc_income_bill_fee where bill_id = #{billId}
|
||||
</delete>
|
||||
</mapper>
|
||||
+25
-22
@@ -2,9 +2,9 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.price.mapper.PrcBillMapper">
|
||||
<mapper namespace="com.ruoyi.price.mapper.PrcOrderBillMapper">
|
||||
|
||||
<resultMap type="PrcBill" id="PrcBillResult">
|
||||
<resultMap type="PrcOrderBill" id="PrcOrderBillResult">
|
||||
<id property="billId" column="bill_id" />
|
||||
<result property="billKey" column="bill_key" />
|
||||
<result property="orderNo" column="order_no" />
|
||||
@@ -52,7 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="registrationFee" column="registration_fee" />
|
||||
<result property="freightAmount" column="freight_amount" />
|
||||
<result property="surchargeAmount" column="surcharge_amount" />
|
||||
<result property="payableTotal" column="payable_total" />
|
||||
<result property="incomeTotal" column="income_total" />
|
||||
<result property="payTotal" column="pay_total" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="createBy" column="created_by" />
|
||||
@@ -61,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcBillVo">
|
||||
<sql id="selectPrcOrderBillVo">
|
||||
select bill_id, bill_key, order_no, tracking_no, 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,
|
||||
@@ -70,23 +71,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
set_type, bind_priority, customer_priceset_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, payable_total, currency, round_mode,
|
||||
freight_amount, surcharge_amount, income_total, pay_total, currency, round_mode,
|
||||
created_by, create_time, updated_by, update_time
|
||||
from prc_bill
|
||||
from prc_order_bill
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcBillByOrderNo" parameterType="String" resultMap="PrcBillResult">
|
||||
<include refid="selectPrcBillVo"/>
|
||||
<select id="selectPrcOrderBillByOrderNo" parameterType="String" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
where order_no = #{orderNo}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcBillById" parameterType="String" resultMap="PrcBillResult">
|
||||
<include refid="selectPrcBillVo"/>
|
||||
<select id="selectPrcOrderBillById" parameterType="String" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
where bill_id = #{billId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcBillList" parameterType="PrcBill" resultMap="PrcBillResult">
|
||||
<include refid="selectPrcBillVo"/>
|
||||
<select id="selectPrcOrderBillList" parameterType="PrcOrderBill" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
<where>
|
||||
<if test="orderNo != null and orderNo != ''">
|
||||
AND order_no like concat('%', #{orderNo}, '%')
|
||||
@@ -122,8 +123,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by create_time desc, bill_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcBill" parameterType="PrcBill">
|
||||
insert into prc_bill (
|
||||
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill">
|
||||
insert into prc_order_bill (
|
||||
bill_id, bill_key, order_no, tracking_no, 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,
|
||||
@@ -132,7 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
set_type, bind_priority, customer_priceset_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, payable_total, currency, round_mode,
|
||||
freight_amount, surcharge_amount, income_total, pay_total, currency, round_mode,
|
||||
create_time
|
||||
) values (
|
||||
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{customerId}, #{customerCode}, #{customerName},
|
||||
@@ -143,13 +144,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{setType}, #{bindPriority}, #{customerPricesetId}, #{productCountryId},
|
||||
#{weightMin}, #{weightMax}, #{weightLabel}, #{effectiveDate}, #{chargeWeight},
|
||||
#{freightRate}, #{baseFreightRate}, #{discountPercent}, #{registrationFee},
|
||||
#{freightAmount}, #{surchargeAmount}, #{payableTotal}, #{currency}, #{roundMode},
|
||||
#{freightAmount}, #{surchargeAmount}, #{incomeTotal}, #{payTotal}, #{currency}, #{roundMode},
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcBill" parameterType="PrcBill">
|
||||
update prc_bill
|
||||
<update id="updatePrcOrderBill" parameterType="PrcOrderBill">
|
||||
update prc_order_bill
|
||||
set bill_key = #{billKey},
|
||||
tracking_no = #{trackingNo},
|
||||
customer_id = #{customerId},
|
||||
@@ -195,17 +196,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
registration_fee = #{registrationFee},
|
||||
freight_amount = #{freightAmount},
|
||||
surcharge_amount = #{surchargeAmount},
|
||||
payable_total = #{payableTotal},
|
||||
income_total = #{incomeTotal},
|
||||
pay_total = #{payTotal},
|
||||
currency = #{currency},
|
||||
round_mode = #{roundMode},
|
||||
update_time = sysdate()
|
||||
where bill_id = #{billId}
|
||||
</update>
|
||||
|
||||
<update id="updateBillAmounts">
|
||||
update prc_bill
|
||||
<update id="updateOrderBillAmounts">
|
||||
update prc_order_bill
|
||||
set surcharge_amount = #{surchargeAmount},
|
||||
payable_total = #{payableTotal},
|
||||
income_total = #{incomeTotal},
|
||||
pay_total = #{payTotal},
|
||||
update_time = sysdate()
|
||||
where bill_id = #{billId}
|
||||
</update>
|
||||
+8
-8
@@ -2,9 +2,9 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.price.mapper.PrcBillFeeMapper">
|
||||
<mapper namespace="com.ruoyi.price.mapper.PrcPayBillFeeMapper">
|
||||
|
||||
<resultMap type="PrcBillFee" id="PrcBillFeeResult">
|
||||
<resultMap type="PrcPayBillFee" id="PrcPayBillFeeResult">
|
||||
<id property="feeId" column="fee_id" />
|
||||
<result property="billId" column="bill_id" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
@@ -17,15 +17,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcBillFeeResult">
|
||||
<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
|
||||
from prc_bill_fee
|
||||
from prc_pay_bill_fee
|
||||
where bill_id = #{billId}
|
||||
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE'), fee_id
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcBillFee" parameterType="PrcBillFee">
|
||||
insert into prc_bill_fee (
|
||||
<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
|
||||
) values (
|
||||
#{feeId}, #{billId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
||||
@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
insert into prc_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
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
@@ -43,6 +43,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
delete from prc_bill_fee where bill_id = #{billId}
|
||||
delete from prc_pay_bill_fee where bill_id = #{billId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -1,8 +1,10 @@
|
||||
-- prc_bill / prc_bill_fee: receivable billing from synced orders
|
||||
-- prc_order_bill: order info header
|
||||
-- prc_income_bill_fee: receivable fee lines
|
||||
-- prc_pay_bill_fee: payable fee lines
|
||||
-- fields follow prc_quote / prc_quote_fee; extra order_no + customer_code
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS prc_bill (
|
||||
CREATE TABLE IF NOT EXISTS prc_order_bill (
|
||||
bill_id VARCHAR(36) NOT NULL COMMENT '计费ID',
|
||||
bill_key CHAR(32) NOT NULL COMMENT 'MD5(order_no)',
|
||||
order_no VARCHAR(64) NOT NULL COMMENT '订单号',
|
||||
@@ -50,7 +52,8 @@ CREATE TABLE IF NOT EXISTS prc_bill (
|
||||
registration_fee DECIMAL(10,2) DEFAULT NULL COMMENT '挂号费',
|
||||
freight_amount DECIMAL(10,2) DEFAULT NULL COMMENT '运费金额',
|
||||
surcharge_amount DECIMAL(10,2) DEFAULT NULL COMMENT '附加费合计',
|
||||
payable_total DECIMAL(10,2) DEFAULT NULL COMMENT '应收总额',
|
||||
income_total DECIMAL(10,2) DEFAULT NULL COMMENT '应收总额',
|
||||
pay_total DECIMAL(10,2) DEFAULT NULL COMMENT '应付总额',
|
||||
currency VARCHAR(10) NOT NULL DEFAULT 'CNY' COMMENT '币种',
|
||||
round_mode VARCHAR(20) NOT NULL DEFAULT 'HALF_UP' COMMENT '取值方式',
|
||||
created_by VARCHAR(64) DEFAULT '' COMMENT '创建人',
|
||||
@@ -62,9 +65,9 @@ CREATE TABLE IF NOT EXISTS prc_bill (
|
||||
UNIQUE KEY uk_bill_key (bill_key),
|
||||
INDEX idx_bill_customer (customer_code, biz_date),
|
||||
INDEX idx_bill_product (product_code, country_code)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='计费应收主表-订单同步计费';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='订单信息主表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS prc_bill_fee (
|
||||
CREATE TABLE IF NOT EXISTS prc_income_bill_fee (
|
||||
fee_id VARCHAR(36) NOT NULL COMMENT '费用明细ID',
|
||||
bill_id VARCHAR(36) NOT NULL COMMENT '计费ID',
|
||||
fee_type VARCHAR(30) NOT NULL COMMENT '费用类型(字典bms_fee_type)',
|
||||
@@ -76,7 +79,24 @@ CREATE TABLE IF NOT EXISTS prc_bill_fee (
|
||||
remark VARCHAR(500) DEFAULT NULL COMMENT '备注',
|
||||
create_time DATETIME DEFAULT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY (fee_id),
|
||||
UNIQUE KEY uk_bill_fee_item (bill_id, fee_type, sc_id),
|
||||
INDEX idx_bill_fee_type (fee_type),
|
||||
CONSTRAINT fk_bill_fee_bill FOREIGN KEY (bill_id) REFERENCES prc_bill (bill_id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='计费应收费用明细';
|
||||
UNIQUE KEY uk_income_bill_fee_item (bill_id, fee_type, sc_id),
|
||||
INDEX idx_income_bill_fee_type (fee_type),
|
||||
CONSTRAINT fk_income_bill_fee_order FOREIGN KEY (bill_id) REFERENCES prc_order_bill (bill_id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='应收费用明细';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS prc_pay_bill_fee (
|
||||
fee_id VARCHAR(36) NOT NULL COMMENT '费用明细ID',
|
||||
bill_id VARCHAR(36) NOT NULL COMMENT '计费ID',
|
||||
fee_type VARCHAR(30) NOT NULL COMMENT '费用类型(字典bms_fee_type)',
|
||||
fee_name VARCHAR(100) DEFAULT NULL COMMENT '费用名称',
|
||||
sc_id BIGINT(20) NOT NULL DEFAULT 0 COMMENT '附加费配置ID',
|
||||
amount DECIMAL(12,2) NOT NULL DEFAULT 0 COMMENT '金额',
|
||||
currency VARCHAR(10) NOT NULL DEFAULT 'CNY' COMMENT '币种',
|
||||
round_mode VARCHAR(20) DEFAULT 'HALF_UP' COMMENT '取值方式',
|
||||
remark VARCHAR(500) DEFAULT NULL COMMENT '备注',
|
||||
create_time DATETIME DEFAULT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY (fee_id),
|
||||
UNIQUE KEY uk_pay_bill_fee_item (bill_id, fee_type, sc_id),
|
||||
INDEX idx_pay_bill_fee_type (fee_type),
|
||||
CONSTRAINT fk_pay_bill_fee_order 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,35 @@
|
||||
-- prc_order_bill: income_total + pay_total
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @db := DATABASE();
|
||||
|
||||
SET @has_income := (
|
||||
SELECT COUNT(*) FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'prc_order_bill' AND COLUMN_NAME = 'income_total'
|
||||
);
|
||||
SET @has_payable := (
|
||||
SELECT COUNT(*) FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'prc_order_bill' AND COLUMN_NAME = 'payable_total'
|
||||
);
|
||||
SET @sql := IF(@has_income = 0 AND @has_payable > 0,
|
||||
'ALTER TABLE prc_order_bill CHANGE COLUMN payable_total income_total DECIMAL(10,2) DEFAULT NULL COMMENT \'应收总额\'',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @has_income2 := (
|
||||
SELECT COUNT(*) FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'prc_order_bill' AND COLUMN_NAME = 'income_total'
|
||||
);
|
||||
SET @sql := IF(@has_income2 = 0,
|
||||
'ALTER TABLE prc_order_bill ADD COLUMN income_total DECIMAL(10,2) DEFAULT NULL COMMENT \'应收总额\' AFTER surcharge_amount',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @has_pay := (
|
||||
SELECT COUNT(*) FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'prc_order_bill' AND COLUMN_NAME = 'pay_total'
|
||||
);
|
||||
SET @sql := IF(@has_pay = 0,
|
||||
'ALTER TABLE prc_order_bill ADD COLUMN pay_total DECIMAL(10,2) DEFAULT NULL COMMENT \'应付总额\' AFTER income_total',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
@@ -0,0 +1,68 @@
|
||||
-- rename prc_bill -> prc_order_bill, prc_bill_fee -> prc_income_bill_fee, add prc_pay_bill_fee
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @db := DATABASE();
|
||||
|
||||
SET @fk := (
|
||||
SELECT CONSTRAINT_NAME FROM information_schema.TABLE_CONSTRAINTS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'prc_bill_fee' AND CONSTRAINT_TYPE = 'FOREIGN KEY'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @sql := IF(@fk IS NOT NULL,
|
||||
CONCAT('ALTER TABLE prc_bill_fee DROP FOREIGN KEY `', @fk, '`'),
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @has_old := (
|
||||
SELECT COUNT(*) FROM information_schema.TABLES
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'prc_bill'
|
||||
);
|
||||
SET @has_new := (
|
||||
SELECT COUNT(*) FROM information_schema.TABLES
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'prc_order_bill'
|
||||
);
|
||||
SET @sql := IF(@has_old > 0 AND @has_new = 0, 'RENAME TABLE prc_bill TO prc_order_bill', 'SELECT 1');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @has_old_fee := (
|
||||
SELECT COUNT(*) FROM information_schema.TABLES
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'prc_bill_fee'
|
||||
);
|
||||
SET @has_new_fee := (
|
||||
SELECT COUNT(*) FROM information_schema.TABLES
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'prc_income_bill_fee'
|
||||
);
|
||||
SET @sql := IF(@has_old_fee > 0 AND @has_new_fee = 0, 'RENAME TABLE prc_bill_fee TO prc_income_bill_fee', 'SELECT 1');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @fk2 := (
|
||||
SELECT CONSTRAINT_NAME FROM information_schema.TABLE_CONSTRAINTS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'prc_income_bill_fee'
|
||||
AND CONSTRAINT_TYPE = 'FOREIGN KEY'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @sql := IF(@fk2 IS NULL,
|
||||
'ALTER TABLE prc_income_bill_fee ADD CONSTRAINT fk_income_bill_fee_order FOREIGN KEY (bill_id) REFERENCES prc_order_bill (bill_id) ON DELETE CASCADE',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
ALTER TABLE prc_order_bill COMMENT = '订单信息主表';
|
||||
ALTER TABLE prc_income_bill_fee COMMENT = '应收费用明细';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS prc_pay_bill_fee (
|
||||
fee_id VARCHAR(36) NOT NULL COMMENT '费用明细ID',
|
||||
bill_id VARCHAR(36) NOT NULL COMMENT '计费ID',
|
||||
fee_type VARCHAR(30) NOT NULL COMMENT '费用类型(字典bms_fee_type)',
|
||||
fee_name VARCHAR(100) DEFAULT NULL COMMENT '费用名称',
|
||||
sc_id BIGINT(20) NOT NULL DEFAULT 0 COMMENT '附加费配置ID',
|
||||
amount DECIMAL(12,2) NOT NULL DEFAULT 0 COMMENT '金额',
|
||||
currency VARCHAR(10) NOT NULL DEFAULT 'CNY' COMMENT '币种',
|
||||
round_mode VARCHAR(20) DEFAULT 'HALF_UP' COMMENT '取值方式',
|
||||
remark VARCHAR(500) DEFAULT NULL COMMENT '备注',
|
||||
create_time DATETIME DEFAULT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY (fee_id),
|
||||
UNIQUE KEY uk_pay_bill_fee_item (bill_id, fee_type, sc_id),
|
||||
INDEX idx_pay_bill_fee_type (fee_type),
|
||||
CONSTRAINT fk_pay_bill_fee_order FOREIGN KEY (bill_id) REFERENCES prc_order_bill (bill_id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='应付费用明细';
|
||||
@@ -16,8 +16,11 @@
|
||||
<template #col-matchSource="{ row }">
|
||||
<el-tag size="small" :type="sourceTagType(row.matchSource)">{{ sourceLabel(row.matchSource) }}</el-tag>
|
||||
</template>
|
||||
<template #col-payableTotal="{ row }">
|
||||
<span class="payable">{{ formatMoney(row.payableTotal) }}</span>
|
||||
<template #col-incomeTotal="{ row }">
|
||||
<span class="payable">{{ formatMoney(row.incomeTotal) }}</span>
|
||||
</template>
|
||||
<template #col-payTotal="{ row }">
|
||||
<span class="payable">{{ formatMoney(row.payTotal) }}</span>
|
||||
</template>
|
||||
<template #col-action="{ row }">
|
||||
<el-button link type="primary" icon="View" @click="handleView(row)">查看</el-button>
|
||||
@@ -47,7 +50,8 @@ const columns = [
|
||||
{ label: '国家', prop: 'country', minWidth: 130, slot: 'country' },
|
||||
{ label: '件数', prop: 'pieces', align: 'center', width: 70 },
|
||||
{ label: '计费重', prop: 'chargeWeight', align: 'center', width: 90 },
|
||||
{ label: '应收总额', prop: 'payableTotal', align: 'right', width: 120, slot: 'payableTotal' },
|
||||
{ label: '应收总额', prop: 'incomeTotal', align: 'right', width: 120, slot: 'incomeTotal' },
|
||||
{ label: '应付总额', prop: 'payTotal', align: 'right', width: 120, slot: 'payTotal' },
|
||||
{ label: '计价来源', prop: 'matchSource', align: 'center', width: 130, slot: 'matchSource' },
|
||||
{ label: '下单时间', prop: 'orderTime', align: 'center', width: 170, parseTime: true },
|
||||
{ label: '操作', prop: 'action', align: 'center', width: 90, fixed: 'right', slot: 'action', showInToolbar: false }
|
||||
|
||||
@@ -49,7 +49,11 @@
|
||||
</div>
|
||||
<div class="amount-card is-total">
|
||||
<div class="amount-label">应收总额</div>
|
||||
<div class="amount-value">{{ formatMoney(detail.payableTotal) }}</div>
|
||||
<div class="amount-value">{{ formatMoney(detail.incomeTotal ?? detail.payableTotal) }}</div>
|
||||
</div>
|
||||
<div class="amount-card is-total">
|
||||
<div class="amount-label">应付总额</div>
|
||||
<div class="amount-value">{{ formatMoney(detail.payTotal) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-descriptions class="detail-desc" :column="2" border size="small">
|
||||
@@ -246,7 +250,7 @@ function sourceTagType(source) {
|
||||
}
|
||||
.amount-summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 10px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user