From 092205ef996bf7f87b60ef365e84e9fa8917de06 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Tue, 21 Feb 2023 10:02:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=BA=E5=91=98=E4=B8=8E?= =?UTF-8?q?=E5=B2=97=E4=BD=8D=E6=96=B0=E8=B5=8B=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CompanyController.java | 62 +++++++++---------- .../controller/PageController.java | 11 ++-- .../depository_manage/pojo/PostP.java | 8 ++- .../service/impl/SplitUnitServiceImpl.java | 3 + .../templates/pages/post/post-out.html | 36 +++++------ .../templates/pages/post/postRole.html | 23 +++---- .../templates/pages/post/postRole_add.html | 12 +--- 7 files changed, 73 insertions(+), 82 deletions(-) diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java b/src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java index 082cd35b..01bfd460 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java @@ -190,40 +190,36 @@ public class CompanyController { List userByPortList = LinkInterfaceUtil.FindUserByMap(userParam, userToken); Integer success = 0; if (map.containsKey("depositoryId")) { - for (int i = 0; i < userByPortList.size(); i++) { + for (UserByPort userByPort : userByPortList) { Map param = new HashMap<>(); - param.put("userId", userByPortList.get(i).getId()); + param.put("userId", userByPort.getId()); param.put("depositoryId", map.get("depositoryId")); - param.put("classes", 2); + param.put("classes", map.get("classes")); List roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); - if (roleAndDepositoryByCondition.size() > 0) { - continue; - } else { + if (roleAndDepositoryByCondition.size() <= 0) { Map insert = new HashMap<>(); - insert.put("classes", 2); + insert.put("classes", map.get("classes")); insert.put("authority", 0); insert.put("depositoryId", map.get("depositoryId")); - insert.put("userid", userByPortList.get(i).getId()); + insert.put("userid", userByPort.getId()); success += roleService.addUserOrPostRoleAndDepository(insert); } } } else { List depositoryAll = depositoryService.findDepositoryAll(); - for (int i = 0; i < depositoryAll.size(); i++) { - for (int j = 0; j < userByPortList.size(); j++) { + for (Depository depository : depositoryAll) { + for (UserByPort userByPort : userByPortList) { Map param = new HashMap<>(); - param.put("userId", userByPortList.get(j).getId()); - param.put("depositoryId", depositoryAll.get(i).getId()); - param.put("classes", 2); + param.put("userId", userByPort.getId()); + param.put("depositoryId", depository.getId()); + param.put("classes", map.get("classes")); List roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); - if (roleAndDepositoryByCondition.size() > 0) { - continue; - } else { + if (roleAndDepositoryByCondition.size() <= 0) { Map insert = new HashMap<>(); - insert.put("classes", 2); + insert.put("classes", map.get("classes")); insert.put("authority", 0); - insert.put("depositoryId", depositoryAll.get(i).getId()); - insert.put("userid", userByPortList.get(j).getId()); + insert.put("depositoryId", depository.getId()); + insert.put("userid", userByPort.getId()); success += roleService.addUserOrPostRoleAndDepository(insert); } } @@ -272,11 +268,11 @@ public class CompanyController { Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); Map param = new HashMap<>(); param.put("depositoryId", depositoryId); - param.put("classes", 2); + param.put("classes", map.get("classes")); List roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); Integer success = 0; - for (int i = 0; i < roleAndDepositoryByCondition.size(); i++) { - success += roleService.deleteRoleAndDepositoryById(roleAndDepositoryByCondition.get(i).getId()); + for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { + success += roleService.deleteRoleAndDepositoryById(roleAndDepository.getId()); } return CrudUtil.postHandle(success, roleAndDepositoryByCondition.size()); } else if (map.containsKey("depositoryIds")) { @@ -284,15 +280,14 @@ public class CompanyController { List depositoryIds = (List) map.get("depositoryIds"); Integer success = 0; Integer total = 0; - for (int i = 0; i < depositoryIds.size(); i++) { - Integer depositoryId = depositoryIds.get(i); + for (Integer depositoryId : depositoryIds) { Map param = new HashMap<>(); param.put("depositoryId", depositoryId); - param.put("classes", 2); + param.put("classes", map.get("classes")); List roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); total += roleAndDepositoryByCondition.size(); - for (int j = 0; j < roleAndDepositoryByCondition.size(); j++) { - success += roleService.deleteRoleAndDepositoryById(roleAndDepositoryByCondition.get(j).getId()); + for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { + success += roleService.deleteRoleAndDepositoryById(roleAndDepository.getId()); } } return CrudUtil.postHandle(success, total); @@ -304,28 +299,29 @@ public class CompanyController { /** * 查询岗位对应的权限 * - * @param postId 要查询的岗位id + * @param map 要查询的调剂 * @return */ @GetMapping("/findPostRole") - public RestResponse findPostRole(@RequestParam("postId") Integer postId, HttpServletRequest request) { + public RestResponse findPostRole(@RequestParam Map map, HttpServletRequest request) { UserByPort userToken = (UserByPort) request.getAttribute("userToken"); Map userParam = new HashMap<>(); + Integer postId = ObjectFormatUtil.toInteger(map.get("postId")); userParam.put("position", postId); List userByPortList = LinkInterfaceUtil.FindUserByMap(userParam, userToken); Post postById = LinkInterfaceUtil.findPostById(postId, userToken); List roleAndDepositoryByCondition = new ArrayList<>(); if (userByPortList.size() != 0) { Map param = new HashMap<>(); - param.put("classes", 2); + param.put("classes", map.get("classes")); param.put("userId", userByPortList.get(0).getId()); roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); } List postPS = new ArrayList<>(); - for (int i = 0; i < roleAndDepositoryByCondition.size(); i++) { + for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { PostP pp = new PostP(postById); - pp.setDepositoryName(roleAndDepositoryByCondition.get(i).getDepositoryName()); - pp.setDepositoryId(roleAndDepositoryByCondition.get(i).getDepositoryId()); + pp.setDepositoryName(roleAndDepository.getDepositoryName()); + pp.setDepositoryId(roleAndDepository.getDepositoryId()); postPS.add(pp); } return new RestResponse(postPS, postPS.size(), 200); diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java index 82229878..3f6bd0fe 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -1265,9 +1265,10 @@ public class PageController { } @GetMapping("/postRoleView") - public ModelAndView findPostRoleView(Integer id) { + public ModelAndView findPostRoleView(Integer id,Integer classes) { ModelAndView mv = new ModelAndView(); mv.addObject("postId", id); + mv.addObject("classes", classes); mv.setViewName("pages/post/postRole"); return mv; } @@ -2009,8 +2010,8 @@ public class PageController { list = new JSONArray(); } List postList = new ArrayList<>(); - for (int i = 0; i < list.size(); i++) { - Post object = JSONObject.toJavaObject((JSONObject) list.get(i), Post.class); + for (Object o : list) { + Post object = JSONObject.toJavaObject((JSONObject) o, Post.class); postList.add(object); } mv.addObject("postList", postList); @@ -2081,13 +2082,13 @@ public class PageController { // 跳转到添加权限界面 @GetMapping("/postRoleAdd") - public ModelAndView PostRoleAdd(Integer id, HttpServletRequest request) { + public ModelAndView PostRoleAdd(Integer id,Integer classes, HttpServletRequest request) { UserByPort userToken = (UserByPort) request.getAttribute("userToken"); ModelAndView mv = new ModelAndView(); mv.setViewName("pages/post/postRole_add"); Post postById = LinkInterfaceUtil.findPostById(id, userToken); mv.addObject("post", postById); - mv.addObject("depositories", depositoryService.findDepositoryAll()); + mv.addObject("classes", classes); return mv; } diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/PostP.java b/src/main/java/com/dreamchaser/depository_manage/pojo/PostP.java index e3bcf83d..483b3865 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/PostP.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/PostP.java @@ -7,7 +7,7 @@ import lombok.Data; public class PostP { /** - * id + * 岗位id */ private Integer id; /** @@ -34,6 +34,12 @@ public class PostP { private String dutiesname; + /** + * 权限id + */ + private Integer prid; + + /** * 归属行政组织名称 */ diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java index 021c6714..d0f9ac95 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java @@ -306,6 +306,9 @@ public class SplitUnitServiceImpl implements SplitUnitService { } + + + /** * 用于计算当前拆单单位与目标拆单单位之间的进率 * diff --git a/src/main/resources/templates/pages/post/post-out.html b/src/main/resources/templates/pages/post/post-out.html index 586fb4e7..112e9aee 100644 --- a/src/main/resources/templates/pages/post/post-out.html +++ b/src/main/resources/templates/pages/post/post-out.html @@ -57,6 +57,7 @@ 子类别 详情 设置权限 + 入库审核权 @@ -106,16 +107,7 @@ {field: 'depositoryName', width: 200, title: '管理仓库'}, {field: 'superiorname', width: 200, title: '上级名称'}, {field: 'departmentname', width: 200, title: '部门'}, - { - field: 'state', title: '状态', minWidth: 80, templet: function (d) { - if (d.state == 1) { - return "启用"; - } else if (d.state == 2) { - return "禁用"; - } - } - }, - {title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"} + {title: '操作', width: 300, toolbar: '#currentTableBar', align: "center"} ] ], limits: [10, 15, 20, 25, 50,100], @@ -186,17 +178,23 @@ layer.full(index); }); return false; - } else if (obj.event == 'add_role') { + } else if (obj.event === 'add_role') { - /*var index = layer.open({ - title: '设置权限', + var index = layer.open({ type: 2, - shade: 0.2, - maxmin: true, + title: '权限信息', shadeClose: true, - area: ['100%', '100%'], - content: '/postRoleAdd?id='+data.id - });*/ + shade: false, + maxmin: true, //开启最大化最小化按钮 + area: ['893px', '600px'], + content: '/postRoleView?id=' + data.id+'&classes=2' + }); + $(window).on("resize", function () { + layer.full(index); + }); + return false; + }else if (obj.event === 'addRoleIn') { + var index = layer.open({ type: 2, title: '权限信息', @@ -204,7 +202,7 @@ shade: false, maxmin: true, //开启最大化最小化按钮 area: ['893px', '600px'], - content: '/postRoleView?id=' + data.id + content: '/postRoleView?id=' + data.id+'&classes=4' }); $(window).on("resize", function () { layer.full(index); diff --git a/src/main/resources/templates/pages/post/postRole.html b/src/main/resources/templates/pages/post/postRole.html index d8745589..a7a76f98 100644 --- a/src/main/resources/templates/pages/post/postRole.html +++ b/src/main/resources/templates/pages/post/postRole.html @@ -13,6 +13,7 @@
+