mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 12:35:07 +08:00
Merge branch 'dev-new' into dev-new-rabbitmq
# Conflicts: # jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/TempController.java # jsowell-admin/src/test/java/SpringBootTestController.java
This commit is contained in:
@@ -75,6 +75,11 @@ public class SettleOrderReport {
|
||||
*/
|
||||
private BigDecimal virtualAmount;
|
||||
|
||||
/**
|
||||
* 结算金额
|
||||
*/
|
||||
private BigDecimal settleAmount;
|
||||
|
||||
/**
|
||||
* 交易日期
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,9 @@ public class QueryOrderDTO extends BaseEntity {
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
// 交易流水号
|
||||
/**
|
||||
* 交易流水号
|
||||
*/
|
||||
private String transactionCode;
|
||||
|
||||
/**
|
||||
@@ -51,6 +53,9 @@ public class QueryOrderDTO extends BaseEntity {
|
||||
*/
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 站点Id列表
|
||||
*/
|
||||
private List<String> stationIdList;
|
||||
|
||||
/**
|
||||
@@ -68,6 +73,9 @@ public class QueryOrderDTO extends BaseEntity {
|
||||
*/
|
||||
private String endTime;
|
||||
|
||||
/**
|
||||
* 订单编号列表
|
||||
*/
|
||||
private List<String> orderCodeList;
|
||||
|
||||
/**
|
||||
@@ -80,9 +88,13 @@ public class QueryOrderDTO extends BaseEntity {
|
||||
*/
|
||||
private String endSettleTime;
|
||||
|
||||
// 会员组编号
|
||||
/**
|
||||
* 会员组编号
|
||||
*/
|
||||
private String groupCode;
|
||||
|
||||
// 车辆vin编号
|
||||
/**
|
||||
* 车辆vin编号
|
||||
*/
|
||||
private String vinCode;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.jsowell.pile.domain.PileMsgRecord;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@@ -16,4 +17,7 @@ public interface PileMsgRecordMapper {
|
||||
* @return
|
||||
*/
|
||||
List<PileMsgRecord> getPileFeedList(@Param("pileSn") String pileSn);
|
||||
|
||||
List<PileMsgRecord> getPileFeedListV2(@Param("pileSn") String pileSn, @Param("frameType") String frameType,
|
||||
@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.pile.domain.PileMsgRecord;
|
||||
import com.jsowell.pile.dto.QueryPileDTO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface PileMsgRecordService {
|
||||
|
||||
/**
|
||||
@@ -24,4 +27,6 @@ public interface PileMsgRecordService {
|
||||
PageResponse getPileFeedList(QueryPileDTO dto);
|
||||
|
||||
String generateDescription(PileMsgRecord pileMsgRecord);
|
||||
|
||||
List<PileMsgRecord> getPileFeedListV2(String pileSn, String frameType, Date startTime, Date endTime);
|
||||
}
|
||||
|
||||
@@ -189,6 +189,7 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
||||
return MemberDiscountVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberDiscountVO queryMemberDiscountV2(String merchantId, String stationId, String memberId) {
|
||||
String groupCode = memberGroupMapper.queryMemberGroupCode(merchantId, stationId, memberId);
|
||||
if (StringUtils.isBlank(groupCode)) {
|
||||
@@ -205,6 +206,7 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
||||
.groupCode(groupCode)
|
||||
.billingTemplateVO(billingTemplate)
|
||||
.build();
|
||||
log.info("查询会员:{}, 在运营商:{}, 下面站点:{}, 折扣信息:{}", memberId, merchantId, stationId, memberDiscountVOBuilder);
|
||||
return memberDiscountVOBuilder;
|
||||
}
|
||||
|
||||
|
||||
@@ -651,9 +651,9 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
|
||||
// 设置过期时间
|
||||
try {
|
||||
if (redisCache.getExpire(redisKey) < 0) {
|
||||
redisCache.expire(redisKey, CacheConstants.cache_expire_time_10d);
|
||||
}
|
||||
redisCache.expire(redisKey, CacheConstants.cache_expire_time_30d);
|
||||
// if (redisCache.getExpire(redisKey) < 0) {
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
log.info("设置过期时间error", e);
|
||||
}
|
||||
|
||||
@@ -494,20 +494,28 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
@Override
|
||||
public List<ConnectorInfoVO> batchSelectConnectorList(List<String> stationIds){
|
||||
List<ConnectorInfoVO> resultList = new ArrayList<>();
|
||||
Map<String, List<ConnectorInfoVO>> map = new LinkedHashMap<>();
|
||||
Map<String, List<ConnectorInfoVO>> map;
|
||||
String baseRedisKey = CacheConstants.GET_UNIAPP_CONNECTOR_LIST_BY_STATION_ID;
|
||||
// 先查询缓存数据
|
||||
for (String stationId : stationIds) {
|
||||
String redisKey = baseRedisKey + stationId;
|
||||
List<ConnectorInfoVO> list = redisCache.getCacheList(redisKey);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
map.put(stationId, list);
|
||||
// 重新设置缓存
|
||||
redisCache.deleteObject(redisKey);
|
||||
redisCache.setCacheList(redisKey, list);
|
||||
redisCache.expire(redisKey, CacheConstants.cache_expire_time_1h);
|
||||
// 先批量查缓存
|
||||
List<String> redisKeys = new ArrayList<>();
|
||||
stationIds.forEach(stationId ->
|
||||
redisKeys.add(CacheConstants.GET_UNIAPP_CONNECTOR_LIST_BY_STATION_ID + stationId));
|
||||
List<Object> redisObjects = redisCache.multiGet(redisKeys);
|
||||
List<ConnectorInfoVO> list = new ArrayList<>();
|
||||
for (Object redisObject : redisObjects) {
|
||||
if (redisObject == null) {
|
||||
continue;
|
||||
}
|
||||
JSONArray array = JSONArray.parseArray(JSON.toJSONString(redisObject));
|
||||
for (Object o : array) {
|
||||
ConnectorInfoVO connectorInfoVO = JSONObject.parseObject(JSON.toJSONString(o), ConnectorInfoVO.class);
|
||||
list.add(connectorInfoVO);
|
||||
}
|
||||
}
|
||||
// 按照stationId分组
|
||||
map = list.stream()
|
||||
.collect(Collectors.groupingBy(ConnectorInfoVO::getStationId));
|
||||
|
||||
// 先将已经有数据的stationId进行收集
|
||||
List<String> hasDataStationIds = new ArrayList<>(map.keySet());
|
||||
List<List<ConnectorInfoVO>> values = new ArrayList<>(map.values());
|
||||
@@ -528,15 +536,19 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
// 先将list根据站点id分组
|
||||
Map<String, List<ConnectorInfoVO>> collect = newConnectorInfoList.stream()
|
||||
.collect(Collectors.groupingBy(ConnectorInfoVO::getStationId));
|
||||
// 循环map并设置缓存
|
||||
// 循环map并设置缓存key值
|
||||
Map<String, List<ConnectorInfoVO>> redisMap = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, List<ConnectorInfoVO>> entry : collect.entrySet()) {
|
||||
String stationId = entry.getKey();
|
||||
String redisKey = baseRedisKey + stationId;
|
||||
|
||||
List<ConnectorInfoVO> voList = entry.getValue();
|
||||
|
||||
String redisKey = baseRedisKey + stationId;
|
||||
redisCache.setCacheList(redisKey, voList);
|
||||
redisCache.expire(redisKey, CacheConstants.cache_expire_time_1h);
|
||||
redisMap.put(redisKey, voList);
|
||||
}
|
||||
// 批量设置缓存
|
||||
redisCache.batchSetCacheList(redisMap, CacheConstants.cache_expire_time_1h, TimeUnit.SECONDS);
|
||||
// redisCache.multiSave(redisMap, CacheConstants.cache_expire_time_1h);
|
||||
}
|
||||
|
||||
// 最终将 values 中的所有 ConnectorInfoVO 元素收集到 resultList
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@@ -120,6 +121,11 @@ public class PileMsgRecordServiceImpl implements PileMsgRecordService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PileMsgRecord> getPileFeedListV2(String pileSn, String frameType, Date createTime, Date updateTime) {
|
||||
return pileMsgRecordMapper.getPileFeedListV2(pileSn, frameType, createTime, updateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析登录报文
|
||||
* @param jsonMsg
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.base.Joiner;
|
||||
@@ -379,7 +378,11 @@ public class SettleOrderReportServiceImpl implements SettleOrderReportService {
|
||||
chargeTime = chargeTime.add(new BigDecimal(settleOrderReportVO.getChargeTime()));
|
||||
electricityAmount = electricityAmount.add(settleOrderReportVO.getElectricityAmount());
|
||||
serviceAmount = serviceAmount.add(settleOrderReportVO.getServiceAmount());
|
||||
totalAmount = totalAmount.add(settleOrderReportVO.getTotalAmount());
|
||||
// 2024年11月12日14点30分使用结算金额计算收入金额
|
||||
BigDecimal amount = settleOrderReportVO.getSettleAmount() != null
|
||||
? settleOrderReportVO.getSettleAmount()
|
||||
: settleOrderReportVO.getTotalAmount();
|
||||
totalAmount = totalAmount.add(amount);
|
||||
virtualAmount = virtualAmount.add(settleOrderReportVO.getVirtualAmount());
|
||||
}
|
||||
// 用电度数
|
||||
@@ -693,6 +696,7 @@ public class SettleOrderReportServiceImpl implements SettleOrderReportService {
|
||||
settleOrderReport.setServiceAmount(totalServiceAmount);
|
||||
settleOrderReport.setTotalAmount(totalOrderAmount);
|
||||
settleOrderReport.setVirtualAmount(totalVirtualAmount);
|
||||
settleOrderReport.setSettleAmount(totalSettleAmount);
|
||||
settleOrderReport.setTradeDate(tradeDate);
|
||||
settleOrderReport.setOrderCodes(Joiner.on(",").join(orderCodeList));
|
||||
// 计算手续费 = 结算金额 * 0.55%
|
||||
@@ -703,6 +707,8 @@ public class SettleOrderReportServiceImpl implements SettleOrderReportService {
|
||||
SettleOrderReport selectResult = this.selectByStationIdAndDate(stationId, tradeDate);
|
||||
if (selectResult != null) {
|
||||
settleOrderReport.setId(selectResult.getId());
|
||||
settleOrderReport.setSettleCode(selectResult.getSettleCode());
|
||||
// settleOrderReport.setCreateTime(selectResult.getCreateTime()); // 沿用原来的创建时间
|
||||
}
|
||||
settleOrderReport.setDelFlag(DelFlagEnum.NORMAL.getValue());
|
||||
// 订单日报 新增或更新
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.jsowell.pile.vo.web;
|
||||
|
||||
import com.jsowell.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -68,6 +67,11 @@ public class SettleOrderReportVO {
|
||||
*/
|
||||
private BigDecimal virtualAmount;
|
||||
|
||||
/**
|
||||
* 结算金额
|
||||
*/
|
||||
private BigDecimal settleAmount;
|
||||
|
||||
/**
|
||||
* 交易日期
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user