|
@@ -3,6 +3,8 @@ package com.iotechn.unimall.admin.api.shop.impl;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+
|
|
|
|
+import com.baidu.ccc.auth.api.token.ApiTokenV1;
|
|
import com.dangdang.openplatform.openapi.sdk.ApiException;
|
|
import com.dangdang.openplatform.openapi.sdk.ApiException;
|
|
import com.dangdang.openplatform.openapi.sdk.SdkClient;
|
|
import com.dangdang.openplatform.openapi.sdk.SdkClient;
|
|
import com.dangdang.openplatform.openapi.sdk.internal.util.FileItem;
|
|
import com.dangdang.openplatform.openapi.sdk.internal.util.FileItem;
|
|
@@ -16,7 +18,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.iotechn.unimall.data.domain.shop.ShopAccount;
|
|
import com.iotechn.unimall.data.domain.shop.ShopAccount;
|
|
import com.iotechn.unimall.data.domain.shop.ShopLog;
|
|
import com.iotechn.unimall.data.domain.shop.ShopLog;
|
|
import com.iotechn.unimall.data.domain.shop.ShopTran;
|
|
import com.iotechn.unimall.data.domain.shop.ShopTran;
|
|
-import com.iotechn.unimall.data.dto.shop.FuziDTO;
|
|
|
|
import com.iotechn.unimall.data.dto.shop.ShopDTO;
|
|
import com.iotechn.unimall.data.dto.shop.ShopDTO;
|
|
import com.iotechn.unimall.data.dto.shop.XmlObject.OrderDetail;
|
|
import com.iotechn.unimall.data.dto.shop.XmlObject.OrderDetail;
|
|
import com.iotechn.unimall.data.dto.shop.XmlObject.SendGood;
|
|
import com.iotechn.unimall.data.dto.shop.XmlObject.SendGood;
|
|
@@ -25,14 +26,9 @@ import com.iotechn.unimall.data.mapper.shop.ShopAccountMapper;
|
|
import com.iotechn.unimall.data.mapper.shop.ShopLogMapper;
|
|
import com.iotechn.unimall.data.mapper.shop.ShopLogMapper;
|
|
import com.iotechn.unimall.data.mapper.shop.ShopTranMapper;
|
|
import com.iotechn.unimall.data.mapper.shop.ShopTranMapper;
|
|
import com.iotechn.unimall.data.util.XMLUtil;
|
|
import com.iotechn.unimall.data.util.XMLUtil;
|
|
-import org.apache.commons.httpclient.Cookie;
|
|
|
|
-import org.apache.commons.httpclient.HttpClient;
|
|
|
|
-import org.apache.commons.httpclient.NameValuePair;
|
|
|
|
-import org.apache.commons.httpclient.cookie.CookiePolicy;
|
|
|
|
-import org.apache.commons.httpclient.methods.GetMethod;
|
|
|
|
-import org.apache.commons.httpclient.methods.PostMethod;
|
|
|
|
import org.apache.http.HttpResponse;
|
|
import org.apache.http.HttpResponse;
|
|
import org.apache.http.HttpStatus;
|
|
import org.apache.http.HttpStatus;
|
|
|
|
+import org.apache.http.client.HttpClient;
|
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
|
import org.apache.http.client.methods.HttpGet;
|
|
import org.apache.http.client.methods.HttpGet;
|
|
@@ -90,15 +86,15 @@ public class ShopOrderServiceImpl implements IShopOrderService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Page<ShopOrder> list(Long accountId, String orderId, String dangOrder,String dangOrderStatus, String address, String provName, String cityName, String areaName, String orderStatus, String orderStatusName, String payStatus, String payName, String receiverName, String mobile, String receiver, Integer deleteFlag, Date gmtCreate, Date gmtUpdate, Long userId, Long adminId,String shopName, Integer page, Integer limit) throws ServiceException {
|
|
|
|
|
|
+ public Page<ShopOrder> list(Long accountId, String orderId, String dangOrder, String dangOrderStatus, String address, String provName, String cityName, String areaName, String orderStatus, String orderStatusName, String payStatus, String payName, String receiverName, String mobile, String receiver, Integer deleteFlag, Date gmtCreate, Date gmtUpdate, Long userId, Long adminId, String shopName, Integer page, Integer limit) throws ServiceException {
|
|
Wrapper<ShopOrder> wrapper = new EntityWrapper<ShopOrder>();
|
|
Wrapper<ShopOrder> wrapper = new EntityWrapper<ShopOrder>();
|
|
List<Long> param = new ArrayList<>();
|
|
List<Long> param = new ArrayList<>();
|
|
- if(!StringUtils.isEmpty(shopName)){
|
|
|
|
|
|
+ if (!StringUtils.isEmpty(shopName)) {
|
|
Wrapper<ShopAccount> wrapper1 = new EntityWrapper<ShopAccount>();
|
|
Wrapper<ShopAccount> wrapper1 = new EntityWrapper<ShopAccount>();
|
|
- wrapper1.like("dang_name",shopName);
|
|
|
|
|
|
+ wrapper1.like("dang_name", shopName);
|
|
List<ShopAccount> list = shopAccountMapper.selectList(wrapper1);
|
|
List<ShopAccount> list = shopAccountMapper.selectList(wrapper1);
|
|
- for (ShopAccount shopAccount:list
|
|
|
|
- ) {
|
|
|
|
|
|
+ for (ShopAccount shopAccount : list
|
|
|
|
+ ) {
|
|
param.add(shopAccount.getId());
|
|
param.add(shopAccount.getId());
|
|
}
|
|
}
|
|
wrapper.in("account_id", param);
|
|
wrapper.in("account_id", param);
|
|
@@ -161,10 +157,10 @@ public class ShopOrderServiceImpl implements IShopOrderService {
|
|
wrapper.like("dang_order_status", dangOrderStatus);
|
|
wrapper.like("dang_order_status", dangOrderStatus);
|
|
}
|
|
}
|
|
wrapper.eq("delete_flag", 0);
|
|
wrapper.eq("delete_flag", 0);
|
|
- wrapper.orderBy("created_time",false);
|
|
|
|
|
|
+ wrapper.orderBy("created_time", false);
|
|
List<ShopOrder> list = shopOrderMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
|
|
List<ShopOrder> list = shopOrderMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
|
|
- for (ShopOrder shopOrder: list
|
|
|
|
- ) {
|
|
|
|
|
|
+ for (ShopOrder shopOrder : list
|
|
|
|
+ ) {
|
|
ShopAccount shopAccount = shopAccountMapper.selectById(shopOrder.getAccountId());
|
|
ShopAccount shopAccount = shopAccountMapper.selectById(shopOrder.getAccountId());
|
|
shopOrder.setShopAccount(shopAccount);
|
|
shopOrder.setShopAccount(shopAccount);
|
|
}
|
|
}
|
|
@@ -266,65 +262,63 @@ public class ShopOrderServiceImpl implements IShopOrderService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public String syncOrderInfoList(ShopDTO shopDTO) throws Exception {
|
|
public String syncOrderInfoList(ShopDTO shopDTO) throws Exception {
|
|
- for (ShopDTO tmp:shopDTO.getShopDTOS()
|
|
|
|
- ) {
|
|
|
|
- syncOrderInfo(tmp.getOrderId(),tmp.getDangId(),tmp.getDangOrder());
|
|
|
|
|
|
+ for (ShopDTO tmp : shopDTO.getShopDTOS()
|
|
|
|
+ ) {
|
|
|
|
+ syncOrderInfo(tmp.getOrderId(), tmp.getDangId(), tmp.getDangOrder());
|
|
}
|
|
}
|
|
return "ok";
|
|
return "ok";
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public ShopOrder syncOrderInfo(String orderId,String dangId,String dangOrder) throws Exception {
|
|
|
|
- try{
|
|
|
|
|
|
+ public ShopOrder syncOrderInfo(String orderId, String dangId, String dangOrder) throws Exception {
|
|
|
|
+ try {
|
|
|
|
|
|
ShopAccount shopAccount = new ShopAccount();
|
|
ShopAccount shopAccount = new ShopAccount();
|
|
- if(dangId != null){
|
|
|
|
|
|
+ if (dangId != null) {
|
|
shopAccount.setDangId(dangId);
|
|
shopAccount.setDangId(dangId);
|
|
}
|
|
}
|
|
- // if(fuziId != null){
|
|
|
|
- // shopAccount.setFuziId(fuziId);
|
|
|
|
- // }
|
|
|
|
|
|
+ // if(fuziId != null){
|
|
|
|
+ // shopAccount.setFuziId(fuziId);
|
|
|
|
+ // }
|
|
shopAccount = shopAccountMapper.selectOne(shopAccount);
|
|
shopAccount = shopAccountMapper.selectOne(shopAccount);
|
|
flushCookie(shopAccount);
|
|
flushCookie(shopAccount);
|
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
- HttpGet get = new HttpGet("https://shop.kongfz.com/buyer/order/getOrderInfo/?orderId="+orderId);
|
|
|
|
|
|
+ HttpGet get = new HttpGet("https://shop.kongfz.com/buyer/order/getOrderInfo/?orderId=" + orderId);
|
|
//这里可以设置请求参数,token等
|
|
//这里可以设置请求参数,token等
|
|
get.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
|
|
get.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
|
|
- get.addHeader("cookie",shopAccount.getFuziCookie());
|
|
|
|
|
|
+ get.addHeader("cookie", shopAccount.getFuziCookie());
|
|
HttpResponse response = httpClient.execute(get);//执行获取响应
|
|
HttpResponse response = httpClient.execute(get);//执行获取响应
|
|
- if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){//根据状态码处理
|
|
|
|
|
|
+ if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {//根据状态码处理
|
|
//返回字符串
|
|
//返回字符串
|
|
- String res = unicodeToString(EntityUtils.toString(response.getEntity(),"UTF-8"));
|
|
|
|
|
|
+ String res = unicodeToString(EntityUtils.toString(response.getEntity(), "UTF-8"));
|
|
System.out.println(res);
|
|
System.out.println(res);
|
|
JSONObject datas = JSONObject.parseObject(res);//转换成JSON格式
|
|
JSONObject datas = JSONObject.parseObject(res);//转换成JSON格式
|
|
Boolean status = (Boolean) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取
|
|
Boolean status = (Boolean) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取
|
|
- ShopOrder data = JSONObject.parseObject(datas.get("data").toString(),ShopOrder.class);//"data"是根据返回值设定
|
|
|
|
|
|
+ ShopOrder data = JSONObject.parseObject(datas.get("data").toString(), ShopOrder.class);//"data"是根据返回值设定
|
|
ShopOrder tmp = new ShopOrder();
|
|
ShopOrder tmp = new ShopOrder();
|
|
tmp.setOrderId(data.getOrderId());
|
|
tmp.setOrderId(data.getOrderId());
|
|
tmp = shopOrderMapper.selectOne(tmp);
|
|
tmp = shopOrderMapper.selectOne(tmp);
|
|
data.setAccountId(shopAccount.getId());
|
|
data.setAccountId(shopAccount.getId());
|
|
- if(tmp == null){
|
|
|
|
|
|
+ if (tmp == null) {
|
|
data.setDangOrder(dangOrder);
|
|
data.setDangOrder(dangOrder);
|
|
data.setGmtCreate(new Date());
|
|
data.setGmtCreate(new Date());
|
|
data.setGmtUpdate(new Date());
|
|
data.setGmtUpdate(new Date());
|
|
shopOrderMapper.insert(data);
|
|
shopOrderMapper.insert(data);
|
|
- }
|
|
|
|
- else{
|
|
|
|
|
|
+ } else {
|
|
data.setDangOrder(dangOrder);
|
|
data.setDangOrder(dangOrder);
|
|
data.setGmtUpdate(new Date());
|
|
data.setGmtUpdate(new Date());
|
|
- shopOrderMapper.update(data,new EntityWrapper<ShopOrder>().eq("order_id",tmp.getOrderId()));
|
|
|
|
|
|
+ shopOrderMapper.update(data, new EntityWrapper<ShopOrder>().eq("order_id", tmp.getOrderId()));
|
|
}
|
|
}
|
|
tmp = new ShopOrder();
|
|
tmp = new ShopOrder();
|
|
tmp.setOrderId(data.getOrderId());
|
|
tmp.setOrderId(data.getOrderId());
|
|
tmp = shopOrderMapper.selectOne(tmp);
|
|
tmp = shopOrderMapper.selectOne(tmp);
|
|
- if(tmp.getOrderStatusName().equals("卖家已发货")&&tmp.getDangOrderStatus().equals("未发货")){
|
|
|
|
|
|
+ if (tmp.getOrderStatusName().equals("卖家已发货") && tmp.getDangOrderStatus().equals("未发货")) {
|
|
//调用当当API 更新发货状态
|
|
//调用当当API 更新发货状态
|
|
- dangOrderDeal(shopAccount,tmp);
|
|
|
|
|
|
+ dangOrderDeal(shopAccount, tmp);
|
|
}
|
|
}
|
|
return tmp;
|
|
return tmp;
|
|
- }
|
|
|
|
- else{
|
|
|
|
|
|
+ } else {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -339,40 +333,100 @@ public class ShopOrderServiceImpl implements IShopOrderService {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- public void flushCookie(ShopAccount shopAccount){
|
|
|
|
- try{
|
|
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ShopOrder callPhone(String mobile) throws Exception {
|
|
|
|
+
|
|
|
|
+ ApiTokenV1.ApiAuthTokenV1Builder builder = new ApiTokenV1.ApiAuthTokenV1Builder();
|
|
|
|
+ // 必填参数 ak,sk,uri,host,http method, 过期时间
|
|
|
|
+ builder.ak("346da55bb3c248ea84e39b5913939f05"); // ak
|
|
|
|
+ builder.sk("0628356ece284d87935f73017af1c0ce"); // sk
|
|
|
|
+ builder.uri("/api/v3/console/realtime/status/create"); // 接口路径
|
|
|
|
+ builder.host("aicc.bce.baidu.com"); // host
|
|
|
|
+ builder.httpMethod("POST"); // http method
|
|
|
|
+ builder.expireInSeconds(1800); // 过期时间
|
|
|
|
+
|
|
|
|
+ // 以下是非必须参数
|
|
|
|
+ // 参与生成token的请求头, 此处若使用了x-bce-date,则调用外呼api接口时,请求头内必需带上x-bce-date
|
|
|
|
+// HashMap<String, String> headerMap = new HashMap<String, String>();
|
|
|
|
+// headerMap.put("x-bce-date", "2022-06-17T08:40:14Z");
|
|
|
|
+// builder.httpHeaderMap(headerMap);
|
|
|
|
+ builder.httpHeader("Content-Type", "application/json");
|
|
|
|
+ builder.httpHeader("Authorization", builder.build().getToken());
|
|
|
|
+ // url里?带的参数,如/api/v1/robot/list?robotName=test, 没有?参数可以不调用此方法
|
|
|
|
+ builder.queryStr("robotId=b304c245-ec71-40ef-b7b8-c94e6874e8ed&mobile="+mobile+"&secretType=2");
|
|
|
|
+
|
|
|
|
+ System.out.println(builder.build().getToken());
|
|
|
|
+ String token = builder.build().getToken();
|
|
|
|
+ System.out.println("token=" + token);
|
|
|
|
+ // 登陆 Url
|
|
|
|
+ String loginUrl = "https://aicc.bce.baidu.com/api/v3/console/realtime/status/create";
|
|
|
|
+ CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
|
+ // 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
|
|
|
|
+ HttpPost httpPost = new HttpPost(loginUrl);
|
|
|
|
+ // 装填参数
|
|
|
|
+ List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>();
|
|
|
|
+ nvps.add(new BasicNameValuePair("robotId", "b304c245-ec71-40ef-b7b8-c94e6874e8ed"));
|
|
|
|
+ nvps.add(new BasicNameValuePair("mobile", mobile));
|
|
|
|
+ nvps.add(new BasicNameValuePair("secretType", "2"));
|
|
|
|
+ // 设置参数到请求对象中
|
|
|
|
+ httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));
|
|
|
|
+
|
|
|
|
+ // 设置header信息
|
|
|
|
+ // 指定报文头【Content-type】、【User-Agent】
|
|
|
|
+ httpPost.setHeader("Content-type", "application/json");
|
|
|
|
+ httpPost.setHeader("Authorization", token);
|
|
|
|
+ httpPost.setHeader("x-bce-date", "2022-06-17T08:40:14Z");
|
|
|
|
+
|
|
|
|
+ // 执行请求操作,并拿到结果(同步阻塞)
|
|
|
|
+ CloseableHttpResponse response = httpClient.execute(httpPost);
|
|
|
|
+ try {
|
|
|
|
+ if (response.getStatusLine().getStatusCode() == 302) {
|
|
|
|
+ }
|
|
|
|
+ System.out.println(EntityUtils.toString(response.getEntity(), "UTF-8"));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ // 释放链接
|
|
|
|
+ response.close();
|
|
|
|
+ httpClient.close();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void flushCookie(ShopAccount shopAccount) {
|
|
|
|
+ try {
|
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
HttpGet getMethod = new HttpGet("https://shop.kongfz.com/buyer/order/index/?pageCurr=1&pageShow=30");
|
|
HttpGet getMethod = new HttpGet("https://shop.kongfz.com/buyer/order/index/?pageCurr=1&pageShow=30");
|
|
getMethod.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
|
|
getMethod.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
|
|
- getMethod.addHeader("cookie",shopAccount.getFuziCookie());
|
|
|
|
|
|
+ getMethod.addHeader("cookie", shopAccount.getFuziCookie());
|
|
|
|
|
|
httpClient.execute(getMethod);
|
|
httpClient.execute(getMethod);
|
|
CloseableHttpResponse response = httpClient.execute(getMethod);//执行获取响应
|
|
CloseableHttpResponse response = httpClient.execute(getMethod);//执行获取响应
|
|
- try{
|
|
|
|
|
|
+ try {
|
|
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {//根据状态码处理
|
|
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {//根据状态码处理
|
|
- String strTmp= EntityUtils.toString(response.getEntity(),"UTF-8");
|
|
|
|
|
|
+ String strTmp = EntityUtils.toString(response.getEntity(), "UTF-8");
|
|
//返回字符串
|
|
//返回字符串
|
|
String res = unicodeToString(strTmp);
|
|
String res = unicodeToString(strTmp);
|
|
JSONObject datas = JSONObject.parseObject(res);//转换成JSON格式
|
|
JSONObject datas = JSONObject.parseObject(res);//转换成JSON格式
|
|
Boolean status = (Boolean) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取
|
|
Boolean status = (Boolean) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取
|
|
- if(status){
|
|
|
|
|
|
+ if (status) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- catch (Exception exception){
|
|
|
|
|
|
+ } catch (Exception exception) {
|
|
|
|
|
|
- }
|
|
|
|
- finally {
|
|
|
|
|
|
+ } finally {
|
|
response.close();
|
|
response.close();
|
|
httpClient.close();
|
|
httpClient.close();
|
|
}
|
|
}
|
|
|
|
|
|
- System.out.println("原cookies = "+shopAccount.getFuziCookie());
|
|
|
|
|
|
+ System.out.println("原cookies = " + shopAccount.getFuziCookie());
|
|
|
|
|
|
// 登陆 Url
|
|
// 登陆 Url
|
|
String loginUrl = "https://login.kongfz.com/Pc/Login/account";
|
|
String loginUrl = "https://login.kongfz.com/Pc/Login/account";
|
|
- BasicCookieStore store= new BasicCookieStore();
|
|
|
|
|
|
+ BasicCookieStore store = new BasicCookieStore();
|
|
httpClient = HttpClients.custom().setDefaultCookieStore(store).build();
|
|
httpClient = HttpClients.custom().setDefaultCookieStore(store).build();
|
|
// 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
|
|
// 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
|
|
HttpPost httpPost = new HttpPost(loginUrl);
|
|
HttpPost httpPost = new HttpPost(loginUrl);
|
|
@@ -390,13 +444,13 @@ public class ShopOrderServiceImpl implements IShopOrderService {
|
|
|
|
|
|
// 执行请求操作,并拿到结果(同步阻塞)
|
|
// 执行请求操作,并拿到结果(同步阻塞)
|
|
response = httpClient.execute(httpPost);
|
|
response = httpClient.execute(httpPost);
|
|
- if(response.getStatusLine().getStatusCode() == 302){
|
|
|
|
|
|
+ if (response.getStatusLine().getStatusCode() == 302) {
|
|
List<org.apache.http.cookie.Cookie> cookielist = store.getCookies();
|
|
List<org.apache.http.cookie.Cookie> cookielist = store.getCookies();
|
|
String nCookie = "";
|
|
String nCookie = "";
|
|
- for(org.apache.http.cookie.Cookie cookie: cookielist){
|
|
|
|
- String name=cookie.getName();
|
|
|
|
- String value=cookie.getValue();
|
|
|
|
- nCookie += name + "="+value+";";
|
|
|
|
|
|
+ for (org.apache.http.cookie.Cookie cookie : cookielist) {
|
|
|
|
+ String name = cookie.getName();
|
|
|
|
+ String value = cookie.getValue();
|
|
|
|
+ nCookie += name + "=" + value + ";";
|
|
}
|
|
}
|
|
System.out.println("nCookie:" + nCookie);
|
|
System.out.println("nCookie:" + nCookie);
|
|
shopAccount.setFuziCookie(nCookie);
|
|
shopAccount.setFuziCookie(nCookie);
|
|
@@ -405,19 +459,19 @@ public class ShopOrderServiceImpl implements IShopOrderService {
|
|
// 释放链接
|
|
// 释放链接
|
|
response.close();
|
|
response.close();
|
|
|
|
|
|
- }catch (Exception e) {
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public void dangOrderDeal(ShopAccount shopAccount,ShopOrder shopOrder) throws Exception {
|
|
|
|
|
|
+ public void dangOrderDeal(ShopAccount shopAccount, ShopOrder shopOrder) throws Exception {
|
|
/**
|
|
/**
|
|
* 获取一下店铺的所有静态参数
|
|
* 获取一下店铺的所有静态参数
|
|
*/
|
|
*/
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
- SdkClient sdkClient = new SdkClient(shopAccount.getDangAppKey(),shopAccount.getDangAppSecret(),shopAccount.getDangSession(),shopAccount.getDangVersion());
|
|
|
|
|
|
+ SdkClient sdkClient = new SdkClient(shopAccount.getDangAppKey(), shopAccount.getDangAppSecret(), shopAccount.getDangSession(), shopAccount.getDangVersion());
|
|
|
|
|
|
OrderDetailsGetRequest ss = new OrderDetailsGetRequest();
|
|
OrderDetailsGetRequest ss = new OrderDetailsGetRequest();
|
|
OrderDetailsGet orderDetailsGet = new OrderDetailsGet();
|
|
OrderDetailsGet orderDetailsGet = new OrderDetailsGet();
|
|
@@ -444,8 +498,8 @@ public class ShopOrderServiceImpl implements IShopOrderService {
|
|
} catch (ApiException e) {
|
|
} catch (ApiException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- SdkClient jiemi = new SdkClient(shopAccount.getDangAppKey(),shopAccount.getDangAppSecret(),shopAccount.getDangSession(),shopAccount.getDangVersion());
|
|
|
|
- OrdersContentDecryptRequest ordersContentDecryptRequest=new OrdersContentDecryptRequest();
|
|
|
|
|
|
+ SdkClient jiemi = new SdkClient(shopAccount.getDangAppKey(), shopAccount.getDangAppSecret(), shopAccount.getDangSession(), shopAccount.getDangVersion());
|
|
|
|
+ OrdersContentDecryptRequest ordersContentDecryptRequest = new OrdersContentDecryptRequest();
|
|
|
|
|
|
List<EncryptDTO> encryptVOS = new ArrayList<EncryptDTO>();
|
|
List<EncryptDTO> encryptVOS = new ArrayList<EncryptDTO>();
|
|
|
|
|
|
@@ -457,7 +511,7 @@ public class ShopOrderServiceImpl implements IShopOrderService {
|
|
ordersContentDecryptRequest.setO_cryptStr(JSON.toJSONString(encryptVOS));
|
|
ordersContentDecryptRequest.setO_cryptStr(JSON.toJSONString(encryptVOS));
|
|
OrdersContentDecryptResponse ordersContentDecryptResponse = null;
|
|
OrdersContentDecryptResponse ordersContentDecryptResponse = null;
|
|
try {
|
|
try {
|
|
- ordersContentDecryptResponse=jiemi.excute(ordersContentDecryptRequest);
|
|
|
|
|
|
+ ordersContentDecryptResponse = jiemi.excute(ordersContentDecryptRequest);
|
|
} catch (ApiException e) {
|
|
} catch (ApiException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
@@ -465,7 +519,6 @@ public class ShopOrderServiceImpl implements IShopOrderService {
|
|
CryptUserInfo cryptUserInfo = data.get(0).getCryptUserInfo();
|
|
CryptUserInfo cryptUserInfo = data.get(0).getCryptUserInfo();
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
OrderDetail o = (OrderDetail) XMLUtil.convertXmlStrToObject(OrderDetail.class, odgrp.getBody());
|
|
OrderDetail o = (OrderDetail) XMLUtil.convertXmlStrToObject(OrderDetail.class, odgrp.getBody());
|
|
SendGoodsInfo sgi = new SendGoodsInfo();
|
|
SendGoodsInfo sgi = new SendGoodsInfo();
|
|
sgi.setConsigneeAddr(cryptUserInfo.getConsigneeAddr());
|
|
sgi.setConsigneeAddr(cryptUserInfo.getConsigneeAddr());
|
|
@@ -491,9 +544,9 @@ public class ShopOrderServiceImpl implements IShopOrderService {
|
|
* 组成OrderInfo
|
|
* 组成OrderInfo
|
|
*/
|
|
*/
|
|
Wrapper wrapper = new EntityWrapper();
|
|
Wrapper wrapper = new EntityWrapper();
|
|
- wrapper.like("fuzi_name",shopOrder.getShippingComName());
|
|
|
|
|
|
+ wrapper.like("fuzi_name", shopOrder.getShippingComName());
|
|
List<ShopTran> list = shopTranMapper.selectList(wrapper);
|
|
List<ShopTran> list = shopTranMapper.selectList(wrapper);
|
|
- if(list.size() == 0 ){
|
|
|
|
|
|
+ if (list.size() == 0) {
|
|
throw new Exception("物流公司不存在");
|
|
throw new Exception("物流公司不存在");
|
|
}
|
|
}
|
|
HashMap<String, Object> stringObjectHashMap = new HashMap<>();
|
|
HashMap<String, Object> stringObjectHashMap = new HashMap<>();
|
|
@@ -536,16 +589,16 @@ public class ShopOrderServiceImpl implements IShopOrderService {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
System.out.println(result.toString());
|
|
System.out.println(result.toString());
|
|
- if(result.getResult().getOrdersList().get(0).getOrderOperCode() == 0){
|
|
|
|
|
|
+ if (result.getResult().getOrdersList().get(0).getOrderOperCode() == 0) {
|
|
shopOrder.setDangOrderStatus("已发货");
|
|
shopOrder.setDangOrderStatus("已发货");
|
|
- shopOrderMapper.update(shopOrder,new EntityWrapper<ShopOrder>().eq("order_id",shopOrder.getOrderId()));
|
|
|
|
|
|
+ shopOrderMapper.update(shopOrder, new EntityWrapper<ShopOrder>().eq("order_id", shopOrder.getOrderId()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Unicode转 汉字字符串
|
|
* Unicode转 汉字字符串
|
|
*
|
|
*
|
|
- * @param str
|
|
|
|
- * \u6728
|
|
|
|
|
|
+ * @param str \u6728
|
|
* @return '木' 26408
|
|
* @return '木' 26408
|
|
*/
|
|
*/
|
|
public static String unicodeToString(String str) {
|
|
public static String unicodeToString(String str) {
|