fix(order): scan Google refunds for Yumi package

This commit is contained in:
hy001 2026-05-08 13:56:34 +08:00
parent c2bee924ce
commit 33b970a033
2 changed files with 12 additions and 10 deletions

View File

@ -5,7 +5,6 @@ import com.google.api.services.androidpublisher.model.VoidedPurchasesListRespons
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
import com.red.circle.component.pay.google.GoogleVerifyService; import com.red.circle.component.pay.google.GoogleVerifyService;
import com.red.circle.component.redis.annotation.TaskCacheLock; import com.red.circle.component.redis.annotation.TaskCacheLock;
import com.red.circle.component.redis.service.RedisService;
import com.red.circle.framework.web.props.EnvProperties; import com.red.circle.framework.web.props.EnvProperties;
import com.red.circle.order.app.common.RecycleReimburseOrderProductCommon; import com.red.circle.order.app.common.RecycleReimburseOrderProductCommon;
import com.red.circle.order.domain.tuple.KeyValuePair; import com.red.circle.order.domain.tuple.KeyValuePair;
@ -21,7 +20,6 @@ import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -35,6 +33,10 @@ import java.util.Objects;
@AllArgsConstructor @AllArgsConstructor
public class GoogleReimburseCheckTask { public class GoogleReimburseCheckTask {
private static final String LIKEI_ANDROID_PACKAGE_NAME = "com.org.yumiparty";
private static final int GOOGLE_REIMBURSE_SCAN_DAYS = 7;
private static final int GOOGLE_REIMBURSE_SCAN_MINUTES = GOOGLE_REIMBURSE_SCAN_DAYS * 24 * 60;
private final OrderCacheService orderCacheService; private final OrderCacheService orderCacheService;
private final EnvProperties envProperties; private final EnvProperties envProperties;
private final GoogleVerifyService googleVerifyService; private final GoogleVerifyService googleVerifyService;
@ -52,14 +54,14 @@ public class GoogleReimburseCheckTask {
return; return;
} }
executeReimburse(20); executeReimburse(GOOGLE_REIMBURSE_SCAN_MINUTES);
log.warn("exec google_reimburse_check_job end with {}",System.currentTimeMillis()-startTime); log.warn("exec google_reimburse_check_job end with {}", System.currentTimeMillis() - startTime);
} }
public void executeReimburse(int latestMinutes) { public void executeReimburse(int latestMinutes) {
List.of( List.of(
KeyValuePair.of(SysOriginPlatformEnum.LIKEI, "com.tkm.likei") KeyValuePair.of(SysOriginPlatformEnum.LIKEI, LIKEI_ANDROID_PACKAGE_NAME)
).forEach(keyValuePair -> { ).forEach(keyValuePair -> {
VoidedPurchasesListResponse response = googleVerifyService VoidedPurchasesListResponse response = googleVerifyService
.getVoidedPurchases(keyValuePair.getKey(), keyValuePair.getValue(), .getVoidedPurchases(keyValuePair.getKey(), keyValuePair.getValue(),

View File

@ -82,13 +82,13 @@ public class OrderGoogleVoidedPurchase extends TimestampBaseEntity {
private String description; private String description;
public String getVoidedSourceString() { public String getVoidedSourceString() {
if (Objects.equals(voidedReason, 0)) { if (Objects.equals(voidedSource, 0)) {
return "用户"; return "用户";
} }
if (Objects.equals(voidedReason, 1)) { if (Objects.equals(voidedSource, 1)) {
return "开发者"; return "开发者";
} }
if (Objects.equals(voidedReason, 2)) { if (Objects.equals(voidedSource, 2)) {
return "Google"; return "Google";
} }
return "未知"; return "未知";