1
zj
2025-04-27 5ce072de78ae263b52dc0e2be5c7391b23c093cf
src/main/java/com/nq/controller/PayApiController.java
@@ -61,96 +61,96 @@
        }
    }
    @RequestMapping({"juhenewpayNotify.do"})
    @ResponseBody
    public JSONObject juhenewpayNotify(HttpServletRequest request, HttpServletResponse response) throws IOException {
        System.out.println("============开始回调===============");
        LinkedMap map = new LinkedMap();
        String orderno = (String) request.getParameter("orderno");
        String amount = (String) request.getParameter("payamount");
        String[] arr = orderno.split("_");
        map.put("payamount", request.getParameter("payamount"));
        map.put("orderno", orderno);
        map.put("status", (String) request.getParameter("status"));
        log.info("回调创建订单前map==="+map.toString());
//    @RequestMapping({"juhenewpayNotify.do"})
//    @ResponseBody
//    public JSONObject juhenewpayNotify(HttpServletRequest request, HttpServletResponse response) throws IOException {
//        System.out.println("============开始回调===============");
//        LinkedMap map = new LinkedMap();
//        String orderno = (String) request.getParameter("orderno");
//        String amount = (String) request.getParameter("payamount");
//        String[] arr = orderno.split("_");
//        map.put("payamount", request.getParameter("payamount"));
//        map.put("orderno", orderno);
//        map.put("status", (String) request.getParameter("status"));
//        log.info("回调创建订单前map==="+map.toString());
//
//        JSONObject jsonObj = new JSONObject();
//        Map<String,Object> json = new HashMap<String,Object>();
//
//
//        if ("1".equals((String) request.getParameter("status"))) {
//            // 这里编写用户业务逻辑代码,如存储订单状态,自动发货等
//            //TODO
//            if (amount != null & !StringUtils.isEmpty(amount)) {
//                System.out.println("============更新用户金额===============");
//                Double aDouble = Double.valueOf(amount);
//                Integer integer = aDouble.intValue();
//                //判断是否回调成功
//                UserRecharge userRecharge = this.userRechargeMapper.findUserRechargeByOrderSn(orderno);
//                if(userRecharge == null){
//                    System.out.println("============    充值完成===============");
//                    iUserRechargeService.createOrder("ST",Integer.valueOf(arr[0]), 1, aDouble.intValue(), orderno);
//                    jsonObj.put("reason", "success");
//                } else {
//                    System.out.println("============充值失败,已回调成功无需重复回调===============");
//                    jsonObj.put("reason", "error");
//                }
//            } else{
//                jsonObj.put("reason", "error");
//            }
//            System.out.println("============回调成功并结束===============");
//            //jsonObj.putAll(map);
//            return jsonObj;
//        } else {
//            System.out.println("============回调失败并结束===============");
//            jsonObj.put("reason", "error");
//            return jsonObj;
//        }
//
//    }
        JSONObject jsonObj = new JSONObject();
        Map<String,Object> json = new HashMap<String,Object>();
        if ("1".equals((String) request.getParameter("status"))) {
            // 这里编写用户业务逻辑代码,如存储订单状态,自动发货等
            //TODO
            if (amount != null & !StringUtils.isEmpty(amount)) {
                System.out.println("============更新用户金额===============");
                Double aDouble = Double.valueOf(amount);
                Integer integer = aDouble.intValue();
                //判断是否回调成功
                UserRecharge userRecharge = this.userRechargeMapper.findUserRechargeByOrderSn(orderno);
                if(userRecharge == null){
                    System.out.println("============    充值完成===============");
                    iUserRechargeService.createOrder(Integer.valueOf(arr[0]), 1, aDouble.intValue(), orderno);
                    jsonObj.put("reason", "success");
                } else {
                    System.out.println("============充值失败,已回调成功无需重复回调===============");
                    jsonObj.put("reason", "error");
                }
            } else{
                jsonObj.put("reason", "error");
            }
            System.out.println("============回调成功并结束===============");
            //jsonObj.putAll(map);
            return jsonObj;
        } else {
            System.out.println("============回调失败并结束===============");
            jsonObj.put("reason", "error");
            return jsonObj;
        }
    }
    @RequestMapping({"juheh5payNotify.do"})
    @ResponseBody
    public void juheh5payNotify(HttpServletRequest request, HttpServletResponse response) throws IOException {
        System.out.println("============开始回调===============");
        LinkedMap map = new LinkedMap();
        String orderno = (String) request.getParameter("name");
        String amount = (String) request.getParameter("money");
        String[] arr = orderno.split("_");
        map.put("money", request.getParameter("money"));
        map.put("name", orderno);
        log.info("回调创建订单前map==="+map.toString());
        JSONObject jsonObj = new JSONObject();
        Map<String,Object> json = new HashMap<String,Object>();
        //if ("200".equals((String) request.getParameter("status"))) {
            // 这里编写用户业务逻辑代码,如存储订单状态,自动发货等
            //TODO
            if (amount != null & !StringUtils.isEmpty(amount)) {
                System.out.println("============更新用户金额===============");
                Double aDouble = Double.valueOf(amount);
                Integer integer = aDouble.intValue();
                //判断是否回调成功
                UserRecharge userRecharge = this.userRechargeMapper.findUserRechargeByOrderSn(orderno);
                if(userRecharge == null){
                    System.out.println("============充值完成===============");
                    iUserRechargeService.createOrder(Integer.valueOf(arr[0]), 1, aDouble.intValue(), orderno);
                } else {
                    System.out.println("============充值失败,已回调成功无需重复回调===============");
                }
            } else{
            }
            System.out.println("============回调成功并结束===============");
            //jsonObj.putAll(map);
            response.getWriter().write("success");
        /*} else {
            System.out.println("============回调失败并结束===============");
            response.getWriter().write("error");
        }*/
    }
