|
|
|
@ -1887,11 +1887,43 @@ public class QyWxOperationService { |
|
|
|
|
|
|
|
} |
|
|
|
else if (flag == 12) { |
|
|
|
|
|
|
|
//此时分为申领申领者本部门备品备件库和申领其它部门备品备件库,当申领的为本部门的时,延续当前写法,当申领的为其他部门的时,将第一节点的审批人换为他部门的领导. version3
|
|
|
|
//申请者id
|
|
|
|
Long applicantId_version3 = mainRecord.getApplicantId(); |
|
|
|
//获取申请者部门
|
|
|
|
UserByPort userByPort_version3 = userService.findUserByIdForNoPack(applicantId_version3); |
|
|
|
String applicantAdminorg_version3 = userByPort_version3.getAdminorg().toString(); |
|
|
|
//获取申请物料所属部门
|
|
|
|
Depository depositoryById_version3 = depositoryMapper.findDepositoryById(mainRecord.getDepositoryId()); |
|
|
|
String materialOrg_version3 = depositoryById_version3.getAdminorg(); |
|
|
|
if(materialOrg_version3.equals(applicantAdminorg_version3)){//申请的时本部门的备品备件库
|
|
|
|
System.out.println("申请的是申请者所在部门的备品备件库"); |
|
|
|
}else{ |
|
|
|
System.out.println("申请的不是申请者所在部门的备品备件库"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*Depository depositoryById = depositoryMapper.findDepositoryById(mainRecord.getDepositoryId()); |
|
|
|
String adminorg = depositoryById.getAdminorg(); |
|
|
|
List<UserByPort> departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(ObjectFormatUtil.toLong(applicantAdminorg_version3));*/ |
|
|
|
|
|
|
|
//获取当前用户部门号与物料出库管理者部门号比较(depository.adminorg),,
|
|
|
|
/** |
|
|
|
* |
|
|
|
*/ |
|
|
|
|
|
|
|
// 如果是备品备件库
|
|
|
|
|
|
|
|
// 获取申请用户所在部门的设备员
|
|
|
|
List<UserByPort> userByPortList = PublicConfig.findUserByAdminorgAndPosition(applicantUser.getMaindeparment(), "设备员", userKey, token); |
|
|
|
List<UserByPort> departmentHeadForUserToken = userService.getDepartmentHeaderByIdForNoPack(applicantUser.getMaindeparment()); |
|
|
|
|
|
|
|
if(materialOrg_version3.equals(applicantAdminorg_version3)){ |
|
|
|
|
|
|
|
|
|
|
|
if (userByPortList.size() > 0) { |
|
|
|
// 如果有设备员
|
|
|
|
for (UserByPort userByPort : userByPortList) { |
|
|
|
@ -1927,6 +1959,22 @@ public class QyWxOperationService { |
|
|
|
notifyerList.add(departmentHeadWorkwechat); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{//申请的不是申请者所在部门的备品备件库
|
|
|
|
List<UserByPort> departmentHeadByUser_version3 = userService.getDepartmentHeaderByIdForNoPack(ObjectFormatUtil.toLong(applicantAdminorg_version3)); |
|
|
|
for (UserByPort departmentHead : departmentHeadByUser_version3 |
|
|
|
) { |
|
|
|
String departmentHeadWorkwechat = departmentHead.getWorkwechat(); |
|
|
|
if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) { |
|
|
|
departmentHeadWorkwechat = departmentHead.getWechat(); |
|
|
|
} |
|
|
|
// 添加到审批节点
|
|
|
|
userIdList.add(departmentHeadWorkwechat); |
|
|
|
// 添加到抄送节点
|
|
|
|
notifyerList.add(departmentHeadWorkwechat); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -2014,7 +2062,7 @@ public class QyWxOperationService { |
|
|
|
otherDepartmentIdList.add(departmentHeadWorkwechat); |
|
|
|
} |
|
|
|
//liwenxuan
|
|
|
|
otherDepartmentIdList = new ArrayList<String>(Collections.singleton("LiWenXuan")); |
|
|
|
//otherDepartmentIdList = new ArrayList<String>(Collections.singleton("LiWenXuan"));
|
|
|
|
|
|
|
|
|
|
|
|
// 用于设置其他部门负责人审批
|
|
|
|
@ -2158,12 +2206,18 @@ public class QyWxOperationService { |
|
|
|
String jsonString = JSONObject.toJSONString(approvalTemplate); |
|
|
|
|
|
|
|
String url = String.format("https://qyapi.weixin.qq.com/cgi-bin/oa/applyevent?access_token=%s", QyWxConfig.GetQYWXToken(userAgent)); |
|
|
|
|
|
|
|
//测试用 version3 上线要改回来. start
|
|
|
|
//System.out.println(jsonString);
|
|
|
|
String s = HttpUtils.doPost(url, jsonString); |
|
|
|
//String s = "[]";
|
|
|
|
//测试用 version3 上线要改回来. start
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(s); |
|
|
|
jsonObject.put("otherDepartmentIdList", JSONObject.toJSONString(otherDepartmentIdList)); |
|
|
|
log.info("发送出库审批结果:" + s + ";发送给企业微信的数据:" + jsonString); |
|
|
|
return jsonObject; |
|
|
|
/** |
|
|
|
* nideshijieyimumufenfeimenwaideqiangweidaicishangrendehenzhijieguoqubeifanyuejiejvmantiandefengxue |
|
|
|
*/ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -2238,7 +2292,7 @@ public class QyWxOperationService { |
|
|
|
Approval_template_approver approval_template_approver_departMentHeader = new Approval_template_approver(); |
|
|
|
approval_template_approver_departMentHeader.setAttr(1); |
|
|
|
//liwenxuan
|
|
|
|
userIdList = new ArrayList<>(Collections.singleton("LiWenXuan")); |
|
|
|
//userIdList = new ArrayList<>(Collections.singleton("LiWenXuan"));
|
|
|
|
approval_template_approver_departMentHeader.setUserid(userIdList); |
|
|
|
|
|
|
|
|
|
|
|
@ -3035,7 +3089,7 @@ public class QyWxOperationService { |
|
|
|
} |
|
|
|
notifyerList.add(user); |
|
|
|
//liwenxuan
|
|
|
|
workwechat = "LiWenXuan"; |
|
|
|
//workwechat = "LiWenXuan";
|
|
|
|
notifyerList.add(workwechat); |
|
|
|
approvalTemplate.setNotifyer(notifyerList); |
|
|
|
|
|
|
|
|