新增account 批量扣除 test

This commit is contained in:
tianfeng 2026-01-13 19:44:24 +08:00
parent 74e07159e9
commit e2d3955793

View File

@ -1,4 +1,6 @@
import com.red.circle.OtherServiceApplication;
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.domain.model.user.UserProfile;
import com.red.circle.other.infra.common.team.decay.ListMemberWorkDecay;
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMemberTarget;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberTargetService;
@ -29,6 +31,8 @@ public class AnchorTargetTest {
private ListMemberWorkDecay listMemberWorkDecay;
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private UserProfileGateway userProfileGateway;
/**
@ -111,10 +115,42 @@ public class AnchorTargetTest {
*/
@Test
public void batchAnchorTargetDeduct() {
// 定义批量扣除的用户和金额列表
Map<Long, Long> map = Map.ofEntries(
Map.entry(8832761L, 150000L),
Map.entry(8834979L, 300000L),
Map.entry(8834654L, 300000L),
Map.entry(8839847L, 300000L),
Map.entry(8827498L, 150000L),
Map.entry(8839866L, 150000L),
Map.entry(8839902L, 300000L),
Map.entry(8839851L, 300000L),
Map.entry(8839894L, 300000L),
Map.entry(8840819L, 300000L),
Map.entry(8839949L, 300000L),
Map.entry(8839954L, 300000L),
Map.entry(8839957L, 300000L),
Map.entry(90090L, 1500000L),
Map.entry(8831059L, 150000L),
Map.entry(8829177L, 150000L),
Map.entry(8840323L, 300000L)
);
// 将account转换为userId并构建batchDeductMap
Map<Long, Long> batchDeductMap = new HashMap<>();
batchDeductMap.put(1957345312961527809L, 1L);
batchDeductMap.put(1989287471839113218L, 1L);
map.forEach((account, amount) -> {
UserProfile userProfile = userProfileGateway.getByAccount("LIKEI", String.valueOf(account));
if (Objects.nonNull(userProfile)) {
batchDeductMap.put(userProfile.getId(), amount);
} else {
throw new RuntimeException("账号不存在:" + account);
}
});
// 定义批量扣除的用户和金额列表
// Map<Long, Long> batchDeductMap = new HashMap<>();
// batchDeductMap.put(1957345312961527809L, 1L);
// batchDeductMap.put(1989287471839113218L, 1L);
// 可以继续添加更多用户...
System.out.println("========== 开始批量扣除 ==========");