套餐应用到车型

This commit is contained in:
19173159168
2025-08-09 00:13:29 +08:00
parent 9018d8eef1
commit 55ff442dc9
18 changed files with 208 additions and 97 deletions

View File

@ -8,8 +8,10 @@ import java.util.stream.Collectors;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.operation.domain.Company;
import com.ruoyi.operation.domain.ZcCarModel;
import com.ruoyi.operation.domain.ZcRentCarRuleBattery;
import com.ruoyi.operation.service.ICompanyService;
import com.ruoyi.operation.service.IZcCarModelService;
import com.ruoyi.operation.service.IZcRentCarRuleBatteryService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@ -43,7 +45,8 @@ public class ZcRentCarRuleController extends BaseController
private ICompanyService companyService;
@Autowired
private IZcRentCarRuleBatteryService zcRentCarRuleBatteryService;
@Autowired
private IZcCarModelService zcCarModelService;
@RequiresPermissions("operation:rentCarRule:view")
@GetMapping()
@ -155,6 +158,12 @@ public class ZcRentCarRuleController extends BaseController
.map(String::valueOf)
.collect(Collectors.joining(","));
mmap.put("modelRuleNames", modelRuleNames);
ZcCarModel zcCarModel = new ZcCarModel();
zcCarModel.setStatus("0");
List<ZcCarModel> modelList = zcCarModelService.selectCarModelListByCarRuleId(id);
mmap.put("modelList", modelList);
return prefix + "/edit";
}
@ -165,10 +174,10 @@ public class ZcRentCarRuleController extends BaseController
@Log(title = "租车计费规则", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(ZcRentCarRule zcRentCarRule)
public AjaxResult editSave(@RequestParam("carModelIds") List<Long> carModelIds, ZcRentCarRule zcRentCarRule)
{
zcRentCarRule.setUpdateBy(getLoginName());
return toAjax(zcRentCarRuleService.updateZcRentCarRule(zcRentCarRule));
return toAjax(zcRentCarRuleService.updateZcRentCarRule(carModelIds,zcRentCarRule));
}
@GetMapping("/detail/{id}")

View File

@ -7,6 +7,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.data.annotation.Transient;
/**
* 车型管理对象 zc_car_model
@ -62,6 +63,10 @@ public class ZcCarModel extends BaseEntity
private List<ZcRentCarRule> rentCarRuleList;
/** 套餐是否关联此车型标识 默认不存在 */
@Transient
private boolean flag = false;
public void setId(Long id)
{
this.id = id;
@ -187,6 +192,16 @@ public class ZcCarModel extends BaseEntity
this.image = image;
}
public boolean isFlag()
{
return flag;
}
public void setFlag(boolean flag)
{
this.flag = flag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -55,6 +55,9 @@ public interface ZcCarModelPackageMapper
public int deleteZcCarModelPackageById(Long id);
public int deleteZcCarModelPackageByModeId(Long modeId);
public int deleteZcCarModelPackageByRuleId(Long ruleId);
/**
* 批量删除车型与租车规则关联
*

View File

@ -53,6 +53,8 @@ public interface IZcCarModelPackageService
public int deleteZcCarModelPackageByIds(String ids);
public int deleteZcCarModelPackageByModeId(Long modeId);
public int deleteZcCarModelPackageByRuleId(Long ruleId);
/**
* 删除车型与租车规则关联信息
*

View File

@ -27,6 +27,7 @@ public interface IZcCarModelService
*/
public List<ZcCarModel> selectZcCarModelList(ZcCarModel zcCarModel);
public List<ZcCarModel> selectCarModelListByCarRuleId(Long rentCarRuleId);
/**
* 新增车型管理
*

View File

@ -44,7 +44,7 @@ public interface IZcRentCarRuleService
* @param zcRentCarRule 租车计费规则
* @return 结果
*/
public int updateZcRentCarRule(ZcRentCarRule zcRentCarRule);
public int updateZcRentCarRule(List<Long> carModelIds, ZcRentCarRule zcRentCarRule);
/**
* 批量删除租车计费规则

View File

@ -95,6 +95,11 @@ public class ZcCarModelPackageServiceImpl implements IZcCarModelPackageService
return zcCarModelPackageMapper.deleteZcCarModelPackageByModeId(modeId);
}
@Override
public int deleteZcCarModelPackageByRuleId(Long ruleId)
{
return zcCarModelPackageMapper.deleteZcCarModelPackageByRuleId(ruleId);
}
/**
* 删除车型与租车规则关联信息
*

View File

@ -1,6 +1,7 @@
package com.ruoyi.operation.service.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
@ -51,6 +52,30 @@ public class ZcCarModelServiceImpl implements IZcCarModelService
return zcCarModelMapper.selectZcCarModelList(zcCarModel);
}
@Override
public List<ZcCarModel> selectCarModelListByCarRuleId(Long rentCarRuleId) {
ZcCarModel zcCarModel = new ZcCarModel();
zcCarModel.setStatus("0");
List<ZcCarModel> zcCarModelList = zcCarModelMapper.selectZcCarModelList(zcCarModel);
ZcCarModelPackage zcCarModelPackage = new ZcCarModelPackage();
zcCarModelPackage.setCarRuleId(rentCarRuleId);
List<ZcCarModelPackage> carModeBatteryList = zcCarModelPackageService.selectZcCarModelPackageList(zcCarModelPackage);
for (ZcCarModel zcm : zcCarModelList)
{
for (ZcCarModelPackage modeRcr : carModeBatteryList)
{
if (zcm.getId().longValue() == modeRcr.getCarModelId().longValue())
{
zcm.setFlag(true);
break;
}
}
}
return zcCarModelList;
}
/**
* 新增车型管理
*

View File

@ -1,5 +1,7 @@
package com.ruoyi.operation.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysRole;
@ -96,10 +98,25 @@ public class ZcRentCarRuleServiceImpl implements IZcRentCarRuleService
* @return 结果
*/
@Override
public int updateZcRentCarRule(ZcRentCarRule zcRentCarRule)
public int updateZcRentCarRule(List<Long> carModelIds,ZcRentCarRule zcRentCarRule)
{
zcRentCarRule.setUpdateTime(DateUtils.getNowDate());
return zcRentCarRuleMapper.updateZcRentCarRule(zcRentCarRule);
int flag = zcRentCarRuleMapper.updateZcRentCarRule(zcRentCarRule);
zcCarModelPackageService.deleteZcCarModelPackageByRuleId(zcRentCarRule.getId());
// 保存关联表 ZcRentCarRuleBattery 数据
List<ZcCarModelPackage> carModelPackageList = new ArrayList<>();
for (Long carModelId : carModelIds) {
ZcCarModelPackage zcCarModelPackage = new ZcCarModelPackage();
zcCarModelPackage.setCarModelId(carModelId);
zcCarModelPackage.setCarRuleId(zcRentCarRule.getId());
zcCarModelPackage.setCreateTime(new Date());
carModelPackageList.add(zcCarModelPackage);
}
if (!carModelPackageList.isEmpty()) {
zcCarModelPackageService.batchInsert(carModelPackageList);
}
return flag;
}
/**

View File

@ -96,5 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteZcCarModelPackageByModeId">
delete from zc_car_model_package where car_model_id = #{modeId}
</delete>
<delete id="deleteZcCarModelPackageByRuleId">
delete from zc_car_model_package where car_rule_id = #{ruleId}
</delete>
</mapper>

View File

@ -124,7 +124,7 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>修改</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}

View File

@ -163,7 +163,7 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>修改</a> ');
actions.push('<a class="btn btn-success btn-xs ' + distributeFlag + ' btnOption" href="javascript:void(0)" onclick="distribute(\'' + row.id + '\')"><i class="fa fa-edit"></i>分配</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
if (row.status == 1) {

View File

@ -129,7 +129,7 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.editCustomize(\'' + row.id + '\',1300,700)"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.editCustomize(\'' + row.id + '\',1300,700)"><i class="fa fa-edit"></i>修改</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
if (row.status == 1) {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="enable(\'' + row.id + '\')"><i class="fa fa-edit"></i>启用</a> ');

View File

@ -106,30 +106,7 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required"></label>
<div class="col-sm-8">
<input name="isDelete" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required"></label>
<div class="col-sm-8">
<input name="cityId" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required"></label>
<div class="col-sm-8">
<input name="operatorId" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required"></label>
<div class="col-sm-8">
<input name="provinceId" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">电池类型:</label>
<div class="col-sm-8">
@ -144,20 +121,10 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">套餐排序规则</label>
<div class="col-sm-8">
<input name="mealSort" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required"></label>
<div class="col-sm-8">
<input name="isJoinInvite" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">套餐渠道租车默认 id号待定</label>
<label class="col-sm-3 control-label is-required">套餐渠道</label>
<div class="col-sm-8">
<input name="mealChannel" class="form-control" type="text" required>
</div>

View File

@ -25,9 +25,9 @@
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="operation:rentBatteyRule:add">-->
<!-- <i class="fa fa-plus"></i> 添加-->
<!-- </a>-->
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="operation:rentBatteyRule:add">
<i class="fa fa-plus"></i> 添加
</a>
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="operation:rentBatteyRule:edit">-->
<!-- <i class="fa fa-edit"></i> 修改-->
<!-- </a>-->

View File

@ -7,79 +7,70 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-rentCarRule-edit" th:object="${zcRentCarRule}">
<input name="id" th:field="*{id}" type="hidden">
<input type="hidden" id="carModelIds" name="carModelIds">
<div class="form-group">
<label class="col-sm-3 control-label is-required">套餐名称:</label>
<div class="col-sm-8">
<label class="col-sm-2 control-label is-required">套餐名称:</label>
<div class="col-sm-4">
<div class="form-control-static" th:text="*{ruleName}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">租赁类型:</label>
<div class="col-sm-8">
<label class="col-sm-2 control-label is-required">租赁类型:</label>
<div class="col-sm-4">
<div class="form-control-static" th:text="${@dict.getLabel('key_rent_type', zcRentCarRule.rentalType)}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">赁天数</label>
<div class="col-sm-8">
<label class="col-sm-2 control-label is-required">车价格(元)</label>
<div class="col-sm-4">
<div class="form-control-static" th:text="*{rentalPrice}"></div>
</div>
<label class="col-sm-2 control-label">租赁天数:</label>
<div class="col-sm-4">
<div class="form-control-static" th:text="*{rentalDays}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">租车价格(元)</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="*{rentalPrice}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">押金价格(元)</label>
<div class="col-sm-8">
<label class="col-sm-2 control-label is-required">押金价格(元)</label>
<div class="col-sm-4">
<div class="form-control-static" th:text="*{depositPrice}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">逾期金额(元)</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="*{overdueFee}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">逾期计费类型:</label>
<div class="col-sm-8">
<label class="col-sm-2 control-label">逾期计费类型:</label>
<div class="col-sm-4">
<div class="form-control-static" th:text="${@dict.getLabel('key_rent_overdue_type', zcRentCarRule.overdueType)}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否支持免押</label>
<div class="col-sm-8">
<div class="form-group">
<label class="col-sm-2 control-label is-required">逾期金额(元)</label>
<div class="col-sm-4">
<div class="form-control-static" th:text="*{overdueFee}"></div>
</div>
<label class="col-sm-2 control-label">是否支持免押:</label>
<div class="col-sm-4">
<div class="form-control-static" th:text="${@dict.getLabel('key_rent_deposit_free', zcRentCarRule.depositFree)}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否支持代扣</label>
<div class="col-sm-8">
<label class="col-sm-2 control-label is-required">所属运营商</label>
<div class="col-sm-4">
<div class="form-control-static" th:text="${company.companyName}"></div>
</div>
<label class="col-sm-2 control-label">是否支持代扣:</label>
<div class="col-sm-4">
<div class="form-control-static" th:text="${@dict.getLabel('key_rent_auto_deduct', zcRentCarRule.autoDeduct)}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">所属运营商</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${company.companyName}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">租电套餐:</label>
<label class="col-sm-2 control-label is-required">租电套餐</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${modelRuleNames}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">选择车型:</label>
<div class="col-sm-8">
<select name="operatingCompanyId" id="operatingCompanyId" class="form-control m-b">
<option value="">请选择车型</option>
<option th:each="company : ${companyList}" th:value="${company.id}" th:text="${company.companyName}" th:field="*{operatingCompanyId}" ></option>
</select>
<h4 class="form-header h4">车型选择</h4>
<div class="row">
<div class="col-sm-12">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</form>
@ -87,6 +78,9 @@
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "operation/rentCarRule";
var modelList = [[${modelList}]]
var statusDatas = [[${@dict.getType('key_company_status')}]];
var batteryTypeDatas = [[${@dict.getType('key_car_battery_type')}]];
$(document).ready(function() {
@ -110,8 +104,75 @@
});
$(function() {
var options = {
data: modelList,
sidePagination: "client",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
clickToSelect: true,
maintainSelected: true,
columns: [{
checkbox: true,
formatter:function (value, row, index) {
if($.common.isEmpty(value)) {
return { checked: row.flag };
} else {
return { checked: value }
}
}
},
{
field: 'id',
title: '车型ID',
visible: false
},
{
field: 'brandName',
title: '品牌名称',
width: '200'
},
{
field: 'modelName',
title: '车型名称',
width: '200'
},
{
field: 'batteryType',
title: '支持电池类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(batteryTypeDatas, value);
}
},
{
field: 'weight',
title: '整车重量(kg)',
width: '100'
},
{
field: 'maxSpeed',
title: '最高时速(km/h)',
width: '100'
},
{
field: 'status',
title: '状态',
width: '100',
formatter: function(value, row, index) {
return $.table.selectDictLabel(statusDatas, value);
}
}
]
};
$.table.init(options);
});
function submitHandler() {
var rows = $.table.selectFirstColumns();
$("#carModelIds").val(rows.join())
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-rentCarRule-edit').serialize());
}

View File

@ -189,7 +189,7 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-primary btn-xs btnOption" href="javascript:void(0)" onClick="$.operate.edit(\''+row.id+'\', 900, 700)"><i class="fa fa-sticky-note-o"></i> 应用至车型</a>');
actions.push('<a class="btn btn-primary btn-xs btnOption" href="javascript:void(0)" onClick="$.operate.editCustomize(\''+row.id+'\', 1300, 800)"><i class="fa fa-sticky-note-o"></i> 应用至车型</a>');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
if (row.status == 1) {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="enable(\'' + row.id + '\',\'' + row.phone + '\')"><i class="fa fa-edit"></i>启用</a> ');

View File

@ -138,6 +138,7 @@
<script th:inline="javascript">
var prefix = ctx + "orders/order";
var suborderTypeDatas = [[${@dict.getType('key_order_suborder_type')}]];
var paymentMethodDatas = [[${@dict.getType('key_order_payment_method')}]];
$("#form-order-edit").validate({
focusCleanup: true
});
@ -202,7 +203,10 @@
{
field: 'paymentMethod',
align: 'center',
title: '支付方式'
title: '支付方式',
formatter: function(value, row, index) {
return $.table.selectDictLabel(paymentMethodDatas, value);
}
},
{