自动生成配置文件和mapper xml

newBigdata
xiaoCJ 11 months ago
parent 93dd731bbe
commit e8fda05a6b

@ -88,7 +88,12 @@
<artifactId>spring-security-jwt</artifactId> <artifactId>spring-security-jwt</artifactId>
<version>1.1.1.RELEASE</version> <version>1.1.1.RELEASE</version>
</dependency> </dependency>
<!-- 其他依赖项 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- 其他依赖项 -->
<dependency> <dependency>
<groupId>com.nimbusds</groupId> <groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId> <artifactId>nimbus-jose-jwt</artifactId>

@ -55,7 +55,7 @@ public class AuthenticationFilter extends OncePerRequestFilter {
} }
JwtUser currentUser; JwtUser currentUser;
try { try {
currentUser = TokenProvider.getJWTUser(token); currentUser = com.sztzjy.financial_bigdata.config.security.TokenProvider.getJWTUser(token);
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
} catch (ExpiredJwtException e1) { } catch (ExpiredJwtException e1) {
response.setStatus(HttpStatus.UNAUTHORIZED.value()); response.setStatus(HttpStatus.UNAUTHORIZED.value());

@ -1,33 +1,40 @@
//package com.sztzjy.financial_bigdata.config.security; package com.sztzjy.financial_bigdata.config.security;
//
//import com.sztzjy.financial_bigdata.entity.User; import com.sztzjy.financial_bigdata.entity.StuUser;
//import com.sztzjy.financial_bigdata.service.IUserService; import com.sztzjy.financial_bigdata.entity.StuUserExample;
//import io.jsonwebtoken.lang.Assert; import com.sztzjy.financial_bigdata.mapper.StuUserMapper;
//import org.springframework.security.core.userdetails.UserDetails; import io.jsonwebtoken.lang.Assert;
//import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.stereotype.Service; import org.springframework.security.core.userdetails.UsernameNotFoundException;
// import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import javax.annotation.Resource; import org.springframework.stereotype.Service;
//
// import javax.annotation.Resource;
//@Service import java.util.List;
//public class AuthenticationService implements UserDetailsService {
// @Resource
// private IUserService userService; @Service
// public class AuthenticationService implements UserDetailsService {
// @Resource
// @Override private StuUserMapper stuUserMapper;
// public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
// User user = userService.findByUsername(username);
// Assert.notNull(user, "用户不存在"); @Override
// public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
// JwtUser jwtUser = new JwtUser(); StuUserExample stuUserExample = new StuUserExample();
// jwtUser.setUsername(user.getUsername()); stuUserExample.createCriteria().andUsernameEqualTo(username);
// jwtUser.setPassword(user.getPassword()); List<StuUser> list = stuUserMapper.selectByExample(stuUserExample);
// jwtUser.setUserId(user.getUserid()); Assert.notNull(list, "用户不存在");
// jwtUser.setName(user.getName()); StuUser user = list.get(0);
// jwtUser.setRoleId(user.getRoleId()); com.sztzjy.financial_bigdata.config.security.JwtUser jwtUser = new com.sztzjy.financial_bigdata.config.security.JwtUser();
// return jwtUser; jwtUser.setUsername(user.getUsername());
// } jwtUser.setPassword(new BCryptPasswordEncoder().encode(user.getPassword())); //不加密会报错Encoded password does not look like BCrypt
//} jwtUser.setUserId(user.getUserid());
jwtUser.setName(user.getName());
jwtUser.setRoleId(user.getRoleId());
jwtUser.setStudentId(user.getStudentId());
return jwtUser;
}
}

