bug修改

beetlsql3-dev
chenyuan 12 months ago
parent c13a10087c
commit e1a931f618

@ -84,4 +84,7 @@ public interface CoreUserDao extends BaseMapper<CoreUser> {
List<CoreUser> findAll();
void deleteById1(Long userId);
List<Map<String,Object>> getUsersBySchoolId(Long schoolId);
}

@ -407,4 +407,9 @@ public class CoreUserService extends CoreBaseService<CoreUser> {
public void deleteById1(Long userId) {
sqlManager.deleteById(CoreUser.class, userId);
}
public List<Map<String,Object>> getUsersBySchoolId(Long schoolId){
return coreUserDao.getUsersBySchoolId(schoolId);
}
}

@ -250,3 +250,7 @@ findAll
deleteById1
===
delete from core_user where ID = #userId#
getUsersBySchoolId
===
select

@ -35,4 +35,8 @@ public interface StudentAccountAssetAllocationDao extends BaseMapper<StudentAcco
List<StudentAccountAssetAllocation> getInfo(Long studentId);
List<StudentAccountAssetAllocation> getInfoByStudentIdAnIsInstitution(Long studentId);
List<StudentAccountAssetAllocation> getByStudentAndApplicationIsNotIn(Long studentId);
Map<String,Object> getMapByStudentIdForForeign(Long studentId);
}

@ -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<StudentAccountP2pSystem> {
PageQuery<StudentAccountP2pSystem> queryByCondition(PageQuery query);
public interface StudentAccountForeignExchangeInvestmentSystemDao extends BaseMapper<StudentAccountForeignExchangeInvestmentSystem> {
PageQuery<StudentAccountForeignExchangeInvestmentSystem> queryByCondition(PageQuery query);
List<StudentAccountP2pSystem> getValuesByQueryNotWithPermission(StudentAccountP2pSystemQuery studentAccountP2pSystemQuery);
List<StudentAccountForeignExchangeInvestmentSystem> getValuesByQueryNotWithPermission(StudentAccountForeignExchangeInvestmentSystem system);
StudentAccountForeignExchangeInvestmentSystem getByStudentId(Long studentId);
}

@ -137,4 +137,9 @@ public interface StudentDao extends BaseMapper<Student>{
Student getByOldId(Long oldId);
Student getStudentByStudentNo(String studentNo);
List<Student> getNoAssetStudent();
Map<String,Object> getMapByStudentIdForForeign(Long studentId);
}

@ -51,4 +51,6 @@ public interface UniversitiesCollegesJurisdictionExperimentalSystemDao extends B
* @return
*/
List<UniversitiesCollegesJurisdictionExperimentalSystem> getNotExpireApply( @Param("orgId") Long orgId , @Param("typeId") String typeIds);
List<UniversitiesCollegesJurisdictionExperimentalSystem>forexSimulationTradingAuthorizationSchoolDataInterface();
}

@ -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 ;
}

@ -39,7 +39,7 @@ import org.beetl.sql.annotation.entity.EnumValue;
public enum AccountTypeEnum {
/**现金账户*/
CASH_ACCOUNT("现金账户"),
// CASH_ACCOUNT("现金账户"),
/**银行账户*/
BANK_ACCOUNT("银行账户"),

@ -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<Studen
private ResourcesApplicationCourseService resourcesApplicationCourseService;
@Autowired
private CourseInfoService courseInfoService;
@Autowired
private UniversitiesCollegesDao universitiesCollegesDao;
@ -95,7 +98,8 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
private StudentAccountEquityInvestmentSystemService studentAccountEquityInvestmentSystemService;
@Autowired
private StudentAccountMockTradingSystemService studentAccountMockTradingSystemService;
@Autowired
private StudentAccountForeignExchangeInvestmentSystemService studentAccountForeignExchangeInvestmentSystemService;
private final static String URL = "jdbc:sqlserver://120.79.161.177:1433;databaseName=Test.Zhiyun_v2.0;trustServerCertificate=true;encrypt=true";
public PageQuery<StudentAccountAssetAllocation> queryByCondition(PageQuery query) {
@ -103,6 +107,7 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
queryListAfter(ret.getList());
return ret;
}
private final static String USER = "sa";
public void deleteByList(List list) {
@ -296,6 +301,7 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
return payload;
}
private final static String PASSWORD = "sztzjy@2017";
/**
@ -384,15 +390,15 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
if (ObjectUtil.equals(state, 2)) {
if(accountAssetAllocation!=null){
accountAssetAllocation.setInitialCapital(accountAssetAllocation.getInitialCapital()==null?new BigDecimal(0):accountAssetAllocation.getInitialCapital());
accountAssetAllocation.setAvailableFunds(accountAssetAllocation.getAvailableFunds()==null?new BigDecimal(0):accountAssetAllocation.getAvailableFunds());
accountAssetAllocation.setInitialInvestmentCapital(accountAssetAllocation.getInitialInvestmentCapital()==null?new BigDecimal(0):accountAssetAllocation.getInitialInvestmentCapital());
accountAssetAllocation.setInitialCapital(Objects.equals(accountAssetAllocation.getInitialCapital().compareTo(BigDecimal.ZERO), 0) ? new BigDecimal(1000000) : accountAssetAllocation.getInitialCapital());
accountAssetAllocation.setAvailableFunds(Objects.equals(accountAssetAllocation.getAvailableFunds().compareTo(BigDecimal.ZERO), 0) ? new BigDecimal(1000000) : accountAssetAllocation.getAvailableFunds());
accountAssetAllocation.setInitialInvestmentCapital(Objects.equals(accountAssetAllocation.getInitialInvestmentCapital().compareTo(BigDecimal.ZERO), 0) ? new BigDecimal(1000000) : accountAssetAllocation.getInitialInvestmentCapital());
accountAssetAllocation.setUpdateTime(new Date());
}
if (accountAssetAllocation != null) {
accountAssetAllocation.setInitialCapital(accountAssetAllocation.getInitialCapital() == null ? new BigDecimal(0) : accountAssetAllocation.getInitialCapital());
accountAssetAllocation.setAvailableFunds(accountAssetAllocation.getAvailableFunds() == null ? new BigDecimal(0) : accountAssetAllocation.getAvailableFunds());
accountAssetAllocation.setInitialInvestmentCapital(accountAssetAllocation.getInitialInvestmentCapital() == null ? new BigDecimal(0) : accountAssetAllocation.getInitialInvestmentCapital());
accountAssetAllocation.setInitialCapital(Objects.equals(accountAssetAllocation.getInitialCapital().compareTo(BigDecimal.ZERO), 0) ? new BigDecimal(1000000) : accountAssetAllocation.getInitialCapital());
accountAssetAllocation.setAvailableFunds(Objects.equals(accountAssetAllocation.getAvailableFunds().compareTo(BigDecimal.ZERO), 0) ? new BigDecimal(1000000) : accountAssetAllocation.getAvailableFunds());
accountAssetAllocation.setInitialInvestmentCapital(Objects.equals(accountAssetAllocation.getInitialInvestmentCapital().compareTo(BigDecimal.ZERO), 0) ? new BigDecimal(1000000) : accountAssetAllocation.getInitialInvestmentCapital());
accountAssetAllocation.setUpdateTime(new Date());
}
}
if (!ObjectUtil.equals(accountAssetAllocation.getApplicationId(), -1L) &&
@ -426,6 +432,7 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
studentAccountAssetAllocationDao.updateById(accountAssetAllocation);
}
}
@Autowired
private CoreUserService coreUserService;
@ -533,14 +540,13 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
}
if (ObjectUtil.equals(values[i].getText(), AccountTypeEnum.BANK_ACCOUNT.getText())) {
allocation.setState(2);
allocation.setApplicationId(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.BANK_ACCOUNT.getText()) ? -2L : -1L);
allocation.setInitialCapital(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.BANK_ACCOUNT.getText()) ?
new BigDecimal(2000000) : BigDecimal.ZERO);
allocation.setAvailableFunds(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.BANK_ACCOUNT.getText()) ?
new BigDecimal(2000000) : BigDecimal.ZERO);
allocation.setInitialInvestmentCapital(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.BANK_ACCOUNT.getText()) ?
new BigDecimal(2000000) : BigDecimal.ZERO);
allocation.setApplicationId(ObjectUtil.equals(values[i].getText(), AccountTypeEnum.BANK_ACCOUNT.getText()) ? -1L : -2L);
allocation.setInitialCapital(
new BigDecimal(2000000));
allocation.setAvailableFunds(
new BigDecimal(2000000));
allocation.setInitialInvestmentCapital(
new BigDecimal(2000000));
} else {
if (ObjectUtil.isNotNull(query.getApplicationSecondLevelRelation())) {
List<ResourcesApplication> applications = resourcesApplicationDao.getValuesByQuery(query);
@ -579,14 +585,14 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
} else if (values[i].getText().equals(AccountTypeEnum.INSURANCE_ACCOUNT.getText())) {
money = 2000000D;
}
allocation.setInitialCapital(CollectionUtil.isNotEmpty(experimentalSystems) ?
new BigDecimal(money) : BigDecimal.ZERO);
allocation.setAvailableFunds(CollectionUtil.isNotEmpty(experimentalSystems) ?
new BigDecimal(money) : BigDecimal.ZERO);
allocation.setInitialInvestmentCapital(CollectionUtil.isNotEmpty(experimentalSystems) ?
new BigDecimal(money) : BigDecimal.ZERO);
allocation.setTotalAssetsOfSubAccounts(CollectionUtil.isNotEmpty(experimentalSystems) ?
new BigDecimal(money) : BigDecimal.ZERO);
allocation.setInitialCapital(
new BigDecimal(money));
allocation.setAvailableFunds(
new BigDecimal(money));
allocation.setInitialInvestmentCapital(
new BigDecimal(money));
allocation.setTotalAssetsOfSubAccounts(
new BigDecimal(money));
}
}
}
@ -676,6 +682,44 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
investmentSystem.setUserId(allocation.getUserId());
studentAccountEquityInvestmentSystemService.add(investmentSystem);
createBaseAccount(investmentSystem.getApplicationId(), oldUserId, 2000000D);
} else if (allocation.getApplicationId() == 113 && j == 1) {
Map<String, Object> 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<Map<String, Object>>() {
}.getType();
Map<String, Object> 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<Studen
"[CreatorUserId]) VALUES (" + applicationId + ", " + initialCapital + ", " + initialCapital + ", " + initialCapital + ", " + initialCapital + ", 0, 0, 0, 0, 0, " +
"0, 0, 0, 0, " + oldUserId + ", " +
"'0', NULL, NULL, NULL, NULL, '" + formattedDate + "', " + oldUserId + ")";
String sql1 = "INSERT INTO [dbo].[P2PAccount]([UserId], [Balance], [IsDeleted], [DeleterUserId], " +
"[DeletionTime], [LastModificationTime], [LastModifierUserId], [CreationTime], " +
"[CreatorUserId], [TotalInvestmentIncome]) VALUES ("+oldUserId+", "+initialCapital+", '0', NULL, NULL, " +
"'"+formattedDate+"', NULL, '"+formattedDate+"', "+oldUserId+", 0)";
String sql1 = "INSERT INTO [dbo].[P2PAccount]([UserId], [Balance], [IsDeleted], [DeleterUserId], " +
"[DeletionTime], [LastModificationTime], [LastModifierUserId], [CreationTime], " +
"[CreatorUserId], [TotalInvestmentIncome]) VALUES (" + oldUserId + ", " + initialCapital + ", '0', NULL, NULL, " +
"'" + formattedDate + "', NULL, '" + formattedDate + "', " + oldUserId + ", 0)";
runJdbc(sql1);
} else if (applicationId == 5L) {
sql = "INSERT INTO [dbo].[ExaTheRaiseAssetAllocation]([ApplicationId], [InitialCapital], [InitialInvestmentCapital], " +
@ -715,8 +759,8 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
"NULL, NULL, NULL, NULL, '" + formattedDate + "', " + oldUserId + ")";
String sql1 = "INSERT INTO [dbo].[CFAccount]([UserId], [TotalInvestmentIncome], [Balance], " +
"[IsDeleted], [DeleterUserId], [DeletionTime], [LastModificationTime], [LastModifierUserId], " +
"[CreationTime], [CreatorUserId]) VALUES ( "+oldUserId+", .00, "+initialCapital+", '0', NULL, NULL, '"+formattedDate+"', " +
"NULL, '"+formattedDate+"', NULL)";
"[CreationTime], [CreatorUserId]) VALUES ( " + oldUserId + ", .00, " + initialCapital + ", '0', NULL, NULL, '" + formattedDate + "', " +
"NULL, '" + formattedDate + "', NULL)";
runJdbc(sql1);
} else if (applicationId == 16L || applicationId == -16L) {
Integer secType;
@ -858,9 +902,9 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
allocation.getInitialInvestmentCapital(), allocation.getInitialInvestmentCapital(), studentId);
String sql = "update ExaPEVCAssetAllocation set FreeMoney =" + allocation.getAvailableFunds()
+ " where UserId = " + coreUser.getOldId() + "";
try{
try {
runJdbc(sql);
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
@ -1088,5 +1132,14 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
return courseInfoService.getByIds(courseInfoIds);
}
//查询对应用户缺的数据
public List<StudentAccountAssetAllocation> getByStudentAndApplicationIsNotIn(Long studentId) {
return studentAccountAssetAllocationDao.getByStudentAndApplicationIsNotIn(studentId);
}
public Map<String, Object> getMapByStudentIdForForeign(Long studentId) {
return studentAccountAssetAllocationDao.getMapByStudentIdForForeign(studentId);
}
}

@ -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<StudentAccountForeignExchangeInvestmentSystem> {
@Autowired
private StudentAccountForeignExchangeInvestmentSystemDao studentAccountForeignExchangeInvestmentSystemDao;
public void add(StudentAccountForeignExchangeInvestmentSystem system) {
studentAccountForeignExchangeInvestmentSystemDao.insert(system);
}
public StudentAccountForeignExchangeInvestmentSystem getByStudentId(Long studentId){
return studentAccountForeignExchangeInvestmentSystemDao.getByStudentId(studentId);
}
}

@ -1792,4 +1792,12 @@ public class StudentService extends CoreBaseService<Student> {
public void deleteById1(Long studentId) {
sqlManager.deleteById(Student.class, studentId);
}
//查询资产数据没有32条的数据
public List<Student> getNoAssetStudent() {
return studentDao.getNoAssetStudent();
}
public Map<String,Object> getMapByStudentIdForForeign(Long studentId){
return studentDao.getMapByStudentIdForForeign(studentId);
}
}

@ -187,4 +187,9 @@ public class UniversitiesCollegesJurisdictionExperimentalSystemService extends C
public List<UniversitiesCollegesJurisdictionExperimentalSystem> getAllOverdueAuthByBeforeAndAfterDays(Long beforeDays, Long afterDays, Long orgId) {
return universitiesCollegesJurisdictionExperimentalSystemDao.getAllOverdueAuthByBeforeAndAfterDays(beforeDays, afterDays, orgId);
}
//查询授权了外汇模拟交易的学校数据
public List<UniversitiesCollegesJurisdictionExperimentalSystem> forexSimulationTradingAuthorizationSchoolDataInterface(){
return universitiesCollegesJurisdictionExperimentalSystemDao.forexSimulationTradingAuthorizationSchoolDataInterface();
}
}

@ -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<List<Map<String, Object>>> getUsersBySchoolId(Long schoolId){
return JsonResult.success(userService.getUsersBySchoolId(schoolId));
}
}

@ -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<List<Student>> partitionList(List<Student> list, int partitions) {
List<List<Student>> 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<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);
}
}
}
}
}

@ -2251,3 +2251,12 @@ select * from student where old_id = #oldId#
getStudentByStudentNo
===
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

@ -788,3 +788,25 @@ getInfo
getInfoByStudentIdAnIsInstitution
===
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#

@ -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#

@ -265,3 +265,6 @@ 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
Loading…
Cancel
Save