|
@@ -27,6 +27,7 @@ import com.fjhx.victoriatourist.entity.jd.po.JdOrder;
|
|
|
import com.fjhx.victoriatourist.entity.jd.po.JdOrderDetails;
|
|
|
import com.fjhx.victoriatourist.entity.jd.vo.CommonDictData;
|
|
|
import com.fjhx.victoriatourist.entity.jd.vo.JdInfoVo;
|
|
|
+import com.fjhx.victoriatourist.entity.jd.vo.TellBackOrderVO;
|
|
|
import com.fjhx.victoriatourist.service.jd.*;
|
|
|
import com.fjhx.victoriatourist.service.jd.constants.InitDictConstant;
|
|
|
import com.fjhx.victoriatourist.service.jd.constants.JdParamConstant;
|
|
@@ -125,6 +126,39 @@ public class JdApiServiceImpl implements JdApiService {
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void tellBackOrer(TellBackOrderVO tellBackOrderVO) {
|
|
|
+ JdClient client = jdClientFactory.getJdClient();
|
|
|
+ VcConfirmpurchaseorderResponse response;
|
|
|
+ try {
|
|
|
+ VcConfirmpurchaseorderRequest request = buildConfirmpurchaseorderRequest(tellBackOrderVO);
|
|
|
+ response = client.execute(request);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ String code = response.getCode();
|
|
|
+ if(!"200".equals(code)){
|
|
|
+ //失败
|
|
|
+ log.error("回告失败:{},{}",response.getZhDesc(), response.getMsg());
|
|
|
+ throw new RuntimeException("回告失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private VcConfirmpurchaseorderRequest buildConfirmpurchaseorderRequest(TellBackOrderVO tellBackOrderVO) {
|
|
|
+ VcConfirmpurchaseorderRequest request = new VcConfirmpurchaseorderRequest();
|
|
|
+ request.setOrderId(tellBackOrderVO.getOrderId());
|
|
|
+ request.setDeliveryTime(tellBackOrderVO.getDeliveryTime());
|
|
|
+ request.setWareId(tellBackOrderVO.getBackInfo().stream().map(o->StrUtil.toString(o.getWareId())).collect(Collectors.joining(",")));
|
|
|
+ request.setConfirmNum(tellBackOrderVO.getBackInfo().stream().map(o->StrUtil.toString(o.getConfirmNum())).collect(Collectors.joining(",")));
|
|
|
+ request.setBackExplanation(tellBackOrderVO.getBackInfo().stream().map(o->StrUtil.toString(o.getBackExplanation())).collect(Collectors.joining(",")));
|
|
|
+ request.setBackExplanationType(tellBackOrderVO.getBackInfo().stream().map(o->StrUtil.toString(o.getBackExplanationType())).collect(Collectors.joining(",")));
|
|
|
+ request.setDeliverCenterId(tellBackOrderVO.getBackInfo().stream().map(o->StrUtil.toString(o.getDeliverCenterId())).collect(Collectors.joining(",")));
|
|
|
+ return request;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public void test() {
|
|
|
// SecurityUtils.setTenantId(tenantId);
|
|
@@ -769,7 +803,13 @@ public class JdApiServiceImpl implements JdApiService {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
- JdClient client = new DefaultJdClient("http://api.jd.com/routerjson", "a1f79f4670fd43a28fa2de02abd86f03ytfm", JdParamConstant.appKey, JdParamConstant.appSecret);
|
|
|
+// JdClient client = new DefaultJdClient("http://api.jd.com/routerjson", "a1f79f4670fd43a28fa2de02abd86f03ytfm", JdParamConstant.appKey, JdParamConstant.appSecret);
|
|
|
+ List<Integer> list = new ArrayList<>();
|
|
|
+ list.add(1);
|
|
|
+ list.add(2);
|
|
|
+ list.add(3);
|
|
|
+ String str = StrUtil.toString(list);
|
|
|
+ System.out.println(str);
|
|
|
}
|
|
|
|
|
|
}
|