Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 49bf1f7f
authored
Oct 18, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
替换资源文件读取方式
1 parent
6f4ae460
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/PeaApiController.java
project-order/src/main/java/com/dituhui/pea/order/controller/PeaApiController.java
View file @
49bf1f7
...
...
@@ -13,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import
com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer
;
import
com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.ResourceLoader
;
import
org.springframework.format.annotation.DateTimeFormat
;
...
...
@@ -113,8 +114,8 @@ public class PeaApiController {
//查询日期起止参数限制为一月
Resource
resource
=
resourceLoader
.
getResource
(
"classpath:/
json/capacity.json"
);
String
jsonStr
=
FileUtil
.
readString
(
r
esource
.
getFile
(),
StandardCharsets
.
UTF_8
);
ClassPathResource
classPathResource
=
new
ClassPathResource
(
"
json/capacity.json"
);
String
jsonStr
=
FileUtil
.
readString
(
classPathR
esource
.
getFile
(),
StandardCharsets
.
UTF_8
);
CapacityQueryDTO
.
Result
result
=
JsonUtil
.
parse
(
jsonStr
,
CapacityQueryDTO
.
Result
.
class
).
get
();
result
.
setParams
(
reqDTO
);
return
Result
.
success
(
result
);
...
...
@@ -139,8 +140,8 @@ public class PeaApiController {
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@RequestParam
(
"endDate"
)
Date
endDate
)
throws
IOException
{
Resource
resource
=
resourceLoader
.
getResource
(
"classpath:/
json/capacity.json"
);
String
jsonStr
=
FileUtil
.
readString
(
r
esource
.
getFile
(),
StandardCharsets
.
UTF_8
);
ClassPathResource
classPathResource
=
new
ClassPathResource
(
"
json/capacity.json"
);
String
jsonStr
=
FileUtil
.
readString
(
classPathR
esource
.
getFile
(),
StandardCharsets
.
UTF_8
);
CapacityQueryDTO
.
Result
resultTemp
=
JsonUtil
.
parse
(
jsonStr
,
CapacityQueryDTO
.
Result
.
class
).
get
();
CapacityQueryDTO
.
PersonalResult
result
=
new
CapacityQueryDTO
.
PersonalResult
();
...
...
@@ -189,8 +190,8 @@ public class PeaApiController {
@GetMapping
(
"/order/stage/query"
)
public
Result
<
OrderDTO
.
StageResult
>
orderStage
(
@NotBlank
@RequestParam
(
"orderId"
)
String
orderId
)
throws
IOException
{
Resource
resource
=
resourceLoader
.
getResource
(
"classpath:/
json/stage.json"
);
String
jsonStr
=
FileUtil
.
readString
(
r
esource
.
getFile
(),
StandardCharsets
.
UTF_8
);
ClassPathResource
classPathResource
=
new
ClassPathResource
(
"
json/stage.json"
);
String
jsonStr
=
FileUtil
.
readString
(
classPathR
esource
.
getFile
(),
StandardCharsets
.
UTF_8
);
OrderDTO
.
StageResult
stageResult
=
JsonUtil
.
parse
(
jsonStr
,
OrderDTO
.
StageResult
.
class
).
get
();
stageResult
.
setOrderId
(
orderId
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment