Commit 63731780 authored by 曹军's avatar 曹军

Merge remote-tracking branch 'origin/master'

parents 3ed327f9 aa83feae
package com.bme.access.upload.job; package com.bme.access.upload.job;
import com.bme.access.upload.common.HttpUtils; import com.bme.access.upload.common.HttpUtils;
import com.bme.access.upload.module.service.LoginService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -15,10 +17,12 @@ import org.springframework.stereotype.Component; ...@@ -15,10 +17,12 @@ import org.springframework.stereotype.Component;
public class HeartBeatJob { public class HeartBeatJob {
private final static String HEART_BEAT_URL = "https://dctapi.soszyzg.com/dct/heartbeat"; private final static String HEART_BEAT_URL = "https://dctapi.soszyzg.com/dct/heartbeat";
@Autowired
@Scheduled(cron = "0 0/1 * * * ?") private LoginService loginService;
@Scheduled(cron = "0 */30 * * * ?")
public void heartBeat() { public void heartBeat() {
try { try {
loginService.login();
HttpUtils.sendGet(HEART_BEAT_URL, null, null); HttpUtils.sendGet(HEART_BEAT_URL, null, null);
} catch (Exception e) { } catch (Exception e) {
log.error("心跳协议(每半个小时调用一次): {}", e); log.error("心跳协议(每半个小时调用一次): {}", e);
......
package com.bme.access.upload.job; package com.bme.access.upload.job;
import com.bme.access.upload.module.service.InAndOutDateService; import com.bme.access.upload.module.service.*;
import com.bme.access.upload.module.service.InFactoryTransportVehicleInfoService;
import com.bme.access.upload.module.service.NoneRoadMovementInfoService;
import com.bme.access.upload.module.service.TransportVehicleInfoService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
...@@ -22,6 +19,8 @@ public class UploadDataNewTask { ...@@ -22,6 +19,8 @@ public class UploadDataNewTask {
private NoneRoadMovementInfoService noneRoadMovementInfoService; private NoneRoadMovementInfoService noneRoadMovementInfoService;
@Autowired @Autowired
private InAndOutDateService inAndOutDateService; private InAndOutDateService inAndOutDateService;
@Autowired
private TransportDateService transportDateService;
/** /**
* 场内运输车辆信息-添加 * 场内运输车辆信息-添加
...@@ -59,7 +58,7 @@ public class UploadDataNewTask { ...@@ -59,7 +58,7 @@ public class UploadDataNewTask {
} }
} }
@Scheduled(cron = "*/30 * * * * ?") @Scheduled(cron = "0 */1 * * * ?")
public void uploadInAndOutDate() { public void uploadInAndOutDate() {
try { try {
inAndOutDateService.uploadInAndOutDate(); inAndOutDateService.uploadInAndOutDate();
...@@ -67,4 +66,14 @@ public class UploadDataNewTask { ...@@ -67,4 +66,14 @@ public class UploadDataNewTask {
log.error("上传进出场记录异常", e); log.error("上传进出场记录异常", e);
} }
} }
@Scheduled(cron = "0 */1 * * * ?")
public void uploadTransportDateInfo() {
try {
transportDateService.uploadTransportDate();
} catch (Exception e) {
log.error("上传货物异常: {}", e);
}
}
} }
package com.bme.access.upload.model;
import lombok.Data;
@Data
public class MaterialInfo {
private String cargoname;
private String cargoquantity;
private String entryexitflownumber;
private String unit;
}
package com.bme.access.upload.model;
import lombok.Data;
@Data
public class TransportDate {
private String numberPlate;
private String transportName;
private Double transportVolume;
private String inoutTime;
private String createTime;
private Integer inOut;
private Integer vehicleUseType;
private String transportCode;
private String transportType;
private String company;
private String loadDischargeAddress;
private Integer action;
private Long id;
private String insertTime;
private Integer syncState;
private Integer remark;
private String msg;
}
package com.bme.access.upload.module.dao;
import com.bme.access.upload.model.TransportDate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface TransportDateMapper {
List<TransportDate> selectTransportDate(@Param("startTime") String startTime, @Param("endTime") String endTime);
}
package com.bme.access.upload.module.dao;
import com.bme.access.upload.model.TransportDate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface TransportDateUploadFailMapper {
Integer insertTransportDateFail(@Param("data")TransportDate data);
}
...@@ -9,6 +9,7 @@ import com.bme.access.upload.module.dao.DataUploadTimeMapper; ...@@ -9,6 +9,7 @@ import com.bme.access.upload.module.dao.DataUploadTimeMapper;
import com.bme.access.upload.module.dao.InAndOutDateUploadFailMapper; 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.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;
...@@ -17,6 +18,7 @@ import java.time.LocalDateTime; ...@@ -17,6 +18,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
@Service @Service
@Slf4j @Slf4j
...@@ -32,6 +34,7 @@ public class InAndOutDateService { ...@@ -32,6 +34,7 @@ public class InAndOutDateService {
private final static String IN_AND_OUT_DATE_URL = "https://dctapi.soszyzg.com/dct/new/addInAndOut"; private final static String IN_AND_OUT_DATE_URL = "https://dctapi.soszyzg.com/dct/new/addInAndOut";
private final static String COMPANY_CODE = "1302847854";
public void uploadInAndOutDate() { public void uploadInAndOutDate() {
// 查询上次更新时间 // 查询上次更新时间
...@@ -42,10 +45,10 @@ public class InAndOutDateService { ...@@ -42,10 +45,10 @@ public class InAndOutDateService {
} }
log.info("本次循环上传大于{}的数据", uploadTime); log.info("本次循环上传大于{}的数据", uploadTime);
String endTime = LocalDateTime.now().minusMinutes(2).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); String endTime = LocalDateTime.now().minusMinutes(2).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
this.getAndUploadInAndOutDate(uploadTime, endTime, Boolean.TRUE); this.getAndUploadInAndOutDate(uploadTime, endTime);
} }
public List<InAndOutDateUrl> getAndUploadInAndOutDate(String startTime, String endTime, Boolean flag) { public void getAndUploadInAndOutDate(String startTime, String endTime) {
log.info("执行进出场记录上传线程"); log.info("执行进出场记录上传线程");
List<InAndOutDateUrl> inAndOutDateUrlList = inAndOutDateUrlMapper.selectInAndOutDateUrl(startTime, endTime); List<InAndOutDateUrl> inAndOutDateUrlList = inAndOutDateUrlMapper.selectInAndOutDateUrl(startTime, endTime);
if (!CollectionUtils.isEmpty(inAndOutDateUrlList)){ if (!CollectionUtils.isEmpty(inAndOutDateUrlList)){
...@@ -62,11 +65,7 @@ public class InAndOutDateService { ...@@ -62,11 +65,7 @@ public class InAndOutDateService {
try { try {
String bodyJson = JSONObject.toJSONString(inAndOutDate); String bodyJson = JSONObject.toJSONString(inAndOutDate);
HttpUtils.sendPost(IN_AND_OUT_DATE_URL, null, null, bodyJson); HttpUtils.sendPost(IN_AND_OUT_DATE_URL, null, null, bodyJson);
if (flag){ dataUploadTimeMapper.updateUploadTimeByType(inAndOutDateUrl.getInOutTime(), 103);
dataUploadTimeMapper.updateUploadTimeByType(inAndOutDateUrl.getInOutTime(), 103);
}
// 防止连接超时
Thread.sleep(50);
} catch (Exception e) { } catch (Exception e) {
log.info("过车记录上传失败,重新上传一次{}", e.getMessage()); log.info("过车记录上传失败,重新上传一次{}", e.getMessage());
try { try {
...@@ -77,23 +76,18 @@ public class InAndOutDateService { ...@@ -77,23 +76,18 @@ public class InAndOutDateService {
inAndOutDateUrl.setMsg(ex.getMessage()); inAndOutDateUrl.setMsg(ex.getMessage());
inAndOutDateUploadFailMapper.insertInAndOutFail(inAndOutDateUrl); inAndOutDateUploadFailMapper.insertInAndOutFail(inAndOutDateUrl);
} finally { } finally {
if (flag){
dataUploadTimeMapper.updateUploadTimeByType(inAndOutDateUrl.getInOutTime(), 103);
}
}
} finally {
if (flag){
dataUploadTimeMapper.updateUploadTimeByType(inAndOutDateUrl.getInOutTime(), 103); dataUploadTimeMapper.updateUploadTimeByType(inAndOutDateUrl.getInOutTime(), 103);
} }
} finally {
dataUploadTimeMapper.updateUploadTimeByType(inAndOutDateUrl.getInOutTime(), 103);
} }
} }
if (!CollectionUtils.isEmpty(inAndOutDateUrlList) && flag){ if (!CollectionUtils.isEmpty(inAndOutDateUrlList)){
log.info("本次循环上传完成,再次更新最后的上传时间{}", inAndOutDateUrlList.get(inAndOutDateUrlList.size() - 1).getInOutTime()); log.info("本次循环上传完成,再次更新最后的上传时间{}", inAndOutDateUrlList.get(inAndOutDateUrlList.size() - 1).getInOutTime());
dataUploadTimeMapper.updateUploadTimeByType(inAndOutDateUrlList.get(inAndOutDateUrlList.size() - 1).getInOutTime(), 103); dataUploadTimeMapper.updateUploadTimeByType(inAndOutDateUrlList.get(inAndOutDateUrlList.size() - 1).getInOutTime(), 103);
} else { } else {
log.info("本次循环无数据上传"); log.info("本次循环无数据上传");
} }
return inAndOutDateUrlList;
} }
private InAndOutDate convertInAndOutDate(InAndOutDateUrl inAndOutDateUrl) { private InAndOutDate convertInAndOutDate(InAndOutDateUrl inAndOutDateUrl) {
...@@ -102,16 +96,30 @@ public class InAndOutDateService { ...@@ -102,16 +96,30 @@ public class InAndOutDateService {
inAndOutDate.setEntryexitstatus(inAndOutDateUrl.getInOrOut().toString()); inAndOutDate.setEntryexitstatus(inAndOutDateUrl.getInOrOut().toString());
inAndOutDate.setEntryexittime(inAndOutDateUrl.getInOutTime()); inAndOutDate.setEntryexittime(inAndOutDateUrl.getInOutTime());
inAndOutDate.setLicenseplatenumber(inAndOutDateUrl.getNumberPlate()); inAndOutDate.setLicenseplatenumber(inAndOutDateUrl.getNumberPlate());
inAndOutDate.setEntryexitnumber(inAndOutDateUrl.getGatePostCode()); // 出入口编号
inAndOutDate.setBarriernumber(""); String entryExitNumber = Objects.equals(inAndOutDateUrl.getGatePostCode(), "GC-2MEN") ? "B" : Objects.equals(inAndOutDateUrl.getGatePostCode(), "GC-3MEN") ? "C" : Objects.equals(inAndOutDateUrl.getGatePostCode(), "GC_1MEN") ? "A" : "";
inAndOutDate.setEntryexitnumber(entryExitNumber);
// 道闸编号
if (StringUtils.isNotEmpty(entryExitNumber)) {
String barrierNumber = Objects.equals(inAndOutDateUrl.getInOrOut(), 1) ? entryExitNumber.concat( "01") : Objects.equals(inAndOutDateUrl.getInOrOut(), 2) ? entryExitNumber.concat( "02") : "";
inAndOutDate.setBarriernumber(barrierNumber);
} else {
inAndOutDate.setBarriernumber("");
}
// 货物信息 // 货物信息
inAndOutDate.setCargoname(""); inAndOutDate.setCargoname("");
inAndOutDate.setCargoquantity(""); inAndOutDate.setCargoquantity("");
inAndOutDate.setUnit("T"); inAndOutDate.setUnit("T");
// 车队信息 // 车队信息
inAndOutDate.setEntryexitflownumber(inAndOutDateUrl.getRsn()); inAndOutDate.setFleetname("");
return new InAndOutDate(); // 进出厂流水号
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();
inAndOutDate.setEntryexitflownumber(rsn);
return inAndOutDate;
} }
} }
package com.bme.access.upload.module.service;
import com.alibaba.fastjson.JSONObject;
import com.bme.access.upload.common.DateUtils;
import com.bme.access.upload.common.HttpUtils;
import com.bme.access.upload.model.MaterialInfo;
import com.bme.access.upload.model.TransportDate;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Service
@Slf4j
public class TransportDateService {
@Autowired
private DataUploadTimeMapper dataUploadTimeMapper;
@Autowired
private TransportDateMapper transportDateMapper;
@Autowired
private LoginService loginService;
@Autowired
private TransportDateUploadFailMapper transportDateUploadFailMapper;
private final static String COMPANY_CODE = "1302847854";
private final static String CARGO_URL = "https://dctapi.soszyzg.com/dct/addCargo";
public void uploadTransportDate() {
// 查询上次更新时间
String uploadTime = dataUploadTimeMapper.getUploadTime(104);
if (org.springframework.util.StringUtils.isEmpty(uploadTime)) {
uploadTime = DateUtils.dateToStr(new Date(System.currentTimeMillis() - 60 * 60 * 1000), "yyyy-MM-dd HH:mm:ss");
dataUploadTimeMapper.insertUploadTime(uploadTime, 104);
}
log.info("本次循环上传大于{}的数据", uploadTime);
String endTime = LocalDateTime.now().minusMinutes(2).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
this.getAndUploadTransportDate(uploadTime, endTime);
}
public void getAndUploadTransportDate(String startTime, String endTime) {
log.info("执行进出厂货物上传");
List<TransportDate> transportDateList = transportDateMapper.selectTransportDate(startTime, endTime);
if (!CollectionUtils.isEmpty(transportDateList)){
try {
loginService.login();
} catch (Exception e) {
log.error("更新token失败:{}", e.getMessage());
}
}
log.info("本次货物上传记录需要上报{}条", transportDateList.size());
for(int i = 0; i < transportDateList.size(); i++) {
TransportDate transportDate = transportDateList.get(i);
MaterialInfo materialInfo = this.convertMaterialInfo(transportDate);
try {
String bodyJson = JSONObject.toJSONString(materialInfo);
HttpUtils.sendPost(CARGO_URL, null, null, bodyJson);
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);
} catch (Exception ex) {
log.info("再次失败,此条数据存于失败表里{}", ex.getMessage());
transportDate.setMsg(ex.getMessage());
transportDateUploadFailMapper.insertTransportDateFail(transportDate);
} finally {
dataUploadTimeMapper.updateUploadTimeByType(transportDate.getInoutTime(), 104);
}
} finally {
dataUploadTimeMapper.updateUploadTimeByType(transportDate.getInoutTime(), 104);
}
}
if (!CollectionUtils.isEmpty(transportDateList)){
log.info("本次循环上传完成,再次更新最后的上传时间{}", transportDateList.get(transportDateList.size() - 1).getInoutTime());
dataUploadTimeMapper.updateUploadTimeByType(transportDateList.get(transportDateList.size() - 1).getInoutTime(), 104);
} else {
log.info("本次循环无数据上传");
}
}
public MaterialInfo convertMaterialInfo(TransportDate transportDate) {
MaterialInfo materialInfo = new MaterialInfo();
materialInfo.setCargoname(transportDate.getTransportName());
materialInfo.setUnit("T");
materialInfo.setCargoquantity(transportDate.getTransportVolume().toString());
// 进出厂流水号
String timeStr = Objects.requireNonNull(DateUtils.format(DateUtils.toDate(transportDate.getInoutTime()), DateUtils.DATE_FORMAT_MIN)).substring(0, DateUtils.DATE_FORMAT_MIN.length());
String rsn = COMPANY_CODE + timeStr + transportDate.getInOut();
materialInfo.setEntryexitflownumber(rsn);
return materialInfo;
}
}
package com.bme.access.upload.module.web;
import com.alibaba.fastjson.JSONObject;
import com.bme.access.upload.common.CommonResult;
import com.bme.access.upload.common.DateUtils;
import com.bme.access.upload.common.HttpUtils;
import com.bme.access.upload.model.InAndOutDate;
import com.bme.access.upload.model.InAndOutDateUrl;
import com.bme.access.upload.model.MaterialInfo;
import com.bme.access.upload.model.TransportDate;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Objects;
@RestController
@Slf4j
@RequestMapping
public class TestController {
private final static String IN_AND_OUT_DATE_URL = "https://dctapi.soszyzg.com/dct/new/addInAndOut";
private final static String CARGO_URL = "https://dctapi.soszyzg.com/dct/addCargo";
private final static String COMPANY_CODE = "1302847854";
@GetMapping("/uploadInAndOutDate")
public CommonResult uploadInAndOutDate() throws Exception {
// 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.setInOutImage("http://192.168.2.80:8080/250709/Vehicle_Plate/16_7_36_140.jpg");
inAndOutDateUrl.setInOrOut(2);
inAndOutDateUrl.setGatePostCode("GC_1MEN");
inAndOutDateUrl.setInOutPlateImage("http://192.168.2.80:8080/250709/ALL_Vehicle_SmallPlate/16_7_36_207.jpg");
InAndOutDate inAndOutDate = this.convertInAndOutDate(inAndOutDateUrl);
try {
String bodyJson = JSONObject.toJSONString(inAndOutDate);
HttpResponse response = HttpUtils.sendPost(IN_AND_OUT_DATE_URL, null, null, bodyJson);
} catch (Exception e) {
log.error(e.getMessage());
}
return CommonResult.success("成功");
}
@GetMapping("/uploadTransportDate")
public CommonResult uploadTransportDate() throws Exception {
// 川LD8228 废钢 34.03 2024-04-30 19:38:17.000 1 1 202405010001 欧冶链金再生资源有限公司西部分公司 1 2024-04-30 19:38:17.000 1
TransportDate transportDate = new TransportDate();
transportDate.setTransportName("废钢");
transportDate.setTransportVolume(34.03);
transportDate.setInOut(1);
transportDate.setInoutTime("2024-04-30 19:38:17.000");
MaterialInfo materialInfo = this.convertMaterialInfo(transportDate);
try {
String bodyJson = JSONObject.toJSONString(materialInfo);
HttpResponse response = HttpUtils.sendPost(CARGO_URL, null, null, bodyJson);
HttpEntity entity = response.getEntity();
String a = "";
} catch (Exception e) {
log.error(e.getMessage());
}
return CommonResult.success("成功");
}
private InAndOutDate convertInAndOutDate(InAndOutDateUrl inAndOutDateUrl) {
InAndOutDate inAndOutDate = new InAndOutDate();
inAndOutDate.setInOutAttribute("1");
inAndOutDate.setEntryexitstatus(inAndOutDateUrl.getInOrOut().toString());
inAndOutDate.setEntryexittime(inAndOutDateUrl.getInOutTime());
inAndOutDate.setLicenseplatenumber(inAndOutDateUrl.getNumberPlate());
// 出入口编号
String entryExitNumber = Objects.equals(inAndOutDateUrl.getGatePostCode(), "GC-2MEN") ? "B" : Objects.equals(inAndOutDateUrl.getGatePostCode(), "GC-3MEN") ? "C" : Objects.equals(inAndOutDateUrl.getGatePostCode(), "GC_1MEN") ? "A" : "";
inAndOutDate.setEntryexitnumber(entryExitNumber);
// 道闸编号
if (StringUtils.isNotEmpty(entryExitNumber)) {
String barrierNumber = Objects.equals(inAndOutDateUrl.getInOrOut(), 1) ? entryExitNumber.concat( "01") : Objects.equals(inAndOutDateUrl.getInOrOut(), 2) ? entryExitNumber.concat( "02") : "";
inAndOutDate.setBarriernumber(barrierNumber);
} else {
inAndOutDate.setBarriernumber("");
}
// 货物信息
inAndOutDate.setCargoname("");
inAndOutDate.setCargoquantity("");
inAndOutDate.setUnit("T");
// 车队信息
inAndOutDate.setFleetname("");
// 进出厂流水号
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();
inAndOutDate.setEntryexitflownumber(rsn);
return inAndOutDate;
}
public MaterialInfo convertMaterialInfo(TransportDate transportDate) {
MaterialInfo materialInfo = new MaterialInfo();
materialInfo.setCargoname(transportDate.getTransportName());
materialInfo.setUnit("T");
materialInfo.setCargoquantity(transportDate.getTransportVolume().toString());
// 进出厂流水号
String timeStr = Objects.requireNonNull(DateUtils.format(DateUtils.toDate(transportDate.getInoutTime()), DateUtils.DATE_FORMAT_MIN)).substring(0, DateUtils.DATE_FORMAT_MIN.length());
String rsn = COMPANY_CODE + timeStr + transportDate.getInOut();
materialInfo.setEntryexitflownumber(rsn);
return materialInfo;
}
}
spring: spring:
datasource: datasource:
original: original:
url: jdbc:sqlserver://10.2.1.89;Databasename=BME_Vehilce_Gate;trustServerCertificate=true url: jdbc:sqlserver://192.168.8.239;Databasename=BME_Vehilce_Gate;trustServerCertificate=true
username: sa username: sa
password: dp@2024 password: dp@2024
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
initialSize: 5 initialSize: 5
minIdle: 5 minIdle: 5
maxActive: 20 maxActive: 20
\ No newline at end of file
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
</appender> </appender>
<appender name="rollingAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="rollingAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${catalina.home:-.}/logs/bme-upload-task-ts-new.log</file> <file>${catalina.home:-.}/logs/bme-access-upload.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${catalina.home:-.}/logs/bme-upload-task-ts-%d{yyyy-MM-dd}.%i.log <fileNamePattern>${catalina.home:-.}/logs/bme-access-upload-%d{yyyy-MM-dd}.%i.log
</fileNamePattern> </fileNamePattern>
<maxHistory>7</maxHistory> <maxHistory>7</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
......
...@@ -4,9 +4,8 @@ ...@@ -4,9 +4,8 @@
<insert id="insertInAndOutFail" parameterType="com.bme.access.upload.model.InAndOutDateUrl"> <insert id="insertInAndOutFail" parameterType="com.bme.access.upload.model.InAndOutDateUrl">
insert into InAndOut_Date_Url_Fail (Number_plate, InOut_Time, InOut_Image, InorOut, Gate_post_code, InOut_Plate_Image, Inout_Top_image, Vehicle_color_index, msg) insert into InAndOut_Date_Url_Fail (Number_plate, InOut_Time, InOut_Image, InorOut, Gate_post_code, InOut_Plate_Image, Inout_Top_image, Vehicle_color_index, msg)
values (#{inAndOutDateUrl.numberPlate}, #{inAndOutDateUrl.inOutTime}, #{inAndOutDateUrl.inOutImage}, #{inAndOutDateUrl.inOrOut}, #{inAndOutDateUrl.gatePostCode}, values (#{data.numberPlate}, #{data.inOutTime}, #{data.inOutImage}, #{data.inOrOut}, #{data.gatePostCode},
#{inAndOutDateUrl.inOutPlateImage}, #{inAndOutDateUrl.inoutTopImage}, #{inAndOutDateUrl.vehicleColorIndex}, #{inAndOutDateUrl.msg}) #{data.inOutPlateImage}, #{data.inoutTopImage}, #{data.vehicleColorIndex}, #{data.msg})
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -3,18 +3,15 @@ ...@@ -3,18 +3,15 @@
<mapper namespace="com.bme.access.upload.module.dao.InAndOutDateUrlMapper"> <mapper namespace="com.bme.access.upload.module.dao.InAndOutDateUrlMapper">
<select id="selectInAndOutDateUrl" resultType="com.bme.access.upload.model.InAndOutDateUrl"> <select id="selectInAndOutDateUrl" resultType="com.bme.access.upload.model.InAndOutDateUrl">
select id ID, select ID id,
Number_plate numberPlate, Number_plate numberPlate,
InOut_Time inOutTime, InOut_Time inOutTime,
InOut_Image inOutImage, InOut_Image inOutImage,
InorOut inOrOut, InorOut inOrOut,
Gate_post_code gatePostCode, Gate_post_code gatePostCode,
InOut_Plate_Image inOutPlateImage, InOut_Plate_Image inOutPlateImage,
Inout_Top_image inoutTopImage, Vehicle_color_index vehicleColorIndex
Vehicle_color_index vehicleColorIndex, from InAndOut_Date_Url where InOut_Time > #{startTime}
unattended,
rsn
from InAndOut_Date_Url where InOut_Time > #{uploadTime}
<if test="endTime !=null and endTime != ''"> <if test="endTime !=null and endTime != ''">
and InOut_Time &lt;= #{endTime} and InOut_Time &lt;= #{endTime}
</if> </if>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bme.access.upload.module.dao.TransportDateMapper">
<select id="selectTransportDate" resultType="com.bme.access.upload.model.TransportDate">
select number_plate numberPlate,
transport_name transportName,
transport_volume transportVolume,
inout_time inoutTime,
create_time createTime,
in_out inOut,
vehicle_use_type vehicleUseType,
transport_code transportCode,
transport_type transportType,
company,
load_discharge_address loadDischargeAddress,
action,
id,
insert_time insertTime,
sync_state syncState,
remark
from Transport_date where inout_time > #{startTime}
<if test="endTime !=null and endTime != ''">
and inout_time &lt;= #{endTime}
</if>
order by inout_time asc
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bme.access.upload.module.dao.TransportDateUploadFailMapper">
<insert id="insertTransportDateFail" parameterType="com.bme.access.upload.model.TransportDate">
insert into Transport_Date_Fail (number_plate,transport_name,transport_volume,inout_time,create_time,in_out,vehicle_use_type,transport_code,transport_type,company,load_discharge_address, msg)
values (#{data.numberPlate}, #{data.transportName}, #{data.transportVolume}, #{data.inoutTime}, now(),
#{data.inOut}, #{data.vehicleUseType}, #{data.transportCode}, #{data.transportType}, #{data.company}, #{data.loadDischargeAddress}, #{data.msg})
</insert>
</mapper>
\ No newline at end of file
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