mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-17 20:49:17 +08:00
页面配置停车平台信息
This commit is contained in:
@@ -32,6 +32,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -422,6 +423,82 @@ public class PileStationInfoController extends BaseController {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存停车平台配置
|
||||
*
|
||||
* @param config 停车平台配置
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/saveParkingConfig")
|
||||
public RestApiResponse<?> saveParkingConfig(@RequestBody ThirdpartyParkingConfig config) {
|
||||
logger.info("保存停车平台配置 params:{}", JSON.toJSONString(config));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
if (config == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
if (StringUtils.isBlank(config.getParkingName())
|
||||
|| StringUtils.isBlank(config.getPlatformType())
|
||||
|| StringUtils.isBlank(config.getSecretKey())
|
||||
|| StringUtils.isBlank(config.getParkId())
|
||||
|| StringUtils.isBlank(config.getApiUrl())) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
if ("4".equals(config.getPlatformType()) && StringUtils.isBlank(config.getAppId())) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
if (config.getId() == null) {
|
||||
config.setCreateTime(now);
|
||||
config.setCreateBy(getUsername());
|
||||
if (StringUtils.isBlank(config.getDelFlag())) {
|
||||
config.setDelFlag("0");
|
||||
}
|
||||
parkingConfigService.insertSelective(config);
|
||||
} else {
|
||||
config.setUpdateTime(now);
|
||||
config.setUpdateBy(getUsername());
|
||||
parkingConfigService.updateByPrimaryKeySelective(config);
|
||||
}
|
||||
response = new RestApiResponse<>(config);
|
||||
} catch (BusinessException e) {
|
||||
logger.error("保存停车平台配置 error,", e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("保存停车平台配置 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("保存停车平台配置 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据站点获取已绑定停车平台配置
|
||||
*
|
||||
* @param stationId 站点ID
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getParkingConfigByStationId/{stationId}")
|
||||
public RestApiResponse<?> getParkingConfigByStationId(@PathVariable("stationId") String stationId) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
if (StringUtils.isBlank(stationId)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
ThirdpartyParkingConfig config = parkingConfigService.selectByStationId(stationId);
|
||||
response = new RestApiResponse<>(config);
|
||||
} catch (BusinessException e) {
|
||||
logger.error("根据站点获取停车平台配置 error,", e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("根据站点获取停车平台配置 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("根据站点获取停车平台配置 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public AjaxResult checkStationAmap
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
#{updateBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
|
||||
<insert id="insertSelective" parameterType="com.jsowell.pile.domain.ThirdpartyParkingConfig">
|
||||
<insert id="insertSelective" parameterType="com.jsowell.pile.domain.ThirdpartyParkingConfig" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
<!--@mbg.generated-->
|
||||
insert into thirdparty_parking_config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
Reference in New Issue
Block a user