master
ljl 9 months ago
parent d4c36f1fc0
commit 7e6cfe4e0a

@ -0,0 +1,8 @@
package com.ms.api.dto;
import lombok.Data;
@Data
public class ShopInfoDao {
private String shopId;
}

@ -1,26 +1,40 @@
package com.ms.biz.spi.timer; 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.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse; import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService; import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler; 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.R;
import com.ms.biz.common.Ret; import com.ms.biz.common.Ret;
import com.ms.biz.common.TimerBaseService; import com.ms.biz.common.TimerBaseService;
import com.ms.biz.task.GetAuthInfoTaskService; import com.ms.biz.util.DDApi;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
@ExtensionService("getAuthInfoTimer") @ExtensionService("getAuthInfoTimer")
@Slf4j @Slf4j
public class GetAuthInfoTimerService extends TimerBaseService implements ExtensionServiceHandler<ItemDTO, Ret> { public class GetAuthInfoTimerService extends TimerBaseService implements ExtensionServiceHandler<ShopInfoDao, Ret> {
@Autowired
GetAuthInfoTaskService getAuthInfoTaskService;
@Override @Override
public BaseResponse<Ret> handle(BaseRequest<ItemDTO> req) { public BaseResponse<Ret> handle(BaseRequest<ShopInfoDao> req) {
getAuthInfoTaskService.runTask(); String shopId = req.getData().getShopId();
return R.ok(Ret.success()); 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<String, String> result = new HashMap<>();
result.put("result", JSONObject.toJSONString(data));
return R.ok(Ret.success(result));
} }
} }

Loading…
Cancel
Save