|
@@ -7,6 +7,7 @@ import ieven.server.webapp.domain.data.Fields;
|
|
|
import ieven.server.webapp.domain.file.FileService;
|
|
|
import ieven.server.webapp.domain.file.LogicalFile;
|
|
|
import ieven.server.webapp.infrastructure.wrapper.Mapped;
|
|
|
+import ieven.server.webapp.service.tenpay.*;
|
|
|
import ieven.server.webapp.util.DataUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
@@ -22,6 +23,7 @@ import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
+import java.util.concurrent.CountDownLatch;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
@@ -32,7 +34,7 @@ public class AlipayService {
|
|
|
@Autowired private HeaderProperties headerProperties;
|
|
|
@Autowired private FileService fileService;
|
|
|
|
|
|
- public Mapped extractAll(String modelId) {
|
|
|
+ public Mapped extractAll(String modelId) throws InterruptedException {
|
|
|
// 先删除所有原来生成的表
|
|
|
clearAllGenerated(modelId);
|
|
|
// 查询出modelId的所有原始表头
|
|
@@ -40,60 +42,95 @@ public class AlipayService {
|
|
|
if (CollectionUtils.isEmpty(originFields)) {
|
|
|
return Mapped.ERROR("文件为空");
|
|
|
}
|
|
|
+
|
|
|
// 无限制大小的threadpool
|
|
|
ExecutorService exec = Executors.newCachedThreadPool();
|
|
|
+ CountDownLatch latch = new CountDownLatch(7);
|
|
|
// 五联单-注册信息
|
|
|
- exec.execute(new ALIPAY_ORIGIN_REGISTER(originFields, modelId, mongoTemplate));
|
|
|
+ exec.execute(new ALIPAY_ORIGIN_REGISTER(originFields, modelId, mongoTemplate, latch));
|
|
|
// 五联单-登录日志
|
|
|
- exec.execute(new ALIPAY_GENERATED_LOGIN(originFields, modelId, mongoTemplate));
|
|
|
+ exec.execute(new ALIPAY_GENERATED_LOGIN(originFields, modelId, mongoTemplate, latch));
|
|
|
// 五联单-交易记录
|
|
|
- exec.execute(new ALIPAY_GENERATED_TRADE(originFields, modelId, mongoTemplate));
|
|
|
+ exec.execute(new ALIPAY_GENERATED_TRADE(originFields, modelId, mongoTemplate, latch));
|
|
|
// 五联单-账户明细
|
|
|
- exec.execute(new ALIPAY_GENERATED_ACCOUNT(originFields, modelId, mongoTemplate));
|
|
|
+ exec.execute(new ALIPAY_GENERATED_ACCOUNT(originFields, modelId, mongoTemplate, latch));
|
|
|
// 五联单-转账明细
|
|
|
- exec.execute(new ALIPAY_GENERATED_TRANSFER(originFields, modelId, mongoTemplate));
|
|
|
+ exec.execute(new ALIPAY_GENERATED_TRANSFER(originFields, modelId, mongoTemplate, latch));
|
|
|
// 反诈平台订单数据
|
|
|
exec.execute(
|
|
|
- new AntiCheat(headerProperties, originFields, modelId, mongoTemplate, fileService));
|
|
|
+ new AntiCheat(headerProperties, originFields, modelId, mongoTemplate, fileService, latch));
|
|
|
// 治安平台订单数据
|
|
|
exec.execute(
|
|
|
- new SecurityOrder(headerProperties, originFields, modelId, mongoTemplate, fileService));
|
|
|
+ new SecurityOrder(
|
|
|
+ headerProperties, originFields, modelId, mongoTemplate, fileService, latch));
|
|
|
+ latch.await();
|
|
|
+ CountDownLatch latch2 = new CountDownLatch(7);
|
|
|
// 五联单-账户透视
|
|
|
exec.execute(
|
|
|
- new ScaleAnalysis(headerProperties, originFields, modelId, mongoTemplate, fileService));
|
|
|
+ new ScaleAnalysis(
|
|
|
+ headerProperties, originFields, modelId, mongoTemplate, fileService, latch2));
|
|
|
// 转账分析
|
|
|
exec.execute(
|
|
|
- new TransferAnalysis(headerProperties, originFields, modelId, mongoTemplate, fileService));
|
|
|
+ new TransferAnalysis(
|
|
|
+ headerProperties, originFields, modelId, mongoTemplate, fileService, latch2));
|
|
|
// 对手分析
|
|
|
exec.execute(
|
|
|
- new EndAnalysis(headerProperties, originFields, modelId, mongoTemplate, fileService));
|
|
|
+ new EndAnalysis(
|
|
|
+ headerProperties, originFields, modelId, mongoTemplate, fileService, latch2));
|
|
|
// 收货地址分析
|
|
|
exec.execute(
|
|
|
- new DeliveryAnalysis(headerProperties, originFields, modelId, mongoTemplate, fileService));
|
|
|
+ new DeliveryAnalysis(
|
|
|
+ headerProperties, originFields, modelId, mongoTemplate, fileService, latch2));
|
|
|
// IP分析
|
|
|
exec.execute(
|
|
|
- new IpAnalysis(headerProperties, originFields, modelId, mongoTemplate, fileService));
|
|
|
+ new IpAnalysis(
|
|
|
+ headerProperties, originFields, modelId, mongoTemplate, fileService, latch2));
|
|
|
|
|
|
// 存储了账号-户名的的信息
|
|
|
Map<String, String> accountToName = new ConcurrentHashMap<>();
|
|
|
// 反诈治安交易数据明细-从反诈读取户名
|
|
|
- exec.execute(new AntiSecurityTrade1(modelId, mongoTemplate, accountToName));
|
|
|
+ exec.execute(new AntiSecurityTrade1(modelId, mongoTemplate, accountToName, latch2));
|
|
|
// 反诈治安交易数据明细-从治安读取户名
|
|
|
- exec.execute(new AntiSecurityTrade2(modelId, mongoTemplate, accountToName));
|
|
|
+ exec.execute(new AntiSecurityTrade2(modelId, mongoTemplate, accountToName, latch2));
|
|
|
+ latch2.await();
|
|
|
+ CountDownLatch latch3 = new CountDownLatch(2);
|
|
|
// 反诈治安交易数据明细-从反诈读取
|
|
|
exec.execute(
|
|
|
new AntiSecurityTrade3(
|
|
|
- headerProperties, modelId, mongoTemplate, accountToName, fileService));
|
|
|
+ headerProperties, modelId, mongoTemplate, accountToName, fileService, latch3));
|
|
|
// 反诈治安交易数据明细-从治安读取
|
|
|
exec.execute(
|
|
|
new AntiSecurityTrade4(
|
|
|
- headerProperties, modelId, mongoTemplate, accountToName, fileService));
|
|
|
+ headerProperties, modelId, mongoTemplate, accountToName, fileService, latch3));
|
|
|
+ latch3.await();
|
|
|
+ CountDownLatch latch4 = new CountDownLatch(2);
|
|
|
// 反诈治安-账户透视
|
|
|
exec.execute(
|
|
|
- new AntiSecurityTradeScaleAnalysis(headerProperties, modelId, mongoTemplate, fileService));
|
|
|
+ new AntiSecurityTradeScaleAnalysis(
|
|
|
+ headerProperties, modelId, mongoTemplate, fileService, latch4));
|
|
|
// 反诈治安-对手分析
|
|
|
exec.execute(
|
|
|
- new AntiSecurityTradeEndAnalysis(headerProperties, modelId, mongoTemplate, fileService));
|
|
|
+ new AntiSecurityTradeEndAnalysis(
|
|
|
+ headerProperties, modelId, mongoTemplate, fileService, latch4));
|
|
|
+ latch4.await();
|
|
|
+ CountDownLatch latch5 = new CountDownLatch(1);
|
|
|
+ exec.execute(
|
|
|
+ new TenpayAccount(
|
|
|
+ originFields, modelId, mongoTemplate, fileService, accountToName, latch5));
|
|
|
+ latch5.await();
|
|
|
+ CountDownLatch latch6 = new CountDownLatch(1);
|
|
|
+ exec.execute(new TenpayOrders(originFields, modelId, mongoTemplate, fileService, latch6));
|
|
|
+ latch6.await();
|
|
|
+
|
|
|
+ CountDownLatch latch7 = new CountDownLatch(4);
|
|
|
+ exec.execute(new TenpayTrades(modelId, mongoTemplate, accountToName, fileService, latch7));
|
|
|
+ exec.execute(new TenpayMobile(originFields, modelId, mongoTemplate, fileService, latch7));
|
|
|
+ exec.execute(
|
|
|
+ new TenpayTradesEndAnalysis(headerProperties, modelId, mongoTemplate, fileService, latch7));
|
|
|
+ exec.execute(
|
|
|
+ new TenpayTradesScaleAnalysis(
|
|
|
+ headerProperties, modelId, mongoTemplate, fileService, latch7));
|
|
|
+ latch7.await();
|
|
|
reorder(modelId);
|
|
|
return Mapped.OK();
|
|
|
}
|