package com.yonyou.mls.srm.mlssrmkkgys.deliveryplan.service.impl; import com.yonyou.cloud.apm.internal.com.alibaba.fastjson.JSONObject; import com.yonyou.iuap.message.platform.rpc.IMsgSendService; import com.yonyou.mls.srm.mlssrmkkgys.deliveryplan.mapper.SendMsgPlanDeliveryMapper; import com.yonyou.mls.srm.mlssrmkkgys.deliveryplan.service.SendMsgPlanDeliveryService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @Slf4j @Service public class SendMsgPlanDeliveryServiceImpl implements SendMsgPlanDeliveryService { @Autowired SendMsgPlanDeliveryMapper sendMsgPlanDeliveryMapper; @Autowired IMsgSendService iMsgSendService; @Value("${mls.buyer_tenant_id}") private String tenantId; @Override public Map<String, Object> sendMsgPlanVendor(JSONObject body) throws Exception { // 交期计划 String purOrderDetailId = body.getString("purOrderDetailId"); //表Id 交期计划表 采购订单明细ID String title = body.getString("title"); // "您有一份交期计划通知,请查收"; String content = body.getString("content"); // "请及时查看交期计划"; try { Map<String, Object> PlanBuyerObject = sendMsgPlanDeliveryMapper.getPlanBuyerIdObject(purOrderDetailId); // 根据交期计划delivery_plan_buyer主表的 采购订单明细ID 获取表行数据 String id = (String) PlanBuyerObject.get("id"); // --主键 采购商交期计划的主表Id // 发送工作通知 Map<String, Object> result = new HashMap<>(); ArrayList<String> receivers = new ArrayList<>(); String purchaseId = (String) PlanBuyerObject.get("ucUserid"); // --友互通id receivers.add(purchaseId); ArrayList<String> channels = new ArrayList<>(); channels.add("uspace"); String messageType = "notice"; String supQualmsgId = id; //单据主表Id supQualmsgId 单据主表ID //拼接跳转链接 String webUrl = "/mdf-node/meta/Voucher/c69eda35/" + supQualmsgId + "?domainKey=procurement&code=inapi_error&OpenWin=1&tenantPk=" + tenantId; Map<String, Object> uspaceExt = new HashMap<>(); uspaceExt.put("webUrl", webUrl); //扩展参数,发送消息时传入各个通道的扩展参数 Map<String, Object> extParams = new HashMap<>(); extParams.put("uspaceExt", uspaceExt); //(1)sysId为系统id,公有云为“diwork”,必传 //(2)tenantId为发送目标租户的租户id,必传 //(3)receivers为消息接收人,必传 //(4)channels为发送通道,必传,例如: // ArrayList<String> channels = new ArrayList<>(); // channels.add("uspace"); //(5)MessageType为发送消息的类型,有notice(通知),creatToDo(待办),prewarn(预警)三种方式,不填时默认为”notice”,该字段非必传 //(6)title为标题,必传 //(7)content为消息内容,必传 Map<String,Object > sendMsg = iMsgSendService.sendPlainMessageToUsers("diwork", tenantId, receivers, channels, messageType, title, content, extParams); result.put("flag", sendMsg.get("flag")); result.put("msg", sendMsg.get("msg")); return result; // 采购商发送到供应商 } catch (Exception e) { throw new Exception(e.getMessage()); } } }
标签:String,通知,ArrayList,必传,发送,import,new,id,BIP From: https://www.cnblogs.com/LFxanla/p/17264335.html