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
77fdfa07
Commit
77fdfa07
authored
Nov 11, 2019
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
联合商户授权
parent
edecb3ac
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
9 deletions
+73
-9
StoreAuthorizationApiService.java
...a/com/gic/store/service/StoreAuthorizationApiService.java
+3
-0
TabAuthStoreLogMapper.java
.../java/com/gic/store/dao/mapper/TabAuthStoreLogMapper.java
+8
-0
AuthStoreLogService.java
.../main/java/com/gic/store/service/AuthStoreLogService.java
+7
-1
AuthStoreLogServiceImpl.java
...a/com/gic/store/service/impl/AuthStoreLogServiceImpl.java
+11
-2
StoreAuthorizationApiServiceImpl.java
.../service/outer/impl/StoreAuthorizationApiServiceImpl.java
+27
-4
TabAuthStoreLogMapper.xml
...rvice/src/main/resources/mapper/TabAuthStoreLogMapper.xml
+17
-2
No files found.
gic-store-api/src/main/java/com/gic/store/service/StoreAuthorizationApiService.java
View file @
77fdfa07
...
...
@@ -4,6 +4,7 @@ import com.gic.api.base.commons.ServiceResponse;
import
com.gic.store.dto.StoreDTO
;
import
javax.xml.ws.Service
;
import
java.util.List
;
public
interface
StoreAuthorizationApiService
{
...
...
@@ -15,6 +16,8 @@ public interface StoreAuthorizationApiService {
*/
ServiceResponse
<
Void
>
authStore
(
Integer
storeResourceId
,
Integer
toEnterpriseId
,
Integer
enterpriseId
);
ServiceResponse
<
Void
>
reAuthStore
(
String
key
);
ServiceResponse
<
Void
>
authorizationSingleStore
(
String
params
);
ServiceResponse
<
Void
>
saveStore
(
StoreDTO
storeDTO
,
Integer
logId
);
...
...
gic-store-service/src/main/java/com/gic/store/dao/mapper/TabAuthStoreLogMapper.java
View file @
77fdfa07
...
...
@@ -56,4 +56,11 @@ public interface TabAuthStoreLogMapper {
List
<
TabAuthStoreLog
>
listLogByKey
(
@Param
(
"key"
)
String
key
,
@Param
(
"status"
)
int
status
);
List
<
TabAuthStoreLog
>
listFailedStore
(
@Param
(
"key"
)
String
key
);
List
<
TabAuthStoreLog
>
listLog
(
@Param
(
"key"
)
String
key
,
@Param
(
"storeInfoId"
)
Integer
storeInfoId
,
@Param
(
"toEnterpriseId"
)
Integer
toEnterpriseId
);
}
\ No newline at end of file
gic-store-service/src/main/java/com/gic/store/service/AuthStoreLogService.java
View file @
77fdfa07
package
com
.
gic
.
store
.
service
;
import
com.gic.store.entity.TabAuthStoreLog
;
import
java.util.List
;
public
interface
AuthStoreLogService
{
int
saveAuthStoreLog
(
Integer
storeInfoId
,
Integer
fromEnterpriseId
,
Integer
toEnterpriseId
,
String
key
);
int
updateStatus
(
Integer
id
,
int
status
);
int
getCount
(
String
key
,
int
status
);
int
getCount
(
String
key
,
Integer
status
);
List
<
TabAuthStoreLog
>
listFailedStore
(
String
key
);
}
gic-store-service/src/main/java/com/gic/store/service/impl/AuthStoreLogServiceImpl.java
View file @
77fdfa07
...
...
@@ -16,12 +16,16 @@ public class AuthStoreLogServiceImpl implements AuthStoreLogService {
@Override
public
int
saveAuthStoreLog
(
Integer
storeInfoId
,
Integer
fromEnterpriseId
,
Integer
toEnterpriseId
,
String
key
)
{
List
<
TabAuthStoreLog
>
list
=
this
.
tabAuthStoreLogMapper
.
listLog
(
key
,
storeInfoId
,
toEnterpriseId
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
return
list
.
get
(
0
).
getId
();
}
TabAuthStoreLog
log
=
new
TabAuthStoreLog
();
log
.
setStoreInfoId
(
storeInfoId
);
log
.
setFromEnterpriseId
(
fromEnterpriseId
);
log
.
setKey
(
key
);
log
.
setToEnterpriseId
(
toEnterpriseId
);
log
.
setStatus
(
1
);
log
.
setStatus
(
0
);
this
.
tabAuthStoreLogMapper
.
insertSelective
(
log
);
return
log
.
getId
();
}
...
...
@@ -35,11 +39,16 @@ public class AuthStoreLogServiceImpl implements AuthStoreLogService {
}
@Override
public
int
getCount
(
String
key
,
int
status
)
{
public
int
getCount
(
String
key
,
Integer
status
)
{
List
<
TabAuthStoreLog
>
list
=
this
.
tabAuthStoreLogMapper
.
listLogByKey
(
key
,
status
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
return
list
.
size
();
}
return
0
;
}
@Override
public
List
<
TabAuthStoreLog
>
listFailedStore
(
String
key
)
{
return
this
.
tabAuthStoreLogMapper
.
listFailedStore
(
key
);
}
}
gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreAuthorizationApiServiceImpl.java
View file @
77fdfa07
...
...
@@ -15,6 +15,7 @@ import com.gic.store.constant.StoreOwnTypeEnum;
import
com.gic.store.dto.StoreDTO
;
import
com.gic.store.dto.StoreSearchDTO
;
import
com.gic.store.dto.StoreWidgetDTO
;
import
com.gic.store.entity.TabAuthStoreLog
;
import
com.gic.store.entity.TabStoreGroup
;
import
com.gic.store.service.*
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -66,13 +67,31 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
storeSearchDTO
.
setSearchJson
(
storeWidgetDTO
.
getSearchParam
());
Long
count
=
this
.
storeApiService
.
queryStoreCountFromES
(
storeSearchDTO
).
getResult
();
if
(
count
>
0
){
this
.
queryStoreByPage
(
count
,
storeSearchDTO
,
toEnterpriseId
,
enterpriseId
);
this
.
queryStoreByPage
(
count
,
storeSearchDTO
,
toEnterpriseId
,
enterpriseId
,
null
);
}
else
{
this
.
unionEnterpriseApiService
.
updateStoreAuthorizationStatus
(
AuthorizationStatusEnum
.
SUCCESS
.
getCode
(),
enterpriseId
,
"授权成功"
,
null
);
}
}
}
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Void
>
reAuthStore
(
String
key
)
{
List
<
TabAuthStoreLog
>
list
=
this
.
authStoreLogService
.
listFailedStore
(
key
);
StringBuilder
storeInfoIds
=
new
StringBuilder
();
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
Integer
fromEnterpriseId
=
list
.
get
(
0
).
getFromEnterpriseId
();
Integer
toEnterpriseId
=
list
.
get
(
0
).
getToEnterpriseId
();
for
(
TabAuthStoreLog
log
:
list
){
storeInfoIds
.
append
(
log
.
getStoreInfoId
()).
append
(
","
);
}
StoreSearchDTO
storeSearchDTO
=
new
StoreSearchDTO
();
storeSearchDTO
.
setEnterpriseId
(
toEnterpriseId
);
storeSearchDTO
.
setStoreInfoIds
(
storeInfoIds
.
toString
());
this
.
queryStoreByPage
(
Long
.
valueOf
(
list
.
size
()+
""
),
storeSearchDTO
,
toEnterpriseId
,
fromEnterpriseId
,
key
);
}
return
null
;
}
...
...
@@ -85,7 +104,6 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
Integer
toEnterpriseId
=
json
.
getInteger
(
"toEnterpriseId"
);
Integer
fromEnterpriseId
=
json
.
getInteger
(
"enterpriseId"
);
Integer
isEnd
=
json
.
getInteger
(
"isEnd"
);
int
total
=
json
.
getInteger
(
"total"
);
String
key
=
json
.
getString
(
"key"
);
storeDTO
.
setEnterpriseId
(
toEnterpriseId
);
storeDTO
.
setFromEnterpriseId
(
fromEnterpriseId
);
...
...
@@ -93,6 +111,7 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
this
.
saveStore
(
storeDTO
,
logId
);
if
(
isEnd
==
1
){
int
count
=
this
.
authStoreLogService
.
getCount
(
key
,
2
);
int
total
=
this
.
authStoreLogService
.
getCount
(
key
,
null
);
if
(
count
>
0
){
this
.
unionEnterpriseApiService
.
updateStoreAuthorizationStatus
(
AuthorizationStatusEnum
.
PARTSUCCESS
.
getCode
(),
storeDTO
.
getEnterpriseId
(),
"成功授权"
+(
total
-
count
)+
"条数据,失败"
+
count
+
"条"
,
key
);
...
...
@@ -118,6 +137,8 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
log
.
info
(
"{},门店授权结果:{}"
,
storeDTO
.
getStoreInfoId
(),
i
);
if
(
i
==
0
&&
logId
!=
0
){
this
.
authStoreLogService
.
updateStatus
(
logId
,
2
);
}
else
{
this
.
authStoreLogService
.
updateStatus
(
logId
,
1
);
}
return
ServiceResponse
.
success
();
}
...
...
@@ -135,8 +156,10 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
return
ServiceResponse
.
success
();
}
private
void
queryStoreByPage
(
Long
count
,
StoreSearchDTO
storeSearchDTO
,
Integer
toEnterpriseId
,
Integer
enterpriseId
){
String
key
=
ToolUtil
.
randomUUID
();
private
void
queryStoreByPage
(
Long
count
,
StoreSearchDTO
storeSearchDTO
,
Integer
toEnterpriseId
,
Integer
enterpriseId
,
String
key
){
if
(
StringUtils
.
isBlank
(
key
)){
key
=
ToolUtil
.
randomUUID
();
}
int
pages
=
count
/
pageSize
+
count
%
pageSize
>
0
?
1
:
0
;
Set
<
Integer
>
regionSet
=
new
HashSet
<>();
Set
<
String
>
storeTypeSet
=
new
HashSet
<>();
...
...
gic-store-service/src/main/resources/mapper/TabAuthStoreLogMapper.xml
View file @
77fdfa07
...
...
@@ -110,10 +110,24 @@
where id = #{id,jdbcType=INTEGER}
</update>
<select
id=
"listLogByKey"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_auth_store_log
where key = #{key}
<if
test=
"status != null"
>
and status = #{status}
</if>
</select>
<select
id=
"listFailedStore"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_auth_store_log
where key = #{key}
and status = #{status}
where key = #{key} and (status =0 or status = 2)
</select>
<select
id=
"listLog"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_auth_store_log
where key = #{key} and to_enterprise_id=#{toEnterpriseId} and store_info_id=#{storeInfoId}
</select>
</mapper>
\ 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