新增 绑定停车平台接口

This commit is contained in:
Lemon
2023-08-25 14:23:35 +08:00
parent 454022c553
commit 9c3c80ca3f
12 changed files with 406 additions and 159 deletions

View File

@@ -0,0 +1,16 @@
package com.jsowell.pile.dto.lutongyunting;
import lombok.Data;
/**
* 绑定停车平台DTO
*
* @author Lemon
* @Date 2023/8/25 13:34
*/
@Data
public class BindParkingPlatformDTO {
private String stationId;
private String parkingId;
}

View File

@@ -88,4 +88,10 @@ public interface PileStationInfoMapper {
* @return
*/
List<String> getIdsByDeptId(String deptId);
/**
* 修改绑定停车平台
* @param stationId
*/
int updateParkingPlatform(@Param("parkingId") String parkingId, @Param("stationId") String stationId);
}

View File

@@ -1,6 +1,8 @@
package com.jsowell.pile.mapper;
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
import org.springframework.stereotype.Repository;
/**
* TODO
@@ -8,6 +10,7 @@ import com.jsowell.pile.domain.ThirdpartyParkingConfig;
* @Date 2023/8/24 16:50
* @author Lemon
*/
@Repository
public interface ThirdpartyParkingConfigMapper {
/**
* delete by primary key

View File

@@ -4,6 +4,7 @@ import com.jsowell.common.core.page.PageResponse;
import com.jsowell.pile.domain.PileStationInfo;
import com.jsowell.pile.dto.FastCreateStationDTO;
import com.jsowell.pile.dto.QueryStationDTO;
import com.jsowell.pile.dto.lutongyunting.BindParkingPlatformDTO;
import com.jsowell.pile.vo.web.PileStationVO;
import java.util.List;
@@ -105,4 +106,10 @@ public interface IPileStationInfoService {
* @return
*/
List<String> getIdsByDeptId(String deptId);
/**
* 绑定停车系统平台
* @param dto
*/
int bindParkingPlatform(BindParkingPlatformDTO dto);
}

View File

@@ -0,0 +1,53 @@
package com.jsowell.pile.service;
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
/**
* 第三方停车平台Service
*
* @author Lemon
* @Date 2023/8/25 13:42
*/
public interface IThirdPartyParkingConfigService {
/**
* delete by primary key
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(Integer id);
/**
* insert record to table
* @param record the record
* @return insert count
*/
int insert(ThirdpartyParkingConfig record);
/**
* insert record to table selective
* @param record the record
* @return insert count
*/
int insertSelective(ThirdpartyParkingConfig record);
/**
* select by primary key
* @param id primary key
* @return object by primary key
*/
ThirdpartyParkingConfig selectByPrimaryKey(Integer id);
/**
* update record selective
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(ThirdpartyParkingConfig record);
/**
* update record
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(ThirdpartyParkingConfig record);
}

View File

@@ -9,6 +9,8 @@ import com.jsowell.common.core.domain.entity.SysUser;
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
import com.jsowell.common.core.page.PageResponse;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.DistanceUtils;
import com.jsowell.common.util.SecurityUtils;
@@ -16,8 +18,11 @@ import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.ip.AddressUtils;
import com.jsowell.pile.domain.PileBasicInfo;
import com.jsowell.pile.domain.PileStationInfo;
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
import com.jsowell.pile.dto.FastCreateStationDTO;
import com.jsowell.pile.dto.QueryStationDTO;
import com.jsowell.pile.dto.lutongyunting.BindParkingPlatformDTO;
import com.jsowell.pile.mapper.PileStationInfoMapper;
import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.base.MerchantInfoVO;
@@ -73,6 +78,8 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
@Autowired
private SysUserService userService;
@Autowired
private IThirdPartyParkingConfigService parkingConfigService;
/**
@@ -486,5 +493,25 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
return pileStationInfoMapper.getIdsByDeptId(deptId);
}
/**
* 绑定停车系统平台
* @param dto
*/
@Override
public int bindParkingPlatform(BindParkingPlatformDTO dto) {
String parkingId = dto.getParkingId();
String stationId = dto.getStationId();
// 先根据停车系统平台查询一下是否有数据
ThirdpartyParkingConfig basicInfo = parkingConfigService.selectByPrimaryKey(Integer.parseInt(parkingId));
if (basicInfo == null) {
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_PARKING_INFO_IS_NULL);
}
// 先删除缓存
String redisKey = CacheConstants.SELECT_PILE_STATION_INFO_BY_ID + stationId;
redisCache.deleteObject(redisKey);
// 再将站点信息表中绑定上parkingId
return pileStationInfoMapper.updateParkingPlatform(parkingId, stationId);
}
}

View File

@@ -0,0 +1,52 @@
package com.jsowell.pile.service.impl;
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
import com.jsowell.pile.mapper.ThirdpartyParkingConfigMapper;
import com.jsowell.pile.service.IThirdPartyParkingConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* TODO
*
* @author Lemon
* @Date 2023/8/25 13:43
*/
@Service
public class ThirdPartyParkingConfigServiceImpl implements IThirdPartyParkingConfigService {
@Autowired
private ThirdpartyParkingConfigMapper thirdpartyParkingConfigMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return thirdpartyParkingConfigMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(ThirdpartyParkingConfig record) {
return thirdpartyParkingConfigMapper.insert(record);
}
@Override
public int insertSelective(ThirdpartyParkingConfig record) {
return thirdpartyParkingConfigMapper.insertSelective(record);
}
@Override
public ThirdpartyParkingConfig selectByPrimaryKey(Integer id) {
return thirdpartyParkingConfigMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(ThirdpartyParkingConfig record) {
return thirdpartyParkingConfigMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(ThirdpartyParkingConfig record) {
return thirdpartyParkingConfigMapper.updateByPrimaryKey(record);
}
}