修改计费信息表结构
This commit is contained in:
@@ -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());
|
||||
Reference in New Issue
Block a user