chenc 3 سال پیش
والد
کامیت
20ef8b1b12

+ 2 - 2
jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java

@@ -104,7 +104,7 @@ public interface ISysBaseAPI {
 	 * @param title  消息主题
 	 * @param msgContent  消息内容
 	 */
-	public void sendSysAnnouncement(String fromUser,String toUser,String title, String msgContent);
+	public void sendSysAnnouncement(String fromUser,String toUser,String title, String msgContent,Map<String,Object> map);
 
 	/**
 	 * 发送系统消息
@@ -146,7 +146,7 @@ public interface ISysBaseAPI {
 	 * @param msgContent  消息内容
 	 * @param setMsgCategory  消息类型 1:消息2:系统消息
 	 */
-	public void sendSysAnnouncement(String fromUser, String toUser, String title, String msgContent, String setMsgCategory);
+	public void sendSysAnnouncement(String fromUser, String toUser, String title, String msgContent, String setMsgCategory,Map<String,Object> map);
 
 	/**queryTableDictByKeys
 	 * 发送系统消息

+ 2 - 1
jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/controller/CommonController.java

@@ -467,7 +467,8 @@ public class CommonController {
 			map.put("success",true);
 			map.put("code",0);
 			Map<String,Object> map1=new HashMap<>();
-			map1.put("url","http://localhost:3000/jeecg-boot/sys/common/downloadFile/"+dbpath);
+//			map1.put("url","http://localhost:3000/jeecg-boot/sys/common/downloadFile/"+dbpath);
+			map1.put("url","http://106.15.206.14:8088/jeecg-boot/sys/common/downloadFile/"+dbpath);
 			map.put("data",map1);
 		} catch (IOException e) {
 			map.put("success",false);

+ 15 - 10
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/service/Impl/ActZprocessServiceImpl.java

@@ -34,10 +34,7 @@ import org.springframework.stereotype.Service;
 
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceContext;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -139,9 +136,13 @@ public class ActZprocessServiceImpl extends ServiceImpl<ActZprocessMapper, ActZp
                     // 分配了节点负责人分发给全部
                     for(LoginUser user : users){
                         taskService.addCandidateUser(task.getId(), user.getUsername());
+                        Map<String,Object> map =new HashMap<>();
+                        map.put("isUrl","1");
+                        map.put("url","/activiti/applyList");
+                        map.put("taskId",task.getId());
                         // 异步发消息
                         sendActMessage(loginUser,user,actBusiness,task.getName(), actBusiness.getSendMessage(),
-                                actBusiness.getSendSms(), actBusiness.getSendEmail());
+                                actBusiness.getSendSms(), actBusiness.getSendEmail(),map);
                     }
                 }
             }else {
@@ -149,10 +150,14 @@ public class ActZprocessServiceImpl extends ServiceImpl<ActZprocessMapper, ActZp
                 String assignees = actBusiness.getAssignees();
                 for (String assignee : assignees.split(",")) {
                     taskService.addCandidateUser(task.getId(), assignee);
+                    Map<String,Object> map =new HashMap<>();
+                    map.put("isUrl","1");
+                    map.put("url","/activiti/applyList");
+                    map.put("taskId",task.getId());
                     // 异步发消息
                     LoginUser user = sysBaseAPI.getUserByName(assignee);
                     sendActMessage(loginUser,user,actBusiness,task.getName(), actBusiness.getSendMessage(),
-                            actBusiness.getSendSms(), actBusiness.getSendEmail());
+                            actBusiness.getSendSms(), actBusiness.getSendEmail(),map);
                 }
             }
             // 设置任务优先级
@@ -171,7 +176,7 @@ public class ActZprocessServiceImpl extends ServiceImpl<ActZprocessMapper, ActZp
      * @param sendSms 短信消息
      * @param sendEmail 邮件消息
      */
-    public void sendActMessage(LoginUser fromUser, LoginUser toUser, ActBusiness act, String taskName, Boolean sendMessage, Boolean sendSms, Boolean sendEmail) {
+    public void sendActMessage(LoginUser fromUser, LoginUser toUser, ActBusiness act, String taskName, Boolean sendMessage, Boolean sendSms, Boolean sendEmail,Map<String,Object> map) {
         String title = String.format("您有一个新的审批任务");
         Map<String, String> msgMap = Maps.newHashMap();
                         /*流程名称:  ${bpm_name}
@@ -184,7 +189,7 @@ public class ActZprocessServiceImpl extends ServiceImpl<ActZprocessMapper, ActZp
         msgMap.put("remark", "请进入待办栏,尽快处理!");
         /*流程催办模板*/
         String msgText = sysBaseAPI.parseTemplateByCode("bpm_cuiban", msgMap);
-        this.sendMessage(fromUser,toUser,title,msgText,sendMessage,sendSms,sendEmail);
+        this.sendMessage(fromUser,toUser,title,msgText,sendMessage,sendSms,sendEmail,map);
     }
 
     /**
@@ -197,9 +202,9 @@ public class ActZprocessServiceImpl extends ServiceImpl<ActZprocessMapper, ActZp
      * @param sendSms 短信
      * @param sendEmail 邮件
      */
-    public void sendMessage(LoginUser fromUser, LoginUser toUser,String title,String msgText,  Boolean sendMessage, Boolean sendSms, Boolean sendEmail) {
+    public void sendMessage(LoginUser fromUser, LoginUser toUser,String title,String msgText,  Boolean sendMessage, Boolean sendSms, Boolean sendEmail,Map<String,Object> map) {
         if (sendMessage!=null&&sendMessage){
-            sysBaseAPI.sendSysAnnouncement(fromUser.getUsername(),toUser.getUsername(),title,msgText);
+            sysBaseAPI.sendSysAnnouncement(fromUser.getUsername(),toUser.getUsername(),title,msgText,map);
         }
         //todo 以下需要购买阿里短信服务;设定邮件服务账号
         if (sendSms!=null&&sendSms&& StrUtil.isNotBlank(toUser.getPhone())){

+ 9 - 8
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActBusinessController.java

@@ -4,6 +4,7 @@ import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
@@ -260,16 +261,16 @@ public class ActBusinessController {
     /**/
     @RequestMapping(value = "/listData")
     public Result listData(ActBusiness param, HttpServletRequest request){
-        LambdaQueryWrapper<ActBusiness> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.orderByDesc(ActBusiness::getCreateTime);
-        if (StrUtil.isNotBlank(param.getTitle())) queryWrapper.like(ActBusiness::getTitle,param.getTitle());
-        if (param.getStatus()!=null) queryWrapper.eq(ActBusiness::getStatus,param.getStatus());
-        if (param.getResult()!=null) queryWrapper.eq(ActBusiness::getResult,param.getResult());
-        if (StrUtil.isNotBlank(request.getParameter("createTime_begin"))) queryWrapper.ge(ActBusiness::getTitle,param.getTitle());
-        if (StrUtil.isNotBlank(request.getParameter("createTime_end"))) queryWrapper.le(ActBusiness::getTitle,param.getTitle());
+        QueryWrapper<ActBusiness> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().orderByDesc(ActBusiness::getCreateTime);
+        if (StrUtil.isNotBlank(param.getTitle())) queryWrapper.lambda().like(ActBusiness::getTitle,param.getTitle());
+        if (param.getStatus()!=null) queryWrapper.lambda().eq(ActBusiness::getStatus,param.getStatus());
+        if (param.getResult()!=null) queryWrapper.lambda().eq(ActBusiness::getResult,param.getResult());
+        if (StrUtil.isNotBlank(request.getParameter("createTime_begin"))) queryWrapper.ge("DATE_FORMAT(create_time,'%Y-%m-%d')",request.getParameter("createTime_begin"));
+        if (StrUtil.isNotBlank(request.getParameter("createTime_end"))) queryWrapper.le("DATE_FORMAT(create_time,'%Y-%m-%d')",request.getParameter("createTime_end"));
 
         LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        queryWrapper.eq(ActBusiness::getUserId,loginUser.getUsername());
+        queryWrapper.lambda().eq(ActBusiness::getUserId,loginUser.getUsername());
              List<ActBusiness> actBusinessList = actBusinessService.list(queryWrapper);
 
         actBusinessList.forEach(e -> {

+ 106 - 6
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActTaskController.java

@@ -142,6 +142,78 @@ public class ActTaskController {
         return Result.ok(list);
     }
 
+    public void show2(String taskId,String userId,String name,String categoryId, Integer priority, HttpServletRequest request,List<Task> taskList){
+        TaskQuery query = taskService.createTaskQuery().taskCandidateOrAssigned(userId);
+        query.taskId(taskId);
+        // 多条件搜索
+        query.orderByTaskPriority().desc();
+        query.orderByTaskCreateTime().desc();
+        if(StrUtil.isNotBlank(name)){
+            query.taskNameLike("%"+name+"%");
+        }
+        if(StrUtil.isNotBlank(categoryId)){
+            query.taskCategory(categoryId);
+        }
+        if(priority!=null){
+            query.taskPriority(priority);
+        }
+        String createTime_begin = request.getParameter("createTime_begin");
+        String createTime_end = request.getParameter("createTime_end");
+        if(StrUtil.isNotBlank(createTime_begin)&&StrUtil.isNotBlank(createTime_end)){
+            Date start = DateUtil.parse(createTime_begin);
+            Date end = DateUtil.parse(createTime_end);
+            query.taskCreatedAfter(start);
+            query.taskCreatedBefore(DateUtil.endOfDay(end));
+        }
+        taskList.addAll(query.list());
+    }
+
+    @RequestMapping(value = "/todoGetByTaskId" )
+    public Result<Object> todoGetByTaskId(String taskId,String name, String categoryId, Integer priority, HttpServletRequest request){
+        List<TaskVo> list = new ArrayList<>();
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = sysUser.getUsername();
+
+        List<Task> taskList = new ArrayList<>();
+        show2(taskId,sysUser.getUsername(),name,categoryId,priority,request,taskList);
+        show2(taskId,sysUser.getId(),name,categoryId,priority,request,taskList);
+        ListSort(taskList);
+        // 转换vo
+        taskList.forEach(e -> {
+            TaskVo tv = new TaskVo(e);
+
+            // 关联委托人
+            if(StrUtil.isNotBlank(tv.getOwner())){
+                String realname = sysBaseAPI.getUserByName(tv.getOwner()).getRealname();
+                tv.setOwner(realname);
+            }
+            List<IdentityLink> identityLinks = runtimeService.getIdentityLinksForProcessInstance(tv.getProcInstId());
+            for(IdentityLink ik : identityLinks){
+                // 关联发起人
+                if("starter".equals(ik.getType())&&StrUtil.isNotBlank(ik.getUserId())){
+                    tv.setApplyer(sysBaseAPI.getUserByName(ik.getUserId()).getRealname());
+                }
+            }
+            // 关联流程信息
+            ActZprocess actProcess = actZprocessService.getById(tv.getProcDefId());
+            if(actProcess!=null){
+                tv.setProcessName(actProcess.getName());
+                tv.setRouteName(actProcess.getRouteName());
+            }
+            // 关联业务key
+            ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(tv.getProcInstId()).singleResult();
+            tv.setBusinessKey(pi.getBusinessKey());
+            ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
+            if(actBusiness!=null){
+                tv.setTableId(actBusiness.getTableId());
+                tv.setTableName(actBusiness.getTableName());
+            }
+
+            list.add(tv);
+        });
+        return Result.ok(list);
+    }
+
     private static void ListSort(List<Task> list) {
         Iterator<Task> iterator = list.iterator();
         if(iterator.hasNext()){
@@ -221,8 +293,13 @@ public class ActTaskController {
         actBusinessService.updateById(actBusiness);
         // 异步发消息
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        //我的消息跳转地址
+        Map<String,Object> map =new HashMap<>();
+        map.put("isUrl","1");
+        map.put("url","/activiti/applyList");
+        map.put("taskId",id);
         actZprocessService.sendMessage(sysUser,sysBaseAPI.getUserByName(actBusiness.getUserId()),ActivitiConstant.MESSAGE_BACK_CONTENT,
-                String.format("您的 【%s】 申请已被驳回!",actBusiness.getTitle()),sendMessage, sendSms, sendEmail);
+                String.format("您的 【%s】 申请已被驳回!",actBusiness.getTitle()),sendMessage, sendSms, sendEmail,map);
         // 记录实际审批人员
         actBusinessService.insertHI_IDENTITYLINK(IdUtil.simpleUUID(),
                 ActivitiConstant.EXECUTOR_TYPE, sysUser.getUsername(), id, procInstId);
@@ -321,8 +398,12 @@ public class ActTaskController {
                             // 分配了节点负责人分发给全部
                             for (LoginUser user : users) {
                                 taskService.addCandidateUser(t.getId(), user.getId());
+                                Map<String,Object> map =new HashMap<>();
+                                map.put("isUrl","1");
+                                map.put("url","/activiti/applyList");
+                                map.put("taskId",t.getId());
                                 // 异步发消息
-                                actZprocessService.sendActMessage(loginUser,user,actBusiness,task.getName(),  sendMessage, sendSms, sendEmail);
+                                actZprocessService.sendActMessage(loginUser,user,actBusiness,task.getName(),  sendMessage, sendSms, sendEmail,map);
                             }
                             taskService.setPriority(t.getId(), task.getPriority());
                         }
@@ -336,7 +417,11 @@ public class ActTaskController {
                             taskService.addCandidateUser(t.getId(), assignee);
                             // 异步发消息
                             LoginUser user = sysBaseAPI.getUserByName(assignee);
-                            actZprocessService.sendActMessage(loginUser,user,actBusiness,task.getName(),  sendMessage, sendSms, sendEmail);
+                            Map<String,Object> map =new HashMap<>();
+                            map.put("isUrl","1");
+                            map.put("url","/activiti/applyList");
+                            map.put("taskId",t.getId());
+                            actZprocessService.sendActMessage(loginUser,user,actBusiness,task.getName(),  sendMessage, sendSms, sendEmail,map);
                             taskService.setPriority(t.getId(), priority);
                         }
                     }
@@ -349,8 +434,13 @@ public class ActTaskController {
             actBusinessService.updateById(actBusiness);
             // 异步发消息
             LoginUser user = sysBaseAPI.getUserByName(actBusiness.getUserId());
+            //我的消息跳转地址
+            Map<String,Object> map =new HashMap<>();
+            map.put("isUrl","1");
+            map.put("url","/activiti/applyList");
+            map.put("taskId",task.getId());
             actZprocessService.sendMessage(loginUser,user,ActivitiConstant.MESSAGE_PASS_CONTENT,
-                    String.format("您的 【%s】 申请已通过!",actBusiness.getTitle()),sendMessage, sendSms, sendEmail);
+                    String.format("您的 【%s】 申请已通过!",actBusiness.getTitle()),sendMessage, sendSms, sendEmail,map);
         }
         // 记录实际审批人员
         actBusinessService.insertHI_IDENTITYLINK(IdUtil.simpleUUID(),
@@ -375,8 +465,13 @@ public class ActTaskController {
         taskService.delegateTask(id, userId);
         taskService.setOwner(id, sysUser.getUsername());
         // 异步发消息
+        //我的消息跳转地址
+        Map<String,Object> map =new HashMap<>();
+        map.put("isUrl","1");
+        map.put("url","/activiti/applyList");
+        map.put("taskId",id);
         actZprocessService.sendMessage(sysUser,sysBaseAPI.getUserByName(userId),ActivitiConstant.MESSAGE_DELEGATE_CONTENT,
-                String.format("您有一个来自 %s 的委托需要处理!",sysUser.getRealname()),sendMessage, sendSms, sendEmail);
+                String.format("您有一个来自 %s 的委托需要处理!",sysUser.getRealname()),sendMessage, sendSms, sendEmail,map);
         return Result.ok("操作成功");
     }
     @RequestMapping(value = "/backToTask", method = RequestMethod.POST)
@@ -411,8 +506,13 @@ public class ActTaskController {
                 for(String assignee:assignees.split(",")){
                     taskService.addCandidateUser(e.getId(), assignee);
                     // 异步发消息
+                    //我的消息跳转地址
+                    Map<String,Object> map =new HashMap<>();
+                    map.put("isUrl","1");
+                    map.put("url","/activiti/applyList");
+                    map.put("taskId",id);
                     actZprocessService.sendMessage(loginUser,sysBaseAPI.getUserByName(assignee),ActivitiConstant.MESSAGE_TODO_CONTENT
-                    ,"您有一个任务待审批,请尽快处理!",sendMessage, sendSms, sendEmail);
+                    ,"您有一个任务待审批,请尽快处理!",sendMessage, sendSms, sendEmail,map);
                 }
                 if(priority!=null){
                     taskService.setPriority(e.getId(), priority);

+ 10 - 3
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java

@@ -196,12 +196,12 @@ public class SysBaseApiImpl implements ISysBaseAPI {
 	}
 
 	@Override
-	public void sendSysAnnouncement(String fromUser, String toUser, String title, String msgContent) {
-		this.sendSysAnnouncement(fromUser, toUser, title, msgContent, CommonConstant.MSG_CATEGORY_2);
+	public void sendSysAnnouncement(String fromUser, String toUser, String title, String msgContent,Map<String,Object> map) {
+		this.sendSysAnnouncement(fromUser, toUser, title, msgContent, CommonConstant.MSG_CATEGORY_2,map);
 	}
 
 	@Override
-	public void sendSysAnnouncement(String fromUser, String toUser, String title, String msgContent, String setMsgCategory) {
+	public void sendSysAnnouncement(String fromUser, String toUser, String title, String msgContent, String setMsgCategory,Map<String,Object> map) {
 		SysAnnouncement announcement = new SysAnnouncement();
 		announcement.setTitile(title);
 		announcement.setMsgContent(msgContent);
@@ -212,6 +212,13 @@ public class SysBaseApiImpl implements ISysBaseAPI {
 		announcement.setSendTime(new Date());
 		announcement.setMsgCategory(setMsgCategory);
 		announcement.setDelFlag(String.valueOf(CommonConstant.DEL_FLAG_0));
+		if(map!=null){
+			if(map.get("isUrl")!=null&&map.get("isUrl").toString().equals("1")){
+				announcement.setOpenType("url");
+//				announcement.setOpenPage(map.get("url").toString());
+				announcement.setOpenPage(map.get("taskId").toString());
+			}
+		}
 		sysAnnouncementMapper.insert(announcement);
 		// 2.插入用户通告阅读标记表记录
 		String userId = toUser;