mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-15 07:18:31 +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 org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -143,10 +144,15 @@ public class PileController extends BaseController {
|
|||||||
public RestApiResponse<?> selectStationConnectorList(HttpServletRequest request, @RequestBody QueryConnectorListDTO dto) {
|
public RestApiResponse<?> selectStationConnectorList(HttpServletRequest request, @RequestBody QueryConnectorListDTO dto) {
|
||||||
logger.info("查询充电枪口列表 params:{}", JSON.toJSONString(dto));
|
logger.info("查询充电枪口列表 params:{}", JSON.toJSONString(dto));
|
||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
|
try {
|
||||||
|
// 修改对接第三方平台的枪口状态
|
||||||
|
updateThirdPartyConnectorStatus(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("修改对接第三方平台的枪口状态 error");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PageResponse pageResponse = pileConnectorInfoService.selectStationConnectorList(dto);
|
PageResponse pageResponse = pileConnectorInfoService.selectStationConnectorList(dto);
|
||||||
List<PileConnectorInfoVO> list = (List<PileConnectorInfoVO>) pageResponse.getList();
|
|
||||||
updateThirdPartyConnectorStatus(list);
|
|
||||||
response = new RestApiResponse<>(pageResponse);
|
response = new RestApiResponse<>(pageResponse);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("查询充电枪口列表异常", 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) {
|
private void updateThirdPartyConnectorStatus(QueryConnectorListDTO dto) {
|
||||||
if (CollectionUtils.isEmpty(connectorList)) {
|
if (dto == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<String> stationIdList = connectorList.stream()
|
List<Long> pileIds = dto.getPileIds();
|
||||||
.map(PileConnectorInfoVO::getStationId)
|
List<Long> stationIdList = dto.getStationIdList();
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
for (String stationId : stationIdList) {
|
List<ThirdPartySnRelationVO> list = new ArrayList<>();
|
||||||
String stationIdStr = String.valueOf(stationId);
|
if (CollectionUtils.isNotEmpty(pileIds)) {
|
||||||
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(stationIdStr, null);
|
list = snRelationService.selectSnRelationListByParams(null, null, pileIds);
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
}
|
||||||
return;
|
if (CollectionUtils.isNotEmpty(stationIdList)) {
|
||||||
}
|
for (Long stationId : stationIdList) {
|
||||||
for (ThirdPartySnRelationVO vo : list) {
|
String stationIdStr = String.valueOf(stationId);
|
||||||
String thirdPartyType = vo.getThirdPartyType();
|
list = snRelationService.selectSnRelationListByParams(stationIdStr, null, null);
|
||||||
// 调用通用查询实时数据接口(需在接口中修改枪口状态)
|
|
||||||
commonService.commonQueryStationStatus(stationIdStr, thirdPartyType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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();
|
String pileSn = orderInfo.getPileSn();
|
||||||
|
|
||||||
// 根据 stationId 查询 pile_sn_relation 表
|
// 根据 stationId 查询 pile_sn_relation 表
|
||||||
List<ThirdPartySnRelationVO> snRelations = snRelationService.selectSnRelationListByParams(stationId, pileSn);
|
List<ThirdPartySnRelationVO> snRelations = snRelationService.selectSnRelationListByParams(stationId, pileSn, null);
|
||||||
if (CollectionUtils.isEmpty(snRelations)) {
|
if (CollectionUtils.isEmpty(snRelations)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.jsowell.web.controller.pile;
|
package com.jsowell.web.controller.pile;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.jsowell.api.uniapp.PileController;
|
||||||
import com.jsowell.common.annotation.Log;
|
import com.jsowell.common.annotation.Log;
|
||||||
import com.jsowell.common.core.controller.BaseController;
|
import com.jsowell.common.core.controller.BaseController;
|
||||||
import com.jsowell.common.core.page.TableDataInfo;
|
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.QueryConnectorListDTO;
|
||||||
import com.jsowell.pile.dto.UpdateConnectorParkNoDTO;
|
import com.jsowell.pile.dto.UpdateConnectorParkNoDTO;
|
||||||
import com.jsowell.pile.service.IThirdpartySnRelationService;
|
import com.jsowell.pile.service.IThirdpartySnRelationService;
|
||||||
|
import com.jsowell.pile.service.PileBasicInfoService;
|
||||||
import com.jsowell.pile.service.PileConnectorInfoService;
|
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.PileConnectorInfoVO;
|
||||||
import com.jsowell.pile.vo.web.ThirdPartySnRelationVO;
|
import com.jsowell.pile.vo.web.ThirdPartySnRelationVO;
|
||||||
import com.jsowell.thirdparty.common.CommonService;
|
import com.jsowell.thirdparty.common.CommonService;
|
||||||
@@ -22,6 +25,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -40,6 +44,12 @@ public class PileConnectorInfoController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IThirdpartySnRelationService snRelationService;
|
private IThirdpartySnRelationService snRelationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileStationInfoService pileStationInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileBasicInfoService pileBasicInfoService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
|
|
||||||
@@ -74,9 +84,13 @@ public class PileConnectorInfoController extends BaseController {
|
|||||||
@PostMapping("/getConnectorInfoListByParams")
|
@PostMapping("/getConnectorInfoListByParams")
|
||||||
public TableDataInfo getConnectorInfoListByParams(@RequestBody QueryConnectorListDTO dto) {
|
public TableDataInfo getConnectorInfoListByParams(@RequestBody QueryConnectorListDTO dto) {
|
||||||
logger.info("查询接口列表 param:{}", JSON.toJSONString(dto));
|
logger.info("查询接口列表 param:{}", JSON.toJSONString(dto));
|
||||||
|
try {
|
||||||
|
// 修改对接第三方平台的枪口状态
|
||||||
|
updateThirdPartyConnectorStatus(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("修改对接第三方平台的枪口状态 error");
|
||||||
|
}
|
||||||
List<PileConnectorInfoVO> list = pileConnectorInfoService.getConnectorInfoListByParams(dto);
|
List<PileConnectorInfoVO> list = pileConnectorInfoService.getConnectorInfoListByParams(dto);
|
||||||
// 修改对接第三方平台的枪口状态
|
|
||||||
updateThirdPartyConnectorStatus(list);
|
|
||||||
logger.info("查询接口列表 result:{}", JSON.toJSONString(list));
|
logger.info("查询接口列表 result:{}", JSON.toJSONString(list));
|
||||||
return getDataTable(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) {
|
private void updateThirdPartyConnectorStatus(QueryConnectorListDTO dto) {
|
||||||
if (CollectionUtils.isEmpty(connectorList)) {
|
if (dto == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<String> stationIdList = connectorList.stream()
|
List<Long> pileIds = dto.getPileIds();
|
||||||
.map(PileConnectorInfoVO::getStationId)
|
List<Long> stationIdList = dto.getStationIdList();
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
for (String stationId : stationIdList) {
|
List<ThirdPartySnRelationVO> list = new ArrayList<>();
|
||||||
String stationIdStr = String.valueOf(stationId);
|
if (CollectionUtils.isNotEmpty(pileIds)) {
|
||||||
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(stationIdStr, null);
|
list = snRelationService.selectSnRelationListByParams(null, null, pileIds);
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
}
|
||||||
return;
|
if (CollectionUtils.isNotEmpty(stationIdList)) {
|
||||||
}
|
for (Long stationId : stationIdList) {
|
||||||
for (ThirdPartySnRelationVO vo : list) {
|
String stationIdStr = String.valueOf(stationId);
|
||||||
String thirdPartyType = vo.getThirdPartyType();
|
list = snRelationService.selectSnRelationListByParams(stationIdStr, null, null);
|
||||||
// 调用通用查询实时数据接口(需在接口中修改枪口状态)
|
}
|
||||||
commonService.commonQueryStationStatus(stationIdStr, thirdPartyType);
|
}
|
||||||
}
|
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
|
* @param stationId
|
||||||
* @return
|
* @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<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)) {
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
for (ThirdPartySnRelationVO vo : list) {
|
for (ThirdPartySnRelationVO vo : list) {
|
||||||
String startMode = vo.getStartMode();
|
String startMode = vo.getStartMode();
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ public class ThirdpartySnRelationServiceImpl implements IThirdpartySnRelationSer
|
|||||||
return thirdpartySnRelationMapper.selectThirdpartySnRelationList(thirdpartySnRelation);
|
return thirdpartySnRelationMapper.selectThirdpartySnRelationList(thirdpartySnRelation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<ThirdPartySnRelationVO> selectSnRelationListByParams(String stationId, String pileSn) {
|
public List<ThirdPartySnRelationVO> selectSnRelationListByParams(String stationId, String pileSn, List<Long> pileIds) {
|
||||||
return thirdpartySnRelationMapper.selectSnRelationListByParams(stationId, pileSn);
|
return thirdpartySnRelationMapper.selectSnRelationListByParams(stationId, pileSn, pileIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -99,6 +99,7 @@
|
|||||||
FROM
|
FROM
|
||||||
thirdparty_sn_relation t1
|
thirdparty_sn_relation t1
|
||||||
JOIN thirdparty_station_relation t2 ON t1.thirdparty_type = t2.third_party_type
|
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
|
WHERE
|
||||||
t1.del_flag = '0'
|
t1.del_flag = '0'
|
||||||
<if test="stationId != null and stationId != ''">
|
<if test="stationId != null and stationId != ''">
|
||||||
@@ -107,6 +108,12 @@
|
|||||||
<if test="pileSn != null and pileSn != ''">
|
<if test="pileSn != null and pileSn != ''">
|
||||||
AND t1.pile_sn = #{pileSn,jdbcType=VARCHAR}
|
AND t1.pile_sn = #{pileSn,jdbcType=VARCHAR}
|
||||||
</if>
|
</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>
|
||||||
|
|
||||||
<select id="getRelationVOList" resultType="com.jsowell.pile.vo.web.ThirdPartySnRelationVO">
|
<select id="getRelationVOList" resultType="com.jsowell.pile.vo.web.ThirdPartySnRelationVO">
|
||||||
|
|||||||
Reference in New Issue
Block a user