员工管理模块批量导入

hehai
shijie 4 years ago
parent 5650dea6d7
commit f6fd6233ef
  1. 8
      src/main/java/com/msdw/tms/common/utils/ExcelImportHelper.java
  2. 8
      src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java
  3. 2
      src/main/resources/mapper/tms/ExperimentalTeachingDao.xml
  4. 22
      src/test/java/com/msdw/tms/Main.java

@ -103,7 +103,7 @@ public class ExcelImportHelper {
if (hssfSheet == null) { if (hssfSheet == null) {
continue; continue;
} }
int lastRowNum = hssfSheet.getLastRowNum(); int lastRowNum = hssfSheet.getLastRowNum()+1;//最后一行行标,比行数小1
if (lastRowNum==2){ if (lastRowNum==2){
break; break;
} }
@ -190,11 +190,11 @@ public class ExcelImportHelper {
String str; String str;
// 角色id // 角色id
if (roleValue.equals("管理员")){ if (roleValue.equals("管理员")){
str = "2"; str = "13";//2
}else if (roleValue.equals("老师")){ }else if (roleValue.equals("老师")){
str = "3"; str = "14";//3
}else{ }else{
str = "2,3"; str = "13,14";
} }
staff.setRoleId(str); staff.setRoleId(str);
//角色名称 //角色名称

@ -319,7 +319,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
for (String str : split) { for (String str : split) {
s=s+str; s=s+str;
} }
if (s.indexOf("2")!=-1){ 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();
@ -353,7 +353,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
} }
} }
} }
if (s.indexOf("3")!=-1){ 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();
@ -390,13 +390,13 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
userInfoDao.addUserinfo(staffVo); userInfoDao.addUserinfo(staffVo);
for (String str : split){ for (String str : split){
if (Integer.parseInt(str)==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);
boolean b = systemSetttingDao.addStaffManager(staffVo); boolean b = systemSetttingDao.addStaffManager(staffVo);
if(!b){throw new RuntimeException();} if(!b){throw new RuntimeException();}
}else if (Integer.parseInt(str)==3){ }else if (Integer.parseInt(str)==14){//3
Integer organizationId = systemSetttingDao.queryDepartmentNameOrganization(staffVo.getStaffProfessionalArchitectureNameTwo(),ConstantUtils.Keda_schoolId); Integer organizationId = systemSetttingDao.queryDepartmentNameOrganization(staffVo.getStaffProfessionalArchitectureNameTwo(),ConstantUtils.Keda_schoolId);
Integer gradeId = systemSetttingDao.queryDepartmentNameGrade(staffVo.getStaffGradeNameTwo(),organizationId); Integer gradeId = systemSetttingDao.queryDepartmentNameGrade(staffVo.getStaffGradeNameTwo(),organizationId);
staffVo.setStaffGradeId(gradeId).setStaffProfessionalArchitectureId(organizationId); staffVo.setStaffGradeId(gradeId).setStaffProfessionalArchitectureId(organizationId);

@ -103,7 +103,7 @@
AND DATE_SUB(CURDATE(), INTERVAL #{exp.month} month ) <= date(creation_time) AND DATE_SUB(CURDATE(), INTERVAL #{exp.month} month ) <= date(creation_time)
</if> </if>
<if test='exp.schoolId!=null and exp.schoolId!=null'> <if test='exp.schoolId!=null and exp.schoolId!=null'>
AND (user_id in (select userId FROM staff WHERE schoolId = #{exp.schoolId} AND isdel = 0 AND FIND_IN_SET(roleId,'1,2,3') ) AND (user_id in (select userId FROM staff WHERE schoolId = #{exp.schoolId} AND isdel = 0 AND FIND_IN_SET(roleId,'1,13,14') )
OR user_id IN ( SELECT userId FROM hr_user_info WHERE disableAccount = 0 AND isdel = 0 AND FIND_IN_SET( roleId, '1' ) ) ) OR user_id IN ( SELECT userId FROM hr_user_info WHERE disableAccount = 0 AND isdel = 0 AND FIND_IN_SET( roleId, '1' ) ) )
</if> </if>
order by creation_time desc order by creation_time desc

@ -3,15 +3,13 @@ package com.msdw.tms;
import com.msdw.tms.entity.ProjectEntity; import com.msdw.tms.entity.ProjectEntity;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.ArrayList; import java.util.*;
import java.util.Comparator;
import java.util.List;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
List<ProjectEntity> project = new ArrayList<>(); /*List<ProjectEntity> project = new ArrayList<>();
ProjectEntity p1 = new ProjectEntity(); ProjectEntity p1 = new ProjectEntity();
p1.setProjectid(1); p1.setProjectid(1);
p1.setProjectname("1"); p1.setProjectname("1");
@ -38,7 +36,23 @@ public class Main {
for (ProjectEntity pro:project) { for (ProjectEntity pro:project) {
System.out.println(pro); System.out.println(pro);
}*/
List<String> list = new ArrayList<>();
for (int i = 0; i < 1000; i++) {
list.add(i + "");
} }
Set<String> set = new HashSet<>();
Random random = new Random();
int i;
while (true) {
i = random.nextInt(list.size());
set.add(list.get(i));
if (set.size() >= 100000) {
break;
}
}
System.out.println(111);
} }
} }

Loading…
Cancel
Save