Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
0c6d7eba
Commit
0c6d7eba
authored
Nov 13, 2017
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复产品管理bug:467,bug:470
优化并统一覆盖更新处理,防止新联系人列表长度大于现存联系人列表长度时发生索引越界异常
parent
6b715105
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
71 deletions
+79
-71
MotanUserServiceImpl.java
.../xyqb/controller/external/motan/MotanUserServiceImpl.java
+2
-8
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+4
-29
UserCenterController.java
...controller/external/user/center/UserCenterController.java
+5
-30
PageServiceImpl.java
...cn/quantgroup/xyqb/service/page/impl/PageServiceImpl.java
+1
-1
IContactService.java
...java/cn/quantgroup/xyqb/service/user/IContactService.java
+15
-1
ContactServiceImpl.java
...quantgroup/xyqb/service/user/impl/ContactServiceImpl.java
+52
-2
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/motan/MotanUserServiceImpl.java
View file @
0c6d7eba
...
@@ -335,7 +335,7 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -335,7 +335,7 @@ public class MotanUserServiceImpl implements UserMotanService {
@Override
@Override
public
UserSysResult
<
List
<
XContact
>>
findContactsByUserId
(
Long
userId
)
{
public
UserSysResult
<
List
<
XContact
>>
findContactsByUserId
(
Long
userId
)
{
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
userId
);
List
<
Contact
>
contacts
=
contactService
.
trim
(
contactService
.
findByUserId
(
userId
)
);
List
<
XContact
>
xContacts
=
convertObject
(
JSON
.
toJSONString
(
contacts
),
new
TypeReference
<
List
<
XContact
>>()
{
List
<
XContact
>
xContacts
=
convertObject
(
JSON
.
toJSONString
(
contacts
),
new
TypeReference
<
List
<
XContact
>>()
{
});
});
return
returnSuccessValue
(
xContacts
);
return
returnSuccessValue
(
xContacts
);
...
@@ -358,7 +358,6 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -358,7 +358,6 @@ public class MotanUserServiceImpl implements UserMotanService {
log
.
error
(
"联系人列表转换错误"
,
e
);
log
.
error
(
"联系人列表转换错误"
,
e
);
return
returnErrorValue
(
"联系人转换错误"
);
return
returnErrorValue
(
"联系人转换错误"
);
}
}
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
for
(
Contact
c
:
contactList
)
{
for
(
Contact
c
:
contactList
)
{
if
(!
ValidationUtil
.
validatePhoneNo
(
c
.
getPhoneNo
()))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
c
.
getPhoneNo
()))
{
log
.
info
(
"用户手机号错误, phoneNo:{}"
,
c
.
getPhoneNo
());
log
.
info
(
"用户手机号错误, phoneNo:{}"
,
c
.
getPhoneNo
());
...
@@ -368,13 +367,8 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -368,13 +367,8 @@ public class MotanUserServiceImpl implements UserMotanService {
log
.
info
(
"用户姓名错误, name:{}"
,
c
.
getName
());
log
.
info
(
"用户姓名错误, name:{}"
,
c
.
getName
());
return
returnErrorValue
(
"用户姓名错误"
);
return
returnErrorValue
(
"用户姓名错误"
);
}
}
c
.
setId
(
null
);
c
.
setUserId
(
userId
);
c
.
setRelation
(
c
.
getRelation
()
==
null
?
Relation
.
OTHER
:
c
.
getRelation
());
c
.
setCreatedAt
(
now
);
c
.
setUpdateAt
(
now
);
}
}
List
<
Contact
>
result
=
contactService
.
save
(
contactList
);
List
<
Contact
>
result
=
contactService
.
save
(
userId
,
contactList
);
List
<
XContact
>
xResult
=
convertObject
(
JSON
.
toJSONString
(
result
),
new
TypeReference
<
List
<
XContact
>>(){});
List
<
XContact
>
xResult
=
convertObject
(
JSON
.
toJSONString
(
result
),
new
TypeReference
<
List
<
XContact
>>(){});
return
returnSuccessValue
(
xResult
);
return
returnSuccessValue
(
xResult
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
0c6d7eba
...
@@ -362,7 +362,7 @@ public class InnerController implements IBaseController {
...
@@ -362,7 +362,7 @@ public class InnerController implements IBaseController {
if
(
null
==
userId
)
{
if
(
null
==
userId
)
{
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
}
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
userId
);
List
<
Contact
>
contacts
=
contactService
.
trim
(
contactService
.
findByUserId
(
userId
)
);
if
(
null
==
contacts
||
contacts
.
size
()
==
0
)
{
if
(
null
==
contacts
||
contacts
.
size
()
==
0
)
{
return
JsonResult
.
buildErrorStateResult
(
null
,
Collections
.
emptyList
());
return
JsonResult
.
buildErrorStateResult
(
null
,
Collections
.
emptyList
());
}
}
...
@@ -379,14 +379,6 @@ public class InnerController implements IBaseController {
...
@@ -379,14 +379,6 @@ public class InnerController implements IBaseController {
LOGGER
.
info
(
"用户ID不能为空"
);
LOGGER
.
info
(
"用户ID不能为空"
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
}
List
<
Contact
>
userContact
=
contactService
.
findByUserId
(
userId
);
/*
* 推翻之前逻辑,联系人可以更改.如果数据库已有记录.则更改
*
if(userContact != null && userContact.size() >= 2) {
return JsonResult.buildSuccessResult(null, ContactRet.contacts2ContactRets(userContact));
}
*/
List
<
Contact
>
contacts
=
JSONObject
.
parseObject
(
contactsStr
,
new
TypeReference
<
List
<
Contact
>>(){});
List
<
Contact
>
contacts
=
JSONObject
.
parseObject
(
contactsStr
,
new
TypeReference
<
List
<
Contact
>>(){});
if
(
CollectionUtils
.
isEmpty
(
contacts
))
{
if
(
CollectionUtils
.
isEmpty
(
contacts
))
{
LOGGER
.
info
(
"联系人不能空"
);
LOGGER
.
info
(
"联系人不能空"
);
...
@@ -402,14 +394,10 @@ public class InnerController implements IBaseController {
...
@@ -402,14 +394,10 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"null"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"null"
,
null
);
}
}
}
}
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
List
<
Contact
>
result
=
contactService
.
save
(
userId
,
contacts
);
convertContactList
(
userId
,
contacts
,
now
);
List
<
Contact
>
result
=
contactService
.
save
(
contacts
);
return
JsonResult
.
buildSuccessResult
(
null
,
ContactRet
.
contacts2ContactRets
(
result
));
return
JsonResult
.
buildSuccessResult
(
null
,
ContactRet
.
contacts2ContactRets
(
result
));
}
}
@RequestMapping
(
"/contact/update/contact"
)
@RequestMapping
(
"/contact/update/contact"
)
public
JsonResult
updateContact
(
@RequestParam
Long
contactId
,
@RequestParam
(
required
=
false
)
String
name
,
public
JsonResult
updateContact
(
@RequestParam
Long
contactId
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
phoneNo
,
@RequestParam
(
required
=
false
)
String
phoneNo
,
...
@@ -444,19 +432,6 @@ public class InnerController implements IBaseController {
...
@@ -444,19 +432,6 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
"修改联系人成功"
,
contact
);
return
JsonResult
.
buildSuccessResult
(
"修改联系人成功"
,
contact
);
}
}
private
void
convertContactList
(
Long
userId
,
List
<
Contact
>
contacts
,
Timestamp
now
)
{
for
(
Contact
c
:
contacts
)
{
c
.
setId
(
null
);
c
.
setUserId
(
userId
);
c
.
setRelation
(
c
.
getRelation
()
==
null
?
cn
.
quantgroup
.
user
.
enums
.
Relation
.
OTHER
:
c
.
getRelation
());
c
.
setCreatedAt
(
now
);
c
.
setUpdateAt
(
now
);
}
}
@RequestMapping
(
"/address/search/user_id"
)
@RequestMapping
(
"/address/search/user_id"
)
public
JsonResult
findAddressByUserId
(
Long
userId
)
{
public
JsonResult
findAddressByUserId
(
Long
userId
)
{
if
(
userId
==
null
)
{
if
(
userId
==
null
)
{
...
@@ -608,7 +583,7 @@ public class InnerController implements IBaseController {
...
@@ -608,7 +583,7 @@ public class InnerController implements IBaseController {
if
(
null
!=
userDetail
)
{
if
(
null
!=
userDetail
)
{
Address
address
=
addressService
.
findByUserId
(
userDetail
.
getUserId
());
Address
address
=
addressService
.
findByUserId
(
userDetail
.
getUserId
());
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
userDetail
.
getUserId
(
));
List
<
Contact
>
contacts
=
contactService
.
trim
(
contactService
.
findByUserId
(
userDetail
.
getUserId
()
));
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
userDetail
.
getUserId
());
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
userDetail
.
getUserId
());
bean
.
setUserId
(
userDetail
.
getUserId
());
bean
.
setUserId
(
userDetail
.
getUserId
());
bean
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
bean
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
...
@@ -660,7 +635,7 @@ public class InnerController implements IBaseController {
...
@@ -660,7 +635,7 @@ public class InnerController implements IBaseController {
if
(
null
!=
userDetail
)
{
if
(
null
!=
userDetail
)
{
Address
address
=
addressService
.
findByUserId
(
userDetail
.
getUserId
());
Address
address
=
addressService
.
findByUserId
(
userDetail
.
getUserId
());
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
userDetail
.
getUserId
(
));
List
<
Contact
>
contacts
=
contactService
.
trim
(
contactService
.
findByUserId
(
userDetail
.
getUserId
()
));
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
userDetail
.
getUserId
());
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
userDetail
.
getUserId
());
bean
.
setUserId
(
userDetail
.
getUserId
());
bean
.
setUserId
(
userDetail
.
getUserId
());
bean
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
bean
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/user/center/UserCenterController.java
View file @
0c6d7eba
...
@@ -201,7 +201,7 @@ public class UserCenterController {
...
@@ -201,7 +201,7 @@ public class UserCenterController {
return
JsonResult
.
buildErrorStateResult
(
"该用户不存在"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"该用户不存在"
,
null
);
}
}
UserExtInfo
userExtInfo
=
userExtInfoService
.
findByUserId
(
userId
);
UserExtInfo
userExtInfo
=
userExtInfoService
.
findByUserId
(
userId
);
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
userId
);
List
<
Contact
>
contacts
=
contactService
.
trim
(
contactService
.
findByUserId
(
userId
)
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
if
(
null
!=
userExtInfo
)
{
if
(
null
!=
userExtInfo
)
{
result
.
put
(
"contacts"
,
null
!=
contacts
&&
contacts
.
size
()
>
0
?
true
:
false
);
result
.
put
(
"contacts"
,
null
!=
contacts
&&
contacts
.
size
()
>
0
?
true
:
false
);
...
@@ -245,35 +245,10 @@ public class UserCenterController {
...
@@ -245,35 +245,10 @@ public class UserCenterController {
LOGGER
.
error
(
"保存联系人,联系人参数为空.contactJson:{}"
,
contactJson
);
LOGGER
.
error
(
"保存联系人,联系人参数为空.contactJson:{}"
,
contactJson
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
}
List
<
Contact
>
userContact
=
contactService
.
findByUserId
(
userId
);
/*
* 推翻之前逻辑,联系人可以更改.如果数据库已有记录.则更改
*
if(userContact != null && userContact.size() >= 2) {
return JsonResult.buildSuccessResult(null, ContactRet.contacts2ContactRets(userContact));
}
*/
List
<
Contact
>
contacts
=
JSONObject
.
parseObject
(
contactJson
,
new
TypeReference
<
List
<
Contact
>>(){});
List
<
Contact
>
contacts
=
JSONObject
.
parseObject
(
contactJson
,
new
TypeReference
<
List
<
Contact
>>(){});
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
if
(
CollectionUtils
.
isEmpty
(
contacts
))
{
if
(
CollectionUtils
.
isEmpty
(
contacts
))
{
return
JsonResult
.
buildErrorStateResult
(
"参数转换错误"
,
null
);
LOGGER
.
info
(
"联系人不能空"
);
}
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
if
(
null
!=
userContact
&&
userContact
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
contacts
.
size
();
i
++)
{
contacts
.
get
(
i
).
setId
(
userContact
.
get
(
i
).
getId
());
contacts
.
get
(
i
).
setUserId
(
userContact
.
get
(
i
).
getUserId
());
if
(
contacts
.
get
(
i
).
getCreatedAt
()
==
null
)
{
contacts
.
get
(
i
).
setCreatedAt
(
now
);
}
contacts
.
get
(
i
).
setUpdateAt
(
now
);
}
}
else
{
for
(
Contact
c
:
contacts
)
{
c
.
setId
(
null
);
c
.
setUserId
(
userId
);
c
.
setCreatedAt
(
now
);
c
.
setUpdateAt
(
now
);
}
}
}
for
(
Contact
contact
:
contacts
){
for
(
Contact
contact
:
contacts
){
if
(!
ValidationUtil
.
validatePhoneNo
(
contact
.
getPhoneNo
()))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
contact
.
getPhoneNo
()))
{
...
@@ -285,7 +260,7 @@ public class UserCenterController {
...
@@ -285,7 +260,7 @@ public class UserCenterController {
return
JsonResult
.
buildErrorStateResult
(
"null"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"null"
,
null
);
}
}
}
}
List
<
Contact
>
result
=
contactService
.
save
(
contacts
);
List
<
Contact
>
result
=
contactService
.
save
(
userId
,
contacts
);
return
JsonResult
.
buildSuccessResult
(
null
,
result
);
return
JsonResult
.
buildSuccessResult
(
null
,
result
);
}
}
...
@@ -366,7 +341,7 @@ public class UserCenterController {
...
@@ -366,7 +341,7 @@ public class UserCenterController {
LOGGER
.
error
(
"保存联系人,未获取到用户id. userId:{}"
,
userId
);
LOGGER
.
error
(
"保存联系人,未获取到用户id. userId:{}"
,
userId
);
return
JsonResult
.
buildErrorStateResult
(
"该用户不存在"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"该用户不存在"
,
null
);
}
}
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
userId
);
List
<
Contact
>
contacts
=
contactService
.
trim
(
contactService
.
findByUserId
(
userId
)
);
return
JsonResult
.
buildSuccessResult
(
null
,
contacts
);
return
JsonResult
.
buildSuccessResult
(
null
,
contacts
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/service/page/impl/PageServiceImpl.java
View file @
0c6d7eba
...
@@ -55,7 +55,7 @@ public class PageServiceImpl implements IPageService {
...
@@ -55,7 +55,7 @@ public class PageServiceImpl implements IPageService {
private
PageType
pageContacts
=
new
PageType
(
"contacts"
,
false
)
{
private
PageType
pageContacts
=
new
PageType
(
"contacts"
,
false
)
{
@Override
@Override
public
boolean
canPass
(
User
user
)
{
public
boolean
canPass
(
User
user
)
{
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
user
.
getId
(
));
List
<
Contact
>
contacts
=
contactService
.
trim
(
contactService
.
findByUserId
(
user
.
getId
()
));
return
contacts
!=
null
&&
contacts
.
size
()
!=
0
;
return
contacts
!=
null
&&
contacts
.
size
()
!=
0
;
}
}
};
};
...
...
src/main/java/cn/quantgroup/xyqb/service/user/IContactService.java
View file @
0c6d7eba
...
@@ -11,9 +11,23 @@ import java.util.List;
...
@@ -11,9 +11,23 @@ import java.util.List;
public
interface
IContactService
{
public
interface
IContactService
{
List
<
Contact
>
findByUserId
(
Long
userId
);
List
<
Contact
>
findByUserId
(
Long
userId
);
/**
* 清除非法联系人记录
* @param contacts - 包含待清除记录的联系人列表
* @return 只包含合法联系人记录的列表
*/
List
<
Contact
>
trim
(
List
<
Contact
>
contacts
);
Contact
findById
(
Long
id
);
Contact
findById
(
Long
id
);
List
<
Contact
>
save
(
List
<
Contact
>
contacts
);
/**
* 批量保存用户联系人
* 如果已存在联系人,则覆盖更新
* @param userId - 用户主键
* @param contacts - 联系人列表
* @return
*/
List
<
Contact
>
save
(
Long
userId
,
List
<
Contact
>
contacts
);
Contact
save
(
Contact
contact
);
Contact
save
(
Contact
contact
);
Contact
saveContact
(
String
name
,
String
phoneNo
,
Relation
relation
,
Contact
contact
);
Contact
saveContact
(
String
name
,
String
phoneNo
,
Relation
relation
,
Contact
contact
);
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/ContactServiceImpl.java
View file @
0c6d7eba
...
@@ -5,6 +5,7 @@ import cn.quantgroup.xyqb.controller.external.user.InnerController;
...
@@ -5,6 +5,7 @@ import cn.quantgroup.xyqb.controller.external.user.InnerController;
import
cn.quantgroup.xyqb.entity.Contact
;
import
cn.quantgroup.xyqb.entity.Contact
;
import
cn.quantgroup.xyqb.repository.IContactRepository
;
import
cn.quantgroup.xyqb.repository.IContactRepository
;
import
cn.quantgroup.xyqb.service.user.IContactService
;
import
cn.quantgroup.xyqb.service.user.IContactService
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -13,6 +14,7 @@ import org.springframework.cache.annotation.Cacheable;
...
@@ -13,6 +14,7 @@ import org.springframework.cache.annotation.Cacheable;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -30,14 +32,37 @@ public class ContactServiceImpl implements IContactService {
...
@@ -30,14 +32,37 @@ public class ContactServiceImpl implements IContactService {
return
contactRepository
.
findByUserId
(
userId
);
return
contactRepository
.
findByUserId
(
userId
);
}
}
@Override
public
List
<
Contact
>
trim
(
List
<
Contact
>
contacts
){
List
<
Contact
>
trimList
=
new
ArrayList
<
Contact
>();
if
(
contacts
==
null
){
return
trimList
;
}
for
(
Contact
contact
:
contacts
){
if
(!
ValidationUtil
.
validatePhoneNo
(
contact
.
getPhoneNo
()))
{
continue
;
}
if
(!
ValidationUtil
.
validateChinese
(
contact
.
getName
()))
{
continue
;
}
trimList
.
add
(
contact
);
}
return
trimList
;
}
@Override
@Override
public
Contact
findById
(
Long
id
)
{
public
Contact
findById
(
Long
id
)
{
return
contactRepository
.
findOne
(
id
);
return
contactRepository
.
findOne
(
id
);
}
}
@Override
@Override
@CacheEvict
(
value
=
"contact"
,
key
=
"'contact' + #contacts.get(0).userId"
,
cacheManager
=
"cacheManager"
)
@CacheEvict
(
value
=
"contact"
,
key
=
"'contact' + #userId"
,
cacheManager
=
"cacheManager"
)
public
List
<
Contact
>
save
(
List
<
Contact
>
contacts
)
{
public
List
<
Contact
>
save
(
Long
userId
,
List
<
Contact
>
contacts
)
{
if
(
userId
==
null
){
return
null
;
}
// 合并当前用户列表到更新列表
mergeContacts
(
userId
,
contacts
);
return
contactRepository
.
save
(
contacts
);
return
contactRepository
.
save
(
contacts
);
}
}
...
@@ -64,4 +89,29 @@ public class ContactServiceImpl implements IContactService {
...
@@ -64,4 +89,29 @@ public class ContactServiceImpl implements IContactService {
contact
=
save
(
contact
);
contact
=
save
(
contact
);
return
contact
;
return
contact
;
}
}
/**
* 合并当前用户列表到更新列表
* @param userId - 用户主键
* @param contacts - 新联系人列表
*/
private
void
mergeContacts
(
Long
userId
,
List
<
Contact
>
contacts
)
{
// 当前联系人列表
List
<
Contact
>
userContact
=
contactRepository
.
findByUserId
(
userId
);
int
userContactCount
=
(
userContact
==
null
)
?
0
:
userContact
.
size
();
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
for
(
int
i
=
0
;
i
<
contacts
.
size
();
i
++)
{
Contact
c
=
contacts
.
get
(
i
);
c
.
setId
(
null
);
c
.
setUserId
(
userId
);
c
.
setRelation
(
c
.
getRelation
()
==
null
?
Relation
.
OTHER
:
c
.
getRelation
());
c
.
setCreatedAt
(
now
);
c
.
setUpdateAt
(
now
);
if
(
userContactCount
>
i
){
c
.
setId
(
userContact
.
get
(
i
).
getId
());
c
.
setCreatedAt
(
contacts
.
get
(
i
).
getCreatedAt
()
==
null
?
now
:
contacts
.
get
(
i
).
getCreatedAt
());
c
.
setRelation
(
contacts
.
get
(
i
).
getRelation
()
==
null
?
Relation
.
OTHER
:
contacts
.
get
(
i
).
getRelation
());
}
}
}
}
}
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