|
@@ -23,12 +23,7 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
FileService fileService;
|
|
FileService fileService;
|
|
CountDownLatch latch;
|
|
CountDownLatch latch;
|
|
|
|
|
|
- public DataStaticAnalysisDs(
|
|
|
|
- HeaderProperties headerProperties,
|
|
|
|
- String modelId,
|
|
|
|
- MongoTemplate mongoTemplate,
|
|
|
|
- FileService fileService,
|
|
|
|
- CountDownLatch latch) {
|
|
|
|
|
|
+ public DataStaticAnalysisDs(HeaderProperties headerProperties, String modelId, MongoTemplate mongoTemplate, FileService fileService, CountDownLatch latch) {
|
|
this.headerProperties = headerProperties;
|
|
this.headerProperties = headerProperties;
|
|
this.modelId = modelId;
|
|
this.modelId = modelId;
|
|
this.mongoTemplate = mongoTemplate;
|
|
this.mongoTemplate = mongoTemplate;
|
|
@@ -50,6 +45,7 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
}
|
|
}
|
|
|
|
|
|
// 插入记录用户后续查询明细
|
|
// 插入记录用户后续查询明细
|
|
|
|
+ List<DataMap> dataMapList = new ArrayList<>();
|
|
if (StringUtils.isNotBlank(dateFileIdcft)) {
|
|
if (StringUtils.isNotBlank(dateFileIdcft)) {
|
|
MongoCursor<Document> cursor = getCursor(dateFileIdcft, mongoTemplate);
|
|
MongoCursor<Document> cursor = getCursor(dateFileIdcft, mongoTemplate);
|
|
if (cursor.hasNext()) {
|
|
if (cursor.hasNext()) {
|
|
@@ -88,9 +84,7 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
idToData.put(alipayId, dataMap);
|
|
idToData.put(alipayId, dataMap);
|
|
}
|
|
}
|
|
String alipayUsername = origin.getString("交易对手户名");
|
|
String alipayUsername = origin.getString("交易对手户名");
|
|
- if (StringUtils.isNotBlank(alipayUsername)
|
|
|
|
- && !"_".equals(alipayUsername)
|
|
|
|
- && !"-".equals(alipayUsername) && !"null".equals(alipayUsername)) {
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(alipayUsername) && !"_".equals(alipayUsername) && !"-".equals(alipayUsername) && !"null".equals(alipayUsername)) {
|
|
if (idToNames.containsKey(alipayId)) {
|
|
if (idToNames.containsKey(alipayId)) {
|
|
Set<String> names = idToNames.get(alipayId);
|
|
Set<String> names = idToNames.get(alipayId);
|
|
names.add(alipayUsername);
|
|
names.add(alipayUsername);
|
|
@@ -129,11 +123,11 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
dataMap.put("总笔数", oCount);
|
|
dataMap.put("总笔数", oCount);
|
|
String mainId = (String) origin.get("交易主体账号");
|
|
String mainId = (String) origin.get("交易主体账号");
|
|
String mainIdhm = (String) origin.get("交易主体户名");
|
|
String mainIdhm = (String) origin.get("交易主体户名");
|
|
- if(StringUtils.isNotBlank(mainId)&&StringUtils.isNotBlank(mainIdhm)){
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(mainId) && StringUtils.isNotBlank(mainIdhm)) {
|
|
if (hm.containsKey(mainId)) {
|
|
if (hm.containsKey(mainId)) {
|
|
Set<String> hmnew = hm.get(mainId);
|
|
Set<String> hmnew = hm.get(mainId);
|
|
hmnew.add(mainIdhm);
|
|
hmnew.add(mainIdhm);
|
|
- hm.put(mainId,hmnew);
|
|
|
|
|
|
+ hm.put(mainId, hmnew);
|
|
} else {
|
|
} else {
|
|
Set<String> mainIds = new HashSet<>();
|
|
Set<String> mainIds = new HashSet<>();
|
|
mainIds.add(mainIdhm);
|
|
mainIds.add(mainIdhm);
|
|
@@ -163,17 +157,17 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
}
|
|
}
|
|
if (CollectionUtils.isNotEmpty(mainIds)) {
|
|
if (CollectionUtils.isNotEmpty(mainIds)) {
|
|
value.put("共同交易主体数", mainIds.size());
|
|
value.put("共同交易主体数", mainIds.size());
|
|
- String str="";
|
|
|
|
- Set<String>jyzthm = new HashSet<>();
|
|
|
|
|
|
+ String str = "";
|
|
|
|
+ Set<String> jyzthm = new HashSet<>();
|
|
for (String mainId : mainIds) {
|
|
for (String mainId : mainIds) {
|
|
Set<String> strings = hm.get(mainId);
|
|
Set<String> strings = hm.get(mainId);
|
|
- if(CollectionUtils.isNotEmpty(strings)){
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(strings)) {
|
|
jyzthm.addAll(strings);
|
|
jyzthm.addAll(strings);
|
|
}
|
|
}
|
|
- str+=CollectionUtils.isEmpty(strings)?mainId+";":mainId+"("+StringUtils.join(strings, ",")+");";
|
|
|
|
|
|
+ str += CollectionUtils.isEmpty(strings) ? mainId + ";" : mainId + "(" + StringUtils.join(strings, ",") + ");";
|
|
}
|
|
}
|
|
value.put("共同交易主体账号汇总", str);
|
|
value.put("共同交易主体账号汇总", str);
|
|
- value.put("共同交易主体户名汇总", Math.min(mainIds.size(),jyzthm.size()));
|
|
|
|
|
|
+ value.put("共同交易主体户名汇总", Math.min(mainIds.size(), jyzthm.size()));
|
|
}
|
|
}
|
|
DataMap dataMap = entry.getValue();
|
|
DataMap dataMap = entry.getValue();
|
|
BigDecimal money1 = (BigDecimal) dataMap.get("交易总额");
|
|
BigDecimal money1 = (BigDecimal) dataMap.get("交易总额");
|
|
@@ -183,7 +177,8 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
BigDecimal money3 = (BigDecimal) dataMap.get("交易主体支出金额");
|
|
BigDecimal money3 = (BigDecimal) dataMap.get("交易主体支出金额");
|
|
dataMap.put("交易主体支出金额", money3.doubleValue());
|
|
dataMap.put("交易主体支出金额", money3.doubleValue());
|
|
}
|
|
}
|
|
- saveLines(idToData.values(), "共同交易主体数", mongoTemplate);
|
|
|
|
|
|
+ dataMapList.addAll(idToData.values());
|
|
|
|
+ //saveLines(idToData.values(), "共同交易主体数", mongoTemplate);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -226,9 +221,7 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
idToData.put(alipayId, dataMap);
|
|
idToData.put(alipayId, dataMap);
|
|
}
|
|
}
|
|
String alipayUsername = origin.getString("交易对手户名");
|
|
String alipayUsername = origin.getString("交易对手户名");
|
|
- if (StringUtils.isNotBlank(alipayUsername)
|
|
|
|
- && !"_".equals(alipayUsername)
|
|
|
|
- && !"-".equals(alipayUsername)&& !"null".equals(alipayUsername)) {
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(alipayUsername) && !"_".equals(alipayUsername) && !"-".equals(alipayUsername) && !"null".equals(alipayUsername)) {
|
|
if (idToNames.containsKey(alipayId)) {
|
|
if (idToNames.containsKey(alipayId)) {
|
|
Set<String> names = idToNames.get(alipayId);
|
|
Set<String> names = idToNames.get(alipayId);
|
|
names.add(alipayUsername);
|
|
names.add(alipayUsername);
|
|
@@ -264,11 +257,11 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
dataMap.put("总笔数", oCount);
|
|
dataMap.put("总笔数", oCount);
|
|
String mainId = (String) origin.get("交易主体账号");
|
|
String mainId = (String) origin.get("交易主体账号");
|
|
String mainIdhm = (String) origin.get("交易主体户名");
|
|
String mainIdhm = (String) origin.get("交易主体户名");
|
|
- if(StringUtils.isNotBlank(mainId)&&StringUtils.isNotBlank(mainIdhm)){
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(mainId) && StringUtils.isNotBlank(mainIdhm)) {
|
|
if (hm.containsKey(mainId)) {
|
|
if (hm.containsKey(mainId)) {
|
|
Set<String> hmnew = hm.get(mainId);
|
|
Set<String> hmnew = hm.get(mainId);
|
|
hmnew.add(mainIdhm);
|
|
hmnew.add(mainIdhm);
|
|
- hm.put(mainId,hmnew);
|
|
|
|
|
|
+ hm.put(mainId, hmnew);
|
|
} else {
|
|
} else {
|
|
Set<String> mainIds = new HashSet<>();
|
|
Set<String> mainIds = new HashSet<>();
|
|
mainIds.add(mainIdhm);
|
|
mainIds.add(mainIdhm);
|
|
@@ -301,17 +294,17 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(mainIds)) {
|
|
if (CollectionUtils.isNotEmpty(mainIds)) {
|
|
value.put("共同交易主体数", mainIds.size());
|
|
value.put("共同交易主体数", mainIds.size());
|
|
- String str="";
|
|
|
|
- Set<String>jyzthm = new HashSet<>();
|
|
|
|
|
|
+ String str = "";
|
|
|
|
+ Set<String> jyzthm = new HashSet<>();
|
|
for (String mainId : mainIds) {
|
|
for (String mainId : mainIds) {
|
|
Set<String> strings = hm.get(mainId);
|
|
Set<String> strings = hm.get(mainId);
|
|
- if(CollectionUtils.isNotEmpty(strings)){
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(strings)) {
|
|
jyzthm.addAll(strings);
|
|
jyzthm.addAll(strings);
|
|
}
|
|
}
|
|
- str+=CollectionUtils.isEmpty(strings)?mainId+";":mainId+"("+StringUtils.join(strings, ",")+");";
|
|
|
|
|
|
+ str += CollectionUtils.isEmpty(strings) ? mainId + ";" : mainId + "(" + StringUtils.join(strings, ",") + ");";
|
|
}
|
|
}
|
|
value.put("共同交易主体账号汇总", str);
|
|
value.put("共同交易主体账号汇总", str);
|
|
- value.put("共同交易主体户名汇总", Math.min(mainIds.size(),jyzthm.size()));
|
|
|
|
|
|
+ value.put("共同交易主体户名汇总", Math.min(mainIds.size(), jyzthm.size()));
|
|
}
|
|
}
|
|
DataMap dataMap = entry.getValue();
|
|
DataMap dataMap = entry.getValue();
|
|
BigDecimal money1 = (BigDecimal) dataMap.get("交易总额");
|
|
BigDecimal money1 = (BigDecimal) dataMap.get("交易总额");
|
|
@@ -321,8 +314,10 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
BigDecimal money3 = (BigDecimal) dataMap.get("交易主体支出金额");
|
|
BigDecimal money3 = (BigDecimal) dataMap.get("交易主体支出金额");
|
|
dataMap.put("交易主体支出金额", money3.doubleValue());
|
|
dataMap.put("交易主体支出金额", money3.doubleValue());
|
|
}
|
|
}
|
|
- saveLines(idToData.values(), "共同交易主体数", mongoTemplate);
|
|
|
|
|
|
+ dataMapList.addAll(idToData.values());
|
|
|
|
+ //saveLines(idToData.values(), "共同交易主体数", mongoTemplate);
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(dateFileIdwld)) {
|
|
if (StringUtils.isNotBlank(dateFileIdwld)) {
|
|
@@ -365,9 +360,7 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
idToData.put(alipayId, dataMap);
|
|
idToData.put(alipayId, dataMap);
|
|
}
|
|
}
|
|
String alipayUsername = origin.getString("对手支付宝户名");
|
|
String alipayUsername = origin.getString("对手支付宝户名");
|
|
- if (StringUtils.isNotBlank(alipayUsername)
|
|
|
|
- && !"_".equals(alipayUsername)
|
|
|
|
- && !"-".equals(alipayUsername)&& !"null".equals(alipayUsername)) {
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(alipayUsername) && !"_".equals(alipayUsername) && !"-".equals(alipayUsername) && !"null".equals(alipayUsername)) {
|
|
if (idToNames.containsKey(alipayId)) {
|
|
if (idToNames.containsKey(alipayId)) {
|
|
Set<String> names = idToNames.get(alipayId);
|
|
Set<String> names = idToNames.get(alipayId);
|
|
names.add(alipayUsername);
|
|
names.add(alipayUsername);
|
|
@@ -437,18 +430,18 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
}
|
|
}
|
|
if (CollectionUtils.isNotEmpty(mainIds)) {
|
|
if (CollectionUtils.isNotEmpty(mainIds)) {
|
|
value.put("共同交易主体数", mainIds.size());
|
|
value.put("共同交易主体数", mainIds.size());
|
|
- String str="";
|
|
|
|
- Set<String>jyzthm = new HashSet<>();
|
|
|
|
- int count=0;
|
|
|
|
|
|
+ String str = "";
|
|
|
|
+ Set<String> jyzthm = new HashSet<>();
|
|
|
|
+ int count = 0;
|
|
for (String mainId : mainIds) {
|
|
for (String mainId : mainIds) {
|
|
Set<String> strings = hm.get(mainId);
|
|
Set<String> strings = hm.get(mainId);
|
|
- if(CollectionUtils.isNotEmpty(strings)){
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(strings)) {
|
|
count++;
|
|
count++;
|
|
}
|
|
}
|
|
- str+=CollectionUtils.isEmpty(strings)?mainId+";":mainId+"("+StringUtils.join(strings, ",")+");";
|
|
|
|
|
|
+ str += CollectionUtils.isEmpty(strings) ? mainId + ";" : mainId + "(" + StringUtils.join(strings, ",") + ");";
|
|
}
|
|
}
|
|
value.put("共同交易主体账号汇总", str);
|
|
value.put("共同交易主体账号汇总", str);
|
|
- value.put("共同交易主体户名汇总", Math.min(mainIds.size(),count));
|
|
|
|
|
|
+ value.put("共同交易主体户名汇总", Math.min(mainIds.size(), count));
|
|
}
|
|
}
|
|
|
|
|
|
DataMap dataMap = entry.getValue();
|
|
DataMap dataMap = entry.getValue();
|
|
@@ -459,10 +452,14 @@ public class DataStaticAnalysisDs extends Ops implements Runnable {
|
|
BigDecimal money3 = (BigDecimal) dataMap.get("交易主体支出金额");
|
|
BigDecimal money3 = (BigDecimal) dataMap.get("交易主体支出金额");
|
|
dataMap.put("交易主体支出金额", money3.doubleValue());
|
|
dataMap.put("交易主体支出金额", money3.doubleValue());
|
|
}
|
|
}
|
|
- saveLines(idToData.values(), "共同交易主体数", mongoTemplate);
|
|
|
|
|
|
+ dataMapList.addAll(idToData.values());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dataMapList)) {
|
|
|
|
+ saveLines(dataMapList, "共同交易主体数", mongoTemplate);
|
|
|
|
+ }
|
|
|
|
+
|
|
latch.countDown();
|
|
latch.countDown();
|
|
log.info("数据分析-对手透视");
|
|
log.info("数据分析-对手透视");
|
|
}
|
|
}
|