|
|
@ -6,9 +6,11 @@ import cn.jlw.oldAliPay.pc.util.Stringutils;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.google.gson.JsonArray;
|
|
|
|
import com.google.gson.JsonArray;
|
|
|
|
import com.google.gson.JsonObject;
|
|
|
|
import com.google.gson.JsonObject;
|
|
|
|
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
import com.ibeetl.admin.core.service.CorePlatformService;
|
|
|
|
import com.ibeetl.admin.core.service.CorePlatformService;
|
|
|
|
import com.ibeetl.admin.core.service.CoreUserService;
|
|
|
|
import com.ibeetl.admin.core.service.CoreUserService;
|
|
|
|
|
|
|
|
import com.ibeetl.jlw.dao.StudentAccountAssetAllocationDao;
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
import com.ibeetl.jlw.entity.dto.CreateUserDTO;
|
|
|
|
import com.ibeetl.jlw.entity.dto.CreateUserDTO;
|
|
|
|
import com.ibeetl.jlw.enums.AccountTypeEnum;
|
|
|
|
import com.ibeetl.jlw.enums.AccountTypeEnum;
|
|
|
@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Type;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.sql.*;
|
|
|
|
import java.sql.*;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
@ -35,6 +38,8 @@ import java.util.concurrent.Executors;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static com.ibeetl.jlw.service.StudentAccountAssetAllocationService.sendPostRequest;
|
|
|
|
|
|
|
|
|
|
|
|
@Api(tags = "数据迁移")
|
|
|
|
@Api(tags = "数据迁移")
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("test")
|
|
|
|
@RequestMapping("test")
|
|
|
@ -60,7 +65,8 @@ public class TestController {
|
|
|
|
private UniversitiesCollegesJurisdictionExperimentalSystemService universitiesCollegesJurisdictionExperimentalSystemService;
|
|
|
|
private UniversitiesCollegesJurisdictionExperimentalSystemService universitiesCollegesJurisdictionExperimentalSystemService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private StudentAccountAssetAllocationService studentAccountAssetAllocationService;
|
|
|
|
private StudentAccountAssetAllocationService studentAccountAssetAllocationService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private StudentAccountForeignExchangeInvestmentSystemService studentAccountForeignExchangeInvestmentSystemService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private StudentAccountP2pSystemService studentAccountP2pSystemService;
|
|
|
|
private StudentAccountP2pSystemService studentAccountP2pSystemService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
@ -1013,6 +1019,7 @@ public class TestController {
|
|
|
|
System.out.println("线程结束");
|
|
|
|
System.out.println("线程结束");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 将列表分成几组
|
|
|
|
// 将列表分成几组
|
|
|
|
private List<List<Student>> partitionList(List<Student> list, int partitions) {
|
|
|
|
private List<List<Student>> partitionList(List<Student> list, int partitions) {
|
|
|
|
List<List<Student>> result = new ArrayList<>();
|
|
|
|
List<List<Student>> result = new ArrayList<>();
|
|
|
@ -1154,7 +1161,7 @@ public class TestController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer applicationId = resultSet.getInt("ApplicationId");
|
|
|
|
Integer applicationId = resultSet.getInt("ApplicationId");
|
|
|
|
if (applicationId.equals("-1")) {
|
|
|
|
if (applicationId.equals("-2")) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String applicationName = resultSet.getString("name");
|
|
|
|
String applicationName = resultSet.getString("name");
|
|
|
@ -1175,9 +1182,6 @@ public class TestController {
|
|
|
|
if (applicationId == -1) {
|
|
|
|
if (applicationId == -1) {
|
|
|
|
allocationQuery.setApplicationId(Long.valueOf(-1));
|
|
|
|
allocationQuery.setApplicationId(Long.valueOf(-1));
|
|
|
|
allocationQuery.setName(AccountTypeEnum.BANK_ACCOUNT);
|
|
|
|
allocationQuery.setName(AccountTypeEnum.BANK_ACCOUNT);
|
|
|
|
} else if (applicationId == -2) {
|
|
|
|
|
|
|
|
allocationQuery.setApplicationId(Long.valueOf(-2));
|
|
|
|
|
|
|
|
allocationQuery.setName(AccountTypeEnum.CASH_ACCOUNT);
|
|
|
|
|
|
|
|
} else if (applicationId == 4) {
|
|
|
|
} else if (applicationId == 4) {
|
|
|
|
allocationQuery.setApplicationId(Long.valueOf(4));
|
|
|
|
allocationQuery.setApplicationId(Long.valueOf(4));
|
|
|
|
allocationQuery.setName(AccountTypeEnum.P2P_ACCOUNT);
|
|
|
|
allocationQuery.setName(AccountTypeEnum.P2P_ACCOUNT);
|
|
|
@ -1526,4 +1530,129 @@ public class TestController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("调整用户资产数据")
|
|
|
|
|
|
|
|
@PostMapping("adjustUserAssetsData")
|
|
|
|
|
|
|
|
public void adjustUserAssetsData() {
|
|
|
|
|
|
|
|
List<Student> students = studentService.getNoAssetStudent();
|
|
|
|
|
|
|
|
if (students != null && students.size() > 0) {
|
|
|
|
|
|
|
|
int numThreads = Runtime.getRuntime().availableProcessors(); // 获取可用处理器数量作为线程数
|
|
|
|
|
|
|
|
ExecutorService executor = Executors.newFixedThreadPool(numThreads);
|
|
|
|
|
|
|
|
int chunkSize = students.size() / numThreads;
|
|
|
|
|
|
|
|
int fromIndex = 0;
|
|
|
|
|
|
|
|
int toIndex = chunkSize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < numThreads; i++) {
|
|
|
|
|
|
|
|
List<Student> chunk = students.subList(fromIndex, toIndex);
|
|
|
|
|
|
|
|
executor.execute(() -> {
|
|
|
|
|
|
|
|
runTask1(chunk);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
fromIndex = toIndex;
|
|
|
|
|
|
|
|
toIndex = (i == numThreads - 2) ? students.size() : toIndex + chunkSize;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
executor.shutdown();
|
|
|
|
|
|
|
|
while (!executor.isTerminated()) {
|
|
|
|
|
|
|
|
// Wait until all threads finish
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
System.out.println("线程结束");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void runTask1(List<Student> students) {
|
|
|
|
|
|
|
|
int processedCount = 0;
|
|
|
|
|
|
|
|
for (Student student : students) {
|
|
|
|
|
|
|
|
processedCount++;
|
|
|
|
|
|
|
|
System.out.println(Thread.currentThread().getName() + ":修改用户" + student.getStudentSn() + ",处理到第" + processedCount + "/" + students.size());
|
|
|
|
|
|
|
|
List<StudentAccountAssetAllocation> applicationIsNotIn = studentAccountAssetAllocationService.getByStudentAndApplicationIsNotIn(student.getStudentId());
|
|
|
|
|
|
|
|
for (StudentAccountAssetAllocation assetAllocation : applicationIsNotIn) {
|
|
|
|
|
|
|
|
StudentAccountAssetAllocationQuery allocation = new StudentAccountAssetAllocationQuery();
|
|
|
|
|
|
|
|
allocation.setStudentId(student.getStudentId());
|
|
|
|
|
|
|
|
allocation.setApplicationId(assetAllocation.getApplicationId());
|
|
|
|
|
|
|
|
UniversitiesColleges colleges = universitiesCollegesService.getByOrgId(student.getOrgId());
|
|
|
|
|
|
|
|
allocation.setUniversitiesCollegesId(colleges.getUniversitiesCollegesId());
|
|
|
|
|
|
|
|
allocation.setName(assetAllocation.getName());
|
|
|
|
|
|
|
|
allocation.setState(1);
|
|
|
|
|
|
|
|
BigDecimal money = new BigDecimal(2000000D);
|
|
|
|
|
|
|
|
allocation.setInitialCapital(money);
|
|
|
|
|
|
|
|
allocation.setAvailableFunds(money);
|
|
|
|
|
|
|
|
allocation.setIntoAccount(AccountTypeEnum.BANK_ACCOUNT);
|
|
|
|
|
|
|
|
allocation.setTransferinAmount(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
allocation.setTransferOutAmount(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
allocation.setInitialInvestmentCapital(money);
|
|
|
|
|
|
|
|
allocation.setBorrowedFunds(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
allocation.setInvestmentFunds(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
allocation.setInvestmentValue(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
allocation.setInvestmentIncome(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
allocation.setTotalAssetsOfSubAccounts(money);
|
|
|
|
|
|
|
|
allocation.setAssetInvestment(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
allocation.setReturnOnEquity(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
allocation.setIsUpdate(2);
|
|
|
|
|
|
|
|
allocation.setAmountFrozen(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
allocation.setUpdateVersion(Long.valueOf(-1));
|
|
|
|
|
|
|
|
allocation.setIsDel(1);
|
|
|
|
|
|
|
|
allocation.setIsInstitution(1);
|
|
|
|
|
|
|
|
studentAccountAssetAllocationService.add(allocation);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("调整用户外汇账户数据")
|
|
|
|
|
|
|
|
@PostMapping("adjustUserFundsData")
|
|
|
|
|
|
|
|
public void adjustUserFundsData() {
|
|
|
|
|
|
|
|
List<UniversitiesCollegesJurisdictionExperimentalSystem> systems = universitiesCollegesJurisdictionExperimentalSystemService.forexSimulationTradingAuthorizationSchoolDataInterface();
|
|
|
|
|
|
|
|
if (systems != null && systems.size() > 0) {
|
|
|
|
|
|
|
|
for (UniversitiesCollegesJurisdictionExperimentalSystem system : systems) {
|
|
|
|
|
|
|
|
UniversitiesColleges universitiesColleges = universitiesCollegesService.getById(system.getUniversitiesCollegesId());
|
|
|
|
|
|
|
|
List<Student> students = studentService.getValuesByOrgId(universitiesColleges.getOrgId());
|
|
|
|
|
|
|
|
if (students == null || students.size() == 0) continue;
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
for (Student student : students) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StudentAccountForeignExchangeInvestmentSystem foreignExchangeInvestmentSystem = studentAccountForeignExchangeInvestmentSystemService.getByStudentId(student.getStudentId());
|
|
|
|
|
|
|
|
if(foreignExchangeInvestmentSystem != null){
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = studentAccountAssetAllocationService.getMapByStudentIdForForeign(student.getStudentId());
|
|
|
|
|
|
|
|
String className = map.get("classname").toString();
|
|
|
|
|
|
|
|
String name = map.get("studentname").toString();
|
|
|
|
|
|
|
|
Long classId = Long.valueOf(map.get("classid").toString());
|
|
|
|
|
|
|
|
String majorName = map.get("majorname").toString();
|
|
|
|
|
|
|
|
String studentNumber = map.get("studentno").toString();
|
|
|
|
|
|
|
|
Double initialCapital = 2000000D;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 构建参数字符串
|
|
|
|
|
|
|
|
String postData = "name=" + name +
|
|
|
|
|
|
|
|
"&className=" + className +
|
|
|
|
|
|
|
|
"&classId=" + classId +
|
|
|
|
|
|
|
|
"&majorName=" + majorName +
|
|
|
|
|
|
|
|
"&studentNumber=" + studentNumber +
|
|
|
|
|
|
|
|
"&initialCapital=" + initialCapital;
|
|
|
|
|
|
|
|
String result = sendPostRequest("http://localhost:8801/account/checkOrCreateForexSimulationUser", postData);
|
|
|
|
|
|
|
|
// 使用 Gson 将 JSON 字符串解析为一个 Map 对象
|
|
|
|
|
|
|
|
Type type = new TypeToken<Map<String, Object>>() {
|
|
|
|
|
|
|
|
}.getType();
|
|
|
|
|
|
|
|
Map<String, Object> jsonMap = new Gson().fromJson(result, type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StudentAccountForeignExchangeInvestmentSystem system1 = new StudentAccountForeignExchangeInvestmentSystem();
|
|
|
|
|
|
|
|
system1.setStudentId(student.getStudentId());
|
|
|
|
|
|
|
|
system1.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId());
|
|
|
|
|
|
|
|
system1.setState(2L);
|
|
|
|
|
|
|
|
system1.setApplicationId(113L);
|
|
|
|
|
|
|
|
system1.setAccountName("外汇模拟交易账户");
|
|
|
|
|
|
|
|
system1.setInitialCapital(new BigDecimal(initialCapital));
|
|
|
|
|
|
|
|
system1.setTotalAssets(jsonMap.get("totalAssets") == null ? BigDecimal.ZERO : new BigDecimal(jsonMap.get("totalAssets").toString()));
|
|
|
|
|
|
|
|
system1.setNetAssetIncome(jsonMap.get("netAssetIncome") == null ? BigDecimal.ZERO : new BigDecimal(jsonMap.get("netAssetIncome").toString()));
|
|
|
|
|
|
|
|
system1.setAvailableBalance(new BigDecimal(2000000));
|
|
|
|
|
|
|
|
system1.setCumulativeIncome(jsonMap.get("cumulativeProfitLoss") == null ? BigDecimal.ZERO : new BigDecimal(jsonMap.get("cumulativeProfitLoss").toString()));
|
|
|
|
|
|
|
|
system1.setTotalAssetIncome(jsonMap.get("yield") == null ? BigDecimal.ZERO : new BigDecimal(jsonMap.get("yield").toString()));
|
|
|
|
|
|
|
|
system1.setIsDel(1L);
|
|
|
|
|
|
|
|
system1.setCreateTime(new Date());
|
|
|
|
|
|
|
|
system1.setIsInstitution(1L);
|
|
|
|
|
|
|
|
studentAccountForeignExchangeInvestmentSystemService.add(system1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|