AppStopUtil.java 813 Bytes
package com.xiniunet.service.railway.util;

import com.xiniunet.common.utils.properties.PropertyGetter;
import com.xiniunet.framework.base.BaseResponse;
import com.xiniunet.framework.exception.ErrorType;

import java.text.SimpleDateFormat;
import java.util.Date;

public class AppStopUtil {

    public static boolean stopApp(BaseResponse response) {
        String stopDate = PropertyGetter.getFromDb("app.shmetro.service.stop.date", "2025-06-28 00:00:00");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String currentDate = sdf.format(new Date());
        if (currentDate.compareTo(stopDate) >= 0) {
            response.addError(ErrorType.OTHER, "此版本功能已配置关停,请立即更新APP");
        }
        return currentDate.compareTo(stopDate) >= 0;
    }

}