mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update 地锁逻辑修改
This commit is contained in:
@@ -30,141 +30,146 @@ import java.util.List;
|
||||
@RequestMapping("/uniapp/pile")
|
||||
public class PileController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IPileStationInfoService pileStationInfoService;
|
||||
@Autowired
|
||||
private IPileStationInfoService pileStationInfoService;
|
||||
|
||||
@Autowired
|
||||
private IPileConnectorInfoService pileConnectorInfoService;
|
||||
@Autowired
|
||||
private IPileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
@Autowired
|
||||
private IPileBillingTemplateService pileBillingTemplateService;
|
||||
@Autowired
|
||||
private IPileBillingTemplateService pileBillingTemplateService;
|
||||
|
||||
@Autowired
|
||||
private IPileMerchantInfoService pileMerchantInfoService;
|
||||
@Autowired
|
||||
private IPileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private OrderPileOccupyService orderPileOccupyService;
|
||||
@Autowired
|
||||
private OrderPileOccupyService orderPileOccupyService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电站信息列表(主页)
|
||||
*
|
||||
* 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 {
|
||||
// 获取appid(第三方平台用)
|
||||
String appId = request.getHeader("appId");
|
||||
if (StringUtils.isNotBlank(appId)) {
|
||||
// 获取deptIds
|
||||
List<String> deptIds = pileMerchantInfoService.getDeptIdsByAppId(appId);
|
||||
queryStationDTO.setMerchantDeptIds(deptIds);
|
||||
}
|
||||
logger.info("uniApp查询充电站信息appId:{}, dto:{}", appId, JSON.toJSONString(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;
|
||||
}
|
||||
/**
|
||||
* 查询充电站信息列表(主页)
|
||||
* <p>
|
||||
* 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 {
|
||||
// 获取appid(第三方平台用)
|
||||
String appId = request.getHeader("appId");
|
||||
if (StringUtils.isNotBlank(appId)) {
|
||||
// 获取deptIds
|
||||
List<String> deptIds = pileMerchantInfoService.getDeptIdsByAppId(appId);
|
||||
queryStationDTO.setMerchantDeptIds(deptIds);
|
||||
}
|
||||
logger.info("uniApp查询充电站信息appId:{}, dto:{}", appId, JSON.toJSONString(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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过站点id查询计费模板列表
|
||||
* http://localhost:8080/uniapp/pile/queryBillingPrice/{stationId}
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryBillingPrice/{stationId}")
|
||||
public RestApiResponse<?> queryBillingPrice(@PathVariable("stationId") String stationId) {
|
||||
logger.info("通过站点id查询计费模板列表 params:{}", stationId);
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
List<BillingPriceVO> billingPriceVOList = pileBillingTemplateService.queryBillingPrice(stationId);
|
||||
response = new RestApiResponse<>(billingPriceVOList);
|
||||
} catch (Exception e) {
|
||||
logger.error("通过站点id查询计费模板列表 error, ", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("通过站点id查询计费模板列表 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
/**
|
||||
* 通过站点id查询计费模板列表
|
||||
* http://localhost:8080/uniapp/pile/queryBillingPrice/{stationId}
|
||||
*
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryBillingPrice/{stationId}")
|
||||
public RestApiResponse<?> queryBillingPrice(@PathVariable("stationId") String stationId) {
|
||||
logger.info("通过站点id查询计费模板列表 params:{}", stationId);
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
List<BillingPriceVO> billingPriceVOList = pileBillingTemplateService.queryBillingPrice(stationId);
|
||||
response = new RestApiResponse<>(billingPriceVOList);
|
||||
} catch (Exception e) {
|
||||
logger.error("通过站点id查询计费模板列表 error, ", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("通过站点id查询计费模板列表 result:{}", 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;
|
||||
}
|
||||
/**
|
||||
* 通过前端参数查询充电枪口列表
|
||||
* <p>
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据充电站id查询枪口列表
|
||||
* @param request
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selectStationConnectorList")
|
||||
public RestApiResponse<?> selectStationConnectorList(HttpServletRequest request, @RequestBody QueryConnectorListDTO dto) {
|
||||
logger.info("查询充电枪口列表 params:{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
PageResponse pageResponse = pileConnectorInfoService.selectStationConnectorList(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;
|
||||
}
|
||||
/**
|
||||
* 根据充电站id查询枪口列表
|
||||
*
|
||||
* @param request
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selectStationConnectorList")
|
||||
public RestApiResponse<?> selectStationConnectorList(HttpServletRequest request, @RequestBody QueryConnectorListDTO dto) {
|
||||
logger.info("查询充电枪口列表 params:{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
PageResponse pageResponse = pileConnectorInfoService.selectStationConnectorList(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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 远程遥控地锁指令 + 生成占桩订单
|
||||
*/
|
||||
@PostMapping("/remoteGroundLock")
|
||||
public RestApiResponse<?> remoteGroundLock(HttpServletRequest request, @RequestBody RemoteGroundLockDTO dto) {
|
||||
// logger.info("遥控地锁指令 params:{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
// 校验参数
|
||||
if (StringUtils.isBlank(dto.getPileSn()) || StringUtils.isBlank(dto.getConnectorCode())
|
||||
|| StringUtils.isBlank(dto.getOperate())) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
// 获取memberId
|
||||
dto.setMemberId(getMemberIdByAuthorization(request));
|
||||
orderPileOccupyService.remoteGroundLock(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (Exception e) {
|
||||
logger.error("遥控地锁指令 error, ", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("遥控地锁指令 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
/**
|
||||
* 远程遥控地锁指令 + 生成占桩订单
|
||||
*/
|
||||
@PostMapping("/remoteGroundLock")
|
||||
public RestApiResponse<?> remoteGroundLock(HttpServletRequest request, @RequestBody RemoteGroundLockDTO dto) {
|
||||
// logger.info("遥控地锁指令 params:{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
// 校验参数
|
||||
if (StringUtils.isBlank(dto.getPileSn()) || StringUtils.isBlank(dto.getConnectorCode())
|
||||
|| StringUtils.isBlank(dto.getOperate())) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
// 获取memberId
|
||||
dto.setMemberId(getMemberIdByAuthorization(request));
|
||||
orderPileOccupyService.remoteGroundLock(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (BusinessException e) {
|
||||
logger.error("遥控地锁指令 warn", 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user