|
|
@@ -5,7 +5,9 @@ import com.uas.eis.dao.EdiLogDao;
|
|
|
import com.uas.eis.dao.EdiSuccessLogDao;
|
|
|
import com.uas.eis.service.ProductService;
|
|
|
import com.uas.eis.utils.Constant;
|
|
|
+import com.uas.eis.utils.HttpUtil;
|
|
|
import com.uas.eis.utils.JacksonUtil;
|
|
|
+import com.uas.eis.utils.LogUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -26,7 +28,7 @@ public class ProductServiceImpl implements ProductService{
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
|
|
|
- private static final String sendProductToYundingUrl = "";
|
|
|
+ private static final String sendProductToYundingUrl = "http://dc.oclean.com/putstorespec?sign";
|
|
|
|
|
|
@Autowired
|
|
|
BaseDao baseDao;
|
|
|
@@ -43,7 +45,7 @@ public class ProductServiceImpl implements ProductService{
|
|
|
datas.add(data);
|
|
|
|
|
|
String timestamp = String.valueOf(System.currentTimeMillis()/1000);
|
|
|
- String outerNo = String.valueOf(data.get(""));
|
|
|
+ String outerNo = String.valueOf(data.get("goods_no"));
|
|
|
|
|
|
Map<String,Object> postMapData = new HashMap<>();
|
|
|
postMapData.put("app_key", Constant.yundingAppKey);
|
|
|
@@ -57,42 +59,42 @@ public class ProductServiceImpl implements ProductService{
|
|
|
Map<String,Object> res = new HashMap<>();
|
|
|
String jsonData = JacksonUtil.toSortJson(data);
|
|
|
System.out.println(jsonData);
|
|
|
-// try{
|
|
|
-//
|
|
|
-// HttpUtil.Response response = HttpUtil.doPostToYunding(sendProductToYundingUrl,jsonData,timestamp);
|
|
|
-//
|
|
|
-// String responseText = response.getResponseText();
|
|
|
-//
|
|
|
-// logger.info("responseText:" + responseText);
|
|
|
-// logger.info("responseCode:" + response.getStatusCode());
|
|
|
-//
|
|
|
-// if(response.getStatusCode()!=200){
|
|
|
-// throw new RuntimeException("yunding server error:" + responseText);
|
|
|
-// }
|
|
|
-//
|
|
|
-// Map<String,Object> responseMap = JacksonUtil.fromJson(response.getResponseText());
|
|
|
-//
|
|
|
-// if(!"0".equals(String.valueOf(responseMap.get("code")))){
|
|
|
-// res.put("success",false);
|
|
|
-// res.put("remark",responseMap.get("message"));
|
|
|
-// }else{
|
|
|
-// Map<String,Object> msgJson = (Map<String,Object>) responseMap.get("msg_json");
|
|
|
-// List<String> successCodes = (List<String>)msgJson.get("s_no");
|
|
|
-// if(successCodes.contains(outerNo)){
|
|
|
-// res.put("success",true);
|
|
|
-// ediLogDao.save(LogUtil.getSendSuccessLog(outerNo,jsonData,"send success"));
|
|
|
-// }else{
|
|
|
-// res.put("success",false);
|
|
|
-// res.put("remark","云顶数据中心处理失败!");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }catch (Exception e){
|
|
|
-// e.printStackTrace();
|
|
|
-// logger.error("error",e);
|
|
|
-//
|
|
|
-// res.put("success",false);
|
|
|
-// res.put("remark",e.getMessage());
|
|
|
-// }
|
|
|
+ try{
|
|
|
+
|
|
|
+ HttpUtil.Response response = HttpUtil.doPostToYunding(sendProductToYundingUrl,jsonData,timestamp);
|
|
|
+
|
|
|
+ String responseText = response.getResponseText();
|
|
|
+
|
|
|
+ logger.info("responseText:" + responseText);
|
|
|
+ logger.info("responseCode:" + response.getStatusCode());
|
|
|
+
|
|
|
+ if(response.getStatusCode()!=200){
|
|
|
+ throw new RuntimeException("yunding server error:" + responseText);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,Object> responseMap = JacksonUtil.fromJson(response.getResponseText());
|
|
|
+
|
|
|
+ if(!"0".equals(String.valueOf(responseMap.get("code")))){
|
|
|
+ res.put("success",false);
|
|
|
+ res.put("remark",responseMap.get("message"));
|
|
|
+ }else{
|
|
|
+ Map<String,Object> msgJson = (Map<String,Object>) responseMap.get("msg_json");
|
|
|
+ List<String> successCodes = (List<String>)msgJson.get("s_no");
|
|
|
+ if(successCodes.contains(outerNo)){
|
|
|
+ res.put("success",true);
|
|
|
+ ediLogDao.save(LogUtil.getSendSuccessLog(outerNo,jsonData,"send success"));
|
|
|
+ }else{
|
|
|
+ res.put("success",false);
|
|
|
+ res.put("remark","云顶数据中心处理失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ logger.error("error",e);
|
|
|
+
|
|
|
+ res.put("success",false);
|
|
|
+ res.put("remark",e.getMessage());
|
|
|
+ }
|
|
|
return res;
|
|
|
}
|
|
|
|