From 3a97be6a6b145e109de944765d2c75525e9b3202 Mon Sep 17 00:00:00 2001 From: mzh820631607 Date: Thu, 22 Oct 2020 18:59:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 + .../com/msdw/tms/api/SystemSetttingApi.java | 48 +++ .../msdw/tms/common/utils/ConstantUtils.java | 7 + .../tms/common/utils/ExcelImportHelper.java | 94 +++++ .../controller/SystemSettingController.java | 119 ++++++- .../com/msdw/tms/dao/SystemSetttingDao.java | 33 +- .../java/com/msdw/tms/dao/UserInfoDao.java | 15 +- .../com/msdw/tms/entity/vo/StaffExportVo.java | 64 ++++ .../java/com/msdw/tms/entity/vo/StaffVo.java | 22 ++ .../tms/service/SystemSetttingService.java | 26 +- .../tms/service/impl/StudentServiceImpl.java | 2 - .../impl/SystemSettingServiceImpl.java | 326 ++++++++++++++++-- .../员工信息导入失败模板.xlsx | Bin 0 -> 9335 bytes .../员工信息导入模板.xlsx | Bin 0 -> 9308 bytes src/main/resources/mapper/tms/StudentDao.xml | 8 +- .../resources/mapper/tms/SystemSetting.xml | 125 ++++++- src/main/resources/mapper/tms/UserInfoDao.xml | 94 ++++- 17 files changed, 936 insertions(+), 52 deletions(-) create mode 100644 src/main/java/com/msdw/tms/api/SystemSetttingApi.java create mode 100644 src/main/java/com/msdw/tms/entity/vo/StaffExportVo.java create mode 100644 src/main/resources/excel-template/员工信息导入失败模板.xlsx create mode 100644 src/main/resources/excel-template/员工信息导入模板.xlsx diff --git a/pom.xml b/pom.xml index cfc7e35..e3e712f 100644 --- a/pom.xml +++ b/pom.xml @@ -170,6 +170,11 @@ commons-lang 2.6 + + cn.hutool + hutool-all + 5.3.8 + commons-logging commons-logging diff --git a/src/main/java/com/msdw/tms/api/SystemSetttingApi.java b/src/main/java/com/msdw/tms/api/SystemSetttingApi.java new file mode 100644 index 0000000..c4300d4 --- /dev/null +++ b/src/main/java/com/msdw/tms/api/SystemSetttingApi.java @@ -0,0 +1,48 @@ +package com.msdw.tms.api; + +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.vo.StaffVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +@Api(value = "系统设置",tags = "系统设置") +public interface SystemSetttingApi { + + @ApiOperation(value = "新增员工",notes = "新增员工") + public R addStaff(StaffVo staffVo); + + @ApiOperation(value = "员工列表",notes = "员工列表信息") + public R queryStaff(StaffVo staffVo); + + @ApiOperation(value = "查看员工详情",notes = "查看员工详情") + public R querystaffDetail( Integer userId); + + @ApiOperation(value = "编辑员工信息",notes = "编辑员工信息") + public R updateStaff( StaffVo staffVo); + + @ApiOperation(value = "删除员工信息",notes = "删除员工信息") + public R deleteStaff(StaffVo staffVo); + + @ApiOperation(value = "批量删除员工信息",notes = "批量删除员工信息") + public R daleteBatchStaff( List userIds); + + @ApiOperation(value = "新增部门",notes = "新增部门") + public R addDepartment( StaffVo staffVo); + + @ApiOperation(value = "员工信息导入模板下载",notes = "员工信息导入模板下载") + public R downloadFiles(HttpServletResponse response) throws IOException; + + @ApiOperation(value = "导入员工信息",notes = "导入员工信息") + public R importStaff(MultipartFile file) throws IOException; + + @ApiOperation(value = "导入员工失败原因导出",notes = "导入员工失败原因导出") + public void exportFailureRecord(HttpServletResponse response, String token) throws Exception; +} diff --git a/src/main/java/com/msdw/tms/common/utils/ConstantUtils.java b/src/main/java/com/msdw/tms/common/utils/ConstantUtils.java index 5fd6312..f7f9adc 100644 --- a/src/main/java/com/msdw/tms/common/utils/ConstantUtils.java +++ b/src/main/java/com/msdw/tms/common/utils/ConstantUtils.java @@ -9,6 +9,8 @@ public class ConstantUtils { //绑定角色ID public static final Integer STUDENT_ROLE = 4; + + public static final String STR_STUDENT_ROLE = "4"; //平台id @@ -17,6 +19,11 @@ public class ConstantUtils { //excel模板信息表id public static final int XLSX_TEMPLATE_ID = 2; + + public static final int XLSX_TEMPLATE_ID3 = 3; + + + //用户初始密码 public static final String INITIAL_PASSWORD = "huoran123"; } diff --git a/src/main/java/com/msdw/tms/common/utils/ExcelImportHelper.java b/src/main/java/com/msdw/tms/common/utils/ExcelImportHelper.java index e17d364..2897b6e 100644 --- a/src/main/java/com/msdw/tms/common/utils/ExcelImportHelper.java +++ b/src/main/java/com/msdw/tms/common/utils/ExcelImportHelper.java @@ -1,5 +1,6 @@ package com.msdw.tms.common.utils; +import com.msdw.tms.entity.vo.StaffVo; import com.msdw.tms.entity.vo.StudentVo; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.*; @@ -86,6 +87,99 @@ public class ExcelImportHelper { return list; } + /** + * 读取学生管理 + * @param file + * @return + */ + public static List readStaff(MultipartFile file) { + List list = new ArrayList(); + + Workbook workbook=getWorkbook(file); + StaffVo staff = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + + Cell phone; + Cell email; + if (row != null) { + staff = new StaffVo(); + row.getCell(0).setCellType(CellType.STRING); + Cell userName = row.getCell(0); + row.getCell(1).setCellType(CellType.STRING); + Cell account = row.getCell(1); + row.getCell(2).setCellType(CellType.STRING); + Cell role = row.getCell(2); + row.getCell(3).setCellType(CellType.STRING); + Cell workNumber = row.getCell(3); + row.getCell(4).setCellType(CellType.STRING); + Cell staffGradeName = row.getCell(4); + row.getCell(5).setCellType(CellType.STRING); + Cell staffProfessionalArchitectureName = row.getCell(5); + if (row.getCell(6)!=null){ + row.getCell(6).setCellType(CellType.STRING); + phone = row.getCell(6); + }else { + phone = row.createCell(6); + } + if (row.getCell(7)!=null){ + row.getCell(7).setCellType(CellType.STRING); + email = row.getCell(7); + }else { + email = row.createCell(7); + } + + row.getCell(8).setCellType(CellType.STRING); + Cell schoolAppellationName = row.getCell(8); + row.getCell(9).setCellType(CellType.STRING); + Cell failureMsg = row.getCell(9); + + + String roleValue = role.getStringCellValue(); + String str; + // 角色id + if (roleValue.equals("管理员")){ + str = "2"; + }else if (roleValue.equals("老师")){ + str = "3"; + }else{ + str = "2,3"; + } + staff.setRoleId(str); + //角色名称 + staff.setRole(role.getStringCellValue()); + // 学生姓名 + staff.setUserName(userName.getStringCellValue()); + //用户账号 + staff.setAccount(account.getStringCellValue()); + // 学生学号 + staff.setWorkNumber(workNumber.getStringCellValue()); + //专业名称 + staff.setStaffGradeName(staffGradeName.getStringCellValue()); + //组织架构名称 + staff.setStaffProfessionalArchitectureName(staffProfessionalArchitectureName.getStringCellValue()); + //电话 + staff.setPhone(phone.getStringCellValue()); + //邮箱 + staff.setEmail(email.getStringCellValue()); + //所属院校 + staff.setSchoolAppellationName(schoolAppellationName.getStringCellValue()); + //学校id + staff.setSchoolId(ConstantUtils.Keda_schoolId); + list.add(staff); + } + } + + } + return list; + } private static Workbook getWorkbook(MultipartFile file) { String fileName = file.getOriginalFilename(); diff --git a/src/main/java/com/msdw/tms/controller/SystemSettingController.java b/src/main/java/com/msdw/tms/controller/SystemSettingController.java index 99aadbd..b574989 100644 --- a/src/main/java/com/msdw/tms/controller/SystemSettingController.java +++ b/src/main/java/com/msdw/tms/controller/SystemSettingController.java @@ -1,30 +1,143 @@ package com.msdw.tms.controller; +import com.msdw.tms.api.SystemSetttingApi; +import com.msdw.tms.common.utils.ConstantUtils; import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.vo.StaffVo; import com.msdw.tms.service.SystemSetttingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 系统设置 */ @RestController @RequestMapping("/tms/system") -public class SystemSettingController { +public class SystemSettingController implements SystemSetttingApi { @Autowired private SystemSetttingService systemSetttingService; + /** + * 新增员工 + * @param staffVo + * @return + */ + @Override @PostMapping("/addStaff") public R addStaff(@RequestBody StaffVo staffVo){ - systemSetttingService.addStaff(staffVo); - return R.ok(); + R r = systemSetttingService.addStaff(staffVo); + return r; } + /** + * 员工列表 + * @param staffVo + * @return + */ + @Override @PostMapping("/queryStaff") public R queryStaff(@RequestBody StaffVo staffVo){ PageUtils query = systemSetttingService.queryStaff(staffVo); return R.ok().put("data",query); } + + /** + * 查看用户详情 + * @param userId + * @return + */ + @Override + @GetMapping("/querystaffDetail") + public R querystaffDetail(@RequestParam Integer userId){ + HashMap map = systemSetttingService.querystaffDetail(userId); + return R.ok().put("data",map); + } + + /** + * 编辑员工信息 + * @param staffVo + * @return + */ + @Override + @PutMapping("/updateStaff") + public R updateStaff(@RequestBody StaffVo staffVo){ + R r = systemSetttingService.updateStaff(staffVo); + return r; + } + + /** + * 删除员工信息 + * @param staffVo + * @return + */ + @Override + @PostMapping("/deleteStaff") + public R deleteStaff(@RequestBody StaffVo staffVo){ + + systemSetttingService.deleteStaff(staffVo.getUserId()); + return R.ok(); + } + + /** + * 批量删除员工信息 + * @return + */ + @Override + @PostMapping("/daleteBatchStaff") + public R daleteBatchStaff(@RequestBody List userIds){ + systemSetttingService.daleteBatchStaff(userIds); + return R.ok(); + } + + /** + * 新增部门 + */ + @Override + @PostMapping("/addDepartment") + public R addDepartment(@RequestBody StaffVo staffVo){ + HashMap map = systemSetttingService.addDepartment(staffVo); + return R.ok().put("data",map); + } + + /** + * excel模板文件下载 + */ + @Override + @GetMapping("/download") + public R downloadFiles(HttpServletResponse response) throws IOException { + systemSetttingService.downloadFiles(response); + return R.ok(); + } + + /** + * 批量导入员工信息 + * @param file + * @return + */ + @Override + @PostMapping("/uploadFile") + public R importStaff(MultipartFile file) throws IOException{ + Map upload = systemSetttingService.upload(file); + return R.ok().put("data",upload); + } + + /** + * 导入员工信息失败数据导出 + * @param response + * @param token + * @throws Exception + */ + @Override + @GetMapping("/export_failure") + public void exportFailureRecord(HttpServletResponse response, @RequestParam String token) throws Exception{ + systemSetttingService.exportFailureRecord(response,token); + } } diff --git a/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java b/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java index c057a88..084daba 100644 --- a/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java +++ b/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java @@ -2,6 +2,7 @@ package com.msdw.tms.dao; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.msdw.tms.entity.StaffEntity; import com.msdw.tms.entity.vo.StaffVo; import org.apache.ibatis.annotations.Mapper; import org.apache.poi.ss.formula.functions.T; @@ -13,5 +14,35 @@ public interface SystemSetttingDao { boolean addStaff(StaffVo staffVo); - IPage queryStaff(Page tPage, String searchContent, StaffVo staffVo); + boolean addStaffN(StaffEntity staffEntity); + + IPage queryStaff(Page tPage, String searchContent, Integer schoolId,String staffGradeIds,String staffProfessionalArchitectureIds); + + StaffVo querystaffDetail(Integer userId,Integer schoolId); + + boolean updateStaff(StaffEntity staffEntity); + + boolean deleteStaffInfo(Integer userId); + + boolean deleteStaff(Integer userId); + + Integer queryGrade(StaffVo staffVo); + + Integer queryDepartment(StaffVo staffVo); + + boolean addDepartment(StaffVo staffVo); + + boolean addStaffGrade(StaffVo staffVo); + + boolean daleteBatchStaff(List userId); + + List queryWorkNumber(String workNumber); + + List queryStaffInfo(Integer userId); + + boolean addStaff(StaffEntity staffEntity,Integer userId); + + boolean deleteStaffOnly(Integer userId); + + boolean updateStaffOnly(StaffVo staffVo); } diff --git a/src/main/java/com/msdw/tms/dao/UserInfoDao.java b/src/main/java/com/msdw/tms/dao/UserInfoDao.java index 8fece8a..3de1095 100644 --- a/src/main/java/com/msdw/tms/dao/UserInfoDao.java +++ b/src/main/java/com/msdw/tms/dao/UserInfoDao.java @@ -3,6 +3,7 @@ package com.msdw.tms.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.msdw.tms.entity.StudentEntity; import com.msdw.tms.entity.UserInfoEntity; +import com.msdw.tms.entity.vo.StaffVo; import com.msdw.tms.entity.vo.StudentVo; import org.apache.ibatis.annotations.Mapper; @@ -27,9 +28,19 @@ public interface UserInfoDao extends BaseMapper { List queryStudentPhone(String phone, Integer schoolId); - int bacthAddStudents(List students); +// int bacthAddStudents(List students); int batchSaveUserInfo(StudentVo studentVo); - Integer addUserinfo(UserInfoEntity userInfo); + Integer addUserinfo(StaffVo staffVo); + + boolean updateUserInfo(StaffVo staffVo); + + List queryPhone(String phone); + + List queryAccount(String account); + + boolean setNUM(Integer userId); + + List queryUserInfo(StaffVo staffVo); } diff --git a/src/main/java/com/msdw/tms/entity/vo/StaffExportVo.java b/src/main/java/com/msdw/tms/entity/vo/StaffExportVo.java new file mode 100644 index 0000000..4f364e4 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/StaffExportVo.java @@ -0,0 +1,64 @@ +package com.msdw.tms.entity.vo; + +import com.msdw.tms.common.utils.poi.ExcelAttribute; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class StaffExportVo { + + //序列号 + private Long index; + + //姓名 + @ExcelAttribute(sort = 0) + private String userName; + + //账号 + @ExcelAttribute(sort = 1) + private String account; + + //角色 + @ExcelAttribute(sort = 2) + private String role; + + //工号 + @ExcelAttribute(sort = 3) + private String workNumber; + + //管理员专业名称 + @ExcelAttribute(sort = 4) + private String staffGradeName; + + //管理员组织架构名称 + @ExcelAttribute(sort = 5) + private String staffProfessionalArchitectureName; + + //老师专业组织名称 + @ExcelAttribute(sort = 6) + private String staffGradeNameTwo; + + //老师组织架构名称 + @ExcelAttribute(sort = 7) + private String staffProfessionalArchitectureNameTwo; + + //手机号码 + @ExcelAttribute(sort = 8) + private String phone; + + //邮箱 + @ExcelAttribute(sort = 9) + private String email; + + //所属院校 + @ExcelAttribute(sort = 10) + private String schoolAppellationName; + + //失败原因 + @ExcelAttribute(sort = 11) + private String failureMsg; + + + +} diff --git a/src/main/java/com/msdw/tms/entity/vo/StaffVo.java b/src/main/java/com/msdw/tms/entity/vo/StaffVo.java index 3ab5a0b..e9f58e5 100644 --- a/src/main/java/com/msdw/tms/entity/vo/StaffVo.java +++ b/src/main/java/com/msdw/tms/entity/vo/StaffVo.java @@ -1,9 +1,12 @@ package com.msdw.tms.entity.vo; +import com.msdw.tms.entity.StaffEntity; import com.msdw.tms.entity.UserInfoEntity; import lombok.Data; import lombok.experimental.Accessors; +import java.util.List; + /** * 员工管理 */ @@ -26,6 +29,8 @@ public class StaffVo extends UserInfoEntity { private String staffProfessionalArchitectureName; //绑定平台 private Integer platformId; + //绑定员工角色id + private Integer staffRoleId; //----------------------------------分页 //第几页 @@ -35,6 +40,23 @@ public class StaffVo extends UserInfoEntity { //搜索内容 private String searchContent; +//---------------------------------- + //所属院校 + private String schoolAppellationName; + + //角色 + private String role; + + //多个组织架构id + private String staffProfessionalArchitectureIds; + //多个年纪id + private String staffGradeIds; + + private List staff; + + +//----------------------------------部门 + //----------------------------------员工年级staff_grade //员工年级表主键id // private Integer staffGradeId; diff --git a/src/main/java/com/msdw/tms/service/SystemSetttingService.java b/src/main/java/com/msdw/tms/service/SystemSetttingService.java index 3199b68..67d3f2d 100644 --- a/src/main/java/com/msdw/tms/service/SystemSetttingService.java +++ b/src/main/java/com/msdw/tms/service/SystemSetttingService.java @@ -1,11 +1,35 @@ package com.msdw.tms.service; import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.vo.StaffVo; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public interface SystemSetttingService { - boolean addStaff(StaffVo staffVo); + R addStaff(StaffVo staffVo); PageUtils queryStaff(StaffVo staffVo); + + HashMap querystaffDetail(Integer userId); + + R updateStaff(StaffVo staffVo); + + boolean deleteStaff(Integer userId); + + HashMap addDepartment(StaffVo staffVo); + + boolean daleteBatchStaff(List userIds); + + Map upload(MultipartFile file) throws IOException; + + void exportFailureRecord(HttpServletResponse response, String token) throws Exception; + + void downloadFiles(HttpServletResponse response) throws IOException; } diff --git a/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java index 930378f..9526a47 100644 --- a/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java @@ -165,9 +165,7 @@ public class StudentServiceImpl extends ServiceImpl im vo.setIndex(ii).setUserName(student.getUserName()).setSchoolAppellationName(student.getSchoolAppellationName()) .setAccount(student.getAccount()).setWorkNumber(student.getWorkNumber()).setPhone(student.getPhone()+" (重复的号码)").setEmail(student.getEmail()) ; -// .setFailureMsg("重复的号码"); failVo1.add(vo); -// map.put("被占用电话号码序列:"+System.currentTimeMillis(),"电话号码:"+phone); students.remove(i); i--; continue; diff --git a/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java index f3a2556..14fef27 100644 --- a/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java @@ -1,23 +1,39 @@ package com.msdw.tms.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.msdw.tms.common.utils.Constant; -import com.msdw.tms.common.utils.ConstantUtils; -import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.common.exception.ExceptionCast; +import com.msdw.tms.common.utils.*; +import com.msdw.tms.common.utils.poi.ExcelExportUtil; import com.msdw.tms.dao.SystemSetttingDao; import com.msdw.tms.dao.UserInfoDao; -import com.msdw.tms.entity.UserInfoEntity; +import com.msdw.tms.entity.StaffEntity; +import com.msdw.tms.entity.XlsxTemplateEntity; +import com.msdw.tms.entity.response.CommonCode; +import com.msdw.tms.entity.vo.StaffExportVo; import com.msdw.tms.entity.vo.StaffVo; -import com.msdw.tms.entity.vo.StudentVo; +import com.msdw.tms.entity.vo.StudentImportFailureVo; +import com.msdw.tms.service.AliyunOssService; import com.msdw.tms.service.SystemSetttingService; +import com.msdw.tms.service.XlsxTemplateService; +import org.apache.commons.lang.StringUtils; import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; -import java.util.HashMap; -import java.util.List; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.util.*; +import java.util.concurrent.TimeUnit; @Service("systemSetttingService") public class SystemSettingServiceImpl implements SystemSetttingService { @@ -28,28 +44,298 @@ public class SystemSettingServiceImpl implements SystemSetttingService { @Autowired private UserInfoDao userInfoDao; + @Resource + XlsxTemplateService xlsxTemplateService; + + @Resource + AliyunOssService ossService; + + @Resource + StringRedisTemplate stringRedisTemplate; + @Override @Transactional - public boolean addStaff(StaffVo staffVo) { -// UserInfoEntity userInfo = new UserInfoEntity(); - staffVo.setPlatformId(ConstantUtils.PLATFORMID).setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())).setIsdel(Constant.IsDel.NOT_DEL.getType()) - .setSchoolId(ConstantUtils.Keda_schoolId); - Integer userId = userInfoDao.addUserinfo(staffVo); - boolean result = systemSetttingDao.addStaff(staffVo); - if (!result){ - throw new RuntimeException(); + public R addStaff(StaffVo staffVo) { + 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 workNumber = staffVo.getWorkNumber(); + List staff = staffVo.getStaff(); + if (phone!=null&&phone!=""){ + List resultP = userInfoDao.queryPhone(phone); + if (resultP.size()>0){ + return R.error(400,"手机号不能重复"); + } } - return result; + List resultA = userInfoDao.queryAccount(account); +// List resultW = systemSetttingDao.queryWorkNumber(workNumber); + if(resultA.size()>0){ + return R.error(400,"账号不能重复"); + } + Integer userId = userInfoDao.addUserinfo(staffVo); + for (int i=0;i resultW = systemSetttingDao.queryWorkNumber(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();} + } +// String[] split = staffVo.getRoleId().split(","); +// for (String s : split){ +// staffVo.setStaffRoleId(Integer.parseInt(s)); +// boolean result = systemSetttingDao.addStaff(staffVo); +// if (!result) { +// throw new RuntimeException(); +// } +// } + return R.ok(); } @Override public PageUtils queryStaff(StaffVo staffVo) { - Page tPage = new Page<>(staffVo.getPage(),staffVo.getSize()); -// IPage saveStudent = studentDao.queryStudent(tPage,searchContent,schoolId); - IPage staff = systemSetttingDao.queryStaff(tPage,staffVo.getSearchContent(),staffVo); + Page tPage = new Page<>(staffVo.getPage(), staffVo.getSize()); + IPage staff = systemSetttingDao.queryStaff(tPage, staffVo.getSearchContent(),ConstantUtils.Keda_schoolId,staffVo.getStaffGradeIds(),staffVo.getStaffProfessionalArchitectureIds()); PageUtils pageUtils = new PageUtils(staff); return pageUtils; } + @Override + public HashMap querystaffDetail(Integer userId) { + HashMap map = new HashMap<>(); + StaffVo result = systemSetttingDao.querystaffDetail(userId, ConstantUtils.Keda_schoolId); + + List 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); + return map; + } + + @Override + @Transactional + public R updateStaff(StaffVo staffVo) { + staffVo.setPlatformId(ConstantUtils.PLATFORMID); + String account = staffVo.getAccount(); + String phone = staffVo.getPhone(); + String workNumber = staffVo.getWorkNumber(); + List staff = staffVo.getStaff();//获取员工数据 + + List result = userInfoDao.queryAccount(account); + String roleIds = result.get(0); + String[] splitOld = staffVo.getRoleId().split(","); + String[] splitNew = roleIds.split(","); + if (splitOld.length==splitNew.length){ + for (int i = 0;i<=splitNew.length;i++){ + boolean a = systemSetttingDao.updateStaff(staff.get(i)); + if (!a){throw new RuntimeException();} + } + }else if (splitNew.length>splitOld.length){ + boolean a = systemSetttingDao.updateStaff(staff.get(0)); + boolean b = systemSetttingDao.addStaff(staff.get(1),staffVo.getUserId()); + if (!a|!b){throw new RuntimeException();} + }else{ + boolean a = systemSetttingDao.deleteStaffOnly(staffVo.getUserId());//删除roleId最大的数据 + staffVo.setStaffRoleId(Integer.parseInt(staffVo.getRoleId())); + boolean b = systemSetttingDao.updateStaffOnly(staffVo);//修改仅剩的数据 + + } + + userInfoDao.setNUM(staffVo.getUserId());//重置账号、手机号码为00 +// systemSetttingDao.deleteStaffInfo(staffVo.getUserId());// + List resultA = userInfoDao.queryAccount(account); + List resultW = systemSetttingDao.queryWorkNumber(workNumber); + if (phone!=null&&phone!=""){ + List resultP = userInfoDao.queryPhone(phone); + if (resultP.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(","); +// for (String s : split){ +// staffVo.setStaffRoleId(Integer.parseInt(s)); +// boolean resultStaff = systemSetttingDao.addStaff(staffVo); +// if (!resultStaff){ +// throw new RuntimeException(); +// } +// } + if (!resultUserInfo) { + throw new RuntimeException(); + } + return R.ok(); + } + + @Override + public boolean deleteStaff(Integer userId) { + boolean result = systemSetttingDao.deleteStaff(userId); + return result; + } + + @Override + @Transactional + public HashMap addDepartment(StaffVo staffVo) { + HashMap map = new HashMap<>(); + //查询是否存在相同的部门 + String departmentName = staffVo.getStaffProfessionalArchitectureName(); + String gradeName = staffVo.getStaffGradeName(); + if (gradeName!=null|gradeName!=""){ + Integer department = systemSetttingDao.queryGrade(staffVo); + if (department==0){ + systemSetttingDao.addDepartment(staffVo); + } + map.put("已存在的部门",departmentName); + }else{ + Integer department = systemSetttingDao.queryDepartment(staffVo); + if (department==0){ + boolean result = systemSetttingDao.addStaffGrade(staffVo); + if (!result){ + throw new RuntimeException(); + } + } + map.put("已存在的部门",gradeName); + } + return map; + } -} + @Override + public boolean daleteBatchStaff(List userIds) { + boolean result = systemSetttingDao.daleteBatchStaff(userIds); + return result; + } + + @Override + public Map upload(MultipartFile file) throws IOException { + HashMap map = new HashMap<>(); + List staffs = ExcelImportHelper.readStaff(file); + List failVo1 = new ArrayList<>(); + // 参数合法性校验,只能上传.xlsx后缀的文件 + if (StringUtils.isBlank(file.getOriginalFilename()) + || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(Constant.EXCEL_SUFFIX)) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID); + } + int size = staffs.size(); + Long ii = 1L; + try { + for (int i = 0;i resultW = systemSetttingDao.queryWorkNumber(workNumber); + List resultA = userInfoDao.queryAccount(account); + List resultU = userInfoDao.queryUserInfo(staffVo); + if (resultU.size()>0){//重复的数据 + StaffExportVo vo = new StaffExportVo(); + vo.setFailureMsg("用户信息已存在"); + ++ii; + vo.setIndex(ii).setUserName(staff.getUserName()).setAccount(staff.getAccount()).setRole(staff.getRole()).setWorkNumber(staff.getWorkNumber()).setStaffGradeName(staff.getStaffGradeName()).setStaffProfessionalArchitectureName(staff.getStaffProfessionalArchitectureName()).setPhone(staff.getPhone()).setEmail(staff.getEmail()).setSchoolAppellationName(staff.getSchoolAppellationName()); + staffs.remove(i); + i--; + } + if (resultW.size()>0){ + StaffExportVo vo = new StaffExportVo(); + vo.setFailureMsg("重复的工号"); + ++ii; + vo.setIndex(ii).setUserName(staff.getUserName()).setAccount(staff.getAccount()).setRole(staff.getRole()).setWorkNumber(staff.getWorkNumber()).setStaffGradeName(staff.getStaffGradeName()).setStaffProfessionalArchitectureName(staff.getStaffProfessionalArchitectureName()).setPhone(staff.getPhone()).setEmail(staff.getEmail()).setSchoolAppellationName(staff.getSchoolAppellationName()); + staffs.remove(i); + i--; + continue; + }else if (resultA.size()>0){ + StaffExportVo vo = new StaffExportVo(); + vo.setFailureMsg("重复的账号"); + ++ii; + vo.setIndex(ii).setUserName(staff.getUserName()).setAccount(staff.getAccount()).setRole(staff.getRole()).setWorkNumber(staff.getWorkNumber()).setStaffGradeName(staff.getStaffGradeName()).setStaffProfessionalArchitectureName(staff.getStaffProfessionalArchitectureName()).setPhone(staff.getPhone()).setEmail(staff.getEmail()).setSchoolAppellationName(staff.getSchoolAppellationName()); + staffs.remove(i); + i--; + continue; + }else if (phone!=null&&phone!=""){ + List resultP = userInfoDao.queryPhone(phone); + if (resultP.size()>0){ + StaffExportVo vo = new StaffExportVo(); + vo.setFailureMsg("重复的手机号码"); + ++ii; + vo.setIndex(ii).setUserName(staff.getUserName()).setAccount(staff.getAccount()).setRole(staff.getRole()).setWorkNumber(staff.getWorkNumber()).setStaffGradeName(staff.getStaffGradeName()).setStaffProfessionalArchitectureName(staff.getStaffProfessionalArchitectureName()).setPhone(staff.getPhone()).setEmail(staff.getEmail()).setSchoolAppellationName(staff.getSchoolAppellationName()); + staffs.remove(i); + i--; + continue; + } + } + ++ii; + if (!staffs.isEmpty()&&staffs.size()>0){ + staffVo.setPassword(ConstantUtils.INITIAL_PASSWORD); + userInfoDao.addUserinfo(staffVo); + staff.setPlatformId(ConstantUtils.PLATFORMID).setUserId(staffVo.getUserId()); + boolean b = systemSetttingDao.addStaff(staff); + if(!b){ + throw new RuntimeException(); + } + + } + + } + }catch (RuntimeException e){ + e.printStackTrace(); + throw new RuntimeException(); + } + String token = ""; + + // 有导入失败的数据,才会存入redis + if (failVo1.size() > 0) { + //生成token + token = "FAILURE_IMPORT" + UUID.randomUUID().toString().replace("-", ""); + + ValueOperations ops = stringRedisTemplate.opsForValue(); + String failureVOJson = JSON.toJSONString(failVo1); + + ops.set(token, failureVOJson, 30 * 60, TimeUnit.SECONDS); + } + map.put("token", token); + map.put("successNum", (size-failVo1.size())+""); + map.put("failureNum", failVo1.size()+""); + + return map; + } + + @Override + public void exportFailureRecord(HttpServletResponse response, String token) throws Exception{ + if (StringUtils.isEmpty(token)) { + return; + } + ValueOperations ops = stringRedisTemplate.opsForValue(); + //获取数据 + String record = ops.get(token); + if (StringUtils.isEmpty(record)) { + return; + } + List parse = JSON.parseObject(record, new TypeReference>() { + }); + + parse.sort(Comparator.comparing(StaffExportVo::getIndex)); + + //2.加载模板流数据 + org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/员工信息导入失败模板.xlsx"); + InputStream inputStream = resource.getInputStream(); + + //3、通过工具类下载文件 + new ExcelExportUtil(StaffExportVo.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). + export(response, inputStream, parse, "员工信息导入失败数据表.xlsx"); + } + + @Override + public void downloadFiles(HttpServletResponse response) throws IOException { + XlsxTemplateEntity xlsxTemplate = xlsxTemplateService.getById(ConstantUtils.XLSX_TEMPLATE_ID3); + ossService.downloadFiles(response, xlsxTemplate.getFileName()); + } +} \ No newline at end of file diff --git a/src/main/resources/excel-template/员工信息导入失败模板.xlsx b/src/main/resources/excel-template/员工信息导入失败模板.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..04bf779b78430a2319e026eaa1cfb9b48057e832 GIT binary patch literal 9335 zcmaJ{1yo$ivK`#rNpN>}mk`|DJp>!v2@U}UCj@tQ65QS0U4lc;>!O4^#hQNfmE55#{VrJjJ7iY8*s5* z7Cm-%{2K$K6UjA$GgKnK=|@#~e_Mj1pDK6oe=<(5;#o;e7rCRifazFN+S_V8J#{RN$Q zi8LK|)j>X3fOWE22qGtJexSovE5d8b)SBzH$;skKCSArlMsS2TpLNULb-U%&(_(LZ z+1TIw9`td8PY7aRMNjf5V4Y!9ThT%Q?i;7RVBVHC^d7$BqI5-G$NX~7_hAz1byls-c@`FEp5=ym4x;&-~MNk;hq6oT6Y#5(1;!#M!? zX=1J4Kh^JRaNXY6oHVgsHj zxndLJE}5)ecEsFC*VwU5W%G9=p)R*y^N-Z|E;{;_9gk1aJ*8OIN+@r@cdc?{#M%7O z$2huj{n)kj!a{tjEGc@)=sbB;_T|!;Sem#UUUJkBCG)-eHog zbhnAL9{=z$OM_BgEhHd}3+uj2*G!saTiFqv75l|IN=b$)k|Tx#X{F-af3v zPuQQF+Y^O2GOfMY0~?-nHgqLGG;Iodf=d7p)CX`Zbn;f6}_UHq?k|r!FH_Kx$9xwm^?tjVt zP+@smfEqOc;1V zOWF=k*fX6FLp;xx0&YH6Jd;mgh@TywMMl`!;hoWF+P}h0oFy#?JR-C$x8rsG8ZhpXfUJF5NIU3 ziO>PCy6E;%w$im%3lhETFFViQMw#S8r?%vzCyUIwPCUe|#a%SDv}GCFItfB~bqiBiQB5Ni-)CothQR0Foal6fh}sMVrm|DbQGuEl@NCu zmknOS+uZEds?Nn%}>Rqx=vfJKM!Rm(Wu~Ii+tx`;WDaXZkI?M$AI&DYKy`BxB3{E^n5?e*_toj zdQH?Y?Khwu+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@|9@E#`VmwE2Q%wGEBv0^F3k^*|E)cGG{WC9j8Bqfv18KR%&5I5 z{wJtAt#YndXbVnEq@U$Xy?qm9AI2#$VzrK1TSS!TryF6Sl5TcV*1Sxco~;n;v*brM z`#UT73j_OIT9r<{+%#AGB}-doAly~$Iw6}5&W&#a19tf17a7T8^t_bESwr|};$Bbe zt11d-@Nv8-;1Mz*3*cfw) zZK=kjIa^0#fdag8=G#y&UqD0ij5#<94xPA4hm@9?Ga$Xt4N6oATi(`fv!_q$)0HO* zqsSb&5uTdb?d*t|(5W7hDc6JSE;V_^&< zqmxpX(VwN2>GWO~F(a_;glcGMrQu{6h0@Z5S<#e-8j zv4Z>L^&RsQFUqb*lF#V*I(fWfJ$S=)5POml3lbxziO+}aX=1EpcyVxBuI;z~sACtN zX*<4pbabT0TJ{s8ry~ZmbuzPcGEjB5Gjr5?a`>|NA$f2X%-}1^)~;L~HWfP~kdfhr zSrPdsi0QBG>=y~?{-$z+FpAcksYcn!h+4x0x!c^f9~+yTUb80xJ@l`{$i>qK^PxF z22FLmwp93?A2|snl2H1CsSMGE!!=`0?Kk63;Bj^D*--Ekw02~#2korIAurQO(B% zpEo0(gn!zj`ls4|?n(R!(Vxu!FYTbmE&aFAzwQD2ss1OM{Y(AyF=YHw|C`(XUz2{~ zcYn60NfSZ-hwXiu?!Pa|?V?Z4vMpZ)xqF8=Dr_mNTl zx8(899{wzK{^|kxk-vWG;qSud{{rjxxlcVZ+K;M#(QLo(kUxpGUlzapQ|%Y+_UDlQ zOlN*|F!OjSJlg#yZ2xP}PXztX_O!ynKUerSy8ic(|4GHb_b>;KaIMc*sRK>cu5 Qw8y(FFpqND#7}zv2RDWWtN;K2 literal 0 HcmV?d00001 diff --git a/src/main/resources/excel-template/员工信息导入模板.xlsx b/src/main/resources/excel-template/员工信息导入模板.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..6acd2c62482b51eccee84907f68121b2fddace53 GIT binary patch literal 9308 zcmaia1yo$ivi9IkaF^ij7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M4jIbr@AEhJz97Id5lVv^Nz2w9Rjx62G{hKFONyUadseR!?mUQAR_C%mIxaT zTO*<@ckPKIk(aPSP*Jm5<-%<9W;^?8Ce;j(~`Q zbD{4hu-OTqxdDCD-+i5bdHTJ)y^`*{4{`td(k7GWtXI+Y!g*6nbu(kbY3r#m_Z_UF zECeLh&#n8{$$&pS19lDo0`MIColo+we)`qHzmtehA?H_nI%M#S=yw46r_nz{(38$D zqa1(f{9H2s&Dax5@~b@=duo3>{P0hEe;$8$68>e6=I?6%dl=$Ri2kJae`~)3PwBsm z{)g=UQ~giY`nUQ%IAr`*|BJ)^Zx8*%{Y1q7YEK>(_~qe$ o(DMHr`Jcr6lkP9CS^gj0-!#3VEX>cviVi-o0tc28dj6#MKSk2iv;Y7A literal 0 HcmV?d00001 diff --git a/src/main/resources/mapper/tms/StudentDao.xml b/src/main/resources/mapper/tms/StudentDao.xml index 5b67ea0..48d33a5 100644 --- a/src/main/resources/mapper/tms/StudentDao.xml +++ b/src/main/resources/mapper/tms/StudentDao.xml @@ -63,7 +63,7 @@ ) - INSERT INTO student( schoolId, userId, workNumber, roleId, isdel,platformId ) + INSERT INTO student( schoolId, userId, workNumber, roleId, isdel,platformId,now() ) VALUES ( #{studentVo.schoolId},#{studentVo.userId},#{studentVo.workNumber},4,0,1) @@ -83,7 +83,6 @@ UPDATE student s,hr_user_info u - s.schoolId = #{schoolId}, s.workNumber = #{workNumber}, s.professionalId = #{professionalId}, s.professionalName = #{professionalName}, @@ -92,19 +91,20 @@ s.classId = #{classId}, s.className = #{className}, u.userName = #{userName}, - u.schoolId = #{schoolId}, u.account = #{account}, u.phone = #{phone}, u.phone = NULL, u.email = #{email} u.email = NULL - u.schoolAppellationId = #{schoolAppellationId}> + u.schoolId = #{schoolAppellationId}> WHERE u.userId = s.userId AND s.studentId = #{studentId} + + update student set workNumber = #{workNumber} diff --git a/src/main/resources/mapper/tms/SystemSetting.xml b/src/main/resources/mapper/tms/SystemSetting.xml index 292943f..23ed521 100644 --- a/src/main/resources/mapper/tms/SystemSetting.xml +++ b/src/main/resources/mapper/tms/SystemSetting.xml @@ -7,7 +7,128 @@ VALUES (#{userId},#{schoolId},#{workNumber},#{staffGradeId},#{staffProfessionalArchitectureId},#{staffGradeName},#{staffProfessionalArchitectureName},#{platformId},#{roleId}) - + SELECT + u.userId, + u.userName, + u.roleId, + u.logInNumber, + u.lastLoginTime, + u.schoolId, + s.workNumber, + s.staffProfessionalArchitectureId, + s.staffProfessionalArchitectureName, + s.staffGradeId, + s.staffGradeName + FROM + hr_user_info u + LEFT JOIN staff s ON u.userId = s.userId + WHERE + s.schoolId = #{schoolId} + AND (u.userName LIKE CONCAT('%',#{searchContent},'%') OR s.workNumber LIKE CONCAT('%',#{searchContent},'%')) + AND FIND_IN_SET(staffGradeId,#{staffGradeIds}) + AND FIND_IN_SET(staffProfessionalArchitectureId,#{staffProfessionalArchitectureIds}) + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/UserInfoDao.xml b/src/main/resources/mapper/tms/UserInfoDao.xml index 2804ae8..4d628ee 100644 --- a/src/main/resources/mapper/tms/UserInfoDao.xml +++ b/src/main/resources/mapper/tms/UserInfoDao.xml @@ -79,34 +79,64 @@ and schoolId = #{schoolId} + + + - INSERT INTO hr_user_info ( userName,email,phone,uniqueIdentificationAccount, schoolId, account,password, roleId,isdel,schoolAppellationId,creationTime) + INSERT INTO hr_user_info ( userName,email,phone,uniqueIdentificationAccount, schoolId, account,password, roleId,isdel,creationTime) VALUES - ( #{userName},#{email},#{phone},#{uniqueIdentificationAccount}, #{schoolId}, #{account}, #{password}, 4 ,0,#{schoolAppellationId},now()) - - - insert into hr_user_info( - userName, uniqueIdentificationAccount, schoolId, phone,account,password,roleId, schoolAppellationId,creationTime) - values - - (#{studentVo.userName}, #{studentVo.uniqueIdentificationAccount},#{studentVo.schoolId}, - #{studentVo.phone}, #{studentVo.account},#{studentVo.password},#{studentVo.roleId}, - (SELECT schoolId FROM school WHERE schoolName = #{studentVo.schoolAppellationName}),now()) - + ( #{userName},#{email},#{phone},#{uniqueIdentificationAccount}, #{schoolAppellationId}, #{account}, #{password}, 4 ,0,now()) + + + + + + + + + + insert into hr_user_info( - userName, uniqueIdentificationAccount, schoolId, phone,account,password,roleId, schoolAppellationId,creationTime) + userName, uniqueIdentificationAccount, phone,account,password,roleId, schoolId,creationTime) values - (#{userName}, #{uniqueIdentificationAccount},#{schoolId}, + (#{userName}, #{uniqueIdentificationAccount}, #{phone}, #{account},#{password},#{roleId}, (SELECT schoolId FROM school WHERE schoolName = #{schoolAppellationName}),now()) - - INSERT INTO hr_user_info ( account, userName, roleId, phone, email, uniqueIdentificationAccount, schoolId,creationTime) + + INSERT INTO hr_user_info ( account, userName, roleId, phone, email, uniqueIdentificationAccount, schoolId,creationTime,password) VALUES - (#{account},#{userName},#{roleId},#{phone},#{email},#{uniqueIdentificationAccount},#{schoolId},now()) + (#{account},#{userName},#{roleId},#{phone},#{email},#{uniqueIdentificationAccount},#{schoolId},now(),#{password}) @@ -129,4 +159,34 @@ AND stu.userId = u.userId + + UPDATE hr_user_info + + + account = #{account}, + + + userName = #{userName}, + + + phone = #{phone}, + + + email = #{email}, + + + schoolAppellationId = #{schoolAppellationId}, + + + roleId = #{roleId} + + + WHERE userId = #{userId}; + + + UPDATE hr_user_info u + SET + u.account = '00',u.phone = '00' + WHERE userId = #{userId} + \ No newline at end of file