| | |
| | | package com.ruoyi.chargingPile; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.chargingPile.api.dto.GetPermissionConfigurationDTO; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiChargingPileApplication.class) |
| | | public class RuoYiChargingPileApplicationTests { |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Test |
| | | public void test(){ |
| | | GetPermissionConfigurationDTO permissionConfiguration = partnerService.getPermissionConfiguration(9, 15); |
| | | System.err.println(JSON.toJSONString(permissionConfiguration)); |
| | | } |
| | | } |
| | | //package com.ruoyi.chargingPile; |
| | | // |
| | | //import com.alibaba.fastjson2.JSON; |
| | | //import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | //import com.ruoyi.chargingPile.api.dto.GetPermissionConfigurationDTO; |
| | | //import com.ruoyi.chargingPile.api.model.Site; |
| | | //import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | //import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | //import com.ruoyi.chargingPile.service.IPartnerService; |
| | | //import com.ruoyi.chargingPile.service.ISiteService; |
| | | //import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | //import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | //import com.ruoyi.chargingPile.util.UUIDUtil; |
| | | //import com.ruoyi.common.core.domain.R; |
| | | //import com.ruoyi.common.core.utils.StringUtils; |
| | | //import com.ruoyi.integration.api.elutong.model.*; |
| | | //import com.ruoyi.integration.api.feignClient.ELuTongClient; |
| | | //import org.junit.jupiter.api.Test; |
| | | //import org.springframework.boot.test.context.SpringBootTest; |
| | | // |
| | | //import javax.annotation.Resource; |
| | | //import java.math.BigDecimal; |
| | | //import java.time.format.DateTimeFormatter; |
| | | //import java.util.ArrayList; |
| | | //import java.util.Arrays; |
| | | //import java.util.List; |
| | | // |
| | | //@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiChargingPileApplication.class) |
| | | //public class RuoYiChargingPileApplicationTests { |
| | | // |
| | | // @Resource ELuTongClient eLuTongClient; |
| | | // |
| | | // @Resource |
| | | // private TChargingGunService chargingGunService; |
| | | // |
| | | // @Resource |
| | | // private TChargingPileService chargingPileService; |
| | | // |
| | | // @Resource |
| | | // private ISiteService siteService; |
| | | // |
| | | // @Test |
| | | // public void test(){ |
| | | // Site site = siteService.getById(76); |
| | | // StationInfoReq stationInfoReq = new StationInfoReq(); |
| | | // stationInfoReq.setOperatorId("91510903906171535D"); |
| | | // stationInfoReq.setStationId(site.getCode()); |
| | | // stationInfoReq.setSerAreaCode(site.getSerAreaCode()); |
| | | // OperatorInfo operatorInfo = new OperatorInfo(); |
| | | // operatorInfo.setOperatorId("91510903906171535D"); |
| | | // operatorInfo.setOperatorName("四川明星新能源科技有限公司"); |
| | | // operatorInfo.setOperatorTel1("18683346252"); |
| | | // operatorInfo.setOperatorTel2("13982508784"); |
| | | // operatorInfo.setOperatorRegAddress("遂宁市船山区渠河南路18号"); |
| | | // operatorInfo.setOperatorNote(""); |
| | | // stationInfoReq.setOperatorInfo(operatorInfo); |
| | | // List<StationInfo> stationInfos = new ArrayList<>(); |
| | | // stationInfos.add(buildStationInfo(site)); |
| | | // stationInfoReq.setItemSize(stationInfos.size()); |
| | | // stationInfoReq.setStationInfos(stationInfos); |
| | | // R r = eLuTongClient.pushStationInfo(stationInfoReq); |
| | | // if(200 != r.getCode()){ |
| | | // System.out.println(r.getMsg()); |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // private StationInfo buildStationInfo(Site site){ |
| | | // StationInfo stationInfo = new StationInfo(); |
| | | // stationInfo.setSerAreaCode(site.getSerAreaCode()); |
| | | // stationInfo.setOperatorId("91510903906171535D"); |
| | | // stationInfo.setStationId(site.getCode()); |
| | | // stationInfo.setStationName(site.getName()); |
| | | // stationInfo.setStationMode("CD"); |
| | | // stationInfo.setAreaCode(site.getDistrictsCode()); |
| | | // stationInfo.setServiceTel(site.getServicePhone()); |
| | | // switch (site.getSiteType()){ |
| | | // case 0: |
| | | // stationInfo.setStationType(255); |
| | | // break; |
| | | // case 1: |
| | | // stationInfo.setStationType(1); |
| | | // break; |
| | | // case 2: |
| | | // stationInfo.setStationType(50); |
| | | // break; |
| | | // case 3: |
| | | // stationInfo.setStationType(100); |
| | | // break; |
| | | // case 4: |
| | | // stationInfo.setStationType(101); |
| | | // break; |
| | | // case 5: |
| | | // stationInfo.setStationType(102); |
| | | // break; |
| | | // case 6: |
| | | // stationInfo.setStationType(103); |
| | | // break; |
| | | // } |
| | | // switch (site.getStatus()){ |
| | | // case 3: |
| | | // stationInfo.setStationStatus(5); |
| | | // break; |
| | | // case 2: |
| | | // stationInfo.setStationStatus(6); |
| | | // break; |
| | | // case 1: |
| | | // stationInfo.setStationStatus(50); |
| | | // break; |
| | | // } |
| | | // stationInfo.setParkNums(site.getParkingSpace()); |
| | | // stationInfo.setStationLng(Double.parseDouble(site.getLon())); |
| | | // stationInfo.setStationLat(Double.parseDouble(site.getLat())); |
| | | // stationInfo.setSiteGuide(site.getGuide()); |
| | | // switch (site.getConstructionSite()){ |
| | | // case 1: |
| | | // stationInfo.setConstruction(1); |
| | | // break; |
| | | // case 2: |
| | | // stationInfo.setConstruction(2); |
| | | // break; |
| | | // case 3: |
| | | // stationInfo.setConstruction(3); |
| | | // break; |
| | | // case 4: |
| | | // stationInfo.setConstruction(4); |
| | | // break; |
| | | // case 5: |
| | | // stationInfo.setConstruction(5); |
| | | // break; |
| | | // case 6: |
| | | // stationInfo.setConstruction(6); |
| | | // break; |
| | | // case 7: |
| | | // stationInfo.setConstruction(7); |
| | | // break; |
| | | // case 8: |
| | | // stationInfo.setConstruction(8); |
| | | // break; |
| | | // case 9: |
| | | // stationInfo.setConstruction(9); |
| | | // break; |
| | | // case 10: |
| | | // stationInfo.setConstruction(10); |
| | | // break; |
| | | // case 11: |
| | | // stationInfo.setConstruction(11); |
| | | // break; |
| | | // case 0: |
| | | // stationInfo.setConstruction(255); |
| | | // break; |
| | | // } |
| | | // if(StringUtils.isNotEmpty(site.getImgUrl())){ |
| | | // stationInfo.setPictures(Arrays.asList(site.getImgUrl().split(","))); |
| | | // } |
| | | // stationInfo.setMatchCars(site.getVehicleDescription()); |
| | | // stationInfo.setBusinessHours(site.getStartServiceTime() + " - " + site.getEndServiceTime()); |
| | | // stationInfo.setSiteGuide(""); |
| | | // stationInfo.setPictures(new ArrayList<>()); |
| | | // stationInfo.setMatchCars(""); |
| | | // stationInfo.setElectricityFee(BigDecimal.ZERO); |
| | | // stationInfo.setServiceFee(BigDecimal.ZERO); |
| | | // stationInfo.setParkFee(BigDecimal.ZERO); |
| | | // stationInfo.setPayment("2"); |
| | | // stationInfo.setSupportOrder(0); |
| | | // stationInfo.setEquipmentInfos(buildEquipmentInfo(site)); |
| | | // return stationInfo; |
| | | // } |
| | | // |
| | | // private List<EquipmentInfo> buildEquipmentInfo(Site site){ |
| | | // List<TChargingPile> list = chargingPileService.list(new LambdaQueryWrapper<TChargingPile>() |
| | | // .eq(TChargingPile::getSiteId, site.getId()).eq(TChargingPile::getDelFlag, 0)); |
| | | // return new ArrayList<EquipmentInfo>(){{ |
| | | // for (TChargingPile chargingPile : list) { |
| | | // EquipmentInfo equipmentInfo = new EquipmentInfo(); |
| | | // equipmentInfo.setEquipmentId(chargingPile.getId().toString()); |
| | | // equipmentInfo.setEquipmentName(chargingPile.getName()); |
| | | // equipmentInfo.setManufacturerId(StringUtils.isNotEmpty(chargingPile.getManufacturerCode()) ? chargingPile.getManufacturerCode() : "91510900MACPB4NJ4E"); |
| | | // equipmentInfo.setManufacturerName(StringUtils.isNotEmpty(chargingPile.getManufacturer()) ? chargingPile.getManufacturer() : ""); |
| | | // equipmentInfo.setEquipmentModel(StringUtils.isNotEmpty(chargingPile.getEquipmentType()) ? chargingPile.getEquipmentType() : ""); |
| | | // if(null != chargingPile.getProductionDate()){ |
| | | // equipmentInfo.setProductionDate(chargingPile.getProductionDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | // }else{ |
| | | // equipmentInfo.setProductionDate(""); |
| | | // } |
| | | // equipmentInfo.setEquipmentType(0 == chargingPile.getType() ? 5 : chargingPile.getType()); |
| | | // if(StringUtils.isNotEmpty(chargingPile.getEquipmentLng())){ |
| | | // equipmentInfo.setEquipmentLng(Double.parseDouble(chargingPile.getEquipmentLng())); |
| | | // } |
| | | // if(StringUtils.isNotEmpty(chargingPile.getEquipmentLat())){ |
| | | // equipmentInfo.setEquipmentLat(Double.parseDouble(chargingPile.getEquipmentLat())); |
| | | // } |
| | | // equipmentInfo.setPower(chargingPile.getRatedPower().doubleValue()); |
| | | // equipmentInfo.setConnectorInfos(buildConnectorInfo(chargingPile)); |
| | | // add(equipmentInfo); |
| | | // } |
| | | // }}; |
| | | // } |
| | | // |
| | | // |
| | | // private List<ConnectorInfo> buildConnectorInfo(TChargingPile chargingPile){ |
| | | // List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>() |
| | | // .eq(TChargingGun::getChargingPileId, chargingPile.getId()).eq(TChargingGun::getDelFlag, 0)); |
| | | // return new ArrayList<ConnectorInfo>(){{ |
| | | // for (TChargingGun chargingGun : list) { |
| | | // ConnectorInfo connectorInfo = new ConnectorInfo(); |
| | | // connectorInfo.setConnectorId(chargingGun.getId().toString()); |
| | | // connectorInfo.setConnectorName(chargingGun.getName()); |
| | | // connectorInfo.setConnectorType(0 == chargingGun.getType() ? 6 : chargingGun.getType()); |
| | | // connectorInfo.setVoltageUpperLimits(chargingGun.getUpperRatedVoltage().intValue()); |
| | | // connectorInfo.setVoltageLowerLimits(chargingGun.getLowerLimitOfRatedVoltage().intValue()); |
| | | // connectorInfo.setCurrent(chargingGun.getRatedCurrent().intValue()); |
| | | // connectorInfo.setPower(chargingGun.getRatedPower().doubleValue()); |
| | | // connectorInfo.setParkNo(chargingGun.getParkingNumber()); |
| | | // connectorInfo.setNationalStandard(Integer.parseInt(chargingGun.getNationalStandard())); |
| | | // connectorInfo.setParkNo(""); |
| | | // add(connectorInfo); |
| | | // } |
| | | // }}; |
| | | // } |
| | | // |
| | | // |
| | | //} |