This commit is contained in:
linfso 2025-07-10 11:43:51 +08:00
parent 1166db3c8c
commit 9c5cf0f98d
5 changed files with 135 additions and 5 deletions

View File

@ -130,4 +130,7 @@ public class EmisQuotePrice extends BaseEntity
private List<EmisQuoteExpression> exprList;
// 计算报价日期
private Date calcDate;
}

View File

@ -36,6 +36,13 @@ public interface EmisQuotePriceMapper extends BaseMapper<EmisQuotePrice>
*/
public List<EmisQuotePrice> selectEmisQuotePriceList(EmisQuotePrice emisQuotePrice);
/**
* 根据计算日期获取当时有效报价
* @param emisQuotePrice
* @return
*/
public List<EmisQuotePrice> selectQuotePriceListByCalcDate(EmisQuotePrice emisQuotePrice);
/**
* 新增
*

View File

@ -3646,6 +3646,7 @@ public class EmisBaseService {
}
/**
* 获取有效产品报价
* @param lineCode
@ -3653,6 +3654,9 @@ public class EmisBaseService {
* @param sendSiteCode
* @param destSiteCode
* @param billType
* @param customerCode
* @param custNo
* @param calcDate
* @return
*/
public List<EmisQuotePrice> getValidQuotePriceList(
@ -3662,13 +3666,16 @@ public class EmisBaseService {
String destSiteCode,
String billType,
String customerCode,
String custNo
String custNo,
Date calcDate
) {
EmisQuotePrice queryEmisQuotePrice = new EmisQuotePrice();
queryEmisQuotePrice.setTransLineCode(lineCode);
queryEmisQuotePrice.setProdCode(prodCode);
queryEmisQuotePrice.setStatus(1);
queryEmisQuotePrice.setCalcDate(calcDate);
// 有效报价 在有效期内,并且未失效的报价
queryEmisQuotePrice.getParams().put("quoteStatus",4);
queryEmisQuotePrice.setBillType(billType);
@ -3686,7 +3693,9 @@ public class EmisBaseService {
queryEmisQuotePrice.setCustomerCode(null);
queryEmisQuotePrice.setCustNo(custNo);
List<EmisQuotePrice> listQuoteVip = emisQuotePriceMapper.selectEmisQuotePriceList(queryEmisQuotePrice);
// bug: 1704 按照运单号开单日期去报价表抓取对应的报价进行计算
// List<EmisQuotePrice> listQuoteVip = emisQuotePriceMapper.selectEmisQuotePriceList(queryEmisQuotePrice);
List<EmisQuotePrice> listQuoteVip = emisQuotePriceMapper.selectQuotePriceListByCalcDate(queryEmisQuotePrice);
for (EmisQuotePrice item : listQuoteVip) {
existsMap.put(item.getFeeType(), "1");
listQuoteValid.add(item);
@ -3696,7 +3705,11 @@ public class EmisBaseService {
queryEmisQuotePrice.setCustomerCode(null);
queryEmisQuotePrice.setCustNo(null);
queryEmisQuotePrice.setQuoteType("1,2");
List<EmisQuotePrice> listQuote = emisQuotePriceMapper.selectEmisQuotePriceList(queryEmisQuotePrice);
queryEmisQuotePrice.setCalcDate(calcDate);
// bug: 1704 按照运单号开单日期去报价表抓取对应的报价进行计算
// List<EmisQuotePrice> listQuote = emisQuotePriceMapper.selectEmisQuotePriceList(queryEmisQuotePrice);
List<EmisQuotePrice> listQuote = emisQuotePriceMapper.selectQuotePriceListByCalcDate(queryEmisQuotePrice);
for (EmisQuotePrice item:listQuote) {
if(existsMap.containsKey(item.getFeeType())){
continue;

View File

@ -3892,10 +3892,15 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
emisWaybill.setSettlementWeight(BigDecimal.ZERO);
}
// 如果寄件日期是空的则取当前时间
if(emisWaybill.getSendDate() == null){
emisWaybill.setSendDate(new Date());
}
// bug: 1704 按照运单号开单日期去报价表抓取对应的报价进行计算
List<EmisQuotePrice> emisQuotePriceList=getValidQuotePriceList(emisWaybill.getTransLineType(),emisWaybill.getProductType(),
emisWaybill.getSendSiteCode(),emisWaybill.getDispatchUnderlingSiteCode(),
emisWaybill.getCalcFeeType(),emisWaybill.getCustomerCode(),emisWaybill.getCustNo()
emisWaybill.getCalcFeeType(),emisWaybill.getCustomerCode(),emisWaybill.getCustNo(),emisWaybill.getSendDate()
);

View File

@ -141,7 +141,6 @@
)
</if>
<if test="params.quoteStatus != null and params.quoteStatus==1">
and status=1
</if>
@ -159,6 +158,109 @@
order by create_time desc
</select>
<!-- 获取寄件当时有效报价 -->
<select id="selectQuotePriceListByCalcDate" parameterType="EmisQuotePrice" resultMap="EmisQuotePriceResult">
<include refid="selectEmisQuotePriceVo"/>
<where>
del_flag = '0'
<if test="quoteId != null "> and quote_id = #{quoteId}</if>
<if test="quoteName != null and quoteName != ''"> and quote_name like concat('%', #{quoteName}, '%')</if>
<if test="quoteCode != null and quoteCode != ''"> and quote_code=#{quoteCode}</if>
<if test="transLineCode != null and transLineCode != ''"> and trans_line_code=#{transLineCode}</if>
<if test="quoteType != null and quoteType != ''"> and FIND_IN_SET(quote_type, #{quoteType})</if>
<if test="customerCode != null and customerCode != ''">
and customer_code=#{customerCode}
</if>
<if test="custNo != null and custNo != ''">
and cust_no=#{custNo}
</if>
<if test="feeType != null and feeType != ''"> and fee_type=#{feeType}</if>
<if test="currency != null and currency != ''"> and currency=#{currency}</if>
<if test="prodCode != null and prodCode != ''"> and FIND_IN_SET(#{prodCode}, prod_code)</if>
<if test="recPayType != null and recPayType != ''"> and rec_pay_type=#{recPayType}</if>
<if test="billType != null and billType != ''"> and bill_type= #{billType}</if>
<if test="otherType1 != null and otherType1 != ''"> and other_type1=#{otherType1}</if>
<if test="otherType2 != null and otherType2 != ''"> and other_type2=#{otherType2}</if>
<if test="carryType != null and carryType != ''"> and carry_type=#{carryType}</if>
<if test="status != null "> and status = #{status}</if>
<if test="dispAreaId != null "> and disp_area_id like concat('%', #{dispAreaId}, '%')</if>
<if test="dispAreaName != null and dispAreaName != ''"> and disp_area_name like concat('%', #{dispAreaName}, '%')</if>
<if test="dispAreaSite != null and dispAreaSite != ''"> and disp_area_site like concat('%', #{dispAreaSite}, '%')</if>
<if test="dispAreaSiteCode != null and dispAreaSiteCode != ''">
and (
exists (select 1 from emis_quote_disp_area eqda where a.disp_area_id=eqda.area_id and find_in_set(#{dispAreaSiteCode},eqda.area_site_code) )
or disp_area_site_code='-1'
)
</if>
<if test="dispAreaSiteId != null and dispAreaSiteId != ''"> and disp_area_site_id=#{dispAreaSiteId}</if>
<if test="sendAreaId != null "> and send_area_id = #{sendAreaId} </if>
<if test="sendAreaName != null and sendAreaName != ''"> and send_area_name like concat('%', #{sendAreaName}, '%')</if>
<if test="sendAreaSite != null and sendAreaSite != ''"> and send_area_site like concat('%', #{sendAreaSite}, '%')</if>
<if test="sendAreaSiteCode != null and sendAreaSiteCode != ''"> and (
exists (select 1 from emis_quote_send_area eqsa where a.send_area_id=eqsa.area_id and find_in_set(#{sendAreaSiteCode},eqsa.area_site_code) )
or send_area_site_code='-1'
)</if>
<if test="sendAreaSiteId != null and sendAreaSiteId != ''"> and send_area_site_id like concat('%', #{sendAreaSiteId}, '%')</if>
<if test="carriesNumber != null and carriesNumber != ''"> and carries_number like concat('%', #{carriesNumber}, '%')</if>
<if test="discardsNumber != null and discardsNumber != ''"> and discards_number like concat('%', #{discardsNumber}, '%')</if>
<if test="leastPrice != null "> and least_price = #{leastPrice}</if>
<if test="priceType != null and priceType != ''"> and price_type like concat('%', #{priceType}, '%')</if>
<if test="priorityLevel != null "> and priority_level = #{priorityLevel}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
<if test="useSiteCode != null and useSiteCode != '' and useSiteCode != '88888'">
<!-- 包含子网点 -->
AND use_site_code in (
SELECT t3.site_code FROM(
SELECT t1.site_code,t1.parent_site_code,t1.site_name,
IF( FIND_IN_SET( parent_site_code, @parent_ids ) > 0, @parent_ids := CONCAT( @parent_ids, ',', site_code ), '0' ) AS cids
FROM ( SELECT * FROM emis_site AS t WHERE t.del_flag = '0' ORDER BY t.site_code ASC ) t1,
( SELECT @parent_ids := #{useSiteCode} ) t2
) t3
WHERE cids != '0'
UNION
SELECT #{useSiteCode} FROM dual
)
</if>
<if test="params.quoteStatus != null and params.quoteStatus==1">
and status=1
</if>
<if test="params.quoteStatus != null and params.quoteStatus==2">
and status=0
</if>
<if test="params.quoteStatus != null and params.quoteStatus==3">
and end_date <![CDATA[ < ]]> #{calcDate}
</if>
<if test="params.quoteStatus != null and params.quoteStatus==4">
and start_date <![CDATA[ <= ]]> #{calcDate} and end_date <![CDATA[ > ]]> #{calcDate} and status=1
</if>
</where>
order by create_time desc
</select>
<select id="selectEmisQuotePriceByQuoteId" parameterType="Long" resultMap="EmisQuotePriceResult">
select quote_id, quote_code, quote_name, quote_type, customer_code, cust_no, use_site_code, trans_line_code, fee_type, currency, prod_code, rec_pay_type, bill_type, other_type1, other_type2, carry_type, status, disp_area_id, disp_area_name, disp_area_site, disp_area_site_code, disp_area_site_id, send_area_id, send_area_name, send_area_site, send_area_site_code, send_area_site_id, carries_number, discards_number, least_price, price_type, start_date, end_date, priority_level, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_quote_price a