Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bme-access-upload
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李洪明
bme-access-upload
Commits
6259760a
Commit
6259760a
authored
Jul 09, 2025
by
李洪明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加上传进出厂记录
parent
f4b0b0ad
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
143 additions
and
13 deletions
+143
-13
Application.java
src/main/java/com/bme/access/upload/Application.java
+1
-9
DruidDataSourceConfig.java
...a/com/bme/access/upload/config/DruidDataSourceConfig.java
+62
-0
InAndOutDateService.java
...bme/access/upload/module/service/InAndOutDateService.java
+1
-2
TestController.java
...java/com/bme/access/upload/module/web/TestController.java
+77
-0
application-gangchen.yml
src/main/resources/application-gangchen.yml
+2
-2
No files found.
src/main/java/com/bme/access/upload/Application.java
View file @
6259760a
package
com
.
bme
.
access
.
upload
;
import
com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
;
@SpringBootApplication
(
exclude
=
{
DataSourceAutoConfiguration
.
class
,
DataSourceTransactionManagerAutoConfiguration
.
class
,
DruidDataSourceAutoConfigure
.
class
,
HibernateJpaAutoConfiguration
.
class
})
@SpringBootApplication
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
...
...
src/main/java/com/bme/access/upload/config/DruidDataSourceConfig.java
0 → 100644
View file @
6259760a
package
com
.
bme
.
access
.
upload
.
config
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.alibaba.druid.support.http.StatViewServlet
;
import
com.alibaba.druid.support.http.WebStatFilter
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.boot.web.servlet.ServletRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 阿里Druid数据源配置
*
* @author yutyi
* @date 2018/09/14
*/
@Configuration
@MapperScan
(
basePackages
=
"com.bme.access.upload.module.dao"
)
public
class
DruidDataSourceConfig
{
@ConfigurationProperties
(
prefix
=
"spring.datasource.original"
)
@Bean
public
DruidDataSource
dataSource
()
{
return
new
DruidDataSource
();
}
/**
* 配置druid的监控管理后台的servlet
* 请求路径:http://locahost:9090/jdbc/durid
* @return
*/
@Bean
public
ServletRegistrationBean
statViewServlet
()
{
ServletRegistrationBean
bean
=
new
ServletRegistrationBean
(
new
StatViewServlet
(),
"/druid/*"
);
Map
<
String
,
String
>
initParams
=
new
HashMap
<>(
6
);
initParams
.
put
(
"loginUsername"
,
"admin"
);
initParams
.
put
(
"loginPassword"
,
"bme12345"
);
bean
.
setInitParameters
(
initParams
);
return
bean
;
}
/**
* 配置一个web监控的filter
* @return
*/
@Bean
public
FilterRegistrationBean
webStatFilter
()
{
FilterRegistrationBean
bean
=
new
FilterRegistrationBean
();
bean
.
setFilter
(
new
WebStatFilter
());
//监控后台所有请求
bean
.
setUrlPatterns
(
Arrays
.
asList
(
"/*"
));
return
bean
;
}
}
\ No newline at end of file
src/main/java/com/bme/access/upload/module/service/InAndOutDateService.java
View file @
6259760a
...
...
@@ -18,7 +18,6 @@ import java.time.LocalDateTime;
import
java.time.format.DateTimeFormatter
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
@Service
...
...
@@ -126,7 +125,7 @@ public class InAndOutDateService {
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
new
InAndOutDate
()
;
return
inAndOutDate
;
}
...
...
src/main/java/com/bme/access/upload/module/web/TestController.java
0 → 100644
View file @
6259760a
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
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
COMPANY_CODE
=
"1302847854"
;
@GetMapping
(
"/uploadInAndDate"
)
public
CommonResult
uploadInAndDate
()
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
(
"成功"
);
}
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
;
}
}
src/main/resources/application-gangchen.yml
View file @
6259760a
spring
:
datasource
:
original
:
url
:
jdbc:sqlserver://1
0.2.1.8
9;Databasename=BME_Vehilce_Gate;trustServerCertificate=true
url
:
jdbc:sqlserver://1
92.168.8.23
9;Databasename=BME_Vehilce_Gate;trustServerCertificate=true
username
:
sa
password
:
dp@2024
driver-class-name
:
com.microsoft.sqlserver.jdbc.SQLServerDriver
initialSize
:
5
minIdle
:
5
maxActive
:
20
maxActive
:
20
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment