|
@@ -12,7 +12,6 @@ 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.checkerframework.checker.units.qual.C;
|
|
|
|
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;
|
|
@@ -22,7 +21,6 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
-import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@Service
|
|
@Service
|
|
@@ -97,6 +95,8 @@ public class DataStaticService extends Ops {
|
|
}
|
|
}
|
|
|
|
|
|
public Mapped staticModel(StaticModelInput staticModelInput) {
|
|
public Mapped staticModel(StaticModelInput staticModelInput) {
|
|
|
|
+ long startTime = System.currentTimeMillis();
|
|
|
|
+ log.error("开始执行");
|
|
String modelId = staticModelInput.getModelId();
|
|
String modelId = staticModelInput.getModelId();
|
|
String dateFileId = getFileId("数据分析-主体信息汇总明细", modelId, mongoTemplate);
|
|
String dateFileId = getFileId("数据分析-主体信息汇总明细", modelId, mongoTemplate);
|
|
String dateFileIdUser = getFileId("数据分析-所有主体信息汇总", modelId, mongoTemplate);
|
|
String dateFileIdUser = getFileId("数据分析-所有主体信息汇总", modelId, mongoTemplate);
|
|
@@ -105,7 +105,8 @@ public class DataStaticService extends Ops {
|
|
if (StringUtils.isBlank(dateFileId)) {
|
|
if (StringUtils.isBlank(dateFileId)) {
|
|
return Mapped.ERROR("数据分析-主体信息汇总明细不存在");
|
|
return Mapped.ERROR("数据分析-主体信息汇总明细不存在");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ long a = System.currentTimeMillis();
|
|
|
|
+ log.error("查询所需的数据" + (a - startTime));
|
|
if (StringUtils.isBlank(dateFileIdUser)) {
|
|
if (StringUtils.isBlank(dateFileIdUser)) {
|
|
return Mapped.ERROR("数据分析-所有主体信息汇总");
|
|
return Mapped.ERROR("数据分析-所有主体信息汇总");
|
|
}
|
|
}
|
|
@@ -116,7 +117,7 @@ public class DataStaticService extends Ops {
|
|
.is(dateFileIdUserTotal))), DataMap.class);
|
|
.is(dateFileIdUserTotal))), DataMap.class);
|
|
if (CollectionUtils.isNotEmpty(dataMapsZt)) {
|
|
if (CollectionUtils.isNotEmpty(dataMapsZt)) {
|
|
for (DataMap dataMap : dataMapsZt) {
|
|
for (DataMap dataMap : dataMapsZt) {
|
|
- String jyzthm = StringUtils.isBlank(String.valueOf(dataMap.get("交易主体户名")))?String.valueOf(dataMap.get("交易主体账号")):String.valueOf(dataMap.get("交易主体户名"));
|
|
|
|
|
|
+ String jyzthm = StringUtils.isBlank(String.valueOf(dataMap.get("交易主体户名"))) ? String.valueOf(dataMap.get("交易主体账号")) : String.valueOf(dataMap.get("交易主体户名"));
|
|
if (!PublicStatic.checkStr(jyzthm)) {
|
|
if (!PublicStatic.checkStr(jyzthm)) {
|
|
String[] split = jyzthm.split(";");
|
|
String[] split = jyzthm.split(";");
|
|
for (int i = 0; i < split.length; i++) {
|
|
for (int i = 0; i < split.length; i++) {
|
|
@@ -136,6 +137,8 @@ public class DataStaticService extends Ops {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ long b = System.currentTimeMillis();
|
|
|
|
+ log.error("循环交易主体账号所需时间" + (b - a));
|
|
//查询所有的主体信息汇总
|
|
//查询所有的主体信息汇总
|
|
List<DataMap> dataMaps = this.mongoTemplate.find((new Query(
|
|
List<DataMap> dataMaps = this.mongoTemplate.find((new Query(
|
|
Criteria.where("fileId")
|
|
Criteria.where("fileId")
|
|
@@ -151,7 +154,8 @@ public class DataStaticService extends Ops {
|
|
personMap.put(zh, dataMaps1);
|
|
personMap.put(zh, dataMaps1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ long c = System.currentTimeMillis();
|
|
|
|
+ log.error("循环交易对手账号所需时间" + (c - b));
|
|
//分两种情况,1:主体是否有数据如果有就按交易主体的计算
|
|
//分两种情况,1:主体是否有数据如果有就按交易主体的计算
|
|
|
|
|
|
Query query = new Query();
|
|
Query query = new Query();
|
|
@@ -203,225 +207,240 @@ public class DataStaticService extends Ops {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(strings1)) {
|
|
|
|
- query.addCriteria(Criteria.where("交易对手账号").in(Objects.requireNonNull(strings1)));
|
|
|
|
- } else {
|
|
|
|
- return Mapped.ERROR("当前无数据");
|
|
|
|
- }
|
|
|
|
- Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(strings1)) {
|
|
|
|
+ query.addCriteria(Criteria.where("交易对手账号").in(Objects.requireNonNull(strings1)));
|
|
|
|
+ } else {
|
|
|
|
+ return Mapped.ERROR("当前无数据");
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
|
|
- List<Map<String, Object>> partyDataList = new ArrayList<>();
|
|
|
|
- List<Map<String, Object>> relationshipGraphList = new ArrayList<>();
|
|
|
|
- List<Map<String, Object>> relationshipGraphListnew = new ArrayList<>();
|
|
|
|
- List<DataMap> dataMapDetail = this.mongoTemplate.find(query, DataMap.class);
|
|
|
|
- //先去判断从是否有大于2的数据
|
|
|
|
|
|
+ List<Map<String, Object>> partyDataList = new ArrayList<>();
|
|
|
|
+ List<Map<String, Object>> relationshipGraphList = new ArrayList<>();
|
|
|
|
+ List<Map<String, Object>> relationshipGraphListnew = new ArrayList<>();
|
|
|
|
+ List<DataMap> dataMapDetail = this.mongoTemplate.find(query, DataMap.class);
|
|
|
|
|
|
- Map<String, List<DataMap>> dsMap = new HashMap<>();
|
|
|
|
|
|
+ long d = System.currentTimeMillis();
|
|
|
|
+ log.error("查询所有数据所需时间" + (d - c));
|
|
|
|
+ //先去判断从是否有大于2的数据
|
|
|
|
|
|
- Map<String, Set<String>> zh = new HashMap<>();
|
|
|
|
- for (DataMap map : dataMapDetail) {
|
|
|
|
- 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);
|
|
|
|
|
|
+ Map<String, List<DataMap>> dsMap = new HashMap<>();
|
|
|
|
|
|
- List<DataMap> dataMaps1 = Optional.ofNullable(dsMap.get(jydszh)).orElse(new ArrayList<DataMap>());
|
|
|
|
- dataMaps1.add(map);
|
|
|
|
- dsMap.put(jydszh, dataMaps1);
|
|
|
|
|
|
+ Map<String, Set<String>> zh = new HashMap<>();
|
|
|
|
+ for (DataMap map : dataMapDetail) {
|
|
|
|
+ String jydszh = String.valueOf(map.get("交易对手账号"));
|
|
|
|
+ String jyzthm = String.valueOf(map.get("交易主体户名"));
|
|
|
|
+ if (PublicStatic.checkStr(jydszh) || PublicStatic.checkStr(jyzthm)) {
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
- if (dsMap == null) {
|
|
|
|
- return Mapped.ERROR("数据有误,请重新查询");
|
|
|
|
|
|
+ Set<String> strings = zh.get(jydszh);
|
|
|
|
+ if (CollectionUtils.isEmpty(strings)) {
|
|
|
|
+ strings = new HashSet<>();
|
|
|
|
+ strings.add(jyzthm);
|
|
|
|
+ } else {
|
|
|
|
+ strings.add(jyzthm);
|
|
}
|
|
}
|
|
- List<DataMap> newList = Lists.newArrayList();
|
|
|
|
- for (Map.Entry<String, Set<String>> entry : zh.entrySet()) {
|
|
|
|
- if (entry.getValue().size() >= staticModelInput.getStartNum() && entry.getValue().size() <= staticModelInput.getEndNum()) {
|
|
|
|
- List<DataMap> dataMaps1 = dsMap.get(entry.getKey());
|
|
|
|
- newList.addAll(dataMaps1);
|
|
|
|
- }
|
|
|
|
|
|
+ zh.put(jydszh, strings);
|
|
|
|
+
|
|
|
|
+ List<DataMap> dataMaps1 = Optional.ofNullable(dsMap.get(jydszh)).orElse(new ArrayList<DataMap>());
|
|
|
|
+ dataMaps1.add(map);
|
|
|
|
+ dsMap.put(jydszh, dataMaps1);
|
|
|
|
+ }
|
|
|
|
+ if (dsMap == null) {
|
|
|
|
+ return Mapped.ERROR("数据有误,请重新查询");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ long e = System.currentTimeMillis();
|
|
|
|
+ log.error("获取所有对手的交易主体账号所需时间" + (e-d));
|
|
|
|
+ List<DataMap> newList = Lists.newArrayList();
|
|
|
|
+ for (Map.Entry<String, Set<String>> entry : zh.entrySet()) {
|
|
|
|
+ if (entry.getValue().size() >= staticModelInput.getStartNum() && entry.getValue().size() <= staticModelInput.getEndNum()) {
|
|
|
|
+ List<DataMap> dataMaps1 = dsMap.get(entry.getKey());
|
|
|
|
+ newList.addAll(dataMaps1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ long f = System.currentTimeMillis();
|
|
|
|
+ log.error("获取大于2的数据所需时间" + (f-e));
|
|
|
|
+ List<String> userList = new ArrayList<>();
|
|
|
|
+ List<String> usermcList = new ArrayList<>();
|
|
|
|
+ List<String> userAllList = new ArrayList<>();
|
|
|
|
+ Map<String, Integer> countMap = new HashMap<>();
|
|
|
|
+ for (DataMap map : newList) {
|
|
|
|
+ String jythm = String.valueOf(map.get("交易主体户名"));
|
|
|
|
+ String jythm1 = String.valueOf(map.get("交易对手户名"));
|
|
|
|
+ if(jythm1.equals("中国银行")){
|
|
|
|
+ System.out.println("5555");
|
|
|
|
+ }
|
|
|
|
+ String jydszh = String.valueOf(map.get("交易对手账号"));
|
|
|
|
+ if (StringUtils.isBlank(jythm) || "null".equals(jythm)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String jdlx = String.valueOf(map.get("借贷类型"));
|
|
|
|
+ if (!jdlx.equals("借") && !jdlx.equals("贷")) {
|
|
|
|
+ log.error("借贷类型有误");
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
|
|
|
|
- List<String> userList = new ArrayList<>();
|
|
|
|
- List<String> usermcList = new ArrayList<>();
|
|
|
|
- List<String> userAllList = new ArrayList<>();
|
|
|
|
- Map<String,Integer>countMap=new HashMap<>();
|
|
|
|
- for (DataMap map : newList) {
|
|
|
|
- String jythm = String.valueOf(map.get("交易主体户名"));
|
|
|
|
- String jydszh = String.valueOf(map.get("交易对手账号"));
|
|
|
|
- if (StringUtils.isBlank(jythm) || "null".equals(jythm)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- String jdlx = String.valueOf(map.get("借贷类型"));
|
|
|
|
- if (!jdlx.equals("借") && !jdlx.equals("贷")) {
|
|
|
|
- log.error("借贷类型有误");
|
|
|
|
- continue;
|
|
|
|
|
|
+ //获取节点名称
|
|
|
|
+ List<DataMap> dataMapsparty1 = personzhmcMap.get(jythm);
|
|
|
|
+ List<DataMap> dataMapsparty2 = personMap.get(jydszh);
|
|
|
|
+ if (CollectionUtils.isEmpty(dataMapsparty1) || CollectionUtils.isEmpty(dataMapsparty2)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (!usermcList.contains(jythm)) {
|
|
|
|
+ Map<String, Object> userMap = new HashMap<>();
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dataMapsparty1)) {
|
|
|
|
+ userMap.put("id", String.valueOf(dataMapsparty1.get(0).get("_id")));
|
|
|
|
+ userMap.put("name", dataMapsparty1.get(0).get("交易主体户名"));
|
|
|
|
+ userMap.put("relationPersons", dataMapsparty1);
|
|
|
|
+ userMap.put("type", "主");
|
|
|
|
+ partyDataList.add(userMap);
|
|
|
|
+ usermcList.add(jythm);
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
- //获取节点名称
|
|
|
|
- List<DataMap> dataMapsparty1 = personzhmcMap.get(jythm);
|
|
|
|
- List<DataMap> dataMapsparty2 = personMap.get(jydszh);
|
|
|
|
- if (CollectionUtils.isEmpty(dataMapsparty1) || CollectionUtils.isEmpty(dataMapsparty2)) {
|
|
|
|
- continue;
|
|
|
|
|
|
+ if (!userList.contains(jydszh)) {
|
|
|
|
+ Map<String, Object> userMap = new HashMap<>();
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dataMapsparty2)) {
|
|
|
|
+ String cid = String.valueOf(dataMapsparty2.get(0).get("_id"));
|
|
|
|
+ userMap.put("id", cid);
|
|
|
|
+ userMap.put("name", dataMapsparty2.get(0).get("账号"));
|
|
|
|
+ userMap.put("relationPersons", dataMapsparty2);
|
|
|
|
+ userMap.put("type", "从");
|
|
|
|
+ partyDataList.add(userMap);
|
|
|
|
+ userList.add(jydszh);
|
|
}
|
|
}
|
|
- if (!usermcList.contains(jythm)) {
|
|
|
|
- Map<String, Object> userMap = new HashMap<>();
|
|
|
|
- if (CollectionUtils.isNotEmpty(dataMapsparty1)) {
|
|
|
|
- userMap.put("id", String.valueOf(dataMapsparty1.get(0).get("_id")));
|
|
|
|
- userMap.put("name", dataMapsparty1.get(0).get("交易主体户名"));
|
|
|
|
- userMap.put("relationPersons", dataMapsparty1);
|
|
|
|
- userMap.put("type", "主");
|
|
|
|
- partyDataList.add(userMap);
|
|
|
|
- usermcList.add(jythm);
|
|
|
|
|
|
+ }
|
|
|
|
+ //增加线上数据
|
|
|
|
+ Map<String, Object> total = new HashMap<>();
|
|
|
|
+ Map<String, Object> party1 = new HashMap<>();
|
|
|
|
+ Map<String, Object> party2 = new HashMap<>();
|
|
|
|
+ Map<String, Object> relationData = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ String userAllId = "";
|
|
|
|
+ if (jdlx.equals("借")) {
|
|
|
|
+ List<DataMap> dataMaps1 = personzhmcMap.get(jythm);
|
|
|
|
+ List<DataMap> dataMaps2 = personMap.get(jydszh);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dataMaps1) && CollectionUtils.isNotEmpty(dataMaps2)) {
|
|
|
|
+ String one = String.valueOf(dataMaps1.get(0).get("_id"));
|
|
|
|
+ party1.put("id", one);
|
|
|
|
+ party1.put("name", dataMaps1.get(0).get("交易主体户名"));
|
|
|
|
+
|
|
|
|
+ String two = String.valueOf(dataMaps2.get(0).get("_id"));
|
|
|
|
+ party2.put("id", two);
|
|
|
|
+ party2.put("name", dataMaps2.get(0).get("账号"));
|
|
|
|
+ Integer integer = countMap.get(one);
|
|
|
|
+ if (integer == null) {
|
|
|
|
+ countMap.put(one, 1);
|
|
|
|
+ } else {
|
|
|
|
+ countMap.put(one, ++integer);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- if (!userList.contains(jydszh)) {
|
|
|
|
- Map<String, Object> userMap = new HashMap<>();
|
|
|
|
- if (CollectionUtils.isNotEmpty(dataMapsparty2)) {
|
|
|
|
- String cid = String.valueOf(dataMapsparty2.get(0).get("_id"));
|
|
|
|
- userMap.put("id", cid);
|
|
|
|
- userMap.put("name", dataMapsparty2.get(0).get("账号"));
|
|
|
|
- userMap.put("relationPersons", dataMapsparty2);
|
|
|
|
- userMap.put("type", "从");
|
|
|
|
- partyDataList.add(userMap);
|
|
|
|
- userList.add(jydszh);
|
|
|
|
|
|
+ Integer integer1 = countMap.get(two);
|
|
|
|
+ if (integer1 == null) {
|
|
|
|
+ countMap.put(two, 1);
|
|
|
|
+ } else {
|
|
|
|
+ countMap.put(two, ++integer1);
|
|
}
|
|
}
|
|
|
|
+ userAllId = one + "-" + two;
|
|
}
|
|
}
|
|
- //增加线上数据
|
|
|
|
- Map<String, Object> total = new HashMap<>();
|
|
|
|
- Map<String, Object> party1 = new HashMap<>();
|
|
|
|
- Map<String, Object> party2 = new HashMap<>();
|
|
|
|
- Map<String, Object> relationData = new HashMap<>();
|
|
|
|
-
|
|
|
|
- String userAllId = "";
|
|
|
|
- if (jdlx.equals("借")) {
|
|
|
|
- List<DataMap> dataMaps1 = personzhmcMap.get(jythm);
|
|
|
|
- List<DataMap> dataMaps2 = personMap.get(jydszh);
|
|
|
|
- if (CollectionUtils.isNotEmpty(dataMaps1) && CollectionUtils.isNotEmpty(dataMaps2)) {
|
|
|
|
- String one = String.valueOf(dataMaps1.get(0).get("_id"));
|
|
|
|
- party1.put("id", one);
|
|
|
|
- party1.put("name", dataMaps1.get(0).get("交易主体户名"));
|
|
|
|
-
|
|
|
|
- String two = String.valueOf(dataMaps2.get(0).get("_id"));
|
|
|
|
- party2.put("id", two);
|
|
|
|
- party2.put("name", dataMaps2.get(0).get("账号"));
|
|
|
|
- Integer integer = countMap.get(one);
|
|
|
|
- if(integer==null){
|
|
|
|
- countMap.put(one,1);
|
|
|
|
- }else {
|
|
|
|
- countMap.put(one,++integer);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- Integer integer1 = countMap.get(two);
|
|
|
|
- if(integer1==null){
|
|
|
|
- countMap.put(two,1);
|
|
|
|
- }else {
|
|
|
|
- countMap.put(two,++integer1);
|
|
|
|
- }
|
|
|
|
- userAllId = one + "-" + two;
|
|
|
|
|
|
+ } else if (jdlx.equals("贷")) {
|
|
|
|
+ List<DataMap> dataMaps1 = personzhmcMap.get(jythm);
|
|
|
|
+ List<DataMap> dataMaps2 = personMap.get(jydszh);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dataMaps1) && CollectionUtils.isNotEmpty(dataMaps2)) {
|
|
|
|
+ String two = String.valueOf(dataMaps1.get(0).get("_id"));
|
|
|
|
+ party2.put("id", String.valueOf(dataMaps1.get(0).get("_id")));
|
|
|
|
+ party2.put("name", dataMaps1.get(0).get("交易主体户名"));
|
|
|
|
+
|
|
|
|
+ String one = String.valueOf(dataMaps2.get(0).get("_id"));
|
|
|
|
+ party1.put("id", String.valueOf(dataMaps2.get(0).get("_id")));
|
|
|
|
+ party1.put("name", dataMaps2.get(0).get("账号"));
|
|
|
|
+
|
|
|
|
+ Integer integer = countMap.get(one);
|
|
|
|
+ if (integer == null) {
|
|
|
|
+ countMap.put(one, 1);
|
|
|
|
+ } else {
|
|
|
|
+ countMap.put(one, ++integer);
|
|
}
|
|
}
|
|
|
|
|
|
- } else if (jdlx.equals("贷")) {
|
|
|
|
- List<DataMap> dataMaps1 = personzhmcMap.get(jythm);
|
|
|
|
- List<DataMap> dataMaps2 = personMap.get(jydszh);
|
|
|
|
- if (CollectionUtils.isNotEmpty(dataMaps1) && CollectionUtils.isNotEmpty(dataMaps2)) {
|
|
|
|
- String two = String.valueOf(dataMaps1.get(0).get("_id"));
|
|
|
|
- party2.put("id", String.valueOf(dataMaps1.get(0).get("_id")));
|
|
|
|
- party2.put("name", dataMaps1.get(0).get("交易主体户名"));
|
|
|
|
-
|
|
|
|
- String one = String.valueOf(dataMaps2.get(0).get("_id"));
|
|
|
|
- party1.put("id", String.valueOf(dataMaps2.get(0).get("_id")));
|
|
|
|
- party1.put("name", dataMaps2.get(0).get("账号"));
|
|
|
|
-
|
|
|
|
- Integer integer = countMap.get(one);
|
|
|
|
- if(integer==null){
|
|
|
|
- countMap.put(one,1);
|
|
|
|
- }else {
|
|
|
|
- countMap.put(one,++integer);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Integer integer1 = countMap.get(two);
|
|
|
|
- if(integer1==null){
|
|
|
|
- countMap.put(two,1);
|
|
|
|
- }else {
|
|
|
|
- countMap.put(two,++integer1);
|
|
|
|
- }
|
|
|
|
- userAllId = one + "-" + two;
|
|
|
|
|
|
+ Integer integer1 = countMap.get(two);
|
|
|
|
+ if (integer1 == null) {
|
|
|
|
+ countMap.put(two, 1);
|
|
|
|
+ } else {
|
|
|
|
+ countMap.put(two, ++integer1);
|
|
}
|
|
}
|
|
|
|
+ userAllId = one + "-" + two;
|
|
}
|
|
}
|
|
- if (!userAllList.contains(userAllId)) {
|
|
|
|
- //查询所有的数据
|
|
|
|
- //查询所有的主体信息汇总
|
|
|
|
- BigDecimal sum = BigDecimal.ZERO;
|
|
|
|
- List<DataMap> dataDetailList = this.mongoTemplate.find((new Query(
|
|
|
|
- Criteria.where("fileId")
|
|
|
|
- .is(dateFileId)
|
|
|
|
- .and("交易主体户名")
|
|
|
|
- .is(jythm)
|
|
|
|
- .and("交易对手账号")
|
|
|
|
- .is(jydszh))), DataMap.class);
|
|
|
|
- for (DataMap dataMap1 : dataDetailList) {
|
|
|
|
- String jyje = String.valueOf(dataMap1.get("交易金额"));
|
|
|
|
- sum = sum.add(new BigDecimal(jyje));
|
|
|
|
- }
|
|
|
|
- relationData.put("modelId", modelId);
|
|
|
|
- relationData.put("fileId", dateFileId);
|
|
|
|
- relationData.put("jythm", jythm);
|
|
|
|
- relationData.put("jydszh", jydszh);
|
|
|
|
- relationData.put("jeTotal", sum);
|
|
|
|
- relationData.put("sum", dataDetailList.size());
|
|
|
|
- total.put("party1", party1);
|
|
|
|
- total.put("party2", party2);
|
|
|
|
- total.put("relationData", relationData);
|
|
|
|
- total.put("userAllId", userAllId);
|
|
|
|
- //total.put("relationships", dataDetailList);
|
|
|
|
- relationshipGraphList.add(total);
|
|
|
|
- userAllList.add(userAllId);
|
|
|
|
- if (partyDataList.size() > 400) {
|
|
|
|
- return Mapped.ERROR("节点超过400个,请重新查询");
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ if (!userAllList.contains(userAllId)) {
|
|
|
|
+ //查询所有的数据
|
|
|
|
+ //查询所有的主体信息汇总
|
|
|
|
+ BigDecimal sum = BigDecimal.ZERO;
|
|
|
|
+ List<DataMap> dataDetailList = this.mongoTemplate.find((new Query(
|
|
|
|
+ Criteria.where("fileId")
|
|
|
|
+ .is(dateFileId)
|
|
|
|
+ .and("交易主体户名")
|
|
|
|
+ .is(jythm)
|
|
|
|
+ .and("交易对手账号")
|
|
|
|
+ .is(jydszh))), DataMap.class);
|
|
|
|
+ for (DataMap dataMap1 : dataDetailList) {
|
|
|
|
+ String jyje = String.valueOf(dataMap1.get("交易金额"));
|
|
|
|
+ sum = sum.add(new BigDecimal(jyje));
|
|
|
|
+ }
|
|
|
|
+ relationData.put("modelId", modelId);
|
|
|
|
+ relationData.put("fileId", dateFileId);
|
|
|
|
+ relationData.put("jythm", jythm);
|
|
|
|
+ relationData.put("jydszh", jydszh);
|
|
|
|
+ relationData.put("jeTotal", sum);
|
|
|
|
+ relationData.put("sum", dataDetailList.size());
|
|
|
|
+ total.put("party1", party1);
|
|
|
|
+ total.put("party2", party2);
|
|
|
|
+ total.put("relationData", relationData);
|
|
|
|
+ total.put("userAllId", userAllId);
|
|
|
|
+ //total.put("relationships", dataDetailList);
|
|
|
|
+ relationshipGraphList.add(total);
|
|
|
|
+ userAllList.add(userAllId);
|
|
|
|
+ if (partyDataList.size() > 400) {
|
|
|
|
+ return Mapped.ERROR("节点超过400个,请重新查询");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- for (Map<String, Object> stringObjectMap : relationshipGraphList) {
|
|
|
|
- Map<String, Object> party1 = (Map) stringObjectMap.get("party1");
|
|
|
|
- Map<String, Object> party2 = (Map) stringObjectMap.get("party2");
|
|
|
|
- String name1 = String.valueOf(party1.get("name"));
|
|
|
|
- String name2 = String.valueOf(party2.get("name"));
|
|
|
|
- String value1 = name2 + "-" + name1;
|
|
|
|
- stringObjectMap.put("type", 1);
|
|
|
|
- for (Map<String, Object> objectMap : relationshipGraphList) {
|
|
|
|
- Map<String, Object> party11 = (Map) objectMap.get("party1");
|
|
|
|
- Map<String, Object> party21 = (Map) objectMap.get("party2");
|
|
|
|
- String name11 = String.valueOf(party11.get("name"));
|
|
|
|
- String name21 = String.valueOf(party21.get("name"));
|
|
|
|
- String value11 = name11 + "-" + name21;
|
|
|
|
- if (value1.equals(value11)) {
|
|
|
|
- stringObjectMap.put("type", 2);
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ long g = System.currentTimeMillis();
|
|
|
|
+ log.error("获取所有的点和线的数据所需时间" + (g-f));
|
|
|
|
+ for (Map<String, Object> stringObjectMap : relationshipGraphList) {
|
|
|
|
+ Map<String, Object> party1 = (Map) stringObjectMap.get("party1");
|
|
|
|
+ Map<String, Object> party2 = (Map) stringObjectMap.get("party2");
|
|
|
|
+ String name1 = String.valueOf(party1.get("name"));
|
|
|
|
+ String name2 = String.valueOf(party2.get("name"));
|
|
|
|
+ String value1 = name2 + "-" + name1;
|
|
|
|
+ stringObjectMap.put("type", 1);
|
|
|
|
+ for (Map<String, Object> objectMap : relationshipGraphList) {
|
|
|
|
+ Map<String, Object> party11 = (Map) objectMap.get("party1");
|
|
|
|
+ Map<String, Object> party21 = (Map) objectMap.get("party2");
|
|
|
|
+ String name11 = String.valueOf(party11.get("name"));
|
|
|
|
+ String name21 = String.valueOf(party21.get("name"));
|
|
|
|
+ String value11 = name11 + "-" + name21;
|
|
|
|
+ if (value1.equals(value11)) {
|
|
|
|
+ stringObjectMap.put("type", 2);
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
- relationshipGraphListnew.add(stringObjectMap);
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+ relationshipGraphListnew.add(stringObjectMap);
|
|
|
|
|
|
- List<Map<String, Object>> partyDataListnew = new ArrayList<>();
|
|
|
|
|
|
+ }
|
|
|
|
+ long h = System.currentTimeMillis();
|
|
|
|
+ log.error("判断线是否为双向箭头数据所需时间" + (h-g));
|
|
|
|
+ log.error("网络关系图所需要的时间" + (h-startTime));
|
|
|
|
+ /* List<Map<String, Object>> partyDataListnew = new ArrayList<>();
|
|
for (Map<String, Object> stringObjectMap : partyDataList) {
|
|
for (Map<String, Object> stringObjectMap : partyDataList) {
|
|
String id =String.valueOf(stringObjectMap.get("id"));
|
|
String id =String.valueOf(stringObjectMap.get("id"));
|
|
stringObjectMap.put("relationCount",countMap.get(id));
|
|
stringObjectMap.put("relationCount",countMap.get(id));
|
|
partyDataListnew.add(stringObjectMap);
|
|
partyDataListnew.add(stringObjectMap);
|
|
- }
|
|
|
|
- dataMap.put("partyData", partyDataListnew);
|
|
|
|
- dataMap.put("relationshipGraph", relationshipGraphListnew);
|
|
|
|
- Mapped mapped = Mapped.OK();
|
|
|
|
- mapped.put("result", dataMap);
|
|
|
|
- return mapped;
|
|
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
+ dataMap.put("partyData", partyDataList);
|
|
|
|
+ dataMap.put("relationshipGraph", relationshipGraphListnew);
|
|
|
|
+ Mapped mapped = Mapped.OK();
|
|
|
|
+ mapped.put("result", dataMap);
|
|
|
|
+ return mapped;
|
|
|
|
+ }
|
|
}
|
|
}
|