pdd-api
This commit is contained in:
parent
fd5f786c58
commit
57c788daa3
|
|
@ -28,7 +28,9 @@ public class HomeController {
|
||||||
//获取access_token方法
|
//获取access_token方法
|
||||||
AccessToken accessToken = AccessTokenBuilder.build(90158786L); //入参为shopId 4463798L
|
AccessToken accessToken = AccessTokenBuilder.build(90158786L); //入参为shopId 4463798L
|
||||||
|
|
||||||
|
if ("50002".equals(accessToken.getCode())) {
|
||||||
|
return accessToken.getSubMsg();
|
||||||
|
}
|
||||||
|
|
||||||
OrderSearchListRequest request = new OrderSearchListRequest();
|
OrderSearchListRequest request = new OrderSearchListRequest();
|
||||||
OrderSearchListParam param = request.getParam();
|
OrderSearchListParam param = request.getParam();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.qihang.pdd.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@MapperScan("com.qihang.pdd.mapper")
|
||||||
|
public class MybatisPlusConfig {
|
||||||
|
@Bean
|
||||||
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); //注意使用哪种数据库
|
||||||
|
return interceptor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,12 +16,13 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("/pdd_api")
|
@RequestMapping("/order")
|
||||||
@RestController
|
@RestController
|
||||||
public class AjaxOrderPddController {
|
public class AjaxOrderPddController {
|
||||||
private static Logger log = LoggerFactory.getLogger(AjaxOrderPddController.class);
|
private static Logger log = LoggerFactory.getLogger(AjaxOrderPddController.class);
|
||||||
|
|
@ -41,8 +42,8 @@ public class AjaxOrderPddController {
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/order/pull_order", method = RequestMethod.GET)
|
@RequestMapping(value = "/pull_order", method = RequestMethod.POST)
|
||||||
public ApiResult<Object> getOrderList(OpenApiRequest reqData)
|
public ApiResult<Object> getOrderList(@RequestBody OpenApiRequest reqData)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
Integer updType = reqData.getUpdType();//更新类型0拉取新订单1更新订单
|
Integer updType = reqData.getUpdType();//更新类型0拉取新订单1更新订单
|
||||||
String startDate = reqData.getStartDate();//reqData.getString("startTime");
|
String startDate = reqData.getStartDate();//reqData.getString("startTime");
|
||||||
|
|
@ -54,7 +55,7 @@ public class AjaxOrderPddController {
|
||||||
if (shop.getType() != EnumShopType.PDD.getIndex()) {
|
if (shop.getType() != EnumShopType.PDD.getIndex()) {
|
||||||
return ApiResult.build(HttpStatus.PARAMS_ERROR, "参数错误,店铺不是PDD店铺");
|
return ApiResult.build(HttpStatus.PARAMS_ERROR, "参数错误,店铺不是PDD店铺");
|
||||||
}
|
}
|
||||||
SysPlatform platform = platformService.selectById(EnumShopType.JD.getIndex());
|
SysPlatform platform = platformService.selectById(EnumShopType.PDD.getIndex());
|
||||||
|
|
||||||
if(!StringUtils.hasText(platform.getAppKey())) {
|
if(!StringUtils.hasText(platform.getAppKey())) {
|
||||||
return ApiResult.build(HttpStatus.PARAMS_ERROR, "平台配置错误,没有找到AppKey");
|
return ApiResult.build(HttpStatus.PARAMS_ERROR, "平台配置错误,没有找到AppKey");
|
||||||
|
|
@ -108,16 +109,16 @@ public class AjaxOrderPddController {
|
||||||
if (!StringUtils.isEmpty(startTime_))
|
if (!StringUtils.isEmpty(startTime_))
|
||||||
startTime = DateUtil.dateTimeToStamp(startTime_).longValue();*/
|
startTime = DateUtil.dateTimeToStamp(startTime_).longValue();*/
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(startDate)) {
|
// if (!StringUtils.isEmpty(startDate)) {
|
||||||
// 选择了开始日期,从开始时间直接循环更新到结束时间,如果选择的时间大于数据库订单最后的时间,那么就用数据库的订单时间
|
// // 选择了开始日期,从开始时间直接循环更新到结束时间,如果选择的时间大于数据库订单最后的时间,那么就用数据库的订单时间
|
||||||
Long startTimeTmp = DateUtil.dateTimeToStamp(startDate).longValue();
|
// Long startTimeTmp = DateUtil.dateTimeToStamp(startDate).longValue();
|
||||||
if (startTimeTmp < startTime)
|
// if (startTimeTmp < startTime)
|
||||||
startTime = startTimeTmp;
|
// startTime = startTimeTmp;
|
||||||
|
//
|
||||||
// 如果选择的结束时间不为空,就用选择的时间
|
// // 如果选择的结束时间不为空,就用选择的时间
|
||||||
if (!StringUtils.isEmpty(endDate))
|
// if (!StringUtils.isEmpty(endDate))
|
||||||
endTime = DateUtil.dateTimeToStamp(endDate).longValue();
|
// endTime = DateUtil.dateTimeToStamp(endDate).longValue();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if (StringUtils.isEmpty(startDate)) { //没有选择开始日期 var pullOrderLog =
|
* if (StringUtils.isEmpty(startDate)) { //没有选择开始日期 var pullOrderLog =
|
||||||
|
|
@ -134,8 +135,7 @@ public class AjaxOrderPddController {
|
||||||
long forSize = (kaishidaojiesu % (60 * 60 * 24) == 0) ? kaishidaojiesu / (60 * 60 * 24)
|
long forSize = (kaishidaojiesu % (60 * 60 * 24) == 0) ? kaishidaojiesu / (60 * 60 * 24)
|
||||||
: kaishidaojiesu / (60 * 60 * 24) + 1;// 计算需要循环的次数
|
: kaishidaojiesu / (60 * 60 * 24) + 1;// 计算需要循环的次数
|
||||||
|
|
||||||
log.info("开始循环更新拼多多订单。开始时间:" + DateUtil.unixTimeStampToDate(startTime) + "结束时间:"
|
// log.info("开始循环更新拼多多订单。开始时间:" + DateUtil.unixTimeStampToDate(startTime) + "结束时间:" + DateUtil.unixTimeStampToDate(endTime) + "总共循环" + forSize);
|
||||||
+ DateUtil.unixTimeStampToDate(endTime) + "总共循环" + forSize);
|
|
||||||
int updCount = 0;
|
int updCount = 0;
|
||||||
int insertCount = 0;
|
int insertCount = 0;
|
||||||
int failCount = 0;
|
int failCount = 0;
|
||||||
|
|
@ -149,11 +149,9 @@ public class AjaxOrderPddController {
|
||||||
endTime1 = endTime;
|
endTime1 = endTime;
|
||||||
int pageIndex = 1;
|
int pageIndex = 1;
|
||||||
|
|
||||||
result = this.pullPddOrder(appKey, appSercet, accessToken, pageIndex, pageSize, startTime1, endTime1,
|
result = this.pullPddOrder(params.getAppKey(),params.getAppSecret(), accessToken, pageIndex, pageSize, startTime1, endTime1, shop.getSellerId());
|
||||||
shopId);
|
|
||||||
pageIndex++;
|
pageIndex++;
|
||||||
log.info("开始循环" + i + "。开始时间:" + DateUtil.unixTimeStampToDate(startTime1) + "结束时间:"
|
// log.info("开始循环" + i + "。开始时间:" + DateUtil.unixTimeStampToDate(startTime1) + "结束时间:" + DateUtil.unixTimeStampToDate(endTime1) + "。");
|
||||||
+ DateUtil.unixTimeStampToDate(endTime1) + "。");
|
|
||||||
// log.info("开始更新第"+pageIndex+"页");
|
// log.info("开始更新第"+pageIndex+"页");
|
||||||
if (result.getCode() == 0) {
|
if (result.getCode() == 0) {
|
||||||
updCount += result.getData().getUpdCount();
|
updCount += result.getData().getUpdCount();
|
||||||
|
|
@ -161,36 +159,35 @@ public class AjaxOrderPddController {
|
||||||
failCount += result.getData().getFailCount();
|
failCount += result.getData().getFailCount();
|
||||||
// log.info("查询到数据:"+result.getData().getTotalRecords());
|
// log.info("查询到数据:"+result.getData().getTotalRecords());
|
||||||
} else if (result.getCode() > 0)
|
} else if (result.getCode() > 0)
|
||||||
return new ApiResult<>(result.getCode(), result.getMsg());
|
return ApiResult.build(result.getCode(), result.getMsg());
|
||||||
// 计算总页数
|
// 计算总页数
|
||||||
int totalPage = (result.getData().getTotalRecords() % pageSize == 0)
|
int totalPage = (result.getData().getTotalRecords() % pageSize == 0)
|
||||||
? result.getData().getTotalRecords() / pageSize
|
? result.getData().getTotalRecords() / pageSize
|
||||||
: (result.getData().getTotalRecords() / pageSize) + 1;
|
: (result.getData().getTotalRecords() / pageSize) + 1;
|
||||||
log.info("开始循环" + i + "。查询到" + result.getData().getTotalRecords() + "条数据,总共:" + totalPage + "页");
|
log.info("开始循环" + i + "。查询到" + result.getData().getTotalRecords() + "条数据,总共:" + totalPage + "页");
|
||||||
while (pageIndex <= totalPage) {
|
// while (pageIndex <= totalPage) {
|
||||||
|
//
|
||||||
// log.info("开始更新第"+pageIndex+"页");
|
// // log.info("开始更新第"+pageIndex+"页");
|
||||||
// log.info("查询到数据:"+result.getData().getTotalRecords());
|
// // log.info("查询到数据:"+result.getData().getTotalRecords());
|
||||||
result = this.pullPddOrder(appKey, appSercet, accessToken, pageIndex, pageSize, startTime1,
|
// result = this.pullPddOrder(appKey, appSercet, accessToken, pageIndex, pageSize, startTime1, endTime1, shopId);
|
||||||
endTime1, shopId);
|
// if (result.getCode() == 0) {
|
||||||
if (result.getCode() == 0) {
|
// updCount += result.getData().getUpdCount();
|
||||||
updCount += result.getData().getUpdCount();
|
// insertCount += result.getData().getAddCount();
|
||||||
insertCount += result.getData().getAddCount();
|
// failCount += result.getData().getFailCount();
|
||||||
failCount += result.getData().getFailCount();
|
// }
|
||||||
}
|
// pageIndex++;
|
||||||
pageIndex++;
|
// }
|
||||||
}
|
|
||||||
// pageIndex = 1;
|
// pageIndex = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ErpSalesPullCountResp resp = new ErpSalesPullCountResp();// 返回结果
|
// ErpSalesPullCountResp resp = new ErpSalesPullCountResp();// 返回结果
|
||||||
resp.setStartTime(DateUtil.unixTimeStampToDate(startTime));
|
// resp.setStartTime(DateUtil.unixTimeStampToDate(startTime));
|
||||||
resp.setEndTime(DateUtil.unixTimeStampToDate(endTime));
|
// resp.setEndTime(DateUtil.unixTimeStampToDate(endTime));
|
||||||
resp.setAddCount(insertCount);
|
// resp.setAddCount(insertCount);
|
||||||
resp.setFailCount(failCount);
|
// resp.setFailCount(failCount);
|
||||||
resp.setUpdCount(updCount);
|
// resp.setUpdCount(updCount);
|
||||||
log.info("更新完成,结果:" + JsonUtil.transferToJson(resp));
|
// log.info("更新完成,结果:" + JsonUtil.transferToJson(resp));
|
||||||
/*
|
/*
|
||||||
* try { //添加更新日志 salesOrderService.addErpSalesPullOrderLog(startTime, endTime,
|
* try { //添加更新日志 salesOrderService.addErpSalesPullOrderLog(startTime, endTime,
|
||||||
* shopId, result.getData().getAddCount(), result.getData().getFailCount(),
|
* shopId, result.getData().getAddCount(), result.getData().getFailCount(),
|
||||||
|
|
@ -198,9 +195,9 @@ public class AjaxOrderPddController {
|
||||||
* log.info("添加更新日志错误"); }
|
* log.info("添加更新日志错误"); }
|
||||||
*/
|
*/
|
||||||
if (result.getCode() == 0)
|
if (result.getCode() == 0)
|
||||||
return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "SUCCESS", resp);
|
return ApiResult.build(HttpStatus.SUCCESS, "SUCCESS");
|
||||||
else
|
else
|
||||||
return new ApiResult<>(result.getCode(), result.getMsg());
|
return ApiResult.build(result.getCode(), result.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -229,17 +226,17 @@ public class AjaxOrderPddController {
|
||||||
pddOrderListGetRequest.setPageSize(pageSize);
|
pddOrderListGetRequest.setPageSize(pageSize);
|
||||||
|
|
||||||
ErpSalesPullCountResp resp = new ErpSalesPullCountResp();
|
ErpSalesPullCountResp resp = new ErpSalesPullCountResp();
|
||||||
resp.setStartTime(DateUtil.unixTimeStampToDate(startTime));
|
resp.setStartTime("2024-03-03 00:00:00");
|
||||||
resp.setEndTime(DateUtil.unixTimeStampToDate(endTime));
|
resp.setEndTime("2024-03-13 23:00:00");
|
||||||
|
|
||||||
Integer addCount = 0, updCount = 0, failCount = 0;
|
Integer addCount = 0, updCount = 0, failCount = 0;
|
||||||
log.info("开始更新第" + pageNo + "页。。。。。。。");
|
log.info("开始更新第" + pageNo + "页。。。。。。。");
|
||||||
PddOrderListGetResponse pddOrderListGetResponse = client.syncInvoke(pddOrderListGetRequest, accessToken);
|
PddOrderListGetResponse pddOrderListGetResponse = client.syncInvoke(pddOrderListGetRequest, accessToken);
|
||||||
if (pddOrderListGetResponse.getErrorResponse() != null) {
|
if (pddOrderListGetResponse.getErrorResponse() != null) {
|
||||||
if (pddOrderListGetResponse.getErrorResponse().getErrorCode().intValue() == 10019) {
|
if (pddOrderListGetResponse.getErrorResponse().getErrorCode().intValue() == 10019) {
|
||||||
return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "Token过期");
|
return ApiResult.build(HttpStatus.UNAUTHORIZED, "Token过期");
|
||||||
} else
|
} else
|
||||||
return new ApiResult<>(EnumResultVo.SystemException.getIndex(),
|
return ApiResult.build(HttpStatus.ERROR,
|
||||||
"接口调用失败:" + pddOrderListGetResponse.getErrorResponse().getErrorMsg());
|
"接口调用失败:" + pddOrderListGetResponse.getErrorResponse().getErrorMsg());
|
||||||
} else {
|
} else {
|
||||||
// 获取到了数据
|
// 获取到了数据
|
||||||
|
|
@ -250,9 +247,9 @@ public class AjaxOrderPddController {
|
||||||
// if(item.getOrderSn().equals("210629-025663970220736")){
|
// if(item.getOrderSn().equals("210629-025663970220736")){
|
||||||
// String s= item.getOrderSn();
|
// String s= item.getOrderSn();
|
||||||
// }
|
// }
|
||||||
PddOrder pddEntity = new PddOrder();
|
/*PddOrder pddEntity = new PddOrder();
|
||||||
|
|
||||||
/*pddEntity.setBuyer_memo(item.getBuyerMemo());
|
pddEntity.setBuyer_memo(item.getBuyerMemo());
|
||||||
pddEntity.setCapital_free_discount(item.getCapitalFreeDiscount());
|
pddEntity.setCapital_free_discount(item.getCapitalFreeDiscount());
|
||||||
pddEntity.setCity(item.getCity());
|
pddEntity.setCity(item.getCity());
|
||||||
pddEntity.setConfirm_status(item.getConfirmStatus());
|
pddEntity.setConfirm_status(item.getConfirmStatus());
|
||||||
|
|
@ -339,7 +336,7 @@ public class AjaxOrderPddController {
|
||||||
} else
|
} else
|
||||||
resp.setTotalRecords(0);
|
resp.setTotalRecords(0);
|
||||||
}
|
}
|
||||||
return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "SUCCESS", resp);
|
return ApiResult.build(HttpStatus.SUCCESS, "SUCCESS", resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,97 +1,97 @@
|
||||||
package com.qihang.pdd.controller;
|
//package com.qihang.pdd.controller;
|
||||||
|
//
|
||||||
|
//
|
||||||
import com.pdd.pop.sdk.http.PopAccessTokenClient;
|
//import com.pdd.pop.sdk.http.PopAccessTokenClient;
|
||||||
import com.pdd.pop.sdk.http.token.AccessTokenResponse;
|
//import com.pdd.pop.sdk.http.token.AccessTokenResponse;
|
||||||
import com.qihang.erp.api.service.IShopService;
|
//import com.qihang.erp.api.service.IShopService;
|
||||||
import com.zhijian.core.config.ServerConfig;
|
//import com.zhijian.core.config.ServerConfig;
|
||||||
import org.slf4j.Logger;
|
//import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
//import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
//import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
//import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
//import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
//
|
||||||
import javax.servlet.http.HttpServletRequest;
|
//import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
//import java.io.IOException;
|
||||||
|
//
|
||||||
@RequestMapping("/pdd_api2")
|
//@RequestMapping("/pdd_api2")
|
||||||
@Controller
|
//@Controller
|
||||||
public class PddOAuthController {
|
//public class PddOAuthController {
|
||||||
@Autowired
|
// @Autowired
|
||||||
private IShopService shopService;
|
// private IShopService shopService;
|
||||||
@Autowired
|
// @Autowired
|
||||||
private ServerConfig serverConfig;
|
// private ServerConfig serverConfig;
|
||||||
private static Logger log = LoggerFactory.getLogger(PddOAuthController.class);
|
// private static Logger log = LoggerFactory.getLogger(PddOAuthController.class);
|
||||||
|
//
|
||||||
@RequestMapping("/oauth")
|
// @RequestMapping("/oauth")
|
||||||
public String oauth(HttpServletRequest req) {
|
// public String oauth(HttpServletRequest req) {
|
||||||
String returnUrl = serverConfig.getUrl() + "/pdd_api/getToken&state="+req.getParameter("shopId");
|
// String returnUrl = serverConfig.getUrl() + "/pdd_api/getToken&state="+req.getParameter("shopId");
|
||||||
var shop = shopService.selectShopById(Long.parseLong(req.getParameter("shopId")));
|
// var shop = shopService.selectShopById(Long.parseLong(req.getParameter("shopId")));
|
||||||
|
//
|
||||||
String appKey = shop.getAppkey();
|
// String appKey = shop.getAppkey();
|
||||||
String appSercet = shop.getAppSercet();
|
// String appSercet = shop.getAppSercet();
|
||||||
|
//
|
||||||
String url = "https://mms.pinduoduo.com/open.html?response_type=code&client_id=" + appKey + "&redirect_uri=" + returnUrl;
|
// String url = "https://mms.pinduoduo.com/open.html?response_type=code&client_id=" + appKey + "&redirect_uri=" + returnUrl;
|
||||||
return "redirect:" + url;
|
// return "redirect:" + url;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@RequestMapping("/getToken")
|
// @RequestMapping("/getToken")
|
||||||
public String getToken(HttpServletRequest req) throws IOException, InterruptedException {
|
// public String getToken(HttpServletRequest req) throws IOException, InterruptedException {
|
||||||
log.info("/**********获取拼多多授权token*********/");
|
// log.info("/**********获取拼多多授权token*********/");
|
||||||
String code = req.getParameter("code");
|
// String code = req.getParameter("code");
|
||||||
|
//
|
||||||
Long shopId =Long.parseLong(req.getParameter("state"));
|
// Long shopId =Long.parseLong(req.getParameter("state"));
|
||||||
var shop = shopService.selectShopById(shopId);
|
// var shop = shopService.selectShopById(shopId);
|
||||||
String appKey = shop.getAppkey();
|
// String appKey = shop.getAppkey();
|
||||||
String appSercet = shop.getAppSercet();
|
// String appSercet = shop.getAppSercet();
|
||||||
PopAccessTokenClient accessTokenClient = new PopAccessTokenClient(appKey, appSercet);
|
// PopAccessTokenClient accessTokenClient = new PopAccessTokenClient(appKey, appSercet);
|
||||||
|
//
|
||||||
// 生成AccessToken
|
// // 生成AccessToken
|
||||||
try {
|
// try {
|
||||||
AccessTokenResponse response = accessTokenClient.generate(code);
|
// AccessTokenResponse response = accessTokenClient.generate(code);
|
||||||
if(response.getErrorResponse()!=null){
|
// if(response.getErrorResponse()!=null){
|
||||||
log.info("/***************获取拼多多授权token错误:"+response.getErrorResponse().getErrorMsg()+"**************/");
|
// log.info("/***************获取拼多多授权token错误:"+response.getErrorResponse().getErrorMsg()+"**************/");
|
||||||
}else{
|
// }else{
|
||||||
//保存accessToken
|
// //保存accessToken
|
||||||
System.out.println(shopId +"--token:" + response.getAccessToken()+",thirdId:"+response.getOwnerId()+",shopId:"+shopId);
|
// System.out.println(shopId +"--token:" + response.getAccessToken()+",thirdId:"+response.getOwnerId()+",shopId:"+shopId);
|
||||||
|
//
|
||||||
shopService.updateSessionKey(shopId,Long.parseLong(response.getOwnerId()),response.getAccessToken());
|
// shopService.updateSessionKey(shopId,Long.parseLong(response.getOwnerId()),response.getAccessToken());
|
||||||
|
//
|
||||||
// thirdSettingService.updateEntity(shopId, response.getAccessToken(), response.getRefreshToken(), response.getExpiresIn(),response.getOwnerId());
|
//// thirdSettingService.updateEntity(shopId, response.getAccessToken(), response.getRefreshToken(), response.getExpiresIn(),response.getOwnerId());
|
||||||
return "redirect:/pdd/getTokenSuccess?mallId="+response.getOwnerId();
|
// return "redirect:/pdd/getTokenSuccess?mallId="+response.getOwnerId();
|
||||||
/* String state = req.getParameter("state");
|
///* String state = req.getParameter("state");
|
||||||
if (state.equalsIgnoreCase("GETORDERLIST")) {
|
// if (state.equalsIgnoreCase("GETORDERLIST")) {
|
||||||
//获取订单list
|
// //获取订单list
|
||||||
return "redirect:/shop/shop_list";
|
// return "redirect:/shop/shop_list";
|
||||||
} else if (state.equalsIgnoreCase("DCGOODSLIST")) {
|
// } else if (state.equalsIgnoreCase("DCGOODSLIST")) {
|
||||||
//商品list
|
// //商品list
|
||||||
return "redirect:/goods/pdd_list";
|
// return "redirect:/goods/pdd_list";
|
||||||
}*/
|
// }*/
|
||||||
}
|
// }
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
|
//
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
return "redirect:/";
|
// return "redirect:/";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 获取授权成功
|
// * 获取授权成功
|
||||||
* @param req
|
// * @param req
|
||||||
* @param model
|
// * @param model
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
@RequestMapping("/getTokenSuccess")
|
// @RequestMapping("/getTokenSuccess")
|
||||||
public String getTokeSuccess(HttpServletRequest req, @RequestParam Long mallId, Model model){
|
// public String getTokeSuccess(HttpServletRequest req, @RequestParam Long mallId, Model model){
|
||||||
var shop = shopService.selectShopById(mallId);
|
// var shop = shopService.selectShopById(mallId);
|
||||||
model.addAttribute("shop",shop);
|
// model.addAttribute("shop",shop);
|
||||||
model.addAttribute("shopId",shop.getId());
|
// model.addAttribute("shopId",shop.getId());
|
||||||
return "get_token_success";
|
// return "get_token_success";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue