package com.ruoyi.web.controller.api;

/**
 * @ClassName ApiPayController
 * @Description 请描述类的业务用途
 * @Author linlinee
 * @Date 2021/12/1 5:47 PM
 * @Version 1.0
 **/

import com.alibaba.fastjson.JSON;
import com.google.gson.JsonObject;
import com.ruoyi.common.annotation.RateLimiter;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.utils.ApiResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.JPushUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.weiXin.WeiXinUtils;
import com.ruoyi.mall.domain.MallMemberUser;
import com.ruoyi.mall.domain.MallOrderOrder;
import com.ruoyi.mall.domain.MemberOrderdto;
import com.ruoyi.mall.domain.dto.MallAppOrderOrderDTO;
import com.ruoyi.mall.domain.dto.MallOrderGoodsDTO;
import com.ruoyi.mall.domain.dto.MallOrderOrderDTO;
import com.ruoyi.mall.domain.dto.MallOrderOrderPO;
import com.ruoyi.mall.domain.vo.MallOrderGoodsVO;
import com.ruoyi.mall.service.*;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.web.controller.utils.PayCommonUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;

@RequestMapping("/api/pay")
@Controller
public class ApiPayController {

    @Autowired
    private IMallOrderOrderService orderOrderService;


    @Autowired
    IMallOrderGoodsService orderGoodsService;

    @Resource
    private IMallSeckillGoodsService mallSeckillGoodsService;

    @Resource
    private IMallMemberUserService mallMemberUserService;

    @Resource
    private IMallGoodsGoodsService mallGoodsGoodsService;

    @Resource
    private IMallCombineOrderLinkService mallCombineOrderLinkService;

    @Resource
    private IMallSalesmanService mallSalesmanService;

    @Resource
    private WeiXinUtils weiXinUtils;

    @Resource
    private SysUserMapper sysUserMapper;

    @Resource
    private JPushUtils jPushUtils;

    //@GetMapping("/test")
    //public void  test(){
    //    List<MallOrderOrder> orderList = orderOrderService.selectMallOrderOrderByTotalOrderSn("1bb110e042264553b3b2411749ec1b6c");
    //
    //    if (!orderList.isEmpty()) {
    //        MallMemberUser memberUser = mallMemberUserService.selectMallMemberUserById(orderList.get(0).getUserId());
    //        for (MallOrderOrder orderOrder : orderList) {
    //
    //            //if (!"0".equals(orderOrder.getStatus())){
    //            //    return "fail";
    //            //}
    //            System.out.println("~~~~~~~~~~~修改订单状态~~~~~~~~~");
    //            // 用户信息
    //
    //            //  验签成功后
    //            if (orderOrder.getDeliveryType() == 0) {
    //                orderOrder.setStatus("1");
    //            } else {
    //                orderOrder.setStatus("2");
    //            }
    //            //// 小程序录入发货信息
    //            //Timer timer = new Timer();
    //            //timer.schedule(new TimerTask() {
    //            //    @Override
    //            //    public void run() {
    //            //        System.out.println(orderSn + "订单和openId" + memberUser.getOpenid());
    //            //        String s = weiXinUtils.deliveryInfo(orderSn, memberUser.getOpenid());
    //            //    }
    //            //}, 300000);
    //
    //
    //            orderOrder.setPayType("1");
    //
    //            orderOrder.setPayAt(DateUtils.getTime());
    //            orderOrderService.updateMallOrderOrder(orderOrder);
    //
    //            // 订单类型（0-普通订单，1-秒杀订单，2-拼团订单）
    //            Integer orderType = orderOrder.getOrderType();
    //
    //            // 2-拼团订单
    //            if (orderType == 2) {
    //                HashMap<String, Object> hashMap = new HashMap<>();
    //                hashMap.put("orderId", orderOrder.getId());
    //                mallCombineOrderLinkService.initiateOrJoinCombine(hashMap);
    //            }
    //
    //            // 销量
    //            List<MallOrderGoodsVO> orderGoodsVOList = orderGoodsService.selectMallOrderGoodsByOrderId(orderOrder.getId());
    //            if (orderGoodsVOList.size() > 0) {
    //                for (MallOrderGoodsVO mallOrderGoodsVO : orderGoodsVOList) {
    //                    Long goodsId = mallOrderGoodsVO.getGoodsId();
    //                    mallGoodsGoodsService.updateMallGoodsGoodsSaleNum(goodsId.intValue(), mallOrderGoodsVO.getTotal());
    //                }
    //            }
    //
    //
    //            //用户历史消费金额
    //
    //            if (ObjectUtils.isNotEmpty(memberUser)) {
    //                memberUser.setAllMoney(memberUser.getAllMoney().add(orderOrder.getPayment()));
    //                mallMemberUserService.updateMallMemberUser(memberUser);
    //            }
    //        }
    //    }
    //
    //}


