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:
Guoqs
2024-11-16 14:27:13 +08:00
31 changed files with 1560 additions and 1191 deletions

View File

@@ -75,6 +75,11 @@ public class SettleOrderReport {
*/
private BigDecimal virtualAmount;
/**
* 结算金额
*/
private BigDecimal settleAmount;
/**
* 交易日期
*/

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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

View File

@@ -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());
// 订单日报 新增或更新

View File

@@ -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;
/**
* 交易日期
*/

View File

@@ -128,4 +128,21 @@
where pile_sn = #{pileSn,jdbcType=VARCHAR}
order by create_time desc
</select>
<select id="getPileFeedListV2" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from pile_msg_record
where pile_sn = #{pileSn,jdbcType=VARCHAR}
<if test="frameType != null and frameType != ''">
and frame_type = #{frameType,jdbcType=VARCHAR}
</if>
<if test="startTime != null and startTime != ''">
and create_time &gt;= #{startTime,jdbcType=TIMESTAMP}
</if>
<if test="endTime != null and endTime != ''">
and create_time &lt;= #{endTime,jdbcType=TIMESTAMP}
</if>
order by create_time desc
</select>
</mapper>

View File

@@ -16,6 +16,7 @@
<result column="service_amount" jdbcType="DECIMAL" property="serviceAmount" />
<result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
<result column="virtual_amount" jdbcType="DECIMAL" property="virtualAmount" />
<result column="settle_amount" jdbcType="DECIMAL" property="settleAmount" />
<result column="trade_date" jdbcType="VARCHAR" property="tradeDate" />
<result column="trade_amount" jdbcType="DECIMAL" property="tradeAmount" />
<result column="trade_fee" jdbcType="DECIMAL" property="tradeFee" />
@@ -26,7 +27,7 @@
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, settle_code, merchant_id, station_id, order_codes, use_electricity, charge_num,
charge_time, electricity_amount, service_amount, total_amount, virtual_amount, trade_date,
charge_time, electricity_amount, service_amount, total_amount, virtual_amount, settle_amount, trade_date,
trade_amount, trade_fee, create_time, update_time, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
@@ -46,13 +47,14 @@
insert into settle_order_report (settle_code, merchant_id, station_id,
order_codes, use_electricity, charge_num,
charge_time, electricity_amount, service_amount,
total_amount, virtual_amount, trade_date,
total_amount, virtual_amount, settle_amount, trade_date,
trade_amount, trade_fee, create_time,
update_time, del_flag)
values (#{settleCode,jdbcType=VARCHAR}, #{merchantId,jdbcType=VARCHAR}, #{stationId,jdbcType=VARCHAR},
#{orderCodes,jdbcType=LONGVARCHAR}, #{useElectricity,jdbcType=DECIMAL}, #{chargeNum,jdbcType=VARCHAR},
#{chargeTime,jdbcType=VARCHAR}, #{electricityAmount,jdbcType=DECIMAL}, #{serviceAmount,jdbcType=DECIMAL},
#{totalAmount,jdbcType=DECIMAL}, #{virtualAmount,jdbcType=DECIMAL}, #{tradeDate,jdbcType=VARCHAR},
#{totalAmount,jdbcType=DECIMAL}, #{virtualAmount,jdbcType=DECIMAL}, #{settleAmount,jdbcType=DECIMAL},
#{tradeDate,jdbcType=VARCHAR},
#{tradeAmount,jdbcType=DECIMAL}, #{tradeFee,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=VARCHAR})
</insert>
@@ -93,6 +95,9 @@
<if test="virtualAmount != null">
virtual_amount,
</if>
<if test="settleCode != null">
settle_amount,
</if>
<if test="tradeDate != null">
trade_date,
</if>
@@ -146,6 +151,9 @@
<if test="virtualAmount != null">
#{virtualAmount,jdbcType=DECIMAL},
</if>
<if test="settleCode != null">
#{settleAmount,jdbcType=DECIMAL},
</if>
<if test="tradeDate != null">
#{tradeDate,jdbcType=VARCHAR},
</if>
@@ -203,6 +211,9 @@
<if test="virtualAmount != null">
virtual_amount = #{virtualAmount,jdbcType=DECIMAL},
</if>
<if test="settleCode != null">
settle_amount = #{settleAmount,jdbcType=DECIMAL},
</if>
<if test="tradeDate != null">
trade_date = #{tradeDate,jdbcType=VARCHAR},
</if>
@@ -238,6 +249,7 @@
service_amount = #{serviceAmount,jdbcType=DECIMAL},
total_amount = #{totalAmount,jdbcType=DECIMAL},
virtual_amount = #{virtualAmount,jdbcType=DECIMAL},
settle_amount = #{settleAmount,jdbcType=DECIMAL},
trade_date = #{tradeDate,jdbcType=VARCHAR},
trade_amount = #{tradeAmount,jdbcType=DECIMAL},
trade_fee = #{tradeFee,jdbcType=DECIMAL},
@@ -305,6 +317,11 @@
when id = #{item.id,jdbcType=INTEGER} then #{item.virtualAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="settle_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.settleAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="trade_date = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.tradeDate,jdbcType=VARCHAR}
@@ -345,7 +362,7 @@
<!--@mbg.generated-->
insert into settle_order_report
(settle_code, merchant_id, station_id, order_codes, use_electricity, charge_num,
charge_time, electricity_amount, service_amount, total_amount, virtual_amount,
charge_time, electricity_amount, service_amount, total_amount, virtual_amount, settle_amount,
trade_date, trade_amount, trade_fee, create_time, update_time, del_flag)
values
<foreach collection="list" item="item" separator=",">
@@ -353,7 +370,7 @@
#{item.orderCodes,jdbcType=LONGVARCHAR}, #{item.useElectricity,jdbcType=DECIMAL},
#{item.chargeNum,jdbcType=VARCHAR}, #{item.chargeTime,jdbcType=VARCHAR}, #{item.electricityAmount,jdbcType=DECIMAL},
#{item.serviceAmount,jdbcType=DECIMAL}, #{item.totalAmount,jdbcType=DECIMAL}, #{item.virtualAmount,jdbcType=DECIMAL},
#{item.tradeDate,jdbcType=VARCHAR}, #{item.tradeAmount,jdbcType=DECIMAL}, #{item.tradeFee,jdbcType=DECIMAL},
#{item.settleAmount,jdbcType=DECIMAL}, #{item.tradeDate,jdbcType=VARCHAR}, #{item.tradeAmount,jdbcType=DECIMAL}, #{item.tradeFee,jdbcType=DECIMAL},
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.delFlag,jdbcType=VARCHAR}
)
</foreach>
@@ -376,11 +393,12 @@
service_amount,
total_amount,
virtual_amount,
settle_amount,
trade_date,
trade_amount,
trade_fee,
create_time,
update_time,
<!-- create_time,-->
<!-- update_time,-->
del_flag,
</trim>
values
@@ -399,11 +417,12 @@
#{serviceAmount,jdbcType=DECIMAL},
#{totalAmount,jdbcType=DECIMAL},
#{virtualAmount,jdbcType=DECIMAL},
#{settleAmount,jdbcType=DECIMAL},
#{tradeDate,jdbcType=VARCHAR},
#{tradeAmount,jdbcType=DECIMAL},
#{tradeFee,jdbcType=DECIMAL},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},
<!--#{createTime,jdbcType=TIMESTAMP},-->
<!--#{updateTime,jdbcType=TIMESTAMP},-->
#{delFlag,jdbcType=VARCHAR},
</trim>
on duplicate key update
@@ -422,11 +441,12 @@
service_amount = #{serviceAmount,jdbcType=DECIMAL},
total_amount = #{totalAmount,jdbcType=DECIMAL},
virtual_amount = #{virtualAmount,jdbcType=DECIMAL},
settle_amount = #{settleAmount,jdbcType=DECIMAL},
trade_date = #{tradeDate,jdbcType=VARCHAR},
trade_amount = #{tradeAmount,jdbcType=DECIMAL},
trade_fee = #{tradeFee,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
<!--create_time = #{createTime,jdbcType=TIMESTAMP},-->
<!--update_time = #{updateTime,jdbcType=TIMESTAMP},-->
del_flag = #{delFlag,jdbcType=VARCHAR},
</trim>
</insert>
@@ -470,6 +490,9 @@
<if test="virtualAmount != null">
virtual_amount,
</if>
<if test="settleAmount != null">
settle_amount,
</if>
<if test="tradeDate != null">
trade_date,
</if>
@@ -527,6 +550,9 @@
<if test="virtualAmount != null">
#{virtualAmount,jdbcType=DECIMAL},
</if>
<if test="settleAmount != null">
#{settleAmount,jdbcType=DECIMAL},
</if>
<if test="tradeDate != null">
#{tradeDate,jdbcType=VARCHAR},
</if>
@@ -584,6 +610,9 @@
<if test="virtualAmount != null">
virtual_amount = #{virtualAmount,jdbcType=DECIMAL},
</if>
<if test="settleAmount != null">
settle_amount = #{settleAmount,jdbcType=DECIMAL},
</if>
<if test="tradeDate != null">
trade_date = #{tradeDate,jdbcType=VARCHAR},
</if>
@@ -616,6 +645,7 @@
<result column="service_amount" property="serviceAmount" />
<result column="total_amount" property="totalAmount" />
<result column="virtual_amount" property="virtualAmount" />
<result column="settle_amount" property="settleAmount" />
<result column="trade_date" property="tradeDate" />
<result column="trade_amount" property="tradeAmount" />
<result column="trade_fee" property="tradeFee" />
@@ -710,6 +740,9 @@
<if test="virtualAmount != null">
virtual_amount,
</if>
<if test="settleAmount != null">
settle_amount,
</if>
<if test="tradeDate != null">
trade_date,
</if>
@@ -757,6 +790,9 @@
<if test="virtualAmount != null">
#{virtualAmount},
</if>
<if test="settleAmount != null">
#{settleAmount},
</if>
<if test="tradeDate != null">
#{tradeDate},
</if>
@@ -805,6 +841,9 @@
<if test="virtualAmount != null">
virtual_amount = #{virtualAmount},
</if>
<if test="settleAmount != null">
settle_amount = #{settleAmount},
</if>
<if test="tradeDate != null">
trade_date = #{tradeDate},
</if>
@@ -850,6 +889,7 @@
t1.service_amount as serviceAmount,
t1.total_amount as totalAmount,
t1.virtual_amount as virtualAmount,
t1.settle_amount as settleAmount,
t1.trade_date as tradeDate,
t1.trade_amount as tradeAmount,
t1.trade_fee as tradeFee