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. 213
      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. 28
      src/main/java/com/msdw/tms/controller/AchievementManagementController.java
  12. 4
      src/main/java/com/msdw/tms/controller/EvaluationRecordController.java
  13. 78
      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. 13
      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. 8
      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. 19
      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. 8
      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. 88
      src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java
  39. 203
      src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java
  40. 423
      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. 70
      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. 168
      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> <version>2.1.1</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId> <artifactId>pagehelper-spring-boot-starter</artifactId>
<version>5.1.2</version> <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> </dependency>

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

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

@ -24,7 +24,10 @@ public interface UserInfoControllerApi {
R getUserId(String token); R getUserId(String token);
@ApiOperation(value = "注册",notes = "注册") @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 = "个人中心信息展示") @ApiOperation(value = "个人中心信息展示",notes = "个人中心信息展示")
R userInfo(Integer id); R userInfo(Integer id);

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

@ -1,7 +1,12 @@
package com.msdw.tms.common.utils; 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.StaffVo;
import com.msdw.tms.entity.vo.StudentVo; 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.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -13,15 +18,62 @@ import java.util.List;
public class ExcelImportHelper { 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 * @param file
* @return * @return
*/ */
public static List<StudentVo> readStudent(MultipartFile file) { public static List<StudentVo> readStudent(MultipartFile file) throws IOException {
List<StudentVo> list = new ArrayList<StudentVo>(); List<StudentVo> list = new ArrayList<StudentVo>();
Workbook workbook=getWorkbook(file); Workbook workbook = getWorkbook(file);
StudentVo student = null; StudentVo student = null;
// 循环工作表Sheet // 循环工作表Sheet
for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) {
@ -29,38 +81,57 @@ public class ExcelImportHelper {
if (hssfSheet == null) { if (hssfSheet == null) {
continue; continue;
} }
int count = 1;
// 循环行Row//开始行2 // 循环行Row//开始行2
for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
Row row = hssfSheet.getRow(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 phone;
Cell email; Cell email;
if (row != null) { if (row != null) {
student = new StudentVo(); student = new StudentVo();
row.getCell(0).setCellType(CellType.STRING); row.getCell(0).setCellType(CellType.STRING);
Cell studentName = row.getCell(0); Cell studentName = row.getCell(0);
row.getCell(1).setCellType(CellType.STRING); row.getCell(1).setCellType(CellType.STRING);
Cell schoolAppellationName = row.getCell(1); Cell account = row.getCell(1);
row.getCell(2).setCellType(CellType.STRING); row.getCell(2).setCellType(CellType.STRING);
Cell account = row.getCell(2);
row.getCell(3).setCellType(CellType.STRING); Cell studentNumber = row.getCell(2);
Cell studentNumber = row.getCell(3); if (row.getCell(3) != null) {
if (row.getCell(4)!=null){ row.getCell(3).setCellType(CellType.STRING);
row.getCell(4).setCellType(CellType.STRING); phone = row.getCell(3);
phone = row.getCell(4); } else {
}else { phone = row.createCell(3);
phone = row.createCell(4);
} }
if (row.getCell(5)!=null){
row.getCell(5).setCellType(CellType.STRING); if (row.getCell(4) != null) {
email = row.getCell(5); row.getCell(4).setCellType(CellType.STRING);
}else { email = row.getCell(4);
email = row.createCell(5); } else {
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.setRoleId(ConstantUtils.STUDENT_ROLE);
// 学生学号 // 学生学号
student.setWorkNumber(studentNumber.getStringCellValue()); student.setWorkNumber(studentNumber.getStringCellValue());
//所属院校
student.setSchoolAppellationName(schoolAppellationName.getStringCellValue());
//用户账号 //用户账号
student.setAccount(account.getStringCellValue()); student.setAccount(account.getStringCellValue());
//电话 //电话
@ -87,15 +156,18 @@ public class ExcelImportHelper {
return list; return list;
} }
/** /**
* 读取员工管理 * 读取员工管理
*
* @param file * @param file
* @return * @return
*/ */
public static List<StaffVo> readStaff(MultipartFile file) { public static List<StaffVo> readStaff(MultipartFile file) throws IOException {
List<StaffVo> list = new ArrayList<StaffVo>(); List<StaffVo> list = new ArrayList<StaffVo>();
Workbook workbook=getWorkbook(file); Workbook workbook = getWorkbook(file);
StaffVo staff = null; StaffVo staff = null;
// 循环工作表Sheet // 循环工作表Sheet
for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) {
@ -103,97 +175,110 @@ public class ExcelImportHelper {
if (hssfSheet == null) { if (hssfSheet == null) {
continue; continue;
} }
int lastRowNum = hssfSheet.getLastRowNum()+1;//最后一行行标,比行数小1 /*int lastRowNum = hssfSheet.getLastRowNum() + 1;//最后一行行标,比行数小1
if (lastRowNum==2){ if (lastRowNum == 2) {
break; break;
} }*/
int count = 1;
// 循环行Row//开始行2 // 循环行Row//开始行2
for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
Row row = hssfSheet.getRow(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 phone;
Cell email; Cell email;
Cell staffGradeName; Cell staffGradeName;
Cell staffProfessionalArchitectureName; Cell staffProfessionalArchitectureName;
Cell staffGradeNameTwo; Cell staffGradeNameTwo;
Cell staffProfessionalArchitectureNameTwo; Cell staffProfessionalArchitectureNameTwo;
if (row != null) { /*Cell account;
Cell role;
Cell workNumber;*/
Cell userName;
if (row == null) {
continue;
} else {
staff = new StaffVo(); staff = new StaffVo();
if (row.getCell(0)!=null){ if (row.getCell(0) != null) {
row.getCell(0).setCellType(CellType.STRING); row.getCell(0).setCellType(CellType.STRING);
userName = row.getCell(0); userName = row.getCell(0);
}else { } else {
continue; userName = row.createCell(0);
} }
//姓名
/* row.getCell(0).setCellType(CellType.STRING);
String userName = row.getCell(0).getStringCellValue();*/
//账号
row.getCell(1).setCellType(CellType.STRING); row.getCell(1).setCellType(CellType.STRING);
Cell account = row.getCell(1); Cell account = row.getCell(1);
//角色
row.getCell(2).setCellType(CellType.STRING); row.getCell(2).setCellType(CellType.STRING);
Cell role = row.getCell(2); Cell role = row.getCell(2);
//工号
row.getCell(3).setCellType(CellType.STRING); row.getCell(3).setCellType(CellType.STRING);
Cell workNumber = row.getCell(3); Cell workNumber = row.getCell(3);
// row.getCell(4).setCellType(CellType.STRING);
// Cell staffGradeName = row.getCell(4);
if (row.getCell(4)!=null){ if (row.getCell(4) != null) {
row.getCell(4).setCellType(CellType.STRING); row.getCell(4).setCellType(CellType.STRING);
staffProfessionalArchitectureName = row.getCell(4); staffProfessionalArchitectureName = row.getCell(4);
}else { } else {
staffProfessionalArchitectureName = row.createCell(4); staffProfessionalArchitectureName = row.createCell(4);
} }
if (row.getCell(5)!=null){ if (row.getCell(5) != null) {
row.getCell(5).setCellType(CellType.STRING); row.getCell(5).setCellType(CellType.STRING);
staffGradeName = row.getCell(5); staffGradeName = row.getCell(5);
}else { } else {
staffGradeName = row.createCell(5); staffGradeName = row.createCell(5);
} }
if (row.getCell(6)!=null){ if (row.getCell(6) != null) {
row.getCell(6).setCellType(CellType.STRING); row.getCell(6).setCellType(CellType.STRING);
staffProfessionalArchitectureNameTwo = row.getCell(6); staffProfessionalArchitectureNameTwo = row.getCell(6);
}else { } else {
staffProfessionalArchitectureNameTwo = row.createCell(6); staffProfessionalArchitectureNameTwo = row.createCell(6);
} }
if (row.getCell(7)!=null){ if (row.getCell(7) != null) {
row.getCell(7).setCellType(CellType.STRING); row.getCell(7).setCellType(CellType.STRING);
staffGradeNameTwo = row.getCell(7); staffGradeNameTwo = row.getCell(7);
}else { } else {
staffGradeNameTwo = row.createCell(7); staffGradeNameTwo = row.createCell(7);
} }
if (row.getCell(8) != null) {
// 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); row.getCell(8).setCellType(CellType.STRING);
phone = row.getCell(8); phone = row.getCell(8);
}else { } else {
phone = row.createCell(8); phone = row.createCell(8);
} }
if (row.getCell(9)!=null){ if (row.getCell(9) != null) {
row.getCell(9).setCellType(CellType.STRING); row.getCell(9).setCellType(CellType.STRING);
email = row.getCell(9); email = row.getCell(9);
}else { } else {
email = row.createCell(9); 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 roleValue = role.getStringCellValue();
String str; String str;
// 角色id // 角色id
if (roleValue.equals("管理员")){ if (roleValue.equals("管理员")) {
str = "13";//2 str = "13";//2
}else if (roleValue.equals("老师")){ } else if (roleValue.equals("老师")) {
str = "14";//3 str = "14";//3
}else{ } else {
str = "13,14"; str = "13,14";
} }
staff.setRoleId(str); staff.setRoleId(str);
@ -218,7 +303,7 @@ public class ExcelImportHelper {
//邮箱 //邮箱
staff.setEmail(email.getStringCellValue()); staff.setEmail(email.getStringCellValue());
//所属院校 //所属院校
staff.setSchoolAppellationName(schoolAppellationName.getStringCellValue()); //staff.setSchoolAppellationName(schoolAppellationName.getStringCellValue());
//学校id //学校id
staff.setSchoolId(ConstantUtils.Keda_schoolId); staff.setSchoolId(ConstantUtils.Keda_schoolId);
list.add(staff); list.add(staff);
@ -229,7 +314,7 @@ public class ExcelImportHelper {
return list; return list;
} }
private static Workbook getWorkbook(MultipartFile file) { private static Workbook getWorkbook(MultipartFile file) {
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
Workbook workbook = null; Workbook workbook = null;
@ -239,7 +324,7 @@ public class ExcelImportHelper {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
}else if (fileName.endsWith("xls")) { } else if (fileName.endsWith("xls")) {
try { try {
workbook = new HSSFWorkbook(file.getInputStream()); workbook = new HSSFWorkbook(file.getInputStream());
} catch (IOException e) { } catch (IOException e) {

@ -1,5 +1,6 @@
package com.msdw.tms.common.utils.poi; package com.msdw.tms.common.utils.poi;
import com.msdw.tms.entity.vo.StudentVo;
import lombok.Data; import lombok.Data;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -8,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -75,6 +77,74 @@ public class ExcelExportUtil<T> {
workbook.write(response.getOutputStream()); 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[] getTemplateStyles(Row row) {
CellStyle[] styles = new CellStyle[row.getLastCellNum()]; CellStyle[] styles = new CellStyle[row.getLastCellNum()];
for (int i = 0; i < row.getLastCellNum(); i++) { for (int i = 0; i < row.getLastCellNum(); i++) {

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

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

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

@ -134,7 +134,7 @@ public class EvaluationRecordController implements EvaluationRecordControllerApi
Integer id = fractionEntityService.queryScore(userId,type); Integer id = fractionEntityService.queryScore(userId,type);
if (id>0){ if (id>0){
Integer score = fractionEntityService.queryExerciseRecord(userId); Integer score = fractionEntityService.queryExerciseRecord(userId);
if (score>=60){ if (score>=80){
return R.ok("true"); return R.ok("true");
}else{ }else{
return R.error(200,"false"); return R.error(200,"false");
@ -152,7 +152,7 @@ public class EvaluationRecordController implements EvaluationRecordControllerApi
Integer id = fractionEntityService.queryScore(userId,type); Integer id = fractionEntityService.queryScore(userId,type);
if (id>0){ if (id>0){
Integer score = fractionEntityService.queryTeachingRecord(userId); Integer score = fractionEntityService.queryTeachingRecord(userId);
if (score>=60){ if (score>=80){
return R.ok("true"); return R.ok("true");
}else{ }else{
return R.error(200,"false"); 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.ProjectRecordEntity;
import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.entity.vo.ProjectRecordVo;
import com.msdw.tms.service.ProjectRecordService; import com.msdw.tms.service.ProjectRecordService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -18,10 +19,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
* * @author
* * @email
* @author
* @email
* @date 2020-08-19 16:07:02 * @date 2020-08-19 16:07:02
*/ */
@RestController @RestController
@ -35,27 +34,32 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
*/ */
@Override @Override
@GetMapping("/schoolRecord") @GetMapping("/schoolRecord")
public R list(@RequestParam Integer page, @RequestParam Integer size, @RequestParam Integer month,@RequestParam String startTime,@RequestParam String endTime, public R list(@RequestParam Integer page, @RequestParam Integer size, @RequestParam Integer month, @RequestParam String startTime, @RequestParam String endTime,
@RequestParam Integer recordState,@RequestParam String condition ){ @RequestParam Integer recordState, @RequestParam String condition) {
ProjectRecordVo recordVo = new ProjectRecordVo(); ProjectRecordVo recordVo = new ProjectRecordVo();
if(!StringUtils.isEmpty(month)) { if (!StringUtils.isEmpty(month)) {
recordVo.setMonth(month); recordVo.setMonth(month);
}if(!StringUtils.isEmpty(startTime)) { }
if (!StringUtils.isEmpty(startTime)) {
recordVo.setStartTime(startTime); recordVo.setStartTime(startTime);
}if(!StringUtils.isEmpty(endTime)) { }
if (!StringUtils.isEmpty(endTime)) {
recordVo.setEndTime(endTime); recordVo.setEndTime(endTime);
}if(!StringUtils.isEmpty(recordState)) { }
if (!StringUtils.isEmpty(recordState)) {
recordVo.setRecordstate(recordState); recordVo.setRecordstate(recordState);
}if(!StringUtils.isEmpty(condition)){ }
if (!StringUtils.isEmpty(condition)) {
recordVo.setCondition(condition); recordVo.setCondition(condition);
} }
PageUtils page1 = projectRecordService.querySchoolRecord(page,size,recordVo); PageUtils page1 = projectRecordService.querySchoolRecord(page, size, recordVo);
return R.ok().put("page", page1); return R.ok().put("page", page1);
} }
/** /**
* 用户端虚拟仿真实验记录 * 用户端虚拟仿真实验记录(练习列表)
*
* @param page * @param page
* @param size * @param size
* @param * @param
@ -63,13 +67,14 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
*/ */
@Override @Override
@GetMapping("/user/record") @GetMapping("/user/record")
public R queryUserRecord(@RequestParam Integer page,@RequestParam Integer size,@RequestParam Integer userId,@RequestParam Integer projectPermissions,@RequestParam Integer systemId){ public R queryUserRecord(@RequestParam Integer page, @RequestParam Integer size, @RequestParam Integer userId, @RequestParam Integer projectPermissions, @RequestParam Integer systemId) {
PageUtils page1 = projectRecordService.queryPage(page,size,userId,projectPermissions,systemId); PageUtils page1 = projectRecordService.queryPage(page, size, userId, projectPermissions, systemId);
return R.ok().put("data", page1); return R.ok().put("data", page1);
} }
/** /**
* 科大用户端虚拟仿真实验记录 * 科大用户端虚拟仿真实验记录
*
* @param page * @param page
* @param size * @param size
* @param * @param
@ -77,13 +82,14 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
*/ */
@Override @Override
@GetMapping("/user/kdRecord") @GetMapping("/user/kdRecord")
public R kdRecord(@RequestParam Integer page,@RequestParam Integer size,@RequestParam Integer userId,@RequestParam Integer projectPermissions,@RequestParam Integer systemId){ public R kdRecord(@RequestParam Integer page, @RequestParam Integer size, @RequestParam Integer userId, @RequestParam Integer projectPermissions, @RequestParam Integer systemId) {
PageUtils page1 = projectRecordService.getByKDUserRecord(page,size,userId,projectPermissions,systemId); PageUtils page1 = projectRecordService.getByKDUserRecord(page, size, userId, projectPermissions, systemId);
return R.ok().put("data", page1); return R.ok().put("data", page1);
} }
/** /**
* 用户端教学实验记录 * 用户端教学实验记录考核列表
*
* @param page * @param page
* @param size * @param size
* @param userid * @param userid
@ -91,20 +97,21 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
*/ */
@Override @Override
@GetMapping("/user/experimentRecord") @GetMapping("/user/experimentRecord")
public R getUserExperimentscore(@RequestParam Integer page,@RequestParam Integer size,@RequestParam Integer userid){ public R getUserExperimentscore(@RequestParam Integer page, @RequestParam Integer size, @RequestParam Integer userid, @RequestParam Integer systemId) {
PageUtils page1 = projectRecordService.queryExperimentPage(page,size,userid); PageUtils page1 = projectRecordService.queryExperimentPage(page, size, userid, systemId);
return R.ok().put("data", page1); return R.ok().put("data", page1);
} }
/** /**
* 个人实验预览 * 个人实验预览
*
* @param userId * @param userId
* @return * @return
*/ */
@Override @Override
@GetMapping("/user/queryScore/{userId}") @GetMapping("/user/queryScore/{userId}")
public R queryScore(@PathVariable("userId") Integer userId){ public R queryScore(@PathVariable("userId") Integer userId) {
ProjectRecordVo projectRecord = projectRecordService.queryScore(userId); ProjectRecordVo projectRecord = projectRecordService.queryScore(userId);
return R.ok().put("data", projectRecord); return R.ok().put("data", projectRecord);
@ -112,12 +119,13 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
/** /**
* 个人实验预览 * 个人实验预览
*
* @param userid * @param userid
* @return * @return
*/ */
@Override @Override
@GetMapping("/user/score/{userId}") @GetMapping("/user/score/{userId}")
public R getUserScore(@PathVariable("userId") Integer userid){ public R getUserScore(@PathVariable("userId") Integer userid) {
ProjectRecordVo projectRecord = projectRecordService.queryUserScore(userid); ProjectRecordVo projectRecord = projectRecordService.queryUserScore(userid);
return R.ok().put("data", projectRecord); return R.ok().put("data", projectRecord);
@ -125,35 +133,37 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
/** /**
* 导出个人虚拟仿真实验记录 * 导出个人虚拟仿真实验记录
*
* @param response * @param response
* @param userId * @param userId
* @throws Exception * @throws Exception
*/ */
@Override @Override
@GetMapping("/user/exportProjectRecord") @GetMapping("/user/exportProjectRecord")
public void exportProjectRecord(HttpServletResponse response,@RequestParam("userId") Integer userId)throws Exception{ public void exportProjectRecord(HttpServletResponse response, @RequestParam("userId") Integer userId) throws Exception {
projectRecordService.exportProjectRecord(response,userId); projectRecordService.exportProjectRecord(response, userId);
} }
/** /**
* 导出个人教学实验记录 * 导出个人教学实验记录
*
* @param response * @param response
* @param userId * @param userId
* @throws Exception * @throws Exception
*/ */
@Override @Override
@GetMapping("/user/exportExperimentProjectRecord") @GetMapping("/user/exportExperimentProjectRecord")
public void exportExperimentProjectRecord(HttpServletResponse response,@RequestParam("userId") Integer userId)throws Exception{ public void exportExperimentProjectRecord(HttpServletResponse response, @RequestParam("userId") Integer userId) throws Exception {
projectRecordService.exportExperimentProjectRecord(response,userId); projectRecordService.exportExperimentProjectRecord(response, userId);
} }
/** /**
* 信息 * 信息
*/ */
@GetMapping("/info/{recordid}") @GetMapping("/info/{recordid}")
public R info(@PathVariable("recordid") Integer recordid){ public R info(@PathVariable("recordid") Integer recordid) {
ProjectRecordEntity projectRecord = projectRecordService.getById(recordid); ProjectRecordEntity projectRecord = projectRecordService.getById(recordid);
return R.ok().put("projectRecord", projectRecord); return R.ok().put("projectRecord", projectRecord);
} }
@ -162,8 +172,8 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
* 保存 * 保存
*/ */
@RequestMapping("/save") @RequestMapping("/save")
public R save(@RequestBody ProjectRecordEntity projectRecord){ public R save(@RequestBody ProjectRecordEntity projectRecord) {
projectRecordService.save(projectRecord); projectRecordService.save(projectRecord);
return R.ok(); return R.ok();
} }
@ -173,10 +183,10 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
*/ */
@Override @Override
@PutMapping("/update") @PutMapping("/update")
public R update(@RequestBody ProjectRecordEntity projectRecord){ public R update(@RequestBody ProjectRecordEntity projectRecord) {
boolean result = projectRecordService.updateUserRecord(projectRecord); boolean result = projectRecordService.updateUserRecord(projectRecord);
return R.ok().put("data",result); return R.ok().put("data", result);
} }
/** /**
@ -184,8 +194,8 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
*/ */
@Override @Override
@DeleteMapping("/delete") @DeleteMapping("/delete")
public R delete(@RequestBody Integer[] recordids){ public R delete(@RequestBody Integer[] recordids) {
projectRecordService.removeByIds(Arrays.asList(recordids)); projectRecordService.removeByIds(Arrays.asList(recordids));
return R.ok(); return R.ok();
} }

@ -40,13 +40,13 @@ public class StudentController implements StudentControllerApi{
private UserInfoService userInfoService; private UserInfoService userInfoService;
/** /**
* 新增学生 * 职站新增学生
* @param studentVo * @param studentVo
* @return * @return
*/ */
@Transactional @Transactional
@Override @Override
@PostMapping("/addStudent") @PostMapping("/zzAddStudent")
public R addStudent(@RequestBody @Valid StudentVo studentVo){ public R addStudent(@RequestBody @Valid StudentVo studentVo){
studentVo.setSchoolId(ConstantUtils.Keda_schoolId); studentVo.setSchoolId(ConstantUtils.Keda_schoolId);
String account = studentVo.getAccount(); 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 * @param schoolId

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

@ -56,7 +56,7 @@ public interface AchievementManagementDao extends BaseMapper<ExperimentalReportE
List<AchievementImportRequest> queryAchievement(@Param("ids") List<Integer> ids); 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); 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);
}

@ -23,11 +23,11 @@ import java.util.List;
@Mapper @Mapper
public interface ProjectRecordDao extends BaseMapper<ProjectRecordEntity> { public interface ProjectRecordDao extends BaseMapper<ProjectRecordEntity> {
IPage<ProjectRecordVo> getByKDUserRecord(Page page,@Param("pro") ProjectRecordEntity projectRecordEntity,Integer projectPermissions); IPage<ProjectRecordVo> getByKDUserRecord(Page page, @Param("pro") ProjectRecordEntity projectRecordEntity, Integer projectPermissions);
IPage<GetByUserRecordResp> getByUserRecord(Page page, @Param("userId") Integer userId, @Param("projectPermissions") Integer projectPermissions,@Param("systemId") Integer systemId); 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); List<ProjectRecordExportVo> getByUserRecordImport(ProjectRecordEntity projectRecordEntity);
@ -46,4 +46,11 @@ public interface ProjectRecordDao extends BaseMapper<ProjectRecordEntity> {
ProjectRecordEntity queryReport(Integer recordId); ProjectRecordEntity queryReport(Integer recordId);
void updateScore(ProjectRecordEntity vo); 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); void updateWorkNumber(String workNumber,Integer studentId);
boolean addStudentInfo(UserInfoEntity userInfoEntity); boolean addStudentInfo(StudentVo studentVo);
List<Integer> querySchoolName(String schoolAppellationName); List<Integer> querySchoolName(String schoolAppellationName);
@ -37,4 +37,6 @@ public interface StudentDao extends BaseMapper<StudentEntity> {
int querySchoolAppellationName(String schoolAppellationName); int querySchoolAppellationName(String schoolAppellationName);
List<StudentVo> queryAccount(String account,Integer schoolId); 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); List<String> queryStudentName(Integer userId);
Integer getUserId(String token); 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 String experimentalName;
//是否删除
private Integer isdel; private Integer isdel;
} }

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

@ -17,10 +17,14 @@ public enum CommonCode implements ResultCode {
EXCEL_FILE_INVALID(false, 10009, "上传excel文件错误!"), EXCEL_FILE_INVALID(false, 10009, "上传excel文件错误!"),
REPEAT_INEXCEL(false, 10010, "试题在excel表中重复!"), REPEAT_INEXCEL(false, 10010, "试题在excel表中重复!"),
EVALUATION_QUESTION_NUM_INVALID(false, 10011, "当前测评题数设置为0,请先设置测评题数!"), 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, "操作失败!"), FAIL(false, 11111, "操作失败!"),
ROLE_NAME_EXIST(false,20001,"该角色名称已存在,请重新输入!"),
ROLE_EMP_EXIST(false,44001,"该角色有用户关联,不能删除!"), ROLE_NAME_EXIST(false, 20001, "该角色名称已存在,请重新输入!"),
ROLE_EMP_EXIST(false, 44001, "该角色有用户关联,不能删除!"),
SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!"); SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!");
//操作是否成功 //操作是否成功
boolean success; boolean success;

@ -88,4 +88,10 @@ public class AchievementManagementVO extends ExperimentalReportEntity {
private String answer; private String answer;
//判分点名称 //判分点名称
private String judgmentPointsName; 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 experimental_class_name;
/**
* 实验名称(即考核名称
*/
private String experimentalName;
} }

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

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

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

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

@ -16,12 +16,13 @@ import java.util.List;
* @date 2020-08-19 16:07:02 * @date 2020-08-19 16:07:02
*/ */
public interface ProjectRecordService extends IService<ProjectRecordEntity> { public interface ProjectRecordService extends IService<ProjectRecordEntity> {
PageUtils getByKDUserRecord(Integer page,Integer size,Integer userId,Integer projectPermissions,Integer systemId); PageUtils getByKDUserRecord(Integer page, Integer size, Integer userId, Integer projectPermissions, Integer systemId);
PageUtils queryPage(Integer page, Integer size, Integer userId, Integer projectPermissions,Integer systemId); 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 queryUserScore(Integer userId);
ProjectRecordVo queryScore(Integer userId); ProjectRecordVo queryScore(Integer userId);
@ -35,5 +36,6 @@ public interface ProjectRecordService extends IService<ProjectRecordEntity> {
boolean updateUserRecord(ProjectRecordEntity projectRecord); boolean updateUserRecord(ProjectRecordEntity projectRecord);
void updateScore(ProjectRecordEntity vo); void updateScore(ProjectRecordEntity vo);
} }

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

@ -48,6 +48,7 @@ public interface UserInfoService extends IService<UserInfoEntity> {
R queryAccount(); 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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.Constant;
import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.R; import com.msdw.tms.common.utils.R;
import com.msdw.tms.common.utils.poi.ExcelExportUtil; import com.msdw.tms.common.utils.poi.ExcelExportUtil;
import com.msdw.tms.dao.AchievementManagementDao; import com.msdw.tms.dao.*;
import com.msdw.tms.dao.ExperimentalTeachingDao;
import com.msdw.tms.dao.ProjectRecordDao;
import com.msdw.tms.dao.UserInfoDao;
import com.msdw.tms.entity.*; import com.msdw.tms.entity.*;
import com.msdw.tms.entity.request.AchievementImportRequest; import com.msdw.tms.entity.request.AchievementImportRequest;
import com.msdw.tms.entity.request.ImportAssessmentRequest; import com.msdw.tms.entity.request.ImportAssessmentRequest;
@ -46,6 +45,9 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
@Autowired @Autowired
private UserInfoDao userInfoDao; private UserInfoDao userInfoDao;
@Autowired
private ProjectHiddenDao projectHiddenDao;
//查询实验报告 //查询实验报告
@Override @Override
@Transactional @Transactional
@ -88,18 +90,41 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
* @return * @return
*/ */
@Override @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); List<ResultsEntity> list = achievementManagementDao.list(vo);
PageInfo info = new PageInfo(list);
for (ResultsEntity entity : list) { for (ResultsEntity entity : list) {
Integer number = achievementManagementDao.getImitationAchievement(entity.getProjectId()).size(); Integer number = achievementManagementDao.getImitationAchievement(entity.getProjectId()).size();
entity.setNumber(number); 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 @Override
@ -109,13 +134,17 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
} }
@Override @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); List<ResultsEntity> newList = achievementManagementDao.newList(vo);
for (ResultsEntity entity : newList) { for (ResultsEntity entity : newList) {
Integer number = achievementManagementDao.getTeachAchievement(entity.getId()).size(); Integer number = achievementManagementDao.getTeachAchievement(entity.getId()).size();
entity.setNumber(number); entity.setNumber(number);
} }
return newList;
PageInfo info = new PageInfo(newList);
return info;
} }
@ -193,8 +222,10 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
@Override @Override
@Transactional @Transactional
public R deleteReport(Integer reportId, Integer recordId) { public R deleteReport(List<Integer> reportId,List<Integer> recordId) {
achievementManagementDao.deleteReport(reportId, recordId); for (int i = 0; i < reportId.size(); i++) {
achievementManagementDao.deleteReport(reportId.get(i), recordId.get(i));
}
return R.ok(); return R.ok();
} }
@ -218,6 +249,7 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
for (int i = 0; i < split.length; i++) { for (int i = 0; i < split.length; i++) {
list.add(Integer.parseInt(split[i])); list.add(Integer.parseInt(split[i]));
} }
//source 1.练习 2考核
switch (source) { switch (source) {
case 1: case 1:
//1.获取数据 //1.获取数据
@ -232,8 +264,12 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
case 2: case 2:
//1.获取数据 //1.获取数据
Integer id = Integer.valueOf(list.get(0)); /*List<ImportAssessmentRequest> assessment = null;
List<ImportAssessmentRequest> assessment = achievementManagementDao.queryAchievementByAssessment(id); for (Integer id : list) {
assessment = achievementManagementDao.queryAchievementByAssessment(id);
}*/
//Integer id = Integer.valueOf(list.get(0));
List<ImportAssessmentRequest> assessment = achievementManagementDao.queryAchievementByAssessment(list);
//2.加载模板流数据 //2.加载模板流数据
ClassPathResource resource1 = new ClassPathResource("excel-template/川大成绩管理实验记录导出模板 (2).xlsx"); ClassPathResource resource1 = new ClassPathResource("excel-template/川大成绩管理实验记录导出模板 (2).xlsx");
@ -327,6 +363,11 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
@Override @Override
public R deleteReportById(List<Integer> projectIds, Integer projectPermissions, List<Integer> ids) { public R deleteReportById(List<Integer> projectIds, Integer projectPermissions, List<Integer> ids) {
ProjectHiddenEntity projectHiddenEntity = new ProjectHiddenEntity();
//projectHiddenEntity.setId(null);
int num = 0;
if (projectPermissions == 1) {//实验教学 if (projectPermissions == 1) {//实验教学
for (Integer id : ids) { for (Integer id : ids) {
List<AchievementManagementVO> teachAchievements = achievementManagementDao.getTeachAchievement(id); List<AchievementManagementVO> teachAchievements = achievementManagementDao.getTeachAchievement(id);
@ -335,6 +376,15 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
Integer recordId = teachAchievement.getRecordId(); Integer recordId = teachAchievement.getRecordId();
achievementManagementDao.deleteReport(reportId, recordId); achievementManagementDao.deleteReport(reportId, recordId);
} }
//将教学实验隐藏
projectHiddenEntity.setTeachId(id);
projectHiddenEntity.setIsHidden(1);
num = projectHiddenDao.insert(projectHiddenEntity);
if (num <= 0) {
R.error(400, "删除失败!");
}
} }
} else { } else {
for (Integer projectId : projectIds) {//虚仿实验 for (Integer projectId : projectIds) {//虚仿实验
@ -344,6 +394,16 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
Integer recordId = imitationAchievement.getRecordId(); Integer recordId = imitationAchievement.getRecordId();
achievementManagementDao.deleteReport(reportId, recordId); 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); Integer systemId = reportDao.querySystemId(recordId);
//python实验 //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); List<AchievementManagementVO> data = achievementManagementDao.queryPythonTest(recordId);
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("data", data); 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.R;
import com.msdw.tms.common.utils.poi.ExcelExportUtil; import com.msdw.tms.common.utils.poi.ExcelExportUtil;
import com.msdw.tms.dao.ProjectRecordDao; import com.msdw.tms.dao.ProjectRecordDao;
import com.msdw.tms.dao.StudentDao;
import com.msdw.tms.entity.ExperimentalReportEntity; import com.msdw.tms.entity.ExperimentalReportEntity;
import com.msdw.tms.entity.ProjectRecordEntity; import com.msdw.tms.entity.ProjectRecordEntity;
import com.msdw.tms.entity.request.ExperimentProjectRecordImportRequest; 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.resp.GetByUserRecordResp;
import com.msdw.tms.entity.vo.ProjectRecordExportVo; import com.msdw.tms.entity.vo.ProjectRecordExportVo;
import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.entity.vo.ProjectRecordVo;
import com.msdw.tms.entity.vo.StudentVo;
import com.msdw.tms.service.ProjectRecordService; import com.msdw.tms.service.ProjectRecordService;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -24,6 +26,8 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -36,16 +40,19 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
@Autowired @Autowired
private ProjectRecordDao baseMapper; private ProjectRecordDao baseMapper;
@Autowired
private StudentDao studentDao;
@Override @Override
public PageUtils getByKDUserRecord(Integer page,Integer size,Integer userId,Integer projectPermissions,Integer systemId) { public PageUtils getByKDUserRecord(Integer page, Integer size, Integer userId, Integer projectPermissions, Integer systemId) {
ProjectRecordEntity projectRecord = new ProjectRecordEntity().setUserid(userId); ProjectRecordEntity projectRecord = new ProjectRecordEntity().setUserid(userId);
//分页对象 //分页对象
Page<T> page1 = new Page<>(page, size); Page<T> page1 = new Page<>(page, size);
IPage<ProjectRecordVo> projectRecordVos = this.baseMapper.getByKDUserRecord(page1,projectRecord,projectPermissions); IPage<ProjectRecordVo> projectRecordVos = this.baseMapper.getByKDUserRecord(page1, projectRecord, projectPermissions);
PageUtils questionsPage = new PageUtils(projectRecordVos); PageUtils questionsPage = new PageUtils(projectRecordVos);
@ -53,7 +60,7 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
} }
@Override @Override
public PageUtils queryPage(Integer page, Integer size, Integer userId, Integer projectPermissions,Integer systemId) { public PageUtils queryPage(Integer page, Integer size, Integer userId, Integer projectPermissions, Integer systemId) {
/*GetByUserRecordResp projectRecord = new GetByUserRecordResp(); /*GetByUserRecordResp projectRecord = new GetByUserRecordResp();
projectRecord.setUserId(userId);*/ projectRecord.setUserId(userId);*/
@ -61,7 +68,7 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
//分页对象 //分页对象
Page<T> page1 = new Page<>(page, size); Page<T> page1 = new Page<>(page, size);
IPage<GetByUserRecordResp> projectRecordVos = this.baseMapper.getByUserRecord(page1, userId, projectPermissions,systemId); IPage<GetByUserRecordResp> projectRecordVos = this.baseMapper.getByUserRecord(page1, userId, projectPermissions, systemId);
PageUtils questionsPage = new PageUtils(projectRecordVos); PageUtils questionsPage = new PageUtils(projectRecordVos);
@ -69,14 +76,14 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
} }
@Override @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()); ProjectRecordEntity projectRecord = new ProjectRecordEntity().setUserid(userid).setIsdel(Constant.IsDel.NOT_DEL.getType());
//分页对象 //分页对象
Page<T> page1 = new Page<>(page, size); 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); PageUtils questionsPage = new PageUtils(projectRecordVos);
@ -88,6 +95,57 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
Integer isdel = Constant.IsDel.NOT_DEL.getType(); Integer isdel = Constant.IsDel.NOT_DEL.getType();
ProjectRecordVo projectRecordVo = this.baseMapper.getByUserScore(userId, isdel); 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(); Double totalTime = projectRecordVo.getTotalTime();
if (totalTime != null) { if (totalTime != null) {
DecimalFormat df = new DecimalFormat("0.00"); 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.getByRecordImport(projectRecord);
// List<ProjectRecordExportVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord); // List<ProjectRecordExportVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord);
StudentVo studentVo = studentDao.queryStudentDetails(userId);
List<ProjectRecordImportRequest> importRequests = projectRecordVos.stream().map(project -> { List<ProjectRecordImportRequest> importRequests = projectRecordVos.stream().map(project -> {
ProjectRecordImportRequest request = new ProjectRecordImportRequest(); ProjectRecordImportRequest request = new ProjectRecordImportRequest();
BeanUtils.copyProperties(project, request); BeanUtils.copyProperties(project, request);
@ -125,13 +185,13 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
//2.加载模板流数据 //2.加载模板流数据
// org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/虚拟仿真实验报告导出模板.xlsx"); // org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/虚拟仿真实验报告导出模板.xlsx");
// FileInputStream fis = new FileInputStream(resource.getFile()); // FileInputStream fis = new FileInputStream(resource.getFile());
ClassPathResource resource = new ClassPathResource("excel-template/虚拟仿真实验报告导出模板.xlsx"); ClassPathResource resource = new ClassPathResource("excel-template/练习记录模板.xlsx");
InputStream inputStream = resource.getInputStream(); InputStream inputStream = resource.getInputStream();
//3、通过工具类下载文件 //3、通过工具类下载文件
new ExcelExportUtil(ProjectRecordImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). new ExcelExportUtil(ProjectRecordImportRequest.class, Constant.ROW_INDEX_REPORT, Constant.STYLE_INDEX).
export(response, inputStream, importRequests, "虚拟仿真实验报告.xlsx"); exportExpand(response, inputStream, importRequests, studentVo,"练习记录.xlsx");
// new ExcelExportUtil(ProjectRecordImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). // new ExcelExportUtil(ProjectRecordImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
// export(response, fis, importRequests, "实验报告导出.xlsx"); // export(response, fis, importRequests, "实验报告导出.xlsx");
} }
@ -146,6 +206,8 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
List<ProjectRecordExportVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord); List<ProjectRecordExportVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord);
StudentVo studentVo = studentDao.queryStudentDetails(userId);
List<ExperimentProjectRecordImportRequest> importRequests = projectRecordVos.stream().map(project -> { List<ExperimentProjectRecordImportRequest> importRequests = projectRecordVos.stream().map(project -> {
ExperimentProjectRecordImportRequest request = new ExperimentProjectRecordImportRequest(); ExperimentProjectRecordImportRequest request = new ExperimentProjectRecordImportRequest();
BeanUtils.copyProperties(project, request); BeanUtils.copyProperties(project, request);
@ -153,13 +215,13 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
}).collect(Collectors.toList()); }).collect(Collectors.toList());
//2.加载模板流数据 //2.加载模板流数据
ClassPathResource resource = new ClassPathResource("excel-template/教学实验报告导出模板.xlsx"); ClassPathResource resource = new ClassPathResource("excel-template/考核记录模板.xlsx");
InputStream inputStream = resource.getInputStream(); InputStream inputStream = resource.getInputStream();
//3、通过工具类下载文件 //3、通过工具类下载文件
new ExcelExportUtil(ExperimentProjectRecordImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). new ExcelExportUtil(ExperimentProjectRecordImportRequest.class, Constant.ROW_INDEX_REPORT, Constant.STYLE_INDEX).
export(response, inputStream, importRequests, "教学实验报告.xlsx"); exportExpand(response, inputStream, importRequests,studentVo, "考核记录.xlsx");
} }
@Override @Override
@ -183,4 +245,6 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
public void updateScore(ProjectRecordEntity vo) { public void updateScore(ProjectRecordEntity vo) {
this.baseMapper.updateScore(vo); this.baseMapper.updateScore(vo);
} }
} }

@ -39,7 +39,7 @@ import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Service("studentService") @Service("studentService")
public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> implements StudentService { public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> implements StudentService {
@Autowired @Autowired
private StudentDao studentDao; private StudentDao studentDao;
@ -57,11 +57,11 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
StringRedisTemplate stringRedisTemplate; StringRedisTemplate stringRedisTemplate;
@Override @Override
public Integer queryStudentIdNumber(String workNumber,Integer schoolId) { public Integer queryStudentIdNumber(String workNumber, Integer schoolId) {
List<Integer> result = studentDao.queryStudentIdNumber(workNumber,schoolId); List<Integer> result = studentDao.queryStudentIdNumber(workNumber, schoolId);
if (result.size()==1){ if (result.size() == 1) {
return 1; return 1;
}else{ } else {
return 0; return 0;
} }
} }
@ -75,9 +75,9 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
} }
@Override @Override
public PageUtils queryStudent(Integer schoolId,String searchContent, Integer page, Integer size) { public PageUtils queryStudent(Integer schoolId, String searchContent, Integer page, Integer size) {
Page<T> tPage = new Page<>(page,size); Page<T> tPage = new Page<>(page, size);
IPage<StudentVo> saveStudent = studentDao.queryStudent(tPage,searchContent,schoolId); IPage<StudentVo> saveStudent = studentDao.queryStudent(tPage, searchContent, schoolId);
PageUtils pageUtils = new PageUtils(saveStudent); PageUtils pageUtils = new PageUtils(saveStudent);
return pageUtils; return pageUtils;
} }
@ -85,10 +85,10 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
@Override @Override
public R queryStudentDetails(Integer userId) { public R queryStudentDetails(Integer userId) {
StudentVo saveStudent = studentDao.queryStudentDetails(userId); StudentVo saveStudent = studentDao.queryStudentDetails(userId);
if (saveStudent!=null){ if (saveStudent != null) {
return R.ok().put("data",saveStudent); return R.ok().put("data", saveStudent);
}else { } else {
return R.error(300,"用户不存在!"); return R.error(300, "用户不存在!");
} }
} }
@ -99,7 +99,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
try { try {
Integer delete = studentDao.deleteStudent(studentId); Integer delete = studentDao.deleteStudent(studentId);
return true; return true;
}catch (RuntimeException e){ } catch (RuntimeException e) {
e.printStackTrace(); e.printStackTrace();
return false; return false;
} }
@ -110,7 +110,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
try { try {
Integer update = studentDao.updateStudent(studentVo); Integer update = studentDao.updateStudent(studentVo);
return true; return true;
}catch (RuntimeException e){ } catch (RuntimeException e) {
e.printStackTrace(); e.printStackTrace();
return false; return false;
} }
@ -118,22 +118,19 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
@Override @Override
public void updateWorkNumber(Integer studentId) { public void updateWorkNumber(Integer studentId) {
studentDao.updateWorkNumber("00",studentId);//将学号重置为00 studentDao.updateWorkNumber("00", studentId);//将学号重置为00
} }
@Override @Override
public R addStudentInfo(UserInfoEntity userInfoEntity) { public R addStudentInfo(StudentVo studentVo) {
R r = new R(); R r = new R();
boolean result = studentDao.addStudentInfo(userInfoEntity); boolean result = studentDao.addStudentInfo(studentVo);
if (result==false){ if (result == false) {
r.put("code",300); throw new RuntimeException();//添加失败,抛出运行时异常让外层事务回滚
r.put("errmessage","注册失败!"); } else {
return r; return R.ok("注册成功!");
}else{
r.put("code",200);
r.put("errmessage","注册成功!");
return r;
} }
} }
@Override @Override
@ -144,8 +141,15 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
@Transactional @Transactional
@Override @Override
public Map<String, String> upload(MultipartFile file, Integer schoolId) throws IOException{ public Map<String, String> upload(MultipartFile file, Integer schoolId) throws IOException {
List<StudentVo> students = ExcelImportHelper.readStudent(file); 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<>(); List<StudentImportFailureVo> failVo1 = new ArrayList<>();
// 参数合法性校验,只能上传.xlsx后缀的文件 // 参数合法性校验,只能上传.xlsx后缀的文件
if (StringUtils.isBlank(file.getOriginalFilename()) if (StringUtils.isBlank(file.getOriginalFilename())
@ -156,24 +160,83 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
Long ii = 1L;//用于记录序列号 Long ii = 1L;//用于记录序列号
try { try {
for (int i = 0;i<students.size();i++){ for (int i = 0; i < students.size(); i++) {
StudentVo student = students.get(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 phone = student.getPhone();
String workNumber = student.getWorkNumber(); 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(); 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(); StudentVo studentVo = new StudentVo();
String schoolAppellationName = student.getSchoolAppellationName(); //String schoolAppellationName = student.getSchoolAppellationName();
List<Integer> result1 = studentDao.queryStudentIdNumber(workNumber,schoolId); List<Integer> result1 = studentDao.queryStudentIdNumber(workNumber, schoolId);
List<StudentEntity> result4 = userInfoDao.queryStudentAccount(account); List<StudentEntity> result4 = userInfoDao.queryStudentAccount(account);
String email = student.getEmail(); String email = student.getEmail();
if (phone!=null&&phone!=""){ if (phone != null && phone != "") {
List<StudentEntity> result2 = userInfoDao.queryStudentPhone(phone); List<StudentEntity> result2 = userInfoDao.queryStudentPhone(phone);
if (result2.size()>=1){ if (result2.size() >= 1) {
log.error("该号码已被使用"); log.error("该号码已被使用");
StudentImportFailureVo vo = new StudentImportFailureVo(); StudentImportFailureVo vo = new StudentImportFailureVo();
++ii; ++ii;
vo.setIndex(ii).setUserName(student.getUserName()).setSchoolAppellationName(student.getSchoolAppellationName()) vo.setIndex(ii)
.setAccount(student.getAccount()).setWorkNumber(student.getWorkNumber()).setPhone(student.getPhone()+" (重复的号码)").setEmail(student.getEmail()) .setUserName(student.getUserName())
.setAccount(student.getAccount())
.setWorkNumber(student.getWorkNumber())
.setPhone(student.getPhone() + " (重复的号码)")
.setEmail(student.getEmail())
; ;
failVo1.add(vo); failVo1.add(vo);
students.remove(i); students.remove(i);
@ -182,24 +245,29 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
} }
studentVo.setPhone(phone); studentVo.setPhone(phone);
} }
if (email!=null&&email!=""){ if (email != null && email != "") {
studentVo.setEmail(email); studentVo.setEmail(email);
} }
List<Integer> result3 = studentDao.querySchoolName(schoolAppellationName); // List<Integer> result3 = studentDao.querySchoolName(schoolAppellationName);
// 唯一标示性账号 // 唯一标示性账号
studentVo.setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())). studentVo.setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())).
setPassword(ConstantUtils.INITIAL_PASSWORD).setToken(new ConstantUtils().token) setPassword(ConstantUtils.INITIAL_PASSWORD).setToken(new ConstantUtils().token)
.setSchoolId(ConstantUtils.Keda_schoolId).setRoleId(ConstantUtils.STUDENT_ROLE) .setSchoolId(ConstantUtils.Keda_schoolId).setRoleId(ConstantUtils.STUDENT_ROLE)
; ;
studentVo.setAccount(student.getAccount()).setSchoolAppellationName(schoolAppellationName) studentVo.setAccount(student.getAccount())
.setUserName(student.getUserName()).setIsdel(Constant.IsDel.NOT_DEL.getType()); .setUserName(student.getUserName())
.setIsdel(Constant.IsDel.NOT_DEL.getType());
if (result1.size()>=1){ if (result1.size() >= 1) {
log.error("该学号已存在"); log.error("该学号已存在");
StudentImportFailureVo vo = new StudentImportFailureVo(); StudentImportFailureVo vo = new StudentImportFailureVo();
++ii; ++ii;
vo.setIndex(ii).setUserName(student.getUserName()).setSchoolAppellationName(student.getSchoolAppellationName()) vo.setIndex(ii)
.setAccount(student.getAccount()).setWorkNumber(student.getWorkNumber()+" (重复的学号)").setPhone(student.getPhone()).setEmail(student.getEmail()) .setUserName(student.getUserName())
.setAccount(student.getAccount())
.setWorkNumber(student.getWorkNumber() + " (重复的学号)")
.setPhone(student.getPhone()).setEmail(student.getEmail())
; ;
// .setFailureMsg("重复的学号"); // .setFailureMsg("重复的学号");
failVo1.add(vo); failVo1.add(vo);
@ -207,12 +275,16 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
students.remove(i); students.remove(i);
i--; i--;
continue; continue;
}else if(result4.size()>=1){ } else if (result4.size() >= 1) {
log.error("账号已存在"); log.error("账号已存在");
StudentImportFailureVo vo = new StudentImportFailureVo(); StudentImportFailureVo vo = new StudentImportFailureVo();
++ii; ++ii;
vo.setIndex(ii).setUserName(student.getUserName()).setSchoolAppellationName(student.getSchoolAppellationName()) vo.setIndex(ii)
.setAccount(student.getAccount()+" (重复的账号)").setWorkNumber(student.getWorkNumber()).setPhone(student.getPhone()).setEmail(student.getEmail()) .setUserName(student.getUserName())
.setAccount(student.getAccount() + " (重复的账号)")
.setWorkNumber(student.getWorkNumber())
.setPhone(student.getPhone())
.setEmail(student.getEmail())
; ;
// .setFailureMsg("重复的账号"); // .setFailureMsg("重复的账号");
failVo1.add(vo); failVo1.add(vo);
@ -221,7 +293,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
i--; i--;
continue; continue;
} }
else if(result3.size()!=1){ /*else if(result3.size()!=1){
log.error("不存在该院校"); log.error("不存在该院校");
StudentImportFailureVo vo = new StudentImportFailureVo(); StudentImportFailureVo vo = new StudentImportFailureVo();
++ii; ++ii;
@ -233,23 +305,24 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
students.remove(i); students.remove(i);
i--; i--;
continue; continue;
} }*/
++ii; ++ii;
if (!students.isEmpty()&&students.size()>0){ if (!students.isEmpty() && students.size() > 0) {
studentVo.setSchoolId(schoolId);
userInfoDao.batchSaveUserInfo(studentVo); userInfoDao.batchSaveUserInfo(studentVo);
student.setUserId(studentVo.getUserId()).setIsdel(Constant.IsDel.NOT_DEL.getType()).setPlatformId(ConstantUtils.PLATFORMID); student.setUserId(studentVo.getUserId()).setIsdel(Constant.IsDel.NOT_DEL.getType()).setPlatformId(ConstantUtils.PLATFORMID);
boolean b = studentDao.saveStudent(student); boolean b = studentDao.saveStudent(student);
if (!b){ if (!b) {
throw new RuntimeException(); throw new RuntimeException();
} }
} }
} }
}catch (RuntimeException e){ } catch (RuntimeException e) {
log.error(e.getMessage()); log.error(e.getMessage());
map.put("failura","添加失败"); map.put("failura", "添加失败");
throw new RuntimeException(); throw new RuntimeException();
} }
String token = ""; String token = "";
@ -264,14 +337,14 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
ops.set(token, failureVOJson, 30 * 60, TimeUnit.SECONDS); ops.set(token, failureVOJson, 30 * 60, TimeUnit.SECONDS);
} }
map.put("token", token); map.put("token", token);
map.put("successNum", (size-failVo1.size())+""); map.put("successNum", (size - failVo1.size()) + "");
map.put("failureNum", failVo1.size()+""); map.put("failureNum", failVo1.size() + "");
return map; return map;
} }
@Override @Override
public void exportFailureRecord(HttpServletResponse response,String token) throws Exception{ public void exportFailureRecord(HttpServletResponse response, String token) throws Exception {
if (StringUtils.isEmpty(token)) { if (StringUtils.isEmpty(token)) {
return; return;
} }
@ -287,27 +360,33 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
parse.sort(Comparator.comparing(StudentImportFailureVo::getIndex)); parse.sort(Comparator.comparing(StudentImportFailureVo::getIndex));
//2.加载模板流数据 //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(); InputStream inputStream = resource.getInputStream();
//3、通过工具类下载文件 //3、通过工具类下载文件
new ExcelExportUtil(StudentImportFailureVo.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). new ExcelExportUtil(StudentImportFailureVo.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
export(response, inputStream, parse, "学生信息导入失败表.xlsx"); export(response, inputStream, parse, "学生信息导入失败表(1).xlsx");
} }
@Override @Override
public R queryAccount(String account,Integer schoolId) { public R queryAccount(String account, Integer schoolId) {
List<StudentVo> result = studentDao.queryAccount(account,schoolId); List<StudentVo> result = studentDao.queryAccount(account, schoolId);
List<StaffVo> vos = userInfoDao.queryAccount(account); List<StaffVo> vos = userInfoDao.queryAccount(account);
if (result.size()>1){ if (result.size() > 1) {
return R.error("系统存在多个相同的账号:"+account); return R.error("系统存在多个相同的账号:" + account);
}else if (result.size()==1){return R.ok().put("data",result); } else if (result.size() == 1) {
}else if (vos.size()>0){ return R.ok().put("data", result);
} else if (vos.size() > 0) {
return R.error("账号已存在"); return R.error("账号已存在");
} }
return R.ok(); return R.ok();
} }
@Override
public int queryStudentByWorkNumber(StudentVo studentVo) {
return studentDao.queryStudentByWorkNumber(studentVo);
}
} }

@ -65,33 +65,35 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
String email = staffVo.getEmail(); String email = staffVo.getEmail();
String workNumber = staffVo.getWorkNumber(); String workNumber = staffVo.getWorkNumber();
List<StaffEntity> staff = staffVo.getStaff(); List<StaffEntity> staff = staffVo.getStaff();
if (phone!=null&&phone!=""){ if (phone != null && phone != "") {
List<Integer> resultP = userInfoDao.queryPhone(phone); List<Integer> resultP = userInfoDao.queryPhone(phone);
if (resultP.size()>0){ if (resultP.size() > 0) {
return R.error(400,"手机号不能重复"); return R.error(400, "手机号不能重复");
} }
} }
if (email!=null&&email!=""){ if (email != null && email != "") {
List<Integer> resultE = userInfoDao.queryEmail(email); List<Integer> resultE = userInfoDao.queryEmail(email);
if (resultE.size()>0){ if (resultE.size() > 0) {
return R.error(400,"手机号不能重复"); return R.error(400, "手机号不能重复");
} }
} }
List<StaffVo> resultA = userInfoDao.queryAccount(account); List<StaffVo> resultA = userInfoDao.queryAccount(account);
// List<Integer> resultW = systemSetttingDao.queryWorkNumber(workNumber); // List<Integer> resultW = systemSetttingDao.queryWorkNumber(workNumber);
if(resultA.size()>0){ if (resultA.size() > 0) {
return R.error(400,"账号不能重复"); return R.error(400, "账号不能重复");
} }
Integer userId = userInfoDao.addUserinfo(staffVo); Integer userId = userInfoDao.addUserinfo(staffVo);
for (int i=0;i<staff.size();i++){ for (int i = 0; i < staff.size(); i++) {
List<Integer> resultW = systemSetttingDao.queryWorkNumber(workNumber); List<Integer> resultW = systemSetttingDao.queryWorkNumber(workNumber);
if (resultW.size()>0){ if (resultW.size() > 0) {
return R.error(400,"工号不能重复"+workNumber); return R.error(400, "工号不能重复" + workNumber);
} }
StaffEntity entity = staff.get(i); StaffEntity entity = staff.get(i);
entity.setSchoolId(ConstantUtils.Keda_schoolId).setPlatformId(ConstantUtils.PLATFORMID).setUserId(staffVo.getUserId()); entity.setSchoolId(ConstantUtils.Keda_schoolId).setPlatformId(ConstantUtils.PLATFORMID).setUserId(staffVo.getUserId());
boolean result = systemSetttingDao.addStaffN(entity); boolean result = systemSetttingDao.addStaffN(entity);
if (!result) {throw new RuntimeException();} if (!result) {
throw new RuntimeException();
}
} }
// String[] split = staffVo.getRoleId().split(","); // String[] split = staffVo.getRoleId().split(",");
// for (String s : split){ // for (String s : split){
@ -107,7 +109,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
@Override @Override
public PageUtils queryStaff(StaffVo staffVo) { public PageUtils queryStaff(StaffVo staffVo) {
Page<T> tPage = new Page<>(staffVo.getPage(), staffVo.getSize()); Page<T> tPage = new Page<>(staffVo.getPage(), staffVo.getSize());
IPage<StaffVo> staff = systemSetttingDao.queryStaff(tPage, staffVo.getSearchContent(),ConstantUtils.Keda_schoolId,staffVo.getStaffGradeIds(),staffVo.getStaffProfessionalArchitectureIds()); IPage<StaffVo> staff = systemSetttingDao.queryStaff(tPage, staffVo.getSearchContent(), ConstantUtils.Keda_schoolId, staffVo.getStaffGradeIds(), staffVo.getStaffProfessionalArchitectureIds());
PageUtils pageUtils = new PageUtils(staff); PageUtils pageUtils = new PageUtils(staff);
return pageUtils; return pageUtils;
} }
@ -120,8 +122,8 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
List<StaffVo> staff = systemSetttingDao.queryStaffInfo(userId); List<StaffVo> staff = systemSetttingDao.queryStaffInfo(userId);
// result.setWorkNumber(staff.getWorkNumber()).setStaffGradeId(staff.getStaffGradeId()).setStaffGradeName(staff.getStaffGradeName()) // result.setWorkNumber(staff.getWorkNumber()).setStaffGradeId(staff.getStaffGradeId()).setStaffGradeName(staff.getStaffGradeName())
// .setStaffProfessionalArchitectureId(staff.getStaffProfessionalArchitectureId()).setStaffProfessionalArchitectureName(staff.getStaffProfessionalArchitectureName()); // .setStaffProfessionalArchitectureId(staff.getStaffProfessionalArchitectureId()).setStaffProfessionalArchitectureName(staff.getStaffProfessionalArchitectureName());
map.put("userInfo",result); map.put("userInfo", result);
map.put("staffInfo",staff); map.put("staffInfo", staff);
return map; return map;
} }
@ -138,45 +140,49 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
String roleIds = result.getRoleId(); String roleIds = result.getRoleId();
String[] splitOld = staffVo.getRoleId().split(","); String[] splitOld = staffVo.getRoleId().split(",");
String[] splitNew = roleIds.split(","); String[] splitNew = roleIds.split(",");
if (splitOld.length==splitNew.length&&splitNew.length<3){ if (splitOld.length == splitNew.length && splitNew.length < 3) {
for (int i = 0;i<splitNew.length;i++){ for (int i = 0; i < splitNew.length; i++) {
boolean a = systemSetttingDao.updateStaff(staff.get(i)); boolean a = systemSetttingDao.updateStaff(staff.get(i));
if (!a){throw new RuntimeException();} if (!a) {
throw new RuntimeException();
}
} }
}else if (splitNew.length>splitOld.length){ } else if (splitNew.length > splitOld.length) {
boolean a = systemSetttingDao.updateStaff(staff.get(0)); boolean a = systemSetttingDao.updateStaff(staff.get(0));
StaffEntity staffEntity = staff.get(1); StaffEntity staffEntity = staff.get(1);
staffEntity.setUserId(staffVo.getUserId()); staffEntity.setUserId(staffVo.getUserId());
boolean b = systemSetttingDao.addStaffUpdata(staffEntity); boolean b = systemSetttingDao.addStaffUpdata(staffEntity);
if (!a|!b){throw new RuntimeException();} if (!a | !b) {
}else if (splitNew.length<splitOld.length){ throw new RuntimeException();
}
} else if (splitNew.length < splitOld.length) {
boolean a = systemSetttingDao.deleteStaffOnly(staffVo.getUserId());//删除roleId最大的数据 boolean a = systemSetttingDao.deleteStaffOnly(staffVo.getUserId());//删除roleId最大的数据
staffVo.setStaffRoleId(Integer.parseInt(staffVo.getRoleId())); staffVo.setStaffRoleId(Integer.parseInt(staffVo.getRoleId()));
boolean b = systemSetttingDao.updateStaffOnly(staffVo);//修改仅剩的数据 boolean b = systemSetttingDao.updateStaffOnly(staffVo);//修改仅剩的数据
}else{ } else {
return R.error(400,"不存在此账号"); return R.error(400, "不存在此账号");
} }
userInfoDao.setNUM(staffVo.getUserId());//重置账号、手机号码为00 userInfoDao.setNUM(staffVo.getUserId());//重置账号、手机号码为00
// systemSetttingDao.deleteStaffInfo(staffVo.getUserId());// // systemSetttingDao.deleteStaffInfo(staffVo.getUserId());//
List<StaffVo> resultA = userInfoDao.queryAccount(account); List<StaffVo> resultA = userInfoDao.queryAccount(account);
List<Integer> resultW = systemSetttingDao.queryWorkNumber(workNumber); List<Integer> resultW = systemSetttingDao.queryWorkNumber(workNumber);
if (phone!=null&&phone!=""){ if (phone != null && phone != "") {
List<Integer> resultP = userInfoDao.queryPhone(phone); List<Integer> resultP = userInfoDao.queryPhone(phone);
if (resultP.size()>0){ if (resultP.size() > 0) {
return R.error(400,"手机号不能重复"); return R.error(400, "手机号不能重复");
} }
} }
if (email!=null&&email!=""){ if (email != null && email != "") {
List<Integer> resultE = userInfoDao.queryEmail(email); List<Integer> resultE = userInfoDao.queryEmail(email);
if (resultE.size()>0){ if (resultE.size() > 0) {
return R.error(400,"手机号不能重复"); return R.error(400, "手机号不能重复");
} }
} }
if(resultA.size()>0){ if (resultA.size() > 0) {
return R.error(400,"账号不能重复"); return R.error(400, "账号不能重复");
}else if (resultW.size()>0){ } else if (resultW.size() > 0) {
return R.error(400,"工号不能重复"); return R.error(400, "工号不能重复");
} }
boolean resultUserInfo = userInfoDao.updateUserInfo(staffVo); boolean resultUserInfo = userInfoDao.updateUserInfo(staffVo);
// String[] split = staffVo.getRoleId().split(","); // String[] split = staffVo.getRoleId().split(",");
@ -206,21 +212,21 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
//查询是否存在相同的部门 //查询是否存在相同的部门
String departmentName = staffVo.getStaffProfessionalArchitectureName(); String departmentName = staffVo.getStaffProfessionalArchitectureName();
String gradeName = staffVo.getStaffGradeName(); String gradeName = staffVo.getStaffGradeName();
if (gradeName!=null|gradeName!=""){ if (gradeName != null | gradeName != "") {
Integer department = systemSetttingDao.queryGrade(staffVo); Integer department = systemSetttingDao.queryGrade(staffVo);
if (department==0){ if (department == 0) {
systemSetttingDao.addDepartment(staffVo); systemSetttingDao.addDepartment(staffVo);
} }
map.put("已存在的部门",departmentName); map.put("已存在的部门", departmentName);
}else{ } else {
Integer department = systemSetttingDao.queryDepartment(staffVo); Integer department = systemSetttingDao.queryDepartment(staffVo);
if (department==0){ if (department == 0) {
boolean result = systemSetttingDao.addStaffGrade(staffVo); boolean result = systemSetttingDao.addStaffGrade(staffVo);
if (!result){ if (!result) {
throw new RuntimeException(); throw new RuntimeException();
} }
} }
map.put("已存在的部门",gradeName); map.put("已存在的部门", gradeName);
} }
return map; return map;
} }
@ -231,11 +237,17 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
return result; return result;
} }
@Override @Override
@Transactional @Transactional
public Map<String, String> upload(MultipartFile file) throws IOException { public Map<String, String> upload(MultipartFile file) throws IOException {
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
List<StaffVo> staffs = ExcelImportHelper.readStaff(file); List<StaffVo> staffs = ExcelImportHelper.readStaff(file);
if (staffs.size() <= 0) {
ExceptionCast.cast(CommonCode.EXCEL_FILE_FORMAT_ERROR_STAFFS);
}
List<StaffExportVo> failVo1 = new ArrayList<>(); List<StaffExportVo> failVo1 = new ArrayList<>();
// 参数合法性校验,只能上传.xlsx后缀的文件 // 参数合法性校验,只能上传.xlsx后缀的文件
if (StringUtils.isBlank(file.getOriginalFilename()) if (StringUtils.isBlank(file.getOriginalFilename())
@ -245,24 +257,235 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
int size = staffs.size(); int size = staffs.size();
Long ii = 1L; Long ii = 1L;
try { try {
for (int i = 0;i<staffs.size();i++){ for (int i = 0; i < staffs.size(); i++) {
++ii; ++ii;
StaffVo staffVo = staffs.get(i); StaffVo staffVo = staffs.get(i);
String phone = staffVo.getPhone(); String phone = staffVo.getPhone();
String email = staffVo.getEmail(); 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 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 architectureName = staffVo.getStaffProfessionalArchitectureName();
String gradeNameTwo = staffVo.getStaffGradeNameTwo(); //绑定年级名称(*管理员的二级部门)
String gradeName = staffVo.getStaffGradeName();
//老师组织架构名称(*老师的一级部门)
String architectureNameTwo = staffVo.getStaffProfessionalArchitectureNameTwo(); 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(); StaffVo staff = new StaffVo();
staff.setSchoolId(ConstantUtils.Keda_schoolId);//设定科大学校id staff.setSchoolId(ConstantUtils.Keda_schoolId);//设定科大学校id
String schoolAppellationName = staffVo.getSchoolAppellationName(); //String schoolAppellationName = staffVo.getSchoolAppellationName();
List<Integer> resultW = systemSetttingDao.queryWorkNumber(workNumber); List<Integer> resultW = systemSetttingDao.queryWorkNumber(workNumber);
List<StaffVo> resultA = userInfoDao.queryAccount(account); List<StaffVo> resultA = userInfoDao.queryAccount(account);
List<StaffVo> resultU = userInfoDao.queryUserInfo(staffVo); List<StaffVo> resultU = userInfoDao.queryUserInfo(staffVo);
if (resultU.size()>0){//重复的数据 if (resultU.size() > 0) {//重复的数据
StaffExportVo vo = new StaffExportVo(); StaffExportVo vo = new StaffExportVo();
vo.setFailureMsg("用户信息已存在"); vo.setFailureMsg("用户信息已存在");
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()); 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());
@ -270,7 +493,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
i--; i--;
failVo1.add(vo); failVo1.add(vo);
continue; continue;
}else if (resultW.size()>0){ } else if (resultW.size() > 0) {
StaffExportVo vo = new StaffExportVo(); StaffExportVo vo = new StaffExportVo();
vo.setFailureMsg("重复的工号"); vo.setFailureMsg("重复的工号");
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()); 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());
@ -278,7 +501,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
i--; i--;
failVo1.add(vo); failVo1.add(vo);
continue; continue;
}else if (resultA.size()>0){ } else if (resultA.size() > 0) {
StaffExportVo vo = new StaffExportVo(); StaffExportVo vo = new StaffExportVo();
vo.setFailureMsg("重复的账号"); vo.setFailureMsg("重复的账号");
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()); 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());
@ -286,9 +509,9 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
i--; i--;
failVo1.add(vo); failVo1.add(vo);
continue; continue;
}else if (phone!=null&&phone!=""){ } else if (phone != null && phone != "") {
List<Integer> resultP = userInfoDao.queryPhone(phone); List<Integer> resultP = userInfoDao.queryPhone(phone);
if (resultP.size()>0){ if (resultP.size() > 0) {
StaffExportVo vo = new StaffExportVo(); StaffExportVo vo = new StaffExportVo();
vo.setFailureMsg("重复的手机号码"); vo.setFailureMsg("重复的手机号码");
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()); 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());
@ -297,9 +520,9 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
failVo1.add(vo); failVo1.add(vo);
continue; continue;
} }
}else if (email!=null&&email!=""){ } else if (email != null && email != "") {
List<Integer> resultE = userInfoDao.queryEmail(email); List<Integer> resultE = userInfoDao.queryEmail(email);
if (resultE.size()>0){ if (resultE.size() > 0) {
StaffExportVo vo = new StaffExportVo(); StaffExportVo vo = new StaffExportVo();
vo.setFailureMsg("重复的邮箱号"); vo.setFailureMsg("重复的邮箱号");
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()); 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());
@ -310,18 +533,18 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
} }
} }
if (!staffs.isEmpty()&&staffs.size()>0){ if (!staffs.isEmpty() && staffs.size() > 0) {
staffVo.setPassword(ConstantUtils.INITIAL_PASSWORD).setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())); staffVo.setPassword(ConstantUtils.INITIAL_PASSWORD).setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis()));
staff.setPlatformId(ConstantUtils.PLATFORMID).setUserId(staffVo.getUserId()); staff.setPlatformId(ConstantUtils.PLATFORMID).setUserId(staffVo.getUserId());
staffVo.setPlatformId(ConstantUtils.PLATFORMID).setToken(new ConstantUtils().token); staffVo.setPlatformId(ConstantUtils.PLATFORMID).setToken(new ConstantUtils().token);
String[] split = staffVo.getRoleId().split(","); String[] split = staffVo.getRoleId().split(",");
String s = ""; String s = "";
for (String str : split) { for (String str : split) {
s=s+str; s = s + str;
} }
if (s.indexOf("13")!=-1){//2 if (s.indexOf("13") != -1) {//2
if (architectureName!=null&&architectureName!=""){ if (architectureName != null && architectureName != "") {
if (gradeName==null|gradeName==""){ if (gradeName == null | gradeName == "") {
StaffExportVo vo = new StaffExportVo(); StaffExportVo vo = new StaffExportVo();
vo.setFailureMsg("二级部门不能为空(管理员)"); vo.setFailureMsg("二级部门不能为空(管理员)");
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()); 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());
@ -329,9 +552,9 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
i--; i--;
failVo1.add(vo); failVo1.add(vo);
continue; continue;
}else{ } else {
Integer b = systemSetttingDao.queryDepartmentNameOrganization(architectureName, ConstantUtils.Keda_schoolId); Integer b = systemSetttingDao.queryDepartmentNameOrganization(architectureName, ConstantUtils.Keda_schoolId);
if (b==null){ if (b == null) {
StaffExportVo vo = new StaffExportVo(); StaffExportVo vo = new StaffExportVo();
vo.setFailureMsg("不存在的一级部门(管理员)"); vo.setFailureMsg("不存在的一级部门(管理员)");
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()); 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());
@ -340,8 +563,8 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
failVo1.add(vo); failVo1.add(vo);
continue; continue;
} }
List<StaffVo> a = systemSetttingDao.judgmentGrade(architectureName,ConstantUtils.Keda_schoolId); List<StaffVo> a = systemSetttingDao.judgmentGrade(architectureName, ConstantUtils.Keda_schoolId);
if (a.size()==0){ if (a.size() == 0) {
StaffExportVo vo = new StaffExportVo(); StaffExportVo vo = new StaffExportVo();
vo.setFailureMsg("不存在此子级部门(管理员)"); vo.setFailureMsg("不存在此子级部门(管理员)");
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()); 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());
@ -353,9 +576,9 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
} }
} }
} }
if (s.indexOf("14")!=-1){//3 if (s.indexOf("14") != -1) {//3
if (architectureNameTwo!=null&&architectureNameTwo!=""){ if (architectureNameTwo != null && architectureNameTwo != "") {
if (gradeNameTwo==null|gradeNameTwo==""){ if (gradeNameTwo == null | gradeNameTwo == "") {
StaffExportVo vo = new StaffExportVo(); StaffExportVo vo = new StaffExportVo();
vo.setFailureMsg("二级部门不能为空(老师)"); vo.setFailureMsg("二级部门不能为空(老师)");
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()); 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());
@ -363,9 +586,9 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
i--; i--;
failVo1.add(vo); failVo1.add(vo);
continue; continue;
}else{ } else {
Integer b = systemSetttingDao.queryDepartmentNameOrganization(architectureNameTwo, ConstantUtils.Keda_schoolId); Integer b = systemSetttingDao.queryDepartmentNameOrganization(architectureNameTwo, ConstantUtils.Keda_schoolId);
if (b==null){ if (b == null) {
StaffExportVo vo = new StaffExportVo(); StaffExportVo vo = new StaffExportVo();
vo.setFailureMsg("不存在此的一级部门(老师)"); vo.setFailureMsg("不存在此的一级部门(老师)");
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()); 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());
@ -374,8 +597,8 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
failVo1.add(vo); failVo1.add(vo);
continue; continue;
} }
List<StaffVo> a = systemSetttingDao.judgmentGrade(architectureNameTwo,ConstantUtils.Keda_schoolId); List<StaffVo> a = systemSetttingDao.judgmentGrade(architectureNameTwo, ConstantUtils.Keda_schoolId);
if (a.size()==0){ if (a.size() == 0) {
StaffExportVo vo = new StaffExportVo(); StaffExportVo vo = new StaffExportVo();
vo.setFailureMsg("不存在的子级部门(老师)"); vo.setFailureMsg("不存在的子级部门(老师)");
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()); 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());
@ -389,25 +612,29 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
} }
userInfoDao.addUserinfo(staffVo); userInfoDao.addUserinfo(staffVo);
for (String str : split){ for (String str : split) {
if (Integer.parseInt(str)==13){//2 if (Integer.parseInt(str) == 13) {//2
Integer organizationId = systemSetttingDao.queryDepartmentNameOrganization(staffVo.getStaffProfessionalArchitectureName(),ConstantUtils.Keda_schoolId); Integer organizationId = systemSetttingDao.queryDepartmentNameOrganization(staffVo.getStaffProfessionalArchitectureName(), ConstantUtils.Keda_schoolId);
Integer gradeId = systemSetttingDao.queryDepartmentNameGrade(staffVo.getStaffGradeName(),organizationId); Integer gradeId = systemSetttingDao.queryDepartmentNameGrade(staffVo.getStaffGradeName(), organizationId);
staffVo.setStaffGradeId(gradeId).setStaffProfessionalArchitectureId(organizationId); staffVo.setStaffGradeId(gradeId).setStaffProfessionalArchitectureId(organizationId).setRoleId("13");
boolean b = systemSetttingDao.addStaffManager(staffVo); boolean b = systemSetttingDao.addStaffManager(staffVo);
if(!b){throw new RuntimeException();} if (!b) {
}else if (Integer.parseInt(str)==14){//3 throw new RuntimeException();
Integer organizationId = systemSetttingDao.queryDepartmentNameOrganization(staffVo.getStaffProfessionalArchitectureNameTwo(),ConstantUtils.Keda_schoolId); }
Integer gradeId = systemSetttingDao.queryDepartmentNameGrade(staffVo.getStaffGradeNameTwo(),organizationId); } else if (Integer.parseInt(str) == 14) {//3
staffVo.setStaffGradeId(gradeId).setStaffProfessionalArchitectureId(organizationId); Integer organizationId = systemSetttingDao.queryDepartmentNameOrganization(staffVo.getStaffProfessionalArchitectureNameTwo(), ConstantUtils.Keda_schoolId);
Integer gradeId = systemSetttingDao.queryDepartmentNameGrade(staffVo.getStaffGradeNameTwo(), organizationId);
staffVo.setStaffGradeId(gradeId).setStaffProfessionalArchitectureId(organizationId).setRoleId("14");
boolean b = systemSetttingDao.addStaffTeacher(staffVo); boolean b = systemSetttingDao.addStaffTeacher(staffVo);
if(!b){throw new RuntimeException();} if (!b) {
throw new RuntimeException();
}
} }
} }
} }
} }
}catch (RuntimeException e){ } catch (RuntimeException e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(); throw new RuntimeException();
} }
@ -424,14 +651,14 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
ops.set(token, failureVOJson, 30 * 60, TimeUnit.SECONDS); ops.set(token, failureVOJson, 30 * 60, TimeUnit.SECONDS);
} }
map.put("token", token); map.put("token", token);
map.put("successNum", (size-failVo1.size())+""); map.put("successNum", (size - failVo1.size()) + "");
map.put("failureNum", failVo1.size()+""); map.put("failureNum", failVo1.size() + "");
return map; return map;
} }
@Override @Override
public void exportFailureRecord(HttpServletResponse response, String token) throws Exception{ public void exportFailureRecord(HttpServletResponse response, String token) throws Exception {
if (StringUtils.isEmpty(token)) { if (StringUtils.isEmpty(token)) {
return; return;
} }
@ -454,14 +681,11 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
new ExcelExportUtil(StaffExportVo.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). new ExcelExportUtil(StaffExportVo.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
export(response, inputStream, parse, "导入失败数据表.xlsx"); export(response, inputStream, parse, "导入失败数据表.xlsx");
if (inputStream!=null){ if (inputStream != null) {
inputStream.close(); inputStream.close();
} }
// //2.加载模板流数据 // //2.加载模板流数据
// org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/staff/测试.xlsx"); // 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"); //// org.springframework.core.io.Resource resource = new FileSystemResource("E:/JavaworkSpace2/msdw_tms/src/main/resources/excel-template/员工信息导入失败模板.xlsx");
@ -482,18 +706,19 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
} }
@Override @Override
public R queryAccount(String account,Integer schoolId) { public R queryAccount(String account, Integer schoolId) {
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
List<StaffVo> result = systemSetttingDao.queryAccount(account,schoolId); List<StaffVo> result = systemSetttingDao.queryAccount(account, schoolId);
List<StaffVo> vos = userInfoDao.queryAccount(account); List<StaffVo> vos = userInfoDao.queryAccount(account);
if (result.size()>1){return R.error("系统存在多个相同的账号:"+account); if (result.size() > 1) {
}else if (result.size()==1){ return R.error("系统存在多个相同的账号:" + account);
} else if (result.size() == 1) {
StaffVo staffVo = result.get(0); StaffVo staffVo = result.get(0);
map.put("user",staffVo); map.put("user", staffVo);
List<StaffVo> staffVos = systemSetttingDao.queryStaffInfo(staffVo.getUserId()); List<StaffVo> staffVos = systemSetttingDao.queryStaffInfo(staffVo.getUserId());
map.put("staff",staffVos); map.put("staff", staffVos);
return R.ok().put("data",map); return R.ok().put("data", map);
}else if (vos.size()>0){ } else if (vos.size() > 0) {
return R.error("账号已存在"); return R.error("账号已存在");
} }
return R.ok(); return R.ok();
@ -501,14 +726,14 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
@Override @Override
@Transactional @Transactional
public R resetPwd(Integer userId,String newPwd) { public R resetPwd(Integer userId, String newPwd) {
UserInfoEntity user = new UserInfoEntity(); UserInfoEntity user = new UserInfoEntity();
user.setPassword(newPwd); user.setPassword(newPwd);
int count = userInfoDao.update(user, new QueryWrapper<UserInfoEntity>().eq("userId", userId)); int count = userInfoDao.update(user, new QueryWrapper<UserInfoEntity>().eq("userId", userId));
if(count > 0){ if (count > 0) {
return R.ok(); return R.ok();
}else{ } else {
return R.error(20002,"重置失败"); return R.error(20002, "重置失败");
} }
} }

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

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

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

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

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

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

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