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

添加日志

parent cfcc68e1
...@@ -10,6 +10,8 @@ import com.bme.access.upload.module.dao.InAndOutDateUploadFailMapper; ...@@ -10,6 +10,8 @@ import com.bme.access.upload.module.dao.InAndOutDateUploadFailMapper;
import com.bme.access.upload.module.dao.InAndOutDateUrlMapper; import com.bme.access.upload.module.dao.InAndOutDateUrlMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -64,13 +66,17 @@ public class InAndOutDateService { ...@@ -64,13 +66,17 @@ public class InAndOutDateService {
InAndOutDate inAndOutDate = this.convertInAndOutDate(inAndOutDateUrl); InAndOutDate inAndOutDate = this.convertInAndOutDate(inAndOutDateUrl);
try { try {
String bodyJson = JSONObject.toJSONString(inAndOutDate); 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); dataUploadTimeMapper.updateUploadTimeByType(inAndOutDateUrl.getInOutTime(), 103);
} catch (Exception e) { } catch (Exception e) {
log.info("过车记录上传失败,重新上传一次{}", e.getMessage()); log.info("过车记录上传失败,重新上传一次{}", e.getMessage());
try { try {
String bodyJson = JSONObject.toJSONString(inAndOutDate); 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) { } catch (Exception ex) {
log.info("再次失败,此条数据存于失败表里{}", ex.getMessage()); log.info("再次失败,此条数据存于失败表里{}", ex.getMessage());
inAndOutDateUrl.setMsg(ex.getMessage()); inAndOutDateUrl.setMsg(ex.getMessage());
......
...@@ -9,6 +9,8 @@ import com.bme.access.upload.module.dao.DataUploadTimeMapper; ...@@ -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.TransportDateMapper;
import com.bme.access.upload.module.dao.TransportDateUploadFailMapper; import com.bme.access.upload.module.dao.TransportDateUploadFailMapper;
import lombok.extern.slf4j.Slf4j; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -62,13 +64,17 @@ public class TransportDateService { ...@@ -62,13 +64,17 @@ public class TransportDateService {
MaterialInfo materialInfo = this.convertMaterialInfo(transportDate); MaterialInfo materialInfo = this.convertMaterialInfo(transportDate);
try { try {
String bodyJson = JSONObject.toJSONString(materialInfo); 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); dataUploadTimeMapper.updateUploadTimeByType(transportDate.getInoutTime(), 104);
} catch (Exception e) { } catch (Exception e) {
log.info("货物上传失败,重新上传一次{}", e.getMessage()); log.info("货物上传失败,重新上传一次{}", e.getMessage());
try { try {
String bodyJson = JSONObject.toJSONString(materialInfo); 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) { } catch (Exception ex) {
log.info("再次失败,此条数据存于失败表里{}", ex.getMessage()); log.info("再次失败,此条数据存于失败表里{}", ex.getMessage());
transportDate.setMsg(ex.getMessage()); transportDate.setMsg(ex.getMessage());
......
...@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -32,8 +33,8 @@ public class TestController { ...@@ -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 // 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 inAndOutDateUrl = new InAndOutDateUrl();
inAndOutDateUrl.setId(313683); inAndOutDateUrl.setId(313683);
inAndOutDateUrl.setNumberPlate("川L99718"); inAndOutDateUrl.setNumberPlate("冀E2585Z");
inAndOutDateUrl.setInOutTime("2025-07-09 16:07:36.210"); 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.setInOutImage("http://192.168.2.80:8080/250709/Vehicle_Plate/16_7_36_140.jpg");
inAndOutDateUrl.setInOrOut(2); inAndOutDateUrl.setInOrOut(2);
inAndOutDateUrl.setGatePostCode("GC_1MEN"); inAndOutDateUrl.setGatePostCode("GC_1MEN");
...@@ -42,6 +43,8 @@ public class TestController { ...@@ -42,6 +43,8 @@ public class TestController {
try { try {
String bodyJson = JSONObject.toJSONString(inAndOutDate); String bodyJson = JSONObject.toJSONString(inAndOutDate);
HttpResponse response = 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());
String a = "";
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
} }
...@@ -87,11 +90,11 @@ public class TestController { ...@@ -87,11 +90,11 @@ public class TestController {
inAndOutDate.setBarriernumber(""); inAndOutDate.setBarriernumber("");
} }
// 货物信息 // 货物信息
inAndOutDate.setCargoname(""); inAndOutDate.setCargoname("生石灰块");
inAndOutDate.setCargoquantity(""); inAndOutDate.setCargoquantity("33.52");
inAndOutDate.setUnit("T"); 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 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(); 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