xinwei #17

Merged
root merged 4 commits from xinwei into master 2024-08-20 19:33:42 +08:00
13 changed files with 741 additions and 1 deletions
Showing only changes of commit 8f595ad135 - Show all commits

View File

@ -0,0 +1,100 @@
package cn.iocoder.yudao.module.parking.controller.admin.chargeinfo;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.parking.controller.admin.chargeinfo.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.chargeinfo.ChargeInfoDO;
import cn.iocoder.yudao.module.parking.service.chargeinfo.ChargeInfoService;
@Tag(name = "管理后台 - 收费信息")
@RestController
@RequestMapping("/parking/charge-info")
@Validated
public class ChargeInfoController {
@Resource
private ChargeInfoService chargeInfoService;
@PostMapping("/insertChargeInformation")
public BlueCardResult insertChargeInformation(@RequestBody ChargeInfoReqDataVO chargeInformation){
return chargeInfoService.uploadChargeInformation(chargeInformation);
}
@PostMapping("/create")
@Operation(summary = "创建收费信息")
@PreAuthorize("@ss.hasPermission('parking:charge-info:create')")
public CommonResult<Long> createchargeInfo(@Valid @RequestBody ChargeInfoSaveReqVO createReqVO) {
return success(chargeInfoService.createchargeInfo(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新收费信息")
@PreAuthorize("@ss.hasPermission('parking:charge-info:update')")
public CommonResult<Boolean> updatechargeInfo(@Valid @RequestBody ChargeInfoSaveReqVO updateReqVO) {
chargeInfoService.updatechargeInfo(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除收费信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:charge-info:delete')")
public CommonResult<Boolean> deletechargeInfo(@RequestParam("id") Long id) {
chargeInfoService.deletechargeInfo(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得收费信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:charge-info:query')")
public CommonResult<ChargeInfoRespVO> getchargeInfo(@RequestParam("id") Long id) {
ChargeInfoDO chargeInfo = chargeInfoService.getchargeInfo(id);
return success(BeanUtils.toBean(chargeInfo, ChargeInfoRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得收费信息分页")
@PreAuthorize("@ss.hasPermission('parking:charge-info:query')")
public CommonResult<PageResult<ChargeInfoRespVO>> getchargeInfoPage(@Valid ChargeInfoPageReqVO pageReqVO) {
PageResult<ChargeInfoDO> pageResult = chargeInfoService.getchargeInfoPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ChargeInfoRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出收费信息 Excel")
@PreAuthorize("@ss.hasPermission('parking:charge-info:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportchargeInfoExcel(@Valid ChargeInfoPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ChargeInfoDO> list = chargeInfoService.getchargeInfoPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "收费信息.xls", "数据", ChargeInfoRespVO.class,
BeanUtils.toBean(list, ChargeInfoRespVO.class));
}
}

View File

@ -0,0 +1,83 @@
package cn.iocoder.yudao.module.parking.controller.admin.chargeinfo.vo;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 收费信息分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ChargeInfoPageReqVO extends PageParam {
@Schema(description = "场库编号")
private String parkNumber;
@Schema(description = "车牌号")
private String plate;
@Schema(description = "入场时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] inTime;
@Schema(description = "结算时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] outTime;
@Schema(description = "入场通道")
private String inChannel;
@Schema(description = "出场通道")
private String outChannel;
@Schema(description = "支付类型")
private String payKind;
@Schema(description = "支付渠道")
private String payChannel;
@Schema(description = "入场订单号", example = "16414")
private String orderId;
@Schema(description = "车辆类型", example = "1")
private String carType;
@Schema(description = "支付订单号")
private String payNo;
@Schema(description = "备注", example = "随便")
private String memo;
@Schema(description = "应缴金额")
private String charge;
@Schema(description = "实收金额")
private String realCharge;
@Schema(description = "优惠金额")
private String couponCharge;
@Schema(description = "区域 ID", example = "19866")
private String areaId;
@Schema(description = "操作员名称", example = "王五")
private String operatorName;
@Schema(description = "操作员联系电话")
private String operatorTelphone;
@Schema(description = "支付订单号")
private String outTradeNo;
@Schema(description = "车牌颜色")
private String plateColor;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,17 @@
package cn.iocoder.yudao.module.parking.controller.admin.chargeinfo.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 收费信息接口请求参数")
@Data
public class ChargeInfoReqDataVO {
@Schema(description = "场库编号")
private String parkNumber;
@Schema(description = "收费信息数量")
private String size;
@Schema(description = "收费信息列表")
private List<ChargeInfoSaveReqVO> datas;
}

View File

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.parking.controller.admin.chargeinfo.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 收费信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ChargeInfoRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28728")
@ExcelProperty("id")
private Long id;
@Schema(description = "场库编号")
@ExcelProperty("场库编号")
private String parkNumber;
@Schema(description = "车牌号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车牌号")
private String plate;
@Schema(description = "入场时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("入场时间")
private String inTime;
@Schema(description = "结算时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("结算时间")
private String outTime;
@Schema(description = "入场通道")
@ExcelProperty("入场通道")
private String inChannel;
@Schema(description = "出场通道")
@ExcelProperty("出场通道")
private String outChannel;
@Schema(description = "支付类型", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("支付类型")
private String payKind;
@Schema(description = "支付渠道", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("支付渠道")
private String payChannel;
@Schema(description = "入场订单号", example = "16414")
@ExcelProperty("入场订单号")
private String orderId;
@Schema(description = "车辆类型", example = "1")
@ExcelProperty("车辆类型")
private String carType;
@Schema(description = "支付订单号")
@ExcelProperty("支付订单号")
private String payNo;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
@ExcelProperty("备注")
private String memo;
@Schema(description = "应缴金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("应缴金额")
private String charge;
@Schema(description = "实收金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("实收金额")
private String realCharge;
@Schema(description = "优惠金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("优惠金额")
private String couponCharge;
@Schema(description = "区域 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19866")
@ExcelProperty("区域 ID")
private String areaId;
@Schema(description = "操作员名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@ExcelProperty("操作员名称")
private String operatorName;
@Schema(description = "操作员联系电话", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("操作员联系电话")
private String operatorTelphone;
@Schema(description = "支付订单号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("支付订单号")
private String outTradeNo;
@Schema(description = "车牌颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车牌颜色")
private String plateColor;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,89 @@
package cn.iocoder.yudao.module.parking.controller.admin.chargeinfo.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 收费信息新增/修改 Request VO")
@Data
public class ChargeInfoSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28728")
private Long id;
@Schema(description = "场库编号")
private String parkNumber;
@Schema(description = "车牌号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "车牌号不能为空")
private String plate;
@Schema(description = "入场时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "入场时间不能为空")
private String inTime;
@Schema(description = "结算时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "结算时间不能为空")
private String outTime;
@Schema(description = "入场通道")
private String inChannel;
@Schema(description = "出场通道")
private String outChannel;
@Schema(description = "支付类型", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "支付类型不能为空")
private String payKind;
@Schema(description = "支付渠道", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "支付渠道不能为空")
private String payChannel;
@Schema(description = "入场订单号", example = "16414")
private String orderId;
@Schema(description = "车辆类型", example = "1")
private String carType;
@Schema(description = "支付订单号")
private String payNo;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
@NotEmpty(message = "备注不能为空")
private String memo;
@Schema(description = "应缴金额", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "应缴金额不能为空")
private String charge;
@Schema(description = "实收金额", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "实收金额不能为空")
private String realCharge;
@Schema(description = "优惠金额", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "优惠金额不能为空")
private String couponCharge;
@Schema(description = "区域 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19866")
@NotEmpty(message = "区域 ID不能为空")
private String areaId;
@Schema(description = "操作员名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotEmpty(message = "操作员名称不能为空")
private String operatorName;
@Schema(description = "操作员联系电话", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "操作员联系电话不能为空")
private String operatorTelphone;
@Schema(description = "支付订单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "支付订单号不能为空")
private String outTradeNo;
@Schema(description = "车牌颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "车牌颜色不能为空")
private String plateColor;
}

View File

@ -48,4 +48,9 @@ public class CarInfoDO extends BaseDO {
*/ */
private Integer confidence; private Integer confidence;
public CarInfoDO(String plate, String plateColor, String carType) {
this.plate = plate;
this.plateColor = plateColor;
this.carType = carType;
}
} }

View File

@ -0,0 +1,108 @@
package cn.iocoder.yudao.module.parking.dal.dataobject.chargeinfo;
import lombok.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 收费信息 DO
*
* @author 芋道源码
*/
@TableName("charge_info")
@KeySequence("charge_info_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ChargeInfoDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 场库编号
*/
private String parkNumber;
/**
* 车牌号
*/
private String plate;
/**
* 入场时间
*/
private String inTime;
/**
* 结算时间
*/
private String outTime;
/**
* 入场通道
*/
private String inChannel;
/**
* 出场通道
*/
private String outChannel;
/**
* 支付类型
*/
private String payKind;
/**
* 支付渠道
*/
private String payChannel;
/**
* 入场订单号
*/
private String orderId;
/**
* 车辆类型
*/
private String carType;
/**
* 支付订单号
*/
private String payNo;
/**
* 备注
*/
private String memo;
/**
* 应缴金额
*/
private String charge;
/**
* 实收金额
*/
private String realCharge;
/**
* 优惠金额
*/
private String couponCharge;
/**
* 区域 ID
*/
private String areaId;
/**
* 操作员名称
*/
private String operatorName;
/**
* 操作员联系电话
*/
private String operatorTelphone;
/**
* 支付订单号
*/
private String outTradeNo;
/**
* 车牌颜色
*/
private String plateColor;
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.parking.dal.mysql.chargeinfo;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.parking.dal.dataobject.chargeinfo.ChargeInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.chargeinfo.vo.*;
/**
* 收费信息 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ChargeInfoMapper extends BaseMapperX<ChargeInfoDO> {
default PageResult<ChargeInfoDO> selectPage(ChargeInfoPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ChargeInfoDO>()
.eqIfPresent(ChargeInfoDO::getParkNumber, reqVO.getParkNumber())
.eqIfPresent(ChargeInfoDO::getPlate, reqVO.getPlate())
.betweenIfPresent(ChargeInfoDO::getInTime, reqVO.getInTime())
.betweenIfPresent(ChargeInfoDO::getOutTime, reqVO.getOutTime())
.eqIfPresent(ChargeInfoDO::getInChannel, reqVO.getInChannel())
.eqIfPresent(ChargeInfoDO::getOutChannel, reqVO.getOutChannel())
.eqIfPresent(ChargeInfoDO::getPayKind, reqVO.getPayKind())
.eqIfPresent(ChargeInfoDO::getPayChannel, reqVO.getPayChannel())
.eqIfPresent(ChargeInfoDO::getOrderId, reqVO.getOrderId())
.eqIfPresent(ChargeInfoDO::getCarType, reqVO.getCarType())
.eqIfPresent(ChargeInfoDO::getPayNo, reqVO.getPayNo())
.eqIfPresent(ChargeInfoDO::getMemo, reqVO.getMemo())
.eqIfPresent(ChargeInfoDO::getCharge, reqVO.getCharge())
.eqIfPresent(ChargeInfoDO::getRealCharge, reqVO.getRealCharge())
.eqIfPresent(ChargeInfoDO::getCouponCharge, reqVO.getCouponCharge())
.eqIfPresent(ChargeInfoDO::getAreaId, reqVO.getAreaId())
.likeIfPresent(ChargeInfoDO::getOperatorName, reqVO.getOperatorName())
.eqIfPresent(ChargeInfoDO::getOperatorTelphone, reqVO.getOperatorTelphone())
.eqIfPresent(ChargeInfoDO::getOutTradeNo, reqVO.getOutTradeNo())
.eqIfPresent(ChargeInfoDO::getPlateColor, reqVO.getPlateColor())
.betweenIfPresent(ChargeInfoDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ChargeInfoDO::getId));
}
}

View File

@ -1,6 +1,10 @@
package cn.iocoder.yudao.module.parking.service.carinfo; package cn.iocoder.yudao.module.parking.service.carinfo;
import cn.iocoder.yudao.module.parking.dal.dataobject.carinfo.CarInfoDO;
import java.util.List;
/** /**
* 车辆信息 Service 接口 * 车辆信息 Service 接口
* *
@ -8,5 +12,10 @@ package cn.iocoder.yudao.module.parking.service.carinfo;
*/ */
public interface CarInfoService { public interface CarInfoService {
/**
* 批量插入或更新车牌信息
* @param carInfoDOList
* @return java.lang.Boolean
*/
Boolean insertOrUpdateBatch(List<CarInfoDO> carInfoDOList);
} }

View File

@ -1,10 +1,15 @@
package cn.iocoder.yudao.module.parking.service.carinfo; package cn.iocoder.yudao.module.parking.service.carinfo;
import cn.iocoder.yudao.module.parking.dal.dataobject.carinfo.CarInfoDO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.parking.dal.mysql.carinfo.CarInfoMapper; import cn.iocoder.yudao.module.parking.dal.mysql.carinfo.CarInfoMapper;
import java.util.List;
/** /**
* 车辆信息 Service 实现类 * 车辆信息 Service 实现类
@ -19,4 +24,8 @@ public class CarInfoServiceImpl implements CarInfoService {
private CarInfoMapper carInfoMapper; private CarInfoMapper carInfoMapper;
@Override
public Boolean insertOrUpdateBatch(List<CarInfoDO> carInfoDOList) {
return carInfoMapper.insertOrUpdateBatch(carInfoDOList);
}
} }

View File

@ -0,0 +1,60 @@
package cn.iocoder.yudao.module.parking.service.chargeinfo;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.chargeinfo.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.chargeinfo.ChargeInfoDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
/**
* 收费信息 Service 接口
*
* @author 芋道源码
*/
public interface ChargeInfoService {
/**
* 创建收费信息
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createchargeInfo(@Valid ChargeInfoSaveReqVO createReqVO);
/**
* 更新收费信息
*
* @param updateReqVO 更新信息
*/
void updatechargeInfo(@Valid ChargeInfoSaveReqVO updateReqVO);
/**
* 删除收费信息
*
* @param id 编号
*/
void deletechargeInfo(Long id);
/**
* 获得收费信息
*
* @param id 编号
* @return 收费信息
*/
ChargeInfoDO getchargeInfo(Long id);
/**
* 获得收费信息分页
*
* @param pageReqVO 分页查询
* @return 收费信息分页
*/
PageResult<ChargeInfoDO> getchargeInfoPage(ChargeInfoPageReqVO pageReqVO);
/**
* 收费信息上传
* @param chargeInformation
* @return cn.iocoder.yudao.module.parking.util.BlueCardResult
*/
BlueCardResult uploadChargeInformation(ChargeInfoReqDataVO chargeInformation);
}

View File

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.parking.service.chargeinfo;
import cn.iocoder.yudao.module.parking.dal.dataobject.carinfo.CarInfoDO;
import cn.iocoder.yudao.module.parking.service.carinfo.CarInfoService;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.parking.controller.admin.chargeinfo.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.chargeinfo.ChargeInfoDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.parking.dal.mysql.chargeinfo.ChargeInfoMapper;
import java.beans.Beans;
import java.util.ArrayList;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.parking.enums.ErrorCodeConstants.*;
/**
* 收费信息 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class ChargeInfoServiceImpl implements ChargeInfoService {
@Resource
private ChargeInfoMapper chargeInfoMapper;
@Resource
private CarInfoService carInfoService;
@Override
public Long createchargeInfo(ChargeInfoSaveReqVO createReqVO) {
// 插入
ChargeInfoDO chargeInfo = BeanUtils.toBean(createReqVO, ChargeInfoDO.class);
chargeInfoMapper.insert(chargeInfo);
// 返回
return chargeInfo.getId();
}
@Override
public void updatechargeInfo(ChargeInfoSaveReqVO updateReqVO) {
// 校验存在
validatechargeInfoExists(updateReqVO.getId());
// 更新
ChargeInfoDO updateObj = BeanUtils.toBean(updateReqVO, ChargeInfoDO.class);
chargeInfoMapper.updateById(updateObj);
}
@Override
public void deletechargeInfo(Long id) {
// 校验存在
validatechargeInfoExists(id);
// 删除
chargeInfoMapper.deleteById(id);
}
private void validatechargeInfoExists(Long id) {
if (chargeInfoMapper.selectById(id) == null) {
throw exception(CHARGE_INFO_NOT_EXISTS);
}
}
@Override
public ChargeInfoDO getchargeInfo(Long id) {
return chargeInfoMapper.selectById(id);
}
@Override
public PageResult<ChargeInfoDO> getchargeInfoPage(ChargeInfoPageReqVO pageReqVO) {
return chargeInfoMapper.selectPage(pageReqVO);
}
@Override
@Transactional
public BlueCardResult uploadChargeInformation(ChargeInfoReqDataVO chargeInformation) {
List<ChargeInfoSaveReqVO> chargeInfoSaveReqVOList = chargeInformation.getDatas();
List<CarInfoDO> carInfoDOList = new ArrayList<>();
for (ChargeInfoSaveReqVO chargeInfoSaveReqVO : chargeInfoSaveReqVOList) {
chargeInfoSaveReqVO.setParkNumber(chargeInformation.getParkNumber());
// 存入车信息数组
carInfoDOList.add(new CarInfoDO(chargeInfoSaveReqVO.getPlate(), chargeInfoSaveReqVO.getPlateColor(), chargeInfoSaveReqVO.getCarType()));
}
List<ChargeInfoDO> chargeInfoDOList = BeanUtils.toBean(chargeInfoSaveReqVOList, ChargeInfoDO.class);
// 插入收费信息
chargeInfoMapper.insertBatch(chargeInfoDOList);
// 插入对应车牌信息
carInfoService.insertOrUpdateBatch(carInfoDOList);
return BlueCardResult.success();
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.parking.dal.mysql.chargeinfo.ChargeInfoMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>