添加接口获取代理组织列表
This commit is contained in:
parent
d22cfcc85b
commit
96d116fe5d
@ -60,6 +60,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers(HttpMethod.GET, "/selectFirePointByCode").permitAll()
|
||||
.antMatchers(HttpMethod.POST, "/updateTypeByFireCode").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/api/user/verificationCode").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/api/user/selectAgentOrgList").permitAll()//获取代理组织列表
|
||||
.antMatchers(HttpMethod.POST, "/uploadFileMore").permitAll()
|
||||
.antMatchers(HttpMethod.POST, "/uploadFile").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/api/user/verificationCodeUpdate").permitAll()
|
||||
|
@ -20,6 +20,7 @@ import com.xkrs.utils.FirePointCodeUtils;
|
||||
import com.xkrs.utils.RandomUtil;
|
||||
import org.apache.hc.core5.util.TextUtils;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -43,6 +44,9 @@ import static com.xkrs.utils.EncryptDecryptUtil.encry256;
|
||||
@RequestMapping(value = "/api/user")
|
||||
public class SysUserController {
|
||||
|
||||
// 获取区域信息
|
||||
private final Locale locale = LocaleContextHolder.getLocale();
|
||||
|
||||
@Resource
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@ -64,8 +68,6 @@ public class SysUserController {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RequestMapping(value = "/updateviplevel", method = RequestMethod.POST)
|
||||
public String updateVipLevel(@RequestBody SysUserVipLevelQo sysUserVipLevelQo) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
String ids = sysUserVipLevelQo.getIds();
|
||||
List<Integer> idList = new ArrayList<>();
|
||||
if (ids.contains(",")) {
|
||||
@ -90,8 +92,6 @@ public class SysUserController {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RequestMapping(value = "/updatereceivesms", method = RequestMethod.POST)
|
||||
public String updateReceiveSms(@RequestBody SysUserReceiveSmsQo sysUserReceiveSmsQo) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
String ids = sysUserReceiveSmsQo.getIds();
|
||||
List<Integer> idList = new ArrayList<>();
|
||||
if (ids.contains(",")) {
|
||||
@ -113,8 +113,6 @@ public class SysUserController {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RequestMapping(value = "/updateremark", method = RequestMethod.POST)
|
||||
public String updateRemark(@RequestBody SysUserRemarkQo sysUserRemarkQo) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
Integer id = sysUserRemarkQo.getId();
|
||||
Optional<SysUserEntity> optionalById = sysUserDao.findById(id);
|
||||
if (optionalById.isEmpty()) {
|
||||
@ -129,14 +127,12 @@ public class SysUserController {
|
||||
*/
|
||||
@RequestMapping(value = "/logged/check", method = RequestMethod.POST)
|
||||
public String loginUserTokenCheck() {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "", locale);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check/duplicate", method = RequestMethod.POST)
|
||||
public String checkDuplicate(@RequestParam(value = "userName", required = false) String userName) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
|
||||
// 验证用户名是否重复
|
||||
if (!sysUserService.checkUserName(userName)) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL, "", locale);
|
||||
@ -144,13 +140,17 @@ public class SysUserController {
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "OK", locale);
|
||||
}
|
||||
|
||||
@GetMapping("/selectAgentOrgList")
|
||||
public String selectAgentOrgList() {
|
||||
List<AgentOrgEntity> agentOrgList= agentOrgDao.findAll(Sort.by(Sort.Direction.ASC, "id"));
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, agentOrgList, locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册系统用户
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public String addUser(@Validated({SysUserQoInsert.class}) @RequestBody SysUserQo userQo, BindingResult bindingResult, HttpServletRequest servletRequest) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
// 验证数据合法性
|
||||
if (bindingResult.hasErrors()) {
|
||||
return outputEncapsulationErrorList(bindingResult.getFieldErrors(), locale);
|
||||
@ -176,8 +176,6 @@ public class SysUserController {
|
||||
*/
|
||||
@RequestMapping(value = "/general/delete", method = RequestMethod.DELETE)
|
||||
public String deleteCustomUser(@RequestParam(value = "userId", required = false) int id) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
// 验证数据合法性
|
||||
int res = sysUserService.softDeleteGeneralUser(id);
|
||||
if (res == 1) {
|
||||
@ -189,8 +187,6 @@ public class SysUserController {
|
||||
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public String updateUser(@Validated({SysUserQoUpdate.class}) @RequestBody SysUserQo userQo, BindingResult bindingResult) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
// 验证数据合法性
|
||||
if (bindingResult.hasErrors()) {
|
||||
return outputEncapsulationErrorList(bindingResult.getFieldErrors(), locale);
|
||||
@ -205,8 +201,6 @@ public class SysUserController {
|
||||
*/
|
||||
@GetMapping("/booleanUserName")
|
||||
public String booleanUserName(@RequestParam("userName") String userName) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
Map map = new HashMap(3);
|
||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(userName);
|
||||
if (sysUserEntity == null) {
|
||||
@ -223,8 +217,6 @@ public class SysUserController {
|
||||
*/
|
||||
@GetMapping("/selectAllUser")
|
||||
public String selectAllUser(@RequestHeader(value = "Authorization") String token) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
// 验证token
|
||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||
@ -245,8 +237,6 @@ public class SysUserController {
|
||||
public String operateActiveFlag(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||
Integer userId = (Integer) map.get("userId");
|
||||
String keepType = (String) map.get("keepType");
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
// 验证token
|
||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||
@ -268,8 +258,6 @@ public class SysUserController {
|
||||
*/
|
||||
@PostMapping("/updatePassword")
|
||||
public String updatePassword(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
String oldPassword = (String) map.get("oldPassword");
|
||||
String newPassword = (String) map.get("newPassword");
|
||||
String confirmPassword = (String) map.get("confirmPassword");
|
||||
@ -287,8 +275,6 @@ public class SysUserController {
|
||||
*/
|
||||
@PostMapping("/adminUpdatePassword")
|
||||
public String adminUpdatePassword(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
// 要修改的用户的id
|
||||
Integer userId = (Integer) map.get("userId");
|
||||
String newPassword = (String) map.get("newPassword");
|
||||
@ -308,8 +294,6 @@ public class SysUserController {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@PostMapping("/userUnRememberPassword")
|
||||
public String userUnRememberPassword(@RequestBody Map map) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
String phone = (String) map.get("phone");
|
||||
String newPassword = (String) map.get("newPassword");
|
||||
String confirmPassword = (String) map.get("confirmPassword");
|
||||
@ -330,8 +314,6 @@ public class SysUserController {
|
||||
*/
|
||||
@GetMapping("/verificationCode")
|
||||
public String verificationCode(@RequestParam("phone") String phone, @RequestParam(value = "agentOrgId", required = false) String agentOrgId) throws Exception {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
Long finalAgentOrgId = Long.parseLong(TextUtils.isEmpty(agentOrgId) ? "1" : agentOrgId);
|
||||
List<AgentOrgEntity> agentOrgList = agentOrgDao.findAll();
|
||||
String targetAgentOrgName = FirePointCodeUtils.getTargetAgentOrgName(finalAgentOrgId, agentOrgList);
|
||||
@ -346,8 +328,6 @@ public class SysUserController {
|
||||
*/
|
||||
@GetMapping("/verificationCodeUpdate")
|
||||
public String verificationCodeUpdate(@RequestParam("phone") String phone) throws Exception {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
SysUserVo sysUserVo = sysUserDao.selectUserByUserName(phone);
|
||||
if (sysUserVo == null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "手机号错误,请使用您注册的手机号", locale);
|
||||
@ -365,7 +345,6 @@ public class SysUserController {
|
||||
*/
|
||||
@GetMapping("/getVerificationCode")
|
||||
public String getVerificationCode(@RequestParam("phone") String phone, @RequestParam("verificationCode") String verificationCode) {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
String o = (String) redisService.get(phone);
|
||||
if ("".equals(o) || o == null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "请先发送验证码!", locale);
|
||||
|
Loading…
Reference in New Issue
Block a user