From 7e6cfe4e0a450bcfde77ff4d65239c587416000c Mon Sep 17 00:00:00 2001 From: ljl Date: Wed, 21 Feb 2024 11:40:13 +0800 Subject: [PATCH] yh --- .../main/java/com/ms/api/dto/ShopInfoDao.java | 8 +++++ .../spi/timer/GetAuthInfoTimerService.java | 34 +++++++++++++------ 2 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 ms-api/src/main/java/com/ms/api/dto/ShopInfoDao.java diff --git a/ms-api/src/main/java/com/ms/api/dto/ShopInfoDao.java b/ms-api/src/main/java/com/ms/api/dto/ShopInfoDao.java new file mode 100644 index 0000000..9206b16 --- /dev/null +++ b/ms-api/src/main/java/com/ms/api/dto/ShopInfoDao.java @@ -0,0 +1,8 @@ +package com.ms.api.dto; + +import lombok.Data; + +@Data +public class ShopInfoDao { + private String shopId; +} diff --git a/ms-biz/src/main/java/com/ms/biz/spi/timer/GetAuthInfoTimerService.java b/ms-biz/src/main/java/com/ms/biz/spi/timer/GetAuthInfoTimerService.java index e32d3a9..0ff389a 100644 --- a/ms-biz/src/main/java/com/ms/biz/spi/timer/GetAuthInfoTimerService.java +++ b/ms-biz/src/main/java/com/ms/biz/spi/timer/GetAuthInfoTimerService.java @@ -1,26 +1,40 @@ package com.ms.biz.spi.timer; +import com.alibaba.fastjson.JSONObject; +import com.doudian.open.api.open_getAuthInfo.data.OpenGetAuthInfoData; +import com.doudian.open.api.open_getAuthInfo.param.OpenGetAuthInfoParam; +import com.doudian.open.utils.StringUtil; import com.jinritemai.cloud.base.api.BaseRequest; import com.jinritemai.cloud.base.api.BaseResponse; import com.jinritemai.cloud.base.api.ExtensionService; import com.jinritemai.cloud.base.api.ExtensionServiceHandler; -import com.ms.api.dto.ItemDTO; +import com.jinritemai.cloud.base.core.util.AuthThreadLocalUtil; +import com.ms.api.dto.ShopInfoDao; import com.ms.biz.common.R; import com.ms.biz.common.Ret; import com.ms.biz.common.TimerBaseService; -import com.ms.biz.task.GetAuthInfoTaskService; +import com.ms.biz.util.DDApi; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; + +import java.util.HashMap; +import java.util.Map; @ExtensionService("getAuthInfoTimer") @Slf4j -public class GetAuthInfoTimerService extends TimerBaseService implements ExtensionServiceHandler { - @Autowired - GetAuthInfoTaskService getAuthInfoTaskService; - +public class GetAuthInfoTimerService extends TimerBaseService implements ExtensionServiceHandler { @Override - public BaseResponse handle(BaseRequest req) { - getAuthInfoTaskService.runTask(); - return R.ok(Ret.success()); + public BaseResponse handle(BaseRequest req) { + String shopId = req.getData().getShopId(); + if (StringUtil.isEmpty(shopId)) { + shopId = "4463798"; + } + AuthThreadLocalUtil.set(shopId); + OpenGetAuthInfoParam param = new OpenGetAuthInfoParam(); + param.setAuthId(shopId); + OpenGetAuthInfoData data = DDApi.getAuthInfo(param); + log.info("GetAuthInfoServiceļ¼š" + JSONObject.toJSONString(data)); + Map result = new HashMap<>(); + result.put("result", JSONObject.toJSONString(data)); + return R.ok(Ret.success(result)); } }