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
a4d536d6
Commit
a4d536d6
authored
Apr 19, 2017
by
lee_mingzhu
Committed by
minminyan
Apr 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge master
parent
ba0db31d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
18 deletions
+69
-18
MotanUserServiceImpl.java
.../xyqb/controller/external/motan/MotanUserServiceImpl.java
+68
-14
WeChatController.java
...group/xyqb/controller/external/user/WeChatController.java
+1
-4
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/motan/MotanUserServiceImpl.java
View file @
a4d536d6
...
...
@@ -4,10 +4,8 @@ import cn.quantgroup.bean.*;
import
cn.quantgroup.service.*
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.entity.Contact
;
import
cn.quantgroup.xyqb.entity.Merchant
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.entity.enumerate.Relation
;
import
cn.quantgroup.xyqb.model.*
;
import
cn.quantgroup.xyqb.model.session.*
;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
...
...
@@ -15,10 +13,7 @@ import cn.quantgroup.xyqb.service.auth.IIdCardService;
import
cn.quantgroup.xyqb.service.merchant.IMerchantService
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
import
cn.quantgroup.xyqb.service.sms.ISmsService
;
import
cn.quantgroup.xyqb.service.user.IContactService
;
import
cn.quantgroup.xyqb.service.user.ILkbUserService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.*
;
import
cn.quantgroup.xyqb.util.IPUtil
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
...
...
@@ -34,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.util.CollectionUtils
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.sql.Timestamp
;
import
java.text.ParseException
;
import
java.util.List
;
...
...
@@ -70,6 +66,8 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController{
private
ISessionService
sessionService
;
@Autowired
private
IContactService
contactService
;
@Autowired
private
IAddressService
addressService
;
private
final
static
Random
random
=
new
Random
();
@Override
...
...
@@ -259,31 +257,87 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController{
}
@Override
public
UserSysResult
<
List
<
XContact
>>
saveContacts
(
Long
userId
,
List
<
XContact
>
list
)
{
public
UserSysResult
<
List
<
XContact
>>
saveContacts
(
Long
userId
,
List
<
XContact
>
contacts
)
{
UserSysResult
<
List
<
XContact
>>
userSysResult
=
returnValue
(
null
,
null
);
if
(
null
==
userId
||
userId
==
0L
)
{
LOGGER
.
error
(
"保存联系人列表,用户id为空"
);
return
userSysResult
;
}
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
isEmpty
(
contacts
))
{
LOGGER
.
error
(
"保存联系人列表,列表为空"
);
return
userSysResult
;
}
return
null
;
//做一次类型转换,
String
jsonContacts
=
JSON
.
toJSONString
(
contacts
);
List
<
Contact
>
contactList
=
null
;
try
{
contactList
=
MAPPER
.
readValue
(
jsonContacts
,
new
TypeReference
<
List
<
Contact
>>()
{});
}
catch
(
IOException
e
)
{
LOGGER
.
error
(
"联系人列表转换错误:{}"
,
e
.
getMessage
());
return
userSysResult
;
}
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
for
(
Contact
c
:
contactList
)
{
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
<
XContact
>
xResult
=
convertObject
(
JSON
.
toJSONString
(
result
),
new
TypeReference
<
List
<
XContact
>>()
{});
return
returnValue
(
xResult
,
""
);
}
@Override
public
UserSysResult
<
XAddress
>
findAddressByUserId
(
Long
aLong
)
{
return
null
;
public
UserSysResult
<
XAddress
>
findAddressByUserId
(
Long
userId
)
{
UserSysResult
<
XAddress
>
userSysResult
=
returnValue
(
null
,
null
);
Address
address
=
addressService
.
findByUserId
(
userId
);
if
(
null
==
address
)
{
return
userSysResult
;
}
XAddress
xAddress
=
convertObject
(
JSON
.
toJSONString
(
address
),
new
TypeReference
<
XAddress
>()
{});
return
returnValue
(
xAddress
,
""
);
}
@Override
public
UserSysResult
<
XAddress
>
saveAddress
(
XAddress
xAddress
)
{
return
null
;
UserSysResult
<
XAddress
>
userSysResult
=
returnValue
(
null
,
null
);
if
(
null
==
xAddress
)
{
return
userSysResult
;
}
if
(
null
==
xAddress
.
getUserId
()
||
null
==
xAddress
.
getProvinceCode
()
||
null
==
xAddress
.
getCityCode
())
{
return
userSysResult
;
}
Address
addressObj
=
addressService
.
findByUserId
(
xAddress
.
getUserId
());
if
(
addressObj
==
null
)
{
addressObj
=
new
Address
();
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
addressObj
.
setCreatedAt
(
now
);
addressObj
.
setUpdateAt
(
now
);
}
addressObj
.
setUserId
(
xAddress
.
getUserId
());
addressObj
.
setProvinceCode
(
xAddress
.
getProvinceCode
());
addressObj
.
setCityCode
(
xAddress
.
getCityCode
());
addressObj
.
setCity
(
xAddress
.
getCity
());
addressObj
.
setDistrictCode
(
xAddress
.
getDistrictCode
());
addressObj
.
setDistrict
(
xAddress
.
getDistrict
());
addressObj
.
setAddress
(
xAddress
.
getAddress
());
addressObj
.
setProvince
(
xAddress
.
getProvince
());
addressObj
=
addressService
.
save
(
addressObj
);
XAddress
address
=
convertObject
(
JSON
.
toJSONString
(
addressObj
),
new
TypeReference
<
XAddress
>()
{});
return
returnValue
(
address
,
""
);
}
@Override
public
UserSysResult
<
XUserExtInfo
>
updateUserExtInfo
(
XUserExtInfo
xUserExtInfo
)
{
UserSysResult
<
XUserExtInfo
>
userSysResult
=
returnValue
(
null
,
null
);
if
(
null
==
xUserExtInfo
)
{
return
userSysResult
;
}
if
(
null
==
xUserExtInfo
.
getUserId
()
||
0L
==
xUserExtInfo
.
getUserId
())
{
return
userSysResult
;
}
return
null
;
}
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/user/WeChatController.java
View file @
a4d536d6
...
...
@@ -403,10 +403,7 @@ public class WeChatController implements IBaseController {
LOGGER
.
info
(
"微信登录:redirect不为null,创建session跳到指定前端页面."
);
AuthBean
authBean
=
sessionService
.
createSession
(
Constants
.
Channel
.
WECHAT
,
Constants
.
Channel
.
WECHAT
,
""
,
user
,
merchant
);
LOGGER
.
info
(
"微信登录:跳转地址{}"
,
url
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
());
Long
channelId
=
"baitiao"
.
equals
(
merchant
.
getName
())
?
222L
:
1L
;
String
target
=
"baitiao"
.
equals
(
merchant
.
getName
())
?
"cashTarget5"
:
"cashTarget4"
;
return
url
+
"/landing?token="
+
authBean
.
getToken
()
+
"®isterFrom="
+
registerFrom
+
"&channelId="
+
channelId
+
"&key="
+
merchant
.
getName
()
+
"&target="
+
target
+
"&isWechat=true"
;
return
url
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
();
}
return
null
;
}
...
...
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