|
|
|
@ -301,11 +301,12 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
|
|
|
|
|
//开设7个账户,现金账户100万,银行账户0元,其他应用的账户开设,但是未被激活,没有初始资金
|
|
|
|
|
AccountTypeEnum[] values = AccountTypeEnum.values();
|
|
|
|
|
UniversitiesColleges universitiesColleges = universitiesCollegesDao.getByOrgId(orgId);
|
|
|
|
|
boolean lock = false;
|
|
|
|
|
//1: 个人,2: 机构
|
|
|
|
|
for (int j = 1; j < 3; j++) {
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < values.length; i++) {
|
|
|
|
|
if(values[i].getText().equals("现金账户"))continue;
|
|
|
|
|
if (values[i].getText().equals("现金账户")) continue;
|
|
|
|
|
StudentAccountAssetAllocation allocation = new StudentAccountAssetAllocation();
|
|
|
|
|
allocation.setStudentId(studentId);
|
|
|
|
|
//先默认不开通,条件符合就开通
|
|
|
|
@ -355,27 +356,30 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
|
|
|
|
|
|
|
|
|
|
query.setApplicationSecondLevelRelation("供应链金融服务公司");
|
|
|
|
|
|
|
|
|
|
}else if(ObjectUtil.equals(values[i].getText(),AccountTypeEnum.FINANCIAL_ACCOUNT.getText())){
|
|
|
|
|
} else if (ObjectUtil.equals(values[i].getText(), AccountTypeEnum.FINANCIAL_ACCOUNT.getText())) {
|
|
|
|
|
query.setApplicationSecondLevelRelation("智能理财");
|
|
|
|
|
}else if(ObjectUtil.equals(values[i].getText(),AccountTypeEnum.FOREX_INVESTMENT_ACCOUNT.getText())){
|
|
|
|
|
} else if (ObjectUtil.equals(values[i].getText(), AccountTypeEnum.FOREX_INVESTMENT_ACCOUNT.getText())) {
|
|
|
|
|
query.setApplicationSecondLevelRelation("外汇");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.equals(values[i].getText(), AccountTypeEnum.BANK_ACCOUNT.getText())) {
|
|
|
|
|
allocation.setState(2);
|
|
|
|
|
allocation.setApplicationId(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.CASH_ACCOUNT.getText()) ? -2L : -1L);
|
|
|
|
|
allocation.setApplicationId(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.BANK_ACCOUNT.getText()) ? -2L : -1L);
|
|
|
|
|
|
|
|
|
|
allocation.setInitialCapital(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.CASH_ACCOUNT.getText()) ?
|
|
|
|
|
allocation.setInitialCapital(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.BANK_ACCOUNT.getText()) ?
|
|
|
|
|
new BigDecimal(2000000) : BigDecimal.ZERO);
|
|
|
|
|
allocation.setAvailableFunds(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.CASH_ACCOUNT.getText()) ?
|
|
|
|
|
allocation.setAvailableFunds(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.BANK_ACCOUNT.getText()) ?
|
|
|
|
|
new BigDecimal(2000000) : BigDecimal.ZERO);
|
|
|
|
|
allocation.setInitialInvestmentCapital(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.CASH_ACCOUNT.getText()) ?
|
|
|
|
|
allocation.setInitialInvestmentCapital(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.BANK_ACCOUNT.getText()) ?
|
|
|
|
|
new BigDecimal(2000000) : BigDecimal.ZERO);
|
|
|
|
|
} else {
|
|
|
|
|
if (ObjectUtil.isNotNull(query.getApplicationSecondLevelRelation())) {
|
|
|
|
|
List<ResourcesApplication> applications = resourcesApplicationDao.getValuesByQuery(query);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(applications)) {
|
|
|
|
|
allocation.setApplicationId(applications.get(0).getResourcesApplicationId());
|
|
|
|
|
if (lock && applications.get(0).getResourcesApplicationId() == 16) {
|
|
|
|
|
allocation.setApplicationId(-16L);
|
|
|
|
|
} else {
|
|
|
|
|
allocation.setApplicationId(applications.get(0).getResourcesApplicationId());
|
|
|
|
|
}
|
|
|
|
|
List<UniversitiesCollegesJurisdictionExperimentalSystem> experimentalSystems = universitiesCollegesJurisdictionExperimentalSystemDao.getNotExpireApply(orgId, applications.get(0).getResourcesApplicationId().toString());
|
|
|
|
|
allocation.setState(CollectionUtil.isNotEmpty(experimentalSystems) ? 2 : 1);
|
|
|
|
|
Double money = 0D;
|
|
|
|
@ -402,7 +406,7 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
|
|
|
|
|
money = 2000000D;
|
|
|
|
|
} else if (values[i].getText().equals(AccountTypeEnum.FINANCIAL_ACCOUNT.getText())) {
|
|
|
|
|
money = 2000000D;
|
|
|
|
|
}else if(values[i].getText().equals(AccountTypeEnum.INSURANCE_ACCOUNT.getText())){
|
|
|
|
|
} else if (values[i].getText().equals(AccountTypeEnum.INSURANCE_ACCOUNT.getText())) {
|
|
|
|
|
money = 2000000D;
|
|
|
|
|
}
|
|
|
|
|
allocation.setInitialCapital(CollectionUtil.isNotEmpty(experimentalSystems) ?
|
|
|
|
@ -416,8 +420,6 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
allocation.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId());
|
|
|
|
|
allocation.setName(values[i]);
|
|
|
|
|
allocation.setUpdateTime(new Date());
|
|
|
|
@ -427,6 +429,83 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
|
|
|
|
|
allocation.setUpdateVersion(-1L);
|
|
|
|
|
allocation.setIsInstitution(j);
|
|
|
|
|
studentAccountAssetAllocationDao.insert(allocation);
|
|
|
|
|
if (allocation != null&&allocation.getApplicationId()!=null) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (allocation.getApplicationId() == 4 && j == 1) {
|
|
|
|
|
StudentAccountP2pSystem p2pSystem = new StudentAccountP2pSystem();
|
|
|
|
|
p2pSystem.setStudentId(studentId);
|
|
|
|
|
p2pSystem.setApplicationId(4L);
|
|
|
|
|
p2pSystem.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId());
|
|
|
|
|
p2pSystem.setState(Long.valueOf(allocation.getState()));
|
|
|
|
|
p2pSystem.setInitialInvestmentCapital(new BigDecimal(2000000));
|
|
|
|
|
p2pSystem.setAvailableBalance(new BigDecimal(2000000));
|
|
|
|
|
p2pSystem.setInitialCapital(new BigDecimal(2000000));
|
|
|
|
|
p2pSystem.setTotalAssets(new BigDecimal(2000000));
|
|
|
|
|
p2pSystem.setIsDel(1L);
|
|
|
|
|
p2pSystem.setIsInstitution(1L);
|
|
|
|
|
p2pSystem.setUserId(allocation.getUserId());
|
|
|
|
|
studentAccountP2pSystemService.add(p2pSystem);
|
|
|
|
|
} else if (allocation.getApplicationId() == 5 && j == 1) {
|
|
|
|
|
|
|
|
|
|
StudentAccountCrowdfundingSystem crowdfundingSystem = new StudentAccountCrowdfundingSystem();
|
|
|
|
|
crowdfundingSystem.setStudentId(studentId);
|
|
|
|
|
crowdfundingSystem.setApplicationId(5L);
|
|
|
|
|
crowdfundingSystem.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId());
|
|
|
|
|
crowdfundingSystem.setState(Long.valueOf(allocation.getState()));
|
|
|
|
|
crowdfundingSystem.setInitialInvestmentCapital(new BigDecimal(2000000));
|
|
|
|
|
crowdfundingSystem.setAvailableBalance(new BigDecimal(2000000));
|
|
|
|
|
crowdfundingSystem.setInitialCapital(new BigDecimal(2000000));
|
|
|
|
|
crowdfundingSystem.setTotalAssets(new BigDecimal(2000000));
|
|
|
|
|
crowdfundingSystem.setIsDel(1L);
|
|
|
|
|
crowdfundingSystem.setIsInstitution(1L);
|
|
|
|
|
crowdfundingSystem.setUserId(allocation.getUserId());
|
|
|
|
|
studentAccountCrowdfundingSystemService.add(crowdfundingSystem);
|
|
|
|
|
} else if (allocation.getApplicationId() == 16 && j == 1 && !lock) {
|
|
|
|
|
lock = true;
|
|
|
|
|
StudentAccountMockTradingSystem mockTradingSystem = new StudentAccountMockTradingSystem();
|
|
|
|
|
mockTradingSystem.setStudentId(studentId);
|
|
|
|
|
mockTradingSystem.setApplicationId(16L);
|
|
|
|
|
mockTradingSystem.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId());
|
|
|
|
|
mockTradingSystem.setState(Long.valueOf(allocation.getState()));
|
|
|
|
|
mockTradingSystem.setInitialInvestmentCapital(new BigDecimal(2000000));
|
|
|
|
|
mockTradingSystem.setAvailableCapital(new BigDecimal(2000000));
|
|
|
|
|
mockTradingSystem.setInitialCapital(new BigDecimal(2000000));
|
|
|
|
|
mockTradingSystem.setTotalAssets(new BigDecimal(2000000));
|
|
|
|
|
mockTradingSystem.setIsDel(1L);
|
|
|
|
|
mockTradingSystem.setIsInstitution(1L);
|
|
|
|
|
mockTradingSystem.setUserId(allocation.getUserId());
|
|
|
|
|
studentAccountMockTradingSystemService.add(mockTradingSystem);
|
|
|
|
|
|
|
|
|
|
StudentAccountMockTradingSystem mockTradingSystem1 = new StudentAccountMockTradingSystem();
|
|
|
|
|
mockTradingSystem1.setStudentId(studentId);
|
|
|
|
|
mockTradingSystem1.setApplicationId(-16L);
|
|
|
|
|
mockTradingSystem1.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId());
|
|
|
|
|
mockTradingSystem1.setState(Long.valueOf(allocation.getState()));
|
|
|
|
|
mockTradingSystem1.setInitialInvestmentCapital(new BigDecimal(2000000));
|
|
|
|
|
mockTradingSystem1.setAvailableCapital(new BigDecimal(2000000));
|
|
|
|
|
mockTradingSystem1.setInitialCapital(new BigDecimal(2000000));
|
|
|
|
|
mockTradingSystem1.setTotalAssets(new BigDecimal(2000000));
|
|
|
|
|
mockTradingSystem1.setIsDel(1L);
|
|
|
|
|
mockTradingSystem1.setIsInstitution(1L);
|
|
|
|
|
mockTradingSystem1.setUserId(allocation.getUserId());
|
|
|
|
|
studentAccountMockTradingSystemService.add(mockTradingSystem1);
|
|
|
|
|
|
|
|
|
|
} else if (allocation.getApplicationId() == 18 && j == 1) {
|
|
|
|
|
StudentAccountEquityInvestmentSystem investmentSystem = new StudentAccountEquityInvestmentSystem();
|
|
|
|
|
investmentSystem.setStudentId(studentId);
|
|
|
|
|
investmentSystem.setApplicationId(18L);
|
|
|
|
|
investmentSystem.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId());
|
|
|
|
|
investmentSystem.setState(Long.valueOf(allocation.getState()));
|
|
|
|
|
investmentSystem.setInitialInvestmentCapital(new BigDecimal(2000000));
|
|
|
|
|
investmentSystem.setOwnFunds(new BigDecimal(2000000));
|
|
|
|
|
investmentSystem.setInitialCapital(new BigDecimal(2000000));
|
|
|
|
|
investmentSystem.setIsDel(1L);
|
|
|
|
|
investmentSystem.setIsInstitution(1L);
|
|
|
|
|
investmentSystem.setUserId(allocation.getUserId());
|
|
|
|
|
studentAccountEquityInvestmentSystemService.add(investmentSystem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -497,7 +576,7 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
|
|
|
|
|
|
|
|
|
|
resourcesApplicationQuery.setApplicationSecondLevelRelation("供应链金融服务公司");
|
|
|
|
|
|
|
|
|
|
}else if(ObjectUtil.equals(accountAssetAllocation.getName().getText(),AccountTypeEnum.FINANCIAL_ACCOUNT.getText())){
|
|
|
|
|
} else if (ObjectUtil.equals(accountAssetAllocation.getName().getText(), AccountTypeEnum.FINANCIAL_ACCOUNT.getText())) {
|
|
|
|
|
resourcesApplicationQuery.setApplicationSecondLevelRelation("智能理财");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -617,12 +696,20 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
|
|
|
|
|
|
|
|
|
|
outAccountAssetAllocation.setAvailableFunds(availableFunds.subtract(transfer));
|
|
|
|
|
outAccountAssetAllocation.setInitialInvestmentCapital(outAccountAssetAllocation.getApplicationId() == -1 ? availableFunds : availableFunds.subtract(transfer));
|
|
|
|
|
if (outAccountAssetAllocation.getTransferOutAmount() == null) {
|
|
|
|
|
outAccountAssetAllocation.setTransferOutAmount(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
outAccountAssetAllocation.setTransferOutAmount(outAccountAssetAllocation.getTransferOutAmount().add(transfer));
|
|
|
|
|
studentAccountAssetAllocationDao.updateById(outAccountAssetAllocation);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
toAccountAssetAllocation.setInitialInvestmentCapital(toAccountAssetAllocation.getTransferOutAmount().add(transfer));
|
|
|
|
|
toAccountAssetAllocation.setAvailableFunds(toAccountAssetAllocation.getTransferOutAmount().add(transfer));
|
|
|
|
|
if (toAccountAssetAllocation.getTransferOutAmount() == null) {
|
|
|
|
|
toAccountAssetAllocation.setTransferOutAmount(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
if (toAccountAssetAllocation.getTransferinAmount() == null) {
|
|
|
|
|
toAccountAssetAllocation.setTransferinAmount(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
toAccountAssetAllocation.setInitialInvestmentCapital(toAccountAssetAllocation.getInitialInvestmentCapital().add(transfer));
|
|
|
|
|
toAccountAssetAllocation.setAvailableFunds(toAccountAssetAllocation.getAvailableFunds().add(transfer));
|
|
|
|
|
toAccountAssetAllocation.setTransferinAmount(toAccountAssetAllocation.getTransferinAmount().add(transfer));
|
|
|
|
|
studentAccountAssetAllocationDao.updateById(toAccountAssetAllocation);
|
|
|
|
|
|
|
|
|
@ -650,7 +737,7 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
|
|
|
|
|
updateQuery.setStudentId(studentId);
|
|
|
|
|
List<StudentAccountAssetAllocation> updateAccount = studentAccountAssetAllocationDao.getValuesByQuery(updateQuery);
|
|
|
|
|
StudentAccountAssetAllocation allocation = updateAccount.get(0);
|
|
|
|
|
studentAccountEquityInvestmentSystemService.updateByTransfer(allocation.getInitialCapital(), allocation.getInitialInvestmentCapital(),
|
|
|
|
|
studentAccountEquityInvestmentSystemService.updateByTransfer(allocation.getAvailableFunds(),allocation.getInitialCapital(), allocation.getInitialInvestmentCapital(),
|
|
|
|
|
allocation.getInitialInvestmentCapital(), allocation.getInitialInvestmentCapital(), studentId);
|
|
|
|
|
}
|
|
|
|
|
if (outAccountAssetAllocation.getApplicationId() == 4 || toAccountAssetAllocation.getApplicationId() == 4) {
|
|
|
|
@ -658,7 +745,7 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (outAccountAssetAllocation.getApplicationId() == 5 || toAccountAssetAllocation.getApplicationId() == 5) {
|
|
|
|
|
updateStudentAccountByApplicationId(studentId, 4);
|
|
|
|
|
updateStudentAccountByApplicationId(studentId, 5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (outAccountAssetAllocation.getApplicationId() == 16 || toAccountAssetAllocation.getApplicationId() == 16) {
|
|
|
|
|