Compare commits

...

2 Commits

Author SHA1 Message Date
Xubx bdb310da38 Merge branch 'new-1.0' of http://62.234.217.137:3000/Big-Data-Lab/CEES-CMD into new-1.0
# Conflicts:
#	jeecg-module-system/jeecg-system-start/src/main/java/org/jeecg/modules/service/impl/CeesWaiTeacherServiceImpl.java
2025-03-19 13:45:10 +08:00
Xubx a06ff03e4f 移动端接口建立 2025-03-19 13:42:47 +08:00
18 changed files with 457 additions and 9 deletions

View File

@ -19,15 +19,14 @@ import org.jeecg.config.shiro.filters.JwtFilter;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@ -39,7 +38,6 @@ import javax.annotation.Resource;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import java.lang.reflect.Method;
import java.time.Duration;
import java.util.*;
/**
@ -106,6 +104,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/auth/2step-code", "anon");//登录验证码
filterChainDefinitionMap.put("/sys/common/static/**", "anon");//图片预览 &下载文件不限制token
filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");//pdf预览
filterChainDefinitionMap.put("/h5/**", "anon");//h5项目
//filterChainDefinitionMap.put("/sys/common/view/**", "anon");//图片预览不限制token
//filterChainDefinitionMap.put("/sys/common/download/**", "anon");//文件下载不限制token

View File

@ -30,7 +30,7 @@ import java.util.Arrays;
*/
@Api(tags = "CEES用户表")
@RestController
@RequestMapping("/org.jeecg.modules/ceesUser")
@RequestMapping("/cees/ceesUser")
@Slf4j
public class CeesUserController extends JeecgController<CeesUser, ICeesUserService> {
@Autowired

View File

@ -0,0 +1,23 @@
package org.jeecg.modules.contoller.h5;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.CeesLocalTeacher;
import org.jeecg.modules.service.ICeesLocalTeacherService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RequestMapping("/h5/cees/ceesLocalTeacher")
@RestController
public class h5CeesLocalTeacherController {
@Resource
ICeesLocalTeacherService ceesLocalTeacherService;
@PostMapping("/save")
public Result<?> save(@RequestBody CeesLocalTeacher ceesLocalTeacher) {
return ceesLocalTeacherService.h5Save(ceesLocalTeacher);
}
}

View File

@ -0,0 +1,23 @@
package org.jeecg.modules.contoller.h5;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.Student;
import org.jeecg.modules.service.IStudentService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RequestMapping("/h5/cees/ceesStudent")
@RestController
public class h5CeesStudentController {
@Resource
IStudentService studentService;
@PostMapping("/save")
public Result<?> save(@RequestBody Student student) {
return studentService.h5Save(student);
}
}

View File

@ -0,0 +1,56 @@
package org.jeecg.modules.contoller.h5;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.CeesUser;
import org.jeecg.modules.service.ICeesUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RequestMapping("/h5/cees/ceesUser")
@RestController
public class h5CeesUserController {
@Autowired
private ICeesUserService ceesUserService;
/**
* 获取专业
* @param ceesUser
* @return {@link Result }<{@link ? }>
*/
@PostMapping("/getMajor")
public Result<?> getMajor(@RequestBody CeesUser ceesUser){
return ceesUserService.getMajorId(ceesUser.getUserId());
}
@PostMapping("/checkUser")
public Result<?> checkUser(@RequestBody CeesUser ceesUser){
/**第一次登录逻辑
* 0.查询表opneid不存在则一定时第一次登录
* 1.输入账号以后查询数据库如果存在则保存openid到h5_user当中
* 2.查询用户身份跳转到对应的填写信息表的页面
* 3.填写信息完成以后提交保存到对应表中
* 4.跳转到首页显示对应的页面信息
*
* 如果不是第一次登录 按照输入的id先查询user的openid是否存在
* 如果openid存在则查询对应的表必填数据是否填了没如果没填跳到表单页面否则
* 查直接跳转到首页为了防止被恶意刷可以添加一个验证码或者ip限制
* 比如说一分钟之内同一个ip智能输入5次等
*/
return ceesUserService.checkUser(ceesUser);
}
/**
* 获取用户信息
* @param userId
* @return {@link Result }<{@link ? }>
*/
@GetMapping("/getUser")
public Result<?> getUser(@RequestParam String userId){
return ceesUserService.getUser(userId);
}
@GetMapping("/getGroupName")
public Result<?> getGroupName(@RequestParam String groupId){
return ceesUserService.getGroupName(groupId);
}
}

View File

@ -0,0 +1,23 @@
package org.jeecg.modules.contoller.h5;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.CeesWaiTeacher;
import org.jeecg.modules.service.ICeesWaiTeacherService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RequestMapping("/h5/cees/ceesWaiTeacher")
@RestController
public class h5WaiTeacherController {
@Resource
ICeesWaiTeacherService ceesWaiTeacherService;
@PostMapping("/save")
public Result<?> save(@RequestBody CeesWaiTeacher ceesWaiTeacher) {
return ceesWaiTeacherService.h5Save(ceesWaiTeacher);
}
}

View File

@ -94,4 +94,9 @@ public class CeesLocalTeacher implements Serializable {
@Excel(name = "状态0正常 1禁用", width = 15)
@ApiModelProperty(value = "状态0正常 1禁用")
private Integer status;
/**是否第一次阅卷*/
@Excel(name = "是否第一次阅卷", width = 15)
@ApiModelProperty(value = "是否第一次阅卷")
private Integer checked;
}

View File

@ -90,6 +90,11 @@ public class CeesUser implements Serializable {
@Excel(name = "学科", width = 15)
@ApiModelProperty(value = "学科")
private Integer majorId;
/**用户专业id*/
@Excel(name = "用户专业id", width = 15)
@ApiModelProperty(value = "用户专业id")
private String userMajorId;
/**专业id*/
@ApiModelProperty(value = "专业id")
@TableField(exist = false)

View File

@ -113,7 +113,7 @@ public class CeesWaiTeacher implements Serializable {
/**性别*/
@Excel(name = "性别", width = 15)
@ApiModelProperty(value = "性别")
private Integer sex;
private String sex;
/**年龄*/
@Excel(name = "年龄", width = 15)
@ApiModelProperty(value = "年龄")

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.CeesLocalTeacher;
/**
@ -12,4 +13,5 @@ import org.jeecg.modules.entity.CeesLocalTeacher;
*/
public interface ICeesLocalTeacherService extends IService<CeesLocalTeacher> {
Result<?> h5Save(CeesLocalTeacher ceesLocalTeacher);
}

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.CeesUser;
/**
@ -12,4 +13,11 @@ import org.jeecg.modules.entity.CeesUser;
public interface ICeesUserService extends IService<CeesUser> {
String createIdentityID(CeesUser ceesUser);
Result<?> getMajorId(String userId);
Result<?> checkUser(CeesUser ceesUser);
Result<?> getUser(String userId);
Result<?> getGroupName(String groupId);
}

View File

@ -27,4 +27,6 @@ public interface ICeesWaiTeacherService extends IService<CeesWaiTeacher> {
Result<?> cancelCheckIn(String id);
Result<?> confirmCheckIn(String id);
Result<?> h5Save(CeesWaiTeacher ceesWaiTeacher);
}

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.Student;
/**
@ -11,4 +12,5 @@ import org.jeecg.modules.entity.Student;
*/
public interface IStudentService extends IService<Student> {
Result<?> h5Save(Student student);
}

View File

@ -1,12 +1,20 @@
package org.jeecg.modules.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.CeesLocalTeacher;
import org.jeecg.modules.entity.CeesUser;
import org.jeecg.modules.mapper.CeesLocalTeacherMapper;
import org.jeecg.modules.mapper.CeesUserMapper;
import org.jeecg.modules.service.ICeesLocalTeacherService;
import org.jeecg.modules.service.ICeesUserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @Description: 本校教师表
* @Author: jeecg-boot
@ -16,4 +24,32 @@ import org.springframework.stereotype.Service;
@Service
public class CeesLocalTeacherServiceImpl extends ServiceImpl<CeesLocalTeacherMapper, CeesLocalTeacher> implements ICeesLocalTeacherService {
@Resource
CeesUserMapper ceesUserMapper;
@Resource
ICeesUserService ceesUserService;
/**
* @param ceesLocalTeacher
* @return
*/
@Override
public Result<?> h5Save(CeesLocalTeacher ceesLocalTeacher) {
LambdaQueryWrapper<CeesUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CeesUser::getUserId, ceesLocalTeacher.getUserId());
CeesUser user = ceesUserMapper.selectOne(queryWrapper);
ceesLocalTeacher.setGroupId(user.getGroupId());
ceesLocalTeacher.setMajorId(user.getMajorId());
ceesLocalTeacher.setUserMajorId(user.getUserMajorId());
// 插入或更新数据
this.save(ceesLocalTeacher);
user.setUserName(ceesLocalTeacher.getUserName());
ceesUserService.updateById(user);
JSONObject jsonObject = new JSONObject();
jsonObject.put("user", ceesLocalTeacher);
jsonObject.put("router", "/mainPage");
return Result.ok(jsonObject);
}
}

View File

@ -1,16 +1,23 @@
package org.jeecg.modules.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.CeesLocalTeacher;
import org.jeecg.modules.entity.CeesUser;
import org.jeecg.modules.entity.CeesWaiTeacher;
import org.jeecg.modules.entity.Student;
import org.jeecg.modules.enums.identity.MajorLetterEnum;
import org.jeecg.modules.enums.identity.StudentLetterEnum;
import org.jeecg.modules.mapper.CeesUserMapper;
import org.jeecg.modules.mapper.*;
import org.jeecg.modules.service.ICeesUserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @Description: CEES用户表
* @Author: jeecg-boot
@ -21,6 +28,18 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor
public class CeesUserServiceImpl extends ServiceImpl<CeesUserMapper, CeesUser> implements ICeesUserService {
@Resource
CeesUserMapper ceesUserMapper;
@Resource
StudentMapper studentMapper;
@Resource
CeesGroupMapper ceesGroupMapper;
@Resource
CeesLocalTeacherMapper ceesLocalTeacherMapper;
@Resource
CeesWaiTeacherMapper ceesWaiTeacherMapper;
@Override
public String createIdentityID(CeesUser ceesUser) {
@ -48,4 +67,184 @@ public class CeesUserServiceImpl extends ServiceImpl<CeesUserMapper, CeesUser> i
}
return res;
}
/**
* @return
*/
@Override
public Result<?> getMajorId(String userId) {
LambdaQueryWrapper<CeesUser> ceesUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
ceesUserLambdaQueryWrapper.eq(CeesUser::getUserId, userId);
CeesUser ceesUser = ceesUserMapper.selectOne(ceesUserLambdaQueryWrapper);
if (ceesUser != null) {
return Result.ok(ceesUser);
}
return Result.error("账号不存在");
}
/**
* @param ceesUser
* @return
*/
@Override
public Result<?> checkUser(CeesUser ceesUser) {
/**
* * 0.查询表opneid不存在则一定是第一次登录
* * 1.输入账号以后查询数据库如果存在则保存openid到h5_user当中
* * 2.查询用户身份跳转到对应的填写信息表的页面
* * 3.填写信息完成以后提交保存到对应表中
* * 4.跳转到首页显示对应的页面信息
*/
LambdaQueryWrapper<CeesUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CeesUser::getUserId, ceesUser.getUserId());
CeesUser user = ceesUserMapper.selectOne(queryWrapper);
if (user == null) {
// 账号不存在
return Result.error("账号错误");
}
if ("1".equals(user.getStatus().toString())) {
// 账号被禁用
return Result.error("账号被禁用, 请联系管理员");
}
// 检查四个身份
switch (user.getIdentity().toString()) {
//1管理员
case "1":
// 2学生
case "2":
LambdaQueryWrapper<Student> studentLambdaQueryWrapper = new LambdaQueryWrapper<>();
studentLambdaQueryWrapper.eq(Student::getUserId, user.getUserId());
Student student = studentMapper.selectOne(studentLambdaQueryWrapper);
// 还没填写数据
if (student == null) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", user.getUserId());
jsonObject.put("router", "/localStudent");
jsonObject.put("status", "1"); //1是填写信息
return Result.ok(jsonObject);
} else {
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", user.getUserId());
jsonObject.put("router", "/mainPage");
jsonObject.put("status", "2"); //2是填写过信息
return Result.ok(jsonObject);
}
case "3":
// 本校老师
LambdaQueryWrapper<CeesLocalTeacher> ceesLocalTeacherLambdaQueryWrapper = new LambdaQueryWrapper<>();
ceesLocalTeacherLambdaQueryWrapper.eq(CeesLocalTeacher::getUserId, user.getUserId());
CeesLocalTeacher ceesLocalTeacher = ceesLocalTeacherMapper.selectOne(ceesLocalTeacherLambdaQueryWrapper);
// 还没填写数据
if (ceesLocalTeacher == null) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", user.getUserId());
jsonObject.put("router", "/localTeacher");
jsonObject.put("status", "1"); //1是填写信息
return Result.ok(jsonObject);
} else {
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", user.getUserId());
jsonObject.put("router", "/mainPage");
jsonObject.put("status", "2"); //2是填写过信息
return Result.ok(jsonObject);
}
case "4":
// 外校老师
LambdaQueryWrapper<CeesWaiTeacher> ceesWaiTeacherLambdaQueryWrapper = new LambdaQueryWrapper<>();
ceesWaiTeacherLambdaQueryWrapper.eq(CeesWaiTeacher::getUserId, user.getUserId());
CeesWaiTeacher ceesWaiTeacher = ceesWaiTeacherMapper.selectOne(ceesWaiTeacherLambdaQueryWrapper);
// 还没填写数据
if (ceesWaiTeacher == null) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", user.getUserId());
jsonObject.put("router", "/waiTeacher");
jsonObject.put("status", "1"); //1是填写信息
return Result.ok(jsonObject);
} else{
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", user.getUserId());
jsonObject.put("router", "/mainPage");
jsonObject.put("status", "2"); //2是填写过信息
return Result.ok(jsonObject);
}
}
return Result.error("未知错误");
}
/**
* @param userId
* @return
*/
@Override
public Result<?> getUser(String userId) {
LambdaQueryWrapper<CeesUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CeesUser::getUserId, userId);
CeesUser ceesUser = ceesUserMapper.selectOne(queryWrapper);
if (ceesUser != null) {
JSONObject jsonObject = new JSONObject();
if (ceesUser.getIdentity() == 1) {
// 管理员
} else if (ceesUser.getIdentity() == 2) {
// 学生
jsonObject.put("show0", true);
jsonObject.put("show1", false);
jsonObject.put("show3", true);
jsonObject.put("show5", true);
jsonObject.put("show6", true);
jsonObject.put("show7", false);
jsonObject.put("show8", true);
LambdaQueryWrapper<Student> studentLambdaQueryWrapper = new LambdaQueryWrapper<>();
studentLambdaQueryWrapper.eq(Student::getUserId, userId);
Student student = studentMapper.selectOne(studentLambdaQueryWrapper);
if (student != null) {
jsonObject.put("user", student);
}
} else if (ceesUser.getIdentity() == 3) {
// 本校老师
jsonObject.put("show0", true);
jsonObject.put("show1", false);
jsonObject.put("show3", true);
jsonObject.put("show5", true);
jsonObject.put("show6", true);
jsonObject.put("show7", false);
jsonObject.put("show8", true);
LambdaQueryWrapper<CeesLocalTeacher> ceesLocalTeacherLambdaQueryWrapper = new LambdaQueryWrapper<>();
ceesLocalTeacherLambdaQueryWrapper.eq(CeesLocalTeacher::getUserId, userId);
CeesLocalTeacher ceesLocalTeacher = ceesLocalTeacherMapper.selectOne(ceesLocalTeacherLambdaQueryWrapper);
if (ceesLocalTeacher != null) {
jsonObject.put("user", ceesLocalTeacher);
}
} else if (ceesUser.getIdentity() == 4) {
// 外校老师
jsonObject.put("show0", true);
jsonObject.put("show1", true);
jsonObject.put("show2", true);
jsonObject.put("show3", true);
jsonObject.put("show4", true);
jsonObject.put("show5", true);
jsonObject.put("show6", true);
jsonObject.put("show7", true);
jsonObject.put("show8", true);
LambdaQueryWrapper<CeesWaiTeacher> ceesWaiTeacherLambdaQueryWrapper = new LambdaQueryWrapper<>();
ceesWaiTeacherLambdaQueryWrapper.eq(CeesWaiTeacher::getUserId, userId);
CeesWaiTeacher ceesWaiTeacher = ceesWaiTeacherMapper.selectOne(ceesWaiTeacherLambdaQueryWrapper);
if (ceesWaiTeacher != null) {
jsonObject.put("user", ceesWaiTeacher);
}
}
return Result.ok(jsonObject);
}
return Result.error("未知错误");
}
/**
* @param groupId
* @return
*/
@Override
public Result<?> getGroupName(String groupId) {
return Result.ok(ceesGroupMapper.selectById(groupId).getName());
}
}

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -11,13 +12,16 @@ import lombok.RequiredArgsConstructor;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.entity.CeesDormitoryInfo;
import org.jeecg.modules.entity.CeesUser;
import org.jeecg.modules.entity.CeesWaiTeacher;
import org.jeecg.modules.enums.MajorEnum;
import org.jeecg.modules.mapper.CeesDormitoryInfoMapper;
import org.jeecg.modules.mapper.CeesUserMapper;
import org.jeecg.modules.mapper.CeesWaiTeacherMapper;
import org.jeecg.modules.service.ICeesWaiTeacherService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Set;
@ -34,6 +38,8 @@ import java.util.stream.Collectors;
public class CeesWaiTeacherServiceImpl extends ServiceImpl<CeesWaiTeacherMapper, CeesWaiTeacher> implements ICeesWaiTeacherService {
private final CeesWaiTeacherMapper ceesWaiTeacherMapper;
private final CeesDormitoryInfoMapper ceesDormitoryInfoMapper;
@Resource
CeesUserMapper ceesUserMapper;
@Override
public Result updateDormitory(String id, String dormitoryId) {
@ -117,4 +123,31 @@ public class CeesWaiTeacherServiceImpl extends ServiceImpl<CeesWaiTeacherMapper,
ceesWaiTeacherMapper.updateById(ceesWaiTeacher);
return Result.ok("确认成功");
}
/**
* @param ceesWaiTeacher
* @return
*/
@Override
public Result<?> h5Save(CeesWaiTeacher ceesWaiTeacher) {
LambdaQueryWrapper<CeesUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CeesUser::getUserId, ceesWaiTeacher.getUserId());
CeesUser ceesUser = ceesUserMapper.selectOne(queryWrapper);
ceesWaiTeacher.setGroupId(ceesUser.getGroupId());
ceesWaiTeacher.setMajorId(ceesUser.getMajorId());
ceesWaiTeacher.setUserMajorId(ceesUser.getUserMajorId());
this.save(ceesWaiTeacher);
ceesUser.setUserName(ceesWaiTeacher.getUserName());
ceesUserMapper.updateById(ceesUser);
// TODO 邀请函的更新
// LambdaUpdateWrapper<H5Invitation> qw = new LambdaUpdateWrapper<>();
// qw.eq(H5Invitation::getUserId, oneUser.getUserId());
// qw.set(H5Invitation::getWorkName, waiTeacher.getWorkName());
// h5InvitationService.update(qw);
JSONObject jsonObject = new JSONObject();
jsonObject.put("user", ceesWaiTeacher);
jsonObject.put("router", "/mainPage");
return Result.ok(jsonObject);
}
}

