package cn.freemud.utils;

import cn.freemud.management.adapter.DeliverySdkAdapter;
import cn.freemud.management.entities.dto.request.console.BizDTO;
import cn.freemud.management.entities.dto.request.console.ConsoleResponseDTO;
import com.alibaba.fastjson.JSON;
import com.freemud.application.sdk.api.ordercenter.adapter.OrderCenterSdkAdapter;
import com.freemud.application.sdk.api.ordercenter.entities.v1.OrderBeanV1;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderInfoReqs;

/**
 * @author : xh.Z
 * @email : fisherman0510@163.com
 * @Date : 2022/5/17 19:50
 * @description :
 */
public class DemoMain {
    public static void main(String[] args) {
        String str = "{\"abnormalDesc\":\"\",\"abnormalState\":0,\"acceptTime\":\"1653290628000\",\"actualPayAmount\":0.0,\"afterSalesOrderList\":[],\"appId\":\"wxa1f272347828dae8\",\"barCounter\":\"\",\"bizType\":1,\"canRefund\":true,\"cancelReason\":\"\",\"companySelfCode\":\"\",\"createTime\":\"1653290627000\",\"daySeq\":27,\"deliveryContactInfoList\":[{\"addressDetail\":\"学清嘉创大厦A座,15层\",\"city\":\"\",\"contactsName\":\"\",\"expressNo\":\"0\",\"extInfo\":\"{\\\"receiveId\\\": \\\"3652236942336672686\\\"}\",\"infoType\":1,\"latitude\":40.0149612,\"longitude\":116.3530960,\"mobile\":\"18017275431\",\"province\":\"\",\"region\":\"\",\"relateObjectType\":1,\"street\":\"\",\"telephone\":\"\",\"thirdDeliveryId\":\"0\"},{\"addressDetail\":\"third\",\"city\":\"\",\"contactsName\":\"\",\"expressNo\":\"3467201747349554177\",\"extInfo\":\"\",\"infoType\":0,\"latitude\":0E-7,\"longitude\":0E-7,\"mobile\":\"\",\"province\":\"\",\"region\":\"\",\"relateObjectType\":3,\"street\":\"\",\"telephone\":\"\",\"thirdDeliveryId\":\"241714355898605828\"}],\"deliveryPromise\":0,\"deliveryState\":0,\"dinersNumber\":0,\"dispenseStatus\":1,\"downstreamPosCode\":\"0\",\"downstreamThirdOrderCode\":\"0\",\"estimateDeliveryCompleteTime\":\"1653292607000\",\"expressChannelCode\":\"ShunFeng\",\"expressChannelName\":\"顺丰\",\"expressNo\":\"3467201747349554177\",\"expressType\":0,\"extInfo\":\"{\\\"fmId\\\": \\\"437634633098457088\\\", \\\"appid\\\": \\\"wxa1f272347828dae8\\\", \\\"openid\\\": \\\"o0wG94vrmHbVDPayTdd_bLAFbAw8\\\", \\\"payDate\\\": \\\"2022-05-23 15:23:47\\\", \\\"version\\\": \\\"2.0.78.8\\\", \\\"prepayId\\\": \\\"\\\", \\\"fromAppId\\\": \\\"wxa1f272347828dae8\\\", \\\"sessionId\\\": \\\"fa860a199923f2045536e75ec222c5fbde2e5edf\\\", \\\"paidMember\\\": false, \\\"payTransId\\\": \\\"437634633098457088\\\", \\\"sessionKey\\\": \\\"yoQ+nvLqahrbjIYbE0IfMg==\\\", \\\"totalScore\\\": 0, \\\"exceptionId\\\": null, \\\"memberLevel\\\": \\\"星耀77777\\\", \\\"serviceTime\\\": 50, \\\"dispatchType\\\": \\\"0\\\", \\\"exceptionDesc\\\": null, \\\"pushOrderTime\\\": 0, \\\"dispatchTimeout\\\": -1, \\\"deliveryHoursDayEnd\\\": \\\"\\\", \\\"deliveryHoursDayStart\\\": \\\"2022-05-23 00:00:00\\\", \\\"packageAmountCollectType\\\": 1}\",\"immediately\":true,\"isParent\":false,\"localTableKey\":\"\",\"marketingCode\":\"\",\"marketingType\":0,\"needInvoice\":false,\"note\":\"\",\"operator\":\"\",\"orderArea\":\"0\",\"orderClient\":2,\"orderCode\":\"24457933181334179700003\",\"orderCostDetailList\":[],\"orderExtended\":{\"agentPayerId\":\"\",\"agentPayerName\":\"\",\"orderClientGroup\":\"北京\",\"orderClientGroupCode\":\"beijin\",\"sendWord\":\"\",\"spellGroupCode\":\"\",\"storeNameEn\":\"\",\"userPhone\":\"\"},\"orderInvoice\":{\"address\":\"\",\"bankCardNo\":\"\",\"content\":\"\",\"invoiceBank\":\"\",\"invoiceUrl\":\"\",\"itemId\":\"\",\"partnerId\":\"\",\"phoneNo\":\"\",\"taxNo\":\"\",\"title\":\"\"},\"orderItemList\":[{\"canRefund\":true,\"extInfo\":\"{\\\"tax\\\": 0.01, \\\"stapleFood\\\": 0, \\\"isMonthCard\\\": 0, \\\"isSendGoods\\\": false, \\\"cartGoodsUid\\\": \\\"3c1be4ba-ad41-453e-bfd2-11b70dd62363\\\", \\\"isB3S1Coupon\\\": 0, \\\"spuProductCode\\\": \\\"wefsdf\\\"}\",\"id\":244579331839556199,\"ignoreInOrderClose\":false,\"marketingCode\":\"0\",\"marketingType\":0,\"nickName\":\"\",\"note\":\"\",\"openId\":\"\",\"parentProductId\":\"0\",\"photoUrl\":\"\",\"productCode\":\"wefsdf\",\"productForeignName\":\"\",\"productForeignProperty\":\"\",\"productForeignSpecName\":\"\",\"productId\":\"232562948867890490\",\"productName\":\"molly美式\",\"productPicUrl\":\"https://picture.sandload.cn/1644545749037.jpg\",\"productPrice\":171.0,\"productProperty\":\"\",\"productQuantity\":1,\"productSeq\":1,\"productSharePrice\":0.0,\"productSpec\":\"232562948867890490\",\"productSpecName\":\"molly美式\",\"productType\":88,\"productUnit\":\"gk\",\"productUpc\":\"\",\"productWeightUnit\":0,\"salePrice\":171.0,\"settlementPrice\":171.0,\"thirdProductId\":\"wesdsd\",\"userId\":\"\",\"weight\":301.67},{\"canRefund\":true,\"extInfo\":\"{\\\"tax\\\": 0, \\\"stapleFood\\\": 0, \\\"isMonthCard\\\": 0, \\\"isB3S1Coupon\\\": 0}\",\"id\":244579331855284841,\"ignoreInOrderClose\":false,\"marketingCode\":\"0\",\"marketingType\":0,\"nickName\":\"\",\"note\":\"\",\"openId\":\"\",\"parentProductId\":\"232562948867890490_1\",\"photoUrl\":\"\",\"productCode\":\"\",\"productForeignName\":\"\",\"productForeignProperty\":\"\",\"productForeignSpecName\":\"\",\"productId\":\"215806159829964858\",\"productName\":\"加珍珠\",\"productPicUrl\":\"\",\"productPrice\":11.0,\"productProperty\":\"\",\"productQuantity\":1,\"productSeq\":2,\"productSharePrice\":0.0,\"productSpec\":\"215806159829964858\",\"productSpecName\":\"加珍珠\",\"productType\":0,\"productUnit\":\"\",\"productUpc\":\"\",\"productWeightUnit\":0,\"salePrice\":11.0,\"settlementPrice\":11.0,\"thirdProductId\":\"H00301\",\"userId\":\"\",\"weight\":0.00},{\"canRefund\":true,\"extInfo\":\"{\\\"tax\\\": 0, \\\"stapleFood\\\": 0, \\\"isMonthCard\\\": 0, \\\"isSendGoods\\\": true, \\\"cartGoodsUid\\\": \\\"60c018e5-b203-4b48-bb42-a2306030ac4e\\\", \\\"isB3S1Coupon\\\": 0, \\\"spuProductCode\\\": \\\"wefsdf\\\"}\",\"id\":244579331869964907,\"ignoreInOrderClose\":false,\"marketingCode\":\"0\",\"marketingType\":0,\"nickName\":\"\",\"note\":\"\",\"openId\":\"\",\"parentProductId\":\"0\",\"photoUrl\":\"\",\"productCode\":\"wefsdf\",\"productForeignName\":\"\",\"productForeignProperty\":\"\",\"productForeignSpecName\":\"\",\"productId\":\"232562948867890490\",\"productName\":\"molly美式\",\"productPicUrl\":\"https://picture.sandload.cn/1644545749037.jpg\",\"productPrice\":160.0,\"productProperty\":\"\",\"productQuantity\":2,\"productSeq\":3,\"productSharePrice\":160.0,\"productSpec\":\"232562948867890490\",\"productSpecName\":\"molly美式\",\"productType\":0,\"productUnit\":\"gk\",\"productUpc\":\"\",\"productWeightUnit\":0,\"salePrice\":0.0,\"settlementPrice\":0.0,\"thirdProductId\":\"wesdsd\",\"userId\":\"\",\"weight\":301.67}],\"orderOperationHistoryList\":[{\"createTime\":1653290627000,\"operationDesc\":\"订单创建\",\"operationMethod\":\"订单创建\",\"operationType\":1,\"operator\":\"顺丰同城\",\"orderCode\":\"24457933181334179700003\",\"originOrderState\":0,\"partnerId\":\"2690\",\"storeId\":\"202104120\",\"targetOrderState\":1,\"timeout\":30,\"updateTime\":1653290627000,\"updateTimestamp\":1653290627090},{\"createTime\":1653290627000,\"operationDesc\":\"订单待支付变成下单\",\"operationMethod\":\"下单\",\"operationType\":1,\"operator\":\"顺丰同城\",\"orderCode\":\"24457933181334179700003\",\"originOrderState\":1,\"partnerId\":\"2690\",\"storeId\":\"202104120\",\"targetOrderState\":2,\"timeout\":0,\"updateTime\":1653290627000,\"updateTimestamp\":1653290627773},{\"createTime\":1653290627000,\"operationDesc\":\"订单下单变成已接单\",\"operationMethod\":\"已接单\",\"operationType\":1,\"operator\":\"自动任务\",\"orderCode\":\"24457933181334179700003\",\"originOrderState\":2,\"partnerId\":\"2690\",\"storeId\":\"202104120\",\"targetOrderState\":3,\"timeout\":180,\"updateTime\":1653290627000,\"updateTimestamp\":1653290627892},{\"createTime\":1653290628000,\"operationDesc\":\"创建运单成功\",\"operationMethod\":\"创建运单成功\",\"operationType\":1,\"operator\":\"自动任务\",\"orderCode\":\"24457933181334179700003\",\"originOrderState\":0,\"partnerId\":\"2690\",\"storeId\":\"202104120\",\"targetOrderState\":0,\"timeout\":0,\"updateTime\":1653290628000,\"updateTimestamp\":1653290628054},{\"createTime\":1653290628000,\"operationDesc\":\"配送:自动分配成功\",\"operationMethod\":\"配送:自动分配成功\",\"operationType\":1,\"operator\":\"\",\"orderCode\":\"24457933181334179700003\",\"originOrderState\":0,\"partnerId\":\"2690\",\"storeId\":\"202104120\",\"targetOrderState\":0,\"timeout\":0,\"updateTime\":1653290628000,\"updateTimestamp\":1653290628281}],\"orderPayItemCreateReqList\":[{\"cardCode\":\"5826900000011930004\",\"fmTradeNo\":\"7702690244579332198149657\",\"id\":244579332421515893,\"operator\":\"\",\"orderCode\":\"24457933181334179700003\",\"orderId\":244579331813341797,\"outOrderNo\":\"\",\"partnerId\":\"2690\",\"payAmount\":171.0,\"payChannelName\":\"储值卡\",\"payChannelType\":3,\"storeId\":\"202104120\",\"transId\":\"437634633098457088\"}],\"orderSendCouponRespList\":[],\"orderSettlementDetailList\":[{\"agentDiscountAmount\":0,\"carrierDiscountAmount\":0,\"extInfo\":\"\",\"externalObjectId\":\"BNSP2022052315220415326\",\"externalObjectName\":\"\",\"externalObjectSubId\":\"\",\"ignoreInDiscountAmount\":false,\"isOnline\":true,\"note\":\"单规格买赠\",\"number\":1,\"platformDiscountAmount\":0,\"platformServiceAmount\":0,\"productId\":\"0\",\"productSeq\":0,\"prospectiveAmount\":0.0,\"settlementAmount\":-320.0,\"settlementType\":23,\"shopAmount\":0,\"shopDiscountAmount\":-320},{\"agentDiscountAmount\":0,\"carrierDiscountAmount\":0,\"extInfo\":\"\",\"externalObjectId\":\"BNSP2022052315220415326\",\"externalObjectName\":\"\",\"externalObjectSubId\":\"\",\"ignoreInDiscountAmount\":false,\"isOnline\":true,\"note\":\"单规格买赠\",\"number\":2,\"platformDiscountAmount\":0,\"platformServiceAmount\":0,\"productId\":\"232562948867890490\",\"productSeq\":3,\"prospectiveAmount\":0.0,\"settlementAmount\":320.0,\"settlementType\":23,\"shopAmount\":0,\"shopDiscountAmount\":320},{\"agentDiscountAmount\":0,\"carrierDiscountAmount\":0,\"extInfo\":\"\",\"externalObjectId\":\"\",\"externalObjectName\":\"\",\"externalObjectSubId\":\"\",\"ignoreInDiscountAmount\":false,\"isOnline\":true,\"note\":\"\",\"number\":2,\"platformDiscountAmount\":0,\"platformServiceAmount\":0,\"productId\":\"232562948867890490\",\"productSeq\":3,\"prospectiveAmount\":0.0,\"settlementAmount\":320.0,\"settlementType\":0,\"shopAmount\":0,\"shopDiscountAmount\":320},{\"agentDiscountAmount\":0,\"carrierDiscountAmount\":0,\"extInfo\":\"\",\"externalObjectId\":\"\",\"externalObjectName\":\"优惠总金额\",\"externalObjectSubId\":\"\",\"ignoreInDiscountAmount\":false,\"isOnline\":true,\"note\":\"\",\"number\":0,\"platformDiscountAmount\":0,\"platformServiceAmount\":0,\"productId\":\"0\",\"productSeq\":0,\"prospectiveAmount\":0.0,\"settlementAmount\":171.0,\"settlementType\":205,\"shopAmount\":0,\"shopDiscountAmount\":320}],\"orderState\":3,\"orderSubState\":0,\"orderType\":3,\"originalAmount\":491.0,\"parentCode\":\"0\",\"partnerId\":\"2690\",\"partnerName\":\"\",\"payChannel\":\"10102\",\"payChannelName\":\"储值卡\",\"payChannelType\":\"3\",\"payRequestNo\":\"437634633098457088\",\"payState\":2,\"payTime\":\"1653290628000\",\"payType\":1,\"pickUpGoodsNo\":\"4228\",\"posCode\":\"\",\"posTableKey\":\"\",\"printNum\":0,\"settlementAmount\":171.0,\"sourceType\":0,\"storeId\":\"202104120\",\"storeName\":\"molly的小店\",\"storeUnifyId\":\"0\",\"suspendDesc\":\"\",\"suspendState\":0,\"thirdOrderCode\":\"24457933181334179700003\",\"thirdStoreId\":\"202104120\",\"toStoreId\":\"0\",\"updateTime\":\"1653290628000\",\"userId\":\"3649418880733072423\",\"userName\":\"顺丰同城\",\"weight\":905.01}";
        OrderInfoReqs orderInfoReqs = JSON.parseObject(str, OrderInfoReqs.class);
        OrderBeanV1 orderBeanV1 = new OrderCenterSdkAdapter().convent2NEWOrderInfo(orderInfoReqs);
        System.out.println(JSON.toJSONString(orderBeanV1));

        DeliverySdkAdapter deliverySdkAdapter = new DeliverySdkAdapter();
        ConsoleResponseDTO<BizDTO> objectConsoleResponseDTO = new ConsoleResponseDTO<>();
        deliverySdkAdapter.buildDeliveryOrderRequestDto(orderBeanV1,objectConsoleResponseDTO,"");
    }
}
