| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.C3mChargingChargeParam; |
| | | import com.sandu.ximon.admin.service.C3mChargingChargeService; |
| | |
| | | * @param charge |
| | | * @return |
| | | */ |
| | | @PostMapping("/addC3mCharging") |
| | | // @PostMapping("/addC3mCharging") |
| | | public ResponseVO<Object> addC3mCharging(@RequestBody C3mChargingChargeParam charge) { |
| | | // chargeService.save(charge); |
| | | // chargeService.initCharge(charge); |
| | |
| | | |
| | | @PostMapping("/updateC3mCharging") |
| | | public ResponseVO<Object> updateC3mCharging(@RequestBody List<C3mChargingCharge> chargeEntities) { |
| | | if(chargeEntities.size()>5){ |
| | | throw new BusinessException("当前最高仅支持4组费率"); |
| | | } |
| | | if(chargeEntities.size()==0){ |
| | | throw new BusinessException("最少需要一条费率"); |
| | | } |
| | | return ResponseUtil.success(chargeService.updateCharge(chargeEntities)); |
| | | } |
| | | |
| | | @PostMapping("/deleteC3mCharging") |
| | | public ResponseVO<Object> deleteC3mCharging(@PathVariable Integer c3mId) { |
| | | return ResponseUtil.success(chargeService.deleteC3mCharging(c3mId)); |
| | | // @PostMapping("/deleteC3mCharging") |
| | | public ResponseVO<Object> deleteC3mCharging(@RequestBody C3mChargingChargeParam charge) { |
| | | boolean remove = chargeService.remove(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, charge.getC3Id()) |
| | | .eq(C3mChargingCharge::getHour, charge.getCharge()).eq(C3mChargingCharge::getHour, charge.getHour()) |
| | | .eq(C3mChargingCharge::getCharge, charge.getCharge()).eq(C3mChargingCharge::getCharge, charge.getTimestamp())); |
| | | return ResponseUtil.success(remove); |
| | | } |
| | | |
| | | |