package com.hzs.sale.order.controller.api;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.hzs.common.core.annotation.RepeatSubmit;
import com.hzs.common.core.config.BdConfig;
import com.hzs.common.core.constant.CacheConstants;
import com.hzs.common.core.constant.HttpStatus;
import com.hzs.common.core.constant.msg.MemberMsgConstants;
import com.hzs.common.core.constant.msg.SaOrderMsgConstants;
import com.hzs.common.core.enums.EDelivery;
import com.hzs.common.core.enums.EOrderType;
import com.hzs.common.core.enums.ESpecialArea;
import com.hzs.common.core.utils.StringUtils;
import com.hzs.common.core.web.domain.AjaxResult;
import com.hzs.common.domain.member.base.CuMember;
import com.hzs.common.domain.member.ext.CuMemberAccountExt;
import com.hzs.common.domain.sale.ext.SaOrderExt;
import com.hzs.common.domain.sale.order.SaOrder;
import com.hzs.common.security.utils.SecurityUtils;
import com.hzs.common.core.utils.TransactionUtils;
import com.hzs.sale.order.controller.ParentOrderController;
import com.hzs.sale.order.param.CuMemberAccountParam;
import com.hzs.sale.order.param.OrderParam;
import com.hzs.sale.order.param.OrderReturn;
import com.hzs.sale.shopping.vo.ShoppingCartVO;
import com.hzs.system.config.IGradeServiceApi;
import com.hzs.system.config.dto.GradeDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * 订单控制类
 */
@RestController
@RequestMapping("/api/order")
@Slf4j
public class ApiRegSaOrderController extends ParentOrderController {

    @DubboReference
    IGradeServiceApi gradeServiceApi;

