Merge branch 'dev' into dev-g

This commit is contained in:
Guoqs
2025-02-12 16:08:25 +08:00
10 changed files with 161 additions and 60 deletions

View File

@@ -253,10 +253,11 @@ public class PileStationInfoController extends BaseController {
@PreAuthorize("@ss.hasPermi('pile:station:query')") @PreAuthorize("@ss.hasPermi('pile:station:query')")
@GetMapping("/getRelationByStationId/{stationId}") @GetMapping("/getRelationByStationId/{stationId}")
public TableDataInfo getSettingByStationId(@PathVariable("stationId") Long id) { public TableDataInfo getSettingByStationId(@PathVariable("stationId") Long id) {
List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id)); // List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id));
for (ThirdPartyStationRelationVO vo : list) { // for (ThirdPartyStationRelationVO vo : list) {
vo.setThirdPartyType(ThirdPlatformTypeEnum.getTypeLabelByTypeCode(vo.getThirdPartyType())); // vo.setThirdPartyType(ThirdPlatformTypeEnum.getTypeLabelByTypeCode(vo.getThirdPartyType()));
} // }
List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoListV2(String.valueOf(id));
return getDataTable(list); return getDataTable(list);
} }
@@ -303,38 +304,38 @@ public class PileStationInfoController extends BaseController {
* @param dto * @param dto
* @return * @return
*/ */
@PostMapping("/pushStationInfo") // @PostMapping("/pushStationInfo")
public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) { // public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
logger.info("推送第三方平台充电站信息 params:{}", JSON.toJSONString(dto)); // logger.info("推送第三方平台充电站信息 params:{}", JSON.toJSONString(dto));
RestApiResponse<?> response = null; // RestApiResponse<?> response = null;
Long stationId = dto.getStationId(); // Long stationId = dto.getStationId();
List<String> types = dto.getThirdPartyTypes(); // List<String> types = dto.getThirdPartyTypes();
// 先查到该站点推送过的类型 // // 先查到该站点推送过的类型
List<ThirdPartyStationRelationVO> infoList = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(stationId)); // List<ThirdPartyStationRelationVO> infoList = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(stationId));
List<String> typeList = infoList.stream() // List<String> typeList = infoList.stream()
.map(ThirdPartyStationRelationVO::getThirdPartyType) // .map(ThirdPartyStationRelationVO::getThirdPartyType)
.collect(Collectors.toList()); // .collect(Collectors.toList());
// 对types去重可获取到需要新推送的第三方平台类型 // // 对types去重可获取到需要新推送的第三方平台类型
types.removeAll(typeList); // types.removeAll(typeList);
dto.setThirdPartyTypes(types); // dto.setThirdPartyTypes(types);
try { // try {
if (StringUtils.isBlank(String.valueOf(stationId))) { // if (StringUtils.isBlank(String.valueOf(stationId))) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); // throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
} // }
String result = commonService.commonPushStation(dto); // String result = commonService.commonPushStation(dto);
response = new RestApiResponse<>(result); // response = new RestApiResponse<>(result);
} 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<>("推送失败,请联系管理员"); // response = new RestApiResponse<>("推送失败,请联系管理员");
// 有报错,所有的都必须删除 // // 有报错,所有的都必须删除
thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(stationId), types); // thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(stationId), types);
} // }
logger.info("推送第三方平台充电站信息 result:{}", response); // logger.info("推送第三方平台充电站信息 result:{}", response);
return response; // return response;
} // }
/** /**
* 绑定停车平台(停车充电下发优惠券) * 绑定停车平台(停车充电下发优惠券)

View File

@@ -31,6 +31,8 @@ public enum ThirdPlatformTypeEnum {
GUANG_XI_PLATFORM("20", "广西平台", "450000000"), GUANG_XI_PLATFORM("20", "广西平台", "450000000"),
XIN_YUN_PLATFORM("21", "新运平台", "MADKXL8FX"), XIN_YUN_PLATFORM("21", "新运平台", "MADKXL8FX"),
HE_NAN_PLATFORM("22", "河南省平台", ""),
; ;
private String typeCode; private String typeCode;

View File

@@ -113,4 +113,6 @@ public interface ThirdPartyStationRelationMapper {
int insertOrUpdateSelective(ThirdPartyStationRelation thirdPartyStationRelation); int insertOrUpdateSelective(ThirdPartyStationRelation thirdPartyStationRelation);
int batchInsert(List<ThirdPartyStationRelation> list); int batchInsert(List<ThirdPartyStationRelation> list);
List<ThirdPartyStationRelationVO> getRelationInfoListV2(@Param("stationId") String stationId);
} }

View File

@@ -112,4 +112,6 @@ public interface ThirdPartyStationRelationService {
* @return * @return
*/ */
List<StationInfoVO> selectStationList(String thirdPlatformType); List<StationInfoVO> selectStationList(String thirdPlatformType);
List<ThirdPartyStationRelationVO> getRelationInfoListV2(String stationId);
} }

