From d19682b5edc68ba1cff8924be64c58fd08d4ef46 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Tue, 21 Feb 2023 09:15:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=A5=E5=BA=93=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E4=BB=93=E5=BA=93=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../depository_manage/config/QyWxConfig.java | 4 +- .../DepositoryRecordController.java | 20 +- .../controller/PageController.java | 32 ++- .../controller/UserController.java | 36 ++- .../mapper/DepositoryRecordMapper.java | 10 + .../mapper/DepositoryRecordMapper.xml | 13 + .../impl/DepositoryRecordServiceImpl.java | 91 +------ .../service/impl/QyWxOperationService.java | 64 ++--- .../service/impl/SplitUnitServiceImpl.java | 38 ++- .../pages/application/application-in.html | 2 +- .../templates/pages/user/table-user.html | 51 ++-- .../templates/pages/user/user-add.html | 12 +- .../templates/pages/user/user-email.html | 247 ------------------ .../templates/pages/user/user-role-edit.html | 17 +- .../templates/pages/user/userRole.html | 14 +- .../templates/pages/user/userRoleForIn.html | 204 +++++++++++++++ .../depository_manage/TestOther.java | 5 + 17 files changed, 367 insertions(+), 493 deletions(-) delete mode 100644 src/main/resources/templates/pages/user/user-email.html create mode 100644 src/main/resources/templates/pages/user/userRoleForIn.html diff --git a/src/main/java/com/dreamchaser/depository_manage/config/QyWxConfig.java b/src/main/java/com/dreamchaser/depository_manage/config/QyWxConfig.java index c7c954aa..59176a07 100644 --- a/src/main/java/com/dreamchaser/depository_manage/config/QyWxConfig.java +++ b/src/main/java/com/dreamchaser/depository_manage/config/QyWxConfig.java @@ -55,8 +55,8 @@ public class QyWxConfig { // 企业微信库存盘点审批模板Id public static String stockTaking_approval_template_id = "C4RbNbd7KYKHGXimVTc5rkNdVWT92JURzoU4KTgbw"; - // 企业微信出库审批模板Id - public static String isTrue_out_approval_template_id = "3WKiKVEcnH2dsARvP18hwkApF1Ku5dbNd7txbZCS"; + // 企业微信入库审批模板Id + public static String in_approval_template_id = "3WKiKVEcnH2dsARvP18hwkApF1Ku5dbNd7txbZCS"; // 用于jsapi的url diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java index 55b81559..b27b39b6 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -188,6 +188,9 @@ public class DepositoryRecordController { Integer integer = 0; map.put("applicantId", userToken.getId()); Map result = new HashMap<>(); + // 定义列表用于储存入库单id + List recordIds = new ArrayList<>(); + if (params.size() < 1 && map.size() > 3) { String unit = (String) (map.get("unit")); if (!"-1".equals(unit)) { @@ -195,6 +198,7 @@ public class DepositoryRecordController { Integer addSplitInventory = splitUnitService.addSplitInventory(map); if (addSplitInventory != -1) { integer += addSplitInventory; + recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); } } else { // 获取库位id @@ -202,18 +206,20 @@ public class DepositoryRecordController { if (placeId == 0) {// 如果插入到仓库 map.put("placeId", 0); // 到默认库位 integer += depositoryRecordService.applicationInPlace(map); + recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); } else { // 如果具体到库位 Integer flag = depositoryRecordService.applicationInPlace(map); if (flag != -1) { integer += flag; + recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); } } } } else { List errMsg = new ArrayList<>(); List successMsg = new ArrayList<>(); - for (int i = 0; i < params.size(); i++) { - Integer temp = ObjectFormatUtil.toInteger(params.get(i)); + for (Integer param : params) { + Integer temp = ObjectFormatUtil.toInteger(param); Map insert = new HashMap<>(); Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId" + temp)); insert.put("applicantId", userToken.getId()); @@ -233,6 +239,7 @@ public class DepositoryRecordController { Integer addSplitInventory = splitUnitService.addSplitInventory(insert); if (addSplitInventory != -1) { integer += addSplitInventory; + recordIds.add(ObjectFormatUtil.toInteger(insert.get("applicationInId"))); successMsg.add(insert); } else { errMsg.add(insert); @@ -246,6 +253,8 @@ public class DepositoryRecordController { } else { integer += add; successMsg.add(insert); + recordIds.add(ObjectFormatUtil.toInteger(insert.get("applicationInId"))); + } } else {// 如果具体到库位 insert.put("placeId", placeId); @@ -255,6 +264,8 @@ public class DepositoryRecordController { errMsg.add(insert); } else { integer += flag; + recordIds.add(ObjectFormatUtil.toInteger(insert.get("applicationInId"))); + } } } @@ -266,6 +277,7 @@ public class DepositoryRecordController { if (addSplitInventory != -1) { integer += addSplitInventory; successMsg.add(map); + recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); } else { errMsg.add(map); } @@ -280,6 +292,8 @@ public class DepositoryRecordController { } else { integer += add; successMsg.add(map); + recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); + } } else { // 如果具体到库位 Integer flag = depositoryRecordService.applicationInPlace(map); @@ -288,6 +302,7 @@ public class DepositoryRecordController { errMsg.add(map); } else { integer += flag; + recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); } } } @@ -295,6 +310,7 @@ public class DepositoryRecordController { result.put("err", errMsg); result.put("success", successMsg); } + if (integer != 0 && params.size() < 1 && integer != -1) { return CrudUtil.postHandle(integer, 1); } else if (integer != 0 && params.size() > 0) { 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 ee789fb2..82229878 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -807,7 +807,6 @@ public class PageController { mv.setViewName("pages/user/table-user"); List administrationPList = findAllCompany(userToken); mv.addObject("administrationPList", administrationPList); - mv.addObject("users", userService.findUserPsByCondition(new HashMap<>())); return mv; } @@ -1052,14 +1051,14 @@ public class PageController { @GetMapping("/user_add") - public ModelAndView user_add(Integer userId, HttpServletRequest request) { + public ModelAndView user_add(Integer userId,Integer classes, HttpServletRequest request) { UserByPort userToken = (UserByPort) request.getAttribute("userToken"); ModelAndView mv = new ModelAndView(); mv.setViewName("pages/user/user-add"); UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userToken); UserByPortP userByPortP = new UserByPortP(userByPort); mv.addObject("userByPort", userByPortP); - mv.addObject("depositories", depositoryService.findDepositoryAll()); + mv.addObject("classes", classes); return mv; } @@ -1078,7 +1077,6 @@ public class PageController { mv.addObject("userByPort", userByPortP); mv.addObject("roleId", roleAndDepositoryById.getId()); mv.addObject("depositoryId", roleAndDepositoryById.getDepositoryId()); - mv.addObject("depositories", depositoryService.findDepositoryAll()); return mv; } @@ -1240,6 +1238,11 @@ public class PageController { return mv; } + /** + * 用于跳转到仓库管理员 + * @param id + * @return + */ @GetMapping("/userRoleView") public ModelAndView finduserRoleView(Integer id) { ModelAndView mv = new ModelAndView(); @@ -1248,6 +1251,19 @@ public class PageController { return mv; } + /** + * 用于跳转到入库申请审核时的赋权 + * @param id + * @return + */ + @GetMapping("/userRoleInView") + public ModelAndView finduserRoleInView(Integer id) { + ModelAndView mv = new ModelAndView(); + mv.addObject("userId", id); + mv.setViewName("pages/user/userRoleForIn"); + return mv; + } + @GetMapping("/postRoleView") public ModelAndView findPostRoleView(Integer id) { ModelAndView mv = new ModelAndView(); @@ -1864,14 +1880,6 @@ public class PageController { return mv; } - @GetMapping("/user_email") - public ModelAndView user_email(HttpServletRequest request) { - ModelAndView mv = new ModelAndView(); - mv.setViewName("pages/user/user-email"); - UserToken userToken = (UserToken) request.getAttribute("userToken"); - mv.addObject("email", userToken.getUser().getEmail()); - return mv; - } public List findAllCompany(UserByPort userByPort) { diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/UserController.java b/src/main/java/com/dreamchaser/depository_manage/controller/UserController.java index e48c7aad..39b7b5a4 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/UserController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/UserController.java @@ -287,16 +287,14 @@ public class UserController { * @return */ /** - * {id: "4323", authority: "1", depositoryId: "20"} * @param map * @return */ @PostMapping("/sys/user_role") public RestResponse addUser(@RequestBody Map map) { - map.put("classes",1); Map param = new HashMap<>(); param.put("userId",map.get("userid")); - param.put("classes",1); + param.put("classes",map.get("classes")); if(map.containsKey("depositoryId")){ param.put("depositoryId",map.get("depositoryId")); List roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); @@ -308,14 +306,12 @@ public class UserController { }else{ List depositoryAll = depositoryService.findDepositoryAll(); Integer success = 0; - for (int i = 0; i < depositoryAll.size(); i++) { - param.put("depositoryId",depositoryAll.get(i).getId()); - map.put("depositoryId",depositoryAll.get(i).getId()); + for (Depository depository : depositoryAll) { + param.put("depositoryId", depository.getId()); + map.put("depositoryId", depository.getId()); List roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); - if(roleAndDepositoryByCondition.size() > 0){ - continue; - }else{ - success += roleService.addUserOrPostRoleAndDepository(map); + if (roleAndDepositoryByCondition.size() <= 0) { + success += roleService.addUserOrPostRoleAndDepository(map); } } return CrudUtil.postHandle(success,depositoryAll.size()); @@ -325,8 +321,6 @@ public class UserController { @PostMapping("/sys/userRole_edit") public RestResponse editUserRole(@RequestBody Map map) { - RoleAndDepository roleId = roleService.findRoleAndDepositoryById(ObjectFormatUtil.toInteger(map.get("roleId"))); - map.put("classes",1); return CrudUtil.postHandle(roleService.UpdateRoleAndDepositoryById(map),1); } @@ -478,18 +472,15 @@ public class UserController { } @GetMapping("/findUserRole") - public RestResponse findUserRole(@RequestParam("userId") Integer userId,HttpServletRequest request){ - Map param = new HashMap<>(); + public RestResponse findUserRole(@RequestParam Map map,HttpServletRequest request){ UserByPort userToken = (UserByPort) request.getAttribute("userToken"); - param.put("classes",1); - param.put("userId",userId); List userByPortPList = new ArrayList<>(); - List roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param); - for (int i = 0; i < roleAndDepositoryByCondition.size(); i++) { - UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndDepositoryByCondition.get(i).getUserId(),userToken); + List roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(map); + for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { + UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndDepository.getUserId(), userToken); UserByPortP up = new UserByPortP(userByPort); - up.setId(roleAndDepositoryByCondition.get(i).getId()); - up.setDepositoryName(roleAndDepositoryByCondition.get(i).getDepositoryName()); + up.setId(roleAndDepository.getId()); + up.setDepositoryName(roleAndDepository.getDepositoryName()); userByPortPList.add(up); } return new RestResponse(userByPortPList, userByPortPList.size(), 200); @@ -497,4 +488,7 @@ public class UserController { + + + } diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java b/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java index a2957ef6..5f8ff620 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java @@ -74,6 +74,13 @@ public interface DepositoryRecordMapper { * @return */ List findApplicationInRecordPAll(); + + /** + * 根据主键id列表获取入库订单列表 + * @param ids + * @return + */ + List findApplicationInRecordsByIds(List ids); /** * 查找所有入库记录 * @return @@ -176,6 +183,9 @@ public interface DepositoryRecordMapper { */ Integer findApplicationInRecordByDate(Map map); + + + /** * 获取一段时间内的出库额度 * diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml index 03bb5ea8..3780fd6c 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml @@ -622,6 +622,19 @@ from applicationInRecordInfo + + + + -
- -
- -
-
@@ -117,28 +108,17 @@ {field: 'name', width: 100, title: '姓名'}, { field: 'gender', width: 80, title: '性别', templet: function (d) { - if (d.gender == 1) { + if (d.gender === 1) { return "男性"; - } else if (d.gender == 2) { + } else if (d.gender === 2) { return "女性"; - } else if (d.gender == 3) { + } else if (d.gender === 3) { return "中性"; } else { return ""; } } }, - { - field: 'state', title: '状态', minWidth: 80, templet: function (d) { - if (d.state == 1) { - return "启用"; - } else if (d.state == 2) { - return "禁用"; - } else { - return ""; - } - } - }, { field: 'health', title: '健康状况', minWidth: 160, templet: function (d) { switch (d.health) { @@ -157,14 +137,13 @@ } } }, - {field: 'depositoryName', width: 200, title: '管理仓库'}, {field: 'mobilephone', width: 200, title: '内线电话'}, {field: 'companyname', width: 200, title: '公司名称'}, {field: 'maindeparmentname', width: 200, title: '主部门'}, {field: 'sunmaindeparmentname', width: 200, title: '岗位'}, {field: 'workpostname', width: 200, title: '工段'}, {field: 'positionname', width: 200, title: '职位'}, - {title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"} + {title: '操作', width: 300, toolbar: '#currentTableBar', align: "center"} ] ], limits: [10, 15, 20, 25, 50, 100], @@ -188,10 +167,7 @@ if (data.adminorg !== '') { req.adminorg = data.adminorg; } - if (data.state != '') { - req.state = data.state; - } - if (data.number != '') { + if (data.number !== '') { req.number = data.number; } //执行搜索重载 @@ -250,7 +226,7 @@ layer.full(index); }); return false; - } else if (obj.event == 'add_role') { + } else if (obj.event === 'add_role') { layer.open({ type: 2, title: '权限信息', @@ -260,6 +236,19 @@ area: ['70%', '70%'], content: '/userRoleView?id=' + data.id }); + }else if(obj.event === 'addRoleForIn'){ + var index1 = layer.open({ + title: '权限信息', + type: 2, + shade: 0.2, + maxmin: true, + shadeClose: true, + area: ['70%', '70%'], + content: '/userRoleInView?id=' + data.id, + }); + $(window).on("resize", function () { + layer.full(index1); + }); } }); diff --git a/src/main/resources/templates/pages/user/user-add.html b/src/main/resources/templates/pages/user/user-add.html index bbc6da98..2391328e 100644 --- a/src/main/resources/templates/pages/user/user-add.html +++ b/src/main/resources/templates/pages/user/user-add.html @@ -17,6 +17,7 @@
+
@@ -24,15 +25,6 @@ 填写自己管理账号的名称。
-
@@ -110,7 +102,7 @@ }) } } - }) + }); return false; }); diff --git a/src/main/resources/templates/pages/user/user-email.html b/src/main/resources/templates/pages/user/user-email.html deleted file mode 100644 index ff41aa76..00000000 --- a/src/main/resources/templates/pages/user/user-email.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - 分步表单 - - - - - - - - -
-
-
-
-
- -
-
-

