|
@@ -19,6 +19,7 @@ import org.apache.shiro.SecurityUtils;
|
|
|
import org.checkerframework.checker.units.qual.Area;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
|
+import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
import org.jeecg.common.system.util.JwtUtil;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
@@ -336,6 +337,8 @@ public class ActBusinessController {
|
|
|
@RequestMapping(value = "/apply", method = RequestMethod.POST)
|
|
|
public Result apply(ActBusiness act){
|
|
|
|
|
|
+ boolean error = false;
|
|
|
+
|
|
|
ActBusiness actBusiness = actBusinessService.getById(act.getId());
|
|
|
if(actBusiness==null){
|
|
|
return Result.error("actBusiness表中该id不存在");
|
|
@@ -349,15 +352,82 @@ public class ActBusinessController {
|
|
|
//如果表单里有 标题 更新一下
|
|
|
actBusiness.setTitle(busiData.get(ActivitiConstant.titleKey)+"");
|
|
|
}
|
|
|
- String processInstanceId = actZprocessService.startProcess(act);
|
|
|
- actBusiness.setProcInstId(processInstanceId);
|
|
|
- actBusiness.setStatus(1);
|
|
|
- actBusiness.setResult(1);
|
|
|
- actBusiness.setApplyTime(new Date());
|
|
|
- actBusinessService.updateById(actBusiness);
|
|
|
+ try {
|
|
|
+ String processInstanceId = actZprocessService.startProcess(act);
|
|
|
+ actBusiness.setProcInstId(processInstanceId);
|
|
|
+ actBusiness.setStatus(1);
|
|
|
+ actBusiness.setResult(1);
|
|
|
+ actBusiness.setApplyTime(new Date());
|
|
|
+ actBusinessService.updateById(actBusiness);
|
|
|
+ }catch (Exception e){//如果提交中发生异常,这直接通过该条数据
|
|
|
+ error = true;
|
|
|
+ onlyInfo(actBusiness,busiData);
|
|
|
+ throw new JeecgBootException("流程错误,直接通过");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
return Result.ok("操作成功");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 单独线程处理信息
|
|
|
+ * @param actBusiness
|
|
|
+ * @param busiData
|
|
|
+ */
|
|
|
+ public void onlyInfo(ActBusiness actBusiness,Map<String, Object> busiData){
|
|
|
+
|
|
|
+ if(actBusiness == null || StringUtils.isBlank(actBusiness.getTableName())){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //会议纪要
|
|
|
+ if(actBusiness.getTableName().equals("meeting_summary")){
|
|
|
+
|
|
|
+ String msg_user1 = busiData.get("meeting_personnel").toString();
|
|
|
+ String msg_title1 = busiData.get("meeting_theme").toString();
|
|
|
+ String msg_content1 = busiData.get("meeting_content").toString();
|
|
|
+
|
|
|
+ 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");
|
|
|
+
|
|
|
+ //在主函数中。不new一个线程,直接去得到当前的线程,为主线程;
|
|
|
+ Thread t=Thread.currentThread();
|
|
|
+ System.out.println("线程为"+t.getName());//线程名:main 这是系统自己为主线程定义的名
|
|
|
+
|
|
|
+ //创建一个线程并初始化
|
|
|
+ Thread thread=new Thread(){
|
|
|
+ //具体的业务代码
|
|
|
+ @Override
|
|
|
+ public void run(){
|
|
|
+ //发送消息
|
|
|
+ for (String o:userList){
|
|
|
+ sysBaseAPI.sendSysAnnouncement(loginUser,"admin",o,"会议纪要","<h2>会议主题:"+msg_title1+"</h2><br> <h3>会议内容:<br>"+msg_content12+"</h3>", CommonConstant.MSG_CATEGORY_2,taskParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ actBusiness.setStatus(2);
|
|
|
+ actBusiness.setResult(2);
|
|
|
+ actBusiness.setApplyTime(new Date());
|
|
|
+ actBusinessService.updateById(actBusiness);
|
|
|
+ Thread t=Thread.currentThread();
|
|
|
+ System.out.println(t.getName());//线程名:Thread-0 自己未命名时,系统会去命名,当有多个线程时,依次为Thread-0、Thread-1、Thread-2....
|
|
|
+ }
|
|
|
+
|
|
|
+ };
|
|
|
+ //开启线程
|
|
|
+ thread.start();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @Author chenchuang
|
|
|
* @Description //TODO 外部项目用来调用的流程提交接口
|