From 7c733388b5e071fedd9b6b2ab4b000f0a5416784 Mon Sep 17 00:00:00 2001 From: Administrator <1101184511@qq.com> Date: 星期一, 17 二月 2025 01:22:17 +0800 Subject: [PATCH] 口令提交过渡页 --- src/main/java/com/taoke/autopay/manager/PayCountVerifyManager.java | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/taoke/autopay/manager/PayCountVerifyManager.java b/src/main/java/com/taoke/autopay/manager/PayCountVerifyManager.java index f8c5515..7a19459 100644 --- a/src/main/java/com/taoke/autopay/manager/PayCountVerifyManager.java +++ b/src/main/java/com/taoke/autopay/manager/PayCountVerifyManager.java @@ -10,6 +10,10 @@ import org.springframework.stereotype.Component; import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 鏀粯娆℃暟绠$悊鍣� @@ -24,18 +28,19 @@ private UserSettingService userSettingService; /** - * 楠岃瘉鏀粯娆℃暟 + * 楠岃瘉鏀粯娆℃暟 + * * @param uid * @param orderType * @param orderChannel * @throws Exception */ public void verifyPayCount(long uid, int orderType, OrderChannelEnum orderChannel) throws KeyOrderException { - OrderCountTypeEnum orderCountType=null; - if(orderType== Constant.ORDER_TYPE_DY){ - orderCountType=OrderCountTypeEnum.DY_ORDER_PAY; - }else if(orderType==Constant.ORDER_TYPE_KS){ - orderCountType=OrderCountTypeEnum.KS_ORDER_PAY; + OrderCountTypeEnum orderCountType = null; + if (orderType == Constant.ORDER_TYPE_DY) { + orderCountType = OrderCountTypeEnum.DY_ORDER_PAY; + } else if (orderType == Constant.ORDER_TYPE_KS) { + orderCountType = OrderCountTypeEnum.KS_ORDER_PAY; } long todayCount = wxUserOrderCountService.sum(uid, orderCountType, orderChannel, TimeUtil.getGernalTime(System.currentTimeMillis(), Constant.DB_DAY_FORMAT)); long totalCount = wxUserOrderCountService.sum(uid, orderCountType, null, null); @@ -45,5 +50,34 @@ } } + /** + * 璁$畻鐢ㄦ埛鍓╀綑鏀粯娆℃暟 + * + * @param uid + */ + public Map<Integer,Long> computeUserLeftPayCount(Long uid) { + Map<Integer,Long> map=new HashMap<>(); + OrderCountTypeEnum[] orderTypes = {OrderCountTypeEnum.DY_ORDER_PAY, OrderCountTypeEnum.KS_ORDER_PAY}; + OrderChannelEnum[] orderChannels = {OrderChannelEnum.cyx, OrderChannelEnum.bps, OrderChannelEnum.own}; + for (OrderCountTypeEnum type : orderTypes) { + List<Long> countList=new ArrayList<>(); + for (OrderChannelEnum orderChannel : orderChannels) { + long todayCount = wxUserOrderCountService.sum(uid, type, orderChannel, TimeUtil.getGernalTime(System.currentTimeMillis(), Constant.DB_DAY_FORMAT)); + long totalCount = wxUserOrderCountService.sum(uid, type, null, null); + int maxPayCount = userSettingService.getLimitCountByTotalCount(type.getType(), totalCount, orderChannel); + long leftCount = maxPayCount - todayCount; + countList.add(leftCount); + } + long maxCount=0; + for (Long count : countList) { + if(count>maxCount){ + maxCount=count; + } + } + map.put(type.getType(),Math.min( maxCount, 50)); + } + return map; + } + } -- Gitblit v1.8.0