mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
Merge branch 'dev-new' into dev-new-rabbitmq
This commit is contained in:
@@ -643,13 +643,14 @@ public class PileService {
|
|||||||
vo = new PersonPileConnectorSumInfoVO();
|
vo = new PersonPileConnectorSumInfoVO();
|
||||||
vo.setSourceType(personalChargingRecord.getSourceType());
|
vo.setSourceType(personalChargingRecord.getSourceType());
|
||||||
if (personalChargingRecord.getChargeStartTime() != null && personalChargingRecord.getChargeEndTime() != null){
|
if (personalChargingRecord.getChargeStartTime() != null && personalChargingRecord.getChargeEndTime() != null){
|
||||||
vo.setChargeStartTime(DateUtils.dateTime(personalChargingRecord.getChargeStartTime()));
|
vo.setChargeStartTime(DateUtils.formatDateTime(personalChargingRecord.getChargeStartTime()));
|
||||||
vo.setChargeEndTime(DateUtils.dateTime(personalChargingRecord.getChargeEndTime()));
|
vo.setChargeEndTime(DateUtils.formatDateTime(personalChargingRecord.getChargeEndTime()));
|
||||||
String datePoor = DateUtils.getDatePoor(personalChargingRecord.getChargeEndTime(), personalChargingRecord.getChargeStartTime());
|
String datePoor = DateUtils.getDatePoor(personalChargingRecord.getChargeEndTime(), personalChargingRecord.getChargeStartTime());
|
||||||
vo.setSumChargingTime(datePoor);
|
vo.setSumChargingTime(datePoor);
|
||||||
}
|
}
|
||||||
vo.setMemberId(personalChargingRecord.getMemberId());
|
vo.setMemberId(personalChargingRecord.getMemberId());
|
||||||
vo.setSumChargingDegree(personalChargingRecord.getTotalUsedElectricity().toString());
|
vo.setSumChargingDegree(personalChargingRecord.getTotalUsedElectricity().toString());
|
||||||
|
vo.setStopReasonMsg(personalChargingRecord.getReason());
|
||||||
list.add(vo);
|
list.add(vo);
|
||||||
}
|
}
|
||||||
return PageResponse.builder()
|
return PageResponse.builder()
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.StopWatch;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -122,6 +123,8 @@ public class LoginRequestHandler extends AbstractYkcHandler {
|
|||||||
// 阻止重复帧
|
// 阻止重复帧
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
StopWatch stopWatch = new StopWatch("LoginRequestHandler");
|
||||||
|
stopWatch.start("解析数据");
|
||||||
|
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
@@ -190,10 +193,10 @@ public class LoginRequestHandler extends AbstractYkcHandler {
|
|||||||
.iccid(iccid)
|
.iccid(iccid)
|
||||||
.business(business)
|
.business(business)
|
||||||
.build();
|
.build();
|
||||||
|
stopWatch.stop();
|
||||||
// 结果(默认 0x01:登录失败)
|
// 结果(默认 0x01:登录失败)
|
||||||
byte[] flag = Constants.oneByteArray;
|
byte[] flag = Constants.oneByteArray;
|
||||||
|
stopWatch.start("登录逻辑");
|
||||||
// 通过桩编码SN查询数据库,如果有数据,则登录成功,否则登录失败
|
// 通过桩编码SN查询数据库,如果有数据,则登录成功,否则登录失败
|
||||||
PileBasicInfo pileBasicInfo = null;
|
PileBasicInfo pileBasicInfo = null;
|
||||||
try {
|
try {
|
||||||
@@ -276,7 +279,8 @@ public class LoginRequestHandler extends AbstractYkcHandler {
|
|||||||
log.error("保存报文失败pileSn:{}", pileSn, e);
|
log.error("保存报文失败pileSn:{}", pileSn, e);
|
||||||
}
|
}
|
||||||
}, executor);
|
}, executor);
|
||||||
|
stopWatch.stop();
|
||||||
|
log.info("0x01登录耗时:{}, 详细信息:{}", stopWatch.getTotalTimeMillis(), stopWatch.prettyPrint());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] messageBody = Bytes.concat(pileSnByte, flag);
|
byte[] messageBody = Bytes.concat(pileSnByte, flag);
|
||||||
return getResult(ykcDataProtocol, messageBody);
|
return getResult(ykcDataProtocol, messageBody);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
|
|||||||
if (StringUtils.isBlank(pileSn)) {
|
if (StringUtils.isBlank(pileSn)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log.info("充电桩退出:{}, channelId:{}", pileSn, PileChannelEntity.getChannelByPileSn(pileSn).channel().id());
|
log.info("充电桩退出:{}, 类型:主动断开链接, channelId:{}", pileSn, PileChannelEntity.getChannelByPileSn(pileSn).channel().id());
|
||||||
|
|
||||||
// 充电桩断开连接,所有枪口都设置为【离线】
|
// 充电桩断开连接,所有枪口都设置为【离线】
|
||||||
pileConnectorInfoService.updateConnectorStatusByPileSn(pileSn, PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue());
|
pileConnectorInfoService.updateConnectorStatusByPileSn(pileSn, PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue());
|
||||||
@@ -68,7 +68,7 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
|
|||||||
// 记录充电桩退出msg
|
// 记录充电桩退出msg
|
||||||
// 保存报文
|
// 保存报文
|
||||||
String type = YKCFrameTypeCode.PILE_LOG_OUT.getCode() + "";
|
String type = YKCFrameTypeCode.PILE_LOG_OUT.getCode() + "";
|
||||||
String jsonMsg = YKCFrameTypeCode.PILE_LOG_OUT.getValue();
|
String jsonMsg = YKCFrameTypeCode.PILE_LOG_OUT.getValue() + ": 充电桩主动断开链接";
|
||||||
pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, "");
|
pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, "");
|
||||||
|
|
||||||
// 删除桩编号和channel的关系
|
// 删除桩编号和channel的关系
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.jsowell.common.constant.CacheConstants;
|
|||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.core.domain.ykc.GroundLockData;
|
import com.jsowell.common.core.domain.ykc.GroundLockData;
|
||||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||||
|
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||||
import com.jsowell.common.core.page.PageResponse;
|
import com.jsowell.common.core.page.PageResponse;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||||
@@ -82,6 +83,9 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileMsgRecordService pileMsgRecordService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PileStationInfoService pileStationInfoService;
|
private PileStationInfoService pileStationInfoService;
|
||||||
|
|
||||||
@@ -863,14 +867,25 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPileOffLine(String pileSn) {
|
public boolean checkPileOffLine(String pileSn) {
|
||||||
|
boolean flag = false;
|
||||||
// 获取桩最后连接时间,最后连接到平台的时间在3分钟之前,判定为离线
|
// 获取桩最后连接时间,最后连接到平台的时间在3分钟之前,判定为离线
|
||||||
String lastConnectionTime = redisCache.getCacheObject(CacheConstants.PILE_LAST_CONNECTION + pileSn);
|
String lastConnectionTime = redisCache.getCacheObject(CacheConstants.PILE_LAST_CONNECTION + pileSn);
|
||||||
if (StringUtils.isBlank(lastConnectionTime)) {
|
if (StringUtils.isBlank(lastConnectionTime)) {
|
||||||
// 没有最后连接时间,返回离线
|
// 没有最后连接时间,返回离线
|
||||||
return true;
|
flag = true;
|
||||||
|
} else {
|
||||||
|
long l = DateUtils.intervalTime(lastConnectionTime, DateUtils.getDateTime());
|
||||||
|
if (l > 3L) {
|
||||||
|
// 超过3分钟,返回离线
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
long l = DateUtils.intervalTime(lastConnectionTime, DateUtils.getDateTime());
|
if (flag) {
|
||||||
return l > 3L;
|
String type = YKCFrameTypeCode.PILE_LOG_OUT.getCode() + "";
|
||||||
|
String jsonMsg = YKCFrameTypeCode.PILE_LOG_OUT.getValue() + ": 超过3分钟无通信, 判断离线!";
|
||||||
|
pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, "");
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -225,12 +225,16 @@ public class PileMsgRecordServiceImpl implements PileMsgRecordService {
|
|||||||
// 枪口编号
|
// 枪口编号
|
||||||
String pileConnectorCode = jsonObject.getString("pileSn") + jsonObject.getString("connectorCode");
|
String pileConnectorCode = jsonObject.getString("pileSn") + jsonObject.getString("connectorCode");
|
||||||
|
|
||||||
|
String stopReason = jsonObject.getString("stopReasonMsg");
|
||||||
|
|
||||||
return "订单号:" + orderCode + ", " +
|
return "订单号:" + orderCode + ", " +
|
||||||
"交易流水号:" + transactionCode + ", " +
|
"交易流水号:" + transactionCode + ", " +
|
||||||
"枪口编号:" + pileConnectorCode + ", " +
|
"枪口编号:" + pileConnectorCode + ", " +
|
||||||
"充电度数:" + totalElectricity + ", " +
|
"充电度数:" + totalElectricity + ", " +
|
||||||
"消费金额:" + consumptionAmount + ", " +
|
"消费金额:" + consumptionAmount + ", " +
|
||||||
"开始时间:" + startTime + ", " +
|
"开始时间:" + startTime + ", " +
|
||||||
"结束时间:" + endTime;
|
"结束时间:" + endTime + ", " +
|
||||||
|
"停止原因:" + stopReason
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,4 +46,9 @@ public class PersonPileConnectorSumInfoVO {
|
|||||||
* 来源(4G/BT) sourceType
|
* 来源(4G/BT) sourceType
|
||||||
*/
|
*/
|
||||||
private String sourceType;
|
private String sourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停止原因
|
||||||
|
*/
|
||||||
|
private String stopReasonMsg;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
package com.jsowell.thirdparty.platform.service.impl;
|
package com.jsowell.thirdparty.platform.service.impl;
|
||||||
|
|
||||||
|
import com.jsowell.common.constant.Constants;
|
||||||
|
import com.jsowell.common.util.StringUtils;
|
||||||
|
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||||
|
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||||
|
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
|
||||||
|
import com.jsowell.thirdparty.platform.domain.ChargeAlgorithmData;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10,4 +17,69 @@ import org.springframework.stereotype.Service;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ChargeAlgorithmService {
|
public class ChargeAlgorithmService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderBasicInfoService orderBasicInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送充电订单数据
|
||||||
|
* @param orderCode
|
||||||
|
*/
|
||||||
|
public void pushOrderInfo(String orderCode) {
|
||||||
|
// 根据订单号查询订单信息
|
||||||
|
OrderVO orderVO = orderBasicInfoService.getChargeOrderInfoByOrderCode(orderCode);
|
||||||
|
|
||||||
|
ChargeAlgorithmData data = ChargeAlgorithmData.builder()
|
||||||
|
.orderCode(orderCode)
|
||||||
|
.initSoc(Constants.zero)
|
||||||
|
.currentSoc(Constants.zero)
|
||||||
|
.alarmCode(Constants.ZERO)
|
||||||
|
.currentServiceFee(String.valueOf(orderVO.getTotalServiceAmount()))
|
||||||
|
.currentTotalFee(String.valueOf(orderVO.getOrderAmount()))
|
||||||
|
.totalCharge(orderVO.getTotalPower())
|
||||||
|
.totalChargeTime(Integer.parseInt(orderVO.getChargingTime()))
|
||||||
|
.remainChargeTime(Constants.zero)
|
||||||
|
// .maxAllowElectricity()
|
||||||
|
// .singleMaxAllowVoltage()
|
||||||
|
// .dcv()
|
||||||
|
// .dca()
|
||||||
|
// .bmsDemandVoltage()
|
||||||
|
// .bmsDemandElectricity()
|
||||||
|
// .bmsChargeMode()
|
||||||
|
// .readBeforeCharge()
|
||||||
|
// .readCurrentCharge()
|
||||||
|
// .beginTime()
|
||||||
|
// .maxAllowTemp()
|
||||||
|
// .chargePower()
|
||||||
|
// .ratedCapacity()
|
||||||
|
// .nominalEnergy()
|
||||||
|
// .ratedVoltage()
|
||||||
|
// .singleMaxVoltage()
|
||||||
|
// .singleMinVoltage()
|
||||||
|
// .singleMaxTemp()
|
||||||
|
// .ventTemp()
|
||||||
|
// .environmentTemp()
|
||||||
|
// .gunTemp()
|
||||||
|
// .doorStatus()
|
||||||
|
// .bmsVersion()
|
||||||
|
// .measuringChargeVoltage()
|
||||||
|
// .measuringChargeElectricity()
|
||||||
|
// .maxSingleVoltageGroupNum()
|
||||||
|
// .maxSingleVoltageNum()
|
||||||
|
// .maxTempPointNum()
|
||||||
|
// .minTempPointNum()
|
||||||
|
// .batteryType()
|
||||||
|
// .batteryInsulation()
|
||||||
|
// .maxAllowTotalVoltage()
|
||||||
|
// .beforeChargeTotalVoltage()
|
||||||
|
|
||||||
|
.build();
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(orderVO.getStartSoc())) {
|
||||||
|
data.setInitSoc(Integer.parseInt(orderVO.getStartSoc()));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(orderVO.getEndSoc())) {
|
||||||
|
data.setCurrentSoc(Integer.parseInt(orderVO.getEndSoc()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user