mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
停车平台, 停车优惠
This commit is contained in:
@@ -14,7 +14,6 @@ import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.poi.ExcelUtil;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.domain.ThirdPartySettingInfo;
|
||||
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
|
||||
import com.jsowell.pile.dto.FastCreateStationDTO;
|
||||
import com.jsowell.pile.dto.PushStationInfoDTO;
|
||||
@@ -48,74 +47,74 @@ import java.util.stream.Collectors;
|
||||
@RestController
|
||||
@RequestMapping("/pile/station")
|
||||
public class PileStationInfoController extends BaseController {
|
||||
@Autowired
|
||||
private PileStationInfoService pileStationInfoService;
|
||||
@Autowired
|
||||
private PileStationInfoService pileStationInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileService pileService;
|
||||
@Autowired
|
||||
private PileService pileService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartySettingInfoService thirdPartySettingInfoService;
|
||||
@Autowired
|
||||
private ThirdPartySettingInfoService thirdPartySettingInfoService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@Autowired
|
||||
private AMapService aMapService;
|
||||
@Autowired
|
||||
private AMapService aMapService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyParkingConfigService parkingConfigService;
|
||||
@Autowired
|
||||
private ThirdPartyParkingConfigService parkingConfigService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电站信息列表NEW
|
||||
*/
|
||||
/**
|
||||
* 查询充电站信息列表NEW
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(QueryStationDTO queryStationDTO) {
|
||||
startPage();
|
||||
// List<PileStationInfo> list = pileStationInfoService.selectPileStationInfoList(pileStationInfo);
|
||||
List<PileStationVO> list = pileStationInfoService.queryStationInfos(queryStationDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
startPage();
|
||||
// List<PileStationInfo> list = pileStationInfoService.selectPileStationInfoList(pileStationInfo);
|
||||
List<PileStationVO> list = pileStationInfoService.queryStationInfos(queryStationDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电站下拉列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:list')")
|
||||
@GetMapping("/StationSelectList")
|
||||
public TableDataInfo getStationSelectList(QueryStationDTO dto) {
|
||||
logger.info("dto:{}", JSON.toJSONString(dto));
|
||||
startPage();
|
||||
List<PileStationVO> list = pileStationInfoService.getStationSelectList(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 查询充电站下拉列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:list')")
|
||||
@GetMapping("/StationSelectList")
|
||||
public TableDataInfo getStationSelectList(QueryStationDTO dto) {
|
||||
logger.info("dto:{}", JSON.toJSONString(dto));
|
||||
startPage();
|
||||
List<PileStationVO> list = pileStationInfoService.getStationSelectList(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 快速建站接口
|
||||
*/
|
||||
/**
|
||||
* 快速建站接口
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:add')")
|
||||
@PostMapping("/fastCreateStation")
|
||||
public AjaxResult fastCreateStation(@RequestBody FastCreateStationDTO dto) {
|
||||
logger.info("快速建站接口 param:{}", JSON.toJSONString(dto));
|
||||
int i = 0;
|
||||
try {
|
||||
i = pileStationInfoService.fastCreateStation(dto);
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("快速建站接口 warn", e);
|
||||
} catch (Exception e) {
|
||||
logger.error("快速建站接口 error", e);
|
||||
}
|
||||
return toAjax(i);
|
||||
logger.info("快速建站接口 param:{}", JSON.toJSONString(dto));
|
||||
int i = 0;
|
||||
try {
|
||||
i = pileStationInfoService.fastCreateStation(dto);
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("快速建站接口 warn", e);
|
||||
} catch (Exception e) {
|
||||
logger.error("快速建站接口 error", e);
|
||||
}
|
||||
return toAjax(i);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电站信息列表
|
||||
*/
|
||||
/**
|
||||
* 查询充电站信息列表
|
||||
*/
|
||||
/*@PreAuthorize("@ss.hasPermi('pile:station:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(PileStationInfo pileStationInfo) {
|
||||
@@ -124,272 +123,278 @@ public class PileStationInfoController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 导出充电站信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:export')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PileStationInfo pileStationInfo) {
|
||||
List<PileStationInfo> list = pileStationInfoService.selectPileStationInfoList(pileStationInfo);
|
||||
ExcelUtil<PileStationInfo> util = new ExcelUtil<PileStationInfo>(PileStationInfo.class);
|
||||
util.exportExcel(response, list, "充电站信息数据");
|
||||
}
|
||||
/**
|
||||
* 导出充电站信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:export')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PileStationInfo pileStationInfo) {
|
||||
List<PileStationInfo> list = pileStationInfoService.selectPileStationInfoList(pileStationInfo);
|
||||
ExcelUtil<PileStationInfo> util = new ExcelUtil<PileStationInfo>(PileStationInfo.class);
|
||||
util.exportExcel(response, list, "充电站信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取充电站信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(pileStationInfoService.selectPileStationInfoById(id));
|
||||
}
|
||||
/**
|
||||
* 获取充电站信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(pileStationInfoService.selectPileStationInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 后管站点基本资料页面
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@GetMapping(value = "/getStationInfo/{stationId}")
|
||||
public AjaxResult getStationInfo(@PathVariable("stationId") String stationId) {
|
||||
return AjaxResult.success(pileStationInfoService.getStationInfo(stationId));
|
||||
}
|
||||
/**
|
||||
* 后管站点基本资料页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@GetMapping(value = "/getStationInfo/{stationId}")
|
||||
public AjaxResult getStationInfo(@PathVariable("stationId") String stationId) {
|
||||
return AjaxResult.success(pileStationInfoService.getStationInfo(stationId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:add')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody PileStationInfo pileStationInfo) {
|
||||
return toAjax(pileStationInfoService.insertPileStationInfo(pileStationInfo));
|
||||
}
|
||||
/**
|
||||
* 新增充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:add')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody PileStationInfo pileStationInfo) {
|
||||
return toAjax(pileStationInfoService.insertPileStationInfo(pileStationInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody PileStationInfo pileStationInfo) {
|
||||
logger.info("修改充电站信息 param:{}", pileStationInfo.toString());
|
||||
return toAjax(pileStationInfoService.updatePileStationInfo(pileStationInfo));
|
||||
}
|
||||
/**
|
||||
* 修改充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody PileStationInfo pileStationInfo) {
|
||||
logger.info("修改充电站信息 param:{}", pileStationInfo.toString());
|
||||
return toAjax(pileStationInfoService.updatePileStationInfo(pileStationInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改对接高德标识
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@Log(title = "修改对接高德标识", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/editAmapFlag")
|
||||
public AjaxResult editAmapFlag(@RequestBody EditAmapFlagDTO dto) {
|
||||
logger.info("修改对接高德标识 param:{}", JSON.toJSONString(dto));
|
||||
return toAjax(pileStationInfoService.updateAmapFlag(dto.getStationId(), dto.getAmapFlag()));
|
||||
}
|
||||
/**
|
||||
* 修改对接高德标识
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@Log(title = "修改对接高德标识", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/editAmapFlag")
|
||||
public AjaxResult editAmapFlag(@RequestBody EditAmapFlagDTO dto) {
|
||||
logger.info("修改对接高德标识 param:{}", JSON.toJSONString(dto));
|
||||
return toAjax(pileStationInfoService.updateAmapFlag(dto.getStationId(), dto.getAmapFlag()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 高德地图商家推送静态信息状态
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@PostMapping("/pushAMapStationStatus")
|
||||
public RestApiResponse<?> pushAMapStationStatus(EditAmapFlagDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String result = aMapService.pushStationInfo(Lists.newArrayList(dto.getStationId()), dto.getAmapFlag());
|
||||
response = new RestApiResponse<>(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("高德地图商家推送静态信息状态 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("高德地图商家推送静态信息状态 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
/**
|
||||
* 高德地图商家推送静态信息状态
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@PostMapping("/pushAMapStationStatus")
|
||||
public RestApiResponse<?> pushAMapStationStatus(EditAmapFlagDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String result = aMapService.pushStationInfo(Lists.newArrayList(dto.getStationId()), dto.getAmapFlag());
|
||||
response = new RestApiResponse<>(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("高德地图商家推送静态信息状态 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("高德地图商家推送静态信息状态 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:remove')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(pileStationInfoService.deletePileStationInfoByIds(ids));
|
||||
}
|
||||
/**
|
||||
* 删除充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:remove')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(pileStationInfoService.deletePileStationInfoByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据运营商id获取充电站列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@PostMapping(value = "/selectStationListByMerchantId")
|
||||
public AjaxResult selectStationListByMerchantId(@RequestBody QueryStationDTO dto) {
|
||||
return AjaxResult.success(pileStationInfoService.selectStationListByMerchantIdWithAuth(Long.valueOf(dto.getMerchantId())));
|
||||
}
|
||||
/**
|
||||
* 根据运营商id获取充电站列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@PostMapping(value = "/selectStationListByMerchantId")
|
||||
public AjaxResult selectStationListByMerchantId(@RequestBody QueryStationDTO dto) {
|
||||
return AjaxResult.success(pileStationInfoService.selectStationListByMerchantIdWithAuth(Long.valueOf(dto.getMerchantId())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改站点二维码前缀
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@PostMapping("/updateStationQRCodePrefix")
|
||||
public AjaxResult updateStationQRCodePrefix(@RequestBody QueryStationDTO dto) {
|
||||
// 校验入参
|
||||
if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getQrcodePrefix())) {
|
||||
return AjaxResult.error(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR.getValue());
|
||||
}
|
||||
return AjaxResult.success(pileService.updateStationQRCodePrefix(dto));
|
||||
}
|
||||
/**
|
||||
* 修改站点二维码前缀
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@PostMapping("/updateStationQRCodePrefix")
|
||||
public AjaxResult updateStationQRCodePrefix(@RequestBody QueryStationDTO dto) {
|
||||
// 校验入参
|
||||
if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getQrcodePrefix())) {
|
||||
return AjaxResult.error(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR.getValue());
|
||||
}
|
||||
return AjaxResult.success(pileService.updateStationQRCodePrefix(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点互联互通配置
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@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()));
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 查询站点互联互通配置
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@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()));
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询第三方平台配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@PostMapping("/getSettingInfo")
|
||||
public TableDataInfo getSettingInfo(@RequestBody ThirdPartySettingInfo info) {
|
||||
List<ThirdPartySettingInfo> infos = thirdPartySettingInfoService.selectThirdPartySettingInfoList(info);
|
||||
return getDataTable(infos);
|
||||
// return AjaxResult.success(thirdPartySettingInfoService.selectSettingInfo(info));
|
||||
}
|
||||
/**
|
||||
* 查询第三方平台配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
// @PostMapping("/getSettingInfo")
|
||||
// public TableDataInfo getSettingInfo(@RequestBody ThirdPartySettingInfo info) {
|
||||
// List<ThirdPartySettingInfo> infos = thirdPartySettingInfoService.selectThirdPartySettingInfoList(info);
|
||||
// return getDataTable(infos);
|
||||
// // return AjaxResult.success(thirdPartySettingInfoService.selectSettingInfo(info));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改站点互联互通配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
// @PostMapping("/updateSettingByStationId")
|
||||
// public AjaxResult updateSettingByStationId(@RequestBody ThirdPartySettingInfo info) {
|
||||
// return AjaxResult.success(thirdPartySettingInfoService.updateStationSettingInfo(info));
|
||||
// }
|
||||
/**
|
||||
* 修改站点互联互通配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
// @PostMapping("/updateSettingByStationId")
|
||||
// public AjaxResult updateSettingByStationId(@RequestBody ThirdPartySettingInfo info) {
|
||||
// return AjaxResult.success(thirdPartySettingInfoService.updateStationSettingInfo(info));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 新增站点互联互通配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:add')")
|
||||
// @PostMapping("/insertSettingInfo")
|
||||
// public AjaxResult insertSettingInfo(ThirdPartySettingInfo info) {
|
||||
// return AjaxResult.success(thirdPartySettingInfoService.insertThirdPartySettingInfo(info));
|
||||
// }
|
||||
/**
|
||||
* 新增站点互联互通配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:add')")
|
||||
// @PostMapping("/insertSettingInfo")
|
||||
// public AjaxResult insertSettingInfo(ThirdPartySettingInfo info) {
|
||||
// return AjaxResult.success(thirdPartySettingInfoService.insertThirdPartySettingInfo(info));
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 推送充电站信息 notification_stationInfo
|
||||
* http://localhost:8080/LianLian/pushStationInfo
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送充电站信息 notification_stationInfo
|
||||
* http://localhost:8080/LianLian/pushStationInfo
|
||||
* @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;
|
||||
}
|
||||
/**
|
||||
* 绑定停车平台(停车充电下发优惠券)
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bindParkingPlatform")
|
||||
public RestApiResponse<?> bindParkingPlatform(@RequestBody BindParkingPlatformDTO dto) {
|
||||
logger.info("绑定停车平台 params:{}", JSON.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
int i = pileStationInfoService.bindParkingPlatform(dto);
|
||||
response = new RestApiResponse<>(i);
|
||||
} 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 dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bindParkingPlatform")
|
||||
public RestApiResponse<?> bindParkingPlatform(@RequestBody BindParkingPlatformDTO dto) {
|
||||
logger.info("绑定停车平台 params:{}", JSON.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
int i = pileStationInfoService.bindParkingPlatform(dto);
|
||||
response = new RestApiResponse<>(i);
|
||||
}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;
|
||||
}
|
||||
/**
|
||||
* 获取停车平台列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getParkingInfoList")
|
||||
public RestApiResponse<?> getParkingInfoList() {
|
||||
// logger.info("获取停车平台列表");
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
startPage();
|
||||
List<ThirdpartyParkingConfig> list = parkingConfigService.selectInfoList();
|
||||
response = new RestApiResponse<>(list);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取停车平台列表 error,", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("获取停车平台列表 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取停车平台列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getParkingInfoList")
|
||||
public RestApiResponse<?> getParkingInfoList() {
|
||||
// logger.info("获取停车平台列表");
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
startPage();
|
||||
List<ThirdpartyParkingConfig> list = parkingConfigService.selectInfoList();
|
||||
response = new RestApiResponse<>(list);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取停车平台列表 error,", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("获取停车平台列表 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新站点与第三方平台关系
|
||||
*/
|
||||
@PostMapping("/updateThirdPartyStationRelation")
|
||||
public AjaxResult updateThirdPartyStationRelation(@RequestBody ThirdPartyStationRelationDTO dto) {
|
||||
AjaxResult result;
|
||||
try {
|
||||
// startPage();
|
||||
thirdPartyStationRelationService.updateThirdPartyStationRelation(dto);
|
||||
result = AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
logger.error("更新站点与第三方平台关系error,", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 更新站点与第三方平台关系
|
||||
*/
|
||||
@PostMapping("/updateThirdPartyStationRelation")
|
||||
public AjaxResult updateThirdPartyStationRelation(@RequestBody ThirdPartyStationRelationDTO dto) {
|
||||
AjaxResult result;
|
||||
try {
|
||||
// startPage();
|
||||
thirdPartyStationRelationService.updateThirdPartyStationRelation(dto);
|
||||
result = AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
logger.error("更新站点与第三方平台关系error,", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user