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 9f774b7c..1841664e 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 @@ -89,4 +89,6 @@ public interface CoreUserDao extends BaseMapper { List> getUsersBySchoolId(Long schoolId); MapgetUserInfoByUsername(String username); + + List>getUserInfosByUsername(); } 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 351dba5b..8a9e4433 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 @@ -417,4 +417,8 @@ public class CoreUserService extends CoreBaseService { public Map getUserInfoByUsername(String username) { return coreUserDao.getUserInfoByUsername(username); } + + public List> getUserInfosByUsername() { + return coreUserDao.getUserInfosByUsername(); + } } diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/util/user/ZYUserInfo.java b/admin-core/src/main/java/com/ibeetl/admin/core/util/user/ZYUserInfo.java index 5f2d25ea..e2f2bfe2 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/util/user/ZYUserInfo.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/util/user/ZYUserInfo.java @@ -164,7 +164,7 @@ public class ZYUserInfo { this.roleId = Integer.valueOf(map.get("roleid").toString()) ; this.schoolId = Integer.valueOf(map.get("schoolid").toString()); this.schoolName = (String) map.get("schoolname"); - this.classId = Integer.valueOf( map.get("classid").toString()); + this.classId =map.get("classid")==null?0: Integer.valueOf( map.get("classid").toString()); this.className = (String) map.get("classname"); this.phone = (String) map.get("phone"); this.collegeId = (Long) map.get("collegeid"); diff --git a/admin-core/src/main/resources/sql/core/coreUser.md b/admin-core/src/main/resources/sql/core/coreUser.md index f5231254..85e771a1 100644 --- a/admin-core/src/main/resources/sql/core/coreUser.md +++ b/admin-core/src/main/resources/sql/core/coreUser.md @@ -280,4 +280,35 @@ left join university_system us on t.university_system_id = us.university_system_ left join university_system us1 on sc.university_system_id = us1.university_system_id left join core_user_role cur on cu.ID = cur.USER_ID where cu.CODE = #username# -and cur.ROLE_ID in (192, 194) \ No newline at end of file +and cur.ROLE_ID in (192, 194) + + +getUserInfosByUsername +=== +select cu.CODE as username, +cu.PASSWORD as password, +IF(s.student_name IS NULL, t.teacher_name, s.student_name) as name, +cu.old_id as userId, +if(cur.ROLE_ID = 192, 4, 3) as roleId, +uc.old_school_id as schoolId, +uc.universities_colleges_name as schoolName, +sc.old_class_id as classId, +sc.class_name as className, +IF(s.student_mobile IS NULL, t.teacher_mobile, s.student_mobile) as phone, +IF(uf.old_id is null, uf1.old_id, uf.old_id) as collegeId, +IF(uf.university_faculty_name is null, uf1.university_faculty_name, uf.university_faculty_name) as collegeName, +IF(us.old_id is null, us1.old_id, us.old_id) as majorId, +IF(us.university_system_name is null, us1.university_system_name, us.university_system_name) as majorName, +s.old_id as studentId, +t.old_id as teacherId +from core_user cu +join universities_colleges uc on cu.ORG_ID = uc.org_id +left join student s on cu.ID = s.user_id +left join teacher t on cu.ID = t.user_id +left join school_class sc on s.class_id = sc.class_id +left join university_faculty uf on t.university_faculty_id = uf.university_faculty_id +left join university_faculty uf1 on sc.university_faculty_id = uf1.university_faculty_id +left join university_system us on t.university_system_id = us.university_system_id +left join university_system us1 on sc.university_system_id = us1.university_system_id +left join core_user_role cur on cu.ID = cur.USER_ID +where cur.ROLE_ID in (192, 194) \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/util/SubsystemUserUtil.java b/web/src/main/java/com/ibeetl/jlw/util/SubsystemUserUtil.java index 75fbc447..baced0b4 100644 --- a/web/src/main/java/com/ibeetl/jlw/util/SubsystemUserUtil.java +++ b/web/src/main/java/com/ibeetl/jlw/util/SubsystemUserUtil.java @@ -9,10 +9,9 @@ import org.springframework.beans.factory.annotation.Value; import java.util.List; public class SubsystemUserUtil { - @Value("${PEVC_USER_INSERT_API_URL}") - private static String pevcUserInsertApiUrl; - @Value("${MNJY_USER_INSERT_API_URL}") - private static String mnjyUserInsertApiUrl; + private static final String PEVC_USER_INSERT_API_URL="http://120.79.161.177:8029/account/saveNewUsersFromZhiyunPlatform"; + private static final String MNJY_USER_INSERT_API_URL="http://120.79.161.177:8091/account/saveNewUsersFromZhiyunPlatform"; + public static void subsystemUserCreate(List zyUserInfos, List applications) throws JsonProcessingException { if (zyUserInfos != null && zyUserInfos.size() > 0) { @@ -20,11 +19,11 @@ public class SubsystemUserUtil { String json = objectMapper.writeValueAsString(zyUserInfos); if (applications.contains(SubsystemName.INVESTMENT_BANK.getText())) { //PEVC系统新增用户信息 - HttpUtil.sendPostRequest(pevcUserInsertApiUrl, json, "application/json"); + HttpUtil.sendPostRequest(PEVC_USER_INSERT_API_URL, json, "application/json"); } if (applications.contains(SubsystemName.SECURITIES_TRADING.getText())) { //MNJY系统新增用户信息 - HttpUtil.sendPostRequest(mnjyUserInsertApiUrl, json, "application/json"); + HttpUtil.sendPostRequest(MNJY_USER_INSERT_API_URL, json, "application/json"); } } 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 ae7f0272..9b3d91af 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/AccountController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/AccountController.java @@ -1398,20 +1398,34 @@ public class AccountController { @PostMapping("test1") public void test() throws JsonProcessingException { + List> infos = coreUserService.getUserInfosByUsername(); + List zyUserInfos = new ArrayList<>(); + for(Map map: infos){ + ZYUserInfo zyUserInfo = new ZYUserInfo(map); + zyUserInfos.add(zyUserInfo); + } + // 计算每个子列表的大小 + int totalSize = zyUserInfos.size(); + int sublistSize = (int) Math.ceil((double) totalSize / 15000); // 向上取整确保每个子列表都有元素 - Map map = coreUserService.getUserInfoByUsername("tzs001"); - Map map1 = coreUserService.getUserInfoByUsername("tzs006"); - ZYUserInfo info = new ZYUserInfo(map); - ZYUserInfo info1 = new ZYUserInfo(map1); - List userInfoList = new ArrayList<>(); - userInfoList.add(info); - userInfoList.add(info1); - ObjectMapper objectMapper = new ObjectMapper(); - String json = objectMapper.writeValueAsString(userInfoList); -// HttpUtil.sendPostRequest("http://localhost:61814/account/saveNewUsersFromZhiyunPlatform", json,"application/json"); - HttpUtil.sendPostRequest("http://localhost:61759/account/saveNewUsersFromZhiyunPlatform", json,"application/json"); -// String request = HttpUtil.sendPostRequest("http://118.31.7.2:8800/account/checkOrCreateForexSimulationUser", json, "application/json"); - int a = 0; + // 分割列表为 8 个子列表 + List> partitions = new ArrayList<>(); + for (int i = 0; i < totalSize; i += sublistSize) { + int end = Math.min(i + sublistSize, totalSize); + List sublist = zyUserInfos.subList(i, end); + partitions.add(sublist); + } + + // 遍历每个子列表并调用方法 + for (List sublist : partitions) { + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(sublist); + + + HttpUtil.sendPostRequest("http://localhost:61814/account/saveNewUsersFromZhiyunPlatform", json, "application/json"); + HttpUtil.sendPostRequest("http://localhost:61759/account/saveNewUsersFromZhiyunPlatform", json, "application/json"); + + } } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/StudentController.java b/web/src/main/java/com/ibeetl/jlw/web/StudentController.java index dc892090..69f92d81 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/StudentController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/StudentController.java @@ -2311,13 +2311,17 @@ public class StudentController extends BaseController { return JsonResult.failMessage(result); } else { student.setCodeFrom("后台新增"); - Long schoolId = student.getSchoolClass().getUniversitiesCollegesId(); + JsonResult jsonResult = studentService.add(student); + SchoolClassQuery query = new SchoolClassQuery(); + query.setClassId(student.getClassId()); + SchoolClass schoolClass = schoolClassService.getValuesByQuery(query).get(0); + Long schoolId = schoolClass.getUniversitiesCollegesId(); ZYUserInfo info = new ZYUserInfo( coreUserService.getUserInfoByUsername(student.getStudentSn())); List applications = universitiesCollegesJurisdictionExperimentalSystemService.getAllApplicationIdBySchoolId(schoolId); - SubsystemUserUtil.subsystemUserCreate(Arrays.asList(info),applications); - return studentService.add(student); + SubsystemUserUtil.subsystemUserCreate(Arrays.asList(info), applications); + return jsonResult; } } @@ -3119,7 +3123,10 @@ public class StudentController extends BaseController { Assert.isTrue(CollectionUtil.isEmpty(listener.getFailMessage()), JSONUtil.toJsonStr(listener.getFailMessage())); List zyUserInfos = new ArrayList<>(); - Long schoolId = list.get(0).getSchoolClass().getUniversitiesCollegesId(); + SchoolClassQuery query = new SchoolClassQuery(); + query.setClassId(list.get(0).getClassId()); + SchoolClass schoolClass = schoolClassService.getValuesByQuery(query).get(0); + Long schoolId = schoolClass.getUniversitiesCollegesId(); for (Student student : list) { studentService.add(student); zyUserInfos.add(new @@ -3128,7 +3135,7 @@ public class StudentController extends BaseController { )); } List applications = universitiesCollegesJurisdictionExperimentalSystemService.getAllApplicationIdBySchoolId(schoolId); - SubsystemUserUtil.subsystemUserCreate(zyUserInfos,applications); + SubsystemUserUtil.subsystemUserCreate(zyUserInfos, applications); platformService.clearDictCache(); } catch (IllegalArgumentException exception) { return JsonResult.failMessage(exception.getMessage()).setCode(DIY_ERROR.getCode()); diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherController.java index 65914492..3caeca12 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherController.java @@ -13,19 +13,23 @@ import cn.jlw.util.ToolUtils; import cn.jlw.util.excel.ExcelUtil; import cn.jlw.util.excel.listener.MyValidateExcelCellDataListener; import cn.jlw.validate.ValidateConfig; +import com.fasterxml.jackson.core.JsonProcessingException; import com.ibeetl.admin.core.annotation.Function; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.file.FileService; import com.ibeetl.admin.core.service.CorePlatformService; +import com.ibeetl.admin.core.service.CoreUserService; import com.ibeetl.admin.core.util.BeanCopyUtil; import com.ibeetl.admin.core.util.PlatformException; import com.ibeetl.admin.core.util.TimeTool; +import com.ibeetl.admin.core.util.user.ZYUserInfo; import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.jlw.dao.UniversitiesCollegesDao; import com.ibeetl.jlw.entity.*; import com.ibeetl.jlw.entity.dto.TeacherBatchImportAdminDTO; import com.ibeetl.jlw.entity.dto.TeacherBatchImportUniAdminDTO; import com.ibeetl.jlw.service.*; +import com.ibeetl.jlw.util.SubsystemUserUtil; import com.ibeetl.jlw.web.query.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -148,6 +152,10 @@ public class TeacherController extends BaseController { @Autowired FileService fileService; + @Autowired + private CoreUserService coreUserService; + @Autowired + private UniversitiesCollegesJurisdictionExperimentalSystemService universitiesCollegesJurisdictionExperimentalSystemService; /* 前端接口 */ @@ -1104,6 +1112,7 @@ public class TeacherController extends BaseController { if (result.hasErrors()) { return JsonResult.failMessage(result); } else { + Long schoolId = 0L; if (null == teacher.getUniversitiesCollegesId()) { UniversitiesColleges universitiesColleges = new UniversitiesColleges(); universitiesColleges.setOrgId(coreUser.getOrgId()); @@ -1112,12 +1121,26 @@ public class TeacherController extends BaseController { universitiesColleges = universitiesCollegesList.get(0); teacher.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId()); teacher.setOrgId(universitiesColleges.getOrgId()); + schoolId = universitiesColleges.getUniversitiesCollegesId(); } } else { UniversitiesColleges universitiesColleges = universitiesCollegesService.queryById(teacher.getUniversitiesCollegesId()); teacher.setOrgId(universitiesColleges.getOrgId()); + schoolId=universitiesColleges.getUniversitiesCollegesId(); + } + + + JsonResult jsonResult = teacherService.add(teacher); + ZYUserInfo info = new + ZYUserInfo( + coreUserService.getUserInfoByUsername(teacher.getTeacherJobNumber())); + List applications = universitiesCollegesJurisdictionExperimentalSystemService.getAllApplicationIdBySchoolId(schoolId); + try { + SubsystemUserUtil.subsystemUserCreate(Arrays.asList(info), applications); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); } - return teacherService.add(teacher); + return jsonResult; } }