xinwei #4
@ -57,7 +57,7 @@ public class AreaController {
|
|||||||
@Operation(summary = "删除区域列表")
|
@Operation(summary = "删除区域列表")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
@PreAuthorize("@ss.hasPermission('parking:area:delete')")
|
@PreAuthorize("@ss.hasPermission('parking:area:delete')")
|
||||||
public CommonResult<Boolean> deleteArea(@RequestParam("id") Integer id) {
|
public CommonResult<Boolean> deleteArea(@RequestParam("id") Long id) {
|
||||||
areaService.deleteArea(id);
|
areaService.deleteArea(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ public class AreaController {
|
|||||||
@Operation(summary = "获得区域列表")
|
@Operation(summary = "获得区域列表")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('parking:area:query')")
|
@PreAuthorize("@ss.hasPermission('parking:area:query')")
|
||||||
public CommonResult<AreaRespVO> getArea(@RequestParam("id") Integer id) {
|
public CommonResult<AreaRespVO> getArea(@RequestParam("id") Long id) {
|
||||||
AreaDO area = areaService.getArea(id);
|
AreaDO area = areaService.getArea(id);
|
||||||
return success(BeanUtils.toBean(area, AreaRespVO.class));
|
return success(BeanUtils.toBean(area, AreaRespVO.class));
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class AreaPageReqVO extends PageParam {
|
public class AreaPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "区域Id", example = "27272")
|
||||||
|
private Integer areaId;
|
||||||
|
|
||||||
@Schema(description = "场库编号")
|
@Schema(description = "场库编号")
|
||||||
private String parkNumber;
|
private String parkNumber;
|
||||||
|
|
||||||
|
@ -6,8 +6,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.module.parking.dal.dataobject.area.AreaDO;
|
import cn.iocoder.yudao.module.parking.dal.dataobject.area.AreaDO;
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.*;
|
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.*;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域列表 Mapper
|
* 区域列表 Mapper
|
||||||
@ -26,7 +28,9 @@ public interface AreaMapper extends BaseMapperX<AreaDO> {
|
|||||||
.eqIfPresent(AreaDO::getBookSpaceCount, reqVO.getBookSpaceCount())
|
.eqIfPresent(AreaDO::getBookSpaceCount, reqVO.getBookSpaceCount())
|
||||||
.eqIfPresent(AreaDO::getBookInParkCount, reqVO.getBookInParkCount())
|
.eqIfPresent(AreaDO::getBookInParkCount, reqVO.getBookInParkCount())
|
||||||
.betweenIfPresent(AreaDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(AreaDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.orderByDesc(AreaDO::getAreaId));
|
.eqIfPresent(AreaDO::getAreaId, reqVO.getAreaId())
|
||||||
|
.orderByDesc(AreaDO::getId));
|
||||||
}
|
}
|
||||||
|
@Delete("DELETE FROM `area` WHERE `park_number` = #{parkNumber}")
|
||||||
|
int physicalDeleteByParkNumber(@Param("parkNumber") String parkNumber);
|
||||||
}
|
}
|
@ -41,7 +41,7 @@ public interface AreaService {
|
|||||||
*
|
*
|
||||||
* @param id 编号
|
* @param id 编号
|
||||||
*/
|
*/
|
||||||
void deleteArea(Integer id);
|
void deleteArea(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得区域列表
|
* 获得区域列表
|
||||||
@ -49,7 +49,7 @@ public interface AreaService {
|
|||||||
* @param id 编号
|
* @param id 编号
|
||||||
* @return 区域列表
|
* @return 区域列表
|
||||||
*/
|
*/
|
||||||
AreaDO getArea(Integer id);
|
AreaDO getArea(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得区域列表分页
|
* 获得区域列表分页
|
||||||
@ -59,10 +59,11 @@ public interface AreaService {
|
|||||||
*/
|
*/
|
||||||
PageResult<AreaDO> getAreaPage(AreaPageReqVO pageReqVO);
|
PageResult<AreaDO> getAreaPage(AreaPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建或更新区域(批量)
|
* 根据场库编号创建或更新区域(批量)
|
||||||
* @param areaList
|
* @param areaList
|
||||||
* @return java.lang.Boolean
|
* @return java.lang.Boolean
|
||||||
*/
|
*/
|
||||||
Boolean createOrUpdateAreaBatch(ArrayList<AreaSaveReqVO> areaList);
|
Boolean updateAreaBatchByParkNumber(ArrayList<AreaSaveReqVO> areaList);
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.parking.service.area;
|
package cn.iocoder.yudao.module.parking.service.area;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
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;
|
||||||
@ -48,28 +49,28 @@ public class AreaServiceImpl implements AreaService {
|
|||||||
@Override
|
@Override
|
||||||
public void updateArea(AreaSaveReqVO updateReqVO) {
|
public void updateArea(AreaSaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateAreaExists(updateReqVO.getAreaId());
|
validateAreaExists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
AreaDO updateObj = BeanUtils.toBean(updateReqVO, AreaDO.class);
|
AreaDO updateObj = BeanUtils.toBean(updateReqVO, AreaDO.class);
|
||||||
areaMapper.updateById(updateObj);
|
areaMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteArea(Integer id) {
|
public void deleteArea(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateAreaExists(id);
|
validateAreaExists(id);
|
||||||
// 删除
|
// 删除
|
||||||
areaMapper.deleteById(id);
|
areaMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateAreaExists(Integer id) {
|
private void validateAreaExists(Long id) {
|
||||||
if (areaMapper.selectById(id) == null) {
|
if (areaMapper.selectById(id) == null) {
|
||||||
throw exception(AREA_NOT_EXISTS);
|
throw exception(AREA_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AreaDO getArea(Integer id) {
|
public AreaDO getArea(Long id) {
|
||||||
return areaMapper.selectById(id);
|
return areaMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,8 +80,15 @@ public class AreaServiceImpl implements AreaService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean createOrUpdateAreaBatch(ArrayList<AreaSaveReqVO> areaList) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
return areaMapper.insertOrUpdateBatch(BeanUtils.toBean(areaList, AreaDO.class));
|
public Boolean updateAreaBatchByParkNumber(ArrayList<AreaSaveReqVO> areaList) {
|
||||||
|
if (areaList == null || areaList.isEmpty()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
areaMapper.physicalDeleteByParkNumber(areaList.get(0).getParkNumber());
|
||||||
|
areaMapper.insertBatch(BeanUtils.toBean(areaList, AreaDO.class));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -85,7 +85,7 @@ public class HeartbeatServiceImpl implements HeartbeatService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public BlueCardResult doHeartbeat(HeartbeatReqDataVO blueCardHeartbeat) {
|
public BlueCardResult doHeartbeat(HeartbeatReqDataVO blueCardHeartbeat) {
|
||||||
try {
|
try {
|
||||||
ArrayList<AreaSaveReqVO> areaList = blueCardHeartbeat.getAreaList();
|
ArrayList<AreaSaveReqVO> areaList = blueCardHeartbeat.getAreaList();
|
||||||
@ -104,9 +104,8 @@ public class HeartbeatServiceImpl implements HeartbeatService {
|
|||||||
if (!areaList.isEmpty()){
|
if (!areaList.isEmpty()){
|
||||||
// 对区域都添加停车场库编号
|
// 对区域都添加停车场库编号
|
||||||
areaList.forEach(item -> item.setParkNumber(blueCardHeartbeat.getParkNumber()));
|
areaList.forEach(item -> item.setParkNumber(blueCardHeartbeat.getParkNumber()));
|
||||||
// 写入区域信息
|
// 更新区域信息
|
||||||
// TODO 判断重复及处理方式
|
areaService.updateAreaBatchByParkNumber(areaList);
|
||||||
areaService.createOrUpdateAreaBatch(areaList);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 手动设置回滚
|
// 手动设置回滚
|
||||||
|
Loading…
Reference in New Issue
Block a user