init
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.cai.controller.admin;
|
||||
|
||||
import com.ruoyi.cai.dto.admin.vo.unread.UnreadData;
|
||||
import com.ruoyi.cai.manager.UnreadManager;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cai/unread")
|
||||
public class UnreadController {
|
||||
|
||||
@Autowired
|
||||
public UnreadManager unreadManager;
|
||||
|
||||
@GetMapping("/data")
|
||||
public R<UnreadData> list() {
|
||||
UnreadData data = unreadManager.data();
|
||||
return R.ok(data);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/checkCount")
|
||||
public R<Integer> count() {
|
||||
boolean checkCount = unreadManager.checkCount();
|
||||
return R.ok(checkCount?1:0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.cai.dto.admin.vo.unread;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UnreadData {
|
||||
private Long accountCashCount;
|
||||
private Long userAlbumCount;
|
||||
private Long userCameraAuditCount;
|
||||
private Long anchorApplyCount;
|
||||
private Long dynamicCount;
|
||||
private Long reportCount;
|
||||
private Long userGreetCount;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.ruoyi.cai.manager;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cai.domain.*;
|
||||
import com.ruoyi.cai.dto.admin.vo.unread.UnreadData;
|
||||
import com.ruoyi.cai.enums.AuditStatusEnum;
|
||||
import com.ruoyi.cai.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class UnreadManager {
|
||||
|
||||
@Autowired
|
||||
private AccountCashService accountCashService;
|
||||
@Autowired
|
||||
private UserAlbumService userAlbumService;
|
||||
@Autowired
|
||||
private UserCameraAuditService userCameraAuditService;
|
||||
@Autowired
|
||||
private AnchorApplyService anchorApplyService;
|
||||
@Autowired
|
||||
private DynamicService dynamicService;
|
||||
@Autowired
|
||||
private ReportService reportService;
|
||||
@Autowired
|
||||
private UserGreetService userGreetService;
|
||||
|
||||
public UnreadData data() {
|
||||
UnreadData unreadData = new UnreadData();
|
||||
long accountCashCount = accountCashService.count(Wrappers.lambdaQuery(AccountCash.class).eq(AccountCash::getStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
unreadData.setAccountCashCount(accountCashCount);
|
||||
long userAlbumCount = userAlbumService.count(Wrappers.lambdaQuery(UserAlbum.class).eq(UserAlbum::getAuditStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
unreadData.setUserAlbumCount(userAlbumCount);
|
||||
long userCameraAuditCount = userCameraAuditService.count(Wrappers.lambdaQuery(UserCameraAudit.class).eq(UserCameraAudit::getAuditStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
unreadData.setUserCameraAuditCount(userCameraAuditCount);
|
||||
long anchorApplyCount = anchorApplyService.count(Wrappers.lambdaQuery(AnchorApply.class).eq(AnchorApply::getAuditStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
unreadData.setAnchorApplyCount(anchorApplyCount);
|
||||
long dynamicCount = dynamicService.count(Wrappers.lambdaQuery(Dynamic.class).eq(Dynamic::getAuditStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
unreadData.setDynamicCount(dynamicCount);
|
||||
long reportCount = reportService.count(Wrappers.lambdaQuery(Report.class).eq(Report::getStatus, 0));
|
||||
unreadData.setReportCount(reportCount);
|
||||
long userGreetCount = userGreetService.count(Wrappers.lambdaQuery(UserGreet.class).eq(UserGreet::getAuditStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
unreadData.setUserGreetCount(userGreetCount);
|
||||
return unreadData;
|
||||
}
|
||||
|
||||
public boolean checkCount() {
|
||||
boolean exists;
|
||||
exists = accountCashService.exists(Wrappers.lambdaQuery(AccountCash.class).eq(AccountCash::getStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
if(exists){
|
||||
return true;
|
||||
}
|
||||
exists = userAlbumService.exists(Wrappers.lambdaQuery(UserAlbum.class).eq(UserAlbum::getAuditStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
if(exists){
|
||||
return true;
|
||||
}
|
||||
exists = userCameraAuditService.exists(Wrappers.lambdaQuery(UserCameraAudit.class).eq(UserCameraAudit::getAuditStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
if(exists){
|
||||
return true;
|
||||
}
|
||||
exists = anchorApplyService.exists(Wrappers.lambdaQuery(AnchorApply.class).eq(AnchorApply::getAuditStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
if(exists){
|
||||
return true;
|
||||
}
|
||||
exists = dynamicService.exists(Wrappers.lambdaQuery(Dynamic.class).eq(Dynamic::getAuditStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
if(exists){
|
||||
return true;
|
||||
}
|
||||
exists = reportService.exists(Wrappers.lambdaQuery(Report.class).eq(Report::getStatus, 0));
|
||||
if(exists){
|
||||
return true;
|
||||
}
|
||||
exists = userGreetService.exists(Wrappers.lambdaQuery(UserGreet.class).eq(UserGreet::getAuditStatus, AuditStatusEnum.AUDITING.getCode()));
|
||||
if(exists){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user