管理端首页统计数据查询修改

This commit is contained in:
GYJ
2025-02-25 17:36:32 +08:00
parent 2516243891
commit fa9350ed6a
6 changed files with 67 additions and 10 deletions

View File

@@ -259,6 +259,13 @@ public class UserController {
//设置本年收入
homeMessageResponse.setYearRevenue(userService.queryPayMoney(3, qdCode));
//查询指定日期下的短剧购买的 量
Map<String, Object> map = userService.queryPayAndExtractInfo();
homeMessageResponse.setTodayPayAmount(map.get("payAmount") == null ? BigDecimal.ZERO :new BigDecimal(map.get("payAmount").toString()));
homeMessageResponse.setTodayPayCount(map.get("payCount") == null ? 0 : Integer.parseInt(map.get("payCount").toString()));
homeMessageResponse.setTodayExtractAmount(map.get("extractAmount") == null ? BigDecimal.ZERO : new BigDecimal(map.get("extractAmount").toString()));
homeMessageResponse.setTodayExtractCount(map.get("extractCount") == null ? 0 : Integer.parseInt(map.get("extractCount").toString()));
return Result.success().put("data", homeMessageResponse);
}

View File

@@ -42,5 +42,6 @@ public interface UserDao extends BaseMapper<UserEntity> {
int updateUserClientIdIsNull(String clientid);
Map<String, Object> queryPayInfo(@Param("start") String start, @Param("end") String end);
Map<String, Object> queryExtractInfo(@Param("start") String start, @Param("end") String end);
}

View File

@@ -48,5 +48,21 @@ public class HomeMessageResponse implements Serializable {
* 本年收入
*/
private Double yearRevenue;
/**
* 当日总支付金额
*/
private BigDecimal todayPayAmount;
/**
* 当日总支付笔数
*/
private Integer todayPayCount;
/**
* 当日提现金额
*/
private BigDecimal todayExtractAmount;
/**
* 当日提现笔数
*/
private Integer todayExtractCount;
}

View File

@@ -10,6 +10,7 @@ import com.sqx.modules.app.entity.UserEntity;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* 用户
@@ -235,4 +236,6 @@ public interface UserService extends IService<UserEntity> {
Result updateUserInviteAmount(UserInviteDTO userInviteDTO);
Result removeUserBlack(Long userId);
Map<String, Object> queryPayAndExtractInfo();
}

View File

@@ -117,28 +117,22 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
@Autowired
private MessageService messageService;
@Autowired
private CommonInfoService commonRepository;
@Autowired
private DiscSpinningService discSpinningService;
@Autowired
private SysUserService sysUserService;
@Autowired
private TbUserBlacklistMapper tbUserBlacklistMapper;
private final AliService aliService;
@Autowired
private UserDao userDao;
private final UserInfoService userInfoService;
private final UserVipDao userVipDao;
private final InviteAchievementService inviteAchievementService;
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);
@Autowired
private CourseDao courseDao;
public UserServiceImpl(@Lazy AliService aliService, UserInfoService userInfoService, UserVipDao userVipDao, InviteAchievementService inviteAchievementService) {
this.aliService = aliService;
public UserServiceImpl(UserInfoService userInfoService, UserVipDao userVipDao, InviteAchievementService inviteAchievementService) {
this.userInfoService = userInfoService;
this.userVipDao = userVipDao;
this.inviteAchievementService = inviteAchievementService;
}
@Override
@@ -1795,4 +1789,24 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
}
return Result.success("解除拉黑成功");
}
@Override
public Map<String, Object> queryPayAndExtractInfo() {
Date date = new Date();
DateTime beginOfDay = DateUtil.beginOfDay(date);
DateTime endOfDay = DateUtil.endOfDay(date);
String begin = DateUtil.format(beginOfDay, "yyyy-MM-dd HH:mm:ss");
String end = DateUtil.format(endOfDay, "yyyy-MM-dd HH:mm:ss");
Map<String, Object> payInfo = userDao.queryPayInfo(begin, end);
Map<String, Object> extractInfo = userDao.queryExtractInfo(begin, end);
Map<String, Object> result = new HashMap<>();
result.put("payAmount", payInfo.get("totalMoney"));
result.put("payCount", payInfo.get("totalCount"));
result.put("extractAmount", extractInfo.get("totalMoney"));
result.put("extractCount", extractInfo.get("totalCount"));
return result;
}
}

View File

@@ -313,5 +313,21 @@
where clientid = #{clientid}
</update>
<select id="queryPayInfo" resultType="map">
select SUM(pay_money) AS totalmoney,
COUNT(1) AS tocalCount
from `orders`
where status=1 and pay_way=9
and create_time between #{start} and #{end}
</select>
<select id="queryExtractInfo" resultType="map">
select SUM(money) AS totalmoney,
COUNT(1) AS tocalCount
from `cash_out`
where state=1
and create_at between #{start} and #{end}
</select>
</mapper>