This commit is contained in:
linfso 2024-05-16 10:04:31 +08:00
parent e74b1ab95b
commit 2d0ccbf621
4 changed files with 41 additions and 7 deletions

View File

@ -2,7 +2,7 @@
* @Project: emis
* @Title: EmisWaybillFeeitem.java
* @author linfso
* @date 2024-04-27 13:18:17
* @date 2024-05-16 01:52:04
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 运单费用条目 实体类 </p>
@ -26,7 +26,7 @@ import lombok.Data;
* @ClassName EmisWaybillFeeitem
* @Description 运单费用条目
* @author linfso
* @date 2024-04-27 13:18:17
* @date 2024-05-16 01:52:04
*/
@Data
public class EmisWaybillFeeitem extends BaseEntity
@ -43,6 +43,8 @@ public class EmisWaybillFeeitem extends BaseEntity
private String feeName;
/* 费用值 */
private BigDecimal fee;
/* 实收费用 */
private BigDecimal realFee;
/* 费用币种 */
private String currency;
/* 报价ID */
@ -51,6 +53,8 @@ public class EmisWaybillFeeitem extends BaseEntity
private Long exprId;
/* 计算公式 */
private String calcExp;
/* 首重费 */
private BigDecimal initialWeightFee;
/* 续重单价 */
private BigDecimal addWeightPrice;
/* 排序 */

View File

