|
|
|
@ -1806,20 +1806,43 @@ public class QyWxOperationService { |
|
|
|
if (!flag) { |
|
|
|
for (Long mtId : materialTypeIdList |
|
|
|
) { |
|
|
|
// 获取当前仓库的管理员列表
|
|
|
|
List<Integer> userIdByDid = roleMapper.findUserIdByMtId(mtId); |
|
|
|
// 获取当前管理员的企业微信userId
|
|
|
|
List<String> qywxUserIdList = new ArrayList<>(); |
|
|
|
for (Integer userId : userIdByDid |
|
|
|
) { |
|
|
|
// 获取对应管理员信息
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userKey, token); |
|
|
|
String user = userByPort.getWorkwechat(); |
|
|
|
if (user == null || "".equals(user)) { |
|
|
|
user = userByPort.getWechat(); |
|
|
|
|
|
|
|
// 用于查询对应的管理员权限
|
|
|
|
Map<String, Object> paramForUserManager = new HashMap<>(); |
|
|
|
paramForUserManager.put("mtid", mtId); |
|
|
|
|
|
|
|
List<RoleAndMaterialType> roleAndMaterialTypeByCondition = roleMapper.findRoleAndMaterialTypeByCondition(paramForUserManager); |
|
|
|
for (RoleAndMaterialType roleAndMaterialType : roleAndMaterialTypeByCondition) { |
|
|
|
int classes = roleAndMaterialType.getClasses(); |
|
|
|
Integer userId = roleAndMaterialType.getUid(); |
|
|
|
if (classes == 1) { |
|
|
|
// 如果是对人设置的权限
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userKey, token); |
|
|
|
String user = userByPort.getWorkwechat(); |
|
|
|
if (user == null || "".equals(user)) { |
|
|
|
user = userByPort.getWechat(); |
|
|
|
} |
|
|
|
qywxUserIdList.add(user); |
|
|
|
} else { |
|
|
|
// 如果是对岗位
|
|
|
|
|
|
|
|
// 定义用于获取当前岗位下的人的参数map
|
|
|
|
Map<String, Object> paramForGetUserByPost = new HashMap<>(); |
|
|
|
paramForGetUserByPost.put("position", userId); |
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); |
|
|
|
for (UserByPort userByPort : userByPortList) { |
|
|
|
// 获取企业微信id或微信id
|
|
|
|
String userByPortWorkwechat = userByPort.getWorkwechat(); |
|
|
|
if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { |
|
|
|
userByPortWorkwechat = userByPort.getWechat(); |
|
|
|
} |
|
|
|
qywxUserIdList.add(userByPortWorkwechat); |
|
|
|
} |
|
|
|
} |
|
|
|
qywxUserIdList.add(user); |
|
|
|
} |
|
|
|
|
|
|
|
if (qywxUserIdList.size() > 0) { |
|
|
|
// 用于设置仓库管理员流程
|
|
|
|
Approval_template_approver approval_template_approver_depository_manager = new Approval_template_approver(); |
|
|
|
@ -1833,20 +1856,44 @@ public class QyWxOperationService { |
|
|
|
for (Integer depositoryId : depositoryIdList |
|
|
|
|
|
|
|
) { |
|
|
|
// 获取当前仓库的管理员列表
|
|
|
|
List<Integer> userIdByDid = roleMapper.findUserIdByDid(depositoryId); |
|
|
|
// 获取当前管理员的企业微信userId
|
|
|
|
List<String> qywxUserIdList = new ArrayList<>(); |
|
|
|
for (Integer userId : userIdByDid |
|
|
|
) { |
|
|
|
// 获取对应管理员信息
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userKey, token); |
|
|
|
String user = userByPort.getWorkwechat(); |
|
|
|
if (user == null || "".equals(user)) { |
|
|
|
user = userByPort.getWechat(); |
|
|
|
|
|
|
|
// 用于查询对应的管理员权限
|
|
|
|
Map<String, Object> paramForUserManager = new HashMap<>(); |
|
|
|
paramForUserManager.put("depositoryId", depositoryId); |
|
|
|
|
|
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleMapper.findRoleAndDepositoryByCondition(paramForUserManager); |
|
|
|
for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { |
|
|
|
int classes = roleAndDepository.getClasses(); |
|
|
|
Integer userId = roleAndDepository.getUserId(); |
|
|
|
if (classes == 1) { |
|
|
|
// 如果是对人设置的权限
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userKey, token); |
|
|
|
String user = userByPort.getWorkwechat(); |
|
|
|
if (user == null || "".equals(user)) { |
|
|
|
user = userByPort.getWechat(); |
|
|
|
} |
|
|
|
qywxUserIdList.add(user); |
|
|
|
} else { |
|
|
|
// 如果是对岗位
|
|
|
|
|
|
|
|
// 定义用于获取当前岗位下的人的参数map
|
|
|
|
Map<String, Object> paramForGetUserByPost = new HashMap<>(); |
|
|
|
paramForGetUserByPost.put("position", userId); |
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); |
|
|
|
for (UserByPort userByPort : userByPortList) { |
|
|
|
|
|
|
|
// 获取企业微信id或微信id
|
|
|
|
String userByPortWorkwechat = userByPort.getWorkwechat(); |
|
|
|
if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { |
|
|
|
userByPortWorkwechat = userByPort.getWechat(); |
|
|
|
} |
|
|
|
qywxUserIdList.add(userByPortWorkwechat); |
|
|
|
} |
|
|
|
} |
|
|
|
qywxUserIdList.add(user); |
|
|
|
} |
|
|
|
|
|
|
|
if (qywxUserIdList.size() > 0) { |
|
|
|
// 用于设置仓库管理员流程
|
|
|
|
Approval_template_approver approval_template_approver_depository_manager = new Approval_template_approver(); |
|
|
|
|