package com.reptileclient.jlifeapp.service.impl;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reptileclient.jlifeapp.constant.JlifeConstant;
import com.reptileclient.jlifeapp.dao.hm.HmBookOrderMapper;
import com.reptileclient.jlifeapp.dao.hm.HmPaymentItemSkuMapper;
import com.reptileclient.jlifeapp.dao.hm.HmPaymentOrderMapper;
import com.reptileclient.jlifeapp.dao.hm.HmTokenMapper;
import com.reptileclient.jlifeapp.dao.jz.*;
import com.reptileclient.jlifeapp.dto.HmPaymentOrderDTO;
import com.reptileclient.jlifeapp.entity.hm.HmBookOrder;
import com.reptileclient.jlifeapp.entity.hm.HmPaymentItemSku;
import com.reptileclient.jlifeapp.entity.hm.HmPaymentOrder;
import com.reptileclient.jlifeapp.entity.hm.HmToken;
import com.reptileclient.jlifeapp.entity.jz.*;
import com.reptileclient.jlifeapp.filter.Filter;
import com.reptileclient.jlifeapp.service.HmDownHistoryService;
import com.reptileclient.jlifeapp.service.HmPaymentOrderService;
import com.reptileclient.jlifeapp.service.RetryService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author fuxubing
 */
@Service
public class HmPaymentOrderServiceImpl implements HmPaymentOrderService {
    private static final Logger logger = LoggerFactory.getLogger(HmBookOrderServiceImpl.class);

    @Resource
    private HmPaymentOrderMapper hmPaymentOrderMapper;
    @Resource
    private Filter filter;
    @Resource
    private HmTokenMapper hmTokenMapper;
    @Resource
    private HmDownHistoryService hmDownHistoryService;
    @Resource
    private HmPaymentItemSkuMapper hmPaymentItemSkuMapper;
    @Resource
    private CustomerClientMapper customerClientMapper;
    @Resource
    private HmBookOrderMapper hmBookOrderMapper;
    @Resource
    private OrderMapper orderMapper;
    @Resource
    private GoodsMapper goodsMapper;
    @Resource
    private OrderGoodsMapper orderGoodsMapper;
    @Resource
    private RetryService retryService;
    @Resource
    private JzShopMapper jzShopMapper;

