This commit is contained in:
2023-05-26 09:23:22 +08:00
12 changed files with 370 additions and 123 deletions

View File

@@ -3,8 +3,10 @@ package com.jsowell.lianlian;
import com.alibaba.fastjson2.JSONObject;
import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.dto.LianLianPushStationInfoDTO;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO;
@@ -33,11 +35,20 @@ public class LianLianController extends BaseController {
private LianLianService lianLianService;
/**
* 推送充电站信息 notification_stationInfo
* http://localhost:8080/LianLian/pushStationInfo
* @param dto
* @return
*/
@PostMapping("/pushStationInfo")
public RestApiResponse<?> pushStationInfo(@RequestBody LianLianPushStationInfoDTO dto) {
logger.info("推送联联平台充电站信息 params:{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response = null;
try {
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
lianLianService.pushStationInfo(dto);
response = new RestApiResponse<>();
}catch (BusinessException e) {

View File

@@ -8,16 +8,19 @@ import com.jsowell.common.core.page.TableDataInfo;
import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.poi.ExcelUtil;
import com.jsowell.pile.domain.PileStationInfo;
import com.jsowell.pile.domain.ThirdPartySettingInfo;
import com.jsowell.pile.dto.FastCreateStationDTO;
import com.jsowell.pile.dto.LianLianPushStationInfoDTO;
import com.jsowell.pile.dto.QueryStationDTO;
import com.jsowell.pile.service.IPileStationInfoService;
import com.jsowell.pile.service.IThirdPartySettingInfoService;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.service.PileService;
import com.jsowell.thirdparty.service.LianLianService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@@ -43,6 +46,9 @@ public class PileStationInfoController extends BaseController {
@Autowired
private IThirdPartySettingInfoService thirdPartySettingInfoService;
@Autowired
private LianLianService lianLianService;
/**
* 查询充电站信息列表NEW
@@ -190,7 +196,7 @@ public class PileStationInfoController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
@PostMapping("/updateSettingByStationId")
public AjaxResult updateSettingByStationId(ThirdPartySettingInfo info) {
public AjaxResult updateSettingByStationId(@RequestBody ThirdPartySettingInfo info) {
return AjaxResult.success(thirdPartySettingInfoService.updateStationSettingInfo(info));
}
@@ -204,4 +210,34 @@ public class PileStationInfoController extends BaseController {
// public AjaxResult insertSettingInfo(ThirdPartySettingInfo info) {
// return AjaxResult.success(thirdPartySettingInfoService.insertThirdPartySettingInfo(info));
// }
/**
* 推送充电站信息 notification_stationInfo
* http://localhost:8080/LianLian/pushStationInfo
* @param dto
* @return
*/
@PostMapping("/pushStationInfo")
public RestApiResponse<?> pushStationInfo(@RequestBody LianLianPushStationInfoDTO dto) {
logger.info("推送联联平台充电站信息 params:{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response = null;
try {
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
lianLianService.pushStationInfo(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<>(e);
}
logger.info("推送联联平台充电站信息 result:{}", response);
return response;
}
}

View File

@@ -164,7 +164,7 @@ public class SpringBootTestController {
// LianLianGetTokenDTO dto = new LianLianGetTokenDTO();
// dto.setOperatorId("MA1JLFUU8");
// dto.setOperatorSecret("Nh62XxlIR5OjAzFj");
String token = lianLianService.getToken("MA1JLFUU8", "fGwLsxW1HdzLw7jp");
String token = lianLianService.getToken("", "MA1JLFUU8", "fGwLsxW1HdzLw7jp");
System.out.println("token:" + token);

View File

@@ -25,6 +25,12 @@ public class ThirdPartySettingInfo extends BaseEntity {
@Excel(name = "对接类型", readConverterExp = "1=-联联平台")
private String type;
/**
* 对接平台url地址
*/
@Excel(name = "url地址")
private String urlAddress;
/**
* 站点id
*/
@@ -82,6 +88,14 @@ public class ThirdPartySettingInfo extends BaseEntity {
return type;
}
public String getUrlAddress() {
return urlAddress;
}
public void setUrlAddress(String urlAddress) {
this.urlAddress = urlAddress;
}
public void setStationId(Long stationId) {
this.stationId = stationId;
}
@@ -143,6 +157,7 @@ public class ThirdPartySettingInfo extends BaseEntity {
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
.append("id", getId())
.append("type", getType())
.append("urlAddress", getType())
.append("stationId", getStationId())
.append("operatorId", getOperatorId())
.append("operatorSecret", getOperatorSecret())

View File

@@ -153,10 +153,10 @@ public interface IOrderBasicInfoService {
/**
* 获取充电实时数据
* @param orderCode 订单编
* @param transactionCode 交易流水
* @return
*/
List<RealTimeMonitorData> getChargingRealTimeData(String orderCode);
List<RealTimeMonitorData> getChargingRealTimeData(String transactionCode);
/**
* 首页订单数据展示

View File

@@ -113,6 +113,7 @@ public class ThirdPartySettingInfoServiceImpl implements IThirdPartySettingInfoS
return insertThirdPartySettingInfo(info);
}else {
// 修改
info.setId(infoByStationId.getId());
return updateThirdPartySettingInfo(info);
}
}

View File

@@ -7,6 +7,7 @@
<resultMap type="com.jsowell.pile.domain.ThirdPartySettingInfo" id="ThirdPartySettingInfoResult">
<result property="id" column="id" />
<result property="type" column="type" />
<result property="urlAddress" column="url_address" />
<result property="stationId" column="station_id" />
<result property="operatorId" column="operator_id" />
<result property="operatorSecret" column="operator_secret" />
@@ -21,18 +22,19 @@
</resultMap>
<sql id="selectThirdPartySettingInfoVo">
select id, type, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag from thirdparty_setting_info
select id, type, url_address, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag from thirdparty_setting_info
</sql>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, type, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag
id, type, url_address, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag
</sql>
<select id="selectThirdPartySettingInfoList" parameterType="com.jsowell.pile.domain.ThirdPartySettingInfo" resultMap="ThirdPartySettingInfoResult">
<include refid="selectThirdPartySettingInfoVo"/>
<where>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="urlAddress != null and type != ''"> and url_address = #{urlAddress}</if>
<if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
<if test="operatorId != null and operatorId != ''"> and operator_id = #{operatorId}</if>
<if test="operatorSecret != null and operatorSecret != ''"> and operator_secret = #{operatorSecret}</if>
@@ -51,6 +53,7 @@
insert into thirdparty_setting_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null">type,</if>
<if test="urlAddress != null">url_address,</if>
<if test="stationId != null">station_id,</if>
<if test="operatorId != null">operator_id,</if>
<if test="operatorSecret != null">operator_secret,</if>
@@ -65,6 +68,7 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null">#{type},</if>
<if test="urlAddress != null">#{urlAddress},</if>
<if test="stationId != null">#{stationId},</if>
<if test="operatorId != null">#{operatorId},</if>
<if test="operatorSecret != null">#{operatorSecret},</if>
@@ -83,6 +87,7 @@
update thirdparty_setting_info
<trim prefix="SET" suffixOverrides=",">
<if test="type != null">type = #{type},</if>
<if test="urlAddress != null">url_address = #{urlAddress},</if>
<if test="stationId != null">station_id = #{stationId},</if>
<if test="operatorId != null">operator_id = #{operatorId},</if>
<if test="operatorSecret != null">operator_secret = #{operatorSecret},</if>

View File

@@ -1,5 +1,6 @@
package com.jsowell.thirdparty.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -19,13 +20,15 @@ public class ConnectorChargeStatusInfo {
* 充电订单号 Y
* 对接平台系统订单编号
*/
private String StartChargeSeq;
@JSONField(name = "StartChargeSeq")
private String startChargeSeq;
/**
* 充电设备接口编码 Y
* 平台下唯一枪口号
*/
private String ConnectorID;
@JSONField(name = "ConnectorID")
private String connectorID;
/**
* 充电设备接口状态 Y
@@ -35,88 +38,103 @@ public class ConnectorChargeStatusInfo {
* 4占用预约锁定
* 255故障
*/
private Integer ConnectorStatus;
@JSONField(name = "ConnectorStatus")
private Integer connectorStatus;
/**
* 车辆识别码 N
* 车辆识别号码或车架号码由17位英数组成
*/
private String Vin;
@JSONField(name = "Vin")
private String vin;
/**
* A相电流 Y
* 单位A默认0 含直流(输出)
*/
private BigDecimal CurrentA;
@JSONField(name = "CurrentA")
private BigDecimal currentA;
/**
* B相电流 N
* 单位A默认0
*/
private BigDecimal CurrentB;
@JSONField(name = "CurrentB")
private BigDecimal currentB;
/**
* C相电流 N
* 单位A默认0
*/
private BigDecimal CurrentC;
@JSONField(name = "CurrentC")
private BigDecimal currentC;
/**
* A相电压 Y
* 单位V默认0含直流(输出)
*/
private BigDecimal VoltageA;
@JSONField(name = "VoltageA")
private BigDecimal voltageA;
/**
* B相电压 N
* 单位V默认0
*/
private BigDecimal VoltageB;
@JSONField(name = "VoltageB")
private BigDecimal voltageB;
/**
* C相电压 N
* 单位V默认0
*/
private BigDecimal VoltageC;
@JSONField(name = "VoltageC")
private BigDecimal voltageC;
/**
* 电池剩余电量(默认0) Y
*/
private BigDecimal Soc;
@JSONField(name = "Soc")
private BigDecimal soc;
/**
* 开始充电时间 Y
* 格式“yyyy-MM-dd HH:mm:ss”
*/
private String StartTime;
@JSONField(name = "StartTime")
private String startTime;
/**
* 本次采样时间 Y
* 格式“yyyy-MM-dd HH:mm:ss”
*/
private String EndTime;
@JSONField(name = "EndTime")
private String endTime;
/**
* 累计充电量 Y
* 单位小数点后2位
*/
private BigDecimal TotalPower;
@JSONField(name = "TotalPower")
private BigDecimal totalPower;
/**
* 累计电费 Y
* 单位小数点后2位
*/
private BigDecimal ElecMoney;
@JSONField(name = "ElecMoney")
private BigDecimal elecMoney;
/**
* 累计服务费 Y
* 单位小数点后2位
*/
private BigDecimal SeviceMoney;
@JSONField(name = "SeviceMoney")
private BigDecimal seviceMoney;
/**
* 累计总金额 Y
* 单位小数点后2位
*/
private BigDecimal TotalMoney;
@JSONField(name = "TotalMoney")
private BigDecimal totalMoney;
}

View File

@@ -18,7 +18,7 @@ public interface LianLianService {
* 根据充电站id推送充电站信息
* @param dto
*/
void pushStationInfo(LianLianPushStationInfoDTO dto);
String pushStationInfo(LianLianPushStationInfoDTO dto);
/**
* 联联平台获取充电站信息
@@ -74,11 +74,12 @@ public interface LianLianService {
/**
* 联联平台获取令牌
* @param urlAddress
* @param operatorId
* @param operatorSecret
* @return
*/
String getToken(String operatorId, String operatorSecret);
String getToken(String urlAddress, String operatorId, String operatorSecret);
/**
* 推送联联平台 设备状态变化推送
@@ -142,4 +143,11 @@ public interface LianLianService {
* @return
*/
String pushOrderReconciliationInfo(String orderCode);
/**
* 设备充电中状态变化推送
* @param pileConnectorCode
* @return
*/
String pushPileChargeStatusChange(String pileConnectorCode);
}

View File

@@ -42,7 +42,7 @@ import java.util.stream.Collectors;
@Service
public class LianLianServiceImpl implements LianLianService {
private static final String TEST_URL = "http://dataexchange.evchargeonline.com:81/shevcs/v1/"; // http://testdataexchange.evchargeonline.com:82/shevcs/v1/
// private static final String TEST_URL = "http://testdataexchange.evchargeonline.com:82/shevcs/v1/"; // http://testdataexchange.evchargeonline.com:82/shevcs/v1/
// private static final String OPERATOR_ID = "MA1JLFUU8"; // MA1JLFUU8 987654321
// private static final String OPERATOR_SECRET = "fGwLsxW1HdzLw7jp"; // fGwLsxW1HdzLw7jp 1234567890abcdef
// private static final String SIG_SECRET = "TmsdVaFVTtjzZbLi"; // 签名秘钥 TmsdVaFVTtjzZbLi 1234567890abcdef
@@ -92,11 +92,11 @@ public class LianLianServiceImpl implements LianLianService {
}
/**
* 根据站点id推送站点信息
* 根据站点id推送站点信息 notification_stationInfo
* @param dto
*/
@Override
public void pushStationInfo(LianLianPushStationInfoDTO dto){
public String pushStationInfo(LianLianPushStationInfoDTO dto){
// String OperatorID = "987654321";
// String SigSecret = "1234567890abcdef"; // 签名秘钥
// String DataSecret = "1234567890abcdef"; // 消息密钥
@@ -108,13 +108,14 @@ public class LianLianServiceImpl implements LianLianService {
// 通过站点id查询相关配置信息
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(dto.getStationId());
if (settingInfo == null) {
return;
throw new BusinessException("", "");
}
String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String urlAddress = settingInfo.getUrlAddress();
// 组装联联平台所需要的数据格式
StationInfo info = StationInfo.builder()
@@ -162,7 +163,7 @@ public class LianLianServiceImpl implements LianLianService {
}
// 调用联联平台接口
String url = TEST_URL + "notification_stationInfo";
String url = urlAddress + "notification_stationInfo";
String jsonStr = JSONObject.toJSONString(info);
JSONObject data = new JSONObject();
@@ -172,12 +173,12 @@ public class LianLianServiceImpl implements LianLianService {
System.out.println("jsonString : " + jsonString);
// 获取令牌
String token = getToken(operatorId, operatorSecret);
String token = getToken(urlAddress, operatorId, operatorSecret);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret
, dataSecretIv, operatorId, signSecret);
System.out.println(result);
// System.out.println(result);
return result;
}
public static void main(String[] args){
@@ -276,7 +277,7 @@ public class LianLianServiceImpl implements LianLianService {
// 充电中
ConnectorChargeStatusInfo info = new ConnectorChargeStatusInfo();
OrderBasicInfo orderBasicInfo = orderBasicInfoService.queryChargingByPileConnectorCode(connectorInfoVO.getPileConnectorCode());
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getOrderCode());
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode());
RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0);
info.setStartChargeSeq(orderBasicInfo.getOrderCode());
@@ -591,13 +592,13 @@ public class LianLianServiceImpl implements LianLianService {
* @return
*/
@Override
public String getToken(String operatorId, String operatorSecret) {
public String getToken(String urlAddress, String operatorId, String operatorSecret) {
// String operatorId = dto.getOperatorId();
// String operatorSecret = dto.getOperatorSecret();
String token = "";
try {
//测试用请求地址
String requestUrl = TEST_URL + "query_token";
String requestUrl = urlAddress + "query_token";
//请求data
Map<String, String> data = new HashMap<>();
@@ -640,7 +641,7 @@ public class LianLianServiceImpl implements LianLianService {
}
/**
* 联联平台推送 设备状态变化推送
* 联联平台推送 设备状态变化推送 notification_stationStatus
* @param pileConnectorCode
* @param status
* @return
@@ -660,11 +661,12 @@ public class LianLianServiceImpl implements LianLianService {
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String urlAddress = settingInfo.getUrlAddress();
String url = TEST_URL + "notification_stationStatus";
String url = urlAddress + "notification_stationStatus";
// 获取令牌
String token = getToken(operatorId, operatorSecret);
String token = getToken(urlAddress, operatorId, operatorSecret);
if (StringUtils.isBlank(token)) {
return null;
}
@@ -683,7 +685,7 @@ public class LianLianServiceImpl implements LianLianService {
}
/**
* 推送订单信息
* 推送订单信息 notification_orderInfo
* @param orderCode
* @return
*/
@@ -704,8 +706,9 @@ public class LianLianServiceImpl implements LianLianService {
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String urlAddress = settingInfo.getUrlAddress();
String url = TEST_URL + "notification_orderInfo";
String url = urlAddress + "notification_orderInfo";
// 拼装成联联平台所需格式对象
OrderInfo orderInfo = OrderInfo.builder()
@@ -790,7 +793,7 @@ public class LianLianServiceImpl implements LianLianService {
orderInfo.setChargeDetails(chargeDetails);
// 获取令牌
String token = getToken(operatorId, operatorSecret);
String token = getToken(urlAddress, operatorId, operatorSecret);
if (StringUtils.isBlank(token)) {
return null;
}
@@ -826,11 +829,12 @@ public class LianLianServiceImpl implements LianLianService {
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String urlAddress = settingInfo.getUrlAddress();
// 推送启动充电结果(调用接口 notification_start_charge_result)
String url = TEST_URL + "notification_start_charge_result";
String url = urlAddress + "notification_start_charge_result";
// 获取令牌
String token = getToken(operatorId, operatorSecret);
String token = getToken(urlAddress, operatorId, operatorSecret);
if (StringUtils.isBlank(token)) {
return null;
}
@@ -879,15 +883,16 @@ public class LianLianServiceImpl implements LianLianService {
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String urlAddress = settingInfo.getUrlAddress();
// 调用 查询充电状态方法
QueryChargingStatusVO vo = query_equip_charge_status(orderCode);
// 获取令牌
String token = getToken(operatorId, operatorSecret);
String token = getToken(urlAddress, operatorId, operatorSecret);
if (StringUtils.isBlank(token)) {
return null;
}
String url = TEST_URL + "notification_equip_charge_status";
String url = urlAddress + "notification_equip_charge_status";
// 调用联联平台接口
String jsonString = JSONObject.toJSONString(vo);
@@ -903,7 +908,7 @@ public class LianLianServiceImpl implements LianLianService {
*/
@Override
public String pushStopChargeResult(String orderCode) {
String url = TEST_URL + "notification_stop_charge_result";
// 根据订单号查询订单信息
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
if (orderInfo == null) {
@@ -919,6 +924,9 @@ public class LianLianServiceImpl implements LianLianService {
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String urlAddress = settingInfo.getUrlAddress();
String url = urlAddress + "notification_stop_charge_result";
String orderStatus = orderInfo.getOrderStatus();
String successFlag = "1";
@@ -933,7 +941,7 @@ public class LianLianServiceImpl implements LianLianService {
orderStatus = "5";
}
// 获取token
String token = getToken(operatorId, operatorSecret);
String token = getToken(urlAddress, operatorId, operatorSecret);
if (StringUtils.isBlank(token)) {
return null;
}
@@ -961,7 +969,7 @@ public class LianLianServiceImpl implements LianLianService {
*/
@Override
public String pushChargeOrderInfo(String orderCode) {
String url = TEST_URL + "notification_charge_order_info";
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
@@ -975,6 +983,9 @@ public class LianLianServiceImpl implements LianLianService {
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String urlAddress = settingInfo.getUrlAddress();
String url = urlAddress + "notification_charge_order_info";
JSONObject json = new JSONObject();
json.put("StartChargeSeq", orderCode);
@@ -988,7 +999,7 @@ public class LianLianServiceImpl implements LianLianService {
json.put("StopReason", 2); // 2BMS 停止充电
String jsonString = JSONObject.toJSONString(json);
String token = getToken(operatorId, operatorSecret);
String token = getToken(urlAddress, operatorId, operatorSecret);
if (token == null) {
return null;
}
@@ -1036,7 +1047,7 @@ public class LianLianServiceImpl implements LianLianService {
*/
@Override
public String queryOrderSettlementInfo(String orderCode) {
String url = TEST_URL + "query_order_settlement_info";
JSONObject json = new JSONObject();
json.put("StartChargeSeq", orderCode);
String jsonString = JSONObject.toJSONString(json);
@@ -1053,9 +1064,12 @@ public class LianLianServiceImpl implements LianLianService {
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String urlAddress = settingInfo.getUrlAddress();
String url = urlAddress + "query_order_settlement_info";
// 获取令牌
String token = getToken(operatorId, operatorSecret);
String token = getToken(urlAddress, operatorId, operatorSecret);
if (StringUtils.isBlank(token)){
return null;
}
@@ -1072,7 +1086,7 @@ public class LianLianServiceImpl implements LianLianService {
*/
@Override
public String pushOrderReconciliationInfo(String orderCode) {
String url = TEST_URL + "check_charge_orders";
List<ChargeOrder> list = new ArrayList<>();
// 根据订单号查询订单信息
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
@@ -1091,6 +1105,9 @@ public class LianLianServiceImpl implements LianLianService {
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String urlAddress = settingInfo.getUrlAddress();
String url = urlAddress + "check_charge_orders";
JSONObject json = new JSONObject();
json.put("CheckOrderSeq", orderCode);
@@ -1109,7 +1126,7 @@ public class LianLianServiceImpl implements LianLianService {
json.put("ChargeOrders", list);
// 获取令牌
String token = getToken(operatorId, operatorSecret);
String token = getToken(urlAddress, operatorId, operatorSecret);
if (StringUtils.isBlank(token)){
return null;
}
@@ -1120,6 +1137,61 @@ public class LianLianServiceImpl implements LianLianService {
return result;
}
/**
* 设备充电中状态变化推送 notification_connector_charge_status
* @param pileConnectorCode
* @return
*/
@Override
public String pushPileChargeStatusChange(String pileConnectorCode) {
// 根据枪口号查询充电实时状态
OrderBasicInfo orderBasicInfo = orderBasicInfoService.queryChargingByPileConnectorCode(pileConnectorCode);
List<RealTimeMonitorData> list = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode());
RealTimeMonitorData realTimeMonitorData = list.get(0);
// 拼装联联参数
ConnectorChargeStatusInfo info = ConnectorChargeStatusInfo.builder()
.startChargeSeq(orderBasicInfo.getOrderCode())
.connectorID(pileConnectorCode)
.connectorStatus(Integer.valueOf(realTimeMonitorData.getConnectorStatus()))
.currentA(new BigDecimal(realTimeMonitorData.getOutputCurrent()))
.voltageA(new BigDecimal(realTimeMonitorData.getOutputVoltage()))
.soc(new BigDecimal(realTimeMonitorData.getSOC()))
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()))
.endTime(DateUtils.getTime())
.totalPower(new BigDecimal(realTimeMonitorData.getChargingDegree()))
.elecMoney(new BigDecimal("0")) // TODO
.seviceMoney(new BigDecimal("0")) // TODO
.totalMoney(new BigDecimal(realTimeMonitorData.getChargingAmount()).setScale(2, BigDecimal.ROUND_HALF_UP))
.build();
// 通过站点id查询相关配置信息
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
if (settingInfo == null) {
return null;
}
String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String urlAddress = settingInfo.getUrlAddress();
String url = urlAddress + "notification_connector_charge_status";
// 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret);
if (StringUtils.isBlank(token)){
return null;
}
String jsonString = JSONObject.toJSONString(info);
// 发送请求
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
/**
* TODO 请求打印充电小票
*/

View File

@@ -110,3 +110,11 @@ export function updateSettingByStationId(data) {
// data: data,
// })
// }
export function pushStationInfo(data) {
return request({
url: "/pile/station/pushStationInfo",
method: "post",
data: data,
})
}

View File

@@ -31,71 +31,87 @@
<billing ref="billing" :stationId="stationId"/>
</el-tab-pane>
<!-- <el-tab-pane label="客户管理" name="member">-->
<!-- 角色管理-->
<!-- </el-tab-pane>-->
<!-- <el-tab-pane label="客户管理" name="member">-->
<!-- 角色管理-->
<!-- </el-tab-pane>-->
<el-tab-pane label="运营管理" name="operation">
<el-card style="margin-bottom:10px">
<h2>二维码配置</h2>
<el-form label-position="right" label-width="200px" style="margin-top:10px">
<el-row>
<el-col span="12">
<el-form-item label="当前配置二维码规则:">
<el-input v-model="stationDetail.qrcodePrefix" maxlength="100px" :disabled="true"/>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item>
<el-button icon="el-icon-setting" size="big" @click="handleCreate" v-has-permi = "['pile:station:edit']">配置参数</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card>
<h2>互联互通配置</h2>
<el-card style="margin-bottom:10px">
<h2>二维码配置</h2>
<el-form label-position="right" label-width="200px" style="margin-top:10px">
<el-row>
<el-col :span="12">
<el-form-item label="运营商ID">
<el-input placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运营商密钥">
<el-input placeholder="请输入" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="消息Data密钥:">
<el-input placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="签名密钥">
<el-input placeholder="请输入" />
</el-form-item>
</el-col>
</el-row>
<el-row >
<el-col :span="12">
<el-form-item label="消息Data密钥初始化向量">
<el-input placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<el-button size="big">提交</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-row>
<el-col span="12">
<el-form-item label="当前配置二维码规则:">
<el-input v-model="stationDetail.qrcodePrefix" maxlength="100px" :disabled="true"/>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item>
<el-button icon="el-icon-setting" size="big" @click="handleCreate"
v-has-permi="['pile:station:edit']">配置参数
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card>
<h2>互联互通配置</h2>
<el-button icon="el-icon-edit" size="big" @click="openEdit" v-has-permi="['pile:station:edit']">编辑参数
</el-button>
<el-form ref="stationSettingForm" :model="stationSettingInfo" label-position="right" label-width="200px"
style="margin-top:10px">
<el-row>
<el-col :span="12">
<el-form-item label="对接平台名称" prop="type">
<el-input placeholder="请输入" v-model="stationSettingInfo.type" :disabled="disableFlag"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="对接平台url地址" prop="urlAddress">
<el-input placeholder="请输入" v-model="stationSettingInfo.urlAddress" :disabled="disableFlag"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运营商ID" prop="operatorId">
<el-input placeholder="请输入" v-model="stationSettingInfo.operatorId" :disabled="disableFlag"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运营商密钥" prop="operatorSecret">
<el-input placeholder="请输入" v-model="stationSettingInfo.operatorSecret" :disabled="disableFlag"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="消息Data密钥:" prop="dataSecret">
<el-input placeholder="请输入" v-model="stationSettingInfo.dataSecret" :disabled="disableFlag"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="签名密钥" prop="signSecret">
<el-input placeholder="请输入" v-model="stationSettingInfo.signSecret" :disabled="disableFlag"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="消息Data密钥初始化向量" prop="dataSecretIv">
<el-input placeholder="请输入" v-model="stationSettingInfo.dataSecretIv" :disabled="disableFlag"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<el-button size="big" @click="submitConfigForm" v-has-permi="['pile:station:edit']">提交</el-button>
<el-button size="big" @click="pushStation" v-has-permi="['pile:station:edit']">推送站点信息</el-button>
<!-- <el-button icon="el-icon-edit" size="big" @click="openEdit" v-has-permi = "['pile:station:edit']" >编辑参数</el-button>-->
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</el-tab-pane>
<el-tab-pane label="站点白名单" name="whitelist">
@@ -125,7 +141,13 @@ import pileList from "./pileList.vue";
import MapContainer from "../../../components/MapContainer/MapContainer.vue";
import stationOrderList from "@/views/pile/station/stationOrderList";
import stationWhiteList from "@/views/pile/station/stationWhiteList";
import {getStationInfo, updateStationQRCodePrefix} from "@/api/pile/station";
import {
getStationInfo,
updateStationQRCodePrefix,
getSettingByStationId,
updateSettingByStationId,
pushStationInfo
} from "@/api/pile/station";
import Whitelist from "@/views/pile/station/stationWhiteList";
export default {
@@ -151,8 +173,10 @@ export default {
stationId: this.$route.params.id,
stationName: this.$route.params.stationName,
stationDetail: {},
stationLat:null,
stationLng:null
stationLat: null,
stationLng: null,
stationSettingInfo: {},
disableFlag: true,
};
},
created() {
@@ -160,9 +184,10 @@ export default {
// const stationId = this.stationId;
const stationName = this.stationName;
const title = "【" + stationName + "】站点详情";
const route = Object.assign({}, this.$route, { title: `${title}` })
const route = Object.assign({}, this.$route, {title: `${title}`})
this.$store.dispatch('tagsView/updateVisitedView', route);
this.queryStationInfo();
this.getStationSettingInfo();
},
mounted() {
this.initializeData(this.activeName);
@@ -195,10 +220,58 @@ export default {
this.stationDetail = res.data;
this.stationLat = res.data.stationLat
this.stationLng = res.data.stationLng
console.log(this.stationLat,this.stationLng,"父组件里面的经纬度")
console.log(this.stationLat, this.stationLng, "父组件里面的经纬度")
});
console.log("queryStationInfo==", this.stationDetail);
},
// 查询站点互联互通配置信息
getStationSettingInfo() {
getSettingByStationId(this.stationId).then((res) => {
console.log("stationId:", this.stationId)
console.log("getSettingByStationId==", res)
this.stationSettingInfo = res.data;
})
},
// 开放编辑按钮
openEdit() {
this.disableFlag = false;
},
// 提交配置设置
submitConfigForm() {
const param = {
stationId: this.stationId,
urlAddress: this.stationSettingInfo.urlAddress,
operatorId: this.stationSettingInfo.operatorId,
operatorSecret: this.stationSettingInfo.operatorSecret,
dataSecret: this.stationSettingInfo.dataSecret,
signSecret: this.stationSettingInfo.signSecret,
dataSecretIv: this.stationSettingInfo.dataSecretIv,
}
console.log("param:", param);
this.$refs.stationSettingForm.validate((valid) => {
if (valid) {
updateSettingByStationId(param).then((response) => {
this.$modal.msgSuccess('修改成功')
this.disableFlag = true;
})
} else {
return false
}
})
},
// 推送站点
pushStation() {
const param = {
stationId: this.stationId,
}
pushStationInfo(param).then((response) => {
this.$modal.msgSuccess('推送成功')
this.disableFlag = true;
})
},
// 配置参数按钮
handleCreate() {
this.dialogTitle = '配置参数';
@@ -216,12 +289,12 @@ export default {
console.log("form:", this.form);
console.log("param:", param);
this.$refs.form.validate((valid) => {
if(valid){
if (valid) {
updateStationQRCodePrefix(param).then((response) => {
this.$modal.msgSuccess('修改成功')
this.dialogFormVisible = false
})
} else{
} else {
return false
}
})