mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
Merge branch 'dev-zza' into dev
This commit is contained in:
@@ -253,10 +253,11 @@ public class PileStationInfoController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@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.getTypeLabelByTypeCode(vo.getThirdPartyType()));
|
||||
}
|
||||
// List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id));
|
||||
// for (ThirdPartyStationRelationVO vo : list) {
|
||||
// vo.setThirdPartyType(ThirdPlatformTypeEnum.getTypeLabelByTypeCode(vo.getThirdPartyType()));
|
||||
// }
|
||||
List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoListV2(String.valueOf(id));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@@ -303,38 +304,38 @@ public class PileStationInfoController extends BaseController {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/pushStationInfo")
|
||||
public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
|
||||
logger.info("推送第三方平台充电站信息 params:{}", JSON.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
Long stationId = dto.getStationId();
|
||||
List<String> types = dto.getThirdPartyTypes();
|
||||
// 先查到该站点推送过的类型
|
||||
List<ThirdPartyStationRelationVO> infoList = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(stationId));
|
||||
List<String> typeList = infoList.stream()
|
||||
.map(ThirdPartyStationRelationVO::getThirdPartyType)
|
||||
.collect(Collectors.toList());
|
||||
// 对types去重,可获取到需要新推送的第三方平台类型
|
||||
types.removeAll(typeList);
|
||||
dto.setThirdPartyTypes(types);
|
||||
try {
|
||||
if (StringUtils.isBlank(String.valueOf(stationId))) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
String result = commonService.commonPushStation(dto);
|
||||
response = new RestApiResponse<>(result);
|
||||
} catch (BusinessException e) {
|
||||
logger.error("推送第三方平台充电站信息 error", e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("推送第三方平台充电站信息 error", e);
|
||||
response = new RestApiResponse<>("推送失败,请联系管理员");
|
||||
// 有报错,所有的都必须删除
|
||||
thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(stationId), types);
|
||||
}
|
||||
logger.info("推送第三方平台充电站信息 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
// @PostMapping("/pushStationInfo")
|
||||
// public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
|
||||
// logger.info("推送第三方平台充电站信息 params:{}", JSON.toJSONString(dto));
|
||||
// RestApiResponse<?> response = null;
|
||||
// Long stationId = dto.getStationId();
|
||||
// List<String> types = dto.getThirdPartyTypes();
|
||||
// // 先查到该站点推送过的类型
|
||||
// List<ThirdPartyStationRelationVO> infoList = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(stationId));
|
||||
// List<String> typeList = infoList.stream()
|
||||
// .map(ThirdPartyStationRelationVO::getThirdPartyType)
|
||||
// .collect(Collectors.toList());
|
||||
// // 对types去重,可获取到需要新推送的第三方平台类型
|
||||
// types.removeAll(typeList);
|
||||
// dto.setThirdPartyTypes(types);
|
||||
// try {
|
||||
// if (StringUtils.isBlank(String.valueOf(stationId))) {
|
||||
// throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
// }
|
||||
// String result = commonService.commonPushStation(dto);
|
||||
// response = new RestApiResponse<>(result);
|
||||
// } catch (BusinessException e) {
|
||||
// logger.error("推送第三方平台充电站信息 error", e);
|
||||
// response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
// } catch (Exception e) {
|
||||
// logger.error("推送第三方平台充电站信息 error", e);
|
||||
// response = new RestApiResponse<>("推送失败,请联系管理员");
|
||||
// // 有报错,所有的都必须删除
|
||||
// thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(stationId), types);
|
||||
// }
|
||||
// logger.info("推送第三方平台充电站信息 result:{}", response);
|
||||
// return response;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 绑定停车平台(停车充电下发优惠券)
|
||||
|
||||
@@ -31,6 +31,8 @@ public enum ThirdPlatformTypeEnum {
|
||||
GUANG_XI_PLATFORM("20", "广西平台", "450000000"),
|
||||
|
||||
XIN_YUN_PLATFORM("21", "新运平台", "MADKXL8FX"),
|
||||
|
||||
HE_NAN_PLATFORM("22", "河南省平台", ""),
|
||||
;
|
||||
|
||||
private String typeCode;
|
||||
|
||||
@@ -113,4 +113,6 @@ public interface ThirdPartyStationRelationMapper {
|
||||
int insertOrUpdateSelective(ThirdPartyStationRelation thirdPartyStationRelation);
|
||||
|
||||
int batchInsert(List<ThirdPartyStationRelation> list);
|
||||
|
||||
List<ThirdPartyStationRelationVO> getRelationInfoListV2(@Param("stationId") String stationId);
|
||||
}
|
||||
|
||||
@@ -112,4 +112,6 @@ public interface ThirdPartyStationRelationService {
|
||||
* @return
|
||||
*/
|
||||
List<StationInfoVO> selectStationList(String thirdPlatformType);
|
||||
|
||||
List<ThirdPartyStationRelationVO> getRelationInfoListV2(String stationId);
|
||||
}
|
||||
|
||||
@@ -128,6 +128,10 @@ public class ThirdPartyStationRelationServiceImpl implements ThirdPartyStationRe
|
||||
return thirdPartyStationRelationMapper.getRelationInfoList(stationId);
|
||||
}
|
||||
|
||||
public List<ThirdPartyStationRelationVO> getRelationInfoListV2(String stationId) {
|
||||
return thirdPartyStationRelationMapper.getRelationInfoListV2(stationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增站点、第三方推送平台配置对应
|
||||
*
|
||||
|
||||
@@ -14,6 +14,8 @@ public class ThirdPartyStationRelationVO {
|
||||
|
||||
private String thirdPartyType;
|
||||
|
||||
private String thirdPartyName;
|
||||
|
||||
private String startMode;
|
||||
|
||||
private String urlAddress;
|
||||
@@ -22,4 +24,24 @@ public class ThirdPartyStationRelationVO {
|
||||
private String signSecret;
|
||||
private String dataSecret;
|
||||
private String dataSecretIv;
|
||||
|
||||
|
||||
/**
|
||||
* 对方平台密钥信息
|
||||
*/
|
||||
private String theirOperatorId;
|
||||
private String theirOperatorSecret;
|
||||
private String theirSignSecret;
|
||||
private String theirDataSecret;
|
||||
private String theirDataSecretIv;
|
||||
|
||||
|
||||
/**
|
||||
* 我方平台密钥信息
|
||||
*/
|
||||
private String ourOperatorId;
|
||||
private String ourOperatorSecret;
|
||||
private String ourSignSecret;
|
||||
private String ourDataSecret;
|
||||
private String ourDataSecretIv;
|
||||
}
|
||||
|
||||
@@ -332,5 +332,26 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="getRelationInfoListV2" resultType="com.jsowell.pile.vo.base.ThirdPartyStationRelationVO">
|
||||
SELECT
|
||||
t1.station_id AS stationId,
|
||||
t1.third_party_type AS thirdPartyType,
|
||||
t2.platform_name AS thirdPartyName,
|
||||
t2.start_mode AS startMode,
|
||||
t2.url_prefix AS urlAddress,
|
||||
t2.their_operator_id AS theirOperatorId,
|
||||
t2.their_operator_secret AS theirOperatorSecret,
|
||||
t2.their_sig_secret AS theirSignSecret,
|
||||
t2.their_data_secret AS theirDataSecret,
|
||||
t2.their_data_secret_iv AS theirDataSecretIv,
|
||||
t2.our_operator_secret AS ourOperatorSecret,
|
||||
t2.our_sig_secret AS ourSignSecret,
|
||||
t2.our_data_secret AS ourDataSecret,
|
||||
t2.our_data_secret_iv AS ourDataSecretIv
|
||||
FROM
|
||||
thirdparty_station_relation t1
|
||||
JOIN thirdparty_secret_info t2 ON t1.third_party_type = t2.platform_type
|
||||
where t1.del_flag = '0'
|
||||
and t1.station_id = #{stationId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.jsowell.thirdparty.platform.service.impl;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 河南省平台Service
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2025/2/11 9:57:47
|
||||
*/
|
||||
@Service
|
||||
public class HeNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
// 平台类型
|
||||
private final String thirdPlatformType = ThirdPlatformTypeEnum.HE_NAN_PLATFORM.getTypeCode();
|
||||
|
||||
@Autowired
|
||||
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
ThirdPartyPlatformFactory.register(thirdPlatformType, this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询河南省平台密钥信息
|
||||
* @return
|
||||
*/
|
||||
private ThirdPartySecretInfoVO getHeNanSecretInfo() {
|
||||
// 通过第三方平台类型查询相关配置信息
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||
}
|
||||
thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU);
|
||||
return thirdPartySecretInfoVO;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -140,13 +140,13 @@ export function updateSettingByStationId(data) {
|
||||
// }
|
||||
|
||||
// 推送充电站信息到联联平台
|
||||
export function pushStationInfo(data) {
|
||||
return request({
|
||||
url: "/pile/station/pushStationInfo",
|
||||
method: "post",
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
// export function pushStationInfo(data) {
|
||||
// return request({
|
||||
// url: "/pile/station/pushStationInfo",
|
||||
// method: "post",
|
||||
// data: data,
|
||||
// })
|
||||
// }
|
||||
|
||||
// 绑定停车平台
|
||||
export function bindParkingPlatform(data) {
|
||||
|
||||
@@ -256,7 +256,6 @@ import {
|
||||
getStationInfo,
|
||||
updateStationQRCodePrefix,
|
||||
updateSettingByStationId,
|
||||
pushStationInfo,
|
||||
getParkingInfoList,
|
||||
bindParkingPlatform,
|
||||
getRelationByStationId,
|
||||
@@ -455,19 +454,19 @@ export default {
|
||||
});
|
||||
},
|
||||
// 推送站点
|
||||
pushStation() {
|
||||
let exchange = "";
|
||||
const param = {
|
||||
stationId: this.stationId,
|
||||
thirdPartyTypes: this.exchange,
|
||||
};
|
||||
console.log("param", param);
|
||||
pushStationInfo(param).then((response) => {
|
||||
console.log("response", response);
|
||||
this.$modal.msg(response.obj);
|
||||
this.disableFlag = true;
|
||||
});
|
||||
},
|
||||
// pushStation() {
|
||||
// let exchange = "";
|
||||
// const param = {
|
||||
// stationId: this.stationId,
|
||||
// thirdPartyTypes: this.exchange,
|
||||
// };
|
||||
// console.log("param", param);
|
||||
// pushStationInfo(param).then((response) => {
|
||||
// console.log("response", response);
|
||||
// this.$modal.msg(response.obj);
|
||||
// this.disableFlag = true;
|
||||
// });
|
||||
// },
|
||||
|
||||
// 保存站点与第三方平台关系
|
||||
saveStationThirdParty() {
|
||||
|
||||
Reference in New Issue
Block a user