    @Override
    public int addPaymentOrderList() {

        HmToken hmToken = hmTokenMapper.selectAll();
        String token = hmToken.getToken();
        //增量日期范围
        DateTime startTime = DateUtil.lastMonth();
        DateTime endTime = new DateTime();

        //获取数据库最新一条盒马数据
        HmPaymentOrder hmPaymentOrder = hmPaymentOrderMapper.selectNewOne(null);

        if (null != hmPaymentOrder) {//有数据只增量更新，没有就全量
            //hmPaymentOrderMapper.deleteByCreateTime(startTime, null);
            hmPaymentOrderMapper.deleteByBetWeenTime(startTime, endTime);
        }

        int row = 0;

        for (int i = 0; i < 2; i++) {
            if (0 != i) {
                //此处为什么又删一次指定门店数据？**********************************************
                hmPaymentOrder = hmPaymentOrderMapper.selectNewOne("SUPHML21");

                if (null != hmPaymentOrder) {
                    //此处不需要删除业务表数据，只更新
                    hmPaymentOrderMapper.deleteByCreateTime(hmPaymentOrder.getCreateTime(), "SUPHML21");
                }
                token = hmToken.getSubToken();
            }
            int totalPage;
            int pageIndex = JlifeConstant.PAGE_INDEX;
            int pageSize = JlifeConstant.PAGE_SIZE;
            do {
                HmPaymentOrderDTO hmPaymentOrderDTO = new HmPaymentOrderDTO();
                //hmPaymentOrderDTO.setPaymentNo("2020122123165726");
                hmPaymentOrderDTO.setPageSize(pageSize);
                hmPaymentOrderDTO.setPageIndex(pageIndex);

                if (null != hmPaymentOrder) {
                    hmPaymentOrderDTO.setCreateTimeBegin(DateUtil.formatDateTime(startTime));
                    hmPaymentOrderDTO.setCreateTimeEnd(DateUtil.formatDateTime(endTime));
                }
                //hmPaymentOrderDTO.setCreateTimeBegin("2020-12-21 00:00:00");

                String jsonString = JSONObject.toJSONString(hmPaymentOrderDTO);
                //JSONObject jsonObject = HttpUtil.requestPost(token, jsonString, JlifeConstant.PAYMENT_ORDER_URL);
                Map<String, Object> request = retryService.requestPost(token, jsonString, JlifeConstant.PAYMENT_ORDER_URL);
                if ("true".equals(request.get("success").toString())) {
                    JSONObject data = (JSONObject) JSON.toJSON(request.get("data"));
                    double total = Double.parseDouble(String.valueOf(data.get("total")));
                    totalPage = (int) total / pageSize;
                    logger.info("totalPage:{}", totalPage);
                    JSONArray items = data.getJSONArray("list");
                    if (CollectionUtils.isEmpty(items)) {
                        return 0;
                    }
                    String filter = this.filter.filter(items.toJSONString());
                    //String aliases = EmojiParser.parseToAliases(items.toJSONString());
                    List<HmPaymentOrder> hmPaymentOrders = JSONObject.parseArray(filter, HmPaymentOrder.class);
                    //row += hmPaymentOrderMapper.insertByBatch(hmPaymentOrders);

                    for (HmPaymentOrder paymentOrder : hmPaymentOrders) {
                        HmPaymentOrder hmPaymentOrder1 = hmPaymentOrderMapper.selectByPaymentNo(paymentOrder.getPaymentNo());
                        //判断订单是否存在，存在删除订单
                        if (hmPaymentOrder1 != null) {
                            hmPaymentOrderMapper.deleteByPrimaryKey(hmPaymentOrder1.getId());
                            hmPaymentItemSkuMapper.deleteByPaymentNo(hmPaymentOrder1.getPaymentNo());
                        }
                        //处理分转元
                        paymentOrder.setOriginFee(paymentOrder.getOriginFee().multiply(BigDecimal.valueOf(0.01)));
                        paymentOrder.setPayFee(null == paymentOrder.getPayFee() ? BigDecimal.ZERO : paymentOrder.getPayFee().multiply(BigDecimal.valueOf(0.01)));

                        row += hmPaymentOrderMapper.insertSelective(paymentOrder);

                        hmPaymentItemSkuMapper.insertByBatch(paymentOrder.getPaymentNo(), paymentOrder.getItemSkuVoList());
                        //同步业务表
                        etl_to_product_update(paymentOrder);
                    }
                    //成功
                    hmDownHistoryService.insertDownLog("服务付款单",
                            JlifeConstant.PAYMENT_ORDER_URL, jsonString, hmPaymentOrderDTO.getCreateTimeBegin(), null, 0);
                    pageIndex++;
                } else {
                    //失败
                    hmDownHistoryService.insertDownLog("服务付款单",
                            JlifeConstant.PAYMENT_ORDER_URL, jsonString, hmPaymentOrderDTO.getCreateTimeBegin(), null, 1);
                    return 0;
                }

            } while (pageIndex <= totalPage + 1);
        }
        return row;
    }

