直接打印信息到页面
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 "参数无效";
}