From 4c9de9a1fdd9f2c49d6e0ab665afbd58c052d08e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=99=88=E6=B2=85?= <907037276@qq.com>
Date: Fri, 8 Dec 2023 18:53:33 +0800
Subject: [PATCH] =?UTF-8?q?1=E3=80=81swagger=E6=8E=A5=E5=8F=A3=E6=96=87?=
 =?UTF-8?q?=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../ibeetl/admin/core/dao/CoreUserDao.java    |  1 +
 .../admin/core/service/CoreUserService.java   |  4 +
 .../src/main/resources/sql/core/coreUser.md   |  7 +-
 .../com/ibeetl/jlw/web/AccountController.java | 75 +++++++++++++++++++
 4 files changed, 86 insertions(+), 1 deletion(-)

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 12a615f6..5ce7c5eb 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
@@ -56,4 +56,5 @@ public interface CoreUserDao extends BaseMapper<CoreUser> {
     void updateUserId(Long newId, Long oldId);
 
     List<CoreUser> getCoreUserListAndOldIdIsNull();
+    CoreUser getCoreUserByOldId(Long oldId);
 }
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 642d4320..977aa6a9 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
@@ -160,6 +160,10 @@ public class CoreUserService extends CoreBaseService<CoreUser> {
 		return coreUserDao.getCoreUserListAndOldIdIsNull();
 	}
 
+	public CoreUser findByOldId(Long oldId){
+		return coreUserDao.getCoreUserByOldId(oldId);
+	}
+
 	/**
 	 * 验证
 	 * @return
diff --git a/admin-core/src/main/resources/sql/core/coreUser.md b/admin-core/src/main/resources/sql/core/coreUser.md
index 825b7e12..2822e78e 100644
--- a/admin-core/src/main/resources/sql/core/coreUser.md
+++ b/admin-core/src/main/resources/sql/core/coreUser.md
@@ -155,4 +155,9 @@ JOIN core_role ON core_user_role.ROLE_ID = core_role.ID where core_user.CODE = #
 
 getCoreUserListAndOldIdIsNull
 ===
- select * from core_user where old_id is null
\ No newline at end of file
+ select * from core_user where old_id is null
+
+
+getCoreUserByOldId
+===
+select * from core_user where old_id = #oldId#
\ 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 3fe2c7b6..3b51490b 100644
--- a/web/src/main/java/com/ibeetl/jlw/web/AccountController.java
+++ b/web/src/main/java/com/ibeetl/jlw/web/AccountController.java
@@ -952,5 +952,80 @@ public class AccountController {
         return null;
     }
 
+    @ApiOperation("智云2.0接口:修改PEVC资金")
+    @PostMapping("updatePEVCAssetAllocations.json")
+    public JsonResult updatePEVCAssetAllocations(Integer userId, Double amount, Double totalAsset) {
+        if (userId != null) {
+            CoreUser user = userService.findByOldId(Long.valueOf(userId));
+            if (user != null) {
+                Student student = studentService.getByUserId(user.getId());
+                StudentAccountAssetAllocation allocation = studentAccountAssetAllocationService.getByApplicationIdAndStudentId(18L, student.getStudentId());
+                if (allocation != null) {
+                    allocation.setAvailableFunds(BigDecimal.valueOf(amount));
+                    allocation.setTotalAssetsOfSubAccounts(BigDecimal.valueOf(totalAsset));
+                    studentAccountAssetAllocationService.updateTemplate(allocation);
+                }
+            }
+        }
+        return JsonResult.success();
+    }
+
+    @ApiOperation("智云2.0接口:UpdatePevcInvestAmount")
+    @PostMapping("updatePevcInvestAmount.json")
+    public JsonResult updatePevcInvestAmount(Integer userId,
+                                             Double amount,
+                                             Double TotalAsset,
+                                             Double zyInvestAmount,
+                                             Double yxInvestAmount,
+                                             Double lhInvestAmount,
+                                             Double bankInvestAmount) {
+        if (userId != null) {
+            CoreUser user = userService.findByOldId(Long.valueOf(userId));
+            if (user != null) {
+                Student student = studentService.getByUserId(user.getId());
+                List<StudentAccountEquityInvestmentSystem> info = studentAccountEquityInvestmentSystemService.getInfo(student.getStudentId());
+                StudentAccountEquityInvestmentSystem system = info.get(0);
+                system.setTotalCollectAssets(BigDecimal.valueOf(amount));
+                system.setOwnInvestmentAssets(BigDecimal.valueOf(zyInvestAmount));
+                system.setLpInvestmentAssets(BigDecimal.valueOf(yxInvestAmount));
+                system.setGlInvestmentAssets(BigDecimal.valueOf(lhInvestAmount));
+                system.setBankLoanInvestment(BigDecimal.valueOf(bankInvestAmount));
+                studentAccountEquityInvestmentSystemService.updateTemplate(system);
+
+                StudentAccountAssetAllocation allocation = studentAccountAssetAllocationService.getByApplicationIdAndStudentId(18L, student.getStudentId());
+                if (allocation != null) {
+                    allocation.setAvailableFunds(BigDecimal.valueOf(amount));
+                    allocation.setTotalAssetsOfSubAccounts(BigDecimal.valueOf(TotalAsset));
+                    double investAmount = zyInvestAmount + yxInvestAmount + lhInvestAmount + bankInvestAmount;
+                    allocation.setInvestmentFunds(BigDecimal.valueOf(investAmount));
+                    studentAccountAssetAllocationService.updateTemplate(allocation);
+                }
+            }
+        }
+        return JsonResult.success();
+    }
+
+    @ApiOperation("智云2.0接口:GetUserNameByUserId")
+    @GetMapping("getUserNameByUserId")
+    public JsonResult getUserNameByUserId(Integer userId) {
+        if (userId != null) {
+            CoreUser user = userService.findByOldId(Long.valueOf(userId));
+            if (user != null) {
+                return JsonResult.success(user.getName());
+            }
+        }
+        return JsonResult.success();
+    }
 
+    @ApiOperation("智云2.0接口:GetClassNameByClassId")
+    @GetMapping("getClassNameByClassId")
+    public JsonResult getClassNameByClassId(Integer classId) {
+        if (classId != null) {
+            SchoolClass schoolClass = schoolClassService.getByOldId(Long.valueOf(classId));
+            if (schoolClass != null) {
+                return JsonResult.success(schoolClass.getClassName());
+            }
+        }
+        return JsonResult.success();
+    }
 }