Commit 80441277 authored by 李洪明's avatar 李洪明

添加日志

parent cfcc68e1
......@@ -10,6 +10,8 @@ import com.bme.access.upload.module.dao.InAndOutDateUploadFailMapper;
import com.bme.access.upload.module.dao.InAndOutDateUrlMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -64,13 +66,17 @@ public class InAndOutDateService {
InAndOutDate inAndOutDate = this.convertInAndOutDate(inAndOutDateUrl);
try {
String bodyJson = JSONObject.toJSONString(inAndOutDate);
HttpUtils.sendPost(IN_AND_OUT_DATE_URL, null, null, bodyJson);
HttpResponse response = HttpUtils.sendPost(IN_AND_OUT_DATE_URL, null, null, bodyJson);
String b = EntityUtils.toString(response.getEntity());
log.info("添加进出厂记录结果:{}", b);
dataUploadTimeMapper.updateUploadTimeByType(inAndOutDateUrl.getInOutTime(), 103);
} catch (Exception e) {
log.info("过车记录上传失败,重新上传一次{}", e.getMessage());
try {
String bodyJson = JSONObject.toJSONString(inAndOutDate);
HttpUtils.sendPost(IN_AND_OUT_DATE_URL, null, null, bodyJson);
HttpResponse response = HttpUtils.sendPost(IN_AND_OUT_DATE_URL, null, null, bodyJson);
String b = EntityUtils.toString(response.getEntity());
log.info("添加进出厂记录结果:{}", b);
} catch (Exception ex) {
log.info("再次失败,此条数据存于失败表里{}", ex.getMessage());
inAndOutDateUrl.setMsg(ex.getMessage());
......
......@@ -9,6 +9,8 @@ import com.bme.access.upload.module.dao.DataUploadTimeMapper;
import com.bme.access.upload.module.dao.TransportDateMapper;
import com.bme.access.upload.module.dao.TransportDateUploadFailMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -62,13 +64,17 @@ public class TransportDateService {
MaterialInfo materialInfo = this.convertMaterialInfo(transportDate);
try {
String bodyJson = JSONObject.toJSONString(materialInfo);
HttpUtils.sendPost(CARGO_URL, null, null, bodyJson);
HttpResponse response = HttpUtils.sendPost(CARGO_URL, null, null, bodyJson);
String b = EntityUtils.toString(response.getEntity());
log.info("添加物料信息结果:{}", b);
dataUploadTimeMapper.updateUploadTimeByType(transportDate.getInoutTime(), 104);
} catch (Exception e) {
log.info("货物上传失败,重新上传一次{}", e.getMessage());
try {
String bodyJson = JSONObject.toJSONString(materialInfo);
HttpUtils.sendPost(CARGO_URL, null, null, bodyJson);
HttpResponse response = HttpUtils.sendPost(CARGO_URL, null, null, bodyJson);
String b = EntityUtils.toString(response.getEntity());
log.info("添加物料信息结果:{}", b);
} catch (Exception ex) {
log.info("再次失败,此条数据存于失败表里{}", ex.getMessage());
transportDate.setMsg(ex.getMessage());
......
......@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -32,8 +33,8 @@ public class TestController {
// 313683 川L99718 2025-07-09 16:07:36.210 http://192.168.2.80:8080/250709/Vehicle_Plate/16_7_36_140.jpg 2 GC_1MEN http://192.168.2.80:8080/250709/ALL_Vehicle_SmallPlate/16_7_36_207.jpg 2 1 1 1752048456
InAndOutDateUrl inAndOutDateUrl = new InAndOutDateUrl();
inAndOutDateUrl.setId(313683);
inAndOutDateUrl.setNumberPlate("川L99718");
inAndOutDateUrl.setInOutTime("2025-07-09 16:07:36.210");
inAndOutDateUrl.setNumberPlate("冀E2585Z");
inAndOutDateUrl.setInOutTime("2025-07-09 16:07:36");
inAndOutDateUrl.setInOutImage("http://192.168.2.80:8080/250709/Vehicle_Plate/16_7_36_140.jpg");
inAndOutDateUrl.setInOrOut(2);
inAndOutDateUrl.setGatePostCode("GC_1MEN");
......@@ -42,6 +43,8 @@ public class TestController {
try {
String bodyJson = JSONObject.toJSONString(inAndOutDate);
HttpResponse response = HttpUtils.sendPost(IN_AND_OUT_DATE_URL, null, null, bodyJson);
String b = EntityUtils.toString(response.getEntity());
String a = "";
} catch (Exception e) {
log.error(e.getMessage());
}
......@@ -87,11 +90,11 @@ public class TestController {
inAndOutDate.setBarriernumber("");
}
// 货物信息
inAndOutDate.setCargoname("");
inAndOutDate.setCargoquantity("");
inAndOutDate.setCargoname("生石灰块");
inAndOutDate.setCargoquantity("33.52");
inAndOutDate.setUnit("T");
// 车队信息
inAndOutDate.setFleetname("");
inAndOutDate.setFleetname("111");
// 进出厂流水号
String timeStr = Objects.requireNonNull(DateUtils.format(DateUtils.toDate(inAndOutDateUrl.getInOutTime()), DateUtils.DATE_FORMAT_MIN)).substring(0, DateUtils.DATE_FORMAT_MIN.length());
String rsn = COMPANY_CODE + timeStr + inAndOutDateUrl.getInOrOut();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment