This commit is contained in:
hanjian
2024-09-08 20:32:22 +08:00
parent 5607c957fb
commit b69682c2d0
6 changed files with 76 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import com.blueland.bpmclient.model.*;
import com.rzdata.common.core.controller.BaseController;
import com.rzdata.common.core.domain.AjaxResult;
import com.rzdata.common.core.domain.entity.SysUser;
import com.rzdata.common.core.domain.model.LoginUser;
import com.rzdata.common.utils.SecurityUtils;
import com.rzdata.common.utils.StringUtils;
import com.rzdata.system.service.ISysConfigService;
@@ -616,4 +617,18 @@ public class WorkflowController extends BaseController {
public AjaxResult getRecordbyPorcInstId(@PathVariable String procInstId) throws Exception{
return AjaxResult.success(workflowService.getRecordbyPorcInstId(procInstId));
}
/**
* 获取用户的消息数量(代办/消息中心)
*/
@GetMapping("/msg/count")
public AjaxResult msgCount() {
AjaxResult ajax = AjaxResult.success();
LoginUser loginUser = getLoginUser();
Map<String, Object> resultMap = workflowService.selectUserMsgCount(loginUser.getUser());
ajax.put("msgCount", resultMap.get("msgCount"));
ajax.put("taskCount", resultMap.get("taskCount"));
ajax.put("totalMsgCount", resultMap.get("totalMsgCount"));
return ajax;
}
}

View File

@@ -8,6 +8,7 @@ import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.blueland.bpmclient.BpmClient;
import com.blueland.bpmclient.model.*;
import com.google.common.collect.Maps;
import com.rzdata.common.core.domain.entity.SysUser;
import com.rzdata.common.utils.SecurityUtils;
import com.rzdata.common.utils.StringUtils;
@@ -54,6 +55,10 @@ public class WorkflowService {
@Autowired
IWorkflowLogService iWorkflowLogService;
@Autowired
private ITzMessageService tzMessageService;
private final static String CUR_ACT_DEF_KEY = "curActDef";
private final static String CUR_ACT_INST_KEY = "curActInst";
private final static String PROC_INST_KEY = "procInst";
@@ -790,4 +795,32 @@ public class WorkflowService {
String url = String.format("%s/%s?procInstId=%s", bpmcConfig.getServiceUrl(), workflowConfig.getRecordQueryUrl(), porcInstId);
return JSONArray.parseArray(getBpmClient().get(url));
}
public Map<String, Object> selectUserMsgCount(SysUser user) {
Map<String, Object> resultMap = Maps.newHashMap();
int totalMsgCount = 0;
int msgCount = 0;
int taskCount = 0;
try {
msgCount = tzMessageService.selectTzMessageByUserCount(String.valueOf(user.getUserId()));
totalMsgCount = msgCount;
resultMap.put("msgCount", msgCount);
} catch (Exception e){
log.error("查询消息中心未读消息数量异常", e);
}
try {
SearchQuery searchQuery = new SearchQuery();
searchQuery.setRecUserId(user.getUserName());
searchQuery.setStatus(1);
Map<String, Integer> resultRecordCount = getRecordCount(searchQuery);
taskCount = resultRecordCount.get("count");
totalMsgCount += taskCount;
} catch (Exception e){
log.error("查询待办消息数量异常", e);
}
resultMap.put("msgCount", msgCount);
resultMap.put("taskCount", taskCount);
resultMap.put("totalMsgCount", totalMsgCount);
return resultMap;
}
}

View File

@@ -37,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessType != null and businessType != ''"> and business_type = #{businessType}</if>
and deleted = '0'
</where>
order by create_time desc
</select>
<select id="selectTzMessageById" parameterType="String" resultMap="TzMessageResult">