@ -30,6 +30,15 @@ public class FeeItem extends VoBase<EmisWaybillFeeitem,FeeItem> {
/* 续重单价 */
private BigDecimal addWeightPrice;
/* 实收费用 */
private BigDecimal realFee;
/* 首重费 */
private BigDecimal initialWeightFee;
@Override
public FeeItem toVo(EmisWaybillFeeitem dbItem) {
FeeItem voItem = new FeeItem();
@ -42,7 +51,9 @@ public class FeeItem extends VoBase<EmisWaybillFeeitem,FeeItem> {
voItem.setOrderNum(dbItem.getOrderNum());
voItem.setCalcExp(dbItem.getCalcExp());
voItem.setAddWeightPrice(dbItem.getAddWeightPrice());
// voItem.setRemark(dbItem.getRemark());
voItem.setRealFee(dbItem.getRealFee());
voItem.setInitialWeightFee(dbItem.getInitialWeightFee());
voItem.setRemark(dbItem.getRemark());
return voItem;
}
@ -58,6 +69,8 @@ public class FeeItem extends VoBase<EmisWaybillFeeitem,FeeItem> {
dbItem.setOrderNum(voItem.getOrderNum());
dbItem.setCalcExp(voItem.getCalcExp());
dbItem.setAddWeightPrice(voItem.getAddWeightPrice());
dbItem.setRealFee(voItem.getRealFee());
dbItem.setInitialWeightFee(voItem.getInitialWeightFee());
dbItem.setRemark(voItem.getRemark());
return dbItem;
}

View File

@ -506,17 +506,24 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
String calcExp = exprItem.getCalculateExpression();
feeItem.setCalcExp(calcExp);
feeItem.setAddWeightPrice(BigDecimal.valueOf(exprItem.getAdditionalWeight()));
feeItem.setInitialWeightFee(BigDecimal.valueOf(exprItem.getInitialWeight()));
String calcExprStr=calcExp.replaceAll("w",emisWaybill.getSettlementWeight().toString())
.replaceAll("s",exprItem.getInitialWeight().toString())
.replaceAll("d",exprItem.getAdditionalWeight().toString());
String calcExprStr=calcExp.replaceAll("w",emisWaybill.getSettlementWeight().toString());
log.info("计算公式:"+calcExprStr+",重量:"+emisWaybill.getSettlementWeight());
double fee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
fee=WaybillHelper.calcSettledFee(fee,quoteItem.getPriceType());
feeItem.setFee(BigDecimal.valueOf(fee));
feeItem.setRealFee(feeItem.getRealFee());
log.info("计算后费用:"+feeItem.getFee());
totalFee=totalFee+fee;
feeItem.setRemark(JSONObject.toJSONString(exprItem));
feeItem.setRemark(feeItem.getCalcExp());
feeList.add(feeItem);

View File

@ -10,10 +10,12 @@
<result property="feeCode" column="fee_code" />
<result property="feeName" column="fee_name" />
<result property="fee" column="fee" />
<result property="realFee" column="real_fee" />
<result property="currency" column="currency" />
<result property="quoteId" column="quote_id" />
<result property="exprId" column="expr_id" />
<result property="calcExp" column="calc_exp" />
<result property="initialWeightFee" column="initial_weight_fee" />
<result property="addWeightPrice" column="add_weight_price" />
<result property="orderNum" column="order_num" />
<result property="delFlag" column="del_flag" />
@ -25,7 +27,7 @@
</resultMap>
<sql id="selectEmisWaybillFeeitemVo">
select id, waybill_id, fee_code, fee_name, fee, currency, quote_id, expr_id, calc_exp, add_weight_price, order_num, del_flag, create_by, create_time, update_by, update_time, remark from emis_waybill_feeitem
select id, waybill_id, fee_code, fee_name, fee, real_fee, currency, quote_id, expr_id, calc_exp, initial_weight_fee, add_weight_price, order_num, del_flag, create_by, create_time, update_by, update_time, remark from emis_waybill_feeitem
</sql>
<select id="selectEmisWaybillFeeitemList" parameterType="EmisWaybillFeeitem" resultMap="EmisWaybillFeeitemResult">
@ -36,10 +38,12 @@
<if test="feeCode != null and feeCode != ''"> and fee_code like concat('%', #{feeCode}, '%')</if>
<if test="feeName != null and feeName != ''"> and fee_name like concat('%', #{feeName}, '%')</if>
<if test="fee != null "> and fee like concat('%', #{fee}, '%')</if>
<if test="realFee != null "> and real_fee = #{realFee}</if>
<if test="currency != null and currency != ''"> and currency like concat('%', #{currency}, '%')</if>
<if test="quoteId != null "> and quote_id = #{quoteId}</if>
<if test="exprId != null "> and expr_id = #{exprId}</if>
<if test="calcExp != null and calcExp != ''"> and calc_exp like concat('%', #{calcExp}, '%')</if>
<if test="initialWeightFee != null "> and initial_weight_fee = #{initialWeightFee}</if>
<if test="addWeightPrice != null "> and add_weight_price = #{addWeightPrice}</if>
<if test="orderNum != null "> and order_num like concat('%', #{orderNum}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
@ -53,7 +57,7 @@
</select>
<select id="selectEmisWaybillFeeitemById" parameterType="Long" resultMap="EmisWaybillFeeitemResult">
select id, waybill_id, fee_code, fee_name, fee, currency, quote_id, expr_id, calc_exp, add_weight_price, order_num, del_flag, create_by, create_time, update_by, update_time, remark
select id, waybill_id, fee_code, fee_name, fee, real_fee, currency, quote_id, expr_id, calc_exp, initial_weight_fee, add_weight_price, order_num, del_flag, create_by, create_time, update_by, update_time, remark
from emis_waybill_feeitem a
where a.id = #{id}
</select>
@ -66,10 +70,12 @@
<if test="feeCode != null and feeCode != ''">fee_code,</if>
<if test="feeName != null and feeName != ''">fee_name,</if>
<if test="fee != null">fee,</if>
<if test="realFee != null">real_fee,</if>
<if test="currency != null and currency != ''">currency,</if>
<if test="quoteId != null">quote_id,</if>
<if test="exprId != null">expr_id,</if>
<if test="calcExp != null and calcExp != ''">calc_exp,</if>
<if test="initialWeightFee != null">initial_weight_fee,</if>
<if test="addWeightPrice != null">add_weight_price,</if>
<if test="orderNum != null">order_num,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
@ -85,10 +91,12 @@
<if test="feeCode != null and feeCode != ''">#{feeCode},</if>
<if test="feeName != null and feeName != ''">#{feeName},</if>
<if test="fee != null">#{fee},</if>
<if test="realFee != null">#{realFee},</if>
<if test="currency != null and currency != ''">#{currency},</if>
<if test="quoteId != null">#{quoteId},</if>
<if test="exprId != null">#{exprId},</if>
<if test="calcExp != null and calcExp != ''">#{calcExp},</if>
<if test="initialWeightFee != null">#{initialWeightFee},</if>
<if test="addWeightPrice != null">#{addWeightPrice},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
@ -107,10 +115,12 @@
<if test="feeCode != null and feeCode != ''">fee_code = #{feeCode},</if>
<if test="feeName != null and feeName != ''">fee_name = #{feeName},</if>
<if test="fee != null">fee = #{fee},</if>
<if test="realFee != null">real_fee = #{realFee},</if>
<if test="currency != null and currency != ''">currency = #{currency},</if>
<if test="quoteId != null">quote_id = #{quoteId},</if>
<if test="exprId != null">expr_id = #{exprId},</if>
<if test="calcExp != null and calcExp != ''">calc_exp = #{calcExp},</if>
<if test="initialWeightFee != null">initial_weight_fee = #{initialWeightFee},</if>
<if test="addWeightPrice != null">add_weight_price = #{addWeightPrice},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>