From e1a931f618bbcd48704fb76c208c4be4c0c8363c Mon Sep 17 00:00:00 2001 From: chenyuan <907037276@qq.com> Date: Thu, 28 Mar 2024 18:19:49 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ibeetl/admin/core/dao/CoreUserDao.java | 3 + .../admin/core/service/CoreUserService.java | 5 + .../src/main/resources/sql/core/coreUser.md | 6 +- .../dao/StudentAccountAssetAllocationDao.java | 4 + ...untForeignExchangeInvestmentSystemDao.java | 9 +- .../java/com/ibeetl/jlw/dao/StudentDao.java | 5 + ...egesJurisdictionExperimentalSystemDao.java | 2 + ...ccountForeignExchangeInvestmentSystem.java | 71 +++++++++ .../com/ibeetl/jlw/enums/AccountTypeEnum.java | 2 +- .../StudentAccountAssetAllocationService.java | 125 ++++++++++----- ...oreignExchangeInvestmentSystemService.java | 30 ++++ .../ibeetl/jlw/service/StudentService.java | 8 + ...JurisdictionExperimentalSystemService.java | 5 + .../com/ibeetl/jlw/web/AccountController.java | 11 +- .../com/ibeetl/jlw/web/TestController.java | 145 +++++++++++++++++- web/src/main/resources/sql/jlw/student.md | 11 +- .../sql/jlw/studentAccountAssetAllocation.md | 24 ++- ...tAccountForeignExchangeInvestmentSystem.md | 4 + ...sCollegesJurisdictionExperimentalSystem.md | 5 +- 19 files changed, 419 insertions(+), 56 deletions(-) create mode 100644 web/src/main/java/com/ibeetl/jlw/entity/StudentAccountForeignExchangeInvestmentSystem.java create mode 100644 web/src/main/java/com/ibeetl/jlw/service/StudentAccountForeignExchangeInvestmentSystemService.java diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreUserDao.java b/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreUserDao.java index 86c37708..422987be 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreUserDao.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreUserDao.java @@ -84,4 +84,7 @@ public interface CoreUserDao extends BaseMapper { List findAll(); void deleteById1(Long userId); + + + List> getUsersBySchoolId(Long schoolId); } diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java index fcb5bc36..ee308b2e 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java @@ -407,4 +407,9 @@ public class CoreUserService extends CoreBaseService { public void deleteById1(Long userId) { sqlManager.deleteById(CoreUser.class, userId); } + + + public List> getUsersBySchoolId(Long schoolId){ + return coreUserDao.getUsersBySchoolId(schoolId); + } } diff --git a/admin-core/src/main/resources/sql/core/coreUser.md b/admin-core/src/main/resources/sql/core/coreUser.md index 06116296..b3b7c78d 100644 --- a/admin-core/src/main/resources/sql/core/coreUser.md +++ b/admin-core/src/main/resources/sql/core/coreUser.md @@ -249,4 +249,8 @@ findAll deleteById1 === -delete from core_user where ID = #userId# \ No newline at end of file +delete from core_user where ID = #userId# + +getUsersBySchoolId +=== + select \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/dao/StudentAccountAssetAllocationDao.java b/web/src/main/java/com/ibeetl/jlw/dao/StudentAccountAssetAllocationDao.java index d98de70c..441d5b23 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/StudentAccountAssetAllocationDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/StudentAccountAssetAllocationDao.java @@ -35,4 +35,8 @@ public interface StudentAccountAssetAllocationDao extends BaseMapper getInfo(Long studentId); List getInfoByStudentIdAnIsInstitution(Long studentId); + + List getByStudentAndApplicationIsNotIn(Long studentId); + + Map getMapByStudentIdForForeign(Long studentId); } diff --git a/web/src/main/java/com/ibeetl/jlw/dao/StudentAccountForeignExchangeInvestmentSystemDao.java b/web/src/main/java/com/ibeetl/jlw/dao/StudentAccountForeignExchangeInvestmentSystemDao.java index 969eeb51..b468353e 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/StudentAccountForeignExchangeInvestmentSystemDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/StudentAccountForeignExchangeInvestmentSystemDao.java @@ -1,5 +1,6 @@ package com.ibeetl.jlw.dao; +import com.ibeetl.jlw.entity.StudentAccountForeignExchangeInvestmentSystem; import com.ibeetl.jlw.entity.StudentAccountP2pSystem; import com.ibeetl.jlw.web.query.StudentAccountP2pSystemQuery; import org.beetl.sql.core.engine.PageQuery; @@ -15,8 +16,10 @@ import java.util.List; // 实际可以不用加Repository注解,调用的地方注入时候,Idea会报红,看着难受 @Repository @SqlResource("jlw.studentAccountForeignExchangeInvestmentSystem") -public interface StudentAccountForeignExchangeInvestmentSystemDao extends BaseMapper { - PageQuery queryByCondition(PageQuery query); +public interface StudentAccountForeignExchangeInvestmentSystemDao extends BaseMapper { + PageQuery queryByCondition(PageQuery query); - List getValuesByQueryNotWithPermission(StudentAccountP2pSystemQuery studentAccountP2pSystemQuery); + List getValuesByQueryNotWithPermission(StudentAccountForeignExchangeInvestmentSystem system); + + StudentAccountForeignExchangeInvestmentSystem getByStudentId(Long studentId); } diff --git a/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java b/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java index 4efdf4ea..098f0ead 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java @@ -137,4 +137,9 @@ public interface StudentDao extends BaseMapper{ Student getByOldId(Long oldId); Student getStudentByStudentNo(String studentNo); + + + List getNoAssetStudent(); + + Map getMapByStudentIdForForeign(Long studentId); } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesJurisdictionExperimentalSystemDao.java b/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesJurisdictionExperimentalSystemDao.java index 6d01fbea..2ec19738 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesJurisdictionExperimentalSystemDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesJurisdictionExperimentalSystemDao.java @@ -51,4 +51,6 @@ public interface UniversitiesCollegesJurisdictionExperimentalSystemDao extends B * @return */ List getNotExpireApply( @Param("orgId") Long orgId , @Param("typeId") String typeIds); + + ListforexSimulationTradingAuthorizationSchoolDataInterface(); } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/entity/StudentAccountForeignExchangeInvestmentSystem.java b/web/src/main/java/com/ibeetl/jlw/entity/StudentAccountForeignExchangeInvestmentSystem.java new file mode 100644 index 00000000..21836908 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/entity/StudentAccountForeignExchangeInvestmentSystem.java @@ -0,0 +1,71 @@ +package com.ibeetl.jlw.entity; + +import com.ibeetl.admin.core.entity.BaseEntity; +import com.ibeetl.admin.core.util.ValidateConfig; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.beetl.sql.annotation.entity.AutoID; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; + +@ApiModel("外汇模拟交易资产表") +@Data +public class StudentAccountForeignExchangeInvestmentSystem extends BaseEntity { + //主键ID + @NotNull(message = "ID不能为空", groups = ValidateConfig.UPDATE.class) + @AutoID + private Long id ; + @ApiModelProperty("学生ID") + private Long studentId; + @ApiModelProperty("应用ID") + private Long applicationId; + @ApiModelProperty("院校ID") + private Long universitiesCollegesId; + @ApiModelProperty("账户ID") + private Long accountId; + @ApiModelProperty("账户名称") + private String accountName; + @ApiModelProperty("账户开通状态 1:未开通 2:已开通") + private Long state; + @ApiModelProperty("期初资金") + private BigDecimal initialCapital; + @ApiModelProperty("期初投资资金") + private BigDecimal initialInvestmentCapital; + @ApiModelProperty("可用余额") + private BigDecimal availableBalance; + @ApiModelProperty("总资产") + private BigDecimal totalAssets; + @ApiModelProperty("总投资额") + private BigDecimal totalInvestment; + @ApiModelProperty("总借款") + private BigDecimal totalBorrow; + @ApiModelProperty("冻结资金") + private BigDecimal frozenFunds; + @ApiModelProperty("累计收益") + private BigDecimal cumulativeIncome; + @ApiModelProperty("总资产收益") + private BigDecimal totalAssetIncome; + @ApiModelProperty("净资产收益") + private BigDecimal netAssetIncome; + @ApiModelProperty("日投资总金额") + private BigDecimal totalDailyInvestmentAmount; + @ApiModelProperty("周投资总金额") + private BigDecimal totalAmountWeeklyInvestment; + @ApiModelProperty("月投资总金额") + private BigDecimal totalAmountMonthlyInvestment; + @ApiModelProperty("'修改时间'") + private Date updateTime ; + @ApiModelProperty("'创建时间'") + private Date createTime ; + @ApiModelProperty("是否删除 1: 正常,2: 删除") + private Long isDel ; + @ApiModelProperty("是否机构 1: 个人,2: 机构") + private Long isInstitution ; + @ApiModelProperty("用户ID") + private Long userId ; + @ApiModelProperty("机构ID") + private Long orgId ; +} diff --git a/web/src/main/java/com/ibeetl/jlw/enums/AccountTypeEnum.java b/web/src/main/java/com/ibeetl/jlw/enums/AccountTypeEnum.java index 04922418..87570f89 100644 --- a/web/src/main/java/com/ibeetl/jlw/enums/AccountTypeEnum.java +++ b/web/src/main/java/com/ibeetl/jlw/enums/AccountTypeEnum.java @@ -39,7 +39,7 @@ import org.beetl.sql.annotation.entity.EnumValue; public enum AccountTypeEnum { /**现金账户*/ - CASH_ACCOUNT("现金账户"), +// CASH_ACCOUNT("现金账户"), /**银行账户*/ BANK_ACCOUNT("银行账户"), diff --git a/web/src/main/java/com/ibeetl/jlw/service/StudentAccountAssetAllocationService.java b/web/src/main/java/com/ibeetl/jlw/service/StudentAccountAssetAllocationService.java index 4ddcd982..405f7c94 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/StudentAccountAssetAllocationService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/StudentAccountAssetAllocationService.java @@ -10,6 +10,8 @@ import cn.hutool.jwt.JWTUtil; import cn.jlw.util.ToolUtils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.service.CoreBaseService; import com.ibeetl.admin.core.service.CoreUserService; @@ -37,10 +39,13 @@ import javax.validation.constraints.NotBlank; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; import java.math.BigDecimal; import java.math.RoundingMode; import java.net.HttpURLConnection; import java.net.URL; +import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.sql.Connection; import java.sql.DriverManager; @@ -73,8 +78,6 @@ public class StudentAccountAssetAllocationService extends CoreBaseService queryByCondition(PageQuery query) { @@ -103,6 +107,7 @@ public class StudentAccountAssetAllocationService extends CoreBaseService applications = resourcesApplicationDao.getValuesByQuery(query); @@ -579,14 +585,14 @@ public class StudentAccountAssetAllocationService extends CoreBaseService students = getMapByStudentIdForForeign(studentId); + String className = students.get("classname").toString(); + String name = students.get("studentname").toString(); + Long classId = Long.valueOf(students.get("classid").toString()); + String majorName = students.get("majorname").toString(); + String studentNumber = students.get("studentno").toString(); + Double initialCapital = 2000000D; + + // 构建参数字符串 + String postData = "name=" + name + + "&className=" + className + + "&classId=" + classId + + "&majorName=" + majorName + + "&studentNumber=" + studentNumber + + "&initialCapital=" + initialCapital; + String result = sendPostRequest("http://120.79.54.255:8801/account/checkOrCreateForexSimulationUser", postData); + // 使用 Gson 将 JSON 字符串解析为一个 Map 对象 + Type type = new TypeToken>() { + }.getType(); + Map jsonMap = new Gson().fromJson(result, type); + + StudentAccountForeignExchangeInvestmentSystem system = new StudentAccountForeignExchangeInvestmentSystem(); + system.setStudentId(studentId); + system.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId()); + system.setState(2L); + system.setApplicationId(113L); + system.setAccountName("外汇模拟交易账户"); + system.setInitialCapital(new BigDecimal(initialCapital)); + system.setTotalAssets(jsonMap.get("totalAssets") == null ? BigDecimal.ZERO : new BigDecimal(jsonMap.get("totalAssets").toString())); + system.setNetAssetIncome(jsonMap.get("netAssetIncome") == null ? BigDecimal.ZERO : new BigDecimal(jsonMap.get("netAssetIncome").toString())); + system.setAvailableBalance(new BigDecimal(2000000)); + system.setCumulativeIncome(jsonMap.get("cumulativeProfitLoss") == null ? BigDecimal.ZERO : new BigDecimal(jsonMap.get("cumulativeProfitLoss").toString())); + system.setTotalAssetIncome(jsonMap.get("yield") == null ? BigDecimal.ZERO : new BigDecimal(jsonMap.get("yield").toString())); + system.setIsDel(1L); + system.setCreateTime(new Date()); + system.setIsInstitution(1L); + studentAccountForeignExchangeInvestmentSystemService.add(system); } } } @@ -699,10 +743,10 @@ public class StudentAccountAssetAllocationService extends CoreBaseService getByStudentAndApplicationIsNotIn(Long studentId) { + return studentAccountAssetAllocationDao.getByStudentAndApplicationIsNotIn(studentId); + } + + public Map getMapByStudentIdForForeign(Long studentId) { + return studentAccountAssetAllocationDao.getMapByStudentIdForForeign(studentId); + } + } diff --git a/web/src/main/java/com/ibeetl/jlw/service/StudentAccountForeignExchangeInvestmentSystemService.java b/web/src/main/java/com/ibeetl/jlw/service/StudentAccountForeignExchangeInvestmentSystemService.java new file mode 100644 index 00000000..632bd19f --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/service/StudentAccountForeignExchangeInvestmentSystemService.java @@ -0,0 +1,30 @@ +package com.ibeetl.jlw.service; + +import com.ibeetl.admin.core.service.CoreBaseService; +import com.ibeetl.jlw.dao.StudentAccountEquityInvestmentSystemDao; +import com.ibeetl.jlw.dao.StudentAccountForeignExchangeInvestmentSystemDao; +import com.ibeetl.jlw.entity.StudentAccountForeignExchangeInvestmentSystem; +import com.ibeetl.jlw.entity.StudentAccountMockTradingSystem; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +@Service +@Transactional +@Validated +public class StudentAccountForeignExchangeInvestmentSystemService extends CoreBaseService { + + @Autowired + private StudentAccountForeignExchangeInvestmentSystemDao studentAccountForeignExchangeInvestmentSystemDao; + + public void add(StudentAccountForeignExchangeInvestmentSystem system) { + studentAccountForeignExchangeInvestmentSystemDao.insert(system); + } + + public StudentAccountForeignExchangeInvestmentSystem getByStudentId(Long studentId){ + return studentAccountForeignExchangeInvestmentSystemDao.getByStudentId(studentId); + + } + +} diff --git a/web/src/main/java/com/ibeetl/jlw/service/StudentService.java b/web/src/main/java/com/ibeetl/jlw/service/StudentService.java index 05485ae4..c1fe9b17 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/StudentService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/StudentService.java @@ -1792,4 +1792,12 @@ public class StudentService extends CoreBaseService { public void deleteById1(Long studentId) { sqlManager.deleteById(Student.class, studentId); } + //查询资产数据没有32条的数据 + public List getNoAssetStudent() { + return studentDao.getNoAssetStudent(); + } + + public Map getMapByStudentIdForForeign(Long studentId){ + return studentDao.getMapByStudentIdForForeign(studentId); + } } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesJurisdictionExperimentalSystemService.java b/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesJurisdictionExperimentalSystemService.java index 408df3cf..03b62bfb 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesJurisdictionExperimentalSystemService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesJurisdictionExperimentalSystemService.java @@ -187,4 +187,9 @@ public class UniversitiesCollegesJurisdictionExperimentalSystemService extends C public List getAllOverdueAuthByBeforeAndAfterDays(Long beforeDays, Long afterDays, Long orgId) { return universitiesCollegesJurisdictionExperimentalSystemDao.getAllOverdueAuthByBeforeAndAfterDays(beforeDays, afterDays, orgId); } + + //查询授权了外汇模拟交易的学校数据 + public List forexSimulationTradingAuthorizationSchoolDataInterface(){ + return universitiesCollegesJurisdictionExperimentalSystemDao.forexSimulationTradingAuthorizationSchoolDataInterface(); + } } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/web/AccountController.java b/web/src/main/java/com/ibeetl/jlw/web/AccountController.java index 9dd1f58a..38518782 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/AccountController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/AccountController.java @@ -210,10 +210,7 @@ public class AccountController { if (applicationId == -1) { allocationQuery.setApplicationId(Long.valueOf(-1)); 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.setName(AccountTypeEnum.P2P_ACCOUNT); StudentAccountCrowdfundingSystem info = studentAccountCrowdfundingSystemService.getInfo(student.getStudentId()); @@ -1346,4 +1343,10 @@ public class AccountController { return JsonResult.success(); } + @ApiOperation("根据学校id查询用户数据") + @GetMapping("getUsersBySchoolId.json") + public JsonResult>> getUsersBySchoolId(Long schoolId){ + return JsonResult.success(userService.getUsersBySchoolId(schoolId)); + } + } diff --git a/web/src/main/java/com/ibeetl/jlw/web/TestController.java b/web/src/main/java/com/ibeetl/jlw/web/TestController.java index 646c75e3..6f8397e6 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TestController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TestController.java @@ -6,9 +6,11 @@ import cn.jlw.oldAliPay.pc.util.Stringutils; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import com.google.gson.reflect.TypeToken; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.service.CorePlatformService; import com.ibeetl.admin.core.service.CoreUserService; +import com.ibeetl.jlw.dao.StudentAccountAssetAllocationDao; import com.ibeetl.jlw.entity.*; import com.ibeetl.jlw.entity.dto.CreateUserDTO; 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.RestController; +import java.lang.reflect.Type; import java.math.BigDecimal; import java.sql.*; import java.text.SimpleDateFormat; @@ -35,6 +38,8 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; +import static com.ibeetl.jlw.service.StudentAccountAssetAllocationService.sendPostRequest; + @Api(tags = "数据迁移") @RestController @RequestMapping("test") @@ -60,7 +65,8 @@ public class TestController { private UniversitiesCollegesJurisdictionExperimentalSystemService universitiesCollegesJurisdictionExperimentalSystemService; @Autowired private StudentAccountAssetAllocationService studentAccountAssetAllocationService; - + @Autowired + private StudentAccountForeignExchangeInvestmentSystemService studentAccountForeignExchangeInvestmentSystemService; @Autowired private StudentAccountP2pSystemService studentAccountP2pSystemService; @Autowired @@ -913,8 +919,8 @@ public class TestController { UniversitySystem system = universitySystemService.getById(schoolClass.getUniversitySystemId()); System.out.println("修改班级" + i + "/" + classes.size()); Connection connection = openConn(); - if(schoolClass.getClassName().equals("产品演示1班")){ - int a = 0; + if (schoolClass.getClassName().equals("产品演示1班")) { + int a = 0; } String sql = "select * from EduClasses where Name = '" + schoolClass.getClassName() + "' and IsDeleted = 0 and majorId = " + system.getOldId(); PreparedStatement ps = connection.prepareStatement(sql); @@ -1013,6 +1019,7 @@ public class TestController { System.out.println("线程结束"); } } + // 将列表分成几组 private List> partitionList(List list, int partitions) { List> result = new ArrayList<>(); @@ -1154,7 +1161,7 @@ public class TestController { Integer applicationId = resultSet.getInt("ApplicationId"); - if (applicationId.equals("-1")) { + if (applicationId.equals("-2")) { continue; } String applicationName = resultSet.getString("name"); @@ -1175,9 +1182,6 @@ public class TestController { if (applicationId == -1) { allocationQuery.setApplicationId(Long.valueOf(-1)); allocationQuery.setName(AccountTypeEnum.BANK_ACCOUNT); - } else if (applicationId == -2) { - allocationQuery.setApplicationId(Long.valueOf(-2)); - allocationQuery.setName(AccountTypeEnum.CASH_ACCOUNT); } else if (applicationId == 4) { allocationQuery.setApplicationId(Long.valueOf(4)); allocationQuery.setName(AccountTypeEnum.P2P_ACCOUNT); @@ -1526,4 +1530,129 @@ public class TestController { } } -} + @ApiOperation("调整用户资产数据") + @PostMapping("adjustUserAssetsData") + public void adjustUserAssetsData() { + List 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 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 students) { + int processedCount = 0; + for (Student student : students) { + processedCount++; + System.out.println(Thread.currentThread().getName() + ":修改用户" + student.getStudentSn() + ",处理到第" + processedCount + "/" + students.size()); + List 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 systems = universitiesCollegesJurisdictionExperimentalSystemService.forexSimulationTradingAuthorizationSchoolDataInterface(); + if (systems != null && systems.size() > 0) { + for (UniversitiesCollegesJurisdictionExperimentalSystem system : systems) { + UniversitiesColleges universitiesColleges = universitiesCollegesService.getById(system.getUniversitiesCollegesId()); + List 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 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>() { + }.getType(); + Map 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); + } + } + } + } +} \ No newline at end of file diff --git a/web/src/main/resources/sql/jlw/student.md b/web/src/main/resources/sql/jlw/student.md index a656ce6c..f90d67c7 100644 --- a/web/src/main/resources/sql/jlw/student.md +++ b/web/src/main/resources/sql/jlw/student.md @@ -2250,4 +2250,13 @@ select * from student where old_id = #oldId# getStudentByStudentNo === -select * from student where student_sn =#studentNo# \ No newline at end of file +select * from student where student_sn =#studentNo# + + +getNoAssetStudent +=== +select student.* +from student join (select count(1) as count1, student_account_asset_allocation.student_id +from student_account_asset_allocation +group by student_account_asset_allocation.student_id) a on student.student_id=a.student_id where a.count1<32 + diff --git a/web/src/main/resources/sql/jlw/studentAccountAssetAllocation.md b/web/src/main/resources/sql/jlw/studentAccountAssetAllocation.md index 99d76dd2..948a9170 100644 --- a/web/src/main/resources/sql/jlw/studentAccountAssetAllocation.md +++ b/web/src/main/resources/sql/jlw/studentAccountAssetAllocation.md @@ -787,4 +787,26 @@ getInfo getInfoByStudentIdAnIsInstitution === -select * from student_account_asset_allocation where student_id=#studentId# and is_institution =1 \ No newline at end of file +select * from student_account_asset_allocation where student_id=#studentId# and is_institution =1 + + +getByStudentAndApplicationIsNotIn +=== +select * +from student_account_asset_allocation +where student_id = 10980 +and (application_id not in (select application_id from student_account_asset_allocation where student_id = #studentId#) or +application_id is null) +and is_institution = 1 + +getMapByStudentIdForForeign +=== +select s.student_name as studentname, +sc.class_name as classname, +sc.class_id classid, +sy.university_system_name as majorname, +s.student_sn studentno +from student s +join school_class sc on s.class_id = sc.class_id +join university_system sy on sc.university_system_id = sy.university_system_id +where student_id =#studentId# \ No newline at end of file diff --git a/web/src/main/resources/sql/jlw/studentAccountForeignExchangeInvestmentSystem.md b/web/src/main/resources/sql/jlw/studentAccountForeignExchangeInvestmentSystem.md index be44ad02..902cf427 100644 --- a/web/src/main/resources/sql/jlw/studentAccountForeignExchangeInvestmentSystem.md +++ b/web/src/main/resources/sql/jlw/studentAccountForeignExchangeInvestmentSystem.md @@ -203,3 +203,7 @@ getValuesByQueryNotWithPermission @if(!isEmpty(orgIdPlural)){ and find_in_set(t.org_id,#orgIdPlural#) @} + +getByStudentId +=== +select * from student_account_foreign_exchange_investment_system where student_id =#studentId# \ No newline at end of file diff --git a/web/src/main/resources/sql/jlw/universitiesCollegesJurisdictionExperimentalSystem.md b/web/src/main/resources/sql/jlw/universitiesCollegesJurisdictionExperimentalSystem.md index 5941a548..8d41eab9 100644 --- a/web/src/main/resources/sql/jlw/universitiesCollegesJurisdictionExperimentalSystem.md +++ b/web/src/main/resources/sql/jlw/universitiesCollegesJurisdictionExperimentalSystem.md @@ -264,4 +264,7 @@ and find_in_set(a.type_id,#typeIds#) @} AND a.use_end_time >= NOW() - + +forexSimulationTradingAuthorizationSchoolDataInterface +=== +select * from universities_colleges_jurisdiction_experimental_system where type_id=113 \ No newline at end of file