管理员充值电量

This commit is contained in:
墨大叔 2024-10-06 17:00:37 +08:00
parent 6348f52646
commit 334420cbe5
2 changed files with 21 additions and 4 deletions

View File

@ -421,6 +421,8 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
order.setType(TransactionBillType.RECHARGE.getType()); // 类型充值订单
order.setDeviceRechargeStatus(TransactionBillDeviceRechargeStatus.UN_RECHARGE.getStatus()); // 设备状态未充值
order.setVersion(2); // 订单版本
order.setCloseStatus(RechargeCloseStatus.SUCCESS.getStatus());
order.setCloseResult("预计成功");
if (SuitFeeType.timingList().contains(suit.getFeeType())) {
// 当为分时段收费则收取押金

View File

@ -1,5 +1,6 @@
package com.ruoyi.web.controller.ss;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -11,6 +12,7 @@ import com.ruoyi.ss.device.domain.dto.DeviceBatchUpdateModelDTO;
import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.device.service.DeviceAssembler;
import com.ruoyi.ss.suit.domain.enums.SuitTimeUnit;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
@ -148,12 +150,25 @@ public class SmDeviceController extends BaseController
return success(deviceService.bindSn(deviceId, sn));
}
@ApiOperation("设备充值时长")
@PreAuthorize("@ss.hasPermi('system:device:addTime')")
@Log(title = "设备", businessType = BusinessType.OTHER)
@Log(title = "设备充值时长", businessType = BusinessType.OTHER)
@PutMapping("/addTime/{deviceId}")
public AjaxResult addTime(@PathVariable @ApiParam("设备id") Long deviceId, @ApiParam("时长(分)") Long amount) {
return toAjax(deviceService.addTimeByUser(deviceId, amount * 60, true, "管理员手动充值"));
public AjaxResult addTime(@PathVariable @ApiParam("设备id") Long deviceId,
@ApiParam("时长") @RequestParam Long amount,
@ApiParam("时长单位") @RequestParam(required = false, defaultValue = "3") String timeUnit) {
SuitTimeUnit unit = SuitTimeUnit.getByValue(timeUnit);
if (unit == null) {
return error("非法的时长单位");
}
return toAjax(deviceService.addTimeByUser(deviceId, amount * unit.getConversion(), true, "管理员手动充值时长"));
}
@PreAuthorize("@ss.hasPermi('system:device:addEle')")
@Log(title = "设备充值电量", businessType = BusinessType.OTHER)
@PutMapping("/addEle/{deviceId}")
public AjaxResult addEle(@ApiParam("设备id") @PathVariable Long deviceId,
@ApiParam("电量(度)") @RequestParam BigDecimal amount) {
return toAjax(deviceService.addEle(deviceId, amount, true, "管理员手动充值电量"));
}
@ApiOperation("设备时长归零")