1. 车型关联收费方式
This commit is contained in:
		
							parent
							
								
									13ea20b61a
								
							
						
					
					
						commit
						8bc7c4c95d
					
				|  | @ -251,7 +251,7 @@ public class AppController extends BaseController | |||
|     @GetMapping("/fee/list") | ||||
|     public AjaxResult feeList(EtFeeRule etFeeRule) | ||||
|     { | ||||
|         List<EtFeeRule> list = etFeeRuleService.selectEtFeeRuleListByAreaId(etFeeRule.getAreaId()); | ||||
|         List<EtFeeRule> list = etFeeRuleService.selectRuleInfoListByModelId(etFeeRule.getModelId()); | ||||
|         return success(list); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ import java.util.List; | |||
| import javax.servlet.http.HttpServletResponse; | ||||
| 
 | ||||
| import com.ruoyi.system.service.IAsDeviceService; | ||||
| import com.ruoyi.system.service.IEtFeeRuleService; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
|  | @ -39,6 +40,9 @@ public class EtModelController extends BaseController | |||
|     @Autowired | ||||
|     private IAsDeviceService asDeviceService; | ||||
| 
 | ||||
|     @Autowired | ||||
|     private IEtFeeRuleService etFeeRuleService; | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 查询车辆型号列表 | ||||
|  | @ -72,7 +76,11 @@ public class EtModelController extends BaseController | |||
|     @GetMapping(value = "/{modelId}") | ||||
|     public AjaxResult getInfo(@PathVariable("modelId") Long modelId) | ||||
|     { | ||||
|         return success(etModelService.selectEtModelByModelId(modelId)); | ||||
|         AjaxResult ajax = AjaxResult.success(); | ||||
|         EtModel model = etModelService.selectEtModelByModelId(modelId); | ||||
|         ajax.put(AjaxResult.DATA_TAG, model); | ||||
|         ajax.put("ruleIds", etFeeRuleService.selectRuleListByModelId(modelId)); | ||||
|         return ajax; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.entity.SysDept; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | ||||
| import com.ruoyi.common.enums.BusinessType; | ||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | ||||
| import com.ruoyi.system.domain.EtFeeRule; | ||||
| import com.ruoyi.system.domain.EtModel; | ||||
| import com.ruoyi.system.domain.EtOperatingArea; | ||||
| import com.ruoyi.system.mapper.EtModelMapper; | ||||
|  | @ -172,6 +173,9 @@ public class EtOperatingAreaController extends BaseController | |||
|         EtModel model = new EtModel(); | ||||
|         model.setOperator(deptId); | ||||
|         ajax.put("modelList",  etModelMapper.selectEtModelList(model)); | ||||
|         EtFeeRule rule = new EtFeeRule(); | ||||
|         rule.setDeptId(deptId); | ||||
|         ajax.put("ruleList", etFeeRuleService.selectEtFeeRuleList(rule)); | ||||
|         return success(ajax); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -47,6 +47,10 @@ public class EtFeeRule extends BaseEntity | |||
|     @Excel(name = "运营商id") | ||||
|     private Long deptId; | ||||
| 
 | ||||
|     @Excel(name = "车型id") | ||||
|     @TableField(exist = false) | ||||
|     private Long modelId; | ||||
| 
 | ||||
|     /** 说明 */ | ||||
|     @Excel(name = "说明") | ||||
|     private String explain; | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| package com.ruoyi.system.domain; | ||||
| 
 | ||||
| import com.baomidou.mybatisplus.annotation.TableField; | ||||
| import com.ruoyi.common.annotation.Excel; | ||||
| import com.ruoyi.common.core.domain.BaseEntity; | ||||
| import lombok.Data; | ||||
|  | @ -32,6 +33,14 @@ public class EtModel extends BaseEntity | |||
|     @Excel(name = "运营商id") | ||||
|     private Long operator; | ||||
| 
 | ||||
|     /** 运营区id */ | ||||
|     @Excel(name = "运营区id") | ||||
|     private Long areaId; | ||||
| 
 | ||||
|     /** 运营区名称 */ | ||||
|     @Excel(name = "运营区名称") | ||||
|     private String areaName; | ||||
| 
 | ||||
|     /** 运营商 */ | ||||
|     @Excel(name = "运营商") | ||||
|     private String operatorName; | ||||
|  | @ -58,4 +67,8 @@ public class EtModel extends BaseEntity | |||
|     @Excel(name = "运营区列表") | ||||
|     private List<EtOperatingArea> areaList; | ||||
| 
 | ||||
|     /** 收费方式 */ | ||||
|     @TableField(exist = false) | ||||
|     private Long[] ruleIds; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,28 @@ | |||
| package com.ruoyi.system.domain; | ||||
| 
 | ||||
| import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import lombok.Builder; | ||||
| import lombok.Data; | ||||
| 
 | ||||
| import java.io.Serializable; | ||||
| 
 | ||||
| /** | ||||
|  * 车型与收费方式关联对象 et_model_rule | ||||
|  * | ||||
|  * @author 邱贞招 | ||||
|  * @date 2024-05-19 | ||||
|  */ | ||||
| @Data | ||||
| @Builder | ||||
| @TableName(value = "et_model_rule") | ||||
| public class EtModelRule implements Serializable { | ||||
| 
 | ||||
|     private static final long serialVersionUID = 1L; | ||||
| 
 | ||||
|     /** 区域id */ | ||||
|     private Long modelId; | ||||
| 
 | ||||
|     /** 收费规则id */ | ||||
|     private Long ruleId; | ||||
| 
 | ||||
| } | ||||
|  | @ -329,5 +329,23 @@ public class EtOrder extends BaseEntity | |||
|     @TableField(exist = false) | ||||
|     private BigDecimal cost; | ||||
| 
 | ||||
|     /** 可退预约费 */ | ||||
|     @Excel(name = "可退预约费") | ||||
|     @TableField(exist = false) | ||||
|     private BigDecimal refundableAppointmentFee; | ||||
| 
 | ||||
|     /** 可退运营区外调度费退款 */ | ||||
|     @Excel(name = "可退运营区外调度费退款") | ||||
|     @TableField(exist = false) | ||||
|     private BigDecimal refundableRideFee; | ||||
| 
 | ||||
|     /** 可退预约费 */ | ||||
|     @Excel(name = "可退预约费") | ||||
|     @TableField(exist = false) | ||||
|     private BigDecimal refundableDispatchFee; | ||||
| 
 | ||||
|     /** 可退停车点外调度费退款 */ | ||||
|     @Excel(name = "可退停车点外调度费退款") | ||||
|     @TableField(exist = false) | ||||
|     private BigDecimal refundableManageFee; | ||||
| } | ||||
|  |  | |||
|  | @ -76,6 +76,14 @@ public interface EtFeeRuleMapper | |||
|      */ | ||||
|     public List<Long> selectRuleListByAreaId(Long areaId); | ||||
| 
 | ||||
|     /** | ||||
|      * 根据modelId获取收费方式选择框列表 | ||||
|      * | ||||
|      * @param modelId 车型id | ||||
|      * @return 选中收费方式ID列表 | ||||
|      */ | ||||
|     public List<Long> selectRuleListByModelId(Long modelId); | ||||
| 
 | ||||
|     /** | ||||
|      * 根据区域ID获取收费方式列表 | ||||
|      * | ||||
|  | @ -84,6 +92,14 @@ public interface EtFeeRuleMapper | |||
|      */ | ||||
|     public List<EtFeeRule> selectRuleInfoListByAreaId(Long areaId); | ||||
| 
 | ||||
|     /** | ||||
|      * 根据区域ID获取收费方式列表 | ||||
|      * | ||||
|      * @param modelId 车型id | ||||
|      * @return 选中收费方式ID列表 | ||||
|      */ | ||||
|     public List<EtFeeRule> selectRuleInfoListByModelId(Long modelId); | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 根据区域ID获取收费方式名称选择框列表 | ||||
|  |  | |||
|  | @ -0,0 +1,29 @@ | |||
| package com.ruoyi.system.mapper; | ||||
| 
 | ||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
| import com.ruoyi.system.domain.EtModelRule; | ||||
| 
 | ||||
| /** | ||||
|  * 区域与收费方式关联 数据层 | ||||
|  * | ||||
|  * @author ruoyi | ||||
|  */ | ||||
| public interface EtModelRuleMapper extends BaseMapper<EtModelRule> | ||||
| { | ||||
|     /** | ||||
|      * 通过用运营区ID删除区域与收费方式关联 | ||||
|      * | ||||
|      * @param areaId 运营区id | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public int deleteModelRuleByModelId(Long areaId); | ||||
| 
 | ||||
|     /** | ||||
|      * 通过用ruleId删除区域与收费方式关联 | ||||
|      * | ||||
|      * @param ruleId 运营区id | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public int deleteModelRuleByRuleId(Long ruleId); | ||||
| 
 | ||||
| } | ||||
|  | @ -44,6 +44,14 @@ public interface IEtFeeRuleService | |||
|      */ | ||||
|     public List<EtFeeRule> selectEtFeeRuleListByAreaId(Long areaId); | ||||
| 
 | ||||
|     /** | ||||
|      * 根据运营区获取收费方式列表 | ||||
|      * | ||||
|      * @param modelId 车型id | ||||
|      * @return 收费方式集合 | ||||
|      */ | ||||
|     public List<EtFeeRule> selectRuleInfoListByModelId(Long modelId); | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 新增收费方式 | ||||
|  | @ -93,4 +101,12 @@ public interface IEtFeeRuleService | |||
|      * @return 选中收费方式名称列表 | ||||
|      */ | ||||
|     public List<String> selectRuleNameListByAreaId(Long areaId); | ||||
| 
 | ||||
|     /** | ||||
|      * 根据modelId获取收费方式选择框列表 | ||||
|      * | ||||
|      * @param modelId 车型id | ||||
|      * @return 选中收费方式ID列表 | ||||
|      */ | ||||
|     public List<Long> selectRuleListByModelId(Long modelId); | ||||
| } | ||||
|  |  | |||
|  | @ -1,7 +1,5 @@ | |||
| package com.ruoyi.system.service.impl; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import cn.hutool.core.util.ObjectUtil; | ||||
| import com.alibaba.fastjson2.JSONObject; | ||||
| import com.ruoyi.common.annotation.DataScope; | ||||
|  | @ -10,20 +8,20 @@ import com.ruoyi.common.core.domain.entity.SysDept; | |||
| import com.ruoyi.common.core.domain.entity.SysUser; | ||||
| import com.ruoyi.common.utils.DateUtils; | ||||
| import com.ruoyi.common.utils.SecurityUtils; | ||||
| import com.ruoyi.system.domain.EtAreaRule; | ||||
| import com.ruoyi.system.domain.EtFeeRule; | ||||
| import com.ruoyi.system.domain.EtModelRule; | ||||
| import com.ruoyi.system.domain.EtOperatingArea; | ||||
| import com.ruoyi.system.domain.vo.IntervalRuleVo; | ||||
| import com.ruoyi.system.domain.vo.StartingRuleVo; | ||||
| import com.ruoyi.system.mapper.EtAreaRuleMapper; | ||||
| import com.ruoyi.system.mapper.EtFeeRuleMapper; | ||||
| import com.ruoyi.system.mapper.EtModelRuleMapper; | ||||
| import com.ruoyi.system.service.IEtFeeRuleService; | ||||
| import com.ruoyi.system.service.IEtOperatingAreaService; | ||||
| import com.ruoyi.system.service.IWxPayService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import com.ruoyi.system.mapper.EtFeeRuleMapper; | ||||
| import com.ruoyi.system.domain.EtFeeRule; | ||||
| import com.ruoyi.system.service.IEtFeeRuleService; | ||||
| 
 | ||||
| import javax.annotation.Resource; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * 收费方式Service业务层处理 | ||||
|  | @ -43,8 +41,11 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService | |||
|     @Autowired | ||||
|     private IWxPayService wxPayService; | ||||
| 
 | ||||
| //    @Resource | ||||
| //    private EtAreaRuleMapper etAreaRuleMapper; | ||||
| 
 | ||||
|     @Resource | ||||
|     private EtAreaRuleMapper etAreaRuleMapper; | ||||
|     private EtModelRuleMapper etModelRuleMapper; | ||||
| 
 | ||||
|     /** | ||||
|      * 查询收费方式 | ||||
|  | @ -122,6 +123,17 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService | |||
|         return etFeeRuleMapper.selectRuleInfoListByAreaId(areaId); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 根据运营区获取收费方式列表 | ||||
|      * | ||||
|      * @param modelId 车型id | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     @Override | ||||
|     public List<EtFeeRule> selectRuleInfoListByModelId(Long modelId) { | ||||
|         return etFeeRuleMapper.selectRuleInfoListByModelId(modelId); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 新增收费方式 | ||||
|      * | ||||
|  | @ -141,7 +153,7 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService | |||
|         etFeeRule.setStatus("0"); | ||||
|         int i = etFeeRuleMapper.insertEtFeeRule(etFeeRule); | ||||
|         if(ObjectUtil.isNotNull(etFeeRule.getAreaId())){ | ||||
|             etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etFeeRule.getAreaId()).ruleId(etFeeRule.getRuleId()).build()); | ||||
|             etModelRuleMapper.insert(EtModelRule.builder().modelId(etFeeRule.getModelId()).ruleId(etFeeRule.getRuleId()).build()); | ||||
|         } | ||||
|         return i; | ||||
|     } | ||||
|  | @ -155,9 +167,9 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService | |||
|     @Override | ||||
|     public int updateEtFeeRule(EtFeeRule etFeeRule) | ||||
|     { | ||||
|         int i = etAreaRuleMapper.deleteAreaRuleByRuleId(etFeeRule.getRuleId()); | ||||
|         int i = etModelRuleMapper.deleteModelRuleByModelId(etFeeRule.getRuleId()); | ||||
|         if(ObjectUtil.isNotNull(etFeeRule.getAreaId())){ | ||||
|             etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etFeeRule.getAreaId()).ruleId(etFeeRule.getRuleId()).build()); | ||||
|             etModelRuleMapper.insert(EtModelRule.builder().modelId(etFeeRule.getModelId()).ruleId(etFeeRule.getRuleId()).build()); | ||||
|         } | ||||
|         return etFeeRuleMapper.updateEtFeeRule(etFeeRule); | ||||
|     } | ||||
|  | @ -197,6 +209,17 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService | |||
|         return etFeeRuleMapper.selectRuleListByAreaId(areaId); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 根据modelId获取收费方式选择框列表 | ||||
|      * | ||||
|      * @param modelId 车型id | ||||
|      * @return 选中收费方式ID列表 | ||||
|      */ | ||||
|     @Override | ||||
|     public List<Long> selectRuleListByModelId(Long modelId) { | ||||
|         return etFeeRuleMapper.selectRuleListByModelId(modelId); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 根据区域ID获取收费方式名称选择框列表 | ||||
|      * | ||||
|  |  | |||
|  | @ -12,9 +12,11 @@ import com.ruoyi.common.utils.onenet.ResponseVo; | |||
| import com.ruoyi.common.utils.onenet.Token; | ||||
| import com.ruoyi.system.domain.AsDevice; | ||||
| import com.ruoyi.system.domain.EtModel; | ||||
| import com.ruoyi.system.domain.EtModelRule; | ||||
| import com.ruoyi.system.domain.EtOperatingArea; | ||||
| import com.ruoyi.system.mapper.AsDeviceMapper; | ||||
| import com.ruoyi.system.mapper.EtModelMapper; | ||||
| import com.ruoyi.system.mapper.EtModelRuleMapper; | ||||
| import com.ruoyi.system.mapper.SysDeptMapper; | ||||
| import com.ruoyi.system.service.IAsDeviceService; | ||||
| import com.ruoyi.system.service.IEtModelService; | ||||
|  | @ -44,15 +46,15 @@ public class EtModelServiceImpl implements IEtModelService | |||
|     @Autowired | ||||
|     private IAsDeviceService asDeviceService; | ||||
| 
 | ||||
|     @Resource | ||||
|     private AsDeviceMapper asDeviceMapper; | ||||
| 
 | ||||
|     @Resource | ||||
|     private IEtOperatingAreaService etOperatingAreaService; | ||||
| 
 | ||||
|     @Resource | ||||
|     private SysDeptMapper deptMapper; | ||||
| 
 | ||||
|     @Resource | ||||
|     private EtModelRuleMapper etModelRuleMapper; | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 查询车辆型号 | ||||
|  | @ -120,6 +122,13 @@ public class EtModelServiceImpl implements IEtModelService | |||
|         } | ||||
|         etModel.setCreateTime(DateUtils.getNowDate()); | ||||
|         int i = etModelMapper.insertEtModel(etModel); | ||||
|         Long[] ruleIds = etModel.getRuleIds(); | ||||
|         if(ObjectUtil.isNotNull(ruleIds) && ruleIds.length > 0){ | ||||
|             for (Long ruleId:ruleIds){ | ||||
|                 etModelRuleMapper.insert(EtModelRule.builder().modelId(etModel.getModelId()).ruleId(ruleId).build()); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
| //        // 发送设置低电压命令 | ||||
| //        Integer lowBatteryReminder = etModel.getLowBatteryReminder(); | ||||
| //        if(ObjectUtil.isNotNull(lowBatteryReminder) && lowBatteryReminder > 0){ | ||||
|  | @ -156,6 +165,15 @@ public class EtModelServiceImpl implements IEtModelService | |||
|         } | ||||
|         etModel.setUpdateTime(DateUtils.getNowDate()); | ||||
|         int i = etModelMapper.updateEtModel(etModel); | ||||
|         Long[] ruleIds = etModel.getRuleIds(); | ||||
|         if(ObjectUtil.isNotNull(ruleIds)){ | ||||
|             etModelRuleMapper.deleteModelRuleByModelId(etModel.getModelId()); | ||||
|             if(ObjectUtil.isNotNull(ruleIds)){ | ||||
|                 for (Long ruleId:ruleIds){ | ||||
|                     etModelRuleMapper.insert(EtModelRule.builder().modelId(etModel.getModelId()).ruleId(ruleId).build()); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         // 发送设置低电压命令 | ||||
| //        Integer lowBatteryReminder = etModel.getLowBatteryReminder(); | ||||
| //        if(ObjectUtil.isNotNull(lowBatteryReminder) && lowBatteryReminder > 0){ | ||||
|  |  | |||
|  | @ -56,8 +56,8 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe | |||
|     @Autowired | ||||
|     private IEtFeeRuleService etFeeRuleService; | ||||
| 
 | ||||
|     @Resource | ||||
|     private EtAreaRuleMapper etAreaRuleMapper; | ||||
| //    @Resource | ||||
| //    private EtAreaRuleMapper etAreaRuleMapper; | ||||
| 
 | ||||
|     @Resource | ||||
|     private IEtOperatingAreaService etOperatingAreaService; | ||||
|  | @ -157,12 +157,12 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe | |||
|         String wkt = GeoUtils.wkt(geometry); | ||||
|         etOperatingArea.setBoundary(wkt); | ||||
|         int insert = dao.insert(etOperatingArea); | ||||
|         Long[] ruleIds = etOperatingArea.getRuleIds(); | ||||
|         if(ObjectUtil.isNotNull(ruleIds) && ruleIds.length > 0){ | ||||
|             for (Long ruleId:ruleIds){ | ||||
|                 etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etOperatingArea.getAreaId()).ruleId(ruleId).build()); | ||||
|             } | ||||
|         } | ||||
| //        Long[] ruleIds = etOperatingArea.getRuleIds(); | ||||
| //        if(ObjectUtil.isNotNull(ruleIds) && ruleIds.length > 0){ | ||||
| //            for (Long ruleId:ruleIds){ | ||||
| //                etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etOperatingArea.getAreaId()).ruleId(ruleId).build()); | ||||
| //            } | ||||
| //        } | ||||
|         Long deptId = SecurityUtils.getDeptId(); | ||||
|         if(deptId == 100){ | ||||
|             deptId = etOperatingArea.getDeptId(); | ||||
|  | @ -193,15 +193,15 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe | |||
|         String wkt = GeoUtils.wkt(geometry); | ||||
|         etOperatingArea.setBoundary(wkt); | ||||
|         int i = dao.updateById(etOperatingArea); | ||||
|         Long[] ruleIds = etOperatingArea.getRuleIds(); | ||||
|         if(ObjectUtil.isNotNull(ruleIds)){ | ||||
|             etAreaRuleMapper.deleteAreaRuleByAreaId(etOperatingArea.getAreaId()); | ||||
|             if(ObjectUtil.isNotNull(ruleIds)){ | ||||
|                 for (Long ruleId:ruleIds){ | ||||
|                     etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etOperatingArea.getAreaId()).ruleId(ruleId).build()); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| //        Long[] ruleIds = etOperatingArea.getRuleIds(); | ||||
| //        if(ObjectUtil.isNotNull(ruleIds)){ | ||||
| //            etAreaRuleMapper.deleteAreaRuleByAreaId(etOperatingArea.getAreaId()); | ||||
| //            if(ObjectUtil.isNotNull(ruleIds)){ | ||||
| //                for (Long ruleId:ruleIds){ | ||||
| //                    etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etOperatingArea.getAreaId()).ruleId(ruleId).build()); | ||||
| //                } | ||||
| //            } | ||||
| //        } | ||||
|         Long deptId = SecurityUtils.getDeptId(); | ||||
|         if(deptId == 100){ | ||||
|             deptId = etOperatingArea.getDeptId(); | ||||
|  |  | |||
|  | @ -224,16 +224,35 @@ public class EtOrderServiceImpl implements IEtOrderService | |||
|                 order.setRule(etFeeRule); | ||||
|             } | ||||
|             //退款记录 | ||||
|             EtRefund etRefund = new EtRefund(); | ||||
|             etRefund.setOrderNo(order.getOrderNo()); | ||||
|             List<EtRefund> refundList = etRefundService.selectEtRefundList(etRefund); | ||||
|             // 初始化可退金额为订单的原始费用 | ||||
|             BigDecimal remainingDispatchFee = order.getDispatchFee(); | ||||
|             BigDecimal remainingManageFee = order.getManageFee(); | ||||
|             BigDecimal remainingRidingFee = order.getRidingFee(); | ||||
|             BigDecimal remainingAppointmentFee = order.getAppointmentFee(); | ||||
|             BigDecimal totalRefundedAmount = BigDecimal.ZERO; // 总退款金额 | ||||
| 
 | ||||
|             List<EtRefund> refundList = etRefundService.selectEtRefundByOrderNo(order.getOrderNo()); | ||||
|             if(ObjectUtils.isNotEmpty(refundList) && refundList.size() > 0){ | ||||
|                 order.setEtRefunds(refundList); | ||||
|             } | ||||
|             if(ObjectUtils.isNotEmpty(refundList)){ | ||||
|                 EtRefund etRefund1 = refundList.get(0); | ||||
|                 order.setEtRefund(etRefund1); | ||||
|                 order.setSettlementFee(order.getTotalFee().subtract(etRefund1.getAmount())); | ||||
|                 for (EtRefund refund : refundList) { | ||||
|                     totalRefundedAmount = totalRefundedAmount.add(refund.getAmount() != null ? refund.getAmount() : BigDecimal.ZERO); | ||||
|                     // 减去已退款的金额 | ||||
|                     remainingDispatchFee = remainingDispatchFee.subtract(refund.getDispatchFee() != null ? refund.getDispatchFee() : BigDecimal.ZERO); | ||||
|                     remainingManageFee = remainingManageFee.subtract(refund.getManageFee() != null ? refund.getManageFee() : BigDecimal.ZERO); | ||||
|                     remainingRidingFee = remainingRidingFee.subtract(refund.getRidingFee() != null ? refund.getRidingFee() : BigDecimal.ZERO); | ||||
|                     remainingAppointmentFee = remainingAppointmentFee.subtract(refund.getAppointmentFee() != null ? refund.getAppointmentFee() : BigDecimal.ZERO); | ||||
|                 } | ||||
|                 order.setSettlementFee(order.getTotalFee().subtract(totalRefundedAmount)); | ||||
|             }else{ | ||||
|                 order.setSettlementFee(order.getTotalFee()); | ||||
|             } | ||||
|             order.setRefundableDispatchFee(remainingDispatchFee.max(BigDecimal.ZERO)); | ||||
|             order.setRefundableManageFee(remainingManageFee.max(BigDecimal.ZERO)); | ||||
|             order.setRefundableRideFee(remainingRidingFee.max(BigDecimal.ZERO)); | ||||
|             order.setRefundableAppointmentFee(remainingAppointmentFee.max(BigDecimal.ZERO)); | ||||
| 
 | ||||
|             //行程记录 | ||||
|             EtTripLog tripLog = new EtTripLog(); | ||||
|             tripLog.setOrderNo(order.getOrderNo()); | ||||
|  |  | |||
|  | @ -74,6 +74,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|         where r.is_deleted  = 0 and a.area_id = #{areaId} | ||||
|     </select> | ||||
| 
 | ||||
|     <select id="selectRuleListByModelId" parameterType="Long" resultType="Long"> | ||||
|         select r.rule_id | ||||
|         from et_fee_rule r | ||||
|                  left join et_model_rule mr on mr.rule_id = r.rule_id | ||||
|                  left join et_model m  on m.model_id = mr.model_id | ||||
|         where r.is_deleted  = 0 and m.model_id = #{modelId} | ||||
|     </select> | ||||
| 
 | ||||
|     <select id="selectRuleInfoListByAreaId" parameterType="Long" resultMap="EtFeeRuleResult"> | ||||
|         select r.rule_id, r.`dept_id`, r.`name`, r.`explain`, | ||||
|                r.status, r.auto_refund_deposit, r.order_exceed_minutes, r.order_exceed_warn, | ||||
|  | @ -93,6 +101,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|         where r.is_deleted  = 0 and a.area_id = #{areaId} | ||||
|     </select> | ||||
| 
 | ||||
|     <select id="selectRuleInfoListByModelId" resultType="com.ruoyi.system.domain.EtFeeRule"> | ||||
|         select r.rule_id, r.`dept_id`, r.`name`, r.`explain`, | ||||
|                r.status, r.auto_refund_deposit, r.order_exceed_minutes, r.order_exceed_warn, | ||||
|                r.free_ride_time, r.rental_unit, r.riding_rule, r.riding_rule_json, r.charging_cycle, r.charging_cycle_value, | ||||
|                r.capped_amount, r.instructions, r.create_by, r.create_time | ||||
|         from et_fee_rule r | ||||
|                  left join et_model_rule mr on mr.rule_id = r.rule_id | ||||
|                  left join et_model m  on m.model_id = mr.model_id | ||||
|         where r.is_deleted  = 0 and m.model_id = #{modelId} | ||||
|     </select> | ||||
| 
 | ||||
|     <insert id="insertEtFeeRule" parameterType="EtFeeRule" useGeneratedKeys="true" keyProperty="ruleId"> | ||||
|         insert into et_fee_rule | ||||
|         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|         <result property="model"    column="model"    /> | ||||
|         <result property="brand"    column="brand"    /> | ||||
|         <result property="operator"    column="operator"    /> | ||||
|         <result property="areaId"       column="area_id"       /> | ||||
|         <result property="fullVoltage"    column="full_voltage"    /> | ||||
|         <result property="lowVoltage"    column="low_voltage"    /> | ||||
|         <result property="fullEndurance"    column="full_endurance"    /> | ||||
|  | @ -21,24 +22,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|     </resultMap> | ||||
| 
 | ||||
|     <sql id="selectEtModelVo"> | ||||
|         select model_id, model, brand, operator, full_voltage, low_voltage, full_endurance, low_battery_reminder, create_by, create_time, update_by, update_time, remark from et_model | ||||
|         select model_id, model, brand, operator, area_id, full_voltage, low_voltage, full_endurance, low_battery_reminder, create_by, create_time, update_by, update_time, remark from et_model | ||||
|     </sql> | ||||
| 
 | ||||
|     <select id="selectEtModelList" parameterType="EtModel" resultMap="EtModelResult"> | ||||
|         select m.model_id, m.model, m.brand, m.operator, m.full_voltage, m.low_voltage, | ||||
|         select m.model_id, m.model, m.brand, m.operator, m.full_voltage, m.low_voltage,m.area_id,a.area_name areaName, | ||||
|         m.full_endurance, m.low_battery_reminder, m.create_by, m.create_time, | ||||
|         m.update_by, m.update_time, m.remark from et_model m | ||||
|         left join sys_dept d on d.dept_id = m.operator | ||||
|         left join et_operating_area a on a.area_id = m.area_id | ||||
|         where m.del_flag != 2 | ||||
|         <if test="model != null  and model != ''"> and m.model = #{model}</if> | ||||
|         <if test="brand != null  and brand != ''"> and m.brand = #{brand}</if> | ||||
|         <if test="operator != null  and operator != ''"> and m.operator = #{operator}</if> | ||||
|         <if test="areaId != null  and areaId != ''"> and m.area_id = #{areaId}</if> | ||||
|         <!-- 数据范围过滤 --> | ||||
|         ${params.dataScope} | ||||
|     </select> | ||||
| 
 | ||||
|     <select id="selectEtModelByModelId" parameterType="Long" resultMap="EtModelResult"> | ||||
|         select m.model_id, m.model, m.brand, m.operator, d.dept_name, m.full_voltage, m.low_voltage, | ||||
|         select m.model_id, m.model, m.brand, m.operator, d.dept_name, m.full_voltage, m.low_voltage,m.area_id, | ||||
|                m.full_endurance, m.low_battery_reminder, m.create_by, m.create_time, | ||||
|                m.update_by, m.update_time, m.remark from et_model m | ||||
|         left join sys_dept d on d.dept_id = m.operator | ||||
|  | @ -56,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|             <if test="model != null">model,</if> | ||||
|             <if test="brand != null">brand,</if> | ||||
|             <if test="operator != null">operator,</if> | ||||
|             <if test="areaId != null">area_id,</if> | ||||
|             <if test="fullVoltage != null">full_voltage,</if> | ||||
|             <if test="lowVoltage != null">low_voltage,</if> | ||||
|             <if test="fullEndurance != null">full_endurance,</if> | ||||
|  | @ -71,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|             <if test="model != null">#{model},</if> | ||||
|             <if test="brand != null">#{brand},</if> | ||||
|             <if test="operator != null">#{operator},</if> | ||||
|             <if test="areaId != null">#{areaId},</if> | ||||
|             <if test="fullVoltage != null">#{fullVoltage},</if> | ||||
|             <if test="lowVoltage != null">#{lowVoltage},</if> | ||||
|             <if test="fullEndurance != null">#{fullEndurance},</if> | ||||
|  | @ -89,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|             <if test="model != null">model = #{model},</if> | ||||
|             <if test="brand != null">brand = #{brand},</if> | ||||
|             <if test="operator != null">operator = #{operator},</if> | ||||
|             <if test="areaId != null">area_id = #{areaId},</if> | ||||
|             <if test="fullVoltage != null">full_voltage = #{fullVoltage},</if> | ||||
|             <if test="lowVoltage != null">low_voltage = #{lowVoltage},</if> | ||||
|             <if test="fullEndurance != null">full_endurance = #{fullEndurance},</if> | ||||
|  |  | |||
|  | @ -0,0 +1,14 @@ | |||
| <?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.system.mapper.EtModelRuleMapper"> | ||||
| 
 | ||||
|     <delete id="deleteModelRuleByModelId"> | ||||
|         delete from et_model_rule where model_id=#{modelId} | ||||
|     </delete> | ||||
| 
 | ||||
|     <delete id="deleteModelRuleByRuleId"> | ||||
|         delete from et_model_rule where rule_id=#{ruleId} | ||||
|     </delete> | ||||
| </mapper> | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user