|
@@ -12,6 +12,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.apache.poi.ss.usermodel.CellType;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
@@ -25,6 +30,7 @@ import org.jeecg.common.system.util.JwtUtil;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.*;
|
|
|
import org.jeecg.modules.system.entity.*;
|
|
|
+import org.jeecg.modules.system.mapper.SysUserDepartMapper;
|
|
|
import org.jeecg.modules.system.model.DepartIdModel;
|
|
|
import org.jeecg.modules.system.model.SysUserSysDepartModel;
|
|
|
import org.jeecg.modules.system.service.*;
|
|
@@ -45,7 +51,10 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -75,6 +84,8 @@ public class SysUserController {
|
|
|
|
|
|
@Autowired
|
|
|
private ISysUserDepartService sysUserDepartService;
|
|
|
+ @Autowired
|
|
|
+ private SysUserDepartMapper textMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private ISysUserRoleService userRoleService;
|
|
@@ -550,6 +561,40 @@ public class SysUserController {
|
|
|
}
|
|
|
}
|
|
|
return ImportExcelUtil.imporReturnRes(errorLines,successLines,errorMessage);
|
|
|
+ /* File file=new File("C:/Users/EDZ/Desktop/jian.xlsx");
|
|
|
+ InputStream in = new FileInputStream(file);
|
|
|
+
|
|
|
+ // 读取整个Excel
|
|
|
+ XSSFWorkbook sheets = new XSSFWorkbook(in);
|
|
|
+ // 获取第一个表单Sheet
|
|
|
+ XSSFSheet sheetAt = sheets.getSheetAt(0);
|
|
|
+ //默认第一行为标题行,i = 0
|
|
|
+ XSSFRow titleRow = sheetAt.getRow(0);
|
|
|
+ List<Map<String,Object>> mapList = new ArrayList<>();
|
|
|
+ // 循环获取每一行数据
|
|
|
+ for (int i = 1; i < sheetAt.getPhysicalNumberOfRows(); i++) {
|
|
|
+ XSSFRow row = sheetAt.getRow(i);
|
|
|
+ // 读取每一列内容
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ for (int index = 0; index < row.getPhysicalNumberOfCells(); index++) {
|
|
|
+ XSSFCell titleCell = titleRow.getCell(index);
|
|
|
+ XSSFCell cell = row.getCell(index);
|
|
|
+ cell.setCellType(CellType.STRING);
|
|
|
+ if (cell.getStringCellValue().equals("")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //表头数据
|
|
|
+ String titleName = titleCell.getStringCellValue();
|
|
|
+ //单元格内容
|
|
|
+ String valueName = cell.getStringCellValue();
|
|
|
+ //每一行的数据
|
|
|
+ map.put(titleName,valueName);
|
|
|
+ }
|
|
|
+ String user = map.get("姓名").toString();
|
|
|
+ String dep = map.get("部门").toString();
|
|
|
+ textMapper.insertText(user,dep);
|
|
|
+ }
|
|
|
+ return null;*/
|
|
|
}
|
|
|
|
|
|
/**
|