mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-25 21:45:08 +08:00
Merge branch 'dev-new' into dev-new-rabbitmq
# Conflicts: # jsowell-admin/src/test/java/PaymentTestController.java
This commit is contained in:
@@ -504,4 +504,11 @@ public interface OrderBasicInfoService{
|
||||
* @param orderCode
|
||||
*/
|
||||
List<BusinessOrderBillingInfoVO> getOrderBillingDetail(String orderCode);
|
||||
|
||||
/**
|
||||
* 临时接口,根据站点id、订单创建时间区间查询订单编号
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<String> tempGetOrderCodes(QueryOrderDTO dto);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import com.jsowell.common.core.domain.ykc.BMSChargeInfoData;
|
||||
import com.jsowell.common.core.domain.ykc.BMSDemandAndChargerOutputData;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.ebike.deviceupload.EBikeMessageCmd20;
|
||||
@@ -110,7 +112,6 @@ public interface PileBasicInfoService {
|
||||
/**
|
||||
* 通过桩sn查询basic信息
|
||||
*
|
||||
* @param id 桩id
|
||||
* @return 结果集合
|
||||
*/
|
||||
PileDetailVO selectPileDetailByPileSn(String pileSn);
|
||||
@@ -151,6 +152,31 @@ public interface PileBasicInfoService {
|
||||
*/
|
||||
void saveRealTimeMonitorData2Redis(RealTimeMonitorData realTimeMonitorData);
|
||||
|
||||
/**
|
||||
* 0x23数据保存到redis
|
||||
* @param bmsDemandAndChargerOutputData
|
||||
*/
|
||||
void saveBMSDemandAndChargerOutputInfo2Redis(BMSDemandAndChargerOutputData bmsDemandAndChargerOutputData);
|
||||
|
||||
/**
|
||||
* 0x25数据保存到redis
|
||||
* @param bmsChargeInfoData
|
||||
*/
|
||||
void saveBMSChargeInfo2Redis(BMSChargeInfoData bmsChargeInfoData);
|
||||
|
||||
/**
|
||||
* 根据交易流水号获取0x25数据(时间倒序)
|
||||
* @return
|
||||
*/
|
||||
List<BMSChargeInfoData> getBMSChargeInfoList(String transactionCode);
|
||||
|
||||
/**
|
||||
* 根据交易流水号查询0x23数据(时间倒序)
|
||||
* @param transactionCode
|
||||
* @return
|
||||
*/
|
||||
List<BMSDemandAndChargerOutputData> getBMSDemandAndChargerOutputInfoList(String transactionCode);
|
||||
|
||||
PileConnectorDetailVO queryPileConnectorDetail(String pileConnectorCode);
|
||||
|
||||
String getPileQrCodeUrl(String pileSn);
|
||||
@@ -206,7 +232,6 @@ public interface PileBasicInfoService {
|
||||
/**
|
||||
* 获取充电桩列表
|
||||
* 提供给联联平台
|
||||
* @param pileStationInfo
|
||||
* @return
|
||||
*/
|
||||
// List<EquipmentInfo> getPileList(PileStationInfo pileStationInfo);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class PileSnGenerateService {
|
||||
increResult = prefix + year + String.format("%1$010d", increNum);
|
||||
|
||||
// 保存到字典中
|
||||
savePileSn2Dict(pileNum);
|
||||
// savePileSn2Dict(pileNum);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取序列号失败", e);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public class PileSnGenerateService {
|
||||
} else {
|
||||
SysDictData dictData = new SysDictData();
|
||||
dictData.setDictType(pile_sn_generate_type);
|
||||
dictData.setDictLabel(EBIKE_PILE_SN_LABEL);
|
||||
dictData.setDictLabel(EV_PILE_SN_LABEL);
|
||||
dictData.setDictValue(pileSnNum + "");
|
||||
dictData.setListClass(Constants.DEFAULT);
|
||||
dictData.setCreateBy(Constants.SYSTEM);
|
||||
|
||||
@@ -1208,6 +1208,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
}
|
||||
List<String> orderCodeList = Lists.newArrayList(StringUtils.split(orderCodes, ","));
|
||||
List<OrderBasicInfo> orderBasicInfos = queryOrderList(orderCodeList);
|
||||
logger.info("运营商id:{}, 日期:{}, 订单号数量:{}, 查询结果数量:{}, orderCodeList:{}", merchantId, orderReport.getTradeDate(), orderCodeList.size(), orderBasicInfos.size(), JSON.toJSONString(orderCodeList));
|
||||
if (CollectionUtils.isEmpty(orderBasicInfos)) {
|
||||
continue;
|
||||
}
|
||||
@@ -1247,12 +1248,11 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
.subtract(feeAmt);
|
||||
clearingBillDetail.setFeeAmt(feeAmt);
|
||||
clearingBillDetail.setConfirmAmt(confirmAmt);
|
||||
billDetailList.add(clearingBillDetail);
|
||||
} else {
|
||||
clearingBillDetail.setFeeAmt(BigDecimal.ZERO);
|
||||
clearingBillDetail.setConfirmAmt(BigDecimal.ZERO);
|
||||
billDetailList.add(clearingBillDetail);
|
||||
}
|
||||
billDetailList.add(clearingBillDetail);
|
||||
} catch (Exception e) {
|
||||
logger.error("订单交易确认失败:{}", orderBasicInfo.getOrderCode(), e);
|
||||
}
|
||||
@@ -4458,5 +4458,10 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tempGetOrderCodes(QueryOrderDTO dto) {
|
||||
return orderBasicInfoMapper.tempGetOrderCodes(dto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.YouDianUtils;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
||||
import com.jsowell.common.core.domain.ykc.GroundLockData;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.core.domain.ykc.*;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.DelFlagEnum;
|
||||
import com.jsowell.common.enums.lianlian.LianLianPileStatusEnum;
|
||||
@@ -634,6 +633,14 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
if (StringUtils.equals(realTimeMonitorData.getTransactionCode(), Constants.ILLEGAL_TRANSACTION_CODE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BigDecimal outputVoltage = new BigDecimal(realTimeMonitorData.getOutputVoltage());
|
||||
BigDecimal outputCurrent = new BigDecimal(realTimeMonitorData.getOutputCurrent());
|
||||
if (outputCurrent.compareTo(BigDecimal.ZERO) == 0) {
|
||||
// 电流等于0,不保存到redis
|
||||
return;
|
||||
}
|
||||
|
||||
// 保存到redis
|
||||
String redisKey = CacheConstants.PILE_REAL_TIME_MONITOR_DATA + realTimeMonitorData.getPileConnectorCode() + "_" + realTimeMonitorData.getTransactionCode();
|
||||
|
||||
@@ -641,8 +648,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
Date now = new Date();
|
||||
realTimeMonitorData.setDateTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, now));
|
||||
// 计算功率,后面查询要用
|
||||
String power = new BigDecimal(realTimeMonitorData.getOutputVoltage())
|
||||
.multiply(new BigDecimal(realTimeMonitorData.getOutputCurrent())).setScale(2, RoundingMode.HALF_UP).toString();
|
||||
String power = outputVoltage.multiply(outputCurrent).setScale(2, RoundingMode.HALF_UP).toString();
|
||||
realTimeMonitorData.setOutputPower(power);
|
||||
// 保存json字符串
|
||||
String jsonMsg = JSON.toJSONString(realTimeMonitorData);
|
||||
@@ -663,6 +669,122 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
redisCache.setCacheObject(pileIsChargingKey, realTimeMonitorData.getTransactionCode(), 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* 0x23信息设置缓存 (缓存时间3天)
|
||||
* @param data
|
||||
*/
|
||||
@Override
|
||||
public void saveBMSDemandAndChargerOutputInfo2Redis(BMSDemandAndChargerOutputData data) {
|
||||
if (StringUtils.equals(data.getTransactionCode(), Constants.ILLEGAL_TRANSACTION_CODE)) {
|
||||
return;
|
||||
}
|
||||
// 保存到redis
|
||||
String redisKey = CacheConstants.BMS_DEMAND_AND_CHARGER_OUTPUT_BY_TRANSACTION_CODE + data.getTransactionCode();
|
||||
// 设置接收到实时数据的时间
|
||||
Date now = new Date();
|
||||
data.setDateTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, now));
|
||||
// 计算功率,后面查询要用
|
||||
String power = new BigDecimal(data.getPileVoltageOutput())
|
||||
.multiply(new BigDecimal(data.getPileCurrentOutput())).setScale(2, RoundingMode.HALF_UP).toString();
|
||||
data.setOutputPower(power);
|
||||
// 保存json字符串
|
||||
String jsonMsg = JSON.toJSONString(data);
|
||||
// 0x23数据20秒发送一次,1分钟3次,在同一分钟内,只保留最后一条实时数据
|
||||
redisCache.hset(redisKey, DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:00", now), jsonMsg);
|
||||
|
||||
// 设置过期时间
|
||||
try {
|
||||
redisCache.expire(redisKey, CacheConstants.cache_expire_time_3d);
|
||||
// if (redisCache.getExpire(redisKey) < 0) {
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
log.info("0x23存入缓存设置过期时间error", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 0x25数据保存到redis
|
||||
* @param bmsChargeInfoData
|
||||
*/
|
||||
@Override
|
||||
public void saveBMSChargeInfo2Redis(BMSChargeInfoData bmsChargeInfoData) {
|
||||
if (StringUtils.equals(bmsChargeInfoData.getTransactionCode(), Constants.ILLEGAL_TRANSACTION_CODE)) {
|
||||
return;
|
||||
}
|
||||
// 保存到redis
|
||||
String redisKey = CacheConstants.BMS_CHARGE_INFO_BY_TRANSACTION_CODE + bmsChargeInfoData.getTransactionCode();
|
||||
// 设置接收到实时数据的时间
|
||||
Date now = new Date();
|
||||
bmsChargeInfoData.setDateTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, now));
|
||||
// 保存json字符串
|
||||
String jsonMsg = JSON.toJSONString(bmsChargeInfoData);
|
||||
// 0x25数据20秒发送一次,1分钟3次,在同一分钟内,只保留最后一条实时数据
|
||||
redisCache.hset(redisKey, DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:00", now), jsonMsg);
|
||||
|
||||
// 设置过期时间
|
||||
try {
|
||||
redisCache.expire(redisKey, CacheConstants.cache_expire_time_3d);
|
||||
} catch (Exception e) {
|
||||
log.info("0x25存入缓存设置过期时间error", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据交易流水号获取0x25数据
|
||||
* @param transactionCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BMSChargeInfoData> getBMSChargeInfoList(String transactionCode) {
|
||||
List<BMSChargeInfoData> resultList = Lists.newArrayList();
|
||||
if (StringUtils.isBlank(transactionCode)) {
|
||||
return resultList;
|
||||
}
|
||||
String redisKey = CacheConstants.BMS_CHARGE_INFO_BY_TRANSACTION_CODE + transactionCode;
|
||||
// 拿到所有数据
|
||||
Map<Object, Object> map = redisCache.hmget(redisKey);
|
||||
if (map != null && !map.isEmpty()) {
|
||||
List<String> keyList = map.keySet().stream()
|
||||
.map(x -> (String) x)
|
||||
.sorted(Comparator.reverseOrder()) // 对keyList排序 时间倒序
|
||||
.collect(Collectors.toList());
|
||||
for (String s : keyList) {
|
||||
Object o = map.get(s);
|
||||
BMSChargeInfoData data = JSONObject.parseObject((String) o, BMSChargeInfoData.class);
|
||||
resultList.add(data);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据交易流水号查询0x23数据(时间倒序)
|
||||
* @param transactionCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BMSDemandAndChargerOutputData> getBMSDemandAndChargerOutputInfoList(String transactionCode) {
|
||||
List<BMSDemandAndChargerOutputData> resultList = Lists.newArrayList();
|
||||
if (StringUtils.isBlank(transactionCode)) {
|
||||
return resultList;
|
||||
}
|
||||
String redisKey = CacheConstants.BMS_DEMAND_AND_CHARGER_OUTPUT_BY_TRANSACTION_CODE + transactionCode;
|
||||
// 拿到所有数据
|
||||
Map<Object, Object> map = redisCache.hmget(redisKey);
|
||||
if (map != null && !map.isEmpty()) {
|
||||
List<String> keyList = map.keySet().stream()
|
||||
.map(x -> (String) x)
|
||||
.sorted(Comparator.reverseOrder()) // 对keyList排序 时间倒序
|
||||
.collect(Collectors.toList());
|
||||
for (String s : keyList) {
|
||||
Object o = map.get(s);
|
||||
BMSDemandAndChargerOutputData data = JSONObject.parseObject((String) o, BMSDemandAndChargerOutputData.class);
|
||||
resultList.add(data);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PileConnectorDetailVO queryPileConnectorDetail(String pileConnectorCode) {
|
||||
return pileBasicInfoMapper.queryPileConnectorDetail(pileConnectorCode);
|
||||
@@ -1111,6 +1233,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
String pileSn = pileBasicInfo.getSn();
|
||||
|
||||
equipmentInfo.setEquipmentID(pileSn);
|
||||
equipmentInfo.setEquipmentClassification(1);
|
||||
equipmentInfo.setManufacturerID(Constants.OPERATORID_LIANLIAN);
|
||||
equipmentInfo.setManufacturerName(Constants.MANUFACTURER_NAME);
|
||||
equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileBasicInfo.getCreateTime()));
|
||||
@@ -1146,6 +1269,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
|
||||
resultList.add(equipmentInfo);
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@@ -1208,6 +1332,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
connectorInfo.setParkNo(pileConnectorInfo.getParkNo());
|
||||
}
|
||||
connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
||||
connectorInfo.setEquipmentClassification(1);
|
||||
connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
||||
connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent()));
|
||||
connectorInfo.setConnectorName(pileConnectorInfo.getPileConnectorCode());
|
||||
|
||||
@@ -337,7 +337,10 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
if (CollectionUtils.isEmpty(pileSns) && CollectionUtils.isEmpty(connectorIds) && CollectionUtils.isEmpty(connectorCodeList)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
|
||||
if (StringUtils.isBlank(dto.getRequestSource())) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
}
|
||||
|
||||
List<PileConnectorInfoVO> pileConnectorInfoList = pileConnectorInfoMapper.getPileConnectorInfoList(pileSns, connectorIds, connectorCodeList);
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ public class PileMemberRelationServiceImpl implements PileMemberRelationService
|
||||
return selectPileMemberRelationList(pileMemberRelation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberVO> selectMemberList(String pileSn) {
|
||||
return pileMemberRelationMapper.selectMemberList(pileSn);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.jsowell.common.enums.ykc.OrderPayRecordEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.domain.ebike.deviceupload.EBikeMessageCmd03;
|
||||
import com.jsowell.pile.dto.*;
|
||||
@@ -246,6 +247,23 @@ public abstract class AbstractProgramLogic implements InitializingBean {
|
||||
orderBasicInfo.setSettlementTime(DateUtils.getNowDate()); // 结算时间
|
||||
}
|
||||
orderBasicInfo.setRefundAmount(residue); // 结算退款金额
|
||||
|
||||
if (StringUtils.isBlank(orderBasicInfo.getStartSoc()) || StringUtils.isBlank(orderBasicInfo.getEndSoc())) {
|
||||
try {
|
||||
Map<String, String> socMap = YKCUtils.getSOCMap(orderBasicInfo.getTransactionCode());
|
||||
if (Objects.nonNull(socMap)) {
|
||||
if (StringUtils.isBlank(orderBasicInfo.getStartSoc())) {
|
||||
orderBasicInfo.setStartSoc(socMap.get("startSoc"));
|
||||
}
|
||||
if (StringUtils.isBlank(orderBasicInfo.getEndSoc())) {
|
||||
orderBasicInfo.setEndSoc(socMap.get("endSoc"));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("获取订单充电开始结束SOC失败:{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user