改造授权接口

20230922-ljl-fixBug
qiushengjie 1 year ago
parent e7197c5d43
commit f7e1a6002b

@ -24,14 +24,13 @@ import java.util.*;
@Slf4j @Slf4j
public class DsTestJavaRequestService implements ExtensionServiceHandler<ItemDTO, String> { public class DsTestJavaRequestService implements ExtensionServiceHandler<ItemDTO, String> {
// @Autowired
// private DsFormRequestTemplate dsFormRequestTemplate;
@Autowired @Autowired
private DsJsonRequestTemplate dsJsonRequestTemplate; private DsJsonRequestTemplate dsJsonRequestTemplate;
@Override @Override
public BaseResponse<String> handle(BaseRequest<ItemDTO> req) { public BaseResponse<String> handle(BaseRequest<ItemDTO> req) {
log.info("");
HashMap<String, Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
List<String> arrayString = new ArrayList<>(); List<String> arrayString = new ArrayList<>();

@ -0,0 +1,75 @@
package com.ms.api.bo;
import lombok.Data;
import java.util.Date;
@Data
public class ShopBO {
/**
* shop_id
*/
private Long shopId;
/**
* shop_name
*/
private String shopName;
/**
* access_token
*/
private String accessToken;
/**
* refresh_token
*/
private String refreshToken;
/**
* expires_in
*/
private String expiresIn;
/**
* last_login_ip
*/
private String lastLoginIp;
/**
* total_product
*/
private Integer totalProduct;
/**
* total_move_detail
*/
private Integer totalMoveDetail;
/**
* app_version
*/
private String appVersion;
/**
* gmt_last_login
*/
private Date gmtLastLogin;
/**
* gmt_expire
*/
private Date gmtExpire;
/**
* gmt_create
*/
private Date gmtCreate;
/**
* gmt_modified
*/
private Date gmtModified;
}

@ -1,9 +1,28 @@
package com.ms.api.common; package com.ms.api.common;
import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.bo.ShopBO;
import com.ms.dal.entity.Shop;
/** /**
* SPI * SPI
*/ */
public class SPIBaseService { public class SPIBaseService<T,R> implements ExtensionServiceHandler<T, R> {
protected String shopId;
protected ShopBO shopInfo;
@Override
public BaseResponse<R> handle(BaseRequest<T> req) {
shopId = req.getAuthId();
// TODO 后面可以改为redis
// TODO 数据库查下shopId 有就注入到shopInfo中没有要新增
// TODO 并且调用抖店的查询店铺详情接口补充详情,可以是accesToken那个接口
return null;
}
} }

@ -8,25 +8,30 @@ import com.ms.api.common.R;
import com.ms.api.common.SPIBaseService; import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.auth.GetPlatformAuthUrlRequestDTO; import com.ms.api.dto.auth.GetPlatformAuthUrlRequestDTO;
import com.ms.api.tool.DsFormRequestTemplate; import com.ms.api.tool.DsFormRequestTemplate;
import com.ms.api.tool.DsJsonRequestTemplate;
import com.ms.api.tool.SecurityTool; import com.ms.api.tool.SecurityTool;
import com.ms.api.common.UniqueKeyMultiValueMap; import com.ms.api.common.UniqueKeyMultiValueMap;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import java.util.HashMap;
/** /**
* 1688 * 1688
* 16881688 * 16881688
*/ */
@ExtensionService("getPlatformAuthUrl") @ExtensionService("getPlatformAuthUrl")
@Slf4j @Slf4j
public class GetPlatformAuthUrlService extends SPIBaseService implements ExtensionServiceHandler<GetPlatformAuthUrlRequestDTO, String> { public class GetPlatformAuthUrlService extends SPIBaseService<GetPlatformAuthUrlRequestDTO, String> {
@Autowired @Autowired
private DsFormRequestTemplate dsFormRequestTemplate; private DsJsonRequestTemplate dsJsonRequestTemplate;
@Override @Override
public BaseResponse<String> handle(BaseRequest<GetPlatformAuthUrlRequestDTO> req) { public BaseResponse<String> handle(BaseRequest<GetPlatformAuthUrlRequestDTO> req) {
super.handle(req);
// ----参数校验---- // ----参数校验----
GetPlatformAuthUrlRequestDTO fields = req.getData(); GetPlatformAuthUrlRequestDTO fields = req.getData();
@ -35,12 +40,12 @@ public class GetPlatformAuthUrlService extends SPIBaseService implements Extensi
// ----业务处理---- // ----业务处理----
// TODO 群里讨论过说,先判断下获取授权信息列表,如果授权过,就不用再获取这个链接 open/platform_shop/get_platform_auth_url // TODO 群里讨论过说,先判断下获取授权信息列表,如果授权过,就不用再获取这个链接 open/platform_shop/get_platform_auth_url
MultiValueMap<String, String> params = new UniqueKeyMultiValueMap<>(); HashMap<String, String> params = new HashMap<>();
params.add("userId", SecurityTool.encodeByAES(fields.getUserId())); params.put("userId", SecurityTool.encodeByAES(shopId));
params.add("platform","ddMicroApp"); params.put("platform","ddMicroApp");
String res = null; String res = null;
try { try {
res = dsFormRequestTemplate.execute("/platform_shop/getPlatformAuthUrl", params); res = dsJsonRequestTemplate.execute("/platform_shop/getPlatformAuthUrl", params);
log.info(res); log.info(res);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

Loading…
Cancel
Save