mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +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;
|
||||
|
||||
Reference in New Issue
Block a user