|
@@ -12,10 +12,7 @@ import com.management.platform.util.MD5Util;
|
|
|
import com.management.platform.util.SnowFlake;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
-import org.apache.poi.ss.usermodel.Cell;
|
|
|
-import org.apache.poi.ss.usermodel.Row;
|
|
|
-import org.apache.poi.ss.usermodel.Sheet;
|
|
|
-import org.apache.poi.ss.usermodel.Workbook;
|
|
|
+import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
@@ -111,6 +108,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
.eq("company_id", userMapper.selectById(request.getHeader("Token")).getCompanyId()));
|
|
|
} catch (NullPointerException e) {
|
|
|
httpRespMsg.setError("验证失败");
|
|
|
+ return httpRespMsg;
|
|
|
}
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -138,6 +136,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
}
|
|
|
} catch (NullPointerException e) {
|
|
|
httpRespMsg.setError("验证失败");
|
|
|
+ return httpRespMsg;
|
|
|
}
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -157,6 +156,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
}
|
|
|
} catch (NullPointerException e) {
|
|
|
httpRespMsg.setError("验证失败");
|
|
|
+ return httpRespMsg;
|
|
|
}
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -221,6 +221,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
}
|
|
|
} catch (NullPointerException e) {
|
|
|
httpRespMsg.setError("验证失败");
|
|
|
+ return httpRespMsg;
|
|
|
}
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -259,8 +260,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
}
|
|
|
//此处新建账号 默认密码为000000 默认 姓名第一列 手机号第二列
|
|
|
Long id = SnowFlake.nextId();
|
|
|
- String name = row.getCell(0).getStringCellValue();
|
|
|
- String phone = row.getCell(1).getStringCellValue();
|
|
|
+ XSSFCell nameCell = row.getCell(0);
|
|
|
+ XSSFCell phoneCell = row.getCell(1);
|
|
|
+ nameCell.setCellType(CellType.STRING);
|
|
|
+ phoneCell.setCellType(CellType.STRING);
|
|
|
+ String name = nameCell.getStringCellValue();
|
|
|
+ String phone = phoneCell.getStringCellValue();
|
|
|
phoneList.add(phone);
|
|
|
userList.add(new User()
|
|
|
.setId(id.toString())
|
|
@@ -288,6 +293,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
httpRespMsg.setError("文件处理出错");
|
|
|
return httpRespMsg;
|
|
|
} catch (NullPointerException e) {
|
|
|
+ e.printStackTrace();
|
|
|
httpRespMsg.setError("数据格式有误或存在空数据 导出失败");
|
|
|
return httpRespMsg;
|
|
|
} catch (Exception e) {
|
|
@@ -297,4 +303,29 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
}
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
+
|
|
|
+ //切换权限状态
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg switchPermission(String id, HttpServletRequest request) {
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ try {
|
|
|
+ User requester = userMapper.selectById(request.getHeader("Token")),
|
|
|
+ target = userMapper.selectById(id);
|
|
|
+ //管理员只能新增员工
|
|
|
+ if (requester.getRole() != 1) {
|
|
|
+ httpRespMsg.setError("仅负责人有权限更改其他人员权限");
|
|
|
+ } else if (!target.getCompanyId().equals(requester.getCompanyId())) {
|
|
|
+ httpRespMsg.setError("只可修改同一公司人员的权限");
|
|
|
+ } else if (target.getRole() == 1) {
|
|
|
+ httpRespMsg.setError("不可修改负责人的权限");
|
|
|
+ } else {
|
|
|
+ target.setRole(target.getRole() == 0 ? 2 : 0);
|
|
|
+ userMapper.updateById(target);
|
|
|
+ }
|
|
|
+ } catch (NullPointerException e) {
|
|
|
+ httpRespMsg.setError("缺少数据 未查询到相应人员信息");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
}
|