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,\"canRefund\":true,\"cancelReason\":\"\",\"companySelfCode\":\"\",\"createTime\":\"1664171871000\",\"daySeq\":3,\"deliveryContactInfoList\":[{\"addressDetail\":\"大润发(南翔店),1\",\"city\":\"\",\"contactsName\":\"\",\"expressNo\":\"0\",\"extInfo\":\"{\\\"receiveId\\\": \\\"3630371879117105885\\\"}\",\"infoType\":1,\"latitude\":31.2934880,\"longitude\":121.3048500,\"mobile\":\"13673451997\",\"province\":\"\",\"region\":\"\",\"relateObjectType\":1,\"street\":\"\",\"telephone\":\"\",\"thirdDeliveryId\":\"0\"},{\"addressDetail\":\"third\",\"city\":\"\",\"contactsName\":\"\",\"expressNo\":\"0\",\"extInfo\":\"\",\"infoType\":0,\"latitude\":0E-7,\"longitude\":0E-7,\"mobile\":\"\",\"province\":\"\",\"region\":\"\",\"relateObjectType\":3,\"street\":\"\",\"telephone\":\"\",\"thirdDeliveryId\":\"0\"}],\"deliveryPromise\":0,\"deliveryState\":-2,\"dinersNumber\":0,\"downstreamPosCode\":\"0\",\"downstreamThirdOrderCode\":\"0\",\"estimateDeliveryCompleteTime\":\"1664173670000\",\"expressChannelCode\":\"\",\"expressChannelName\":\"\",\"expressNo\":\"\",\"expressType\":0,\"extInfo\":\"{\\\"fmId\\\": \\\"7702399255989142807352652\\\", \\\"appid\\\": \\\"wxef754bdcc220db4e\\\", \\\"openid\\\": \\\"oDbry5DgPZ4JoPEIK6T3_TfLIZjU\\\", \\\"payDate\\\": \\\"2022-09-26 13:57:59\\\", \\\"version\\\": \\\"3.0.8.1\\\", \\\"prepayId\\\": \\\"wx26135751171422810eac850846067c0000\\\", \\\"fromAppId\\\": \\\"wxef754bdcc220db4e\\\", \\\"sessionId\\\": \\\"7f66316bda471491462c8b5517567689f4fdd3b0\\\", \\\"endTransId\\\": \\\"112474209721622092613575125375\\\", \\\"paidMember\\\": false, \\\"payTransId\\\": \\\"7702399255989142807352652\\\", \\\"sessionKey\\\": \\\"QV0djl/Sc3aCGbzDOFPBQw==\\\", \\\"memberLevel\\\": \\\"青铜\\\", \\\"serviceTime\\\": 50, \\\"pushOrderTime\\\": 0, \\\"deliveryHoursDayEnd\\\": \\\"\\\", \\\"deliveryHoursDayStart\\\": \\\"2022-09-26 00:00:00\\\", \\\"packageAmountCollectType\\\": 1}\",\"immediately\":true,\"isParent\":false,\"localTableKey\":\"\",\"marketingCode\":\"\",\"marketingType\":0,\"needInvoice\":false,\"note\":\"\",\"operator\":\"\",\"orderArea\":\"0\",\"orderClient\":2,\"orderCode\":\"25598914263934597100005\",\"orderCostDetailList\":[{\"actualCostAmount\":1.0,\"billType\":1,\"costAmount\":1.0,\"costName\":\"配送费\",\"costType\":2,\"note\":\"\",\"orderItemId\":0,\"productId\":\"0\",\"productSeq\":0}],\"orderExtended\":{\"agentPayerId\":\"\",\"agentPayerName\":\"\",\"orderClientGroup\":\"小鱼\",\"orderClientGroupCode\":\"896\",\"sendWord\":\"\",\"spellGroupCode\":\"\",\"storeNameEn\":\"\",\"userPhone\":\"\"},\"orderInvoice\":{\"address\":\"\",\"bankCardNo\":\"\",\"content\":\"\",\"invoiceBank\":\"\",\"invoiceUrl\":\"\",\"itemId\":\"\",\"partnerId\":\"\",\"phoneNo\":\"\",\"taxNo\":\"\",\"title\":\"\"},\"orderItemList\":[{\"canRefund\":true,\"extInfo\":\"{\\\"tax\\\": 0, \\\"stapleFood\\\": 0, \\\"isMonthCard\\\": 0, \\\"isSendGoods\\\": false, \\\"cartGoodsUid\\\": \\\"1f7863c9-fb4e-4e22-9051-a6d3dc22a29b\\\", \\\"isB3S1Coupon\\\": 0, \\\"spuProductCode\\\": \\\"nogroupcombo\\\"}\",\"id\":255989142654026037,\"ignoreInOrderClose\":false,\"marketingCode\":\"0\",\"marketingType\":0,\"nickName\":\"\",\"note\":\"\",\"openId\":\"\",\"parentProductId\":\"0\",\"photoUrl\":\"\",\"productCode\":\"nogroupcombo\",\"productForeignName\":\"\",\"productForeignProperty\":\"null\",\"productForeignSpecName\":\"\",\"productId\":\"152022148230396673\",\"productName\":\"无商品组套餐\",\"productPicUrl\":\"https://img10.sandload.cn/zfx01.jpg?timestamp=1593832540030\",\"productPrice\":1.0,\"productProperty\":\"番茄味糖\",\"productQuantity\":1,\"productSeq\":1,\"productSharePrice\":0.0,\"productSpec\":\"152022148230396673\",\"productSpecName\":\"无商品组套餐\",\"productSpuQuantity\":1,\"productType\":0,\"productUnit\":\"\",\"productUpc\":\"\",\"productWeightUnit\":0,\"salePrice\":1.0,\"settlementPrice\":1.0,\"thirdProductId\":\"nogroupcombo\",\"userId\":\"\",\"weight\":0.00}],\"orderSendCouponRespList\":[],\"orderSettlementDetailList\":[{\"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\":2.0,\"settlementType\":205,\"shopAmount\":0,\"shopDiscountAmount\":0}],\"orderState\":2,\"orderSubState\":0,\"orderType\":3,\"originalAmount\":2.0,\"parentCode\":\"0\",\"partnerId\":\"2399\",\"partnerName\":\"\",\"payChannel\":\"10211\",\"payChannelName\":\"微信\",\"payChannelType\":\"1\",\"payRequestNo\":\"7702399255989142807352652\",\"payState\":2,\"payTime\":\"1664171879000\",\"payType\":1,\"pickUpGoodsNo\":\"C003\",\"posCode\":\"\",\"posTableKey\":\"\",\"printNum\":0,\"settlementAmount\":2.0,\"sourceType\":0,\"storeId\":\"1085\",\"storeName\":\"南翔QA测试门店lulu&测试门店lulu&测试门店lulu&(店)\",\"storeUnifyId\":\"0\",\"suspendDesc\":\"\",\"suspendState\":0,\"thirdOrderCode\":\"25598914263934597100005\",\"thirdStoreId\":\"0099\",\"toStoreId\":\"0\",\"updateTime\":\"1664171879000\",\"userId\":\"3628509743958943995\",\"userMobile\":\"13673451997\",\"userName\":\"李雪玉\",\"weight\":0.00}";
        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);
    }
}
