|
|
|
@ -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<ItemDTO, Ret> {
|
|
|
|
|
@Autowired
|
|
|
|
|
GetAuthInfoTaskService getAuthInfoTaskService;
|
|
|
|
|
|
|
|
|
|
public class GetAuthInfoTimerService extends TimerBaseService implements ExtensionServiceHandler<ShopInfoDao, Ret> {
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse<Ret> handle(BaseRequest<ItemDTO> req) {
|
|
|
|
|
getAuthInfoTaskService.runTask();
|
|
|
|
|
return R.ok(Ret.success());
|
|
|
|
|
public BaseResponse<Ret> handle(BaseRequest<ShopInfoDao> 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<String, String> result = new HashMap<>();
|
|
|
|
|
result.put("result", JSONObject.toJSONString(data));
|
|
|
|
|
return R.ok(Ret.success(result));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|