|
@@ -6,7 +6,9 @@ import com.kuaishou.merchant.open.api.KsMerchantApiException;
|
|
|
import com.kuaishou.merchant.open.api.client.AccessTokenKsMerchantClient;
|
|
import com.kuaishou.merchant.open.api.client.AccessTokenKsMerchantClient;
|
|
|
import com.kuaishou.merchant.open.api.common.utils.GsonUtils;
|
|
import com.kuaishou.merchant.open.api.common.utils.GsonUtils;
|
|
|
import com.kuaishou.merchant.open.api.request.order.OpenOrderCursorListRequest;
|
|
import com.kuaishou.merchant.open.api.request.order.OpenOrderCursorListRequest;
|
|
|
|
|
+import com.kuaishou.merchant.open.api.request.order.OpenOrderDetailRequest;
|
|
|
import com.kuaishou.merchant.open.api.response.order.OpenOrderCursorListResponse;
|
|
import com.kuaishou.merchant.open.api.response.order.OpenOrderCursorListResponse;
|
|
|
|
|
+import com.kuaishou.merchant.open.api.response.order.OpenOrderDetailResponse;
|
|
|
import com.ruixuan.common.utils.Check;
|
|
import com.ruixuan.common.utils.Check;
|
|
|
import com.ruixuan.common.utils.DateUtils;
|
|
import com.ruixuan.common.utils.DateUtils;
|
|
|
import com.ruixuan.isc.constants.KuaiShouConstants;
|
|
import com.ruixuan.isc.constants.KuaiShouConstants;
|
|
@@ -106,36 +108,52 @@ public class KwaixiaodianOrderCursorListServiceImpl implements IKwaixiaodianOrde
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void insertKWaiShopOrder(JSONObject eventJSon) {
|
|
public void insertKWaiShopOrder(JSONObject eventJSon) {
|
|
|
|
|
+ log.info("新增kwaixiaodian订单,消息体:{}", eventJSon);
|
|
|
|
|
+ JSONObject info = eventJSon.getJSONObject("info");
|
|
|
|
|
+ String openId = eventJSon.getString("openId");
|
|
|
|
|
+ Long oid = null;
|
|
|
|
|
+ if (!Check.isNull(info)) {
|
|
|
|
|
+ oid = info.getLong("oid");
|
|
|
|
|
+ KuaishouAccessToken token = accessTokenService.getKWaiAccessTokenByOpenId(openId);
|
|
|
|
|
+ AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(KuaiShouConstants.KFX_URL, token.getAppKey(), token.getSignSecret());
|
|
|
|
|
|
|
|
|
|
+ OpenOrderDetailRequest request = new OpenOrderDetailRequest();
|
|
|
|
|
+ request.setAccessToken(token.getAccessToken());
|
|
|
|
|
+ request.setApiMethodVersion(1L);
|
|
|
|
|
+ request.setOid(oid);
|
|
|
|
|
+ OpenOrderDetailResponse response = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ response = client.execute(request);
|
|
|
|
|
+ } catch (KsMerchantApiException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(GsonUtils.toJSON(response));
|
|
|
|
|
+ String code = jsonObject.getString("code");
|
|
|
|
|
+ if ("1".equals(code)) {
|
|
|
|
|
+ JSONObject data = jsonObject.getJSONObject("data");
|
|
|
|
|
+ KwaixiaodianOrderCursorList order = new KwaixiaodianOrderCursorList(token, data);
|
|
|
|
|
+ mapper.insertKWaixiaodianOrderCursorList(order);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.error("===kwaixiaodian新增订单(open.order.detail)失败,oid:{},信息:{}", oid, jsonObject.getString("error_msg"));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void updateKWaiShopOrder(JSONObject eventJSon) {
|
|
|
|
|
- /* try {
|
|
|
|
|
|
|
+ public void updateKWaiShopOrderStatus(JSONObject eventJSon) {
|
|
|
|
|
+ try {
|
|
|
JSONObject info = eventJSon.getJSONObject("info");
|
|
JSONObject info = eventJSon.getJSONObject("info");
|
|
|
if (!Check.isNull(info)) {
|
|
if (!Check.isNull(info)) {
|
|
|
Long oid = info.getLong("oid");
|
|
Long oid = info.getLong("oid");
|
|
|
- Integer cpsOrderStatus = info.getInteger("status");
|
|
|
|
|
- if (cpsOrderStatus == 60) {
|
|
|
|
|
- Integer i = updateOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
|
|
- if (i > 0) {
|
|
|
|
|
- log.info("订单ID:{},状态:{} 修改成功", oid, cpsOrderStatus);
|
|
|
|
|
- } else {
|
|
|
|
|
- log.error("订单ID:{},状态:{} 修改失败", oid, cpsOrderStatus);
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- Integer i = this.updateOrderStatus(oid, cpsOrderStatus);
|
|
|
|
|
- if (i > 0) {
|
|
|
|
|
- log.info("订单ID:{},状态:{} 修改成功", oid, cpsOrderStatus);
|
|
|
|
|
- } else {
|
|
|
|
|
- log.error("订单ID:{},状态:{} 修改失败", oid, cpsOrderStatus);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Integer status = info.getInteger("status");
|
|
|
|
|
+ int i = mapper.updateKWaiShopOrderStatus(oid, status);
|
|
|
|
|
+ if (i <= 0) {
|
|
|
|
|
+ log.error("KWai_订单ID:{},状态:{} 修改失败", oid, status);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
-
|
|
|
|
|
- }*/
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|