package com.yem;

import com.yem.wm.utils.YEM;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.servicehelper.workflow.MessageCenterServiceHelper;
import kd.bos.workflow.engine.msg.info.MessageInfo;
import org.apache.commons.compress.utils.Lists;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description: TODO
 * @Date: 2024/8/9 14:53
 * @Created: by ZZSLL
 */

public class TestBillPlugin extends AbstractBillPlugIn {
    @Override
    public void afterDoOperation(AfterDoOperationEventArgs e) {
        super.afterDoOperation(e);
        String operateKey = e.getOperateKey();
        if ("test_btn".equals(operateKey)) {

        }
        if ("test_sendmsg".equals(operateKey)) {
            ArrayList<Long> list = Lists.newArrayList();
            list.add(1995049501487820800L);
            list.add(1891246179585375232L);
//            YEM.sendMessage(list, "系统发送", MessageInfo.TYPE_NOTICE, "TEST_MESSAGE_TITLE_1", "TEST_MESSAGE_CONTENT_1", "业务消息");

            MessageInfo message = new MessageInfo();
            message.setUserIds(list);
            message.setSenderName("系统发送");
            message.setType(MessageInfo.TYPE_NOTICE);
            message.setTitle("TEST_MESSAGE_TITLE_1");
            message.setContent("TEST_MESSAGE_CONTENT_1");
            message.setTag("业务消息");
            Map<String, Object> params = new HashMap<>();
            Map<String, Object> systemNotice = new HashMap<>();
            systemNotice.put("showType", 1);
            params.put("systemNotice", systemNotice);
            message.setParams(params);
            MessageCenterServiceHelper.sendMessage(message);
//            MessageCenterServiceHelper.sendMessage(message);
        }
    }
}