View File

@ -1,12 +1,20 @@
package org.jeecg.modules.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.CeesUser;
import org.jeecg.modules.entity.Student;
import org.jeecg.modules.mapper.CeesUserMapper;
import org.jeecg.modules.mapper.StudentMapper;
import org.jeecg.modules.service.ICeesUserService;
import org.jeecg.modules.service.IStudentService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @Description: 研究生表
* @Author: jeecg-boot
@ -15,5 +23,29 @@ import org.springframework.stereotype.Service;
*/
@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements IStudentService {
@Resource
CeesUserMapper ceesUserMapper;
@Resource
ICeesUserService ceesUserService;
/**
* @param student
* @return
*/
@Override
public Result<?> h5Save(Student student) {
LambdaQueryWrapper<CeesUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CeesUser::getUserId, student.getUserId());
CeesUser user = ceesUserMapper.selectOne(queryWrapper);
student.setGroupId(user.getGroupId());
student.setMajorId(user.getMajorId());
student.setUserMajorId(user.getUserMajorId());
// 插入或更新数据
this.save(student);
user.setUserName(student.getUserName());
ceesUserService.updateById(user);
JSONObject jsonObject = new JSONObject();
jsonObject.put("user", student);
jsonObject.put("router", "/mainPage");
return Result.ok(jsonObject);
}
}

View File

@ -1,5 +1,5 @@
server:
port: 8080
port: 8091
tomcat:
max-swallow-size: -1
error: