mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-13 03:39:55 +08:00
update 电单车协议
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
package com.jsowell.netty.domain.ebike;
|
package com.jsowell.netty.domain.ebike;
|
||||||
|
|
||||||
import com.jsowell.common.util.BytesUtil;
|
import com.jsowell.common.util.BytesUtil;
|
||||||
|
import com.jsowell.netty.domain.ebike.deviceupload.DeviceRegister;
|
||||||
import com.jsowell.netty.domain.ebike.deviceupload.EBikeMessageCmd03;
|
import com.jsowell.netty.domain.ebike.deviceupload.EBikeMessageCmd03;
|
||||||
|
import com.jsowell.netty.domain.ebike.deviceupload.EBikeMessageCmd20;
|
||||||
import com.jsowell.netty.domain.ebike.deviceupload.SettlementInfo;
|
import com.jsowell.netty.domain.ebike.deviceupload.SettlementInfo;
|
||||||
import com.jsowell.netty.domain.ebike.serversend.EBikeMessageCmd82;
|
import com.jsowell.netty.domain.ebike.serversend.EBikeMessageCmd82;
|
||||||
import com.jsowell.netty.domain.ebike.serversend.SpecificDataCmd82;
|
import com.jsowell.netty.domain.ebike.serversend.SpecificDataCmd82;
|
||||||
@@ -40,6 +42,8 @@ public abstract class AbsEBikeMessage {
|
|||||||
return new EBikeMessageCmd82(header, length, physicalId, messageId, command, null, checksum, new SpecificDataCmd82(dataBytes));
|
return new EBikeMessageCmd82(header, length, physicalId, messageId, command, null, checksum, new SpecificDataCmd82(dataBytes));
|
||||||
case "03":
|
case "03":
|
||||||
return new EBikeMessageCmd03(header, length, physicalId, messageId, command, null, checksum, new SettlementInfo(dataBytes));
|
return new EBikeMessageCmd03(header, length, physicalId, messageId, command, null, checksum, new SettlementInfo(dataBytes));
|
||||||
|
case "20":
|
||||||
|
return new EBikeMessageCmd20(header, length, physicalId, messageId, command, null, checksum, new DeviceRegister(dataBytes));
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unsupported command: " + command);
|
throw new IllegalArgumentException("Unsupported command: " + command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.jsowell.netty.domain.ebike.deviceupload;
|
||||||
|
|
||||||
|
import com.jsowell.common.util.BytesUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceRegister {
|
||||||
|
/**
|
||||||
|
* 固件版本,如100则表示V1.00版本
|
||||||
|
*/
|
||||||
|
private String firmwareVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口数量 表示设备总共有多少个端口
|
||||||
|
*/
|
||||||
|
private String portNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟ID:需要内部组网的设备的本地地址,如485、LORA系列,如不需组网的设备,默认为00
|
||||||
|
*/
|
||||||
|
private String virtualId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型: 见01指令中的设备类型表
|
||||||
|
*/
|
||||||
|
private String deviceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作模式:第0位:0=联网,1=刷卡。第1位:0=RN8209,1=BL0939。第2位:0=无短路预检,1=有短路预检。第3位:0=光耦检测模式,1=带灯模式。
|
||||||
|
*/
|
||||||
|
private String workMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电源板版本号:电源板的固件版本号,如没有电源板的机型则为0
|
||||||
|
*/
|
||||||
|
private String powerBoardVersion;
|
||||||
|
|
||||||
|
public DeviceRegister(byte[] dataBytes) {
|
||||||
|
this.firmwareVersion = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 0, 2)) + "";
|
||||||
|
this.portNumber = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 2, 3)) + "";
|
||||||
|
this.virtualId = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 3, 4)) + "";
|
||||||
|
this.deviceType = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 4, 5));
|
||||||
|
this.workMode = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 5, 6));
|
||||||
|
this.powerBoardVersion = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 6, 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.jsowell.netty.domain.ebike.deviceupload;
|
||||||
|
|
||||||
|
import com.jsowell.netty.domain.ebike.AbsEBikeMessage;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备注册包(20指令)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EBikeMessageCmd20 extends AbsEBikeMessage {
|
||||||
|
|
||||||
|
private DeviceRegister deviceRegister;
|
||||||
|
|
||||||
|
public EBikeMessageCmd20(String header, int length, int physicalId, int messageId, String command, Object payload, int checksum, DeviceRegister deviceRegister) {
|
||||||
|
super(header, length, physicalId, messageId, command, payload, checksum);
|
||||||
|
this.deviceRegister = deviceRegister;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parsePayload(byte[] dataBytes) {
|
||||||
|
this.deviceRegister = new DeviceRegister(dataBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeviceRegister getDeviceRegister() {
|
||||||
|
return deviceRegister;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1220,7 +1220,6 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
|||||||
dto.setMerchantId(pileConnectorDetailVO.getMerchantId());
|
dto.setMerchantId(pileConnectorDetailVO.getMerchantId());
|
||||||
dto.setStationId(pileConnectorDetailVO.getStationId());
|
dto.setStationId(pileConnectorDetailVO.getStationId());
|
||||||
// 获取处理逻辑
|
// 获取处理逻辑
|
||||||
// String mode = pileMerchantInfoService.getDelayModeByAppIdAndRequestSource(dto.getAppId(), dto.getRequestSource());
|
|
||||||
String mode = pileMerchantInfoService.getDelayModeByMerchantId(pileConnectorDetailVO.getMerchantId());
|
String mode = pileMerchantInfoService.getDelayModeByMerchantId(pileConnectorDetailVO.getMerchantId());
|
||||||
AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode);
|
AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode);
|
||||||
return orderLogic.startPersonalPileCharging(dto);
|
return orderLogic.startPersonalPileCharging(dto);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.pile.service.impl;
|
package com.jsowell.pile.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.CoordinateUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@@ -13,7 +14,10 @@ import com.jsowell.common.core.redis.RedisCache;
|
|||||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.*;
|
import com.jsowell.common.util.DateUtils;
|
||||||
|
import com.jsowell.common.util.DistanceUtils;
|
||||||
|
import com.jsowell.common.util.SecurityUtils;
|
||||||
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.common.util.ip.AddressUtils;
|
import com.jsowell.common.util.ip.AddressUtils;
|
||||||
import com.jsowell.pile.domain.PileBasicInfo;
|
import com.jsowell.pile.domain.PileBasicInfo;
|
||||||
import com.jsowell.pile.domain.PileStationInfo;
|
import com.jsowell.pile.domain.PileStationInfo;
|
||||||
@@ -26,18 +30,16 @@ import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
|
|||||||
import com.jsowell.pile.mapper.PileStationInfoMapper;
|
import com.jsowell.pile.mapper.PileStationInfoMapper;
|
||||||
import com.jsowell.pile.service.*;
|
import com.jsowell.pile.service.*;
|
||||||
import com.jsowell.pile.util.UserUtils;
|
import com.jsowell.pile.util.UserUtils;
|
||||||
import com.jsowell.pile.vo.uniapp.business.BusinessOrderDetailInfoVO;
|
|
||||||
import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO;
|
|
||||||
import com.jsowell.pile.vo.base.*;
|
import com.jsowell.pile.vo.base.*;
|
||||||
import com.jsowell.pile.vo.ningxiajiaotou.NXJTStationInfoVO;
|
import com.jsowell.pile.vo.ningxiajiaotou.NXJTStationInfoVO;
|
||||||
|
import com.jsowell.pile.vo.uniapp.business.BusinessOrderDetailInfoVO;
|
||||||
|
import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO;
|
||||||
import com.jsowell.pile.vo.uniapp.business.StationOrderQuantityInfoVO;
|
import com.jsowell.pile.vo.uniapp.business.StationOrderQuantityInfoVO;
|
||||||
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
|
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
|
||||||
import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails;
|
import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails;
|
||||||
import com.jsowell.pile.vo.web.PileStationVO;
|
import com.jsowell.pile.vo.web.PileStationVO;
|
||||||
import com.jsowell.system.service.SysDeptService;
|
import com.jsowell.system.service.SysDeptService;
|
||||||
import com.jsowell.system.service.SysUserService;
|
import com.jsowell.system.service.SysUserService;
|
||||||
import com.yi.business.geo.GeoCodeInfo;
|
|
||||||
import com.yi.business.geo.TermRelationTreeCoordinate;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -119,6 +121,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
/**
|
/**
|
||||||
* 查询站点基本资料
|
* 查询站点基本资料
|
||||||
* 加缓存
|
* 加缓存
|
||||||
|
*
|
||||||
* @param stationId
|
* @param stationId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -205,6 +208,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过充电桩枪口编号查询充电站信息
|
* 通过充电桩枪口编号查询充电站信息
|
||||||
|
*
|
||||||
* @param pileConnectorCode 充电桩枪口编号
|
* @param pileConnectorCode 充电桩枪口编号
|
||||||
* @return 充电站信息
|
* @return 充电站信息
|
||||||
*/
|
*/
|
||||||
@@ -219,6 +223,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过充电桩sn查询充电站信息
|
* 通过充电桩sn查询充电站信息
|
||||||
|
*
|
||||||
* @param pileSn 充电桩sn
|
* @param pileSn 充电桩sn
|
||||||
* @return 充电站信息
|
* @return 充电站信息
|
||||||
*/
|
*/
|
||||||
@@ -317,6 +322,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 快速建站
|
* 快速建站
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -391,6 +397,17 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2024年8月16日14点15分 天地图坐标转高德坐标
|
||||||
|
if (StringUtils.isNotBlank(pileStationInfo.getStationLng()) && StringUtils.isNotBlank(pileStationInfo.getStationLat())) {
|
||||||
|
// 获取经纬度
|
||||||
|
CoordinateUtil.Coordinate coordinate = CoordinateUtil.wgs84ToGcj02(Double.parseDouble(pileStationInfo.getStationLng()), Double.parseDouble(pileStationInfo.getStationLat()));
|
||||||
|
if (coordinate != null) {
|
||||||
|
pileStationInfo.setStationLng(String.valueOf(coordinate.getLng()));
|
||||||
|
pileStationInfo.setStationLat(String.valueOf(coordinate.getLat()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pileStationInfo.setUpdateBy(SecurityUtils.getUsername());
|
pileStationInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||||
pileStationInfo.setUpdateTime(DateUtils.getNowDate());
|
pileStationInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
int i = pileStationInfoMapper.updatePileStationInfo(pileStationInfo);
|
int i = pileStationInfoMapper.updatePileStationInfo(pileStationInfo);
|
||||||
@@ -462,6 +479,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电站列表信息
|
* 充电站列表信息
|
||||||
|
*
|
||||||
* @param dto 前台参数
|
* @param dto 前台参数
|
||||||
* @return 充电站对象集合
|
* @return 充电站对象集合
|
||||||
*/
|
*/
|
||||||
@@ -505,13 +523,13 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
for (PileStationVO pileStationVO : pageInfo.getList()) {
|
for (PileStationVO pileStationVO : pageInfo.getList()) {
|
||||||
stationVO = new StationInfoVO();
|
stationVO = new StationInfoVO();
|
||||||
if (StringUtils.isNotEmpty(stationLng) && StringUtils.isNotEmpty(stationLat)) {
|
if (StringUtils.isNotEmpty(stationLng) && StringUtils.isNotEmpty(stationLat)) {
|
||||||
try{
|
try {
|
||||||
// 计算当前经纬度和站点之间的距离
|
// 计算当前经纬度和站点之间的距离
|
||||||
distance = DistanceUtils.getDistance(Double.parseDouble(stationLng), Double.parseDouble(stationLat),
|
distance = DistanceUtils.getDistance(Double.parseDouble(stationLng), Double.parseDouble(stationLat),
|
||||||
Double.parseDouble(pileStationVO.getStationLng()), Double.parseDouble(pileStationVO.getStationLat()));
|
Double.parseDouble(pileStationVO.getStationLng()), Double.parseDouble(pileStationVO.getStationLat()));
|
||||||
// 保留两位小数
|
// 保留两位小数
|
||||||
stationVO.setDistance(String.format("%.2f", distance));
|
stationVO.setDistance(String.format("%.2f", distance));
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
stationVO.setDistance("0.00");
|
stationVO.setDistance("0.00");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -581,6 +599,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据站点id查询运营商配置的汇付会员id
|
* 根据站点id查询运营商配置的汇付会员id
|
||||||
|
*
|
||||||
* @param stationId
|
* @param stationId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -596,6 +615,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过站点部门id查询站点id
|
* 通过站点部门id查询站点id
|
||||||
|
*
|
||||||
* @param deptId
|
* @param deptId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -606,6 +626,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定停车系统平台
|
* 绑定停车系统平台
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -626,6 +647,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询充电站下拉列表
|
* 查询充电站下拉列表
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -644,6 +666,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 宁夏交投查询充电站信息
|
* 宁夏交投查询充电站信息
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -661,12 +684,13 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PileStationInfo> getStationInfosByMerchantIds(List<String> merchantIds){
|
public List<PileStationInfo> getStationInfosByMerchantIds(List<String> merchantIds) {
|
||||||
return pileStationInfoMapper.getStationInfosByMerchantIds(merchantIds);
|
return pileStationInfoMapper.getStationInfosByMerchantIds(merchantIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取站点统计信息
|
* 获取站点统计信息
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -681,7 +705,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
merchantIds = merchantInfoVOList.stream()
|
merchantIds = merchantInfoVOList.stream()
|
||||||
.map(MerchantInfoVO::getMerchantId)
|
.map(MerchantInfoVO::getMerchantId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}else {
|
} else {
|
||||||
merchantIds.add(merchantId);
|
merchantIds.add(merchantId);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isEmpty(stationIds)) {
|
if (CollectionUtils.isEmpty(stationIds)) {
|
||||||
@@ -715,7 +739,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
for (Map.Entry<String, SettleOrderReport> entry: collect.entrySet()) {
|
for (Map.Entry<String, SettleOrderReport> entry : collect.entrySet()) {
|
||||||
String stationId = entry.getKey();
|
String stationId = entry.getKey();
|
||||||
SettleOrderReport report = entry.getValue();
|
SettleOrderReport report = entry.getValue();
|
||||||
|
|
||||||
@@ -734,16 +758,16 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
if (StringUtils.equals(PileConnectorDataBaseStatusEnum.FREE.getValue(), connectorStatus)) {
|
if (StringUtils.equals(PileConnectorDataBaseStatusEnum.FREE.getValue(), connectorStatus)) {
|
||||||
// 空闲
|
// 空闲
|
||||||
freeConnectorNum += 1;
|
freeConnectorNum += 1;
|
||||||
}else if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue(), connectorStatus)) {
|
} else if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue(), connectorStatus)) {
|
||||||
// 占用(未充电)
|
// 占用(未充电)
|
||||||
occupiedConnectorNum += 1;
|
occupiedConnectorNum += 1;
|
||||||
}else if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue(), connectorStatus)) {
|
} else if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue(), connectorStatus)) {
|
||||||
// 充电中
|
// 充电中
|
||||||
chargingConnectorNum += 1;
|
chargingConnectorNum += 1;
|
||||||
}else if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue(), connectorStatus)) {
|
} else if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue(), connectorStatus)) {
|
||||||
// 离线
|
// 离线
|
||||||
offlineConnectorNum += 1;
|
offlineConnectorNum += 1;
|
||||||
}else if(StringUtils.equals(PileConnectorDataBaseStatusEnum.FAULT.getValue(), connectorStatus)) {
|
} else if (StringUtils.equals(PileConnectorDataBaseStatusEnum.FAULT.getValue(), connectorStatus)) {
|
||||||
// 故障
|
// 故障
|
||||||
faultConnectorNum += 1;
|
faultConnectorNum += 1;
|
||||||
}
|
}
|
||||||
@@ -776,6 +800,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取站点运营分析信息(7天、30天)
|
* 获取站点运营分析信息(7天、30天)
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -811,7 +836,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
if (StringUtils.equals(Constants.ONE, type)) {
|
if (StringUtils.equals(Constants.ONE, type)) {
|
||||||
// 7天
|
// 7天
|
||||||
date = DateUtils.addDays(new Date(), -7);
|
date = DateUtils.addDays(new Date(), -7);
|
||||||
}else if (StringUtils.equals(Constants.TWO, type)) {
|
} else if (StringUtils.equals(Constants.TWO, type)) {
|
||||||
// 30天
|
// 30天
|
||||||
date = DateUtils.addDays(new Date(), -30);
|
date = DateUtils.addDays(new Date(), -30);
|
||||||
}
|
}
|
||||||
@@ -907,7 +932,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
vo.setOrderAmountGrowthRate("-");
|
vo.setOrderAmountGrowthRate("-");
|
||||||
vo.setServiceAmountGrowthRate("-");
|
vo.setServiceAmountGrowthRate("-");
|
||||||
// vo.setBusinessOrderDetailInfoVOList();
|
// vo.setBusinessOrderDetailInfoVOList();
|
||||||
}else {
|
} else {
|
||||||
// 充电量增长率
|
// 充电量增长率
|
||||||
todayUsedElectricity = orderDetailToday.getTotalUsedElectricity();
|
todayUsedElectricity = orderDetailToday.getTotalUsedElectricity();
|
||||||
yesterdayUsedElectricity = orderDetailYesterday.getTotalUsedElectricity();
|
yesterdayUsedElectricity = orderDetailYesterday.getTotalUsedElectricity();
|
||||||
@@ -918,7 +943,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
todayServiceAmount = orderDetailToday.getTotalServiceAmount();
|
todayServiceAmount = orderDetailToday.getTotalServiceAmount();
|
||||||
yesterdayServiceAmount = orderDetailYesterday.getTotalServiceAmount();
|
yesterdayServiceAmount = orderDetailYesterday.getTotalServiceAmount();
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
// 如果指定日期为空,则默认最后一天(当天)与前一天做对比
|
// 如果指定日期为空,则默认最后一天(当天)与前一天做对比
|
||||||
BusinessOrderDetailInfoVO orderDetailToday = businessOrderDetailInfoVOS.get(businessOrderDetailInfoVOS.size() - 1);
|
BusinessOrderDetailInfoVO orderDetailToday = businessOrderDetailInfoVOS.get(businessOrderDetailInfoVOS.size() - 1);
|
||||||
BusinessOrderDetailInfoVO orderDetailYesterday = businessOrderDetailInfoVOS.get(businessOrderDetailInfoVOS.size() - 2);
|
BusinessOrderDetailInfoVO orderDetailYesterday = businessOrderDetailInfoVOS.get(businessOrderDetailInfoVOS.size() - 2);
|
||||||
@@ -934,19 +959,19 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
}
|
}
|
||||||
if (yesterdayUsedElectricity.compareTo(BigDecimal.ZERO) == 0) {
|
if (yesterdayUsedElectricity.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
usedElectricityRiseRate = "0%";
|
usedElectricityRiseRate = "0%";
|
||||||
}else {
|
} else {
|
||||||
BigDecimal divideUsedElectricity = todayUsedElectricity.subtract(yesterdayUsedElectricity).divide(yesterdayUsedElectricity, 2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal divideUsedElectricity = todayUsedElectricity.subtract(yesterdayUsedElectricity).divide(yesterdayUsedElectricity, 2, BigDecimal.ROUND_HALF_UP);
|
||||||
usedElectricityRiseRate = divideUsedElectricity.multiply(new BigDecimal("100")) + "%";
|
usedElectricityRiseRate = divideUsedElectricity.multiply(new BigDecimal("100")) + "%";
|
||||||
}
|
}
|
||||||
if (yesterdaySettleAmount.compareTo(BigDecimal.ZERO) == 0) {
|
if (yesterdaySettleAmount.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
orderAmountRiseRate = "0%";
|
orderAmountRiseRate = "0%";
|
||||||
}else {
|
} else {
|
||||||
BigDecimal divideSettleAmount = todaySettleAmount.subtract(yesterdaySettleAmount).divide(yesterdaySettleAmount, 2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal divideSettleAmount = todaySettleAmount.subtract(yesterdaySettleAmount).divide(yesterdaySettleAmount, 2, BigDecimal.ROUND_HALF_UP);
|
||||||
orderAmountRiseRate = divideSettleAmount.multiply(new BigDecimal("100")) + "%";
|
orderAmountRiseRate = divideSettleAmount.multiply(new BigDecimal("100")) + "%";
|
||||||
}
|
}
|
||||||
if (yesterdayServiceAmount.compareTo(BigDecimal.ZERO) == 0) {
|
if (yesterdayServiceAmount.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
serviceAmountRiseRate = "0%";
|
serviceAmountRiseRate = "0%";
|
||||||
}else {
|
} else {
|
||||||
BigDecimal divideServiceAmount = todayServiceAmount.subtract(yesterdayServiceAmount).divide(yesterdayServiceAmount, 2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal divideServiceAmount = todayServiceAmount.subtract(yesterdayServiceAmount).divide(yesterdayServiceAmount, 2, BigDecimal.ROUND_HALF_UP);
|
||||||
serviceAmountRiseRate = divideServiceAmount.multiply(new BigDecimal("100")) + "%";
|
serviceAmountRiseRate = divideServiceAmount.multiply(new BigDecimal("100")) + "%";
|
||||||
}
|
}
|
||||||
@@ -960,6 +985,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取站点运营分析信息(12个月)
|
* 获取站点运营分析信息(12个月)
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -999,11 +1025,11 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
SettleOrderReport nowReportInfo = new SettleOrderReport();
|
SettleOrderReport nowReportInfo = new SettleOrderReport();
|
||||||
SettleOrderReport lastMonthReportInfo = new SettleOrderReport();
|
SettleOrderReport lastMonthReportInfo = new SettleOrderReport();
|
||||||
if(dateTime == null) {
|
if (dateTime == null) {
|
||||||
// 为空默认对比最后一个月和前一个月的数据
|
// 为空默认对比最后一个月和前一个月的数据
|
||||||
nowReportInfo = settleOrderReports.get(settleOrderReports.size() - 1);
|
nowReportInfo = settleOrderReports.get(settleOrderReports.size() - 1);
|
||||||
lastMonthReportInfo = settleOrderReports.get(settleOrderReports.size() - 2);
|
lastMonthReportInfo = settleOrderReports.get(settleOrderReports.size() - 2);
|
||||||
}else {
|
} else {
|
||||||
// 对比目标日期和目标日期前一个月数据
|
// 对比目标日期和目标日期前一个月数据
|
||||||
nowReportInfo = map.get(dateTime);
|
nowReportInfo = map.get(dateTime);
|
||||||
Date lastMonth = DateUtils.addMonths(DateUtils.parseDate(dateTime), -1);
|
Date lastMonth = DateUtils.addMonths(DateUtils.parseDate(dateTime), -1);
|
||||||
@@ -1048,6 +1074,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询订单数量趋势信息
|
* 查询订单数量趋势信息
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -1067,7 +1094,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
// 30天
|
// 30天
|
||||||
startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, DateUtils.addDays(new Date(), -30));
|
startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, DateUtils.addDays(new Date(), -30));
|
||||||
endTime = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
|
endTime = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
|
||||||
}else if (StringUtils.equals(Constants.THREE, type)) {
|
} else if (StringUtils.equals(Constants.THREE, type)) {
|
||||||
// 一年
|
// 一年
|
||||||
startTime = DateUtils.getFirstDayOfLastYearMonth();
|
startTime = DateUtils.getFirstDayOfLastYearMonth();
|
||||||
endTime = DateUtils.getLastDayOfCurrentMonth();
|
endTime = DateUtils.getLastDayOfCurrentMonth();
|
||||||
@@ -1088,7 +1115,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
a.setChargeNum(String.valueOf(new BigDecimal(a.getChargeNum()).add(new BigDecimal(b.getChargeNum()))));
|
a.setChargeNum(String.valueOf(new BigDecimal(a.getChargeNum()).add(new BigDecimal(b.getChargeNum()))));
|
||||||
return a;
|
return a;
|
||||||
}));
|
}));
|
||||||
}else {
|
} else {
|
||||||
collect = settleOrderReports.stream()
|
collect = settleOrderReports.stream()
|
||||||
.peek(report -> {
|
.peek(report -> {
|
||||||
LocalDate date = LocalDate.parse(report.getTradeDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
LocalDate date = LocalDate.parse(report.getTradeDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
@@ -1118,7 +1145,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
StringUtils.equals(Constants.TWO, type)) {
|
StringUtils.equals(Constants.TWO, type)) {
|
||||||
// 7天
|
// 7天
|
||||||
format = DateUtils.YYYY_MM_DD;
|
format = DateUtils.YYYY_MM_DD;
|
||||||
}else {
|
} else {
|
||||||
format = DateUtils.YYYY_MM;
|
format = DateUtils.YYYY_MM;
|
||||||
}
|
}
|
||||||
String yesterday = DateUtils.parseDateToStr(format, DateUtils.addDays(DateUtils.parseDate(dateTime), -1));
|
String yesterday = DateUtils.parseDateToStr(format, DateUtils.addDays(DateUtils.parseDate(dateTime), -1));
|
||||||
@@ -1132,7 +1159,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
if (yesterdayOrderNum.compareTo(BigDecimal.ZERO) != 0) {
|
if (yesterdayOrderNum.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
BigDecimal orderNumRate = todayOrderNum.subtract(yesterdayOrderNum).divide(yesterdayOrderNum, 2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal orderNumRate = todayOrderNum.subtract(yesterdayOrderNum).divide(yesterdayOrderNum, 2, BigDecimal.ROUND_HALF_UP);
|
||||||
orderNumRateGrowthRate = orderNumRate.multiply(new BigDecimal("100")) + "%";
|
orderNumRateGrowthRate = orderNumRate.multiply(new BigDecimal("100")) + "%";
|
||||||
}else {
|
} else {
|
||||||
orderNumRateGrowthRate = todayOrderNum.multiply(new BigDecimal("100")) + "%";
|
orderNumRateGrowthRate = todayOrderNum.multiply(new BigDecimal("100")) + "%";
|
||||||
}
|
}
|
||||||
vo.setOrderAmountGrowthRate(orderNumRateGrowthRate);
|
vo.setOrderAmountGrowthRate(orderNumRateGrowthRate);
|
||||||
@@ -1143,6 +1170,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询站点枪利用率趋势信息
|
* 查询站点枪利用率趋势信息
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -307,7 +307,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
<version>5.7.3</version>
|
<version>5.8.30</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.huifu.adapay.core/adapay-core-sdk -->
|
<!-- https://mvnrepository.com/artifact/com.huifu.adapay.core/adapay-core-sdk -->
|
||||||
|
|||||||
Reference in New Issue
Block a user