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
2bc13b4a
Commit
2bc13b4a
authored
Nov 22, 2024
by
NGUYEN LONG CHAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
62451: グループコード追加
グループ情報API(abvapi/group)
parent
c3bb33c4
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
12 deletions
+33
-12
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/GroupsJSON.java
+6
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/DBConnector.java
+1
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/DatabaseVersions.java
+1
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/GroupDao.java
+14
-6
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/MGroup.java
+6
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/GroupDto.java
+3
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/GroupLogic.java
+2
-2
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/GroupsJSON.java
View file @
2bc13b4a
...
...
@@ -23,6 +23,7 @@ public class GroupsJSON extends AcmsCommonJSON {
public
static
final
String
GroupLevel
=
"groupLevel"
;
public
static
final
String
ParentGroupId
=
"parentGroupId"
;
public
static
final
String
UserGroupIds
=
"userGroupIds"
;
public
static
final
String
GroupCode
=
"groupCode"
;
public
ArrayList
<
GroupDto
>
groupList
;
public
Integer
[]
userGroupIds
;
...
...
@@ -56,6 +57,10 @@ public class GroupsJSON extends AcmsCommonJSON {
String
groupName
=
getString
(
group
,
GroupName
);
short
groupLevel
=
(
short
)
getInt
(
group
,
GroupLevel
);
int
parentGroupId
=
getInt
(
group
,
ParentGroupId
);
String
groupCode
=
""
;
if
(
group
.
has
(
GroupCode
))
{
groupCode
=
getString
(
group
,
GroupCode
);
}
// ユーザが所属しているグループフラグ
boolean
userGroupFlg
=
false
;
...
...
@@ -63,7 +68,7 @@ public class GroupsJSON extends AcmsCommonJSON {
userGroupFlg
=
Arrays
.
asList
(
userGroupIds
).
contains
(
groupId
);
}
groupList
.
add
(
new
GroupDto
(
groupId
,
groupName
,
groupLevel
,
parentGroupId
,
userGroupFlg
));
groupList
.
add
(
new
GroupDto
(
groupId
,
groupName
,
groupLevel
,
parentGroupId
,
userGroupFlg
,
groupCode
));
}
}
else
{
throw
new
JSONValidationException
(
json
.
toString
(),
GroupList
+
" property not found."
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/DBConnector.java
View file @
2bc13b4a
...
...
@@ -19,7 +19,7 @@ import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public
class
DBConnector
{
private
static
volatile
DBConnector
dbConnector
=
null
;
public
static
final
String
DatabaseName
=
"ABVJE"
;
public
static
final
int
DatabaseVersion
=
DatabaseVersions
.
Ver1_0_
5
;
public
static
final
int
DatabaseVersion
=
DatabaseVersions
.
Ver1_0_
612
;
protected
SQLiteDatabase
db
=
null
;
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/DatabaseVersions.java
View file @
2bc13b4a
...
...
@@ -7,4 +7,5 @@ public class DatabaseVersions {
public
static
final
int
Ver1_0_3
=
21
;
// @From カテゴリ選択機能追加
public
static
final
int
Ver1_0_4
=
31
;
// @From ロック、ダッシュボード対応
public
static
final
int
Ver1_0_5
=
32
;
// Ver.1.0.600 プッシュメッセージ仕様変更対応
public
static
final
int
Ver1_0_612
=
33
;
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/GroupDao.java
View file @
2bc13b4a
...
...
@@ -59,6 +59,10 @@ public class GroupDao extends AbstractDao {
if
(
column
!=
-
1
)
{
dto
.
userGroupFlg
=
toBool
(
cursor
.
getInt
(
column
));
}
column
=
cursor
.
getColumnIndex
(
"group_code"
);
if
(
column
!=
-
1
)
{
dto
.
groupCode
=
cursor
.
getString
(
column
);
}
return
dto
;
}
...
...
@@ -88,6 +92,7 @@ public class GroupDao extends AbstractDao {
sql
.
append
(
" , mg.parent_group_id AS parent_group_id "
);
sql
.
append
(
" , mg.group_name AS group_name "
);
sql
.
append
(
" , 0 AS content_count "
);
// 初期化用であるため、コンテンツ数はいらない。
sql
.
append
(
" , mg.group_code AS group_code "
);
sql
.
append
(
" FROM m_group AS mg "
);
break
;
case
GetRootGroups:
...
...
@@ -125,6 +130,7 @@ public class GroupDao extends AbstractDao {
sql
.
append
(
" , T1.group_level "
);
sql
.
append
(
" , T1.group_name "
);
sql
.
append
(
" , T1.group_path "
);
sql
.
append
(
" , T1.group_code "
);
sql
.
append
(
" , SUM(T1.content_count) AS content_count "
);
sql
.
append
(
" , CASE WHEN SUM(T1.child_content_count) = 0 THEN ' (' || SUM(T1.content_count) || ') ' "
);
sql
.
append
(
" ELSE ' (' || SUM(T1.content_count) || '/' || (SUM(T1.content_count) + SUM(T1.child_content_count)) || ') ' "
);
...
...
@@ -136,6 +142,7 @@ public class GroupDao extends AbstractDao {
sql
.
append
(
" , mg2.group_level "
);
sql
.
append
(
" , mg2.group_name "
);
sql
.
append
(
" , mg2.group_path "
);
sql
.
append
(
" , mg2.group_code "
);
if
(
isOnlineSearched
)
{
sql
.
append
(
" , CASE WHEN mg2.group_id = mg1.group_id THEN COUNT(tcss.content_id) "
);
...
...
@@ -264,14 +271,14 @@ public class GroupDao extends AbstractDao {
return
sql
.
toString
();
}
public
void
insertGroup
(
int
groupId
,
int
parentGroupId
,
String
groupName
,
int
groupLevel
,
boolean
userGroupFlg
)
{
public
void
insertGroup
(
int
groupId
,
int
parentGroupId
,
String
groupName
,
int
groupLevel
,
boolean
userGroupFlg
,
String
groupCode
)
{
StringBuffer
sql
=
new
StringBuffer
();
sql
.
append
(
" INSERT OR IGNORE INTO m_group (group_id, parent_group_id, group_name, group_path, group_level, user_group_flg) "
);
sql
.
append
(
" VALUES (?,?,?,?,?,?) "
);
sql
.
append
(
" INSERT OR IGNORE INTO m_group (group_id, parent_group_id, group_name, group_path, group_level, user_group_flg
, group_code
) "
);
sql
.
append
(
" VALUES (?,?,?,?,?,?
,?
) "
);
try
{
beginTransaction
();
String
groupPath
=
createInsertGroupPath
(
groupId
,
parentGroupId
,
groupLevel
);
insert
(
sql
.
toString
(),
new
Object
[]
{
groupId
,
parentGroupId
,
groupName
,
groupPath
,
groupLevel
,
userGroupFlg
});
insert
(
sql
.
toString
(),
new
Object
[]
{
groupId
,
parentGroupId
,
groupName
,
groupPath
,
groupLevel
,
userGroupFlg
,
groupCode
});
commit
();
}
catch
(
Exception
e
)
{
rollback
();
...
...
@@ -305,19 +312,20 @@ public class GroupDao extends AbstractDao {
return
rawQueryGetDto
(
sql
.
toString
(),
new
String
[]
{
""
+
parentGroupId
,
""
+
groupLevel
},
GroupDto
.
class
);
}
public
void
updateGroup
(
int
groupId
,
int
parentGroupId
,
String
groupName
,
int
groupLevel
,
boolean
userGroupFlg
)
{
public
void
updateGroup
(
int
groupId
,
int
parentGroupId
,
String
groupName
,
int
groupLevel
,
boolean
userGroupFlg
,
String
groupCode
)
{
StringBuffer
sql
=
new
StringBuffer
();
sql
.
append
(
" UPDATE m_group "
);
sql
.
append
(
" SET group_name = ? "
);
sql
.
append
(
" , user_group_flg = ? "
);
sql
.
append
(
" , group_path = ? "
);
sql
.
append
(
" , group_code = ? "
);
sql
.
append
(
" WHERE group_id = ? "
);
sql
.
append
(
" AND parent_group_id = ? "
);
sql
.
append
(
" AND group_level = ? "
);
try
{
beginTransaction
();
String
groupPath
=
createUpdateGroupPath
(
groupId
,
parentGroupId
,
groupLevel
);
update
(
sql
.
toString
(),
new
Object
[]
{
groupName
,
userGroupFlg
,
groupPath
,
groupId
,
parentGroupId
,
groupLevel
});
update
(
sql
.
toString
(),
new
Object
[]
{
groupName
,
userGroupFlg
,
groupPath
,
group
Code
,
group
Id
,
parentGroupId
,
groupLevel
});
commit
();
}
catch
(
Exception
e
)
{
rollback
();
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/MGroup.java
View file @
2bc13b4a
...
...
@@ -34,6 +34,7 @@ public class MGroup extends SQLiteTableScript {
sql
.
append
(
" , group_name VARCHAR(64) NOT NULL "
);
sql
.
append
(
" , group_path TEXT NOT NULL "
);
// path enumaerationパターンを適用する。since DatabaseVersions.Ver1_5_0
sql
.
append
(
" , user_group_flg BOOLEAN NOT NULL DEFAULT 0 "
);
// since DatabaseVersions.Plus_1_1_0
sql
.
append
(
" , group_code VARCHAR(10) DEFAULT '' NOT NULL "
);
sql
.
append
(
" , PRIMARY KEY (group_relation_id) "
);
sql
.
append
(
" ) "
);
...
...
@@ -66,7 +67,11 @@ public class MGroup extends SQLiteTableScript {
@Override
public
List
<
String
>
getUpgradeScript
(
int
oldVersion
,
int
newVersion
)
{
return
null
;
List
<
String
>
ddl
=
new
ArrayList
<
String
>();
if
(
oldVersion
<
DatabaseVersions
.
Ver1_0_612
)
{
ddl
.
add
(
" ALTER TABLE m_group ADD COLUMN group_code VARCHAR(10) DEFAULT '' NOT NULL "
);
}
return
ddl
;
}
@Override
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/GroupDto.java
View file @
2bc13b4a
...
...
@@ -16,16 +16,18 @@ public class GroupDto extends AbstractDto {
public
String
displayCount
;
public
String
groupPath
;
public
boolean
userGroupFlg
;
public
String
groupCode
;
public
GroupDto
()
{
}
public
GroupDto
(
int
groupId
,
String
groupName
,
int
groupLevel
,
int
parentGroupId
,
boolean
userGroupFlg
)
{
public
GroupDto
(
int
groupId
,
String
groupName
,
int
groupLevel
,
int
parentGroupId
,
boolean
userGroupFlg
,
String
groupCode
)
{
this
.
groupId
=
groupId
;
this
.
groupName
=
groupName
;
this
.
groupLevel
=
groupLevel
;
this
.
parentGroupId
=
parentGroupId
;
this
.
userGroupFlg
=
userGroupFlg
;
this
.
groupCode
=
groupCode
;
}
@Override
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/GroupLogic.java
View file @
2bc13b4a
...
...
@@ -70,7 +70,7 @@ public class GroupLogic extends AbstractLogic {
if
(
exist
)
{
// update
groupDao
.
updateGroup
(
serverDto
.
groupId
,
serverDto
.
parentGroupId
,
serverDto
.
groupName
,
serverDto
.
groupLevel
,
serverDto
.
userGroupFlg
);
groupDao
.
updateGroup
(
serverDto
.
groupId
,
serverDto
.
parentGroupId
,
serverDto
.
groupName
,
serverDto
.
groupLevel
,
serverDto
.
userGroupFlg
,
serverDto
.
groupCode
);
// 更新したグループはローカルのリストから外しておく。
localGroups
.
remove
(
localDto
);
...
...
@@ -83,7 +83,7 @@ public class GroupLogic extends AbstractLogic {
// ユーザの所属グループの情報が変更された
isChangedUserGroupInfo
=
true
;
// insert
groupDao
.
insertGroup
(
serverDto
.
groupId
,
serverDto
.
parentGroupId
,
serverDto
.
groupName
,
serverDto
.
groupLevel
,
serverDto
.
userGroupFlg
);
groupDao
.
insertGroup
(
serverDto
.
groupId
,
serverDto
.
parentGroupId
,
serverDto
.
groupName
,
serverDto
.
groupLevel
,
serverDto
.
userGroupFlg
,
serverDto
.
groupCode
);
if
(
localContents
==
null
)
{
localContents
=
contentDao
.
getAllContents
();
...
...
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