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
c38f42ff
Commit
c38f42ff
authored
Jul 09, 2019
by
陶光胜
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://115.159.76.241/base_platform_enterprise/gic-store
into developer
parents
96547de4
b08a6f35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
StoreApiServiceImpl.java
...java/com/gic/store/service/outer/StoreApiServiceImpl.java
+13
-0
StoreBrandApiServiceImpl.java
...com/gic/store/service/outer/StoreBrandApiServiceImpl.java
+48
-0
No files found.
gic-store-service/src/main/java/com/gic/store/service/outer/StoreApiServiceImpl.java
View file @
c38f42ff
...
...
@@ -5,6 +5,8 @@ import com.gic.api.base.commons.Page;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.log.api.dto.SystemSetLogDTO
;
import
com.gic.log.api.service.LogApiService
;
import
com.gic.store.constant.StoreEnableOrDisAbleEnum
;
import
com.gic.store.constant.StoreFieldTypeEnum
;
import
com.gic.store.constant.StoreGroupConstant
;
...
...
@@ -22,6 +24,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -53,6 +56,8 @@ public class StoreApiServiceImpl implements StoreApiService {
private
StoreStrategyService
storeStrategyService
;
@Autowired
private
StoreFieldSelectService
storeFieldSelectService
;
@Autowired
private
LogApiService
logApiService
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -94,6 +99,14 @@ public class StoreApiServiceImpl implements StoreApiService {
delBusinessTimes
=
delBusinessTimeIds
.
stream
().
map
(
Integer:
:
parseInt
).
collect
(
Collectors
.
toList
());
}
storeBusinessTimeService
.
editStoreBusinessTime
(
storeDTO
.
getEnterpriseId
(),
storeDTO
.
getStoreId
(),
storeDTO
.
getBusinessTimeList
(),
delBusinessTimes
);
// 写日志
SystemSetLogDTO
systemSetLogDTO
=
new
SystemSetLogDTO
();
systemSetLogDTO
.
setEnterpriesId
(
storeDTO
.
getEnterpriseId
()
+
""
);
systemSetLogDTO
.
setLogTime
(
new
Date
());
systemSetLogDTO
.
setInterfaceName
(
"com.gic.store.service.StoreApiService.saveOrUpdate"
);
systemSetLogDTO
.
setContent
(
"门店信息变更"
);
systemSetLogDTO
.
setRelationId
(
storeDTO
.
getStoreId
().
longValue
());
logApiService
.
saveSystemSetLog
(
systemSetLogDTO
);
return
ServiceResponse
.
success
();
}
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/StoreBrandApiServiceImpl.java
View file @
c38f42ff
...
...
@@ -5,6 +5,8 @@ import com.gic.api.base.commons.ServiceResponse;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GlobalInfo
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.log.api.dto.SystemSetLogDTO
;
import
com.gic.log.api.service.LogApiService
;
import
com.gic.store.dto.StoreBrandDTO
;
import
com.gic.store.entity.TabStoreBrand
;
import
com.gic.store.service.StoreBrandApiService
;
...
...
@@ -16,10 +18,15 @@ import org.apache.commons.collections.CollectionUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.BeanWrapper
;
import
org.springframework.beans.BeanWrapperImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.beans.PropertyDescriptor
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
...
...
@@ -40,8 +47,18 @@ public class StoreBrandApiServiceImpl implements StoreBrandApiService {
@Autowired
private
StoreService
storeService
;
@Autowired
private
LogApiService
logApiService
;
@Override
public
ServiceResponse
<
Integer
>
saveOrUpdateStoreBrand
(
StoreBrandDTO
storeBrandDTO
)
{
// 日志
SystemSetLogDTO
systemSetLogDTO
=
new
SystemSetLogDTO
();
systemSetLogDTO
.
setEnterpriesId
(
storeBrandDTO
.
getEnterpriseId
()
+
""
);
systemSetLogDTO
.
setLogTime
(
new
Date
());
systemSetLogDTO
.
setInterfaceName
(
"com.gic.store.service.StoreBrandApiService.saveOrUpdateStoreBrand"
);
Integer
storeBrandId
;
int
brandCodeCount
=
storeBrandService
.
countByStoreBrandCode
(
storeBrandDTO
.
getEnterpriseId
(),
storeBrandDTO
.
getStoreBrandCode
(),
storeBrandDTO
.
getStoreBrandId
());
if
(
brandCodeCount
>
0
)
{
...
...
@@ -54,15 +71,22 @@ public class StoreBrandApiServiceImpl implements StoreBrandApiService {
if
(
storeBrandDTO
.
getStoreBrandId
()
==
null
)
{
// 新增
storeBrandId
=
storeBrandService
.
save
(
storeBrandDTO
);
systemSetLogDTO
.
setContent
(
"新增品牌, 品牌名:"
+
storeBrandDTO
.
getStoreBrandName
());
}
else
{
// 编辑
storeBrandId
=
storeBrandDTO
.
getStoreBrandId
();
// TabStoreBrand storeBrand = storeBrandService.getBrandById(storeBrandId);
Integer
updateLine
=
storeBrandService
.
update
(
storeBrandDTO
);
if
(
updateLine
==
0
)
{
logger
.
warn
(
"[storeBrandId ==> {}] 不存在"
,
storeBrandDTO
.
getStoreBrandId
());
return
ServiceResponse
.
failure
(
ErrorCode
.
ERR_2
.
getCode
(),
"没找到要编辑的门店品牌"
);
}
}
// 写日志
systemSetLogDTO
.
setContent
(
"门店信息变更"
);
logApiService
.
saveSystemSetLog
(
systemSetLogDTO
);
return
ServiceResponse
.
success
(
storeBrandId
);
}
...
...
@@ -141,4 +165,28 @@ public class StoreBrandApiServiceImpl implements StoreBrandApiService {
return
ServiceResponse
.
success
();
}
public
static
void
main
(
String
[]
args
)
{
// todo 判断修改字段
HashMap
<
String
,
Object
>
propertyMap
=
new
HashMap
<>();
propertyMap
.
put
(
"storeBrandName"
,
"品牌名"
);
propertyMap
.
put
(
"storeBrandCode"
,
"品牌code"
);
StoreBrandDTO
oldDTO
=
new
StoreBrandDTO
();
oldDTO
.
setStoreBrandName
(
"123"
);
oldDTO
.
setStoreBrandCode
(
"444"
);
StoreBrandDTO
newDTO
=
new
StoreBrandDTO
();
newDTO
.
setStoreBrandName
(
"456"
);
newDTO
.
setStoreBrandName
(
"444"
);
final
BeanWrapper
oldDTOBean
=
new
BeanWrapperImpl
(
oldDTO
);
final
BeanWrapper
newDTOBean
=
new
BeanWrapperImpl
(
newDTO
);
PropertyDescriptor
[]
pds
=
oldDTOBean
.
getPropertyDescriptors
();
for
(
PropertyDescriptor
pd
:
pds
)
{
Object
oldValue
=
oldDTOBean
.
getPropertyValue
(
pd
.
getName
());
Object
newValue
=
newDTOBean
.
getPropertyValue
(
pd
.
getName
());
if
(
oldValue
!=
null
&&
newValue
!=
null
&&
!
oldValue
.
equals
(
newValue
))
{
System
.
out
.
println
(
propertyMap
.
get
(
pd
.
getName
())
+
" 从 "
+
oldValue
+
" 修改为 "
+
newValue
);
}
}
}
}
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