diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/controller/LianLianController.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/controller/LianLianController.java new file mode 100644 index 000000000..e8d7abaf8 --- /dev/null +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/controller/LianLianController.java @@ -0,0 +1,19 @@ +package com.jsowell.thirdparty.controller; + +import com.jsowell.common.annotation.Anonymous; +import com.jsowell.common.core.controller.BaseController; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 对接联联平台controller + * + * @author JS-ZZA + * @date 2023/4/10 14:58 + */ +@Anonymous +@RestController +@RequestMapping("/LianLian") +public class LianLianController extends BaseController { + +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/ConnectorInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/ConnectorInfo.java index f36ea0b16..e55f3258e 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/ConnectorInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/ConnectorInfo.java @@ -19,12 +19,12 @@ public class ConnectorInfo { * 充电设备接口编码 Y * 充电设备接口编码,同一对接平台内唯一 */ - private String PileConnectorCode; + private String ConnectorID; /** * 充电设备接口名称 N */ - private String connectorName; + private String ConnectorName; /** * 充电设备接口类型 Y @@ -33,32 +33,32 @@ public class ConnectorInfo { * 3:交流接口插头(带枪线,模式3,连接方式C) * 4:直流接口枪头(带枪线,模式4) */ - private Integer connectorType; + private Integer ConnectorType; /** * 额定电压上限(单位:V) Y */ - private Integer ratedVoltageMax; + private Integer VoltageUpperLimits; /** * 额定电压下限(单位:V) Y */ - private Integer ratedVoltageMin; + private Integer VoltageLowerLimits; /** * 额定电流(单位:A) Y */ - private Integer ratedCurrent; + private Integer Current; /** * 额定功率(单位:kW) Y */ - private BigDecimal ratedPower; + private BigDecimal Power; /** * 车位号 N * 停车场车位编号 */ - private String parkingCode; + private String ParkNo; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/LianLianService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/LianLianService.java index 0e60c6b8e..0156b855a 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/LianLianService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/LianLianService.java @@ -2,6 +2,7 @@ package com.jsowell.thirdparty.service; import com.jsowell.thirdparty.domain.StationInfo; import com.jsowell.thirdparty.dto.QueryStationInfoDTO; +import com.jsowell.thirdparty.vo.LianLianPageResponse; import java.util.List; @@ -13,5 +14,5 @@ public interface LianLianService { */ void pushMerchantInfo(Long merchantId); - List query_stations_info(QueryStationInfoDTO dto); + LianLianPageResponse query_stations_info(QueryStationInfoDTO dto); } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java index 709fae76a..7258c9299 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java @@ -1,19 +1,22 @@ package com.jsowell.thirdparty.service.impl; import com.github.pagehelper.PageInfo; -import com.google.common.collect.Lists; import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.PageUtils; +import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.PileBasicInfo; +import com.jsowell.pile.domain.PileConnectorInfo; import com.jsowell.pile.domain.PileStationInfo; import com.jsowell.pile.service.*; import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.web.PileModelInfoVO; +import com.jsowell.thirdparty.domain.ConnectorInfo; import com.jsowell.thirdparty.domain.EquipmentInfo; import com.jsowell.thirdparty.domain.OperatorInfo; import com.jsowell.thirdparty.domain.StationInfo; import com.jsowell.thirdparty.dto.QueryStationInfoDTO; import com.jsowell.thirdparty.service.LianLianService; +import com.jsowell.thirdparty.vo.LianLianPageResponse; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -21,7 +24,6 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import java.util.Map; @Service public class LianLianServiceImpl implements LianLianService { @@ -63,7 +65,7 @@ public class LianLianServiceImpl implements LianLianService { * @return */ @Override - public List query_stations_info(QueryStationInfoDTO dto) { + public LianLianPageResponse query_stations_info(QueryStationInfoDTO dto) { List resultList = new ArrayList<>(); int pageNo = dto.getPageNo() == 0 ? 1 : dto.getPageNo(); int pageSize = dto.getPageSize() == 0 ? 10 : dto.getPageSize(); @@ -117,7 +119,13 @@ public class LianLianServiceImpl implements LianLianService { resultList.add(stationInfo); } - return resultList; + LianLianPageResponse pageResponse = LianLianPageResponse.builder() + .PageNo(pageInfo.getPageNum()) + .PageCount(pageInfo.getPages()) + .ItemSize(resultList.size()) + .list(resultList) + .build(); + return pageResponse; } /** @@ -146,11 +154,42 @@ public class LianLianServiceImpl implements LianLianService { equipmentInfo.setEquipmentStatus(50); equipmentInfo.setEquipmentPower(new BigDecimal(modelInfo.getRatedPower())); equipmentInfo.setNewNationalStandard(1); - // equipmentInfo.setConnectorInfos(); + List connectorList = getConnectorList(pileBasicInfo); + equipmentInfo.setConnectorInfos(connectorList); equipmentInfo.setVinFlag(1); resultList.add(equipmentInfo); } return resultList; } + + + /** + * 获取枪口列表 + * @param pileBasicInfo + * @return + */ + private List getConnectorList(PileBasicInfo pileBasicInfo){ + List resultList = new ArrayList<>(); + + List list = pileConnectorInfoService.selectPileConnectorInfoList(pileBasicInfo.getSn()); + for (PileConnectorInfo pileConnectorInfo : list) { + ConnectorInfo connectorInfo = new ConnectorInfo(); + + connectorInfo.setConnectorID(pileConnectorInfo.getPileConnectorCode()); + String pileSn = pileConnectorInfo.getPileSn(); + PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); + int connectorType = StringUtils.equals("1", modelInfo.getSpeedType()) ? 4 : 3; + + connectorInfo.setConnectorType(connectorType); + connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage())); + connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage())); + connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent())); + connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower())); + + resultList.add(connectorInfo); + } + + return resultList; + } } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/vo/LianLianPageResponse.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/vo/LianLianPageResponse.java new file mode 100644 index 000000000..4ffee1980 --- /dev/null +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/vo/LianLianPageResponse.java @@ -0,0 +1,43 @@ +package com.jsowell.thirdparty.vo; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 联联平台分页反参 + * + * @author JS-ZZA + * @date 2023/4/10 15:24 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class LianLianPageResponse implements Serializable { + + private static final long serialVersionUID = -8425633122529553009L; + /** + * 当前页数 + */ + private int PageNo; + + /** + * 页码总数 + */ + private int PageCount; + + /** + * 总记录条数 + */ + private int ItemSize; + + /** + * 数据集合 + */ + private List list; +}