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 edb29def..e42522cb 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -1576,13 +1576,38 @@ public class DepositoryRecordController { StringBuilder sb = new StringBuilder(); for (RoleAndMaterialType mt : materialTypeIdForIn ) { - // 获取管理员数据 - UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), finalUserkey, finalUsertoken); - String workwechat = userByPort.getWorkwechat(); - if (workwechat == null || "".equals(workwechat)) { - workwechat = userByPort.getWechat(); + // 获取权限类型 + int classes = mt.getClasses(); + // 获取权限赋值的uid + Integer uid = mt.getUid(); + if (classes == 1) { + // 如果是针对人 + + // 获取管理员数据 + UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserkey, finalUsertoken); + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } else { + // 如果是对岗位 + + + // 定义用于获取当前岗位下的人的参数map + Map paramForGetUserByPost = new HashMap<>(); + paramForGetUserByPost.put("position", uid); + List userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); + for (UserByPort userByPort : userByPortList) { + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } + } - sb.append(workwechat).append(","); + } JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserkey, finalUsertoken); String sp_no = jsonObject.getString("sp_no"); @@ -1607,13 +1632,36 @@ public class DepositoryRecordController { StringBuilder sb = new StringBuilder(); for (RoleAndDepository mt : materialTypeIdForIn ) { - // 获取管理员数据 - UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), finalUserkey, finalUsertoken); - String workwechat = userByPort.getWorkwechat(); - if (workwechat == null || "".equals(workwechat)) { - workwechat = userByPort.getWechat(); + + // 获取权限类型 + int classes = mt.getClasses(); + Integer uid = mt.getUserId(); + if (classes == 1) { + // 如果是对人 + + // 获取管理员数据 + UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserkey, finalUsertoken); + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } else { + // 如果是岗位 + + // 定义用于获取当前岗位下的人的参数map + Map paramForGetUserByPost = new HashMap<>(); + paramForGetUserByPost.put("position", uid); + List userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); + for (UserByPort userByPort : userByPortList) { + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } } - sb.append(workwechat).append(","); + } JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserkey, finalUsertoken); String sp_no = jsonObject.getString("sp_no"); @@ -1819,13 +1867,32 @@ public class DepositoryRecordController { StringBuilder sb = new StringBuilder(); for (RoleAndMaterialType mt : materialTypeIdForIn ) { - // 获取管理员数据 - UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), finalUserkey, finalUsertoken); - String workwechat = userByPort.getWorkwechat(); - if (workwechat == null || "".equals(workwechat)) { - workwechat = userByPort.getWechat(); + + int classes = mt.getClasses(); + Integer uid = mt.getUid(); + if (classes == 1) { + // 获取管理员数据 + UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserkey, finalUsertoken); + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } else { + // 定义用于获取当前岗位下的人的参数map + Map paramForGetUserByPost = new HashMap<>(); + paramForGetUserByPost.put("position", uid); + List userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); + for (UserByPort userByPort : userByPortList) { + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } } - sb.append(workwechat).append(","); + + } JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserkey, finalUsertoken); String sp_no = jsonObject.getString("sp_no"); @@ -1850,13 +1917,32 @@ public class DepositoryRecordController { StringBuilder sb = new StringBuilder(); for (RoleAndDepository mt : materialTypeIdForIn ) { - // 获取管理员数据 - UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), finalUserkey, finalUsertoken); - String workwechat = userByPort.getWorkwechat(); - if (workwechat == null || "".equals(workwechat)) { - workwechat = userByPort.getWechat(); + + int classes = mt.getClasses(); + Integer uid = mt.getUserId(); + if (classes == 1) { + // 获取管理员数据 + UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserkey, finalUsertoken); + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } else { + // 定义用于获取当前岗位下的人的参数map + Map paramForGetUserByPost = new HashMap<>(); + paramForGetUserByPost.put("position", uid); + List userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); + for (UserByPort userByPort : userByPortList) { + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } } - sb.append(workwechat).append(","); + + } JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserkey, finalUsertoken); String sp_no = jsonObject.getString("sp_no"); 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 64e12e7f..222f3e72 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 @@ -229,7 +229,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { public Integer insertApplicationOutRecord(Map map, UserByPort userToken, String userKey, String token) { String placeId = ""; Object temp = map.get("placeId"); - String depositoryId = (String) map.get("depositoryId"); + String depositoryId = map.get("depositoryId").toString(); if (depositoryId == null || "".equals(depositoryId)) { map.put("flagForOpenDepository", 1); map.remove("depositoryId"); @@ -918,7 +918,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { public Integer insertApplicationOutMin(Map map) { // 获取当前出库库存id Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); - String depositoryId = (String) map.get("depositoryId"); + String depositoryId = map.get("depositoryId").toString(); // 获取当前出库库存记录 Inventory inventoryById = materialMapper.findInventoryById(mid); if (depositoryId == null || "".equals(depositoryId)) {