说明


- 验证码五分钟后会失效,请及时输入。 -
-
-
- -
-
-
- - - - - \ No newline at end of file diff --git a/src/main/resources/templates/pages/user/user-role-edit.html b/src/main/resources/templates/pages/user/user-role-edit.html index b9dc907e..01cbc1b4 100644 --- a/src/main/resources/templates/pages/user/user-role-edit.html +++ b/src/main/resources/templates/pages/user/user-role-edit.html @@ -25,22 +25,9 @@ 填写自己管理账号的名称。
-
- @@ -106,7 +93,7 @@ layer.msg(data.statusInfo.message);//失败的表情 return; } else { - layer.msg("申请提交成功", { + layer.msg("修改成功", { icon: 6,//成功的表情 time: 500 //1秒关闭(如果不配置,默认是3秒) },function(){ @@ -115,7 +102,7 @@ }) } } - }) + }); return false; }); diff --git a/src/main/resources/templates/pages/user/userRole.html b/src/main/resources/templates/pages/user/userRole.html index 66daa690..69aa45ec 100644 --- a/src/main/resources/templates/pages/user/userRole.html +++ b/src/main/resources/templates/pages/user/userRole.html @@ -36,8 +36,7 @@ //第一个实例 table.render({ elem: '#demo' - , height: 312 - , url: 'findUserRole?userId=' + userId, //数据接口 + , url: 'findUserRole?userId=' + userId+'&classes=1', //数据接口 parseData: function (res) { //res 即为原始返回的数据 return { "status": res.status, //解析接口状态 @@ -65,15 +64,6 @@ {field: 'depositoryName', width: 200, title: '仓库名称', sort: true}, {field: 'number', width: 100, title: '工号', sort: true}, {field: 'name', width: 100, title: '姓名', sort: true}, - { - field: 'state', title: '状态', minWidth: 80, sort: true, templet: function (d) { - if (d.state == 1) { - return "启用"; - } else if (d.state == 2) { - return "禁用"; - } - } - }, {field: 'mobilephone', width: 200, title: '内线电话', sort: true}, {field: 'companyname', width: 200, title: '公司名称', sort: true}, {field: 'maindeparmentname', width: 200, title: '主部门', sort: true}, @@ -152,7 +142,7 @@ maxmin:true, shadeClose: true, area: ['100%', '100%'], - content: '/user_add?userId='+userId, + content: '/user_add?userId='+userId+'&classes=1', end:function () { location.reload() } diff --git a/src/main/resources/templates/pages/user/userRoleForIn.html b/src/main/resources/templates/pages/user/userRoleForIn.html new file mode 100644 index 00000000..076836cb --- /dev/null +++ b/src/main/resources/templates/pages/user/userRoleForIn.html @@ -0,0 +1,204 @@ + + + + + layui + + + + + + + + +
+ + +
+ + + +
+ + + + \ No newline at end of file diff --git a/src/test/java/com/dreamchaser/depository_manage/TestOther.java b/src/test/java/com/dreamchaser/depository_manage/TestOther.java index ebfc0f89..88e7cf0a 100644 --- a/src/test/java/com/dreamchaser/depository_manage/TestOther.java +++ b/src/test/java/com/dreamchaser/depository_manage/TestOther.java @@ -148,4 +148,9 @@ public class TestOther { } + + + + } +