Ejemplo n.º 1
0
  /**
   * 分页查询
   *
   * @param request
   * @return
   * @throws Exception
   */
  @RequestMapping(value = "/list")
  public @ResponseBody String queryAttribute(HttpServletRequest request) throws Exception {
    parseRequest(request);
    logger.info("查询商品参数");
    String goods_id = ivo.getString("goods_id", "");
    if (StringUtils.isEmptyOrNull(goods_id)) {
      ovo = new OVO(-1, "商品编号不能为空", "商品编号不能为空");
      return AesUtil.encode(VOConvert.ovoToJson(ovo));
    }

    Row row = goodsService.findDetail(goods_id);
    if (row == null) {
      ovo = new OVO(-1, "商品不存在", "商品不存在");
      return AesUtil.encode(VOConvert.ovoToJson(ovo));
    }
    String id = "";
    String brand = "";
    String specification = "";
    String packaging = "";
    String origin = "";
    String expiry_date = "";
    String store = "";
    String goods_name = row.getString("name", "");
    Row attributeRow = goodsAttributeService.list(goods_id);
    if (attributeRow != null) {
      id = attributeRow.getString("id", "");
      brand = attributeRow.getString("brand", "");
      specification = attributeRow.getString("specification", "");
      packaging = attributeRow.getString("packaging", "");
      origin = attributeRow.getString("origin", "");
      expiry_date = attributeRow.getString("expiry_date", "");
      store = attributeRow.getString("store", "");
    }
    ovo = new OVO(0, "", "");
    ovo.set("id", id);
    ovo.set("goods_id", goods_id);
    ovo.set("brand", brand);
    ovo.set("specification", specification);
    ovo.set("packaging", packaging);
    ovo.set("origin", origin);
    ovo.set("expiry_date", expiry_date);
    ovo.set("store", store);
    ovo.set("goods_name", goods_name);
    return AesUtil.encode(VOConvert.ovoToJson(ovo));
  }
Ejemplo n.º 2
0
 /**
  * 检查文件版本信息,如果需要更新,则返回文件的下载路径 json 格式文件 共3个文件: 省份 城市 城市区域
  *
  * @param request
  * @return
  * @throws Exception
  */
 @RequestMapping(value = "/checkVersion")
 public @ResponseBody String checkVersion(HttpServletRequest request) throws Exception {
   OVO ovo = null;
   parseRequest(request);
   String versionNo = ivo.getString("version");
   if (StringUtils.isEmptyOrNull(versionNo)) {
     versionNo = "0";
   }
   Setting setting = SettingUtils.get();
   String path = setting.getPhysicalPath() + "/resources/geography_files/";
   String version_file = path + "version.json";
   File file = new File(version_file);
   if (!file.exists()) {
     ovo = new OVO(0, "", "");
     ovo.set("update", "0"); // 不用更新
     return AesUtil.encode(VOConvert.ovoToJson(ovo));
   }
   String version_content = FileUtil.readText(version_file);
   JSONObject jsonObj = JSONObject.fromObject(version_content);
   String timestamp = jsonObj.getString("VERSION");
   if (StringUtils.isEmptyOrNull(timestamp) || versionNo.equals(timestamp)) {
     ovo = new OVO(0, "", "");
     ovo.set("update", "0"); // 不用更新
     return AesUtil.encode(VOConvert.ovoToJson(ovo));
   }
   String siteUrl = setting.getSiteUrl() + "/resources/geography_files/";
   //		String province_path =siteUrl+"province.json";
   //		String city_path =siteUrl+"city.json";
   //		String zone_path =siteUrl+"zone.json";
   //		String version_path =siteUrl+"version.json";
   String geography_path = siteUrl + "geography.json";
   //		String geography_content =FileUtil.readText(geography_path);
   //		ovo =VOConvert.jsonToOvo(geography_content);
   ovo = new OVO(0, "", "");
   ovo.set("update", "1"); // 需要更新
   //		ovo.set("province_path", province_path);
   //		ovo.set("city_path", city_path);
   //		ovo.set("zone_path", zone_path);
   //		ovo.set("version_path", version_path);
   ovo.set("geography_path", geography_path);
   return AesUtil.encode(VOConvert.ovoToJson(ovo));
 }
Ejemplo n.º 3
0
 /**
  * 查询全部城市以及城市区域列表
  *
  * @param request
  * @return
  * @throws Exception
  */
 @RequestMapping(value = "/CityAndZone")
 public @ResponseBody String queryCityAndZone(HttpServletRequest request) throws Exception {
   parseRequest(request);
   logger.info("查询城市以及区域");
   Row row = zoneService.queryAllCityAndZone();
   DataSet cityDataSet = (DataSet) row.get("city");
   DataSet zoneDataSet = (DataSet) row.get("zone");
   OVO ovo = new OVO(0, "", "");
   ovo.set("city_list", cityDataSet);
   ovo.set("zone_list", zoneDataSet);
   return AesUtil.encode(VOConvert.ovoToJson(ovo));
 }