package com.ruoyi.account.controller;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.ruoyi.account.api.dto.CompanyAllocateRecordQueryDTO;
|
import com.ruoyi.account.api.model.TCompanyAllocateRecord;
|
import com.ruoyi.account.service.TCompanyAllocateRecordService;
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.web.controller.BaseController;
|
import com.ruoyi.common.security.annotation.Logical;
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.math.BigDecimal;
|
|
@Api(tags = "公司额度分配记录")
|
@RestController
|
@RequestMapping("/company-allocate-record")
|
public class TCompanyAllocateRecordController extends BaseController {
|
|
@Autowired
|
private TCompanyAllocateRecordService companyAllocateRecordService;
|
|
@ApiOperation(value = "分页查询公司额度分配记录")
|
@RequiresPermissions(value = {"/companyManagement/list"}, logical = Logical.OR)
|
@PostMapping("/page")
|
public R<IPage<TCompanyAllocateRecord>> page(@RequestBody CompanyAllocateRecordQueryDTO query) {
|
return R.ok(companyAllocateRecordService.selectRecordPage(query));
|
}
|
|
/**
|
* 内部接口:写入消费流水(VIN码充电结算调用,按订单号+变更类型幂等)
|
*/
|
@ApiOperation(value = "内部-写入消费流水", tags = {"内部调用"})
|
@PostMapping("/inner/record-consume")
|
public R<Boolean> recordConsume(@RequestParam("companyId") Integer companyId,
|
@RequestParam("userType") Integer userType,
|
@RequestParam("userInfo") String userInfo,
|
@RequestParam(value = "userName", required = false) String userName,
|
@RequestParam("beforeBalance") BigDecimal beforeBalance,
|
@RequestParam("amount") BigDecimal amount,
|
@RequestParam("chargingOrderCode") String chargingOrderCode,
|
@RequestParam(value = "remark", required = false) String remark) {
|
try {
|
return R.ok(companyAllocateRecordService.recordConsume(companyId, userType, userInfo, userName,
|
beforeBalance, amount, chargingOrderCode, remark));
|
} catch (RuntimeException ex) {
|
logger.error("写入消费流水失败:orderCode={}", chargingOrderCode, ex);
|
return R.fail("写入消费流水失败:" + ex.getMessage());
|
}
|
}
|
}
|