mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-23 08:39:46 +08:00
bugfix 羽信预约充电独立逻辑
补齐 0xB2 协议字段,新增羽信预约 DTO、service 和接口。 羽信预约改为先确认桩端成功再落库,取消/删除前先取消桩端预约。 原预约逻辑不再兼容羽信主板,保持旧链路独立。
This commit is contained in:
@@ -17,6 +17,7 @@ import com.jsowell.pile.service.PileBasicInfoService;
|
||||
import com.jsowell.pile.service.PileFirmwareInfoService;
|
||||
import com.jsowell.pile.service.PileMerchantInfoService;
|
||||
import com.jsowell.pile.service.PileReservationInfoService;
|
||||
import com.jsowell.pile.service.YuxinReservationChargingService;
|
||||
import com.jsowell.pile.vo.PileReservationInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.PersonPileConnectorSumInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.PersonPileRealTimeVO;
|
||||
@@ -55,6 +56,9 @@ public class PersonPileController extends BaseController {
|
||||
@Autowired
|
||||
private PileReservationInfoService pileReservationInfoService;
|
||||
|
||||
@Autowired
|
||||
private YuxinReservationChargingService yuxinReservationChargingService;
|
||||
|
||||
@Autowired
|
||||
private PileFirmwareInfoService pileFirmwareInfoService;
|
||||
|
||||
@@ -508,6 +512,125 @@ public class PersonPileController extends BaseController {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 羽信主板添加预约充电
|
||||
* http://localhost:8080/uniapp/personalPile/yuxin/createReserved
|
||||
*/
|
||||
@PostMapping("/yuxin/createReserved")
|
||||
public RestApiResponse<?> createYuxinReserved(HttpServletRequest request, @RequestBody YuxinReservationChargingDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
dto.setMemberId(memberId);
|
||||
int reservedId = yuxinReservationChargingService.createReservation(dto);
|
||||
response = new RestApiResponse<>(ImmutableMap.of("reservedId", reservedId));
|
||||
} catch (BusinessException e) {
|
||||
logger.error("羽信添加预约充电error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("羽信添加预约充电error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_CREATE_RESERVED_ERROR);
|
||||
}
|
||||
logger.info("羽信添加预约充电params:{}, result:{}", dto, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 羽信主板修改预约充电
|
||||
* http://localhost:8080/uniapp/personalPile/yuxin/updateReservation
|
||||
*/
|
||||
@PostMapping("/yuxin/updateReservation")
|
||||
public RestApiResponse<?> updateYuxinReservation(HttpServletRequest request, @RequestBody YuxinReservationChargingDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
dto.setMemberId(memberId);
|
||||
int i = yuxinReservationChargingService.updateReservation(dto);
|
||||
if (i > 0) {
|
||||
response = new RestApiResponse<>();
|
||||
} else {
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_UPDATE_RESERVED_STATUS_ERROR.getValue(), ReturnCodeEnum.CODE_UPDATE_RESERVED_STATUS_ERROR.getLabel() + ": 充电桩返回修改失败");
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
logger.error("羽信修改预约充电error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("羽信修改预约充电error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_UPDATE_RESERVED_STATUS_ERROR);
|
||||
}
|
||||
logger.info("羽信修改预约充电params:{}, result:{}", dto, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 羽信主板取消预约充电
|
||||
* http://localhost:8080/uniapp/personalPile/yuxin/cancelReservation
|
||||
*/
|
||||
@PostMapping("/yuxin/cancelReservation")
|
||||
public RestApiResponse<?> cancelYuxinReservation(HttpServletRequest request, @RequestBody YuxinReservationChargingDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
dto.setMemberId(memberId);
|
||||
yuxinReservationChargingService.cancelReservation(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (BusinessException e) {
|
||||
logger.error("羽信取消预约充电error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("羽信取消预约充电error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_UPDATE_RESERVED_STATUS_ERROR);
|
||||
}
|
||||
logger.info("羽信取消预约充电params:{}, result:{}", dto, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 羽信主板删除预约
|
||||
* http://localhost:8080/uniapp/personalPile/yuxin/deleteReservation
|
||||
*/
|
||||
@PostMapping("/yuxin/deleteReservation")
|
||||
public RestApiResponse<?> deleteYuxinReservation(HttpServletRequest request, @RequestBody YuxinReservationChargingDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
dto.setMemberId(memberId);
|
||||
yuxinReservationChargingService.deleteReservation(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (BusinessException e) {
|
||||
logger.error("羽信删除预约error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("羽信删除预约error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_UPDATE_RESERVED_STATUS_ERROR);
|
||||
}
|
||||
logger.info("羽信删除预约params:{}, result:{}", dto, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 羽信主板查询预约信息
|
||||
* http://localhost:8080/uniapp/personalPile/yuxin/queryReservationInfo
|
||||
*/
|
||||
@PostMapping("/yuxin/queryReservationInfo")
|
||||
public RestApiResponse<?> queryYuxinReservationInfo(HttpServletRequest request, @RequestBody YuxinReservationChargingDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
dto.setMemberId(memberId);
|
||||
PileReservationInfoVO vo = yuxinReservationChargingService.queryReservationInfo(dto);
|
||||
response = new RestApiResponse<>(vo);
|
||||
} catch (BusinessException e) {
|
||||
logger.error("羽信查询预约状态error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("羽信查询预约状态error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_QUERY_RESERVATION_STATUS_ERROR);
|
||||
}
|
||||
logger.info("羽信查询预约状态params:{}, result:{}", dto, JSON.toJSONString(response));
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存蓝牙充电记录
|
||||
* http://localhost:8080/uniapp/personalPile/saveBluetoothChargingRecord
|
||||
|
||||
Reference in New Issue
Block a user