Просмотр исходного кода

楼层: 开放接口给 修改楼层项目

wangdy 8 лет назад
Родитель
Сommit
f7fbfc47ab

+ 8 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/FloorsService.java

@@ -19,4 +19,12 @@ public interface FloorsService {
 	 * @return the floors by module
 	 */
 	List<JSONObject> getFloorsByModule(String module);
+
+	/**
+	 * Gets floors by module.
+	 *
+	 * @param body the body
+	 * @return the floors by module
+	 */
+	Boolean setFloorsItem(String floorId,String body);
 }

+ 16 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/FloorsServiceImpl.java

@@ -1,10 +1,12 @@
 package com.uas.platform.b2c.advertise.ad.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import com.uas.platform.b2c.advertise.ad.service.FloorsService;
 import com.uas.platform.b2c.core.config.MicroServicesConf;
 import com.uas.platform.b2c.core.utils.JacksonUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 
@@ -35,4 +37,18 @@ public class FloorsServiceImpl implements FloorsService {
 		String result = restTemplate.getForEntity(url, String.class).getBody();
 		return JacksonUtils.fromJsonArray(result, JSONObject.class);
 	}
+
+	@Override
+	public Boolean setFloorsItem(String floorId, String body) {
+		if ("".equals(floorId)){
+			return false;
+		}
+		String url = conf.getRequestUrlForFloor(20040, "/floors/"+floorId+"/item");
+		HttpStatus status = restTemplate.postForEntity(url,body,String.class).getStatusCode();
+		if (status.equals(HttpStatus.OK)){
+			return true;
+		}else{
+			return false;
+		}
+	}
 }