Browse Source

修改物料更新地址

wangdy 8 years ago
parent
commit
9a27c21fbd

+ 8 - 4
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java

@@ -50,6 +50,7 @@ import oracle.jdbc.oracore.OracleType;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.dao.DataAccessException;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;
@@ -172,6 +173,9 @@ public class ProductServiceImpl implements ProductService {
     @Autowired
     private GoodsService goodsService;
 
+    @Value("#{sys.productServiceIp}")
+    private String productServiceIp;
+
     private ConcurrentHashMap<String, Field> sortFields = new ConcurrentHashMap<String, Field>();
 
     @Override
@@ -352,7 +356,7 @@ public class ProductServiceImpl implements ProductService {
                     Map<String,Object> requestMap = new HashMap<>();
                     requestMap.put("userUU",productPersonList.get(0).getUserUU());
                     requestMap.put("productId",productPersonList.get(0).getProductId());
-                    String res  = restTemplate.postForEntity("http://192.168.253.12:24000/product/assign/delete", null, String.class, requestMap).getBody();
+                    String res  = restTemplate.postForEntity( productServiceIp+"/product/assign/delete", null, String.class, requestMap).getBody();
 //                    Long ppid = productPersonList.get(0).getId();
 //                    productPersonDao.delete(ppid);
                 }
@@ -739,7 +743,7 @@ public class ProductServiceImpl implements ProductService {
         int fail = 0;
         Map<String, Long> queryMap = new HashMap<>();
         queryMap.put("enUU", enUU);
-        String successUrl = "http://192.168.253.129:8099/product/match/nonProduct";
+        String successUrl = productServiceIp + "/product/match/nonProduct";
         String result = restTemplate.postForEntity(successUrl, queryMap, String.class).getBody();
         ModelMap map = FastjsonUtils.fromJson(result, ModelMap.class);
         fail = total - (int) map.get("success");
@@ -846,7 +850,7 @@ public class ProductServiceImpl implements ProductService {
             productPrivate.setBatchCount(0);
             productPrivateDao.save(productPrivate);
         }
-        restTemplate.postForEntity("http://192.168.253.129:8099/product/update", afterProduct, String.class);
+        restTemplate.postForEntity(productServiceIp + "/product/update", afterProduct, String.class);
         updateInfoAfterTurnStandard(matchId, standardProduct);
         return ResultMap.success(null);
     }
@@ -877,7 +881,7 @@ public class ProductServiceImpl implements ProductService {
             return new ResultMap(CodeType.NO_INFO, "匹配结果信息丢失");
         }
         Product standardProduct = updateProductAfterMatch(beforeProduct, result);
-        restTemplate.postForEntity("http://192.168.253.129:8099/product/update", standardProduct, String.class);
+        restTemplate.postForEntity(productServiceIp + "/product/update", standardProduct, String.class);
 
         Product afterProduct = productDao.findOne(afterId);
         updateInfoAfterTurnStandard(beforeId, afterProduct);

+ 7 - 3
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -39,6 +39,7 @@ import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFDateUtil;
 import org.apache.poi.ss.usermodel.*;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.dao.DataAccessException;
 import org.springframework.data.domain.Page;
 import org.springframework.data.jpa.domain.Specification;
@@ -104,6 +105,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	@Autowired
 	private ProductPrivateDao productPrivateDao;
 
+	@Value("#{sys.productServiceIp}")
+	private String productServiceIp;
+
 	@Override
 	public ReleaseProductByBatch save(ReleaseProductByBatch releaseProductByBatch) {
 		return releaseProductByBatch;
@@ -1041,7 +1045,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		if (!CollectionUtils.isEmpty(releaseProductByBatchList)) {
 			List<com.uas.ps.entity.Product> products = convertProduct(releaseProductByBatchList,false);
 			// TODO 什么接口
-			String result = restTemplate.postForEntity("http://192.168.253.12:24000/product/update", products, String.class).getBody();
+			String result = restTemplate.postForEntity(productServiceIp + "/product/update", products, String.class).getBody();
 			List<Long> productIds = JSON.parseArray(result, Long.class);
 			// 默认为b2c Enable开启
 			List<ProductPrivate> productPrivates = new ArrayList<>();
@@ -1154,12 +1158,12 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
         if (!CollectionUtils.isEmpty(releaseProductByBatchList)) {
             List<com.uas.ps.entity.Product> products = convertProduct(releaseProductByBatchList,true);
             // TODO 什么接口
-			String result = restTemplate.postForEntity("http://192.168.253.12:24000/product/update", products, String.class).getBody();
+			String result = restTemplate.postForEntity(productServiceIp + "/product/update", products, String.class).getBody();
             List<Long> productIds = JSON.parseArray(result, Long.class);
             Map<String,Object> requestMap = new HashMap<>();
             requestMap.put("userUU",SystemSession.getUser().getUserUU());
             //添加个人关系
-            String res  = restTemplate.postForEntity("http://192.168.253.12:24000/product/assign/batch", productIds, String.class, requestMap).getBody();
+            String res  = restTemplate.postForEntity(productServiceIp + "/product/assign/batch", productIds, String.class, requestMap).getBody();
             // 默认为b2c Enable开启
             List<ProductPrivate> productPrivates = new ArrayList<>();
             for (Long prId : productIds) {

+ 2 - 0
src/main/resources/dev/sys.properties

@@ -39,6 +39,8 @@ uploadFileUrl = http://10.10.100.200:9999
 searchUrl = http://10.10.100.191:8092
 # message ip
 messageServiceIp=http://message.ubtob.com/
+# product public ip
+productServiceIp=http://192.168.253.12:24000
 
 # Kafka
 kafka-bootstrap-servers=10.10.100.11:9292,10.10.100.12:9292,10.10.100.13:9292,10.10.100.14:9292,10.10.100.15:9292,10.10.100.16:9292

+ 2 - 0
src/main/resources/prod/sys.properties

@@ -41,6 +41,8 @@ searchUrl=http://10.10.0.76:8081
 
 # message ip
 messageServiceIp=http://message.ubtob.com/
+# product public ip
+productServiceIp=http://192.168.253.12:24000
 
 # Kafka
 kafka-bootstrap-servers=10.10.100.11:9292,10.10.100.12:9292,10.10.100.13:9292,10.10.100.14:9292,10.10.100.15:9292,10.10.100.16:9292

+ 2 - 0
src/main/resources/test/sys.properties

@@ -40,6 +40,8 @@ searchUrl = http://10.10.100.191:8092
 
 # message ip
 messageServiceIp=http://message.ubtob.com/
+# product public ip
+productServiceIp=http://192.168.253.12:24000
 
 # Kafka
 kafka-bootstrap-servers=10.10.100.11:9292,10.10.100.12:9292,10.10.100.13:9292,10.10.100.14:9292,10.10.100.15:9292,10.10.100.16:9292