diff --git a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/SiChuanController.java b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/SiChuanController.java index 67c30c941..0eff319d2 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/SiChuanController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/SiChuanController.java @@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import java.util.List; import java.util.Map; /** @@ -22,7 +23,7 @@ import java.util.Map; @Anonymous @RequestMapping("/sichuan") public class SiChuanController extends ThirdPartyBaseController { - private final String platformName = ""; + private final String platformName = "四川省监管平台"; private final String platformType = ThirdPlatformTypeEnum.SI_CHUAN_PLATFORM.getTypeCode(); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/dto/ConnectorInfoDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/dto/ConnectorInfoDTO.java new file mode 100644 index 000000000..aac4c3f50 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/dto/ConnectorInfoDTO.java @@ -0,0 +1,170 @@ +package com.jsowell.pile.thirdparty.dto; + +import com.alibaba.fastjson2.annotation.JSONField; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * 充电设备接口信息 + */ +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Data +public class ConnectorInfoDTO { + /** + * 充电设备接口编码 Y + * 充电设备接口编码,同一对接平台内唯一 + */ + @JSONField(name = "ConnectorID") + private String connectorID; + + /** + * 设备接口分类 + * 1:车辆充电设备接口 + * 2:换电站内的电池箱 充电设备接口 + */ + @JSONField(name = "EquipmentClassification") + private Integer equipmentClassification; + + /** + * 充电设备接口名称 N + */ + @JSONField(name = "ConnectorName") + private String connectorName; + + /** + * 充电设备接口类型 Y + * 1:家用插座(模式2) + * 2:交流接口插座(模式3,连接方式B ) + * 3:交流接口插头(带枪线,模式3,连接方式C) + * 4:直流接口枪头(带枪线,模式4) + */ + @JSONField(name = "ConnectorType") + private Integer connectorType; + + /** + * 枪口状态 + */ + @JSONField(name = "Status") + private Integer status; + + /** + * 额定电压上限(单位:V) Y + */ + @JSONField(name = "VoltageUpperLimits") + private BigDecimal voltageUpperLimits; + + /** + * 额定电压下限(单位:V) Y + */ + @JSONField(name = "VoltageLowerLimits") + private BigDecimal voltageLowerLimits; + + /** + *恒功率电压上限 + */ + @JSONField(name = "ConstantVoltageUpperLimits") + private Integer constantVoltageUpperLimits; + + /** + *恒功率电压下限 + */ + @JSONField(name = "ConstantVoltageLowerLimits") + private Integer constantVoltageLowerLimits; + + /** + * 额定电流(单位:A) Y + */ + @JSONField(name = "Current") + private BigDecimal current; + + /** + *恒功率电流上限 + */ + @JSONField(name = "ConstantCurrentUpperLimits") + private Integer ConstantCurrentUpperLimits; + + /** + * 额 定 电 流 上限 + */ + @JSONField(name = "CurrentUpperLimits") + private Integer currentUpperLimits; + + /** + * 额 定 电 流 下限 + */ + @JSONField(name = "CurrentLowerLimits") + private Integer currentLowerLimits; + + /** + *恒功率电流下限 + */ + @JSONField(name = "ConstantCurrentLowerLimits") + private Integer ConstantCurrentLowerLimits; + + /** + * 额定功率(单位:kW) Y + */ + @JSONField(name = "Power") + private BigDecimal power; + + /** + * 接口功率类型 + */ + @JSONField(name = "PowerType") + private Integer powerType; + + /** + * 车位号 N + * 停车场车位编号 + */ + @JSONField(name = "ParkNo") + private String parkNo; + + + /** + * 运营状态 + * 0-未知 + * 1-建设中 + * 5-关闭下线 + * 6-维护中 + * 50-正常使用 + */ + @JSONField(name = "OperateStatus") + private Integer operateStatus; + + /** + * 运营状态 + * 0-未知 + * 1-建设中 + * 5-关闭下线 + * 6-维护中 + * 50-正常使用 + */ + @JSONField(name = "OpreateStatus") + private Integer opreateStatus; + + /** + * 国家标准 + */ + @JSONField(name = "NationalStandard") + private Integer nationalStandard; + + /** + * 辅助电源 + */ + @JSONField(name = "AuxPower") + private Integer auxPower; + + /** + * 运营时间 + */ + @JSONField(name = "OpreateHours") + private String opreateHours; + +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/dto/EquipmentInfoDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/dto/EquipmentInfoDTO.java new file mode 100644 index 000000000..596c351ec --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/dto/EquipmentInfoDTO.java @@ -0,0 +1,217 @@ +package com.jsowell.pile.thirdparty; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.jsowell.pile.thirdparty.dto.ConnectorInfoDTO; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 充电设备信息 + */ +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Data +public class EquipmentInfoDTO { + /** + * 设备编码 Y + * 设备唯一编码,对同一对接平台,保证唯一 + */ + @JSONField(name = "EquipmentID") + private String equipmentID; + + /** + * 设备唯一编码 + *设备生产商组织机构代 码 9 位+设备出厂唯一 编码 + */ + @JSONField(name = "EquipmentUniqueNumber") + private String equipmentUniqueNumber; + + /** + * 设备生产商组织机构代码 Y + */ + @JSONField(name = "ManufacturerID") + private String manufacturerID; + + /** + * 设备生产商名称 + */ + @JSONField(name = "ManufacturerName") + private String manufacturerName; + + /** + * 设备型号 N + * 由设备生厂商定义的设备型号 + */ + @JSONField(name = "EquipmentModel") + private String equipmentModel; + + /** + * 设备名称 N + */ + @JSONField(name = "EquipmentName") + private String equipmentName; + + /** + * 设备生产日期 N + * YYYY-MM-DD + */ + @JSONField(name = "ProductionDate") + private String productionDate; + + /** + * 建设时间 Y + * YYYY-MM-DD + */ + @JSONField(name = "ConstructionTime") + private String constructionTime; + + /** + * 设备类型(1-直流设备;2-交流设备;3-交直流一体设备) Y + */ + @JSONField(name = "EquipmentType") + private Integer equipmentType; + + /** + * 设备分类 + * 1:车辆充电设备 2:换电站内的电池箱 充电设备 + */ + @JSONField(name = "EquipmentClassification") + private Integer equipmentClassification; + + /** + * 设备状态 Y + * 0:未知 + * 1:建设中 + * 5:关闭下线 + * 6:维护中 + * 50:正常使用 + */ + @JSONField(name = "EquipmentStatus") + private Integer equipmentStatus; + + /** + * 充电设备用途 + * 1:公用; + * 2:专用; + * 3:个人分时共享; + * 4:限制类公用; + * 9:其他 + */ + @JSONField(name = "EquipmentApplication") + private String equipmentApplication; + + /** + * 额定功率(单位:kW) Y + */ + @JSONField(name = "EquipmentPower") + private BigDecimal equipmentPower; + + /** + * 新国标(0-否;1-是) Y + * 是否新国标 + */ + @JSONField(name = "NewNationalStandard") + private Integer newNationalStandard; + + /** + * 充电设备接口列表 Y + * 该充电设备所有的充电设备接口的信息对象集合 + */ + @JSONField(name = "ConnectorInfos") + private List connectorInfos; + + /** + * 充电设备经度 N + * GCJ-02坐标系 + */ + @JSONField(name = "EquipmentLng") + private BigDecimal equipmentLng; + + /** + * 充电设备纬度 N + * GCJ-02坐标系 + */ + @JSONField(name = "EquipmentLat") + private BigDecimal equipmentLat; + + /** + * 是否支持VIN码识别(0-否;1-是) Y + */ + @JSONField(name = "VinFlag") + private Integer vinFlag; + + /** + * 设备总功率 + */ + @JSONField(name = "Power") + private BigDecimal power; + + /** + * 设备开通时间 + */ + @JSONField(name = "OpenDate") + private String openDate; + + /** + * 设备投资金额 + */ + @JSONField(name = "EquipmentInvestment") + private BigDecimal equipmentInvestment; + + /** + * 设备出厂序号 + */ + @JSONField(name = "ProductSN") + private String productSN; + + /** + * 是否支持自动识别VIN码 + */ + @JSONField(name = "SVIN") + private Integer svin; + + /** + * 是否支持有序充电 + */ + @JSONField(name = "SautoPower") + private Integer sautoPower; + + /** + * 额定电压上限 + */ + @JSONField(name = "VoltageUpperLimits") + private BigDecimal voltageUpperLimits; + + /** + * 额定电压下限 + */ + @JSONField(name = "VoltageLowerLimits") + private BigDecimal voltageLowerLimits; + + /** + * 额定电流 + */ + @JSONField(name = "Current") + private BigDecimal current; + + + /** + * 站点额定功率 + */ + private BigDecimal stationRatedPower; + + + /** + *报装户号 + * 如整个站按一个户号立户的,则站内所以设备的户号为同一个,如果是桩立户,则为桩实际立户户号。20 字符。 + */ + @JSONField(name = "ConsNo") + private String ConsNo; + +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/dto/SupStationInfoDTO.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/dto/SupStationInfoDTO.java new file mode 100644 index 000000000..d11cda7cd --- /dev/null +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/dto/SupStationInfoDTO.java @@ -0,0 +1,26 @@ +package com.jsowell.thirdparty.platform.dto; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.jsowell.pile.thirdparty.EquipmentInfoDTO; +import com.jsowell.thirdparty.platform.domain.SupStationInfo; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import java.util.List; + + +/** + * 内蒙古平台站点信息 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@SuperBuilder +public class SupStationInfoDTO extends SupStationInfo { + + @JSONField(name = "EquipmentInfos") + private List equipmentInfosDTO; + +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SiChuanPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SiChuanPlatformServiceImpl.java index 1855f3534..2531cadbf 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SiChuanPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/SiChuanPlatformServiceImpl.java @@ -1,5 +1,6 @@ package com.jsowell.thirdparty.platform.service.impl; +import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.github.pagehelper.PageHelper; @@ -8,39 +9,33 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.jsowell.common.constant.Constants; import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; -import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum; +import com.jsowell.common.enums.lianlian.LianLianPileStatusEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; -import com.jsowell.common.enums.ykc.BillingTimeTypeEnum; -import com.jsowell.common.enums.ykc.OrderStatusEnum; -import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; -import com.jsowell.common.enums.ykc.ReturnCodeEnum; +import com.jsowell.common.enums.ykc.*; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.*; import com.jsowell.pile.domain.*; -import com.jsowell.pile.domain.ykcCommond.StartChargingCommand; import com.jsowell.pile.dto.*; -import com.jsowell.pile.mapper.OrderMonitorDataMapper; +import com.jsowell.pile.mapper.PileBasicInfoMapper; import com.jsowell.pile.service.*; -import com.jsowell.pile.thirdparty.CommonParamsDTO; -import com.jsowell.pile.thirdparty.ConnectorInfo; -import com.jsowell.pile.thirdparty.EquipmentInfo; +import com.jsowell.pile.thirdparty.*; +import com.jsowell.pile.thirdparty.EquipmentInfoDTO; +import com.jsowell.pile.thirdparty.dto.ConnectorInfoDTO; import com.jsowell.pile.util.MerchantUtils; import com.jsowell.pile.vo.SupStationStatsVO; import com.jsowell.pile.vo.ThirdPartySecretInfoVO; import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.base.MerchantInfoVO; -import com.jsowell.pile.vo.base.StationInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO; import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO; import com.jsowell.pile.vo.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileMerchantInfoVO; -import com.jsowell.pile.vo.web.PileModelInfoVO; import com.jsowell.pile.vo.web.PileStationVO; -import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO; import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo; import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo; import com.jsowell.thirdparty.lianlian.vo.*; import com.jsowell.thirdparty.platform.domain.*; +import com.jsowell.thirdparty.platform.dto.SupStationInfoDTO; import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory; import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService; import com.jsowell.thirdparty.platform.util.Cryptos; @@ -51,19 +46,11 @@ import com.yi.business.geo.GeoCodeInfo; import com.yi.business.geo.TermRelationTreeCoordinate; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; -import org.bouncycastle.crypto.CryptoException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.math.RoundingMode; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import java.security.spec.InvalidKeySpecException; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.format.DateTimeFormatter; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -94,11 +81,10 @@ public class SiChuanPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private PileBillingTemplateService pileBillingTemplateService; - @Autowired - private YKCPushCommandService ykcPushCommandService; @Autowired - private PileRemoteService pileRemoteService; + private PileBasicInfoMapper pileBasicInfoMapper; + @Autowired private ThirdPartyStationRelationService thirdPartyStationRelationService; @@ -221,20 +207,19 @@ public class SiChuanPlatformServiceImpl implements ThirdPartyPlatformService { public Map queryStationsInfo(QueryStationInfoDTO dto) { int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo(); int pageSize = dto.getPageSize() == null ? 50 : dto.getPageSize(); - dto.setThirdPlatformType(thirdPlatformType); + dto.setThirdPlatformType("25"); PageUtils.startPage(pageNo, pageSize); List stationInfos = pileStationInfoService.selectStationInfosByThirdParty(dto); if (CollectionUtils.isEmpty(stationInfos)) { // 未查到数据 return null; } - // ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId()); - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getSiChuanSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = null; PageInfo pageInfo = new PageInfo<>(stationInfos); - List resultList = new ArrayList<>(); + List resultList = new ArrayList<>(); for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) { - SupStationInfo stationInfo = new SupStationInfo(); + SupStationInfoDTO stationInfo = new SupStationInfoDTO(); stationInfo.setStationID(String.valueOf(pileStationInfo.getId())); stationInfo.setOperatorID(Constants.OPERATORID_JIANG_SU); // 组织机构代码 String organizationCode = pileStationInfo.getOrganizationCode(); @@ -275,10 +260,13 @@ public class SiChuanPlatformServiceImpl implements ThirdPartyPlatformService { stationInfo.setCapacity(pileStationInfo.getCapacity().setScale(4, RoundingMode.HALF_UP)); } // 获取充电桩设备列表 - List pileList = getPileList(pileStationInfo,pileStationInfo.getStationStatus()); + List pileList = getPileList(String.valueOf(pileStationInfo.getId())); + if (CollectionUtils.isNotEmpty(pileList)) { + stationInfo.setEquipmentInfosDTO(pileList); // 充电设备信息列表 + } // 站点额定总功率 BigDecimal stationRatedPower = pileList.stream() - .map(EquipmentInfo::getEquipmentPower) + .map(EquipmentInfoDTO::getEquipmentPower) .reduce(BigDecimal.ZERO, BigDecimal::add); stationInfo.setRatedPower(stationRatedPower.setScale(4, RoundingMode.HALF_UP)); @@ -294,9 +282,6 @@ public class SiChuanPlatformServiceImpl implements ThirdPartyPlatformService { if (StringUtils.isNotBlank(pileStationInfo.getPictures())) { stationInfo.setPictures(Lists.newArrayList(pileStationInfo.getPictures().split(","))); } - if (CollectionUtils.isNotEmpty(pileList)) { - stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表 - } StringBuilder electricityFee = new StringBuilder(); StringBuilder serviceFee = new StringBuilder(); // 查询计费模板 @@ -339,6 +324,7 @@ public class SiChuanPlatformServiceImpl implements ThirdPartyPlatformService { map.put("PageCount", pageInfo.getPages()); map.put("PageNo", pageInfo.getPageNum()); map.put("StationInfos", resultList); + log.info("queryStationsInfo result : " + JSON.toJSONString(map)); return ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO); } @@ -366,7 +352,7 @@ public class SiChuanPlatformServiceImpl implements ThirdPartyPlatformService { // 组装中电联平台所需要的数据格式 - SupStationInfo info = SupStationInfo.builder() + SupStationInfoDTO info = SupStationInfoDTO.builder() .stationID(stationId) .operatorID(Constants.OPERATORID_JIANG_SU) .stationName(pileStationInfo.getStationName()) @@ -401,11 +387,11 @@ public class SiChuanPlatformServiceImpl implements ThirdPartyPlatformService { } //获取充电桩设备列表 - List pileList = getPileList(pileStationInfo,pileStationInfo.getStationStatus()); + List pileList = getPileList(String.valueOf(pileStationInfo.getId())); // 站点额定总功率 BigDecimal stationRatedPower = pileList.stream() - .map(EquipmentInfo::getEquipmentPower) + .map(EquipmentInfoDTO::getEquipmentPower) .reduce(BigDecimal.ZERO, BigDecimal::add); info.setRatedPower(stationRatedPower.setScale(4, RoundingMode.HALF_UP)); info.setPeriodFee(Constants.one); @@ -461,7 +447,7 @@ public class SiChuanPlatformServiceImpl implements ThirdPartyPlatformService { } if (CollectionUtils.isNotEmpty(pileList)) { - info.setEquipmentInfos(pileList); // 充电设备信息列表 + info.setEquipmentInfosDTO(pileList); // 充电设备信息列表 } stationInfos.add(info); @@ -1125,79 +1111,98 @@ public class SiChuanPlatformServiceImpl implements ThirdPartyPlatformService { - /** - * 获取桩列表信息 - * - * @param pileStationInfo - * @param stationStatus - * @return - */ - private List getPileList(PileStationInfo pileStationInfo , String stationStatus) { - List resultList = new ArrayList<>(); + public List getPileList(String stationId) { + List resultList = new ArrayList<>(); // 通过站点id查询桩基本信息 - List list = pileBasicInfoService.getPileListByStationId(String.valueOf(pileStationInfo.getId())); - // 封装成中电联平台对象 - for (PileBasicInfo pileBasicInfo : list) { - EquipmentInfo equipmentInfo = new EquipmentInfo(); - String pileSn = pileBasicInfo.getSn(); + List list = getPileDetailInfoList(stationId); + // 封装成联联平台对象 + for (PileDetailInfoVO pileDetailInfoVO : list) { + com.jsowell.pile.thirdparty.EquipmentInfoDTO equipmentInfo = new EquipmentInfoDTO(); + String pileSn = pileDetailInfoVO.getPileSn(); equipmentInfo.setEquipmentID(pileSn); - equipmentInfo.setEquipmentClassification(Constants.one); - PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); - equipmentInfo.setEquipmentType(Integer.parseInt(modelInfo.getSpeedType())); - equipmentInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(4, RoundingMode.HALF_UP)); + equipmentInfo.setEquipmentClassification(1); - List connectorList = getConnectorList(pileBasicInfo,stationStatus); + if (StringUtils.isBlank(pileDetailInfoVO.getSpeedType())) { + continue; + } + equipmentInfo.setEquipmentType(Integer.valueOf(pileDetailInfoVO.getSpeedType())); + equipmentInfo.setEquipmentPower(new BigDecimal(pileDetailInfoVO.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + + String pileStatus = pileDetailInfoVO.getPileStatus(); + if (StringUtils.equals(PileStatusEnum.ON_LINE.getValue(), pileStatus)) { + // 1-在线 + pileStatus = LianLianPileStatusEnum.NORMAL.getCode(); + } else if (StringUtils.equals(PileStatusEnum.OFF_LINE.getValue(), pileStatus)) { + // 2-离线 + pileStatus = LianLianPileStatusEnum.CLOSE_OFFLINE.getCode(); + } else if (StringUtils.equals(PileStatusEnum.FAULT.getValue(), pileStatus)) { + // 3-故障 + pileStatus = LianLianPileStatusEnum.UNDER_MAINTENANCE.getCode(); + } + + equipmentInfo.setPower(new BigDecimal(pileDetailInfoVO.getRatedPower()).setScale(4, RoundingMode.HALF_UP)); + + // 枪口列表 + List connectorList = getConnectorListForLianLian(pileDetailInfoVO); equipmentInfo.setConnectorInfos(connectorList); resultList.add(equipmentInfo); } + return resultList; } - /** - * 获取枪口列表 - * - * @param pileBasicInfo - * @param stationStatus - * @return - */ - private List getConnectorList(PileBasicInfo pileBasicInfo , String stationStatus) { - List resultList = new ArrayList<>(); + public List getPileDetailInfoList(String stationId) { + List pileDetailInfoList = pileBasicInfoMapper.getPileDetailInfoList(stationId); + if (CollectionUtils.isEmpty(pileDetailInfoList)) { + return new ArrayList<>(); + } + List pileSnList = pileDetailInfoList.stream() + .map(PileDetailInfoVO::getPileSn) + .collect(Collectors.toList()); + Map pileStatusV2 = pileConnectorInfoService.getPileStatus(pileSnList); + pileDetailInfoList.forEach(pileDetailInfoVO -> { + String pileSn = pileDetailInfoVO.getPileSn(); + if (pileStatusV2.containsKey(pileSn)) { + pileDetailInfoVO.setPileStatus(pileStatusV2.get(pileSn)); + } + }); + return pileDetailInfoList; + } - List list = pileConnectorInfoService.selectPileConnectorInfoList(pileBasicInfo.getSn()); + + public List getConnectorListForLianLian(PileDetailInfoVO pileDetailInfoVO) { + List resultList = new ArrayList<>(); + + List list = pileConnectorInfoService.selectPileConnectorInfoList(pileDetailInfoVO.getPileSn()); for (PileConnectorInfo pileConnectorInfo : list) { - ConnectorInfo connectorInfo = new ConnectorInfo(); + ConnectorInfoDTO connectorInfo = new ConnectorInfoDTO(); connectorInfo.setConnectorID(pileConnectorInfo.getPileConnectorCode()); - connectorInfo.setEquipmentClassification(Constants.one); - String pileSn = pileConnectorInfo.getPileSn(); - PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); - int connectorType = StringUtils.equals("1", modelInfo.getSpeedType()) ? 4 : 3; - + connectorInfo.setEquipmentClassification(1); + int connectorType = StringUtils.equals("1", pileDetailInfoVO.getSpeedType()) ? 4 : 3; connectorInfo.setConnectorType(connectorType); - // 车位号 - if (StringUtils.isNotBlank(pileConnectorInfo.getParkNo())) { - connectorInfo.setParkNo(pileConnectorInfo.getParkNo()); - } - connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage())); - connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage())); - connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent())); - connectorInfo.setNationalStandard(2); - // if (!StringUtils.equals(modelInfo.getConnectorNum(), "1")) { - // // 如果不是单枪,则枪口功率需要除以枪口数量 - // String ratedPowerStr = modelInfo.getRatedPower(); - // BigDecimal ratedPower = new BigDecimal(ratedPowerStr); - // connectorInfo.setPower(ratedPower.divide(new BigDecimal(modelInfo.getConnectorNum()), 1, BigDecimal.ROUND_HALF_UP)); - // }else { - // } - connectorInfo.setAuxPower(3); - connectorInfo.setOpreateStatus(Integer.valueOf(stationStatus)); - connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + + connectorInfo.setVoltageUpperLimits(new BigDecimal(pileDetailInfoVO.getRatedVoltage()).setScale(4, RoundingMode.HALF_UP)); + connectorInfo.setVoltageLowerLimits(new BigDecimal(pileDetailInfoVO.getRatedVoltage()).setScale(4, RoundingMode.HALF_UP)); + connectorInfo.setCurrent(new BigDecimal(pileDetailInfoVO.getRatedCurrent()).setScale(4, RoundingMode.HALF_UP)); + connectorInfo.setPower(new BigDecimal(pileDetailInfoVO.getRatedPower()).setScale(4, RoundingMode.HALF_UP)); + connectorInfo.setNationalStandard(StringUtils.equals("1", pileDetailInfoVO.getSpeedType()) ? 12 : 11); + connectorInfo.setAuxPower(3); // 3-兼容12V和24V + connectorInfo.setOperateStatus(50); // 50-正常使用 + +/* if (!StringUtils.equals(pileDetailInfoVO.getConnectorNum(), "1")) { + // 如果不是单枪,则枪口功率需要除以枪口数量 + String ratedPowerStr = pileDetailInfoVO.getRatedPower(); + BigDecimal ratedPower = new BigDecimal(ratedPowerStr); + connectorInfo.setPower(ratedPower.divide(new BigDecimal(pileDetailInfoVO.getConnectorNum()), 1, BigDecimal.ROUND_HALF_UP)); + }else { + connectorInfo.setPower(new BigDecimal(pileDetailInfoVO.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + }*/ resultList.add(connectorInfo); } - return resultList; }