diff --git a/.gitignore b/.gitignore index e8d57d08088dd42068778b8f5d49cf4d05cc7fdd..9e35c768b0eceb7fb14c87d1bdea8544e6953928 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ dependency-reduced-pom.xml buildNumber.properties .mvn/timing.properties .mvn/wrapper/maven-wrapper.jar +.idea +*.iml diff --git a/ftdb/src/main/java/com/common/calculation/InitiUtil.java b/ftdb/src/main/java/com/common/calculation/InitiUtil.java index 57d9a2de242d1eec643cea78f3ec252934600bb0..7925710df4769fd9ae8b49c074b9f12b2ea4b025 100644 --- a/ftdb/src/main/java/com/common/calculation/InitiUtil.java +++ b/ftdb/src/main/java/com/common/calculation/InitiUtil.java @@ -31,7 +31,7 @@ public class InitiUtil { return datacfg_cusnum * 1000l; } //个人账户 - public static Long getAccnum(Integer datacfg_accnum){ + public static Long getAccnum(Long datacfg_accnum){ return datacfg_accnum * 1000l; } diff --git a/ftdb/src/main/java/com/pojo/DataConfig.java b/ftdb/src/main/java/com/pojo/DataConfig.java index b60608596efac4dc2905a965a10b67b11d72038d..6e7979fca2a09a3191384b0369fdff9413849cf1 100644 --- a/ftdb/src/main/java/com/pojo/DataConfig.java +++ b/ftdb/src/main/java/com/pojo/DataConfig.java @@ -21,7 +21,7 @@ public class DataConfig { private String datacfg_id; //配置编号 private Integer datacfg_brhnum; //网点数 private Integer datacfg_sjnonum; //网点下科目数 - private Integer datacfg_accnum ; //科目下账号数 + private Long datacfg_accnum ; //科目下账号数 private Integer datacfg_cusnum ; //客户数 public String getDatacfg_id() { @@ -48,11 +48,11 @@ public class DataConfig { this.datacfg_sjnonum = datacfg_sjnonum; } - public Integer getDatacfg_accnum() { + public Long getDatacfg_accnum() { return datacfg_accnum; } - public void setDatacfg_accnum(Integer datacfg_accnum) { + public void setDatacfg_accnum(Long datacfg_accnum) { this.datacfg_accnum = datacfg_accnum; } diff --git a/ftdb/src/main/java/com/service/impl/AtomicityServiceImpl.java b/ftdb/src/main/java/com/service/impl/AtomicityServiceImpl.java index 0c9b11bc08a23c99218812726bd588285dc7da68..fa9a120355f8ae9e54464343ae1779f53cda8d62 100644 --- a/ftdb/src/main/java/com/service/impl/AtomicityServiceImpl.java +++ b/ftdb/src/main/java/com/service/impl/AtomicityServiceImpl.java @@ -57,7 +57,7 @@ public class AtomicityServiceImpl extends Thread implements AtomicityService{ private boolean isStop = false; - private int datacfg_accnum; + private Long datacfg_accnum; @Override public void run() { @@ -255,13 +255,13 @@ public class AtomicityServiceImpl extends Thread implements AtomicityService{ - public int getDatacfg_accnum() { + public Long getDatacfg_accnum() { return datacfg_accnum; } - public void setDatacfg_accnum(int datacfg_accnum) { + public void setDatacfg_accnum(Long datacfg_accnum) { this.datacfg_accnum = datacfg_accnum; } diff --git a/ftdb/src/main/java/com/service/impl/DepositMoneyServiceImpl.java b/ftdb/src/main/java/com/service/impl/DepositMoneyServiceImpl.java index 221d6644e5f1b207b39b918d3919cc7a26e9dea0..26baf0e40155ee4d9e1a909c8f196d64af99f218 100644 --- a/ftdb/src/main/java/com/service/impl/DepositMoneyServiceImpl.java +++ b/ftdb/src/main/java/com/service/impl/DepositMoneyServiceImpl.java @@ -63,7 +63,7 @@ public class DepositMoneyServiceImpl implements DepositMoneyService,Callable task = pool.submit(new ParallelExecuteAddAccountTask(initialData,1,datacfg_accnum)); + ForkJoinTask task = pool.submit(new ParallelExecuteAddAccountTask(initialData,new Long(1),datacfg_accnum)); task.get(); pool.shutdown(); //阻塞当前线程直到 ForkJoinPool 中所有的任务都执行结束 @@ -650,29 +650,29 @@ public class InitialDataServiceImpl implements InitialDataService,Runnable { - static class ParallelExecuteAddAccountTask extends RecursiveTask { + static class ParallelExecuteAddAccountTask extends RecursiveTask { private static final long serialVersionUID = 1L; private static Random r = new Random(); private static Random r2 = new Random(); private final Logger logger = LoggerFactory.getLogger(InitialDataServiceImpl.class); private InitialData initialData; - private Integer startValue; - private Integer endValue; + private Long startValue; + private Long endValue; - public ParallelExecuteAddAccountTask(InitialData initialData, Integer startValue , Integer endValue) { + public ParallelExecuteAddAccountTask(InitialData initialData, Long startValue , Long endValue) { this.initialData = initialData; this.startValue = startValue; this.endValue = endValue; } @Override - protected Integer compute() { + protected Long compute() { if(endValue - startValue < pageSize) { logger.info(" InitialDataServiceImpl ParallelExecuteAddAccountTask compute startValue {} endValue {} ",startValue,endValue); try { ArrayList accounts = new ArrayList<>(); - for (int i = startValue; i <= endValue; i++) { + for (Long i = startValue; i <= endValue; i++) { Account ac = new Account(); ac.setAccount_id("60"+String.valueOf(InitiUtil.getAccnum(datacfg_accnum)+i)); ac.setAccount_sjnoid(String.format("%05d",(r.nextInt(datacfg_sjnonum )+1))); diff --git a/ftdb/src/main/java/com/service/impl/IsolationMainServiceImpl.java b/ftdb/src/main/java/com/service/impl/IsolationMainServiceImpl.java index 80ed5fb25569a249a47cd178c6665dbdd14b6af8..154d5df9b81e80604918ab3e8daa28278f3e6341 100644 --- a/ftdb/src/main/java/com/service/impl/IsolationMainServiceImpl.java +++ b/ftdb/src/main/java/com/service/impl/IsolationMainServiceImpl.java @@ -47,7 +47,7 @@ public class IsolationMainServiceImpl extends Thread implements IsolationMainSer private boolean isStop = false; - private int datacfg_accnum; + private Long datacfg_accnum; /** * 数据库隔离级别RR或者RC @@ -116,13 +116,13 @@ public class IsolationMainServiceImpl extends Thread implements IsolationMainSer - public Integer getDatacfg_accnum() { + public Long getDatacfg_accnum() { return datacfg_accnum; } - public void setDatacfg_accnum(Integer datacfg_accnum) { + public void setDatacfg_accnum(Long datacfg_accnum) { this.datacfg_accnum = datacfg_accnum; } diff --git a/ftdb/src/main/java/com/service/impl/QueryAccountServiceImpl.java b/ftdb/src/main/java/com/service/impl/QueryAccountServiceImpl.java index 171ba26e687a4084d9beb972496c0cb0dce21abf..259ac88dde2ca78a1a27c5c38f01c1b1a796a04c 100644 --- a/ftdb/src/main/java/com/service/impl/QueryAccountServiceImpl.java +++ b/ftdb/src/main/java/com/service/impl/QueryAccountServiceImpl.java @@ -62,14 +62,12 @@ public class QueryAccountServiceImpl implements QueryAccountService,Callable { private PropertiesConstant propertiesConstant; private int num; - private int datacfg_accnum; + private Long datacfg_accnum; private String process_id; private String trancfgType; @@ -85,10 +85,10 @@ public class TransferServiceImpl implements TransferService,Callable { long nowMillis = nowDate.getTime(); Time nowTime = new Time(nowMillis); BigDecimal money = AmountUtil.getRandomMoney(0,AccountConstant.ACCOUNT_DEFAULT_MONERY);//转账金额 - String accountFrom = "60"+String.valueOf((new Random().nextInt(datacfg_accnum)+1)+InitiUtil.getAccnum(datacfg_accnum));//借方 - String accountTo = "60"+String.valueOf((new Random().nextInt(datacfg_accnum)+1)+InitiUtil.getAccnum(datacfg_accnum));//贷方 + String accountFrom = "60"+String.valueOf((new Random().nextLong()+1)+InitiUtil.getAccnum(datacfg_accnum));//借方 + String accountTo = "60"+String.valueOf((new Random().nextLong()+1)+InitiUtil.getAccnum(datacfg_accnum));//贷方 while(accountFrom.equals(accountTo)) {//保证借方贷方不相等 - accountTo = "60"+String.valueOf((new Random().nextInt(datacfg_accnum)+1)+InitiUtil.getAccnum(datacfg_accnum)); + accountTo = "60"+String.valueOf((new Random().nextLong()+1)+InitiUtil.getAccnum(datacfg_accnum)); } if(accountFrom.compareTo(accountTo)>0) {//保证账号小的为借方 String temp = accountFrom; @@ -364,11 +364,11 @@ public class TransferServiceImpl implements TransferService,Callable { this.num = num; } - public int getDatacfg_accnum() { + public Long getDatacfg_accnum() { return datacfg_accnum; } - public void setDatacfg_accnum(int datacfg_accnum) { + public void setDatacfg_accnum(Long datacfg_accnum) { this.datacfg_accnum = datacfg_accnum; } diff --git a/ftdb/src/main/java/com/service/impl/WithdrawMoneyServiceImpl.java b/ftdb/src/main/java/com/service/impl/WithdrawMoneyServiceImpl.java index d1011051dd03ff2356852fa373562552059f2dac..845f3e8ef3370d8640449a5d192bf0fcd10ffce6 100644 --- a/ftdb/src/main/java/com/service/impl/WithdrawMoneyServiceImpl.java +++ b/ftdb/src/main/java/com/service/impl/WithdrawMoneyServiceImpl.java @@ -63,7 +63,7 @@ public class WithdrawMoneyServiceImpl implements WithdrawMoneyService,Callable