View File

@@ -128,6 +128,10 @@ public class ThirdPartyStationRelationServiceImpl implements ThirdPartyStationRe
return thirdPartyStationRelationMapper.getRelationInfoList(stationId); return thirdPartyStationRelationMapper.getRelationInfoList(stationId);
} }
public List<ThirdPartyStationRelationVO> getRelationInfoListV2(String stationId) {
return thirdPartyStationRelationMapper.getRelationInfoListV2(stationId);
}
/** /**
* 新增站点、第三方推送平台配置对应 * 新增站点、第三方推送平台配置对应
* *

View File

@@ -14,6 +14,8 @@ public class ThirdPartyStationRelationVO {
private String thirdPartyType; private String thirdPartyType;
private String thirdPartyName;
private String startMode; private String startMode;
private String urlAddress; private String urlAddress;
@@ -22,4 +24,24 @@ public class ThirdPartyStationRelationVO {
private String signSecret; private String signSecret;
private String dataSecret; private String dataSecret;
private String dataSecretIv; 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;
} }

View File

@@ -332,5 +332,26 @@
</trim> </trim>
</insert> </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> </mapper>

View File

@@ -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;
}
}

View File

@@ -140,13 +140,13 @@ export function updateSettingByStationId(data) {
// } // }
// 推送充电站信息到联联平台 // 推送充电站信息到联联平台
export function pushStationInfo(data) { // export function pushStationInfo(data) {
return request({ // return request({
url: "/pile/station/pushStationInfo", // url: "/pile/station/pushStationInfo",
method: "post", // method: "post",
data: data, // data: data,
}) // })
} // }
// 绑定停车平台 // 绑定停车平台
export function bindParkingPlatform(data) { export function bindParkingPlatform(data) {

View File

@@ -256,7 +256,6 @@ import {
getStationInfo, getStationInfo,
updateStationQRCodePrefix, updateStationQRCodePrefix,
updateSettingByStationId, updateSettingByStationId,
pushStationInfo,
getParkingInfoList, getParkingInfoList,
bindParkingPlatform, bindParkingPlatform,
getRelationByStationId, getRelationByStationId,
@@ -375,8 +374,8 @@ export default {
console.log("res", res); console.log("res", res);
console.log("res.rows", res.rows); console.log("res.rows", res.rows);
res.rows.forEach((item, index) => { res.rows.forEach((item, index) => {
this.checkList.push(item.thirdPartyType); this.checkList.push(item.thirdPartyName);
this.firstList.push(item.thirdPartyType); this.firstList.push(item.thirdPartyName);
}); });
console.log("this.checkList", this.checkList, this.firstList); console.log("this.checkList", this.checkList, this.firstList);
// if (res.data === undefined) { // if (res.data === undefined) {
@@ -455,19 +454,19 @@ export default {
}); });
}, },
// 推送站点 // 推送站点
pushStation() { // pushStation() {
let exchange = ""; // let exchange = "";
const param = { // const param = {
stationId: this.stationId, // stationId: this.stationId,
thirdPartyTypes: this.exchange, // thirdPartyTypes: this.exchange,
}; // };
console.log("param", param); // console.log("param", param);
pushStationInfo(param).then((response) => { // pushStationInfo(param).then((response) => {
console.log("response", response); // console.log("response", response);
this.$modal.msg(response.obj); // this.$modal.msg(response.obj);
this.disableFlag = true; // this.disableFlag = true;
}); // });
}, // },
// 保存站点与第三方平台关系 // 保存站点与第三方平台关系
saveStationThirdParty() { saveStationThirdParty() {