mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update 调试联联接口
This commit is contained in:
@@ -78,6 +78,11 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.jsowell</groupId>
|
||||
<artifactId>jsowell-thirdparty</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -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<String> 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;
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -368,7 +368,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
t3.speed_type
|
||||
</select>
|
||||
|
||||
<select id="getPileListByStationId" resultType="com.jsowell.pile.domain.PileBasicInfo">
|
||||
<select id="getPileListByStationId" resultMap="PileBasicInfoResult">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from pile_basic_info
|
||||
where station_id = #{stationId,jdbcType=VARCHAR}
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
|
||||
<select id="getUniAppConnectorList" resultType="com.jsowell.pile.vo.base.ConnectorInfoVO">
|
||||
SELECT
|
||||
t1.pile_connector_code as connectorCode,
|
||||
t1.pile_connector_code as pileConnectorCode,
|
||||
t2.station_id as stationId,
|
||||
t1.STATUS as connectorStatus,
|
||||
t1.pile_sn,
|
||||
|
||||
@@ -370,7 +370,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getStationInfoForLianLian" resultMap="PileStationInfoResult">
|
||||
<include refid="selectPileStationInfoVo">
|
||||
</include>
|
||||
<include refid="selectPileStationInfoVo"/>
|
||||
where public_flag = '1'
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -29,4 +29,7 @@ public interface LianLianService {
|
||||
* @return
|
||||
*/
|
||||
LianLianPageResponse query_station_status(List<String> StationIDs);
|
||||
|
||||
|
||||
LianLianPageResponse query_station_stats(QueryStationInfoDTO dto);
|
||||
}
|
||||
|
||||
@@ -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<StationInfo> 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<PileStationInfo> 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<EquipmentInfo> 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<EquipmentInfo> 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<StationStatusInfo> 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<ConnectorInfo> connectorList = getConnectorList(pileBasicInfo);
|
||||
equipmentInfo.setConnectorInfos(connectorList);
|
||||
equipmentInfo.setVinFlag(1);
|
||||
|
||||
resultList.add(equipmentInfo);
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ export default {
|
||||
required: true,
|
||||
min: 16,
|
||||
max: 16,
|
||||
message: "长度必须为16字符!(不足长度可后补零)",
|
||||
message: "长度必须为16字符!(不足长度可后补零)",
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user