|
@@ -7,6 +7,7 @@ import java.util.Map;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import com.ruoyi.common.core.utils.SecurityUtils;
|
|
|
+import com.ruoyi.common.core.utils.StringUtils;
|
|
|
import com.ruoyi.resource.domain.ZnylKhzh;
|
|
|
import com.ruoyi.resource.domain.ZnylYgry;
|
|
|
import com.ruoyi.resource.service.IZnylKhzhService;
|
|
@@ -86,13 +87,25 @@ public class ZnylXqdwController extends BaseController
|
|
|
@GetMapping("/getXqdwList")
|
|
|
public AjaxResult getXqdwList(ZnylXqdw znylXqdw)
|
|
|
{
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
+ if (userId != 1) {
|
|
|
+ Long accountId = Long.valueOf(0);
|
|
|
+ ZnylYgry ygry = znylYgryService.selectByAccountno(SecurityUtils.getUsername());
|
|
|
+ if (null != ygry) {
|
|
|
+ accountId = ygry.getAccountid();
|
|
|
+ } else {
|
|
|
+ ZnylKhzh khzh = znylKhzhService.selectByAccountno(SecurityUtils.getUsername());
|
|
|
+ accountId = khzh.getId();
|
|
|
+ }
|
|
|
+ znylXqdw.setAccountid(accountId);
|
|
|
+ }
|
|
|
if(null != znylXqdw.getRegioncode()){
|
|
|
SysDeptJl sysDeptJl = remoteDeptJlService.selectSysDeptJlByCode(znylXqdw.getRegioncode());
|
|
|
String level = String.valueOf(sysDeptJl.getLevel());
|
|
|
if (level.equals("1")) { //查全部
|
|
|
znylXqdw.setRegioncode("");
|
|
|
} else if (level.equals("2")) { // 所有下级区划
|
|
|
- List<SysDeptJl> childDept = remoteDeptJlService.getDeptList(sysDeptJl.getId());
|
|
|
+ List<SysDeptJl> childDept = remoteDeptJlService.getDeptListByPid(sysDeptJl.getId());
|
|
|
List<String> deptIdsList = new ArrayList<>();
|
|
|
for (int i = 0; childDept.size() > i; i++) {
|
|
|
deptIdsList.add(childDept.get(i).getCode());
|
|
@@ -110,10 +123,10 @@ public class ZnylXqdwController extends BaseController
|
|
|
* 区划
|
|
|
* @return
|
|
|
*/
|
|
|
- @GetMapping("/getDeptListByCode")
|
|
|
- public AjaxResult getDeptListByCode()
|
|
|
+ @PostMapping("/getDeptListByCode")
|
|
|
+ public AjaxResult getDeptListByCode(@RequestBody SysDeptJl sysDeptJl)
|
|
|
{
|
|
|
- List<SysDeptJl> list = new ArrayList<>();
|
|
|
+ SysDeptJl query = new SysDeptJl();
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
if (userId != 1) {
|
|
|
String code = "";
|
|
@@ -124,16 +137,30 @@ public class ZnylXqdwController extends BaseController
|
|
|
ZnylKhzh khzh = znylKhzhService.selectByAccountno(SecurityUtils.getUsername());
|
|
|
code = khzh.getRegioncode();
|
|
|
}
|
|
|
- SysDeptJl sysDeptJl = remoteDeptJlService.selectSysDeptJlByCode(code);
|
|
|
-// List<SysDeptJl> list = remoteDeptJlService.getDeptList(sysDeptJl.getId());
|
|
|
- list = remoteDeptJlService.getDeptList(sysDeptJl.getId());
|
|
|
-// list.add(sysDeptJl);
|
|
|
- return AjaxResult.success(list);
|
|
|
- } else {
|
|
|
- list = remoteDeptJlService.getDeptList(null);
|
|
|
- return AjaxResult.success(list);
|
|
|
+// 用户的区划
|
|
|
+ SysDeptJl userDept = remoteDeptJlService.selectSysDeptJlByCode(code);
|
|
|
+ if(null == sysDeptJl.getLevel()){
|
|
|
+ query.setParentId("479a446fce894740b373f9c4b356daac");
|
|
|
+ } else{
|
|
|
+ if (userDept.getLevel() == 1) {
|
|
|
+ query.setParentId(sysDeptJl.getParentId());
|
|
|
+ }else if (userDept.getLevel() == 2) {
|
|
|
+ if (sysDeptJl.getLevel() == 1){ //查二级
|
|
|
+ query.setId(userDept.getId());
|
|
|
+ }else if(sysDeptJl.getLevel() == 2){
|
|
|
+ query.setParentId(userDept.getId());
|
|
|
+ }
|
|
|
+ }else if (userDept.getLevel() == 3) {
|
|
|
+ if (sysDeptJl.getLevel() == 1){ //查二级
|
|
|
+ query.setId(userDept.getParentId());
|
|
|
+ }else if(sysDeptJl.getLevel() == 2){
|
|
|
+ query.setId(userDept.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+ List<SysDeptJl> list = remoteDeptJlService.getLists(query);
|
|
|
+ return AjaxResult.success(list);
|
|
|
}
|
|
|
|
|
|
/**
|