完善pdd商品拉取、关联
This commit is contained in:
parent
c48b8c9a25
commit
e62d17cf56
|
|
@ -63,7 +63,7 @@ public class ApiCommon {
|
|||
params.setSellerId(shop.getSellerShopId().toString());
|
||||
if (!StringUtils.hasText(shop.getAccessToken())) {
|
||||
|
||||
return ResultVo.error(HttpStatus.UNAUTHORIZED, "Token已过期,请重新授权", params);
|
||||
return ResultVo.error(HttpStatus.UNAUTHORIZED1, "Token已过期,请重新授权", params);
|
||||
}
|
||||
|
||||
/****************先查询卖家对不对***************/
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -23,78 +23,14 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-web</artifactId>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-undertow</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <!–SpringCloud Alibaba nacos 服务发现依赖–>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.qihang</groupId>-->
|
||||
<!-- <artifactId>security</artifactId>-->
|
||||
<!-- <version>1.0-SNAPSHOT</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>mysql</groupId>-->
|
||||
<!-- <artifactId>mysql-connector-java</artifactId>-->
|
||||
<!-- <version>8.0.33</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.baomidou</groupId>-->
|
||||
<!-- <artifactId>mybatis-plus-spring-boot3-starter</artifactId>-->
|
||||
<!-- <version>3.5.5</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>pdd</groupId>
|
||||
<artifactId>pop-sdk-all</artifactId>
|
||||
<version>1.11.8</version>
|
||||
<artifactId>pop-api</artifactId>
|
||||
<version>0.3</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/pop-sdk-all-1.11.8.jar</systemPath>
|
||||
<systemPath>${project.basedir}/libs/pdd-api-0.3.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.projectlombok</groupId>-->
|
||||
<!-- <artifactId>lombok</artifactId>-->
|
||||
<!-- <version>1.18.30</version>-->
|
||||
<!-- <scope>provided</scope>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
</dependencies>
|
||||
<!-- <dependencyManagement>-->
|
||||
<!-- <dependencies>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-dependencies</artifactId>-->
|
||||
<!-- <version>${spring-boot.version}</version>-->
|
||||
<!-- <type>pom</type>-->
|
||||
<!-- <scope>import</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-alibaba-dependencies</artifactId>-->
|
||||
<!-- <version>${spring-cloud-alibaba.version}</version>-->
|
||||
<!-- <type>pom</type>-->
|
||||
<!-- <scope>import</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- </dependencies>-->
|
||||
<!-- </dependencyManagement>-->
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -1,768 +0,0 @@
|
|||
package com.qihang.pdd.controller;//package com.qihang.erp.api.controller.pdd;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSON;
|
||||
//import com.b2c.common.api.ApiResult;
|
||||
//import com.b2c.common.api.ApiResultEnum;
|
||||
//import com.b2c.common.utils.DateUtil;
|
||||
//import com.b2c.common.utils.JsonUtil;
|
||||
//import com.b2c.entity.DataRow;
|
||||
//import com.b2c.entity.enums.EnumPddLogistics;
|
||||
//import com.b2c.entity.erp.ErpPullOrderLogEntity;
|
||||
//import com.b2c.entity.erp.vo.ErpSalesPullCountResp;
|
||||
//import com.b2c.entity.pdd.OrderPddEntity;
|
||||
//import com.b2c.entity.pdd.OrderPddItemEntity;
|
||||
//import com.b2c.entity.pdd.RefundPddEntity;
|
||||
//import com.b2c.entity.result.EnumResultVo;
|
||||
//import com.b2c.oms.DataConfigObject;
|
||||
//import com.b2c.service.ShopService;
|
||||
//import com.b2c.service.erp.ErpSalesOrderService;
|
||||
//import com.b2c.service.oms.OrderPddRefundService;
|
||||
//import com.b2c.service.oms.OrderPddService;
|
||||
//import com.b2c.service.oms.SysThirdSettingService;
|
||||
//import com.pdd.pop.sdk.http.PopClient;
|
||||
//import com.pdd.pop.sdk.http.PopHttpClient;
|
||||
//import com.pdd.pop.sdk.http.api.pop.request.PddOrderInformationGetRequest;
|
||||
//import com.pdd.pop.sdk.http.api.pop.request.PddRefundInformationGetRequest;
|
||||
//import com.pdd.pop.sdk.http.api.pop.request.PddRefundListIncrementGetRequest;
|
||||
//import com.pdd.pop.sdk.http.api.pop.response.PddOrderInformationGetResponse;
|
||||
//import com.pdd.pop.sdk.http.api.pop.response.PddRefundInformationGetResponse;
|
||||
//import com.pdd.pop.sdk.http.api.pop.response.PddRefundListIncrementGetResponse;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.ui.Model;
|
||||
//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.RequestMethod;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//@RequestMapping("/ajax_pdd")
|
||||
//@RestController
|
||||
//public class AjaxRefundPddController {
|
||||
// private static Logger log = LoggerFactory.getLogger(AjaxRefundPddController.class);
|
||||
//
|
||||
// @Autowired
|
||||
// private SysThirdSettingService thirdSettingService;
|
||||
// @Autowired
|
||||
// private OrderPddService orderPddService;
|
||||
// @Autowired
|
||||
// private ErpSalesOrderService salesOrderService;
|
||||
//
|
||||
// @Autowired
|
||||
// private OrderPddRefundService refundService;
|
||||
//
|
||||
// @Autowired
|
||||
// private ShopService shopService;
|
||||
// /**
|
||||
// * pdd退货订单更新
|
||||
// * @param model
|
||||
// * @param req
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// @RequestMapping(value = "/pull_refund")
|
||||
// public ApiResult<ErpSalesPullCountResp> getOrderList(Model model,@RequestBody DataRow data, HttpServletRequest req) throws Exception {
|
||||
// String startDate = data.getString("startTime");
|
||||
// String endDate = data.getString("endTime");
|
||||
// Integer shopId = data.getInt("shopId");//拼多多shopId
|
||||
//
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
//
|
||||
// var shop = shopService.getShop(shopId);
|
||||
//
|
||||
// ErpSalesPullCountResp resp=new ErpSalesPullCountResp();//返回结果
|
||||
//
|
||||
// // var settingEntity = thirdSettingService.getEntity(shop.getType());
|
||||
//
|
||||
//
|
||||
//
|
||||
// Long startTime = 0L;
|
||||
// Long endTime = System.currentTimeMillis() / 1000;
|
||||
// if(StringUtils.isEmpty(startDate)) {
|
||||
// //没有选择开始日期
|
||||
// ErpPullOrderLogEntity pullOrderLog = null;//salesOrderService.getErpOrderPullLogByShopId(shopId, 1);
|
||||
// if (pullOrderLog != null) {
|
||||
// startTime = pullOrderLog.getEndTime() - 60 * 10;
|
||||
//// endTime = startTime + 60 * 30;
|
||||
//// if (endTime > System.currentTimeMillis() / 1000) {
|
||||
//// //如果结束时间大于当前时间,那么将开始时间和结算时间改成当前24小时内
|
||||
//// endTime = System.currentTimeMillis() / 1000;
|
||||
//// startTime = endTime - 60 * 60 * 24;
|
||||
//// }
|
||||
// }else{
|
||||
// startTime = endTime - 60 * 60 * 24;//(24小时前)
|
||||
// // return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请选择开始拉取时间");
|
||||
// }
|
||||
// }else {
|
||||
// //选择了开始日期,从开始时间直接循环更新到结束时间
|
||||
//// startTime = DateUtil.dateToStamp(startDate).longValue();
|
||||
// startTime = DateUtil.dateTimeToStamp(startDate).longValue();
|
||||
//
|
||||
// if(StringUtils.isEmpty(endDate)) endTime = System.currentTimeMillis() / 1000;
|
||||
// else
|
||||
// endTime = DateUtil.dateTimeToStamp(endDate).longValue();
|
||||
//// endTime = DateUtil.dateTimeToStamp(endDate+" 23:59:00").longValue();
|
||||
//// startTime = 1587966628L;endTime = startTime + 60 * 30;
|
||||
// }
|
||||
//
|
||||
// /****************循环更新,直到结束,30分钟一次****************/
|
||||
//
|
||||
// long kaishidaojiesu = endTime - startTime;
|
||||
// long forSize = (kaishidaojiesu % 1800 == 0)?kaishidaojiesu / 1800 : kaishidaojiesu / 1800 +1;//计算需要循环的次数
|
||||
// log.info("开始循环更新拼多多退货。开始时间:"+DateUtil.unixTimeStampToDate(startTime)+"结束时间:"+DateUtil.unixTimeStampToDate(endTime)+"总共循环"+forSize);
|
||||
// int updCount = 0;
|
||||
// int insertCount = 0;
|
||||
// int failCount = 0;
|
||||
//
|
||||
// //开始循环更新
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
// for(int i=0;i<forSize;i++) {
|
||||
// Long startTime1 = startTime + i*1800;
|
||||
// Long endTime1 = startTime1 +1800;
|
||||
//
|
||||
// PddRefundListIncrementGetRequest request = new PddRefundListIncrementGetRequest();
|
||||
// request.setAfterSalesStatus(1);
|
||||
// request.setAfterSalesType(1);
|
||||
// request.setStartUpdatedAt(startTime1);//1586239200L
|
||||
// request.setEndUpdatedAt(endTime1);//1586241000L
|
||||
// request.setPage(1);
|
||||
// request.setPageSize(100);
|
||||
//
|
||||
// PddRefundListIncrementGetResponse response = client.syncInvoke(request, shop.getSessionKey());
|
||||
//
|
||||
// if (response.getErrorResponse() != null) {
|
||||
// if (response.getErrorResponse().getErrorCode().intValue() == 10019) {
|
||||
// log.info("更新失败,Token过期");
|
||||
// //token过期
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "Token过期");
|
||||
// } else {
|
||||
// log.info("更新失败:"+response.getErrorResponse().getErrorMsg());
|
||||
// return new ApiResult<>(EnumResultVo.SystemException.getIndex(), "接口调用失败:" + response.getErrorResponse().getErrorMsg());
|
||||
// }
|
||||
// } else {
|
||||
// //获取到了数据
|
||||
// if (response.getRefundIncrementGetResponse().getTotalCount() == 0) {
|
||||
// //return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "获取到0条数据");
|
||||
// } else {
|
||||
// //开始处理订单数据
|
||||
// for (var item : response.getRefundIncrementGetResponse().getRefundList()) {
|
||||
//
|
||||
// RefundPddEntity entity = new RefundPddEntity();
|
||||
// entity.setAfter_sale_reason(item.getAfterSaleReason());
|
||||
// entity.setAfter_sales_status(item.getAfterSalesStatus());
|
||||
// entity.setAfter_sales_type(item.getAfterSalesType());
|
||||
// entity.setConfirm_time(DateUtil.strToLongGo(item.getConfirmTime()));
|
||||
// entity.setCreated_time(DateUtil.strToLongGo(item.getCreatedTime()));
|
||||
// entity.setDiscount_amount(Double.parseDouble(item.getDiscountAmount()));
|
||||
// entity.setGoods_id(0);
|
||||
// entity.setGoods_number(item.getOuterGoodsId());
|
||||
// entity.setSkuNumber(item.getOuterId());
|
||||
// entity.setGoods_image(item.getGoodImage());
|
||||
// entity.setGoods_name(item.getGoodsName());
|
||||
// entity.setGoods_price(Double.parseDouble(item.getGoodsPrice()));
|
||||
// entity.setSkuInfo("");
|
||||
// entity.setId(item.getId());
|
||||
// entity.setOrder_amount(Double.parseDouble(item.getOrderAmount()));
|
||||
// entity.setOrder_sn(item.getOrderSn());
|
||||
// entity.setQuantity(Integer.parseInt(item.getGoodsNumber()));
|
||||
// entity.setRefund_amount(Double.parseDouble(item.getRefundAmount()));
|
||||
// entity.setShopId(shopId);
|
||||
// entity.setTracking_number(item.getTrackingNumber());
|
||||
// entity.setUpdated_time(item.getUpdatedTime());
|
||||
// var result = orderPddService.editRefundPddOrder(entity);
|
||||
// log.info("开始处理退货单{refundId:"+item.getId()+",status:"+item.getAfterSalesStatus()+"},处理结果:"+result.getMsg());
|
||||
// if (result.getCode() == EnumResultVo.DataExist.getIndex()) {
|
||||
// updCount++;//修改
|
||||
// } else if (result.getCode() == EnumResultVo.SUCCESS.getIndex()) {
|
||||
// insertCount++;
|
||||
// } else {
|
||||
// failCount++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// resp.setStartTime(DateUtil.unixTimeStampToDate(startTime));
|
||||
// resp.setEndTime(DateUtil.unixTimeStampToDate(endTime));
|
||||
// resp.setAddCount(insertCount);
|
||||
// resp.setFailCount(failCount);
|
||||
// resp.setUpdCount(updCount);
|
||||
// salesOrderService.addErpSalesPullOrderLog(startTime, endTime, shopId, insertCount, failCount, updCount, 1);
|
||||
// log.info("退货订单处理完成。"+ JsonUtil.objToString(resp));
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "SUCCESS",resp);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 更新退款订单
|
||||
// * @param model
|
||||
// * @param data
|
||||
// * @param req
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// @RequestMapping(value = "/upd_refund_by_id")
|
||||
// public ApiResult<ErpSalesPullCountResp> updRefundById(Model model, @RequestBody DataRow data, HttpServletRequest req) throws Exception {
|
||||
// Long refId = data.getLong("id");
|
||||
// if (refId == null || refId <= 0) {
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "参数错误,缺少id");
|
||||
// }
|
||||
// Integer shopId = data.getInt("shopId");
|
||||
// if (shopId == null || shopId <= 0) {
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "参数错误,缺少shopId");
|
||||
// }
|
||||
//
|
||||
// var refund = refundService.getEntityById(refId);
|
||||
// if(refund == null) return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "参数错误,不存在refund");
|
||||
//
|
||||
// log.info("/***********开始更新拼多多退货"+refId+"***********/");
|
||||
//
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
//// Integer shopId = 5;//拼多多shopId
|
||||
// var shop = shopService.getShop(shopId);
|
||||
//
|
||||
//// ErpSalesPullCountResp resp=new ErpSalesPullCountResp();//返回结果
|
||||
//
|
||||
// var settingEntity = thirdSettingService.getEntity(shop.getType());
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
//
|
||||
// PddRefundInformationGetRequest request = new PddRefundInformationGetRequest();
|
||||
// request.setAfterSalesId(refId);
|
||||
// request.setOrderSn(refund.getOrder_sn());
|
||||
// PddRefundInformationGetResponse response = client.syncInvoke(request, shop.getSessionKey());
|
||||
//
|
||||
// if (response.getErrorResponse() != null) {
|
||||
// if (response.getErrorResponse().getErrorCode().intValue() == 10019) {
|
||||
// //token过期
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "Token过期");
|
||||
// } else {
|
||||
// return new ApiResult<>(EnumResultVo.SystemException.getIndex(), "接口调用失败:" + response.getErrorResponse().getErrorMsg());
|
||||
// }
|
||||
// }else {
|
||||
//
|
||||
// //获取到了数据
|
||||
// RefundPddEntity entity = new RefundPddEntity();
|
||||
// entity.setAfter_sale_reason(response.getAfterSalesReason());
|
||||
// entity.setAfter_sales_status(response.getAfterSalesStatus());
|
||||
// entity.setAfter_sales_type(response.getAfterSalesType());
|
||||
// entity.setId(response.getId());
|
||||
// entity.setRefund_amount(Double.parseDouble((response.getRefundAmount() / 100)+""));
|
||||
// entity.setShippingStatus(response.getShippingStatus());
|
||||
// entity.setTracking_number(response.getExpressNo());
|
||||
// entity.setTracking_company(response.getShippingName());
|
||||
// entity.setDescribe(response.getRemark());
|
||||
//
|
||||
// var result = orderPddService.updRefundPddOrder(entity);
|
||||
// }
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "SUCCESS");
|
||||
////
|
||||
//// PddRefundListIncrementGetRequest request = new PddRefundListIncrementGetRequest();
|
||||
//// request.setAfterSalesStatus(1);
|
||||
//// request.setAfterSalesType(1);
|
||||
////
|
||||
//// Long startTime=0L;
|
||||
//// Long endTime=System.currentTimeMillis() / 1000;
|
||||
//// var pullOrderLog=salesOrderService.getErpOrderPullLogByShopId(shopId,1);
|
||||
//// if(pullOrderLog!=null){
|
||||
//// startTime=pullOrderLog.getEndTime() - 60 * 10;
|
||||
//// endTime = startTime + 60 * 30;
|
||||
//// }else startTime=endTime-60 * 29;
|
||||
////
|
||||
//// startTime = 1587966628L;
|
||||
//// endTime = startTime + 60 * 30;
|
||||
////
|
||||
//// request.setStartUpdatedAt(startTime);//1586239200L
|
||||
//// request.setEndUpdatedAt(endTime);//1586241000L
|
||||
////
|
||||
//// request.setPage(1);
|
||||
//// request.setPageSize(100);
|
||||
////
|
||||
//// PddRefundListIncrementGetResponse response = client.syncInvoke(request, settingEntity.getAccess_token());
|
||||
////
|
||||
//// int updCount = 0;
|
||||
//// int insertCount = 0;
|
||||
//// int failCount=0;
|
||||
////
|
||||
//// if (response.getErrorResponse() != null) {
|
||||
//// if (response.getErrorResponse().getErrorCode().intValue() == 10019) {
|
||||
//// //token过期
|
||||
//// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "Token过期");
|
||||
//// } else {
|
||||
//// return new ApiResult<>(EnumResultVo.SystemException.getIndex(), "接口调用失败:" + response.getErrorResponse().getErrorMsg());
|
||||
//// }
|
||||
//// } else {
|
||||
//// //获取到了数据
|
||||
//// if (response.getRefundIncrementGetResponse().getTotalCount() == 0) {
|
||||
//// //return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "获取到0条数据");
|
||||
//// } else {
|
||||
//// //开始处理订单数据
|
||||
//// for (var item : response.getRefundIncrementGetResponse().getRefundList()) {
|
||||
//// RefundPddEntity entity = new RefundPddEntity();
|
||||
//// entity.setAfter_sale_reason(item.getAfterSaleReason());
|
||||
//// entity.setAfter_sales_status(item.getAfterSalesStatus());
|
||||
//// entity.setAfter_sales_type(item.getAfterSalesType());
|
||||
//// entity.setConfirm_time(DateUtil.strToLongGo(item.getConfirmTime()));
|
||||
//// entity.setCreated_time(DateUtil.strToLongGo(item.getCreatedTime()));
|
||||
//// entity.setDiscount_amount(Double.parseDouble(item.getDiscountAmount()));
|
||||
//// entity.setGoods_id(0);
|
||||
//// entity.setGoods_number(item.getOuterGoodsId());
|
||||
//// entity.setSkuNumber(item.getOuterId());
|
||||
//// entity.setGoods_image(item.getGoodImage());
|
||||
//// entity.setGoods_name(item.getGoodsName());
|
||||
//// entity.setGoods_price(Double.parseDouble(item.getGoodsPrice()));
|
||||
//// entity.setSkuInfo("");
|
||||
//// entity.setId(item.getId());
|
||||
//// entity.setOrder_amount(Double.parseDouble(item.getOrderAmount()));
|
||||
//// entity.setOrder_sn(item.getOrderSn());
|
||||
//// entity.setQuantity(Integer.parseInt(item.getGoodsNumber()));
|
||||
//// entity.setRefund_amount(Double.parseDouble(item.getRefundAmount()));
|
||||
//// entity.setShopId(shopId);
|
||||
//// entity.setTracking_number(item.getTrackingNumber());
|
||||
//// entity.setUpdated_time(item.getUpdatedTime());
|
||||
//// var result = orderPddService.editRefundPddOrder(entity);
|
||||
//// if (result.getCode() == EnumResultVo.DataExist.getIndex()){
|
||||
//// updCount++;//修改
|
||||
//// } else if (result.getCode() == EnumResultVo.SUCCESS.getIndex()){
|
||||
//// insertCount ++;
|
||||
//// }else{
|
||||
//// failCount++;
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
//// resp.setStartTime(DateUtil.unixTimeStampToDate(startTime));
|
||||
//// resp.setEndTime(DateUtil.unixTimeStampToDate(endTime));
|
||||
//// resp.setAddCount(insertCount);
|
||||
//// resp.setFailCount(failCount);
|
||||
//// resp.setUpdCount(updCount);
|
||||
////
|
||||
//// salesOrderService.addErpSalesPullOrderLog(startTime,endTime,shopId,insertCount,failCount,updCount,1);
|
||||
//// }
|
||||
////
|
||||
//// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "SUCCESS",resp);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 批量更新未处理的退货订单
|
||||
// * @param model
|
||||
// * @param data
|
||||
// * @param req
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// @RequestMapping(value = "/upd_refund_by_audit")
|
||||
// public ApiResult<ErpSalesPullCountResp> updRefundByAudit(Model model, @RequestBody DataRow data, HttpServletRequest req) throws Exception {
|
||||
// Integer shopId = data.getInt("shopId");
|
||||
// if (shopId == null || shopId <= 0) {
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "参数错误,缺少shopId");
|
||||
// }
|
||||
// var refundList = refundService.getList(1, 20000, null, null, null,0,shopId,3,null,null,null);
|
||||
//
|
||||
//
|
||||
// log.info("/***********开始更新拼多多退货,总共"+refundList.getTotalSize()+"条***********/");
|
||||
//
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
//// Integer shopId = 5;//拼多多shopId
|
||||
// var shop = shopService.getShop(shopId);
|
||||
//
|
||||
//// ErpSalesPullCountResp resp=new ErpSalesPullCountResp();//返回结果
|
||||
//
|
||||
// var settingEntity = thirdSettingService.getEntity(shop.getType());
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
// int total=0;
|
||||
// for (var refund:refundList.getList()) {
|
||||
// total++;
|
||||
// PddRefundInformationGetRequest request = new PddRefundInformationGetRequest();
|
||||
// request.setAfterSalesId(refund.getId());
|
||||
// request.setOrderSn(refund.getOrder_sn());
|
||||
// PddRefundInformationGetResponse response = client.syncInvoke(request,shop.getSessionKey());
|
||||
//
|
||||
// if (response.getErrorResponse() != null) {
|
||||
// if (response.getErrorResponse().getErrorCode().intValue() == 10019) {
|
||||
// //token过期
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "Token过期");
|
||||
// } else {
|
||||
// return new ApiResult<>(EnumResultVo.SystemException.getIndex(), "接口调用失败:" + response.getErrorResponse().getErrorMsg());
|
||||
// }
|
||||
// }else {
|
||||
// log.info("更新退货订单"+refund.getId()+",订单号"+refund.getOrder_sn()+"状态"+response.getAfterSalesStatus());
|
||||
// //获取到了数据
|
||||
// RefundPddEntity entity = new RefundPddEntity();
|
||||
// entity.setAfter_sale_reason(response.getAfterSalesReason());
|
||||
// entity.setAfter_sales_status(response.getAfterSalesStatus());
|
||||
// entity.setAfter_sales_type(response.getAfterSalesType());
|
||||
// entity.setId(response.getId());
|
||||
// entity.setRefund_amount(Double.parseDouble((response.getRefundAmount() / 100)+""));
|
||||
// entity.setShippingStatus(response.getShippingStatus());
|
||||
// entity.setTracking_number(response.getExpressNo());
|
||||
// entity.setTracking_company(response.getShippingName());
|
||||
// entity.setDescribe(response.getRemark());
|
||||
//
|
||||
// var result = orderPddService.updRefundPddOrder(entity);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// log.info("更新退货订单完成,总共更新"+total);
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "更新退货订单完成,总共更新"+total);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 确认到仓库
|
||||
// *
|
||||
// * @param req
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value = "/confirm_refund", method = RequestMethod.POST)
|
||||
// public ApiResult<String> reviewRefund(@RequestBody DataRow data, HttpServletRequest req) throws Exception {
|
||||
// Long refId = data.getLong("id");
|
||||
// if(refId == null || refId<=0){
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "参数错误,缺少id");
|
||||
// }
|
||||
//// if (StringUtils.isEmpty(data.getString("companyCode")))
|
||||
//// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请选择快递公司");
|
||||
//// if (StringUtils.isEmpty(data.getString("code")))
|
||||
//// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请输入快递单号");
|
||||
//
|
||||
// var detail = refundService.getEntityById(refId);
|
||||
// if(detail == null) return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "退货不存在");
|
||||
// if(detail.getAfter_sales_type().intValue()!=3 && detail.getAuditStatus().intValue()!=0) return new ApiResult<>(EnumResultVo.SystemException.getIndex(), "已经处理过了");
|
||||
// if(StringUtils.isEmpty(detail.getTracking_number())) return new ApiResult<>(EnumResultVo.SystemException.getIndex(), "还没有物流信息,请更新退货订单");
|
||||
//
|
||||
// var result = refundService.confirmRefund(refId);
|
||||
///* if(result.getMsg().equals("订单不存在")){
|
||||
// DataRow reqData=new DataRow();
|
||||
// reqData.set("shopId",detail.getShopId());
|
||||
// reqData.set("orderSn",detail.getOrder_sn());
|
||||
// var results = upd_pdd_order_by_num_(reqData);
|
||||
// return new ApiResult<>(results.getCode(),results.getMsg().equals("更新成功") ? "订单拉取成功,请重新确认" : "订单拉取失败原因:"+results.getMsg());
|
||||
// }*/
|
||||
// return new ApiResult<>(result.getCode(), result.getMsg());
|
||||
//// return new ApiResult<>(EnumResultVo.SystemException.getIndex(), "未实现");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 订单拦截
|
||||
// * @param data
|
||||
// * @param req
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value = "/order_intercept", method = RequestMethod.POST)
|
||||
// public ApiResult<String> orderIntercept(@RequestBody DataRow data, HttpServletRequest req) throws Exception {
|
||||
// String orderSn = data.getString("orderSn");
|
||||
// if(StringUtils.isEmpty(orderSn)){
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "参数错误,缺少orderSn");
|
||||
// }
|
||||
// Integer shopId = data.getInt("shopId");
|
||||
// if(shopId == null || shopId<=0){
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "参数错误,缺少shopId");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// RefundPddEntity refund = refundService.getEntityByOrderSn(orderSn);
|
||||
// if(refund==null){
|
||||
// //本地库没有退货单,去拼多多接口拉取
|
||||
// log.info("/***********开始拉取拼多多退货,"+orderSn+"***********/");
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
// var shop = shopService.getShop(shopId);
|
||||
// var settingEntity = thirdSettingService.getEntity(shop.getType());
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
//
|
||||
//// PddRefundInformationGetRequest request = new PddRefundInformationGetRequest();
|
||||
//// request.setOrderSn(orderSn);
|
||||
//// PddRefundInformationGetResponse response = client.syncInvoke(request, settingEntity.getAccess_token());
|
||||
// PddRefundListIncrementGetRequest request = new PddRefundListIncrementGetRequest();
|
||||
// request.setAfterSalesStatus(1);
|
||||
// request.setAfterSalesType(1);
|
||||
// request.setStartUpdatedAt(1586239200L);//1586239200L
|
||||
// request.setEndUpdatedAt(1586241000L);//1586241000L
|
||||
// request.setPage(1);
|
||||
// request.setPageSize(100);
|
||||
// request.setOrderSn(orderSn);
|
||||
//
|
||||
// PddRefundListIncrementGetResponse response = client.syncInvoke(request,shop.getSessionKey());
|
||||
//
|
||||
// if (response.getErrorResponse() != null) {
|
||||
// if (response.getErrorResponse().getErrorCode().intValue() == 10019) {
|
||||
// //token过期
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "Token过期");
|
||||
// }
|
||||
// else {
|
||||
// return new ApiResult<>(EnumResultVo.SystemException.getIndex(), "接口调用失败:" + response.getErrorResponse().getErrorMsg());
|
||||
// }
|
||||
// }else {
|
||||
// log.info("从拼多多拉取到退货订单,开始处理退货订单");
|
||||
// if(response.getRefundIncrementGetResponse().getTotalCount() > 0) {
|
||||
// for (var item : response.getRefundIncrementGetResponse().getRefundList()) {
|
||||
// RefundPddEntity entity = new RefundPddEntity();
|
||||
// entity.setAfter_sale_reason(item.getAfterSaleReason());
|
||||
// entity.setAfter_sales_status(item.getAfterSalesStatus());
|
||||
// entity.setAfter_sales_type(item.getAfterSalesType());
|
||||
// entity.setConfirm_time(DateUtil.strToLongGo(item.getConfirmTime()));
|
||||
// entity.setCreated_time(DateUtil.strToLongGo(item.getCreatedTime()));
|
||||
// entity.setDiscount_amount(Double.parseDouble(item.getDiscountAmount()));
|
||||
// entity.setGoods_id(0);
|
||||
// entity.setGoods_number(item.getOuterGoodsId());
|
||||
// entity.setSkuNumber(item.getOuterId());
|
||||
// entity.setGoods_image(item.getGoodImage());
|
||||
// entity.setGoods_name(item.getGoodsName());
|
||||
// entity.setGoods_price(Double.parseDouble(item.getGoodsPrice()));
|
||||
// entity.setSkuInfo("");
|
||||
// entity.setId(item.getId());
|
||||
// entity.setOrder_amount(Double.parseDouble(item.getOrderAmount()));
|
||||
// entity.setOrder_sn(item.getOrderSn());
|
||||
// entity.setQuantity(Integer.parseInt(item.getGoodsNumber()));
|
||||
// entity.setRefund_amount(Double.parseDouble(item.getRefundAmount()));
|
||||
// entity.setShopId(shopId);
|
||||
// entity.setTracking_number(item.getTrackingNumber());
|
||||
// entity.setUpdated_time(item.getUpdatedTime());
|
||||
//
|
||||
// refund = new RefundPddEntity();
|
||||
// refund.setId(entity.getId());
|
||||
// orderPddService.editRefundPddOrder(entity);
|
||||
// }
|
||||
// }else{
|
||||
// var order = orderPddService.getOrder(orderSn);
|
||||
// var goods = order.getItems().get(0);
|
||||
// Long refundId = refundService.getRefundIdMin() - 1;
|
||||
// RefundPddEntity entity = new RefundPddEntity();
|
||||
// entity.setAfter_sale_reason("订单拦截");
|
||||
// entity.setAfter_sales_status(3);
|
||||
// entity.setAfter_sales_type(9);
|
||||
// entity.setConfirm_time(0l);
|
||||
// entity.setCreated_time(System.currentTimeMillis() / 1000);
|
||||
// entity.setDiscount_amount(0.0);
|
||||
// entity.setGoods_id(0);
|
||||
// entity.setGoods_number(goods.getGoodsNum());
|
||||
// entity.setSkuNumber(goods.getGoodsSpecNum());
|
||||
// entity.setGoods_image(goods.getGoodsImg());
|
||||
// entity.setGoods_name(goods.getGoodsName());
|
||||
// entity.setGoods_price(goods.getGoodsPrice());
|
||||
// entity.setSkuInfo(goods.getGoodsSpec());
|
||||
// entity.setId(refundId);
|
||||
// entity.setOrder_amount(order.getPay_amount());
|
||||
// entity.setOrder_sn(orderSn);
|
||||
// entity.setQuantity(goods.getQuantity());
|
||||
// entity.setRefund_amount(order.getPay_amount());
|
||||
// entity.setShopId(shopId);
|
||||
// entity.setTracking_number(order.getTracking_number());
|
||||
// entity.setUpdated_time("");
|
||||
// refund = new RefundPddEntity();
|
||||
// refund.setId(entity.getId());
|
||||
// orderPddService.editRefundPddOrder(entity);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //更新快递信息到退货数据中
|
||||
// var result = orderPddService.interceptOrder(orderSn,refund.getId());
|
||||
// log.info("拦截订单,结果:"+ JSON.toJSONString(result));
|
||||
// if(result.getCode() == EnumResultVo.SUCCESS.getIndex()){
|
||||
// //拦截成功,开始推送到仓库
|
||||
// var result1 = refundService.confirmRefund(result.getData());
|
||||
// log.info("拦截成功,推送到仓库。推送结果:"+ JSON.toJSONString(result1));
|
||||
// return new ApiResult<>(result1.getCode(), result1.getMsg());
|
||||
// }
|
||||
//
|
||||
// return new ApiResult<>(ApiResultEnum.SystemException, "系统异常");
|
||||
// }
|
||||
// /**
|
||||
// * 标记已处理
|
||||
// *
|
||||
// * @param req
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value = "/sign_refund", method = RequestMethod.POST)
|
||||
// public ApiResult<String> signRefund(@RequestBody DataRow data, HttpServletRequest req) {
|
||||
// Long refId = data.getLong("id");
|
||||
// if(refId == null || refId<=0){
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "参数错误,缺少id");
|
||||
// }
|
||||
//
|
||||
//// if (StringUtils.isEmpty(data.getString("companyCode")))
|
||||
//// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请选择快递公司");
|
||||
//// if (StringUtils.isEmpty(data.getString("code")))
|
||||
//// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请输入快递单号");
|
||||
//
|
||||
//// var detail = refundService.getEntityById(refId);
|
||||
//// if(detail == null) return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "退货不存在");
|
||||
//// if(detail.getAfter_sales_type().intValue()!=3 && detail.getAuditStatus().intValue()!=0) return new ApiResult<>(EnumResultVo.SystemException.getIndex(), "已经处理过了");
|
||||
//// if(StringUtils.isEmpty(detail.getTracking_number())) return new ApiResult<>(EnumResultVo.SystemException.getIndex(), "还没有物流信息,请更新退货订单");
|
||||
//
|
||||
//// var result = refundService.confirmRefund(refId);
|
||||
//// return new ApiResult<>(result.getCode(), result.getAuditStatustMsg());
|
||||
// refundService.signRefund(refId);
|
||||
// return new ApiResult<>(ApiResultEnum.SUCCESS, "SUCCESS");
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value = "/refund_apply_pdd_submit", method = RequestMethod.POST)
|
||||
// public ApiResult<Integer> addOrderCancel(HttpServletRequest request) {
|
||||
///* String logisticsCompany="";
|
||||
// if(!StringUtils.isEmpty(request.getParameter("logisticsCompany"))){
|
||||
// logisticsCompany=request.getParameter("logisticsCompany");
|
||||
// }
|
||||
// String logisticsCode="";
|
||||
// if(!StringUtils.isEmpty(request.getParameter("logisticsCode"))){
|
||||
// logisticsCode=request.getParameter("logisticsCode");
|
||||
// }
|
||||
// Long orderId = Long.parseLong(request.getParameter("order_id"));
|
||||
// ErpSalesOrderRefundReq applyVo=new ErpSalesOrderRefundReq();
|
||||
// applyVo.setOrderId(orderId);
|
||||
// applyVo.setLogisticsCompany(logisticsCompany);
|
||||
// applyVo.setLogisticsCode(logisticsCode);
|
||||
// List<ErpSalesOrderItemEntity> itemVoList = new ArrayList<>();
|
||||
//
|
||||
// String[] idDataArr = request.getParameterValues("item[]");
|
||||
// String[] nums = request.getParameterValues("count[]");
|
||||
// //循环查找选中的item
|
||||
// for (int i = 0; i < idDataArr.length; i++) {
|
||||
// String[] idData = idDataArr[i].split(":");
|
||||
// ErpSalesOrderItemEntity itemVo = new ErpSalesOrderItemEntity();
|
||||
// itemVo.setId(Long.parseLong(idData[1]));
|
||||
// itemVo.setRefundCount(Integer.parseInt(nums[Integer.parseInt(idData[0])]));
|
||||
// itemVoList.add(itemVo);
|
||||
// }
|
||||
// applyVo.setItems(itemVoList);
|
||||
//
|
||||
// var result= refundService.addPddOrderRefund(applyVo);
|
||||
// return new ApiResult<>(result.getCode(), result.getMsg());*/
|
||||
//
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "功能暂时禁用");
|
||||
//
|
||||
// }
|
||||
// @RequestMapping(value = "/upd_pdd_order_by_num", method = RequestMethod.POST)
|
||||
// public ApiResult<String> upd_pdd_order_by_num(@RequestBody DataRow data, HttpServletRequest req) throws Exception{
|
||||
// if(StringUtils.isEmpty(data.get("orderSn")))return new ApiResult<>(ApiResultEnum.ParamsError,"订单号不能为空");
|
||||
// var result = upd_pdd_order_by_num_(data);
|
||||
// return new ApiResult<>(result.getCode(), result.getMsg());
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public ApiResult<String> upd_pdd_order_by_num_(DataRow data) throws Exception{
|
||||
// var shop = shopService.getShop(data.getInt("shopId"));
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
// PddOrderInformationGetRequest pddOrderRequest=new PddOrderInformationGetRequest();
|
||||
// pddOrderRequest.setOrderSn(data.getString("orderSn").trim());
|
||||
// PddOrderInformationGetResponse pddOrderResponse = client.syncInvoke(pddOrderRequest,shop.getSessionKey());
|
||||
// if(!StringUtils.isEmpty(pddOrderResponse.getErrorResponse())){
|
||||
// return new ApiResult<>(ApiResultEnum.Fail, pddOrderResponse.getErrorResponse().getErrorMsg());
|
||||
// }
|
||||
// var item = pddOrderResponse.getOrderInfoGetResponse().getOrderInfo();
|
||||
// String company=StringUtils.isEmpty(item.getLogisticsId()) ? "" : EnumPddLogistics.getName(item.getLogisticsId().intValue());
|
||||
// OrderPddEntity pddEntity = new OrderPddEntity();
|
||||
// pddEntity.setOrder_status(item.getOrderStatus());
|
||||
// pddEntity.setOrderSn(item.getOrderSn().trim());
|
||||
// pddEntity.setShipping_time(item.getShippingTime());
|
||||
// pddEntity.setTracking_company(company);
|
||||
// pddEntity.setTracking_number(item.getTrackingNumber());
|
||||
// pddEntity.setProvince(item.getProvince());
|
||||
// pddEntity.setCity(item.getCity());
|
||||
// pddEntity.setTown(item.getTown());
|
||||
// pddEntity.setShopId(shop.getId());
|
||||
//
|
||||
// pddEntity.setAddress(item.getAddress());
|
||||
// pddEntity.setAfter_sales_status(item.getAfterSalesStatus());
|
||||
// pddEntity.setBuyer_memo(item.getBuyerMemo());
|
||||
// pddEntity.setCapital_free_discount(item.getCapitalFreeDiscount());
|
||||
// pddEntity.setConfirm_status(item.getConfirmStatus());
|
||||
// pddEntity.setConfirm_time(item.getConfirmTime());
|
||||
// pddEntity.setCountry(item.getCountry());
|
||||
// pddEntity.setCreated_time(item.getCreatedTime());
|
||||
// pddEntity.setDiscount_amount(item.getDiscountAmount());
|
||||
// pddEntity.setFree_sf(item.getFreeSf());
|
||||
// pddEntity.setGoods_amount(item.getGoodsAmount());
|
||||
// pddEntity.setGroup_status(item.getGroupStatus());
|
||||
// pddEntity.setIs_lucky_flag(item.getIsLuckyFlag());
|
||||
// pddEntity.setPay_amount(item.getPayAmount());
|
||||
// pddEntity.setPay_no(item.getPayNo());
|
||||
// pddEntity.setPay_time(item.getPayTime());
|
||||
// pddEntity.setPay_type(item.getPayType());
|
||||
// pddEntity.setPlatform_discount(item.getPlatformDiscount());
|
||||
// pddEntity.setPostage(item.getPostage());
|
||||
// pddEntity.setReceive_time(item.getReceiveTime());
|
||||
// pddEntity.setReceiver_name(item.getReceiverName());
|
||||
// pddEntity.setReceiver_phone(item.getReceiverPhone());
|
||||
// pddEntity.setRefund_status(item.getRefundStatus());
|
||||
// pddEntity.setRemark(item.getRemark());
|
||||
// pddEntity.setSeller_discount(item.getSellerDiscount());
|
||||
// pddEntity.setTradeType(item.getTradeType());
|
||||
// pddEntity.setUpdated_at(item.getUpdatedAt());
|
||||
// pddEntity.setOrderConfirmTime(DateUtil.strToLongGo(item.getConfirmTime()));
|
||||
// pddEntity.setExcelLogId(0);
|
||||
//
|
||||
//
|
||||
// List<OrderPddItemEntity> items = new ArrayList<>();
|
||||
// for (var it: item.getItemList()) {
|
||||
// OrderPddItemEntity pddItem = new OrderPddItemEntity();
|
||||
// pddItem.setGoodsImg(it.getGoodsImg());
|
||||
// pddItem.setGoodsName(it.getGoodsName());
|
||||
// pddItem.setGoodsNum(it.getOuterGoodsId());
|
||||
// pddItem.setGoodsPrice(it.getGoodsPrice());
|
||||
// pddItem.setGoodsSpec(it.getGoodsSpec());
|
||||
// pddItem.setGoodsSpecNum(it.getOuterId());
|
||||
// pddItem.setQuantity(it.getGoodsCount());
|
||||
// items.add(pddItem);
|
||||
// }
|
||||
// pddEntity.setItems(items);
|
||||
// //开始写入数据库
|
||||
// orderPddService.insertOrder(pddEntity,data.getInt("shopId"));
|
||||
//
|
||||
// PddRefundListIncrementGetRequest request = new PddRefundListIncrementGetRequest();
|
||||
// request.setAfterSalesStatus(1);
|
||||
// request.setAfterSalesType(1);
|
||||
// request.setStartUpdatedAt(1586239200L);//
|
||||
// request.setEndUpdatedAt(1586241000L);//
|
||||
// request.setPage(1);
|
||||
// request.setPageSize(100);
|
||||
// request.setOrderSn(data.getString("orderSn"));
|
||||
//
|
||||
// PddRefundListIncrementGetResponse response = client.syncInvoke(request, shop.getSessionKey());
|
||||
//
|
||||
// if(!StringUtils.isEmpty(response.getErrorResponse())){
|
||||
// return new ApiResult<>(ApiResultEnum.Fail, response.getErrorResponse().getErrorMsg());
|
||||
// }
|
||||
// //开始处理订单数据
|
||||
// var ritem = response.getRefundIncrementGetResponse().getRefundList().get(0);
|
||||
// RefundPddEntity entity = new RefundPddEntity();
|
||||
// entity.setAfter_sale_reason(ritem.getAfterSaleReason());
|
||||
// entity.setAfter_sales_status(ritem.getAfterSalesStatus());
|
||||
// entity.setAfter_sales_type(ritem.getAfterSalesType());
|
||||
// entity.setConfirm_time(DateUtil.strToLongGo(ritem.getConfirmTime()));
|
||||
// entity.setCreated_time(DateUtil.strToLongGo(ritem.getCreatedTime()));
|
||||
// entity.setDiscount_amount(Double.parseDouble(ritem.getDiscountAmount()));
|
||||
// entity.setGoods_id(0);
|
||||
// entity.setGoods_number(ritem.getOuterGoodsId());
|
||||
// entity.setSkuNumber(ritem.getOuterId());
|
||||
// entity.setGoods_image(ritem.getGoodImage());
|
||||
// entity.setGoods_name(ritem.getGoodsName());
|
||||
// entity.setGoods_price(Double.parseDouble(ritem.getGoodsPrice()));
|
||||
// entity.setSkuInfo("");
|
||||
// entity.setId(ritem.getId());
|
||||
// entity.setOrder_amount(Double.parseDouble(ritem.getOrderAmount()));
|
||||
// entity.setOrder_sn(ritem.getOrderSn());
|
||||
// entity.setQuantity(Integer.parseInt(ritem.getGoodsNumber()));
|
||||
// entity.setRefund_amount(Double.parseDouble(ritem.getRefundAmount()));
|
||||
// entity.setShopId(shop.getId());
|
||||
// entity.setTracking_number(ritem.getTrackingNumber());
|
||||
// entity.setUpdated_time(ritem.getUpdatedTime());
|
||||
// entity.setAuditStatus(0);
|
||||
// var result = orderPddService.editRefundPddOrder(entity);
|
||||
// return new ApiResult<>(result.getCode(), result.getMsg());
|
||||
// }
|
||||
//}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
package com.qihang.pdd.controller;
|
||||
|
||||
/**
|
||||
* 更新erp销售订单数据统计
|
||||
*/
|
||||
public class ErpSalesPullCountResp {
|
||||
private int addCount;//新增
|
||||
private int failCount;//失败
|
||||
private int updCount;//更新
|
||||
private Integer totalRecords;//总记录数
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public int getAddCount() {
|
||||
return addCount;
|
||||
}
|
||||
|
||||
public void setAddCount(int addCount) {
|
||||
this.addCount = addCount;
|
||||
}
|
||||
|
||||
public int getFailCount() {
|
||||
return failCount;
|
||||
}
|
||||
|
||||
public void setFailCount(int failCount) {
|
||||
this.failCount = failCount;
|
||||
}
|
||||
|
||||
public int getUpdCount() {
|
||||
return updCount;
|
||||
}
|
||||
|
||||
public void setUpdCount(int updCount) {
|
||||
this.updCount = updCount;
|
||||
}
|
||||
|
||||
public Integer getTotalRecords() {
|
||||
return totalRecords;
|
||||
}
|
||||
|
||||
public void setTotalRecords(Integer totalRecords) {
|
||||
this.totalRecords = totalRecords;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
package com.qihang.pdd.controller;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
public class HomeController {
|
||||
@GetMapping("/")
|
||||
public String home(){
|
||||
|
||||
return "{'code':0,'msg':'pdd-api请通过api访问'}";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
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";
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
package com.qihang.pdd.controller;
|
||||
|
||||
public class OpenApiRequest {
|
||||
private Integer shopId;//店铺Id
|
||||
private Long orderId;//订单id
|
||||
private Integer updType;//更新类型0拉取新订单1更新订单
|
||||
private String startDate;
|
||||
private String endDate;
|
||||
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(String startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public String getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(String endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public Integer getUpdType() {
|
||||
return updType;
|
||||
}
|
||||
|
||||
public void setUpdType(Integer updType) {
|
||||
this.updType = updType;
|
||||
}
|
||||
|
||||
public Long getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(Long orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,354 +0,0 @@
|
|||
package com.qihang.pdd.controller;//package com.qihang.erp.api.controller.pdd;
|
||||
//
|
||||
//
|
||||
//import com.b2c.common.api.ApiResult;
|
||||
//import com.b2c.common.api.ApiResultEnum;
|
||||
//import com.b2c.common.utils.DateUtil;
|
||||
//import com.b2c.entity.datacenter.DcTmallOrderEntity;
|
||||
//import com.b2c.entity.pdd.OrderPddEntity;
|
||||
//import com.b2c.entity.pdd.OrderPddItemEntity;
|
||||
//import com.b2c.entity.result.ResultVo;
|
||||
//import com.b2c.oms.DataConfigObject;
|
||||
//import com.b2c.oms.request.OrderConfirmReq;
|
||||
//import com.b2c.repository.utils.OrderNumberUtils;
|
||||
//import com.b2c.service.ShopService;
|
||||
//import com.b2c.service.erp.ErpGoodsService;
|
||||
//import com.b2c.service.oms.OrderPddService;
|
||||
//import com.b2c.service.oms.SysThirdSettingService;
|
||||
//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.util.StringUtils;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import java.math.BigDecimal;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * 描述:
|
||||
// *
|
||||
// * @author qlp
|
||||
// * @date 2019-11-13 14:44
|
||||
// */
|
||||
//@RequestMapping("/pdd")
|
||||
//@Controller
|
||||
//public class OrderPddController {
|
||||
// @Autowired
|
||||
// private ShopService shopService;
|
||||
// @Autowired
|
||||
// private OrderPddService orderPddService;
|
||||
// @Autowired
|
||||
// private ErpGoodsService erpGoodsService;
|
||||
// @Autowired
|
||||
// private SysThirdSettingService thirdSettingService;
|
||||
// private static Logger log = LoggerFactory.getLogger(OrderPddController.class);
|
||||
// /**
|
||||
// * 订单列表
|
||||
// * @param model
|
||||
// * @param shopId
|
||||
// * @param request
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping("/orderList")
|
||||
// public String orderList(Model model, @RequestParam Integer shopId, HttpServletRequest request){
|
||||
// //查询店铺信息
|
||||
// var shop = shopService.getShop(shopId);
|
||||
// model.addAttribute("shop",shop);
|
||||
//
|
||||
// String orderNum="";
|
||||
// if (!StringUtils.isEmpty(request.getParameter("orderNum")))
|
||||
// {orderNum = request.getParameter("orderNum"); model.addAttribute("orderNum",orderNum);}
|
||||
//
|
||||
// String goodsSpecNum="";
|
||||
// if (!StringUtils.isEmpty(request.getParameter("goodsSpecNum"))) {goodsSpecNum = request.getParameter("goodsSpecNum"); model.addAttribute("goodsSpecNum",goodsSpecNum);}
|
||||
// String trackingNumber="";
|
||||
// if (!StringUtils.isEmpty(request.getParameter("trackingNumber"))) {trackingNumber = request.getParameter("trackingNumber"); model.addAttribute("trackingNumber",trackingNumber);}
|
||||
//
|
||||
//
|
||||
// Integer status = null;
|
||||
// if (!StringUtils.isEmpty(request.getParameter("status"))) {
|
||||
// try {
|
||||
// status = Integer.parseInt(request.getParameter("status"));
|
||||
// model.addAttribute("status",status);
|
||||
// }catch (Exception e){}
|
||||
// }
|
||||
// Integer refundStatus = null;
|
||||
// if (!StringUtils.isEmpty(request.getParameter("refundStatus"))) {
|
||||
// try {
|
||||
// refundStatus = Integer.parseInt(request.getParameter("refundStatus"));
|
||||
// model.addAttribute("refundStatus",refundStatus);
|
||||
// }catch (Exception e){}
|
||||
// }
|
||||
// if(status!=null && status.intValue() == 1){
|
||||
// if(refundStatus == null){
|
||||
// refundStatus = 1;
|
||||
// model.addAttribute("refundStatus",refundStatus);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Integer orderBy = 2;
|
||||
// if (!StringUtils.isEmpty(request.getParameter("orderBy"))) {
|
||||
// try {
|
||||
// orderBy = Integer.parseInt(request.getParameter("orderBy"));
|
||||
//
|
||||
// }catch (Exception e){}
|
||||
// }
|
||||
// model.addAttribute("orderBy",orderBy);
|
||||
// Integer startTime = null;
|
||||
// if (!StringUtils.isEmpty(request.getParameter("startTime"))){
|
||||
//// startTime = DateUtil.dateToStamp(request.getParameter("startTime")) ;
|
||||
// startTime = DateUtil.dateTimeToStamp(request.getParameter("startTime")) ;
|
||||
// model.addAttribute("startTime",request.getParameter("startTime"));
|
||||
// }
|
||||
//
|
||||
// Integer endTime=null;
|
||||
// if (!StringUtils.isEmpty(request.getParameter("endTime"))) {
|
||||
// endTime = DateUtil.dateTimeToStamp(request.getParameter("endTime") );//+ " 23:59:59"
|
||||
// model.addAttribute("endTime",request.getParameter("endTime"));
|
||||
// }
|
||||
//
|
||||
// Integer pageIndex = 1, pageSize = DataConfigObject.getInstance().getPageSize();
|
||||
// if (!StringUtils.isEmpty(request.getParameter("page"))) {
|
||||
// pageIndex = Integer.parseInt(request.getParameter("page"));
|
||||
// }
|
||||
//
|
||||
// //查询订单
|
||||
// var result = orderPddService.getOrderViewList(pageIndex,pageSize,orderNum,goodsSpecNum,status,refundStatus,shopId,startTime,endTime,null,orderBy,trackingNumber);
|
||||
//// var result = orderPddService.getOrderListAndItem(pageIndex, pageSize, orderNum, status, shopId, null, startTime, endTime,null);
|
||||
// model.addAttribute("pageIndex", pageIndex);
|
||||
// model.addAttribute("pageSize", pageSize);
|
||||
// model.addAttribute("totalSize", result.getTotalSize());
|
||||
// model.addAttribute("lists", result.getList());
|
||||
//
|
||||
// model.addAttribute("menuId","order_list");
|
||||
//
|
||||
//
|
||||
// return "v3/order_list_pdd";
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 订单详情
|
||||
// *
|
||||
// * @param model
|
||||
// * @param id
|
||||
// * @param shopId
|
||||
// * @param request
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value = "/orderDetail", method = RequestMethod.GET)
|
||||
// public String orderDetailTmall(Model model, @RequestParam Long id,@RequestParam Integer shopId, HttpServletRequest request) {
|
||||
//
|
||||
// OrderPddEntity orderDetail = orderPddService.getOrderDetailAndItemsById(id);
|
||||
//
|
||||
// model.addAttribute("orderVo", orderDetail);
|
||||
//
|
||||
// //查询店铺信息
|
||||
// var shop = shopService.getShop(shopId);
|
||||
// model.addAttribute("shop", shop);
|
||||
// model.addAttribute("menuId", "order_list");
|
||||
//
|
||||
// return "v3/order_detail_pdd";
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 确定订单
|
||||
// * @param model
|
||||
// * @param orderId
|
||||
// * @param request
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value = "/order_confirm", method = RequestMethod.GET)
|
||||
// public String orderConfirmGet(Model model, @RequestParam Long orderId,HttpServletRequest request) {
|
||||
// var order = orderPddService.getOrderDetailAndItemsById(orderId);
|
||||
// if (order == null) {
|
||||
// model.addAttribute("error", "没有找到订单");
|
||||
// model.addAttribute("orderVo", new DcTmallOrderEntity());
|
||||
//
|
||||
// } else {
|
||||
// model.addAttribute("orderVo", order);
|
||||
//// model.addAttribute("clientId", order.getClientUserId() != null ? order.getClientUserId() : 0);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return "v3/order_confirm_pdd";
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 订单确认(进入仓库)
|
||||
// *
|
||||
// * @param req
|
||||
// * @return
|
||||
// */
|
||||
// @ResponseBody
|
||||
// @RequestMapping(value = "/order_confirm_post", method = RequestMethod.POST)
|
||||
// public ApiResult<String> confirmOrder(@RequestBody OrderConfirmReq req, HttpServletRequest request) {
|
||||
// if (req.getOrderId() == null || req.getOrderId() <= 0)
|
||||
// return new ApiResult<>(ApiResultEnum.ParamsError.getIndex(), "参数错误,缺少orderId");
|
||||
// if (StringUtils.isEmpty(req.getReceiver()))
|
||||
// return new ApiResult<>(ApiResultEnum.ParamsError.getIndex(), "参数错误,缺少receiver");
|
||||
// if (StringUtils.isEmpty(req.getMobile()))
|
||||
// return new ApiResult<>(ApiResultEnum.ParamsError.getIndex(), "参数错误,缺少mobile");
|
||||
// if (StringUtils.isEmpty(req.getAddress()))
|
||||
// return new ApiResult<>(ApiResultEnum.ParamsError.getIndex(), "参数错误,缺少address");
|
||||
//
|
||||
// var order = orderPddService.getOrderDetailAndItemsById(req.getOrderId());
|
||||
//
|
||||
//// Integer shopId = order.getShopId();//拼多多shopId
|
||||
//// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
//// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
//// var shop = shopService.getShop(shopId);
|
||||
//// var settingEntity = thirdSettingService.getEntity(shop.getType());
|
||||
//// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
//// PddOrderInformationGetRequest pddOrderRequest=new PddOrderInformationGetRequest();
|
||||
//// pddOrderRequest.setOrderSn(order.getOrderSn());
|
||||
//// Integer pddOrderStatus=1;
|
||||
//// try {
|
||||
//// PddOrderInformationGetResponse pddOrderResponse = client.syncInvoke(pddOrderRequest, settingEntity.getAccess_token());
|
||||
//// if(!StringUtils.isEmpty(pddOrderResponse.getErrorResponse())){
|
||||
//// return new ApiResult<>(ApiResultEnum.ParamsError.getIndex(),pddOrderResponse.getErrorResponse().getErrorMsg());
|
||||
//// }
|
||||
//// pddOrderStatus = pddOrderResponse.getOrderInfoGetResponse().getOrderInfo().getOrderStatus();
|
||||
//// }catch (Exception e){
|
||||
//// return new ApiResult<>(ApiResultEnum.ParamsError.getIndex(), "拼多多接口查询订单状态异常");
|
||||
//// }
|
||||
// log.info("/**********************订单状态判断" + order.getOrder_status() + "**********************/");
|
||||
// if (order == null)
|
||||
// return new ApiResult<>(404, "订单不存在");//检查是否已经确认
|
||||
// else if (order.getAuditStatus().intValue() > 0)
|
||||
// return new ApiResult<>(501, "订单已经确认过了");
|
||||
//// else if (pddOrderStatus != EnumPddOrderStatus.WaitSend.getIndex())
|
||||
//// return new ApiResult<>(402, "订单不是发货中的状态,不能操作");
|
||||
// else if(order.getAfter_sales_status() != 0){
|
||||
// return new ApiResult<>(409, "订单已退款,不能操作");
|
||||
// }
|
||||
// log.info("/**********************开始确认订单" + req.getOrderId() + "**********************/");
|
||||
// synchronized (this) {
|
||||
// //确认订单,加入到仓库系统待发货订单列表
|
||||
// ResultVo<Integer> result = orderPddService.orderConfirmAndJoinDeliveryQueueForPdd(req.getOrderId(), req.getReceiver(), req.getMobile(), req.getAddress(), req.getSellerMemo());
|
||||
//
|
||||
// log.info("/**********************确认订单完成" + result + "**********************/");
|
||||
// return new ApiResult<>(result.getCode(), result.getMsg());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 创建订单
|
||||
// * @param model
|
||||
// * @param shopId
|
||||
// * @param request
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping("/order_create")
|
||||
// public String orderCreate(Model model,@RequestParam Integer shopId, HttpServletRequest request){
|
||||
// model.addAttribute("orderNumber",OrderNumberUtils.getOrderIdByTime());
|
||||
// model.addAttribute("menuId", "order_create");
|
||||
// return "v3/order_create_pdd";
|
||||
// }
|
||||
// /**
|
||||
// * pdd创建订单
|
||||
// * @param model
|
||||
// * @param request
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value = "/order_create", method = RequestMethod.POST)
|
||||
// public String postSystemOrder(Model model, HttpServletRequest request) {
|
||||
// model.addAttribute("menuId", "order_create");
|
||||
// /***商品信息****/
|
||||
// String[] specNumber = request.getParameterValues("specNumber");//规格编码组合
|
||||
// String[] goodsNumber = request.getParameterValues("goodsNumber");//商品编码组合
|
||||
// String[] goodsId = request.getParameterValues("goodsId");//商品id组合
|
||||
// String[] specsId = request.getParameterValues("specId");//商品规格id组合
|
||||
// String[] quantitys = request.getParameterValues("quantity");//数量组合
|
||||
// String[] prices = request.getParameterValues("note");//商品价格
|
||||
//
|
||||
// String orderNumber = request.getParameter("orderNumber");
|
||||
// //收件人信息
|
||||
// String contactMobile = request.getParameter("contactMobile");
|
||||
// String contactPerson = request.getParameter("contactPerson");
|
||||
// String area = request.getParameter("area");
|
||||
// String address = request.getParameter("address");
|
||||
// Integer saleType = Integer.parseInt(request.getParameter("saleType"));
|
||||
// String shippingFee= StringUtils.isEmpty(request.getParameter("shippingFee")) ? "0" :request.getParameter("shippingFee");
|
||||
// String sellerMemo = request.getParameter("sellerMemo");
|
||||
//
|
||||
// String[] areaNameArray = area.split(" ");
|
||||
//
|
||||
// String provinceName = "";
|
||||
// if (areaNameArray.length > 0) provinceName = areaNameArray[0];
|
||||
// String cityName = "";
|
||||
// if (areaNameArray.length > 1) cityName = areaNameArray[1];
|
||||
// String districtName = "";
|
||||
// if (areaNameArray.length > 2) districtName = areaNameArray[2];
|
||||
//
|
||||
// OrderPddEntity pddEntity = new OrderPddEntity();
|
||||
//
|
||||
// List<OrderPddItemEntity> items = new ArrayList<>();
|
||||
// double goodsTotalAmount = 0;//商品总价
|
||||
// for (int i = 0,n=goodsId.length;i<n;i++) {
|
||||
// if(StringUtils.isEmpty(goodsId[i]))continue;
|
||||
// OrderPddItemEntity pddItem = new OrderPddItemEntity();
|
||||
// Integer specId=Integer.parseInt(specsId[i]);
|
||||
// BigDecimal price = new BigDecimal(prices[i]);
|
||||
// Integer count =Integer.parseInt(quantitys[i]);
|
||||
// var spec = erpGoodsService.getSpecBySpecId(specId);
|
||||
//
|
||||
// goodsTotalAmount += price.doubleValue() * count;
|
||||
//
|
||||
// pddItem.setErpGoodsId(spec.getGoodsId());
|
||||
// pddItem.setErpGoodsSpecId(spec.getId());
|
||||
// pddItem.setGoodsImg(spec.getColorImage());
|
||||
// pddItem.setGoodsName(spec.getGoodTitle());
|
||||
// pddItem.setGoodsNum(goodsNumber[i]);
|
||||
// pddItem.setGoodsPrice(price.doubleValue());
|
||||
// pddItem.setGoodsSpec(spec.getColorValue()+","+spec.getSizeValue());
|
||||
// pddItem.setGoodsSpecNum(specNumber[i]);
|
||||
// pddItem.setQuantity(count);
|
||||
// pddItem.setIsGift(saleType.intValue()==2 ? 1 : 0);
|
||||
// items.add(pddItem);
|
||||
// }
|
||||
// pddEntity.setItems(items);
|
||||
// double orderTotalAmount=goodsTotalAmount+Double.valueOf(shippingFee);
|
||||
// pddEntity.setAddress(new StringBuilder(provinceName).append(cityName).append(districtName).append(address).toString());
|
||||
// pddEntity.setAfter_sales_status(0);
|
||||
// pddEntity.setBuyer_memo("");
|
||||
// pddEntity.setCapital_free_discount(0d);
|
||||
// pddEntity.setCity(cityName);
|
||||
// pddEntity.setConfirm_status(1);
|
||||
// pddEntity.setConfirm_time("");
|
||||
// pddEntity.setCountry("中国");
|
||||
// pddEntity.setCreated_time(DateUtil.getCurrentDateTime());
|
||||
// pddEntity.setDiscount_amount(0d);
|
||||
// pddEntity.setFree_sf(0);
|
||||
// pddEntity.setGoods_amount(goodsTotalAmount);
|
||||
// pddEntity.setGroup_status(1);
|
||||
// pddEntity.setIs_lucky_flag(saleType);
|
||||
// pddEntity.setOrderSn(orderNumber);
|
||||
// pddEntity.setOrder_status(1);
|
||||
// pddEntity.setPay_amount(orderTotalAmount);
|
||||
// pddEntity.setPay_no("");
|
||||
// pddEntity.setPay_time("0");
|
||||
// pddEntity.setPay_type("");
|
||||
// pddEntity.setPlatform_discount(0d);
|
||||
// pddEntity.setPostage(Double.valueOf(shippingFee));
|
||||
// pddEntity.setProvince(provinceName);
|
||||
// pddEntity.setReceive_time("");
|
||||
// pddEntity.setReceiver_name(contactPerson);
|
||||
// pddEntity.setReceiver_phone(contactMobile);
|
||||
// pddEntity.setRefund_status(0);
|
||||
// pddEntity.setRemark(sellerMemo);
|
||||
// pddEntity.setSeller_discount(0d);
|
||||
// pddEntity.setShipping_time("");
|
||||
// pddEntity.setTown("");
|
||||
// pddEntity.setTracking_number("");
|
||||
// pddEntity.setTradeType(0);
|
||||
// pddEntity.setUpdated_at("");
|
||||
// pddEntity.setOrderConfirmTime(System.currentTimeMillis() / 1000);
|
||||
// orderPddService.orderCreatePdd(pddEntity);
|
||||
// return "redirect:/pdd/orderList?shopId=5";
|
||||
// }
|
||||
//}
|
||||
|
|
@ -1,416 +0,0 @@
|
|||
package com.qihang.pdd.controller;//package com.qihang.erp.api.controller.pdd;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//import com.b2c.common.utils.DateUtil;
|
||||
//import com.b2c.service.erp.ErpOrderService;
|
||||
//import com.b2c.service.oms.OrderPddService;
|
||||
//import com.pdd.pop.sdk.common.util.JsonUtil;
|
||||
//import com.pdd.pop.sdk.http.PopClient;
|
||||
//import com.pdd.pop.sdk.http.PopHttpClient;
|
||||
//import com.pdd.pop.sdk.http.api.pop.request.PddCloudprintCmdprintRenderRequest;
|
||||
//import com.pdd.pop.sdk.http.api.pop.request.PddWaybillGetRequest;
|
||||
//import com.pdd.pop.sdk.http.api.pop.request.PddWaybillSearchRequest;
|
||||
//import com.pdd.pop.sdk.http.api.pop.response.PddCloudprintCmdprintRenderResponse;
|
||||
//import com.pdd.pop.sdk.http.api.pop.response.PddWaybillGetResponse;
|
||||
//import com.pdd.pop.sdk.http.api.pop.response.PddWaybillSearchResponse;
|
||||
//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.util.StringUtils;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMethod;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * 订单打印controller
|
||||
// */
|
||||
//@RequestMapping("/fahuo")
|
||||
//@Controller
|
||||
//public class OrderPrintPddController {
|
||||
// @Autowired
|
||||
// private ErpOrderService orderService;
|
||||
// @Autowired
|
||||
// private OrderPddService pddService;
|
||||
// private static Logger log = LoggerFactory.getLogger(OrderPddController.class);
|
||||
//
|
||||
// @RequestMapping(value = "/order_pdd", method = RequestMethod.GET)
|
||||
// public String getOrderStockOutList(Model model, HttpServletRequest request) {
|
||||
// Integer pageIndex = 1;
|
||||
// Integer pageSize = 100;
|
||||
//
|
||||
// if (StringUtils.isEmpty(request.getParameter("page")) == false) {
|
||||
// try {
|
||||
// pageIndex = Integer.parseInt(request.getParameter("page"));
|
||||
// } catch (Exception e) {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Integer startTime = 0;
|
||||
// Integer endTime = 0;
|
||||
// String startTimeTemp= request.getParameter("startTime");
|
||||
// if (StringUtils.isEmpty(startTimeTemp) == false) {
|
||||
// startTime = DateUtil.dateTimeToStamp(request.getParameter("startTime"));
|
||||
// }
|
||||
// String endTimeTemp = request.getParameter("endTime");
|
||||
// if (StringUtils.isEmpty(endTimeTemp) == false) {
|
||||
// endTime = DateUtil.dateTimeToStamp(request.getParameter("endTime"));
|
||||
// }
|
||||
// String goodsSpecNum="";
|
||||
// if (!StringUtils.isEmpty(request.getParameter("goodsSpecNum"))) {goodsSpecNum = request.getParameter("goodsSpecNum"); model.addAttribute("goodsSpecNum",goodsSpecNum);}
|
||||
// String orderNum="";
|
||||
// if (!StringUtils.isEmpty(request.getParameter("orderNum")))
|
||||
// {orderNum = request.getParameter("orderNum"); model.addAttribute("orderNum",orderNum);}
|
||||
//
|
||||
// String goodsNum="";
|
||||
// if (!StringUtils.isEmpty(request.getParameter("goodsNum"))) {
|
||||
// goodsNum = request.getParameter("goodsNum");
|
||||
// }
|
||||
// Integer shopId=18;
|
||||
// if(!StringUtils.isEmpty(request.getParameter("shopId"))){
|
||||
// shopId= Integer.parseInt(request.getParameter("shopId"));
|
||||
// }
|
||||
// //快递单状态
|
||||
// //EnumErpOrderlogisticsPrintStatus printStatus = EnumErpOrderlogisticsPrintStatus.NotPrint;
|
||||
// Integer printStatus = 0;
|
||||
// if (!StringUtils.isEmpty(request.getParameter("print"))) {
|
||||
// printStatus = Integer.parseInt(request.getParameter("print"));
|
||||
// }
|
||||
// // Integer isHebing = 0;
|
||||
// model.addAttribute("printStatus", printStatus);
|
||||
// model.addAttribute("pageIndex", pageIndex);
|
||||
// model.addAttribute("pageSize", pageSize);
|
||||
// model.addAttribute("shopId",shopId);
|
||||
// model.addAttribute("isHebing",0);
|
||||
// model.addAttribute("goodsNum",goodsNum);
|
||||
//
|
||||
// //PagingResponse<OrderWaitSendListVo> result = orderService.getWaitPrintOrderList(pageIndex, pageSize, printStatus, startTime, endTime,shopId);
|
||||
// //var result = pddService.getOrderViewListPrintWdy(shopId,pageIndex,pageSize,orderNum,goodsNum,goodsSpecNum,0,startTime,endTime);
|
||||
// var result = pddService.getOrderViewList(pageIndex,pageSize,orderNum,goodsSpecNum,null,shopId,startTime,endTime,0,1,"",goodsNum);
|
||||
//
|
||||
// model.addAttribute("list", result.getList());
|
||||
// model.addAttribute("totalSize", result.getTotalSize());
|
||||
//
|
||||
// model.addAttribute("menuId","print_order_list");
|
||||
// return "fahuo/order_fahuo_pdd";
|
||||
// }
|
||||
// @RequestMapping(value = "/order_fahuo_pdd_hebing", method = RequestMethod.GET)
|
||||
// public String order_fahuo_pdd_hebing(Model model, HttpServletRequest request) {
|
||||
// Integer printStatus = 0;
|
||||
// if (!StringUtils.isEmpty(request.getParameter("print"))) {
|
||||
// printStatus = Integer.parseInt(request.getParameter("print"));
|
||||
// }
|
||||
// Integer startTime = 0;
|
||||
// Integer endTime = 0;
|
||||
// String date = request.getParameter("date");
|
||||
// if (StringUtils.isEmpty(date) == false) {
|
||||
// //时间筛选了2020-02-07 - 2020-02-14
|
||||
// String[] st = date.split(" - ");
|
||||
// if (st.length > 0) {
|
||||
// startTime = DateUtil.dateToStamp(st[0]);
|
||||
// }
|
||||
// if (st.length > 1) {
|
||||
// endTime = DateUtil.dateTimeToStamp(st[1] + " 23:59:59");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// String goodsNum="";
|
||||
// if (!StringUtils.isEmpty(request.getParameter("goodsNum"))) {
|
||||
// goodsNum = request.getParameter("goodsNum");
|
||||
// model.addAttribute("goodsNum",goodsNum);
|
||||
// }
|
||||
// Integer shopId=18;
|
||||
// if(!StringUtils.isEmpty(request.getParameter("shopId"))){
|
||||
// shopId= Integer.parseInt(request.getParameter("shopId"));
|
||||
// }
|
||||
// Integer isHebing=1;
|
||||
// model.addAttribute("printStatus", printStatus);
|
||||
// model.addAttribute("isHebing",isHebing);
|
||||
// model.addAttribute("goodsNum",goodsNum);
|
||||
// model.addAttribute("shopId",shopId);
|
||||
// var result = pddService.getPddOrderHebing(shopId,printStatus,goodsNum);
|
||||
//
|
||||
// model.addAttribute("list", result);
|
||||
// model.addAttribute("totalSize", result.size());
|
||||
//
|
||||
// model.addAttribute("menuId","print_order_list");
|
||||
// return "fahuo/order_fahuo_pdd_hebing";
|
||||
// }
|
||||
// @RequestMapping(value = "/order_fahuo_pdd_code", method = RequestMethod.GET)
|
||||
// public String order_fahuo_pdd_code(Model model, HttpServletRequest request) {
|
||||
// var result = pddService.getPddOrderCodePrint(null);
|
||||
//
|
||||
// model.addAttribute("list", result);
|
||||
// model.addAttribute("totalSize", result.size());
|
||||
// model.addAttribute("printStatus",2);
|
||||
// model.addAttribute("isHebing",0);
|
||||
//
|
||||
// return "fahuo/order_fahuo_pdd_code";
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value = "/order_fahuo_pdd_ydd", method = RequestMethod.GET)
|
||||
// public String order_fahuo_pdd_ydd(Model model, HttpServletRequest request) {
|
||||
// Integer pageIndex = 1;
|
||||
// Integer pageSize = 100;
|
||||
//
|
||||
// if (StringUtils.isEmpty(request.getParameter("page")) == false) {
|
||||
// try {
|
||||
// pageIndex = Integer.parseInt(request.getParameter("page"));
|
||||
// } catch (Exception e) {
|
||||
// }
|
||||
// }
|
||||
// String trackingNumber="";
|
||||
// Integer status=1;
|
||||
// if (!StringUtils.isEmpty(request.getParameter("trackingNumber"))) {
|
||||
// trackingNumber = request.getParameter("trackingNumber");
|
||||
// status=null;
|
||||
// }
|
||||
// String printStartTime="";
|
||||
// String printEndTime="";
|
||||
// if (!StringUtils.isEmpty(request.getParameter("printStartTime"))) {
|
||||
// printStartTime = request.getParameter("printStartTime");
|
||||
// }
|
||||
// if (!StringUtils.isEmpty(request.getParameter("printEndTime"))) {
|
||||
// printEndTime = request.getParameter("printEndTime");
|
||||
// }
|
||||
// Integer shopId=null;
|
||||
// if(!StringUtils.isEmpty(request.getParameter("shopId"))){
|
||||
// shopId=Integer.parseInt(request.getParameter("shopId"));
|
||||
// }
|
||||
//
|
||||
// model.addAttribute("shopId",shopId);
|
||||
// var result=pddService.getOrderViewListByPrint(pageIndex,pageSize,shopId,1,trackingNumber,printStartTime,printEndTime);
|
||||
// model.addAttribute("printStatus",1);
|
||||
// model.addAttribute("isHebing",0);
|
||||
// model.addAttribute("trackingNumber",trackingNumber);
|
||||
// model.addAttribute("list", result.getList());
|
||||
// model.addAttribute("totalSize", result.getTotalSize());
|
||||
// model.addAttribute("printStartTime",printStartTime);
|
||||
// model.addAttribute("printEndTime",printEndTime);
|
||||
//
|
||||
// model.addAttribute("menuId","print_order_list");
|
||||
// return "fahuo/order_fahuo_pdd_ydd";
|
||||
// }
|
||||
// @RequestMapping(value = "/test", method = RequestMethod.GET)
|
||||
// public void test() throws Exception{
|
||||
// String clientId = "dc953bcf16d24b27abf3e64a59e1ecd1";
|
||||
// String clientSecret = "de296599e194a08cbfbb2b3b340e11fec7a1bacc";
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
//
|
||||
///* PddCloudprintStdtemplatesGetRequest request2 = new PddCloudprintStdtemplatesGetRequest();
|
||||
// PddCloudprintStdtemplatesGetResponse response2 = client.syncInvoke(request2);
|
||||
// System.out.println(JsonUtil.transferToJson(response2));*/
|
||||
// PddWaybillSearchRequest request = new PddWaybillSearchRequest();
|
||||
// PddWaybillSearchResponse response = client.syncInvoke(request, "1d8739f5222942288d7d39fb4e29f1e4e279be81");
|
||||
// System.out.println(JsonUtil.transferToJson(response));
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value = "/order_print", method = RequestMethod.GET)
|
||||
// public void testPddPrint() throws Exception{
|
||||
// String clientId = "dc953bcf16d24b27abf3e64a59e1ecd1";
|
||||
// String clientSecret = "de296599e194a08cbfbb2b3b340e11fec7a1bacc";
|
||||
// String accessToken = "bbaf1f7176d04785bae3809d309cb3215da6ca2f";
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
// PddWaybillGetRequest request = new PddWaybillGetRequest();
|
||||
//
|
||||
// var order = pddService.getOrder("210617-119055350582012");
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequest paramWaybillCloudPrintApplyNewRequest = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequest();
|
||||
// paramWaybillCloudPrintApplyNewRequest.setNeedEncrypt(false);
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestSender sender = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestSender();
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestSenderAddress address = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestSenderAddress();
|
||||
// //东方店铺发货地址
|
||||
///* address.setCity("东莞市");
|
||||
// address.setDetail("聚新二路42号华衣云商科技");
|
||||
// address.setDistrict("大朗镇");
|
||||
// address.setProvince("广东省");
|
||||
// sender.setAddress(address);
|
||||
// sender.setMobile("15920623872");
|
||||
// sender.setName("胡生");
|
||||
// sender.setPhone("15920623872");*/
|
||||
// //百货店发货地址
|
||||
// address.setProvince("广东省");
|
||||
// address.setCity("东莞市");
|
||||
// address.setDistrict("大朗镇");
|
||||
// address.setDetail("聚新2路42号");
|
||||
// sender.setName("胡生");
|
||||
// sender.setPhone("15920623872");
|
||||
// paramWaybillCloudPrintApplyNewRequest.setSender(sender);
|
||||
// List<PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItem> tradeOrderInfoDtos = new ArrayList<>();
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItem item = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItem();
|
||||
// //item.setLogisticsServices("{ "SVC-COD": { "value": "200" } }");
|
||||
// item.setObjectId("str");
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemOrderInfo orderInfo = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemOrderInfo();
|
||||
// orderInfo.setOrderChannelsType("PDD");
|
||||
// List<String> tradeOrderList = new ArrayList<String>();
|
||||
// tradeOrderList.add(order.getOrderSn());
|
||||
// orderInfo.setTradeOrderList(tradeOrderList);
|
||||
// item.setOrderInfo(orderInfo);
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemPackageInfo packageInfo = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemPackageInfo();
|
||||
// packageInfo.setGoodsDescription("str");
|
||||
// packageInfo.setId("str");
|
||||
// List<PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemPackageInfoItemsItem> items = new ArrayList<>();
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemPackageInfoItemsItem item1 = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemPackageInfoItemsItem();
|
||||
// item1.setCount(1);
|
||||
// item1.setName("衣服");
|
||||
// items.add(item1);
|
||||
// packageInfo.setItems(items);
|
||||
// packageInfo.setPackagingDescription("");
|
||||
// packageInfo.setTotalPackagesCount(0);
|
||||
// packageInfo.setVolume(0L);
|
||||
// packageInfo.setWeight(0L);
|
||||
// item.setPackageInfo(packageInfo);
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemRecipient recipient = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemRecipient();
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemRecipientAddress address1 = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemRecipientAddress();
|
||||
// address1.setCountry(order.getCountry());
|
||||
// address1.setProvince(order.getProvince());
|
||||
// address1.setCity(order.getCity());
|
||||
// address1.setDistrict(order.getTown());
|
||||
// address1.setDetail(order.getAddress());
|
||||
// //address.setTown();
|
||||
// recipient.setAddress(address1);
|
||||
// recipient.setMobile(order.getReceiver_phone());
|
||||
// recipient.setName(order.getReceiver_name());
|
||||
// recipient.setPhone(order.getReceiver_phone());
|
||||
// item.setRecipient(recipient);
|
||||
// item.setTemplateUrl("https://file-link.pinduoduo.com/jtsd_one");
|
||||
// item.setUserId(0L);
|
||||
// tradeOrderInfoDtos.add(item);
|
||||
// paramWaybillCloudPrintApplyNewRequest.setTradeOrderInfoDtos(tradeOrderInfoDtos);
|
||||
// paramWaybillCloudPrintApplyNewRequest.setWpCode("JTSD");
|
||||
// request.setParamWaybillCloudPrintApplyNewRequest(paramWaybillCloudPrintApplyNewRequest);
|
||||
// try {
|
||||
// PddWaybillGetResponse response = client.syncInvoke(request, accessToken);
|
||||
// String jsonStr =JsonUtil.transferToJson(response);
|
||||
// System.out.println("res0:"+jsonStr);
|
||||
// var resObjs= JSONObject.parseObject(jsonStr).getJSONObject("pdd_waybill_get_response").getJSONArray("modules");
|
||||
//
|
||||
// PddCloudprintCmdprintRenderRequest requestP = new PddCloudprintCmdprintRenderRequest();
|
||||
//
|
||||
// PddCloudprintCmdprintRenderRequest.Request request1 = new PddCloudprintCmdprintRenderRequest.Request();
|
||||
// //目前暂未对这两个字段进行校验,服务商可以传入与服务相关的固定值。
|
||||
// request1.setClientSideId("PC_PRINT");
|
||||
// request1.setClientType("PC");
|
||||
//
|
||||
// PddCloudprintCmdprintRenderRequest.RequestConfig config = new PddCloudprintCmdprintRenderRequest.RequestConfig();
|
||||
// config.setHorizontalOffset((double) 0.0);
|
||||
// config.setNeedBottomLogo(false);
|
||||
// config.setNeedMiddleLogo(false);
|
||||
// config.setNeedTopLogo(false);
|
||||
// config.setOrientation("str");
|
||||
// config.setVerticalOffset((double) 0.0);
|
||||
// request1.setConfig(config);
|
||||
//
|
||||
// PddCloudprintCmdprintRenderRequest.RequestDocument document = new PddCloudprintCmdprintRenderRequest.RequestDocument();
|
||||
// List<PddCloudprintCmdprintRenderRequest.RequestDocumentContentsItem> contents = new ArrayList<>();
|
||||
//
|
||||
// String printStr="";
|
||||
// for(int i=0;i<resObjs.size();i++) {
|
||||
// printStr=resObjs.getJSONObject(i).get("print_data").toString();
|
||||
// }
|
||||
// PddCloudprintCmdprintRenderRequest.RequestDocumentContentsItem itemP = new PddCloudprintCmdprintRenderRequest.RequestDocumentContentsItem();
|
||||
// //item.setAddData("str");
|
||||
// itemP.setEncrypted(false);
|
||||
// itemP.setPrintData(printStr);
|
||||
// //item.setSignature("str");
|
||||
// //标准模板:https://file-link.pinduoduo.com/jtsd_std
|
||||
// //模板一:https://file-link.pinduoduo.com/jtsd_one
|
||||
// itemP.setTemplateUrl("https://file-link.pinduoduo.com/jtsd_one");
|
||||
// //item.setVer("3");
|
||||
// contents.add(itemP);
|
||||
// document.setContents(contents);
|
||||
// request1.setDocument(document);
|
||||
// request1.setPrinterName("QR-386A");
|
||||
// request1.setPrintCommandType("CPCL");
|
||||
// //request1.setCmdEncoding("gzip_byte");
|
||||
// requestP.setRequest(request1);
|
||||
//
|
||||
// PddCloudprintCmdprintRenderResponse responseP = client.syncInvoke(requestP, accessToken);
|
||||
// System.out.println(JsonUtil.transferToJson(responseP));
|
||||
//
|
||||
// }catch (Exception e){
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//// @RequestMapping(value = "/print_code", method = RequestMethod.GET)
|
||||
//// public void printCode(){
|
||||
//// String clientId = "dc953bcf16d24b27abf3e64a59e1ecd1";
|
||||
//// String clientSecret = "de296599e194a08cbfbb2b3b340e11fec7a1bacc";
|
||||
//// String accessToken = "50bb3b8f8a1a4fbdbc8da52e99b7beb31ab4a001";
|
||||
//// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
////
|
||||
//// PddCloudprintCmdprintRenderRequest request = new PddCloudprintCmdprintRenderRequest();
|
||||
////
|
||||
//// PddCloudprintCmdprintRenderRequest.Request request1 = new PddCloudprintCmdprintRenderRequest.Request();
|
||||
//// request1.setClientSideId("wx8e023a4836a52f22");
|
||||
//// request1.setClientType("weixin");
|
||||
////
|
||||
//// PddCloudprintCmdprintRenderRequest.RequestConfig config = new PddCloudprintCmdprintRenderRequest.RequestConfig();
|
||||
////
|
||||
//// config.setHorizontalOffset((double) 0.0);
|
||||
//// config.setNeedBottomLogo(false);
|
||||
//// config.setNeedMiddleLogo(false);
|
||||
//// config.setNeedTopLogo(false);
|
||||
//// config.setOrientation("normal");
|
||||
//// config.setVerticalOffset((double) 0.0);
|
||||
////
|
||||
////// config.setHorizontalOffset((double) 0.0);
|
||||
////// config.setNeedBottomLogo(false);
|
||||
////// config.setNeedMiddleLogo(false);
|
||||
////// config.setNeedTopLogo(false);
|
||||
//// config.setOrientation("normal");
|
||||
////// config.setVerticalOffset((double) 0.0);
|
||||
////
|
||||
//// request1.setConfig(config);
|
||||
////
|
||||
//// PddCloudprintCmdprintRenderRequest.RequestDocument document = new PddCloudprintCmdprintRenderRequest.RequestDocument();
|
||||
//// List<PddCloudprintCmdprintRenderRequest.RequestDocumentContentsItem> contents = new ArrayList<>();
|
||||
////
|
||||
//// String resJsonStr="{\"pdd_waybill_get_response\":{\"modules\":[{\"object_id\":\"str\",\"print_data\":\"{\\\"encryptedData\\\":\\\"a67d4819d0cd21554e9437e0bc2caa629864b0effd1aec65833023f78e93733ca9eec3468dc487b24682b9d64f176ca6bb3f602c2b383571c725bae8ff84957579b574f231f3f4bff51447906ce0566b74210e61bb9379a1ad3647cd9c5648fc1e2a627dde855be135aeadb4dffd020554bf84a05f39d50f49bf8875895fc79ec23933bbf375987929f129b6bd30521b8259c104e564a45b5d2c4d3ccd45aa9dae43e27c34c91c6be269d3028ff1f579a866bed94696a9d697851edb30ee8411975486bc993fee8c4cad2525e0e33638978c8fcb8dea75a1d05d2b586ff0174bc18a3a0680e0ae48d73444fc440fb55f7b2a0485f4d2d7396601ba9ea295d895023b4d2299cb87cca5be2a147bc62f078e716dcce4f563215d8098b6eefe7df465c05a88f80098f6175441f711f5ca193c60b61435c58c5d32fa6a39b9b8a3699c4411dca8921be94ba5fd5de113a76c34eb0bad6fcbbfcfe4eacd400a1ff63e51d603c8aaada8969165607d149c0e6bcf724924fcacc9248818a219719e2c46199ced5ada6f6b42a2c3555fddcfe2fb5309cae5dca4a0c5d389ecee8bcf66062ff3aa7c09ee6aa9ebfa86139a7a4adce21cceb4729e0a448f762f6d5b379790093943651240f93932eb106d25341df44bb4dfb2e9b5ed3c827a6c063585cf2fbd9b5886886efea7ac89fb734130da262a22b282c8a8bbddc2d79fcd35814e3fa24c3538dac9bbdb096054263f7f2541191c0b1aa5207f8be1ae1292aea443d3fabf1fb837b58758738eebe494941af774ace3ac436420fc4c15b41b97c5553c1483ecfb87c3691e80f0d30e75d4339bc7e5d9de6ccf3e65d1008ba61d6803b0e8b874ab353ccb368536cc35b4ddde1f43d509ee8146ffd6b7a4841299dba4512af7b533a44fcabce1224c91ca9785659abf2f5f4f8dd2ccc6c264f7ed25587ab5b023ae2089e748bdf34eca6948198d366e879863b41cfe558bd0ce9f6c5361c1ea29d905e5e73b42f945e573cd9b519f17629fa8134a8dd4cdfd48aac911ea2140ece7269d71e8230ab6fff4ab9f08771f849cf3eb3a34f41743fd7b4f3e5532c6fc98a38cd63f7a48750d056fd25fad54f31ce2e8c3f4a679baf83f18202280c8069fe3c5c942cc5d95412b9ca707c62c0ba3c19f88bd4c518a6bdfda6670cf84a7ab6b23d4a8bb996fc9c6d8dc65318a82e5e637eb2aa2a91e3a146f01fecb2d02f6e768c90f72296d56563e9cf1e7d6d377ffcd7817c00d9db2e5abc93e515b23218e92df1f23e774580caee71824adfcc4a7d3c36f9113954f03eb84b7acecee2eb77d38935af1ec1ff0f7a5c965616166a5d9f427b5f5d497f83dfe67acb745f1e887e9c2af61f79fa802293e18a7d6a1f4666ff4913249f708623d5b619e7824c199474395b26cc26613b74d00a653ec4d3bcb580629a1716610a5341242ffbc10b176cddd186aa336f9cbe3fbaa2e9904c52c9e92da89f36539aba33e8883dd4b2b0792b8c93ec80508fb476d96fa689c3171135a3c03ee17c5e7f20387b2948bc4b9c371c1bbe57f4efa3b75054d77e191bcb8339c61c7d4efac045455da183eed3e331ec26fcc60e768f5\\\",\\\"signature\\\":\\\"g/C/uwNK5sTXC07e9z4KGoykKqoEuAL/txQtIGKCM6UMBkY1WmTpM43T8ylaoq0nsa3pEQBoWuu1QreS7kUAXU8egugpr8PMGnVg5plrDkAa/zaOAV+8q8xv3dR/7vU/VBmCWcR3z3dmlRBXNomyW6KNmXTeH1vh3tQPtPllho4=\\\",\\\"templateUrl\\\":\\\"https://file-link.pinduoduo.com/jtsd_one\\\",\\\"ver\\\":\\\"3\\\"}\",\"waybill_code\":\"JT5049988959708\"}]}}";
|
||||
//// var resObjs= JSONObject.parseObject(resJsonStr).getJSONObject("pdd_waybill_get_response").getJSONArray("modules");
|
||||
//// String printStr="";
|
||||
//// for(int i=0;i<resObjs.size();i++) {
|
||||
//// printStr=resObjs.getJSONObject(i).get("print_data").toString();
|
||||
//// }
|
||||
//// String str_="{\\\"data\\\":{\\\"list\\\":[{\\\"fontSize\\\":16,\\\"height\\\":22,\\\"left\\\":12,\\\"text\\\":\\\"测试店铺\\\",\\\"top\\\":2,\\\"width\\\":270},{\\\"fontSize\\\":16,\\\"height\\\":22,\\\"left\\\":322,\\\"text\\\":\\\"2019-07-25 08:23:67\\\",\\\"top\\\":2,\\\"width\\\":270},{\\\"fontSize\\\":16,\\\"height\\\":22,\\\"left\\\":12,\\\"text\\\":\\\"190321-254553812462731270\\\",\\\"top\\\":24,\\\"width\\\":270},{\\\"fontSize\\\":16,\\\"height\\\":22,\\\"left\\\":332,\\\"text\\\":\\\"高级发胶\\\",\\\"top\\\":24,\\\"width\\\":270},{\\\"fontSize\\\":16,\\\"height\\\":22,\\\"left\\\":12,\\\"text\\\":\\\"231000333\\\",\\\"top\\\":46,\\\"width\\\":270},{\\\"fontSize\\\":16,\\\"height\\\":22,\\\"left\\\":180,\\\"text\\\":\\\"黑色\\\",\\\"top\\\":46,\\\"width\\\":270},{\\\"fontSize\\\":16,\\\"height\\\":22,\\\"left\\\":340,\\\"text\\\":\\\"总计:10件 8.8元\\\",\\\"top\\\":46,\\\"width\\\":270}],\\\"waterdata\\\":{\\\"left\\\":566,\\\"text\\\":\\\"1件\\\",\\\"top\\\":128}}}";
|
||||
//// System.out.println(str_);
|
||||
//// PddCloudprintCmdprintRenderRequest.RequestDocumentContentsItem item = new PddCloudprintCmdprintRenderRequest.RequestDocumentContentsItem();
|
||||
//// //item.setAddData("str");
|
||||
//// item.setEncrypted(false);
|
||||
//// item.setPrintData(str_);
|
||||
//// //item.setSignature("str");
|
||||
//// //标准模板:https://file-link.pinduoduo.com/jtsd_std
|
||||
//// //模板一:https://file-link.pinduoduo.com/jtsd_one
|
||||
//// item.setTemplateUrl("https://file-link.pinduoduo.com/jtsd_one");
|
||||
//// //item.setVer("3");
|
||||
//// contents.add(item);
|
||||
//// document.setContents(contents);
|
||||
//// request1.setDocument(document);
|
||||
//// request1.setPrinterName("FUJI XEROX DocuCentre S2110");//FUJI XEROX DocuCentre S2110
|
||||
//// request1.setPrintCommandType("CPCL");
|
||||
//// request1.setCmdEncoding("gzip_byte");
|
||||
//// request.setRequest(request1);
|
||||
//// try {
|
||||
//// PddCloudprintCmdprintRenderResponse response = client.syncInvoke(request, accessToken);
|
||||
//// System.out.println(JsonUtil.transferToJson(response));
|
||||
//// }catch (Exception e){
|
||||
////
|
||||
//// }
|
||||
////
|
||||
//// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
package com.qihang.pdd.controller;
|
||||
|
||||
|
||||
import com.pdd.pop.sdk.http.PopClient;
|
||||
import com.pdd.pop.sdk.http.PopHttpClient;
|
||||
import com.pdd.pop.sdk.http.api.pop.request.PddMallInfoGetRequest;
|
||||
import com.pdd.pop.sdk.http.api.pop.response.PddMallInfoGetResponse;
|
||||
import com.qihang.common.common.ResultVo;
|
||||
import com.qihang.common.enums.HttpStatus;
|
||||
|
||||
public class PddApiUtils {
|
||||
/**
|
||||
* 获取店铺信息(原则上所有api调用之前都需要调用一下该方法)
|
||||
* @param clientId
|
||||
* @param clientSecret
|
||||
* @param accessToken
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static ResultVo<PddMallInfoGetResponse.MallInfoGetResponse> getShopInfo(String clientId, String clientSecret, String accessToken) throws Exception {
|
||||
|
||||
PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
|
||||
PddMallInfoGetRequest request = new PddMallInfoGetRequest();
|
||||
PddMallInfoGetResponse response = client.syncInvoke(request, accessToken);
|
||||
if (response.getErrorResponse() == null) {
|
||||
// 刷新一下token
|
||||
|
||||
return ResultVo.success( response.getMallInfoGetResponse());
|
||||
} else if (response.getErrorResponse().getErrorCode().intValue() == 10019) {
|
||||
return ResultVo.error(HttpStatus.UNAUTHORIZED, "Token过期");
|
||||
}else
|
||||
return ResultVo.error(HttpStatus.ERROR, "接口调用失败:"+response.getErrorResponse().getErrorMsg());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.qihang.pdd.controller;
|
||||
|
||||
import cn.qihangerp.open.pdd.GoodsApiHelper;
|
||||
import cn.qihangerp.open.pdd.common.ApiResultVo;
|
||||
import cn.qihangerp.open.pdd.model.GoodsResultVo;
|
||||
import com.qihang.common.common.AjaxResult;
|
||||
import com.qihang.common.common.ResultVoEnum;
|
||||
import com.qihang.common.enums.HttpStatus;
|
||||
import com.qihang.pdd.domain.OmsPddGoods;
|
||||
import com.qihang.pdd.domain.OmsPddGoodsSku;
|
||||
import com.qihang.pdd.openapi.ApiCommon;
|
||||
import com.qihang.pdd.openapi.PullRequest;
|
||||
import com.qihang.pdd.service.OmsPddGoodsService;
|
||||
import com.qihang.security.common.BaseController;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.java.Log;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Log
|
||||
@RequestMapping("/goods")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class PddGoodsApiController extends BaseController {
|
||||
private final OmsPddGoodsService goodsService;
|
||||
private final ApiCommon pddApiHelper;
|
||||
|
||||
/**
|
||||
* @api {post} /api/v1/pull_goods 更新店铺商品列表
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName pullGoods
|
||||
* @apiGroup taoGood
|
||||
* @apiParam {String} startTime 开始时间
|
||||
* @apiParam {String} endTime 结束时间
|
||||
* @apiParam {Number} shopId 店铺id(东方符号:7)
|
||||
* @apiSuccessExample {json} Success-Response:
|
||||
* HTTP/1.1 200 OK{
|
||||
"code": "0成功其他失败",
|
||||
"msg": "成功或失败信息"
|
||||
}
|
||||
*/
|
||||
@RequestMapping(value = "/pull_goods", method = RequestMethod.POST)
|
||||
public AjaxResult pullGoodsList(@RequestBody PullRequest req) throws Exception {
|
||||
if (req.getShopId() == null || req.getShopId() <= 0) {
|
||||
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
|
||||
// return ApiResult.build(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
|
||||
}
|
||||
var checkResult = pddApiHelper.checkBefore(req.getShopId());
|
||||
if (checkResult.getCode() != HttpStatus.SUCCESS) {
|
||||
return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(), checkResult.getData());
|
||||
}
|
||||
String accessToken = checkResult.getData().getAccessToken();
|
||||
String url = checkResult.getData().getServerUrl();
|
||||
String appKey = checkResult.getData().getAppKey();
|
||||
String appSecret = checkResult.getData().getAppSecret();
|
||||
int insertSuccess = 0;//新增成功的订单
|
||||
int totalError = 0;
|
||||
int hasExistOrder = 0;//已存在的订单数
|
||||
ApiResultVo<GoodsResultVo> apiResultVo = GoodsApiHelper.pullGoodsList(appKey, appSecret, accessToken, 1, 20);
|
||||
if(apiResultVo.getCode() == 10019) return AjaxResult.error(HttpStatus.UNAUTHORIZED1,"Token已过期");
|
||||
if (apiResultVo.getCode() != 0) return AjaxResult.error(apiResultVo.getCode(), apiResultVo.getMsg());
|
||||
//成功
|
||||
if (apiResultVo.getData().getGoodsList() != null) {
|
||||
for (var g : apiResultVo.getData().getGoodsList()) {
|
||||
OmsPddGoods goods = new OmsPddGoods();
|
||||
BeanUtils.copyProperties(g, goods);
|
||||
// TODO:转换goods
|
||||
goods.setShopId(req.getShopId());
|
||||
goods.setCreateTime(new Date());
|
||||
List<OmsPddGoodsSku> skuList = new ArrayList<>();
|
||||
for (var s : g.getSkuList()) {
|
||||
OmsPddGoodsSku sku = new OmsPddGoodsSku();
|
||||
BeanUtils.copyProperties(s, sku);
|
||||
sku.setShopId(req.getShopId());
|
||||
sku.setGoodsId(g.getGoodsId());
|
||||
sku.setGoodsName(g.getGoodsName());
|
||||
sku.setThumbUrl(g.getThumbUrl());
|
||||
|
||||
sku.setCreateTime(new Date());
|
||||
skuList.add(sku);
|
||||
}
|
||||
goods.setSkuList(skuList);
|
||||
|
||||
int result = goodsService.saveAndUpdateGoods(req.getShopId(), goods);
|
||||
if (result == ResultVoEnum.DataExist.getIndex()) {
|
||||
//已经存在
|
||||
hasExistOrder++;
|
||||
} else if (result == ResultVoEnum.SUCCESS.getIndex()) {
|
||||
insertSuccess++;
|
||||
} else {
|
||||
totalError++;
|
||||
}
|
||||
}
|
||||
}
|
||||
String msg = "成功,总共找到:" + apiResultVo.getData().getGoodsList().size() + "条商品数据,新增:" + insertSuccess + "条,添加错误:" + totalError + "条,更新:" + hasExistOrder + "条";
|
||||
logger.info(msg);
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), msg);
|
||||
return AjaxResult.success(msg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.qihang.pdd.controller;
|
||||
|
||||
|
||||
import com.qihang.common.bo.LinkErpGoodsSkuBo;
|
||||
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.pdd.domain.OmsPddGoods;
|
||||
import com.qihang.pdd.domain.OmsPddGoodsSku;
|
||||
import com.qihang.pdd.service.OmsPddGoodsService;
|
||||
import com.qihang.pdd.service.OmsPddGoodsSkuService;
|
||||
import com.qihang.security.common.BaseController;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RequestMapping("/goods")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class PddGoodsController extends BaseController {
|
||||
private final OmsPddGoodsService goodsService;
|
||||
private final OmsPddGoodsSkuService skuService;
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public TableDataInfo goodsList(OmsPddGoods bo, PageQuery pageQuery) {
|
||||
PageResult<OmsPddGoods> result = goodsService.queryPageList(bo, pageQuery);
|
||||
|
||||
return getDataTable(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/skuList", method = RequestMethod.GET)
|
||||
public TableDataInfo skuList(OmsPddGoodsSku bo, PageQuery pageQuery) {
|
||||
PageResult<OmsPddGoodsSku> result = skuService.queryPageList(bo, pageQuery);
|
||||
|
||||
return getDataTable(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺订单详细信息
|
||||
*/
|
||||
@GetMapping(value = "/sku/{id}")
|
||||
public AjaxResult getSkuInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(skuService.getById(id));
|
||||
}
|
||||
@PostMapping(value = "/sku/linkErp")
|
||||
public AjaxResult linkErp(@RequestBody LinkErpGoodsSkuBo bo)
|
||||
{
|
||||
OmsPddGoodsSku sku = new OmsPddGoodsSku();
|
||||
sku.setId(bo.getId());
|
||||
sku.setErpGoodsSkuId(Long.parseLong(bo.getErpGoodsSkuId()));
|
||||
skuService.updateById(sku);
|
||||
return success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,87 +1,73 @@
|
|||
package com.qihang.pdd.controller;
|
||||
|
||||
|
||||
import com.pdd.pop.sdk.http.PopAccessTokenClient;
|
||||
import com.pdd.pop.sdk.http.token.AccessTokenResponse;
|
||||
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 com.qihang.pdd.service.SShopService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/pdd_api2")
|
||||
@Controller
|
||||
@RestController
|
||||
public class PddOAuthController {
|
||||
|
||||
private final SShopService shopService;
|
||||
private final SShopPlatformService platformService;
|
||||
// @Autowired
|
||||
// private IShopService shopService;
|
||||
// @Autowired
|
||||
// private ServerConfig serverConfig;
|
||||
private static Logger log = LoggerFactory.getLogger(PddOAuthController.class);
|
||||
|
||||
@RequestMapping("/oauth")
|
||||
public String oauth(OpenApiRequest reqData) {
|
||||
// String returnUrl = serverConfig.getUrl() + "/pdd_api/getToken&state="+req.getParameter("shopId");
|
||||
// var shop = shopService.selectShopById(reqData.getShopId());
|
||||
@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 url;
|
||||
return AjaxResult.success("SUCCESS",url);
|
||||
}
|
||||
|
||||
@RequestMapping("/getToken")
|
||||
public String getToken(HttpServletRequest req) throws IOException, InterruptedException {
|
||||
@PostMapping("/getToken")
|
||||
public AjaxResult getToken(@RequestBody TokenCreateBo bo) throws IOException, InterruptedException {
|
||||
log.info("/**********获取拼多多授权token*********/");
|
||||
String code = req.getParameter("code");
|
||||
|
||||
Integer shopId =Integer.parseInt(req.getParameter("state"));
|
||||
var shop = shopService.selectShopById(shopId);
|
||||
// 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(code);
|
||||
if(response.getErrorResponse()!=null){
|
||||
log.info("/***************获取拼多多授权token错误:"+response.getErrorResponse().getErrorMsg()+"**************/");
|
||||
}else{
|
||||
//保存accessToken
|
||||
System.out.println(shopId +"--token:" + response.getAccessToken()+",thirdId:"+response.getOwnerId()+",shopId:"+shopId);
|
||||
|
||||
// shopService.updateSessionKey(shopId,Long.parseLong(response.getOwnerId()),response.getAccessToken());
|
||||
shopService.updateSessionKey(shopId,response.getOwnerId(),response.getAccessToken(),response.getRefreshToken(),response.getExpiresIn().longValue());
|
||||
|
||||
// thirdSettingService.updateEntity(shopId, response.getAccessToken(), response.getRefreshToken(), response.getExpiresIn(),response.getOwnerId());
|
||||
return "redirect:/pdd/getTokenSuccess?mallId="+response.getOwnerId();
|
||||
/* String state = req.getParameter("state");
|
||||
if (state.equalsIgnoreCase("GETORDERLIST")) {
|
||||
//获取订单list
|
||||
return "redirect:/shop/shop_list";
|
||||
} else if (state.equalsIgnoreCase("DCGOODSLIST")) {
|
||||
//商品list
|
||||
return "redirect:/goods/pdd_list";
|
||||
}*/
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
return "redirect:/";
|
||||
// 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");
|
||||
}
|
||||
|
||||
// /**
|
||||
|
|
|
|||
|
|
@ -1,132 +1,55 @@
|
|||
//package com.qihang.pdd.controller;
|
||||
//
|
||||
//import com.pdd.pop.sdk.http.PopClient;
|
||||
//import com.pdd.pop.sdk.http.PopHttpClient;
|
||||
//import com.pdd.pop.sdk.http.api.pop.request.PddOrderListGetRequest;
|
||||
//import com.pdd.pop.sdk.http.api.pop.request.PddPopAuthTokenRefreshRequest;
|
||||
//import com.pdd.pop.sdk.http.api.pop.response.PddOrderListGetResponse;
|
||||
//import com.pdd.pop.sdk.http.api.pop.response.PddPopAuthTokenRefreshResponse;
|
||||
//
|
||||
//import cn.qihangerp.open.pdd.OrderApiHelper;
|
||||
//import cn.qihangerp.open.pdd.common.ApiResultVo;
|
||||
//import cn.qihangerp.open.pdd.model.OrderListResultVo;
|
||||
//import com.qihang.common.common.AjaxResult;
|
||||
//import com.qihang.common.common.ResultVo;
|
||||
//import com.qihang.common.common.ResultVoEnum;
|
||||
//import com.qihang.common.enums.EnumShopType;
|
||||
//import com.qihang.common.enums.HttpStatus;
|
||||
//import com.qihang.pdd.openapi.ApiCommon;
|
||||
//import com.qihang.pdd.openapi.PullRequest;
|
||||
//import com.qihang.pdd.service.OmsPddGoodsService;
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.BeanUtils;
|
||||
//import org.springframework.util.StringUtils;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestBody;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMethod;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//@AllArgsConstructor
|
||||
//@RequestMapping("/order")
|
||||
//@RequestMapping("/pdd-api/order")
|
||||
//@RestController
|
||||
//public class AjaxOrderPddController {
|
||||
// private static Logger log = LoggerFactory.getLogger(AjaxOrderPddController.class);
|
||||
//// @Autowired
|
||||
//// private ServerConfig serverConfig;
|
||||
//
|
||||
// private final SysShopService shopService;
|
||||
// private final SysPlatformService platformService;
|
||||
//// @Autowired
|
||||
//// private IPddOrderService pddOrderService;
|
||||
//
|
||||
//public class PddOrderApiController {
|
||||
// private static Logger logger = LoggerFactory.getLogger(PddOrderApiController.class);
|
||||
// private final OmsPddGoodsService goodsService;
|
||||
// private final OmsPddOrderService orderService;
|
||||
// private final ApiCommon pddApiHelper;
|
||||
// /**
|
||||
// * 接口拉取订单
|
||||
// *
|
||||
// * @param reqData
|
||||
// * @param
|
||||
// * @param
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// @RequestMapping(value = "/pull_order", method = RequestMethod.POST)
|
||||
// public AjaxResult getOrderList(@RequestBody OpenApiRequest reqData)
|
||||
// throws Exception {
|
||||
// Integer updType = reqData.getUpdType();//更新类型0拉取新订单1更新订单
|
||||
// String startDate = reqData.getStartDate();//reqData.getString("startTime");
|
||||
// String endDate = reqData.getEndDate();//reqData.getString("endTime");
|
||||
// @PostMapping ("/pull_order")
|
||||
// public AjaxResult getOrderList(@RequestBody PullRequest req) throws Exception {
|
||||
//
|
||||
// var shop = shopService.selectShopById(reqData.getShopId());
|
||||
// if(shop == null) AjaxResult.error(HttpStatus.PARAMS_ERROR, "店铺不存在!");
|
||||
//
|
||||
// if (shop.getType() != EnumShopType.PDD.getIndex()) {
|
||||
// return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,店铺不是PDD店铺");
|
||||
// Long shopId = req.getShopId();// 拼多多shopId
|
||||
// var checkResult = pddApiHelper.checkBefore(req.getShopId());
|
||||
// if (checkResult.getCode() != HttpStatus.SUCCESS) {
|
||||
// return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(), checkResult.getData());
|
||||
// }
|
||||
// SysPlatform platform = platformService.selectById(EnumShopType.PDD.getIndex());
|
||||
//
|
||||
// if(!StringUtils.hasText(platform.getAppKey())) {
|
||||
// return AjaxResult.error(HttpStatus.PARAMS_ERROR, "平台配置错误,没有找到AppKey");
|
||||
// }
|
||||
// if(!StringUtils.hasText(platform.getAppSecret())) {
|
||||
// return AjaxResult.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到AppSercet");
|
||||
// }
|
||||
//// if(!StringUtils.hasText(platform.getRedirectUri())) {
|
||||
//// return AjaxResult.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到RedirectUri");
|
||||
//// }
|
||||
//// if(!StringUtils.hasText(platform.getServerUrl())) {
|
||||
//// return ApiResult.build(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到ServerUrl");
|
||||
//// }
|
||||
//
|
||||
//// String appKey = shop.getAppKey();
|
||||
//// String appSercet = shop.getAppSercet();
|
||||
//// if(!StringUtils.hasText(appKey) || !StringUtils.hasText(appSercet)) return new ApiResult<>(EnumResultVo.Fail.getIndex(), "参数错误:请设置appkey和serecet");
|
||||
//
|
||||
//// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
//// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
//// var shop = shopService.getShop(shopId);
|
||||
// // var settingEntity = thirdSettingService.getEntity(shop.getType());
|
||||
//
|
||||
// ShopApiParams params = new ShopApiParams();
|
||||
// params.setAppKey(platform.getAppKey());
|
||||
// params.setAppSecret(platform.getAppSecret());
|
||||
// params.setAccessToken(shop.getAccessToken());
|
||||
// params.setTokenRequestUrl("http://localhost:3000/pdd_api2/oauth");
|
||||
// params.setApiRequestUrl(shop.getApiRequestUrl());
|
||||
//// String url = "https://mms.pinduoduo.com/open.html?response_type=code&client_id=" + params.getAppKey() + "&redirect_uri=" + URLEncoder.encode(platform.getRedirectUri());
|
||||
//
|
||||
// String accessToken = params.getAccessToken();
|
||||
// if(!StringUtils.hasText(accessToken)) {
|
||||
// return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误:accessToken为空");
|
||||
// }
|
||||
//// if(!StringUtils.hasText(accessToken)) return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "参数错误:accessToken为空",params);
|
||||
// // 获取店铺信息,判断店铺是否一致
|
||||
// var shopResult = PddApiUtils.getShopInfo(params.getAppKey(), params.getAppSecret(), accessToken);
|
||||
// if (shopResult.getCode() != ResultVoEnum.SUCCESS.getIndex()) {
|
||||
//// if(shopResult.getCode() == HttpStatus.UNAUTHORIZED){
|
||||
//// // 生成AccessToken
|
||||
//// PopAccessTokenClient accessTokenClient = new PopAccessTokenClient(params.getAppKey(), params.getAppSecret());
|
||||
//// String code = "5d78cf7f5eb14e56b4fd08bdc9060eb334723348";
|
||||
//// try {
|
||||
//// AccessTokenResponse response = accessTokenClient.generate(code);
|
||||
//// if(response.getErrorResponse()!=null){
|
||||
//// log.info("/***************获取拼多多授权token错误:"+response.getErrorResponse().getErrorMsg()+"**************/");
|
||||
//// }else{
|
||||
//// //保存accessToken
|
||||
//// shopService.updateSessionKey(reqData.getShopId(),response.getOwnerId(),response.getAccessToken(),response.getRefreshToken(),response.getExpiresIn().longValue());
|
||||
//// }
|
||||
//// } catch (Exception e) {
|
||||
//// e.printStackTrace();
|
||||
//// }
|
||||
//// }
|
||||
// return AjaxResult.error(shopResult.getCode(), shopResult.getMsg(), params);
|
||||
// }else{
|
||||
// // 看看是否需要刷新一下token
|
||||
// PopClient client = new PopHttpClient(params.getAppKey(), params.getAppSecret());
|
||||
// PddPopAuthTokenRefreshRequest request = new PddPopAuthTokenRefreshRequest();
|
||||
// request.setRefreshToken(shop.getRefreshToken());
|
||||
// PddPopAuthTokenRefreshResponse response = client.syncInvoke(request);
|
||||
// System.out.println(response);
|
||||
// //保存accessToken
|
||||
// shopService.updateSessionKey(reqData.getShopId(),response.getPopAuthTokenRefreshResponse().getOwnerId(),response.getPopAuthTokenRefreshResponse().getAccessToken(),response.getPopAuthTokenRefreshResponse().getRefreshToken(),response.getPopAuthTokenRefreshResponse().getExpiresIn().longValue());
|
||||
// }
|
||||
//
|
||||
// if (shopResult.getData().getMallId().longValue() != shop.getSellerId().longValue()) {
|
||||
// return AjaxResult.error(HttpStatus.UNAUTHORIZED, "该店铺不是授权店铺",params);
|
||||
// }
|
||||
//
|
||||
// ResultVo<ErpSalesPullCountResp> result = null;// 返回结果
|
||||
// String accessToken = checkResult.getData().getAccessToken();
|
||||
// String url = checkResult.getData().getServerUrl();
|
||||
// String appKey = checkResult.getData().getAppKey();
|
||||
// String appSecret = checkResult.getData().getAppSecret();
|
||||
//
|
||||
// Long endTime = System.currentTimeMillis() / 1000;// 订单更新结束时间(默认值)
|
||||
// Long startTime = endTime - 60 * 60 * 24 + 10;// 订单更新开始时间(默认值)
|
||||
|
|
@ -136,16 +59,16 @@
|
|||
// if (!StringUtils.isEmpty(startTime_))
|
||||
// startTime = DateUtil.dateTimeToStamp(startTime_).longValue();*/
|
||||
//
|
||||
//// if (!StringUtils.isEmpty(startDate)) {
|
||||
//// // 选择了开始日期,从开始时间直接循环更新到结束时间,如果选择的时间大于数据库订单最后的时间,那么就用数据库的订单时间
|
||||
//// Long startTimeTmp = DateUtil.dateTimeToStamp(startDate).longValue();
|
||||
//// if (startTimeTmp < startTime)
|
||||
//// startTime = startTimeTmp;
|
||||
////
|
||||
//// // 如果选择的结束时间不为空,就用选择的时间
|
||||
//// if (!StringUtils.isEmpty(endDate))
|
||||
//// endTime = DateUtil.dateTimeToStamp(endDate).longValue();
|
||||
//// }
|
||||
// if (!StringUtils.isEmpty(startDate)) {
|
||||
// // 选择了开始日期,从开始时间直接循环更新到结束时间,如果选择的时间大于数据库订单最后的时间,那么就用数据库的订单时间
|
||||
// Long startTimeTmp = DateUtil.dateTimeToStamp(startDate).longValue();
|
||||
// if (startTimeTmp < startTime)
|
||||
// startTime = startTimeTmp;
|
||||
//
|
||||
// // 如果选择的结束时间不为空,就用选择的时间
|
||||
// if (!StringUtils.isEmpty(endDate))
|
||||
// endTime = DateUtil.dateTimeToStamp(endDate).longValue();
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * if (StringUtils.isEmpty(startDate)) { //没有选择开始日期 var pullOrderLog =
|
||||
|
|
@ -158,215 +81,57 @@
|
|||
// * else endTime = DateUtil.dateTimeToStamp(endDate + " 23:59:00").longValue(); }
|
||||
// */
|
||||
//
|
||||
// long kaishidaojiesu = endTime - startTime;
|
||||
// long forSize = (kaishidaojiesu % (60 * 60 * 24) == 0) ? kaishidaojiesu / (60 * 60 * 24)
|
||||
// : kaishidaojiesu / (60 * 60 * 24) + 1;// 计算需要循环的次数
|
||||
//
|
||||
//// log.info("开始循环更新拼多多订单。开始时间:" + DateUtil.unixTimeStampToDate(startTime) + "结束时间:" + DateUtil.unixTimeStampToDate(endTime) + "总共循环" + forSize);
|
||||
// int updCount = 0;
|
||||
// int insertCount = 0;
|
||||
// int failCount = 0;
|
||||
// // int pageIndex = 1;
|
||||
// int pageSize = 100;
|
||||
// logger.info("开始循环更新拼多多订单。开始时间:" + DateUtil.unixTimeStampToDate(startTime) + "结束时间:"
|
||||
// + DateUtil.unixTimeStampToDate(endTime));
|
||||
// int hasExistOrder = 0;
|
||||
// int insertSuccess = 0;
|
||||
// int totalError = 0;
|
||||
//
|
||||
// for (int i = 0; i < forSize; i++) {
|
||||
// Long startTime1 = startTime + i * 60 * 60 * 24;
|
||||
// Long endTime1 = startTime1 + 60 * 60 * 24;
|
||||
// if (endTime1 > endTime)
|
||||
// endTime1 = endTime;
|
||||
// int pageIndex = 1;
|
||||
//
|
||||
// result = this.pullPddOrder(params.getAppKey(),params.getAppSecret(), accessToken, pageIndex, pageSize, startTime1, endTime1, shop.getSellerId());
|
||||
// pageIndex++;
|
||||
//// log.info("开始循环" + i + "。开始时间:" + DateUtil.unixTimeStampToDate(startTime1) + "结束时间:" + DateUtil.unixTimeStampToDate(endTime1) + "。");
|
||||
// // log.info("开始更新第"+pageIndex+"页");
|
||||
// if (result.getCode() == 0) {
|
||||
// updCount += result.getData().getUpdCount();
|
||||
// insertCount += result.getData().getAddCount();
|
||||
// failCount += result.getData().getFailCount();
|
||||
// // log.info("查询到数据:"+result.getData().getTotalRecords());
|
||||
// } else if (result.getCode() > 0)
|
||||
// return AjaxResult.error(result.getCode(), result.getMsg());
|
||||
// // 计算总页数
|
||||
// int totalPage = (result.getData().getTotalRecords() % pageSize == 0)
|
||||
// ? result.getData().getTotalRecords() / pageSize
|
||||
// : (result.getData().getTotalRecords() / pageSize) + 1;
|
||||
// log.info("开始循环" + i + "。查询到" + result.getData().getTotalRecords() + "条数据,总共:" + totalPage + "页");
|
||||
//// while (pageIndex <= totalPage) {
|
||||
////
|
||||
//// // log.info("开始更新第"+pageIndex+"页");
|
||||
//// // log.info("查询到数据:"+result.getData().getTotalRecords());
|
||||
//// result = this.pullPddOrder(appKey, appSercet, accessToken, pageIndex, pageSize, startTime1, endTime1, shopId);
|
||||
//// if (result.getCode() == 0) {
|
||||
//// updCount += result.getData().getUpdCount();
|
||||
//// insertCount += result.getData().getAddCount();
|
||||
//// failCount += result.getData().getFailCount();
|
||||
//// }
|
||||
//// pageIndex++;
|
||||
//// }
|
||||
// // pageIndex = 1;
|
||||
//
|
||||
// }
|
||||
//
|
||||
//// ErpSalesPullCountResp resp = new ErpSalesPullCountResp();// 返回结果
|
||||
//// resp.setStartTime(DateUtil.unixTimeStampToDate(startTime));
|
||||
//// resp.setEndTime(DateUtil.unixTimeStampToDate(endTime));
|
||||
//// resp.setAddCount(insertCount);
|
||||
//// resp.setFailCount(failCount);
|
||||
//// resp.setUpdCount(updCount);
|
||||
//// log.info("更新完成,结果:" + JsonUtil.transferToJson(resp));
|
||||
// /*
|
||||
// * try { //添加更新日志 salesOrderService.addErpSalesPullOrderLog(startTime, endTime,
|
||||
// * shopId, result.getData().getAddCount(), result.getData().getFailCount(),
|
||||
// * result.getData().getUpdCount(), updType); } catch (Exception e) {
|
||||
// * log.info("添加更新日志错误"); }
|
||||
// */
|
||||
// if (result.getCode() == 0)
|
||||
// return AjaxResult.success();
|
||||
// else
|
||||
// return AjaxResult.error(result.getCode(), result.getMsg());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 拉取拼多多接口订单
|
||||
// *
|
||||
// * @param pageNo
|
||||
// * @param pageSize
|
||||
// * @param startTime
|
||||
// * @param endTime
|
||||
// * @param shopId
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// private ResultVo<ErpSalesPullCountResp> pullPddOrder( String clientId,String clientSecret,String accessToken,Integer pageNo, Integer pageSize, Long startTime, Long endTime, Long shopId) throws Exception {
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
//
|
||||
// // 调取拼多多接口 pdd.order.list.get 订单列表查询接口(根据成交时间)
|
||||
// PddOrderListGetRequest pddOrderListGetRequest = new PddOrderListGetRequest();
|
||||
// pddOrderListGetRequest.setOrderStatus(5);// 发货状态,1:待发货,2:已发货待签收,3:已签收 5:全部
|
||||
// pddOrderListGetRequest.setRefundStatus(5);// 售后状态 1:无售后或售后关闭,2:售后处理中,3:退款中,4: 退款成功 5:全部
|
||||
//
|
||||
// // 开始时间 结束时间不能超过24小时
|
||||
// pddOrderListGetRequest.setStartConfirmAt(startTime);
|
||||
// pddOrderListGetRequest.setEndConfirmAt(endTime);
|
||||
// pddOrderListGetRequest.setPage(pageNo);
|
||||
// pddOrderListGetRequest.setPageSize(pageSize);
|
||||
//
|
||||
// ErpSalesPullCountResp resp = new ErpSalesPullCountResp();
|
||||
// resp.setStartTime("2024-03-03 00:00:00");
|
||||
// resp.setEndTime("2024-03-13 23:00:00");
|
||||
//
|
||||
// Integer addCount = 0, updCount = 0, failCount = 0;
|
||||
// log.info("开始更新第" + pageNo + "页。。。。。。。");
|
||||
// PddOrderListGetResponse pddOrderListGetResponse = client.syncInvoke(pddOrderListGetRequest, accessToken);
|
||||
// if (pddOrderListGetResponse.getErrorResponse() != null) {
|
||||
// if (pddOrderListGetResponse.getErrorResponse().getErrorCode().intValue() == 10019) {
|
||||
// return ResultVo.error(HttpStatus.UNAUTHORIZED, "Token过期");
|
||||
// } else
|
||||
// return ResultVo.error(HttpStatus.ERROR,
|
||||
// "接口调用失败:" + pddOrderListGetResponse.getErrorResponse().getErrorMsg());
|
||||
// } else {
|
||||
// // 获取到了数据
|
||||
// log.info("第" + pageNo + "页。获取到" + pddOrderListGetResponse.getOrderListGetResponse().getOrderList().size()
|
||||
// + "条数据");
|
||||
// if (pddOrderListGetResponse.getOrderListGetResponse().getTotalCount() > 0) {
|
||||
// for (var item : pddOrderListGetResponse.getOrderListGetResponse().getOrderList()) {
|
||||
// // if(item.getOrderSn().equals("210629-025663970220736")){
|
||||
// // String s= item.getOrderSn();
|
||||
// // }
|
||||
// /*PddOrder pddEntity = new PddOrder();
|
||||
//
|
||||
// pddEntity.setBuyer_memo(item.getBuyerMemo());
|
||||
// pddEntity.setCapital_free_discount(item.getCapitalFreeDiscount());
|
||||
// pddEntity.setCity(item.getCity());
|
||||
// pddEntity.setConfirm_status(item.getConfirmStatus());
|
||||
// pddEntity.setConfirm_time(item.getConfirmTime());
|
||||
// pddEntity.setCountry(item.getCountry());
|
||||
// pddEntity.setCreated_time(item.getCreatedTime());
|
||||
// pddEntity.setDiscount_amount(item.getDiscountAmount());
|
||||
// pddEntity.setFree_sf(item.getFreeSf());
|
||||
// pddEntity.setGoods_amount(item.getGoodsAmount());
|
||||
// pddEntity.setGroup_status(item.getGroupStatus());
|
||||
// pddEntity.setIs_lucky_flag(item.getIsLuckyFlag());
|
||||
// pddEntity.setOrderSn(item.getOrderSn());
|
||||
// pddEntity.setOrder_status(item.getOrderStatus());// 订单发货状态,1:待发货,2:已发货待签收,3:已签收 0:异常
|
||||
// pddEntity.setPay_amount(item.getPayAmount());
|
||||
// pddEntity.setPay_no(item.getPayNo());
|
||||
// pddEntity.setPay_time(item.getPayTime());
|
||||
// pddEntity.setPay_type(item.getPayType());
|
||||
// pddEntity.setPlatform_discount(item.getPlatformDiscount());
|
||||
// pddEntity.setPostage(item.getPostage());
|
||||
// pddEntity.setProvince(item.getProvince());
|
||||
// pddEntity.setReceive_time(item.getReceiveTime());
|
||||
// pddEntity.setLast_ship_time(item.getLastShipTime());
|
||||
//
|
||||
// pddEntity.setReceiver_name(item.getReceiverName());
|
||||
// pddEntity.setReceiver_phone(item.getReceiverPhone());
|
||||
// pddEntity.setAddress(item.getAddress());
|
||||
// pddEntity.setNameKey(extractIndex(item.getReceiverName()));
|
||||
// pddEntity.setPhoneKey(extractIndex(item.getReceiverPhone()));
|
||||
// pddEntity.setAddressKey(extractIndex(item.getAddress()));
|
||||
//
|
||||
// pddEntity.setRefund_status(item.getRefundStatus());// 订单售后状态,1:无售后或售后关闭,2:售后处理中,3:退款中,4:退款成功,0:异常
|
||||
// pddEntity.setAfter_sales_status(item.getAfterSalesStatus());// 售后状态 0:无售后 2:买家申请退款,待商家处理
|
||||
// // 3:退货退款,待商家处理 4:商家同意退款,退款中
|
||||
// // 5:平台同意退款,退款中 6:驳回退款,待买家处理
|
||||
// // 7:已同意退货退款,待用户发货 8:平台处理中 9:平台拒绝退款,退款关闭
|
||||
// // 10:退款成功 11:买家撤销 12:买家逾期未处理,退款失败
|
||||
// // 13:买家逾期,超过有效期 14:换货补寄待商家处理
|
||||
// // 15:换货补寄待用户处理 16:换货补寄成功 17:换货补寄失败
|
||||
// // 18:换货补寄待用户确认完成 21:待商家同意维修 22:待用户确认发货
|
||||
// // 24:维修关闭 25:维修成功 27:待用户确认收货
|
||||
// // 31:已同意拒收退款,待用户拒收 32:补寄待商家发货
|
||||
//
|
||||
// pddEntity.setRemark(item.getRemark());
|
||||
// pddEntity.setSeller_discount(item.getSellerDiscount());
|
||||
// pddEntity.setShipping_time(item.getShippingTime());
|
||||
// pddEntity.setTown(item.getTown());
|
||||
// pddEntity.setTracking_number(item.getTrackingNumber());
|
||||
// pddEntity.setTradeType(item.getTradeType());
|
||||
// pddEntity.setUpdated_at(item.getUpdatedAt());
|
||||
// pddEntity.setOrderConfirmTime(DateUtil.strToLongGo(item.getConfirmTime()));
|
||||
//
|
||||
// List<PddOrderItem> items = new ArrayList<>();
|
||||
// // items
|
||||
// for (var it : item.getItemList()) {
|
||||
// PddOrderItem pddItem = new PddOrderItem();
|
||||
// pddItem.setGoodsImg(it.getGoodsImg());
|
||||
// pddItem.setGoodsName(it.getGoodsName());
|
||||
// pddItem.setGoodsNum(it.getOuterGoodsId());
|
||||
// pddItem.setGoodsPrice(it.getGoodsPrice());
|
||||
// pddItem.setGoodsSpec(it.getGoodsSpec());
|
||||
// pddItem.setGoodsSpecNum(it.getOuterId());
|
||||
// pddItem.setQuantity(it.getGoodsCount());
|
||||
// items.add(pddItem);
|
||||
// }
|
||||
// pddEntity.setItems(items);
|
||||
//
|
||||
// // 开始写入数据库
|
||||
// var result = orderPddService.insertOrder(pddEntity, shopId);
|
||||
// // log.info("订单处理:" +
|
||||
// // item.getOrderSn()+"【结果:"+result.getCode()+"】"+result.getMsg());
|
||||
// if (result.getCode() == EnumResultVo.Exist.getIndex()) {
|
||||
// updCount += 1;
|
||||
// } else if (result.getCode() == EnumResultVo.SUCCESS.getIndex()) {
|
||||
// addCount += 1;
|
||||
// } else {
|
||||
// failCount += 1;
|
||||
// }*/
|
||||
// resp.setAddCount(addCount);
|
||||
// resp.setUpdCount(updCount);
|
||||
// resp.setFailCount(failCount);
|
||||
// ApiResultVo<OrderListResultVo> apiResultVo = OrderApiHelper.pullOrderList(appKey, appSecret, accessToken, 1716160072, 1716242872, 1, 20);
|
||||
// if (apiResultVo.getCode() != 0) return AjaxResult.error(apiResultVo.getCode(), apiResultVo.getMsg());
|
||||
// //成功
|
||||
// if (apiResultVo.getData().getOrderList() != null) {
|
||||
// //循环插入订单数据到数据库
|
||||
// for (var trade : apiResultVo.getData().getOrderList()) {
|
||||
// OmsPddOrder order = new OmsPddOrder();
|
||||
// BeanUtils.copyProperties(trade,order);
|
||||
// List<OmsPddOrderItem> items = new ArrayList<>();
|
||||
// for (var it:trade.getItemList()) {
|
||||
// OmsPddOrderItem item = new OmsPddOrderItem();
|
||||
// BeanUtils.copyProperties(it,item);
|
||||
// items.add(item);
|
||||
// }
|
||||
// order.setItemList(items);
|
||||
// //插入订单数据
|
||||
// var result = orderService.saveOrder(req.getShopId(), order);
|
||||
// if (result.getCode() == ResultVoEnum.DataExist.getIndex()) {
|
||||
// //已经存在
|
||||
// logger.info("/**************主动更新pdd订单:开始更新数据库:" + order.getId() + "存在、更新****************/");
|
||||
//
|
||||
// resp.setTotalRecords(pddOrderListGetResponse.getOrderListGetResponse().getTotalCount());
|
||||
// } else
|
||||
// resp.setTotalRecords(0);
|
||||
// hasExistOrder++;
|
||||
// } else if (result.getCode() == ResultVoEnum.SUCCESS.getIndex()) {
|
||||
// logger.info("/**************主动更新pdd订单:开始更新数据库:" + order.getId() + "不存在、新增****************/");
|
||||
//
|
||||
// insertSuccess++;
|
||||
// } else {
|
||||
// logger.info("/**************主动更新pdd订单:开始更新数据库:" + order.getId() + "报错****************/");
|
||||
// totalError++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return ResultVo.success(resp);
|
||||
// String msg = "成功,总共找到:" + apiResultVo.getData().getOrderList().size() + "条商品数据,新增:" + insertSuccess + "条,添加错误:" + totalError + "条,更新:" + hasExistOrder + "条";
|
||||
// logger.info(msg);
|
||||
//
|
||||
// return AjaxResult.success(msg);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//// /**
|
||||
//// * 更新订单状态(根据订单号)
|
||||
//// *
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
//package com.qihang.pdd.controller;
|
||||
//
|
||||
//
|
||||
//import com.qihang.common.common.TableDataInfo;
|
||||
//import com.qihang.security.common.BaseController;
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMethod;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
///**
|
||||
// * 拼多多订单Controller
|
||||
// *
|
||||
// * @author qihang
|
||||
// * @date 2024-01-02
|
||||
// */
|
||||
//@AllArgsConstructor
|
||||
//@RestController
|
||||
//@RequestMapping("/order")
|
||||
//public class PddOrderController extends BaseController
|
||||
//{
|
||||
//
|
||||
// private final OmsPddOrderService orderService;
|
||||
// @RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
// public TableDataInfo orderList(OmsPddOrder bo, PageQuery pageQuery) {
|
||||
// PageResult<OmsPddOrder> result = orderService.queryPageList(bo, pageQuery);
|
||||
//
|
||||
// return getDataTable(result);
|
||||
// }
|
||||
//// @Autowired
|
||||
//// private IPddOrderService pddOrderService;
|
||||
////
|
||||
//// /**
|
||||
//// * 查询拼多多订单列表
|
||||
//// */
|
||||
//// @PreAuthorize("@ss.hasPermi('pdd:order:list')")
|
||||
//// @GetMapping("/list")
|
||||
//// public TableDataInfo list(PddOrder pddOrder)
|
||||
//// {
|
||||
//// startPage();
|
||||
//// List<PddOrder> list = pddOrderService.selectPddOrderList(pddOrder);
|
||||
//// return getDataTable(list);
|
||||
//// }
|
||||
////
|
||||
//// /**
|
||||
//// * 导出拼多多订单列表
|
||||
//// */
|
||||
//// @PreAuthorize("@ss.hasPermi('pdd:order:export')")
|
||||
//// @Log(title = "拼多多订单", businessType = BusinessType.EXPORT)
|
||||
//// @PostMapping("/export")
|
||||
//// public void export(HttpServletResponse response, PddOrder pddOrder)
|
||||
//// {
|
||||
//// List<PddOrder> list = pddOrderService.selectPddOrderList(pddOrder);
|
||||
//// ExcelUtil<PddOrder> util = new ExcelUtil<PddOrder>(PddOrder.class);
|
||||
//// util.exportExcel(response, list, "拼多多订单数据");
|
||||
//// }
|
||||
////
|
||||
//// /**
|
||||
//// * 获取拼多多订单详细信息
|
||||
//// */
|
||||
//// @PreAuthorize("@ss.hasPermi('pdd:order:query')")
|
||||
//// @GetMapping(value = "/{id}")
|
||||
//// public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
//// {
|
||||
//// return success(pddOrderService.selectPddOrderById(id));
|
||||
//// }
|
||||
////
|
||||
//// /**
|
||||
//// * 新增拼多多订单
|
||||
//// */
|
||||
//// @PreAuthorize("@ss.hasPermi('pdd:order:add')")
|
||||
//// @Log(title = "拼多多订单", businessType = BusinessType.INSERT)
|
||||
//// @PostMapping
|
||||
//// public AjaxResult add(@RequestBody PddOrder pddOrder)
|
||||
//// {
|
||||
//// Integer result = pddOrderService.insertPddOrder(pddOrder);
|
||||
//// if(result == -1) return new AjaxResult(505,"订单号已存在");
|
||||
//// else if(result == -2) return new AjaxResult(506,"请添加商品");
|
||||
//// else if(result == -3) return new AjaxResult(507,"商品数据错误");
|
||||
//// return toAjax(result);
|
||||
//// }
|
||||
////
|
||||
//// @Log(title = "拼多多订单", businessType = BusinessType.UPDATE)
|
||||
//// @PostMapping("/confirm")
|
||||
//// public AjaxResult confirmOrder(@RequestBody PddOrder pddOrder)
|
||||
//// {
|
||||
//// pddOrder.setUpdateBy(getUsername());
|
||||
//// Integer result = pddOrderService.confirmOrder(pddOrder);
|
||||
//// if(result == -1) return new AjaxResult(505,"订单不存在");
|
||||
//// else if(result == -2) return new AjaxResult(506,"订单已确认过了");
|
||||
//// else if(result == -3) return new AjaxResult(507,"订单售后中!无法操作!");
|
||||
//// else if(result == -4) return new AjaxResult(508,"订单号确认过了!请检查订单号是否正确!");
|
||||
//// else if(result == -5) return new AjaxResult(509,"不支持的发货方式!");
|
||||
//// else if(result == -11) return new AjaxResult(511,"商品SKU编码不存在!");
|
||||
//// else if(result == -12) return new AjaxResult(512,"商品信息不存在!");
|
||||
//// return toAjax(result);
|
||||
//// }
|
||||
////
|
||||
//
|
||||
//}
|
||||
|
|
@ -1,391 +0,0 @@
|
|||
package com.qihang.pdd.controller;//package com.qihang.erp.api.controller.pdd;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSON;
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//import com.b2c.common.jdbc.DbUtil;
|
||||
//import com.b2c.common.utils.DateUtil;
|
||||
//import com.b2c.oms.DataConfigObject;
|
||||
//import com.b2c.oms.PddWsClient;
|
||||
//import com.b2c.service.oms.OrderPddService;
|
||||
//import com.pdd.pop.sdk.common.util.JsonUtil;
|
||||
//import com.pdd.pop.sdk.http.PopClient;
|
||||
//import com.pdd.pop.sdk.http.PopHttpClient;
|
||||
//import com.pdd.pop.sdk.http.api.pop.request.PddPmcUserGetRequest;
|
||||
//import com.pdd.pop.sdk.http.api.pop.request.PddPmcUserPermitRequest;
|
||||
//import com.pdd.pop.sdk.http.api.pop.response.PddPmcUserGetResponse;
|
||||
//import com.pdd.pop.sdk.http.api.pop.response.PddPmcUserPermitResponse;
|
||||
//import com.pdd.pop.sdk.message.MessageHandler;
|
||||
//import com.pdd.pop.sdk.message.WsClient;
|
||||
//import com.pdd.pop.sdk.message.model.Message;
|
||||
//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.ResponseBody;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.sql.*;
|
||||
//
|
||||
//@Controller
|
||||
//public class PddSocketController {
|
||||
//
|
||||
// private static Logger log = LoggerFactory.getLogger(PddSocketController.class);
|
||||
//
|
||||
// @Autowired
|
||||
// private OrderPddService orderPddService;
|
||||
//
|
||||
// @RequestMapping("/pddSockettest")
|
||||
// @ResponseBody
|
||||
// public String pddSoceketTest() throws Exception {
|
||||
// String clientId = "dc953bcf16d24b27abf3e64a59e1ecd1";
|
||||
// String clientSecret = "de296599e194a08cbfbb2b3b340e11fec7a1bacc";
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
//
|
||||
//
|
||||
//// Connection conn = null;
|
||||
//// Statement stmt = null;
|
||||
//// ResultSet rs = null;
|
||||
//// try{
|
||||
//// String jdbcUrl = DataConfigObject.getInstance().getJdbcURL();
|
||||
//// String jdbcUser= DataConfigObject.getInstance().getJdbcUSER();
|
||||
//// String jdbcPwd = DataConfigObject.getInstance().getJdbcPASSWORD();
|
||||
//// DbUtil dbUtil = new DbUtil(jdbcUrl,jdbcUser,jdbcPwd);
|
||||
//// conn = dbUtil.getConnection();
|
||||
//// }
|
||||
//// catch (Exception e){
|
||||
//// log.info("数据库链接异常");
|
||||
//// }
|
||||
//// String sql = "insert into dc_pdd_message (mall_id,type,content) value(?,?,?)";
|
||||
//// if(conn != null) {
|
||||
//// try {
|
||||
//// log.info("开始数据库操作");
|
||||
//// PreparedStatement pst = conn.prepareStatement(sql);
|
||||
//// //为占位符设置具体内容
|
||||
//// pst.setLong(1, 1);
|
||||
//// pst.setString(2, "pdd_trade_TradeConfirmed");
|
||||
//// pst.setString(3," {\"content\":\"{\\\"mall_id\\\":171504183,\\\"refund_fee\\\":1990,\\\"bill_type\\\":1,\\\"modified\\\":1625637425016,\\\"refund_id\\\":7381745730,\\\"operation\\\":1000,\\\"tid\\\":\\\"210707-339507978993455\\\"}\",\"mallID\":171504183,\"type\":\"pdd_refund_RefundCreated\"}");
|
||||
////
|
||||
//// var dataResult = pst.executeUpdate();
|
||||
//// log.info("数据插入成功"+dataResult);
|
||||
////// //3.操作数据库,实现增删改查
|
||||
////// stmt = conn.createStatement();
|
||||
////// rs = stmt.executeQuery("insert into user_name, age FROM imooc_goddess");
|
||||
////// //如果有数据,rs.next()返回true
|
||||
////// while (rs.next()) {
|
||||
////// System.out.println(rs.getString("user_name") + " 年龄:" + rs.getInt("age"));
|
||||
////// }
|
||||
//// } catch (Exception e) {
|
||||
//// if (rs != null && !rs.isClosed()) {
|
||||
//// rs.close();
|
||||
//// log.info("ResultSet is close " + rs.isClosed());
|
||||
//// }
|
||||
//// if (stmt != null && !stmt.isClosed()) {
|
||||
//// stmt.close();
|
||||
//// log.info("Statement is close " + stmt.isClosed());
|
||||
//// }
|
||||
//// if (conn != null && !conn.isClosed()) {
|
||||
//// conn.close();
|
||||
//// log.info("Connection is close " + conn.isClosed());
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//// String accessToken = "8386f04e132d486fa3eec27481614e43f4fabe66";
|
||||
//// PddPmcUserPermitRequest request1 = new PddPmcUserPermitRequest();
|
||||
//// request1.setTopics("pdd_trade_TradeConfirmed");
|
||||
//// PddPmcUserPermitResponse response1 = client.syncInvoke(request1, accessToken);
|
||||
//// System.out.println(JsonUtil.transferToJson(response1));
|
||||
//
|
||||
//
|
||||
// PddPmcUserGetRequest request = new PddPmcUserGetRequest();
|
||||
// request.setOwnerId("171504183");
|
||||
// PddPmcUserGetResponse response = client.syncInvoke(request);
|
||||
// System.out.println(JsonUtil.transferToJson(response));
|
||||
//
|
||||
// return JsonUtil.transferToJson(response);
|
||||
// }
|
||||
//
|
||||
// @RequestMapping("/pddSocket")
|
||||
// @ResponseBody
|
||||
// public String pddSocket(Model model) throws Exception {
|
||||
//
|
||||
//
|
||||
// log.info("开启拼多多消息长连接");
|
||||
// String clientId = "dc953bcf16d24b27abf3e64a59e1ecd1";
|
||||
// String clientSecret = "de296599e194a08cbfbb2b3b340e11fec7a1bacc";
|
||||
// String accessToken = "5f3ed4cddf99491e883bc6dfd867bed3b1ec90a4";
|
||||
// String accessToken1 = "c99a5f0233e44b93bcf8ebd9cd02313f95c56cf2";
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// PddPmcUserPermitRequest request = new PddPmcUserPermitRequest();
|
||||
//// request.setTopics("pdd_trade_TradeConfirmed,pdd_refund_RefundCreated");
|
||||
// request.setTopics("pdd_trade_TradeConfirmed,pdd_refund_RefundCreated,pdd_refund_RefundBuyerReturnGoods");
|
||||
//
|
||||
// PddPmcUserPermitResponse response = client.syncInvoke(request, accessToken);
|
||||
// System.out.println(JsonUtil.transferToJson(response));
|
||||
//
|
||||
// PddPmcUserPermitResponse response1 = client.syncInvoke(request, accessToken1);
|
||||
// System.out.println(JsonUtil.transferToJson(response1));
|
||||
//
|
||||
// String jdbcUrl = DataConfigObject.getInstance().getJdbcURL();
|
||||
// String jdbcUser= DataConfigObject.getInstance().getJdbcUSER();
|
||||
// String jdbcPwd = DataConfigObject.getInstance().getJdbcPASSWORD();
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// WsClient ws = PddWsClient.getInstance().getWsClient();
|
||||
// ws.setMessageHandler(new MessageHandler() {
|
||||
// @Override
|
||||
// public void onMessage(Message message) throws InterruptedException, IOException {
|
||||
// log.info("拼多多新消息:" + JSON.toJSONString(message));
|
||||
// DbUtil dbUtil = null;
|
||||
// Connection conn = null;
|
||||
// Statement stmt = null;
|
||||
//
|
||||
// try{
|
||||
// dbUtil =new DbUtil(jdbcUrl,jdbcUser,jdbcPwd);
|
||||
// conn = DbUtil.getConnection();
|
||||
// stmt = conn.createStatement();
|
||||
// }catch (Exception e){
|
||||
// conn = null;
|
||||
// stmt = null;
|
||||
// log.info("数据库连接池初始化错误");
|
||||
// }
|
||||
// if (message.getType().equals("pdd_refund_RefundCreated")) {
|
||||
// //新退货订单,插入退货表
|
||||
//// log.info("接收到拼多多新退款,插入退货表:" );
|
||||
// Integer shopId = 0;
|
||||
// if(message.getMallID().longValue() == 171504183L){
|
||||
// shopId = 18;
|
||||
// } else if(message.getMallID().longValue() == 593374804L){
|
||||
// shopId = 5;
|
||||
// }
|
||||
// JSONObject jsonObject = JSON.parseObject(message.getContent());
|
||||
// Long refundId = jsonObject.getLong("refund_id");
|
||||
// Integer billType = jsonObject.getInteger("bill_type");
|
||||
// Long refundFee = jsonObject.getLong("refund_fee");
|
||||
// Integer operation=jsonObject.getInteger("operation");
|
||||
// String orderSn = jsonObject.getString("tid");
|
||||
// Long modified = jsonObject.getLong("modified");
|
||||
// String sql = "SELECT count(0) FROM dc_pdd_refund WHERE id="+refundId;//查询
|
||||
//
|
||||
// try {
|
||||
// if(stmt == null){
|
||||
// log.info("链接断开了");
|
||||
// }
|
||||
// ResultSet rs = stmt.executeQuery(sql);
|
||||
// int isExist = 0;
|
||||
// //如果有数据,rs.next()返回true
|
||||
// if(rs.next()){
|
||||
// isExist = rs.getInt(1);
|
||||
// }
|
||||
// if(isExist > 0){
|
||||
// log.info(refundId + "存在,不操作");
|
||||
// }else{
|
||||
// //插入数据,简单数据
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// sb.append("INSERT INTO dc_pdd_refund SET id="+refundId);
|
||||
// sb.append(",order_sn='"+orderSn+"'");
|
||||
// sb.append(",shopId="+shopId);
|
||||
// sb.append(",after_sales_type=0");
|
||||
// sb.append(",after_sales_status=0");
|
||||
// sb.append(",after_sale_reason=''");
|
||||
// sb.append(",confirm_time=0");
|
||||
// sb.append(",created_time=0");
|
||||
// sb.append(",discount_amount=0");
|
||||
// sb.append(",order_amount=0");
|
||||
// sb.append(",refund_amount="+refundFee.doubleValue() / 100);
|
||||
// sb.append(",quantity=0");
|
||||
// sb.append(",goods_price=0");
|
||||
// sb.append(",updated_time='"+DateUtil.getCurrentDateTime()+"'");
|
||||
// sb.append(",auditStatus=-9");
|
||||
//
|
||||
//
|
||||
// int r = stmt.executeUpdate(sb.toString());
|
||||
//// log.info(refundId+"新增成功");
|
||||
// log.info("处理拼多多新退款消息:{refundId:" + refundId + ",order_sn:" + orderSn + "},添加成功");
|
||||
// }
|
||||
// if(rs.isClosed()==false) rs.close();
|
||||
//
|
||||
// } catch (SQLException e) {
|
||||
// e.printStackTrace();
|
||||
// }finally {
|
||||
// try {
|
||||
// if(stmt!=null && stmt.isClosed()==false ) stmt.close();
|
||||
// if (conn != null && conn.isClosed()) conn.close();
|
||||
// }catch (Exception ee){}
|
||||
// }
|
||||
//
|
||||
//// RefundPddEntity refundPdd = new RefundPddEntity();
|
||||
//// refundPdd.setId(refundId);
|
||||
//// refundPdd.setShopId(shopId);
|
||||
//// refundPdd.setAfter_sales_type(billType+1);
|
||||
//// refundPdd.setAfter_sales_status(2);
|
||||
//// refundPdd.setAfter_sale_reason(operation+"");
|
||||
//// refundPdd.setAuditStatus(-9);//带拉取状态
|
||||
//// refundPdd.setConfirm_time(0L);
|
||||
//// refundPdd.setCreated_time(modified);
|
||||
//// refundPdd.setDescribe("");
|
||||
//// refundPdd.setDiscount_amount(0.0);
|
||||
//// refundPdd.setGoods_id(0);
|
||||
//// refundPdd.setGoods_image("");
|
||||
//// refundPdd.setGoods_name("");
|
||||
//// refundPdd.setGoods_number("");
|
||||
//// refundPdd.setGoods_price(0.0);
|
||||
//// refundPdd.setOrder_amount(0.0);
|
||||
//// refundPdd.setOrder_sn(orderSn);
|
||||
//// refundPdd.setQuantity(0);
|
||||
//// refundPdd.setRefund_amount(refundFee.doubleValue() / 100);
|
||||
//// refundPdd.setShippingStatus(0);
|
||||
//// refundPdd.setSkuId(0);
|
||||
//// refundPdd.setSkuInfo("");
|
||||
//// refundPdd.setSkuNumber("");
|
||||
//// refundPdd.setTracking_company("");
|
||||
//// refundPdd.setTracking_number("");
|
||||
//// refundPdd.setUpdated_time(DateUtil.getCurrentDateTime());
|
||||
//// var result = orderPddService.editRefundPddOrder(refundPdd);
|
||||
//// log.info("开始处理退货单消息:{refundId:"+refundId+",status:"+operation+"},处理结果:"+result.getMsg());
|
||||
//
|
||||
// }else if (message.getType().equals("pdd_trade_TradeConfirmed")){
|
||||
//// log.info("接收到拼多多新订单,插入订单表:" );
|
||||
// try {
|
||||
// Integer shopId = 0;
|
||||
// if (message.getMallID().longValue() == 171504183L) {
|
||||
// shopId = 18;
|
||||
// } else if(message.getMallID().longValue() == 593374804L){
|
||||
// shopId = 5;
|
||||
// }
|
||||
// //{"content":"{\"mall_id\":171504183,\"tid\":\"210822-038440825871540\"}","mallID":171504183,"type":"pdd_trade_TradeConfirmed"}
|
||||
// JSONObject jsonObject = JSON.parseObject(message.getContent());
|
||||
// String tid = jsonObject.getString("tid");
|
||||
// String sql = "SELECT COUNT(0) FROM dc_pdd_orders WHERE order_sn=" + tid + " and shopId =" + shopId;
|
||||
// ResultSet rs = stmt.executeQuery(sql);
|
||||
// int isExist = 0;
|
||||
// //如果有数据,rs.next()返回true
|
||||
// if (rs.next()) {
|
||||
// isExist = rs.getInt(1);
|
||||
// }
|
||||
// if (isExist > 0) {
|
||||
// log.info(tid + "存在,不操作");
|
||||
// } else {
|
||||
//
|
||||
// // 开始写入数据库
|
||||
// /*****1、添加order*****/
|
||||
// StringBuilder orderInsertSQL = new StringBuilder();
|
||||
// orderInsertSQL.append("INSERT INTO dc_pdd_orders");
|
||||
// orderInsertSQL.append(" SET ");
|
||||
// orderInsertSQL.append(" order_sn='"+tid+"'");
|
||||
// orderInsertSQL.append(",shopId="+shopId);
|
||||
// orderInsertSQL.append(",trade_type=0,");
|
||||
// orderInsertSQL.append(" confirm_status=0,");
|
||||
// orderInsertSQL.append(" free_sf=0,");
|
||||
// orderInsertSQL.append(" group_status=0,");
|
||||
// orderInsertSQL.append(" capital_free_discount=0.0,");
|
||||
// orderInsertSQL.append(" seller_discount=0.0,");
|
||||
// orderInsertSQL.append(" platform_discount=0.0,");
|
||||
// orderInsertSQL.append(" updated_at='"+DateUtil.getCurrentDateTime()+"'");
|
||||
// orderInsertSQL.append(",refund_status=0,");
|
||||
// orderInsertSQL.append(" is_lucky_flag=0,");
|
||||
// orderInsertSQL.append(" order_status=0,");
|
||||
// orderInsertSQL.append(" postage=0.0,");
|
||||
// orderInsertSQL.append(" discount_amount=0.0,");
|
||||
// orderInsertSQL.append(" goods_amount=0.0,");
|
||||
// orderInsertSQL.append(" pay_amount=0.0,");
|
||||
// orderInsertSQL.append(" after_sales_status=0,");
|
||||
// orderInsertSQL.append(" order_confirm_time=0, ");
|
||||
// orderInsertSQL.append(" auditStatus=-9 ");
|
||||
//
|
||||
// PreparedStatement pst = conn.prepareStatement(orderInsertSQL.toString(),Statement.RETURN_GENERATED_KEYS);
|
||||
// pst.executeUpdate();
|
||||
// ResultSet rs1 = pst.getGeneratedKeys();
|
||||
// Long orderId = 0l;
|
||||
// if(rs1.next()){
|
||||
// orderId= rs1.getLong(1);
|
||||
// }
|
||||
//
|
||||
//// int r = stmt.executeUpdate(orderInsertSQL.toString());
|
||||
//
|
||||
//// var result = orderPddService.insertOrderForMessage(shopId, tid);
|
||||
//
|
||||
// log.info("处理拼多多新订单消息:{tid:" + tid + ",id:" + orderId + "},添加成功");
|
||||
//
|
||||
// if(rs.isClosed()==false) rs.close();
|
||||
// if(rs1.isClosed()==false) rs1.close();
|
||||
// }
|
||||
//
|
||||
// }catch (Exception e){
|
||||
// log.info("处理拼多多新订单消息错误"+e.getMessage());
|
||||
// } finally {
|
||||
// try {
|
||||
// if(stmt!=null && stmt.isClosed()==false ) stmt.close();
|
||||
// if (conn != null && conn.isClosed()) conn.close();
|
||||
// }catch (Exception ee){}
|
||||
// }
|
||||
// }else if (message.getType().equals("pdd_refund_RefundBuyerReturnGoods")) {
|
||||
// log.info("----------------------------------------------------------");
|
||||
// log.info("接收到拼多多退货订单买家发货消息"+JSON.toJSONString(message));
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//// );
|
||||
//// WsClient ws = new WsClient(
|
||||
//// "wss://message-api.pinduoduo.com", clientId,
|
||||
//// clientSecret, new MessageHandler() {
|
||||
//// @Override
|
||||
//// public void onMessage(Message message) throws InterruptedException {
|
||||
//// log.info("接收拼多多消息中");
|
||||
//// try {
|
||||
//// //业务处理
|
||||
//// Long mallId = message.getMallID();
|
||||
////// String tid = message.getContent();
|
||||
////
|
||||
//// if(message.getType().equals("pdd_refund_RefundCreated")){
|
||||
//// //新退货订单
|
||||
//// log.info("接收到拼多多新退款:" + JSON.toJSONString(message));
|
||||
//// }
|
||||
////
|
||||
//// if(message.getType().equals("pdd_trade_TradeConfirmed")){
|
||||
//// //新退货订单
|
||||
//// log.info("接收到拼多多新订单:" + JSON.toJSONString(message));
|
||||
//// }
|
||||
////
|
||||
//// }catch (Exception e){
|
||||
//// log.info("异常");
|
||||
//// }
|
||||
//// }
|
||||
//// });
|
||||
//// ws.connect();
|
||||
//// ws.close();
|
||||
// Boolean isRu = PddWsClient.getInstance().getWsClient().isOnline();
|
||||
// if(isRu) return "OK";
|
||||
// else return "Error";
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @RequestMapping("/pddSocketClose")
|
||||
// @ResponseBody
|
||||
// public String pddSocketColse(Model model){
|
||||
// Boolean isRu = PddWsClient.getInstance().getWsClient().isOnline();
|
||||
// if(isRu) {
|
||||
// log.info("运行中,手动关闭");
|
||||
// PddWsClient.getInstance().getWsClient().close();
|
||||
// return "运行中,手动关闭";
|
||||
// }
|
||||
// else {
|
||||
// log.info("关闭中");
|
||||
// return "关闭中";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
|
@ -1,158 +0,0 @@
|
|||
package com.qihang.pdd.controller;//package com.qihang.erp.api.controller.pdd;
|
||||
//
|
||||
//import com.b2c.common.utils.DateUtil;
|
||||
//import com.b2c.oms.DataConfigObject;
|
||||
//import com.b2c.service.ExpressCompanyService;
|
||||
//import com.b2c.service.ShopService;
|
||||
//import com.b2c.service.oms.OrderPddRefundService;
|
||||
//import com.b2c.service.oms.OrderPddService;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Controller;
|
||||
//import org.springframework.ui.Model;
|
||||
//import org.springframework.util.StringUtils;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMethod;
|
||||
//import org.springframework.web.bind.annotation.RequestParam;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//
|
||||
///**
|
||||
// * 描述:
|
||||
// *
|
||||
// * @author qlp
|
||||
// * @date 2019-09-24 16:05
|
||||
// */
|
||||
//@RequestMapping("/pdd")
|
||||
//@Controller
|
||||
//public class RefundPddController {
|
||||
// @Autowired
|
||||
// private ShopService shopService;
|
||||
// @Autowired
|
||||
// private ExpressCompanyService expressCompanyService;
|
||||
// @Autowired
|
||||
// private OrderPddRefundService refundService;
|
||||
// @Autowired
|
||||
// private OrderPddService orderPddService;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 退货订单
|
||||
// *
|
||||
// * @param model
|
||||
// * @param request
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value = "/refund_list", method = RequestMethod.GET)
|
||||
// public String list(Model model, @RequestParam Integer shopId, HttpServletRequest request) {
|
||||
// //查询店铺信息
|
||||
// var shop = shopService.getShop(shopId);
|
||||
// model.addAttribute("shop",shop);
|
||||
// model.addAttribute("shopId",shopId);
|
||||
// Integer type = null;
|
||||
// if (!StringUtils.isEmpty(request.getParameter("type"))) {
|
||||
// try {
|
||||
// type = Integer.parseInt(request.getParameter("type"));
|
||||
// }catch (Exception e){}
|
||||
// }
|
||||
// model.addAttribute("menuId", "refund_list");
|
||||
// model.addAttribute("type", type);
|
||||
//
|
||||
// String page = request.getParameter("page");
|
||||
// Integer pageIndex = 1;
|
||||
// Integer pageSize = DataConfigObject.getInstance().getPageSize();
|
||||
//
|
||||
// Long refundId = 0l;
|
||||
// String orderNum = "";
|
||||
// String logisticsCode = "";//退货物流单号
|
||||
//
|
||||
// Integer startTime = 0;
|
||||
// Integer endTime = 0;
|
||||
//
|
||||
// Integer status = null;
|
||||
// Integer auditStatus = null;
|
||||
//
|
||||
// if (!StringUtils.isEmpty(page)) {
|
||||
// pageIndex = Integer.parseInt(page);
|
||||
// }
|
||||
//
|
||||
// if (!StringUtils.isEmpty(request.getParameter("orderNum"))) {
|
||||
// orderNum = request.getParameter("orderNum");
|
||||
// model.addAttribute("orderNum",orderNum);
|
||||
// }
|
||||
//
|
||||
// if (!StringUtils.isEmpty(request.getParameter("refundNum"))) {
|
||||
// refundId = Long.parseLong(request.getParameter("refundNum"));
|
||||
// model.addAttribute("refundNum",refundId);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (!StringUtils.isEmpty(request.getParameter("logisticsCode"))) {
|
||||
// logisticsCode = request.getParameter("logisticsCode");
|
||||
// model.addAttribute("logisticsCode",logisticsCode);
|
||||
// }
|
||||
//
|
||||
// if (!StringUtils.isEmpty(request.getParameter("status"))) {
|
||||
// status = Integer.parseInt(request.getParameter("status"));
|
||||
// model.addAttribute("status",status);
|
||||
// }
|
||||
// if (!StringUtils.isEmpty(request.getParameter("auditStatus"))) {
|
||||
// auditStatus = Integer.parseInt(request.getParameter("auditStatus"));
|
||||
// model.addAttribute("auditStatus",auditStatus);
|
||||
// }
|
||||
//
|
||||
// if (!StringUtils.isEmpty(request.getParameter("startTime"))) {
|
||||
// startTime = DateUtil.dateToStamp(request.getParameter("startTime"));
|
||||
// }
|
||||
// if (!StringUtils.isEmpty(request.getParameter("endTime"))) {
|
||||
// endTime = DateUtil.dateTimeToStamp(request.getParameter("endTime") + " 23:59:59");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// model.addAttribute("pageIndex", pageIndex);
|
||||
// model.addAttribute("pageSize", pageSize);
|
||||
// var result = refundService.getList(pageIndex, pageSize, refundId, orderNum, status,auditStatus,shopId,type,logisticsCode, startTime, endTime);
|
||||
// model.addAttribute("orderNum",orderNum);
|
||||
// model.addAttribute("totalSize", result.getTotalSize());
|
||||
// model.addAttribute("list", result.getList());
|
||||
//
|
||||
// model.addAttribute("company", expressCompanyService.getExpressCompany());
|
||||
//
|
||||
// return "v3/refund_list_pdd";
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 退货详情
|
||||
// *
|
||||
// * @param model
|
||||
// * @param id
|
||||
// * @param request
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value = "/refund_detail", method = RequestMethod.GET)
|
||||
// public String getOrderDetailYg(Model model, @RequestParam Long id, HttpServletRequest request) {
|
||||
// model.addAttribute("menuId", "refund_list");
|
||||
// var detail = refundService.getEntityById(id);
|
||||
//
|
||||
// if(detail == null) return "redirect:/pdd/refund_list";
|
||||
//
|
||||
// model.addAttribute("orderVo", detail);
|
||||
//
|
||||
// model.addAttribute("menuId", "refund_list");
|
||||
//
|
||||
// return "v3/refund_detail_pdd";
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value = "/apply_refund_pdd", method = RequestMethod.GET)
|
||||
// public String getOrderRefundOffline(Model model,@RequestParam Integer shopId, HttpServletRequest request) {
|
||||
// //查询订单信息
|
||||
// Long orderId = Long.parseLong(request.getParameter("id"));
|
||||
// var orderDetail = orderPddService.getOrderDetailAndItemsById(orderId);
|
||||
// model.addAttribute("menuId", "refund_list");
|
||||
// model.addAttribute("items", orderDetail.getItems());
|
||||
// model.addAttribute("orderId", orderId);
|
||||
// model.addAttribute("shopId", shopId);
|
||||
// return "v3/order_apply_refund_pdd";
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
package com.qihang.pdd.controller;
|
||||
|
||||
public class ShopApiParams {
|
||||
private String appKey;
|
||||
private String appSecret;
|
||||
private String accessToken;
|
||||
private String apiRequestUrl;
|
||||
private String tokenRequestUrl;
|
||||
|
||||
public String getTokenRequestUrl() {
|
||||
return tokenRequestUrl;
|
||||
}
|
||||
|
||||
public void setTokenRequestUrl(String tokenRequestUrl) {
|
||||
this.tokenRequestUrl = tokenRequestUrl;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public String getApiRequestUrl() {
|
||||
return apiRequestUrl;
|
||||
}
|
||||
|
||||
public void setApiRequestUrl(String apiRequestUrl) {
|
||||
this.apiRequestUrl = apiRequestUrl;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.qihang.pdd.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pdd商品表
|
||||
* @TableName oms_pdd_goods
|
||||
*/
|
||||
@Data
|
||||
public class OmsPddGoods implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
private Long goodsId;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String goodsName;
|
||||
|
||||
/**
|
||||
* 商品总数量
|
||||
*/
|
||||
private Long goodsQuantity;
|
||||
|
||||
/**
|
||||
* 是否多sku,0-单sku,1-多sku
|
||||
*/
|
||||
private Integer isMoreSku;
|
||||
|
||||
/**
|
||||
* 是否在架上,0-下架中,1-架上
|
||||
*/
|
||||
private Integer isOnsale;
|
||||
|
||||
/**
|
||||
* 商品缩略图
|
||||
*/
|
||||
private String thumbUrl;
|
||||
|
||||
/**
|
||||
* 商品创建时间的时间戳
|
||||
*/
|
||||
private Long createdAt;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* erp商品id
|
||||
*/
|
||||
private Long erpGoodsId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
@TableField(exist = false)
|
||||
private List<OmsPddGoodsSku> skuList;
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.qihang.pdd.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pdd商品SKU表
|
||||
* @TableName oms_pdd_goods_sku
|
||||
*/
|
||||
@Data
|
||||
public class OmsPddGoodsSku implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* sku编码
|
||||
*/
|
||||
private Long skuId;
|
||||
|
||||
/**
|
||||
* pdd商品编码
|
||||
*/
|
||||
private Long goodsId;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String goodsName;
|
||||
|
||||
/**
|
||||
* 商品缩略图
|
||||
*/
|
||||
private String thumbUrl;
|
||||
|
||||
/**
|
||||
* 商家外部编码(sku)
|
||||
*/
|
||||
private String outerId;
|
||||
|
||||
/**
|
||||
* sku库存
|
||||
*/
|
||||
private Long skuQuantity;
|
||||
|
||||
/**
|
||||
* 规格名称
|
||||
*/
|
||||
private String spec;
|
||||
|
||||
/**
|
||||
* sku是否在架上,0-下架中,1-架上
|
||||
*/
|
||||
private Integer isSkuOnsale;
|
||||
|
||||
/**
|
||||
* 商品id(o_goods外键)
|
||||
*/
|
||||
private Long erpGoodsId;
|
||||
|
||||
/**
|
||||
* 商品skuid(o_goods_sku外键)
|
||||
*/
|
||||
private Long erpGoodsSkuId;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.qihang.pdd.mapper;
|
||||
|
||||
import com.qihang.pdd.domain.OmsPddGoods;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_pdd_goods(pdd商品表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-11 14:16:55
|
||||
* @Entity com.qihang.pdd.domain.OmsPddGoods
|
||||
*/
|
||||
public interface OmsPddGoodsMapper extends BaseMapper<OmsPddGoods> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.qihang.pdd.mapper;
|
||||
|
||||
import com.qihang.pdd.domain.OmsPddGoodsSku;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_pdd_goods_sku(pdd商品SKU表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-11 14:16:55
|
||||
* @Entity com.qihang.pdd.domain.OmsPddGoodsSku
|
||||
*/
|
||||
public interface OmsPddGoodsSkuMapper extends BaseMapper<OmsPddGoodsSku> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.qihang.pdd.openapi;
|
||||
|
||||
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.pdd.domain.SShopPlatform;
|
||||
import com.qihang.pdd.service.SShopPlatformService;
|
||||
import com.qihang.pdd.service.SShopService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Component
|
||||
public class ApiCommon {
|
||||
private final SShopService shopService;
|
||||
private final SShopPlatformService platformService;
|
||||
// private final ServerConfig serverConfig;
|
||||
/**
|
||||
* 更新前的检查
|
||||
*
|
||||
* @param shopId
|
||||
* @return
|
||||
* @throws
|
||||
*/
|
||||
public ResultVo<ShopApiParams> checkBefore(Long shopId) {
|
||||
var shop = shopService.selectShopById(shopId);
|
||||
if (shop == null) {
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "参数错误,没有找到店铺");
|
||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "参数错误,没有找到店铺");
|
||||
}
|
||||
|
||||
if (shop.getPlatform() != EnumShopType.PDD.getIndex()) {
|
||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "参数错误,店铺不是PDD店铺");
|
||||
}
|
||||
SShopPlatform platform = platformService.getById(EnumShopType.PDD.getIndex());
|
||||
|
||||
if (!StringUtils.hasText(platform.getAppKey())) {
|
||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "平台配置错误,没有找到AppKey");
|
||||
}
|
||||
if (!StringUtils.hasText(platform.getAppSecret())) {
|
||||
return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到AppSecret");
|
||||
}
|
||||
// if (!StringUtils.hasText(platform.getRedirectUri())) {
|
||||
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到RedirectUri");
|
||||
// }
|
||||
// if (!StringUtils.hasText(platform.getServerUrl())) {
|
||||
// return ResultVo.error(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到ServerUrl");
|
||||
// }
|
||||
|
||||
// if(shop.getSellerId() == null || shop.getSellerId() <= 0) {
|
||||
// return com.qihang.tao.common.ApiResult.build(HttpStatus.PARAMS_ERROR, "第三方平台配置错误,没有找到SellerUserId");
|
||||
// }
|
||||
|
||||
ShopApiParams params = new ShopApiParams();
|
||||
params.setAppKey(platform.getAppKey());
|
||||
params.setAppSecret(platform.getAppSecret());
|
||||
params.setAccessToken(shop.getAccessToken());
|
||||
// params.setTokenRequestUrl(platform.getRedirectUri());
|
||||
// params.setApiRequestUrl(platform.getServerUrl());
|
||||
// params.setServerUrl(platform.getServerUrl());
|
||||
params.setSellerId(shop.getSellerShopId().toString());
|
||||
if (!StringUtils.hasText(shop.getAccessToken())) {
|
||||
|
||||
return ResultVo.error(HttpStatus.UNAUTHORIZED1, "Token已过期,请重新授权", params);
|
||||
}
|
||||
return ResultVo.success(HttpStatus.SUCCESS, params);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.qihang.pdd.openapi;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PullRequest {
|
||||
private Long shopId;//店铺Id
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.qihang.pdd.service;
|
||||
|
||||
import com.qihang.common.common.PageQuery;
|
||||
import com.qihang.common.common.PageResult;
|
||||
import com.qihang.pdd.domain.OmsPddGoods;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_pdd_goods(pdd商品表)】的数据库操作Service
|
||||
* @createDate 2024-06-11 14:16:55
|
||||
*/
|
||||
public interface OmsPddGoodsService extends IService<OmsPddGoods> {
|
||||
PageResult<OmsPddGoods> queryPageList(OmsPddGoods bo, PageQuery pageQuery);
|
||||
|
||||
int saveAndUpdateGoods(Long shopId,OmsPddGoods goods);
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.qihang.pdd.service;
|
||||
|
||||
import com.qihang.common.common.PageQuery;
|
||||
import com.qihang.common.common.PageResult;
|
||||
import com.qihang.pdd.domain.OmsPddGoodsSku;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_pdd_goods_sku(pdd商品SKU表)】的数据库操作Service
|
||||
* @createDate 2024-06-11 14:16:55
|
||||
*/
|
||||
public interface OmsPddGoodsSkuService extends IService<OmsPddGoodsSku> {
|
||||
PageResult<OmsPddGoodsSku> queryPageList(OmsPddGoodsSku bo, PageQuery pageQuery);
|
||||
}
|
||||
|
|
@ -9,6 +9,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
* @createDate 2024-06-04 15:29:29
|
||||
*/
|
||||
public interface SShopService extends IService<SShop> {
|
||||
SShop selectShopById(Integer shopId);
|
||||
SShop selectShopById(Long shopId);
|
||||
void updateSessionKey(Integer shopId, String ownerId, String sessionKey, String refreshToken, Long expiresIn);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,104 @@
|
|||
package com.qihang.pdd.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.common.common.PageQuery;
|
||||
import com.qihang.common.common.PageResult;
|
||||
import com.qihang.common.common.ResultVoEnum;
|
||||
import com.qihang.pdd.domain.OmsPddGoods;
|
||||
import com.qihang.pdd.domain.OmsPddGoodsSku;
|
||||
import com.qihang.pdd.mapper.OmsPddGoodsSkuMapper;
|
||||
import com.qihang.pdd.service.OmsPddGoodsService;
|
||||
import com.qihang.pdd.mapper.OmsPddGoodsMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_pdd_goods(pdd商品表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-11 14:16:55
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class OmsPddGoodsServiceImpl extends ServiceImpl<OmsPddGoodsMapper, OmsPddGoods>
|
||||
implements OmsPddGoodsService{
|
||||
private final OmsPddGoodsMapper mapper;
|
||||
private final OmsPddGoodsSkuMapper skuMapper;
|
||||
@Override
|
||||
public PageResult<OmsPddGoods> queryPageList(OmsPddGoods bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OmsPddGoods> queryWrapper = new LambdaQueryWrapper<OmsPddGoods>()
|
||||
.eq(bo.getShopId()!=null,OmsPddGoods::getShopId,bo.getShopId());
|
||||
|
||||
Page<OmsPddGoods> goodsPage = mapper.selectPage(pageQuery.build(), queryWrapper);
|
||||
return PageResult.build(goodsPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveAndUpdateGoods(Long shopId, OmsPddGoods goods) {
|
||||
List<OmsPddGoods> goodsList = mapper.selectList(new LambdaQueryWrapper<OmsPddGoods>().eq(OmsPddGoods::getGoodsId, goods.getGoodsId()));
|
||||
if(goodsList!=null && goodsList.size()>0){
|
||||
// 存在,更新
|
||||
goods.setShopId(shopId);
|
||||
goods.setId(goodsList.get(0).getId());
|
||||
goods.setUpdateTime(new Date());
|
||||
mapper.updateById(goods);
|
||||
|
||||
// 删除sku
|
||||
skuMapper.delete(new LambdaQueryWrapper<OmsPddGoodsSku>().eq(OmsPddGoodsSku::getGoodsId,goods.getGoodsId()));
|
||||
|
||||
// 重新插入sku
|
||||
if(goods.getSkuList()!=null) {
|
||||
for (var sku : goods.getSkuList()) {
|
||||
sku.setShopId(shopId);
|
||||
sku.setGoodsId(goods.getGoodsId());
|
||||
sku.setThumbUrl(goods.getThumbUrl());
|
||||
sku.setGoodsName(goods.getGoodsName());
|
||||
// 根据OuterId查找ERP系统中的skuid
|
||||
// if(StringUtils.isNotEmpty(sku.getOuterId())) {
|
||||
// ErpGoodsSpecVo erpGoodsSpecVo = skuMapper.selectGoodsSpecBySpecNum(sku.getOuterId());
|
||||
// if(erpGoodsSpecVo!=null ){
|
||||
// sku.setErpGoodsId(erpGoodsSpecVo.getGoodsId());
|
||||
// sku.setErpGoodsSkuId(erpGoodsSpecVo.getId());
|
||||
//// sku.setErpSupplierId(erpGoodsSpecVo.getSupplierId());
|
||||
// }
|
||||
// }
|
||||
skuMapper.insert(sku);
|
||||
}
|
||||
}
|
||||
return ResultVoEnum.DataExist.getIndex();
|
||||
}else {
|
||||
// 不存在,新增
|
||||
goods.setShopId(shopId);
|
||||
goods.setCreateTime(new Date());
|
||||
mapper.insert(goods);
|
||||
// 插入sku
|
||||
if(goods.getSkuList()!=null) {
|
||||
for (var sku : goods.getSkuList()) {
|
||||
sku.setShopId(shopId);
|
||||
sku.setGoodsId(goods.getGoodsId());
|
||||
sku.setThumbUrl(goods.getThumbUrl());
|
||||
sku.setGoodsName(goods.getGoodsName());
|
||||
// 根据OuterId查找ERP系统中的skuid
|
||||
// if(StringUtils.isNotEmpty(sku.getOuterId())) {
|
||||
// ErpGoodsSpecVo erpGoodsSpecVo = skuMapper.selectGoodsSpecBySpecNum(sku.getOuterId());
|
||||
// if(erpGoodsSpecVo!=null ){
|
||||
// sku.setErpGoodsId(erpGoodsSpecVo.getGoodsId());
|
||||
// sku.setErpGoodsSkuId(erpGoodsSpecVo.getId());
|
||||
//// sku.setErpSupplierId(erpGoodsSpecVo.getSupplierId());
|
||||
// }
|
||||
// }
|
||||
skuMapper.insert(sku);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.qihang.pdd.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.common.common.PageQuery;
|
||||
import com.qihang.common.common.PageResult;
|
||||
import com.qihang.pdd.domain.OmsPddGoodsSku;
|
||||
import com.qihang.pdd.service.OmsPddGoodsSkuService;
|
||||
import com.qihang.pdd.mapper.OmsPddGoodsSkuMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_pdd_goods_sku(pdd商品SKU表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-11 14:16:55
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class OmsPddGoodsSkuServiceImpl extends ServiceImpl<OmsPddGoodsSkuMapper, OmsPddGoodsSku>
|
||||
implements OmsPddGoodsSkuService{
|
||||
private final OmsPddGoodsSkuMapper mapper;
|
||||
|
||||
@Override
|
||||
public PageResult<OmsPddGoodsSku> queryPageList(OmsPddGoodsSku bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OmsPddGoodsSku> queryWrapper = new LambdaQueryWrapper<OmsPddGoodsSku>()
|
||||
.eq(bo.getShopId()!=null,OmsPddGoodsSku::getShopId,bo.getShopId());
|
||||
|
||||
Page<OmsPddGoodsSku> goodsSkuPage = mapper.selectPage(pageQuery.build(), queryWrapper);
|
||||
return PageResult.build(goodsSkuPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ public class SShopServiceImpl extends ServiceImpl<SShopMapper, SShop>
|
|||
implements SShopService{
|
||||
private SShopMapper mapper;
|
||||
@Override
|
||||
public SShop selectShopById(Integer shopId) {
|
||||
public SShop selectShopById(Long shopId) {
|
||||
return mapper.selectById(shopId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<?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.OmsPddGoodsMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.pdd.domain.OmsPddGoods">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="goodsId" column="goods_id" jdbcType="BIGINT"/>
|
||||
<result property="goodsName" column="goods_name" jdbcType="VARCHAR"/>
|
||||
<result property="goodsQuantity" column="goods_quantity" jdbcType="BIGINT"/>
|
||||
<result property="isMoreSku" column="is_more_sku" jdbcType="INTEGER"/>
|
||||
<result property="isOnsale" column="is_onsale" jdbcType="INTEGER"/>
|
||||
<result property="thumbUrl" column="thumb_url" jdbcType="VARCHAR"/>
|
||||
<result property="createdAt" column="created_at" jdbcType="BIGINT"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="erpGoodsId" column="erp_goods_id" 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,goods_id,goods_name,
|
||||
goods_quantity,is_more_sku,is_onsale,
|
||||
thumb_url,created_at,shop_id,
|
||||
erp_goods_id,create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?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.OmsPddGoodsSkuMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.pdd.domain.OmsPddGoodsSku">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="skuId" column="sku_id" jdbcType="BIGINT"/>
|
||||
<result property="goodsId" column="goods_id" jdbcType="BIGINT"/>
|
||||
<result property="goodsName" column="goods_name" jdbcType="VARCHAR"/>
|
||||
<result property="thumbUrl" column="thumb_url" jdbcType="VARCHAR"/>
|
||||
<result property="outerId" column="outer_id" jdbcType="VARCHAR"/>
|
||||
<result property="skuQuantity" column="sku_quantity" jdbcType="BIGINT"/>
|
||||
<result property="spec" column="spec" jdbcType="VARCHAR"/>
|
||||
<result property="isSkuOnsale" column="is_sku_onsale" jdbcType="INTEGER"/>
|
||||
<result property="erpGoodsId" column="erp_goods_id" jdbcType="BIGINT"/>
|
||||
<result property="erpGoodsSkuId" column="erp_goods_sku_id" jdbcType="BIGINT"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,sku_id,goods_id,
|
||||
goods_name,thumb_url,outer_id,
|
||||
sku_quantity,spec,is_sku_onsale,
|
||||
erp_goods_id,erp_goods_sku_id,shop_id,
|
||||
create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||
// 查询列表
|
||||
export function listGoodsSku(query) {
|
||||
return request({
|
||||
url: '/pdd-api/goods/skuList',
|
||||
url: '/api/pdd-api/goods/skuList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
|
@ -12,7 +12,7 @@ export function listGoodsSku(query) {
|
|||
|
||||
export function getGoodsSku(id) {
|
||||
return request({
|
||||
url: '/pdd-api/goods/sku/'+id,
|
||||
url: '/api/pdd-api/goods/sku/'+id,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
|
@ -20,16 +20,16 @@ export function getGoodsSku(id) {
|
|||
|
||||
export function linkErpGoodsSkuId(data) {
|
||||
return request({
|
||||
url: '/pdd-api/goods/sku/linkErp',
|
||||
url: '/api/pdd-api/goods/sku/linkErp',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 接口拉取淘宝商品
|
||||
// 接口拉取商品
|
||||
export function pullGoodsList(data) {
|
||||
return request({
|
||||
url: '/pdd-api/goods/pull_goods',
|
||||
url: '/api/pdd-api/goods/pull_goods',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
|
|
|
|||
|
|
@ -55,17 +55,17 @@
|
|||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="goodsList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" :data="goodsList" >
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<!-- <el-table-column label="ID" align="center" prop="id" />-->
|
||||
<el-table-column label="商品ID" align="center" prop="wareId" />
|
||||
<el-table-column label="Sku Id" align="center" prop="skuId" />
|
||||
<el-table-column label="sku名称" align="center" prop="skuName" />
|
||||
<el-table-column label="图片" align="center" prop="logo" width="100">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.logo" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="图片" align="center" prop="logo" width="100">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <image-preview :src="scope.row.logo" :width="50" :height="50"/>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
|
||||
<!-- <el-table-column label="店铺" align="center" prop="categoryId" >-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="goodsList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" :data="goodsList">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<!-- <el-table-column label="ID" align="center" prop="id" />-->
|
||||
<el-table-column label="商品ID" align="center" prop="goodsId" />
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商家编码" align="center" prop="outerId" />
|
||||
|
||||
<el-table-column label="ERP SKU ID" align="center" prop="erpGoodsSkuId" />
|
||||
<el-table-column label="状态" align="center" prop="isSkuOnsale" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.isSkuOnsale === 1">上架中</el-tag>
|
||||
|
|
@ -106,8 +106,8 @@
|
|||
<!-- 添加或修改商品管理对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="ERP商品SkuId" prop="erpSkuId">
|
||||
<el-input v-model.number="form.erpSkuId" placeholder="请输入ERP商品SkuId" />
|
||||
<el-form-item label="ERP商品SkuId" prop="erpGoodsSkuId">
|
||||
<el-input v-model.number="form.erpGoodsSkuId" placeholder="请输入ERP商品SkuId" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
|
||||
import {listShop} from "@/api/shop/shop";
|
||||
import {listGoodsSku,pullGoodsList} from "@/api/pdd/goods";
|
||||
import {listGoodsSku,pullGoodsList,getGoodsSku,linkErpGoodsSkuId} from "@/api/pdd/goods";
|
||||
|
||||
import {MessageBox} from "element-ui";
|
||||
import {isRelogin} from "@/utils/request";
|
||||
|
|
@ -168,7 +168,7 @@ export default {
|
|||
id: [
|
||||
{ required: true, message: "不能为空", trigger: "change" }
|
||||
],
|
||||
erpSkuId: [
|
||||
erpGoodsSkuId: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue