停车场-迁移写入出场记录
This commit is contained in:
parent
91c7e2f15c
commit
9ec2f804f8
@ -1,4 +1,5 @@
|
|||||||
package cn.iocoder.yudao.module.parking.controller.admin.appearancerecord;
|
package cn.iocoder.yudao.module.parking.controller.admin.appearancerecord;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
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.AppearanceRecordPageReqVO;
|
||||||
import cn.iocoder.yudao.module.parking.controller.admin.appearancerecord.vo.AppearanceRecordRespVO;
|
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.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.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.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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -22,6 +32,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
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 {
|
public class AppearanceRecordController {
|
||||||
|
|
||||||
@Autowired
|
@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")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建出场记录")
|
@Operation(summary = "创建出场记录")
|
||||||
@PreAuthorize("@ss.hasPermission('appearance:record:create')")
|
@PreAuthorize("@ss.hasPermission('appearance:record:create')")
|
||||||
public CommonResult<Long> createRecord(@Valid @RequestBody AppearanceRecordSaveReqVO createReqVO) {
|
public CommonResult<Long> createRecord(@Valid @RequestBody AppearanceRecordSaveReqVO createReqVO) {
|
||||||
return success(recordService.createRecord(createReqVO));
|
return success(appearanceRecordService.createRecord(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新出场记录")
|
@Operation(summary = "更新出场记录")
|
||||||
@PreAuthorize("@ss.hasPermission('appearance:record:update')")
|
@PreAuthorize("@ss.hasPermission('appearance:record:update')")
|
||||||
public CommonResult<Boolean> updateRecord(@Valid @RequestBody AppearanceRecordSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateRecord(@Valid @RequestBody AppearanceRecordSaveReqVO updateReqVO) {
|
||||||
recordService.updateRecord(updateReqVO);
|
appearanceRecordService.updateRecord(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +98,7 @@ public class AppearanceRecordController {
|
|||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
@PreAuthorize("@ss.hasPermission('appearance:record:delete')")
|
@PreAuthorize("@ss.hasPermission('appearance:record:delete')")
|
||||||
public CommonResult<Boolean> deleteRecord(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> deleteRecord(@RequestParam("id") Long id) {
|
||||||
recordService.deleteRecord(id);
|
appearanceRecordService.deleteRecord(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +107,7 @@ public class AppearanceRecordController {
|
|||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('appearance:record:query')")
|
@PreAuthorize("@ss.hasPermission('appearance:record:query')")
|
||||||
public CommonResult<AppearanceRecordRespVO> getRecord(@RequestParam("id") Long id) {
|
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));
|
return success(BeanUtils.toBean(record, AppearanceRecordRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +115,7 @@ public class AppearanceRecordController {
|
|||||||
@Operation(summary = "获得出场记录分页")
|
@Operation(summary = "获得出场记录分页")
|
||||||
@PreAuthorize("@ss.hasPermission('appearance:record:query')")
|
@PreAuthorize("@ss.hasPermission('appearance:record:query')")
|
||||||
public CommonResult<PageResult<AppearanceRecordRespVO>> getRecordPage(@Valid AppearanceRecordPageReqVO pageReqVO) {
|
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));
|
return success(BeanUtils.toBean(pageResult, AppearanceRecordRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +126,7 @@ public class AppearanceRecordController {
|
|||||||
public void exportRecordExcel(@Valid AppearanceRecordPageReqVO pageReqVO,
|
public void exportRecordExcel(@Valid AppearanceRecordPageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
List<AppearanceRecordDO> list = recordService.getRecordPage(pageReqVO).getList();
|
List<AppearanceRecordDO> list = appearanceRecordService.getRecordPage(pageReqVO).getList();
|
||||||
// 导出 Excel
|
// 导出 Excel
|
||||||
ExcelUtils.write(response, "出场记录.xls", "数据", AppearanceRecordRespVO.class,
|
ExcelUtils.write(response, "出场记录.xls", "数据", AppearanceRecordRespVO.class,
|
||||||
BeanUtils.toBean(list, AppearanceRecordRespVO.class));
|
BeanUtils.toBean(list, AppearanceRecordRespVO.class));
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.parking.dal.dataobject.revenue;
|
package cn.iocoder.yudao.module.parking.dal.dataobject.revenue;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
@ -59,4 +59,11 @@ public interface AccessRecordPictureService {
|
|||||||
* @return cn.iocoder.yudao.module.parking.util.BlueCardResult
|
* @return cn.iocoder.yudao.module.parking.util.BlueCardResult
|
||||||
*/
|
*/
|
||||||
BlueCardResult uploadAccessRecordPicture(AccessRecordPictureDO accessRecordPicture);
|
BlueCardResult uploadAccessRecordPicture(AccessRecordPictureDO accessRecordPicture);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过图片名称查找上传记录
|
||||||
|
* @param inImage
|
||||||
|
* @return cn.iocoder.yudao.module.parking.dal.dataobject.accessrecordpicture.AccessRecordPictureDO
|
||||||
|
*/
|
||||||
|
AccessRecordPictureDO findByImageName(String inImage);
|
||||||
}
|
}
|
@ -86,4 +86,9 @@ public class AccessRecordPictureServiceImpl implements AccessRecordPictureServic
|
|||||||
return BlueCardResult.success();
|
return BlueCardResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccessRecordPictureDO findByImageName(String inImage) {
|
||||||
|
return accessRecordPictureMapper.selectOne(AccessRecordPictureDO::getImageName, inImage);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user