From 0f517869adf9fc02fbd62a4f2d59cab744abcad5 Mon Sep 17 00:00:00 2001 From: jiang Date: Fri, 7 Nov 2025 14:23:41 +0800 Subject: [PATCH] =?UTF-8?q?bug=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backstage/entity/CarContractSupCarVo.java | 2 +- .../mapper/SupDispatchCarMapper.java | 34 ++++++++- .../service/CarBalanceServiceImpl.java | 18 ++++- .../service/SupDispatchCarServiceImpl.java | 26 +++++-- .../business/backstage/CarContractMapper.xml | 69 ++++++++++++------- .../backstage/SupDispatchCarMapper.xml | 7 +- 6 files changed, 115 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/bonus/gzcar/business/backstage/entity/CarContractSupCarVo.java b/src/main/java/com/bonus/gzcar/business/backstage/entity/CarContractSupCarVo.java index 96b7fc5..802ce68 100644 --- a/src/main/java/com/bonus/gzcar/business/backstage/entity/CarContractSupCarVo.java +++ b/src/main/java/com/bonus/gzcar/business/backstage/entity/CarContractSupCarVo.java @@ -44,7 +44,6 @@ public class CarContractSupCarVo { private String glsJs; - /** * 单项基准费用(元/吨*公里) */ @@ -126,6 +125,7 @@ public class CarContractSupCarVo { */ private String delOutId; + private String ton; } diff --git a/src/main/java/com/bonus/gzcar/business/backstage/mapper/SupDispatchCarMapper.java b/src/main/java/com/bonus/gzcar/business/backstage/mapper/SupDispatchCarMapper.java index 70e9b95..952ed79 100644 --- a/src/main/java/com/bonus/gzcar/business/backstage/mapper/SupDispatchCarMapper.java +++ b/src/main/java/com/bonus/gzcar/business/backstage/mapper/SupDispatchCarMapper.java @@ -18,6 +18,7 @@ public interface SupDispatchCarMapper { /** * 查询分配给供应商的数据集合 + * * @param data * @return */ @@ -25,6 +26,7 @@ public interface SupDispatchCarMapper { /** * 派车前查询 + * * @param data * @return */ @@ -32,32 +34,37 @@ public interface SupDispatchCarMapper { /** * 供应商 价格查询 + * * @param contractId * @param modelId * @param supId * @return */ - List getContractPriceList(@Param("contractId") String contractId,@Param("modelId") String modelId,@Param("supId") String supId); + List getContractPriceList(@Param("contractId") String contractId, @Param("modelId") String modelId, @Param("supId") String supId, @Param("ton") String ton); /** * 查询差量进出场费用设置 + * * @param contractId * @param modelId * @param supId * @return */ - List getCarOutList(@Param("contractId") String contractId,@Param("modelId") String modelId,@Param("supId") String supId); + List getCarOutList(@Param("contractId") String contractId, @Param("modelId") String modelId, @Param("supId") String supId); /** * 新增派车数据集合 + * * @param outVo * @return */ int addDispatchCarData(CarPlanOutVo outVo); void addDispatchCarDataRecord(CarPlanOutVo outVo); + /** * 新增发车详情数据 + * * @param * @param detailsVoList */ @@ -67,12 +74,14 @@ public interface SupDispatchCarMapper { /** * 更新计划 信息 + * * @param outVo */ void updatePlanInfo(CarPlanOutVo outVo); /** * 查询数据信息 + * * @param data * @return */ @@ -80,6 +89,7 @@ public interface SupDispatchCarMapper { /** * 查询 + * * @return */ List getDispatchCarDetailsList(CarPlanOutVo data); @@ -88,6 +98,7 @@ public interface SupDispatchCarMapper { /** * 修改发车数据 + * * @param outVo * @return */ @@ -95,6 +106,7 @@ public interface SupDispatchCarMapper { /** * 查询修改前记录 + * * @param detailsVo * @return */ @@ -102,6 +114,7 @@ public interface SupDispatchCarMapper { /** * 修改车辆详情数据 + * * @param detailsVo */ void updateDispatchCarDetailsData(CarPlanOutVoDetailsVo detailsVo); @@ -111,12 +124,14 @@ public interface SupDispatchCarMapper { /** * 修改车辆详情 + * * @param detailsVo */ void updateDispatchCarDetailsDataRecord(CarPlanOutVoDetailsVo detailsVo); /** * 到货确认单查询 + * * @param data * @return */ @@ -124,6 +139,7 @@ public interface SupDispatchCarMapper { /** * 已结算无法发货 + * * @param outVo * @return */ @@ -131,6 +147,7 @@ public interface SupDispatchCarMapper { /** * 查询结算数据 + * * @param outVo * @return */ @@ -138,6 +155,7 @@ public interface SupDispatchCarMapper { /** * 删除car_plan_out数据 + * * @param data * @return */ @@ -145,6 +163,7 @@ public interface SupDispatchCarMapper { /** * 删除car_plan_out_record数据 + * * @param data * @return */ @@ -152,6 +171,7 @@ public interface SupDispatchCarMapper { /** * 查询数据 + * * @param data * @return */ @@ -159,6 +179,7 @@ public interface SupDispatchCarMapper { /** * 删除文件 + * * @param file * @return */ @@ -166,6 +187,7 @@ public interface SupDispatchCarMapper { /** * 删除car_plan_out_details数据 + * * @param outVo * @return */ @@ -173,6 +195,7 @@ public interface SupDispatchCarMapper { /** * 删除car_plan_out_details_record数据 + * * @param outVo * @return */ @@ -180,6 +203,7 @@ public interface SupDispatchCarMapper { /** * 修改car_plan_apply_status + * * @param outVo * @return */ @@ -187,6 +211,7 @@ public interface SupDispatchCarMapper { /** * 删除car_plan_audit_record数据 + * * @param outVo * @return */ @@ -194,6 +219,7 @@ public interface SupDispatchCarMapper { /** * 查询car_plan_out_details数据 + * * @param bean1 * @return */ @@ -201,6 +227,7 @@ public interface SupDispatchCarMapper { /** * 删除文件 + * * @param data * @return */ @@ -208,6 +235,7 @@ public interface SupDispatchCarMapper { /** * 审核 + * * @param data * @return */ @@ -215,6 +243,7 @@ public interface SupDispatchCarMapper { /** * 提交审核 + * * @param data * @return */ @@ -222,6 +251,7 @@ public interface SupDispatchCarMapper { /** * 修改文件状态 + * * @param params * @return */ diff --git a/src/main/java/com/bonus/gzcar/business/backstage/service/CarBalanceServiceImpl.java b/src/main/java/com/bonus/gzcar/business/backstage/service/CarBalanceServiceImpl.java index 000f4ee..6878c21 100644 --- a/src/main/java/com/bonus/gzcar/business/backstage/service/CarBalanceServiceImpl.java +++ b/src/main/java/com/bonus/gzcar/business/backstage/service/CarBalanceServiceImpl.java @@ -199,11 +199,23 @@ public class CarBalanceServiceImpl implements CarBalanceService { int day = vo.getDays(); try { + String tonType; + Integer tonValue = Integer.valueOf(vo.getTon()); // 先获取值,避免重复调用方法 + if (tonValue == null) { + // 处理 null 情况(根据业务需求,可选默认值 1/2/3 或抛出异常) + tonType = "1"; + } else if (tonValue < 2) { + tonType = "1"; + } else if (tonValue < 5) { // 隐含条件:2 ≤ tonValue < 5 + tonType = "2"; + } else { // 隐含条件:tonValue ≥ 5(原逻辑写的 >5,这里包含等于,需确认是否需要调整) + tonType = "3"; + } BigDecimal days = new BigDecimal(day); BigDecimal fee = new BigDecimal(vo.getFee()); BigDecimal dcMoney = new BigDecimal("0"); BigDecimal month = new BigDecimal("30"); - PriceVo priceVo = getMoney(vo.getContractId(), vo.getModelId(), vo.getSupId(), null); + PriceVo priceVo = getMoney(vo.getContractId(), vo.getModelId(), vo.getSupId(), null, tonType); sb.append("依据:").append(priceVo.getName()).append("-").append(priceVo.getModel()); vo.setPriceId(priceVo.getId()); vo.setGlsPrice(priceVo.getPrice()); @@ -256,8 +268,8 @@ public class CarBalanceServiceImpl implements CarBalanceService { * @param gls * @return */ - private PriceVo getMoney(String contractId, String modelId, String supId, String gls) throws Exception { - List list = supDispatchCarMapper.getContractPriceList(contractId, modelId, supId); + private PriceVo getMoney(String contractId, String modelId, String supId, String gls, String ton) throws Exception { + List list = supDispatchCarMapper.getContractPriceList(contractId, modelId, supId, ton); //车辆 if (StringHelper.isEmpty(modelId)) { BigDecimal nowGls = new BigDecimal(gls); diff --git a/src/main/java/com/bonus/gzcar/business/backstage/service/SupDispatchCarServiceImpl.java b/src/main/java/com/bonus/gzcar/business/backstage/service/SupDispatchCarServiceImpl.java index 818d392..3b19f01 100644 --- a/src/main/java/com/bonus/gzcar/business/backstage/service/SupDispatchCarServiceImpl.java +++ b/src/main/java/com/bonus/gzcar/business/backstage/service/SupDispatchCarServiceImpl.java @@ -447,7 +447,19 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService { //公里数必填 String gls = vo.getGls(); try { - PriceVo priceVo = getMoney(vo.getContractId(), null, vo.getSupId(), gls); + String tonType; + Integer tonValue = Integer.valueOf(vo.getTon()); // 先获取值,避免重复调用方法 + if (tonValue == null) { + // 处理 null 情况(根据业务需求,可选默认值 1/2/3 或抛出异常) + tonType = "1"; + } else if (tonValue < 2) { + tonType = "1"; + } else if (tonValue < 5) { // 隐含条件:2 ≤ tonValue < 5 + tonType = "2"; + } else { // 隐含条件:tonValue ≥ 5(原逻辑写的 >5,这里包含等于,需确认是否需要调整) + tonType = "3"; + } + PriceVo priceVo = getMoney(vo.getContractId(), null, vo.getSupId(), gls, tonType); sb.append("依据:").append(priceVo.getGlsStart()).append("-").append(priceVo.getGlsEnd()); sb.append("公里:").append(priceVo.getPrice()).append("元"); vo.setRemark(sb.toString()); @@ -472,7 +484,7 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService { BigDecimal days = new BigDecimal(day); BigDecimal dcMoney = new BigDecimal("0"); BigDecimal month = new BigDecimal("30"); - PriceVo priceVo = getMoney(vo.getContractId(), vo.getModelId(), vo.getSupId(), null); + PriceVo priceVo = getMoney(vo.getContractId(), vo.getModelId(), vo.getSupId(), null, null); sb.append("依据:").append(priceVo.getName()).append("-").append(priceVo.getModel()); vo.setPriceId(priceVo.getId()); vo.setGlsPrice(priceVo.getPrice()); @@ -547,8 +559,8 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService { * @param gls * @return */ - private PriceVo getMoney(String contractId, String modelId, String supId, String gls) throws Exception { - List list = mapper.getContractPriceList(contractId, modelId, supId); + private PriceVo getMoney(String contractId, String modelId, String supId, String gls, String ton) throws Exception { + List list = mapper.getContractPriceList(contractId, modelId, supId, ton); //车辆 if (StringHelper.isEmpty(modelId)) { BigDecimal nowGls = new BigDecimal(gls); @@ -632,7 +644,7 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService { public ServerResponse deleteFile(CarPlanOutVo data) { try { int res = mapper.deleteFile(data); - if (res > 0){ + if (res > 0) { return ServerResponse.createSuccess("删除成功", "删除成功"); } else { return ServerResponse.createErroe("删除失败"); @@ -648,7 +660,7 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService { try { // data.setId(data.getId()+"-dh"); int res = mapper.examine(data); - if (res > 0){ + if (res > 0) { return ServerResponse.createSuccess("审核成功", "审核成功"); } else { return ServerResponse.createErroe("审核失败"); @@ -664,7 +676,7 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService { try { // data.setId(data.getId()+"-dh"); int res = mapper.toCheck(data); - if (res > 0){ + if (res > 0) { return ServerResponse.createSuccess("提交成功", "提交成功"); } else { return ServerResponse.createErroe("提交失败"); diff --git a/src/main/resources/mappers/business/backstage/CarContractMapper.xml b/src/main/resources/mappers/business/backstage/CarContractMapper.xml index daf547e..401ac6b 100644 --- a/src/main/resources/mappers/business/backstage/CarContractMapper.xml +++ b/src/main/resources/mappers/business/backstage/CarContractMapper.xml @@ -3,9 +3,10 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - insert into car_contract( code, type, name, start_time, end_time, money, is_active, creator, create_time, - updater, update_time, remark) - values(#{code},#{type},#{name},#{startTime},#{endTime},#{money},1,#{creator},now(),#{updater},now(),#{remark}) + insert into car_contract(code, type, name, start_time, end_time, money, is_active, creator, create_time, + updater, update_time, remark) + values (#{code}, #{type}, #{name}, #{startTime}, #{endTime}, #{money}, 1, #{creator}, now(), #{updater}, now(), + #{remark}) @@ -14,23 +15,25 @@ INSERT INTO car_contract_type( - rel_id, contract_id, sup_id, type, model_id, gls_ks, gls_js,gl_price, gl_xf, gl_sj_price, day_price, - month_price, dc_xf, day_sj_price, month_sj_price, day_to_month, is_driver_set, is_out_set, remark + rel_id, contract_id, sup_id, type, model_id, gls_ks, gls_js,gl_price, gl_xf, gl_sj_price, day_price, + month_price, dc_xf, day_sj_price, month_sj_price, day_to_month, is_driver_set, is_out_set, remark,ton )values - - (#{param.id},#{param.contractId},#{param.supId},#{param.type},#{item.modelId},#{item.glsKs},#{item.glsJs}, #{item.glPrice},#{item.glXf},#{item.glSjPrice},#{item.dayPrice}, - #{item.monthPrice},#{item.dcXf},#{item.daySjPrice},#{item.monthSjPrice}, #{item.dayToMonth},#{item.isDriverSet},#{item.isOutSet},#{item.remark} ) - + + (#{param.id},#{param.contractId},#{param.supId},#{param.type},#{item.modelId},#{item.glsKs},#{item.glsJs}, + #{item.glPrice},#{item.glXf},#{item.glSjPrice},#{item.dayPrice}, + #{item.monthPrice},#{item.dcXf},#{item.daySjPrice},#{item.monthSjPrice}, + #{item.dayToMonth},#{item.isDriverSet},#{item.isOutSet},#{item.remark} ,#{item.ton}) + - INSERT INTO car_contract_type( - rel_id,contract_id, sup_id, type, model_id, gls_ks, gls_js,gl_price, gl_xf, gl_sj_price, day_price, - month_price, dc_xf,day_sj_price, month_sj_price, day_to_month, is_driver_set, is_out_set, remark - )values ( - #{param.id}, #{param.contractId},#{param.supId},#{param.type},#{item.modelId},#{item.glsKs}, - #{item.glsJs}, #{item.glPrice},#{item.glXf},#{item.glSjPrice},#{item.dayPrice}, - #{item.monthPrice},#{item.dcXf},#{item.daySjPrice},#{item.monthSjPrice}, #{item.dayToMonth}, - #{item.isDriverSet},#{item.isOutSet},#{item.remark} ) + INSERT INTO car_contract_type(rel_id, contract_id, sup_id, type, model_id, gls_ks, gls_js, gl_price, gl_xf, + gl_sj_price, day_price, + month_price, dc_xf, day_sj_price, month_sj_price, day_to_month, is_driver_set, + is_out_set, remark, ton) + values (#{param.id}, #{param.contractId}, #{param.supId}, #{param.type}, #{item.modelId}, #{item.glsKs}, + #{item.glsJs}, #{item.glPrice}, #{item.glXf}, #{item.glSjPrice}, #{item.dayPrice}, + #{item.monthPrice}, #{item.dcXf}, #{item.daySjPrice}, #{item.monthSjPrice}, #{item.dayToMonth}, + #{item.isDriverSet}, #{item.isOutSet}, #{item.remark}, #{item.ton}) insert into car_contract_type_out( @@ -62,14 +65,28 @@ where id=#{id} - update car_contract_type set - rel_id=#{relId},contract_id=#{contractId}, sup_id=#{supId}, - type=#{type}, model_id=#{modelId}, gls_ks=#{glsKs}, gls_js=#{glsJs},gl_price=#{glPrice}, - gl_xf=#{glXf}, gl_sj_price=#{glSjPrice}, day_price=#{dayPrice}, - month_price=#{monthPrice}, dc_xf=#{dcXf},day_sj_price=#{daySjPrice}, - month_sj_price=#{monthSjPrice}, day_to_month=#{dayToMonth},is_driver_set=#{isDriverSet},is_out_set=#{isOutSet}, - remark=#{remark} - where id=#{id} + update car_contract_type + set rel_id=#{relId}, + contract_id=#{contractId}, + sup_id=#{supId}, + type=#{type}, + model_id=#{modelId}, + gls_ks=#{glsKs}, + gls_js=#{glsJs}, + gl_price=#{glPrice}, + gl_xf=#{glXf}, + gl_sj_price=#{glSjPrice}, + day_price=#{dayPrice}, + month_price=#{monthPrice}, + dc_xf=#{dcXf}, + day_sj_price=#{daySjPrice}, + month_sj_price=#{monthSjPrice}, + day_to_month=#{dayToMonth}, + is_driver_set=#{isDriverSet}, + is_out_set=#{isOutSet}, + remark=#{remark}, + ton=#{ton} + where id = #{id} update car_contract_type_out set @@ -206,7 +223,7 @@ cct.gls_ks glsKs, cct.gls_js glsJs, cct.gl_price glPrice, cct.gl_xf glXf, cct.gl_sj_price glSjPrice, cct.day_price dayPrice, cct.month_price monthPrice, cct.dc_xf dcXf, cct.day_sj_price daySjPrice, cct.month_sj_price monthSjPrice, cct.day_to_month dayToMonth, cct.is_driver_set isDriverSet, - cct.is_out_set isOutSet, cct.remark remark,cct.rel_id relId,cmti.`name`,cmti.model + cct.is_out_set isOutSet, cct.remark remark,cct.rel_id relId,cmti.`name`,cmti.model,cct.ton from car_contract_type cct left join car_ma_type_info cmti on cct.model_id=cmti.id WHERE rel_id=#{id} diff --git a/src/main/resources/mappers/business/backstage/SupDispatchCarMapper.xml b/src/main/resources/mappers/business/backstage/SupDispatchCarMapper.xml index 75326f6..d032ceb 100644 --- a/src/main/resources/mappers/business/backstage/SupDispatchCarMapper.xml +++ b/src/main/resources/mappers/business/backstage/SupDispatchCarMapper.xml @@ -242,9 +242,12 @@ cct.day_to_month dayToMonth,cct.model_id modelId,cmti.name,cmti.type,cmti.model FROM car_contract_type cct LEFT JOIN car_ma_type_info cmti on cmti.id =cct.model_id - where cct.contract_id=#{contractId} and sup_id=#{supId} + where cct.contract_id=#{contractId} and sup_id=#{supId} - and model_id=#{modelId} + and model_id=#{modelId} + + + and ton=#{ton}