Kaynağa Gözat

:bug: 疏浚无数据不删除

lag 10 ay önce
ebeveyn
işleme
9c086cf6d8

+ 4 - 0
src/main/java/com/shcd/service/dredging/impl/DredgingServiceImpl.java

@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 import sun.net.www.http.HttpClient;
 
 import javax.net.ssl.HostnameVerifier;
@@ -77,6 +78,9 @@ public class DredgingServiceImpl implements DredgingService {
                 HttpResponse dredgingProject = HttpUtil.createPost(dredgingProjectUrl).body(projectIdJSON).setFollowRedirects(true).timeout(30000).execute();
                 if (StringUtils.isNotBlank(dredgingProject.body())) {
                     HashMap projectInfos = JSONObject.parseObject(dredgingProject.body(), HashMap.class);
+                    if (CollectionUtils.isEmpty(projectInfos)) {
+                        return "无数据,不进行删除操作!";
+                    }
                     SnowflakeGenerator snowflakeGenerator = new SnowflakeGenerator();
                     //主表内容解析存储
                     DredgingProjectOverview projectOver = new DredgingProjectOverview();