@ -1,6 +1,5 @@
package com.sztzjy.financial_bigdata.config.security; package com.sztzjy.financial_bigdata.config.security;
import io.swagger.models.auth.In;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
@ -30,6 +29,7 @@ public class JwtUser implements UserDetails {
private int collegeId; private int collegeId;
private String collegeName; private String collegeName;
private List<String> authorityCodes; private List<String> authorityCodes;
private String studentId;
@Override @Override
public Collection<? extends GrantedAuthority> getAuthorities() { public Collection<? extends GrantedAuthority> getAuthorities() {

@ -4,11 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/** /**
* *

@ -32,16 +32,6 @@ public class WebConfigurerAdapter implements WebMvcConfigurer {
private String fileType; private String fileType;
@Value("${file.path}") @Value("${file.path}")
private String filePath; private String filePath;
@Bean
public IFileUtil getFileUtil() {
if (fileType.equals("local")) {
return new LocalFileUtil(filePath);
} else {
throw new IllegalArgumentException("未知文件工具类注入类型");
}
}
@Bean @Bean
public CorsFilter corsFilter() { public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
@ -77,4 +67,12 @@ public class WebConfigurerAdapter implements WebMvcConfigurer {
} }
} }
@Bean
public IFileUtil getFileUtil() {
if (fileType.equals("local")) {
return new LocalFileUtil(filePath);
} else {
throw new IllegalArgumentException("未知文件工具类注入类型");
}
}
} }

@ -22,7 +22,6 @@ import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo; import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import javax.annotation.Resource;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@ -113,7 +112,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Bean @Bean
public SessionRegistry sessionRegistry() { public SessionRegistry sessionRegistry() {
return new CustomSessionRegistry(); return new com.sztzjy.financial_bigdata.config.security.CustomSessionRegistry();
} }
} }

@ -88,7 +88,7 @@ public class StuKnowledgeNote {
@GetMapping("/getReport") @GetMapping("/getReport")
@ApiOperation("获取单个学生报告接口") @ApiOperation("知识概要--获取单个学生报告接口")
@AnonymousAccess @AnonymousAccess
public ResponseEntity<FileSystemResource> getReport(@RequestParam String chapterId, HttpServletResponse response) { public ResponseEntity<FileSystemResource> getReport(@RequestParam String chapterId, HttpServletResponse response) {
SysKnowledgeSummary sysKnowledgeSummary = sysKnowledgeSummaryMapper.selectByPrimaryKey(chapterId); SysKnowledgeSummary sysKnowledgeSummary = sysKnowledgeSummaryMapper.selectByPrimaryKey(chapterId);

@ -141,7 +141,7 @@ public class StuScoreController {
trainingReport.setReportSize(size); trainingReport.setReportSize(size);
StuTrainingWithBLOBs stuTrainingWithBLOBs = stuTrainingMapper.selectByPrimaryKey(trainingId); StuTrainingWithBLOBs stuTrainingWithBLOBs = stuTrainingMapper.selectByPrimaryKey(trainingId);
stuTrainingWithBLOBs.setReportId(trainingReport.getReportId()); // 第一次上传时设置实训表的报告ID stuTrainingWithBLOBs.setReportId(trainingReport.getReportId()); // 第一次上传时设置实训表的报告ID
stuTrainingMapper.updateByPrimaryKeyWithBLOBs(stuTrainingWithBLOBs); trainingReportMapper.insert(trainingReport);
return new ResultEntity<>(HttpStatus.OK, "上传成功!"); return new ResultEntity<>(HttpStatus.OK, "上传成功!");
} }
} }

@ -20,16 +20,21 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun; import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.python.core.AstList;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
@ -61,65 +66,77 @@ public class TeaGradeManageController {
@Autowired @Autowired
private StuTheoryExamMapper stuTheoryExamMapper; private StuTheoryExamMapper stuTheoryExamMapper;
// @AnonymousAccess
// @PostMapping("/getExamInfo")
// @ApiOperation("考试模式--页面展示(学生端实战考核复用)")
// public ResultEntity<PageInfo<TeaExamManageCountDto>> getExamInfo(@RequestParam Integer index,
// @RequestParam Integer size,
// @ApiParam("ManyAnswer为考试时间JudgeAnswer为发布人") @RequestParam String schoolId) {
//
// List<TeaExamManage> teaExamManages = teaExamManageMapper.selectBySchoolId(schoolId);
// List<TeaExamManageCountDto>teaExamManageCountDtos =new AstList();
// for (TeaExamManage teaExamManage : teaExamManages) {
// List<String> nameList = new ArrayList<>();
// TeaExamManageCountDto copyexamManageWithBLOBs = new TeaExamManageCountDto();
// int num = 0;
// //获取班级和考试人数
// String classId = teaAndStudentExamMapper.selectByExamId(teaExamManage.getExamManageId());
// String[] split = classId.split(",");
// for (String s : split) {
// StuClass stuClass = stuClassMapper.selectByPrimaryKey(s);
// String className = stuClass.getClassName();
// nameList.add(className);
// int count = userMapper.selectNumByClass(s);
// num = num + count;
// }
// copyexamManageWithBLOBs.setExamClass(nameList);
// copyexamManageWithBLOBs.setExamNum(num);
// BeanUtils.copyProperties(teaExamManage, copyexamManageWithBLOBs);
// Date now = new Date(); // 当前日期
// Date endTime = teaExamManage.getEndTime(); // 从 teaExamManage 对象中获取的日期
// Date startTime = teaExamManage.getStartTime();
//
// if (now.compareTo(endTime) > 0) {
// copyexamManageWithBLOBs.setExamStatus("已结束");
// } else if (now.compareTo(startTime) < 0) {
// copyexamManageWithBLOBs.setExamStatus("未开始");
// } else {
// copyexamManageWithBLOBs.setExamStatus("进行中");
// }
// String concatenatedTimeString = startTime + " -- " + endTime;
// copyexamManageWithBLOBs.setExamTime(concatenatedTimeString); //考试时间
// String userId = teaExamManage.getUserId();
// StuUser stuUser = userMapper.selectByPrimaryKey(userId);
// copyexamManageWithBLOBs.setName(stuUser.getName()); //发布人
// teaExamManageCountDtos.add(copyexamManageWithBLOBs);
// }
// PageUtil.pageHelper(teaExamManageCountDtos, index, size);
// return new ResultEntity<>(new PageInfo<>(teaExamManageCountDtos));
// }
@AnonymousAccess @AnonymousAccess
@PostMapping("/getExamInfo") @PostMapping("/getExamInfo")
@ApiOperation("考试模式--页面展示(学生端实战考核复用)") @ApiOperation("考试模式--页面展示(学生端实战考核复用)")
public ResultEntity<PageInfo<TeaExamManageCountDto>> getExamInfo(@RequestParam Integer index, public ResultEntity<PageInfo<TeaExamManageCountDto>> getExamInfo(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@ApiParam("ManyAnswer为考试时间JudgeAnswer为发布人") @RequestParam String schoolId) { @ApiParam("ManyAnswer为考试时间JudgeAnswer为发布人") @RequestParam String schoolId) {
TeaExamManageExample teaExamManageExample = new TeaExamManageExample();
teaExamManageExample.createCriteria().andSchoolIdEqualTo(schoolId); List<TeaExamManage> teaExamManages = teaExamManageMapper.selectBySchoolId(schoolId);
List<TeaExamManage> teaExamManages = teaExamManageMapper.selectByExample(teaExamManageExample);
List<TeaExamManageCountDto> teaExamManageCountDtos = new ArrayList<>(); List<TeaExamManageCountDto> teaExamManageCountDtos = new ArrayList<>();
// 批量查询班级信息
List<String> examIds = new ArrayList<>();
for (TeaExamManage teaExamManage : teaExamManages) { for (TeaExamManage teaExamManage : teaExamManages) {
List<String> nameList = new ArrayList<>(); examIds.add(teaExamManage.getExamManageId());
TeaExamManageCountDto copyexamManageWithBLOBs = new TeaExamManageCountDto();
int num = 0;
//获取班级和考试人数
String classId = teaAndStudentExamMapper.selectByExamId(teaExamManage.getExamManageId());
String[] split = classId.split(",");
for (String s : split) {
StuClass stuClass = stuClassMapper.selectByPrimaryKey(s);
String className = stuClass.getClassName();
nameList.add(className);
int count = userMapper.selectNumByClass(s);
num = num + count;
}
copyexamManageWithBLOBs.setExamClass(nameList);
copyexamManageWithBLOBs.setExamNum(num);
BeanUtils.copyProperties(teaExamManage, copyexamManageWithBLOBs);
Date startTime = teaExamManage.getStartTime();
Date endTime = teaExamManage.getEndTime();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTimeString = formatter.format(startTime);
String endTimeString = formatter.format(endTime);
Date date = new Date(); // 当前日期
Date endtimeDtae = teaExamManage.getEndTime(); // 从 teaExamManage 对象中获取的日期
Date startTimeDtae = teaExamManage.getStartTime();
long now = date.getTime();
long end = endtimeDtae.getTime();
long start = startTimeDtae.getTime();
if (now > end) {
// 当前 大于 结束时间
copyexamManageWithBLOBs.setExamStatus("已结束");
} else if (now < start) {
// 当前 小于 开始时间
copyexamManageWithBLOBs.setExamStatus("未开始");
} else {
copyexamManageWithBLOBs.setExamStatus("进行中");
}
String concatenatedTimeString = startTimeString + " -- " + endTimeString;
copyexamManageWithBLOBs.setExamTime(concatenatedTimeString); //考试时间
String userId = teaExamManage.getUserId();
StuUser stuUser = userMapper.selectByPrimaryKey(userId);
copyexamManageWithBLOBs.setName(stuUser.getName()); //发布人
teaExamManageCountDtos.add(copyexamManageWithBLOBs);
} }
PageUtil.pageHelper(teaExamManageCountDtos, index, size);
return new ResultEntity<>(new PageInfo<>(teaExamManageCountDtos));
PageInfo pageInfo = PageUtil.pageHelper(teaExamManageCountDtos, index, size);
return new ResultEntity<PageInfo<TeaExamManageCountDto>>(pageInfo);
} }
@AnonymousAccess @AnonymousAccess
@PostMapping("/getExamInfoAndRank") @PostMapping("/getExamInfoAndRank")
@ApiOperation("考试模式--成绩排名和成绩情况展示") //TODO 图片可能需要一个接口去取 @ApiOperation("考试模式--成绩排名和成绩情况展示") //TODO 图片可能需要一个接口去取
@ -312,14 +329,28 @@ public class TeaGradeManageController {
@AnonymousAccess @AnonymousAccess
@PostMapping("/getReportBySchoolID") @PostMapping("/getReportBySchoolID")
@ApiOperation("练习模式--实训报告展示") @ApiOperation("练习模式--实训报告展示")
public ResultEntity<PageInfo<TrainingReport>> getReportBySchoolID(@RequestParam Integer index, public ResultEntity<PageInfo<TrainingReportDto>> getReportBySchoolID(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@RequestParam String schoolId) { @RequestParam String schoolId) {
PageHelper.startPage(index, size); PageHelper.startPage(index, size);
TrainingReportExample reportExample = new TrainingReportExample(); TrainingReportExample reportExample = new TrainingReportExample();
reportExample.createCriteria().andSchoolIdEqualTo(schoolId); reportExample.createCriteria().andSchoolIdEqualTo(schoolId);
List<TrainingReportDto> list = new AstList();
List<TrainingReport> trainingReports = reportMapper.selectByExampleWithBLOBs(reportExample); List<TrainingReport> trainingReports = reportMapper.selectByExampleWithBLOBs(reportExample);
return new ResultEntity<PageInfo<TrainingReport>>(new PageInfo<>(trainingReports)); if (!trainingReports.isEmpty()) {
for (TrainingReport trainingReport : trainingReports) {
TrainingReportDto trainingReportDto = new TrainingReportDto();
BeanUtils.copyProperties(trainingReport, trainingReportDto);
StuUser user = userMapper.selectByPrimaryKey(trainingReport.getUserId());
trainingReportDto.setName(user.getName());
trainingReportDto.setStudentId(user.getStudentId());
StuClass stuClass = stuClassMapper.selectByPrimaryKey(user.getClassId());
trainingReportDto.setClassName(stuClass.getClassName());
list.add(trainingReportDto);
}
}
PageInfo pageInfo = PageUtil.pageHelper(list, index, size);
return new ResultEntity<>(pageInfo);
} }
@AnonymousAccess @AnonymousAccess
@ -335,6 +366,38 @@ public class TeaGradeManageController {
return new ResultEntity<>(iTeaGradeManageService.getReportCorrect(schoolId, index, size, module, classId, keyWord)); return new ResultEntity<>(iTeaGradeManageService.getReportCorrect(schoolId, index, size, module, classId, keyWord));
} }
@AnonymousAccess
@PostMapping("/getChapterName")
@ApiOperation("评阅-章节下拉框")
public ResultEntity<List<String>> getReportCorrect() {
List<String> list = sysCourseMapper.selectNameByCourseID();
return new ResultEntity<>(list);
}
@Value("${file.path}")
private String filePath;
@GetMapping("/getReportByReportId")
@ApiOperation("评阅--获取单个学生报告接口")
@AnonymousAccess
public ResponseEntity<FileSystemResource> getReport(@RequestParam String reportId, HttpServletResponse response) {
TrainingReport trainingReport = reportMapper.selectByPrimaryKey(reportId);
String fileUrl = trainingReport.getFilePath();
String videoPath = filePath + fileUrl;
File videoFile = new File(videoPath);
if (videoFile.exists()) {
FileSystemResource fileSystemResource = new FileSystemResource(videoFile);
return ResponseEntity.ok()
.contentType(MediaType.parseMediaType("application/pdf"))
.body(fileSystemResource);
} else {
return ResponseEntity.notFound().build();
}
}
@AnonymousAccess @AnonymousAccess
@PostMapping("/updateScoreOrComment") @PostMapping("/updateScoreOrComment")
@ApiOperation("练习模式--实训报告评阅页面老师评分或评语") @ApiOperation("练习模式--实训报告评阅页面老师评分或评语")

@ -9,7 +9,6 @@ import com.sztzjy.financial_bigdata.config.security.JwtUser;
import com.sztzjy.financial_bigdata.config.security.LoginResult; import com.sztzjy.financial_bigdata.config.security.LoginResult;
import com.sztzjy.financial_bigdata.config.security.TokenProvider; import com.sztzjy.financial_bigdata.config.security.TokenProvider;
import com.sztzjy.financial_bigdata.entity.*; import com.sztzjy.financial_bigdata.entity.*;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuUserDto; import com.sztzjy.financial_bigdata.entity.stu_dto.StuUserDto;
import com.sztzjy.financial_bigdata.mapper.StuClassMapper; import com.sztzjy.financial_bigdata.mapper.StuClassMapper;
import com.sztzjy.financial_bigdata.mapper.StuUserMapper; import com.sztzjy.financial_bigdata.mapper.StuUserMapper;
@ -27,6 +26,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -53,7 +53,7 @@ public class UserController {
private ITeaUserService userService; private ITeaUserService userService;
@Autowired @Autowired
private SysLoginLogMapper sysLoginLogMapper; private SysLoginLogMapper sysLoginLogMapper;
@Autowired @Resource
private AuthenticationManagerBuilder authenticationManagerBuilder; private AuthenticationManagerBuilder authenticationManagerBuilder;
// 用户登录时记录的信息 // 用户登录时记录的信息
@ -69,16 +69,23 @@ public class UserController {
public ResultEntity login(@RequestParam String passwordEncode, public ResultEntity login(@RequestParam String passwordEncode,
@RequestParam String userName, @RequestParam String userName,
HttpServletRequest request, HttpServletRequest request,
@RequestParam(required = false) String TOKEN) throws Exception { @RequestParam(required = false) String TOKEN) {
JwtUser jwtUser; JwtUser jwtUser;
String passWord = RsaUtil.decryptByPrivateKey(passwordEncode); String passWord;
try {
passWord = RsaUtil.decryptByPrivateKey(passwordEncode);
} catch (Exception e) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "密码错误");
}
if (StringUtils.isBlank(TOKEN)) { if (StringUtils.isBlank(TOKEN)) {
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(userName, passWord); UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(userName, passWord);
System.out.println(authenticationToken); System.out.println(userName);
System.out.println(passWord);
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
SecurityContextHolder.getContext().setAuthentication(authentication); SecurityContextHolder.getContext().setAuthentication(authentication);
JwtUser jwtUser1 = (JwtUser) authentication.getPrincipal(); jwtUser = (JwtUser) authentication.getPrincipal();
String token = TokenProvider.createToken(jwtUser1); String token = TokenProvider.createToken(jwtUser);
// 1、子系统直接登录 // 1、子系统直接登录
StuUserExample stuUserExample = new StuUserExample(); StuUserExample stuUserExample = new StuUserExample();
stuUserExample.createCriteria().andUsernameEqualTo(userName).andPasswordEqualTo(passWord); stuUserExample.createCriteria().andUsernameEqualTo(userName).andPasswordEqualTo(passWord);
@ -128,14 +135,13 @@ public class UserController {
map.put("classId", loginResult.getClassId()); map.put("classId", loginResult.getClassId());
map.put("userId", loginResult.getUserId()); map.put("userId", loginResult.getUserId());
map.put("token", token); map.put("token", token);
String uuid = getIPAndPlace(request, loginResult.getName(), loginResult.getUserId(), jwtUser.getUsername()); //todo 学号暂时没有 String uuid = getIPAndPlace(request, loginResult.getName(), loginResult.getUserId(), jwtUser.getStudentId());
map.put("logId", uuid); map.put("logId", uuid);
return new ResultEntity(HttpStatus.OK, map); //todo 从智云登录后将用户添加到本地用户表 return new ResultEntity(HttpStatus.OK, map); //todo 从智云登录后将用户添加到本地用户表
} }
} }
private String getIPAndPlace(HttpServletRequest request, String name, String userId, String studentId) { private String getIPAndPlace(HttpServletRequest request, String name, String userId, String studentId) {
String ip = request.getRemoteAddr(); String ip = request.getRemoteAddr();
String ipHomePlace = userService.getIpAddress(ip); String ipHomePlace = userService.getIpAddress(ip);
@ -153,7 +159,6 @@ public class UserController {
} }
@PostMapping("/setLoginDuration") @PostMapping("/setLoginDuration")
@ApiOperation("登录日志--设置登录时长退出时调用") @ApiOperation("登录日志--设置登录时长退出时调用")
public void setLoginDuration(@ApiParam("登录返回的日志ID") @RequestParam String logID) { public void setLoginDuration(@ApiParam("登录返回的日志ID") @RequestParam String logID) {
@ -167,8 +172,6 @@ public class UserController {
} }
@ApiOperation("根据用户Code查询该用户是否存在个人赛用户数据存在则返回不存在则新增后返回用于智云3.0创建用户后调用该接口创建用户个人赛") @ApiOperation("根据用户Code查询该用户是否存在个人赛用户数据存在则返回不存在则新增后返回用于智云3.0创建用户后调用该接口创建用户个人赛")
@PostMapping("/checkOrCreateForexSimulationUser") @PostMapping("/checkOrCreateForexSimulationUser")
@AnonymousAccess @AnonymousAccess
@ -325,7 +328,6 @@ public class UserController {
// } // }
/* /*
* @author xcj * @author xcj
* @Date 2024/3/12 * @Date 2024/3/12

@ -0,0 +1,61 @@
package com.sztzjy.financial_bigdata.entity.tea_dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
/**
*
*
* @author xcj
* training_report
*/
@Data
@NoArgsConstructor
public class TrainingReportDto {
@ApiModelProperty("实训报告ID")
private String reportId;
@ApiModelProperty("章节ID")
private String chapterId;
@ApiModelProperty("章节名称")
private String chapterName;
@ApiModelProperty("用户ID")
private String userId;
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("学号")
private String studentId;
@ApiModelProperty("班级")
private String className;
@ApiModelProperty("实训报告名称")
private String reportName;
@ApiModelProperty("实训报告上传时间")
private Date uploadTime;
@ApiModelProperty("实训报告大小/单位MB")
private Integer reportSize;
@ApiModelProperty("教师评分")
private BigDecimal teacherScore;
@ApiModelProperty("文件地址")
private String filePath;
@ApiModelProperty("学校ID")
private String schoolId;
@ApiModelProperty("教师评语")
private String teacherComment;
}

@ -37,4 +37,6 @@ public interface StuClassMapper {
@Select("SELECT s.class_name FROM stu_class s, stu_userinfo u WHERE s.class_id = u.class_id and s.class_id = #{classId};") @Select("SELECT s.class_name FROM stu_class s, stu_userinfo u WHERE s.class_id = u.class_id and s.class_id = #{classId};")
String selectClassNameByClassId(@Param("classId")String classId); String selectClassNameByClassId(@Param("classId")String classId);
List<StuClass> selectByPrimaryKeys(@Param("classIds") List<String> classIds);
} }

@ -46,6 +46,14 @@ public interface StuUserMapper {
@Param("keyWord") String keyWord); @Param("keyWord") String keyWord);
@Select("select count(*) from stu_userinfo where class_id = #{s}") @Select("<script>" +
int selectNumByClass(@Param("s") String s); "select COUNT(*) FROM stu_userinfo WHERE class_id IN("
+"<foreach collection='classIdList' separator=',' item='id'>"
+ "#{id} "
+ "</foreach> "
+")</script>")
int selectNumByClass(@Param("classIdList") List<String> classIdList);
List<Integer> selectNumByClasss(List<String> classIdList);
} }

@ -41,4 +41,6 @@ public interface SysCourseMapper {
List<SysCourse> getBySchoolId(); List<SysCourse> getBySchoolId();
@Select("select scc.chapter_name from sys_course_chapter scc join sys_course sc on scc.course_id = sc.course_id where sc.input_type = '1'")
List<String> selectNameByCourseID();
} }

@ -2,12 +2,12 @@ package com.sztzjy.financial_bigdata.mapper;
import com.sztzjy.financial_bigdata.entity.TeaAndStudentExam; import com.sztzjy.financial_bigdata.entity.TeaAndStudentExam;
import com.sztzjy.financial_bigdata.entity.TeaAndStudentExamExample; import com.sztzjy.financial_bigdata.entity.TeaAndStudentExamExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper @Mapper
public interface TeaAndStudentExamMapper { public interface TeaAndStudentExamMapper {
long countByExample(TeaAndStudentExamExample example); long countByExample(TeaAndStudentExamExample example);
@ -32,6 +32,6 @@ public interface TeaAndStudentExamMapper {
int updateByPrimaryKey(TeaAndStudentExam record); int updateByPrimaryKey(TeaAndStudentExam record);
@Select("select class_id from tea_and_student_exam where exam_manage_id =#{examManageId}") // @Select("select class_id from tea_and_student_exam where exam_manage_id =#{examManageId}")
String selectByExamId(@Param("examManageId") String examManageId); // String selectByExamId(@Param("examManageId") String examManageId);
} }

@ -44,4 +44,6 @@ public interface TeaExamManageMapper {
@Select("select * from tea_exam_manage where user_id = #{userId}") @Select("select * from tea_exam_manage where user_id = #{userId}")
List<TeaExamManageWithBLOBs> selectByUserId(@Param("userId") String userId); List<TeaExamManageWithBLOBs> selectByUserId(@Param("userId") String userId);
List<TeaExamManage> selectBySchoolId(@Param("schoolId")String schoolId);
} }

@ -25,7 +25,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -54,7 +55,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -66,9 +68,11 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
class_id, class_name, create_time, school_name class_id
, class_name, create_time, school_name
</sql> </sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample"
resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
@ -89,7 +93,8 @@
where class_id = #{classId,jdbcType=VARCHAR} where class_id = #{classId,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from stu_class delete
from stu_class
where class_id = #{classId,jdbcType=VARCHAR} where class_id = #{classId,jdbcType=VARCHAR}
</delete> </delete>
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample"> <delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample">
@ -135,7 +140,8 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample"
resultType="java.lang.Long">
select count(*) from stu_class select count(*) from stu_class
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
@ -193,4 +199,5 @@
school_name = #{schoolName,jdbcType=VARCHAR} school_name = #{schoolName,jdbcType=VARCHAR}
where class_id = #{classId,jdbcType=VARCHAR} where class_id = #{classId,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>

@ -523,4 +523,13 @@
case_score = #{caseScore,jdbcType=DECIMAL} case_score = #{caseScore,jdbcType=DECIMAL}
where exam_manage_id = #{examManageId,jdbcType=VARCHAR} where exam_manage_id = #{examManageId,jdbcType=VARCHAR}
</update> </update>
<select id="selectBySchoolId" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
from tea_exam_manage
where school_id = #{schoolId,jdbcType=VARCHAR}
</select>
</mapper> </mapper>
Loading…
Cancel
Save