From 87d116dc3277ae2c8c04e919677d158e352918b1 Mon Sep 17 00:00:00 2001 From: mzh820631607 Date: Tue, 20 Oct 2020 18:40:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msdw/tms/api/StudentControllerApi.java | 3 + .../tms/controller/StudentController.java | 6 +- .../controller/SystemSettingController.java | 30 ++++ .../com/msdw/tms/dao/SystemSetttingDao.java | 17 +++ .../java/com/msdw/tms/dao/UserInfoDao.java | 9 +- .../java/com/msdw/tms/entity/StaffEntity.java | 35 +++++ .../java/com/msdw/tms/entity/vo/StaffVo.java | 55 ++++++++ .../tms/entity/vo/StudentImportFailureVo.java | 40 ++++++ .../com/msdw/tms/service/StudentService.java | 5 +- .../tms/service/SystemSetttingService.java | 11 ++ .../tms/service/impl/StudentServiceImpl.java | 131 +++++++++++++++--- .../impl/SystemSettingServiceImpl.java | 55 ++++++++ src/main/resources/application.yml | 2 +- .../学生导入失败数据导出模板.xlsx | Bin 0 -> 9368 bytes .../resources/mapper/tms/SystemSetting.xml | 13 ++ src/main/resources/mapper/tms/UserInfoDao.xml | 21 +-- 16 files changed, 392 insertions(+), 41 deletions(-) create mode 100644 src/main/java/com/msdw/tms/controller/SystemSettingController.java create mode 100644 src/main/java/com/msdw/tms/dao/SystemSetttingDao.java create mode 100644 src/main/java/com/msdw/tms/entity/StaffEntity.java create mode 100644 src/main/java/com/msdw/tms/entity/vo/StaffVo.java create mode 100644 src/main/java/com/msdw/tms/entity/vo/StudentImportFailureVo.java create mode 100644 src/main/java/com/msdw/tms/service/SystemSetttingService.java create mode 100644 src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java create mode 100644 src/main/resources/excel-template/学生导入失败数据导出模板.xlsx create mode 100644 src/main/resources/mapper/tms/SystemSetting.xml diff --git a/src/main/java/com/msdw/tms/api/StudentControllerApi.java b/src/main/java/com/msdw/tms/api/StudentControllerApi.java index faac6bd..9efac77 100644 --- a/src/main/java/com/msdw/tms/api/StudentControllerApi.java +++ b/src/main/java/com/msdw/tms/api/StudentControllerApi.java @@ -38,4 +38,7 @@ public interface StudentControllerApi { @ApiOperation(value = "批量导入学生信息",notes = "批量导入学生信息") public R uploadFile(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/controller/StudentController.java b/src/main/java/com/msdw/tms/controller/StudentController.java index 6e21cf6..299bf14 100644 --- a/src/main/java/com/msdw/tms/controller/StudentController.java +++ b/src/main/java/com/msdw/tms/controller/StudentController.java @@ -21,6 +21,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 学生管理 @@ -196,11 +197,12 @@ public class StudentController implements StudentControllerApi{ @PostMapping("/uploadFile") public R uploadFile(MultipartFile file) throws IOException{ Integer schoolId = ConstantUtils.Keda_schoolId; - HashMap upload = studentService.upload(file,schoolId); + Map upload = studentService.upload(file,schoolId); return R.ok().put("data",upload); } - @PostMapping("/export_failure") + @Override + @GetMapping("/export_failure") public void exportFailureRecord(HttpServletResponse response, String token) throws Exception{ studentService.exportFailureRecord(response,token); diff --git a/src/main/java/com/msdw/tms/controller/SystemSettingController.java b/src/main/java/com/msdw/tms/controller/SystemSettingController.java new file mode 100644 index 0000000..99aadbd --- /dev/null +++ b/src/main/java/com/msdw/tms/controller/SystemSettingController.java @@ -0,0 +1,30 @@ +package com.msdw.tms.controller; + +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.*; + +/** + * 系统设置 + */ +@RestController +@RequestMapping("/tms/system") +public class SystemSettingController { + @Autowired + private SystemSetttingService systemSetttingService; + + @PostMapping("/addStaff") + public R addStaff(@RequestBody StaffVo staffVo){ + systemSetttingService.addStaff(staffVo); + return R.ok(); + } + + @PostMapping("/queryStaff") + public R queryStaff(@RequestBody StaffVo staffVo){ + PageUtils query = systemSetttingService.queryStaff(staffVo); + return R.ok().put("data",query); + } +} diff --git a/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java b/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java new file mode 100644 index 0000000..c057a88 --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java @@ -0,0 +1,17 @@ +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.vo.StaffVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.poi.ss.formula.functions.T; + +import java.util.List; + +@Mapper +public interface SystemSetttingDao { + + boolean addStaff(StaffVo staffVo); + + IPage queryStaff(Page tPage, String searchContent, 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 c5e8b6f..8fece8a 100644 --- a/src/main/java/com/msdw/tms/dao/UserInfoDao.java +++ b/src/main/java/com/msdw/tms/dao/UserInfoDao.java @@ -1,14 +1,10 @@ package com.msdw.tms.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.StudentEntity; -import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserInfoEntity; import com.msdw.tms.entity.vo.StudentVo; -import com.msdw.tms.entity.vo.UserEntityVo; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import java.util.List; @@ -27,12 +23,13 @@ public interface UserInfoDao extends BaseMapper { Integer disableAccount(StudentVo studentIds); - List queryStudentAccount(String account,Integer schoolId); + List queryStudentAccount(String account, Integer schoolId); - List queryStudentPhone(String phone,Integer schoolId); + List queryStudentPhone(String phone, Integer schoolId); int bacthAddStudents(List students); int batchSaveUserInfo(StudentVo studentVo); + Integer addUserinfo(UserInfoEntity userInfo); } diff --git a/src/main/java/com/msdw/tms/entity/StaffEntity.java b/src/main/java/com/msdw/tms/entity/StaffEntity.java new file mode 100644 index 0000000..490f295 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/StaffEntity.java @@ -0,0 +1,35 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +@TableName("staff") +public class StaffEntity { + + //员工主键id + private Integer staffId; + //员工工号 + private String workNumber; + //绑定年级id + private Integer staffGradeId; + //绑定专业id + private Integer staffProfessionalArchitectureId; + //绑定年级名称 + private String staffGradeName; + //绑定专业名称 + private String staffProfessionalArchitectureName; + //角色id + private Integer roleId; + //绑定学校id + private Integer schoolId; + //绑定用户id + private Integer userId; + //是否删除 + private Integer isdel; + //绑定平台 + private Integer platformId; +} diff --git a/src/main/java/com/msdw/tms/entity/vo/StaffVo.java b/src/main/java/com/msdw/tms/entity/vo/StaffVo.java new file mode 100644 index 0000000..3ab5a0b --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/StaffVo.java @@ -0,0 +1,55 @@ +package com.msdw.tms.entity.vo; + +import com.msdw.tms.entity.UserInfoEntity; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 员工管理 + */ +@Data +@Accessors(chain = true) +public class StaffVo extends UserInfoEntity { + +//---------------------------------员工信息staff(未完全) + //员工主键id + private Integer staffId; + //员工工号 + private String workNumber; + //绑定年级id + private Integer staffGradeId; + //绑定专业id + private Integer staffProfessionalArchitectureId; + //绑定年级名称 + private String staffGradeName; + //绑定专业名称 + private String staffProfessionalArchitectureName; + //绑定平台 + private Integer platformId; + +//----------------------------------分页 + //第几页 + private Integer page; + //每页数据量 + private Integer size; + //搜索内容 + private String searchContent; + +//----------------------------------员工年级staff_grade + //员工年级表主键id +// private Integer staffGradeId; + //员工年纪表名称 +// private String staffGradeName; + //绑定员工专业组织架构id +// private Integer staffProfessionalArchitectureId; +// private Integer isdel; + +//----------------------------------员工组织关系staff_professional_architecture + //员工组织架构主键 +// private Integer staffProfessionalArchitectureId; + //员工组织架构名称 +// private String staffProfessionalArchitectureName; + //绑定学校id +// private Integer schoolId; + // private Integer isdel; +} diff --git a/src/main/java/com/msdw/tms/entity/vo/StudentImportFailureVo.java b/src/main/java/com/msdw/tms/entity/vo/StudentImportFailureVo.java new file mode 100644 index 0000000..9c4429c --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/StudentImportFailureVo.java @@ -0,0 +1,40 @@ +package com.msdw.tms.entity.vo; + +import com.msdw.tms.common.utils.poi.ExcelAttribute; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Data +@ToString +@Accessors(chain = true) +public class StudentImportFailureVo { + + //第几行 + private Long index; + //用户姓名 + @ExcelAttribute(sort = 0) + private String userName; + //所属院校 + @ExcelAttribute(sort = 1) + private String schoolAppellationName; + //账号 + @ExcelAttribute(sort = 2) + private String account; + //学号 + @ExcelAttribute(sort = 3) + private String workNumber; + //手机号码 + @ExcelAttribute(sort = 4) + private String phone; + //邮箱 + @ExcelAttribute(sort = 5) + private String email; + //失败原因 + @ExcelAttribute(sort = 6) + private String failureMsg; + // +// @ExcelAttribute(sort = 7) +// private String message; + +} diff --git a/src/main/java/com/msdw/tms/service/StudentService.java b/src/main/java/com/msdw/tms/service/StudentService.java index d26d8f4..58259c6 100644 --- a/src/main/java/com/msdw/tms/service/StudentService.java +++ b/src/main/java/com/msdw/tms/service/StudentService.java @@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashMap; import java.util.List; +import java.util.Map; public interface StudentService extends IService{ @@ -31,7 +32,7 @@ public interface StudentService extends IService{ void downloadFiles(HttpServletResponse response) throws IOException; - HashMap upload(MultipartFile file, Integer schoolId) throws IOException; + Map upload(MultipartFile file, Integer schoolId) throws IOException; - void exportFailureRecord(HttpServletResponse response,String token); + void exportFailureRecord(HttpServletResponse response,String token) throws Exception; } diff --git a/src/main/java/com/msdw/tms/service/SystemSetttingService.java b/src/main/java/com/msdw/tms/service/SystemSetttingService.java new file mode 100644 index 0000000..3199b68 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/SystemSetttingService.java @@ -0,0 +1,11 @@ +package com.msdw.tms.service; + +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.entity.vo.StaffVo; + +public interface SystemSetttingService { + + boolean addStaff(StaffVo staffVo); + + PageUtils queryStaff(StaffVo staffVo); +} 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 72d6084..930378f 100644 --- a/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java @@ -1,16 +1,21 @@ 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.StudentDao; import com.msdw.tms.dao.UserInfoDao; import com.msdw.tms.entity.StudentEntity; import com.msdw.tms.entity.UserInfoEntity; import com.msdw.tms.entity.XlsxTemplateEntity; import com.msdw.tms.entity.response.CommonCode; +import com.msdw.tms.entity.vo.QuestionsImportFailureVO; +import com.msdw.tms.entity.vo.StudentImportFailureVo; import com.msdw.tms.entity.vo.StudentVo; import com.msdw.tms.service.AliyunOssService; import com.msdw.tms.service.StudentService; @@ -18,6 +23,9 @@ 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; @@ -25,9 +33,9 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import java.io.InputStream; +import java.util.*; +import java.util.concurrent.TimeUnit; @Service("studentService") public class StudentServiceImpl extends ServiceImpl implements StudentService { @@ -44,6 +52,9 @@ public class StudentServiceImpl extends ServiceImpl im @Autowired private UserInfoDao userInfoDao; + @Resource + StringRedisTemplate stringRedisTemplate; + @Override public Integer queryStudentIdNumber(String workNumber,Integer schoolId) { List result = studentDao.queryStudentIdNumber(workNumber,schoolId); @@ -88,7 +99,7 @@ public class StudentServiceImpl extends ServiceImpl im public boolean updateStudent(StudentVo studentVo) { try { Integer update = studentDao.updateStudent(studentVo); - return true; + return true; }catch (RuntimeException e){ e.printStackTrace(); return false; @@ -105,14 +116,14 @@ public class StudentServiceImpl extends ServiceImpl im R r = new R(); boolean result = studentDao.addStudentInfo(userInfoEntity); if (result==false){ - r.put("code",300); - r.put("errmessage","注册失败!"); - return r; - }else{ - r.put("code",200); - r.put("errmessage","注册成功!"); - return r; - } + r.put("code",300); + r.put("errmessage","注册失败!"); + return r; + }else{ + r.put("code",200); + r.put("errmessage","注册成功!"); + return r; + } } @Override @@ -123,30 +134,40 @@ public class StudentServiceImpl extends ServiceImpl im @Transactional @Override - public HashMap upload(MultipartFile file, Integer schoolId) throws IOException{ + public Map upload(MultipartFile file, Integer schoolId) throws IOException{ List students = ExcelImportHelper.readStudent(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); } - - HashMap map = new HashMap<>(); + int size = students.size(); + Map map = new HashMap<>(); + Long ii = 1L;//用于记录序列号 try { for (int i = 0;i result1 = studentDao.queryStudentIdNumber(workNumber,schoolId); + List result4 = userInfoDao.queryStudentAccount(account, schoolId); String email = student.getEmail(); if (phone!=null&&phone!=""){ List result2 = userInfoDao.queryStudentPhone(phone, schoolId); if (result2.size()==1){ log.error("该号码已被使用"); - map.put("被占用电话号码序列:"+System.currentTimeMillis(),"电话号码:"+phone); + StudentImportFailureVo vo = new StudentImportFailureVo(); + ++ii; + 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; @@ -161,22 +182,50 @@ public class StudentServiceImpl extends ServiceImpl im studentVo.setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())). setPassword(ConstantUtils.INITIAL_PASSWORD) .setSchoolId(ConstantUtils.Keda_schoolId).setRoleId(ConstantUtils.STUDENT_ROLE) - ; + ; studentVo.setAccount(student.getAccount()).setSchoolAppellationName(schoolAppellationName).setUserName(student.getUserName()).setIsdel(Constant.IsDel.NOT_DEL.getType()); if (result1.size()==1){ log.error("该学号已存在"); - map.put("学号已存在序列:"+System.currentTimeMillis(),"学号:"+workNumber); + StudentImportFailureVo vo = new StudentImportFailureVo(); + ++ii; + 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(),"学号:"+workNumber); + students.remove(i); + i--; + continue; + }else if(result4.size()==1){ + log.error("账号已存在"); + StudentImportFailureVo vo = new StudentImportFailureVo(); + ++ii; + 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(),"学号:"+workNumber); students.remove(i); i--; continue; - }else if(result3.size()!=1){ + } + else if(result3.size()!=1){ log.error("不存在该院校"); - map.put("错误的学校名称序列:"+System.currentTimeMillis(),"学校名称:"+schoolAppellationName); + StudentImportFailureVo vo = new StudentImportFailureVo(); + ++ii; + 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(),"学校名称:"+schoolAppellationName); students.remove(i); i--; continue; } + ++ii; if (!students.isEmpty()&&students.size()>0){ userInfoDao.batchSaveUserInfo(studentVo); student.setUserId(studentVo.getUserId()).setIsdel(Constant.IsDel.NOT_DEL.getType()).setPlatformId(ConstantUtils.PLATFORMID); @@ -185,18 +234,56 @@ public class StudentServiceImpl extends ServiceImpl im throw new RuntimeException(); } } + + } }catch (RuntimeException e){ log.error(e.getMessage()); + map.put("failura","添加失败"); 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) { + 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(StudentImportFailureVo::getIndex)); + + //2.加载模板流数据 + org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/学生导入失败数据导出模板.xlsx"); + InputStream inputStream = resource.getInputStream(); + //3、通过工具类下载文件 + new ExcelExportUtil(StudentImportFailureVo.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). + export(response, inputStream, parse, "学生信息导入失败表.xlsx"); } // public HashMap readStudent(Integer schoolId, MultipartFile file) { diff --git a/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java new file mode 100644 index 0000000..f3a2556 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java @@ -0,0 +1,55 @@ +package com.msdw.tms.service.impl; + +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.dao.SystemSetttingDao; +import com.msdw.tms.dao.UserInfoDao; +import com.msdw.tms.entity.UserInfoEntity; +import com.msdw.tms.entity.vo.StaffVo; +import com.msdw.tms.entity.vo.StudentVo; +import com.msdw.tms.service.SystemSetttingService; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; + +@Service("systemSetttingService") +public class SystemSettingServiceImpl implements SystemSetttingService { + + @Autowired + private SystemSetttingDao systemSetttingDao; + + @Autowired + private UserInfoDao userInfoDao; + + @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(); + } + return result; + } + + @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); + PageUtils pageUtils = new PageUtils(staff); + return pageUtils; + } + + +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5537c11..5660afe 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -17,7 +17,7 @@ spring: # port: 6379 # password: huoran redis: - host: 192.168.31.125 + host: 127.0.0.1 port: 6379 password: mybatis-plus: diff --git a/src/main/resources/excel-template/学生导入失败数据导出模板.xlsx b/src/main/resources/excel-template/学生导入失败数据导出模板.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..d0cb19815a07977a71c73625bc6b9936d15e92d7 GIT binary patch literal 9368 zcma)i1yEhvvMuf&+}+*X-66QU>&7j3(BK~2-7OG2!Ge2`V1eN75cr$q-IH^8=iU0V z3id8&nQQdwo?ShrvK%-B9LVzuQ```K{`}8^1%5GeG*t#TI=L_@1I5sRe}MTVHYTbE z$^r@k!UF~Zg7SAUV<#s@PkXzp_#Rns7L>QgLB}Y78tbU=B)iDm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_*w7&0oR@5Q2+n{ literal 0 HcmV?d00001 diff --git a/src/main/resources/mapper/tms/SystemSetting.xml b/src/main/resources/mapper/tms/SystemSetting.xml new file mode 100644 index 0000000..292943f --- /dev/null +++ b/src/main/resources/mapper/tms/SystemSetting.xml @@ -0,0 +1,13 @@ + + + + + + INSERT INTO staff (userId,schoolId,workNumber,staffGradeId,staffProfessionalArchitectureId,staffGradeName,staffProfessionalArchitectureName,platformId,roleId) + VALUES + (#{userId},#{schoolId},#{workNumber},#{staffGradeId},#{staffProfessionalArchitectureId},#{staffGradeName},#{staffProfessionalArchitectureName},#{platformId},#{roleId}) + + + \ 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 79c66ca..2804ae8 100644 --- a/src/main/resources/mapper/tms/UserInfoDao.xml +++ b/src/main/resources/mapper/tms/UserInfoDao.xml @@ -6,10 +6,10 @@ insert into hr_user_info( userName, uniqueIdentificationAccount, provinceId, - cityId, schoolId, phone,account,password,roleId,schoolAppellationId) + cityId, schoolId, phone,account,password,roleId,schoolAppellationId,creationTime) values( #{userName}, #{uniqueIdentificationAccount}, #{provinceId}, - #{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId},#{schoolAppellationId}) + #{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId},#{schoolAppellationId},now()) @@ -81,27 +81,32 @@ - INSERT INTO hr_user_info ( userName,email,phone,uniqueIdentificationAccount, schoolId, account,password, roleId,isdel,schoolAppellationId) + INSERT INTO hr_user_info ( userName,email,phone,uniqueIdentificationAccount, schoolId, account,password, roleId,isdel,schoolAppellationId,creationTime) VALUES - ( #{userName},#{email},#{phone},#{uniqueIdentificationAccount}, #{schoolId}, #{account}, #{password}, 4 ,0,#{schoolAppellationId}) + ( #{userName},#{email},#{phone},#{uniqueIdentificationAccount}, #{schoolId}, #{account}, #{password}, 4 ,0,#{schoolAppellationId},now()) insert into hr_user_info( - userName, uniqueIdentificationAccount, schoolId, phone,account,password,roleId, schoolAppellationId) + 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})) + (SELECT schoolId FROM school WHERE schoolName = #{studentVo.schoolAppellationName}),now()) insert into hr_user_info( - userName, uniqueIdentificationAccount, schoolId, phone,account,password,roleId, schoolAppellationId) + userName, uniqueIdentificationAccount, schoolId, phone,account,password,roleId, schoolAppellationId,creationTime) values (#{userName}, #{uniqueIdentificationAccount},#{schoolId}, #{phone}, #{account},#{password},#{roleId}, - (SELECT schoolId FROM school WHERE schoolName = #{schoolAppellationName})) + (SELECT schoolId FROM school WHERE schoolName = #{schoolAppellationName}),now()) + + + INSERT INTO hr_user_info ( account, userName, roleId, phone, email, uniqueIdentificationAccount, schoolId,creationTime) + VALUES + (#{account},#{userName},#{roleId},#{phone},#{email},#{uniqueIdentificationAccount},#{schoolId},now())