Merge branch 'dev' into dev-g

This commit is contained in:
Guoqs
2025-02-12 16:08:25 +08:00
10 changed files with 161 additions and 60 deletions

View File

@@ -253,10 +253,11 @@ public class PileStationInfoController extends BaseController {
@PreAuthorize("@ss.hasPermi('pile:station:query')")
@GetMapping("/getRelationByStationId/{stationId}")
public TableDataInfo getSettingByStationId(@PathVariable("stationId") Long id) {
List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id));
for (ThirdPartyStationRelationVO vo : list) {
vo.setThirdPartyType(ThirdPlatformTypeEnum.getTypeLabelByTypeCode(vo.getThirdPartyType()));
}
// List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id));
// for (ThirdPartyStationRelationVO vo : list) {
// vo.setThirdPartyType(ThirdPlatformTypeEnum.getTypeLabelByTypeCode(vo.getThirdPartyType()));
// }
List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoListV2(String.valueOf(id));
return getDataTable(list);
}
@@ -303,38 +304,38 @@ public class PileStationInfoController extends BaseController {
* @param dto
* @return
*/
@PostMapping("/pushStationInfo")
public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
logger.info("推送第三方平台充电站信息 params:{}", JSON.toJSONString(dto));
RestApiResponse<?> response = null;
Long stationId = dto.getStationId();
List<String> types = dto.getThirdPartyTypes();
// 先查到该站点推送过的类型
List<ThirdPartyStationRelationVO> infoList = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(stationId));
List<String> typeList = infoList.stream()
.map(ThirdPartyStationRelationVO::getThirdPartyType)
.collect(Collectors.toList());
// 对types去重可获取到需要新推送的第三方平台类型
types.removeAll(typeList);
dto.setThirdPartyTypes(types);
try {
if (StringUtils.isBlank(String.valueOf(stationId))) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
String result = commonService.commonPushStation(dto);
response = new RestApiResponse<>(result);
} catch (BusinessException e) {
logger.error("推送第三方平台充电站信息 error", e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
} catch (Exception e) {
logger.error("推送第三方平台充电站信息 error", e);
response = new RestApiResponse<>("推送失败,请联系管理员");
// 有报错,所有的都必须删除
thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(stationId), types);
}
logger.info("推送第三方平台充电站信息 result:{}", response);
return response;
}
// @PostMapping("/pushStationInfo")
// public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
// logger.info("推送第三方平台充电站信息 params:{}", JSON.toJSONString(dto));
// RestApiResponse<?> response = null;
// Long stationId = dto.getStationId();
// List<String> types = dto.getThirdPartyTypes();
// // 先查到该站点推送过的类型
// List<ThirdPartyStationRelationVO> infoList = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(stationId));
// List<String> typeList = infoList.stream()
// .map(ThirdPartyStationRelationVO::getThirdPartyType)
// .collect(Collectors.toList());
// // 对types去重可获取到需要新推送的第三方平台类型
// types.removeAll(typeList);
// dto.setThirdPartyTypes(types);
// try {
// if (StringUtils.isBlank(String.valueOf(stationId))) {
// throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
// }
// String result = commonService.commonPushStation(dto);
// response = new RestApiResponse<>(result);
// } catch (BusinessException e) {
// logger.error("推送第三方平台充电站信息 error", e);
// response = new RestApiResponse<>(e.getCode(), e.getMessage());
// } catch (Exception e) {
// logger.error("推送第三方平台充电站信息 error", e);
// response = new RestApiResponse<>("推送失败,请联系管理员");
// // 有报错,所有的都必须删除
// thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(stationId), types);
// }
// logger.info("推送第三方平台充电站信息 result:{}", response);
// return response;
// }
/**
* 绑定停车平台(停车充电下发优惠券)