mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-10 10:19:54 +08:00
将推送第三方平台改为可推送多个平台
This commit is contained in:
@@ -27,6 +27,7 @@ import com.jsowell.pile.service.PileStationInfoService;
|
||||
import com.jsowell.pile.service.ThirdPartyParkingConfigService;
|
||||
import com.jsowell.pile.service.ThirdPartyStationRelationService;
|
||||
import com.jsowell.pile.service.ThirdPartySettingInfoService;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.service.PileService;
|
||||
import com.jsowell.thirdparty.huawei.HuaWeiService;
|
||||
@@ -242,11 +243,13 @@ public class PileStationInfoController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@GetMapping("/getSettingByStationId/{stationId}")
|
||||
public AjaxResult getSettingByStationId(@PathVariable("stationId") Long id) {
|
||||
ThirdPartyStationRelation info = new ThirdPartyStationRelation();
|
||||
info.setStationId(id);
|
||||
return AjaxResult.success(thirdPartyStationRelationService.selectRelationInfo(info));
|
||||
@GetMapping("/getRelationByStationId/{stationId}")
|
||||
public TableDataInfo getSettingByStationId(@PathVariable("stationId") Long id) {
|
||||
List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id));
|
||||
for (ThirdPartyStationRelationVO vo : list) {
|
||||
vo.setThirdPartyType(ThirdPlatformTypeEnum.getLabelByCode(vo.getThirdPartyType()));
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,8 +259,10 @@ public class PileStationInfoController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@PostMapping("/getSettingInfo")
|
||||
public AjaxResult getSettingInfo(@RequestBody ThirdPartySettingInfo info) {
|
||||
return AjaxResult.success(thirdPartySettingInfoService.selectSettingInfo(info));
|
||||
public TableDataInfo getSettingInfo(@RequestBody ThirdPartySettingInfo info) {
|
||||
List<ThirdPartySettingInfo> infos = thirdPartySettingInfoService.selectThirdPartySettingInfoList(info);
|
||||
return getDataTable(infos);
|
||||
// return AjaxResult.success(thirdPartySettingInfoService.selectSettingInfo(info));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,28 +306,32 @@ public class PileStationInfoController extends BaseController {
|
||||
String result = "";
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) {
|
||||
// 推送联联
|
||||
result = lianLianService.pushStationInfo(dto);
|
||||
// result = lianLianService.pushStationInfo(dto);
|
||||
result = lianLianService.pushStationInfoV2(dto);
|
||||
}
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) {
|
||||
// 中电联
|
||||
result = zdlService.pushStationInfo(dto);
|
||||
// result = zdlService.pushStationInfo(dto);
|
||||
result = zdlService.pushStationInfoV2(dto);
|
||||
}
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), dto.getThirdPartyType())) {
|
||||
// 江苏省平台
|
||||
result = nrService.pushStationInfo(dto);
|
||||
// result = nrService.pushStationInfo(dto);
|
||||
result = nrService.pushStationInfoV2(dto);
|
||||
}
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), dto.getThirdPartyType())) {
|
||||
// 甬城泊车平台
|
||||
result = ycbcService.pushStationInfo(dto);
|
||||
// result = ycbcService.pushStationInfo(dto);
|
||||
result = ycbcService.pushStationInfoV2(dto);
|
||||
}
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), dto.getThirdPartyType())) {
|
||||
// 新电途平台
|
||||
result = xdtService.pushStationInfo(dto);
|
||||
}
|
||||
if(StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), dto.getThirdPartyType())) {
|
||||
// 华为
|
||||
result = huaWeiService.notificationOperationSystemInfo(dto);
|
||||
xdtService.pushStationInfo(dto);
|
||||
}
|
||||
// if(StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), dto.getThirdPartyType())) {
|
||||
// // 华为
|
||||
// result = huaWeiService.notificationOperationSystemInfo(dto);
|
||||
// }
|
||||
response = new RestApiResponse<>(result);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("推送第三方平台充电站信息 error",e);
|
||||
@@ -331,10 +340,7 @@ public class PileStationInfoController extends BaseController {
|
||||
logger.error("推送第三方平台充电站信息 error", e);
|
||||
response = new RestApiResponse<>("推送失败,请联系管理员");
|
||||
// 删除对应配置信息
|
||||
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
|
||||
relation.setStationId(dto.getStationId());
|
||||
relation.setDelFlag(DelFlagEnum.DELETE.getValue());
|
||||
thirdPartyStationRelationService.updateThirdPartyStationRelation(relation);
|
||||
thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(dto.getStationId()), dto.getThirdPartyType());
|
||||
}
|
||||
logger.info("推送第三方平台充电站信息 result:{}", response);
|
||||
return response;
|
||||
|
||||
@@ -36,10 +36,10 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: jsowell_dev
|
||||
# url: jdbc:mysql://192.168.2.2:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: jsowell_prd_copy
|
||||
# url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: jsowell_dev
|
||||
url: jdbc:mysql://192.168.2.2:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: jsowell_prd_copy
|
||||
password: 123456
|
||||
# 从库数据源
|
||||
slave:
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.jsowell.common.util.StringUtils;
|
||||
* @Date 2023/10/23 8:21:33
|
||||
*/
|
||||
public enum ThirdPlatformTypeEnum {
|
||||
LIAN_LIAN_PLATFORM("1", "联联平台"),
|
||||
LIAN_LIAN_PLATFORM("1", "上海联联平台"),
|
||||
ZHONG_DIAN_LIAN_PLATFORM("2", "中电联平台"),
|
||||
JIANG_SU_PLATFORM("3", "江苏省平台"),
|
||||
YONG_CHENG_BO_CHE("4", "甬城泊车平台"),
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.jsowell.pile.domain.ThirdPartyStationRelation;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@@ -68,4 +69,20 @@ public interface ThirdPartyStationRelationMapper {
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteThirdPartyStationRelationByIds(Long[] ids);
|
||||
|
||||
|
||||
/**
|
||||
* 通过站点id查询该站点对接了哪些第三方平台
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
List<ThirdPartyStationRelationVO> getRelationInfoList(@Param("stationId") String stationId);
|
||||
|
||||
/**
|
||||
* 修改删除标识为1
|
||||
* @param stationId
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
int updateRelationDelFlag(@Param("stationId") String stationId, @Param("type") String type);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,13 @@ public interface ThirdPartyStationRelationService {
|
||||
*/
|
||||
ThirdPartyStationRelationVO selectRelationInfo(ThirdPartyStationRelation thirdPartyStationRelation);
|
||||
|
||||
/**
|
||||
* 通过站点id查询该站点对接了哪些第三方平台
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
List<ThirdPartyStationRelationVO> getRelationInfoList(String stationId);
|
||||
|
||||
/**
|
||||
* 新增站点、第三方推送平台配置对应
|
||||
*
|
||||
@@ -66,4 +73,6 @@ public interface ThirdPartyStationRelationService {
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteThirdPartyStationRelationById(Long id);
|
||||
|
||||
int updateRelationDelFlag(String stationId, String type);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,16 @@ public class ThirdPartyStationRelationServiceImpl implements ThirdPartyStationRe
|
||||
return thirdPartyStationRelationMapper.selectRelationInfo(thirdPartyStationRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过站点id查询该站点对接了哪些第三方平台
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ThirdPartyStationRelationVO> getRelationInfoList(String stationId) {
|
||||
return thirdPartyStationRelationMapper.getRelationInfoList(stationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增站点、第三方推送平台配置对应
|
||||
*
|
||||
@@ -99,4 +109,9 @@ public class ThirdPartyStationRelationServiceImpl implements ThirdPartyStationRe
|
||||
public int deleteThirdPartyStationRelationById(Long id) {
|
||||
return thirdPartyStationRelationMapper.deleteThirdPartyStationRelationById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateRelationDelFlag(String stationId, String type) {
|
||||
return thirdPartyStationRelationMapper.updateRelationDelFlag(stationId, type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,14 +123,13 @@
|
||||
<select id="selectThirdInfo" resultMap="ThirdPartySettingInfoResult">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from thirdparty_setting_info
|
||||
<where>
|
||||
where del_flag = '0'
|
||||
<if test="stationId != null">
|
||||
and station_id = #{stationId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and type = #{type,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</where>
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -102,4 +102,31 @@
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getRelationInfoList" resultType="com.jsowell.pile.vo.base.ThirdPartyStationRelationVO">
|
||||
select
|
||||
t1.station_id as stationId,
|
||||
t1.third_party_type as thirdPartyType,
|
||||
t2.url_address as urlAddress,
|
||||
t2.operator_id as operatorId,
|
||||
t2.operator_secret as operatorSecret,
|
||||
t2.sign_secret as signSecret,
|
||||
t2.data_secret as dataSecret,
|
||||
t2.data_secret_IV as dataSecretIv
|
||||
from thirdparty_station_relation t1 join thirdparty_setting_info t2 on t1.third_party_type = t2.type
|
||||
where t1.del_flag = '0'
|
||||
<if test="stationId != null">
|
||||
and t1.station_id = #{stationId,jdbcType=BIGINT}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="updateRelationDelFlag">
|
||||
update
|
||||
thirdparty_station_relation
|
||||
set
|
||||
del_flag = '1'
|
||||
where
|
||||
station_id = #{stationId,jdbcType=VARCHAR}
|
||||
and third_party_type = #{type,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
||||
37
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java
vendored
Normal file
37
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.jsowell.thirdparty.common;
|
||||
|
||||
import com.jsowell.pile.domain.ThirdPartyStationRelation;
|
||||
import com.jsowell.pile.dto.PushStationInfoDTO;
|
||||
import com.jsowell.pile.service.ThirdPartyStationRelationService;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2024/1/18 15:11:32
|
||||
*/
|
||||
@Service
|
||||
public class CommonService {
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
|
||||
/**
|
||||
* 将站点--第三方平台类型对应关系存入关系表
|
||||
* @param dto
|
||||
*/
|
||||
public void insertInfo2DataBase(PushStationInfoDTO dto) {
|
||||
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
|
||||
relation.setStationId(dto.getStationId());
|
||||
relation.setThirdPartyType(dto.getThirdPartyType());
|
||||
ThirdPartyStationRelationVO vo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
||||
if (vo != null) {
|
||||
return;
|
||||
}
|
||||
// 新增数据库
|
||||
thirdPartyStationRelationService.insertThirdPartyStationRelation(relation);
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ public interface LianLianService {
|
||||
*/
|
||||
String pushStationInfo(PushStationInfoDTO dto);
|
||||
|
||||
String pushStationInfoV2(PushStationInfoDTO dto);
|
||||
|
||||
/**
|
||||
* 联联平台获取充电站信息
|
||||
* @param dto
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.thirdparty.common.CommonService;
|
||||
import com.jsowell.thirdparty.lianlian.domain.*;
|
||||
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
||||
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
||||
@@ -107,6 +108,9 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@Override
|
||||
public void pushMerchantInfo(Long merchantId) {
|
||||
// 通过id查询运营商信息
|
||||
@@ -251,6 +255,124 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public String pushStationInfoV2(PushStationInfoDTO dto) {
|
||||
// String OperatorID = "987654321";
|
||||
// String SigSecret = "1234567890abcdef"; // 签名秘钥
|
||||
// String DataSecret = "1234567890abcdef"; // 消息密钥
|
||||
// String DataSecretIV = "1234567890abcdef"; // 消息密钥初始化向量
|
||||
// String token = "c548f9276c1c4ea8b88b1f7b1eb7cf07"; //QueryToken类查询接口获取到的token
|
||||
|
||||
// 通过id查询站点相关信息
|
||||
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(dto.getStationId());
|
||||
// 通过第三方配置类型查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = new ThirdPartySettingInfo();
|
||||
settingInfo.setType(dto.getThirdPartyType());
|
||||
ThirdPartySettingInfo thirdPartySettingInfo = thirdPartySettingInfoService.selectSettingInfo(settingInfo);
|
||||
|
||||
String operatorId = thirdPartySettingInfo.getOperatorId();
|
||||
String operatorSecret = thirdPartySettingInfo.getOperatorSecret();
|
||||
String signSecret = thirdPartySettingInfo.getSignSecret();
|
||||
String dataSecret = thirdPartySettingInfo.getDataSecret();
|
||||
String dataSecretIv = thirdPartySettingInfo.getDataSecretIv();
|
||||
String urlAddress = thirdPartySettingInfo.getUrlAddress();
|
||||
|
||||
// 组装联联平台所需要的数据格式
|
||||
StationInfo info = StationInfo.builder()
|
||||
.stationID("LC" +dto.getStationId())
|
||||
.operatorID(operatorId)
|
||||
// .equipmentOwnerID(Constants.OPERATORID_LIANLIAN)
|
||||
.stationName(pileStationInfo.getStationName())
|
||||
.isAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
|
||||
.isPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()))
|
||||
.countryCode(pileStationInfo.getCountryCode())
|
||||
// .areaCode(pileStationInfo.getAreaCode())
|
||||
.address(pileStationInfo.getAddress())
|
||||
.serviceTel(pileStationInfo.getStationTel())
|
||||
.stationType(Integer.valueOf(pileStationInfo.getStationType()))
|
||||
.stationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
|
||||
.parkNums(Integer.valueOf(pileStationInfo.getParkNums()))
|
||||
.stationLng(new BigDecimal(pileStationInfo.getStationLng()))
|
||||
.stationLat(new BigDecimal(pileStationInfo.getStationLat()))
|
||||
.construction(Integer.valueOf(pileStationInfo.getConstruction()))
|
||||
.openAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay()))
|
||||
.minElectricityPrice(new BigDecimal(Constants.ZERO))
|
||||
.electricityFee(Constants.ZERO)
|
||||
.serviceFee(Constants.ZERO)
|
||||
.parkFree(Integer.valueOf(pileStationInfo.getParkFree()))
|
||||
// .ParkFee("2")
|
||||
.supportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()))
|
||||
.parkFeeType(0)
|
||||
.toiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()))
|
||||
.storeFlag(Integer.valueOf(pileStationInfo.getStoreFlag()))
|
||||
.restaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()))
|
||||
.loungeFlag(Integer.valueOf(pileStationInfo.getLoungeFlag()))
|
||||
.canopyFlag(Integer.valueOf(pileStationInfo.getCanopyFlag()))
|
||||
.printerFlag(Integer.valueOf(pileStationInfo.getPrinterFlag()))
|
||||
.barrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag()))
|
||||
.parkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag()))
|
||||
|
||||
.build();
|
||||
String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213
|
||||
// 根据逗号分组
|
||||
String[] split = StringUtils.split(areaCode, ",");
|
||||
// 只取最后一部分 330213
|
||||
String subAreaCode = split[split.length - 1];
|
||||
info.setAreaCode(subAreaCode);
|
||||
// 截取运营商组织机构代码(去除最后一位后的最后九位)
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId()));
|
||||
String organizationCode = merchantInfo.getOrganizationCode();
|
||||
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
||||
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
||||
info.setEquipmentOwnerID(equipmentOwnerId);
|
||||
}
|
||||
if (StringUtils.equals("36", String.valueOf(pileStationInfo.getMerchantId()))) {
|
||||
// 远大
|
||||
info.setEquipmentOwnerID(Constants.OPERATORID_YUAN_DA);
|
||||
}
|
||||
if (StringUtils.equals("35", String.valueOf(pileStationInfo.getMerchantId()))) {
|
||||
// 如果是希晓运营商,则把equipmentOwnerID换成希晓
|
||||
info.setEquipmentOwnerID(Constants.OPERATORID_XI_XIAO);
|
||||
}
|
||||
String payment = StationPaymentEnum.getPaymentByCode(pileStationInfo.getPayment());
|
||||
info.setPayment(payment);
|
||||
if (StringUtils.isNotBlank(pileStationInfo.getParkingNumber())) {
|
||||
info.setIsPublicParkingLot(1);
|
||||
info.setParkingLotNumber(pileStationInfo.getParkingNumber());
|
||||
}
|
||||
// 户号
|
||||
if (StringUtils.isNotBlank(pileStationInfo.getAccountNumber())) {
|
||||
info.setAccountNumber(pileStationInfo.getAccountNumber());
|
||||
}
|
||||
// 容量
|
||||
if (StringUtils.isNotBlank(String.valueOf(pileStationInfo.getCapacity()))) {
|
||||
info.setCapacity(pileStationInfo.getCapacity().setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
List<EquipmentInfo> pileList = getPileList(pileStationInfo);
|
||||
if (CollectionUtils.isNotEmpty(pileList)) {
|
||||
info.setEquipmentInfos(pileList); // 充电设备信息列表
|
||||
}
|
||||
|
||||
// 调用联联平台接口
|
||||
String url = urlAddress + "notification_stationInfo";
|
||||
|
||||
String jsonStr = JSONObject.toJSONString(info);
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("StationInfo", jsonStr);
|
||||
|
||||
String jsonString = JSONObject.toJSONString(data);
|
||||
System.out.println("jsonString : " + jsonString);
|
||||
|
||||
// 获取令牌
|
||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret
|
||||
, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
// 新增数据库
|
||||
commonService.insertInfo2DataBase(dto);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws UnsupportedEncodingException {
|
||||
String dataSecret = "KnGhAb88GtUEPb0j"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO
|
||||
String dataSecretIV = "XZ4wURhuo2y8s4ZS"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR
|
||||
|
||||
@@ -54,6 +54,9 @@ public interface NRService {
|
||||
public String pushStationInfo(PushStationInfoDTO dto) throws ParseException;
|
||||
|
||||
|
||||
public String pushStationInfoV2(PushStationInfoDTO dto) throws ParseException;
|
||||
|
||||
|
||||
/**
|
||||
* 获取充电站信息
|
||||
* @param dto
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.jsowell.pile.vo.uniapp.CurrentTimePriceDetails;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.thirdparty.common.CommonService;
|
||||
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
||||
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
||||
import com.jsowell.thirdparty.lianlian.util.Cryptos;
|
||||
@@ -86,9 +87,15 @@ public class NRServiceImpl implements NRService {
|
||||
@Autowired
|
||||
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartySettingInfoService thirdPartySettingInfoService;
|
||||
|
||||
@Autowired
|
||||
private LianLianService lianLianService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@@ -235,6 +242,110 @@ public class NRServiceImpl implements NRService {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public String pushStationInfoV2(PushStationInfoDTO dto) throws ParseException {
|
||||
PileStationVO stationInfoVO = pileStationInfoService.getStationInfo(String.valueOf(dto.getStationId()));
|
||||
if (stationInfoVO == null) {
|
||||
return null;
|
||||
}
|
||||
// 通过第三方配置类型查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = new ThirdPartySettingInfo();
|
||||
settingInfo.setType(dto.getThirdPartyType());
|
||||
ThirdPartySettingInfo thirdPartySettingInfo = thirdPartySettingInfoService.selectSettingInfo(settingInfo);
|
||||
|
||||
String operatorId = thirdPartySettingInfo.getOperatorId();
|
||||
String operatorSecret = thirdPartySettingInfo.getOperatorSecret();
|
||||
String signSecret = thirdPartySettingInfo.getSignSecret();
|
||||
String dataSecret = thirdPartySettingInfo.getDataSecret();
|
||||
String dataSecretIv = thirdPartySettingInfo.getDataSecretIv();
|
||||
String urlAddress = thirdPartySettingInfo.getUrlAddress();
|
||||
|
||||
// 拼装南瑞平台所需参数
|
||||
NRStationInfo nrStationInfo = NRStationInfo.builder()
|
||||
.stationId(String.valueOf(stationInfoVO.getId()))
|
||||
.operatorID(Constants.OPERATORID_JIANG_SU)
|
||||
// .equipmentOwnerID(Constants.OPERATORID_JIANG_SU)
|
||||
.stationName(stationInfoVO.getStationName())
|
||||
.countryCode(stationInfoVO.getCountryCode())
|
||||
// .areaCode()
|
||||
.address(stationInfoVO.getAddress())
|
||||
.serviceTel(stationInfoVO.getStationTel())
|
||||
.stationStatus(stationInfoVO.getStationStatus())
|
||||
.parkNums(0)
|
||||
.stationLng(new BigDecimal(stationInfoVO.getStationLng()).setScale(6, BigDecimal.ROUND_HALF_UP))
|
||||
.stationLat(new BigDecimal(stationInfoVO.getStationLat()).setScale(6, BigDecimal.ROUND_HALF_UP))
|
||||
.openForBusinessDate(DateUtils.convertDateTimeToDate(stationInfoVO.getCreateTime()))
|
||||
.openAllDay(Integer.parseInt(stationInfoVO.getOpenAllDay()))
|
||||
.busineHours(stationInfoVO.getBusinessHours())
|
||||
.minElectricityPrice(stationInfoVO.getElectricityPrice().add(stationInfoVO.getServicePrice()))
|
||||
.loungeFlag(0)
|
||||
.isAloneApply(0)
|
||||
.printerFlag(0)
|
||||
.parkFree(0)
|
||||
.isPublicParkingLot(0)
|
||||
.payment(1)
|
||||
.restaurantFlag(0)
|
||||
.barrierFlag(0)
|
||||
.serviceFee(stationInfoVO.getServicePrice())
|
||||
.parkingLockFlag(0)
|
||||
.electricityFee(stationInfoVO.getElectricityPrice())
|
||||
.storeFlag(0)
|
||||
.canopyFlag(0)
|
||||
.toiletFlag(0)
|
||||
.supportOrder(0)
|
||||
.parkFeeType(1)
|
||||
|
||||
.build();
|
||||
// 截取运营商组织机构代码(去除最后一位后的最后九位)
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(stationInfoVO.getMerchantId()));
|
||||
String organizationCode = merchantInfo.getOrganizationCode();
|
||||
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
||||
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
||||
nrStationInfo.setEquipmentOwnerID(equipmentOwnerId);
|
||||
}
|
||||
// 站点地址
|
||||
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())) {
|
||||
nrStationInfo.setPictures(stationInfoVO.getPictureList());
|
||||
}
|
||||
String stationType = stationInfoVO.getStationType();
|
||||
if (!StringUtils.equals("1", stationType) && !StringUtils.equals("255", stationType)) {
|
||||
// 不为1-公共并且不为255-其他,都为专用
|
||||
stationType = "2";
|
||||
}
|
||||
nrStationInfo.setStationType(Integer.parseInt(stationType));
|
||||
// 获取建设场所
|
||||
int jsConstructionCode = JiangSuConstructionEnum.getJSCodeByDataBaseCode(Integer.parseInt(stationInfoVO.getConstruction()));
|
||||
nrStationInfo.setConstruction(jsConstructionCode);
|
||||
|
||||
List<NREquipmentInfo> nrEquipmentInfos = getEquipmentInfo(String.valueOf(dto.getStationId()));
|
||||
nrStationInfo.setEquipmentInfos(nrEquipmentInfos);
|
||||
|
||||
// 推送到平台
|
||||
String url = urlAddress + "notification_stationInfo";
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("StationInfo", nrStationInfo);
|
||||
|
||||
String jsonString = data.toString();
|
||||
System.out.println("jsonString : " + jsonString);
|
||||
|
||||
// 获取令牌
|
||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||
System.out.println(token);
|
||||
String result = HttpRequestUtil.nrSendPost(token, jsonString, url, dataSecret
|
||||
, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
// 新增数据库
|
||||
commonService.insertInfo2DataBase(dto);
|
||||
return "result";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取充电站信息
|
||||
* @param dto
|
||||
|
||||
@@ -119,4 +119,6 @@ public interface XDTService {
|
||||
|
||||
|
||||
String pushStationInfo(PushStationInfoDTO dto);
|
||||
|
||||
String pushStationInfoV2(PushStationInfoDTO dto);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.service.PileStationInfoService;
|
||||
import com.jsowell.pile.service.ThirdPartyStationRelationService;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||
import com.jsowell.thirdparty.common.CommonService;
|
||||
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
||||
import com.jsowell.thirdparty.xindiantu.service.XDTService;
|
||||
import com.jsowell.thirdparty.zhongdianlian.dto.ZDLGetTokenDTO;
|
||||
@@ -42,6 +43,9 @@ public class XDTServiceImpl implements XDTService {
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
/**
|
||||
* 获取令牌
|
||||
* @param dto
|
||||
@@ -213,4 +217,10 @@ public class XDTServiceImpl implements XDTService {
|
||||
}
|
||||
return "Error";
|
||||
}
|
||||
|
||||
public String pushStationInfoV2(PushStationInfoDTO dto) {
|
||||
// 新增数据库
|
||||
commonService.insertInfo2DataBase(dto);
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,4 +112,6 @@ public interface YCBCService {
|
||||
* @return
|
||||
*/
|
||||
String pushStationInfo(PushStationInfoDTO dto);
|
||||
|
||||
String pushStationInfoV2(PushStationInfoDTO dto);
|
||||
}
|
||||
@@ -278,4 +278,8 @@ public class YCBCServiceImpl implements YCBCService {
|
||||
return zdlService.pushStationInfo(dto);
|
||||
}
|
||||
|
||||
public String pushStationInfoV2(PushStationInfoDTO dto) {
|
||||
return zdlService.pushStationInfoV2(dto);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ public interface ZDLService {
|
||||
*/
|
||||
String pushStationInfo(PushStationInfoDTO dto);
|
||||
|
||||
String pushStationInfoV2(PushStationInfoDTO dto);
|
||||
|
||||
/**
|
||||
* 查询站点信息
|
||||
* @param dto
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO;
|
||||
import com.jsowell.thirdparty.common.CommonService;
|
||||
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
||||
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
||||
import com.jsowell.thirdparty.lianlian.util.Cryptos;
|
||||
@@ -79,6 +80,12 @@ public class ZDLServiceImpl implements ZDLService {
|
||||
@Autowired
|
||||
private PileBillingTemplateService pileBillingTemplateService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartySettingInfoService thirdPartySettingInfoService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
/**
|
||||
* 获取令牌
|
||||
* @param dto
|
||||
@@ -190,6 +197,95 @@ public class ZDLServiceImpl implements ZDLService {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public String pushStationInfoV2(PushStationInfoDTO dto) {
|
||||
// 通过id查询站点相关信息
|
||||
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(dto.getStationId());
|
||||
// 通过第三方配置类型查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = new ThirdPartySettingInfo();
|
||||
settingInfo.setType(dto.getThirdPartyType());
|
||||
ThirdPartySettingInfo thirdPartySettingInfo = thirdPartySettingInfoService.selectSettingInfo(settingInfo);
|
||||
|
||||
String operatorId = thirdPartySettingInfo.getOperatorId();
|
||||
String operatorSecret = thirdPartySettingInfo.getOperatorSecret();
|
||||
String signSecret = thirdPartySettingInfo.getSignSecret();
|
||||
String dataSecret = thirdPartySettingInfo.getDataSecret();
|
||||
String dataSecretIv = thirdPartySettingInfo.getDataSecretIv();
|
||||
String urlAddress = thirdPartySettingInfo.getUrlAddress();
|
||||
|
||||
// 组装中电联平台所需要的数据格式
|
||||
ZDLStationInfo info = ZDLStationInfo.builder()
|
||||
.stationId(String.valueOf(dto.getStationId()))
|
||||
.operatorId(Constants.OPERATORID_JIANG_SU)
|
||||
// .equipmentOwnerId(Constants.OPERATORID_JIANG_SU)
|
||||
.stationName(pileStationInfo.getStationName())
|
||||
.countryCode(pileStationInfo.getCountryCode())
|
||||
.areaCode(pileStationInfo.getAreaCode())
|
||||
.address(pileStationInfo.getAddress())
|
||||
.serviceTel(pileStationInfo.getStationTel())
|
||||
.stationType(Integer.valueOf(pileStationInfo.getStationType()))
|
||||
.stationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
|
||||
.parkNums(Integer.valueOf(pileStationInfo.getParkNums()))
|
||||
.stationLng(new BigDecimal(pileStationInfo.getStationLng()))
|
||||
.stationLat(new BigDecimal(pileStationInfo.getStationLat()))
|
||||
.construction(Integer.valueOf(pileStationInfo.getConstruction()))
|
||||
|
||||
.build();
|
||||
// 截取运营商组织机构代码(去除最后一位后的最后九位)
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId()));
|
||||
String organizationCode = merchantInfo.getOrganizationCode();
|
||||
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
||||
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
||||
info.setEquipmentOwnerId(equipmentOwnerId);
|
||||
}
|
||||
|
||||
List<ZDLEquipmentInfo> pileList = getPileList(pileStationInfo);
|
||||
if (CollectionUtils.isNotEmpty(pileList)) {
|
||||
info.setEquipmentInfos(pileList); // 充电设备信息列表
|
||||
}
|
||||
|
||||
// 调用中电联平台接口
|
||||
String url = urlAddress + "notification_stationInfo";
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("StationInfo", info);
|
||||
|
||||
String jsonString = JSONObject.toJSONString(data);
|
||||
System.out.println("jsonString : " + jsonString);
|
||||
|
||||
// 获取令牌
|
||||
String token = "";
|
||||
String result = "";
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), dto.getThirdPartyType())) {
|
||||
YCBCGetTokenDTO ycbcGetTokenDTO = new YCBCGetTokenDTO();
|
||||
ycbcGetTokenDTO.setOperatorId(operatorId);
|
||||
ycbcGetTokenDTO.setDataSecret(dataSecret);
|
||||
ycbcGetTokenDTO.setSignSecret(signSecret);
|
||||
ycbcGetTokenDTO.setUrlAddress(urlAddress);
|
||||
ycbcGetTokenDTO.setDataSecretIv(dataSecretIv);
|
||||
ycbcGetTokenDTO.setOperatorSecret(operatorSecret);
|
||||
|
||||
token = ycbcService.YCBCGetToken(ycbcGetTokenDTO);
|
||||
result = HttpRequestUtil.YCBCSendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}else {
|
||||
ZDLGetTokenDTO tokenDTO = ZDLGetTokenDTO.builder()
|
||||
.urlAddress(urlAddress)
|
||||
.operatorId(operatorId)
|
||||
.operatorSecret(operatorSecret)
|
||||
.dataSecret(dataSecret)
|
||||
.dataSecretIv(dataSecretIv)
|
||||
.signSecret(signSecret)
|
||||
.build();
|
||||
token = ZDLGetToken(tokenDTO);
|
||||
result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}
|
||||
// 新增数据库
|
||||
commonService.insertInfo2DataBase(dto);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String startTime = "00:00:00"; // 00:00:00 格式
|
||||
// 需要将中间的冒号去掉
|
||||
|
||||
@@ -105,9 +105,9 @@ export function updateStationQRCodePrefix(data) {
|
||||
* @param id
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
export function getSettingByStationId(id) {
|
||||
export function getRelationByStationId(id) {
|
||||
return request({
|
||||
url: "/pile/station/getSettingByStationId/" + id,
|
||||
url: "/pile/station/getRelationByStationId/" + id,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="对接平台名称:" prop="type">
|
||||
<el-checkbox-group v-model="checkList" v-for="dict in dict.type.third_party_type">
|
||||
<el-checkbox
|
||||
<el-checkbox-group v-model="checkList">
|
||||
<el-checkbox v-for="dict in dict.type.third_party_type"
|
||||
:label="dict.label"
|
||||
:key="dict.value"
|
||||
:value="dict.value"
|
||||
@@ -368,7 +368,7 @@ import {
|
||||
pushStationInfo,
|
||||
getSettingInfo,
|
||||
getParkingInfoList,
|
||||
bindParkingPlatform,
|
||||
bindParkingPlatform, getRelationByStationId,
|
||||
} from "@/api/pile/station";
|
||||
import Whitelist from "@/views/pile/station/stationWhiteList";
|
||||
import OrderReport from "./orderReport.vue";
|
||||
@@ -420,9 +420,10 @@ export default {
|
||||
const title = "【" + stationName + "】站点详情";
|
||||
const route = Object.assign({}, this.$route, { title: `${title}` });
|
||||
this.$store.dispatch("tagsView/updateVisitedView", route);
|
||||
this.getRelationByStationId();
|
||||
this.getParkingList();
|
||||
this.queryStationInfo();
|
||||
this.getStationSettingInfo();
|
||||
|
||||
},
|
||||
mounted() {
|
||||
this.initializeData(this.activeName);
|
||||
@@ -466,33 +467,39 @@ export default {
|
||||
console.log("queryStationInfo==", this.stationDetail);
|
||||
},
|
||||
// 查询站点互联互通配置信息
|
||||
getStationSettingInfo() {
|
||||
getSettingByStationId(this.stationId).then((res) => {
|
||||
getRelationByStationId() {
|
||||
getRelationByStationId(this.stationId).then((res) => {
|
||||
console.log("stationId:", this.stationId);
|
||||
console.log("getSettingByStationId==", res.data === undefined);
|
||||
if (res.data === undefined) {
|
||||
this.stationSettingInfo.thirdPartyType = "0";
|
||||
} else {
|
||||
this.stationSettingInfo = res.data;
|
||||
}
|
||||
console.log("res", res);
|
||||
console.log("res.rows", res.rows);
|
||||
res.rows.forEach((item, index) =>{
|
||||
this.checkList.push(item.thirdPartyType);
|
||||
})
|
||||
console.log("this.checkList", this.checkList);
|
||||
// if (res.data === undefined) {
|
||||
// this.stationSettingInfo.thirdPartyType = "0";
|
||||
// } else {
|
||||
// this.stationSettingInfo = res.data;
|
||||
// }
|
||||
});
|
||||
},
|
||||
|
||||
// 根据对接平台类型查询配置信息
|
||||
getSettingParams() {
|
||||
const param = {
|
||||
// stationId: this.stationId,
|
||||
type: this.stationSettingInfo.type,
|
||||
};
|
||||
console.log("param", param);
|
||||
getSettingInfo(param).then((res) => {
|
||||
console.log("getSettingInfo", res);
|
||||
if (res.data === undefined) {
|
||||
this.stationSettingInfo = [];
|
||||
} else {
|
||||
this.stationSettingInfo = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
// getSettingParams() {
|
||||
// const param = {
|
||||
// // stationId: this.stationId,
|
||||
// type: this.stationSettingInfo.type,
|
||||
// };
|
||||
// console.log("param", param);
|
||||
// getSettingInfo(param).then((res) => {
|
||||
// console.log("getSettingInfo", res);
|
||||
// if (res.data === undefined) {
|
||||
// this.stationSettingInfo = [];
|
||||
// } else {
|
||||
// this.stationSettingInfo = res.data;
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
|
||||
// 获取停车平台列表
|
||||
getParkingList() {
|
||||
|
||||
Reference in New Issue
Block a user