|
|
@@ -164,21 +164,34 @@ public class UserController extends BaseController {
|
|
|
@Log(title = "导入用户", businessType = BusinessType.IMPORT)
|
|
|
@PreAuthorize("@ss.hasPermi('system:section:import')")
|
|
|
@PostMapping("/importData")
|
|
|
- public AjaxResult<Map<String,Object>> importData(MultipartFile file, String importNo) throws Exception
|
|
|
+ public AjaxResult<Map<String,Object>> importData(MultipartFile file, String importNo,Integer sign) throws Exception
|
|
|
{
|
|
|
- ExcelUtil<UserImportAddBo> util = new ExcelUtil<UserImportAddBo>(UserImportAddBo.class);
|
|
|
- List<UserImportAddBo> userList = null;
|
|
|
- try{
|
|
|
- userList = util.importExcel(file.getInputStream());
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- throw new IllegalArgumentException("模板格式不正确,请重新下载模板");
|
|
|
+ Map<String, Object> rs = new HashMap<>();
|
|
|
+ if (ObjectUtils.isNotNull(sign) && sign == 1){
|
|
|
+ ExcelUtil<UserPeriodImportBo> util = new ExcelUtil<UserPeriodImportBo>(UserPeriodImportBo.class);
|
|
|
+ List<UserPeriodImportBo> userList = null;
|
|
|
+ try{
|
|
|
+ userList = util.importExcel(file.getInputStream());
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new IllegalArgumentException("模板格式不正确,请重新下载模板");
|
|
|
+ }
|
|
|
+ rs = iUserService.importSevenUser(userList);
|
|
|
+ }else {
|
|
|
+ ExcelUtil<UserImportAddBo> util = new ExcelUtil<UserImportAddBo>(UserImportAddBo.class);
|
|
|
+ List<UserImportAddBo> userList = null;
|
|
|
+ try{
|
|
|
+ userList = util.importExcel(file.getInputStream());
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new IllegalArgumentException("模板格式不正确,请重新下载模板");
|
|
|
+ }
|
|
|
+ Collections.reverse(userList);
|
|
|
+ if (userList.stream().allMatch(item -> ObjectUtils.isNull(item))){
|
|
|
+ throw new IllegalArgumentException("模板格式不正确,请重新下载模板");
|
|
|
+ }
|
|
|
+ rs = iUserService.importUser(userList,importNo);
|
|
|
}
|
|
|
- Collections.reverse(userList);
|
|
|
- if (userList.stream().allMatch(item -> ObjectUtils.isNull(item))){
|
|
|
- throw new IllegalArgumentException("模板格式不正确,请重新下载模板");
|
|
|
- }
|
|
|
- Map<String, Object> rs = iUserService.importUser(userList,importNo);
|
|
|
return AjaxResult.success(rs);
|
|
|
}
|
|
|
|