Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
880b65ad
Commit
880b65ad
authored
Mar 08, 2022
by
onuma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
オブジェクトを毎回生成していたのを修正。アフターバーナーライブラリを追加。
parent
f3029c25
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
ABVJE_BL/build.gradle
+2
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/OperationLogic.java
+17
-13
No files found.
ABVJE_BL/build.gradle
View file @
880b65ad
...
@@ -16,6 +16,8 @@ dependencies {
...
@@ -16,6 +16,8 @@ dependencies {
implementation
group:
'com.fasterxml.jackson.core'
,
name:
'jackson-databind'
,
version:
'2.9.10.8'
implementation
group:
'com.fasterxml.jackson.core'
,
name:
'jackson-databind'
,
version:
'2.9.10.8'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations
implementation
group:
'com.fasterxml.jackson.core'
,
name:
'jackson-annotations'
,
version:
'2.9.10'
implementation
group:
'com.fasterxml.jackson.core'
,
name:
'jackson-annotations'
,
version:
'2.9.10'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-afterburner
implementation
group:
'com.fasterxml.jackson.module'
,
name:
'jackson-module-afterburner'
,
version:
'2.9.10'
}
}
sourceSets
{
sourceSets
{
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/OperationLogic.java
View file @
880b65ad
...
@@ -84,6 +84,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
...
@@ -84,6 +84,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationConfig
;
import
com.fasterxml.jackson.databind.SerializationConfig
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.module.afterburner.AfterburnerModule
;
/**
/**
* Created by leej on 2018/08/17.
* Created by leej on 2018/08/17.
...
@@ -1522,12 +1523,18 @@ public class OperationLogic extends AbstractLogic {
...
@@ -1522,12 +1523,18 @@ public class OperationLogic extends AbstractLogic {
public
void
createRoutineTaskReportJsonByJackson
(
Long
operationId
,
String
contentPath
)
throws
IOException
{
public
void
createRoutineTaskReportJsonByJackson
(
Long
operationId
,
String
contentPath
)
throws
IOException
{
List
<
TaskReport
>
taskReportList
=
new
ArrayList
<
TaskReport
>();
List
<
TaskReport
>
taskReportList
=
new
ArrayList
<
TaskReport
>();
List
<
TaskReportDto
>
routineTaskReportDtoList
=
mTaskReportDao
.
getTaskReportByOperationId
(
operationId
);
List
<
TaskReportDto
>
routineTaskReportDtoList
=
mTaskReportDao
.
getTaskReportByOperationId
(
operationId
);
ObjectMapper
hogetaskMapper
=
new
ObjectMapper
();
hogetaskMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
// null を無視
hogetaskMapper
.
disable
(
SerializationFeature
.
FAIL_ON_EMPTY_BEANS
);
// 空を許可。例) "task": {}
hogetaskMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
// 定義していないプロパティも出力
// 現在の作業タイプは定期点検の場合
// 現在の作業タイプは定期点検の場合
for
(
TaskReportDto
dto
:
routineTaskReportDtoList
)
{
for
(
TaskReportDto
dto
:
routineTaskReportDtoList
)
{
ObjectMapper
mapper
=
new
ObjectMapper
();
//
ObjectMapper mapper = new ObjectMapper();
mapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
// null を無視
//
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // null を無視
mapper
.
disable
(
SerializationFeature
.
FAIL_ON_EMPTY_BEANS
);
// 空を許可。例) "task": {}
//
mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); // 空を許可。例) "task": {}
mapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
// 定義していないプロパティも出力
//
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false); // 定義していないプロパティも出力
TaskReport
taskReport
=
new
TaskReport
();
TaskReport
taskReport
=
new
TaskReport
();
taskReport
.
taskReportInfoId
=
dto
.
taskReportInfoId
;
taskReport
.
taskReportInfoId
=
dto
.
taskReportInfoId
;
...
@@ -1536,10 +1543,6 @@ public class OperationLogic extends AbstractLogic {
...
@@ -1536,10 +1543,6 @@ public class OperationLogic extends AbstractLogic {
taskReport
.
reportEndDate
=
DateTimeUtil
.
toStringInTimeZone
(
dto
.
reportEndDate
,
DateTimeFormat
.
yyyyMMddHHmmss_hyphen
,
DateTimeUtil
.
getLocalTimeZone
());
taskReport
.
reportEndDate
=
DateTimeUtil
.
toStringInTimeZone
(
dto
.
reportEndDate
,
DateTimeFormat
.
yyyyMMddHHmmss_hyphen
,
DateTimeUtil
.
getLocalTimeZone
());
if
(!
StringUtil
.
isNullOrEmpty
(
dto
.
jsonData
))
{
if
(!
StringUtil
.
isNullOrEmpty
(
dto
.
jsonData
))
{
ObjectMapper
hogetaskMapper
=
new
ObjectMapper
();
hogetaskMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
// null を無視
hogetaskMapper
.
disable
(
SerializationFeature
.
FAIL_ON_EMPTY_BEANS
);
// 空を許可。例) "task": {}
hogetaskMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
// 定義していないプロパティも出力
HogeTask
hogeTask1
=
hogetaskMapper
.
readValue
(
dto
.
jsonData
,
HogeTask
.
class
);
HogeTask
hogeTask1
=
hogetaskMapper
.
readValue
(
dto
.
jsonData
,
HogeTask
.
class
);
...
@@ -1564,12 +1567,13 @@ public class OperationLogic extends AbstractLogic {
...
@@ -1564,12 +1567,13 @@ public class OperationLogic extends AbstractLogic {
root
.
taskReportId
=
lastRoutineTaskReportDto
.
taskReportId
;
root
.
taskReportId
=
lastRoutineTaskReportDto
.
taskReportId
;
root
.
taskReport_0
=
taskReportList
;
root
.
taskReport_0
=
taskReportList
;
ObjectMapper
lastMapper
=
new
ObjectMapper
();
//ObjectMapper lastMapper = new ObjectMapper();
lastMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
// null を無視
//lastMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // null を無視
lastMapper
.
disable
(
SerializationFeature
.
FAIL_ON_EMPTY_BEANS
);
// 空を許可。例) "task": {}
//lastMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); // 空を許可。例) "task": {}
lastMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
// 定義していないプロパティも出力
//lastMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false); // 定義していないプロパティも出力
//lastMapper.registerModule(new AfterburnerModule());
//long start = System.currentTimeMillis();
//long start = System.currentTimeMillis();
last
Mapper
.
writeValue
(
new
File
(
contentPath
+
"/"
+
ABookKeys
.
TASK_REPORT
+
".json"
),
root
);
hogetask
Mapper
.
writeValue
(
new
File
(
contentPath
+
"/"
+
ABookKeys
.
TASK_REPORT
+
".json"
),
root
);
//long end = System.currentTimeMillis();
//long end = System.currentTimeMillis();
//Logger.i(TAG,"Jackson file write time. %s" , (end-start));
//Logger.i(TAG,"Jackson file write time. %s" , (end-start));
}
}
...
...
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