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
2a35f606
Commit
2a35f606
authored
Nov 08, 2017
by
Java—红包—徐 然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改迁移逻辑
parent
af3fced3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
18 deletions
+32
-18
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+8
-16
IContactService.java
...java/cn/quantgroup/xyqb/service/user/IContactService.java
+3
-0
ContactServiceImpl.java
...quantgroup/xyqb/service/user/impl/ContactServiceImpl.java
+21
-2
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
2a35f606
...
...
@@ -405,6 +405,8 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
null
,
ContactRet
.
contacts2ContactRets
(
result
));
}
@RequestMapping
(
"/contact/update/contact"
)
public
JsonResult
updateContact
(
@RequestParam
Long
contactId
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
phoneNo
,
...
...
@@ -414,10 +416,7 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"参数不合法"
,
null
);
}
Contact
contact
=
contactService
.
findById
(
contactId
);
if
(
null
==
contact
)
{
return
JsonResult
.
buildErrorStateResult
(
"修改联系人不存在"
,
null
);
}
if
(
StringUtils
.
isEmpty
(
name
)
&&
StringUtils
.
isEmpty
(
phoneNo
)
){
return
JsonResult
.
buildErrorStateResult
(
"修改联系人修改条件不能都为空"
,
null
);
}
...
...
@@ -430,19 +429,11 @@ public class InnerController implements IBaseController {
if
(
StringUtils
.
isEmpty
(
reason
)){
return
JsonResult
.
buildErrorStateResult
(
"修改原因不能为空"
,
null
);
}
if
(
null
!=
name
)
{
contact
.
setName
(
name
);
}
if
(
null
!=
phoneNo
)
{
contact
.
setPhoneNo
(
phoneNo
);
}
if
(
null
!=
relation
)
{
contact
.
setRelation
(
relation
);
Contact
contact
=
contactService
.
findById
(
contactId
);
if
(
null
==
contact
)
{
return
JsonResult
.
buildErrorStateResult
(
"修改联系人不存在"
,
null
);
}
LOGGER
.
info
(
"修改前联系人信息:{}"
,
contact
);
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
contact
.
setUpdateAt
(
now
);
contact
=
contactService
.
save
(
contact
);
contact
=
contactService
.
saveContact
(
name
,
phoneNo
,
relation
,
contact
);
String
ip
=
IPUtil
.
getRemoteIP
(
request
);
LOGGER
.
info
(
"修改后联系人信息:{},修改原因:{},操作ip:{}"
,
contact
,
reason
,
ip
);
...
...
@@ -451,6 +442,7 @@ public class InnerController implements IBaseController {
private
void
convertContactList
(
Long
userId
,
List
<
Contact
>
contacts
,
Timestamp
now
)
{
for
(
Contact
c
:
contacts
)
{
c
.
setId
(
null
);
...
...
src/main/java/cn/quantgroup/xyqb/service/user/IContactService.java
View file @
2a35f606
package
cn
.
quantgroup
.
xyqb
.
service
.
user
;
import
cn.quantgroup.user.enums.Relation
;
import
cn.quantgroup.xyqb.entity.Contact
;
import
java.util.List
;
...
...
@@ -14,4 +15,6 @@ public interface IContactService {
List
<
Contact
>
save
(
List
<
Contact
>
contacts
);
Contact
save
(
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 @
2a35f606
package
cn
.
quantgroup
.
xyqb
.
service
.
user
.
impl
;
import
cn.quantgroup.user.enums.Relation
;
import
cn.quantgroup.xyqb.controller.external.user.InnerController
;
import
cn.quantgroup.xyqb.entity.Contact
;
import
cn.quantgroup.xyqb.repository.IContactRepository
;
import
cn.quantgroup.xyqb.service.user.IContactService
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
java.sql.Timestamp
;
import
java.util.List
;
/**
...
...
@@ -15,7 +19,7 @@ import java.util.List;
*/
@Service
public
class
ContactServiceImpl
implements
IContactService
{
private
static
final
org
.
slf4j
.
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ContactServiceImpl
.
class
);
@Autowired
private
IContactRepository
contactRepository
;
...
...
@@ -42,5 +46,20 @@ public class ContactServiceImpl implements IContactService {
return
contactRepository
.
save
(
contact
);
}
public
Contact
saveContact
(
String
name
,
String
phoneNo
,
Relation
relation
,
Contact
contact
)
{
if
(
null
!=
name
)
{
contact
.
setName
(
name
);
}
if
(
null
!=
phoneNo
)
{
contact
.
setPhoneNo
(
phoneNo
);
}
if
(
null
!=
relation
)
{
contact
.
setRelation
(
relation
);
}
LOGGER
.
info
(
"修改前联系人信息:{}"
,
contact
);
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
contact
.
setUpdateAt
(
now
);
contact
=
save
(
contact
);
return
contact
;
}
}
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