完善店铺更新token功能
This commit is contained in:
parent
d99743e84f
commit
1a47ac320c
8831
docs/qihang-erp.sql
8831
docs/qihang-erp.sql
File diff suppressed because it is too large
Load Diff
|
|
@ -1,16 +1,15 @@
|
|||
package com.qihang.oms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.qihang.common.common.AjaxResult;
|
||||
import com.qihang.common.common.PageQuery;
|
||||
import com.qihang.common.common.PageResult;
|
||||
import com.qihang.common.common.TableDataInfo;
|
||||
import com.qihang.oms.domain.SShop;
|
||||
import com.qihang.oms.domain.SShopSetting;
|
||||
import com.qihang.oms.domain.SShopPlatform;
|
||||
import com.qihang.oms.domain.SysLogisticsCompany;
|
||||
import com.qihang.oms.service.SShopPlatformService;
|
||||
import com.qihang.oms.service.SShopService;
|
||||
import com.qihang.oms.service.SShopSettingService;
|
||||
import com.qihang.oms.service.SysLogisticsCompanyService;
|
||||
import com.qihang.security.common.BaseController;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -18,6 +17,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -32,7 +32,7 @@ import java.util.List;
|
|||
public class ShopController extends BaseController {
|
||||
private final SysLogisticsCompanyService logisticsCompanyService;
|
||||
private final SShopService shopService;
|
||||
private final SShopSettingService shopSettingService;
|
||||
private final SShopPlatformService platformService;
|
||||
|
||||
/**
|
||||
* 查询店铺列表logistics
|
||||
|
|
@ -41,7 +41,7 @@ public class ShopController extends BaseController {
|
|||
@GetMapping("/list")
|
||||
public TableDataInfo list(SShop shop)
|
||||
{
|
||||
LambdaQueryWrapper<SShop> qw = new LambdaQueryWrapper<SShop>().eq(shop.getType()!=null,SShop::getType,shop.getType());
|
||||
LambdaQueryWrapper<SShop> qw = new LambdaQueryWrapper<SShop>().eq(shop.getPlatform()!=null,SShop::getPlatform,shop.getPlatform());
|
||||
List<SShop> list = shopService.list(qw);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ public class ShopController extends BaseController {
|
|||
@GetMapping("/platformList")
|
||||
public TableDataInfo platformList()
|
||||
{
|
||||
List<SShopSetting> list = shopSettingService.list();
|
||||
List<SShopPlatform> list = platformService.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ public class ShopController extends BaseController {
|
|||
@GetMapping(value = "/platform/{id}")
|
||||
public AjaxResult getPlatform(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(shopService.getById(id));
|
||||
return success(platformService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -76,7 +76,7 @@ public class ShopController extends BaseController {
|
|||
@PostMapping("/shop")
|
||||
public AjaxResult add(@RequestBody SShop shop)
|
||||
{
|
||||
shop.setModifyOn(System.currentTimeMillis()/1000);
|
||||
shop.setCreateTime(new Date());
|
||||
return toAjax(shopService.save(shop));
|
||||
}
|
||||
|
||||
|
|
@ -87,6 +87,7 @@ public class ShopController extends BaseController {
|
|||
@PutMapping("/shop")
|
||||
public AjaxResult edit(@RequestBody SShop shop)
|
||||
{
|
||||
shop.setUpdateTime(new Date());
|
||||
return toAjax(shopService.updateById(shop));
|
||||
}
|
||||
|
||||
|
|
@ -96,9 +97,9 @@ public class ShopController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@PutMapping("/platform")
|
||||
public AjaxResult edit(@RequestBody SShopSetting platform)
|
||||
public AjaxResult edit(@RequestBody SShopPlatform platform)
|
||||
{
|
||||
return toAjax(shopSettingService.updateById(platform));
|
||||
return toAjax(platformService.updateById(platform));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
package com.qihang.oms.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据中心-店铺
|
||||
* 电商平台店铺表
|
||||
* @TableName s_shop
|
||||
*/
|
||||
@Data
|
||||
|
|
@ -22,7 +23,7 @@ public class SShop implements Serializable {
|
|||
/**
|
||||
* 店铺别名
|
||||
*/
|
||||
private String nickname;
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 标识
|
||||
|
|
@ -37,32 +38,22 @@ public class SShop implements Serializable {
|
|||
/**
|
||||
* 对应第三方平台Id
|
||||
*/
|
||||
private Integer type;
|
||||
private Integer platform;
|
||||
|
||||
/**
|
||||
* 店铺url
|
||||
*/
|
||||
private String url;
|
||||
private String shopUrl;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer ordernum;
|
||||
private Integer orderNum;
|
||||
|
||||
/**
|
||||
* 是否删除0否1是
|
||||
*/
|
||||
private Integer isdelete;
|
||||
|
||||
/**
|
||||
* 是否显示(0:是1否)
|
||||
*/
|
||||
private Integer isshow;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Long modifyOn;
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
|
|
@ -70,34 +61,29 @@ public class SShop implements Serializable {
|
|||
private String remark;
|
||||
|
||||
/**
|
||||
* 第三方平台店铺id,淘宝天猫开放平台使用
|
||||
* 第三方平台店铺id
|
||||
*/
|
||||
private Long selleruserid;
|
||||
private Long sellerShopId;
|
||||
|
||||
/**
|
||||
* 卖家userId
|
||||
* Appkey(微信视频号小店专用)
|
||||
*/
|
||||
private String selleruseridstr;
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* Appsercet(微信视频号小店专用)
|
||||
*/
|
||||
private String appSercet;
|
||||
|
||||
/**
|
||||
* 第三方平台sessionKey(access_token)
|
||||
*/
|
||||
private String sessionkey;
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* Appkey
|
||||
* accessToken到期(秒)
|
||||
*/
|
||||
private String appkey;
|
||||
|
||||
/**
|
||||
* Appsercet
|
||||
*/
|
||||
private String appsercet;
|
||||
|
||||
/**
|
||||
* 到期
|
||||
*/
|
||||
private Long expiresIn;
|
||||
private Long accessExpiresIn;
|
||||
|
||||
/**
|
||||
* access_token开始时间
|
||||
|
|
@ -115,9 +101,14 @@ public class SShop implements Serializable {
|
|||
private Long refreshTokenTimeout;
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
* 创建时间
|
||||
*/
|
||||
private String apiRequestUrl;
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.qihang.oms.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 电商平台配置表
|
||||
* @TableName s_shop_platform
|
||||
*/
|
||||
@Data
|
||||
public class SShopPlatform implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 平台名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* appSecret
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 服务url
|
||||
*/
|
||||
private String serverUrl;
|
||||
|
||||
/**
|
||||
* 回调url
|
||||
*/
|
||||
private String redirectUrl;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
package com.qihang.oms.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 第三方平台设置
|
||||
* @TableName s_shop_setting
|
||||
*/
|
||||
@Data
|
||||
public class SShopSetting implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 配置名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* appSecret
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 阿里access token
|
||||
*/
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* 到期
|
||||
*/
|
||||
private Long expiresIn;
|
||||
|
||||
/**
|
||||
* access_token开始时间
|
||||
*/
|
||||
private Long accessTokenBegin;
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
private String refreshToken;
|
||||
|
||||
/**
|
||||
* 刷新token过期时间
|
||||
*/
|
||||
private Long refreshTokenTimeout;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Long modifyOn;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
*/
|
||||
private String requestUrl;
|
||||
|
||||
/**
|
||||
* 第三方店铺id
|
||||
*/
|
||||
private String thirdId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop(数据中心-店铺)】的数据库操作Mapper
|
||||
* @createDate 2024-05-10 09:39:26
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-04 14:53:08
|
||||
* @Entity com.qihang.oms.domain.SShop
|
||||
*/
|
||||
public interface SShopMapper extends BaseMapper<SShop> {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.qihang.oms.mapper;
|
||||
|
||||
import com.qihang.oms.domain.SShopPlatform;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-04 14:53:08
|
||||
* @Entity com.qihang.oms.domain.SShopPlatform
|
||||
*/
|
||||
public interface SShopPlatformMapper extends BaseMapper<SShopPlatform> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.qihang.oms.mapper;
|
||||
|
||||
import com.qihang.oms.domain.SShopSetting;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_setting(第三方平台设置)】的数据库操作Mapper
|
||||
* @createDate 2024-05-10 09:39:26
|
||||
* @Entity com.qihang.oms.domain.SShopSetting
|
||||
*/
|
||||
public interface SShopSettingMapper extends BaseMapper<SShopSetting> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.qihang.oms.service;
|
||||
|
||||
import com.qihang.oms.domain.SShopPlatform;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Service
|
||||
* @createDate 2024-06-04 14:53:08
|
||||
*/
|
||||
public interface SShopPlatformService extends IService<SShopPlatform> {
|
||||
|
||||
}
|
||||
|
|
@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop(数据中心-店铺)】的数据库操作Service
|
||||
* @createDate 2024-05-10 09:39:26
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Service
|
||||
* @createDate 2024-06-04 14:53:08
|
||||
*/
|
||||
public interface SShopService extends IService<SShop> {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
package com.qihang.oms.service;
|
||||
|
||||
import com.qihang.oms.domain.SShopSetting;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_setting(第三方平台设置)】的数据库操作Service
|
||||
* @createDate 2024-05-10 09:39:26
|
||||
*/
|
||||
public interface SShopSettingService extends IService<SShopSetting> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.qihang.oms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.oms.domain.SShopPlatform;
|
||||
import com.qihang.oms.service.SShopPlatformService;
|
||||
import com.qihang.oms.mapper.SShopPlatformMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-04 14:53:08
|
||||
*/
|
||||
@Service
|
||||
public class SShopPlatformServiceImpl extends ServiceImpl<SShopPlatformMapper, SShopPlatform>
|
||||
implements SShopPlatformService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -8,8 +8,8 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop(数据中心-店铺)】的数据库操作Service实现
|
||||
* @createDate 2024-05-10 09:39:26
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-04 14:53:08
|
||||
*/
|
||||
@Service
|
||||
public class SShopServiceImpl extends ServiceImpl<SShopMapper, SShop>
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
package com.qihang.oms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.oms.domain.SShopSetting;
|
||||
import com.qihang.oms.service.SShopSettingService;
|
||||
import com.qihang.oms.mapper.SShopSettingMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_setting(第三方平台设置)】的数据库操作Service实现
|
||||
* @createDate 2024-05-10 09:39:26
|
||||
*/
|
||||
@Service
|
||||
public class SShopSettingServiceImpl extends ServiceImpl<SShopSettingMapper, SShopSetting>
|
||||
implements SShopSettingService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -7,36 +7,33 @@
|
|||
<resultMap id="BaseResultMap" type="com.qihang.oms.domain.SShop">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="nickname" column="nickName" jdbcType="VARCHAR"/>
|
||||
<result property="nickName" column="nick_name" jdbcType="VARCHAR"/>
|
||||
<result property="ename" column="ename" jdbcType="VARCHAR"/>
|
||||
<result property="company" column="company" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="type" jdbcType="INTEGER"/>
|
||||
<result property="url" column="url" jdbcType="VARCHAR"/>
|
||||
<result property="ordernum" column="orderNum" jdbcType="INTEGER"/>
|
||||
<result property="isdelete" column="isDelete" jdbcType="INTEGER"/>
|
||||
<result property="isshow" column="isShow" jdbcType="INTEGER"/>
|
||||
<result property="modifyOn" column="modify_on" jdbcType="BIGINT"/>
|
||||
<result property="platform" column="platform" jdbcType="INTEGER"/>
|
||||
<result property="shopUrl" column="shop_url" jdbcType="VARCHAR"/>
|
||||
<result property="orderNum" column="order_num" jdbcType="INTEGER"/>
|
||||
<result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="selleruserid" column="sellerUserId" jdbcType="BIGINT"/>
|
||||
<result property="selleruseridstr" column="sellerUserIdStr" jdbcType="VARCHAR"/>
|
||||
<result property="sessionkey" column="sessionKey" jdbcType="VARCHAR"/>
|
||||
<result property="appkey" column="appkey" jdbcType="VARCHAR"/>
|
||||
<result property="appsercet" column="appSercet" jdbcType="VARCHAR"/>
|
||||
<result property="expiresIn" column="expires_in" jdbcType="BIGINT"/>
|
||||
<result property="sellerShopId" column="seller_shop_id" jdbcType="BIGINT"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSercet" column="app_sercet" jdbcType="VARCHAR"/>
|
||||
<result property="accessToken" column="access_token" jdbcType="VARCHAR"/>
|
||||
<result property="accessExpiresIn" column="access_expires_in" jdbcType="BIGINT"/>
|
||||
<result property="accessTokenBegin" column="access_token_begin" jdbcType="BIGINT"/>
|
||||
<result property="refreshToken" column="refresh_token" jdbcType="VARCHAR"/>
|
||||
<result property="refreshTokenTimeout" column="refresh_token_timeout" jdbcType="BIGINT"/>
|
||||
<result property="apiRequestUrl" column="api_request_url" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,nickName,
|
||||
ename,company,type,
|
||||
url,orderNum,isDelete,
|
||||
isShow,modify_on,remark,
|
||||
sellerUserId,sellerUserIdStr,sessionKey,
|
||||
appkey,appSercet,expires_in,
|
||||
id,name,nick_name,
|
||||
ename,company,platform,
|
||||
shop_url,order_num,is_delete,
|
||||
remark,seller_shop_id,app_key,
|
||||
app_sercet,access_token,access_expires_in,
|
||||
access_token_begin,refresh_token,refresh_token_timeout,
|
||||
api_request_url
|
||||
create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.qihang.oms.mapper.SShopPlatformMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.oms.domain.SShopPlatform">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSecret" column="app_secret" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="serverUrl" column="server_url" jdbcType="VARCHAR"/>
|
||||
<result property="redirectUrl" column="redirect_url" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,app_key,
|
||||
app_secret,remark,server_url,
|
||||
redirect_url,create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.qihang.oms.mapper.SShopSettingMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.oms.domain.SShopSetting">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSecret" column="app_secret" jdbcType="VARCHAR"/>
|
||||
<result property="accessToken" column="access_token" jdbcType="VARCHAR"/>
|
||||
<result property="expiresIn" column="expires_in" jdbcType="BIGINT"/>
|
||||
<result property="accessTokenBegin" column="access_token_begin" jdbcType="BIGINT"/>
|
||||
<result property="refreshToken" column="refresh_token" jdbcType="VARCHAR"/>
|
||||
<result property="refreshTokenTimeout" column="refresh_token_timeout" jdbcType="BIGINT"/>
|
||||
<result property="modifyOn" column="modify_on" jdbcType="BIGINT"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="requestUrl" column="request_url" jdbcType="VARCHAR"/>
|
||||
<result property="thirdId" column="third_id" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,app_key,
|
||||
app_secret,access_token,expires_in,
|
||||
access_token_begin,refresh_token,refresh_token_timeout,
|
||||
modify_on,remark,request_url,
|
||||
third_id
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package com.qihang.jd.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.qihang.common.common.AjaxResult;
|
||||
import com.qihang.common.enums.EnumShopType;
|
||||
import com.qihang.jd.domain.SShopPlatform;
|
||||
import com.qihang.jd.domain.bo.JdTokenCreateBo;
|
||||
import com.qihang.jd.service.SShopPlatformService;
|
||||
import com.qihang.jd.service.impl.SShopPlatformServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URLEncoder;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
public class JdOAuthController {
|
||||
private final SShopPlatformService platformService;
|
||||
private static Logger log = LoggerFactory.getLogger(JdOAuthController.class);
|
||||
|
||||
@GetMapping("/getOauthUrl")
|
||||
public AjaxResult OAuth(@RequestParam Integer shopId) throws IOException, InterruptedException {
|
||||
//查询配置信息
|
||||
SShopPlatform platform = platformService.getById(EnumShopType.JD.getIndex());
|
||||
if (!StringUtils.hasText(platform.getAppKey())) {
|
||||
return AjaxResult.error( "平台配置错误,没有找到AppKey");
|
||||
}
|
||||
if (!StringUtils.hasText(platform.getAppSecret())) {
|
||||
return AjaxResult.error( "第三方平台配置错误,没有找到AppSercet");
|
||||
}
|
||||
if (!StringUtils.hasText(platform.getRedirectUrl())) {
|
||||
return AjaxResult.error( "第三方平台配置错误,没有找到RedirectUrl");
|
||||
}
|
||||
String url = "https://open-oauth.jd.com/oauth2/to_login?app_key="+platform.getAppKey()+"&response_type=code&redirect_uri="
|
||||
+ URLEncoder.encode(platform.getRedirectUrl())+"&state="+shopId+"&scope=snsapi_base";
|
||||
return AjaxResult.success("SUCCESS",url);
|
||||
}
|
||||
|
||||
@PostMapping("/tokenCreate")
|
||||
public AjaxResult callback(@RequestBody JdTokenCreateBo bo) throws IOException, InterruptedException {
|
||||
log.info("京东授权返回code");
|
||||
if (!StringUtils.hasText(bo.getCode())) return AjaxResult.error("code不能为空");
|
||||
SShopPlatform platform = platformService.getById(EnumShopType.JD.getIndex());
|
||||
|
||||
String url = "https://open-oauth.jd.com/oauth2/access_token?app_key=" + platform.getAppKey() + "&app_secret=" + platform.getAppKey() + "&grant_type=authorization_code&code=" + bo.getCode();
|
||||
|
||||
HttpClient client = HttpClient.newBuilder().build();
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(URI.create(url)).header("Content-Type", "application/json").GET()
|
||||
.build();
|
||||
HttpResponse<String> result = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
|
||||
if(StringUtils.hasText("result.body()")){
|
||||
// 结果处理
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if(jsonObject.getInteger("code")>0){
|
||||
return AjaxResult.error(jsonObject.getString("msg"));
|
||||
}
|
||||
// platformService.updateShopSessionByShopId(bo.getShopId().longValue(),"aa");
|
||||
}
|
||||
/***
|
||||
*
|
||||
* {"access_token":"c9f997d0e44d4f118033c6e8e329f9e0zdbl","expires_in":31535999,"refresh_token":"c293b96a03a94013a471e50ebc3d2f9czi5m","scope":"snsapi_base","open_id":"PjmgY-ntsszAW81q9NRErnrUTVHhD-HC64HuspupG8Q","uid":"8474668550","time":1709518959147,"token_type":"bearer","code":0,"xid":"o*AASTnxHZ0sdNj9M3XhiMqYf0NTViY_IfFlQem3U6w1lv-neCalw"}
|
||||
*
|
||||
*
|
||||
* {
|
||||
* "access_token": "c9f997d0e44d4f118033c6e8e329f9e0zdbl",
|
||||
* "expires_in": 31535999,
|
||||
* "refresh_token": "c293b96a03a94013a471e50ebc3d2f9czi5m",
|
||||
* "scope": "snsapi_base",
|
||||
* "open_id": "PjmgY-ntsszAW81q9NRErnrUTVHhD-HC64HuspupG8Q",
|
||||
* "uid": "8474668550",
|
||||
* "time": 1709518959147,
|
||||
* "token_type": "bearer",
|
||||
* "code": 0,
|
||||
* "xid": "o*AASTnxHZ0sdNj9M3XhiMqYf0NTViY_IfFlQem3U6w1lv-neCalw"
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// String sessionKey = request.getParameter("top_session");
|
||||
// String state = request.getParameter("state");
|
||||
// try {
|
||||
// Integer shopId = Integer.parseInt(state);
|
||||
//// shopService.updateSessionKey(shopId, sessionKey);
|
||||
// return "redirect:/order/list?shopId=" + shopId;
|
||||
// } catch (Exception e) {
|
||||
// return "redirect:/?msg=callback_taobao_error";
|
||||
// }
|
||||
|
||||
return AjaxResult.success("SUCCESS");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
package com.qihang.jd.controller;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Controller
|
||||
public class OAuthController {
|
||||
// private final SysPlatformService platformService;
|
||||
// private final SysShopService shopService;
|
||||
private static Logger log = LoggerFactory.getLogger(OAuthController.class);
|
||||
|
||||
@GetMapping("/jd-api/oauth")
|
||||
public String aliOAuth(@RequestParam Integer shopId) throws IOException, InterruptedException {
|
||||
//查询店铺信息
|
||||
// var shop = shopService.selectShopById(shopId);
|
||||
// SysPlatform platform = platformService.selectById(shop.getType());
|
||||
// String url = "http://container.open.taobao.com/container?appkey=" + platform.getAppKey() + "&state=" + shopId;
|
||||
String url = "https://open-oauth.jd.com/oauth2/to_login?app_key=FB4CC3688E6F9065D4FF510A53BB60FF&response_type=code&redirect_uri=http%3A%2F%2Fwww.qumei.com&state=2&scope=snsapi_base";
|
||||
return "redirect:" + url;
|
||||
}
|
||||
|
||||
@RequestMapping("/jd-api/code_callback")
|
||||
public String callback(Model model, HttpServletRequest request) {
|
||||
log.info("京东授权返回code");
|
||||
String code = request.getParameter("code");//6RZ71G
|
||||
|
||||
//https://open-oauth.jd.com/oauth2/access_token?app_key=FB4CC3688E6F9065D4FF510A53BB60FF&app_secret=40e8c8b2427f4e6db8f4a39af27d719e&grant_type=authorization_code&code=6RZ71G
|
||||
|
||||
/***
|
||||
*
|
||||
* {"access_token":"c9f997d0e44d4f118033c6e8e329f9e0zdbl","expires_in":31535999,"refresh_token":"c293b96a03a94013a471e50ebc3d2f9czi5m","scope":"snsapi_base","open_id":"PjmgY-ntsszAW81q9NRErnrUTVHhD-HC64HuspupG8Q","uid":"8474668550","time":1709518959147,"token_type":"bearer","code":0,"xid":"o*AASTnxHZ0sdNj9M3XhiMqYf0NTViY_IfFlQem3U6w1lv-neCalw"}
|
||||
*
|
||||
*
|
||||
* {
|
||||
* "access_token": "c9f997d0e44d4f118033c6e8e329f9e0zdbl",
|
||||
* "expires_in": 31535999,
|
||||
* "refresh_token": "c293b96a03a94013a471e50ebc3d2f9czi5m",
|
||||
* "scope": "snsapi_base",
|
||||
* "open_id": "PjmgY-ntsszAW81q9NRErnrUTVHhD-HC64HuspupG8Q",
|
||||
* "uid": "8474668550",
|
||||
* "time": 1709518959147,
|
||||
* "token_type": "bearer",
|
||||
* "code": 0,
|
||||
* "xid": "o*AASTnxHZ0sdNj9M3XhiMqYf0NTViY_IfFlQem3U6w1lv-neCalw"
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String sessionKey = request.getParameter("top_session");
|
||||
String state = request.getParameter("state");
|
||||
try {
|
||||
Integer shopId = Integer.parseInt(state);
|
||||
// shopService.updateSessionKey(shopId, sessionKey);
|
||||
return "redirect:/order/list?shopId=" + shopId;
|
||||
} catch (Exception e) {
|
||||
return "redirect:/?msg=callback_taobao_error";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
package com.qihang.jd.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据中心-店铺
|
||||
* 电商平台店铺表
|
||||
* @TableName s_shop
|
||||
*/
|
||||
@Data
|
||||
|
|
@ -22,7 +23,7 @@ public class SShop implements Serializable {
|
|||
/**
|
||||
* 店铺别名
|
||||
*/
|
||||
private String nickname;
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 标识
|
||||
|
|
@ -37,32 +38,22 @@ public class SShop implements Serializable {
|
|||
/**
|
||||
* 对应第三方平台Id
|
||||
*/
|
||||
private Integer type;
|
||||
private Integer platform;
|
||||
|
||||
/**
|
||||
* 店铺url
|
||||
*/
|
||||
private String url;
|
||||
private String shopUrl;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer ordernum;
|
||||
private Integer orderNum;
|
||||
|
||||
/**
|
||||
* 是否删除0否1是
|
||||
*/
|
||||
private Integer isdelete;
|
||||
|
||||
/**
|
||||
* 是否显示(0:是1否)
|
||||
*/
|
||||
private Integer isshow;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Long modifyOn;
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
|
|
@ -70,34 +61,29 @@ public class SShop implements Serializable {
|
|||
private String remark;
|
||||
|
||||
/**
|
||||
* 第三方平台店铺id,淘宝天猫开放平台使用
|
||||
* 第三方平台店铺id
|
||||
*/
|
||||
private Long selleruserid;
|
||||
private Long sellerShopId;
|
||||
|
||||
/**
|
||||
* 卖家userId
|
||||
* Appkey(微信视频号小店专用)
|
||||
*/
|
||||
private String selleruseridstr;
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* Appsercet(微信视频号小店专用)
|
||||
*/
|
||||
private String appSercet;
|
||||
|
||||
/**
|
||||
* 第三方平台sessionKey(access_token)
|
||||
*/
|
||||
private String sessionkey;
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* Appkey
|
||||
* accessToken到期(秒)
|
||||
*/
|
||||
private String appkey;
|
||||
|
||||
/**
|
||||
* Appsercet
|
||||
*/
|
||||
private String appsercet;
|
||||
|
||||
/**
|
||||
* 到期
|
||||
*/
|
||||
private Long expiresIn;
|
||||
private Long accessExpiresIn;
|
||||
|
||||
/**
|
||||
* access_token开始时间
|
||||
|
|
@ -115,9 +101,14 @@ public class SShop implements Serializable {
|
|||
private Long refreshTokenTimeout;
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
* 创建时间
|
||||
*/
|
||||
private String apiRequestUrl;
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.qihang.jd.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 电商平台配置表
|
||||
* @TableName s_shop_platform
|
||||
*/
|
||||
@Data
|
||||
public class SShopPlatform implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 平台名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* appSecret
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 服务url
|
||||
*/
|
||||
private String serverUrl;
|
||||
|
||||
/**
|
||||
* 回调url
|
||||
*/
|
||||
private String redirectUrl;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
package com.qihang.jd.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 第三方平台设置
|
||||
* @TableName s_shop_setting
|
||||
*/
|
||||
@Data
|
||||
public class SShopSetting implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 配置名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* appSecret
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 阿里access token
|
||||
*/
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* 到期
|
||||
*/
|
||||
private Long expiresIn;
|
||||
|
||||
/**
|
||||
* access_token开始时间
|
||||
*/
|
||||
private Long accessTokenBegin;
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
private String refreshToken;
|
||||
|
||||
/**
|
||||
* 刷新token过期时间
|
||||
*/
|
||||
private Long refreshTokenTimeout;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Long modifyOn;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
*/
|
||||
private String requestUrl;
|
||||
|
||||
/**
|
||||
* 第三方店铺id
|
||||
*/
|
||||
private String thirdId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.qihang.jd.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class JdTokenCreateBo {
|
||||
private Integer shopId;
|
||||
private Integer platform;
|
||||
private String code;
|
||||
}
|
||||
|
|
@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop(数据中心-店铺)】的数据库操作Mapper
|
||||
* @createDate 2024-05-10 11:07:56
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-04 15:11:24
|
||||
* @Entity com.qihang.jd.domain.SShop
|
||||
*/
|
||||
public interface SShopMapper extends BaseMapper<SShop> {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.qihang.jd.mapper;
|
||||
|
||||
import com.qihang.jd.domain.SShopPlatform;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-04 15:11:24
|
||||
* @Entity com.qihang.jd.domain.SShopPlatform
|
||||
*/
|
||||
public interface SShopPlatformMapper extends BaseMapper<SShopPlatform> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.qihang.jd.mapper;
|
||||
|
||||
import com.qihang.jd.domain.SShopSetting;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_setting(第三方平台设置)】的数据库操作Mapper
|
||||
* @createDate 2024-05-10 11:07:56
|
||||
* @Entity com.qihang.jd.domain.SShopSetting
|
||||
*/
|
||||
public interface SShopSettingMapper extends BaseMapper<SShopSetting> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -4,9 +4,9 @@ import com.qihang.common.api.ShopApiParams;
|
|||
import com.qihang.common.common.ResultVo;
|
||||
import com.qihang.common.enums.EnumShopType;
|
||||
import com.qihang.common.enums.HttpStatus;
|
||||
import com.qihang.jd.domain.SShopSetting;
|
||||
import com.qihang.jd.domain.SShopPlatform;
|
||||
import com.qihang.jd.service.SShopPlatformService;
|
||||
import com.qihang.jd.service.SShopService;
|
||||
import com.qihang.jd.service.SShopSettingService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
|
@ -15,7 +15,7 @@ import org.springframework.util.StringUtils;
|
|||
@Component
|
||||
public class ApiCommon {
|
||||
private final SShopService shopService;
|
||||
private final SShopSettingService platformService;
|
||||
private final SShopPlatformService platformService;
|
||||
// private final ServerConfig serverConfig;
|
||||
/**
|
||||
* 更新前的检查
|
||||
|
|
@ -31,10 +31,10 @@ public class ApiCommon {
|
|||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "参数错误,没有找到店铺");
|
||||
}
|
||||
|
||||
if (shop.getType() != EnumShopType.JD.getIndex()) {
|
||||
if (shop.getPlatform() != EnumShopType.JD.getIndex()) {
|
||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "参数错误,店铺不是JD店铺");
|
||||
}
|
||||
SShopSetting platform = platformService.getById(EnumShopType.JD.getIndex());
|
||||
SShopPlatform platform = platformService.getById(EnumShopType.JD.getIndex());
|
||||
|
||||
if (!StringUtils.hasText(platform.getAppKey())) {
|
||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "平台配置错误,没有找到AppKey");
|
||||
|
|
@ -56,12 +56,12 @@ public class ApiCommon {
|
|||
ShopApiParams params = new ShopApiParams();
|
||||
params.setAppKey(platform.getAppKey());
|
||||
params.setAppSecret(platform.getAppSecret());
|
||||
params.setAccessToken(shop.getSessionkey());
|
||||
params.setAccessToken(shop.getAccessToken());
|
||||
// params.setTokenRequestUrl(platform.getRedirectUri());
|
||||
// params.setApiRequestUrl(platform.getServerUrl());
|
||||
// params.setServerUrl(platform.getServerUrl());
|
||||
params.setSellerId(shop.getSelleruserid().toString());
|
||||
if (!StringUtils.hasText(shop.getSessionkey())) {
|
||||
params.setSellerId(shop.getSellerShopId().toString());
|
||||
if (!StringUtils.hasText(shop.getAccessToken())) {
|
||||
|
||||
return ResultVo.error(HttpStatus.UNAUTHORIZED, "Token已过期,请重新授权", params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.qihang.jd.service;
|
||||
|
||||
import com.qihang.jd.domain.SShopPlatform;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Service
|
||||
* @createDate 2024-06-04 15:11:24
|
||||
*/
|
||||
public interface SShopPlatformService extends IService<SShopPlatform> {
|
||||
|
||||
}
|
||||
|
|
@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop(数据中心-店铺)】的数据库操作Service
|
||||
* @createDate 2024-05-10 11:07:56
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Service
|
||||
* @createDate 2024-06-04 15:11:24
|
||||
*/
|
||||
public interface SShopService extends IService<SShop> {
|
||||
SShop selectShopById(Long shopId);
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
package com.qihang.jd.service;
|
||||
|
||||
import com.qihang.jd.domain.SShopSetting;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_setting(第三方平台设置)】的数据库操作Service
|
||||
* @createDate 2024-05-10 11:07:56
|
||||
*/
|
||||
public interface SShopSettingService extends IService<SShopSetting> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.qihang.jd.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.jd.domain.SShopPlatform;
|
||||
import com.qihang.jd.service.SShopPlatformService;
|
||||
import com.qihang.jd.mapper.SShopPlatformMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-04 15:11:24
|
||||
*/
|
||||
@Service
|
||||
public class SShopPlatformServiceImpl extends ServiceImpl<SShopPlatformMapper, SShopPlatform>
|
||||
implements SShopPlatformService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -9,8 +9,8 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop(数据中心-店铺)】的数据库操作Service实现
|
||||
* @createDate 2024-05-10 11:07:56
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-04 15:11:24
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
|
|
@ -26,7 +26,7 @@ public class SShopServiceImpl extends ServiceImpl<SShopMapper, SShop>
|
|||
public void updateSessionKey(Long shopId, String sessionKey) {
|
||||
SShop shop = new SShop();
|
||||
shop.setId(shopId);
|
||||
shop.setSessionkey(sessionKey);
|
||||
shop.setAccessToken(sessionKey);
|
||||
mapper.updateById(shop);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
package com.qihang.jd.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.jd.domain.SShopSetting;
|
||||
import com.qihang.jd.service.SShopSettingService;
|
||||
import com.qihang.jd.mapper.SShopSettingMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_setting(第三方平台设置)】的数据库操作Service实现
|
||||
* @createDate 2024-05-10 11:07:56
|
||||
*/
|
||||
@Service
|
||||
public class SShopSettingServiceImpl extends ServiceImpl<SShopSettingMapper, SShopSetting>
|
||||
implements SShopSettingService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -7,36 +7,33 @@
|
|||
<resultMap id="BaseResultMap" type="com.qihang.jd.domain.SShop">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="nickname" column="nickName" jdbcType="VARCHAR"/>
|
||||
<result property="nickName" column="nick_name" jdbcType="VARCHAR"/>
|
||||
<result property="ename" column="ename" jdbcType="VARCHAR"/>
|
||||
<result property="company" column="company" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="type" jdbcType="INTEGER"/>
|
||||
<result property="url" column="url" jdbcType="VARCHAR"/>
|
||||
<result property="ordernum" column="orderNum" jdbcType="INTEGER"/>
|
||||
<result property="isdelete" column="isDelete" jdbcType="INTEGER"/>
|
||||
<result property="isshow" column="isShow" jdbcType="INTEGER"/>
|
||||
<result property="modifyOn" column="modify_on" jdbcType="BIGINT"/>
|
||||
<result property="platform" column="platform" jdbcType="INTEGER"/>
|
||||
<result property="shopUrl" column="shop_url" jdbcType="VARCHAR"/>
|
||||
<result property="orderNum" column="order_num" jdbcType="INTEGER"/>
|
||||
<result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="selleruserid" column="sellerUserId" jdbcType="BIGINT"/>
|
||||
<result property="selleruseridstr" column="sellerUserIdStr" jdbcType="VARCHAR"/>
|
||||
<result property="sessionkey" column="sessionKey" jdbcType="VARCHAR"/>
|
||||
<result property="appkey" column="appkey" jdbcType="VARCHAR"/>
|
||||
<result property="appsercet" column="appSercet" jdbcType="VARCHAR"/>
|
||||
<result property="expiresIn" column="expires_in" jdbcType="BIGINT"/>
|
||||
<result property="sellerShopId" column="seller_shop_id" jdbcType="BIGINT"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSercet" column="app_sercet" jdbcType="VARCHAR"/>
|
||||
<result property="accessToken" column="access_token" jdbcType="VARCHAR"/>
|
||||
<result property="accessExpiresIn" column="access_expires_in" jdbcType="BIGINT"/>
|
||||
<result property="accessTokenBegin" column="access_token_begin" jdbcType="BIGINT"/>
|
||||
<result property="refreshToken" column="refresh_token" jdbcType="VARCHAR"/>
|
||||
<result property="refreshTokenTimeout" column="refresh_token_timeout" jdbcType="BIGINT"/>
|
||||
<result property="apiRequestUrl" column="api_request_url" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,nickName,
|
||||
ename,company,type,
|
||||
url,orderNum,isDelete,
|
||||
isShow,modify_on,remark,
|
||||
sellerUserId,sellerUserIdStr,sessionKey,
|
||||
appkey,appSercet,expires_in,
|
||||
id,name,nick_name,
|
||||
ename,company,platform,
|
||||
shop_url,order_num,is_delete,
|
||||
remark,seller_shop_id,app_key,
|
||||
app_sercet,access_token,access_expires_in,
|
||||
access_token_begin,refresh_token,refresh_token_timeout,
|
||||
api_request_url
|
||||
create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -2,21 +2,23 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.qihang.pdd.mapper.SysPlatformMapper">
|
||||
<mapper namespace="com.qihang.jd.mapper.SShopPlatformMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.pdd.domain.SysPlatform">
|
||||
<resultMap id="BaseResultMap" type="com.qihang.jd.domain.SShopPlatform">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="code" column="code" jdbcType="VARCHAR"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSecret" column="app_secret" jdbcType="VARCHAR"/>
|
||||
<result property="redirectUri" column="redirect_uri" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="serverUrl" column="server_url" jdbcType="VARCHAR"/>
|
||||
<result property="redirectUrl" column="redirect_url" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,code,
|
||||
app_key,app_secret,redirect_uri,
|
||||
server_url
|
||||
id,name,app_key,
|
||||
app_secret,remark,server_url,
|
||||
redirect_url,create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.qihang.jd.mapper.SShopSettingMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.jd.domain.SShopSetting">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSecret" column="app_secret" jdbcType="VARCHAR"/>
|
||||
<result property="accessToken" column="access_token" jdbcType="VARCHAR"/>
|
||||
<result property="expiresIn" column="expires_in" jdbcType="BIGINT"/>
|
||||
<result property="accessTokenBegin" column="access_token_begin" jdbcType="BIGINT"/>
|
||||
<result property="refreshToken" column="refresh_token" jdbcType="VARCHAR"/>
|
||||
<result property="refreshTokenTimeout" column="refresh_token_timeout" jdbcType="BIGINT"/>
|
||||
<result property="modifyOn" column="modify_on" jdbcType="BIGINT"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="requestUrl" column="request_url" jdbcType="VARCHAR"/>
|
||||
<result property="thirdId" column="third_id" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,app_key,
|
||||
app_secret,access_token,expires_in,
|
||||
access_token_begin,refresh_token,refresh_token_timeout,
|
||||
modify_on,remark,request_url,
|
||||
third_id
|
||||
</sql>
|
||||
</mapper>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,87 @@
|
|||
package com.qihang.pdd.controller;
|
||||
|
||||
|
||||
import com.qihang.common.common.AjaxResult;
|
||||
import com.qihang.common.enums.EnumShopType;
|
||||
import com.qihang.pdd.domain.bo.TokenCreateBo;
|
||||
import com.qihang.pdd.service.SShopPlatformService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
public class OAuthController {
|
||||
|
||||
private final SShopPlatformService platformService;
|
||||
private static Logger log = LoggerFactory.getLogger(PddOAuthController.class);
|
||||
|
||||
@GetMapping("/getOauthUrl")
|
||||
public AjaxResult oauth(@RequestParam Integer shopId) {
|
||||
|
||||
var platform = platformService.getById(EnumShopType.PDD.getIndex());
|
||||
if (platform == null) return AjaxResult.error("系统错误,没有找到第三方平台的配置信息");
|
||||
else if (StringUtils.isEmpty(platform.getAppKey()))
|
||||
return AjaxResult.error( "系统错误,第三方平台配置信息不完整,缺少appkey");
|
||||
else if (StringUtils.isEmpty(platform.getAppSecret()))
|
||||
return AjaxResult.error("系统错误,第三方平台配置信息不完整,缺少appSecret");
|
||||
else if (StringUtils.isEmpty(platform.getRedirectUrl()))
|
||||
return AjaxResult.error("系统错误,第三方平台配置信息不完整,缺少RedirectUrl");
|
||||
|
||||
String appKey = platform.getAppKey();
|
||||
String appSercet = platform.getAppSecret();
|
||||
|
||||
String url = "https://mms.pinduoduo.com/open.html?response_type=code&client_id=" + appKey + "&redirect_uri=" + URLEncoder.encode(platform.getRedirectUrl());
|
||||
return AjaxResult.success("SUCCESS",url);
|
||||
}
|
||||
|
||||
@PostMapping("/getToken")
|
||||
public AjaxResult getToken(@RequestBody TokenCreateBo bo) throws IOException, InterruptedException {
|
||||
log.info("/**********获取拼多多授权token*********/");
|
||||
// var shop = shopService.selectShopById(bo.getShopId());
|
||||
var platform = platformService.getById(EnumShopType.PDD.getIndex());
|
||||
String appKey = platform.getAppKey();
|
||||
String appSercet = platform.getAppSecret();
|
||||
|
||||
// PopAccessTokenClient accessTokenClient = new PopAccessTokenClient(appKey, appSercet);
|
||||
//
|
||||
// // 生成AccessToken
|
||||
// try {
|
||||
// AccessTokenResponse response = accessTokenClient.generate(bo.getCode());
|
||||
// if(response.getErrorResponse()!=null){
|
||||
// log.info("/***************获取拼多多授权token错误:"+response.getErrorResponse().getErrorMsg()+"**************/");
|
||||
// }else{
|
||||
// //保存accessToken
|
||||
// shopService.updateSessionKey(bo.getShopId(),response.getAccessToken());
|
||||
//
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// e.printStackTrace();
|
||||
//
|
||||
// }
|
||||
return AjaxResult.success("SUCCESS");
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取授权成功
|
||||
// * @param req
|
||||
// * @param model
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping("/getTokenSuccess")
|
||||
// public String getTokeSuccess(HttpServletRequest req, @RequestParam Long mallId, Model model){
|
||||
// var shop = shopService.selectShopById(mallId);
|
||||
// model.addAttribute("shop",shop);
|
||||
// model.addAttribute("shopId",shop.getId());
|
||||
// return "get_token_success";
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -4,18 +4,15 @@ package com.qihang.pdd.controller;
|
|||
import com.pdd.pop.sdk.http.PopAccessTokenClient;
|
||||
import com.pdd.pop.sdk.http.token.AccessTokenResponse;
|
||||
import com.qihang.common.enums.EnumShopType;
|
||||
import com.qihang.pdd.domain.SysPlatform;
|
||||
import com.qihang.pdd.service.SysPlatformService;
|
||||
import com.qihang.pdd.service.SysShopService;
|
||||
import com.qihang.pdd.service.SShopPlatformService;
|
||||
import com.qihang.pdd.service.SShopService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
|
|
@ -23,8 +20,8 @@ import java.net.URLEncoder;
|
|||
@RequestMapping("/pdd_api2")
|
||||
@Controller
|
||||
public class PddOAuthController {
|
||||
private final SysShopService shopService;
|
||||
private final SysPlatformService platformService;
|
||||
private final SShopService shopService;
|
||||
private final SShopPlatformService platformService;
|
||||
// @Autowired
|
||||
// private IShopService shopService;
|
||||
// @Autowired
|
||||
|
|
@ -34,12 +31,12 @@ public class PddOAuthController {
|
|||
@RequestMapping("/oauth")
|
||||
public String oauth(OpenApiRequest reqData) {
|
||||
// String returnUrl = serverConfig.getUrl() + "/pdd_api/getToken&state="+req.getParameter("shopId");
|
||||
var shop = shopService.selectShopById(reqData.getShopId());
|
||||
SysPlatform platform = platformService.selectById(EnumShopType.PDD.getIndex());
|
||||
// var shop = shopService.selectShopById(reqData.getShopId());
|
||||
var platform = platformService.getById(EnumShopType.PDD.getIndex());
|
||||
String appKey = platform.getAppKey();
|
||||
String appSercet = platform.getAppSecret();
|
||||
|
||||
String url = "https://mms.pinduoduo.com/open.html?response_type=code&client_id=" + appKey + "&redirect_uri=" + URLEncoder.encode(platform.getRedirectUri());
|
||||
String url = "https://mms.pinduoduo.com/open.html?response_type=code&client_id=" + appKey + "&redirect_uri=" + URLEncoder.encode(platform.getRedirectUrl());
|
||||
return url;
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +47,7 @@ public class PddOAuthController {
|
|||
|
||||
Integer shopId =Integer.parseInt(req.getParameter("state"));
|
||||
var shop = shopService.selectShopById(shopId);
|
||||
SysPlatform platform = platformService.selectById(EnumShopType.PDD.getIndex());
|
||||
var platform = platformService.getById(EnumShopType.PDD.getIndex());
|
||||
String appKey = platform.getAppKey();
|
||||
String appSercet = platform.getAppSecret();
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,114 @@
|
|||
package com.qihang.pdd.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 电商平台店铺表
|
||||
* @TableName s_shop
|
||||
*/
|
||||
@Data
|
||||
public class SShop implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 店铺名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 店铺别名
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 标识
|
||||
*/
|
||||
private String ename;
|
||||
|
||||
/**
|
||||
* 店铺主题
|
||||
*/
|
||||
private String company;
|
||||
|
||||
/**
|
||||
* 对应第三方平台Id
|
||||
*/
|
||||
private Integer platform;
|
||||
|
||||
/**
|
||||
* 店铺url
|
||||
*/
|
||||
private String shopUrl;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer orderNum;
|
||||
|
||||
/**
|
||||
* 是否删除0否1是
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 第三方平台店铺id
|
||||
*/
|
||||
private Long sellerShopId;
|
||||
|
||||
/**
|
||||
* Appkey(微信视频号小店专用)
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* Appsercet(微信视频号小店专用)
|
||||
*/
|
||||
private String appSercet;
|
||||
|
||||
/**
|
||||
* 第三方平台sessionKey(access_token)
|
||||
*/
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* accessToken到期(秒)
|
||||
*/
|
||||
private Long accessExpiresIn;
|
||||
|
||||
/**
|
||||
* access_token开始时间
|
||||
*/
|
||||
private Long accessTokenBegin;
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
private String refreshToken;
|
||||
|
||||
/**
|
||||
* 刷新token过期时间
|
||||
*/
|
||||
private Long refreshTokenTimeout;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.qihang.pdd.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 电商平台配置表
|
||||
* @TableName s_shop_platform
|
||||
*/
|
||||
@Data
|
||||
public class SShopPlatform implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 平台名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* appSecret
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 服务url
|
||||
*/
|
||||
private String serverUrl;
|
||||
|
||||
/**
|
||||
* 回调url
|
||||
*/
|
||||
private String redirectUrl;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
package com.qihang.pdd.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName sys_platform
|
||||
*/
|
||||
public class SysPlatform implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 平台名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 平台编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 平台回调uri
|
||||
*/
|
||||
private String redirectUri;
|
||||
|
||||
/**
|
||||
* 接口访问地址
|
||||
*/
|
||||
private String serverUrl;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台名
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台名
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台编码
|
||||
*/
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台编码
|
||||
*/
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String getAppKey() {
|
||||
return appKey;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setAppKey(String appKey) {
|
||||
this.appKey = appKey;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String getAppSecret() {
|
||||
return appSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setAppSecret(String appSecret) {
|
||||
this.appSecret = appSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台回调uri
|
||||
*/
|
||||
public String getRedirectUri() {
|
||||
return redirectUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台回调uri
|
||||
*/
|
||||
public void setRedirectUri(String redirectUri) {
|
||||
this.redirectUri = redirectUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口访问地址
|
||||
*/
|
||||
public String getServerUrl() {
|
||||
return serverUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口访问地址
|
||||
*/
|
||||
public void setServerUrl(String serverUrl) {
|
||||
this.serverUrl = serverUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
SysPlatform other = (SysPlatform) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
|
||||
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
|
||||
&& (this.getAppKey() == null ? other.getAppKey() == null : this.getAppKey().equals(other.getAppKey()))
|
||||
&& (this.getAppSecret() == null ? other.getAppSecret() == null : this.getAppSecret().equals(other.getAppSecret()))
|
||||
&& (this.getRedirectUri() == null ? other.getRedirectUri() == null : this.getRedirectUri().equals(other.getRedirectUri()))
|
||||
&& (this.getServerUrl() == null ? other.getServerUrl() == null : this.getServerUrl().equals(other.getServerUrl()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
||||
result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
|
||||
result = prime * result + ((getAppKey() == null) ? 0 : getAppKey().hashCode());
|
||||
result = prime * result + ((getAppSecret() == null) ? 0 : getAppSecret().hashCode());
|
||||
result = prime * result + ((getRedirectUri() == null) ? 0 : getRedirectUri().hashCode());
|
||||
result = prime * result + ((getServerUrl() == null) ? 0 : getServerUrl().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", name=").append(name);
|
||||
sb.append(", code=").append(code);
|
||||
sb.append(", appKey=").append(appKey);
|
||||
sb.append(", appSecret=").append(appSecret);
|
||||
sb.append(", redirectUri=").append(redirectUri);
|
||||
sb.append(", serverUrl=").append(serverUrl);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,417 +0,0 @@
|
|||
package com.qihang.pdd.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 数据中心-店铺
|
||||
* @TableName sys_shop
|
||||
*/
|
||||
public class SysShop implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 店铺名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 对应第三方平台Id
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 店铺url
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 状态(1正常2已删除)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Long modifyOn;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 第三方平台店铺id,淘宝天猫开放平台使用
|
||||
*/
|
||||
private Long sellerId;
|
||||
|
||||
/**
|
||||
* Appkey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* Appsercet
|
||||
*/
|
||||
private String appSercet;
|
||||
|
||||
/**
|
||||
* 第三方平台sessionKey(access_token)
|
||||
*/
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* 到期
|
||||
*/
|
||||
private Long expiresIn;
|
||||
|
||||
/**
|
||||
* access_token开始时间
|
||||
*/
|
||||
private Long accessTokenBegin;
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
private String refreshToken;
|
||||
|
||||
/**
|
||||
* 刷新token过期时间
|
||||
*/
|
||||
private Long refreshTokenTimeout;
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
*/
|
||||
private String apiRequestUrl;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺名
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺名
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对应第三方平台Id
|
||||
*/
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对应第三方平台Id
|
||||
*/
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺url
|
||||
*/
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺url
|
||||
*/
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态(1正常2已删除)
|
||||
*/
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态(1正常2已删除)
|
||||
*/
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
public Long getModifyOn() {
|
||||
return modifyOn;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
public void setModifyOn(Long modifyOn) {
|
||||
this.modifyOn = modifyOn;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方平台店铺id,淘宝天猫开放平台使用
|
||||
*/
|
||||
public Long getSellerId() {
|
||||
return sellerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方平台店铺id,淘宝天猫开放平台使用
|
||||
*/
|
||||
public void setSellerId(Long sellerId) {
|
||||
this.sellerId = sellerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appkey
|
||||
*/
|
||||
public String getAppKey() {
|
||||
return appKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appkey
|
||||
*/
|
||||
public void setAppKey(String appKey) {
|
||||
this.appKey = appKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appsercet
|
||||
*/
|
||||
public String getAppSercet() {
|
||||
return appSercet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appsercet
|
||||
*/
|
||||
public void setAppSercet(String appSercet) {
|
||||
this.appSercet = appSercet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方平台sessionKey(access_token)
|
||||
*/
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方平台sessionKey(access_token)
|
||||
*/
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* 到期
|
||||
*/
|
||||
public Long getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* 到期
|
||||
*/
|
||||
public void setExpiresIn(Long expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* access_token开始时间
|
||||
*/
|
||||
public Long getAccessTokenBegin() {
|
||||
return accessTokenBegin;
|
||||
}
|
||||
|
||||
/**
|
||||
* access_token开始时间
|
||||
*/
|
||||
public void setAccessTokenBegin(Long accessTokenBegin) {
|
||||
this.accessTokenBegin = accessTokenBegin;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
public String getRefreshToken() {
|
||||
return refreshToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
public void setRefreshToken(String refreshToken) {
|
||||
this.refreshToken = refreshToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新token过期时间
|
||||
*/
|
||||
public Long getRefreshTokenTimeout() {
|
||||
return refreshTokenTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新token过期时间
|
||||
*/
|
||||
public void setRefreshTokenTimeout(Long refreshTokenTimeout) {
|
||||
this.refreshTokenTimeout = refreshTokenTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
*/
|
||||
public String getApiRequestUrl() {
|
||||
return apiRequestUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
*/
|
||||
public void setApiRequestUrl(String apiRequestUrl) {
|
||||
this.apiRequestUrl = apiRequestUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
SysShop other = (SysShop) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
|
||||
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
|
||||
&& (this.getUrl() == null ? other.getUrl() == null : this.getUrl().equals(other.getUrl()))
|
||||
&& (this.getSort() == null ? other.getSort() == null : this.getSort().equals(other.getSort()))
|
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
|
||||
&& (this.getModifyOn() == null ? other.getModifyOn() == null : this.getModifyOn().equals(other.getModifyOn()))
|
||||
&& (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
|
||||
&& (this.getSellerId() == null ? other.getSellerId() == null : this.getSellerId().equals(other.getSellerId()))
|
||||
&& (this.getAppKey() == null ? other.getAppKey() == null : this.getAppKey().equals(other.getAppKey()))
|
||||
&& (this.getAppSercet() == null ? other.getAppSercet() == null : this.getAppSercet().equals(other.getAppSercet()))
|
||||
&& (this.getAccessToken() == null ? other.getAccessToken() == null : this.getAccessToken().equals(other.getAccessToken()))
|
||||
&& (this.getExpiresIn() == null ? other.getExpiresIn() == null : this.getExpiresIn().equals(other.getExpiresIn()))
|
||||
&& (this.getAccessTokenBegin() == null ? other.getAccessTokenBegin() == null : this.getAccessTokenBegin().equals(other.getAccessTokenBegin()))
|
||||
&& (this.getRefreshToken() == null ? other.getRefreshToken() == null : this.getRefreshToken().equals(other.getRefreshToken()))
|
||||
&& (this.getRefreshTokenTimeout() == null ? other.getRefreshTokenTimeout() == null : this.getRefreshTokenTimeout().equals(other.getRefreshTokenTimeout()))
|
||||
&& (this.getApiRequestUrl() == null ? other.getApiRequestUrl() == null : this.getApiRequestUrl().equals(other.getApiRequestUrl()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
||||
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
|
||||
result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode());
|
||||
result = prime * result + ((getSort() == null) ? 0 : getSort().hashCode());
|
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
|
||||
result = prime * result + ((getModifyOn() == null) ? 0 : getModifyOn().hashCode());
|
||||
result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
|
||||
result = prime * result + ((getSellerId() == null) ? 0 : getSellerId().hashCode());
|
||||
result = prime * result + ((getAppKey() == null) ? 0 : getAppKey().hashCode());
|
||||
result = prime * result + ((getAppSercet() == null) ? 0 : getAppSercet().hashCode());
|
||||
result = prime * result + ((getAccessToken() == null) ? 0 : getAccessToken().hashCode());
|
||||
result = prime * result + ((getExpiresIn() == null) ? 0 : getExpiresIn().hashCode());
|
||||
result = prime * result + ((getAccessTokenBegin() == null) ? 0 : getAccessTokenBegin().hashCode());
|
||||
result = prime * result + ((getRefreshToken() == null) ? 0 : getRefreshToken().hashCode());
|
||||
result = prime * result + ((getRefreshTokenTimeout() == null) ? 0 : getRefreshTokenTimeout().hashCode());
|
||||
result = prime * result + ((getApiRequestUrl() == null) ? 0 : getApiRequestUrl().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", name=").append(name);
|
||||
sb.append(", type=").append(type);
|
||||
sb.append(", url=").append(url);
|
||||
sb.append(", sort=").append(sort);
|
||||
sb.append(", status=").append(status);
|
||||
sb.append(", modifyOn=").append(modifyOn);
|
||||
sb.append(", remark=").append(remark);
|
||||
sb.append(", sellerId=").append(sellerId);
|
||||
sb.append(", appKey=").append(appKey);
|
||||
sb.append(", appSercet=").append(appSercet);
|
||||
sb.append(", accessToken=").append(accessToken);
|
||||
sb.append(", expiresIn=").append(expiresIn);
|
||||
sb.append(", accessTokenBegin=").append(accessTokenBegin);
|
||||
sb.append(", refreshToken=").append(refreshToken);
|
||||
sb.append(", refreshTokenTimeout=").append(refreshTokenTimeout);
|
||||
sb.append(", apiRequestUrl=").append(apiRequestUrl);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.qihang.pdd.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TokenCreateBo {
|
||||
private Integer shopId;
|
||||
private Integer platform;
|
||||
private String code;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.qihang.pdd.mapper;
|
||||
|
||||
import com.qihang.pdd.domain.SShop;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-04 15:29:29
|
||||
* @Entity com.qihang.pdd.domain.SShop
|
||||
*/
|
||||
public interface SShopMapper extends BaseMapper<SShop> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.qihang.pdd.mapper;
|
||||
|
||||
import com.qihang.pdd.domain.SShopPlatform;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-04 15:29:29
|
||||
* @Entity com.qihang.pdd.domain.SShopPlatform
|
||||
*/
|
||||
public interface SShopPlatformMapper extends BaseMapper<SShopPlatform> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.qihang.pdd.mapper;
|
||||
|
||||
import com.qihang.pdd.domain.SysPlatform;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【sys_platform】的数据库操作Mapper
|
||||
* @createDate 2024-03-13 17:43:42
|
||||
* @Entity com.qihang.pdd.domain.SysPlatform
|
||||
*/
|
||||
public interface SysPlatformMapper extends BaseMapper<SysPlatform> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.qihang.pdd.mapper;
|
||||
|
||||
import com.qihang.pdd.domain.SysShop;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【sys_shop(数据中心-店铺)】的数据库操作Mapper
|
||||
* @createDate 2024-03-13 17:43:42
|
||||
* @Entity com.qihang.pdd.domain.SysShop
|
||||
*/
|
||||
public interface SysShopMapper extends BaseMapper<SysShop> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.qihang.pdd.service;
|
||||
|
||||
import com.qihang.pdd.domain.SShopPlatform;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Service
|
||||
* @createDate 2024-06-04 15:29:29
|
||||
*/
|
||||
public interface SShopPlatformService extends IService<SShopPlatform> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.qihang.pdd.service;
|
||||
|
||||
import com.qihang.pdd.domain.SShop;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Service
|
||||
* @createDate 2024-06-04 15:29:29
|
||||
*/
|
||||
public interface SShopService extends IService<SShop> {
|
||||
SShop selectShopById(Integer shopId);
|
||||
void updateSessionKey(Integer shopId, String ownerId, String sessionKey, String refreshToken, Long expiresIn);
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.qihang.pdd.service;
|
||||
|
||||
import com.qihang.pdd.domain.SysPlatform;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【sys_platform】的数据库操作Service
|
||||
* @createDate 2024-03-13 17:43:42
|
||||
*/
|
||||
public interface SysPlatformService extends IService<SysPlatform> {
|
||||
SysPlatform selectById(Integer id);
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
package com.qihang.pdd.service;
|
||||
|
||||
import com.qihang.pdd.domain.SysShop;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【sys_shop(数据中心-店铺)】的数据库操作Service
|
||||
* @createDate 2024-03-13 17:43:42
|
||||
*/
|
||||
public interface SysShopService extends IService<SysShop> {
|
||||
SysShop selectShopById(Integer shopId);
|
||||
|
||||
void updateSessionKey(Integer shopId,String ownerId,String sessionKey,String refreshToken,Long expiresIn);
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.qihang.pdd.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.pdd.domain.SShopPlatform;
|
||||
import com.qihang.pdd.service.SShopPlatformService;
|
||||
import com.qihang.pdd.mapper.SShopPlatformMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-04 15:29:29
|
||||
*/
|
||||
@Service
|
||||
public class SShopPlatformServiceImpl extends ServiceImpl<SShopPlatformMapper, SShopPlatform>
|
||||
implements SShopPlatformService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,39 +1,37 @@
|
|||
package com.qihang.pdd.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.pdd.domain.SysShop;
|
||||
import com.qihang.pdd.service.SysShopService;
|
||||
import com.qihang.pdd.mapper.SysShopMapper;
|
||||
import com.qihang.pdd.domain.SShop;
|
||||
import com.qihang.pdd.service.SShopService;
|
||||
import com.qihang.pdd.mapper.SShopMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【sys_shop(数据中心-店铺)】的数据库操作Service实现
|
||||
* @createDate 2024-03-13 17:43:42
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-04 15:29:29
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class SysShopServiceImpl extends ServiceImpl<SysShopMapper, SysShop>
|
||||
implements SysShopService{
|
||||
|
||||
private SysShopMapper mapper;
|
||||
public class SShopServiceImpl extends ServiceImpl<SShopMapper, SShop>
|
||||
implements SShopService{
|
||||
private SShopMapper mapper;
|
||||
@Override
|
||||
public SysShop selectShopById(Integer shopId) {
|
||||
public SShop selectShopById(Integer shopId) {
|
||||
return mapper.selectById(shopId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSessionKey(Integer shopId, String ownerId, String sessionKey, String refreshToken, Long expiresIn) {
|
||||
SysShop shop = new SysShop();
|
||||
SShop shop = new SShop();
|
||||
shop.setId(shopId);
|
||||
shop.setAccessToken(sessionKey);
|
||||
shop.setRefreshToken(refreshToken);
|
||||
shop.setExpiresIn(expiresIn);
|
||||
shop.setAccessExpiresIn(expiresIn);
|
||||
shop.setAccessTokenBegin(System.currentTimeMillis() / 1000);
|
||||
mapper.updateById(shop);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package com.qihang.pdd.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.pdd.domain.SysPlatform;
|
||||
import com.qihang.pdd.service.SysPlatformService;
|
||||
import com.qihang.pdd.mapper.SysPlatformMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【sys_platform】的数据库操作Service实现
|
||||
* @createDate 2024-03-13 17:43:42
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class SysPlatformServiceImpl extends ServiceImpl<SysPlatformMapper, SysPlatform>
|
||||
implements SysPlatformService{
|
||||
private final SysPlatformMapper mapper;
|
||||
@Override
|
||||
public SysPlatform selectById(Integer id) {
|
||||
return mapper.selectById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.qihang.pdd.mapper.SShopMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.pdd.domain.SShop">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="nickName" column="nick_name" jdbcType="VARCHAR"/>
|
||||
<result property="ename" column="ename" jdbcType="VARCHAR"/>
|
||||
<result property="company" column="company" jdbcType="VARCHAR"/>
|
||||
<result property="platform" column="platform" jdbcType="INTEGER"/>
|
||||
<result property="shopUrl" column="shop_url" jdbcType="VARCHAR"/>
|
||||
<result property="orderNum" column="order_num" jdbcType="INTEGER"/>
|
||||
<result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="sellerShopId" column="seller_shop_id" jdbcType="BIGINT"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSercet" column="app_sercet" jdbcType="VARCHAR"/>
|
||||
<result property="accessToken" column="access_token" jdbcType="VARCHAR"/>
|
||||
<result property="accessExpiresIn" column="access_expires_in" jdbcType="BIGINT"/>
|
||||
<result property="accessTokenBegin" column="access_token_begin" jdbcType="BIGINT"/>
|
||||
<result property="refreshToken" column="refresh_token" jdbcType="VARCHAR"/>
|
||||
<result property="refreshTokenTimeout" column="refresh_token_timeout" jdbcType="BIGINT"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,nick_name,
|
||||
ename,company,platform,
|
||||
shop_url,order_num,is_delete,
|
||||
remark,seller_shop_id,app_key,
|
||||
app_sercet,access_token,access_expires_in,
|
||||
access_token_begin,refresh_token,refresh_token_timeout,
|
||||
create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.qihang.pdd.mapper.SShopPlatformMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.pdd.domain.SShopPlatform">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSecret" column="app_secret" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="serverUrl" column="server_url" jdbcType="VARCHAR"/>
|
||||
<result property="redirectUrl" column="redirect_url" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,app_key,
|
||||
app_secret,remark,server_url,
|
||||
redirect_url,create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.qihang.pdd.mapper.SysShopMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.pdd.domain.SysShop">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="type" jdbcType="INTEGER"/>
|
||||
<result property="url" column="url" jdbcType="VARCHAR"/>
|
||||
<result property="sort" column="sort" jdbcType="INTEGER"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
<result property="modifyOn" column="modify_on" jdbcType="BIGINT"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="sellerId" column="seller_id" jdbcType="BIGINT"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSercet" column="app_sercet" jdbcType="VARCHAR"/>
|
||||
<result property="accessToken" column="access_token" jdbcType="VARCHAR"/>
|
||||
<result property="expiresIn" column="expires_in" jdbcType="BIGINT"/>
|
||||
<result property="accessTokenBegin" column="access_token_begin" jdbcType="BIGINT"/>
|
||||
<result property="refreshToken" column="refresh_token" jdbcType="VARCHAR"/>
|
||||
<result property="refreshTokenTimeout" column="refresh_token_timeout" jdbcType="BIGINT"/>
|
||||
<result property="apiRequestUrl" column="api_request_url" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,type,
|
||||
url,sort,status,
|
||||
modify_on,remark,seller_id,
|
||||
app_key,app_sercet,access_token,
|
||||
expires_in,access_token_begin,refresh_token,
|
||||
refresh_token_timeout,api_request_url
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.qihang.tao.controller;
|
||||
|
||||
|
||||
import com.qihang.common.common.AjaxResult;
|
||||
import com.qihang.common.enums.EnumShopType;
|
||||
import com.qihang.tao.domain.bo.TaoTokenCreateBo;
|
||||
import com.qihang.tao.service.SShopPlatformService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 淘宝回调地址
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
public class OAuthController {
|
||||
|
||||
private final SShopPlatformService platformService;
|
||||
private static Logger log = LoggerFactory.getLogger(OAuthController.class);
|
||||
/**
|
||||
* 淘宝授权url
|
||||
*
|
||||
* @param
|
||||
* @param shopId
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@GetMapping("/getOauthUrl")
|
||||
public AjaxResult aliOAuth(@RequestParam Long shopId) throws IOException, InterruptedException {
|
||||
//查询店铺信息
|
||||
// var shop = taoOrderService.selectShopById(shopId);
|
||||
var thirdConfig = platformService.getById(EnumShopType.TAO.getIndex());
|
||||
if (!StringUtils.hasText(thirdConfig.getAppKey())) {
|
||||
return AjaxResult.error( "平台配置错误,没有找到AppKey");
|
||||
}
|
||||
if (!StringUtils.hasText(thirdConfig.getAppSecret())) {
|
||||
return AjaxResult.error( "第三方平台配置错误,没有找到AppSercet");
|
||||
}
|
||||
// if (!StringUtils.hasText(thirdConfig.getRedirectUrl())) {
|
||||
// return AjaxResult.error( "第三方平台配置错误,没有找到RedirectUrl");
|
||||
// }
|
||||
|
||||
String url = "http://container.open.taobao.com/container?appkey=" + thirdConfig.getAppKey() + "&state=" + shopId;
|
||||
//https://oauth.taobao.com/authorize?response_type=token&force_auth=true&from_site=fuwu&client_id=28181872
|
||||
|
||||
return AjaxResult.success("SUCCESS",url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 淘宝授权回调
|
||||
* @param
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/tokenCreate")
|
||||
public AjaxResult callback(@RequestBody TaoTokenCreateBo bo) {
|
||||
log.info("tao授权返回code");
|
||||
if (!StringUtils.hasText(bo.getCode())) return AjaxResult.error("code不能为空");
|
||||
// log.info("淘系店铺授权回调开始");
|
||||
// String sessionKey = request.getParameter("top_session");
|
||||
// String state = request.getParameter("state");
|
||||
// try {
|
||||
// Long shopId = Long.parseLong(state);
|
||||
// taoOrderService.updateShopSessionByShopId(shopId, sessionKey);
|
||||
// return "redirect:/order/list?shopId=" + shopId;
|
||||
// } catch (Exception e) {
|
||||
// return "redirect:/?msg=callback_taobao_error";
|
||||
// }
|
||||
return AjaxResult.success("SUCCESS");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
package com.qihang.tao.controller;
|
||||
|
||||
import com.qihang.tao.domain.SShopSetting;
|
||||
import com.qihang.tao.service.SShopService;
|
||||
import com.qihang.tao.service.SShopSettingService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 淘宝回调地址
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Controller
|
||||
public class OAuthTaoCallbackController {
|
||||
|
||||
private final SShopService shopService;
|
||||
private final SShopSettingService platformService;
|
||||
private static Logger log = LoggerFactory.getLogger(OAuthTaoCallbackController.class);
|
||||
/**
|
||||
* 淘宝授权url
|
||||
*
|
||||
* @param shopId
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@GetMapping("/taoapi2/tao_oauth")
|
||||
public String aliOAuth(@RequestParam Long shopId) throws IOException, InterruptedException {
|
||||
//查询店铺信息
|
||||
var shop = shopService.selectShopById(shopId);
|
||||
SShopSetting platform = platformService.getById(shop.getType());
|
||||
|
||||
|
||||
// var entity = thirdSettingService.getEntity(shop.getType());
|
||||
String url = "http://container.open.taobao.com/container?appkey=" + platform.getAppKey() + "&state=" + shopId;
|
||||
//https://oauth.taobao.com/authorize?response_type=token&force_auth=true&from_site=fuwu&client_id=28181872
|
||||
return "redirect:" + url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 淘宝授权回调
|
||||
* @param model
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/taoapi2/callback")
|
||||
public String callback(Model model, HttpServletRequest request) {
|
||||
log.info("淘系店铺授权回调开始");
|
||||
String sessionKey = request.getParameter("top_session");
|
||||
String state = request.getParameter("state");
|
||||
try {
|
||||
Long shopId = Long.parseLong(state);
|
||||
shopService.updateSessionKey(shopId, sessionKey);
|
||||
return "redirect:/order/list?shopId=" + shopId;
|
||||
} catch (Exception e) {
|
||||
return "redirect:/?msg=callback_taobao_error";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
package com.qihang.tao.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据中心-店铺
|
||||
* 电商平台店铺表
|
||||
* @TableName s_shop
|
||||
*/
|
||||
@Data
|
||||
|
|
@ -22,7 +23,7 @@ public class SShop implements Serializable {
|
|||
/**
|
||||
* 店铺别名
|
||||
*/
|
||||
private String nickname;
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 标识
|
||||
|
|
@ -37,32 +38,22 @@ public class SShop implements Serializable {
|
|||
/**
|
||||
* 对应第三方平台Id
|
||||
*/
|
||||
private Integer type;
|
||||
private Integer platform;
|
||||
|
||||
/**
|
||||
* 店铺url
|
||||
*/
|
||||
private String url;
|
||||
private String shopUrl;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer ordernum;
|
||||
private Integer orderNum;
|
||||
|
||||
/**
|
||||
* 是否删除0否1是
|
||||
*/
|
||||
private Integer isdelete;
|
||||
|
||||
/**
|
||||
* 是否显示(0:是1否)
|
||||
*/
|
||||
private Integer isshow;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Long modifyOn;
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
|
|
@ -70,34 +61,29 @@ public class SShop implements Serializable {
|
|||
private String remark;
|
||||
|
||||
/**
|
||||
* 第三方平台店铺id,淘宝天猫开放平台使用
|
||||
* 第三方平台店铺id
|
||||
*/
|
||||
private Long selleruserid;
|
||||
private Long sellerShopId;
|
||||
|
||||
/**
|
||||
* 卖家userId
|
||||
* Appkey(微信视频号小店专用)
|
||||
*/
|
||||
private String selleruseridstr;
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* Appsercet(微信视频号小店专用)
|
||||
*/
|
||||
private String appSercet;
|
||||
|
||||
/**
|
||||
* 第三方平台sessionKey(access_token)
|
||||
*/
|
||||
private String sessionkey;
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* Appkey
|
||||
* accessToken到期(秒)
|
||||
*/
|
||||
private String appkey;
|
||||
|
||||
/**
|
||||
* Appsercet
|
||||
*/
|
||||
private String appsercet;
|
||||
|
||||
/**
|
||||
* 到期
|
||||
*/
|
||||
private Long expiresIn;
|
||||
private Long accessExpiresIn;
|
||||
|
||||
/**
|
||||
* access_token开始时间
|
||||
|
|
@ -115,9 +101,14 @@ public class SShop implements Serializable {
|
|||
private Long refreshTokenTimeout;
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
* 创建时间
|
||||
*/
|
||||
private String apiRequestUrl;
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.qihang.tao.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 电商平台配置表
|
||||
* @TableName s_shop_platform
|
||||
*/
|
||||
@Data
|
||||
public class SShopPlatform implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 平台名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* appSecret
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 服务url
|
||||
*/
|
||||
private String serverUrl;
|
||||
|
||||
/**
|
||||
* 回调url
|
||||
*/
|
||||
private String redirectUrl;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
package com.qihang.tao.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 第三方平台设置
|
||||
* @TableName s_shop_setting
|
||||
*/
|
||||
@Data
|
||||
public class SShopSetting implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 配置名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* appSecret
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 阿里access token
|
||||
*/
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* 到期
|
||||
*/
|
||||
private Long expiresIn;
|
||||
|
||||
/**
|
||||
* access_token开始时间
|
||||
*/
|
||||
private Long accessTokenBegin;
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
private String refreshToken;
|
||||
|
||||
/**
|
||||
* 刷新token过期时间
|
||||
*/
|
||||
private Long refreshTokenTimeout;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Long modifyOn;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
*/
|
||||
private String requestUrl;
|
||||
|
||||
/**
|
||||
* 第三方店铺id
|
||||
*/
|
||||
private String thirdId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.qihang.tao.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TaoTokenCreateBo {
|
||||
private Integer shopId;
|
||||
private Integer platform;
|
||||
private String code;
|
||||
}
|
||||
|
|
@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop(数据中心-店铺)】的数据库操作Mapper
|
||||
* @createDate 2024-05-10 10:13:15
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-04 15:20:42
|
||||
* @Entity com.qihang.tao.domain.SShop
|
||||
*/
|
||||
public interface SShopMapper extends BaseMapper<SShop> {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.qihang.tao.mapper;
|
||||
|
||||
import com.qihang.tao.domain.SShopPlatform;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-04 15:20:42
|
||||
* @Entity com.qihang.tao.domain.SShopPlatform
|
||||
*/
|
||||
public interface SShopPlatformMapper extends BaseMapper<SShopPlatform> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.qihang.tao.mapper;
|
||||
|
||||
import com.qihang.tao.domain.SShopSetting;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_setting(第三方平台设置)】的数据库操作Mapper
|
||||
* @createDate 2024-05-10 10:13:15
|
||||
* @Entity com.qihang.tao.domain.SShopSetting
|
||||
*/
|
||||
public interface SShopSettingMapper extends BaseMapper<SShopSetting> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -5,9 +5,8 @@ import com.qihang.common.enums.HttpStatus;
|
|||
import com.qihang.common.enums.EnumShopType;
|
||||
import com.qihang.tao.common.ServerConfig;
|
||||
import com.qihang.common.api.ShopApiParams;
|
||||
import com.qihang.tao.domain.SShopSetting;
|
||||
import com.qihang.tao.service.SShopPlatformService;
|
||||
import com.qihang.tao.service.SShopService;
|
||||
import com.qihang.tao.service.SShopSettingService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
|
@ -15,8 +14,8 @@ import org.springframework.util.StringUtils;
|
|||
@Component
|
||||
public class ApiCommon {
|
||||
private final SShopService shopService;
|
||||
private final SShopSettingService platformService;
|
||||
private final ServerConfig serverConfig;
|
||||
private final SShopPlatformService platformService;
|
||||
// private final ServerConfig serverConfig;
|
||||
/**
|
||||
* 更新前的检查
|
||||
*
|
||||
|
|
@ -32,12 +31,12 @@ public class ApiCommon {
|
|||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "参数错误,没有找到店铺");
|
||||
}
|
||||
|
||||
if (shop.getType() != EnumShopType.TAO.getIndex()) {
|
||||
if (shop.getPlatform() != EnumShopType.TAO.getIndex()) {
|
||||
// return ApiResult.build(HttpStatus.PARAMS_ERROR, "参数错误,店铺不是淘系店铺");
|
||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "参数错误,店铺不是淘系店铺");
|
||||
}
|
||||
|
||||
SShopSetting platform = platformService.getById(EnumShopType.TAO.getIndex());
|
||||
var platform = platformService.getById(EnumShopType.TAO.getIndex());
|
||||
|
||||
if(!StringUtils.hasText(platform.getAppKey())) {
|
||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "平台配置错误,没有找到AppKey");
|
||||
|
|
@ -45,6 +44,9 @@ public class ApiCommon {
|
|||
if(!StringUtils.hasText(platform.getAppSecret())) {
|
||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到AppSercet");
|
||||
}
|
||||
// if(!StringUtils.hasText(platform.getServerUrl())) {
|
||||
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到ApiRequestUrl");
|
||||
// }
|
||||
// if(!StringUtils.hasText(platform.getServerUrl())) {
|
||||
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到ApiRequestUrl");
|
||||
// }
|
||||
|
|
@ -55,11 +57,11 @@ public class ApiCommon {
|
|||
ShopApiParams params = new ShopApiParams();
|
||||
params.setAppKey(platform.getAppKey());
|
||||
params.setAppSecret(platform.getAppSecret());
|
||||
params.setAccessToken(shop.getSessionkey());
|
||||
params.setTokenRequestUrl(serverConfig.getUrl()+"/taoapi2/tao_oauth");
|
||||
params.setAccessToken(shop.getAccessToken());
|
||||
params.setTokenRequestUrl(platform.getRedirectUrl());
|
||||
// params.setApiRequestUrl(platform.getServerUrl());
|
||||
|
||||
if (!StringUtils.hasText(shop.getSessionkey())) {
|
||||
if (!StringUtils.hasText(shop.getAccessToken())) {
|
||||
|
||||
return ResultVo.error(HttpStatus.UNAUTHORIZED, "Token已过期,请重新授权", params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.qihang.tao.service;
|
||||
|
||||
import com.qihang.tao.domain.SShopPlatform;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Service
|
||||
* @createDate 2024-06-04 15:20:42
|
||||
*/
|
||||
public interface SShopPlatformService extends IService<SShopPlatform> {
|
||||
|
||||
}
|
||||
|
|
@ -5,12 +5,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop(数据中心-店铺)】的数据库操作Service
|
||||
* @createDate 2024-05-10 10:13:15
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Service
|
||||
* @createDate 2024-06-04 15:20:42
|
||||
*/
|
||||
public interface SShopService extends IService<SShop> {
|
||||
SShop selectShopById(Long shopId);
|
||||
|
||||
void updateSessionKey(Long shopId, String sessionKey);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
package com.qihang.tao.service;
|
||||
|
||||
import com.qihang.tao.domain.SShopSetting;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_setting(第三方平台设置)】的数据库操作Service
|
||||
* @createDate 2024-05-10 10:13:15
|
||||
*/
|
||||
public interface SShopSettingService extends IService<SShopSetting> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.qihang.tao.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.tao.domain.SShopPlatform;
|
||||
import com.qihang.tao.service.SShopPlatformService;
|
||||
import com.qihang.tao.mapper.SShopPlatformMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_platform(电商平台配置表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-04 15:20:42
|
||||
*/
|
||||
@Service
|
||||
public class SShopPlatformServiceImpl extends ServiceImpl<SShopPlatformMapper, SShopPlatform>
|
||||
implements SShopPlatformService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -9,8 +9,8 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop(数据中心-店铺)】的数据库操作Service实现
|
||||
* @createDate 2024-05-10 10:13:15
|
||||
* @description 针对表【s_shop(电商平台店铺表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-04 15:20:42
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
|
|
@ -26,7 +26,7 @@ public class SShopServiceImpl extends ServiceImpl<SShopMapper, SShop>
|
|||
public void updateSessionKey(Long shopId, String sessionKey) {
|
||||
SShop shop = new SShop();
|
||||
shop.setId(shopId);
|
||||
shop.setSessionkey(sessionKey);
|
||||
shop.setAccessToken(sessionKey);
|
||||
mapper.updateById(shop);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
package com.qihang.tao.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.tao.domain.SShopSetting;
|
||||
import com.qihang.tao.service.SShopSettingService;
|
||||
import com.qihang.tao.mapper.SShopSettingMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【s_shop_setting(第三方平台设置)】的数据库操作Service实现
|
||||
* @createDate 2024-05-10 10:13:15
|
||||
*/
|
||||
@Service
|
||||
public class SShopSettingServiceImpl extends ServiceImpl<SShopSettingMapper, SShopSetting>
|
||||
implements SShopSettingService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -7,36 +7,33 @@
|
|||
<resultMap id="BaseResultMap" type="com.qihang.tao.domain.SShop">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="nickname" column="nickName" jdbcType="VARCHAR"/>
|
||||
<result property="nickName" column="nick_name" jdbcType="VARCHAR"/>
|
||||
<result property="ename" column="ename" jdbcType="VARCHAR"/>
|
||||
<result property="company" column="company" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="type" jdbcType="INTEGER"/>
|
||||
<result property="url" column="url" jdbcType="VARCHAR"/>
|
||||
<result property="ordernum" column="orderNum" jdbcType="INTEGER"/>
|
||||
<result property="isdelete" column="isDelete" jdbcType="INTEGER"/>
|
||||
<result property="isshow" column="isShow" jdbcType="INTEGER"/>
|
||||
<result property="modifyOn" column="modify_on" jdbcType="BIGINT"/>
|
||||
<result property="platform" column="platform" jdbcType="INTEGER"/>
|
||||
<result property="shopUrl" column="shop_url" jdbcType="VARCHAR"/>
|
||||
<result property="orderNum" column="order_num" jdbcType="INTEGER"/>
|
||||
<result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="selleruserid" column="sellerUserId" jdbcType="BIGINT"/>
|
||||
<result property="selleruseridstr" column="sellerUserIdStr" jdbcType="VARCHAR"/>
|
||||
<result property="sessionkey" column="sessionKey" jdbcType="VARCHAR"/>
|
||||
<result property="appkey" column="appkey" jdbcType="VARCHAR"/>
|
||||
<result property="appsercet" column="appSercet" jdbcType="VARCHAR"/>
|
||||
<result property="expiresIn" column="expires_in" jdbcType="BIGINT"/>
|
||||
<result property="sellerShopId" column="seller_shop_id" jdbcType="BIGINT"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSercet" column="app_sercet" jdbcType="VARCHAR"/>
|
||||
<result property="accessToken" column="access_token" jdbcType="VARCHAR"/>
|
||||
<result property="accessExpiresIn" column="access_expires_in" jdbcType="BIGINT"/>
|
||||
<result property="accessTokenBegin" column="access_token_begin" jdbcType="BIGINT"/>
|
||||
<result property="refreshToken" column="refresh_token" jdbcType="VARCHAR"/>
|
||||
<result property="refreshTokenTimeout" column="refresh_token_timeout" jdbcType="BIGINT"/>
|
||||
<result property="apiRequestUrl" column="api_request_url" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,nickName,
|
||||
ename,company,type,
|
||||
url,orderNum,isDelete,
|
||||
isShow,modify_on,remark,
|
||||
sellerUserId,sellerUserIdStr,sessionKey,
|
||||
appkey,appSercet,expires_in,
|
||||
id,name,nick_name,
|
||||
ename,company,platform,
|
||||
shop_url,order_num,is_delete,
|
||||
remark,seller_shop_id,app_key,
|
||||
app_sercet,access_token,access_expires_in,
|
||||
access_token_begin,refresh_token,refresh_token_timeout,
|
||||
api_request_url
|
||||
create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.qihang.tao.mapper.SShopPlatformMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.tao.domain.SShopPlatform">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSecret" column="app_secret" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="serverUrl" column="server_url" jdbcType="VARCHAR"/>
|
||||
<result property="redirectUrl" column="redirect_url" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,app_key,
|
||||
app_secret,remark,server_url,
|
||||
redirect_url,create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.qihang.tao.mapper.SShopSettingMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.tao.domain.SShopSetting">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSecret" column="app_secret" jdbcType="VARCHAR"/>
|
||||
<result property="accessToken" column="access_token" jdbcType="VARCHAR"/>
|
||||
<result property="expiresIn" column="expires_in" jdbcType="BIGINT"/>
|
||||
<result property="accessTokenBegin" column="access_token_begin" jdbcType="BIGINT"/>
|
||||
<result property="refreshToken" column="refresh_token" jdbcType="VARCHAR"/>
|
||||
<result property="refreshTokenTimeout" column="refresh_token_timeout" jdbcType="BIGINT"/>
|
||||
<result property="modifyOn" column="modify_on" jdbcType="BIGINT"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="requestUrl" column="request_url" jdbcType="VARCHAR"/>
|
||||
<result property="thirdId" column="third_id" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,app_key,
|
||||
app_secret,access_token,expires_in,
|
||||
access_token_begin,refresh_token,refresh_token_timeout,
|
||||
modify_on,remark,request_url,
|
||||
third_id
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 获取京东授权url
|
||||
export function getJdOAuthUrl(query) {
|
||||
return request({
|
||||
url: '/jd-api/getOauthUrl',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取京东token
|
||||
export function getJdToken(data) {
|
||||
return request({
|
||||
url: '/jd-api/tokenCreate',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
|
||||
export function getPddOAuthUrl(query) {
|
||||
return request({
|
||||
url: '/pdd-api/getOauthUrl',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function getPddToken(data) {
|
||||
return request({
|
||||
url: '/pdd-api/getToken',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function getTaoOAuthUrl(query) {
|
||||
return request({
|
||||
url: '/tao-api/getOauthUrl',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取token
|
||||
export function getTaoToken(data) {
|
||||
return request({
|
||||
url: '/tao-api/tokenCreate',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<el-table-column label="平台" align="center" prop="name" />
|
||||
<el-table-column label="AppKey" align="center" prop="appKey" />
|
||||
<el-table-column label="AppSecret" align="center" prop="appSecret" />
|
||||
<el-table-column label="回调URL" align="center" prop="redirectUri" />
|
||||
<el-table-column label="回调URL" align="center" prop="redirectUrl" />
|
||||
<el-table-column label="接口请求URL" align="center" prop="serverUrl" />
|
||||
<!-- <el-table-column label="描述" align="center" prop="remark" />-->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
|
|
@ -51,17 +51,14 @@
|
|||
<el-form-item label="平台名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入平台名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入平台编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="AppKey" prop="appKey">
|
||||
<el-input v-model="form.appKey" placeholder="请输入AppKey" />
|
||||
</el-form-item>
|
||||
<el-form-item label="AppSecret" prop="appSecret">
|
||||
<el-input v-model="form.appSecret" placeholder="请输入AppSecret" />
|
||||
</el-form-item>
|
||||
<el-form-item label="回调URL" prop="redirectUri">
|
||||
<el-input v-model="form.redirectUri" placeholder="请输入回调URL" />
|
||||
<el-form-item label="回调URL" prop="redirectUrl">
|
||||
<el-input v-model="form.redirectUrl" placeholder="请输入回调URL" />
|
||||
</el-form-item>
|
||||
<el-form-item label="接口请求URL" prop="serverUrl">
|
||||
<el-input v-model="form.serverUrl" placeholder="请输入接口请求URL" />
|
||||
|
|
@ -78,31 +75,6 @@
|
|||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- API参数设置对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="apiOpen" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="appkey" prop="appkey">
|
||||
<el-input v-model="form.appkey" placeholder="请输入appkey" />
|
||||
</el-form-item>
|
||||
<el-form-item label="appSercet" prop="appSercet">
|
||||
<el-input v-model="form.appSercet" placeholder="请输入appSercet" />
|
||||
</el-form-item>
|
||||
<el-form-item label="API请求URL" prop="apiRequestUrl">
|
||||
<el-input v-model="form.apiRequestUrl" placeholder="请输入API请求URL" />
|
||||
</el-form-item>
|
||||
<el-form-item label="卖家UserId" prop="sellerUserId">
|
||||
<el-input v-model="form.sellerUserId" placeholder="请输入sellerUserId" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="描述" prop="remark">-->
|
||||
<!-- <el-input type="textarea" v-model="form.remark" placeholder="请输入描述" />-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -171,21 +143,11 @@ export default {
|
|||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
nickName: null,
|
||||
ename: null,
|
||||
company: null,
|
||||
type: null,
|
||||
url: null,
|
||||
orderNum: null,
|
||||
isDelete: null,
|
||||
isShow: null,
|
||||
modifyOn: null,
|
||||
remark: null,
|
||||
sellerUserId: null,
|
||||
sellerUserIdStr: null,
|
||||
sessionKey: null,
|
||||
appkey: null,
|
||||
appSercet: null
|
||||
appSercet: null,
|
||||
remark: null,
|
||||
serverUrl: null,
|
||||
redirectUrl: null,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
|
@ -206,7 +168,7 @@ export default {
|
|||
getPlatform(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.$nextTick(()=>{
|
||||
this.form.type = response.data.type+'';
|
||||
this.form.platform = response.data.platform+'';
|
||||
})
|
||||
|
||||
this.open = true;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="平台" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择平台" clearable>
|
||||
<el-form-item label="平台" prop="platform">
|
||||
<el-select v-model="queryParams.platform" placeholder="请选择平台" clearable>
|
||||
<el-option
|
||||
v-for="item in typeList"
|
||||
:key="item.id"
|
||||
|
|
@ -79,17 +79,17 @@
|
|||
<!-- <el-table-column label="店铺别名" align="center" prop="nickName" /> -->
|
||||
<!-- <el-table-column label="标识" align="center" prop="ename" /> -->
|
||||
<!-- <el-table-column label="店铺主体" align="center" prop="company" /> -->
|
||||
<el-table-column label="平台" align="center" prop="type" >
|
||||
<el-table-column label="平台" align="center" prop="platform" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.type === 1">1688</el-tag>
|
||||
<el-tag v-if="scope.row.type === 2">视频号小店</el-tag>
|
||||
<el-tag v-if="scope.row.type === 3">京东</el-tag>
|
||||
<el-tag v-if="scope.row.type === 4">淘系店铺</el-tag>
|
||||
<el-tag v-if="scope.row.type === 5">拼多多</el-tag>
|
||||
<el-tag v-if="scope.row.type === 6">抖店</el-tag>
|
||||
<el-tag v-if="scope.row.type === 7">小红书</el-tag>
|
||||
<el-tag v-if="scope.row.type === 8">快手小店</el-tag>
|
||||
<el-tag v-if="scope.row.type === 99">其他</el-tag>
|
||||
<el-tag v-if="scope.row.platform === 1">1688</el-tag>
|
||||
<el-tag v-if="scope.row.platform === 2">视频号小店</el-tag>
|
||||
<el-tag v-if="scope.row.platform === 3">京东</el-tag>
|
||||
<el-tag v-if="scope.row.platform === 4">淘系店铺</el-tag>
|
||||
<el-tag v-if="scope.row.platform === 5">拼多多</el-tag>
|
||||
<el-tag v-if="scope.row.platform === 6">抖店</el-tag>
|
||||
<el-tag v-if="scope.row.platform === 7">小红书</el-tag>
|
||||
<el-tag v-if="scope.row.platform === 8">快手小店</el-tag>
|
||||
<el-tag v-if="scope.row.platform === 99">其他</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="店铺url" align="center" prop="url" /> -->
|
||||
|
|
@ -122,20 +122,14 @@
|
|||
>删除</el-button>
|
||||
</el-row>
|
||||
<el-button
|
||||
v-if="scope.row.type!==3"
|
||||
v-if="scope.row.platform !== 99"
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-refresh"
|
||||
size="mini"
|
||||
@click="handleUpdateToken(scope.row)"
|
||||
>更新AccessToken</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
plain
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
@click="handleApiSetting(scope.row)"
|
||||
>API参数设置</el-button>
|
||||
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -151,12 +145,12 @@
|
|||
|
||||
<!-- 添加或修改店铺对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="128px">
|
||||
<el-form-item label="店铺名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入店铺名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="平台" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择店铺平台">
|
||||
<el-form-item label="平台" prop="platform">
|
||||
<el-select v-model="form.platform" placeholder="请选择店铺平台">
|
||||
<el-option
|
||||
v-for="item in typeList"
|
||||
:key="item.id"
|
||||
|
|
@ -168,7 +162,15 @@
|
|||
<el-form-item label="店铺别名" prop="nickName">
|
||||
<el-input v-model="form.nickName" placeholder="请输入店铺别名" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="平台店铺ID" prop="sellerShopId">
|
||||
<el-input v-model="form.sellerShopId" placeholder="请输入平台ShopId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频号appKey" prop="appKey" v-if="form.platform === 2">
|
||||
<el-input v-model="form.appKey" placeholder="请输入视频号appKey" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频号appSercet" prop="appSercet" v-if="form.platform === 2">
|
||||
<el-input v-model="form.appSercet" placeholder="请输入视频号appSercet" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="remark">
|
||||
<el-input type="textarea" v-model="form.remark" placeholder="请输入描述" />
|
||||
</el-form-item>
|
||||
|
|
@ -180,31 +182,6 @@
|
|||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- API参数设置对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="apiOpen" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="appkey" prop="appkey">
|
||||
<el-input v-model="form.appkey" placeholder="请输入appkey" />
|
||||
</el-form-item>
|
||||
<el-form-item label="appSercet" prop="appSercet">
|
||||
<el-input v-model="form.appSercet" placeholder="请输入appSercet" />
|
||||
</el-form-item>
|
||||
<el-form-item label="API请求URL" prop="apiRequestUrl">
|
||||
<el-input v-model="form.apiRequestUrl" placeholder="请输入API请求URL" />
|
||||
</el-form-item>
|
||||
<el-form-item label="卖家UserId" prop="sellerUserId">
|
||||
<el-input v-model="form.sellerUserId" placeholder="请输入sellerUserId" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="描述" prop="remark">-->
|
||||
<!-- <el-input type="textarea" v-model="form.remark" placeholder="请输入描述" />-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :title="title" :visible.sync="authOpen" width="500px" append-to-body>
|
||||
<el-form ref="tokenForm" :model="tokenForm" :rules="rules" label-width="80px">
|
||||
|
|
@ -231,7 +208,10 @@
|
|||
|
||||
<script>
|
||||
import {listShop, getShop, delShop, addShop, updateShop, listPlatform} from "@/api/shop/shop";
|
||||
import {getJdOAuthUrl, getJdToken} from "@/api/jd/shop";
|
||||
import {getTaoOAuthUrl, getTaoToken} from "@/api/tao/shop";
|
||||
import {float} from "quill/ui/icons";
|
||||
import {getPddOAuthUrl,getPddToken} from "@/api/pdd/shop";
|
||||
export default {
|
||||
name: "Shop",
|
||||
data() {
|
||||
|
|
@ -262,11 +242,11 @@ export default {
|
|||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
type: null
|
||||
platform: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
type:null
|
||||
platform:null
|
||||
},
|
||||
// 获取token表单
|
||||
tokenForm:{
|
||||
|
|
@ -278,11 +258,8 @@ export default {
|
|||
name: [
|
||||
{ required: true, message: "店铺名不能为空", trigger: "blur" }
|
||||
],
|
||||
type: [{ required: true, message: "请选择平台", trigger: "change" }],
|
||||
appkey: [{ required: true, message: "不能为空", trigger: "change" }],
|
||||
appSercet: [{ required: true, message: "不能为空", trigger: "change" }],
|
||||
apiRequestUrl: [{ required: true, message: "不能为空", trigger: "change" }],
|
||||
sellerUserId: [{ required: true, message: "不能为空", trigger: "change" }],
|
||||
platform: [{ required: true, message: "请选择平台", trigger: "change" }],
|
||||
sellerShopId: [{ required: true, message: "不能为空", trigger: "change" }],
|
||||
code: [{ required: true, message: "不能为空", trigger: "change" }],
|
||||
|
||||
}
|
||||
|
|
@ -313,6 +290,7 @@ export default {
|
|||
cancel() {
|
||||
this.open = false;
|
||||
this.apiOpen = false;
|
||||
this.authOpen = false
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
|
|
@ -375,15 +353,7 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
handleApiSetting(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getShop(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.apiOpen = true;
|
||||
this.title = "API参数设置";
|
||||
});
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
|
|
@ -417,36 +387,65 @@ export default {
|
|||
},
|
||||
handleUpdateToken(row){
|
||||
console.log("获取token",row)
|
||||
if(row.type === 2 || row.type === 5){
|
||||
if(row.platform === 2){
|
||||
this.$modal.msgSuccess("视频号小店后台会自动获取token,无需手动授权!");
|
||||
}
|
||||
if(row.platform === 3){
|
||||
getJdOAuthUrl({shopId:row.id}).then(response => {
|
||||
console.log("获取token=====jd ",response)
|
||||
this.authOpen = true;
|
||||
this.title = "更新店铺授权";
|
||||
this.tokenForm.url = response.data
|
||||
this.tokenForm.shopId = row.id
|
||||
this.tokenForm.shopType = row.type
|
||||
this.tokenForm.platform = row.platform
|
||||
})
|
||||
}else if(row.type ===1){
|
||||
}else if(row.platform === 4){
|
||||
getTaoOAuthUrl({shopId:row.id}).then(response => {
|
||||
console.log("获取token=====tao ",response)
|
||||
this.authOpen = true;
|
||||
this.title = "更新店铺授权";
|
||||
this.tokenForm.url = response.data
|
||||
this.tokenForm.shopId = row.id
|
||||
this.tokenForm.shopType = row.type
|
||||
this.tokenForm.platform = row.platform
|
||||
})
|
||||
}else if(row.type ===4){
|
||||
getOAuthUrl({shopId:row.id}).then(response => {
|
||||
}else if(row.platform ===5){
|
||||
getPddOAuthUrl({shopId:row.id}).then(response => {
|
||||
console.log("获取token=====pdd ",response)
|
||||
this.authOpen = true;
|
||||
this.title = "更新店铺授权";
|
||||
this.tokenForm.url = response.data
|
||||
this.tokenForm.shopId = row.id
|
||||
this.tokenForm.shopType = row.type
|
||||
this.tokenForm.platform = row.platform
|
||||
})
|
||||
}else if(row.platform === 6){
|
||||
this.$modal.msgSuccess("抖店后台会自动获取token,无需手动授权!");
|
||||
}else if(row.platform === 7){
|
||||
this.$modal.msgError("还未实现小红书接入!敬请期待!");
|
||||
}else if(row.platform === 8){
|
||||
this.$modal.msgError("还未实现快手小店接入!敬请期待!");
|
||||
}
|
||||
|
||||
},
|
||||
getTokenSubmit(){
|
||||
this.$refs["tokenForm"].validate(valid => {
|
||||
if (valid) {
|
||||
console.log("=====更新token=====",this.tokenForm)
|
||||
if(this.tokenForm.platform === 3){
|
||||
getJdToken(this.tokenForm).then(response => {
|
||||
this.authOpen = false
|
||||
this.$modal.msgSuccess("授权成功");
|
||||
|
||||
});
|
||||
}else if(this.tokenForm.platform === 4){
|
||||
getTaoToken(this.tokenForm).then(response => {
|
||||
this.authOpen = false
|
||||
this.$modal.msgSuccess("授权成功");
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue