Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
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
openSource
apollo
Commits
bc9aa725
Commit
bc9aa725
authored
Jun 07, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix datachange create by
parent
266f4d89
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
ItemSetService.java
...om/ctrip/framework/apollo/biz/service/ItemSetService.java
+4
-3
BeanUtils.java
...va/com/ctrip/framework/apollo/common/utils/BeanUtils.java
+2
-2
PortalServerConfigController.java
...pollo/portal/controller/PortalServerConfigController.java
+4
-2
No files found.
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemSetService.java
View file @
bc9aa725
...
...
@@ -3,6 +3,7 @@ package com.ctrip.framework.apollo.biz.service;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
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.Item
;
...
...
@@ -23,7 +24,7 @@ public class ItemSetService {
@Transactional
public
void
updateSet
(
ItemChangeSets
changeSet
)
{
String
owner
=
changeSet
.
getDataChangeLastModifiedBy
();
if
(
changeSet
.
getCreateItems
()
!=
null
)
{
if
(
!
CollectionUtils
.
isEmpty
(
changeSet
.
getCreateItems
())
)
{
for
(
ItemDTO
item
:
changeSet
.
getCreateItems
())
{
Item
entity
=
BeanUtils
.
transfrom
(
Item
.
class
,
item
);
entity
.
setDataChangeCreatedBy
(
owner
);
...
...
@@ -33,7 +34,7 @@ public class ItemSetService {
auditService
.
audit
(
"ItemSet"
,
null
,
Audit
.
OP
.
INSERT
,
owner
);
}
if
(
changeSet
.
getUpdateItems
()
!=
null
)
{
if
(
!
CollectionUtils
.
isEmpty
(
changeSet
.
getUpdateItems
())
)
{
for
(
ItemDTO
item
:
changeSet
.
getUpdateItems
())
{
Item
entity
=
BeanUtils
.
transfrom
(
Item
.
class
,
item
);
Item
managedItem
=
itemRepository
.
findOne
(
entity
.
getId
());
...
...
@@ -44,7 +45,7 @@ public class ItemSetService {
auditService
.
audit
(
"ItemSet"
,
null
,
Audit
.
OP
.
UPDATE
,
owner
);
}
if
(
changeSet
.
getDeleteItems
()
!=
null
)
{
if
(
!
CollectionUtils
.
isEmpty
(
changeSet
.
getDeleteItems
())
)
{
for
(
ItemDTO
item
:
changeSet
.
getDeleteItems
())
{
Item
entity
=
BeanUtils
.
transfrom
(
Item
.
class
,
item
);
entity
.
setDataChangeLastModifiedBy
(
owner
);
...
...
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java
View file @
bc9aa725
...
...
@@ -218,7 +218,7 @@ public class BeanUtils {
/**
* The copy will ignore <em>BaseEntity</em> field
*
*
* @param source
* @param target
*/
...
...
@@ -226,5 +226,5 @@ public class BeanUtils {
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
View file @
bc9aa725
...
...
@@ -4,6 +4,7 @@ package com.ctrip.framework.apollo.portal.controller;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.core.exception.BadRequestException
;
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.repository.ServerConfigRepository
;
...
...
@@ -21,6 +22,8 @@ public class PortalServerConfigController {
@Autowired
private
ServerConfigRepository
serverConfigRepository
;
@Autowired
private
UserInfoHolder
userInfoHolder
;
@RequestMapping
(
value
=
"/server/config"
,
method
=
RequestMethod
.
POST
)
public
ServerConfig
createOrUpdate
(
@RequestBody
ServerConfig
serverConfig
)
{
...
...
@@ -29,8 +32,7 @@ public class PortalServerConfigController {
throw
new
BadRequestException
(
"request payload contains empty"
);
}
// TODO: 16/6/2 接入sso之后改成当前登录用户
String
modifiedBy
=
"admin"
;
String
modifiedBy
=
userInfoHolder
.
getUser
().
getUsername
();
ServerConfig
storedConfig
=
serverConfigRepository
.
findByKey
(
serverConfig
.
getKey
());
...
...
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