package com.nq.controller.backend; import com.nq.common.ServerResponse; import com.nq.service.IUserRechargeService; import com.nq.service.IUserService; import com.nq.service.IUserWithdrawService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.Map; @Controller @RequestMapping({"/admin/notification/"}) public class AdminNotificationController { private static final Logger log = LoggerFactory.getLogger(AdminNotificationController.class); @Autowired IUserRechargeService iUserRechargeService; @Autowired IUserWithdrawService iUserWithdrawService; @Autowired IUserService iUserService; @RequestMapping({"pendingCount.do"}) @ResponseBody public ServerResponse> getPendingCount(HttpServletRequest request) { try { Map result = new HashMap<>(); // 充值待处理数量(状态为0) int rechargeCount = iUserRechargeService.countPendingRecharge(); // 提现待处理数量(状态为0) int withdrawCount = iUserWithdrawService.countPendingWithdraw(); // 实名认证待处理数量(isActive为1) int authCount = iUserService.countPendingAuth(); result.put("rechargeCount", rechargeCount); result.put("withdrawCount", withdrawCount); result.put("authCount", authCount); result.put("totalCount", rechargeCount + withdrawCount + authCount); return ServerResponse.createBySuccess(result); } catch (Exception e) { log.error("获取待处理数量失败", e); return ServerResponse.createByErrorMsg("获取待处理数量失败"); } } }