|
|
|
@ -1145,14 +1145,8 @@ public class QyWxOperationService { |
|
|
|
return jsonObject; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 给仓库管理员发送出库通知 |
|
|
|
* |
|
|
|
* @param uid |
|
|
|
* @param outMinId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public JSONObject sendNotificationToDepositoryManager(String uid, Integer outMinId, String userAgent) { |
|
|
|
|
|
|
|
public TemplateCard_text_notice getTextNoticeCard(Integer outMinId, Integer quantity) { |
|
|
|
// 需要出库的子订单
|
|
|
|
ApplicationOutRecordMin recordMin = depositoryRecordMapper.findApplicationOutMinById(outMinId); |
|
|
|
// 获取其主订单
|
|
|
|
@ -1161,21 +1155,6 @@ public class QyWxOperationService { |
|
|
|
Integer applicantId = outRecordP.getApplicantId(); |
|
|
|
// 申请人
|
|
|
|
UserByPort applicant = LinkInterfaceUtil.FindUserById(applicantId, null); |
|
|
|
// 定义文本通知型卡片
|
|
|
|
TextNotice textNotice = new TextNotice(); |
|
|
|
|
|
|
|
//设置消息接收者
|
|
|
|
String[] split = uid.split(","); |
|
|
|
StringBuilder toUserName = new StringBuilder(); |
|
|
|
for (int i = 0; i < split.length - 1; i++) { |
|
|
|
toUserName.append(split[i]).append("|"); |
|
|
|
} |
|
|
|
toUserName.append(split[split.length - 1]); |
|
|
|
textNotice.setTouser(toUserName.toString()); // 不区分大小写
|
|
|
|
|
|
|
|
|
|
|
|
// 设置agentId
|
|
|
|
textNotice.setAgentid(QyWxConfig.AgentId); |
|
|
|
|
|
|
|
// 定义卡片模板
|
|
|
|
TemplateCard_text_notice text_notice = new TemplateCard_text_notice(); |
|
|
|
@ -1186,8 +1165,6 @@ public class QyWxOperationService { |
|
|
|
Snowflake snowflake = new Snowflake(10, 10, true); |
|
|
|
text_notice.setTask_id(snowflake.nextIdStr()); |
|
|
|
|
|
|
|
textNotice.setMsgtype("template_card"); |
|
|
|
|
|
|
|
// 设置主标题
|
|
|
|
TemplateCard_main_title main_title = new TemplateCard_main_title(); |
|
|
|
main_title.setTitle(applicant.getName() + "的出库请求"); |
|
|
|
@ -1233,7 +1210,12 @@ public class QyWxOperationService { |
|
|
|
TemplateCard_horizontal_content horizontal_content_quantity = new TemplateCard_horizontal_content(); |
|
|
|
horizontal_content_quantity.setType(0); |
|
|
|
horizontal_content_quantity.setKeyname("申请数量:"); |
|
|
|
horizontal_content_quantity.setValue(String.valueOf(recordMin.getQuantity() / 100)); |
|
|
|
if (quantity != null) { |
|
|
|
horizontal_content_quantity.setValue(String.valueOf(quantity / 100)); |
|
|
|
} else { |
|
|
|
horizontal_content_quantity.setValue(String.valueOf(recordMin.getQuantity() / 100)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 申请单位
|
|
|
|
TemplateCard_horizontal_content horizontal_content_unit = new TemplateCard_horizontal_content(); |
|
|
|
@ -1282,6 +1264,37 @@ public class QyWxOperationService { |
|
|
|
jumpList.add(jump); |
|
|
|
|
|
|
|
text_notice.setJump_list(jumpList); |
|
|
|
return text_notice; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 给仓库管理员发送出库通知 |
|
|
|
* |
|
|
|
* @param uid |
|
|
|
* @param outMinId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public JSONObject sendNotificationToDepositoryManager(String uid, Integer outMinId, String userAgent) { |
|
|
|
// 定义文本通知型卡片
|
|
|
|
TextNotice textNotice = new TextNotice(); |
|
|
|
|
|
|
|
//设置消息接收者
|
|
|
|
String[] split = uid.split(","); |
|
|
|
StringBuilder toUserName = new StringBuilder(); |
|
|
|
for (int i = 0; i < split.length - 1; i++) { |
|
|
|
toUserName.append(split[i]).append("|"); |
|
|
|
} |
|
|
|
toUserName.append(split[split.length - 1]); |
|
|
|
textNotice.setTouser(toUserName.toString()); // 不区分大小写
|
|
|
|
|
|
|
|
|
|
|
|
// 设置agentId
|
|
|
|
textNotice.setAgentid(QyWxConfig.AgentId); |
|
|
|
|
|
|
|
textNotice.setMsgtype("template_card"); |
|
|
|
|
|
|
|
// 获取卡片模板
|
|
|
|
TemplateCard_text_notice text_notice = getTextNoticeCard(outMinId,null); |
|
|
|
|
|
|
|
textNotice.setTemplate_card(text_notice); |
|
|
|
String s = JSONObject.toJSONString(textNotice); |
|
|
|
@ -1301,6 +1314,7 @@ public class QyWxOperationService { |
|
|
|
return jsonObject; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 用于撤回发送给企业微信的消息 |
|
|
|
* |
|
|
|
@ -1331,7 +1345,7 @@ public class QyWxOperationService { |
|
|
|
* @param response_code |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public JSONObject updateTemplateCard(String response_code, String userName, String state, String userAgent) { |
|
|
|
public JSONObject updateButtonTemplateCardToUnEnable(String response_code, String userName, String state, String userAgent) { |
|
|
|
String url = String.format("https://qyapi.weixin.qq.com/cgi-bin/message/update_template_card?access_token=" + QyWxConfig.GetQYWXToken(userAgent) + "&debug=1"); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("atall", 1); |
|
|
|
@ -1347,6 +1361,23 @@ public class QyWxOperationService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JSONObject updateTemplateCardToQuantity(String response_code, Integer quantity, String userAgent, Integer outMinId) { |
|
|
|
String url = String.format("https://qyapi.weixin.qq.com/cgi-bin/message/update_template_card?access_token=" + QyWxConfig.GetQYWXToken(userAgent) + "&debug=1"); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("atall", 1); |
|
|
|
map.put("agentid", QyWxConfig.AgentId); |
|
|
|
map.put("response_code", response_code); |
|
|
|
map.put("enable_id_trans", 0); |
|
|
|
TemplateCard_text_notice text_notice = getTextNoticeCard(outMinId,quantity); |
|
|
|
map.put("template_card",text_notice); |
|
|
|
String jsonString = JSONObject.toJSONString(map); |
|
|
|
System.out.println(jsonString); |
|
|
|
String s1 = HttpUtils.doPost(url, jsonString); |
|
|
|
JSONObject jsonObject = JSON.parseObject(s1); |
|
|
|
return jsonObject; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 获取审批模板详细 |
|
|
|
* |
|
|
|
|