update 华为Service

This commit is contained in:
Lemon
2024-03-25 09:13:40 +08:00
parent ee02249554
commit 5c6cf06db2
3 changed files with 56 additions and 29 deletions

View File

@@ -4,12 +4,15 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.JWTUtils;
import com.jsowell.pile.dto.ThirdPartyCommonStartChargeDTO;
import com.jsowell.pile.dto.huawei.*;
import com.jsowell.pile.vo.huawei.QueryChargeStatusVO;
import com.jsowell.pile.vo.huawei.QueryEquipAuthVO;
import com.jsowell.pile.vo.huawei.QueryStartChargeVO;
import com.jsowell.thirdparty.common.CommonService;
import com.jsowell.thirdparty.huawei.HuaweiServiceV2;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo;
@@ -40,6 +43,9 @@ public class HuaWeiControllerV2 extends BaseController {
@Autowired
private HuaweiServiceV2 huaweiServiceV2;
@Autowired
private CommonService commonService;
/**
* 获取token接口
* http://localhost:8080/huawei/v1/query_token
@@ -184,12 +190,12 @@ public class HuaWeiControllerV2 extends BaseController {
Map<String, String> resultMap = null;
try {
resultMap = huaweiServiceV2.vinStartCharge(vinStartChargeDTO);
logger.info("华为vin启动充电 result:{}", resultMap);
}catch (Exception e) {
} catch (Exception e) {
logger.error("华为vin启动充电 error", e);
}
logger.info("华为vin启动充电 resultMap:{}", resultMap);
if (resultMap != null) {
return CommonResult.success(0, "vin启动充电成功!", resultMap.get("Data"), resultMap.get("Sig"));
return CommonResult.success(0, "vin启动充电结果", resultMap.get("Data"), resultMap.get("Sig"));
}else {
return CommonResult.failed("vin启动充电 error");
}
@@ -342,6 +348,21 @@ public class HuaWeiControllerV2 extends BaseController {
@PostMapping("/commonStartCharge")
public RestApiResponse<?> commonStartCharge(@RequestBody ThirdPartyCommonStartChargeDTO dto) {
RestApiResponse<?> response = null;
try {
String result = commonService.commonQueryStartCharge(dto);
response = new RestApiResponse<>(result);
} catch (Exception e) {
logger.error("统一启动充电接口 error", e);
}
logger.info("统一启动充电接口 params:{}, result:{}", JSON.toJSONString(dto), response);
return response;
}
/**