mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-05 02:20:12 +08:00
Merge branch 'dev' of https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web into dev
# Conflicts: # jsowell-admin/src/main/java/com/jsowell/web/controller/pile/OrderBasicInfoController.java # jsowell-pile/src/main/java/com/jsowell/pile/mapper/OrderSplitRecordMapper.java # jsowell-pile/src/main/java/com/jsowell/pile/service/OrderSplitRecordService.java # jsowell-pile/src/main/resources/mapper/pile/OrderSplitRecordMapper.xml
This commit is contained in:
@@ -134,10 +134,18 @@ public class MemberService {
|
||||
if (StringUtils.isEmpty(captchaCode)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_VERIFICATION_CODE_TIMEOUT_ERROR);
|
||||
}
|
||||
// 如果缓存中有,但与实际不一致,则为验证码错误
|
||||
if (!StringUtils.equals(captchaCode, dto.getVerificationCode())) {
|
||||
// 获取通用验证码
|
||||
String commonCaptchaCode = redisCache.getCacheObject(CacheConstants.SMS_COMMON_VERIFICATION_CODE_KEY + dto.getMobileNumber());
|
||||
|
||||
// 缓存中的验证码或者通用验证码, 两个都不匹配, 则抛出异常
|
||||
if (!StringUtils.equals(captchaCode, dto.getVerificationCode()) && !StringUtils.equals(commonCaptchaCode, dto.getVerificationCode())) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_VERIFICATION_CODE_ERROR);
|
||||
}
|
||||
|
||||
// 如果缓存中有,但与实际不一致,则为验证码错误
|
||||
// if (!StringUtils.equals(captchaCode, dto.getVerificationCode())) {
|
||||
// throw new BusinessException(ReturnCodeEnum.CODE_VERIFICATION_CODE_ERROR);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.jsowell.pile.service.PileStationInfoService;
|
||||
import com.jsowell.pile.util.UserUtils;
|
||||
import com.jsowell.pile.vo.web.OrderListVO;
|
||||
import com.jsowell.pile.vo.web.SplitAggregateDataVO;
|
||||
import com.jsowell.pile.vo.web.SplitRecordInfoVO;
|
||||
import com.jsowell.pile.vo.web.SplitConfigOrderVO;
|
||||
import com.jsowell.service.OrderService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -270,4 +270,25 @@ public class OrderBasicInfoController extends BaseController {
|
||||
logger.info("根据汇付会员id查询分账汇总数据 params:{}, result:{}", JSON.toJSONString(dto), response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/queryMemberAggregateData")
|
||||
public RestApiResponse<?> queryStationAggregateData(@RequestBody SplitConfigStationDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
List<SplitConfigOrderVO> list = orderSplitRecordService.queryStationAggregateData(dto);
|
||||
response = new RestApiResponse<>(list);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询站点汇总数据 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("查询站点汇总数据 params:{}, result:{}", JSON.toJSONString(dto), response);
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -292,6 +292,30 @@ public class SpringBootTestController {
|
||||
@Autowired
|
||||
private QcyunsService qcyunsService;
|
||||
|
||||
@Test
|
||||
public void testCommonVerificationCode() {
|
||||
String phoneNumber = "18612341234";
|
||||
String code = "2563";
|
||||
|
||||
// 改为保存redis
|
||||
// String redisKey = CacheConstants.SMS_VERIFICATION_CODE_KEY + phoneNumber;
|
||||
// redisCache.setCacheObject(redisKey, code, CacheConstants.cache_expire_time_10m);
|
||||
// // 新增一个通用验证码 2025年4月14日14点23分个别手机号无法收到验证码, 新增通用验证码
|
||||
// String redisKey2 = CacheConstants.SMS_COMMON_VERIFICATION_CODE_KEY + phoneNumber;
|
||||
// redisCache.setCacheObject(redisKey2, Constants.COMMON_VERIFICATION_CODE, CacheConstants.cache_expire_time_30m);
|
||||
//
|
||||
// MemberRegisterAndLoginDTO build = MemberRegisterAndLoginDTO.builder()
|
||||
// .mobileNumber(phoneNumber)
|
||||
// .verificationCode("2561")
|
||||
// .build();
|
||||
//
|
||||
// memberService.checkVerificationCode(build);
|
||||
|
||||
System.out.println(true && false);
|
||||
|
||||
System.out.println(false && false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifySplitConfigTest() {
|
||||
List<StationSplitConfig> stationSplitConfigList = Lists.newArrayList();
|
||||
|
||||
@@ -1,32 +1,29 @@
|
||||
002212025033120040710752753296222404608
|
||||
002212025040118083910753086624879816704
|
||||
002212025040118121310753087526303617024
|
||||
002212025040210493010753338498696753152
|
||||
002212025040212040610753357272238116864
|
||||
002212025040215455710753413101593972736
|
||||
002212025040218145710753450600974405632
|
||||
002212025040219495110753474482596904960
|
||||
002212025040223032810753523208355823616
|
||||
002212025040223543110753536054248128512
|
||||
002212025040312071510753720452197171200
|
||||
002212025040314331710753757201870016512
|
||||
002212025040316411610753789412328382464
|
||||
002212025040421013510754217311242010624
|
||||
002212025040519095410754551590926077952
|
||||
002212025040609135610754764000301273088
|
||||
002212025040611093710754793114936659968
|
||||
002212025040619292810754918905612455936
|
||||
002212025040713134910755186758379012096
|
||||
002212025040717495610755256244689645568
|
||||
002212025040720410110755299299038371840
|
||||
002212025040819433910755647248230109184
|
||||
002212025040820210010755656648563867648
|
||||
002212025040910053110755864145792385024
|
||||
002212025040912384610755902710423265280
|
||||
002212025040917575410755983024773582848
|
||||
002212025040918160910755987617166602240
|
||||
002212025040922292610756051356562411520
|
||||
002212025041018274910756352943126425600
|
||||
002212025041020451410756387522530336768
|
||||
002212025041108534410756570855605174272
|
||||
002212025041112061610756619309433913344
|
||||
002212025040517302410754526554035269632
|
||||
002212025040521352610754588215047827456
|
||||
002212025040521583710754594050836094977
|
||||
002212025040522064510754596098677391360
|
||||
002212025040522423310754605107544899584
|
||||
002212025040522455910754605969921523712
|
||||
002212025040523390210754619322947743744
|
||||
002212025040600303910754632313055567872
|
||||
002212025040600392710754634527276048384
|
||||
002212025040601060810754641239708884992
|
||||
002212025040601173210754644110103003136
|
||||
002212025040603200310754674940574154752
|
||||
002212025040609192510754765380371595264
|
||||
002212025040609305410754768271103414272
|
||||
002212025040610013710754776001338265600
|
||||
002212025040612155610754809803494293504
|
||||
002212025040612343810754814508381392896
|
||||
002212025040612554310754819815291432960
|
||||
002212025040614060610754837526614802432
|
||||
002212025040615114510754854048968069120
|
||||
002212025040617230610754887101996191744
|
||||
002212025040617282410754888436151406592
|
||||
002212025040618070510754898171150368768
|
||||
002212025040619341410754920104559325184
|
||||
002212025040619431310754922363885764608
|
||||
002212025040619494510754924008057954304
|
||||
002212025040620043410754927737400930304
|
||||
002212025040620182910754931240679227392
|
||||
002212025040620585810754941429015732225
|
||||
|
||||
@@ -385,6 +385,11 @@ public class CacheConstants {
|
||||
*/
|
||||
public static final String SMS_VERIFICATION_CODE_KEY = "sms_verification_code:";
|
||||
|
||||
/**
|
||||
* 短信通用验证码有效期时长 redis key
|
||||
*/
|
||||
public static final String SMS_COMMON_VERIFICATION_CODE_KEY = "sms_common_verification_code:";
|
||||
|
||||
/**
|
||||
* 根据桩号查询计费模板
|
||||
*/
|
||||
|
||||
@@ -314,4 +314,7 @@ public class Constants {
|
||||
// 汇付延时分账支付模式
|
||||
public static final String ADAPAY_PAY_MODE_DELAY = "delay";
|
||||
|
||||
// 通用验证码
|
||||
public static final String COMMON_VERIFICATION_CODE = "8888";
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.github.qcloudsms.SmsSingleSender;
|
||||
import com.github.qcloudsms.SmsSingleSenderResult;
|
||||
import com.github.qcloudsms.httpclient.HTTPException;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -56,6 +57,9 @@ public class SMSUtil {
|
||||
String redisKey = CacheConstants.SMS_VERIFICATION_CODE_KEY + phoneNumber;
|
||||
redisCache.setCacheObject(redisKey, code, CacheConstants.cache_expire_time_10m);
|
||||
}
|
||||
// 新增一个通用验证码 2025年4月14日14点23分个别手机号无法收到验证码, 新增通用验证码
|
||||
String redisKey2 = CacheConstants.SMS_COMMON_VERIFICATION_CODE_KEY + phoneNumber;
|
||||
redisCache.setCacheObject(redisKey2, Constants.COMMON_VERIFICATION_CODE, CacheConstants.cache_expire_time_30m);
|
||||
return reStr;
|
||||
}
|
||||
|
||||
@@ -64,4 +68,4 @@ public class SMSUtil {
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,8 @@ public class SplitConfigStationDTO {
|
||||
* 汇付会员ID
|
||||
*/
|
||||
private String adapayMemberId;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.OrderSplitRecord;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitDTO;
|
||||
import com.jsowell.pile.dto.SplitConfigStationDTO;
|
||||
import com.jsowell.pile.vo.web.OrderSplitRecordVO;
|
||||
import com.jsowell.pile.vo.web.SplitAggregateDataVO;
|
||||
import com.jsowell.pile.vo.web.SplitConfigStationVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -50,4 +52,11 @@ public interface OrderSplitRecordMapper {
|
||||
List<OrderSplitRecordVO> queryOrderSplitData(@Param("orderCodeList") List<String> orderCodeList);
|
||||
|
||||
List<SplitAggregateDataVO> getSplitListByAdapyMemberId(@Param("dto") QueryOrderSplitDTO dto);
|
||||
|
||||
/**
|
||||
* 根据汇付会员id查询分账汇总数据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<SplitConfigStationVO> queryStationAggregateData(SplitConfigStationDTO dto);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.pile.domain.OrderSplitRecord;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitDTO;
|
||||
import com.jsowell.pile.dto.SplitConfigStationDTO;
|
||||
import com.jsowell.pile.dto.SplitOrderDTO;
|
||||
import com.jsowell.pile.vo.OrderInfoDetailVO;
|
||||
import com.jsowell.pile.vo.web.*;
|
||||
@@ -82,5 +83,7 @@ public interface OrderSplitRecordService {
|
||||
* @return
|
||||
*/
|
||||
List<SplitAggregateDataVO> queryStationAggregateData(QueryOrderSplitDTO dto);
|
||||
|
||||
List<SplitConfigOrderVO> queryStationAggregateData(SplitConfigStationDTO dto);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.jsowell.common.core.domain.model.LoginUser;
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.common.enums.DelFlagEnum;
|
||||
import com.jsowell.common.enums.adapay.AdapayStatusEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
@@ -19,6 +20,7 @@ import com.jsowell.pile.domain.AdapayMemberAccount;
|
||||
import com.jsowell.pile.domain.OrderSplitRecord;
|
||||
import com.jsowell.pile.domain.PileMerchantInfo;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitDTO;
|
||||
import com.jsowell.pile.dto.SplitConfigStationDTO;
|
||||
import com.jsowell.pile.dto.SplitOrderDTO;
|
||||
import com.jsowell.pile.mapper.OrderSplitRecordMapper;
|
||||
import com.jsowell.pile.service.AdapayMemberAccountService;
|
||||
@@ -350,6 +352,70 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
return orderSplitRecordMapper.queryOrderSplitRecordByMemberId(adapayMemberId, startTime, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SplitConfigOrderVO> queryStationAggregateData(SplitConfigStationDTO dto) {
|
||||
//获取该汇付id的所有分账信息
|
||||
List<SplitConfigStationVO> lists=orderSplitRecordMapper.queryStationAggregateData(dto);
|
||||
if(CollectionUtils.isEmpty(lists)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
//根据stationId分组
|
||||
Map<String, List<SplitConfigStationVO>> collect = lists.stream()
|
||||
.collect(Collectors.groupingBy(SplitConfigStationVO::getStationId));
|
||||
|
||||
//根据分组进行分账信息的汇总
|
||||
List<SplitConfigOrderVO> resultList = Lists.newArrayList();
|
||||
for (Map.Entry<String, List<SplitConfigStationVO>> entry : collect.entrySet()) {
|
||||
String stationId = entry.getKey();
|
||||
List<SplitConfigStationVO> splitConfigStationVOList = entry.getValue();
|
||||
|
||||
//计算时间范围
|
||||
List<SplitConfigStationVO> sortedList = splitConfigStationVOList.stream()
|
||||
.sorted(Comparator.comparing(SplitConfigStationVO::getTradeDate))
|
||||
.collect(Collectors.toList());
|
||||
String startTime = sortedList.get(0).getTradeDate();
|
||||
String endTime = sortedList.get(sortedList.size() - 1).getTradeDate();
|
||||
|
||||
String timeRange = startTime + "至" + endTime;
|
||||
|
||||
//总的电费分账金额totalElectricitySplitAmount
|
||||
BigDecimal totalElectricitySplitAmount =
|
||||
splitConfigStationVOList.stream()
|
||||
.map(SplitConfigStationVO::getElectricityAmount)
|
||||
.filter(Objects::nonNull) //过滤掉null
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
//总的服务费分账金额totalServiceSplitAmount
|
||||
BigDecimal totalServiceSplitAmount =
|
||||
splitConfigStationVOList.stream()
|
||||
.map(SplitConfigStationVO::getServiceAmount)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
//总手续费分账金额totalFeeAmount
|
||||
BigDecimal totalFeeAmount =
|
||||
splitConfigStationVOList.stream()
|
||||
.map(SplitConfigStationVO::getFeeAmount)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
//总收入分账金额= 总电费分账金额 +总手续费分账金额 -总手续费分账金额
|
||||
BigDecimal totalRevenueAmount = totalElectricitySplitAmount.add(totalServiceSplitAmount).subtract(totalFeeAmount);
|
||||
SplitConfigOrderVO splitConfigOrderVO =
|
||||
SplitConfigOrderVO.builder()
|
||||
.stationId(stationId)
|
||||
.stationName(splitConfigStationVOList.get(0).getStationName())
|
||||
.orderCount(splitConfigStationVOList.size())
|
||||
.timeRange(timeRange)
|
||||
.totalElectricitySplitAmount(totalElectricitySplitAmount)
|
||||
.totalServiceSplitAmount(totalServiceSplitAmount)
|
||||
.totalFeeAmount(totalFeeAmount)
|
||||
.totalRevenueAmount(totalRevenueAmount)
|
||||
.build();
|
||||
|
||||
resultList.add(splitConfigOrderVO);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据汇付会员id查询分账汇总数据
|
||||
* @param dto
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.jsowell.pile.vo.web;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class SplitConfigOrderVO {
|
||||
|
||||
/**
|
||||
* 站点ID
|
||||
*/
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 站点名称
|
||||
*/
|
||||
private String stationName;
|
||||
|
||||
/**
|
||||
* 时间范围
|
||||
*/
|
||||
private String timeRange;
|
||||
|
||||
/**
|
||||
* 订单数量
|
||||
*/
|
||||
private int orderCount;
|
||||
|
||||
/**
|
||||
* 总电费分账金额
|
||||
*/
|
||||
private BigDecimal totalElectricitySplitAmount;
|
||||
|
||||
/**
|
||||
* 总服务费分账金额
|
||||
*/
|
||||
private BigDecimal totalServiceSplitAmount;
|
||||
|
||||
/**
|
||||
* 总手续费分账金额
|
||||
*/
|
||||
private BigDecimal totalFeeAmount;
|
||||
|
||||
/**
|
||||
* 总收入分账金额= 总电费分账金额 +总手续费分账金额 -总手续费分账金额
|
||||
*/
|
||||
private BigDecimal totalRevenueAmount;
|
||||
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.jsowell.pile.vo.web;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class SplitConfigStationVO {
|
||||
|
||||
@@ -15,4 +17,12 @@ public class SplitConfigStationVO {
|
||||
*/
|
||||
private String stationName;
|
||||
|
||||
private String tradeDate;
|
||||
|
||||
private BigDecimal electricityAmount;
|
||||
|
||||
private BigDecimal serviceAmount;
|
||||
|
||||
private BigDecimal feeAmount;
|
||||
|
||||
}
|
||||
|
||||
@@ -858,4 +858,23 @@
|
||||
</if>
|
||||
group by t1.station_id
|
||||
</select>
|
||||
|
||||
<select id="queryStationAggregateData" resultType="com.jsowell.pile.vo.web.SplitConfigStationVO">
|
||||
SELECT
|
||||
t2.station_id AS stationId,
|
||||
t3.station_name AS stationName,
|
||||
t1.electricity_amount AS electricityAmount,
|
||||
t1.service_amount AS serviceAmount,
|
||||
t1.fee_amount AS feeAmount,
|
||||
t1.trade_date AS tradeDate
|
||||
FROM
|
||||
order_split_record t1
|
||||
JOIN order_basic_info t2 ON t1.order_code = t2.order_code
|
||||
JOIN pile_station_info t3 ON t1.station_id = t3.id
|
||||
WHERE
|
||||
t1.adapay_member_id = #{adapayMemberId}
|
||||
AND t1.del_flag = '0'
|
||||
AND t1.trade_date BETWEEN #{startTime,jdbcType=VARCHAR} AND #{endTime,jdbcType=VARCHAR};
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user