|
@@ -1,6 +1,8 @@
|
|
package ieven.server.webapp.service.datastatic;
|
|
package ieven.server.webapp.service.datastatic;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
+import com.mongodb.client.MongoCursor;
|
|
|
|
+import ieven.server.webapp.domain.alipay.AlipayHeaders;
|
|
import ieven.server.webapp.domain.data.DataMap;
|
|
import ieven.server.webapp.domain.data.DataMap;
|
|
import ieven.server.webapp.domain.data.StaticInput;
|
|
import ieven.server.webapp.domain.data.StaticInput;
|
|
import ieven.server.webapp.domain.data.StaticModelInput;
|
|
import ieven.server.webapp.domain.data.StaticModelInput;
|
|
@@ -12,6 +14,7 @@ import ieven.server.webapp.util.excel.PublicStatic;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.bson.Document;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
@@ -217,16 +220,51 @@ public class DataStaticService extends Ops {
|
|
List<Map<String, Object>> partyDataList = new ArrayList<>();
|
|
List<Map<String, Object>> partyDataList = new ArrayList<>();
|
|
List<Map<String, Object>> relationshipGraphList = new ArrayList<>();
|
|
List<Map<String, Object>> relationshipGraphList = new ArrayList<>();
|
|
List<Map<String, Object>> relationshipGraphListnew = new ArrayList<>();
|
|
List<Map<String, Object>> relationshipGraphListnew = new ArrayList<>();
|
|
- List<DataMap> dataMapDetail = this.mongoTemplate.find(query, DataMap.class);
|
|
|
|
|
|
+
|
|
|
|
+ //List<DataMap> dataMapDetail = this.mongoTemplate.find(query, DataMap.class);
|
|
|
|
+
|
|
|
|
+ MongoCursor<Document> cursor =
|
|
|
|
+ mongoTemplate
|
|
|
|
+ .getCollection("data")
|
|
|
|
+ .find(query.getQueryObject())
|
|
|
|
+ .batchSize(1000)
|
|
|
|
+ .noCursorTimeout(true)
|
|
|
|
+ .cursor();
|
|
|
|
|
|
long d = System.currentTimeMillis();
|
|
long d = System.currentTimeMillis();
|
|
log.error("查询所有数据所需时间" + (d - c));
|
|
log.error("查询所有数据所需时间" + (d - c));
|
|
//先去判断从是否有大于2的数据
|
|
//先去判断从是否有大于2的数据
|
|
-
|
|
|
|
|
|
+ Document originDoc;
|
|
Map<String, List<DataMap>> dsMap = new HashMap<>();
|
|
Map<String, List<DataMap>> dsMap = new HashMap<>();
|
|
-
|
|
|
|
Map<String, Set<String>> zh = new HashMap<>();
|
|
Map<String, Set<String>> zh = new HashMap<>();
|
|
- for (DataMap map : dataMapDetail) {
|
|
|
|
|
|
+ while (cursor.hasNext()) {
|
|
|
|
+ // 写法1(建议)
|
|
|
|
+ try {
|
|
|
|
+ originDoc = cursor.next();
|
|
|
|
+ DataMap map = initWithOrigin(originDoc, dateFileId);
|
|
|
|
+ String jydszh = String.valueOf(map.get("交易对手账号"));
|
|
|
|
+ String jyzthm = String.valueOf(map.get("交易主体户名"));
|
|
|
|
+ if (PublicStatic.checkStr(jydszh) || PublicStatic.checkStr(jyzthm)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Set<String> strings = zh.get(jydszh);
|
|
|
|
+ if (CollectionUtils.isEmpty(strings)) {
|
|
|
|
+ strings = new HashSet<>();
|
|
|
|
+ strings.add(jyzthm);
|
|
|
|
+ } else {
|
|
|
|
+ strings.add(jyzthm);
|
|
|
|
+ }
|
|
|
|
+ zh.put(jydszh, strings);
|
|
|
|
+
|
|
|
|
+ List<DataMap> dataMaps1 = Optional.ofNullable(dsMap.get(jydszh)).orElse(new ArrayList<DataMap>());
|
|
|
|
+ dataMaps1.add(map);
|
|
|
|
+ dsMap.put(jydszh, dataMaps1);
|
|
|
|
+ } catch (Exception exception) {
|
|
|
|
+ log.error(exception.getMessage(), exception);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* for (DataMap map : dataMapDetail) {
|
|
String jydszh = String.valueOf(map.get("交易对手账号"));
|
|
String jydszh = String.valueOf(map.get("交易对手账号"));
|
|
String jyzthm = String.valueOf(map.get("交易主体户名"));
|
|
String jyzthm = String.valueOf(map.get("交易主体户名"));
|
|
if (PublicStatic.checkStr(jydszh) || PublicStatic.checkStr(jyzthm)) {
|
|
if (PublicStatic.checkStr(jydszh) || PublicStatic.checkStr(jyzthm)) {
|
|
@@ -244,7 +282,7 @@ public class DataStaticService extends Ops {
|
|
List<DataMap> dataMaps1 = Optional.ofNullable(dsMap.get(jydszh)).orElse(new ArrayList<DataMap>());
|
|
List<DataMap> dataMaps1 = Optional.ofNullable(dsMap.get(jydszh)).orElse(new ArrayList<DataMap>());
|
|
dataMaps1.add(map);
|
|
dataMaps1.add(map);
|
|
dsMap.put(jydszh, dataMaps1);
|
|
dsMap.put(jydszh, dataMaps1);
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
if (dsMap == null) {
|
|
if (dsMap == null) {
|
|
return Mapped.ERROR("数据有误,请重新查询");
|
|
return Mapped.ERROR("数据有误,请重新查询");
|
|
}
|
|
}
|