1
zj
2025-09-23 92b9a9452201e3ed77dcebdce918a2597cccb730
1
2 files modified
50 ■■■■ changed files
src/main/java/com/nq/controller/protol/UserWithdrawController.java 6 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java 44 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/controller/protol/UserWithdrawController.java
@@ -61,9 +61,9 @@
        requestTimestamps.put(requestId, System.currentTimeMillis());
        try {
            if (!isIntegerGreaterThan100(amt)) {
                return ServerResponse.createByErrorMsg("请输入整数!",request);
            }
//            if (!isIntegerGreaterThan100(amt)) {
//                return ServerResponse.createByErrorMsg("请输入整数!",request);
//            }
            synchronized (user.getId()){
                serverResponse = this.iUserWithdrawService.outMoney(amt, user.getWithPwd(), accsetType,bankId,request);
            }
src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
@@ -6,6 +6,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.nq.dao.*;
import com.nq.enums.EConfigKey;
import com.nq.enums.EUserAssets;
import com.nq.pojo.*;
import com.nq.service.*;
@@ -24,6 +25,7 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@@ -129,9 +131,9 @@
                return ServerResponse.createByErrorMsg("模拟用户无法提取资金",request);
            }
            SiteSetting siteSetting = this.iSiteSettingService.getSiteSetting();
            if ((new BigDecimal(amt)).compareTo(new BigDecimal(siteSetting.getWithMinAmt().intValue())) == -1) {
                return ServerResponse.createByErrorMsg("最小提现金额:" + siteSetting.getWithMinAmt(),request);
            }
//            if ((new BigDecimal(amt)).compareTo(new BigDecimal(siteSetting.getWithMinAmt().intValue())) == -1) {
//                return ServerResponse.createByErrorMsg("最小提现金额:" + siteSetting.getWithMinAmt(),request);
//            }
            boolean b = getServerResponse();
            if (!b) {
@@ -172,14 +174,36 @@
    }
    private boolean getServerResponse() {
        StockTimeSetting stockTimeSetting = stockTimeSettingMapper.selectOne(new QueryWrapper<StockTimeSetting>().eq("accets_type", "US"));
        if (stockTimeSetting == null) {
            return false;
        StockConfig stockConfig = iStockConfigServices.queryByKey(EConfigKey.WITHDRAW_TIME_SETTING.getCode());
        return isInTimeRange(stockConfig.getCValue());
    }
    /**
     * 判断当前时间是否在指定的时间区间内
     * @param timeRange 时间区间字符串,格式如:"9:00-18:00"
     * @return 如果在区间内返回true,否则返回false
     */
    public static boolean isInTimeRange(String timeRange) {
        try {
            // 分割开始时间和结束时间
            String[] times = timeRange.split("-");
            if (times.length != 2) {
                throw new IllegalArgumentException("时间格式不正确,应为:HH:mm-HH:mm");
            }
            // 解析时间
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("H:mm");
            LocalTime startTime = LocalTime.parse(times[0].trim(), formatter);
            LocalTime endTime = LocalTime.parse(times[1].trim(), formatter);
            LocalTime currentTime = LocalTime.now();
            // 判断是否在时间区间内
            return !currentTime.isBefore(startTime) && !currentTime.isAfter(endTime);
        } catch (Exception e) {
            throw new IllegalArgumentException("时间解析错误,请检查格式是否正确", e);
        }
        if (!stockTimeSetting.getWeekDay().contains(String.valueOf(LocalDate.now().getDayOfWeek().getValue()))) {
            return false;
        }
        return TimeUtil.isTradingHour(stockTimeSetting.getAmStartTime(), stockTimeSetting.getAmEndTime(), stockTimeSetting.getPmStartTime(), stockTimeSetting.getPmEndTime());
    }
    public ServerResponse<PageInfo> findUserWithList(String withStatus, HttpServletRequest request, int pageNum, int pageSize) {