|
|
|
@ -1917,9 +1917,13 @@ public class QyWxOperationService { |
|
|
|
|
|
|
|
|
|
|
|
List<String> userIdList = new ArrayList<>(); |
|
|
|
List<UserByPort> departmentHeadForUserToken = PublicConfig.findDepartmentHeadByUser(userToken.getMaindeparment(),userKey,token ); |
|
|
|
for (UserByPort departmentHead : departmentHeadForUserToken |
|
|
|
String[] departmentHeadS = mainRecord.getDepartmenthead().split(","); |
|
|
|
for (String department:departmentHeadS |
|
|
|
) { |
|
|
|
if("".equals(department)){ |
|
|
|
continue; |
|
|
|
} |
|
|
|
UserByPort departmentHead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(department), userKey, token); |
|
|
|
String departmentHeadWorkwechat = departmentHead.getWorkwechat(); |
|
|
|
if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) { |
|
|
|
departmentHeadWorkwechat = departmentHead.getWechat(); |
|
|
|
@ -1927,6 +1931,7 @@ public class QyWxOperationService { |
|
|
|
userIdList.add(departmentHeadWorkwechat); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前登录用户部门与企业微信部门对照
|
|
|
|
JSONObject userPortByQyWx = PublicConfig.getUserPortByQyWx(userToken.getMaindeparment()); |
|
|
|
String portName = userPortByQyWx.getString("name"); |
|
|
|
@ -2029,6 +2034,11 @@ public class QyWxOperationService { |
|
|
|
|
|
|
|
// 定义仓库Id列表
|
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
|
List<Long> materialTypeIdList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
// 设置标志位,用于标志是否全为办公用品库或消防用品库
|
|
|
|
boolean flag = true; |
|
|
|
for (ApplicationOutRecordMin recordMin : minRecordList) { |
|
|
|
// 获取明细信息
|
|
|
|
|
|
|
|
@ -2040,10 +2050,21 @@ public class QyWxOperationService { |
|
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(depositoryId); |
|
|
|
|
|
|
|
|
|
|
|
if (!depositoryById.getDname().contains("前置仓")) { |
|
|
|
// 如果不是前置仓下的仓库
|
|
|
|
flag = false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!depositoryIdList.contains(depositoryId)) { |
|
|
|
// 如果当前仓库列表中不存在该仓库id
|
|
|
|
depositoryIdList.add(depositoryId); |
|
|
|
} |
|
|
|
Long materialTypeId = materialById.getMaterialTypeId(); |
|
|
|
if (!materialTypeIdList.contains(materialTypeId)) { |
|
|
|
// 如果当前仓库列表中不存在该仓库id
|
|
|
|
materialTypeIdList.add(materialTypeId); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, Object> detail_list = new HashMap<>(); |
|
|
|
// 定义明细种的控件列表
|
|
|
|
@ -2223,18 +2244,60 @@ public class QyWxOperationService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String[] depositoryManagerS = mainRecord.getDepartmenthead().split(","); |
|
|
|
List<String> depositoryManagerWorkWechats = new ArrayList<>(); |
|
|
|
for (String depositorymanager:depositoryManagerS |
|
|
|
) { |
|
|
|
if("".equals(depositorymanager)){ |
|
|
|
continue; |
|
|
|
} |
|
|
|
UserByPort depositoryManage = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(depositorymanager), userKey, token); |
|
|
|
String departmentHeadWorkwechat = depositoryManage.getWorkwechat(); |
|
|
|
if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) { |
|
|
|
departmentHeadWorkwechat = depositoryManage.getWechat(); |
|
|
|
} |
|
|
|
depositoryManagerWorkWechats.add(departmentHeadWorkwechat); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取仓储中心负责人标签的用户userId
|
|
|
|
List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserList(userAgent); |
|
|
|
// 用于设置仓储中心负责人流程
|
|
|
|
Approval_template_approver approval_template_approver_Label = new Approval_template_approver(); |
|
|
|
approval_template_approver_Label.setAttr(1); |
|
|
|
approval_template_approver_Label.setUserid(qyWxLabelUserList); |
|
|
|
approval_template_approver_Label.setUserid(depositoryManagerWorkWechats); |
|
|
|
approval_template_approver_list.add(approval_template_approver_Label); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(); |
|
|
|
} |
|
|
|
qywxUserIdList.add(user); |
|
|
|
} |
|
|
|
if (qywxUserIdList.size() > 0) { |
|
|
|
// 用于设置仓库管理员流程
|
|
|
|
Approval_template_approver approval_template_approver_depository_manager = new Approval_template_approver(); |
|
|
|
approval_template_approver_depository_manager.setAttr(1); |
|
|
|
approval_template_approver_depository_manager.setUserid(qywxUserIdList); |
|
|
|
|
|
|
|
approval_template_approver_list.add(approval_template_approver_depository_manager); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
for (Integer depositoryId : depositoryIdList |
|
|
|
|
|
|
|
) { |
|
|
|
@ -2262,6 +2325,7 @@ public class QyWxOperationService { |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 设置审批流程
|
|
|
|
|