    @ResponseBody
    @RequestMapping("/weixinpayNotify")
    public Object weixinpayNotify(HttpServletRequest req, HttpServletResponse res) {
        try {
            InputStream inStream = req.getInputStream();
            ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
            byte[] buffer = new byte[1024];
            int len = 0;
            while ((len = inStream.read(buffer)) != -1) {
                outSteam.write(buffer, 0, len);
            }
            System.out.println("~~~~~~~~~~~~~~~~付款成功~~~~~~~~~");
            outSteam.close();
            inStream.close();
            // 获取微信调用我们notify_url的返回信息
            String result = new String(outSteam.toByteArray(), "utf-8");
            Map<Object, Object> mapFromXml = PayCommonUtil.doXMLParse(result);
            SortedMap<String, String> sortedMap = new TreeMap();
            if (mapFromXml.get("result_code").toString().equalsIgnoreCase("SUCCESS")) {
                String orderSn = mapFromXml.get("out_trade_no").toString();
                System.out.println("合单号totalOrderSn=" + orderSn);
                List<MallOrderOrder> orderList = orderOrderService.selectMallOrderOrderByTotalOrderSn(orderSn);

                if (!orderList.isEmpty()) {
                    MallMemberUser memberUser = mallMemberUserService.selectMallMemberUserById(orderList.get(0).getUserId());
                    for (MallOrderOrder orderOrder : orderList) {

                        if (!"0".equals(orderOrder.getStatus())) {
                            return "fail";
                        }
                        System.out.println("~~~~~~~~~~~修改订单状态~~~~~~~~~");
                        // 用户信息

                        //  验签成功后
                        if (orderOrder.getDeliveryType() == 0) {
                            orderOrder.setStatus("1");
                            orderOrder.setOrderStatus("1");
                            orderOrder.setIsPay("1");
                            orderOrder.setIsFinance("1");
                        } else {
                            orderOrder.setStatus("2");
                        }
                        // 小程序录入发货信息
                        Timer timer = new Timer();
                        timer.schedule(new TimerTask() {
                            @Override
                            public void run() {
                                System.out.println(orderSn + "订单和openId" + memberUser.getOpenid());
                                String s = weiXinUtils.deliveryInfo(orderSn, memberUser.getOpenid());
                            }
                        }, 300000);


                        orderOrder.setPayType("1");

                        orderOrder.setPayAt(DateUtils.getTime());
                        orderOrder.setFinanceExamineAt(DateUtils.getTime());
                        orderOrderService.updateMallOrderOrder(orderOrder);

                        Map<String, String> orderInfoParams = new HashMap<>();
                        orderInfoParams.put("orderId", orderOrder.getId().toString());
                        orderInfoParams.put("orderType", "0");
                        String orderInfo = JSON.toJSONString(orderInfoParams);

                        // 极光推送
                        // roleId：1-超级管理员，12-仓库管理员，13-财务，10-分公司管理员，11-业务员
                        Map<String, Object> newParams = new HashMap<>();
                        newParams.put("roleId", 1);
                        String[] userName = sysUserMapper.selectUserNameByParams(newParams);
                        if (userName.length > 0) {
                            System.out.println("新增线上订单-管理员审核推送");
                            try {
                                String url = "intent:#Intent;action=cn.jiguang.myaction;component=com.qdw.qianlengnet/com.qdw.qianlengnet.activity.ChiefAdministratorOrderDetailsActivity;S.orderNo=" + orderOrder.getId().toString() + ";i.orderType=" + 0 + ";end";
                                JsonObject jsonObject = new JsonObject();
                                jsonObject.addProperty("url", url);

                                jPushUtils.jPush(userName, orderOrder.getReceiverName() + orderOrder.getReceiverPhone() + "下单，管理员请及时审核", "线上订单管理员审核", orderInfo, orderInfoParams, jsonObject);
                            } catch (Exception e) {
                                System.out.println("新增线上订单-管理员审核推送异常");
                            }
                        }

                        if (orderOrder.getSalesmanId() != null) {
                            // roleId：1-超级管理员，12-仓库管理员，13-财务，10-分公司管理员，11-业务员
                            Map<String, Object> salesmanParams = new HashMap<>();// 新增线上订单-业务员查看推送
                            salesmanParams.put("roleId", 11);
                            salesmanParams.put("salesmanId", orderOrder.getSalesmanId());
                            String[] salesmanName = sysUserMapper.selectUserNameByParams(salesmanParams);
                            if (salesmanName.length > 0) {
                                System.out.println("新增线上订单-业务员查看推送");
                                try {
                                    String url = "intent:#Intent;action=cn.jiguang.myaction;component=com.qdw.qianlengnet/com.qdw.qianlengnet.activity.OrderDetailsActivity;S.orderNo=" + orderOrder.getId().toString() + ";i.orderType=" + 0 + ";end";
                                    JsonObject jsonObject = new JsonObject();
                                    jsonObject.addProperty("url", url);

                                    jPushUtils.jPush(salesmanName, orderOrder.getReceiverName() + orderOrder.getReceiverPhone() + "下单，请及时查看", "线上订单-业务员查看", orderInfo, orderInfoParams, jsonObject);
                                } catch (Exception e) {
                                    System.out.println("新增线上订单-业务员查看推送异常");
                                }
                            }
                        }


                        // 订单类型（0-普通订单，1-秒杀订单，2-拼团订单）
                        Integer orderType = orderOrder.getOrderType();

                        // 2-拼团订单
                        if (orderType == 2) {
                            HashMap<String, Object> hashMap = new HashMap<>();
                            hashMap.put("orderId", orderOrder.getId());
                            mallCombineOrderLinkService.initiateOrJoinCombine(hashMap);
                        }

                        // 销量
                        List<MallOrderGoodsVO> orderGoodsVOList = orderGoodsService.selectMallOrderGoodsByOrderId(orderOrder.getId());
                        if (orderGoodsVOList.size() > 0) {
                            for (MallOrderGoodsVO mallOrderGoodsVO : orderGoodsVOList) {
                                Long goodsId = mallOrderGoodsVO.getGoodsId();
                                mallGoodsGoodsService.updateMallGoodsGoodsSaleNum(goodsId.intValue(), mallOrderGoodsVO.getTotal());
                            }
                        }


                        //用户历史消费金额

                        if (ObjectUtils.isNotEmpty(memberUser)) {
                            memberUser.setAllMoney(memberUser.getAllMoney().add(orderOrder.getPayment()));
                            mallMemberUserService.updateMallMemberUser(memberUser);
                        }

                        // 订阅消息推送
                        // String salePhone = "";
                        // if (memberUser.getSalesmanId() != null && memberUser.getSalesmanId() != 0) {
                        //     MallSalesman mallSalesman = mallSalesmanService.selectMallSalesmanById(memberUser.getSalesmanId());
                        //     if (mallSalesman != null && mallSalesman.getUserId() != null && mallSalesman.getIsLogin() != null && mallSalesman.getIsLogin() == 1) {
                        //
                        //         MallMemberUser memberUserById = mallMemberUserService.selectMallMemberUserById(mallSalesman.getUserId());
                        //         System.out.println("合单号:" + orderSn + "---推送业务员id" + memberUser.getSalesmanId());
                        //         if (memberUserById != null && StringUtils.isNotBlank(memberUserById.getOpenid())) {
                        //
                        //             // 获取业务员手机号
                        //             salePhone = memberUserById.getPhone();
                        //
                        //             Map<String, Object> data = new HashMap<>();
                        //             data.put("character_string2", new WxMessageDataDto(orderOrder.getOrderNo()));
                        //             data.put("amount1", new WxMessageDataDto(orderOrder.getOrderPrice().toString()));
                        //             data.put("thing26", new WxMessageDataDto("1"));
                        //
                        //             String delivery = "快递";
                        //             if (orderOrder.getDeliveryType() == 1) {
                        //                 delivery = "自提";
                        //             }
                        //             data.put("thing20", new WxMessageDataDto(delivery));
                        //             String page = "pages/orderDetails/orderDetails?orderId=" + orderOrder.getId();
                        //             // 服务通知
                        //             System.out.println("------发送订阅消息合单号:"+ orderSn);
                        //             weiXinUtils.sendSubscribeMessage(WeiXinParamConfig.ORDER_PAY_TEMPLATE_ID, memberUserById.getOpenid(), data, page);
                        //         }
                        //     }
                        // }
                        // 推送给管理和财务
                        // List<MallMemberUser> bossMemberUser = mallMemberUserService.selectBossMemberUser();
                        // if (!bossMemberUser.isEmpty()){
                        //
                        //     for (MallMemberUser mallMemberUser : bossMemberUser) {
                        //
                        //         if (mallMemberUser != null && StringUtils.isNotBlank(mallMemberUser.getOpenid())) {
                        //             if (mallMemberUser.getPhone().equals(salePhone)){
                        //                 System.out.println("业务员手机号和管理员相同" + salePhone);
                        //                 continue;
                        //             }
                        //             Map<String, Object> data = new HashMap<>();
                        //             data.put("character_string2", new WxMessageDataDto(orderOrder.getOrderNo()));
                        //             data.put("amount1", new WxMessageDataDto(orderOrder.getOrderPrice().toString()));
                        //             data.put("thing26", new WxMessageDataDto("1"));
                        //
                        //             String delivery = "快递";
                        //             if (orderOrder.getDeliveryType() == 1) {
                        //                 delivery = "自提";
                        //             }
                        //             data.put("thing20", new WxMessageDataDto(delivery));
                        //             String page = "pages/orderDetails/orderDetails?orderId=" + orderOrder.getId();
                        //             // 服务通知
                        //             weiXinUtils.sendSubscribeMessage(WeiXinParamConfig.ORDER_PAY_TEMPLATE_ID, mallMemberUser.getOpenid(), data, page);
                        //         }
                        //     }
                        // }

                    }

                    // 小程序录入发货信息
                    Timer timer = new Timer();
                    timer.schedule(new TimerTask() {
                        @Override
                        public void run() {
                            System.out.println(orderSn + "订单和openId" + memberUser.getOpenid());
                            String s = weiXinUtils.deliveryInfo(orderSn, memberUser.getOpenid());
                        }
                    }, 300000);


                }


                sortedMap.put("return_code", "SUCCESS");
                sortedMap.put("return_msg", "OK");
                res.reset();
                res.getWriter().write(parseXML(sortedMap));

                //小票机打印
                //增加积分
            } else {
                sortedMap.put("return_code", "FAIL");
                sortedMap.put("return_msg", "签名失败");
                res.reset();
                res.getWriter().write(parseXML(sortedMap));
            }
            return "success";
        } catch (Exception e) {
            return "failure";
        }
    }


