package cn.freemud.service.impl;

import cn.freemud.adapter.OrderAdapter;
import cn.freemud.entities.dto.OrderPrintDto;
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/9/23 16:51
 * @description :
 */
public class OrderInfo2OrderBean {

    public static void main(String[] args) {
        OrderCenterSdkAdapter orderCenterSdkAdapter = new OrderCenterSdkAdapter();
        String strOrderInfo = "{\"abnormalDesc\":\"\",\"abnormalState\":0,\"actualPayAmount\":2.0,\"afterSalesOrderList\":[],\"afterSalesState\":0,\"appId\":\"wxef754bdcc220db4e\",\"barCounter\":\"\",\"bizType\":1,\"businessDay\":1663862400000,\"canRefund\":true,\"cancelReason\":\"\",\"companySelfCode\":\"\",\"createTime\":1663922390000,\"daySeq\":0,\"deliveryContactInfoList\":[{\"addressDetail\":\"大润发(南翔店),1\",\"city\":\"\",\"contactsName\":\"\",\"expressNo\":\"0\",\"extInfo\":\"{\\\"receiveId\\\": \\\"3630371879117105885\\\"}\",\"infoType\":1,\"latitude\":31.293488,\"longitude\":121.30485,\"mobile\":\"13673451997\",\"province\":\"\",\"region\":\"\",\"relateObjectType\":1,\"street\":\"\",\"telephone\":\"\",\"thirdDeliveryId\":\"0\",\"tripDist\":0},{\"addressDetail\":\"self\",\"city\":\"\",\"contactsName\":\"\",\"expressNo\":\"0\",\"extInfo\":\"\",\"infoType\":0,\"latitude\":0.0,\"longitude\":0.0,\"mobile\":\"\",\"province\":\"\",\"region\":\"\",\"relateObjectType\":3,\"street\":\"\",\"telephone\":\"\",\"thirdDeliveryId\":\"0\",\"tripDist\":0}],\"deliveryPromise\":0,\"deliveryState\":-2,\"dinersNumber\":0,\"downstreamPosCode\":\"0\",\"downstreamThirdOrderCode\":\"0\",\"estimateDeliveryCompleteTime\":1663924189000,\"evaluationState\":0,\"expressChannelCode\":\"\",\"expressChannelName\":\"\",\"expressNo\":\"\",\"expressType\":0,\"extInfo\":\"{\\\"sessionKey\\\":\\\"beaMHKx1GDQBgnogko0P+A==\\\",\\\"openid\\\":\\\"oDbry5DgPZ4JoPEIK6T3_TfLIZjU\\\",\\\"paidMember\\\":false,\\\"sessionId\\\":\\\"44f326a1783530b9e1a3c1857eb4011fc83ca219\\\",\\\"serviceTime\\\":50,\\\"version\\\":\\\"3.0.8.1\\\",\\\"packageAmountCollectType\\\":1,\\\"pushOrderTime\\\":0,\\\"fmId\\\":\\\"7702399255727543417804132\\\",\\\"deliveryHoursDayEnd\\\":\\\"\\\",\\\"fromAppId\\\":\\\"wxef754bdcc220db4e\\\",\\\"appid\\\":\\\"wxef754bdcc220db4e\\\",\\\"deliveryHoursDayStart\\\":\\\"2022-09-23 00:00:00\\\",\\\"prepayId\\\":\\\"wx2316395046954291e14041594ead230000\\\"}\",\"immediately\":true,\"isParent\":false,\"localTableKey\":\"\",\"logisticsAccessChannel\":0,\"logisticsList\":[],\"marketingCode\":\"\",\"marketingType\":0,\"needInvoice\":false,\"note\":\"\",\"operator\":\"\",\"orderArea\":\"0\",\"orderClient\":2,\"orderCode\":\"25572754324560307500005\",\"orderCostDetailList\":[{\"actualCostAmount\":1.0,\"billType\":1,\"costAmount\":1.0,\"costName\":\"配送费\",\"costType\":2,\"createTime\":1663922390000,\"note\":\"\",\"orderCode\":\"25572754324560307500005\",\"orderItemId\":0,\"partnerId\":\"2399\",\"productId\":\"0\",\"productSeq\":0,\"updateTime\":1663922390000}],\"orderExtended\":{\"agentPayerId\":\"\",\"agentPayerName\":\"\",\"createTime\":1663922390000,\"id\":255727543245603075,\"isDeleted\":false,\"orderClientGroup\":\"海淀\",\"orderClientGroupCode\":\"haidian\",\"orderCode\":\"25572754324560307500005\",\"orderId\":255727543245603075,\"partnerId\":\"2399\",\"sendWord\":\"\",\"spellGroupCode\":\"\",\"storeId\":\"0329\",\"storeNameEn\":\"\",\"updateTime\":1663922390000,\"userPhone\":\"\",\"version\":0},\"orderInvoice\":{\"address\":\"\",\"bankCardNo\":\"\",\"content\":\"\",\"invoiceBank\":\"\",\"invoiceNo\":\"\",\"invoiceUrl\":\"\",\"itemId\":\"\",\"partnerId\":\"\",\"phoneNo\":\"\",\"pickUpNo\":\"\",\"taxNo\":\"\",\"title\":\"\",\"userId\":\"\"},\"orderItemList\":[{\"canRefund\":true,\"categoryId\":\"0\",\"categoryName\":\"0\",\"extInfo\":\"{\\\"tax\\\": 0, \\\"stapleFood\\\": 0, \\\"isMonthCard\\\": 0, \\\"isSendGoods\\\": false, \\\"cartGoodsUid\\\": \\\"3db95403-8f22-49cf-a7b5-5751dc2432d7\\\", \\\"isB3S1Coupon\\\": 0, \\\"spuProductCode\\\": \\\"810\\\", \\\"thirdProductPropertyId\\\": \\\"1,1,0\\\"}\",\"id\":255727543261331717,\"ignoreInOrderClose\":false,\"marketingCode\":\"0\",\"marketingType\":0,\"nickName\":\"\",\"note\":\"\",\"openId\":\"\",\"originalProductType\":1,\"parentProductId\":\"0\",\"photoUrl\":\"\",\"productCode\":\"810\",\"productForeignName\":\"\",\"productForeignProperty\":\"null/null/null\",\"productForeignSpecName\":\"\",\"productId\":\"190528777624840461\",\"productName\":\"香甜牛奶（热）\",\"productPicUrl\":\"https://img10.sandload.cn/1623736171543.jpg\",\"productPrice\":1.0,\"productProperty\":\"少量/少量/无糖\",\"productQuantity\":1,\"productScorePrice\":0,\"productSeq\":1,\"productSharePrice\":0.0,\"productSpec\":\"190528777624840461\",\"productSpecName\":\"香甜牛奶（热）\",\"productSpuQuantity\":1,\"productType\":0,\"productUnit\":\"\",\"productUpc\":\"\",\"productWeightUnit\":0,\"realDBProductSpuQuantity\":1,\"salePrice\":1.0,\"saleScorePrice\":0,\"settlementPrice\":1.0,\"settlementScorePrice\":0,\"thirdProductId\":\"810\",\"userId\":\"\",\"weight\":0.0}],\"orderSendCouponRespList\":[],\"orderSettlementDetailList\":[{\"agentDiscountAmount\":0.0,\"carrierDiscountAmount\":0.0,\"extInfo\":\"\",\"externalObjectId\":\"\",\"externalObjectName\":\"优惠总金额\",\"externalObjectSubId\":\"\",\"ignoreInDiscountAmount\":false,\"isOnline\":true,\"note\":\"\",\"number\":0,\"platformDiscountAmount\":0.0,\"platformServiceAmount\":0.0,\"productId\":\"0\",\"productSeq\":0,\"prospectiveAmount\":0.0,\"settlementAmount\":2.0,\"settlementType\":205,\"shopAmount\":0.0,\"shopDiscountAmount\":0.0}],\"orderState\":1,\"orderSubState\":0,\"orderType\":3,\"orderVersion\":1,\"originalAmount\":2.0,\"originalScoreAmount\":0,\"parentCode\":\"0\",\"partnerId\":\"2399\",\"partnerName\":\"\",\"payChannel\":\"10211\",\"payChannelName\":\"微信\",\"payChannelType\":1,\"payRequestNo\":\"0\",\"payState\":1,\"payType\":1,\"physicalGoodsFlag\":1,\"pickUpGoodsNo\":\"\",\"posCode\":\"\",\"posTableKey\":\"\",\"ppoOrderCode\":\"\",\"printNum\":0,\"settlementAmount\":2.0,\"settlementScoreAmount\":0,\"sourceType\":0,\"storeId\":\"0329\",\"storeName\":\"雪玉测试门店\",\"storeUnifyId\":\"0\",\"suspendDesc\":\"\",\"suspendState\":0,\"thirdOrderCode\":\"25572754324560307500005\",\"thirdStoreId\":\"\",\"toStoreId\":\"0\",\"updateTime\":1663922389000,\"userId\":\"3628509743958943995\",\"userMobile\":\"13673451997\",\"userName\":\"李雪玉\",\"userSourceType\":1,\"weight\":0.0}";
        OrderInfoReqs orderInfoReqs = JSON.parseObject(strOrderInfo, OrderInfoReqs.class);
        OrderBeanV1 orderBeanV1 = orderCenterSdkAdapter.convent2NEWOrderInfo(orderInfoReqs);

        OrderAdapter orderAdapter = new OrderAdapter();
        OrderPrintDto orderPrintDto = orderAdapter.convert2OrderPrintDto(orderBeanV1);
        System.out.println(orderPrintDto);
    }
}
