From 7176bede55d61172bda9d91600d7e4af1f3178cc Mon Sep 17 00:00:00 2001 From: erdanergou Date: Wed, 12 Jul 2023 10:18:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=E5=91=98=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E7=A6=BB=E8=81=8C=E4=B8=8E=E5=90=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CompanyController.java | 4 ++ .../controller/DepositoryController.java | 68 +++++++++++++------ .../DepositoryRecordController.java | 24 +++++++ .../impl/DepositoryRecordServiceImpl.java | 32 +++++++++ .../service/impl/QyWxOperationService.java | 17 ++++- .../service/impl/SplitUnitServiceImpl.java | 8 +++ 6 files changed, 130 insertions(+), 23 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 aa8ac4e9..aed58cfd 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java @@ -259,6 +259,10 @@ public class CompanyController { Integer success = 0; if (map.containsKey("depositoryId")) { for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } Map param = new HashMap<>(); param.put("userId", userByPort.getId()); param.put("depositoryId", map.get("depositoryId")); diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java index a7d989fa..1ceb6fb2 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java @@ -149,7 +149,7 @@ public class DepositoryController { HandlesOtherFunctionalThreadPool.execute(() -> RealDeleteSonDepository(id.toString(), finalUserKey, finalToken)); return CrudUtil.deleteHandle(depositoryService.deleteDepositoryRecordById(id), 1); } else if (map.containsKey("ids")) { - List ids = ObjectFormatUtil.objToList(map.get("ids"),Integer.class); + List ids = ObjectFormatUtil.objToList(map.get("ids"), Integer.class); for (Integer integer : ids) { String id = integer.toString(); HandlesOtherFunctionalThreadPool.execute(() -> RealDeleteSonDepository(id, finalUserKey, finalToken)); @@ -239,7 +239,7 @@ public class DepositoryController { return CrudUtil.deleteHandle(depositoryService.changeStateToDeletedById(id), 1); } else if (map.containsKey("ids")) { - List ids = ObjectFormatUtil.objToList(map.get("ids"),Integer.class); + List ids = ObjectFormatUtil.objToList(map.get("ids"), Integer.class); for (Integer integer : ids) { String id = integer.toString(); HandlesOtherFunctionalThreadPool.execute(() -> UpdateSonState(id, 3, true, finalUserKey, finalToken)); @@ -332,8 +332,8 @@ public class DepositoryController { // 获取本月及之前月份各种类别入/出库总量 List materialTypeAll = materialTypeService.findMaterialTypeNoParent(); Map previousMonth = DateUtil.getPreviousMonth(); - List months = ObjectFormatUtil.objToList(previousMonth.get("months"),Object.class); - List sourceList = ObjectFormatUtil.objToList(previousMonth.get("sourceList"),Object.class); + List months = ObjectFormatUtil.objToList(previousMonth.get("months"), Object.class); + List sourceList = ObjectFormatUtil.objToList(previousMonth.get("sourceList"), Object.class); for (int num = 0; num < months.size() - 1; num++) { for (MaterialType materialType : materialTypeAll) { Map parm = new HashMap<>(); @@ -583,7 +583,7 @@ public class DepositoryController { e.printStackTrace(); } if (sunburstChartData == null || sunburstChartData.size() == 0) { - sunburstChartData = ObjectFormatUtil.objToList(((Map) result).get("sunburstChartDataForInventory"),Object.class); + sunburstChartData = ObjectFormatUtil.objToList(((Map) result).get("sunburstChartDataForInventory"), Object.class); } if (lineChartData == null || lineChartData.size() == 0) { lineChartData = (Map) ((Map) result).get("inventoryLineChartData"); @@ -715,9 +715,9 @@ public class DepositoryController { // 获取本月之前的月份 Map previousMonth = DateUtil.getPreviousMonth(); // 获取月份的时间戳 - List months = ObjectFormatUtil.objToList(previousMonth.get("months"),Object.class); + List months = ObjectFormatUtil.objToList(previousMonth.get("months"), Object.class); // 获取月份名称 - List sourceList = ObjectFormatUtil.objToList(previousMonth.get("sourceList"),Object.class); + List sourceList = ObjectFormatUtil.objToList(previousMonth.get("sourceList"), Object.class); // 结果集 List> futureList = new ArrayList>(); int threadSize = months.size(); @@ -756,9 +756,9 @@ public class DepositoryController { public List getInventorySunburstData(UserByPort userByPort) { Map previousMonth = DateUtil.getPreviousMonth(); // 获取所有月份 - List months = ObjectFormatUtil.objToList(previousMonth.get("months"),Object.class); + List months = ObjectFormatUtil.objToList(previousMonth.get("months"), Object.class); // 获取月份名称 - List sourceList = ObjectFormatUtil.objToList((List) previousMonth.get("sourceList"),Object.class); + List sourceList = ObjectFormatUtil.objToList((List) previousMonth.get("sourceList"), Object.class); Calendar instance = Calendar.getInstance(); instance.add(Calendar.MONTH, 1); instance.set(Calendar.DATE, 1); @@ -806,9 +806,9 @@ public class DepositoryController { try { obj = completionService.take().get(); - Map objectMap = ObjectFormatUtil.objToMap(obj,String.class,Object.class); + Map objectMap = ObjectFormatUtil.objToMap(obj, String.class, Object.class); Integer id = ObjectFormatUtil.toInteger((objectMap).get("id")); - List inventoryByMtAndD = ObjectFormatUtil.objToList(objectMap.get("inventoryByMtAndD"),InventoryByMTAndDepository.class); + List inventoryByMtAndD = ObjectFormatUtil.objToList(objectMap.get("inventoryByMtAndD"), InventoryByMTAndDepository.class); value += ObjectFormatUtil.toDouble(objectMap.get("value")); inventoryForMTAndDepository.put(id, inventoryByMtAndD); (objectMap).remove("id"); @@ -994,19 +994,43 @@ public class DepositoryController { token = (String) request.getSession().getAttribute("userToken"); userKey = (String) request.getSession().getAttribute("userKey"); } - UserByPort userToken = AuthenticationTokenPool.getUserToken(token); - List userIdByDid = roleService.findUserIdByDid(did); - List list = new ArrayList<>(); - for (Integer integer : userIdByDid) { - UserByPort userByPort = PublicConfig.FindUserById(integer, userKey, token); - // 获取用户的用工关系 - int emptype = userByPort.getEmptype(); - if(emptype > 10){ - continue; + + // 用于查询对应的管理员权限 + Map paramForUserManager = new HashMap<>(); + paramForUserManager.put("depositoryId", did); + List list = new ArrayList<>(); + ; + List roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(paramForUserManager); + for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { + int classes = roleAndDepository.getClasses(); + Integer userId = roleAndDepository.getUserId(); + if (classes == 1) { + // 如果是对人设置的权限 + UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token); + // 获取用户的用工关系 + int emptype = userByPort.getEmptype(); + if (emptype > 10) { + continue; + } + list.add(userByPort); + } else { + // 如果是对岗位 + + // 定义用于获取当前岗位下的人的参数map + Map paramForGetUserByPost = new HashMap<>(); + paramForGetUserByPost.put("position", userId); + List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); + for (UserByPort userByPort : userByPortList) { + // 获取用户的用工关系 + int emptype = userByPort.getEmptype(); + if (emptype > 10) { + continue; + } + list.add(userByPort); + } } - UserByPortP user = new UserByPortP(userByPort); - list.add(user); } + int size = list.size(); return new RestResponse(list, size, 200); } 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 db64f2fa..52a7f477 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -480,6 +480,10 @@ public class DepositoryRecordController { paramForGetUserByPost.put("position", uid); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } String workwechat = userByPort.getWorkwechat(); if (workwechat == null || "".equals(workwechat)) { workwechat = userByPort.getWechat(); @@ -537,6 +541,10 @@ public class DepositoryRecordController { paramForGetUserByPost.put("position", uid); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserKey, finalToken); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } String workwechat = userByPort.getWorkwechat(); if (workwechat == null || "".equals(workwechat)) { workwechat = userByPort.getWechat(); @@ -1766,6 +1774,10 @@ public class DepositoryRecordController { paramForGetUserByPost.put("position", uid); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } String workwechat = userByPort.getWorkwechat(); if (workwechat == null || "".equals(workwechat)) { workwechat = userByPort.getWechat(); @@ -1826,6 +1838,10 @@ public class DepositoryRecordController { paramForGetUserByPost.put("position", uid); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } String workwechat = userByPort.getWorkwechat(); if (workwechat == null || "".equals(workwechat)) { workwechat = userByPort.getWechat(); @@ -2057,6 +2073,10 @@ public class DepositoryRecordController { paramForGetUserByPost.put("position", uid); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } String workwechat = userByPort.getWorkwechat(); if (workwechat == null || "".equals(workwechat)) { workwechat = userByPort.getWechat(); @@ -2112,6 +2132,10 @@ public class DepositoryRecordController { paramForGetUserByPost.put("position", uid); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } String workwechat = userByPort.getWorkwechat(); if (workwechat == null || "".equals(workwechat)) { workwechat = userByPort.getWechat(); diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java index 54401d4b..acb012b3 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java @@ -750,6 +750,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { paramForGetUserByPost.put("position", roleAndDepository.getUserId()); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } approverId.append(userByPort.getId()).append(","); } } @@ -785,6 +789,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { paramForGetUserByPost.put("position", uid); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } approverId.append(userByPort.getId()).append(","); } } @@ -2513,6 +2521,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 获取当前岗位对应的人员 List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort1 : userByPortList) { + int emptype = userByPort1.getEmptype(); + if(emptype > 10){ + continue; + } Integer userId1 = userByPort1.getId(); // 修改redis中用户的数据 updateRedisDataForUserManager(userId1, minRecordKey); @@ -2587,6 +2599,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { paramForGetUserByPost.put("position", roleAndDepository.getUserId()); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort1 : userByPortList) { + int emptype = userByPort1.getEmptype(); + if(emptype > 10){ + continue; + } Integer userId1 = userByPort1.getId(); // 修改redis中用户的数据 updateRedisDataForUserManager(userId1, minRecordKey); @@ -3588,6 +3604,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } Integer userId = userByPort.getId(); // 修改redis中用户的数据 updateRedisDataForUserManager(userId, minRecordKey); @@ -3671,6 +3691,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { paramForGetUserByPost.put("position", roleAndDepository.getUserId()); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } Integer userId = userByPort.getId(); // 修改redis中用户的数据 updateRedisDataForUserManager(userId, minRecordKey); @@ -4091,6 +4115,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort1 : userByPortList) { + int emptype = userByPort1.getEmptype(); + if(emptype > 10){ + continue; + } Integer userId = userByPort1.getId(); // 修改redis中用户的数据 updateRedisDataForUserManager(userId, minRecordKey); @@ -4173,6 +4201,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { paramForGetUserByPost.put("position", roleAndDepository.getUserId()); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort1 : userByPortList) { + int emptype = userByPort1.getEmptype(); + if(emptype > 10){ + continue; + } Integer userId = userByPort1.getId(); // 修改redis中用户的数据 updateRedisDataForUserManager(userId, minRecordKey); diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java index 127adb01..b7c962b6 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java @@ -1974,6 +1974,10 @@ public class QyWxOperationService { paramForGetUserByPost.put("position", userId); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } // 获取企业微信id或微信id String userByPortWorkwechat = userByPort.getWorkwechat(); if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { @@ -2029,7 +2033,10 @@ public class QyWxOperationService { paramForGetUserByPost.put("position", userId); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort : userByPortList) { - + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } // 获取企业微信id或微信id String userByPortWorkwechat = userByPort.getWorkwechat(); if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { @@ -2494,6 +2501,10 @@ public class QyWxOperationService { paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } String userByPortWorkwechat = userByPort.getWorkwechat(); if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { userByPortWorkwechat = userByPort.getWechat(); @@ -2557,6 +2568,10 @@ public class QyWxOperationService { paramForGetUserByPost.put("position", roleAndDepository.getUserId()); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } String userByPortWorkwechat = userByPort.getWorkwechat(); if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { userByPortWorkwechat = userByPort.getWechat(); 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 3c82a69e..02b29c06 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 @@ -137,6 +137,10 @@ public class SplitUnitServiceImpl implements SplitUnitService { paramForGetUserByPost.put("position", roleAndDepository.getUserId()); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } approverId.append(userByPort.getId()).append(","); } } @@ -169,6 +173,10 @@ public class SplitUnitServiceImpl implements SplitUnitService { paramForGetUserByPost.put("position", uid); List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null); for (UserByPort userByPort : userByPortList) { + int emptype = userByPort.getEmptype(); + if(emptype > 10){ + continue; + } approverId.append(userByPort.getId()).append(","); } }