Merge remote-tracking branch 'origin/master'

hehai
shijie 4 years ago
commit 0d012f55de
  1. 25
      pom.xml
  2. 3
      src/main/java/com/msdw/tms/api/AchievementManagementApi.java
  3. 2
      src/main/java/com/msdw/tms/api/ProjectRcordControllerApi.java
  4. 3
      src/main/java/com/msdw/tms/api/StudentControllerApi.java
  5. 5
      src/main/java/com/msdw/tms/api/UserInfoControllerApi.java
  6. 4
      src/main/java/com/msdw/tms/common/utils/Constant.java
  7. 163
      src/main/java/com/msdw/tms/common/utils/ExcelImportHelper.java
  8. 70
      src/main/java/com/msdw/tms/common/utils/poi/ExcelExportUtil.java
  9. 2
      src/main/java/com/msdw/tms/config/EmailUtils.java
  10. 3
      src/main/java/com/msdw/tms/config/SendSMS.java
  11. 26
      src/main/java/com/msdw/tms/controller/AchievementManagementController.java
  12. 4
      src/main/java/com/msdw/tms/controller/EvaluationRecordController.java
  13. 30
      src/main/java/com/msdw/tms/controller/ProjectRecordController.java
  14. 47
      src/main/java/com/msdw/tms/controller/StudentController.java
  15. 76
      src/main/java/com/msdw/tms/controller/UserInfoController.java
  16. 2
      src/main/java/com/msdw/tms/dao/AchievementManagementDao.java
  17. 13
      src/main/java/com/msdw/tms/dao/ProjectHiddenDao.java
  18. 9
      src/main/java/com/msdw/tms/dao/ProjectRecordDao.java
  19. 4
      src/main/java/com/msdw/tms/dao/StudentDao.java
  20. 2
      src/main/java/com/msdw/tms/dao/UserInfoDao.java
  21. 34
      src/main/java/com/msdw/tms/entity/ProjectHiddenEntity.java
  22. 3
      src/main/java/com/msdw/tms/entity/ResultsEntity.java
  23. 18
      src/main/java/com/msdw/tms/entity/request/ExperimentProjectRecordImportRequest.java
  24. 4
      src/main/java/com/msdw/tms/entity/response/CommonCode.java
  25. 6
      src/main/java/com/msdw/tms/entity/vo/AchievementManagementVO.java
  26. 4
      src/main/java/com/msdw/tms/entity/vo/ProjectRecordExportVo.java
  27. 15
      src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java
  28. 14
      src/main/java/com/msdw/tms/entity/vo/StudentImportFailureVo.java
  29. 1
      src/main/java/com/msdw/tms/entity/vo/StudentVo.java
  30. 9
      src/main/java/com/msdw/tms/service/AchievementManagementService.java
  31. 7
      src/main/java/com/msdw/tms/service/ProjectHiddenService.java
  32. 4
      src/main/java/com/msdw/tms/service/ProjectRecordService.java
  33. 3
      src/main/java/com/msdw/tms/service/StudentService.java
  34. 3
      src/main/java/com/msdw/tms/service/UserInfoService.java
  35. 86
      src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java
  36. 3
      src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java
  37. 18
      src/main/java/com/msdw/tms/service/impl/ProjectHiddenServiceImpl.java
  38. 80
      src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java
  39. 125
      src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java
  40. 255
      src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java
  41. 9
      src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java
  42. 129
      src/main/java/com/msdw/tms/util/ListPageUtil.java
  43. BIN
      src/main/resources/excel-template/员工导入失败数据导出模板.xlsx
  44. BIN
      src/main/resources/excel-template/学生导入失败数据导出模板(1).xlsx
  45. BIN
      src/main/resources/excel-template/教学实验报告导出模板.xlsx
  46. BIN
      src/main/resources/excel-template/练习记录模板.xlsx
  47. BIN
      src/main/resources/excel-template/考核记录模板.xlsx
  48. BIN
      src/main/resources/excel-template/虚拟仿真实验报告导出模板.xlsx
  49. 38
      src/main/resources/mapper/tms/AchievementManagementDao.xml
  50. 7
      src/main/resources/mapper/tms/ExperimentalReportDao.xml
  51. 14
      src/main/resources/mapper/tms/ProjectHiddenDao.xml
  52. 84
      src/main/resources/mapper/tms/ProjectRecordDao.xml
  53. 13
      src/main/resources/mapper/tms/StudentDao.xml
  54. 4
      src/main/resources/mapper/tms/SystemSetting.xml
  55. 1
      src/main/resources/mapper/tms/UserDao.xml
  56. 6
      src/main/resources/mapper/tms/UserInfoDao.xml

@ -220,10 +220,31 @@
<version>2.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
<!--使用spring boot2整合 pagehelper-spring-boot-starter必须排除一下依赖
因为pagehelper-spring-boot-starter也已经在pom依赖了mybatis与mybatis-spring
所以会与mybatis-plus-boot-starter中的mybatis与mybatis-spring发生冲突
-->
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</exclusion>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--mybatis-plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>

@ -35,6 +35,7 @@ public interface AchievementManagementApi {
@RequestParam(value = "开始时间", required = false) String startTime,
@RequestParam(value = "结束时间", required = false) String endTime,
@RequestParam(value = "月份", required = false) Integer month,
@RequestParam(value = "系统",required = true) Integer systemId,
@RequestParam(value = "页码", required = true) Integer page,
@RequestParam(value = "页数大小", required = true) Integer size);
@ -55,7 +56,7 @@ public interface AchievementManagementApi {
// R updateScore(@ApiParam(value = "recordid和score") ProjectRecordEntity entity);
@ApiOperation(value = "删除实验报告", notes = "根据实验记录主键reportId和实验报告主键recordId删除实验报告")
R deleteReport(@ApiParam(value = "实验记录主键", required = true) Integer reportId, @ApiParam(value = "实验报告主键", required = true) @RequestParam Integer recordId);
R deleteReport(@ApiParam(value = "实验记录主键", required = true) List<Integer> reportId, @ApiParam(value = "实验报告主键", required = true) @RequestParam List<Integer> recordId);
@ApiOperation(value = "班级实验报告列表查询", notes = "班级实验报告列表查询")
R queryEvaluationReport(@ApiParam(value = "搜索内容(学校名称/学生姓名)", required = false) String searchContant,

@ -25,7 +25,7 @@ public interface ProjectRcordControllerApi {
R queryUserRecord(Integer page,Integer size,Integer userId,Integer projectPermissions,Integer systemId);
@ApiOperation(value = "用户端教学实验记录",notes = "用户端教学实验记录")
R getUserExperimentscore(Integer page,Integer size,Integer userid);
R getUserExperimentscore(Integer page,Integer size,Integer userid, Integer systemId);
@ApiOperation(value = "个人实验概览",notes = "个人实验概览")
R queryScore(Integer userId);

@ -18,6 +18,9 @@ public interface StudentControllerApi {
@ApiOperation(value = "新增学生",notes = "新增学生")
public R addStudent(@RequestBody StudentVo studentVo);
@ApiOperation(value = "新增学生",notes = "新增学生")
public R zzAddStudent(@RequestBody StudentVo studentVo);
@ApiOperation(value = "学生列表信息",notes = "学生列表信息")
public R queryStudent(Integer schoolId, String seachContent, Integer page, Integer size);

@ -24,7 +24,10 @@ public interface UserInfoControllerApi {
R getUserId(String token);
@ApiOperation(value = "注册",notes = "注册")
R save(UserInfoEntity entity);
R save(UserInfoEntity entity,@ApiParam(value = "学号",required = true)String workNumber);
@ApiOperation(value = "注册",notes = "注册")
R zzAdd(UserInfoEntity entity,@ApiParam(value = "学号",required = true)String workNumber);
@ApiOperation(value = "个人中心信息展示",notes = "个人中心信息展示")
R userInfo(Integer id);

@ -54,6 +54,10 @@ public class Constant {
* 通过excel批量导入试题数据时起始行
*/
public static final int ROW_INDEX = 2;
/**
* 通过excel批量导入试题数据时起始行(专门用于练习考核报告的
*/
public static final int ROW_INDEX_REPORT = 3;
/**
* 通过excel批量导入试题数据时起始行
*/

@ -1,7 +1,12 @@
package com.msdw.tms.common.utils;
import com.msdw.tms.common.exception.ExceptionCast;
import com.msdw.tms.entity.response.CommonCode;
import com.msdw.tms.entity.vo.StaffVo;
import com.msdw.tms.entity.vo.StudentVo;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -13,12 +18,59 @@ import java.util.List;
public class ExcelImportHelper {
//判断row是否为空
public static boolean isRowEmpty(Row row) {
if (null == row) {
return true;
}
int firstCellNum = row.getFirstCellNum(); //第一个列位置
int lastCellNum = row.getLastCellNum(); //最后一列位置
int nullCellNum = 0; //空列数量
for (int c = firstCellNum; c < lastCellNum; c++) {
Cell cell = row.getCell(c);
if (null == cell || CellType.BLANK == cell.getCellType()) {
nullCellNum++;
continue;
}
cell.setCellType(CellType.STRING);
String cellValue = cell.getStringCellValue().trim();
if (StringUtils.isEmpty(cellValue)) {
nullCellNum++;
}
}
//所有列都为空
if (nullCellNum == (lastCellNum - firstCellNum)) {
return true;
}
return false;
}
//todo 解决POI无法同时读取带多种格式的单元格表格
public static String getValue(Cell cell) {
if (cell == null) {
return "";
} else if (cell.getCellType() == CellType.BOOLEAN) {
return String.valueOf(cell.getBooleanCellValue());
} else if (cell.getCellType() == CellType.NUMERIC) {
String value = "";
return value;
} else {
return String.valueOf(cell.getStringCellValue());
}
}
/**
* 读取学生管理
*
* @param file
* @return
*/
public static List<StudentVo> readStudent(MultipartFile file) {
public static List<StudentVo> readStudent(MultipartFile file) throws IOException {
List<StudentVo> list = new ArrayList<StudentVo>();
Workbook workbook = getWorkbook(file);
@ -29,38 +81,57 @@ public class ExcelImportHelper {
if (hssfSheet == null) {
continue;
}
int count = 1;
// 循环行Row//开始行2
for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
Row row = hssfSheet.getRow(rowNum);
if (isRowEmpty(row)) {
count++;
if (count == hssfSheet.getLastRowNum()) {
ExceptionCast.cast(CommonCode.EXCEL_FILE_NULL);
}
continue;
}
if (row == null) {
continue;
} else if (
StringUtils.isEmpty(getValue(row.getCell(0))) &&
StringUtils.isEmpty(getValue(row.getCell(1))) &&
StringUtils.isEmpty(getValue(row.getCell(2)))) {
continue;
}
Cell phone;
Cell email;
if (row != null) {
student = new StudentVo();
row.getCell(0).setCellType(CellType.STRING);
Cell studentName = row.getCell(0);
row.getCell(1).setCellType(CellType.STRING);
Cell schoolAppellationName = row.getCell(1);
Cell account = row.getCell(1);
row.getCell(2).setCellType(CellType.STRING);
Cell account = row.getCell(2);
Cell studentNumber = row.getCell(2);
if (row.getCell(3) != null) {
row.getCell(3).setCellType(CellType.STRING);
Cell studentNumber = row.getCell(3);
if (row.getCell(4)!=null){
row.getCell(4).setCellType(CellType.STRING);
phone = row.getCell(4);
phone = row.getCell(3);
} else {
phone = row.createCell(4);
phone = row.createCell(3);
}
if (row.getCell(5)!=null){
row.getCell(5).setCellType(CellType.STRING);
email = row.getCell(5);
if (row.getCell(4) != null) {
row.getCell(4).setCellType(CellType.STRING);
email = row.getCell(4);
} else {
email = row.createCell(5);
email = row.createCell(4);
}
// row.getCell(4).setCellType(CellType.STRING);
// Cell phone = row.getCell(4);
// row.getCell(5).setCellType(CellType.STRING);
// Cell email = row.getCell(5);
// 学生姓名
@ -69,8 +140,6 @@ public class ExcelImportHelper {
student.setRoleId(ConstantUtils.STUDENT_ROLE);
// 学生学号
student.setWorkNumber(studentNumber.getStringCellValue());
//所属院校
student.setSchoolAppellationName(schoolAppellationName.getStringCellValue());
//用户账号
student.setAccount(account.getStringCellValue());
//电话
@ -87,12 +156,15 @@ public class ExcelImportHelper {
return list;
}
/**
* 读取员工管理
*
* @param file
* @return
*/
public static List<StaffVo> readStaff(MultipartFile file) {
public static List<StaffVo> readStaff(MultipartFile file) throws IOException {
List<StaffVo> list = new ArrayList<StaffVo>();
Workbook workbook = getWorkbook(file);
@ -103,39 +175,62 @@ public class ExcelImportHelper {
if (hssfSheet == null) {
continue;
}
int lastRowNum = hssfSheet.getLastRowNum()+1;//最后一行行标,比行数小1
/*int lastRowNum = hssfSheet.getLastRowNum() + 1;//最后一行行标,比行数小1
if (lastRowNum == 2) {
break;
}
}*/
int count = 1;
// 循环行Row//开始行2
for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
Row row = hssfSheet.getRow(rowNum);
Cell userName;
if (isRowEmpty(row)) {
count++;
if (count == hssfSheet.getLastRowNum()) {
ExceptionCast.cast(CommonCode.EXCEL_FILE_NULL);
}
continue;
}
Cell phone;
Cell email;
Cell staffGradeName;
Cell staffProfessionalArchitectureName;
Cell staffGradeNameTwo;
Cell staffProfessionalArchitectureNameTwo;
if (row != null) {
/*Cell account;
Cell role;
Cell workNumber;*/
Cell userName;
if (row == null) {
continue;
} else {
staff = new StaffVo();
if (row.getCell(0) != null) {
row.getCell(0).setCellType(CellType.STRING);
userName = row.getCell(0);
} else {
continue;
userName = row.createCell(0);
}
//姓名
/* row.getCell(0).setCellType(CellType.STRING);
String userName = row.getCell(0).getStringCellValue();*/
//账号
row.getCell(1).setCellType(CellType.STRING);
Cell account = row.getCell(1);
//角色
row.getCell(2).setCellType(CellType.STRING);
Cell role = row.getCell(2);
//工号
row.getCell(3).setCellType(CellType.STRING);
Cell workNumber = row.getCell(3);
// row.getCell(4).setCellType(CellType.STRING);
// Cell staffGradeName = row.getCell(4);
if (row.getCell(4) != null) {
row.getCell(4).setCellType(CellType.STRING);
staffProfessionalArchitectureName = row.getCell(4);
@ -160,14 +255,6 @@ public class ExcelImportHelper {
} else {
staffGradeNameTwo = row.createCell(7);
}
// row.getCell(5).setCellType(CellType.STRING);
// Cell staffProfessionalArchitectureName = row.getCell(5);
// row.getCell(6).setCellType(CellType.STRING);
// Cell staffGradeNameTwo = row.getCell(6);
// row.getCell(7).setCellType(CellType.STRING);
// Cell staffProfessionalArchitectureNameTwo = row.getCell(7);
if (row.getCell(8) != null) {
row.getCell(8).setCellType(CellType.STRING);
phone = row.getCell(8);
@ -180,11 +267,9 @@ public class ExcelImportHelper {
} else {
email = row.createCell(9);
}
row.getCell(10).setCellType(CellType.STRING);
Cell schoolAppellationName = row.getCell(10);
// row.getCell(11).setCellType(CellType.STRING);
// Cell failureMsg = row.getCell(11);
/*row.getCell(10).setCellType(CellType.STRING);
Cell schoolAppellationName = row.getCell(10);*/
String roleValue = role.getStringCellValue();
String str;
@ -218,7 +303,7 @@ public class ExcelImportHelper {
//邮箱
staff.setEmail(email.getStringCellValue());
//所属院校
staff.setSchoolAppellationName(schoolAppellationName.getStringCellValue());
//staff.setSchoolAppellationName(schoolAppellationName.getStringCellValue());
//学校id
staff.setSchoolId(ConstantUtils.Keda_schoolId);
list.add(staff);

@ -1,5 +1,6 @@
package com.msdw.tms.common.utils.poi;
import com.msdw.tms.entity.vo.StudentVo;
import lombok.Data;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -8,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@ -75,6 +77,74 @@ public class ExcelExportUtil<T> {
workbook.write(response.getOutputStream());
}
/**
* 基于注解导出(新增需求拓展
* 参数
* response
* InputStream:模板的输入流
* objs数据
* obj:拓展对象
* fileName生成的文件名
*/
public void exportExpand(HttpServletResponse response, InputStream is, List<T> objs,Object obj, String fileName) throws Exception {
//1.根据模板创建工作簿
XSSFWorkbook workbook = new XSSFWorkbook(is);
//2.读取工作表
Sheet sheet = workbook.getSheetAt(0);
Row row1 = sheet.getRow(styleIndex);
//3.提取公共的样式
CellStyle[] styles = getTemplateStyles(row1);
//导出学生姓名,学号
Sheet sheet1 = this.exportStudentInfo(sheet,(StudentVo)obj);
//4.根据数据创建每一行和每一个单元格的数据2
AtomicInteger datasAi = new AtomicInteger(rowIndex); //数字
for (T t : objs) {
//datasAi.getAndIncrement() :获取数字,并++ i++
Row row = sheet1.createRow(datasAi.getAndIncrement());
for (int i = 0; i < styles.length; i++) {
Cell cell = row.createCell(i);
cell.setCellStyle(styles[i]);
for (Field field : fields) {
if (field.isAnnotationPresent(ExcelAttribute.class)) {
field.setAccessible(true);
ExcelAttribute ea = field.getAnnotation(ExcelAttribute.class);
if (i == ea.sort()) {
if (field.get(t) != null) {
cell.setCellValue(field.get(t).toString());
}
}
}
}
}
}
fileName = URLEncoder.encode(fileName, "UTF-8");
response.setContentType("application/octet-stream");
response.setHeader("content-disposition", "attachment;filename=" + new String(fileName.getBytes("ISO8859-1")));
response.setHeader("filename", fileName);
workbook.write(response.getOutputStream());
}
/**
* 添加姓名学号的导出
* @param sheet
* @return
*/
private Sheet exportStudentInfo(Sheet sheet,StudentVo studentVo){
Integer ROW_INDEX = 1;
Integer CELL_INDEX_NAME = 1;
Integer CELL_INDEX_WORKNUMBER = 3;
sheet.getRow(ROW_INDEX).getCell(CELL_INDEX_NAME).setCellValue(studentVo.getUserName());
sheet.getRow(ROW_INDEX).getCell(CELL_INDEX_WORKNUMBER).setCellValue(studentVo.getWorkNumber());
return sheet;
}
CellStyle[] getTemplateStyles(Row row) {
CellStyle[] styles = new CellStyle[row.getLastCellNum()];
for (int i = 0; i < row.getLastCellNum(); i++) {

@ -30,6 +30,8 @@ public class EmailUtils {
try {
HtmlEmail email = new HtmlEmail();
email.setHostName(SERVER_ADDRESS);
email.setSSLOnConnect(true); //使用ssl加密true
email.setSslSmtpPort("465"); //使用465端口
email.setCharset("UTF-8");
email.addTo(emailaddress);

@ -16,7 +16,7 @@ public class SendSMS {
private static final String PHONSMSTEMPLATE = "SMS_204155294";
public static void main(String[] args){
String mobile="17722612183";//需要接受短信验证码的手机号
String mobile="12345678910";//需要接受短信验证码的手机号
// String sendTemplate="SMS_204155294";//短信模板ID,需要去阿里云平台申请,审核通过后方能使用,通常是以"SMS_"开头字符串
String code = (int)((Math.random() * 9 + 1) * 100000)+ "";//要发送给用户的短信验证码,行业通常使用六位纯数字
@ -26,7 +26,6 @@ public class SendSMS {
}else{
System.out.println("短信发送失败");
}
}
/**
* 通过阿里云平台发送短信如果发送成功返回"OK" ;否则返回的是错误信息

@ -1,23 +1,26 @@
package com.msdw.tms.controller;
import com.github.pagehelper.PageInfo;
import com.msdw.tms.api.AchievementManagementApi;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.*;
import com.msdw.tms.entity.vo.AchievementManagementVO;
import com.msdw.tms.entity.vo.ResultsVo;
import com.msdw.tms.service.AchievementManagementService;
import com.msdw.tms.service.ProjectRecordService;
import com.msdw.tms.util.ListPageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
* 成绩管理
*/
@CrossOrigin
@RestController
@RequestMapping("/Achievement")
public class AchievementManagementController implements AchievementManagementApi {
@ -89,7 +92,9 @@ public class AchievementManagementController implements AchievementManagementApi
if (endTime != null) {
vo.setEndTime(endTime);
}
List<ResultsEntity> result = service.list(vo, page, size);
PageInfo<ResultsEntity> result = service.list(vo, page, size);
return R.ok().put("data", result);
}
@ -103,6 +108,7 @@ public class AchievementManagementController implements AchievementManagementApi
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) Integer month,
@RequestParam(required = true) Integer systemId,
@RequestParam(required = true) Integer page,
@RequestParam(required = true) Integer size) {
ResultsVo vo = new ResultsVo();
@ -120,7 +126,10 @@ public class AchievementManagementController implements AchievementManagementApi
if (endTime != null) {
vo.setEndTime(endTime);
}
List<ResultsEntity> result = service.newList(vo, page, size);
if (systemId != null){
vo.setSystemId(systemId);
}
PageInfo<ResultsEntity> result = service.newList(vo, page, size);
return R.ok().put("data", result);
}
@ -198,7 +207,16 @@ public class AchievementManagementController implements AchievementManagementApi
*/
@Override
@PostMapping("/deleteReport")
public R deleteReport(@RequestParam Integer reportId, @RequestParam Integer recordId) {
public R deleteReport(@RequestParam List<Integer> reportId, @RequestParam List<Integer> recordId) {
if (reportId == null || reportId.size() == 0){
return R.error(400,"参数错误!");
}
if (recordId == null || recordId.size() == 0){
return R.error(400,"参数错误!");
}
if (reportId.size() != recordId.size()){
return R.error(400,"参数错误!");
}
R result = service.deleteReport(reportId, recordId);
return result;
}

@ -134,7 +134,7 @@ public class EvaluationRecordController implements EvaluationRecordControllerApi
Integer id = fractionEntityService.queryScore(userId,type);
if (id>0){
Integer score = fractionEntityService.queryExerciseRecord(userId);
if (score>=60){
if (score>=80){
return R.ok("true");
}else{
return R.error(200,"false");
@ -152,7 +152,7 @@ public class EvaluationRecordController implements EvaluationRecordControllerApi
Integer id = fractionEntityService.queryScore(userId,type);
if (id>0){
Integer score = fractionEntityService.queryTeachingRecord(userId);
if (score>=60){
if (score>=80){
return R.ok("true");
}else{
return R.error(200,"false");

@ -8,6 +8,7 @@ import com.msdw.tms.entity.ProjectEntity;
import com.msdw.tms.entity.ProjectRecordEntity;
import com.msdw.tms.entity.vo.ProjectRecordVo;
import com.msdw.tms.service.ProjectRecordService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@ -18,8 +19,6 @@ import java.util.HashMap;
import java.util.List;
/**
*
*
* @author
* @email
* @date 2020-08-19 16:07:02
@ -40,13 +39,17 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
ProjectRecordVo recordVo = new ProjectRecordVo();
if (!StringUtils.isEmpty(month)) {
recordVo.setMonth(month);
}if(!StringUtils.isEmpty(startTime)) {
}
if (!StringUtils.isEmpty(startTime)) {
recordVo.setStartTime(startTime);
}if(!StringUtils.isEmpty(endTime)) {
}
if (!StringUtils.isEmpty(endTime)) {
recordVo.setEndTime(endTime);
}if(!StringUtils.isEmpty(recordState)) {
}
if (!StringUtils.isEmpty(recordState)) {
recordVo.setRecordstate(recordState);
}if(!StringUtils.isEmpty(condition)){
}
if (!StringUtils.isEmpty(condition)) {
recordVo.setCondition(condition);
}
PageUtils page1 = projectRecordService.querySchoolRecord(page, size, recordVo);
@ -55,7 +58,8 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
}
/**
* 用户端虚拟仿真实验记录
* 用户端虚拟仿真实验记录(练习列表)
*
* @param page
* @param size
* @param
@ -70,6 +74,7 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
/**
* 科大用户端虚拟仿真实验记录
*
* @param page
* @param size
* @param
@ -83,7 +88,8 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
}
/**
* 用户端教学实验记录
* 用户端教学实验记录考核列表
*
* @param page
* @param size
* @param userid
@ -91,14 +97,15 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
*/
@Override
@GetMapping("/user/experimentRecord")
public R getUserExperimentscore(@RequestParam Integer page,@RequestParam Integer size,@RequestParam Integer userid){
PageUtils page1 = projectRecordService.queryExperimentPage(page,size,userid);
public R getUserExperimentscore(@RequestParam Integer page, @RequestParam Integer size, @RequestParam Integer userid, @RequestParam Integer systemId) {
PageUtils page1 = projectRecordService.queryExperimentPage(page, size, userid, systemId);
return R.ok().put("data", page1);
}
/**
* 个人实验预览
*
* @param userId
* @return
*/
@ -112,6 +119,7 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
/**
* 个人实验预览
*
* @param userid
* @return
*/
@ -125,6 +133,7 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
/**
* 导出个人虚拟仿真实验记录
*
* @param response
* @param userId
* @throws Exception
@ -138,6 +147,7 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
/**
* 导出个人教学实验记录
*
* @param response
* @param userId
* @throws Exception

@ -40,13 +40,13 @@ public class StudentController implements StudentControllerApi{
private UserInfoService userInfoService;
/**
* 新增学生
* 职站新增学生
* @param studentVo
* @return
*/
@Transactional
@Override
@PostMapping("/addStudent")
@PostMapping("/zzAddStudent")
public R addStudent(@RequestBody @Valid StudentVo studentVo){
studentVo.setSchoolId(ConstantUtils.Keda_schoolId);
String account = studentVo.getAccount();
@ -83,6 +83,49 @@ public class StudentController implements StudentControllerApi{
}
}
/**
* 科大新增学生
* @param studentVo
* @return
*/
@Transactional
@Override
@PostMapping("/addStudent")
public R zzAddStudent(@RequestBody @Valid StudentVo studentVo){
String account = studentVo.getAccount();
String phone = studentVo.getPhone();
Integer schoolId = studentVo.getSchoolId();
Integer result = studentService.queryStudentIdNumber(studentVo.getWorkNumber(),schoolId);
Integer res = userInfoService.queryStudentAccount(account,schoolId);
if (phone!=null&&phone!=""){
Integer outcome = userInfoService.queryStudentPhone(phone);
if(outcome==1){
return R.error("手机号不能重复,只能绑定一个用户");
}
}
String email = studentVo.getEmail();
if (result==1){
return R.error("学号不能重复");
}else if (res==1){
return R.error("账号不能重复");
}
else{
UserInfoEntity userInfoList = new UserInfoEntity();
userInfoList.setAccount(account)
.setPhone(phone)
.setEmail(studentVo.getEmail())
.setSchoolId(studentVo.getSchoolAppellationId())
.setUserName(studentVo.getUserName())
.setToken(new ConstantUtils().token);
userInfoService.saveUserInfo(userInfoList);
studentVo.setUserId(userInfoList.getUserId()).setPlatformId(ConstantUtils.PLATFORMID);//暂时写死平台id(PlatformId)
boolean saveStudent = studentService.saveStudent(studentVo);
return saveStudent ? R.ok() : R.error();
}
}
/**
* 学生列表
* @param schoolId

@ -8,6 +8,7 @@ import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.UserInfoEntity;
import com.msdw.tms.entity.UserPersonalFileEntity;
import com.msdw.tms.entity.vo.CheckVo;
import com.msdw.tms.entity.vo.StudentVo;
import com.msdw.tms.entity.vo.UserEntityVo;
import com.msdw.tms.entity.vo.UserProsonalEntityVo;
import com.msdw.tms.service.StudentService;
@ -58,27 +59,82 @@ public class UserInfoController implements UserInfoControllerApi {
@Override
@Transactional
@PostMapping("/add")
public R save(@RequestBody UserInfoEntity userInfoEntity){
public R save(@RequestBody UserInfoEntity userInfoEntity,@RequestParam String workNumber){
String token ="UT_"+ UUID.randomUUID().toString().replace("-", "");
userInfoEntity.setToken(token);
userInfoEntity.setSchoolId(2105);
Integer schoolId = userInfoEntity.getSchoolId();
Integer integer = userInfoService.queryStudentAccount(userInfoEntity.getAccount(),schoolId);
Integer integer1 = userInfoService.queryStudentPhone(userInfoEntity.getPhone());
//新增学生
StudentVo studentVo = new StudentVo();
studentVo.setRoleId(Integer.valueOf(userInfoEntity.getRoleId()));
studentVo.setSchoolId(schoolId);
studentVo.setIsdel(0);
studentVo.setWorkNumber(workNumber);
studentVo.setPlatformId(1);
//为1 学号有重复
int num = studentService.queryStudentByWorkNumber(studentVo);
if (integer==1){
return R.error(400,"账号已存在");
}
if (integer1==1){
return R.error(400,"改手机号已被绑定");
return R.error(400,"该手机号已被绑定");
}
if (num == 1){
return R.error(400,"该学号重复!");
}
int userId = userInfoService.add(userInfoEntity);
if (userId==0){
return R.error(400,"添加用户信息失败");
}
// userInfoEntity.setUserId(userId);
studentService.addStudentInfo(userInfoEntity);
studentVo.setUserId(userInfoEntity.getUserId());
return studentService.addStudentInfo(studentVo);
}
return R.ok();
/**
* 职站注册
*/
@Override
@Transactional
@PostMapping("/zzAdd")
public R zzAdd(@RequestBody UserInfoEntity userInfoEntity,@RequestParam String workNumber){
String token ="UT_"+ UUID.randomUUID().toString().replace("-", "");
userInfoEntity.setToken(token);
userInfoEntity.setSchoolId(2105);
Integer schoolId = userInfoEntity.getSchoolId();
Integer integer = userInfoService.queryStudentAccount(userInfoEntity.getAccount(),schoolId);
Integer integer1 = userInfoService.queryStudentPhone(userInfoEntity.getPhone());
//新增学生
StudentVo studentVo = new StudentVo();
studentVo.setRoleId(Integer.valueOf(userInfoEntity.getRoleId()));
studentVo.setSchoolId(schoolId);
studentVo.setIsdel(0);
studentVo.setWorkNumber(workNumber);
studentVo.setPlatformId(1);
//为1 学号有重复
int num = studentService.queryStudentByWorkNumber(studentVo);
if (integer==1){
return R.error(400,"账号已存在");
}
if (integer1==1){
return R.error(400,"该手机号已被绑定");
}
if (num == 1){
return R.error(400,"该学号重复!");
}
int userId = userInfoService.add(userInfoEntity);
if (userId==0){
return R.error(400,"添加用户信息失败");
}
// userInfoEntity.setUserId(userId);
studentVo.setUserId(userInfoEntity.getUserId());
return studentService.addStudentInfo(studentVo);
}
/**
@ -126,6 +182,12 @@ public class UserInfoController implements UserInfoControllerApi {
UserInfoEntity userInfo = vo.getUserInfoEntity();
Integer userId = userInfo.getUserId();
String password = userInfo.getPassword();
//验证账号是否存在
int num = userInfoService.queryAccountExist(userInfo.getAccount());
if (num >= 1){
return R.error(500,"更新失败,账号不能重复");
}
String userPassword = userInfoService.queryPasword(userId);
if (userPassword.equals(password)==true){
return R.error(400,"false,the password is the same!!!");
@ -207,7 +269,7 @@ public class UserInfoController implements UserInfoControllerApi {
@Override
@GetMapping("/getUserId")
public R getUserId(@RequestParam String token){
Integer userId = userInfoService.getUserId(token);
return R.ok().put("userId", userId);
R result = userInfoService.getUserId(token);
return result;
}
}

@ -56,7 +56,7 @@ public interface AchievementManagementDao extends BaseMapper<ExperimentalReportE
List<AchievementImportRequest> queryAchievement(@Param("ids") List<Integer> ids);
//导出考核
List<ImportAssessmentRequest> queryAchievementByAssessment(Integer id);
List<ImportAssessmentRequest> queryAchievementByAssessment(@Param("ids") List<Integer> ids);
List<AchievementManagementVO> queryFictitiousRecord(Integer systemId, String searchContant, String startingtime, String endtime, Integer month, List<Integer> projectIds);

@ -0,0 +1,13 @@
package com.msdw.tms.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.msdw.tms.entity.ProjectHiddenEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ProjectHiddenDao extends BaseMapper<ProjectHiddenEntity> {
ProjectHiddenEntity selectByProjectId(Integer projectId);
ProjectHiddenEntity selectByTeachId(Integer teachId);
}

@ -27,7 +27,7 @@ public interface ProjectRecordDao extends BaseMapper<ProjectRecordEntity> {
IPage<GetByUserRecordResp> getByUserRecord(Page page, @Param("userId") Integer userId, @Param("projectPermissions") Integer projectPermissions, @Param("systemId") Integer systemId);
IPage<ProjectRecordVo> getByUserExperimentRecord(Page page, @Param("pro") ProjectRecordEntity projectRecordEntity);
IPage<ProjectRecordVo> getByUserExperimentRecord(Page page, @Param("pro") ProjectRecordEntity projectRecordEntity, Integer systemId);
List<ProjectRecordExportVo> getByUserRecordImport(ProjectRecordEntity projectRecordEntity);
@ -46,4 +46,11 @@ public interface ProjectRecordDao extends BaseMapper<ProjectRecordEntity> {
ProjectRecordEntity queryReport(Integer recordId);
void updateScore(ProjectRecordEntity vo);
//练习统计
List<GetByUserRecordResp> sumByPracticeNum(Integer userId);
//考核统计
List<ProjectRecordVo> sumByAssessmentNum(Integer userId);
}

@ -28,7 +28,7 @@ public interface StudentDao extends BaseMapper<StudentEntity> {
void updateWorkNumber(String workNumber,Integer studentId);
boolean addStudentInfo(UserInfoEntity userInfoEntity);
boolean addStudentInfo(StudentVo studentVo);
List<Integer> querySchoolName(String schoolAppellationName);
@ -37,4 +37,6 @@ public interface StudentDao extends BaseMapper<StudentEntity> {
int querySchoolAppellationName(String schoolAppellationName);
List<StudentVo> queryAccount(String account,Integer schoolId);
int queryStudentByWorkNumber(StudentVo studentVo);
}

@ -66,4 +66,6 @@ public interface UserInfoDao extends BaseMapper<UserInfoEntity> {
List<String> queryStudentName(Integer userId);
Integer getUserId(String token);
Integer queryAccountExist(String account);
}

@ -0,0 +1,34 @@
package com.msdw.tms.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@ApiModel(value = "此表是在教师端成绩管理,虚仿以及教学列表展示中使用到")
@TableName("tms_project_hidden")
public class ProjectHiddenEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "主键")
private Integer id;
@ApiModelProperty(value = "项目id(对应hr_project_management主键)")
private Integer projectId;
@ApiModelProperty(value = "实验教学id(对应tms_experimental_teaching主键)")
private Integer teachId;
@ApiModelProperty(value = "是否隐藏(0不隐藏,1隐藏)")
private Integer isHidden;
}

@ -48,8 +48,7 @@ public class ResultsEntity{
//实验名称
private String experimentalName;
//是否删除
private Integer isdel;
}

@ -8,36 +8,42 @@ import lombok.Data;
*/
@Data
public class ExperimentProjectRecordImportRequest {
/**
* 实验班级名称
* 实验名称(即考核名称
*/
@ExcelAttribute(sort = 0)
private String experimentalName;
/**
* 实验班级名称
*/
@ExcelAttribute(sort = 1)
private String experimentalClassName;
/**
* 实验项目名称
*/
@ExcelAttribute(sort = 1)
@ExcelAttribute(sort = 2)
private String projectName;
/**
* 得分
*/
@ExcelAttribute(sort = 2)
@ExcelAttribute(sort = 3)
private Integer score;
/**
* 耗时
*/
@ExcelAttribute(sort = 3)
@ExcelAttribute(sort = 4)
private Integer timeSum;
/**
* 起始时间
*/
@ExcelAttribute(sort = 4)
@ExcelAttribute(sort = 5)
private String startTime;
/**
* 结束时间
*/
@ExcelAttribute(sort = 5)
@ExcelAttribute(sort = 6)
private String endTime;
}

@ -17,8 +17,12 @@ public enum CommonCode implements ResultCode {
EXCEL_FILE_INVALID(false, 10009, "上传excel文件错误!"),
REPEAT_INEXCEL(false, 10010, "试题在excel表中重复!"),
EVALUATION_QUESTION_NUM_INVALID(false, 10011, "当前测评题数设置为0,请先设置测评题数!"),
EXCEL_FILE_NULL(false, 100011, "导入失败,导入数据为空!"),
EXCEL_FILE_FORMAT_ERROR(false, 100012, "请根据模板使用说明录入正确的学生信息!"),
EXCEL_FILE_FORMAT_ERROR_STAFFS(false, 100012, "请根据模板使用说明录入正确的员工信息!"),
FAIL(false, 11111, "操作失败!"),
ROLE_NAME_EXIST(false, 20001, "该角色名称已存在,请重新输入!"),
ROLE_EMP_EXIST(false, 44001, "该角色有用户关联,不能删除!"),
SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!");

@ -88,4 +88,10 @@ public class AchievementManagementVO extends ExperimentalReportEntity {
private String answer;
//判分点名称
private String judgmentPointsName;
//学生id
private Integer studentId;
//运行有没有出现错误(0、运行正确 1、运行错误
private Integer isError;
}

@ -88,4 +88,8 @@ public class ProjectRecordExportVo extends ProjectRecordEntity implements Serial
* 实验班级名称
*/
private String experimental_class_name;
/**
* 实验名称(即考核名称
*/
private String experimentalName;
}

@ -5,6 +5,7 @@ import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@Data
@ -76,7 +77,9 @@ public class ProjectRecordVo extends ProjectRecordEntity implements Serializable
* 待评分
*/
private Integer tobescored;
/** 记录状态(0 未修改,1 已修改)*/
/**
* 记录状态0 未修改1 已修改
*/
private Integer recordState;
// =====================================记录实验项目信息
/**
@ -95,7 +98,10 @@ public class ProjectRecordVo extends ProjectRecordEntity implements Serializable
* 实验班级名
*/
private String experimentalClassName;
/**
* 实验名称
*/
private String experimentalName;
/**
* 封装多个项目id
*/
@ -109,4 +115,9 @@ public class ProjectRecordVo extends ProjectRecordEntity implements Serializable
*/
private Integer schoolId;
/**
* 系统id
*/
private Integer systemId;
}

@ -15,23 +15,23 @@ public class StudentImportFailureVo {
//用户姓名
@ExcelAttribute(sort = 0)
private String userName;
//所属院校
/*//所属院校
@ExcelAttribute(sort = 1)
private String schoolAppellationName;
private String schoolAppellationName;*/
//账号
@ExcelAttribute(sort = 2)
@ExcelAttribute(sort = 1)
private String account;
//学号
@ExcelAttribute(sort = 3)
@ExcelAttribute(sort = 2)
private String workNumber;
//手机号码
@ExcelAttribute(sort = 4)
@ExcelAttribute(sort = 3)
private String phone;
//邮箱
@ExcelAttribute(sort = 5)
@ExcelAttribute(sort = 4)
private String email;
//失败原因
@ExcelAttribute(sort = 6)
@ExcelAttribute(sort = 5)
private String failureMsg;
//
// @ExcelAttribute(sort = 7)

@ -5,6 +5,7 @@ import com.msdw.tms.entity.UserInfoEntity;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.List;

@ -1,16 +1,15 @@
package com.msdw.tms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.ExperimentalReportEntity;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.ReportEntity;
import com.msdw.tms.entity.ResultsEntity;
import com.msdw.tms.entity.vo.AchievementManagementVO;
import com.msdw.tms.entity.vo.ResultsVo;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
public interface AchievementManagementService extends IService<ExperimentalReportEntity> {
@ -21,10 +20,10 @@ public interface AchievementManagementService extends IService<ExperimentalRepor
//查询知道老师
R getTeacher(Integer projectId);
List<ResultsEntity> list(ResultsVo vo, Integer page, Integer size);
PageInfo<ResultsEntity> list(ResultsVo vo, Integer page, Integer size);
//查询实验教学列表
List<ResultsEntity> newList(ResultsVo vo, Integer page, Integer size);
PageInfo<ResultsEntity> newList(ResultsVo vo, Integer page, Integer size);
List<ReportEntity> reportList(ResultsVo vo, Integer page, Integer size);
@ -32,7 +31,7 @@ public interface AchievementManagementService extends IService<ExperimentalRepor
R queryReport(Integer reportId);
R deleteReport(Integer reportId, Integer recordId);
R deleteReport(List<Integer> reportId,List<Integer> recordId);
R queryEvaluationReport(String searchContant, Integer projectId, Integer page, Integer size);

@ -0,0 +1,7 @@
package com.msdw.tms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.msdw.tms.entity.ProjectHiddenEntity;
public interface ProjectHiddenService extends IService<ProjectHiddenEntity> {
}

@ -20,8 +20,9 @@ public interface ProjectRecordService extends IService<ProjectRecordEntity> {
PageUtils queryPage(Integer page, Integer size, Integer userId, Integer projectPermissions, Integer systemId);
PageUtils queryExperimentPage(Integer page, Integer size, Integer userid);
PageUtils queryExperimentPage(Integer page, Integer size, Integer userid, Integer systemId);
//学生端实验概览
ProjectRecordVo queryUserScore(Integer userId);
ProjectRecordVo queryScore(Integer userId);
@ -35,5 +36,6 @@ public interface ProjectRecordService extends IService<ProjectRecordEntity> {
boolean updateUserRecord(ProjectRecordEntity projectRecord);
void updateScore(ProjectRecordEntity vo);
}

@ -30,7 +30,7 @@ public interface StudentService extends IService<StudentEntity>{
void updateWorkNumber(Integer studentId);
R addStudentInfo(UserInfoEntity userInfoEntity);
R addStudentInfo(StudentVo studentVo);
void downloadFiles(HttpServletResponse response) throws IOException;
@ -40,4 +40,5 @@ public interface StudentService extends IService<StudentEntity>{
R queryAccount(String account,Integer schoolId);
int queryStudentByWorkNumber(StudentVo studentVo);
}

@ -48,6 +48,7 @@ public interface UserInfoService extends IService<UserInfoEntity> {
R queryAccount();
Integer getUserId(String token);
R getUserId(String token);
Integer queryAccountExist(String account);
}

@ -3,14 +3,13 @@ package com.msdw.tms.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.msdw.tms.common.utils.Constant;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.R;
import com.msdw.tms.common.utils.poi.ExcelExportUtil;
import com.msdw.tms.dao.AchievementManagementDao;
import com.msdw.tms.dao.ExperimentalTeachingDao;
import com.msdw.tms.dao.ProjectRecordDao;
import com.msdw.tms.dao.UserInfoDao;
import com.msdw.tms.dao.*;
import com.msdw.tms.entity.*;
import com.msdw.tms.entity.request.AchievementImportRequest;
import com.msdw.tms.entity.request.ImportAssessmentRequest;
@ -46,6 +45,9 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
@Autowired
private UserInfoDao userInfoDao;
@Autowired
private ProjectHiddenDao projectHiddenDao;
//查询实验报告
@Override
@Transactional
@ -88,18 +90,41 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
* @return
*/
@Override
public List<ResultsEntity> list(ResultsVo vo, Integer page, Integer size) {
public PageInfo<ResultsEntity> list(ResultsVo vo, Integer page, Integer size) {
//使用分页插件,核心代码就这一行
PageHelper.startPage(page, size);
List<ResultsEntity> list = achievementManagementDao.list(vo);
PageInfo info = new PageInfo(list);
for (ResultsEntity entity : list) {
Integer number = achievementManagementDao.getImitationAchievement(entity.getProjectId()).size();
entity.setNumber(number);
}
/*
Date begin = new Date();
list.parallelStream().forEach(x -> {
x.setNumber(achievementManagementDao.getImitationAchievement(x.getProjectId()).size());
x.setProjectHiddenEntity(projectHiddenDao.selectByProjectId(x.getProjectId()));
});
Date end = new Date();
// System.out.println("时间1:" + (end.getTime() - begin.getTime()));
Date begin1 = new Date();
for (ResultsEntity entity : list) {
Integer number = achievementManagementDao.getImitationAchievement(entity.getProjectId()).size();
entity.setNumber(number);
ProjectHiddenEntity hiddenEntity = projectHiddenDao.selectByProjectId(entity.getProjectId());
entity.setProjectHiddenEntity(hiddenEntity);
}
Date end1 = new Date();*/
//System.out.println("时间2:" + (end1.getTime() - begin1.getTime()));
return list;
// PageInfo<ResultsEntity> ret = new PageInfo<>();
return info;
}
@Override
@ -109,13 +134,17 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
}
@Override
public List<ResultsEntity> newList(ResultsVo vo, Integer page, Integer size) {
public PageInfo<ResultsEntity> newList(ResultsVo vo, Integer page, Integer size) {
//使用分页插件,核心代码就这一行
PageHelper.startPage(page, size);
List<ResultsEntity> newList = achievementManagementDao.newList(vo);
for (ResultsEntity entity : newList) {
Integer number = achievementManagementDao.getTeachAchievement(entity.getId()).size();
entity.setNumber(number);
}
return newList;
PageInfo info = new PageInfo(newList);
return info;
}
@ -193,8 +222,10 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
@Override
@Transactional
public R deleteReport(Integer reportId, Integer recordId) {
achievementManagementDao.deleteReport(reportId, recordId);
public R deleteReport(List<Integer> reportId,List<Integer> recordId) {
for (int i = 0; i < reportId.size(); i++) {
achievementManagementDao.deleteReport(reportId.get(i), recordId.get(i));
}
return R.ok();
}
@ -218,6 +249,7 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
for (int i = 0; i < split.length; i++) {
list.add(Integer.parseInt(split[i]));
}
//source 1.练习 2考核
switch (source) {
case 1:
//1.获取数据
@ -232,8 +264,12 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
case 2:
//1.获取数据
Integer id = Integer.valueOf(list.get(0));
List<ImportAssessmentRequest> assessment = achievementManagementDao.queryAchievementByAssessment(id);
/*List<ImportAssessmentRequest> assessment = null;
for (Integer id : list) {
assessment = achievementManagementDao.queryAchievementByAssessment(id);
}*/
//Integer id = Integer.valueOf(list.get(0));
List<ImportAssessmentRequest> assessment = achievementManagementDao.queryAchievementByAssessment(list);
//2.加载模板流数据
ClassPathResource resource1 = new ClassPathResource("excel-template/川大成绩管理实验记录导出模板 (2).xlsx");
@ -327,6 +363,11 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
@Override
public R deleteReportById(List<Integer> projectIds, Integer projectPermissions, List<Integer> ids) {
ProjectHiddenEntity projectHiddenEntity = new ProjectHiddenEntity();
//projectHiddenEntity.setId(null);
int num = 0;
if (projectPermissions == 1) {//实验教学
for (Integer id : ids) {
List<AchievementManagementVO> teachAchievements = achievementManagementDao.getTeachAchievement(id);
@ -335,6 +376,15 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
Integer recordId = teachAchievement.getRecordId();
achievementManagementDao.deleteReport(reportId, recordId);
}
//将教学实验隐藏
projectHiddenEntity.setTeachId(id);
projectHiddenEntity.setIsHidden(1);
num = projectHiddenDao.insert(projectHiddenEntity);
if (num <= 0) {
R.error(400, "删除失败!");
}
}
} else {
for (Integer projectId : projectIds) {//虚仿实验
@ -344,6 +394,16 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
Integer recordId = imitationAchievement.getRecordId();
achievementManagementDao.deleteReport(reportId, recordId);
}
//将虚仿项目隐藏
projectHiddenEntity.setProjectId(projectId);
projectHiddenEntity.setIsHidden(1);
num = projectHiddenDao.insert(projectHiddenEntity);
if (num <= 0) {
R.error(400, "删除失败!");
}
}
}

@ -56,7 +56,8 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
Integer systemId = reportDao.querySystemId(recordId);
//python实验
if (systemId == 1 | systemId == 4 | systemId == 5) {
if (systemId != 2 || systemId != 3) {
/*if (systemId == 1 | systemId == 4 | systemId == 5) {*/
List<AchievementManagementVO> data = achievementManagementDao.queryPythonTest(recordId);
HashMap<String, Object> map = new HashMap<>();
map.put("data", data);

@ -0,0 +1,18 @@
package com.msdw.tms.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.msdw.tms.dao.ProjectHiddenDao;
import com.msdw.tms.entity.ProjectHiddenEntity;
import com.msdw.tms.service.ProjectHiddenService;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.Map;
import java.util.function.Function;
@Service("projectHiddenService")
public class ProjectHiddenServiceImpl extends ServiceImpl<ProjectHiddenDao, ProjectHiddenEntity> implements ProjectHiddenService {
}

@ -8,6 +8,7 @@ import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.R;
import com.msdw.tms.common.utils.poi.ExcelExportUtil;
import com.msdw.tms.dao.ProjectRecordDao;
import com.msdw.tms.dao.StudentDao;
import com.msdw.tms.entity.ExperimentalReportEntity;
import com.msdw.tms.entity.ProjectRecordEntity;
import com.msdw.tms.entity.request.ExperimentProjectRecordImportRequest;
@ -15,6 +16,7 @@ import com.msdw.tms.entity.request.ProjectRecordImportRequest;
import com.msdw.tms.entity.resp.GetByUserRecordResp;
import com.msdw.tms.entity.vo.ProjectRecordExportVo;
import com.msdw.tms.entity.vo.ProjectRecordVo;
import com.msdw.tms.entity.vo.StudentVo;
import com.msdw.tms.service.ProjectRecordService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
@ -24,6 +26,8 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.List;
@ -36,6 +40,9 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
@Autowired
private ProjectRecordDao baseMapper;
@Autowired
private StudentDao studentDao;
@Override
public PageUtils getByKDUserRecord(Integer page, Integer size, Integer userId, Integer projectPermissions, Integer systemId) {
@ -69,14 +76,14 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
}
@Override
public PageUtils queryExperimentPage(Integer page, Integer size, Integer userid) {
public PageUtils queryExperimentPage(Integer page, Integer size, Integer userid, Integer systemId) {
ProjectRecordEntity projectRecord = new ProjectRecordEntity().setUserid(userid).setIsdel(Constant.IsDel.NOT_DEL.getType());
//分页对象
Page<T> page1 = new Page<>(page, size);
IPage<ProjectRecordVo> projectRecordVos = this.baseMapper.getByUserExperimentRecord(page1, projectRecord);
IPage<ProjectRecordVo> projectRecordVos = this.baseMapper.getByUserExperimentRecord(page1, projectRecord, systemId);
PageUtils questionsPage = new PageUtils(projectRecordVos);
@ -88,6 +95,57 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
Integer isdel = Constant.IsDel.NOT_DEL.getType();
ProjectRecordVo projectRecordVo = this.baseMapper.getByUserScore(userId, isdel);
//练习统计
List<GetByUserRecordResp> sumByPracticeNum = this.baseMapper.sumByPracticeNum(userId);
//练习总分
Integer practiceByScore = 0;
//练习总耗时
Integer practiceByTime = 0;
for (GetByUserRecordResp resp : sumByPracticeNum) {
//累计总分
practiceByScore += resp.getScore();
//累计时间
practiceByTime += resp.getTimeSum();
}
//考核统计
List<ProjectRecordVo> sumByAssessmentNum = this.baseMapper.sumByAssessmentNum(userId);
//练习总分
Integer assessmenteByScore = 0;
//练习总耗时
double assessmentByTime = 0;
for (ProjectRecordVo vo : sumByAssessmentNum) {
//累计总分
assessmenteByScore += vo.getScore();
//累计时间
assessmentByTime += vo.getTimeSum();
}
//设置实验次数
Integer numer = sumByPracticeNum.size() + sumByAssessmentNum.size();
projectRecordVo.setExperimentNumber(numer);
//取平均分
//BigDecimal getSumByScore = (new BigDecimal(practiceByScore).add(new BigDecimal(assessmenteByScore))).divide(new BigDecimal(numer)).setScale(2, RoundingMode.HALF_UP);
if (practiceByScore + assessmenteByScore != 0) {
double getSumByScore = (practiceByScore + assessmenteByScore) / numer;
projectRecordVo.setAvgScore(getSumByScore);
} else {
projectRecordVo.setAvgScore(0);
}
//获得总耗时
double getTime = practiceByTime + assessmentByTime;
projectRecordVo.setTotalTime(new Double(getTime));
Double totalTime = projectRecordVo.getTotalTime();
if (totalTime != null) {
DecimalFormat df = new DecimalFormat("0.00");
@ -115,6 +173,8 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
List<ProjectRecordExportVo> projectRecordVos = this.baseMapper.getByRecordImport(projectRecord);
// List<ProjectRecordExportVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord);
StudentVo studentVo = studentDao.queryStudentDetails(userId);
List<ProjectRecordImportRequest> importRequests = projectRecordVos.stream().map(project -> {
ProjectRecordImportRequest request = new ProjectRecordImportRequest();
BeanUtils.copyProperties(project, request);
@ -125,13 +185,13 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
//2.加载模板流数据
// org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/虚拟仿真实验报告导出模板.xlsx");
// FileInputStream fis = new FileInputStream(resource.getFile());
ClassPathResource resource = new ClassPathResource("excel-template/虚拟仿真实验报告导出模板.xlsx");
ClassPathResource resource = new ClassPathResource("excel-template/练习记录模板.xlsx");
InputStream inputStream = resource.getInputStream();
//3、通过工具类下载文件
new ExcelExportUtil(ProjectRecordImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
export(response, inputStream, importRequests, "虚拟仿真实验报告.xlsx");
new ExcelExportUtil(ProjectRecordImportRequest.class, Constant.ROW_INDEX_REPORT, Constant.STYLE_INDEX).
exportExpand(response, inputStream, importRequests, studentVo,"练习记录.xlsx");
// new ExcelExportUtil(ProjectRecordImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
// export(response, fis, importRequests, "实验报告导出.xlsx");
}
@ -146,6 +206,8 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
List<ProjectRecordExportVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord);
StudentVo studentVo = studentDao.queryStudentDetails(userId);
List<ExperimentProjectRecordImportRequest> importRequests = projectRecordVos.stream().map(project -> {
ExperimentProjectRecordImportRequest request = new ExperimentProjectRecordImportRequest();
BeanUtils.copyProperties(project, request);
@ -153,13 +215,13 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
}).collect(Collectors.toList());
//2.加载模板流数据
ClassPathResource resource = new ClassPathResource("excel-template/教学实验报告导出模板.xlsx");
ClassPathResource resource = new ClassPathResource("excel-template/考核记录模板.xlsx");
InputStream inputStream = resource.getInputStream();
//3、通过工具类下载文件
new ExcelExportUtil(ExperimentProjectRecordImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
export(response, inputStream, importRequests, "教学实验报告.xlsx");
new ExcelExportUtil(ExperimentProjectRecordImportRequest.class, Constant.ROW_INDEX_REPORT, Constant.STYLE_INDEX).
exportExpand(response, inputStream, importRequests,studentVo, "考核记录.xlsx");
}
@Override
@ -183,4 +245,6 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
public void updateScore(ProjectRecordEntity vo) {
this.baseMapper.updateScore(vo);
}
}

@ -122,18 +122,15 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
}
@Override
public R addStudentInfo(UserInfoEntity userInfoEntity) {
public R addStudentInfo(StudentVo studentVo) {
R r = new R();
boolean result = studentDao.addStudentInfo(userInfoEntity);
boolean result = studentDao.addStudentInfo(studentVo);
if (result == false) {
r.put("code",300);
r.put("errmessage","注册失败!");
return r;
throw new RuntimeException();//添加失败,抛出运行时异常让外层事务回滚
} else {
r.put("code",200);
r.put("errmessage","注册成功!");
return r;
return R.ok("注册成功!");
}
}
@Override
@ -145,7 +142,14 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
@Transactional
@Override
public Map<String, String> upload(MultipartFile file, Integer schoolId) throws IOException {
List<StudentVo> students = ExcelImportHelper.readStudent(file);
if (students.size() <= 0) {
ExceptionCast.cast(CommonCode.EXCEL_FILE_FORMAT_ERROR);
}
Map<String, String> errorMap = new HashMap<>();
List<StudentImportFailureVo> failVo1 = new ArrayList<>();
// 参数合法性校验,只能上传.xlsx后缀的文件
if (StringUtils.isBlank(file.getOriginalFilename())
@ -158,11 +162,66 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
try {
for (int i = 0; i < students.size(); i++) {
StudentVo student = students.get(i);
String userName = student.getUserName();
if (userName.equals("")) {
log.error("*姓名不能为空");
StudentImportFailureVo vo = new StudentImportFailureVo();
++ii;
vo.setIndex(ii)
.setUserName(student.getUserName() + " 必填项:((姓名不能为空)")
.setAccount(student.getAccount())
.setWorkNumber(student.getWorkNumber())
.setPhone(student.getPhone()).setEmail(student.getEmail())
;
failVo1.add(vo);
students.remove(i);
i--;
continue;
}
String phone = student.getPhone();
String workNumber = student.getWorkNumber();
if (workNumber.equals("")) {
log.error("*学号不能为空");
StudentImportFailureVo vo = new StudentImportFailureVo();
++ii;
vo.setIndex(ii)
.setUserName(student.getUserName())
.setAccount(student.getAccount())
.setWorkNumber(student.getWorkNumber() + " 必填项:(*学号不能为空)")
.setPhone(student.getPhone()).setEmail(student.getEmail())
;
failVo1.add(vo);
students.remove(i);
i--;
continue;
}
String account = student.getAccount();
if (account.equals("")) {
log.error("*账号不能为空");
StudentImportFailureVo vo = new StudentImportFailureVo();
++ii;
vo.setIndex(ii)
.setUserName(student.getUserName())
.setAccount(student.getAccount() + " 必填项:(*账号不能为空)")
.setWorkNumber(student.getWorkNumber())
.setPhone(student.getPhone()).setEmail(student.getEmail())
;
failVo1.add(vo);
students.remove(i);
i--;
continue;
}
StudentVo studentVo = new StudentVo();
String schoolAppellationName = student.getSchoolAppellationName();
//String schoolAppellationName = student.getSchoolAppellationName();
List<Integer> result1 = studentDao.queryStudentIdNumber(workNumber, schoolId);
List<StudentEntity> result4 = userInfoDao.queryStudentAccount(account);
String email = student.getEmail();
@ -172,8 +231,12 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
log.error("该号码已被使用");
StudentImportFailureVo vo = new StudentImportFailureVo();
++ii;
vo.setIndex(ii).setUserName(student.getUserName()).setSchoolAppellationName(student.getSchoolAppellationName())
.setAccount(student.getAccount()).setWorkNumber(student.getWorkNumber()).setPhone(student.getPhone()+" (重复的号码)").setEmail(student.getEmail())
vo.setIndex(ii)
.setUserName(student.getUserName())
.setAccount(student.getAccount())
.setWorkNumber(student.getWorkNumber())
.setPhone(student.getPhone() + " (重复的号码)")
.setEmail(student.getEmail())
;
failVo1.add(vo);
students.remove(i);
@ -185,21 +248,26 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
if (email != null && email != "") {
studentVo.setEmail(email);
}
List<Integer> result3 = studentDao.querySchoolName(schoolAppellationName);
// List<Integer> result3 = studentDao.querySchoolName(schoolAppellationName);
// 唯一标示性账号
studentVo.setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())).
setPassword(ConstantUtils.INITIAL_PASSWORD).setToken(new ConstantUtils().token)
.setSchoolId(ConstantUtils.Keda_schoolId).setRoleId(ConstantUtils.STUDENT_ROLE)
;
studentVo.setAccount(student.getAccount()).setSchoolAppellationName(schoolAppellationName)
.setUserName(student.getUserName()).setIsdel(Constant.IsDel.NOT_DEL.getType());
studentVo.setAccount(student.getAccount())
.setUserName(student.getUserName())
.setIsdel(Constant.IsDel.NOT_DEL.getType());
if (result1.size() >= 1) {
log.error("该学号已存在");
StudentImportFailureVo vo = new StudentImportFailureVo();
++ii;
vo.setIndex(ii).setUserName(student.getUserName()).setSchoolAppellationName(student.getSchoolAppellationName())
.setAccount(student.getAccount()).setWorkNumber(student.getWorkNumber()+" (重复的学号)").setPhone(student.getPhone()).setEmail(student.getEmail())
vo.setIndex(ii)
.setUserName(student.getUserName())
.setAccount(student.getAccount())
.setWorkNumber(student.getWorkNumber() + " (重复的学号)")
.setPhone(student.getPhone()).setEmail(student.getEmail())
;
// .setFailureMsg("重复的学号");
failVo1.add(vo);
@ -211,8 +279,12 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
log.error("账号已存在");
StudentImportFailureVo vo = new StudentImportFailureVo();
++ii;
vo.setIndex(ii).setUserName(student.getUserName()).setSchoolAppellationName(student.getSchoolAppellationName())
.setAccount(student.getAccount()+" (重复的账号)").setWorkNumber(student.getWorkNumber()).setPhone(student.getPhone()).setEmail(student.getEmail())
vo.setIndex(ii)
.setUserName(student.getUserName())
.setAccount(student.getAccount() + " (重复的账号)")
.setWorkNumber(student.getWorkNumber())
.setPhone(student.getPhone())
.setEmail(student.getEmail())
;
// .setFailureMsg("重复的账号");
failVo1.add(vo);
@ -221,7 +293,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
i--;
continue;
}
else if(result3.size()!=1){
/*else if(result3.size()!=1){
log.error("不存在该院校");
StudentImportFailureVo vo = new StudentImportFailureVo();
++ii;
@ -233,9 +305,10 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
students.remove(i);
i--;
continue;
}
}*/
++ii;
if (!students.isEmpty() && students.size() > 0) {
studentVo.setSchoolId(schoolId);
userInfoDao.batchSaveUserInfo(studentVo);
student.setUserId(studentVo.getUserId()).setIsdel(Constant.IsDel.NOT_DEL.getType()).setPlatformId(ConstantUtils.PLATFORMID);
boolean b = studentDao.saveStudent(student);
@ -287,12 +360,12 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
parse.sort(Comparator.comparing(StudentImportFailureVo::getIndex));
//2.加载模板流数据
org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/学生导入失败数据导出模板.xlsx");
org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/学生导入失败数据导出模板(1).xlsx");
InputStream inputStream = resource.getInputStream();
//3、通过工具类下载文件
new ExcelExportUtil(StudentImportFailureVo.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
export(response, inputStream, parse, "学生信息导入失败表.xlsx");
export(response, inputStream, parse, "学生信息导入失败表(1).xlsx");
}
@ -302,7 +375,8 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
List<StaffVo> vos = userInfoDao.queryAccount(account);
if (result.size() > 1) {
return R.error("系统存在多个相同的账号:" + account);
}else if (result.size()==1){return R.ok().put("data",result);
} else if (result.size() == 1) {
return R.ok().put("data", result);
} else if (vos.size() > 0) {
return R.error("账号已存在");
}
@ -310,4 +384,9 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
}
@Override
public int queryStudentByWorkNumber(StudentVo studentVo) {
return studentDao.queryStudentByWorkNumber(studentVo);
}
}

@ -91,7 +91,9 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
StaffEntity entity = staff.get(i);
entity.setSchoolId(ConstantUtils.Keda_schoolId).setPlatformId(ConstantUtils.PLATFORMID).setUserId(staffVo.getUserId());
boolean result = systemSetttingDao.addStaffN(entity);
if (!result) {throw new RuntimeException();}
if (!result) {
throw new RuntimeException();
}
}
// String[] split = staffVo.getRoleId().split(",");
// for (String s : split){
@ -141,14 +143,18 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
if (splitOld.length == splitNew.length && splitNew.length < 3) {
for (int i = 0; i < splitNew.length; i++) {
boolean a = systemSetttingDao.updateStaff(staff.get(i));
if (!a){throw new RuntimeException();}
if (!a) {
throw new RuntimeException();
}
}
} else if (splitNew.length > splitOld.length) {
boolean a = systemSetttingDao.updateStaff(staff.get(0));
StaffEntity staffEntity = staff.get(1);
staffEntity.setUserId(staffVo.getUserId());
boolean b = systemSetttingDao.addStaffUpdata(staffEntity);
if (!a|!b){throw new RuntimeException();}
if (!a | !b) {
throw new RuntimeException();
}
} else if (splitNew.length < splitOld.length) {
boolean a = systemSetttingDao.deleteStaffOnly(staffVo.getUserId());//删除roleId最大的数据
staffVo.setStaffRoleId(Integer.parseInt(staffVo.getRoleId()));
@ -231,11 +237,17 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
return result;
}
@Override
@Transactional
public Map<String, String> upload(MultipartFile file) throws IOException {
HashMap<String, String> map = new HashMap<>();
List<StaffVo> staffs = ExcelImportHelper.readStaff(file);
if (staffs.size() <= 0) {
ExceptionCast.cast(CommonCode.EXCEL_FILE_FORMAT_ERROR_STAFFS);
}
List<StaffExportVo> failVo1 = new ArrayList<>();
// 参数合法性校验,只能上传.xlsx后缀的文件
if (StringUtils.isBlank(file.getOriginalFilename())
@ -250,15 +262,226 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
StaffVo staffVo = staffs.get(i);
String phone = staffVo.getPhone();
String email = staffVo.getEmail();
String workNumber = staffVo.getWorkNumber();
//校验员工姓名
if (staffVo.getUserName().equals("")) {
StaffExportVo vo = new StaffExportVo();
vo.setIndex(ii)
.setUserName(staffVo.getUserName() + " *必填项:(员工姓名不能为空) ")
.setAccount(staffVo.getAccount())
.setRole(staffVo.getRole())
.setWorkNumber(staffVo.getWorkNumber())
.setStaffGradeName(staffVo.getStaffGradeName())
.setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName())
.setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo())
.setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo())
.setPhone(staffVo.getPhone())
.setEmail(staffVo.getEmail())
.setSchoolAppellationName(staffVo.getSchoolAppellationName());
staffs.remove(i);
i--;
failVo1.add(vo);
continue;
}
//用户账号
String account = staffVo.getAccount();
String gradeName = staffVo.getStaffGradeName();
//校验账号
if (account.equals("")) {
StaffExportVo vo = new StaffExportVo();
vo.setIndex(ii)
.setUserName(staffVo.getUserName())
.setAccount(staffVo.getAccount() + " *必填项:(员工账号不能为空) ")
.setRole(staffVo.getRole())
.setWorkNumber(staffVo.getWorkNumber())
.setStaffGradeName(staffVo.getStaffGradeName())
.setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName())
.setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo())
.setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo())
.setPhone(staffVo.getPhone())
.setEmail(staffVo.getEmail())
.setSchoolAppellationName(staffVo.getSchoolAppellationName());
staffs.remove(i);
i--;
failVo1.add(vo);
continue;
}
//校验角色
String role = staffVo.getRole();
if (role.equals("")) {
StaffExportVo vo = new StaffExportVo();
vo.setIndex(ii)
.setUserName(staffVo.getUserName())
.setAccount(staffVo.getAccount())
.setRole(staffVo.getRole() + " *必填项:(角色不能为空) ")
.setWorkNumber(staffVo.getWorkNumber())
.setStaffGradeName(staffVo.getStaffGradeName())
.setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName())
.setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo())
.setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo())
.setPhone(staffVo.getPhone())
.setEmail(staffVo.getEmail())
.setSchoolAppellationName(staffVo.getSchoolAppellationName());
staffs.remove(i);
i--;
failVo1.add(vo);
continue;
}
//校验工号
String workNumber = staffVo.getWorkNumber();//员工工号
if (workNumber.equals("")) {
StaffExportVo vo = new StaffExportVo();
vo.setIndex(ii)
.setUserName(staffVo.getUserName())
.setAccount(staffVo.getAccount())
.setRole(staffVo.getRole())
.setWorkNumber(staffVo.getWorkNumber() + " *必填项:(员工工号不能为空) ")
.setStaffGradeName(staffVo.getStaffGradeName())
.setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName())
.setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo())
.setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo())
.setPhone(staffVo.getPhone())
.setEmail(staffVo.getEmail())
.setSchoolAppellationName(staffVo.getSchoolAppellationName());
staffs.remove(i);
i--;
failVo1.add(vo);
continue;
}
//绑定专业名称(*管理员的一级部门)
String architectureName = staffVo.getStaffProfessionalArchitectureName();
String gradeNameTwo = staffVo.getStaffGradeNameTwo();
//绑定年级名称(*管理员的二级部门)
String gradeName = staffVo.getStaffGradeName();
//老师组织架构名称(*老师的一级部门)
String architectureNameTwo = staffVo.getStaffProfessionalArchitectureNameTwo();
//老师专业组织名称(*老师的二级部门)
String gradeNameTwo = staffVo.getStaffGradeNameTwo();
if (role != null) {
//根据角色校验用户导入的数据
switch (role.trim()) {
case "老师":
if (architectureNameTwo.trim().equals("") || gradeNameTwo.trim().equals("")) {
StaffExportVo vo = new StaffExportVo();
vo.setIndex(ii)
.setUserName(staffVo.getUserName())
.setAccount(staffVo.getAccount())
.setRole(staffVo.getRole())
.setWorkNumber(staffVo.getWorkNumber())
.setStaffGradeName(staffVo.getStaffGradeName() + "")
.setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName())
.setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo() + " *必填项:(老师的二级部门不能为空) ")
.setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo() + " *必填项:(老师的一级部门不能为空) ")
.setPhone(staffVo.getPhone())
.setEmail(staffVo.getEmail())
.setSchoolAppellationName(staffVo.getSchoolAppellationName());
staffs.remove(i);
i--;
failVo1.add(vo);
continue;
}
break;
case "管理员+老师":
if (architectureName.trim().equals("") || gradeName.trim().equals("")) {
StaffExportVo vo = new StaffExportVo();
vo.setIndex(ii)
.setUserName(staffVo.getUserName())
.setAccount(staffVo.getAccount())
.setRole(staffVo.getRole())
.setWorkNumber(staffVo.getWorkNumber())
.setStaffGradeName(staffVo.getStaffGradeName() + " *必填项:(管理员的二级部门不能为空) ")
.setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName() + " *必填项:(管理员的一级部门不能为空) ")
.setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo())
.setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo())
.setPhone(staffVo.getPhone())
.setEmail(staffVo.getEmail())
.setSchoolAppellationName(staffVo.getSchoolAppellationName());
staffs.remove(i);
i--;
failVo1.add(vo);
continue;
} else if (architectureNameTwo.trim().equals("") || gradeNameTwo.trim().equals("")) {
StaffExportVo vo = new StaffExportVo();
vo.setIndex(ii)
.setUserName(staffVo.getUserName())
.setAccount(staffVo.getAccount())
.setRole(staffVo.getRole())
.setWorkNumber(staffVo.getWorkNumber())
.setStaffGradeName(staffVo.getStaffGradeName() + "")
.setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName())
.setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo() + " *必填项:(老师的二级部门不能为空) ")
.setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo() + " *必填项:(老师的一级部门不能为空) ")
.setPhone(staffVo.getPhone())
.setEmail(staffVo.getEmail())
.setSchoolAppellationName(staffVo.getSchoolAppellationName());
staffs.remove(i);
i--;
failVo1.add(vo);
continue;
} else if ((architectureNameTwo.trim().equals("") || gradeNameTwo.trim().equals(""))
&&
architectureName.trim().equals("") || gradeName.trim().equals("")) {
StaffExportVo vo = new StaffExportVo();
vo.setIndex(ii)
.setUserName(staffVo.getUserName())
.setAccount(staffVo.getAccount())
.setRole(staffVo.getRole())
.setWorkNumber(staffVo.getWorkNumber())
.setStaffGradeName(staffVo.getStaffGradeName() + " *必填项:(管理员的二级部门不能为空) ")
.setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName() + " *必填项:(管理员的一级部门不能为空) ")
.setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo() + " *必填项:(老师的二级部门不能为空) ")
.setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo() + " *必填项:(老师的一级部门不能为空) ")
.setPhone(staffVo.getPhone())
.setEmail(staffVo.getEmail())
.setSchoolAppellationName(staffVo.getSchoolAppellationName());
staffs.remove(i);
i--;
failVo1.add(vo);
continue;
}
break;
case "管理员":
//architectureName gradeName
if (architectureName.trim().equals("") || gradeName.trim().equals("")) {
StaffExportVo vo = new StaffExportVo();
vo.setIndex(ii)
.setUserName(staffVo.getUserName())
.setAccount(staffVo.getAccount())
.setRole(staffVo.getRole())
.setWorkNumber(staffVo.getWorkNumber())
.setStaffGradeName(staffVo.getStaffGradeName() + " *必填项:(管理员的二级部门不能为空) ")
.setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName() + " *必填项:(管理员的一级部门不能为空) ")
.setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo())
.setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo())
.setPhone(staffVo.getPhone())
.setEmail(staffVo.getEmail())
.setSchoolAppellationName(staffVo.getSchoolAppellationName());
staffs.remove(i);
i--;
failVo1.add(vo);
continue;
}
break;
}
}
StaffVo staff = new StaffVo();
staff.setSchoolId(ConstantUtils.Keda_schoolId);//设定科大学校id
String schoolAppellationName = staffVo.getSchoolAppellationName();
//String schoolAppellationName = staffVo.getSchoolAppellationName();
List<Integer> resultW = systemSetttingDao.queryWorkNumber(workNumber);
List<StaffVo> resultA = userInfoDao.queryAccount(account);
List<StaffVo> resultU = userInfoDao.queryUserInfo(staffVo);
@ -393,15 +616,19 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
if (Integer.parseInt(str) == 13) {//2
Integer organizationId = systemSetttingDao.queryDepartmentNameOrganization(staffVo.getStaffProfessionalArchitectureName(), ConstantUtils.Keda_schoolId);
Integer gradeId = systemSetttingDao.queryDepartmentNameGrade(staffVo.getStaffGradeName(), organizationId);
staffVo.setStaffGradeId(gradeId).setStaffProfessionalArchitectureId(organizationId);
staffVo.setStaffGradeId(gradeId).setStaffProfessionalArchitectureId(organizationId).setRoleId("13");
boolean b = systemSetttingDao.addStaffManager(staffVo);
if(!b){throw new RuntimeException();}
if (!b) {
throw new RuntimeException();
}
} else if (Integer.parseInt(str) == 14) {//3
Integer organizationId = systemSetttingDao.queryDepartmentNameOrganization(staffVo.getStaffProfessionalArchitectureNameTwo(), ConstantUtils.Keda_schoolId);
Integer gradeId = systemSetttingDao.queryDepartmentNameGrade(staffVo.getStaffGradeNameTwo(), organizationId);
staffVo.setStaffGradeId(gradeId).setStaffProfessionalArchitectureId(organizationId);
staffVo.setStaffGradeId(gradeId).setStaffProfessionalArchitectureId(organizationId).setRoleId("14");
boolean b = systemSetttingDao.addStaffTeacher(staffVo);
if(!b){throw new RuntimeException();}
if (!b) {
throw new RuntimeException();
}
}
}
@ -459,9 +686,6 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
}
// //2.加载模板流数据
// org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/staff/测试.xlsx");
//// org.springframework.core.io.Resource resource = new FileSystemResource("E:/JavaworkSpace2/msdw_tms/src/main/resources/excel-template/员工信息导入失败模板.xlsx");
@ -486,7 +710,8 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
HashMap<String, Object> map = new HashMap<>();
List<StaffVo> result = systemSetttingDao.queryAccount(account, schoolId);
List<StaffVo> vos = userInfoDao.queryAccount(account);
if (result.size()>1){return R.error("系统存在多个相同的账号:"+account);
if (result.size() > 1) {
return R.error("系统存在多个相同的账号:" + account);
} else if (result.size() == 1) {
StaffVo staffVo = result.get(0);
map.put("user", staffVo);

@ -223,8 +223,13 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity
}
@Override
public Integer getUserId(String token) {
public R getUserId(String token) {
Integer userId = userInfoDao.getUserId(token);
return userId;
return R.ok().put("userId", userId);
}
@Override
public Integer queryAccountExist(String account) {
return userInfoDao.queryAccountExist(account);
}
}

@ -0,0 +1,129 @@
package com.msdw.tms.util;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* @ProjectName: gzedu
* @Package: com.huoran.edu.utils
* @ClassName: ListSub
* @Description: 集合分页
* @Author: Maureen.Rong
* @CreateDate: 2020/12/3 18:48
* @UpdateDate: 2020/12/3 18:48
* @Version: 1.0
*/
public class ListPageUtil<T> {
/**
* 原集合
*/
private List<T> data;
/**
* 上一页
*/
private int lastPage;
/**
* 当前页
*/
private int nowPage;
/**
* 下一页
*/
private int nextPage;
/**
* 每页条数
*/
private int pageSize;
/**
* 总页数
*/
private int totalPage;
/**
* 总数据条数
*/
private int totalCount;
public ListPageUtil(List<T> data, int nowPage, int pageSize) {
if (data == null || data.isEmpty()) {
//throw new IllegalArgumentException("暂无数据");
this.data = null;
// this.pageSize = pageSize;
// this.nowPage = nowPage;
// this.totalCount = data.size();
}
this.data = data;
this.pageSize = pageSize;
this.nowPage = nowPage;
this.totalCount = data.size();
this.totalPage = (totalCount + pageSize - 1) / pageSize;
this.lastPage = nowPage - 1 > 1 ? nowPage - 1 : 1;
this.nextPage = nowPage >= totalPage ? totalPage : nowPage + 1;
}
/**
* 得到分页后的数据
*
* @return 分页后结果
*/
public List<T> getPagedList() {
int fromIndex = (nowPage - 1) * pageSize;
if (fromIndex >= data.size()) {
return Collections.emptyList();//空数组
}
if (fromIndex < 0) {
return Collections.emptyList();//空数组
}
int toIndex = nowPage * pageSize;
if (toIndex >= data.size()) {
toIndex = data.size();
}
return data.subList(fromIndex, toIndex);
}
public int getPageSize() {
return pageSize;
}
public List<T> getData() {
return data;
}
public int getLastPage() {
return lastPage;
}
public int getNowPage() {
return nowPage;
}
public int getNextPage() {
return nextPage;
}
public int getTotalPage() {
return totalPage;
}
public int getTotalCount() {
return totalCount;
}
public static void main(String[] args) {
Integer[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
List<Integer> list = Arrays.asList(array);
ListPageUtil<Integer> listPageUtil = new ListPageUtil<Integer>(list, 1, 4);
List<Integer> pagedList = listPageUtil.getPagedList();
System.out.println(pagedList);
}
}

@ -177,7 +177,8 @@
u.userName,
re.score,
re.submitTime,
r.eventId
r.eventId,
s.studentId
FROM
tms_experimental_report r
INNER JOIN tms_experimental_teaching t ON t.id = r.projectId
@ -238,8 +239,7 @@
</select>
<select id="queryAchievementByAssessment" resultType="com.msdw.tms.entity.request.ImportAssessmentRequest"
parameterType="java.lang.Integer">
<select id="queryAchievementByAssessment" resultType="com.msdw.tms.entity.request.ImportAssessmentRequest">
SELECT schoolName,
experimental_class_name,
userName,
@ -257,7 +257,15 @@
INNER JOIN hr_user_info u ON u.userId = r.userId
INNER JOIN school s ON s.schoolId = u.schoolId
INNER JOIN student stu ON stu.userId = u.userId
WHERE t.id = #{id}
WHERE
<if test="ids.size()>0">
r.recordId IN (
<foreach collection="ids" separator="," item="recordId">
#{recordId}
</foreach>
)
</if>
AND report.isdel = 0
</select>
<select id="queryFictitiousRecord" resultType="com.msdw.tms.entity.vo.AchievementManagementVO">
@ -401,7 +409,8 @@
IF
(p.rightAndWrong = 0, hsi.score, 0) AS codeScore,
hjp.judgmentPointsName,
hjp.experimentcode AS answer
hjp.experimentcode AS answer,
hec.isError
FROM hr_experiment_code AS hec,
hr_score_index AS hsi,
hr_judgment_points AS hjp,
@ -441,13 +450,15 @@
hpm.isdel
FROM
hr_project_management hpm
LEFT JOIN
tms_project_hidden tph on hpm.projectId = tph.project_id
WHERE systemId = #{systemId}
AND hpm.projectPermissions = #{projectPermissions}
AND tph.is_hidden is NULL
<if test="searchContant!=null and searchContant!=''">and hpm.projectName like concat('%',#{searchContant},'%')
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime != ''">and hpm.creationTime between
#{endTime} and #{startTime}
#{startTime} and #{endTime}
</if>
<if test="month!=null and month != ''">and DATE_SUB(CURDATE(), INTERVAL #{month} month ) &lt;=
date(hpm.creationTime)
@ -497,18 +508,21 @@
et.creation_time AS creationTime,
et.is_del
FROM
tms_experimental_teaching et,
hr_project_management pm
tms_experimental_teaching et inner join
hr_project_management pm on et.project_id = pm.projectId
LEFT JOIN
tms_project_hidden tph on et.id = tph.teach_id
WHERE
user_id = #{userId}
AND et.project_id = pm.projectId
AND pm.isdel = 0
AND systemId = #{systemId}
AND tph.is_hidden is NULL
/*AND pm.isdel = 0*/
<if test="searchContant!=null and searchContant!=''">and et.experimental_class_name like
concat('%',#{searchContant},'%') or et.experimental_name like concat('%',#{searchContant},'%') or
pm.projectName like concat('%',#{searchContant},'%')
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime != ''">and et.creation_time between
#{endTime} and #{startTime}
#{startTime} and #{endTime}
</if>
<if test="month!=null and month != ''">and DATE_SUB(CURDATE(), INTERVAL #{month} month ) &lt;=
date(et.creation_time)

@ -30,7 +30,8 @@
ter.improvement,
IFNULL(ter.`comment`, (SELECT `comment` FROM tms_comment WHERE id = commentId)) AS comment,
ter.instructor,
ter.purpose
ter.purpose,
tet.experimental_class_name as experimentalClassName
FROM hr_user_info u,
student stu,
tms_experimental_report ter,
@ -43,11 +44,11 @@
AND ter.projectId = tet.id
AND stu.userId = tpr.userId
AND ter.studentId = #{studentId}
AND ter.isdel = 0
AND tpr.isdel = 0
AND tpr.recordId = #{recordId}
AND ter.projectId = #{projectId}
</select>
<select id="queryVirtualReport" resultType="com.msdw.tms.entity.vo.ExperimentalReportVo">
SELECT
tpr.recordId,

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.msdw.tms.dao.ProjectHiddenDao">
<select id="selectByProjectId" resultType="com.msdw.tms.entity.ProjectHiddenEntity">
SELECT is_hidden FROM tms_project_hidden WHERE project_id = #{projectId}
</select>
<select id="selectByTeachId" resultType="com.msdw.tms.entity.ProjectHiddenEntity">
SELECT is_hidden FROM tms_project_hidden WHERE teach_id = #{teachId}
</select>
</mapper>

@ -23,8 +23,7 @@
<select id="getByKDUserRecord" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
SELECT
her.reportId as reportId,
SELECT her.reportId as reportId,
her.projectId,
projectName,
her.score,
@ -32,19 +31,16 @@
her.startTime,
her.creationTime as endTime,
her.className
FROM
hr_experimental_report her
FROM hr_experimental_report her
LEFT JOIN hr_project_management tp ON her.projectId = tp.projectId
WHERE
her.studentId = #{pro.userid}
AND
her.isdel = 0
AND
tp.projectPermissions = #{projectPermissions}
WHERE her.studentId = #{pro.userid}
AND her.isdel = 0
AND tp.projectPermissions = #{projectPermissions}
order by her.creationTime desc
</select>
<!--练习记录-->
<select id="getByUserRecord" resultType="com.msdw.tms.entity.resp.GetByUserRecordResp"
parameterType="java.lang.Integer">
SELECT re.reportId,
@ -65,11 +61,13 @@
-- 教师端逻辑删除,学生端不做判断
-- and r.isdel = 0
and projectPermissions = #{projectPermissions}
<if test="systemId!=null and systemId!=''">
and t.systemId = #{systemId}
</if>
GROUP BY c.recordId desc
</select>
<!-- -->
<!-- 考核记录 -->
<select id="getByUserExperimentRecord" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
SELECT tet.id,
ter.reportId,
@ -81,12 +79,17 @@
startingTime as startTime,
endTime,
recordState,
tet.experimental_class_name as experimentalClassName
tet.experimental_class_name as experimentalClassName,
tet.experimental_name as experimentalName,
systemId
FROM tms_project_record tpr
LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId
LEFT JOIN tms_experimental_teaching tet ON tet.project_id = tpr.projectId
LEFT JOIN tms_experimental_report ter ON ter.projectId = tet.id
WHERE tpr.userId = #{pro.userid}
<if test="systemId!=null and systemId!=''">and systemId = #{systemId}</if>
AND tpr.isdel >= #{pro.isdel}
AND tp.projectPermissions !=0
AND
@ -103,7 +106,8 @@
startingTime as startTime,
endTime,
recordState,
tet.experimental_class_name
tet.experimental_class_name,
tet.experimental_name
FROM tms_project_record tpr
LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId
LEFT JOIN tms_experimental_teaching tet ON tpr.projectId = tet.project_id
@ -132,14 +136,14 @@
sum(timeSum) AS totalTime,
avg(score) avgScore
FROM tms_project_record pr
LEFT JOIN hr_user_info u ON pr.userId = u.userId
INNER JOIN hr_user_info u ON pr.userId = u.userId
WHERE pr.userId = #{userid}
</select>
<!-- 个人实验预览-->
<select id="queryScore" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
SELECT count(*) as experimentNumber, sum(timeConsuming) as totalTime, avg(score) as avgScore
FROM hr_experimental_report
where studentId = 547
where studentId = #{studentId}
</select>
<select id="getBySchoolRecord" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
@ -210,4 +214,54 @@
SET score = #{score}
WHERE recordId = #{recordid}
</update>
<!--练习记录-->
<select id="sumByPracticeNum" resultType="com.msdw.tms.entity.resp.GetByUserRecordResp"
parameterType="java.lang.Integer">
SELECT re.reportId,
projectName,
c.recordId,
r.score,
c.codeId,
r.startingTime,
r.submitTime,
r.timeSum,
c.userId,
t.systemId
FROM hr_experiment_code c
INNER JOIN hr_project_management t ON t.projectId = c.projectId
INNER JOIN tms_project_record r ON r.recordId = c.recordId
INNER JOIN tms_experimental_report re ON re.eventId = r.recordId
WHERE c.userId = #{userId}
AND projectPermissions = 0
GROUP BY c.recordId DESC;
</select>
<!-- 考核记录 -->
<select id="sumByAssessmentNum" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
SELECT tet.id,
ter.reportId,
tpr.recordId,
tpr.projectId,
tp.projectName,
score,
timeSum,
startingTime AS startTime,
endTime,
recordState,
tet.experimental_class_name AS experimentalClassName,
systemId
FROM tms_project_record tpr
LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId
LEFT JOIN tms_experimental_teaching tet ON tet.project_id = tpr.projectId
LEFT JOIN tms_experimental_report ter ON ter.projectId = tet.id
WHERE tpr.userId = #{userId}
AND tpr.isdel >= 0
AND tp.projectPermissions != 0
AND ter.eventId = tpr.recordId
ORDER BY
tpr.recordId DESC;
</select>
</mapper>

@ -28,6 +28,9 @@
u.schoolId AS schoolAppellationId,
u.disableAccount,
u.lastLoginTime,
u.phone,
u.email,
u.uniqueIdentificationAccount,
s.roleId,
s.workNumber as workNumber,
s.isdel,
@ -43,7 +46,7 @@
AND u.isdel = 0
AND l.isdel = 0
AND s.isdel = 0
<if test="searchContent!=null">AND (l.schoolName LIKE CONCAT('%',#{searchContent},'%') OR u.userName LIKE CONCAT('%',#{searchContent},'%'))</if>
<if test="searchContent!=null">AND (l.schoolName LIKE CONCAT('%',#{searchContent},'%') OR u.userName LIKE CONCAT('%',#{searchContent},'%') OR u.account LIKE CONCAT('%',#{searchContent},'%') )</if>
ORDER BY studentId DESC
</select>
@ -94,9 +97,9 @@ WHERE
)
</insert>
<insert id="addStudentInfo">
INSERT INTO student(schoolId,userId,roleId,isdel,platformId)
INSERT INTO student(schoolId,userId,roleId,isdel,platformId,workNumber)
VALUES
( #{schoolId},#{userId},4,0,1
( #{schoolId},#{userId},#{roleId},#{isdel},#{platformId},#{workNumber}
)
</insert>
<insert id="bacthAddStudents">
@ -146,4 +149,8 @@ WHERE
update student set workNumber = #{workNumber} where studentId = #{studentId}
</update>
<select id="queryStudentByWorkNumber" resultType="java.lang.Integer">
SELECT count(*) FROM student WHERE workNumber = #{workNumber} AND schoolId = #{schoolId} AND isdel = 0
</select>
</mapper>

@ -25,12 +25,12 @@
<insert id="addStaffManager">
INSERT INTO staff (userId,schoolId,workNumber,staffGradeId,staffProfessionalArchitectureId,staffGradeName,staffProfessionalArchitectureName,platformId,roleId)
VALUES
(#{userId},#{schoolId},#{workNumber},#{staffGradeId},#{staffProfessionalArchitectureId},#{staffGradeName},#{staffProfessionalArchitectureName},#{platformId},2)
(#{userId},#{schoolId},#{workNumber},#{staffGradeId},#{staffProfessionalArchitectureId},#{staffGradeName},#{staffProfessionalArchitectureName},#{platformId},#{roleId})
</insert>
<insert id="addStaffTeacher">
INSERT INTO staff (userId,schoolId,workNumber,staffGradeId,staffProfessionalArchitectureId,staffGradeName,staffProfessionalArchitectureName,platformId,roleId)
VALUES
(#{userId},#{schoolId},#{workNumber},#{staffGradeId},#{staffProfessionalArchitectureId},#{staffGradeNameTwo},#{staffProfessionalArchitectureNameTwo},#{platformId},3)
(#{userId},#{schoolId},#{workNumber},#{staffGradeId},#{staffProfessionalArchitectureId},#{staffGradeNameTwo},#{staffProfessionalArchitectureNameTwo},#{platformId},#{roleId})
</insert>
<insert id="addStaffUpdata">
INSERT INTO staff (userId,schoolId,workNumber,staffGradeId,staffProfessionalArchitectureId,staffGradeName,staffProfessionalArchitectureName,platformId,roleId)

@ -19,6 +19,7 @@
u.IDNumber,
u.documentType,
u.educationDegree,
u.userAvatars,
pro.provinceId,
pro.provinceName,
s.schoolId,

@ -146,7 +146,7 @@
values
(#{userName}, #{uniqueIdentificationAccount},
#{phone}, #{account},#{password},#{roleId},
(SELECT schoolId FROM school WHERE schoolName = #{schoolAppellationName}),now(),#{token})
#{schoolId},now(),#{token})
</insert>
<insert id="addUserinfo" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
INSERT INTO hr_user_info ( account, userName, roleId, phone, email, uniqueIdentificationAccount, schoolId,creationTime,password,token)
@ -291,4 +291,8 @@
SELECT userId FROM hr_user_info where token = #{token} and isdel = 0
</select>
<select id="queryAccountExist" resultType="java.lang.Integer">
SELECT count(*) FROM hr_user_info where account = #{account} and isdel = 0
</select>
</mapper>
Loading…
Cancel
Save