|
@@ -0,0 +1,94 @@
|
|
|
+package org.jeecg.modules.activiti.listener;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import org.activiti.engine.delegate.*;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.jeecg.common.constant.CommonConstant;
|
|
|
+import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
+import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.activiti.mapper.TbTableInfoMapper;
|
|
|
+import org.jeecg.modules.system.mapper.SysUserMapper;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+ * 流程监听,会议纪要发送消息至参会人
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class ListenerMeeting implements TaskListener, JavaDelegate {
|
|
|
+
|
|
|
+ private Expression json;
|
|
|
+ @Autowired
|
|
|
+ private ISysBaseAPI sysBaseAPI;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void notify(DelegateTask delegateTask){
|
|
|
+ System.out.println("-------------1");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void execute(DelegateExecution delegateExecution){
|
|
|
+
|
|
|
+ String jsonString = json.getExpressionText();
|
|
|
+ JSONObject jsonObject = JSON.parseObject(jsonString);
|
|
|
+ String msg_title = oConvertUtils.getString(jsonObject.get("msg_title"));
|
|
|
+ String msg_content = oConvertUtils.getString(jsonObject.get("msg_content"));
|
|
|
+ String msg_user = oConvertUtils.getString(jsonObject.get("msg_user"));
|
|
|
+
|
|
|
+ System.out.println(msg_user);
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(msg_user)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!delegateExecution.getVariableInstances().containsKey(msg_user)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ String msg_user1 = delegateExecution.getVariableInstances().get(msg_user).getTextValue();
|
|
|
+ String msg_title1 = delegateExecution.getVariableInstances().get(msg_title).getTextValue();
|
|
|
+ String msg_content1 = delegateExecution.getVariableInstances().get(msg_content).getTextValue();
|
|
|
+
|
|
|
+ String msg_content12 = msg_content1.replace("\n","<br>");
|
|
|
+
|
|
|
+ String dmf = msg_user1.replace("[","");
|
|
|
+ String dmf2 = dmf.replace("]","");
|
|
|
+ String dmf3 = dmf2.replace("\"","");
|
|
|
+ String[] userList = dmf3.split(",");
|
|
|
+
|
|
|
+ HashMap<String,Object> taskParam = new HashMap<>();
|
|
|
+ LoginUser loginUser = sysBaseAPI.getUserByName("admin");
|
|
|
+
|
|
|
+ for (String o:userList){
|
|
|
+ sysBaseAPI.sendSysAnnouncement(loginUser,"admin",o,"会议纪要","<h2>会议主题:"+msg_title1+"</h2><br> <h3>会议内容:<br>"+msg_content12+"</h3>", CommonConstant.MSG_CATEGORY_2,taskParam);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String ss = "[\"lisi\",\"admin\",\"wxs\",\"T0116\",\"T0007\"]";
|
|
|
+
|
|
|
+ String dmf = ss.replace("[","");
|
|
|
+ String dmf2 = dmf.replace("]","");
|
|
|
+
|
|
|
+ String[] ssa = dmf2.split(",");
|
|
|
+ System.out.println(ssa);
|
|
|
+
|
|
|
+
|
|
|
+ System.out.println(dmf2);
|
|
|
+ List<String> aa = new ArrayList<>();
|
|
|
+ aa.add(0,"223232");
|
|
|
+ aa.add(1,"223232");
|
|
|
+
|
|
|
+ System.out.println(aa);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|