    @Override
    public int syncHmPaymentOrderByPhone(String phone) {
        HmToken hmToken = hmTokenMapper.selectAll();
        String token = hmToken.getToken();
        hmPaymentOrderMapper.deleteByBuyerPhone(phone);
        int row = 0;
        for (int i = 0; i < 2; i++) {
            if (0 != i) {
                token = hmToken.getSubToken();
            }
            int totalPage;
            int pageIndex = JlifeConstant.PAGE_INDEX;
            int pageSize = JlifeConstant.PAGE_SIZE;

            do {
                HmPaymentOrderDTO hmPaymentOrderDTO = new HmPaymentOrderDTO();
                hmPaymentOrderDTO.setPageSize(pageSize);
                hmPaymentOrderDTO.setPageIndex(pageIndex);
                hmPaymentOrderDTO.setBuyerPhone(phone);

                String jsonString = JSONObject.toJSONString(hmPaymentOrderDTO);
                //JSONObject jsonObject = HttpUtil.requestPost(token, jsonString, JlifeConstant.PAYMENT_ORDER_URL);
                Map<String, Object> request = retryService.requestPost(token, jsonString, JlifeConstant.PAYMENT_ORDER_URL);
                if ("true".equals(request.get("success").toString())) {
                    JSONObject data = (JSONObject) JSON.toJSON(request.get("data"));
                    double total = Double.parseDouble(String.valueOf(data.get("total")));
                    totalPage = (int) total / pageSize;
                    logger.info("totalPage:{}", totalPage);
                    JSONArray items = data.getJSONArray("list");
                    if (CollectionUtils.isEmpty(items)) {
                        return 0;
                    }
                    String filter = this.filter.filter(items.toJSONString());
                    //String aliases = EmojiParser.parseToAliases(items.toJSONString());
                    List<HmPaymentOrder> hmPaymentOrders = JSONObject.parseArray(filter, HmPaymentOrder.class);
                    for (HmPaymentOrder paymentOrder : hmPaymentOrders) {
                        //处理分转元
                        paymentOrder.setOriginFee(paymentOrder.getOriginFee().multiply(BigDecimal.valueOf(0.01)));
                        paymentOrder.setPayFee(null == paymentOrder.getPayFee() ? BigDecimal.ZERO : paymentOrder.getPayFee().multiply(BigDecimal.valueOf(0.01)));

                        row += hmPaymentOrderMapper.insertSelective(paymentOrder);

                        hmPaymentItemSkuMapper.insertByBatch(paymentOrder.getPaymentNo(), paymentOrder.getItemSkuVoList());
                        //同步业务表
                        //同步客户
                        CustomerClient customerClient = insertCustomerClient(phone, paymentOrder.getBuyerName(), "");
                        //订单数据同步
                        Order order = insertOrder(customerClient.getId().intValue(), paymentOrder, paymentOrder.getShopName());
                        //商品同步
                        insertGoods(order, paymentOrder);
                    }
                    //成功
                    hmDownHistoryService.insertDownLog("服务付款单",
                            JlifeConstant.PAYMENT_ORDER_URL, jsonString, hmPaymentOrderDTO.getCreateTimeBegin(), null, 0);
                    pageIndex++;
                } else {
                    //失败
                    hmDownHistoryService.insertDownLog("服务付款单",
                            JlifeConstant.PAYMENT_ORDER_URL, jsonString, hmPaymentOrderDTO.getCreateTimeBegin(), null, 1);
                    return 0;
                }

            } while (pageIndex <= totalPage + 1);
        }
        return row;
    }

    @Override
    public int deleteDistinctData(DateTime dateTime) {
        return hmPaymentOrderMapper.deleteDistinctData(dateTime);
    }

