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
276678e5
Commit
276678e5
authored
May 22, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店修改添加逻辑:同步微盟
parent
9d2b3e81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
0 deletions
+88
-0
StoreApiServiceImpl.java
...com/gic/store/service/outer/impl/StoreApiServiceImpl.java
+87
-0
dubbo-gic-store-service.xml
...re-service/src/main/resources/dubbo-gic-store-service.xml
+1
-0
No files found.
gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreApiServiceImpl.java
View file @
276678e5
...
...
@@ -9,10 +9,12 @@ import com.gic.commons.util.*;
import
com.gic.enterprise.dto.CustomStoreDTO
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.dto.EnterpriseLicenseDTO
;
import
com.gic.enterprise.dto.wm.WmStoreSyncLogDTO
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.response.EnterpriseServiceResponse
;
import
com.gic.enterprise.service.CustomStoreApiService
;
import
com.gic.enterprise.service.EnterpriseApiService
;
import
com.gic.enterprise.service.WmStoreSyncLogApiService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.search.business.api.constant.enums.OperateEnum
;
...
...
@@ -27,6 +29,9 @@ import com.gic.store.entity.*;
import
com.gic.store.service.*
;
import
com.gic.store.strategy.BulkUpdateStoreStrtegy
;
import
com.gic.store.utils.field.*
;
import
com.gic.weimob.api.dto.WeimobPhysicalStoreDTO
;
import
com.gic.weimob.api.dto.WeimobStoreAccountDTO
;
import
com.gic.weimob.api.service.WeimobStoreSiteService
;
import
com.google.common.base.Joiner
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -40,6 +45,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -101,6 +107,10 @@ public class StoreApiServiceImpl implements StoreApiService {
private
ClerkApiService
clerkApiService
;
@Autowired
private
StoreTagService
storeTagService
;
@Autowired
private
WeimobStoreSiteService
weimobStoreSiteService
;
@Autowired
private
WmStoreSyncLogApiService
wmStoreSyncLogApiService
;
private
Map
<
String
,
BulkUpdateStoreStrtegy
>
storeStrtegyMap
=
new
ConcurrentHashMap
<>();
...
...
@@ -174,6 +184,9 @@ public class StoreApiServiceImpl implements StoreApiService {
}
catch
(
Exception
e
)
{
logger
.
warn
(
"门店编辑日志记录错误"
,
e
);
}
//修改门店同步到微盟
updateStoreToWm
(
storeDTO
);
}
// 自定义属性
String
error
=
storeExtendService
.
saveOrUpdate
(
storeDTO
.
getEnterpriseId
(),
storeDTO
.
getStoreInfoId
(),
storeDTO
.
getStoreExtendList
());
...
...
@@ -1500,4 +1513,78 @@ public class StoreApiServiceImpl implements StoreApiService {
return
ServiceResponse
.
failure
(
error
.
getCode
(),
error
.
getResultInfo
());
}
private
void
updateStoreToWm
(
StoreDTO
storeDTO
)
{
WeimobPhysicalStoreDTO
weimobPhysicalStoreDTO
=
getWeimobPhsicalStore
(
storeDTO
);
logger
.
info
(
"实体门店拼接后对象为:{}"
,
JSON
.
toJSONString
(
weimobPhysicalStoreDTO
));
if
(
weimobPhysicalStoreDTO
!=
null
)
{
ServiceResponse
<
List
<
WmStoreSyncLogDTO
>>
wmStoreListResult
=
wmStoreSyncLogApiService
.
listByStoreId
(
storeDTO
.
getStoreId
(),
storeDTO
.
getEnterpriseId
());
if
(
wmStoreListResult
.
isSuccess
())
{
List
<
WmStoreSyncLogDTO
>
wmStoreList
=
wmStoreListResult
.
getResult
();
wmStoreList
.
forEach
(
wmStore
->
{
ServiceResponse
<
Void
>
weimobResult
=
this
.
weimobStoreSiteService
.
updateWeimobPhysicalStore
(
wmStore
.
getWmMallStoreId
(),
storeDTO
.
getEnterpriseId
(),
weimobPhysicalStoreDTO
);
logger
.
info
(
"门店修改同步到微盟结果:{},店铺ID:{}"
,
JSON
.
toJSONString
(
weimobResult
),
wmStore
.
getWmMallStoreId
());
});
}
}
}
private
WeimobPhysicalStoreDTO
getWeimobPhsicalStore
(
StoreDTO
storeDTO
)
{
if
(
storeDTO
.
getStatus
().
intValue
()
==
1
)
{
WeimobPhysicalStoreDTO
weimobPhysicalStoreDTO
=
new
WeimobPhysicalStoreDTO
();
//用storeInfoId
weimobPhysicalStoreDTO
.
setStoreInfoId
(
storeDTO
.
getStoreInfoId
());
weimobPhysicalStoreDTO
.
setStoreNumber
(
storeDTO
.
getStoreCode
());
weimobPhysicalStoreDTO
.
setStoreName
(
storeDTO
.
getStoreName
());
//经纬度
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isNotBlank
(
storeDTO
.
getLongitude
()))
{
weimobPhysicalStoreDTO
.
setLongitude
(
new
BigDecimal
(
storeDTO
.
getLongitude
()));
}
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isNotBlank
(
storeDTO
.
getLatitude
()))
{
weimobPhysicalStoreDTO
.
setLatitude
(
new
BigDecimal
(
storeDTO
.
getLatitude
()));
}
//省市区名称
String
fullArea
=
org
.
apache
.
commons
.
lang
.
StringUtils
.
isNotBlank
(
storeDTO
.
getProvinces
())
?
storeDTO
.
getProvinces
().
replaceAll
(
"//"
,
""
)
:
""
;
weimobPhysicalStoreDTO
.
setAddress
(
fullArea
+
storeDTO
.
getAddress
());
StringBuilder
businessTime
=
new
StringBuilder
();
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"HH:mm"
);
List
<
StoreBusinessTimeDTO
>
businessTimeList
=
storeDTO
.
getBusinessTimeList
();
if
(
CollectionUtils
.
isNotEmpty
(
businessTimeList
))
{
businessTimeList
.
stream
().
map
(
e
->
{
String
businessHours
=
simpleDateFormat
.
format
(
e
.
getOpenTime
())
+
"-"
+
simpleDateFormat
.
format
(
e
.
getCloseTime
());
return
e
.
getWeekdayShow
()
+
businessHours
;
}).
forEach
(
businessTime:
:
append
);
}
weimobPhysicalStoreDTO
.
setBussinessHours
(
businessTime
.
toString
());
WeimobStoreAccountDTO
accountDTO
=
new
WeimobStoreAccountDTO
();
ClerkDTO
headClerk
=
getHeadClerk
(
storeDTO
.
getEnterpriseId
(),
storeDTO
.
getStoreId
());
if
(
headClerk
!=
null
)
{
accountDTO
.
setManagerLoginAccount
(
headClerk
.
getPhoneNumber
());
accountDTO
.
setManagerName
(
headClerk
.
getClerkName
());
}
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isNotBlank
(
storeDTO
.
getConactsPhone
()))
{
weimobPhysicalStoreDTO
.
setStoreTel
(
storeDTO
.
getConactsPhone
());
}
else
{
//店长的号码
if
(
headClerk
!=
null
)
{
weimobPhysicalStoreDTO
.
setStoreTel
(
headClerk
.
getPhoneNumber
());
}
}
weimobPhysicalStoreDTO
.
setAccountVo
(
accountDTO
);
return
weimobPhysicalStoreDTO
;
}
return
null
;
}
private
ClerkDTO
getHeadClerk
(
Integer
enterpriseId
,
Integer
storeId
)
{
ServiceResponse
<
ClerkDTO
>
clerkResponse
=
clerkApiService
.
getHeadClerk
(
enterpriseId
,
storeId
);
if
(
clerkResponse
.
isSuccess
())
{
return
clerkResponse
.
getResult
();
}
return
null
;
}
}
gic-store-service/src/main/resources/dubbo-gic-store-service.xml
View file @
276678e5
...
...
@@ -65,4 +65,5 @@
<dubbo:service
interface=
"com.gic.store.service.DictApiService"
ref=
"dictApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.weimob.api.service.WeimobStoreSiteService"
id=
"weimobStoreSiteService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.enterprise.service.WmStoreSyncLogApiService"
id=
"wmStoreSyncLogApiService"
timeout=
"6000"
/>
</beans>
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