update m2pool 新增下架和上架币种过程中所需的删除和恢复挖矿账户等接口
This commit is contained in:
@@ -87,4 +87,16 @@ public class ManageUserController {
|
||||
public TableDataInfo<SummaryOfPendingPaymentsDto> summaryOfPendingPayments(@RequestBody PageVo pageVo){
|
||||
return manageUserService.summaryOfPendingPayments(pageVo);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteUserAccount")
|
||||
@ApiOperation(value = "管理系统:下架币种--删除币种对应的所有挖矿账户")
|
||||
public R<String> deleteUserAccount(@RequestBody CoinVo coinVo){
|
||||
return manageUserService.deleteUserAccount(coinVo);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteUserAccount")
|
||||
@ApiOperation(value = "管理系统:重新上架已下架币种--把以前币种状态设置为5下架的改为 0")
|
||||
public R<String> addUserAccount(@RequestBody CoinVo coinVo){
|
||||
return manageUserService.addUserAccount(coinVo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.m2pool.manage.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Description 账户ID数据传输对象
|
||||
* @Date 2026/1/29
|
||||
* @Author lizixuan
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AccountIdsDto {
|
||||
/**
|
||||
* 矿机账户ID
|
||||
*/
|
||||
private Long minerId;
|
||||
|
||||
/**
|
||||
* 余额账户ID
|
||||
*/
|
||||
private Long balanceId;
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface ManageBroadcastMapper extends BaseMapper<ManageBroadcast> {
|
||||
@@ -117,4 +118,28 @@ public interface ManageBroadcastMapper extends BaseMapper<ManageBroadcast> {
|
||||
* @return
|
||||
*/
|
||||
List<SummaryOfPendingPaymentsDto> getStartPayments(@Param("list") List<SummaryOfPendingPaymentsDto> summaryOfPendingPaymentsList );
|
||||
|
||||
/**
|
||||
* 查询指定币种和状态的账户ID列表(包含矿机账户ID和余额账户ID)
|
||||
* @param coin 币种
|
||||
* @param status 状态
|
||||
* @return 返回AccountIdsDto列表,包含矿机账户ID和余额账户ID
|
||||
*/
|
||||
List<com.m2pool.manage.dto.AccountIdsDto> getAccountIdsByCoinAndStatus(@Param("coin") String coin, @Param("status") int status);
|
||||
|
||||
/**
|
||||
* 根据ID列表更新矿机账户状态
|
||||
* @param ids ID列表
|
||||
* @param newStatus 新状态
|
||||
* @return
|
||||
*/
|
||||
boolean updateUserMinerAccountStatusByIds(@Param("ids") List<Long> ids, @Param("newStatus") int newStatus);
|
||||
|
||||
/**
|
||||
* 根据ID列表更新账户余额状态
|
||||
* @param ids ID列表
|
||||
* @param newStatus 新状态
|
||||
* @return
|
||||
*/
|
||||
boolean updateUserAccountBalanceStatusByIds(@Param("ids") List<Long> ids, @Param("newStatus") int newStatus);
|
||||
}
|
||||
|
||||
@@ -68,4 +68,9 @@ public interface ManageUserService{
|
||||
* @return
|
||||
*/
|
||||
TableDataInfo<SummaryOfPendingPaymentsDto> summaryOfPendingPayments(PageVo pageVo);
|
||||
|
||||
|
||||
R<String> deleteUserAccount(CoinVo coinVo);
|
||||
|
||||
R<String> addUserAccount(CoinVo coinVo);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
@@ -279,4 +280,71 @@ public class ManageUserServiceImpl implements ManageUserService {
|
||||
PageHelper.clearPage();
|
||||
return rspData;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public R<String> deleteUserAccount(CoinVo coinVo) {
|
||||
List<AccountIdsDto> accountIdsList = manageBroadcastMapper.getAccountIdsByCoinAndStatus(coinVo.getCoin(), 0);
|
||||
if (accountIdsList == null || accountIdsList.isEmpty()) {
|
||||
return R.success("删除成功");
|
||||
}
|
||||
|
||||
List<Long> minerIds = new ArrayList<>();
|
||||
List<Long> balanceIds = new ArrayList<>();
|
||||
|
||||
for (AccountIdsDto accountIds : accountIdsList) {
|
||||
if (accountIds.getMinerId() != null) {
|
||||
minerIds.add(accountIds.getMinerId());
|
||||
}
|
||||
if (accountIds.getBalanceId() != null) {
|
||||
balanceIds.add(accountIds.getBalanceId());
|
||||
}
|
||||
}
|
||||
|
||||
boolean result1 = true;
|
||||
boolean result2 = true;
|
||||
|
||||
if (!minerIds.isEmpty()) {
|
||||
result1 = manageBroadcastMapper.updateUserMinerAccountStatusByIds(minerIds, 5);
|
||||
}
|
||||
if (!balanceIds.isEmpty()) {
|
||||
result2 = manageBroadcastMapper.updateUserAccountBalanceStatusByIds(balanceIds, 5);
|
||||
}
|
||||
|
||||
return (result1 && result2) ? R.success("删除成功") : R.fail("删除失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public R<String> addUserAccount(CoinVo coinVo) {
|
||||
List<AccountIdsDto> accountIdsList = manageBroadcastMapper.getAccountIdsByCoinAndStatus(coinVo.getCoin(), 5);
|
||||
if (accountIdsList == null || accountIdsList.isEmpty()) {
|
||||
return R.success("添加成功");
|
||||
}
|
||||
|
||||
List<Long> minerIds = new ArrayList<>();
|
||||
List<Long> balanceIds = new ArrayList<>();
|
||||
|
||||
for (AccountIdsDto accountIds : accountIdsList) {
|
||||
if (accountIds.getMinerId() != null) {
|
||||
minerIds.add(accountIds.getMinerId());
|
||||
}
|
||||
if (accountIds.getBalanceId() != null) {
|
||||
balanceIds.add(accountIds.getBalanceId());
|
||||
}
|
||||
}
|
||||
|
||||
boolean result1 = true;
|
||||
boolean result2 = true;
|
||||
|
||||
if (!minerIds.isEmpty()) {
|
||||
result1 = manageBroadcastMapper.updateUserMinerAccountStatusByIds(minerIds, 0);
|
||||
}
|
||||
if (!balanceIds.isEmpty()) {
|
||||
result2 = manageBroadcastMapper.updateUserAccountBalanceStatusByIds(balanceIds, 0);
|
||||
}
|
||||
|
||||
return (result1 && result2) ? R.success("添加成功") : R.fail("添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,4 +173,30 @@
|
||||
</foreach>)
|
||||
</select>
|
||||
|
||||
<select id="getAccountIdsByCoinAndStatus" resultType="com.m2pool.manage.dto.AccountIdsDto">
|
||||
SELECT
|
||||
uma.id as minerId,
|
||||
uab.id as balanceId
|
||||
FROM
|
||||
user_miner_account uma
|
||||
LEFT JOIN
|
||||
user_account_balance uab ON uma.id = uab.ma_id AND uab.status = #{status}
|
||||
WHERE
|
||||
uma.coin = #{coin} AND uma.status = #{status}
|
||||
</select>
|
||||
|
||||
<update id="updateUserMinerAccountStatusByIds">
|
||||
UPDATE user_miner_account SET status = #{newStatus} WHERE id IN
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateUserAccountBalanceStatusByIds">
|
||||
UPDATE user_account_balance SET status = #{newStatus} WHERE ma_id IN
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user