2023-03-04 16:29:55 +08:00
|
|
|
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.enums.ykc.ReturnCodeEnum;
|
|
|
|
|
import com.jsowell.common.exception.BusinessException;
|
|
|
|
|
import com.jsowell.common.response.RestApiResponse;
|
2023-03-15 09:12:09 +08:00
|
|
|
import com.jsowell.pile.service.IOrderBasicInfoService;
|
2023-03-04 16:29:55 +08:00
|
|
|
import com.jsowell.pile.vo.uniapp.PileConnectorVO;
|
|
|
|
|
import com.jsowell.service.PileService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
|
|
@Anonymous
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/app-xcx-h5")
|
|
|
|
|
public class JumpController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PileService pileService;
|
|
|
|
|
|
2023-03-15 09:12:09 +08:00
|
|
|
@Autowired
|
|
|
|
|
private IOrderBasicInfoService orderBasicInfoService;
|
|
|
|
|
|
2023-03-04 16:29:55 +08:00
|
|
|
/**
|
|
|
|
|
* 查询充电桩详情
|
|
|
|
|
* http://localhost:8080/app-xcx-h5/pile/pileDetail/{pileSn}
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/pile/pileDetail/{pileSn}")
|
|
|
|
|
public RestApiResponse<?> getPileDetail(HttpServletRequest request, @PathVariable("pileSn") String pileSn) {
|
|
|
|
|
logger.info("app-xcx-h5查询充电桩详情 param:{}", pileSn);
|
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
try {
|
|
|
|
|
PileConnectorVO vo = pileService.getPileDetailByPileSn(pileSn);
|
|
|
|
|
response = new RestApiResponse<>(vo);
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
logger.warn("app-xcx-h5查询充电桩详情 warn", e);
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("app-xcx-h5查询充电桩详情 error", e);
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_PILE_DETAIL_ERROR);
|
|
|
|
|
}
|
|
|
|
|
logger.info("app-xcx-h5查询充电桩详情 result:{}", JSONObject.toJSONString(response));
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询充电枪口详情
|
|
|
|
|
* http://localhost:8080/app-xcx-h5/pile/connectorDetail/{pileConnectorCode}
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/pile/connectorDetail/{pileConnectorCode}")
|
|
|
|
|
public RestApiResponse<?> getConnectorDetail(HttpServletRequest request, @PathVariable("pileConnectorCode") String pileConnectorCode) {
|
|
|
|
|
logger.info("app-xcx-h5查询充电枪口详情 param:{}", pileConnectorCode);
|
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
try {
|
|
|
|
|
PileConnectorVO vo = pileService.getConnectorDetail(pileConnectorCode);
|
|
|
|
|
response = new RestApiResponse<>(vo);
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
logger.warn("app-xcx-h5查询充电枪口详情 warn", e);
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("app-xcx-h5查询充电枪口详情 error", e);
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_PILE_DETAIL_ERROR);
|
|
|
|
|
}
|
|
|
|
|
logger.info("app-xcx-h5查询充电枪口详情 result:{}", JSONObject.toJSONString(response));
|
|
|
|
|
return response;
|
|
|
|
|
}
|
2023-03-15 09:12:09 +08:00
|
|
|
|
2023-04-18 16:46:47 +08:00
|
|
|
/**
|
|
|
|
|
* 更新接口
|
|
|
|
|
*/
|
|
|
|
|
public RestApiResponse<?> updateOrderDetail() {
|
|
|
|
|
orderBasicInfoService.updateElecAmount();
|
|
|
|
|
return new RestApiResponse<>();
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-04 16:29:55 +08:00
|
|
|
}
|