From 9ec2f804f8b9c911e75ec2d5c9268d95825fd789 Mon Sep 17 00:00:00 2001 From: XinWei <2718030729@qq.com> Date: Wed, 31 Jul 2024 10:56:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=9C=BA-=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E5=86=99=E5=85=A5=E5=87=BA=E5=9C=BA=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppearanceRecordController.java | 59 ++++++++++++++++--- .../dal/dataobject/revenue/RevenueDO.java | 3 - .../AccessRecordPictureService.java | 7 +++ .../AccessRecordPictureServiceImpl.java | 5 ++ 4 files changed, 62 insertions(+), 12 deletions(-) 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