• Spring MVC取变量值


    @RequestMapping(value = "/dflights/cityLowPrice", method = { RequestMethod.GET }, headers = "Accept=application/json")
     public CommResponse searchCityLowPrice(
       @RequestParam(value = "depCity", required = true) String depCity,
       @RequestParam(value = "qDays", defaultValue = "30") int qDays,
       @RequestParam(value = "qLines", defaultValue = "10") int qLines,
       @RequestParam(value = "daysPerLine", defaultValue = "1") int daysPerLine) {
    
      CommResponse ret;
    
      List<LowPriceContent> list;
      try {
       this.verify(depCity, qDays, qLines, daysPerLine);
    
       list = lowPriceService.getCityLowPrice(depCity, qDays, qLines,
         daysPerLine);
       List<LowPriceODT> lowPrices = new ArrayList<LowPriceODT>();
    
       for (LowPriceContent lowPriceContent : list) {
        LowPriceODT odt = new LowPriceODT();
    
        odt.setCfcsdm(lowPriceContent.getDepartCity());
        String searchItem = baseInfoService
          .getAviationCityNameByCode(lowPriceContent
            .getDepartCity());
        if (searchItem != null) {
         odt.setCfcs(searchItem);
        }
    
        odt.setDdcsdm(lowPriceContent.getArrivelCity());
        searchItem = baseInfoService
          .getAviationCityNameByCode(lowPriceContent
            .getArrivelCity());
        if (searchItem != null) {
         odt.setDdcs(searchItem);
        }
    
        odt.setCfrq(lowPriceContent.getDate());
        odt.setGj(CurrencyUtil.convertFen2YuanText(lowPriceContent
          .getPrice()));
        odt.setZk(lowPriceContent.getDiscountRate());
        lowPrices.add(odt);
       }
       CommResponseWithArray<LowPriceODT> response = new CommResponseWithArray<LowPriceODT>();
       response.setIsSuccess("Y");
       response.setFailReason("");
       response.setData(lowPrices);
       ret = response;
    
      } catch (ServiceException e) {
       ret = new CommResponse();
       ret.setIsSuccess("N");
       ret.setFailReason(e.getMsg());
      }
      return ret;
     }
    
  • 相关阅读:
    单例
    ASIHttpRequest加载网络数据和上传数据功能
    JSONModel
    KVC/KVO
    C中的动态内存分配和释放(free)
    IOS开发中Xcode一些使用技巧,快捷键的使用
    Struts2文件上传
    Struts2的输入校验
    struts2类型转换中的错误处理
    struts2自定义类型转换器
  • 原文地址:https://www.cnblogs.com/duojia/p/4552441.html
Copyright © 2020-2023  润新知