Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-store
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
base_platform_enterprise
gic-store
Commits
4cda8641
Commit
4cda8641
authored
Feb 27, 2020
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店对外api修改
parent
50370961
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
29 deletions
+38
-29
StoreOpenDTO.java
...pi/src/main/java/com/gic/store/dto/open/StoreOpenDTO.java
+6
-0
StoreOpenApiServiceImpl.java
...gic/store/service/outer/impl/StoreOpenApiServiceImpl.java
+32
-29
No files found.
gic-store-api/src/main/java/com/gic/store/dto/open/StoreOpenDTO.java
View file @
4cda8641
...
...
@@ -93,6 +93,12 @@ public class StoreOpenDTO implements Serializable {
/**
* 扩展字段
* [
* {
* "fieldCode":"",
* "fieldValue"""
* }
* ]
*/
private
String
customField
;
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreOpenApiServiceImpl.java
View file @
4cda8641
...
...
@@ -252,42 +252,45 @@ public class StoreOpenApiServiceImpl implements StoreOpenApiService {
List
<
StoreFieldDTO
>
fieldList
=
storeFieldService
.
listStoreFieldByRegionId
(
storeOpenDTO
.
getRegionId
());
String
customField
=
storeOpenDTO
.
getCustomField
();
if
(
StringUtils
.
isBlank
(
customField
))
{
customField
=
""
;
customField
=
"
[]
"
;
}
List
<
JSONObject
>
customFieldList
=
JSON
.
parseArray
(
customField
,
JSONObject
.
class
);
Map
<
String
,
String
>
apiFieldMap
=
getApiFieldMap
(
enterpriseId
,
storeOpenDTO
.
getRegionId
());
if
(
apiFieldMap
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"获取gic端和对外API之间门店自定义字段的匹配数据失败"
);
}
for
(
JSONObject
jsonObject
:
customFieldList
)
{
String
fieldCode
=
jsonObject
.
getString
(
"fieldCode"
);
String
fieldName
=
apiFieldMap
.
get
(
fieldCode
);
jsonObject
.
put
(
"fieldName"
,
fieldName
);
}
if
(
CollectionUtils
.
isNotEmpty
(
customFieldList
))
{
Map
<
String
,
String
>
apiFieldMap
=
getApiFieldMap
(
enterpriseId
,
storeOpenDTO
.
getRegionId
());
if
(
apiFieldMap
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"获取gic端和对外API之间门店自定义字段的匹配数据失败"
);
}
for
(
JSONObject
jsonObject
:
customFieldList
)
{
String
fieldCode
=
jsonObject
.
getString
(
"fieldCode"
);
String
fieldName
=
apiFieldMap
.
get
(
fieldCode
);
jsonObject
.
put
(
"fieldName"
,
fieldName
);
}
// logger.info("门店域的ID:{}, 自定义字段数据:{}", regionId, JSON.toJSONString(fieldList));
if
(
CollectionUtils
.
isNotEmpty
(
fieldList
))
{
List
<
StoreExtendDTO
>
extendDTOList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
fieldList
.
size
();
i
++)
{
StoreExtendDTO
storeExtendDTO
=
new
StoreExtendDTO
();
storeExtendDTO
.
setStoreFieldId
(
fieldList
.
get
(
i
).
getStoreFieldId
());
for
(
JSONObject
storeFieldObject
:
customFieldList
)
{
if
(
fieldList
.
get
(
i
).
getStoreFieldName
().
equals
(
storeFieldObject
.
getString
(
"fieldName"
)))
{
storeExtendDTO
.
setValue
(
storeFieldObject
.
getString
(
"fieldValue"
));
break
;
if
(
CollectionUtils
.
isNotEmpty
(
fieldList
))
{
List
<
StoreExtendDTO
>
extendDTOList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
fieldList
.
size
();
i
++)
{
StoreExtendDTO
storeExtendDTO
=
new
StoreExtendDTO
();
storeExtendDTO
.
setStoreFieldId
(
fieldList
.
get
(
i
).
getStoreFieldId
());
for
(
JSONObject
storeFieldObject
:
customFieldList
)
{
if
(
fieldList
.
get
(
i
).
getStoreFieldName
().
equals
(
storeFieldObject
.
getString
(
"fieldName"
)))
{
storeExtendDTO
.
setValue
(
storeFieldObject
.
getString
(
"fieldValue"
));
break
;
}
}
storeExtendDTO
.
setSort
(
fieldList
.
get
(
i
).
getSort
());
// 验证
ServiceResponse
fieldResponse
=
storeApiService
.
validateFieldExceptRepeat
(
storeExtendDTO
.
getValue
(),
fieldList
.
get
(
i
));
if
(!
fieldResponse
.
isSuccess
())
{
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
fieldResponse
.
getMessage
());
}
extendDTOList
.
add
(
storeExtendDTO
);
}
storeExtendDTO
.
setSort
(
fieldList
.
get
(
i
).
getSort
());
// 验证
ServiceResponse
fieldResponse
=
storeApiService
.
validateFieldExceptRepeat
(
storeExtendDTO
.
getValue
(),
fieldList
.
get
(
i
));
if
(!
fieldResponse
.
isSuccess
())
{
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
fieldResponse
.
getMessage
());
}
extendDTOList
.
add
(
storeExtendDTO
);
storeDTO
.
setStoreExtendList
(
extendDTOList
);
}
else
{
storeDTO
.
setStoreExtendList
(
Collections
.
emptyList
());
}
storeDTO
.
setStoreExtendList
(
extendDTOList
);
}
else
{
storeDTO
.
setStoreExtendList
(
Collections
.
emptyList
());
}
storeDTO
.
setReason
(
StoreLogReasonEnum
.
EXTERNAL
.
getCode
());
...
...
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