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