添加接口获取代理组织列表

This commit is contained in:
liuchengqian 2022-07-07 08:57:51 +08:00
parent d22cfcc85b
commit 96d116fe5d
2 changed files with 12 additions and 32 deletions

View File

@ -60,6 +60,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.GET, "/selectFirePointByCode").permitAll() .antMatchers(HttpMethod.GET, "/selectFirePointByCode").permitAll()
.antMatchers(HttpMethod.POST, "/updateTypeByFireCode").permitAll() .antMatchers(HttpMethod.POST, "/updateTypeByFireCode").permitAll()
.antMatchers(HttpMethod.GET, "/api/user/verificationCode").permitAll() .antMatchers(HttpMethod.GET, "/api/user/verificationCode").permitAll()
.antMatchers(HttpMethod.GET, "/api/user/selectAgentOrgList").permitAll()//获取代理组织列表
.antMatchers(HttpMethod.POST, "/uploadFileMore").permitAll() .antMatchers(HttpMethod.POST, "/uploadFileMore").permitAll()
.antMatchers(HttpMethod.POST, "/uploadFile").permitAll() .antMatchers(HttpMethod.POST, "/uploadFile").permitAll()
.antMatchers(HttpMethod.GET, "/api/user/verificationCodeUpdate").permitAll() .antMatchers(HttpMethod.GET, "/api/user/verificationCodeUpdate").permitAll()

View File

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