改造授权接口

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

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

Loading…
Cancel
Save