update 后台管理新增定时任务开关,收益入库定时任务修改。新增用户待支付汇总 接口
This commit is contained in:
@@ -95,6 +95,8 @@ public class ManageDocumentsController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//@PostMapping("/searchDocument")
|
||||
//@ApiOperation(value = "业务系统:按关键字搜索文章内容")
|
||||
//public TableDataInfo<ManageDocumentDto> searchDocument(@RequestBody ManageSearchDocumentVo manageSearchDocumentVo){
|
||||
|
||||
@@ -10,10 +10,7 @@ import com.m2pool.manage.service.ManageUserService;
|
||||
import com.m2pool.manage.vo.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@@ -83,4 +80,11 @@ public class ManageUserController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/summaryOfPendingPayments")
|
||||
@ApiOperation(value = "管理系统:用户待支付汇总")
|
||||
@RequiresLogin
|
||||
@RequiresRoles(value = {"back_admin","admin"}, logical = Logical.OR)
|
||||
public R<List<SummaryOfPendingPaymentsDto>> summaryOfPendingPayments(){
|
||||
return manageUserService.summaryOfPendingPayments();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,4 +109,12 @@ public interface ManageBroadcastMapper extends BaseMapper<ManageBroadcast> {
|
||||
* @return
|
||||
*/
|
||||
int selectNeedDeleteNumbers(@Param("coin") String coin, @Param("date") LocalDateTime date);
|
||||
|
||||
|
||||
/**
|
||||
* 获取起付额
|
||||
* @param coin
|
||||
* @return
|
||||
*/
|
||||
List<SummaryOfPendingPaymentsDto> getStartPayments(@Param("list") List<SummaryOfPendingPaymentsDto> summaryOfPendingPaymentsList );
|
||||
}
|
||||
|
||||
@@ -35,4 +35,12 @@ public interface ManageWalletOutInMapper extends BaseMapper<ManageWalletOutIn> {
|
||||
@DistributionDB
|
||||
List<ManageWalletOutIn> getWalletOut(@Param("startDate") LocalDateTime startDate);
|
||||
|
||||
/**
|
||||
* 获取用户待支付汇总
|
||||
* @param coin
|
||||
* @return
|
||||
*/
|
||||
@DistributionDB
|
||||
List<SummaryOfPendingPaymentsDto> summaryOfPendingPayments();
|
||||
|
||||
}
|
||||
|
||||
@@ -59,4 +59,13 @@ public interface ManageUserService{
|
||||
* @return
|
||||
*/
|
||||
R<List<ManageMiningUserOnlineDto>> getMinerUserOnlineStatus(ManageMiningUserPowerVo manageMiningUserPowerVo);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 管理系统:用户待支付汇总
|
||||
* @param coinVo
|
||||
* @return
|
||||
*/
|
||||
R<List<SummaryOfPendingPaymentsDto>> summaryOfPendingPayments();
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.m2pool.common.core.utils.StringUtils;
|
||||
import com.m2pool.common.core.web.page.TableDataInfo;
|
||||
import com.m2pool.manage.dto.*;
|
||||
import com.m2pool.manage.mapper.ManageBroadcastMapper;
|
||||
import com.m2pool.manage.mapper.ManageWalletOutInMapper;
|
||||
import com.m2pool.manage.service.ManageUserService;
|
||||
import com.m2pool.manage.utils.PowerUnitUtils;
|
||||
import com.m2pool.manage.vo.*;
|
||||
@@ -35,6 +36,9 @@ public class ManageUserServiceImpl implements ManageUserService {
|
||||
@Resource
|
||||
private ManageBroadcastMapper manageBroadcastMapper;
|
||||
|
||||
@Resource
|
||||
private ManageWalletOutInMapper manageWalletOutInMapper;
|
||||
|
||||
@Resource
|
||||
private JavaMailSenderImpl javaMailSender;
|
||||
|
||||
@@ -240,7 +244,29 @@ public class ManageUserServiceImpl implements ManageUserService {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<SummaryOfPendingPaymentsDto>> summaryOfPendingPayments() {
|
||||
List<SummaryOfPendingPaymentsDto> summaryOfPendingPaymentsList = manageWalletOutInMapper.summaryOfPendingPayments();
|
||||
System.out.println("起付额:"+summaryOfPendingPaymentsList);
|
||||
//查询起付额
|
||||
List<SummaryOfPendingPaymentsDto> startPayments = manageBroadcastMapper.getStartPayments(summaryOfPendingPaymentsList);
|
||||
|
||||
|
||||
|
||||
// 创建一个 Map 用于存储第二个集合中元素的 user 和 coin 组合对应的 startPayAmount
|
||||
Map<String, BigDecimal> startPayAmountMap = startPayments.stream()
|
||||
.collect(Collectors.toMap(
|
||||
dto -> dto.getUser() + "_" + dto.getCoin(),
|
||||
SummaryOfPendingPaymentsDto::getStartPayAmount
|
||||
));
|
||||
System.out.println("起付额22:"+startPayAmountMap);
|
||||
// 遍历第一个集合,根据 user 和 coin 从 Map 中查找对应的 startPayAmount 并填充
|
||||
for (SummaryOfPendingPaymentsDto dto : summaryOfPendingPaymentsList) {
|
||||
String key = dto.getUser() + "_" + dto.getCoin();
|
||||
if (startPayAmountMap.containsKey(key)) {
|
||||
dto.setStartPayAmount(startPayAmountMap.get(key));
|
||||
}else{
|
||||
dto.setStartPayAmount(BigDecimal.ZERO);
|
||||
}
|
||||
}
|
||||
return R.success(summaryOfPendingPaymentsList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.m2pool.manage.entity.ManageWalletOutIn;
|
||||
import com.m2pool.manage.mapper.ManageBroadcastMapper;
|
||||
import com.m2pool.manage.mapper.ManageWalletOutInMapper;
|
||||
import com.m2pool.manage.service.ManageWalletOutInService;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@@ -22,9 +24,12 @@ import java.util.stream.Stream;
|
||||
* @Date 2025/7/15 15:45
|
||||
* @Author yyb
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "task.manage")
|
||||
@EnableScheduling
|
||||
public class ManageTask {
|
||||
private boolean enable;
|
||||
|
||||
@Resource
|
||||
private ManageWalletOutInService manageWalletOutInService;
|
||||
@@ -37,7 +42,7 @@ public class ManageTask {
|
||||
/**
|
||||
* 存储交易记录定时任务
|
||||
*/
|
||||
@Scheduled(cron = "22 17 0/1 * * ?")
|
||||
@Scheduled(cron = "22 35 0/1 * * ?")
|
||||
//@Scheduled(cron = "0 0/1 * * * ?")
|
||||
public void insertDataToWalletOutInDb(){
|
||||
ManageWalletOutIn manageWalletOutIn = manageWalletOutInMapper.selectOne(new LambdaQueryWrapper<ManageWalletOutIn>()
|
||||
@@ -147,6 +152,9 @@ public class ManageTask {
|
||||
*/
|
||||
@Scheduled(cron = "5 5 1 * * ?")
|
||||
public void deleteOnlineAndOfflineDataForNexa(){
|
||||
if (!enable){
|
||||
return;
|
||||
}
|
||||
// 记录开始时间(纳秒)
|
||||
long startTime = System.nanoTime();
|
||||
|
||||
@@ -164,6 +172,9 @@ public class ManageTask {
|
||||
|
||||
@Scheduled(cron = "10 5 2 * * ?")
|
||||
public void deleteOnlineAndOfflineDataForMona(){
|
||||
if (!enable){
|
||||
return;
|
||||
}
|
||||
// 记录开始时间(纳秒)
|
||||
long startTime = System.nanoTime();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -180,6 +191,9 @@ public class ManageTask {
|
||||
|
||||
@Scheduled(cron = "10 5 3 * * ?")
|
||||
public void deleteOnlineAndOfflineDataForRxd(){
|
||||
if (!enable){
|
||||
return;
|
||||
}
|
||||
// 记录开始时间(纳秒)
|
||||
long startTime = System.nanoTime();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -196,6 +210,9 @@ public class ManageTask {
|
||||
|
||||
@Scheduled(cron = "10 5 4 * * ?")
|
||||
public void deleteOnlineAndOfflineDataForGrs(){
|
||||
if (!enable){
|
||||
return;
|
||||
}
|
||||
// 记录开始时间(纳秒)
|
||||
long startTime = System.nanoTime();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -212,6 +229,9 @@ public class ManageTask {
|
||||
|
||||
@Scheduled(cron = "10 5 5 * * ?")
|
||||
public void deleteOnlineAndOfflineDataForEnx(){
|
||||
if (!enable){
|
||||
return;
|
||||
}
|
||||
// 记录开始时间(纳秒)
|
||||
long startTime = System.nanoTime();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -228,6 +248,9 @@ public class ManageTask {
|
||||
|
||||
@Scheduled(cron = "10 5 6 * * ?")
|
||||
public void deleteOnlineAndOfflineDataForAlph(){
|
||||
if (!enable){
|
||||
return;
|
||||
}
|
||||
// 记录开始时间(纳秒)
|
||||
long startTime = System.nanoTime();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -244,6 +267,9 @@ public class ManageTask {
|
||||
|
||||
@Scheduled(cron = "10 5 7 * * ?")
|
||||
public void deleteOnlineAndOfflineDataForDgbo(){
|
||||
if (!enable){
|
||||
return;
|
||||
}
|
||||
// 记录开始时间(纳秒)
|
||||
long startTime = System.nanoTime();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -260,6 +286,9 @@ public class ManageTask {
|
||||
|
||||
@Scheduled(cron = "10 5 8 * * ?")
|
||||
public void deleteOnlineAndOfflineDataForDgbq(){
|
||||
if (!enable){
|
||||
return;
|
||||
}
|
||||
// 记录开始时间(纳秒)
|
||||
long startTime = System.nanoTime();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -276,6 +305,9 @@ public class ManageTask {
|
||||
|
||||
@Scheduled(cron = "10 5 9 * * ?")
|
||||
public void deleteOnlineAndOfflineDataForDgbs(){
|
||||
if (!enable){
|
||||
return;
|
||||
}
|
||||
// 记录开始时间(纳秒)
|
||||
long startTime = System.nanoTime();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
@@ -2,10 +2,7 @@ package com.m2pool.manage.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* @Description 发送的邮箱信息
|
||||
@@ -16,7 +13,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "发送的邮箱信息")
|
||||
@ApiModel(description = "发送的邮箱信息", value="EmailVo")
|
||||
public class EmailVo{
|
||||
@ApiModelProperty(value = "接受者邮箱,多个以逗号隔开",example = "1416014977@qq.com,1328642438@qq.com")
|
||||
private String to;
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "基础请求对象")
|
||||
@ApiModel(description = "基础请求对象",value = "ManageBaseVo")
|
||||
public class ManageBaseVo {
|
||||
@ApiModelProperty(value = "id",example = "1")
|
||||
private Long id;
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@ApiModel(value = "广播请求对象")
|
||||
@ApiModel(description = "广播请求对象",value = "ManageBroadcastVo")
|
||||
public class ManageBroadcastVo{
|
||||
@ApiModelProperty(value = "id",example = "1")
|
||||
private Long id;
|
||||
|
||||
@@ -8,7 +8,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Description 用户请求对象
|
||||
* @Description 用户挖矿账户详情请求对象
|
||||
* @Date 2025/5/22 17:18
|
||||
* @Author yyb
|
||||
*/
|
||||
@@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "用户挖矿账户详情请求对象")
|
||||
@ApiModel(value = "ManageMiningUserVo",description = "用户挖矿账户详情请求对象")
|
||||
public class ManageMiningUserVo{
|
||||
|
||||
@ApiModelProperty(value = "用户名(邮箱)",example = "1328642438@qq.com",required = true)
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "用户请求对象")
|
||||
@ApiModel(value = "ManageUserVo",description = "用户请求对象")
|
||||
public class ManageUserVo extends PageVo{
|
||||
@ApiModelProperty(value = "查询条件:币种,进入页面默认只显示出nexa,用户可选择",example = "nexa",required = true)
|
||||
private String coin;
|
||||
|
||||
@@ -10,7 +10,7 @@ import lombok.Data;
|
||||
* @Author yyb
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "分页请求对象")
|
||||
@ApiModel(value = "PageVo",description = "分页请求对象")
|
||||
public class PageVo {
|
||||
@ApiModelProperty(value = "当前页码 (默认为1)",example = "1")
|
||||
private Integer pageNum = 1;
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
FROM
|
||||
wallet_in
|
||||
where
|
||||
coin = #{coin} AND `user` = #{user}
|
||||
coin = #{coin} AND `user` = #{user} and state = 1
|
||||
</select>
|
||||
<select id="getAccountExpend" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
@@ -153,8 +153,23 @@
|
||||
select count(*) from ${coin}_mhs30m where `date` <![CDATA[ <= ]]> #{date}
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteOnlineAndOfflineData">
|
||||
delete from ${coin}_mhs30m where `date` <![CDATA[ <= ]]> #{date} LIMIT 5000
|
||||
</delete>
|
||||
|
||||
<select id="getStartPayments" resultType="com.m2pool.manage.dto.SummaryOfPendingPaymentsDto">
|
||||
SELECT
|
||||
uma.miner_user AS `user`,
|
||||
uma.coin,
|
||||
COALESCE ( uab.amount, 0 ) as startPayAmount
|
||||
FROM
|
||||
user_account_balance uab
|
||||
JOIN user_miner_account uma ON uma.id = uab.ma_id
|
||||
WHERE
|
||||
<foreach collection="list" item="item" separator="OR">
|
||||
(`user` = #{item.user} AND coin = #{item.coin})
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -9,19 +9,19 @@
|
||||
SELECT
|
||||
wi.coin,
|
||||
wi.`user`,
|
||||
wi.should_out_date AS shouldOutDate,
|
||||
wi.should_out_date AS `date`,
|
||||
wi.amount AS allocationAmount,
|
||||
wi.`create_date` as `date`,
|
||||
wi.`create_date` as `shouldOutDate`,
|
||||
wi.max_height AS maxHeight
|
||||
FROM
|
||||
wallet_in wi
|
||||
<where>
|
||||
<choose>
|
||||
<when test="startDate != null">
|
||||
wi.`create_date` >= DATE(#{startDate})
|
||||
wi.`should_out_date` >= DATE(#{startDate})
|
||||
</when>
|
||||
<otherwise>
|
||||
wi.`create_date` <![CDATA[ <= ]]> NOW()
|
||||
wi.`should_out_date` <![CDATA[ <= ]]> NOW()
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
@@ -44,4 +44,7 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="summaryOfPendingPayments" resultType="com.m2pool.manage.dto.SummaryOfPendingPaymentsDto">
|
||||
select coin, max(max_height) as maxHeight, max(should_out_date) AS shouldOutDate, `user`, sum(amount) as needPayAmount from wallet_in where state = 2 group by coin,`user`;
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user