@ -60,6 +60,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
staffVo . setUniqueIdentificationAccount ( String . valueOf ( System . currentTimeMillis ( ) ) ) . setIsdel ( Constant . IsDel . NOT_DEL . getType ( ) ) . setPassword ( ConstantUtils . INITIAL_PASSWORD ) ;
String account = staffVo . getAccount ( ) ;
String phone = staffVo . getPhone ( ) ;
String email = staffVo . getEmail ( ) ;
String workNumber = staffVo . getWorkNumber ( ) ;
List < StaffEntity > staff = staffVo . getStaff ( ) ;
if ( phone ! = null & & phone ! = "" ) {
@ -68,6 +69,12 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
return R . error ( 400 , "手机号不能重复" ) ;
}
}
if ( email ! = null & & email ! = "" ) {
List < Integer > resultE = userInfoDao . queryEmail ( email ) ;
if ( resultE . size ( ) > 0 ) {
return R . error ( 400 , "手机号不能重复" ) ;
}
}
List < StaffVo > resultA = userInfoDao . queryAccount ( account ) ;
// List<Integer> resultW = systemSetttingDao.queryWorkNumber(workNumber);
if ( resultA . size ( ) > 0 ) {
@ -122,18 +129,16 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
staffVo . setPlatformId ( ConstantUtils . PLATFORMID ) ;
String account = staffVo . getAccount ( ) ;
String phone = staffVo . getPhone ( ) ;
String email = staffVo . getEmail ( ) ;
String workNumber = staffVo . getWorkNumber ( ) ;
List < StaffEntity > staff = staffVo . getStaff ( ) ; //获取员工数据
StaffVo result = userInfoDao . queryAccountUpdate ( staffVo . getUserId ( ) ) ;
// String roleIds = result.get(0).getRoleId();
// StaffVo staffVo1 = result.get(0);
String roleIds = result . getRoleId ( ) ;
String [ ] splitOld = staffVo . getRoleId ( ) . split ( "," ) ;
String [ ] splitNew = roleIds . split ( "," ) ;
if ( splitOld . length = = splitNew . length & & splitNew . length < 2 ) {
if ( splitOld . length = = splitNew . length & & splitNew . length < 3 ) {
for ( int i = 0 ; i < splitNew . length ; i + + ) {
// for (int i = 0;i<splitNew.length+1;i++){
boolean a = systemSetttingDao . updateStaff ( staff . get ( i ) ) ;
if ( ! a ) { throw new RuntimeException ( ) ; }
}
@ -161,6 +166,12 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
return R . error ( 400 , "手机号不能重复" ) ;
}
}
if ( email ! = null & & email ! = "" ) {
List < Integer > resultE = userInfoDao . queryEmail ( email ) ;
if ( resultE . size ( ) > 0 ) {
return R . error ( 400 , "手机号不能重复" ) ;
}
}
if ( resultA . size ( ) > 0 ) {
return R . error ( 400 , "账号不能重复" ) ;
} else if ( resultW . size ( ) > 0 ) {
@ -175,16 +186,16 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
// throw new RuntimeException();
// }
// }
if ( ! resultUserInfo ) {
throw new RuntimeException ( ) ;
}
if ( ! resultUserInfo ) {
throw new RuntimeException ( ) ;
}
return R . ok ( ) ;
}
@Override
public boolean deleteStaff ( Integer userId ) {
boolean result = systemSetttingDao . deleteStaff ( userId ) ;
return result ;
return result ;
}
@Override
@ -220,6 +231,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
}
@Override
@Transactional
public Map < String , String > upload ( MultipartFile file ) throws IOException {
HashMap < String , String > map = new HashMap < > ( ) ;
List < StaffVo > staffs = ExcelImportHelper . readStaff ( file ) ;
@ -233,10 +245,16 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
Long ii = 1L ;
try {
for ( int i = 0 ; i < staffs . size ( ) ; i + + ) {
+ + ii ;
StaffVo staffVo = staffs . get ( i ) ;
String phone = staffVo . getPhone ( ) ;
String email = staffVo . getEmail ( ) ;
String workNumber = staffVo . getWorkNumber ( ) ;
String account = staffVo . getAccount ( ) ;
String gradeName = staffVo . getStaffGradeName ( ) ;
String architectureName = staffVo . getStaffProfessionalArchitectureName ( ) ;
String gradeNameTwo = staffVo . getStaffGradeNameTwo ( ) ;
String architectureNameTwo = staffVo . getStaffProfessionalArchitectureNameTwo ( ) ;
StaffVo staff = new StaffVo ( ) ;
staff . setSchoolId ( ConstantUtils . Keda_schoolId ) ; //设定科大学校id
String schoolAppellationName = staffVo . getSchoolAppellationName ( ) ;
@ -246,17 +264,14 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
if ( resultU . size ( ) > 0 ) { //重复的数据
StaffExportVo vo = new StaffExportVo ( ) ;
vo . setFailureMsg ( "用户信息已存在" ) ;
+ + ii ;
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 ;
}
if ( resultW . size ( ) > 0 ) {
} else if ( resultW . size ( ) > 0 ) {
StaffExportVo vo = new StaffExportVo ( ) ;
vo . setFailureMsg ( "重复的工号" ) ;
+ + ii ;
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 - - ;
@ -265,7 +280,6 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
} else if ( resultA . size ( ) > 0 ) {
StaffExportVo vo = new StaffExportVo ( ) ;
vo . setFailureMsg ( "重复的账号" ) ;
+ + ii ;
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 - - ;
@ -276,7 +290,17 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
if ( resultP . size ( ) > 0 ) {
StaffExportVo vo = new StaffExportVo ( ) ;
vo . setFailureMsg ( "重复的手机号码" ) ;
+ + ii ;
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 ( email ! = null & & email ! = "" ) {
List < Integer > resultE = userInfoDao . queryEmail ( email ) ;
if ( resultE . size ( ) > 0 ) {
StaffExportVo vo = new StaffExportVo ( ) ;
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 ( ) ) ;
staffs . remove ( i ) ;
i - - ;
@ -284,16 +308,89 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
continue ;
}
}
+ + ii ;
if ( ! staffs . isEmpty ( ) & & staffs . size ( ) > 0 ) {
staffVo . setPassword ( ConstantUtils . INITIAL_PASSWORD ) . setUniqueIdentificationAccount ( String . valueOf ( System . currentTimeMillis ( ) ) ) ;
userInfoDao . addUserinfo ( staffVo ) ;
staff . setPlatformId ( ConstantUtils . PLATFORMID ) . setUserId ( staffVo . getUserId ( ) ) ;
staffVo . setPlatformId ( ConstantUtils . PLATFORMID ) ;
String [ ] split = staffVo . getRoleId ( ) . split ( "," ) ;
String s = "" ;
for ( String str : split ) {
s = s + str ;
}
if ( s . indexOf ( "2" ) ! = - 1 ) {
if ( architectureName ! = null & & architectureName ! = "" ) {
if ( gradeName = = null | gradeName = = "" ) {
StaffExportVo vo = new StaffExportVo ( ) ;
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 ( ) ) ;
staffs . remove ( i ) ;
i - - ;
failVo1 . add ( vo ) ;
continue ;
} else {
Integer b = systemSetttingDao . queryDepartmentNameOrganization ( architectureName , ConstantUtils . Keda_schoolId ) ;
if ( b = = null ) {
StaffExportVo vo = new StaffExportVo ( ) ;
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 ( ) ) ;
staffs . remove ( i ) ;
i - - ;
failVo1 . add ( vo ) ;
continue ;
}
boolean a = systemSetttingDao . judgmentGrade ( architectureName , ConstantUtils . Keda_schoolId ) ;
if ( ! a ) {
StaffExportVo vo = new StaffExportVo ( ) ;
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 ( ) ) ;
staffs . remove ( i ) ;
i - - ;
failVo1 . add ( vo ) ;
continue ;
}
}
}
} else if ( s . indexOf ( "3" ) ! = - 1 ) {
if ( architectureNameTwo ! = null & & architectureNameTwo ! = "" ) {
if ( gradeNameTwo = = null | gradeNameTwo = = "" ) {
StaffExportVo vo = new StaffExportVo ( ) ;
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 ( ) ) ;
staffs . remove ( i ) ;
i - - ;
failVo1 . add ( vo ) ;
continue ;
} else {
Integer b = systemSetttingDao . queryDepartmentNameOrganization ( architectureNameTwo , ConstantUtils . Keda_schoolId ) ;
if ( b = = null ) {
StaffExportVo vo = new StaffExportVo ( ) ;
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 ( ) ) ;
staffs . remove ( i ) ;
i - - ;
failVo1 . add ( vo ) ;
continue ;
}
boolean a = systemSetttingDao . judgmentGrade ( architectureNameTwo , ConstantUtils . Keda_schoolId ) ;
if ( ! a ) {
StaffExportVo vo = new StaffExportVo ( ) ;
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 ( ) ) ;
staffs . remove ( i ) ;
i - - ;
failVo1 . add ( vo ) ;
continue ;
}
}
}
}
userInfoDao . addUserinfo ( staffVo ) ;
for ( String str : split ) {
if ( Integer . parseInt ( str ) = = 2 ) {
Integer gradeId = systemSetttingDao . queryDepartmentNameGrade ( staffVo . getStaffGradeName ( ) , ConstantUtils . Keda_schoolId ) ;
Integer organizationId = systemSetttingDao . queryDepartmentNameOrganization ( staffVo . getStaffProfessionalArchitectureName ( ) , ConstantUtils . Keda_schoolId ) ;
Integer gradeId = systemSetttingDao . queryDepartmentNameGrade ( staffVo . getStaffGradeName ( ) , organizationId ) ;
staffVo . setStaffGradeId ( gradeId ) . setStaffProfessionalArchitectureId ( organizationId ) ;
boolean b = systemSetttingDao . addStaffManager ( staffVo ) ;
if ( ! b ) { throw new RuntimeException ( ) ; }