diff --git a/jsowell-admin/pom.xml b/jsowell-admin/pom.xml index b0ebfe083..33cac306e 100644 --- a/jsowell-admin/pom.xml +++ b/jsowell-admin/pom.xml @@ -78,6 +78,11 @@ spring-boot-starter-test + + com.jsowell + jsowell-thirdparty + + diff --git a/jsowell-admin/src/main/java/com/jsowell/lianlian/LianLianController.java b/jsowell-admin/src/main/java/com/jsowell/lianlian/LianLianController.java new file mode 100644 index 000000000..0d2353940 --- /dev/null +++ b/jsowell-admin/src/main/java/com/jsowell/lianlian/LianLianController.java @@ -0,0 +1,79 @@ +package com.jsowell.lianlian; + +import com.alibaba.fastjson2.JSONObject; +import com.jsowell.common.annotation.Anonymous; +import com.jsowell.common.core.controller.BaseController; +import com.jsowell.common.response.RestApiResponse; +import com.jsowell.common.util.StringUtils; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * 对接联联平台controller + * + * @author JS-ZZA + * @date 2023/4/10 14:58 + */ +@Anonymous +@RestController +@RequestMapping("/LianLian") +public class LianLianController extends BaseController { + + @Autowired + private LianLianService lianLianService; + + + /** + * 联联平台查询充电站信息 + * http://localhost:8080/LianLian/query_stations_info + * @param dto + * @return + */ + @PostMapping("/query_stations_info") + public RestApiResponse query_stations_info(@RequestBody QueryStationInfoDTO dto) { + logger.info("联联平台查询充电站信息 params:{}", JSONObject.toJSONString(dto)); + RestApiResponse response = null; + try { + LianLianPageResponse pageResponse = lianLianService.query_stations_info(dto); + response = new RestApiResponse<>(pageResponse); + }catch (Exception e) { + logger.error("联联平台查询充电站信息 error", e); + response = new RestApiResponse<>(e); + } + logger.info("联联平台查询充电站信息 result:{}", response); + return response; + } + + /** + * 查询充电站状态信息 + * @param dto + * @return + */ + @PostMapping("/query_station_status") + public RestApiResponse query_station_status(@RequestBody ArrayList StationIDs) { + logger.info("联联平台查询充电站状态信息 params:{}", StationIDs); + RestApiResponse response; + try { + if (CollectionUtils.isEmpty(StationIDs)) { + return null; + } + LianLianPageResponse pageResponse = lianLianService.query_station_status(StationIDs); + response = new RestApiResponse<>(pageResponse); + }catch (Exception e) { + logger.error("联联平台查询充电站状态信息 error", e); + response = new RestApiResponse<>(e); + } + logger.info("联联平台查询充电站状态信息 result:{}", response); + return response; + } +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileBasicInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileBasicInfo.java index 111b48bb9..285285753 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileBasicInfo.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileBasicInfo.java @@ -95,6 +95,8 @@ public class PileBasicInfo extends BaseEntity { @Excel(name = "故障原因") private String faultReason; + private Date createTime; + /** * 删除标识(0-正常;1-删除) */ @@ -204,6 +206,19 @@ public class PileBasicInfo extends BaseEntity { this.secretKey = secretKey; } + public static long getSerialVersionUID() { + return serialVersionUID; + } + + @Override + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.JSON_STYLE) diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml index dea5d4ba4..60ca1419d 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml @@ -368,7 +368,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" t3.speed_type - select from pile_basic_info where station_id = #{stationId,jdbcType=VARCHAR} diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml index 2370db604..f5f986df0 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml @@ -223,7 +223,7 @@ \ No newline at end of file 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 deleted file mode 100644 index e8d7abaf8..000000000 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/controller/LianLianController.java +++ /dev/null @@ -1,19 +0,0 @@ -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/dto/QueryStationInfoDTO.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/dto/QueryStationInfoDTO.java index abfb8a96f..9f9a61834 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/dto/QueryStationInfoDTO.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/dto/QueryStationInfoDTO.java @@ -1,6 +1,11 @@ package com.jsowell.thirdparty.dto; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; /** * 查询站点信息dto @@ -9,6 +14,9 @@ import lombok.Data; * @date 2023/4/8 10:02 */ @Data +@AllArgsConstructor +@NoArgsConstructor +@Builder public class QueryStationInfoDTO { /** * 上次查询时间 @@ -28,4 +36,22 @@ public class QueryStationInfoDTO { * 不填写默认为 10 */ private Integer PageSize; + + + /** + * 充电站 ID + */ + private String StationID; + + /** + * 统计开始时间 + * 格式“yyyy-MM-dd” + */ + private String StartTime; + + /** + * 统计结束时间 + * 格式“yyyy-MM-dd” + */ + private String EndTime; } 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 6f16243b5..e37c3eea9 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 @@ -29,4 +29,7 @@ public interface LianLianService { * @return */ LianLianPageResponse query_station_status(List StationIDs); + + + LianLianPageResponse query_station_stats(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 8703384e0..de7c5f194 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,5 +1,6 @@ package com.jsowell.thirdparty.service.impl; +import cn.hutool.core.util.PageUtil; import com.github.pagehelper.PageInfo; import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; @@ -26,6 +27,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; @Service public class LianLianServiceImpl implements LianLianService { @@ -72,8 +74,8 @@ public class LianLianServiceImpl implements LianLianService { @Override 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(); + int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo(); + int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize(); PageUtils.startPage(pageNo, pageSize); List stationInfos = pileStationInfoService.getStationInfoForLianLian(); @@ -107,10 +109,6 @@ public class LianLianServiceImpl implements LianLianService { stationInfo.setParkFree(Integer.valueOf(pileStationInfo.getParkFree())); stationInfo.setPayment(pileStationInfo.getPayment()); stationInfo.setSupportOrder(Integer.valueOf(pileStationInfo.getSupportOrder())); - - List pileList = getPileList(pileStationInfo); - stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表 - // stationInfo.setParkFeeType(pileStationInfo); // 停车收费类型 stationInfo.setToiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag())); stationInfo.setStoreFlag(Integer.valueOf(pileStationInfo.getStoreFlag())); @@ -121,6 +119,11 @@ public class LianLianServiceImpl implements LianLianService { stationInfo.setBarrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag())); stationInfo.setParkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag())); + List pileList = getPileList(pileStationInfo); + if (CollectionUtils.isNotEmpty(pileList)) { + stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表 + } + resultList.add(stationInfo); } @@ -180,9 +183,29 @@ public class LianLianServiceImpl implements LianLianService { StationStatusInfos.add(stationStatusInfo); } - // TODO 将 StationStatusInfos 分页 - } + // TODO 将 StationStatusInfos 分页 + int pageNum = 1; + int pageSize = 10; + List collect = StationStatusInfos.stream() + .skip((pageNum - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + int total = StationStatusInfos.size(); + int pages = PageUtil.totalPage(total, pageSize); + + LianLianPageResponse response = LianLianPageResponse.builder() + .PageCount(pages) + .PageNo(pageNum) + .list(collect) + .ItemSize(total) + .build(); + return response; + } + + @Override + public LianLianPageResponse query_station_stats(QueryStationInfoDTO dto) { return null; } @@ -212,9 +235,10 @@ public class LianLianServiceImpl implements LianLianService { equipmentInfo.setEquipmentStatus(50); equipmentInfo.setEquipmentPower(new BigDecimal(modelInfo.getRatedPower())); equipmentInfo.setNewNationalStandard(1); + equipmentInfo.setVinFlag(1); + List connectorList = getConnectorList(pileBasicInfo); equipmentInfo.setConnectorInfos(connectorList); - equipmentInfo.setVinFlag(1); resultList.add(equipmentInfo); } diff --git a/jsowell-ui/src/views/pile/card/index.vue b/jsowell-ui/src/views/pile/card/index.vue index 6513eca4a..6bbac50eb 100644 --- a/jsowell-ui/src/views/pile/card/index.vue +++ b/jsowell-ui/src/views/pile/card/index.vue @@ -223,7 +223,7 @@ export default { required: true, min: 16, max: 16, - message: "长度必须为16字符!(不足长度可后补零)", + message: "长度必须为16字符!(不足长度可后补零)", trigger: 'blur' } ],