|
@@ -10,6 +10,12 @@ import java.util.Optional;
|
|
|
* @Api 移动端图片处理类
|
|
|
*/
|
|
|
public class PictureReplaceAll {
|
|
|
+
|
|
|
+ private static String OLD_IP_FIRST = "172.18.1.32:8081";
|
|
|
+ private static String OLD_IP_SECOND = "119.3.201.155:8081";
|
|
|
+// private static String OLD_IP_SECOND = "10.6.52.32:8081";
|
|
|
+ private static String NEW_IP = "218.27.3.115:9301";
|
|
|
+
|
|
|
/**
|
|
|
* @description
|
|
|
* @author LG
|
|
@@ -19,15 +25,12 @@ public class PictureReplaceAll {
|
|
|
* @time 2023/8/16 22:52
|
|
|
*/
|
|
|
public static void replaceAllPictureUrl(List<LinkedHashMap<String, Object>> list, String replaceKey) {
|
|
|
- String oldIp1 = "172.18.1.32:8081";
|
|
|
- String newIp1 = "218.27.3.115:9301";
|
|
|
- String oldIp2 = "10.6.52.32:8081";
|
|
|
- list.replaceAll(map -> replaceSchedulePictures(map, replaceKey, oldIp1, newIp1, oldIp2));
|
|
|
+ list.replaceAll(map -> replaceSchedulePictures(map, replaceKey));
|
|
|
}
|
|
|
|
|
|
- private static LinkedHashMap<String, Object> replaceSchedulePictures(LinkedHashMap<String, Object> map, String replaceKey, String oldIp1, String newIp1, String oldIp2) {
|
|
|
- String url = Optional.ofNullable(map.get(replaceKey)).map(Object::toString).map(s -> s.replaceAll(oldIp1, newIp1)).orElse("");
|
|
|
- url = url.replaceAll(oldIp2, newIp1);
|
|
|
+ private static LinkedHashMap<String, Object> replaceSchedulePictures(LinkedHashMap<String, Object> map, String replaceKey) {
|
|
|
+ String url = Optional.ofNullable(map.get(replaceKey)).map(Object::toString).map(s -> s.replaceAll(OLD_IP_FIRST, NEW_IP).replaceAll(OLD_IP_SECOND, NEW_IP)).orElse("");
|
|
|
+// url = url.replaceAll(oldIp2, newIp1);
|
|
|
map.put(replaceKey, url);
|
|
|
return map;
|
|
|
}
|