Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wrr-cat
apollo
提交
bc9aa725
apollo
项目概览
wrr-cat
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bc9aa725
编写于
6月 07, 2016
作者:
L
lepdou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix datachange create by
上级
266f4d89
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
7 deletion
+10
-7
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemSetService.java
...om/ctrip/framework/apollo/biz/service/ItemSetService.java
+4
-3
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java
...va/com/ctrip/framework/apollo/common/utils/BeanUtils.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalServerConfigController.java
...pollo/portal/controller/PortalServerConfigController.java
+4
-2
未找到文件。
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemSetService.java
浏览文件 @
bc9aa725
...
@@ -3,6 +3,7 @@ package com.ctrip.framework.apollo.biz.service;
...
@@ -3,6 +3,7 @@ package com.ctrip.framework.apollo.biz.service;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
com.ctrip.framework.apollo.biz.entity.Audit
;
import
com.ctrip.framework.apollo.biz.entity.Audit
;
import
com.ctrip.framework.apollo.biz.entity.Item
;
import
com.ctrip.framework.apollo.biz.entity.Item
;
...
@@ -23,7 +24,7 @@ public class ItemSetService {
...
@@ -23,7 +24,7 @@ public class ItemSetService {
@Transactional
@Transactional
public
void
updateSet
(
ItemChangeSets
changeSet
)
{
public
void
updateSet
(
ItemChangeSets
changeSet
)
{
String
owner
=
changeSet
.
getDataChangeLastModifiedBy
();
String
owner
=
changeSet
.
getDataChangeLastModifiedBy
();
if
(
changeSet
.
getCreateItems
()
!=
null
)
{
if
(
!
CollectionUtils
.
isEmpty
(
changeSet
.
getCreateItems
())
)
{
for
(
ItemDTO
item
:
changeSet
.
getCreateItems
())
{
for
(
ItemDTO
item
:
changeSet
.
getCreateItems
())
{
Item
entity
=
BeanUtils
.
transfrom
(
Item
.
class
,
item
);
Item
entity
=
BeanUtils
.
transfrom
(
Item
.
class
,
item
);
entity
.
setDataChangeCreatedBy
(
owner
);
entity
.
setDataChangeCreatedBy
(
owner
);
...
@@ -33,7 +34,7 @@ public class ItemSetService {
...
@@ -33,7 +34,7 @@ public class ItemSetService {
auditService
.
audit
(
"ItemSet"
,
null
,
Audit
.
OP
.
INSERT
,
owner
);
auditService
.
audit
(
"ItemSet"
,
null
,
Audit
.
OP
.
INSERT
,
owner
);
}
}
if
(
changeSet
.
getUpdateItems
()
!=
null
)
{
if
(
!
CollectionUtils
.
isEmpty
(
changeSet
.
getUpdateItems
())
)
{
for
(
ItemDTO
item
:
changeSet
.
getUpdateItems
())
{
for
(
ItemDTO
item
:
changeSet
.
getUpdateItems
())
{
Item
entity
=
BeanUtils
.
transfrom
(
Item
.
class
,
item
);
Item
entity
=
BeanUtils
.
transfrom
(
Item
.
class
,
item
);
Item
managedItem
=
itemRepository
.
findOne
(
entity
.
getId
());
Item
managedItem
=
itemRepository
.
findOne
(
entity
.
getId
());
...
@@ -44,7 +45,7 @@ public class ItemSetService {
...
@@ -44,7 +45,7 @@ public class ItemSetService {
auditService
.
audit
(
"ItemSet"
,
null
,
Audit
.
OP
.
UPDATE
,
owner
);
auditService
.
audit
(
"ItemSet"
,
null
,
Audit
.
OP
.
UPDATE
,
owner
);
}
}
if
(
changeSet
.
getDeleteItems
()
!=
null
)
{
if
(
!
CollectionUtils
.
isEmpty
(
changeSet
.
getDeleteItems
())
)
{
for
(
ItemDTO
item
:
changeSet
.
getDeleteItems
())
{
for
(
ItemDTO
item
:
changeSet
.
getDeleteItems
())
{
Item
entity
=
BeanUtils
.
transfrom
(
Item
.
class
,
item
);
Item
entity
=
BeanUtils
.
transfrom
(
Item
.
class
,
item
);
entity
.
setDataChangeLastModifiedBy
(
owner
);
entity
.
setDataChangeLastModifiedBy
(
owner
);
...
...
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java
浏览文件 @
bc9aa725
...
@@ -218,7 +218,7 @@ public class BeanUtils {
...
@@ -218,7 +218,7 @@ public class BeanUtils {
/**
/**
* The copy will ignore <em>BaseEntity</em> field
* The copy will ignore <em>BaseEntity</em> field
*
*
* @param source
* @param source
* @param target
* @param target
*/
*/
...
@@ -226,5 +226,5 @@ public class BeanUtils {
...
@@ -226,5 +226,5 @@ public class BeanUtils {
org
.
springframework
.
beans
.
BeanUtils
.
copyProperties
(
source
,
target
,
COPY_IGNORED_PROPERTIES
);
org
.
springframework
.
beans
.
BeanUtils
.
copyProperties
(
source
,
target
,
COPY_IGNORED_PROPERTIES
);
}
}
private
static
final
String
[]
COPY_IGNORED_PROPERTIES
=
{
"id"
,
"dataChangeCreatedTime"
,
"dataChangeLastModifiedTime"
};
private
static
final
String
[]
COPY_IGNORED_PROPERTIES
=
{
"id"
,
"dataChangeCreated
By"
,
"dataChangeCreated
Time"
,
"dataChangeLastModifiedTime"
};
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalServerConfigController.java
浏览文件 @
bc9aa725
...
@@ -4,6 +4,7 @@ package com.ctrip.framework.apollo.portal.controller;
...
@@ -4,6 +4,7 @@ package com.ctrip.framework.apollo.portal.controller;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.core.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.entity.po.ServerConfig
;
import
com.ctrip.framework.apollo.portal.entity.po.ServerConfig
;
import
com.ctrip.framework.apollo.portal.repository.ServerConfigRepository
;
import
com.ctrip.framework.apollo.portal.repository.ServerConfigRepository
;
...
@@ -21,6 +22,8 @@ public class PortalServerConfigController {
...
@@ -21,6 +22,8 @@ public class PortalServerConfigController {
@Autowired
@Autowired
private
ServerConfigRepository
serverConfigRepository
;
private
ServerConfigRepository
serverConfigRepository
;
@Autowired
private
UserInfoHolder
userInfoHolder
;
@RequestMapping
(
value
=
"/server/config"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/server/config"
,
method
=
RequestMethod
.
POST
)
public
ServerConfig
createOrUpdate
(
@RequestBody
ServerConfig
serverConfig
)
{
public
ServerConfig
createOrUpdate
(
@RequestBody
ServerConfig
serverConfig
)
{
...
@@ -29,8 +32,7 @@ public class PortalServerConfigController {
...
@@ -29,8 +32,7 @@ public class PortalServerConfigController {
throw
new
BadRequestException
(
"request payload contains empty"
);
throw
new
BadRequestException
(
"request payload contains empty"
);
}
}
// TODO: 16/6/2 接入sso之后改成当前登录用户
String
modifiedBy
=
userInfoHolder
.
getUser
().
getUsername
();
String
modifiedBy
=
"admin"
;
ServerConfig
storedConfig
=
serverConfigRepository
.
findByKey
(
serverConfig
.
getKey
());
ServerConfig
storedConfig
=
serverConfigRepository
.
findByKey
(
serverConfig
.
getKey
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录