diff --git a/jsowell-admin/src/main/java/com/jsowell/service/PileService.java b/jsowell-admin/src/main/java/com/jsowell/service/PileService.java index 83d788460..9659b6030 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/PileService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/PileService.java @@ -464,10 +464,12 @@ public class PileService { if (StringUtils.equals(Constants.ONE, type)) { List pileMemberRelations = pileMemberRelationService.selectPileMemberRelationByPileSn(dto.getPileSn()); idList = pileMemberRelations.stream().map(PileMemberRelation::getId).collect(Collectors.toList()); + + // 管理员解绑,需要删除该桩的预约信息 + pileReservationInfoService.deleteReservationByPileSn(dto.getPileSn()); }else { idList.add(pileMemberRelation.getId()); } - return pileMemberRelationService.deleteRelationByIds(idList); } diff --git a/jsowell-admin/src/test/java/SpringBootTestController.java b/jsowell-admin/src/test/java/SpringBootTestController.java index ee5a7b231..e055afd8b 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -62,6 +62,7 @@ import com.jsowell.pile.service.programlogic.ProgramLogicFactory; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.transaction.dto.OrderTransactionDTO; import com.jsowell.pile.transaction.service.TransactionService; +import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.base.MemberWalletVO; import com.jsowell.pile.vo.base.PileInfoVO; import com.jsowell.pile.vo.uniapp.customer.*; @@ -309,6 +310,13 @@ public class SpringBootTestController { } } + @Test + public void batchSelectConnectorList() { + ArrayList stationIds = Lists.newArrayList("19", "2", "14"); + List connectorInfoVOS = pileConnectorInfoService.batchSelectConnectorList(stationIds); + System.out.println(connectorInfoVOS); + } + @Test public void selectPileConnectorInfoListByPileSnListTest() { List pileSnList = Lists.newArrayList(); diff --git a/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java b/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java index 42be0aa5f..e0236ff4a 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java +++ b/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java @@ -95,6 +95,8 @@ public class Constants { public static final String OPERATORID_LIANLIAN = "MA1JLFUU8"; public static final String OPERATORID_JIANG_SU = "MA1X78KH5"; + public static final String MANUFACTURER_NAME = "举视(江苏)新能源设备制造有限公司"; + public static final String OPERATORID_XI_XIAO = "MAC13L2Q9"; diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java index 42d96d496..a837c7532 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java @@ -25,6 +25,7 @@ public enum ThirdPlatformTypeEnum { SHEN_ZHEN_PLATFORM("14", "深圳平台", ""), ZHE_JIANG_PLATFORM("15", "浙江省平台", "002485048"), SU_ZHOU_PLATFORM("16", "苏州市平台", "MAC1MFJ1X"), + GAN_SU_PLATFORM("17", "甘肃省平台", ""), ; private String typeCode; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java index 425f3d77d..0cbf9e8e4 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java @@ -128,4 +128,11 @@ public interface PileConnectorInfoMapper { * @return */ PileConnectorInfoVO getConnectorInfoByParams(@Param("dto") QueryConnectorInfoDTO dto); + + /** + * 通过站点idList查询枪口列表信息 + * @param stationIds + * @return + */ + List batchSelectConnectorList(@Param("stationIds") List stationIds); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileReservationInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileReservationInfoMapper.java index 3eebf865d..8a3acf398 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileReservationInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileReservationInfoMapper.java @@ -37,4 +37,11 @@ public interface PileReservationInfoMapper { PileReservationInfo selectByPileConnectorCode(String pileConnectorCode); PileReservationInfo selectByPileSn(String pileSn); + + /** + * 根据桩编号删除预约记录 + * @param pileSn + * @return + */ + int deleteByPileSn(String pileSn); } \ No newline at end of file diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java index 1d31945cf..a7ed68530 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java @@ -114,6 +114,13 @@ public interface PileConnectorInfoService { List getConnectorListForLianLian(Long stationId); + /** + * 根据站点idList批量查询枪口数据 + * @param stationIds + * @return + */ + List batchSelectConnectorList(List stationIds); + List selectConnectorInfoList(String pileSn); PageResponse selectStationConnectorList(QueryConnectorListDTO dto); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileReservationInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileReservationInfoService.java index 59ccba5db..ce3678fe8 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileReservationInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileReservationInfoService.java @@ -1,14 +1,14 @@ package com.jsowell.pile.service; -import java.util.List; - import com.jsowell.common.core.page.PageResponse; +import com.jsowell.pile.domain.PileReservationInfo; import com.jsowell.pile.dto.CreateReservedDTO; import com.jsowell.pile.dto.PersonPileStopChargingDTO; import com.jsowell.pile.dto.PileReservationDTO; -import com.jsowell.pile.domain.PileReservationInfo; import com.jsowell.pile.vo.PileReservationInfoVO; +import java.util.List; + public interface PileReservationInfoService { int deleteByPrimaryKey(Integer id); @@ -77,5 +77,11 @@ public interface PileReservationInfoService { void initPersonalPileReservation(String pileConnectorCode); void initPersonalPileReservation(String pileSn, String connectorCode); + + /** + * 根据pileSn删除预约记录 + * @param pileSn + */ + void deleteReservationByPileSn(String pileSn); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java index d6e2d2b19..a28d6ebc6 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java @@ -1112,10 +1112,12 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { equipmentInfo.setEquipmentID(pileSn); equipmentInfo.setManufacturerID(Constants.OPERATORID_LIANLIAN); + equipmentInfo.setManufacturerName(Constants.MANUFACTURER_NAME); equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileBasicInfo.getCreateTime())); PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); equipmentInfo.setEquipmentType(Integer.valueOf(modelInfo.getSpeedType())); + equipmentInfo.setEquipmentModel(modelInfo.getModelName()); // Map pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn())); Map pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileSn)); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index 22243f7a3..7e39e7826 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -46,10 +46,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; import java.math.BigDecimal; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -484,10 +481,70 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { return list; } + @Override public List getConnectorListForLianLian(Long stationId) { return getUniAppConnectorList(stationId); } + /** + * 批量查询枪口列表 + * @param stationIds + * @return + */ + @Override + public List batchSelectConnectorList(List stationIds){ + List resultList = new ArrayList<>(); + Map> map = new LinkedHashMap<>(); + String baseRedisKey = CacheConstants.GET_UNIAPP_CONNECTOR_LIST_BY_STATION_ID; + // 先查询缓存数据 + for (String stationId : stationIds) { + String redisKey = baseRedisKey + stationId; + List list = redisCache.getCacheList(redisKey); + if (CollectionUtils.isNotEmpty(list)) { + map.put(stationId, list); + // 重新设置缓存 + redisCache.deleteObject(redisKey); + redisCache.setCacheList(redisKey, list); + redisCache.expire(redisKey, CacheConstants.cache_expire_time_1h); + } + } + // 先将已经有数据的stationId进行收集 + List hasDataStationIds = new ArrayList<>(map.keySet()); + List> values = new ArrayList<>(map.values()); + // 筛选出没有数据的stationIds + List noDataStationIds = stationIds.stream() + .filter(x -> !hasDataStationIds.contains(x)) + .collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(noDataStationIds)) { + // 重新查询数据库 + // 通过stationIds批量查询数据库 + List newConnectorInfoList = pileConnectorInfoMapper.batchSelectConnectorList(noDataStationIds); + if (CollectionUtils.isEmpty(values)) { + values = Lists.newArrayList(); + } + values.add(newConnectorInfoList); + + // 设置缓存 + // 先将list根据站点id分组 + Map> collect = newConnectorInfoList.stream() + .collect(Collectors.groupingBy(ConnectorInfoVO::getStationId)); + // 循环map并设置缓存 + for (Map.Entry> entry : collect.entrySet()) { + String stationId = entry.getKey(); + List voList = entry.getValue(); + + String redisKey = baseRedisKey + stationId; + redisCache.setCacheList(redisKey, voList); + redisCache.expire(redisKey, CacheConstants.cache_expire_time_1h); + } + } + + // 最终将 values 中的所有 ConnectorInfoVO 元素收集到 resultList + values.forEach(resultList::addAll); + + return resultList; + } + @Override public List selectConnectorInfoList(String pileSn) { // log.info("查询充电枪口详情-selectConnectorInfoList, param:{}", pileSn); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileReservationInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileReservationInfoServiceImpl.java index 4ff0fa684..56d6cc2cc 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileReservationInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileReservationInfoServiceImpl.java @@ -615,5 +615,10 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic String pileConnectorCode = pileSn + connectorCode; this.initPersonalPileReservation(pileConnectorCode); } + + @Override + public void deleteReservationByPileSn(String pileSn) { + pileReservationInfoMapper.deleteByPileSn(pileSn); + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/EquipmentInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/EquipmentInfo.java index 4509ad0c5..f1cc24ad5 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/EquipmentInfo.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/EquipmentInfo.java @@ -30,6 +30,12 @@ public class EquipmentInfo { @JSONField(name = "ManufacturerID") private String manufacturerID; + /** + * 设备生产商名称 + */ + @JSONField(name = "ManufacturerName") + private String manufacturerName; + /** * 设备型号 N * 由设备生厂商定义的设备型号 diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml index c241a0771..4e5cf5e33 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml @@ -285,4 +285,24 @@ AND t3.pile_connector_code = #{dto.pileConnectorCode,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileReservationInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileReservationInfoMapper.xml index 61a5f03b9..cbbfacab4 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileReservationInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileReservationInfoMapper.xml @@ -668,4 +668,9 @@ where del_flag = '0' and pile_sn = #{pileSn,jdbcType=VARCHAR} + + + delete from pile_reservation_info + where pile_sn = #{pileSn,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GanSuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GanSuPlatformServiceImpl.java new file mode 100644 index 000000000..82a38d115 --- /dev/null +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GanSuPlatformServiceImpl.java @@ -0,0 +1,257 @@ +package com.jsowell.thirdparty.platform.service.impl; + +import com.alibaba.fastjson2.JSON; +import com.github.pagehelper.PageInfo; +import com.jsowell.common.constant.Constants; +import com.jsowell.common.core.redis.RedisCache; +import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; +import com.jsowell.common.enums.ykc.ReturnCodeEnum; +import com.jsowell.common.exception.BusinessException; +import com.jsowell.common.util.JWTUtils; +import com.jsowell.common.util.PageUtils; +import com.jsowell.common.util.StringUtils; +import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.service.*; +import com.jsowell.pile.thirdparty.CommonParamsDTO; +import com.jsowell.pile.thirdparty.EquipmentInfo; +import com.jsowell.pile.vo.ThirdPartySecretInfoVO; +import com.jsowell.pile.vo.base.ConnectorInfoVO; +import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO; +import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo; +import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo; +import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO; +import com.jsowell.thirdparty.platform.domain.SupStationInfo; +import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory; +import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.ThirdPartyPlatformUtils; +import com.jsowell.thirdparty.service.ThirdpartySecretInfoService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 甘肃省平台 + * + * @author Lemon + * @Date 2024/11/5 13:31:06 + */ +public class GanSuPlatformServiceImpl implements ThirdPartyPlatformService { + + @Autowired + private ThirdpartySecretInfoService thirdpartySecretInfoService; + + @Autowired + private PileBasicInfoService pileBasicInfoService; + + @Autowired + private PileMerchantInfoService pileMerchantInfoService; + + @Autowired + private PileConnectorInfoService pileConnectorInfoService; + + @Autowired + private OrderBasicInfoService orderBasicInfoService; + + @Autowired + private PileStationInfoService pileStationInfoService; + + @Autowired + private RedisCache redisCache; + + // 平台类型 + private final String thirdPlatformType = ThirdPlatformTypeEnum.GAN_SU_PLATFORM.getTypeCode(); + + @Override + public void afterPropertiesSet() throws Exception { + ThirdPartyPlatformFactory.register(thirdPlatformType, this); + } + + /** + * 请求令牌 query_token + * @param dto + * @return + */ + @Override + public Map queryToken(CommonParamsDTO dto) { + AccessTokenVO vo = new AccessTokenVO(); + // 0:成功;1:失败 + int succStat = 0; + // 0:无;1:无此对接平台;2:密钥错误; 3~99:自定义 + int failReason = 0; + + String operatorId = dto.getOperatorID(); + // token缓存key值 + String redisKey = operatorId + "_token:"; + // 通过operatorId 查出 operatorSecret + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGanSuSecretInfo(); + if (thirdPartySecretInfoVO == null) { + failReason = 1; + succStat = 1; + } else { + String ourOperatorSecret = thirdPartySecretInfoVO.getOurOperatorSecret(); + String dataSecret = thirdPartySecretInfoVO.getOurDataSecret(); + String dataSecretIv = thirdPartySecretInfoVO.getOurDataSecretIv(); + // 解密data 获取参数中的OperatorSecret + String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv); + String inputOperatorSecret = null; + if (StringUtils.isNotBlank(decrypt)) { + inputOperatorSecret = JSON.parseObject(decrypt).getString("OperatorSecret"); + } + // 对比密钥 + if (!StringUtils.equals(ourOperatorSecret, inputOperatorSecret)) { + failReason = 1; + succStat = 1; + } else { + // 先查缓存中是否有已生成的token + String token = redisCache.getCacheObject(redisKey); + int expiredTime = (int) redisCache.getExpire(redisKey); + if (StringUtils.isBlank(token)){ + // 生成token + token = JWTUtils.createToken(operatorId, ourOperatorSecret, JWTUtils.ttlMillis); + expiredTime = (int) (JWTUtils.ttlMillis / 1000); + } + vo.setAccessToken(token); + vo.setTokenAvailableTime(expiredTime); + // 设置缓存 + redisCache.setCacheObject(redisKey, token, expiredTime, TimeUnit.SECONDS); + } + } + // 组装返回参数 + vo.setOperatorID(operatorId); + vo.setFailReason(failReason); + vo.setSuccStat(succStat); + + Map resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret() + , thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getOurSigSecret()); + return resultMap; + } + + /** + * 查询站点信息 query_stations_info + * @param dto 查询站点信息dto + * @return + */ + @Override + public Map queryStationsInfo(QueryStationInfoDTO dto) { + int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo(); + int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize(); + + PageUtils.startPage(pageNo, pageSize); + List stationInfos = pileStationInfoService.getStationInfosByThirdParty(dto); + if (CollectionUtils.isEmpty(stationInfos)) { + // 未查到数据 + return null; + } + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGanSuSecretInfo(); + + PageInfo pageInfo = new PageInfo<>(stationInfos); + List resultList = new ArrayList<>(); + for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) { + String stationId = String.valueOf(pileStationInfo.getId()); + SupStationInfo stationInfo = SupStationInfo.builder() + .stationID(stationId) + .operatorID(Constants.OPERATORID_JIANG_SU) + .stationName(pileStationInfo.getStationName()) + .countryCode(pileStationInfo.getCountryCode()) + .address(pileStationInfo.getAddress()) + .stationType(Integer.parseInt(pileStationInfo.getStationType())) + .stationStatus(Integer.parseInt(pileStationInfo.getStationStatus())) + .stationLng(new BigDecimal(pileStationInfo.getStationLng())) + .stationLat(new BigDecimal(pileStationInfo.getStationLat())) + .construction(Integer.parseInt(pileStationInfo.getConstruction())) + .parkNums(Integer.parseInt(pileStationInfo.getParkNums())) + // todo .electricityFee() + // todo .serviceFee() + + .build(); + // busineHours + String busineHours = getBusineHours(); + stationInfo.setBusineHours(busineHours); + + // areaCode + String[] split = StringUtils.split(pileStationInfo.getAreaCode(), ","); + // 只取最后一部分 330213 + String subAreaCode = split[split.length - 1]; + stationInfo.setAreaCode(subAreaCode); + + // EquipmentOwnerID + String organizationCode = pileStationInfo.getOrganizationCode(); + if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { + String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1); + stationInfo.setEquipmentOwnerID(equipmentOwnerId); + } else { + stationInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU); + } + + List pileList = pileBasicInfoService.getPileListForLianLian(stationId); + if (CollectionUtils.isNotEmpty(pileList)) { + stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表 + } + resultList.add(stationInfo); + } + Map map = new LinkedHashMap<>(); + map.put("PageNo", pageInfo.getPageNum()); + map.put("PageCount", pageInfo.getPages()); + map.put("ItemSize", pageInfo.getTotal()); + map.put("StationInfos", resultList); + return ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO); + } + + + /** + * 拉取充电站中的充电枪的状态数据 query_station_status + * @param dto 查询站点信息dto + * @return + */ + @Override + public Map queryStationStatus(QueryStationInfoDTO dto) { + List stationIds = dto.getStationIds(); + List StationStatusInfos = new ArrayList<>(); + List connectorStatusInfos = new ArrayList<>(); + // 查询密钥信息 + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGanSuSecretInfo(); + + ConnectorStatusInfo connectorStatusInfo; + // 根据站点idList查询 + List list = pileConnectorInfoService.batchSelectConnectorList(stationIds); + + + + + return null; + } + + /** + * 获取甘肃平台密钥 + * @return + */ + private ThirdPartySecretInfoVO getGanSuSecretInfo() { + String thirdPartyType = ThirdPlatformTypeEnum.GAN_SU_PLATFORM.getTypeCode(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPartyType); + if (thirdPartySecretInfoVO == null) { + throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); + } + thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU); + return thirdPartySecretInfoVO; + } + + private String getBusineHours() { + Map map = new LinkedHashMap<>(); + map.put("1", "[\"00:00-24:00\"]"); + map.put("2", "[\"00:00-24:00\"]"); + map.put("3", "[\"00:00-24:00\"]"); + map.put("4", "[\"00:00-24:00\"]"); + map.put("5", "[\"00:00-24:00\"]"); + map.put("6", "[\"00:00-24:00\"]"); + map.put("7", "[\"00:00-24:00\"]"); + + return map.toString(); + } +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java index cd4822294..71f1ee511 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java @@ -204,6 +204,15 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { */ @Override public Map queryStationsInfo(QueryStationInfoDTO dto) { + // 查询出要查询的充电站id并set进 dto 的stationIds + List stationRelationList = thirdPartyStationRelationService.selectThirdPartyStationRelationList(thirdPlatformType); + if (CollectionUtils.isNotEmpty(stationRelationList)) { + List stationIdList = stationRelationList.stream() + .map(x -> String.valueOf(x.getStationId())) + .collect(Collectors.toList()); + dto.setStationIds(stationIdList); + } + int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo(); int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize(); diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SuZhouPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SuZhouPlatformServiceImpl.java index 54382fb50..ad1a4b7ca 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SuZhouPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SuZhouPlatformServiceImpl.java @@ -233,10 +233,8 @@ public class SuZhouPlatformServiceImpl implements ThirdPartyPlatformService { return null; } // ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId()); - ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType); - if (thirdPartySecretInfoVO == null) { - return null; - } + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getSuZhouSecretInfo(); + PageInfo pageInfo = new PageInfo<>(stationInfos); List resultList = new ArrayList<>(); for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) {