|
|
@@ -12,6 +12,9 @@ import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
import static com.zsElectric.boot.common.constant.ConnectivityConstants.FAIL_REASON_NONE;
|
|
|
import static com.zsElectric.boot.common.constant.ConnectivityConstants.STATUS_OK;
|
|
|
import static com.zsElectric.boot.common.util.HmacMD5Util.genSign;
|
|
|
@@ -170,4 +173,42 @@ public class ChargingReceptionServiceImpl implements ChargingReceptionService {
|
|
|
.setSig(genSign);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResponseParmsEntity stationStatus(RequestParmsEntity requestDTO) {
|
|
|
+ log.info("接收设备状态变化推送请求参数:{}", requestDTO);
|
|
|
+ String encryptData = "";
|
|
|
+ String genSign = "";
|
|
|
+ ResponseParmsEntity responseParmsEntity = new ResponseParmsEntity();
|
|
|
+
|
|
|
+ try {
|
|
|
+ String data = requestDTO.getOperatorID() + requestDTO.getData() + requestDTO.getTimeStamp() + requestDTO.getSeq();
|
|
|
+ if (verify(data, ConnectivityConstants.SIG_SECRET, requestDTO.getSig())) {
|
|
|
+ String decryptData = chargingUtil.decryptData(requestDTO.getData());
|
|
|
+ log.info("解密后的数据:{}", decryptData);
|
|
|
+
|
|
|
+ // todo 业务代码待处理
|
|
|
+
|
|
|
+ Map<String, Integer> statusMap = new HashMap<>();
|
|
|
+ statusMap.put("Status", 0);
|
|
|
+ encryptData = chargingUtil.encryptData(new Gson().toJson(statusMap));
|
|
|
+ genSign = genSign(STATUS_OK, "", encryptData, ConnectivityConstants.SIG_SECRET);
|
|
|
+
|
|
|
+ responseParmsEntity
|
|
|
+ .setRet(STATUS_OK)
|
|
|
+ .setMsg("")
|
|
|
+ .setData(encryptData)
|
|
|
+ .setSig(genSign);
|
|
|
+ } else {
|
|
|
+ log.error("数据验签失败");
|
|
|
+ throw new BusinessException("数据验签失败");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("数据解密失败:{}", e.getMessage());
|
|
|
+ throw new BusinessException("数据解密失败:" + e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
+ return responseParmsEntity;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|