diff --git a/src/main/java/cn/com/tenlion/usercenter/controller/route/area/user/AreaUserRouteController.java b/src/main/java/cn/com/tenlion/usercenter/controller/route/area/user/AreaUserRouteController.java index 776b146..c3ce2a3 100644 --- a/src/main/java/cn/com/tenlion/usercenter/controller/route/area/user/AreaUserRouteController.java +++ b/src/main/java/cn/com/tenlion/usercenter/controller/route/area/user/AreaUserRouteController.java @@ -1,11 +1,18 @@ package cn.com.tenlion.usercenter.controller.route.area.user; +import cn.com.tenlion.usercenter.pojo.dtos.userexpand.UserExpandDTO; +import cn.com.tenlion.usercenter.pojo.pos.userexpand.UserExpandPO; import ink.wgink.common.base.DefaultBaseController; +import ink.wgink.common.component.SecurityComponent; +import ink.wgink.exceptions.SearchException; import ink.wgink.interfaces.consts.ISystemConstant; import ink.wgink.interfaces.user.IUserExpandBaseService; import ink.wgink.interfaces.user.IUserExpandOptionButton; +import ink.wgink.module.dictionary.pojo.dtos.AreaDTO; +import ink.wgink.module.dictionary.service.IAreaService; import ink.wgink.service.user.util.UserUtil; import io.swagger.annotations.Api; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -21,6 +28,10 @@ public class AreaUserRouteController { private IUserExpandBaseService userExpandBaseService; @Autowired(required = false) private IUserExpandOptionButton userExpandOptionButton; + @Autowired + private SecurityComponent securityComponent; + @Autowired + private IAreaService areaService; @GetMapping("save-area-user") public ModelAndView saveAreaUser() { @@ -40,6 +51,30 @@ public class AreaUserRouteController { return mv; } + @GetMapping("list-area-admin") + public ModelAndView listAreaAdmin() { + ModelAndView mv = new ModelAndView("area/user/list-area-admin"); + if (securityComponent.isAdmin()) { + mv.addObject("baseParentId", "0"); + } else { + UserExpandPO userExpandPO = securityComponent.getExpandData(UserExpandPO.class); + if (userExpandPO == null) { + throw new SearchException("未绑定拓展属性"); + } + if (StringUtils.isBlank(userExpandPO.getAreaCode())) { + throw new SearchException("未绑定地区"); + } + AreaDTO areaDTO = areaService.getByCode(userExpandPO.getAreaCode()); + if (areaDTO == null) { + throw new SearchException("地区不存在"); + } + mv.addObject("baseAreaId", areaDTO.getAreaId()); + mv.addObject("baseAreaParentId", areaDTO.getAreaParentId()); + mv.addObject("baseAreaCode", areaDTO.getAreaCode()); + } + return mv; + } + @GetMapping("list-area-user") public ModelAndView listAreaUser() { ModelAndView mv = new ModelAndView("area/user/list-area-user"); @@ -47,4 +82,11 @@ public class AreaUserRouteController { return mv; } + @GetMapping("list-area-user-admin") + public ModelAndView listAreaUserAdmin() { + ModelAndView mv = new ModelAndView("area/user/list-area-user-admin"); + UserUtil.setUserListPageExpand(userExpandBaseService, userExpandOptionButton, mv); + return mv; + } + } diff --git a/src/main/resources/templates/area/user/list-area-admin.html b/src/main/resources/templates/area/user/list-area-admin.html new file mode 100644 index 0000000..303d053 --- /dev/null +++ b/src/main/resources/templates/area/user/list-area-admin.html @@ -0,0 +1,187 @@ + + +
+