    @Override
    public int updatePaymentOrderList() {
        HmToken hmToken = hmTokenMapper.selectAll();
        String token = hmToken.getToken();
        //获取数据库最新一条盒马数据
        HmPaymentOrder hmPaymentOrder = hmPaymentOrderMapper.selectNewOne(null);

        if (null == hmPaymentOrder) {
            return 0;
        }

        DateTime startTime = DateUtil.lastMonth();
        DateTime endTime = new DateTime();
        hmPaymentOrderMapper.deleteByBetWeenTime(startTime, endTime);

        int row = 0;
        for (int i = 0; i < 2; i++) {
            if (0 != i) {
                token = hmToken.getSubToken();
            }

            int totalPage;
            int pageIndex = JlifeConstant.PAGE_INDEX;
            int pageSize = JlifeConstant.PAGE_SIZE;

            do {
                HmPaymentOrderDTO hmPaymentOrderDTO = new HmPaymentOrderDTO();
                hmPaymentOrderDTO.setPageSize(pageSize);
                hmPaymentOrderDTO.setPageIndex(pageIndex);
                hmPaymentOrderDTO.setCreateTimeBegin(DateUtil.formatDateTime(startTime));
                hmPaymentOrderDTO.setCreateTimeEnd(DateUtil.formatDateTime(endTime));

                String jsonString = JSONObject.toJSONString(hmPaymentOrderDTO);
                //JSONObject jsonObject = HttpUtil.requestPost(token, jsonString, JlifeConstant.PAYMENT_ORDER_URL);
                Map<String, Object> request = retryService.requestPost(token, jsonString, JlifeConstant.PAYMENT_ORDER_URL);
                if ("true".equals(request.get("success").toString())) {
                    JSONObject data = (JSONObject) JSON.toJSON(request.get("data"));
                    double total = Double.parseDouble(String.valueOf(data.get("total")));
                    totalPage = (int) total / pageSize;
                    logger.info("totalPage:{}", totalPage);
                    JSONArray items = data.getJSONArray("list");
                    if (CollectionUtils.isEmpty(items)) {
                        return 0;
                    }
                    String filter = this.filter.filter(items.toJSONString());
                    //String aliases = EmojiParser.parseToAliases(items.toJSONString());
                    List<HmPaymentOrder> hmPaymentOrders = JSONObject.parseArray(filter, HmPaymentOrder.class);
                    for (HmPaymentOrder paymentOrder : hmPaymentOrders) {
                        HmPaymentOrder hmPaymentOrder1 = hmPaymentOrderMapper.selectByPaymentNo(paymentOrder.getPaymentNo());
                        //判断订单是否存在，存在删除订单
                        if (hmPaymentOrder1 != null) {
                            hmPaymentOrderMapper.deleteByPrimaryKey(hmPaymentOrder1.getId());
                            hmPaymentItemSkuMapper.deleteByPaymentNo(hmPaymentOrder1.getPaymentNo());
                        }

                        //处理分转元
                        paymentOrder.setOriginFee(paymentOrder.getOriginFee().multiply(BigDecimal.valueOf(0.01)));
                        paymentOrder.setPayFee(null == paymentOrder.getPayFee() ? BigDecimal.ZERO : paymentOrder.getPayFee().multiply(BigDecimal.valueOf(0.01)));

                        row += hmPaymentOrderMapper.insertSelective(paymentOrder);

                        hmPaymentItemSkuMapper.insertByBatch(paymentOrder.getPaymentNo(), paymentOrder.getItemSkuVoList());
                        //同步业务表
                        etl_to_product(paymentOrder);
                    }
                    //成功
                    hmDownHistoryService.insertDownLog("服务付款单",
                            JlifeConstant.PAYMENT_ORDER_URL, jsonString, hmPaymentOrderDTO.getCreateTimeBegin(), null, 0);
                    pageIndex++;
                } else {
                    //失败
                    hmDownHistoryService.insertDownLog("服务付款单",
                            JlifeConstant.PAYMENT_ORDER_URL, jsonString, hmPaymentOrderDTO.getCreateTimeBegin(), null, 1);
                    return 0;
                }

            } while (pageIndex <= totalPage + 1);
        }
        return row;
    }

    @Override
    public int updateByPaymentNo(String paymentNo, String stationCode) {

        HmToken hmToken = hmTokenMapper.selectAll();
        String token = hmToken.getToken();
        if ("147001".equals(stationCode) || StringUtils.isBlank(stationCode)) {
            token = hmToken.getSubToken();
        }

        HmPaymentOrderDTO hmPaymentOrderDTO = new HmPaymentOrderDTO();
        hmPaymentOrderDTO.setPaymentNo(paymentNo);
        String jsonString = JSONObject.toJSONString(hmPaymentOrderDTO);
        //JSONObject jsonObject = HttpUtil.requestPost(token, jsonString, JlifeConstant.BOOK_ORDER_URL);

        Map<String, Object> request = retryService.requestPost(token, jsonString, JlifeConstant.PAYMENT_ORDER_URL);

        if ("true".equals(request.get("success").toString())) {
            JSONObject data = (JSONObject) JSON.toJSON(request.get("data"));

            JSONArray items = data.getJSONArray("list");
            if (CollectionUtils.isEmpty(items)) {
                return 0;
            }
            String filter = this.filter.filter(items.toJSONString());
            //String aliases = EmojiParser.parseToAliases(items.toJSONString());
            List<HmPaymentOrder> hmPaymentOrders = JSONObject.parseArray(filter, HmPaymentOrder.class);
            for (HmPaymentOrder paymentOrder : hmPaymentOrders) {
                HmPaymentOrder hmPaymentOrder1 = hmPaymentOrderMapper.selectByPaymentNo(paymentOrder.getPaymentNo());
                //判断订单是否存在，存在删除订单
                if (hmPaymentOrder1 != null) {
                    hmPaymentOrderMapper.deleteByPrimaryKey(hmPaymentOrder1.getId());
                    hmPaymentItemSkuMapper.deleteByPaymentNo(hmPaymentOrder1.getPaymentNo());
                }

                //处理分转元
                paymentOrder.setOriginFee(paymentOrder.getOriginFee().multiply(BigDecimal.valueOf(0.01)));
                paymentOrder.setPayFee(null == paymentOrder.getPayFee() ? BigDecimal.ZERO : paymentOrder.getPayFee().multiply(BigDecimal.valueOf(0.01)));

                hmPaymentOrderMapper.insertSelective(paymentOrder);

                hmPaymentItemSkuMapper.insertByBatch(paymentOrder.getPaymentNo(), paymentOrder.getItemSkuVoList());
                //同步业务表
                etl_to_product(paymentOrder);
            }
            //成功
            hmDownHistoryService.insertDownLog("服务付款单",
                    JlifeConstant.PAYMENT_ORDER_URL, jsonString, hmPaymentOrderDTO.getCreateTimeBegin(), null, 0);
            return 1;
        } else {
            //失败
            hmDownHistoryService.insertDownLog("服务付款单",
                    JlifeConstant.PAYMENT_ORDER_URL, jsonString, hmPaymentOrderDTO.getCreateTimeBegin(), null, 1);
            return 0;
        }

    }