//    @RequestMapping({"juheh5payNotify.do"})
//    @ResponseBody
//    public void juheh5payNotify(HttpServletRequest request, HttpServletResponse response) throws IOException {
//        System.out.println("============开始回调===============");
//        LinkedMap map = new LinkedMap();
//        String orderno = (String) request.getParameter("name");
//        String amount = (String) request.getParameter("money");
//        String[] arr = orderno.split("_");
//        map.put("money", request.getParameter("money"));
//        map.put("name", orderno);
//        log.info("回调创建订单前map==="+map.toString());
//
//        JSONObject jsonObj = new JSONObject();
//        Map<String,Object> json = new HashMap<String,Object>();
//
//
//        //if ("200".equals((String) request.getParameter("status"))) {
//            // 这里编写用户业务逻辑代码,如存储订单状态,自动发货等
//            //TODO
//            if (amount != null & !StringUtils.isEmpty(amount)) {
//                System.out.println("============更新用户金额===============");
//                Double aDouble = Double.valueOf(amount);
//                Integer integer = aDouble.intValue();
//                //判断是否回调成功
//                UserRecharge userRecharge = this.userRechargeMapper.findUserRechargeByOrderSn(orderno);
//                if(userRecharge == null){
//                    System.out.println("============充值完成===============");
//                    iUserRechargeService.createOrder(Integer.valueOf(arr[0]), 1, aDouble.intValue(), orderno);
//                } else {
//                    System.out.println("============充值失败,已回调成功无需重复回调===============");
//                }
//            } else{
//            }
//            System.out.println("============回调成功并结束===============");
//            //jsonObj.putAll(map);
//            response.getWriter().write("success");
//        /*} else {
//            System.out.println("============回调失败并结束===============");
//            response.getWriter().write("error");
//        }*/
//
//    }
    @RequestMapping({"flyNotify.do"})
    @ResponseBody