Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
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-platform-auth
Commits
ad052f2e
Commit
ad052f2e
authored
Jul 17, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报名修改
parent
876e2c03
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
189 deletions
+2
-189
LogUtils.java
...vice/src/main/java/com/gic/enterprise/utils/LogUtils.java
+0
-73
PropertyNameMap.java
...c/main/java/com/gic/enterprise/utils/PropertyNameMap.java
+0
-44
LogAspect.java
...src/main/java/com/gic/enterprise/utils/log/LogAspect.java
+0
-66
jdbc-gic-platform-auth-service.xml
...ice/src/main/resources/jdbc-gic-platform-auth-service.xml
+2
-6
No files found.
gic-platform-auth-service/src/main/java/com/gic/enterprise/utils/LogUtils.java
deleted
100644 → 0
View file @
876e2c03
package
com
.
gic
.
enterprise
.
utils
;
import
com.gic.log.api.dto.SystemSetLogDTO
;
import
com.gic.log.api.service.LogApiService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanWrapper
;
import
org.springframework.beans.BeanWrapperImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.beans.PropertyDescriptor
;
import
java.util.Date
;
/**
* @author zhiwj
* @date 2019/7/10
*/
@Component
public
class
LogUtils
{
private
static
LogApiService
logApiService
;
public
static
<
T
>
void
saveAddLog
(
T
obj
)
{
saveLog
(
obj
,
1
);
}
public
static
<
T
>
void
saveUpdateLog
(
T
obj
)
{
saveLog
(
obj
,
2
);
}
@Autowired
public
void
setLogApiService
(
LogApiService
logApiService
)
{
LogUtils
.
logApiService
=
logApiService
;
}
public
static
<
T
>
void
saveLog
(
T
obj
,
Integer
type
)
{
// 日志
SystemSetLogDTO
systemSetLogDTO
=
new
SystemSetLogDTO
();
// systemSetLogDTO.setEnterpriesId(storeBrandDTO.getEnterpriseId() + "");
systemSetLogDTO
.
setLogTime
(
new
Date
());
// systemSetLogDTO.setInterfaceName("com.gic.store.service.StoreBrandApiService.saveOrUpdateStoreBrand");
StringBuilder
content
=
new
StringBuilder
();
getContent
(
obj
,
type
,
content
);
systemSetLogDTO
.
setContent
(
content
.
toString
());
// System.out.println(systemSetLogDTO.getContent());
logApiService
.
saveSystemSetLog
(
systemSetLogDTO
);
}
private
static
<
T
>
void
getContent
(
T
obj
,
Integer
type
,
StringBuilder
content
)
{
final
BeanWrapper
dtoBean
=
new
BeanWrapperImpl
(
obj
);
PropertyDescriptor
[]
pds
=
dtoBean
.
getPropertyDescriptors
();
for
(
PropertyDescriptor
pd
:
pds
)
{
String
name
=
PropertyNameMap
.
get
(
pd
.
getName
());
if
(
StringUtils
.
isNotBlank
(
name
))
{
Object
value
=
dtoBean
.
getPropertyValue
(
pd
.
getName
());
if
(
value
!=
null
)
{
if
(
value
instanceof
Iterable
)
{
for
(
Object
o
:
(
Iterable
)
value
)
{
getContent
(
o
,
type
,
content
);
}
}
else
{
if
(
type
==
1
)
{
content
.
append
(
name
).
append
(
" 新增 "
).
append
(
value
).
append
(
"<br/>"
);
}
else
if
(
type
==
2
)
{
content
.
append
(
name
).
append
(
" 修改为 "
).
append
(
value
).
append
(
"<br/>"
);
}
}
}
}
}
}
}
gic-platform-auth-service/src/main/java/com/gic/enterprise/utils/PropertyNameMap.java
deleted
100644 → 0
View file @
876e2c03
package
com
.
gic
.
enterprise
.
utils
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author zhiwj
* @date 2019/7/11
*/
public
class
PropertyNameMap
{
/**
* 暂时放这里测试下, 以后移到enterprise_base_api里去
*/
private
static
final
Map
<
String
,
String
>
map
=
new
HashMap
<>();
static
{
map
.
put
(
"regionName"
,
"门店域名称"
);
map
.
put
(
"regionCode"
,
"门店域code"
);
map
.
put
(
"storeBrandCode"
,
"品牌code"
);
map
.
put
(
"storeBrandName"
,
"品牌名称"
);
map
.
put
(
"storeBrandCategory"
,
"经营类目"
);
map
.
put
(
"storeSupport"
,
"门店适用"
);
map
.
put
(
"goodsSupport"
,
"商品适用"
);
map
.
put
(
"storeName"
,
"门店名称"
);
map
.
put
(
"conactsPhone"
,
"门店电话"
);
map
.
put
(
"address"
,
"门店详细地址"
);
map
.
put
(
"brandIds"
,
"关联门店品牌id,多个用逗号分隔"
);
map
.
put
(
"longitude"
,
"经度"
);
map
.
put
(
"latitude"
,
"纬度"
);
// map.put("status", "门店启用状态");
map
.
put
(
"erpStatus"
,
"erp门店状态"
);
map
.
put
(
"storeType"
,
"门店类型"
);
map
.
put
(
"weekday"
,
"营业时间"
);
map
.
put
(
"businessTimeList"
,
"营业时间"
);
}
private
PropertyNameMap
()
{
}
public
static
String
get
(
String
name
)
{
return
map
.
get
(
name
);
}
}
gic-platform-auth-service/src/main/java/com/gic/enterprise/utils/log/LogAspect.java
deleted
100644 → 0
View file @
876e2c03
package
com
.
gic
.
enterprise
.
utils
.
log
;
import
com.gic.enterprise.utils.LogUtils
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.AfterReturning
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author guojx
* @date 2019/7/12 10:26 AM
*/
@Aspect
public
class
LogAspect
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
LogAspect
.
class
);
@Pointcut
(
"execution(* com.gic.enterprise.service.outer.*.save*(..))"
)
public
void
saveCell
()
{
}
@Pointcut
(
"execution(public * com.gic.enterprise.service.outer.*.edit*(..))"
)
public
void
updateCell
()
{
}
@Pointcut
(
"execution(* com.gic.enterprise.service.outer.*.delete*(..))"
)
public
void
deleteCell
()
{
}
@AfterReturning
(
value
=
"saveCell()"
,
argNames
=
"joinPoint,object"
,
returning
=
"object"
)
public
void
saveLog
(
JoinPoint
joinPoint
,
Object
object
)
{
if
(
joinPoint
.
getArgs
()
==
null
)
{
return
;
}
String
methodName
=
joinPoint
.
getSignature
().
getName
();
String
operContent
=
""
;
logger
.
info
(
"aspectLog:{}"
,
joinPoint
.
getArgs
());
LogUtils
.
saveAddLog
(
arrToList
(
joinPoint
.
getArgs
()));
}
@AfterReturning
(
value
=
"updateCell()"
,
argNames
=
"joinPoint,object"
,
returning
=
"object"
)
public
void
updateLog
(
JoinPoint
joinPoint
,
Object
object
)
{
if
(
joinPoint
.
getArgs
()
==
null
)
{
return
;
}
String
methodName
=
joinPoint
.
getSignature
().
getName
();
String
operContent
=
""
;
logger
.
info
(
"aspectLog:{}"
,
joinPoint
.
getArgs
());
LogUtils
.
saveUpdateLog
(
arrToList
(
joinPoint
.
getArgs
()));
}
private
List
<
Object
>
arrToList
(
Object
[]
args
)
{
List
<
Object
>
resultList
=
new
ArrayList
<>(
args
.
length
);
for
(
Object
obj
:
args
)
{
resultList
.
add
(
obj
);
}
return
resultList
;
}
}
gic-platform-auth-service/src/main/resources/jdbc-gic-platform-auth-service.xml
View file @
ad052f2e
...
...
@@ -19,10 +19,6 @@
<context:annotation-config/>
<!-- 启动对@AspectJ注解的支持 -->
<aop:aspectj-autoproxy
/>
<bean
class=
"com.gic.store.utils.log.LogAspect"
></bean>
<!--<apollo:config namespaces="COMMON.sharding,COMMON.4.0-jdbc"/>-->
<!--<bean id="dataSource" class="com.gic.sharding.sdk.ShardingDatasource" init-method="init">-->
...
...
@@ -35,7 +31,7 @@
<bean
class=
"org.mybatis.spring.SqlSessionFactoryBean"
id=
"sqlSessionFactory"
>
<property
name=
"dataSource"
ref=
"dataSource"
/>
<property
name=
"typeAliasesPackage"
value=
"com.gic.
auth
.**.entity"
/>
<property
name=
"typeAliasesPackage"
value=
"com.gic.
enterprise
.**.entity"
/>
<property
name=
"mapperLocations"
value=
"classpath*:mapper/*.xml"
/>
<property
name=
"plugins"
>
<array>
...
...
@@ -53,7 +49,7 @@
</property>
</bean>
<bean
class=
"org.mybatis.spring.mapper.MapperScannerConfigurer"
>
<property
name=
"basePackage"
value=
"com.gic.
auth
.**.dao.mapper"
/>
<property
name=
"basePackage"
value=
"com.gic.
enterprise
.**.dao.mapper"
/>
<property
name=
"sqlSessionFactoryBeanName"
value=
"sqlSessionFactory"
/>
</bean>
<bean
class=
"org.springframework.jdbc.datasource.DataSourceTransactionManager"
>
...
...
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