    @ResponseBody
    @RequestMapping("/collectionpay")
    public ApiResult collectionpay(@RequestBody MemberOrderdto memberorderdto) {
        try {
            if (memberorderdto.getOrderId().isEmpty()|| memberorderdto.getUserId().isEmpty()) {
                return ApiResult.error(100, "缺少参数");
            }
            if (memberorderdto.getPayProof().isEmpty()) {
                return ApiResult.error("请上传支付凭证");
            }
            String totalOrderSn = memberorderdto.getOrderId().toString();
            String userId = memberorderdto.getUserId().toString();
            MallMemberUser userDO = mallMemberUserService.selectMallMemberUserById(Long.parseLong(userId));
            if (userDO == null) {
                return ApiResult.error(103, "用户异常");
            }
            List<MallOrderOrder> orderList = orderOrderService.selectMallOrderOrderByTotalOrderSn(totalOrderSn);
            if (orderList.isEmpty()) {
                return ApiResult.error(101, "订单异常");
            }
            BigDecimal payment = BigDecimal.ZERO;
            for (MallOrderOrder order : orderList) {
                payment = payment.add(order.getPayment());
            }
            System.out.println("合单号totalOrderSn=" + totalOrderSn);
            if (!orderList.isEmpty()) {
                MallMemberUser memberUser = mallMemberUserService.selectMallMemberUserById(orderList.get(0).getUserId());
                for (MallOrderOrder orderOrder : orderList) {
                    if (!"0".equals(orderOrder.getStatus())) {
                        return ApiResult.error(101, "订单异常");
                    }
                    System.out.println("~~~~~~~~~~~修改订单状态~~~~~~~~~");
                    // 用户信息
                    //  验签成功后
                    if (orderOrder.getDeliveryType() == 0) {
                        orderOrder.setStatus("12");
                        orderOrder.setOrderStatus("1");
                        orderOrder.setIsPay("1");
                        orderOrder.setIsFinance("0");
                    } else {
                        orderOrder.setStatus("12");
                    }
                    // 小程序录入发货信息
                    Timer timer = new Timer();
                    timer.schedule(new TimerTask() {
                        @Override
                        public void run() {
                            System.out.println(totalOrderSn + "订单和openId" + memberUser.getOpenid());
                            String s = weiXinUtils.deliveryInfo(totalOrderSn, memberUser.getOpenid());
                        }
                    }, 300000);
                    orderOrder.setPayType("3");
                    orderOrder.setPayAt(DateUtils.getTime());
                    orderOrder.setFinanceExamineAt(DateUtils.getTime());
                    orderOrder.setPayProof(memberorderdto.getPayProof().toString());
                    orderOrderService.updateMallOrderOrder(orderOrder);
                    Map<String, String> orderInfoParams = new HashMap<>();
                    orderInfoParams.put("orderId", orderOrder.getId().toString());
                    orderInfoParams.put("orderType", "0");
                    String orderInfo = JSON.toJSONString(orderInfoParams);
                    // 极光推送
                    // roleId：1-超级管理员，12-仓库管理员，13-财务，10-分公司管理员，11-业务员
                    Map<String, Object> newParams = new HashMap<>();
                    newParams.put("roleId", 1);
                    String[] userName = sysUserMapper.selectUserNameByParams(newParams);
                    if (userName.length > 0) {
                        System.out.println("新增线上订单-管理员审核推送");
                        try {
                            String url = "intent:#Intent;action=cn.jiguang.myaction;component=com.qdw.qianlengnet/com.qdw.qianlengnet.activity.ChiefAdministratorOrderDetailsActivity;S.orderNo=" + orderOrder.getId().toString() + ";i.orderType=" + 0 + ";end";
                            JsonObject jsonObject = new JsonObject();
                            jsonObject.addProperty("url", url);

                            jPushUtils.jPush(userName, orderOrder.getReceiverName() + orderOrder.getReceiverPhone() + "下单，管理员请及时审核", "线上订单管理员审核", orderInfo, orderInfoParams, jsonObject);
                        } catch (Exception e) {
                            System.out.println("新增线上订单-管理员审核推送异常");
                        }
                    }
                    if (orderOrder.getSalesmanId() != null) {
                        // roleId：1-超级管理员，12-仓库管理员，13-财务，10-分公司管理员，11-业务员
                        Map<String, Object> salesmanParams = new HashMap<>();// 新增线上订单-业务员查看推送
                        salesmanParams.put("roleId", 11);
                        salesmanParams.put("salesmanId", orderOrder.getSalesmanId());
                        String[] salesmanName = sysUserMapper.selectUserNameByParams(salesmanParams);
                        if (salesmanName.length > 0) {
                            System.out.println("新增线上订单-业务员查看推送");
                            try {
                                String url = "intent:#Intent;action=cn.jiguang.myaction;component=com.qdw.qianlengnet/com.qdw.qianlengnet.activity.OrderDetailsActivity;S.orderNo=" + orderOrder.getId().toString() + ";i.orderType=" + 0 + ";end";
                                JsonObject jsonObject = new JsonObject();
                                jsonObject.addProperty("url", url);

                                jPushUtils.jPush(salesmanName, orderOrder.getReceiverName() + orderOrder.getReceiverPhone() + "下单，请及时查看", "线上订单-业务员查看", orderInfo, orderInfoParams, jsonObject);
                            } catch (Exception e) {
                                System.out.println("新增线上订单-业务员查看推送异常");
                            }
                        }
                    }
                    // 订单类型（0-普通订单，1-秒杀订单，2-拼团订单）
                    Integer orderType = orderOrder.getOrderType();
                    // 2-拼团订单
                    if (orderType == 2) {
                        HashMap<String, Object> hashMap = new HashMap<>();
                        hashMap.put("orderId", orderOrder.getId());
                        mallCombineOrderLinkService.initiateOrJoinCombine(hashMap);
                    }
                    // 销量
                    List<MallOrderGoodsVO> orderGoodsVOList = orderGoodsService.selectMallOrderGoodsByOrderId(orderOrder.getId());
                    if (orderGoodsVOList.size() > 0) {
                        for (MallOrderGoodsVO mallOrderGoodsVO : orderGoodsVOList) {
                            Long goodsId = mallOrderGoodsVO.getGoodsId();
                            mallGoodsGoodsService.updateMallGoodsGoodsSaleNum(goodsId.intValue(), mallOrderGoodsVO.getTotal());
                        }
                    }
                    //用户历史消费金额
                    if (ObjectUtils.isNotEmpty(memberUser)) {
                        memberUser.setAllMoney(memberUser.getAllMoney().add(orderOrder.getPayment()));
                        mallMemberUserService.updateMallMemberUser(memberUser);
                    }
                }
            }
            return ApiResult.ok("上传成功");
        } catch (Exception e) {
            return ApiResult.error("上传失败");
        }
    }

