diff --git a/web/src/main/java/com/ibeetl/jlw/service/api/student/ApiStudentService.java b/web/src/main/java/com/ibeetl/jlw/service/api/student/ApiStudentService.java index e5ddc0ce..811e2d54 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/api/student/ApiStudentService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/api/student/ApiStudentService.java @@ -36,7 +36,7 @@ import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser; /** *

- * 学生端-API接口 + * 学生端-API接口 *

* * @author mlx @@ -47,20 +47,32 @@ import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser; @Validated public class ApiStudentService { - @Autowired private ApiIndexBaseService apiIndexBaseService; - @Autowired private TeacherOpenCourseNoticeService teacherOpenCourseNoticeService; - @Autowired private StudentService studentService; - @Autowired private StudentDao studentDao; - @Autowired private ResourcesApplicationService resourcesApplicationService; - @Autowired private TeacherOpenCourseMergeStudentDao teacherOpenCourseMergeStudentDao; - @Autowired private UniversitiesCollegesService universitiesCollegesService; - @Autowired private PasswordConfig.PasswordEncryptService passwordEncryptService; - @Autowired private CoreUserService coreUserService; + @Autowired + private ApiIndexBaseService apiIndexBaseService; + @Autowired + private TeacherOpenCourseNoticeService teacherOpenCourseNoticeService; + @Autowired + private StudentService studentService; + @Autowired + private StudentDao studentDao; + @Autowired + private StudentAccountAssetAllocationService studentAccountAssetAllocationService; + @Autowired + private ResourcesApplicationService resourcesApplicationService; + @Autowired + private TeacherOpenCourseMergeStudentDao teacherOpenCourseMergeStudentDao; + @Autowired + private UniversitiesCollegesService universitiesCollegesService; + @Autowired + private PasswordConfig.PasswordEncryptService passwordEncryptService; + @Autowired + private CoreUserService coreUserService; @Autowired private SysLogService sysLogService; /** - * 教师端-首页数据 + * 学生端-首页数据 + * * @return */ public StudentIndexData index() { @@ -97,36 +109,52 @@ public class ApiStudentService { //饼状图数据 //todo 查询数据库 - // + List studentAccountAssetAllocations = studentAccountAssetAllocationService.getInfoByStudentId(studentId); List> pieMaps = new ArrayList<>(); - Map map1 = new HashMap<>(); - map1.put("name", "现金账户"); - map1.put("value", 835000); - Map map2 = new HashMap<>(); - map2.put("name", "银行账户"); - map2.put("value", 572924); - Map map3 = new HashMap<>(); - map3.put("name", "P2P账户"); - map3.put("value", 150370); - Map map4 = new HashMap<>(); - map4.put("name", "众筹账户"); - map4.put("value", 558499); - Map map5 = new HashMap<>(); - map5.put("name", "股票基金投资账户"); - map5.put("value", 1118689); - Map map6 = new HashMap<>(); - map6.put("name", "期货投资账户"); - map6.put("value", 247149); - Map map7 = new HashMap<>(); - map7.put("name", "期权投资账户"); - map7.put("value", 5038001); - pieMaps.add(map1); - pieMaps.add(map2); - pieMaps.add(map3); - pieMaps.add(map4); - pieMaps.add(map5); - pieMaps.add(map6); - pieMaps.add(map7); + for (StudentAccountAssetAllocation allocation : studentAccountAssetAllocations) { + if (allocation.getName().getText().equals("现金账户")) { + continue; + } + Map map = new HashMap<>(); + if (allocation.getName().getText().equals("银行账户")) { + map.put("name", allocation.getName().getText()); + map.put("value", allocation.getAvailableFunds()); + } else { + if (allocation.getName().getText().equals("P2P账户")) { + map.put("name", "网络融资账户"); + map.put("value", allocation.getTotalAssetsOfSubAccounts()); + } else { + map.put("name", allocation.getName().getText()); + map.put("value", allocation.getTotalAssetsOfSubAccounts()); + } + } + pieMaps.add(map); + } + +// Map map2 = new HashMap<>(); +// map2.put("name", "银行账户"); +// map2.put("value", 572924); +// Map map3 = new HashMap<>(); +// map3.put("name", "P2P账户"); +// map3.put("value", 150370); +// Map map4 = new HashMap<>(); +// map4.put("name", "众筹账户"); +// map4.put("value", 558499); +// Map map5 = new HashMap<>(); +// map5.put("name", "股票基金投资账户"); +// map5.put("value", 1118689); +// Map map6 = new HashMap<>(); +// map6.put("name", "期货投资账户"); +// map6.put("value", 247149); +// Map map7 = new HashMap<>(); +// map7.put("name", "期权投资账户"); +// map7.put("value", 5038001); +// pieMaps.add(map2); +// pieMaps.add(map3); +// pieMaps.add(map4); +// pieMaps.add(map5); +// pieMaps.add(map6); +// pieMaps.add(map7); //我的收益率 Map lineMap = new HashMap<>(); List xList = new ArrayList<>(); @@ -156,8 +184,8 @@ public class ApiStudentService { yList2.add("135"); yLists.add(yList1); yLists.add(yList2); - lineMap.put("xList" , xList); - lineMap.put("yList" , yLists); + lineMap.put("xList", xList); + lineMap.put("yList", yLists); return StudentIndexData.builder() .noticeList(noticeList) @@ -170,10 +198,11 @@ public class ApiStudentService { /** * 学生端-注册 + * * @param dto * @return */ - public void register(@NotNull(message="学生注册信息不能为空!") StudentRegisterDTO dto) { + public void register(@NotNull(message = "学生注册信息不能为空!") StudentRegisterDTO dto) { // 传入的院校ID final Long universitiesCollegesId = dto.getUniversitiesCollegesId(); @@ -187,6 +216,7 @@ public class ApiStudentService { /** * 学生端-独有的修改密码 + * * @param dto */ public void editPwd(@NotNull(message = "修改密码信息不能为空!") StudentEditPasswordDTO dto) { @@ -220,12 +250,13 @@ public class ApiStudentService { // 根据旧密码修改新密码 // Boolean updateSuccess = coreUserService.editPwdByOld(dto.getOldPwd(), dto.getNewPwd(), studentInfo.getUserId()); - Boolean updateSuccess = coreUserService.editPwdByOldNotVerify( dto.getNewPwd(), studentInfo.getUserId()); + Boolean updateSuccess = coreUserService.editPwdByOldNotVerify(dto.getNewPwd(), studentInfo.getUserId()); Assert.isTrue(updateSuccess, "密码修改失败!"); } /** * 学生活跃度信息 + * * @return */ public StudentActiveInfo studentActiveInfo() {