Commit 3793be10 by wangxin

消息数量接口增加我的信箱

parent 296d7be4
...@@ -22,4 +22,7 @@ public class PromptStatisticsVO { ...@@ -22,4 +22,7 @@ public class PromptStatisticsVO {
@ApiModelProperty(value = "培训测试提示数量") @ApiModelProperty(value = "培训测试提示数量")
private Integer trainingTestCount; private Integer trainingTestCount;
@ApiModelProperty(value = "信箱提示数量")
private Integer mailboxCount;
} }
\ No newline at end of file
...@@ -6,6 +6,8 @@ import com.yizhi.core.application.context.RequestContext; ...@@ -6,6 +6,8 @@ import com.yizhi.core.application.context.RequestContext;
import com.yizhi.research.application.feign.ResearchClient; import com.yizhi.research.application.feign.ResearchClient;
import com.yizhi.research.application.vo.BaseModel; import com.yizhi.research.application.vo.BaseModel;
import com.yizhi.research.application.vo.api.PageVo; import com.yizhi.research.application.vo.api.PageVo;
import com.yizhi.site.application.feign.api.SystemMailboxClients;
import com.yizhi.site.application.vo.domain.SystemMailboxParamVo;
import com.yizhi.training.application.feign.TrainingProjectClient; import com.yizhi.training.application.feign.TrainingProjectClient;
import com.yizhi.training.application.vo.api.TrainingProjectMyParamVo; import com.yizhi.training.application.vo.api.TrainingProjectMyParamVo;
import com.yizhi.util.application.domain.Response; import com.yizhi.util.application.domain.Response;
...@@ -43,6 +45,9 @@ public class PromptStatisticsController { ...@@ -43,6 +45,9 @@ public class PromptStatisticsController {
@Autowired @Autowired
private ExamApiClient examApiClient; private ExamApiClient examApiClient;
@Autowired
private SystemMailboxClients systemMailboxClients;
@ApiOperation(value = "获取提示统计信息", notes = "获取总提示数量及各类提示数量统计") @ApiOperation(value = "获取提示统计信息", notes = "获取总提示数量及各类提示数量统计")
@GetMapping("/statistics") @GetMapping("/statistics")
public Response<PromptStatisticsVO> getPromptStatistics() { public Response<PromptStatisticsVO> getPromptStatistics() {
...@@ -66,9 +71,13 @@ public class PromptStatisticsController { ...@@ -66,9 +71,13 @@ public class PromptStatisticsController {
// 4. 获取培训测试数量(考试相关的提示数量) // 4. 获取培训测试数量(考试相关的提示数量)
Integer trainingTestCount = getTrainingTestCount(context); Integer trainingTestCount = getTrainingTestCount(context);
statistics.setTrainingTestCount(trainingTestCount); statistics.setTrainingTestCount(trainingTestCount);
// 5. 获取信箱提示数量(未读消息数量)
Integer mailboxCount = getMailboxCount(context);
statistics.setMailboxCount(mailboxCount);
// 5. 计算总提示数量 // 6. 计算总提示数量
int totalPromptCount = workTaskCount + themeActivityCount + voteCount + trainingTestCount; int totalPromptCount = workTaskCount + themeActivityCount + voteCount + trainingTestCount + mailboxCount;
statistics.setTotalPromptCount(totalPromptCount); statistics.setTotalPromptCount(totalPromptCount);
return Response.ok(statistics); return Response.ok(statistics);
...@@ -197,4 +206,23 @@ public class PromptStatisticsController { ...@@ -197,4 +206,23 @@ public class PromptStatisticsController {
return 0; return 0;
} }
} }
/**
* 获取信箱提示数量(未读消息数量)
* @param context
* @return
*/
private Integer getMailboxCount(RequestContext context) {
try {
// 获取未读消息数量
Page<SystemMailboxParamVo> response = systemMailboxClients.selectMyPage(1,1, 2);
if (response != null ) {
return response.getTotal();
}
return 0;
} catch (Exception e) {
LOGGER.error("获取信箱提示数量失败", e);
return 0;
}
}
} }
\ No newline at end of file
...@@ -22,4 +22,7 @@ public class PromptStatisticsVO { ...@@ -22,4 +22,7 @@ public class PromptStatisticsVO {
@ApiModelProperty(value = "培训测试提示数量") @ApiModelProperty(value = "培训测试提示数量")
private Integer trainingTestCount; private Integer trainingTestCount;
@ApiModelProperty(value = "信箱提示数量")
private Integer mailboxCount;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment