新增子系统用户

beetlsql3-dev
chenyuan 11 months ago
parent c4d773e9f5
commit 6cda6499be

@ -89,4 +89,6 @@ public interface CoreUserDao extends BaseMapper<CoreUser> {
List<Map<String,Object>> getUsersBySchoolId(Long schoolId);
Map<String,Object>getUserInfoByUsername(String username);
List<Map<String,Object>>getUserInfosByUsername();
}

@ -417,4 +417,8 @@ public class CoreUserService extends CoreBaseService<CoreUser> {
public Map<String, Object> getUserInfoByUsername(String username) {
return coreUserDao.getUserInfoByUsername(username);
}
public List<Map<String, Object>> getUserInfosByUsername() {
return coreUserDao.getUserInfosByUsername();
}
}

@ -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");

@ -281,3 +281,34 @@ left join university_system us1 on sc.university_system_id = us1.university_syst
left join core_user_role cur on cu.ID = cur.USER_ID
where cu.CODE = #username#
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)

@ -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<ZYUserInfo> zyUserInfos, List<String> 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");
}
}

@ -1398,20 +1398,34 @@ public class AccountController {
@PostMapping("test1")
public void test() throws JsonProcessingException {
List<Map<String, Object>> infos = coreUserService.getUserInfosByUsername();
List<ZYUserInfo> zyUserInfos = new ArrayList<>();
for(Map<String, Object> map: infos){
ZYUserInfo zyUserInfo = new ZYUserInfo(map);
zyUserInfos.add(zyUserInfo);
}
// 计算每个子列表的大小
int totalSize = zyUserInfos.size();
int sublistSize = (int) Math.ceil((double) totalSize / 15000); // 向上取整确保每个子列表都有元素
// 分割列表为 8 个子列表
List<List<ZYUserInfo>> partitions = new ArrayList<>();
for (int i = 0; i < totalSize; i += sublistSize) {
int end = Math.min(i + sublistSize, totalSize);
List<ZYUserInfo> sublist = zyUserInfos.subList(i, end);
partitions.add(sublist);
}
Map<String, Object> map = coreUserService.getUserInfoByUsername("tzs001");
Map<String, Object> map1 = coreUserService.getUserInfoByUsername("tzs006");
ZYUserInfo info = new ZYUserInfo(map);
ZYUserInfo info1 = new ZYUserInfo(map1);
List<ZYUserInfo> userInfoList = new ArrayList<>();
userInfoList.add(info);
userInfoList.add(info1);
// 遍历每个子列表并调用方法
for (List<ZYUserInfo> sublist : partitions) {
ObjectMapper objectMapper = new ObjectMapper();
String json = objectMapper.writeValueAsString(userInfoList);
// HttpUtil.sendPostRequest("http://localhost:61814/account/saveNewUsersFromZhiyunPlatform", json,"application/json");
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");
// String request = HttpUtil.sendPostRequest("http://118.31.7.2:8800/account/checkOrCreateForexSimulationUser", json, "application/json");
int a = 0;
}
}
}

@ -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<String> applications = universitiesCollegesJurisdictionExperimentalSystemService.getAllApplicationIdBySchoolId(schoolId);
SubsystemUserUtil.subsystemUserCreate(Arrays.asList(info), applications);
return studentService.add(student);
return jsonResult;
}
}
@ -3119,7 +3123,10 @@ public class StudentController extends BaseController {
Assert.isTrue(CollectionUtil.isEmpty(listener.getFailMessage()), JSONUtil.toJsonStr(listener.getFailMessage()));
List<ZYUserInfo> 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

@ -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();
}
return teacherService.add(teacher);
JsonResult jsonResult = teacherService.add(teacher);
ZYUserInfo info = new
ZYUserInfo(
coreUserService.getUserInfoByUsername(teacher.getTeacherJobNumber()));
List<String> applications = universitiesCollegesJurisdictionExperimentalSystemService.getAllApplicationIdBySchoolId(schoolId);
try {
SubsystemUserUtil.subsystemUserCreate(Arrays.asList(info), applications);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
return jsonResult;
}
}

Loading…
Cancel
Save