    /**
     * 订单状态设置
     *
     * @param status
     * @return
     */
    private Short setOrderStatus(Integer status) {
        short orderStatus = 101;
        if (status == null) {
            return orderStatus;
        }
        if (6 == status) {
            orderStatus = 102;
        } else if (3 == status) {
            orderStatus = 202;
        } else if (1 == status || 4 == status || 5 == status) {
            orderStatus = 201;
        } else if (7 == status) {
            orderStatus = 301;
        } else if (9 == status) {
            orderStatus = 401;
        }
        return orderStatus;
    }

    /**
     * 同步到生产库表
     *
     * @param paymentOrder
     */
    public void etl_to_product_update(HmPaymentOrder paymentOrder) {
        Order order = orderMapper.selectByServiceConatctNo(paymentOrder.getServiceContractNo());
        if (order == null) {
            etl_to_product(paymentOrder);
        } else {
            Order orders = new Order();
            orders.setOrderStatus(setOrderStatus(paymentOrder.getStatus()));
            orders.setUpdateTime(new Date());
            orders.setId(order.getId());
//           System.out.println(orders.getOrderStatus());

            orderMapper.updateByPrimaryKeySelective(orders);
        }
    }

    /**
     * 同步到生产库表
     *
     * @param paymentOrder
     */
    private void etl_to_product(HmPaymentOrder paymentOrder) {
        HmBookOrder hmBookOrder = hmBookOrderMapper.selectByPaymentNo(paymentOrder.getPaymentNo());
        if (null != hmBookOrder) {
            //同步客户
            String phone = paymentOrder.getBuyerPhone();
            //手机号，首选取订单customerphone，如果没有就去buyerphone，再次就是
            if (phone == null) {
                phone = paymentOrder.getCustomerPhone() == null ? hmBookOrder.getPhone() : paymentOrder.getCustomerPhone();
            }

            CustomerClient customerClient = insertCustomerClient(phone, hmBookOrder.getUserName(), hmBookOrder.getAddress());
            //订单数据同步
            Order order = insertOrder(customerClient.getId().intValue(), paymentOrder, hmBookOrder.getShopName());
            //商品同步
            insertGoods(order, paymentOrder);
        }
    }

