mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-30 12:07:59 +08:00
update 推送第三方平台可多选
This commit is contained in:
@@ -30,6 +30,7 @@ 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.common.CommonService;
|
||||
import com.jsowell.thirdparty.huawei.HuaWeiService;
|
||||
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
||||
import com.jsowell.thirdparty.nanrui.service.NRService;
|
||||
@@ -42,6 +43,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 充电站信息Controller
|
||||
@@ -62,22 +64,9 @@ public class PileStationInfoController extends BaseController {
|
||||
private ThirdPartySettingInfoService thirdPartySettingInfoService;
|
||||
|
||||
@Autowired
|
||||
private LianLianService lianLianService;
|
||||
private CommonService commonService;
|
||||
|
||||
@Autowired
|
||||
private ZDLService zdlService;
|
||||
|
||||
@Autowired
|
||||
private NRService nrService;
|
||||
|
||||
@Autowired
|
||||
private YCBCService ycbcService;
|
||||
|
||||
@Autowired
|
||||
private XDTService xdtService;
|
||||
|
||||
@Autowired
|
||||
private HuaWeiService huaWeiService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
@@ -299,52 +288,30 @@ public class PileStationInfoController extends BaseController {
|
||||
public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
|
||||
logger.info("推送第三方平台充电站信息 params:{}", JSONObject.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(dto.getStationId()))) {
|
||||
if (StringUtils.isBlank(String.valueOf(stationId))) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
String result = "";
|
||||
for (String type : types) {
|
||||
dto.setThirdPartyType(type);
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) {
|
||||
// 推送联联
|
||||
// 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.pushStationInfoV2(dto);
|
||||
}
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), dto.getThirdPartyType())) {
|
||||
// 江苏省平台
|
||||
// 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.pushStationInfoV2(dto);
|
||||
}
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), dto.getThirdPartyType())) {
|
||||
// 新电途平台
|
||||
xdtService.pushStationInfo(dto);
|
||||
}
|
||||
// if(StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), dto.getThirdPartyType())) {
|
||||
// // 华为
|
||||
// result = huaWeiService.notificationOperationSystemInfo(dto);
|
||||
// }
|
||||
response = new RestApiResponse<>(result);
|
||||
}
|
||||
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(dto.getStationId()), dto.getThirdPartyType());
|
||||
// 有报错,所有的都必须删除
|
||||
thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(stationId), types);
|
||||
}
|
||||
logger.info("推送第三方平台充电站信息 result:{}", response);
|
||||
return response;
|
||||
|
||||
@@ -84,5 +84,5 @@ public interface ThirdPartyStationRelationMapper {
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
int updateRelationDelFlag(@Param("stationId") String stationId, @Param("type") String type);
|
||||
int updateRelationDelFlag(@Param("stationId") String stationId, @Param("types") List<String> types);
|
||||
}
|
||||
|
||||
@@ -74,5 +74,5 @@ public interface ThirdPartyStationRelationService {
|
||||
*/
|
||||
public int deleteThirdPartyStationRelationById(Long id);
|
||||
|
||||
int updateRelationDelFlag(String stationId, String type);
|
||||
int updateRelationDelFlag(String stationId, List<String> types);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ThirdPartyStationRelationServiceImpl implements ThirdPartyStationRe
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateRelationDelFlag(String stationId, String type) {
|
||||
return thirdPartyStationRelationMapper.updateRelationDelFlag(stationId, type);
|
||||
public int updateRelationDelFlag(String stationId, List<String> types) {
|
||||
return thirdPartyStationRelationMapper.updateRelationDelFlag(stationId, types);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +127,9 @@
|
||||
del_flag = '1'
|
||||
where
|
||||
station_id = #{stationId,jdbcType=VARCHAR}
|
||||
and third_party_type = #{type,jdbcType=VARCHAR}
|
||||
and third_party_type in
|
||||
<foreach collection="types" open="(" item="type" close=")" separator=",">
|
||||
#{type,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -1,12 +1,25 @@
|
||||
package com.jsowell.thirdparty.common;
|
||||
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
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 com.jsowell.thirdparty.huawei.HuaWeiService;
|
||||
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
||||
import com.jsowell.thirdparty.nanrui.service.NRService;
|
||||
import com.jsowell.thirdparty.xindiantu.service.XDTService;
|
||||
import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
|
||||
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
@@ -19,6 +32,24 @@ public class CommonService {
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
|
||||
@Autowired
|
||||
private LianLianService lianLianService;
|
||||
|
||||
@Autowired
|
||||
private ZDLService zdlService;
|
||||
|
||||
@Autowired
|
||||
private NRService nrService;
|
||||
|
||||
@Autowired
|
||||
private YCBCService ycbcService;
|
||||
|
||||
@Autowired
|
||||
private XDTService xdtService;
|
||||
|
||||
@Autowired
|
||||
private HuaWeiService huaWeiService;
|
||||
|
||||
/**
|
||||
* 将站点--第三方平台类型对应关系存入关系表
|
||||
* @param dto
|
||||
@@ -34,4 +65,51 @@ public class CommonService {
|
||||
// 新增数据库
|
||||
thirdPartyStationRelationService.insertThirdPartyStationRelation(relation);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统一方法推送站点信息
|
||||
* @param dto
|
||||
* @return
|
||||
* @throws ParseException
|
||||
*/
|
||||
public String commonPushStation(PushStationInfoDTO dto) throws ParseException {
|
||||
List<String> types = dto.getThirdPartyTypes();
|
||||
|
||||
String result = "";
|
||||
StringBuilder finalResult = new StringBuilder();
|
||||
for (String type : types) {
|
||||
dto.setThirdPartyType(type);
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) {
|
||||
// 推送联联
|
||||
// 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.pushStationInfoV2(dto);
|
||||
}
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), dto.getThirdPartyType())) {
|
||||
// 江苏省平台
|
||||
// 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.pushStationInfoV2(dto);
|
||||
}
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), dto.getThirdPartyType())) {
|
||||
// 新电途平台
|
||||
result = xdtService.pushStationInfoV2(dto);
|
||||
}
|
||||
// if(StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), dto.getThirdPartyType())) {
|
||||
// // 华为
|
||||
// result = huaWeiService.notificationOperationSystemInfo(dto);
|
||||
// }
|
||||
finalResult.append(result).append("\n");
|
||||
}
|
||||
return finalResult.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
|
||||
// 新增数据库
|
||||
commonService.insertInfo2DataBase(dto);
|
||||
return result;
|
||||
return dto.getThirdPartyType() + ":" + result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ public class NRServiceImpl implements NRService {
|
||||
|
||||
// 新增数据库
|
||||
commonService.insertInfo2DataBase(dto);
|
||||
return "result";
|
||||
return dto.getThirdPartyType() + ":" + result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -221,6 +221,6 @@ public class XDTServiceImpl implements XDTService {
|
||||
public String pushStationInfoV2(PushStationInfoDTO dto) {
|
||||
// 新增数据库
|
||||
commonService.insertInfo2DataBase(dto);
|
||||
return "OK";
|
||||
return dto.getThirdPartyType() + ":" + "OK";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ public class ZDLServiceImpl implements ZDLService {
|
||||
}
|
||||
// 新增数据库
|
||||
commonService.insertInfo2DataBase(dto);
|
||||
return result;
|
||||
return dto.getThirdPartyType() + ":" + result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
|
||||
<el-card>
|
||||
<h2>互联互通配置</h2>
|
||||
<el-button icon="el-icon-edit" size="big" @click="openEdit" 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 ref="stationSettingForm" :model="stationSettingInfo" label-position="right" label-width="200px"
|
||||
style="margin-top: 10px">
|
||||
<el-row>
|
||||
|
||||
Reference in New Issue
Block a user