套餐设置bug

This commit is contained in:
19173159168
2025-09-25 00:23:39 +08:00
parent 08fb39db7e
commit cdbc6aef58

View File

@ -112,7 +112,7 @@ public class ZcRentCarRuleController extends BaseController
@Log(title = "租车计费规则", businessType = BusinessType.INSERT) @Log(title = "租车计费规则", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(@RequestParam("batteryRules") List<Long> batteryRuleIds, ZcRentCarRule zcRentCarRule) public AjaxResult addSave(@RequestParam(value = "batteryRules",required = false) List<Long> batteryRuleIds, ZcRentCarRule zcRentCarRule)
{ {
// 如果是按天租,验证选择的租电套餐支持天数是否一致 // 如果是按天租,验证选择的租电套餐支持天数是否一致
if("3".equals(zcRentCarRule.getRentalType())){ if("3".equals(zcRentCarRule.getRentalType())){
@ -131,17 +131,19 @@ public class ZcRentCarRuleController extends BaseController
int flag = zcRentCarRuleService.insertZcRentCarRule(zcRentCarRule); int flag = zcRentCarRuleService.insertZcRentCarRule(zcRentCarRule);
// 保存关联表 ZcRentCarRuleBattery 数据 if (batteryRuleIds != null && !batteryRuleIds.isEmpty()) {
List<ZcRentCarRuleBattery> ruleBatteryList = new ArrayList<>(); // 保存关联表 ZcRentCarRuleBattery 数据
for (Long batteryRuleId : batteryRuleIds) { List<ZcRentCarRuleBattery> ruleBatteryList = new ArrayList<>();
ZcRentCarRuleBattery ruleBattery = new ZcRentCarRuleBattery(); for (Long batteryRuleId : batteryRuleIds) {
ruleBattery.setCarRuleId(zcRentCarRule.getId()); ZcRentCarRuleBattery ruleBattery = new ZcRentCarRuleBattery();
ruleBattery.setBatteryRuleId(batteryRuleId); ruleBattery.setCarRuleId(zcRentCarRule.getId());
ruleBattery.setCreateTime(new Date()); ruleBattery.setBatteryRuleId(batteryRuleId);
ruleBatteryList.add(ruleBattery); ruleBattery.setCreateTime(new Date());
} ruleBatteryList.add(ruleBattery);
if (!ruleBatteryList.isEmpty()) { }
zcRentCarRuleBatteryService.batchInsert(ruleBatteryList); if (!ruleBatteryList.isEmpty()) {
zcRentCarRuleBatteryService.batchInsert(ruleBatteryList);
}
} }
return toAjax(flag); return toAjax(flag);
} }