Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
service-campaign
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyen Ha
service-campaign
Commits
9d63d53e
Commit
9d63d53e
authored
Aug 26, 2019
by
Đào Nhật Quang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quangdn
parent
d4565414
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
28 deletions
+36
-28
src/main/java/com/viettel/campaign/service/CustomerService.java
...in/java/com/viettel/campaign/service/CustomerService.java
+2
-0
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+26
-23
src/main/java/com/viettel/campaign/web/rest/CustomerController.java
...ava/com/viettel/campaign/web/rest/CustomerController.java
+8
-5
No files found.
src/main/java/com/viettel/campaign/service/CustomerService.java
View file @
9d63d53e
...
...
@@ -34,6 +34,8 @@ public interface CustomerService {
ResultDTO
getAllCustomerList
(
int
page
,
int
pageSize
,
String
sort
,
Long
companySiteId
);
// THÍM NÀO MERGE CONFLICT THÌ GIỮ LẠI HỘ E CÁI METHOD NÀY VỚI
// VIẾT ĐI VIẾT LẠI 4 LẦN RỒI ĐẤY
ResultDTO
createCustomerList
(
CustomerListDTO
customerListDTO
,
String
userName
);
ResultDTO
updateCustomerList
(
CustomerListDTO
customerListDTO
);
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
9d63d53e
...
...
@@ -600,35 +600,38 @@ public class CustomerServiceImpl implements CustomerService {
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
createCustomerList
(
CustomerListDTO
customerListDTO
,
String
userName
)
{
// THÍM NÀO MERGE CONFLICT THÌ GIỮ LẠI HỘ E CÁI METHOD NÀY VỚI
// VIẾT ĐI VIẾT LẠI 4 LẦN RỒI ĐẤY
ResultDTO
resultDTO
=
new
ResultDTO
();
CustomerListMapper
customerListMapper
=
new
CustomerListMapper
();
CustomerList
customerList
=
new
CustomerList
();
try
{
if
(
customerListDTO
!=
null
)
{
// insert
CustomerList
findCustomer
=
customerListRepository
.
findByCustomerListCode
(
customerListDTO
.
getCustomerListCode
());
if
(
findCustomer
==
null
)
{
customerListDTO
.
setCreateBy
(
userName
);
customerList
=
customerListMapper
.
toPersistenceBean
(
customerListDTO
);
customerListRepository
.
save
(
customerList
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
}
}
else
{
CustomerList
cl
=
customerListRepository
.
findByCustomerListCode
(
customerListDTO
.
getCustomerListCode
());
if
(
cl
!=
null
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
resultDTO
.
setDescription
(
"Entity exists"
);
return
resultDTO
;
}
else
{
cl
=
new
CustomerList
();
cl
.
setCustomerListCode
(
customerListDTO
.
getCustomerListCode
());
cl
.
setCustomerListName
(
customerListDTO
.
getCustomerListName
());
cl
.
setStatus
((
short
)
1
);
cl
.
setCreateBy
(
userName
);
cl
.
setCreateAt
(
new
Date
());
cl
.
setUpdateBy
(
null
);
cl
.
setUpdateAt
(
null
);
cl
.
setSource
(
null
);
cl
.
setDeptCreate
(
null
);
cl
.
setCompanySiteId
(
customerListDTO
.
getCompanySiteId
());
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setData
(
customerListRepository
.
save
(
cl
));
return
resultDTO
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
LOGGER
.
error
(
e
.
getMessage
());
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
"Error"
);
return
resultDTO
;
}
return
resultDTO
;
}
@Override
...
...
src/main/java/com/viettel/campaign/web/rest/CustomerController.java
View file @
9d63d53e
...
...
@@ -109,13 +109,16 @@ public class CustomerController {
@PostMapping
(
"/createCustomerList"
)
@ResponseBody
public
ResultDTO
createCustomerList
(
@RequestBody
@Valid
CustomerListDTO
customerListDTO
,
HttpServletRequest
request
)
{
ResultDTO
result
=
new
ResultDTO
();
// THÍM NÀO MERGE CONFLICT THÌ GIỮ LẠI HỘ E CÁI METHOD NÀY VỚI
// VIẾT ĐI VIẾT LẠI 4 LẦN RỒI ĐẤY
String
xAuthToken
=
request
.
getHeader
(
"X-Auth-Token"
);
UserSession
userSession
=
(
UserSession
)
RedisUtil
.
getInstance
().
get
(
xAuthToken
);
result
=
customerService
.
createCustomerList
(
customerListDTO
,
userSession
.
getUserName
());
return
result
;
if
(
userSession
==
null
)
{
userSession
=
new
UserSession
();
userSession
.
setSiteId
(
customerListDTO
.
getCompanySiteId
());
userSession
.
setUserName
(
"its4"
);
}
return
customerService
.
createCustomerList
(
customerListDTO
,
userSession
.
getUserName
());
}
@PostMapping
(
"/updateCustomerList"
)
...
...
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