diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/appearancerecord/AppearanceRecordController.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/appearancerecord/AppearanceRecordController.java index bdd7a93d8..085cc518d 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/appearancerecord/AppearanceRecordController.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/appearancerecord/AppearanceRecordController.java @@ -1,4 +1,5 @@ package cn.iocoder.yudao.module.parking.controller.admin.appearancerecord; + import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageParam; @@ -8,8 +9,17 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.module.parking.controller.admin.appearancerecord.vo.AppearanceRecordPageReqVO; import cn.iocoder.yudao.module.parking.controller.admin.appearancerecord.vo.AppearanceRecordRespVO; import cn.iocoder.yudao.module.parking.controller.admin.appearancerecord.vo.AppearanceRecordSaveReqVO; +import cn.iocoder.yudao.module.parking.controller.admin.revenue.vo.RevenueSaveReqVO; +import cn.iocoder.yudao.module.parking.controller.admin.vehiclerecord.vo.VehicleRecordSaveReqVO; +import cn.iocoder.yudao.module.parking.dal.dataobject.accessrecordpicture.AccessRecordPictureDO; import cn.iocoder.yudao.module.parking.dal.dataobject.appearancerecord.AppearanceRecordDO; +import cn.iocoder.yudao.module.parking.dal.dataobject.revenue.RevenueDO; +import cn.iocoder.yudao.module.parking.dal.dataobject.vehiclerecord.VehicleRecordDO; +import cn.iocoder.yudao.module.parking.service.accessrecordpicture.AccessRecordPictureService; import cn.iocoder.yudao.module.parking.service.appearancerecord.AppearanceRecordService; +import cn.iocoder.yudao.module.parking.service.revenue.RevenueService; +import cn.iocoder.yudao.module.parking.service.vehiclerecord.VehicleRecordService; +import cn.iocoder.yudao.module.parking.util.BlueCardResult; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; @@ -22,6 +32,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; +import java.time.LocalDateTime; import java.util.List; import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; @@ -35,20 +46,50 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; public class AppearanceRecordController { @Autowired - private AppearanceRecordService recordService; + private AppearanceRecordService appearanceRecordService; + @Resource + private AccessRecordPictureService accessRecordPictureService; + @Resource + private VehicleRecordService vehicleRecordService; + @Resource + private RevenueService revenueService; + + @PostMapping("/insertAppearanceRecord") + @Operation(summary = "写入出场记录") + public BlueCardResult insertAppearanceRecord(@RequestBody AppearanceRecordSaveReqVO appearanceRecord) { + AccessRecordPictureDO imageData = accessRecordPictureService.findByImageName(appearanceRecord.getInImage());//入场图片数据 + VehicleRecordSaveReqVO vehicleRecord = new VehicleRecordSaveReqVO(); + vehicleRecord.setIntoOrOut("出"); + vehicleRecord.setPicture(imageData.getImgAddress()); + vehicleRecord.setTime(appearanceRecord.getOutTime()); + vehicleRecord.setLicenseNumber(appearanceRecord.getPlate()); + vehicleRecordService.createVehicleRecord(vehicleRecord); + + RevenueSaveReqVO revenue = new RevenueSaveReqVO(); + revenue.setAreaName(appearanceRecord.getAreaName()); + revenue.setGetTime(appearanceRecord.getGetTime()); + revenue.setMemo(appearanceRecord.getMemo()); + revenue.setPayCharge(appearanceRecord.getPayCharge()); + revenue.setPayKind(appearanceRecord.getPayKind()); + revenue.setPlate(appearanceRecord.getPlate()); + revenueService.createRevenue(revenue); + + appearanceRecordService.createRecord(appearanceRecord); + return BlueCardResult.success(); + } @PostMapping("/create") @Operation(summary = "创建出场记录") @PreAuthorize("@ss.hasPermission('appearance:record:create')") public CommonResult createRecord(@Valid @RequestBody AppearanceRecordSaveReqVO createReqVO) { - return success(recordService.createRecord(createReqVO)); + return success(appearanceRecordService.createRecord(createReqVO)); } @PutMapping("/update") @Operation(summary = "更新出场记录") @PreAuthorize("@ss.hasPermission('appearance:record:update')") public CommonResult updateRecord(@Valid @RequestBody AppearanceRecordSaveReqVO updateReqVO) { - recordService.updateRecord(updateReqVO); + appearanceRecordService.updateRecord(updateReqVO); return success(true); } @@ -57,7 +98,7 @@ public class AppearanceRecordController { @Parameter(name = "id", description = "编号", required = true) @PreAuthorize("@ss.hasPermission('appearance:record:delete')") public CommonResult deleteRecord(@RequestParam("id") Long id) { - recordService.deleteRecord(id); + appearanceRecordService.deleteRecord(id); return success(true); } @@ -66,7 +107,7 @@ public class AppearanceRecordController { @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('appearance:record:query')") public CommonResult getRecord(@RequestParam("id") Long id) { - AppearanceRecordDO record = recordService.getRecord(id); + AppearanceRecordDO record = appearanceRecordService.getRecord(id); return success(BeanUtils.toBean(record, AppearanceRecordRespVO.class)); } @@ -74,7 +115,7 @@ public class AppearanceRecordController { @Operation(summary = "获得出场记录分页") @PreAuthorize("@ss.hasPermission('appearance:record:query')") public CommonResult> getRecordPage(@Valid AppearanceRecordPageReqVO pageReqVO) { - PageResult pageResult = recordService.getRecordPage(pageReqVO); + PageResult pageResult = appearanceRecordService.getRecordPage(pageReqVO); return success(BeanUtils.toBean(pageResult, AppearanceRecordRespVO.class)); } @@ -83,12 +124,12 @@ public class AppearanceRecordController { @PreAuthorize("@ss.hasPermission('appearance:record:export')") @ApiAccessLog(operateType = EXPORT) public void exportRecordExcel(@Valid AppearanceRecordPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { + HttpServletResponse response) throws IOException { pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = recordService.getRecordPage(pageReqVO).getList(); + List list = appearanceRecordService.getRecordPage(pageReqVO).getList(); // 导出 Excel ExcelUtils.write(response, "出场记录.xls", "数据", AppearanceRecordRespVO.class, - BeanUtils.toBean(list, AppearanceRecordRespVO.class)); + BeanUtils.toBean(list, AppearanceRecordRespVO.class)); } } \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/revenue/RevenueDO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/revenue/RevenueDO.java index d78dd3f4c..e583724db 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/revenue/RevenueDO.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/revenue/RevenueDO.java @@ -1,9 +1,6 @@ package cn.iocoder.yudao.module.parking.dal.dataobject.revenue; import lombok.*; -import java.util.*; -import java.time.LocalDateTime; -import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/accessrecordpicture/AccessRecordPictureService.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/accessrecordpicture/AccessRecordPictureService.java index 1a31869ee..ffb27ed3c 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/accessrecordpicture/AccessRecordPictureService.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/accessrecordpicture/AccessRecordPictureService.java @@ -59,4 +59,11 @@ public interface AccessRecordPictureService { * @return cn.iocoder.yudao.module.parking.util.BlueCardResult */ BlueCardResult uploadAccessRecordPicture(AccessRecordPictureDO accessRecordPicture); + + /** + * 通过图片名称查找上传记录 + * @param inImage + * @return cn.iocoder.yudao.module.parking.dal.dataobject.accessrecordpicture.AccessRecordPictureDO + */ + AccessRecordPictureDO findByImageName(String inImage); } \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/accessrecordpicture/AccessRecordPictureServiceImpl.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/accessrecordpicture/AccessRecordPictureServiceImpl.java index 4d2cd2807..6e239c5ab 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/accessrecordpicture/AccessRecordPictureServiceImpl.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/accessrecordpicture/AccessRecordPictureServiceImpl.java @@ -86,4 +86,9 @@ public class AccessRecordPictureServiceImpl implements AccessRecordPictureServic return BlueCardResult.success(); } + @Override + public AccessRecordPictureDO findByImageName(String inImage) { + return accessRecordPictureMapper.selectOne(AccessRecordPictureDO::getImageName, inImage); + } + } \ No newline at end of file