update 江苏省平台接口

This commit is contained in:
Lemon
2023-10-20 17:20:31 +08:00
parent be44562253
commit 4c6277b36c
6 changed files with 65 additions and 49 deletions

View File

@@ -29,7 +29,7 @@ import java.nio.charset.StandardCharsets;
import java.util.Map; import java.util.Map;
/** /**
* 南瑞平台 controller * 江苏平台 controller
* *
* @author Lemon * @author Lemon
* @Date 2023/10/11 13:26 * @Date 2023/10/11 13:26
@@ -48,7 +48,7 @@ public class NRController extends BaseController {
*/ */
@RequestMapping("/v1/query_stations_info") @RequestMapping("/v1/query_stations_info")
public CommonResult<?> query_stations_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { public CommonResult<?> query_stations_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("南瑞平台查询充电站信息 params:{}", JSON.toJSONString(dto)); logger.info("江苏平台查询充电站信息 params:{}", JSON.toJSONString(dto));
try { try {
// 校验令牌 // 校验令牌
String token = request.getHeader("Authorization"); String token = request.getHeader("Authorization");
@@ -72,7 +72,7 @@ public class NRController extends BaseController {
Map<String, String> map = nrService.query_stations_info(queryStationInfoDTO); Map<String, String> map = nrService.query_stations_info(queryStationInfoDTO);
return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig")); return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
logger.error("南瑞平台查询充电站信息 error", e); logger.error("江苏平台查询充电站信息 error", e);
} }
return CommonResult.failed("查询充电站信息异常"); return CommonResult.failed("查询充电站信息异常");
} }
@@ -84,7 +84,7 @@ public class NRController extends BaseController {
*/ */
@RequestMapping("/v1/query_station_status") @RequestMapping("/v1/query_station_status")
public CommonResult<?> query_station_status(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { public CommonResult<?> query_station_status(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("南瑞平台查询设备接口状态 params:{}", JSON.toJSONString(dto)); logger.info("江苏平台查询设备接口状态 params:{}", JSON.toJSONString(dto));
try { try {
// 校验令牌 // 校验令牌
String token = request.getHeader("Authorization"); String token = request.getHeader("Authorization");
@@ -109,7 +109,7 @@ public class NRController extends BaseController {
Map<String, String> map = nrService.query_station_status(queryStationInfoDTO); Map<String, String> map = nrService.query_station_status(queryStationInfoDTO);
return CommonResult.success(0, "查询设备接口状态成功!", map.get("Data"), map.get("Sig")); return CommonResult.success(0, "查询设备接口状态成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
logger.error("南瑞平台查询设备接口状态 error", e); logger.error("江苏平台查询设备接口状态 error", e);
e.printStackTrace(); e.printStackTrace();
} }
return CommonResult.failed("查询设备接口状态异常"); return CommonResult.failed("查询设备接口状态异常");
@@ -122,7 +122,7 @@ public class NRController extends BaseController {
*/ */
@RequestMapping("/v1/query_order_info") @RequestMapping("/v1/query_order_info")
public CommonResult<?> query_order_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { public CommonResult<?> query_order_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("南瑞平台查询充电电量信息 params:{}", JSON.toJSONString(dto)); logger.info("江苏平台查询充电电量信息 params:{}", JSON.toJSONString(dto));
try { try {
// 校验令牌 // 校验令牌
String token = request.getHeader("Authorization"); String token = request.getHeader("Authorization");
@@ -147,7 +147,7 @@ public class NRController extends BaseController {
Map<String, String> map = nrService.query_order_info(nrQueryOrderDTO); Map<String, String> map = nrService.query_order_info(nrQueryOrderDTO);
return CommonResult.success(0, "查询充电电量信息成功!", map.get("Data"), map.get("Sig")); return CommonResult.success(0, "查询充电电量信息成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
logger.error("南瑞平台查询充电电量信息 error", e); logger.error("江苏平台查询充电电量信息 error", e);
} }
return CommonResult.failed("查询充电电量信息异常"); return CommonResult.failed("查询充电电量信息异常");
} }
@@ -158,10 +158,10 @@ public class NRController extends BaseController {
*/ */
@PostMapping("/v1/query_token") @PostMapping("/v1/query_token")
public CommonResult<?> queryToken(@RequestBody CommonParamsDTO dto) { public CommonResult<?> queryToken(@RequestBody CommonParamsDTO dto) {
logger.info("南瑞平台请求令牌 params:{}", JSONObject.toJSONString(dto)); logger.info("江苏平台请求令牌 params:{}", JSONObject.toJSONString(dto));
try { try {
Map<String, String> map = nrService.generateToken(dto); Map<String, String> map = nrService.generateToken(dto);
logger.info("南瑞平台请求令牌 result:{}", JSONObject.toJSONString(map)); logger.info("江苏平台请求令牌 result:{}", JSONObject.toJSONString(map));
return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig")); return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
logger.error("获取token接口 异常"); logger.error("获取token接口 异常");
@@ -185,7 +185,7 @@ public class NRController extends BaseController {
*/ */
@PostMapping("/v1/pushStationInfo") @PostMapping("/v1/pushStationInfo")
public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) { public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
logger.info("推送南瑞平台充电站信息 params:{}", JSONObject.toJSONString(dto)); logger.info("推送江苏平台充电站信息 params:{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response = null; RestApiResponse<?> response = null;
try { try {
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) { if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
@@ -194,13 +194,13 @@ public class NRController extends BaseController {
String s = nrService.pushStationInfo(dto); String s = nrService.pushStationInfo(dto);
response = new RestApiResponse<>(s); response = new RestApiResponse<>(s);
}catch (BusinessException e) { }catch (BusinessException e) {
logger.error("推送南瑞平台充电站信息 error",e); logger.error("推送江苏平台充电站信息 error",e);
response = new RestApiResponse<>(e.getCode(), e.getMessage()); response = new RestApiResponse<>(e.getCode(), e.getMessage());
}catch (Exception e) { }catch (Exception e) {
logger.error("推送南瑞平台充电站信息 error", e); logger.error("推送江苏平台充电站信息 error", e);
response = new RestApiResponse<>(e); response = new RestApiResponse<>(e);
} }
logger.info("推送南瑞平台充电站信息 result:{}", response); logger.info("推送江苏平台充电站信息 result:{}", response);
return response; return response;
} }
@@ -212,7 +212,7 @@ public class NRController extends BaseController {
*/ */
@PostMapping("/v1/pushAlarmInfo") @PostMapping("/v1/pushAlarmInfo")
public RestApiResponse<?> pushAlarmInfo(@RequestBody PushAlarmInfoDTO dto) { public RestApiResponse<?> pushAlarmInfo(@RequestBody PushAlarmInfoDTO dto) {
logger.info("推送南瑞平台告警信息 params:{}", JSONObject.toJSONString(dto)); logger.info("推送江苏平台告警信息 params:{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response = null; RestApiResponse<?> response = null;
try { try {
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) { if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
@@ -221,13 +221,13 @@ public class NRController extends BaseController {
String s = nrService.pushAlarmInfo(dto); String s = nrService.pushAlarmInfo(dto);
response = new RestApiResponse<>(s); response = new RestApiResponse<>(s);
}catch (BusinessException e) { }catch (BusinessException e) {
logger.error("推送南瑞平台告警信息 error",e); logger.error("推送江苏平台告警信息 error",e);
response = new RestApiResponse<>(e.getCode(), e.getMessage()); response = new RestApiResponse<>(e.getCode(), e.getMessage());
}catch (Exception e) { }catch (Exception e) {
logger.error("推送南瑞平台告警信息 error", e); logger.error("推送江苏平台告警信息 error", e);
response = new RestApiResponse<>(e); response = new RestApiResponse<>(e);
} }
logger.info("推送南瑞平台告警信息 result:{}", response); logger.info("推送江苏平台告警信息 result:{}", response);
return response; return response;
} }
@@ -238,19 +238,19 @@ public class NRController extends BaseController {
*/ */
@PostMapping("/v1/pushPileStatus") @PostMapping("/v1/pushPileStatus")
public RestApiResponse<?> pushPileStatus(@RequestBody RealTimeMonitorData data) { public RestApiResponse<?> pushPileStatus(@RequestBody RealTimeMonitorData data) {
logger.info("推送南瑞平台设备状态变化推送 params:{}", JSONObject.toJSONString(data)); logger.info("推送江苏平台设备状态变化推送 params:{}", JSONObject.toJSONString(data));
RestApiResponse<?> response = null; RestApiResponse<?> response = null;
try { try {
String s = nrService.pushPileStatus(data); String s = nrService.pushPileStatus(data);
response = new RestApiResponse<>(s); response = new RestApiResponse<>(s);
}catch (BusinessException e) { }catch (BusinessException e) {
logger.error("推送南瑞平台设备状态变化推送 error",e); logger.error("推送江苏平台设备状态变化推送 error",e);
response = new RestApiResponse<>(e.getCode(), e.getMessage()); response = new RestApiResponse<>(e.getCode(), e.getMessage());
}catch (Exception e) { }catch (Exception e) {
logger.error("推送南瑞平台设备状态变化推送 error", e); logger.error("推送江苏平台设备状态变化推送 error", e);
response = new RestApiResponse<>(e); response = new RestApiResponse<>(e);
} }
logger.info("推送南瑞平台设备状态变化推送 result:{}", response); logger.info("推送江苏平台设备状态变化推送 result:{}", response);
return response; return response;
} }
@@ -262,19 +262,19 @@ public class NRController extends BaseController {
*/ */
@GetMapping("/v1/pushOrderInfo/{orderCode}") @GetMapping("/v1/pushOrderInfo/{orderCode}")
public RestApiResponse<?> pushOrderInfo(@PathVariable("orderCode") String orderCode) { public RestApiResponse<?> pushOrderInfo(@PathVariable("orderCode") String orderCode) {
logger.info("南瑞平台充电电量信息推送 params:{}", orderCode); logger.info("江苏平台充电电量信息推送 params:{}", orderCode);
RestApiResponse<?> response = null; RestApiResponse<?> response = null;
try { try {
String s = nrService.pushOrderInfo(orderCode); String s = nrService.pushOrderInfo(orderCode);
response = new RestApiResponse<>(s); response = new RestApiResponse<>(s);
}catch (BusinessException e) { }catch (BusinessException e) {
logger.error("南瑞平台充电电量信息推送 error",e); logger.error("江苏平台充电电量信息推送 error",e);
response = new RestApiResponse<>(e.getCode(), e.getMessage()); response = new RestApiResponse<>(e.getCode(), e.getMessage());
}catch (Exception e) { }catch (Exception e) {
logger.error("南瑞平台充电电量信息推送 error", e); logger.error("江苏平台充电电量信息推送 error", e);
response = new RestApiResponse<>(e); response = new RestApiResponse<>(e);
} }
logger.info("南瑞平台充电电量信息推送 result:{}", response); logger.info("江苏平台充电电量信息推送 result:{}", response);
return response; return response;
} }
} }

View File

@@ -52,6 +52,8 @@ public class Constants {
public static final String OPERATORID_LIANLIAN = "MA1JLFUU8"; public static final String OPERATORID_LIANLIAN = "MA1JLFUU8";
public static final String OPERATORID_JIANG_SU = "MA1X78KH5";
// public static final String APP_ID = "wxbb3e0d474569481d"; // 举视充电网 wxbb3e0d474569481d // public static final String APP_ID = "wxbb3e0d474569481d"; // 举视充电网 wxbb3e0d474569481d
// //
// public static final String APP_SECRET = "bbac689f4654b209de4d6944808ec80b"; // 举视充电网 bbac689f4654b209de4d6944808ec80b // public static final String APP_SECRET = "bbac689f4654b209de4d6944808ec80b"; // 举视充电网 bbac689f4654b209de4d6944808ec80b

View File

@@ -94,6 +94,8 @@ public class AdapayCallbackRecord implements Serializable {
private String wxUserId; private String wxUserId;
private String businessMode;
/** /**
* 创建时间 * 创建时间
*/ */

View File

@@ -44,6 +44,8 @@ import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil;
import com.jsowell.thirdparty.lianlian.vo.*; import com.jsowell.thirdparty.lianlian.vo.*;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -62,6 +64,8 @@ public class LianLianServiceImpl implements LianLianService {
// private static final String DATA_SECRET = "R1Hdq80mSWswwCzt"; // 消息密钥 R1Hdq80mSWswwCzt 1234567890abcdef // private static final String DATA_SECRET = "R1Hdq80mSWswwCzt"; // 消息密钥 R1Hdq80mSWswwCzt 1234567890abcdef
// private static final String DATA_SECRETIV = "LVpz3qHD8sM2PYjl"; // 消息密钥初始化向量 LVpz3qHD8sM2PYjl 1234567890abcdef // private static final String DATA_SECRETIV = "LVpz3qHD8sM2PYjl"; // 消息密钥初始化向量 LVpz3qHD8sM2PYjl 1234567890abcdef
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired @Autowired
private IPileMerchantInfoService pileMerchantInfoService; private IPileMerchantInfoService pileMerchantInfoService;
@@ -779,6 +783,7 @@ public class LianLianServiceImpl implements LianLianService {
String response = HttpUtil.post(requestUrl, tokenRequest); String response = HttpUtil.post(requestUrl, tokenRequest);
LianLianResultVO result = JSON.parseObject(response, LianLianResultVO.class); LianLianResultVO result = JSON.parseObject(response, LianLianResultVO.class);
logger.info("获取令牌 result:{}", result);
if (result.getRet() == 0) { if (result.getRet() == 0) {
// 解密data // 解密data
@@ -787,6 +792,7 @@ public class LianLianServiceImpl implements LianLianService {
String dataStr = new String(plainText, "UTF-8"); String dataStr = new String(plainText, "UTF-8");
Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr); Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr);
token = resultMap.get("AccessToken"); token = resultMap.get("AccessToken");
logger.info("token: {}", token);
} }
} catch (Exception e) { } catch (Exception e) {
return token; return token;

View File

@@ -157,11 +157,11 @@ public class HttpRequestUtil {
} }
/** /**
* 南瑞平台发送请求 * 江苏平台发送请求
* *
* TODO和联联平台一样的方法若测试通过则统一更换成上面的方法 * TODO和联联平台一样的方法若测试通过则统一更换成上面的方法
* *
* @param token 南瑞平台令牌 * @param token 江苏平台令牌
* @param data 要传输的JsonString格式数据 * @param data 要传输的JsonString格式数据
* @param url 请求地址 * @param url 请求地址
* @param dataSecret 消息密钥 * @param dataSecret 消息密钥
@@ -172,7 +172,7 @@ public class HttpRequestUtil {
*/ */
public static String nrSendPost(String token, String data, String url, String dataSecret, public static String nrSendPost(String token, String data, String url, String dataSecret,
String dataSecretIV, String operatorId, String sigSecret){ String dataSecretIV, String operatorId, String sigSecret){
log.info("南瑞平台发送请求 data:{}", data); log.info("江苏平台发送请求 data:{}", data);
//加密 //加密
byte[] encryptText = Cryptos.aesEncrypt(data.getBytes(), byte[] encryptText = Cryptos.aesEncrypt(data.getBytes(),
dataSecret.getBytes(), dataSecretIV.getBytes()); dataSecret.getBytes(), dataSecretIV.getBytes());
@@ -188,23 +188,25 @@ public class HttpRequestUtil {
params.put("Sig", sign); params.put("Sig", sign);
String postData = JSON.toJSONString(params); String postData = JSON.toJSONString(params);
log.info("南瑞平台发送请求 最终提交数据:{}", postData); log.info("江苏平台发送请求 最终提交数据:{}", postData);
// System.out.println("最终提交数据:" + postData); // System.out.println("最终提交数据:" + postData);
String hutoolRequest = HttpRequest.post(url).header("Authorization", "Bearer " + token).body(postData).execute().body(); String hutoolRequest = HttpRequest.post(url).header("Authorization", "Bearer " + token).body(postData).execute().body();
log.info("南瑞平台发送请求 接收到返回数据:{}", hutoolRequest); log.info("江苏平台发送请求 接收到返回数据:{}", hutoolRequest);
// System.out.println("接收到返回数据:" + hutoolRequest); // System.out.println("接收到返回数据:" + hutoolRequest);
if (StringUtils.isBlank(hutoolRequest)) {
return "SUCCESS";
}
Map<String, Object> map = (Map<String, Object>) JSON.parse(hutoolRequest); Map<String, Object> map = (Map<String, Object>) JSON.parse(hutoolRequest);
log.info("南瑞平台发送请求 返回数据map:{}", JSON.toJSONString(map)); log.info("江苏平台发送请求 返回数据map:{}", JSON.toJSONString(map));
int ret = (int) map.get("Ret"); int ret = (int) map.get("Ret");
String resultMsg = (String) map.get("Msg"); String resultMsg = (String) map.get("Msg");
if (ret != 0) { if (ret != 0) {
// 表示请求有异常 // 表示请求有异常
log.error("南瑞平台发送请求 error:{}, 源数据:{}", resultMsg, data); log.error("江苏平台发送请求 error:{}, 源数据:{}", resultMsg, data);
return resultMsg; return resultMsg;
} }
String rData = (String) map.get("Data"); String rData = (String) map.get("Data");
@@ -218,7 +220,7 @@ public class HttpRequestUtil {
e.printStackTrace(); e.printStackTrace();
} }
log.info("南瑞平台发送请求 解密数据:{}", plainData); log.info("江苏平台发送请求 解密数据:{}", plainData);
// System.out.println("解密数据:" + plainData); // System.out.println("解密数据:" + plainData);
return resultMsg; return resultMsg;
} }

View File

@@ -151,11 +151,11 @@ public class NRServiceImpl implements NRService {
// 拼装南瑞平台所需参数 // 拼装南瑞平台所需参数
NRStationInfo nrStationInfo = NRStationInfo.builder() NRStationInfo nrStationInfo = NRStationInfo.builder()
.stationId("NR" + stationInfoVO.getId()) .stationId("NR" + stationInfoVO.getId())
.operatorID("014406554") .operatorID(Constants.OPERATORID_JIANG_SU)
.equipmentOwnerID("014406554") .equipmentOwnerID(Constants.OPERATORID_JIANG_SU)
.stationName(stationInfoVO.getStationName()) .stationName(stationInfoVO.getStationName())
.countryCode(stationInfoVO.getCountryCode()) .countryCode(stationInfoVO.getCountryCode())
.areaCode(stationInfoVO.getAreaCode()) // .areaCode()
.address(stationInfoVO.getAddress()) .address(stationInfoVO.getAddress())
.serviceTel(stationInfoVO.getStationTel()) .serviceTel(stationInfoVO.getStationTel())
.stationStatus(stationInfoVO.getStationStatus()) .stationStatus(stationInfoVO.getStationStatus())
@@ -166,7 +166,6 @@ public class NRServiceImpl implements NRService {
.openAllDay(Integer.parseInt(stationInfoVO.getOpenAllDay())) .openAllDay(Integer.parseInt(stationInfoVO.getOpenAllDay()))
.busineHours(stationInfoVO.getBusinessHours()) .busineHours(stationInfoVO.getBusinessHours())
.minElectricityPrice(stationInfoVO.getElectricityPrice().add(stationInfoVO.getServicePrice())) .minElectricityPrice(stationInfoVO.getElectricityPrice().add(stationInfoVO.getServicePrice()))
.loungeFlag(0) .loungeFlag(0)
.isAloneApply(0) .isAloneApply(0)
.printerFlag(0) .printerFlag(0)
@@ -185,6 +184,12 @@ public class NRServiceImpl implements NRService {
.parkFeeType(1) .parkFeeType(1)
.build(); .build();
// 站点地址
String areaCode = stationInfoVO.getAreaCode();
// 截取最后一组数据,例如将 320000,320500,320583 截取为 320583
String[] split = StringUtils.split(areaCode, ",");
String s = split[split.length - 1];
nrStationInfo.setAreaCode(s);
// 站点图片 // 站点图片
if (CollectionUtils.isNotEmpty(stationInfoVO.getPictureList())) { if (CollectionUtils.isNotEmpty(stationInfoVO.getPictureList())) {
nrStationInfo.setPictures(stationInfoVO.getPictureList()); nrStationInfo.setPictures(stationInfoVO.getPictureList());
@@ -203,15 +208,15 @@ public class NRServiceImpl implements NRService {
// 推送到平台 // 推送到平台
String url = urlAddress + "notification_stationInfo"; String url = urlAddress + "notification_stationInfo";
String jsonStr = JSONObject.toJSONString(nrStationInfo);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("StationInfo", jsonStr); data.put("StationInfo", nrStationInfo);
String jsonString = JSONObject.toJSONString(data); String jsonString = data.toString();
System.out.println("jsonString : " + jsonString); System.out.println("jsonString : " + jsonString);
// 获取令牌 // 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
System.out.println(token);
String result = HttpRequestUtil.nrSendPost(token, jsonString, url, dataSecret String result = HttpRequestUtil.nrSendPost(token, jsonString, url, dataSecret
, dataSecretIv, operatorId, signSecret); , dataSecretIv, operatorId, signSecret);
@@ -244,9 +249,9 @@ public class NRServiceImpl implements NRService {
for (PileStationInfo pileStationInfo : pageInfo.getList()) { for (PileStationInfo pileStationInfo : pageInfo.getList()) {
// 拼装参数 // 拼装参数
NRStationInfo nrStationInfo = NRStationInfo.builder() NRStationInfo nrStationInfo = NRStationInfo.builder()
.stationId(String.valueOf(pileStationInfo.getId())) .stationId("NR" + pileStationInfo.getId())
.operatorID(Constants.OPERATORID_LIANLIAN) .operatorID(Constants.OPERATORID_JIANG_SU)
.equipmentOwnerID(Constants.OPERATORID_LIANLIAN) .equipmentOwnerID(Constants.OPERATORID_JIANG_SU)
.stationName(pileStationInfo.getStationName()) .stationName(pileStationInfo.getStationName())
.countryCode(pileStationInfo.getCountryCode()) .countryCode(pileStationInfo.getCountryCode())
.areaCode(pileStationInfo.getAreaCode()) .areaCode(pileStationInfo.getAreaCode())
@@ -352,7 +357,7 @@ public class NRServiceImpl implements NRService {
.connectorId(dto.getPileConnectorCode()) .connectorId(dto.getPileConnectorCode())
.alertTime(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS)) .alertTime(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS))
.alertCode(120) // 120-预留 .alertCode(120) // 120-预留
.describe(faultReason) .describe("急停按钮动作故障")
.status(status) .status(status)
.build(); .build();
@@ -361,9 +366,8 @@ public class NRServiceImpl implements NRService {
// 发送请求 // 发送请求
String url = urlAddress + "notification_alarmInfo"; String url = urlAddress + "notification_alarmInfo";
String jsonStr = JSONObject.toJSONString(nrAlarmInfos);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("AlarmInfos", jsonStr); data.put("AlarmInfos", nrAlarmInfos);
String jsonString = JSONObject.toJSONString(data); String jsonString = JSONObject.toJSONString(data);
System.out.println("jsonString : " + jsonString); System.out.println("jsonString : " + jsonString);
@@ -418,8 +422,8 @@ public class NRServiceImpl implements NRService {
NRConnectorStatusInfo nrConnectorStatusInfo = NRConnectorStatusInfo.builder() NRConnectorStatusInfo nrConnectorStatusInfo = NRConnectorStatusInfo.builder()
.connectorID(pileConnectorCode) .connectorID(pileConnectorCode)
.status(Integer.parseInt(connectorStatus)) .status(Integer.parseInt(connectorStatus))
.currentA(Integer.parseInt(realTimeMonitorData.getOutputCurrent())) .currentA(new BigDecimal(realTimeMonitorData.getOutputCurrent()).intValue())
.voltageA(Integer.parseInt(realTimeMonitorData.getOutputVoltage())) .voltageA(new BigDecimal(realTimeMonitorData.getOutputVoltage()).intValue())
.soc(BigDecimal.ZERO) .soc(BigDecimal.ZERO)
.beginTime(DateUtils.formatDateTime(orderBasicInfo.getChargeStartTime())) .beginTime(DateUtils.formatDateTime(orderBasicInfo.getChargeStartTime()))
.currentKwh(new BigDecimal(realTimeMonitorData.getChargingDegree()).setScale(3, BigDecimal.ROUND_HALF_UP)) .currentKwh(new BigDecimal(realTimeMonitorData.getChargingDegree()).setScale(3, BigDecimal.ROUND_HALF_UP))