mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 查询枪口状态之前先查询该站点有没有推送第三方平台(华为)
This commit is contained in:
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -143,10 +144,15 @@ public class PileController extends BaseController {
|
||||
public RestApiResponse<?> selectStationConnectorList(HttpServletRequest request, @RequestBody QueryConnectorListDTO dto) {
|
||||
logger.info("查询充电枪口列表 params:{}", JSON.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
// 修改对接第三方平台的枪口状态
|
||||
updateThirdPartyConnectorStatus(dto);
|
||||
} catch (Exception e) {
|
||||
logger.error("修改对接第三方平台的枪口状态 error");
|
||||
}
|
||||
|
||||
try {
|
||||
PageResponse pageResponse = pileConnectorInfoService.selectStationConnectorList(dto);
|
||||
List<PileConnectorInfoVO> list = (List<PileConnectorInfoVO>) pageResponse.getList();
|
||||
updateThirdPartyConnectorStatus(list);
|
||||
response = new RestApiResponse<>(pageResponse);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询充电枪口列表异常", e);
|
||||
@@ -186,26 +192,35 @@ public class PileController extends BaseController {
|
||||
|
||||
/**
|
||||
* 修改第三方平台枪口状态
|
||||
* @see com.jsowell.web.controller.pile.PileConnectorInfoController#updateThirdPartyConnectorStatus(com.jsowell.pile.dto.QueryConnectorListDTO)
|
||||
* 两个方法完全相同,如有修改需同步修改
|
||||
*/
|
||||
public void updateThirdPartyConnectorStatus(List<PileConnectorInfoVO> connectorList) {
|
||||
if (CollectionUtils.isEmpty(connectorList)) {
|
||||
private void updateThirdPartyConnectorStatus(QueryConnectorListDTO dto) {
|
||||
if (dto == null) {
|
||||
return;
|
||||
}
|
||||
List<String> stationIdList = connectorList.stream()
|
||||
.map(PileConnectorInfoVO::getStationId)
|
||||
.collect(Collectors.toList());
|
||||
List<Long> pileIds = dto.getPileIds();
|
||||
List<Long> stationIdList = dto.getStationIdList();
|
||||
|
||||
for (String stationId : stationIdList) {
|
||||
String stationIdStr = String.valueOf(stationId);
|
||||
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(stationIdStr, null);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (ThirdPartySnRelationVO vo : list) {
|
||||
String thirdPartyType = vo.getThirdPartyType();
|
||||
// 调用通用查询实时数据接口(需在接口中修改枪口状态)
|
||||
commonService.commonQueryStationStatus(stationIdStr, thirdPartyType);
|
||||
List<ThirdPartySnRelationVO> list = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(pileIds)) {
|
||||
list = snRelationService.selectSnRelationListByParams(null, null, pileIds);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(stationIdList)) {
|
||||
for (Long stationId : stationIdList) {
|
||||
String stationIdStr = String.valueOf(stationId);
|
||||
list = snRelationService.selectSnRelationListByParams(stationIdStr, null, null);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ThirdPartySnRelationVO vo : list) {
|
||||
String thirdPartyType = vo.getThirdPartyType();
|
||||
String stationId = vo.getStationId();
|
||||
// 调用通用查询实时数据接口(需在接口中修改枪口状态)
|
||||
commonService.commonQueryStationStatus(stationId, thirdPartyType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1336,7 +1336,7 @@ public class OrderService {
|
||||
String pileSn = orderInfo.getPileSn();
|
||||
|
||||
// 根据 stationId 查询 pile_sn_relation 表
|
||||
List<ThirdPartySnRelationVO> snRelations = snRelationService.selectSnRelationListByParams(stationId, pileSn);
|
||||
List<ThirdPartySnRelationVO> snRelations = snRelationService.selectSnRelationListByParams(stationId, pileSn, null);
|
||||
if (CollectionUtils.isEmpty(snRelations)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.web.controller.pile;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.jsowell.api.uniapp.PileController;
|
||||
import com.jsowell.common.annotation.Log;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.core.page.TableDataInfo;
|
||||
@@ -12,7 +13,9 @@ import com.jsowell.pile.dto.QueryConnectorDTO;
|
||||
import com.jsowell.pile.dto.QueryConnectorListDTO;
|
||||
import com.jsowell.pile.dto.UpdateConnectorParkNoDTO;
|
||||
import com.jsowell.pile.service.IThirdpartySnRelationService;
|
||||
import com.jsowell.pile.service.PileBasicInfoService;
|
||||
import com.jsowell.pile.service.PileConnectorInfoService;
|
||||
import com.jsowell.pile.service.PileStationInfoService;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.ThirdPartySnRelationVO;
|
||||
import com.jsowell.thirdparty.common.CommonService;
|
||||
@@ -22,6 +25,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -40,6 +44,12 @@ public class PileConnectorInfoController extends BaseController {
|
||||
@Autowired
|
||||
private IThirdpartySnRelationService snRelationService;
|
||||
|
||||
@Autowired
|
||||
private PileStationInfoService pileStationInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileBasicInfoService pileBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@@ -74,9 +84,13 @@ public class PileConnectorInfoController extends BaseController {
|
||||
@PostMapping("/getConnectorInfoListByParams")
|
||||
public TableDataInfo getConnectorInfoListByParams(@RequestBody QueryConnectorListDTO dto) {
|
||||
logger.info("查询接口列表 param:{}", JSON.toJSONString(dto));
|
||||
try {
|
||||
// 修改对接第三方平台的枪口状态
|
||||
updateThirdPartyConnectorStatus(dto);
|
||||
} catch (Exception e) {
|
||||
logger.error("修改对接第三方平台的枪口状态 error");
|
||||
}
|
||||
List<PileConnectorInfoVO> list = pileConnectorInfoService.getConnectorInfoListByParams(dto);
|
||||
// 修改对接第三方平台的枪口状态
|
||||
updateThirdPartyConnectorStatus(list);
|
||||
logger.info("查询接口列表 result:{}", JSON.toJSONString(list));
|
||||
return getDataTable(list);
|
||||
}
|
||||
@@ -144,26 +158,35 @@ public class PileConnectorInfoController extends BaseController {
|
||||
|
||||
/**
|
||||
* 修改第三方平台枪口状态
|
||||
* @see PileController#updateThirdPartyConnectorStatus(com.jsowell.pile.dto.QueryConnectorListDTO)
|
||||
* 两个方法完全相同,如有修改需同步修改
|
||||
*/
|
||||
public void updateThirdPartyConnectorStatus(List<PileConnectorInfoVO> connectorList) {
|
||||
if (CollectionUtils.isEmpty(connectorList)) {
|
||||
private void updateThirdPartyConnectorStatus(QueryConnectorListDTO dto) {
|
||||
if (dto == null) {
|
||||
return;
|
||||
}
|
||||
List<String> stationIdList = connectorList.stream()
|
||||
.map(PileConnectorInfoVO::getStationId)
|
||||
.collect(Collectors.toList());
|
||||
List<Long> pileIds = dto.getPileIds();
|
||||
List<Long> stationIdList = dto.getStationIdList();
|
||||
|
||||
for (String stationId : stationIdList) {
|
||||
String stationIdStr = String.valueOf(stationId);
|
||||
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(stationIdStr, null);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (ThirdPartySnRelationVO vo : list) {
|
||||
String thirdPartyType = vo.getThirdPartyType();
|
||||
// 调用通用查询实时数据接口(需在接口中修改枪口状态)
|
||||
commonService.commonQueryStationStatus(stationIdStr, thirdPartyType);
|
||||
}
|
||||
List<ThirdPartySnRelationVO> list = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(pileIds)) {
|
||||
list = snRelationService.selectSnRelationListByParams(null, null, pileIds);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(stationIdList)) {
|
||||
for (Long stationId : stationIdList) {
|
||||
String stationIdStr = String.valueOf(stationId);
|
||||
list = snRelationService.selectSnRelationListByParams(stationIdStr, null, null);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ThirdPartySnRelationVO vo : list) {
|
||||
String thirdPartyType = vo.getThirdPartyType();
|
||||
String stationId = vo.getStationId();
|
||||
// 调用通用查询实时数据接口(需在接口中修改枪口状态)
|
||||
commonService.commonQueryStationStatus(stationId, thirdPartyType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,5 +84,5 @@ public interface ThirdpartySnRelationMapper {
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
List<ThirdPartySnRelationVO> selectSnRelationListByParams(@Param("stationId") String stationId, @Param("pileSn") String pileSn);
|
||||
List<ThirdPartySnRelationVO> selectSnRelationListByParams(@Param("stationId") String stationId, @Param("pileSn") String pileSn, @Param("pileIds") List<Long> pileIds);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface IThirdpartySnRelationService {
|
||||
*/
|
||||
public List<ThirdpartySnRelation> selectThirdpartySnRelationList(ThirdpartySnRelation thirdpartySnRelation);
|
||||
|
||||
public List<ThirdPartySnRelationVO> selectSnRelationListByParams(String stationId, String pileSn);
|
||||
public List<ThirdPartySnRelationVO> selectSnRelationListByParams(String stationId, String pileSn, List<Long> pileIds);
|
||||
|
||||
/**
|
||||
* 新增万车充--第三方平台桩编号对应关系
|
||||
|
||||
@@ -3056,7 +3056,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
}
|
||||
|
||||
// 判断该桩是否对接了类似华为平台的第三方站点
|
||||
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(null, orderInfo.getPileSn());
|
||||
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(null, orderInfo.getPileSn(), null);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (ThirdPartySnRelationVO vo : list) {
|
||||
String startMode = vo.getStartMode();
|
||||
|
||||
@@ -45,9 +45,9 @@ public class ThirdpartySnRelationServiceImpl implements IThirdpartySnRelationSer
|
||||
return thirdpartySnRelationMapper.selectThirdpartySnRelationList(thirdpartySnRelation);
|
||||
}
|
||||
|
||||
|
||||
public List<ThirdPartySnRelationVO> selectSnRelationListByParams(String stationId, String pileSn) {
|
||||
return thirdpartySnRelationMapper.selectSnRelationListByParams(stationId, pileSn);
|
||||
@Override
|
||||
public List<ThirdPartySnRelationVO> selectSnRelationListByParams(String stationId, String pileSn, List<Long> pileIds) {
|
||||
return thirdpartySnRelationMapper.selectSnRelationListByParams(stationId, pileSn, pileIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
FROM
|
||||
thirdparty_sn_relation t1
|
||||
JOIN thirdparty_station_relation t2 ON t1.thirdparty_type = t2.third_party_type
|
||||
JOIN pile_basic_info t3 on t1.pile_sn = t3.sn
|
||||
WHERE
|
||||
t1.del_flag = '0'
|
||||
<if test="stationId != null and stationId != ''">
|
||||
@@ -107,6 +108,12 @@
|
||||
<if test="pileSn != null and pileSn != ''">
|
||||
AND t1.pile_sn = #{pileSn,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="pileIds != null and pileIds.size() != 0">
|
||||
AND t3.id in
|
||||
<foreach collection="pileIds" item="pileId" open="(" separator="," close=")">
|
||||
#{pileId,jdbcType=BIGINT}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getRelationVOList" resultType="com.jsowell.pile.vo.web.ThirdPartySnRelationVO">
|
||||
|
||||
Reference in New Issue
Block a user