修改同步接口

master
xiaoCJ 8 months ago
parent 9d7ff32697
commit 705b59fc8f

@ -1,5 +1,5 @@
package com.sztzjy.financial_bigdata.controller.tea; package com.sztzjy.financial_bigdata.controller.tea;
import javax.swing.JOptionPane;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -38,7 +38,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @Author xcj * @Author xcj
@ -89,13 +88,12 @@ public class UserController {
// } // }
@PostMapping("/login") @PostMapping("/login")
@ApiOperation("登录接口") @ApiOperation("登录接口")
@AnonymousAccess @AnonymousAccess
public ResultEntity login(@RequestParam(required = false) String passwordEncode, public ResultEntity login(@RequestParam(required = false) String passwordEncode,
@RequestParam(required = false) String userName, @RequestParam(required = false) String userName,
@ApiParam("所属系统")@RequestParam String systemOwner, @ApiParam("所属系统") @RequestParam String systemOwner,
HttpServletRequest request, HttpServletRequest request,
@RequestParam(required = false) String TOKEN) { @RequestParam(required = false) String TOKEN) {
JwtUser jwtUser; JwtUser jwtUser;
@ -132,11 +130,11 @@ public class UserController {
map.put("schoolId", user.getSchoolId()); map.put("schoolId", user.getSchoolId());
map.put("classId", user.getClassId()); map.put("classId", user.getClassId());
map.put("userId", user.getUserid()); map.put("userId", user.getUserid());
map.put("zyuserid",user.getZyUserid()); map.put("zyuserid", user.getZyUserid());
String uuid = getIPAndPlace(request, user.getName(), user.getUserid(), user.getStudentId()); String uuid = getIPAndPlace(request, user.getName(), user.getUserid(), user.getStudentId());
map.put("logId", uuid); map.put("logId", uuid);
map.put("token", token); map.put("token", token);
map.put("systemOwner",user.getSystemOnwer()); map.put("systemOwner", user.getSystemOnwer());
return new ResultEntity(HttpStatus.OK, map); return new ResultEntity(HttpStatus.OK, map);
} else { // 2、智云单点登录 } else { // 2、智云单点登录
jwtUser = TokenProvider.getJWTUserByZhiYun(TOKEN); jwtUser = TokenProvider.getJWTUserByZhiYun(TOKEN);
@ -194,7 +192,7 @@ public class UserController {
@AnonymousAccess @AnonymousAccess
public ResultEntity<String> getClassNameByClassId(@RequestParam String classId) { public ResultEntity<String> getClassNameByClassId(@RequestParam String classId) {
StuClass stuClass = classMapper.selectByPrimaryKey(classId); StuClass stuClass = classMapper.selectByPrimaryKey(classId);
if(stuClass==null){ if (stuClass == null) {
return null; return null;
} }
return new ResultEntity<>(stuClass.getClassName()); return new ResultEntity<>(stuClass.getClassName());
@ -224,17 +222,20 @@ public class UserController {
for (int i = 0; i < zyUserInfoList.size(); i++) { for (int i = 0; i < zyUserInfoList.size(); i++) {
StuClass stuClass = new StuClass(); StuClass stuClass = new StuClass();
ZYUserInfo zyUserInfo = zyUserInfoList.get(i); ZYUserInfo zyUserInfo = zyUserInfoList.get(i);
String userId = String.valueOf(zyUserInfo.getUserId()); Integer zyUserId = zyUserInfo.getUserId();
String username = zyUserInfo.getUsername(); // studentid String username = zyUserInfo.getUsername(); // studentid
String name = zyUserInfo.getName(); String name = zyUserInfo.getName();
String password = zyUserInfo.getPassword(); String password = zyUserInfo.getPassword();
Integer roleId = zyUserInfo.getRoleId(); //3教师 4学生 Integer roleId = zyUserInfo.getRoleId(); //3教师 4学生
StuUser stuUser1 = stuUserMapper.selectByPrimaryKey(userId);
if (stuUser1 != null) { StuUserExample example = new StuUserExample();
example.createCriteria().andZyUseridEqualTo(zyUserId).andSystemOnwerEqualTo(systemOwner);
List<StuUser> list = stuUserMapper.selectByExample(example);
if (list != null || !list.isEmpty()) {
continue; continue;
} }
StuUser stuUser = new StuUser(); StuUser stuUser = new StuUser();
stuUser.setUserid(userId); stuUser.setUserid(IdUtil.randomUUID());
stuUser.setStudentId(zyUserInfo.getUsername()); stuUser.setStudentId(zyUserInfo.getUsername());
stuUser.setName(name); stuUser.setName(name);
stuUser.setUsername(username); stuUser.setUsername(username);

Loading…
Cancel
Save