个人桩停止充电

This commit is contained in:
Guoqs
2024-07-26 10:52:40 +08:00
parent 44d276fbf4
commit ab5c4e9dc2
4 changed files with 78 additions and 37 deletions

View File

@@ -140,36 +140,7 @@ public class PersonPileController extends BaseController {
return response;
}
/**
* 个人桩停止充电
* http://localhost:8080/uniapp/personalPile/personPileStopCharging
* 管理员可以停自己启动的和别人启动的
* 其他人员只能停止自己启动的
*/
@PostMapping("/personPileStopCharging")
public RestApiResponse<?> personPileStopCharging(HttpServletRequest request, PersonPileStopChargingDTO dto) {
RestApiResponse<?> response = null;
try {
String appId = request.getHeader("appId");
if (StringUtils.isNotBlank(appId)) {
String firstLevelMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByWxAppId(appId);
if (StringUtils.isNotBlank(firstLevelMerchantId)) {
dto.setFirstLevelMerchantId(firstLevelMerchantId);
}
}
String memberId = getMemberIdByAuthorization(request);
dto.setMemberId(memberId);
pileReservationInfoService.personPileStopCharging(dto);
response = new RestApiResponse<>();
} catch (BusinessException e) {
logger.error("个人桩停止充电error", e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
} catch (Exception e) {
logger.error("个人桩停止充电error", e);
response = new RestApiResponse<>(ReturnCodeEnum.CODE_PERSON_PILE_STOP_CHARGING_ERROR);
}
return response;
}
/**
@@ -310,6 +281,38 @@ public class PersonPileController extends BaseController {
}
/**
* 个人桩停止充电
* http://localhost:8080/uniapp/personalPile/personPileStopCharging
* 管理员可以停自己启动的和别人启动的
* 其他人员只能停止自己启动的
*/
@PostMapping("/personPileStopCharging")
public RestApiResponse<?> personPileStopCharging(HttpServletRequest request, PersonPileStopChargingDTO dto) {
RestApiResponse<?> response = null;
try {
String appId = request.getHeader("appId");
if (StringUtils.isNotBlank(appId)) {
String firstLevelMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByWxAppId(appId);
if (StringUtils.isNotBlank(firstLevelMerchantId)) {
dto.setFirstLevelMerchantId(firstLevelMerchantId);
}
}
String memberId = getMemberIdByAuthorization(request);
dto.setMemberId(memberId);
pileReservationInfoService.personPileStopCharging(dto);
response = new RestApiResponse<>();
} catch (BusinessException e) {
logger.error("个人桩停止充电error", e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
} catch (Exception e) {
logger.error("个人桩停止充电error", e);
response = new RestApiResponse<>(ReturnCodeEnum.CODE_PERSON_PILE_STOP_CHARGING_ERROR);
}
return response;
}
/**
* 添加预约充电
* http://localhost:8080/uniapp/personalPile/createReserved
@@ -431,7 +434,7 @@ public class PersonPileController extends BaseController {
}
/**
* 根据充电桩查询预约状态
* 根据充电桩查询预约信息
* http://localhost:8080/uniapp/personalPile/queryReservationInfo
*/
@PostMapping("/queryReservationInfo")

View File

@@ -260,6 +260,17 @@ public class SpringBootTestController {
@Autowired
private PileReservationInfoService pileReservationInfoService;
@Test
public void personPileStopChargingTest() {
String memberId = "84085683";
String pileConnectorCode = "8823000000141001";
PersonPileStopChargingDTO dto = PersonPileStopChargingDTO.builder()
.memberId(memberId)
.pileConnectorCode(pileConnectorCode)
.build();
pileReservationInfoService.personPileStopCharging(dto);
}
@Test
public void selectMemberPlateNumberRelationTest() {
String memberId = "25950857";