    /**
     * 确认注册订单，生成待支付订单,只有注册订单有待支付订单
     *
     * @param orderParam 订单参数
     */
    @PostMapping("/confirm-reg-order")
    @RepeatSubmit
    public AjaxResult confirmRegisterOrder(@Validated @RequestBody OrderParam orderParam,
                                           @RequestHeader("Source") Integer source) {
        if (orderParam.getDeleteList() == null || orderParam.getDeleteList().size() == 0) {
            return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.SPECIAL_AREA_NOT_EMPTY));
        }
        // 查询是否生成待支付订单
        initSecurityOrderParam(orderParam);
        // 验证必输项
        if (source == null || validateFieldNotNull(orderParam, orderParam.getValidConfirmField()) ||
                !checkRecMsgBoolean(orderParam)) {
            return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.REQUIRED_NOT_EMPTY));
        }

        orderParam.setSource(source);
        AjaxResult result = validateSaveMember(orderParam);
        if ((Integer) result.get(AjaxResult.CODE_TAG) == HttpStatus.ERROR) {
            return result;
        }
        convertShoppingCarToSku(orderParam);

        if (getOrderService().confirmRegSaOrderByOrderParam(orderParam)) {
            //删除购物车下单的数据
            if (CollectionUtil.isNotEmpty(orderParam.getDeleteList())) {
                ShoppingCartVO sop = new ShoppingCartVO();
                sop.setDeleteList(orderParam.getDeleteList());
                shoppingCartService.batchDelShopping(SecurityUtils.getUserId(), sop);
            }
            return AjaxResult.success(OrderReturn.builder().orderCode(orderParam.getOrderCode()).specialArea(orderParam.getSpecialArea()).build());
        } else {
            return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.PARENT_NO_JURISDICTION));
        }
    }

    /**
     * 支付注册订单，生成支付订单或者更新待支付订单
     *
     * @param orderParam 订单参数
     */
    @PostMapping("/pay-reg-order")
    @RepeatSubmit
    public AjaxResult payRegisterOrder(@RequestBody OrderParam orderParam) {
        initSecurityOrderParam(orderParam);
        // 判断是否是待支付，待支付的话验证订单编号是否存在
        if (orderParam.getSpecialArea() == null) {
            return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.ORDER_TYPE_EMPTY));
        }
        boolean isToBePay = getOrderService().getIsToBePayByOrderType(orderParam.getPkSettleCountry(), orderParam.getSpecialArea());
        CuMember newCuMember;
        SaOrderExt saOrderExt;
        boolean isHaiFun = false;

        if (isToBePay) {
            if (StringUtils.isEmpty(orderParam.getPayPwd())) {
                return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.MEMBER_PASSWORD_EMPTY));
            }
            if (StringUtils.isEmpty(orderParam.getOrderCode())) {
                return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.ORDER_CODE_EMPTY));
            }
            saOrderExt = getOrderService().querySaleOrderExtByOrderCode(getSaOrderQueryParam(orderParam), null);
            if (saOrderExt == null) {
                return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.ORDER_EMPTY));
            }

            // 缓存中获取银行等信息
            OrderParam cacheOrderParam = redisService.getCacheObject(CacheConstants.TEMP_PARAM + SecurityUtils.getUserId() + orderParam.getOrderCode());
            if (null != cacheOrderParam) {
                saOrderExt.setPkBank(cacheOrderParam.getPkBank());
                saOrderExt.setCardNumber(cacheOrderParam.getCardNumber());
                saOrderExt.setSubBankName(cacheOrderParam.getSubBankName());
                saOrderExt.setAccountName(cacheOrderParam.getAccountName());
                saOrderExt.setIdCard(cacheOrderParam.getIdCard());
            }

            newCuMember = getOrderService().getCuMemberByKey(saOrderExt.getPkMember());
        } else {
            String payPwd = orderParam.getPayPwd();
            orderParam = redisService.getCacheObject(CacheConstants.TEMP_PARAM + SecurityUtils.getUserId() + orderParam.getOrderCode());
            initSecurityOrderParam(orderParam);
            orderParam.setPayPwd(payPwd);
            // 验证必输项
            if (validateFieldNotNull(orderParam, orderParam.getValidSaveField())) {
                return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.REQUIRED_NOT_EMPTY));
            }

            AjaxResult result = validateSaveMember(orderParam);
            if ((Integer) result.get(AjaxResult.CODE_TAG) == HttpStatus.ERROR) {
                return result;
            }
            String orderCode = orderParam.getOrderCode();
            newCuMember = getOrderService().packageCuMember(orderParam);
            if (StringUtils.isNotEmpty(orderParam.getMemberCode())) {
                newCuMember.setMemberCode(orderParam.getMemberCode());
            }
            saOrderExt = getOrderService().packageSaOrder(orderParam, newCuMember);
            if (saOrderExt == null) {
                return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.ORDER_MEMBER_CACHE));
            }
            saOrderExt.setOrderCode(orderCode);
        }

        // 查询报单会员账户信息
        AjaxResult result = validateMemberAccount(orderParam);
        if ((Integer) result.get(AjaxResult.CODE_TAG) == HttpStatus.ERROR) {
            return result;
        }
        OrderParam oldOrderParam = redisService.getCacheObject(CacheConstants.TEMP_PARAM + SecurityUtils.getUserId() + orderParam.getOrderCode());
        if (oldOrderParam == null) {
            oldOrderParam = new OrderParam();
            oldOrderParam.setPkSettleCountry(SecurityUtils.getPkCountry());
        }

        CuMemberAccountExt cuMemberAccountExt = (CuMemberAccountExt) result.get(AjaxResult.DATA_TAG);
        // 对安置位置加锁
        if (validatePlacePosition(orderParam.getPlaceParentId(), orderParam.getPlaceDept())) {
            // 验证余额状态
            // 验证会员账户余额是否足够支付
            getOrderService().queryOrderSpendDetails(cuMemberAccountExt, saOrderExt, saOrderExt.getOrderItemsList());
            if (cuMemberAccountExt.getIsPayment()) {
                // 开始支付 扣款
                getOrderService().payRegSaOrder(saOrderExt, newCuMember, cuMemberAccountExt, isHaiFun);
            } else {
                if (StringUtils.isEmpty(cuMemberAccountExt.getErrorMsg())) {
                    return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.MEMBER_BALANCE_NOT_PAY));
                } else {
                    return AjaxResult.error(cuMemberAccountExt.getErrorMsg());
                }
            }
            // 保存逻辑 保存订单、保存会员
        } else {
            return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.PLACE_PARENT_DEPT_EXIST));
        }
        OrderReturn orderReturn = OrderReturn.builder()
                .memberCode(newCuMember.getMemberCode())
                .memberName(newCuMember.getMemberName())
                .phone(newCuMember.getPhone())
                .email(newCuMember.getEmail())
                .loginPassword(newCuMember.getLoginPassword())
                .payPassword(newCuMember.getPayPassword())
                .urlAddress(BdConfig.getPc())
                .build();
        return AjaxResult.success(orderReturn);
    }

    /**
     * 查询订单
     *
     * @param orderParam 订单参数
     */
    @PostMapping("/query-order")
    public AjaxResult queryOrder(@RequestBody OrderParam orderParam) {
        log.info(orderParam.getOrderCode());
        initPkCountry(orderParam);
        // 直接支付，从redis中获取
        AjaxResult result = validateOrderParam(orderParam);
        if (result != null) {
            return result;
        }
        SaOrder saOrder;
        boolean isToBePay = getOrderService().getIsToBePayByOrderType(orderParam.getPkSettleCountry(), orderParam.getSpecialArea());

        if (isToBePay) {
            // 从数据库中获取
            saOrder = getOrderService().querySaleOrderByOrderCode(getSaOrderQueryParam(orderParam));
            if (saOrder == null) {
                return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.ORDER_EMPTY));
            }
        } else {
            SaOrderExt saOrderExt = redisService.getCacheObject(CacheConstants.TEMP_ORDER + SecurityUtils.getUserId() + orderParam.getOrderCode());
            if (saOrderExt == null) {
                return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.ORDER_EMPTY));
            }
            saOrder = BeanUtil.copyProperties(saOrderExt, SaOrder.class);
        }

        OrderReturn orderReturn = getOrderReturn(saOrder, orderParam);
        if (isToBePay) {
            CuMember cuMember = getOrderService().getCuMemberByKey(saOrder.getPkMember());
            if (cuMember != null) {
                orderReturn.setMemberCode(cuMember.getMemberCode());
                orderReturn.setMemberName(cuMember.getMemberName());
                if (EOrderType.REGISTER_ORDER.getValue() == saOrder.getOrderType()) {
                    CuMember parentCuMember = getOrderService().getCuMemberByKey(cuMember.getPkParent());
                    CuMember placeCuMember = getOrderService().getCuMemberByKey(cuMember.getPkPlaceParent());
                    GradeDTO gradeDTO = gradeServiceApi.getGrade(cuMember.getPkSettleGrade()).getData();
                    orderReturn.setPkGrade(gradeDTO.getPkTransaction());
                    orderReturn.setPhone(cuMember.getPhone());
                    orderReturn.setParent(parentCuMember.getMemberCode());
                    orderReturn.setParentName(parentCuMember.getMemberName());
                    orderReturn.setPlaceParent(placeCuMember.getMemberCode());
                    orderReturn.setPlaceParentName(placeCuMember.getMemberName());
                    orderReturn.setPlaceDept(cuMember.getPlaceDept());
                    orderReturn.setSource(cuMember.getSource());
                } else if (EOrderType.UPGRADE_ORDER.getValue() == saOrder.getOrderType()) {
                    getOrderService().setLastCuMemberGrade(cuMember, saOrder);
                    GradeDTO gradeDTO = gradeServiceApi.getGrade(cuMember.getPkSettleGrade()).getData();
                    orderReturn.setPkGrade(gradeDTO.getPkTransaction());
                }
            }
        } else if (EOrderType.PICK_ORDER.getValue() == orderParam.getSpecialArea()) {
            // 提货订单，因为没有缓存的请求入参，只有缓存的订单数据，此处需要单独处理一下会员信息
            CuMember cuMember = getOrderService().getCuMemberByKey(saOrder.getPkMember());
            orderReturn.setMemberCode(cuMember.getMemberCode());
            orderReturn.setMemberName(cuMember.getMemberName());
            // 支付过期时间，目前与缓存订单时间保持一致30分钟
            orderReturn.setPayTime(CacheConstants.MEMBER_REFRESH_TIME * 60);
        } else {
            orderParam = redisService.getCacheObject(CacheConstants.TEMP_PARAM + SecurityUtils.getUserId() + orderParam.getOrderCode());
            GradeDTO gradeDTO = gradeServiceApi.getGrade(orderParam.getPkGrade()).getData();
            orderReturn.setMemberCode(orderParam.getMemberCode());
            orderReturn.setMemberName(orderParam.getMemberName());
            orderReturn.setPkGrade(gradeDTO.getPkTransaction());
            orderReturn.setPhone(orderParam.getPhone());
            orderReturn.setParent(orderParam.getParent());
            orderReturn.setParentName(orderParam.getParentName());
            orderReturn.setPlaceParent(orderParam.getPlaceParent());
            orderReturn.setPlaceParentName(orderParam.getPlaceParentName());
            orderReturn.setPlaceDept(orderParam.getPlaceDept());
            orderReturn.setSource(orderParam.getSource());
        }
        return AjaxResult.success(orderReturn);
    }

    /**
     * 查询订单邮费
     *
     * @param orderParam 订单参数
     */
    @PostMapping("/query-order-postage")
    public AjaxResult queryOrderPostage(@RequestBody OrderParam orderParam) {
        if (orderParam.getDeleteList() == null || orderParam.getDeleteList().size() == 0) {
            return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.SPECIAL_AREA_NOT_EMPTY));
        }
        // 验证必输项，一个条件未填写都不计算邮费
        if (checkRecPostageMsgBoolean(orderParam) && orderParam.getDeliveryWay() == EDelivery.FAST_MAIL.getValue()) {
            initSecurityOrderParam(orderParam);
            convertShoppingCarToSku(orderParam);
            getOrderService().queryPostageByParam(orderParam);
        }
        return AjaxResult.success(OrderReturn.builder().postage(orderParam.getPostage()).build());
    }

    /**
     * 自助服务-修改收货地址邮费计算
     **/
    @PostMapping("/self-order-postage")
    public AjaxResult selfOrderPostage(@RequestBody OrderParam orderParam) {
        // 验证必输项，一个条件未填写都不计算邮费
        if (checkRecPostageMsgBoolean(orderParam) && orderParam.getDeliveryWay() == EDelivery.FAST_MAIL.getValue()) {
            initSecurityOrderParam(orderParam);
            getOrderService().queryPostageByParam(orderParam);
        }
        return AjaxResult.success(OrderReturn.builder().postage(orderParam.getPostage()).build());
    }


    /**
     * 查询订单消费明细
     *
     * @param orderParam 订单参数
     */
    @PostMapping("/query-spend-details")
    public AjaxResult queryOrderSpendDetails(@RequestBody OrderParam orderParam) {
        log.info(orderParam.getOrderCode());
        initPkCountry(orderParam);
        AjaxResult result = validateOrderParam(orderParam);
        if (result != null) {
            return result;
        }
        boolean isToBePay = getOrderService().getIsToBePayByOrderType(orderParam.getPkSettleCountry(), orderParam.getSpecialArea());

        SaOrderExt saOrder;
        if (isToBePay) {
//                saOrder = getOrderService().querySaleOrderByOrderCode(getSaOrderQueryParam(orderParam));
            saOrder = getOrderService().querySaleOrderExtByOrderCode(getSaOrderQueryParam(orderParam), null);
        } else {
            // 直接支付，从redis中获取
            SaOrderExt saOrderExt = redisService.getCacheObject(CacheConstants.TEMP_ORDER + SecurityUtils.getUserId() + orderParam.getOrderCode());
            saOrder = BeanUtil.copyProperties(saOrderExt, SaOrderExt.class);
        }
        if (saOrder == null || StringUtils.isEmpty(saOrder.getOrderCode())) {
            return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.ORDER_MEMBER_CACHE));
        }

        // 获取账户，验证账户
        List<CuMemberAccountExt> cuMemberAccountExtList = getOrderService().queryMemberAccountByCondition(getCuMemberAccount(orderParam));
        if (cuMemberAccountExtList == null || cuMemberAccountExtList.size() == 0) {
            return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.CENTER_NOT_EXISTS));
        }
        CuMemberAccountExt cuMemberAccountExt = cuMemberAccountExtList.get(0);
        // 验证会员账户余额是否足够支付
        getOrderService().queryOrderSpendDetails(cuMemberAccountExt, saOrder, saOrder.getOrderItemsList());
        CuMemberAccountParam cuMemberAccountParam = BeanUtil.copyProperties(cuMemberAccountExt, CuMemberAccountParam.class);
        return AjaxResult.success(cuMemberAccountParam);
    }

    private AjaxResult validateOrderParam(@RequestBody OrderParam orderParam) {
        initSecurityOrderParam(orderParam);
        if (orderParam.getSpecialArea() == null) {
            return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.ORDER_TYPE_EMPTY));
        }
        if (StringUtils.isEmpty(orderParam.getOrderCode())) {
            return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.ORDER_CODE_EMPTY));
        }
        return null;
    }

    /**
     * 验证手机号+姓名
     *
     * @param orderParam 手机号、姓名
     */
    @Override
    @PostMapping("/valid-phone")
    public AjaxResult validatePhone(@RequestBody OrderParam orderParam) {
        initPkCountry(orderParam);
        return super.validatePhone(orderParam);
    }

    /**
     * 验证推荐编号、推荐关系，成功后返回姓名,只有注册订单调用
     *
     * @param orderParam 必须推荐人
     */
    @Override
    @PostMapping("/valid-p-code")
    public AjaxResult validateReferenceRelation(@RequestBody OrderParam orderParam) {
        // 报单中心只能是登陆人
        orderParam.setCenterCodeId(SecurityUtils.getUserId());
        initPkCountry(orderParam);
        return super.validateReferenceRelation(orderParam);
    }

    /**
     * 验证安置编号，成功后返回姓名
     *
     * @param orderParam 必须安置人 当传输的值中安置部门不为空时，校验安置位置
     */
    @Override
    @PostMapping("/valid-p-p-code")
    public AjaxResult validatePlaceParentMemberCode(@RequestBody OrderParam orderParam) {
        initPkCountry(orderParam);
        return super.validatePlaceParentMemberCode(orderParam);
    }


    /**
     * 空单注册 验证权限，验证编号是否有报单权限
     */
    @PostMapping("/valid-authority")
    public AjaxResult validateRegisterAuthority() {
        // 前台登录验证登录会员，后台空点验证输入的报单人
        return super.validateRegisterAuthority(SecurityUtils.getUserId());
    }

    /**
     * 校验会员等级, 计算会员等级
     *
     * @param orderParam 参数
     */
    @PostMapping("/valid-mem-level")
    public AjaxResult validateMemberLevel(@RequestBody OrderParam orderParam) {
        if (orderParam.getSpecialArea() == null || orderParam.getDeleteList() == null || orderParam.getDeleteList().size() == 0) {
            return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.SPECIAL_AREA_NOT_EMPTY));
        }
        if (orderParam.getOrderItemsParams() == null ||
                orderParam.getOrderItemsParams().size() == 0) {
            return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.SHOPPING_CAR));
        }
        orderParam.setCenterCodeId(SecurityUtils.getUserId());
        convertShoppingCarToSku(orderParam);

        // 计算等级
        if (EOrderType.UPGRADE_ORDER.getValue() == ESpecialArea.getOrderTypeValue(orderParam.getSpecialArea())) {
            if (orderParam.getUpgradeMemberCode() == null) {
                orderParam.setCenterCodeId(SecurityUtils.getUserId());
            } else {
                CuMember cuMember = getCuMemberByCode(orderParam.getUpgradeMemberCode());
                orderParam.setCenterCodeId(cuMember.getPkId());
            }
        }
        initPkCountry(orderParam);
        OrderReturn orderReturn = getOrderService().computeLevel(orderParam);
        if (orderReturn.getIsEnough()) {
            return AjaxResult.success(orderReturn);
        } else {
            if (EOrderType.UPGRADE_ORDER.getValue() == ESpecialArea.getOrderTypeValue(orderParam.getSpecialArea())) {
                return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.LEVEL_NOT_ENOUGH));
            } else {
                return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.REGISTER_LEVEL_NOT_ENOUGH));
            }
        }
    }

    /*
     *  沙棘创客礼包仅为vip级会员开放
     **/
    @PostMapping("/valid-enough-shop")
    public AjaxResult validateEnoughShop(@RequestBody OrderParam orderParam) {
        return AjaxResult.success();
    }

    /**
     * 快速注册
     *
     * @param orderParam 参数
     */
    @PostMapping("/quick-reg")
    public AjaxResult quickRegistration(@RequestBody OrderParam orderParam) {
        if (orderParam.getSpecialArea() == null) {
            return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.SPECIAL_AREA_NOT_EMPTY));
        }
        if (StringUtils.isEmpty(orderParam.getParent())) {
            orderParam.setParentId(SecurityUtils.getUserId());
            CuMember parentCuMember = getOrderService().getCuMemberByKey(orderParam.getParentId());
            orderParam.setParentName(parentCuMember.getMemberName());
        } else {
            CuMember parentCuMember = getCuMemberByCode(orderParam.getParent().toUpperCase());
            if (parentCuMember == null) {
                return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.PARENT_NOT_EXISTS));
            }
            orderParam.setParentId(parentCuMember.getPkId());
            orderParam.setParentName(parentCuMember.getMemberName());
        }
        CuMember cuMember = CuMember.builder()
                .pkParent(orderParam.getParentId())
                .memberName(orderParam.getMemberName())
                .memberCode(orderParam.getMemberCode())
                .pkSettleCountry(SecurityUtils.getPkCountry())
                .build();
        boolean isFirst = getOrderService().validateFirstOrder(cuMember.getPkParent(), cuMember.getPkSettleCountry());
        cuMember = getOrderService().obtainLastResettleByRecommend(cuMember, Boolean.TRUE, isFirst);
        return AjaxResult.success(OrderReturn.builder()
                .isFirst(isFirst)
                .parentName(orderParam.getParentName())
                .placeParent(cuMember.getMemberCode())
                .placeParentName(cuMember.getMemberName())
                .placeDept(cuMember.getPlaceDept()).build());
    }

    /**
     * 快速注册
     *
     * @param orderParam 参数
     */
    @PostMapping("/update-default")
    public AjaxResult setRegisterDefault(@RequestBody OrderParam orderParam) {
        if (orderParam.getDisplayDefault() == null) {
            orderParam.setDisplayDefault(0);
        }
        redisService.setCacheObject(CacheConstants.MEMBER_DEFAULT_DISPLAY + SecurityUtils.getUserId(), orderParam.getDisplayDefault(), CacheConstants.MEMBER_REFRESH_TIME, TimeUnit.DAYS);
        return AjaxResult.success();
    }

    /**
     * 快速注册
     */
    @GetMapping("/query-default")
    public AjaxResult setRegisterDefault() {
        Integer displayDefault = redisService.getCacheObject(CacheConstants.MEMBER_DEFAULT_DISPLAY + SecurityUtils.getUserId());
        return AjaxResult.success(OrderReturn.builder().displayDefault(displayDefault == null ? 0 : displayDefault).build());
    }

}