    /**
     * 输出XML
     *
     * @param map
     * @return
     */
    public String parseXML(Map map) {
        StringBuffer sb = new StringBuffer();
        sb.append("<xml>\n");
        Set es = map.entrySet();
        Iterator it = es.iterator();
        while (it.hasNext()) {
            Map.Entry entry = (Map.Entry) it.next();
            String k = (String) entry.getKey();
            String v = (String) entry.getValue();
            if (null != v && !"".equals(v) && !"appkey".equals(k)) {

                sb.append("<" + k + "><![CDATA[" + v + "]]></" + k + ">\n");
            }
        }
        sb.append("</xml>");
        return sb.toString();
    }

    /**
     * 小程序录入发货信息
     *
     * @param params orderSn 单号
     * @return ok
     */
    @GetMapping("/enterGoodsInfo")
    public ApiResult enterGoodsInfo(@RequestParam Map<String, Object> params) {
        if (!params.containsKey("orderSn") || StringUtils.isBlank(params.get("orderSn").toString())) {
            return ApiResult.error("请填写orderSn");
        }
        try {
            String orderSn = params.get("orderSn").toString();
            System.out.println("合单号totalOrderSn=" + orderSn);
            List<MallOrderOrder> orderList = orderOrderService.selectMallOrderOrderByTotalOrderSn(orderSn);

            if (!orderList.isEmpty()) {
                MallMemberUser memberUser = mallMemberUserService.selectMallMemberUserById(orderList.get(0).getUserId());
                String s = weiXinUtils.deliveryInfo(orderSn, memberUser.getOpenid());

                //用户历史消费金额
                if (ObjectUtils.isNotEmpty(memberUser)) {
                    memberUser.setAllMoney(memberUser.getAllMoney().add(orderList.get(0).getPayment()));
                    mallMemberUserService.updateMallMemberUser(memberUser);
                }
            }

            return ApiResult.ok();
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResult.error("小程序录入发货信息异常");
        }
    }

//    /**
//     * 管理员审核订单
//     *
//     * @param resourceDTO 订单对象
//     * @return ok
//     */
//    @RepeatSubmit
//    @RateLimiter(key = "API_adminExamineOrder", time = 5, count = 50)
//    @PostMapping("/examineorderadmin")
//    public ApiResult examineorderadmin(@RequestBody MallOrderOrderPO resourceDTO, BindingResult bindingResult) {
//        // 参数校验
//        if (bindingResult.hasErrors()) {
//            return ApiResult.allParameterErrors(bindingResult);
//        }
//        try {
//            return orderOrderService.examineorderadmin(resourceDTO);
//        } catch (Exception e) {
//            return ApiResult.error("管理员审核订单异常");
//        }
//    }
}
