| | |
| | | |
| | | import com.lf.server.config.PropertiesConfig; |
| | | import com.lf.server.entity.all.SettingData; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.http.client.entity.UrlEncodedFormEntity; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | | import java.net.URL; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | private static int downloadPath = 1; |
| | | |
| | | private static int uploadPath = 1; |
| | | |
| | | private final static double D80 = 80; |
| | | |
| | | private final static Log log = LogFactory.getLog(PathHelper.class); |
| | | |
| | |
| | | public void deleteOldPath(String tempPath) { |
| | | try { |
| | | double ran = Math.random() * 99; |
| | | if (ran < D80) { |
| | | if (ran < StaticData.D90) { |
| | | return; |
| | | } |
| | | |
| | |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取static目录 |
| | | */ |
| | | public static String getStaticPath() { |
| | | ClassLoader classLoader = PathHelper.class.getClassLoader(); |
| | | URL url = classLoader.getResource(""); |
| | | String path = url.getPath(); |
| | | |
| | | return path.substring(0, path.indexOf("/target/classes")) + "/src/main/resources/static/"; |
| | | } |
| | | } |