南瑞平台 controller类 并测试

This commit is contained in:
Lemon
2023-10-12 09:14:13 +08:00
parent aef44dcce9
commit 192cf56e84
11 changed files with 162 additions and 67 deletions

View File

@@ -33,7 +33,7 @@ public interface NRService {
* @param dto
* @return
*/
Map<String, String> query_stations_info(QueryStationInfoDTO dto);
Map<String, Object> query_stations_info(QueryStationInfoDTO dto);
/**
* 推送告警信息

View File

@@ -24,6 +24,7 @@ import com.jsowell.thirdparty.nanrui.domain.*;
import com.jsowell.thirdparty.nanrui.service.NRService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.ParseException;
@@ -36,6 +37,7 @@ import java.util.stream.Collectors;
* @author Lemon
* @Date 2023/9/26 9:20
*/
@Service
public class NRServiceImpl implements NRService {
@Autowired
@@ -84,7 +86,7 @@ public class NRServiceImpl implements NRService {
.parkNums(0)
.stationLng(new BigDecimal(stationInfoVO.getStationLng()).setScale(6, BigDecimal.ROUND_HALF_UP))
.stationLat(new BigDecimal(stationInfoVO.getStationLat()).setScale(6, BigDecimal.ROUND_HALF_UP))
.openForBusinessDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, DateUtils.parseDate(stationInfoVO.getCreateTime())))
.openForBusinessDate(stationInfoVO.getCreateTime())
.openAllDay(Integer.parseInt(stationInfoVO.getOpenAllDay()))
.busineHours(stationInfoVO.getBusinessHours())
.minElectricityPrice(stationInfoVO.getElectricityPrice().add(stationInfoVO.getServicePrice()))
@@ -110,7 +112,7 @@ public class NRServiceImpl implements NRService {
}
@Override
public Map<String, String> query_stations_info(QueryStationInfoDTO dto) {
public Map<String, Object> query_stations_info(QueryStationInfoDTO dto) {
List<NRStationInfo> resultList = new ArrayList<>();
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
@@ -142,7 +144,7 @@ public class NRServiceImpl implements NRService {
.parkNums(0)
.stationLng(new BigDecimal(pileStationInfo.getStationLng()).setScale(6, BigDecimal.ROUND_HALF_UP))
.stationLat(new BigDecimal(pileStationInfo.getStationLat()).setScale(6, BigDecimal.ROUND_HALF_UP))
.openForBusinessDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, DateUtils.parseDate(pileStationInfo.getCreateTime())))
.openForBusinessDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileStationInfo.getCreateTime()))
.openAllDay(Integer.parseInt(pileStationInfo.getOpenAllDay()))
.busineHours(pileStationInfo.getBusinessHours())
.build();
@@ -186,9 +188,7 @@ public class NRServiceImpl implements NRService {
map.put("ItemSize", resultList.size());
map.put("StationInfos", resultList);
// TODO 发送数据
return null;
return map;
}
@@ -346,6 +346,13 @@ public class NRServiceImpl implements NRService {
if (CollectionUtils.isEmpty(nrOrderInfos)) {
return new ArrayList<>();
}
// 将组织机构代码只取后9位数
for (NROrderInfo nrOrderInfo : nrOrderInfos) {
String operatorId = nrOrderInfo.getOperatorId();
if (StringUtils.isNotBlank(operatorId)) {
nrOrderInfo.setOperatorId(StringUtils.substring(operatorId, operatorId.length() - 9));
}
}
return nrOrderInfos;
}