|
@@ -1,6 +1,7 @@
|
|
|
package com.steerinfo.dil.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.steerinfo.dil.feign.*;
|
|
|
import com.steerinfo.dil.mapper.TmstruckEnfactoryResultMapper;
|
|
|
import com.steerinfo.dil.mapper.TmstruckLeaveFactoryResultMapper;
|
|
@@ -9,6 +10,7 @@ import com.steerinfo.dil.mapper.UtilsMapper;
|
|
|
import com.steerinfo.dil.model.TmstruckLeaveFactoryResult;
|
|
|
import com.steerinfo.dil.service.ITmstruckLeaveFactoryResultService;
|
|
|
import com.steerinfo.dil.util.DataChange;
|
|
|
+import com.steerinfo.dil.util.HTTPRequestUtils;
|
|
|
import com.steerinfo.dil.util.getRequestUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -16,6 +18,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.DateFormat;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -70,8 +74,9 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
|
|
|
|
|
|
@Autowired
|
|
|
JoinFeign joinFeign;
|
|
|
-
|
|
|
- private String guoYuanUrl="http://113.204.217.110:9810/dagang/receiving";
|
|
|
+ //果园库测试接口:"http://113.204.217.110:9810/dagang/receiving";
|
|
|
+ //果园库正式接口
|
|
|
+ private String guoYuanUrl="http://114.117.208.165:9810/dagang/receiving";
|
|
|
//城嘉库登录访问接口
|
|
|
private String chengJiaLoginUrl="http://116.204.73.104:8083/dagon/login";
|
|
|
//城嘉库推送数据接口
|
|
@@ -303,12 +308,36 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
|
|
|
if (token != null) {
|
|
|
for (Map<String,Object> map1:data) {
|
|
|
map1.put("token", token);
|
|
|
+ //接口发送日期
|
|
|
+ map1.put("sendTime",new Date());
|
|
|
///调用城嘉库推送接口
|
|
|
sendMesToChengJia(map1);
|
|
|
}
|
|
|
} else {
|
|
|
System.out.println("登录城嘉库失败");
|
|
|
}
|
|
|
+ }else if(addressPlace!=null && addressPlace.contains("果园港")){
|
|
|
+ //果园库
|
|
|
+ List<Map<String,Object>> data =getOffSiteWarehouse(orderNumber);
|
|
|
+ Map<String,Object> details=new HashMap<>();
|
|
|
+ DateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ for(Map<String,Object> temp:data){
|
|
|
+ temp.put("resultOutGateTime",format.format((Date)(temp.get("outGateTime"))));
|
|
|
+ temp.put("orderIssueTime",format.format((Date)(temp.get("orderIssueTime"))));
|
|
|
+ temp.remove("outGateTime");
|
|
|
+ }
|
|
|
+ //发送时间
|
|
|
+ details.put("sendTime",format.format(new Date()));
|
|
|
+ //系统代码
|
|
|
+ details.put("sysCode", "DGXT");
|
|
|
+ //仓库代码
|
|
|
+ details.put("warehouseCode", "LJJT");
|
|
|
+ //运输方式
|
|
|
+ details.put("transportType", "汽运");
|
|
|
+ //详细数据
|
|
|
+ details.put("details", data);
|
|
|
+ //推送数据
|
|
|
+ sendMesToGuoyuan(details);
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
@@ -533,8 +562,6 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
|
|
|
}else if (materialName.contains("螺纹")){
|
|
|
map1.put("materialType","螺纹钢");
|
|
|
}
|
|
|
- //接口发送日期
|
|
|
- map1.put("sendTime",new Date());
|
|
|
}
|
|
|
return mapList;
|
|
|
}
|
|
@@ -585,12 +612,6 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
|
|
|
/**
|
|
|
* 推送数据给城嘉库
|
|
|
*/
|
|
|
-
|
|
|
- /**
|
|
|
- * 访问重庆果园库接口方法
|
|
|
- * @param map
|
|
|
- * @return
|
|
|
- */
|
|
|
public int sendMesToChengJia(Map<String, Object> map){
|
|
|
String token =(String) map.get("token");
|
|
|
Map<String,Object> jsonObject = new HashMap<>();
|
|
@@ -611,4 +632,37 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 访问重庆果园库接口方法
|
|
|
+ * @param map
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public int sendMesToGuoyuan(Map<String, Object> map){
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.putAll(map);
|
|
|
+ String jsonData = null;
|
|
|
+ try {
|
|
|
+ jsonData = HTTPRequestUtils.send(guoYuanUrl, jsonObject, "utf-8");
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if(!"null".equals(jsonData)){
|
|
|
+ System.out.println(jsonData);
|
|
|
+ try{
|
|
|
+ HashMap hashMap = JSON.parseObject(jsonData, HashMap.class);
|
|
|
+ BigDecimal code =DataChange.dataToBigDecimal(hashMap.get("code"));
|
|
|
+ System.out.println(hashMap.get("message"));
|
|
|
+ if(code.intValue()==200){
|
|
|
+ return 1;
|
|
|
+ }else {
|
|
|
+ System.out.println("推送数据失败"+hashMap.get("message"));
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|