xinwei #3

Merged
root merged 30 commits from xinwei into master 2024-08-15 09:53:30 +08:00
4 changed files with 62 additions and 12 deletions
Showing only changes of commit 9ec2f804f8 - Show all commits

View File

@ -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<Long> 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<Boolean> 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<Boolean> 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<AppearanceRecordRespVO> 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<PageResult<AppearanceRecordRespVO>> getRecordPage(@Valid AppearanceRecordPageReqVO pageReqVO) {
PageResult<AppearanceRecordDO> pageResult = recordService.getRecordPage(pageReqVO);
PageResult<AppearanceRecordDO> 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<AppearanceRecordDO> list = recordService.getRecordPage(pageReqVO).getList();
List<AppearanceRecordDO> list = appearanceRecordService.getRecordPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "出场记录.xls", "数据", AppearanceRecordRespVO.class,
BeanUtils.toBean(list, AppearanceRecordRespVO.class));
BeanUtils.toBean(list, AppearanceRecordRespVO.class));
}
}

View File

@ -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;

View File

@ -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);
}

View File

@ -86,4 +86,9 @@ public class AccessRecordPictureServiceImpl implements AccessRecordPictureServic
return BlueCardResult.success();
}
@Override
public AccessRecordPictureDO findByImageName(String inImage) {
return accessRecordPictureMapper.selectOne(AccessRecordPictureDO::getImageName, inImage);
}
}