mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 12:35:07 +08:00
92 lines
3.1 KiB
Java
92 lines
3.1 KiB
Java
|
|
package com.jsowell.api.uniapp;
|
||
|
|
|
||
|
|
import com.alibaba.fastjson2.JSONObject;
|
||
|
|
import com.jsowell.common.annotation.Anonymous;
|
||
|
|
import com.jsowell.common.core.controller.BaseController;
|
||
|
|
import com.jsowell.common.core.page.PageResponse;
|
||
|
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||
|
|
import com.jsowell.common.exception.BusinessException;
|
||
|
|
import com.jsowell.common.response.RestApiResponse;
|
||
|
|
import com.jsowell.pile.dto.QueryConnectorListDTO;
|
||
|
|
import com.jsowell.pile.dto.QueryStationDTO;
|
||
|
|
import com.jsowell.pile.service.IPileConnectorInfoService;
|
||
|
|
import com.jsowell.pile.service.IPileStationInfoService;
|
||
|
|
import com.jsowell.pile.vo.uniapp.PersonalPileInfoVO;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
|
||
|
|
import javax.servlet.http.HttpServletRequest;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 充电桩相关接口
|
||
|
|
* 提供给小程序调用
|
||
|
|
*/
|
||
|
|
// 不登录直接访问
|
||
|
|
@Anonymous
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/uniapp/pile")
|
||
|
|
public class PileController extends BaseController {
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private IPileStationInfoService pileStationInfoService;
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private IPileConnectorInfoService pileConnectorInfoService;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询充电站信息列表(主页)
|
||
|
|
*
|
||
|
|
* http://localhost:8080/uniapp/pile/queryStationInfos
|
||
|
|
*/
|
||
|
|
@PostMapping("/queryStationInfos")
|
||
|
|
public RestApiResponse<?> queryStationInfos(HttpServletRequest request, @RequestBody QueryStationDTO queryStationDTO) {
|
||
|
|
logger.info("查询充电站信息列表 param:{}", JSONObject.toJSONString(queryStationDTO));
|
||
|
|
RestApiResponse<?> response = null;
|
||
|
|
try {
|
||
|
|
getMemberIdByAuthorization(request);
|
||
|
|
// startPage();
|
||
|
|
// List<PileStationVO> list = pileStationInfoService.uniAppQueryStationInfos(queryStationDTO);
|
||
|
|
PageResponse pageResponse = pileStationInfoService.uniAppQueryStationInfoList(queryStationDTO);
|
||
|
|
response = new RestApiResponse<>(pageResponse);
|
||
|
|
} catch (BusinessException e) {
|
||
|
|
logger.warn("查询充电站信息列表warn", e);
|
||
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||
|
|
} catch (Exception e) {
|
||
|
|
logger.error("查询充电站信息列表异常 error", e);
|
||
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_PILE_STATION_INFO_ERROR);
|
||
|
|
}
|
||
|
|
logger.info("查询充电站信息列表 result:{}", JSONObject.toJSONString(response));
|
||
|
|
return response;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 通过前端参数查询充电枪口列表
|
||
|
|
*
|
||
|
|
* http://localhost:8080/uniapp/pile/selectConnectorListByParams
|
||
|
|
*
|
||
|
|
* @param dto
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@PostMapping("/selectConnectorListByParams")
|
||
|
|
public RestApiResponse<?> selectConnectorListByParams(HttpServletRequest request, @RequestBody QueryConnectorListDTO dto) {
|
||
|
|
logger.info("查询充电枪口列表 params:{}", JSONObject.toJSONString(dto));
|
||
|
|
RestApiResponse<?> response = null;
|
||
|
|
try {
|
||
|
|
PageResponse pageResponse = pileConnectorInfoService.getUniAppConnectorInfoListByParams(dto);
|
||
|
|
response = new RestApiResponse<>(pageResponse);
|
||
|
|
} catch (Exception e) {
|
||
|
|
logger.error("查询充电枪口列表异常", e);
|
||
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_CONNECTOR_INFO_BY_STATION_ID_ERROR);
|
||
|
|
}
|
||
|
|
logger.info("查询充电枪口列表 result:{}", response);
|
||
|
|
return response;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|