Exemplo n.º 1
0
  /**
   * 显示订单的收货信息,客服可修改,修改的和原来的用-隔开
   *
   * @param orderId
   * @param response
   * @throws IOException
   */
  @RequestMapping(value = "/order/addressInfo/{orderId}")
  public void addressInfoGrid(@PathVariable("orderId") long orderId, HttpServletResponse response)
      throws IOException {
    AddressInfo addressInfo = new AddressInfo();
    Logistics logistics = tradeCenterBossClient.queryLogisticsByOrderId(orderId);
    LogisticsRedundancy logisticsRedundancy =
        tradeCenterBossClient.queryLogisticsRedundancy(logistics.getId());
    Order order = tradeCenterBossClient.queryOrderById(orderId);
    List<AddressInfo> list = new LinkedList<AddressInfo>();
    if (order != null) {
      addressInfo.setOrderState(order.getOrderState().toString());
      String[] province = (logistics.getProvince()).split(",");
      if (province.length == 2) {
        addressInfo.setProvince(province[0]);
        addressInfo.setCity(province[0]);
        addressInfo.setDistricts(province[1]);
      } else {
        addressInfo.setProvince(province[0]);
        addressInfo.setCity(province[1]);
        addressInfo.setDistricts(province[2]);
      }
      addressInfo.setConsignee(logistics.getName());
      addressInfo.setLocation(logistics.getLocation());
      addressInfo.setMobile(logistics.getMobile());
      addressInfo.setZipCode(logistics.getZipCode());

      if (StringUtils.isNotEmpty(logisticsRedundancy.getNameRewrite())) {
        addressInfo.setConsignee(
            addressInfo.getConsignee() + Old_New_Gap + logisticsRedundancy.getNameRewrite());
      }
      if (StringUtils.isNotEmpty(logisticsRedundancy.getLocationRewrite())) {
        addressInfo.setLocation(
            addressInfo.getLocation() + Old_New_Gap + logisticsRedundancy.getLocationRewrite());
      }
      if (StringUtils.isNotEmpty(logisticsRedundancy.getMobileRewrite())) {
        addressInfo.setMobile(
            addressInfo.getMobile() + Old_New_Gap + logisticsRedundancy.getMobileRewrite());
      }
      if (StringUtils.isNotEmpty(logisticsRedundancy.getZipCodeRewrite())) {
        addressInfo.setZipCode(
            addressInfo.getZipCode() + Old_New_Gap + logisticsRedundancy.getZipCodeRewrite());
      }

      String provinceRewrite = logisticsRedundancy.getProvinceRewrite();
      if (StringUtils.isNotEmpty(provinceRewrite)) {
        String[] newProvince = (logisticsRedundancy.getProvinceRewrite()).split(",");
        addressInfo.setProvince(addressInfo.getProvince() + Old_New_Gap + newProvince[0]);
        addressInfo.setCity(addressInfo.getCity() + Old_New_Gap + newProvince[1]);
        addressInfo.setDistricts(addressInfo.getDistricts() + Old_New_Gap + newProvince[2]);
      }
      list.add(addressInfo);
    }
    new JsonResult(true).addData("totalCount", 1).addData("result", list).toJson(response);
  }
Exemplo n.º 2
0
  // JAVADOC COMMENT ELIDED
  private static LocationImpl locationInfo2Location(LocationInfo locationInfo) {
    QualifiedCoordinates coordinates =
        new QualifiedCoordinates(
            locationInfo.latitude,
            locationInfo.longitude,
            locationInfo.altitude,
            locationInfo.horizontalAccuracy,
            locationInfo.verticalAccuracy);

    AddressInfo address = new AddressInfo();

    if (locationInfo.isAddressInfo) {
      if (locationInfo.AddressInfo_EXTENSION != null) {
        address.setField(AddressInfo.EXTENSION, locationInfo.AddressInfo_EXTENSION);
      }
      if (locationInfo.AddressInfo_STREET != null) {
        address.setField(AddressInfo.STREET, locationInfo.AddressInfo_STREET);
      }
      if (locationInfo.AddressInfo_POSTAL_CODE != null) {
        address.setField(AddressInfo.POSTAL_CODE, locationInfo.AddressInfo_POSTAL_CODE);
      }
      if (locationInfo.AddressInfo_CITY != null) {
        address.setField(AddressInfo.CITY, locationInfo.AddressInfo_CITY);
      }
      if (locationInfo.AddressInfo_COUNTY != null) {
        address.setField(AddressInfo.COUNTY, locationInfo.AddressInfo_COUNTY);
      }
      if (locationInfo.AddressInfo_STATE != null) {
        address.setField(AddressInfo.STATE, locationInfo.AddressInfo_STATE);
      }
      if (locationInfo.AddressInfo_COUNTRY != null) {
        address.setField(AddressInfo.COUNTRY, locationInfo.AddressInfo_COUNTRY);
      }
      if (locationInfo.AddressInfo_COUNTRY_CODE != null) {
        address.setField(AddressInfo.COUNTRY_CODE, locationInfo.AddressInfo_COUNTRY_CODE);
      }
      if (locationInfo.AddressInfo_DISTRICT != null) {
        address.setField(AddressInfo.DISTRICT, locationInfo.AddressInfo_DISTRICT);
      }
      if (locationInfo.AddressInfo_BUILDING_NAME != null) {
        address.setField(AddressInfo.BUILDING_NAME, locationInfo.AddressInfo_BUILDING_NAME);
      }
      if (locationInfo.AddressInfo_BUILDING_FLOOR != null) {
        address.setField(AddressInfo.BUILDING_FLOOR, locationInfo.AddressInfo_BUILDING_FLOOR);
      }
      if (locationInfo.AddressInfo_BUILDING_ROOM != null) {
        address.setField(AddressInfo.BUILDING_ROOM, locationInfo.AddressInfo_BUILDING_ROOM);
      }
      if (locationInfo.AddressInfo_BUILDING_ZONE != null) {
        address.setField(AddressInfo.BUILDING_ZONE, locationInfo.AddressInfo_BUILDING_ZONE);
      }
      if (locationInfo.AddressInfo_CROSSING1 != null) {
        address.setField(AddressInfo.CROSSING1, locationInfo.AddressInfo_CROSSING1);
      }
      if (locationInfo.AddressInfo_CROSSING2 != null) {
        address.setField(AddressInfo.CROSSING2, locationInfo.AddressInfo_CROSSING2);
      }
      if (locationInfo.AddressInfo_URL != null) {
        address.setField(AddressInfo.URL, locationInfo.AddressInfo_URL);
      }
      if (locationInfo.AddressInfo_PHONE_NUMBER != null) {
        address.setField(AddressInfo.PHONE_NUMBER, locationInfo.AddressInfo_PHONE_NUMBER);
      }
    }
    LocationImpl location =
        new LocationImpl(
            coordinates,
            locationInfo.speed,
            locationInfo.course,
            locationInfo.method,
            address,
            locationInfo.isValid);
    location.extraInfoNMEA = locationInfo.extraInfoNMEA;
    location.extraInfoLIF = locationInfo.extraInfoLIF;
    location.extraInfoPlain = locationInfo.extraInfoPlain;
    location.extraInfoOther = locationInfo.extraInfoOther;
    location.extraInfoOtherMIMEType = locationInfo.extraInfoOtherMIMEType;
    location.setTimestamp(locationInfo.timestamp);
    return location;
  }