• web


    直接打印信息到页面
    resultMap.put(Constants.Attrs.ERR_CODE, Constants.Config.STR_500);
    resultMap.put(Constants.Attrs.ERR_MSG, Constants.TipMsg.ORDER_NOT_EXIST);
    response.getWriter().write(JSON.toJSONString(resultMap));

    转发,1个request,
    request.setAttribute(Constants.Attrs.Content, Constants.TipMsg.QRCODE_HAS_USED);
    request.getRequestDispatcher("/alreadyUse.html").forward(request, response);

    重定向 2个request,变地址
    response.sendRedirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appId + "&redirect_uri="+baseServer+"orderInfo/wxpay&response_type=code&scope=snsapi_userinfo&state=" + orderNum ); // + "&connect_redirect=1");

    ModelAndView mv
    mv.addAllObjects(resultMap);
    mv.setViewName("error");
    mv.setViewName("payDetail");

    WebMvcConfigurer 配置HandlerInterceptor拦截器addInterceptors、静态资源映射addResourceHandlers、MultipartConfigElement等

    BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
    out.write(result.get("paySuccess").getBytes());
    out.flush();
    out.close();

    @PostMapping("transact")
    @ApiOperation(value = "办理长租")  , notes =
    @ApiImplicitParams({
            @ApiImplicitParam(name = "longRentCars", value = "长租车辆数组", required = true, example = "[{"carPlatenum":"bgyl","parkingId":"619c2cab357e429d8f8904fb25ae1eb1"},{"carPlatenum":"silasila","parkingId":"619c2cab357e429d8f8904fb25ae1eb1"}]"),
            @ApiImplicitParam(name = "longRentRecord", value = "长租记录数据", required = true, example = "[{"type":1,"rentFee":123,"rentStartTime":"2019-01-10","rentEndTime":"2019-01-10","restDay":30,"area":"北1区","status":1,"parkingId":"619c2cab357e429d8f8904fb25ae1eb1"}]"),
            @ApiImplicitParam(name = "longRentUser", value = "长租用户数据", required = true, example = "[{"key":"longRentUser","value":"{userName:\"张学友\",conNum:\"132456789\"}","description":""}]")
    })
    public RestResponse transactLongRent(String longRentCars, String longRentRecord, String longRentUser) {
        return this.wrap(longRentService.transactLongRent(longRentCars, longRentRecord, longRentUser));
    }
    
     @Override
    public Object transactLongRent(String longRentCars, String longRentRecord, String longRentUser) {
        if (StringUtils.isEmpty(longRentCars) || StringUtils.isEmpty(longRentRecord) || StringUtils.isEmpty(longRentUser)) {
            return "参数不能为空";
        }
        List<LongRentCar> cars = JSON.parseArray(longRentCars, LongRentCar.class);
        List<LongRentRecord> rentRecords = JSON.parseArray(longRentRecord, LongRentRecord.class);
        LongRentUser user = JSON.parseObject(longRentUser, LongRentUser.class);
        if (null == user || StringUtils.isEmpty(user.getUserName())) {
            return "参数无效";
        }
    

    service层
    @Transactional(rollbackFor = Exception.class)

  • 相关阅读:
    使用NSTask调用shell
    《UML和模式应用》读书笔记(一)
    iOS网络编程
    多线程
    Quartz2D
    沙盒中的数据存取
    UIButton设置为圆形按钮并增加边框
    Mac开发快速入门
    JavaWeb学习总结(三)response与request
    JavaWeb学习总结(二) Servlet
  • 原文地址:https://www.cnblogs.com/cashew/p/11641684.html
Copyright © 2020-2023  润新知