    /**
     * 订单插入
     *
     * @param userId
     * @param paymentOrder
     * @return
     */
    private Order insertOrder(int userId, HmPaymentOrder paymentOrder, String shopName) {
        Order order = orderMapper.selectByOrderSn(paymentOrder.getPaymentNo());
        if (null != order) {
            //删除订单
            orderMapper.deleteByPrimaryKey(order.getId());
            //删除订单商品
            orderGoodsMapper.deleteByOrderId(order.getId());
        }
        order = new Order();
        order.setUserId(userId);
        order.setOrderSn(paymentOrder.getPaymentNo());
        order.setOrderStatus(setOrderStatus(paymentOrder.getStatus()));
        order.setOrderServiceStatus(paymentOrder.getStatus().shortValue());
        order.setOrderChannel(4);
        if (StringUtils.isNotBlank(paymentOrder.getShopCode())) {
            JzShop jzShop = jzShopMapper.selectByShopNo(paymentOrder.getShopCode());
            if (null == jzShop) {
                //门店不存在 新增一个门店
                jzShop = new JzShop();
                jzShop.setShopChannel(4);
                jzShop.setShopName(shopName);
                jzShop.setShopNo(paymentOrder.getShopCode());
                jzShop.setShopName(shopName);
                String city = null;
                if (shopName.length() > 3) {
                    city = shopName.substring(0, 2);
                }
                jzShop.setShopCityName(city);
                jzShopMapper.insertSelective(jzShop);
            }
            order.setOrderShopId(jzShop.getId());
        }

        order.setConsignee(paymentOrder.getBuyerName());
        order.setMobile(paymentOrder.getBuyerPhone());
        order.setOrderPrice(paymentOrder.getOriginFee());
        order.setActualPrice(null == paymentOrder.getPayFee() ? BigDecimal.ZERO : paymentOrder.getPayFee());
//        order.setOrderPrice(paymentOrder.getOriginFee().multiply(BigDecimal.valueOf(0.01)));
//        order.setActualPrice(null == paymentOrder.getPayFee() ? BigDecimal.ZERO : paymentOrder.getPayFee().multiply(BigDecimal.valueOf(0.01)));
        order.setPayTime(paymentOrder.getPayTime());
        order.setImportTime(new Date());
        order.setCreateTime(paymentOrder.getCreateTime());
        order.setDeleted(true);
        order.setServiceContractNo(paymentOrder.getServiceContractNo());
        orderMapper.insertSelective(order);
        return order;
    }

    /**
     * 插入客户
     *
     * @param phone
     * @return
     */
    private CustomerClient insertCustomerClient(String phone, String userName, String address) {
        CustomerClient customerClient = customerClientMapper.selectByTel(phone);
        if (null == customerClient) {
            customerClient = new CustomerClient();
            customerClient.setCustomerAddr(address);
            customerClient.setCustomerNo(customerClientMapper.selectCustomerNo());
            customerClient.setTel(phone);
            customerClient.setSource("hema");
            customerClient.setChannelId(4);
            if (StringUtils.isNotBlank(userName)) {
                customerClient.setCustomerName(userName);
            }
            customerClientMapper.insertSelective(customerClient);
        }
        return customerClient;
    }

    /**
     * 新增商品
     *
     * @param order
     * @param paymentOrder
     */
    private void insertGoods(Order order, HmPaymentOrder paymentOrder) {
        for (HmPaymentItemSku hmPaymentItemSku : paymentOrder.getItemSkuVoList()) {
            Goods goods = goodsMapper.selectByGoodsSn(hmPaymentItemSku.getItemId());
            if (null == goods) {
                goods = new Goods();
                goods.setGoodsSn(hmPaymentItemSku.getItemId());
                goods.setName(hmPaymentItemSku.getItemName());
                goods.setCounterPrice(hmPaymentItemSku.getOriginCostPrice().multiply(BigDecimal.valueOf(0.01)));
                goods.setRetailPrice(hmPaymentItemSku.getOriginCostPrice().multiply(BigDecimal.valueOf(0.01)));
                goods.setDeleted(true);
                goods.setCreateTime(new Date());
                goodsMapper.insertSelective(goods);
            }
            OrderGoods orderGoods = new OrderGoods();
            orderGoods.setOrderId(order.getId());
            orderGoods.setGoodsId(goods.getId());
            orderGoods.setGoodsName(hmPaymentItemSku.getItemName());
            orderGoods.setGoodsSn(hmPaymentItemSku.getItemId());
            orderGoods.setNumber(hmPaymentItemSku.getBuyAmount().shortValueExact());
            orderGoods.setPrice(hmPaymentItemSku.getCostPrice().multiply(BigDecimal.valueOf(0.01)));
            orderGoods.setAddTime(paymentOrder.getCreateTime());
            orderGoods.setDeleted(true);
            orderGoodsMapper.insertSelective(orderGoods);
        }
    }
}
