Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
Project
Project
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
曲欣亮
shop
Commits
a79a24f7
Commit
a79a24f7
authored
Dec 02, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
c
parent
1895bea6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
23 deletions
+41
-23
UserController.java
src/main/java/com/egolm/shop/controller/UserController.java
+13
-23
UserService.java
src/main/java/com/egolm/shop/service/UserService.java
+2
-0
UserServiceImpl.java
...ain/java/com/egolm/shop/service/impl/UserServiceImpl.java
+26
-0
No files found.
src/main/java/com/egolm/shop/controller/UserController.java
View file @
a79a24f7
...
@@ -198,28 +198,12 @@ public class UserController {
...
@@ -198,28 +198,12 @@ public class UserController {
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"timestamp"
,
dataType
=
"String"
,
required
=
true
,
value
=
"时间戳"
,
defaultValue
=
""
)
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"timestamp"
,
dataType
=
"String"
,
required
=
true
,
value
=
"时间戳"
,
defaultValue
=
""
)
})
})
@RequestMapping
(
value
=
"/loginByOpenId"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/loginByOpenId"
,
method
=
RequestMethod
.
POST
)
public
String
loginByOpenId
(
String
openId
,
String
mobile
,
String
orgNo
,
String
unionId
,
String
langID
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
String
loginByOpenId
(
String
openId
,
String
mobile
,
String
orgNo
,
String
name
,
String
unionId
,
String
langID
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
Object
>
customerMap
=
userService
.
queryCustomerByOpenId
(
openId
);
XException
.
assertNotBlank
(
orgNo
,
"组织机构不能为空"
);
if
(
customerMap
==
null
)
{
XException
.
assertNotBlank
(
openId
,
"OpenID不能为空"
);
customerMap
=
userService
.
queryCustomerByMobile
(
mobile
);
mobile
=
StringUtil
.
isBlank
(
mobile
)
?
""
:
mobile
;
}
name
=
StringUtil
.
isBlank
(
name
)
?
""
:
name
;
if
(
customerMap
==
null
)
{
userService
.
loginByOpenId
(
orgNo
,
openId
,
mobile
,
name
);
if
(
StringUtil
.
isNotBlank
(
openId
,
mobile
))
{
customerMap
=
userService
.
createCustomer
(
orgNo
,
openId
,
mobile
);
}
else
{
throw
new
XException
(
"手机号码和OPENID不能为空"
);
}
}
else
{
userService
.
saveOpenId
((
String
)
customerMap
.
get
(
"sCustNO"
),
openId
);
}
String
custNo
=
(
String
)
customerMap
.
get
(
"sCustNO"
);
List
<
Map
<
String
,
Object
>>
shopList
=
userService
.
queryShopList
(
orgNo
,
custNo
);
if
(
shopList
.
size
()
==
0
)
{
shopList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
shopMap
=
userService
.
createShop
(
orgNo
,
customerMap
);
shopList
.
add
(
shopMap
);
}
customerMap
.
put
(
"sShopNO"
,
shopList
.
get
(
0
).
get
(
"sShopNO"
));
return
this
.
queryUserInfoByOpenId
(
orgNo
,
openId
,
langID
,
request
,
response
);
return
this
.
queryUserInfoByOpenId
(
orgNo
,
openId
,
langID
,
request
,
response
);
}
}
...
@@ -325,7 +309,13 @@ public class UserController {
...
@@ -325,7 +309,13 @@ public class UserController {
String
sCustNO
=
(
String
)
customerMap
.
get
(
"sCustNO"
);
String
sCustNO
=
(
String
)
customerMap
.
get
(
"sCustNO"
);
List
<
Map
<
String
,
Object
>>
bankList
=
userService
.
queryBankList
(
sCustNO
);
List
<
Map
<
String
,
Object
>>
bankList
=
userService
.
queryBankList
(
sCustNO
);
List
<
Map
<
String
,
Object
>>
shopList
=
userService
.
queryShopList
(
orgNo
,
sCustNO
);
List
<
Map
<
String
,
Object
>>
shopList
=
userService
.
queryShopList
(
orgNo
,
sCustNO
);
customerMap
.
put
(
"sShopNO"
,
shopList
.
get
(
0
).
get
(
"sShopNO"
));
for
(
Map
<
String
,
Object
>
shopMap
:
shopList
)
{
String
sOrgNO
=
(
String
)
shopMap
.
get
(
"sOrgNO"
);
if
(
orgNo
.
equals
(
sOrgNO
))
{
customerMap
.
put
(
"sShopNO"
,
shopMap
.
get
(
"sShopNO"
));
break
;
}
}
customerMap
.
put
(
"nShopID"
,
shopList
.
get
(
0
).
get
(
"nShopID"
));
customerMap
.
put
(
"nShopID"
,
shopList
.
get
(
0
).
get
(
"nShopID"
));
customerMap
.
put
(
"sEmail"
,
shopList
.
get
(
0
).
get
(
"sEmail"
));
customerMap
.
put
(
"sEmail"
,
shopList
.
get
(
0
).
get
(
"sEmail"
));
customerMap
.
put
(
"sShopName"
,
shopList
.
get
(
0
).
get
(
"sShopName"
));
customerMap
.
put
(
"sShopName"
,
shopList
.
get
(
0
).
get
(
"sShopName"
));
...
...
src/main/java/com/egolm/shop/service/UserService.java
View file @
a79a24f7
...
@@ -49,4 +49,6 @@ public interface UserService {
...
@@ -49,4 +49,6 @@ public interface UserService {
public
List
<
Map
<
String
,
Object
>>
queryBankList
(
String
sCustNO
);
public
List
<
Map
<
String
,
Object
>>
queryBankList
(
String
sCustNO
);
public
void
loginByOpenId
(
String
orgNo
,
String
openId
,
String
mobile
,
String
name
);
}
}
src/main/java/com/egolm/shop/service/impl/UserServiceImpl.java
View file @
a79a24f7
...
@@ -30,6 +30,7 @@ import com.egolm.common.StringUtil;
...
@@ -30,6 +30,7 @@ import com.egolm.common.StringUtil;
import
com.egolm.common.Util
;
import
com.egolm.common.Util
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.ResultMutil
;
import
com.egolm.common.jdbc.dialect.Dialect
;
import
com.egolm.common.jdbc.dialect.Dialect
;
import
com.egolm.common.jdbc.dialect.SqlServerDialect
;
import
com.egolm.common.jdbc.dialect.SqlServerDialect
;
import
com.egolm.common.jdbc.dialect.bean.Sql
;
import
com.egolm.common.jdbc.dialect.bean.Sql
;
...
@@ -803,4 +804,29 @@ public class UserServiceImpl implements UserService {
...
@@ -803,4 +804,29 @@ public class UserServiceImpl implements UserService {
return
jdbcTemplate
.
queryForList
(
sql
,
sCustNO
);
return
jdbcTemplate
.
queryForList
(
sql
,
sCustNO
);
}
}
@Override
public
void
loginByOpenId
(
String
orgNo
,
String
openId
,
String
mobile
,
String
name
)
{
String
sql
=
"exec up_B2BUserRegisterLogin ?, ?, ?, ?"
;
ResultMutil
result
=
jdbcTemplate
.
executeMutil
(
sql
,
orgNo
,
openId
,
mobile
,
name
);
List
<
List
<
Map
<
String
,
Object
>>>
datas
=
result
.
getDatas
();
List
<
Map
<
String
,
Object
>>
sList
=
datas
.
get
(
0
);
Map
<
String
,
Object
>
sMap
=
sList
.
get
(
0
);
Object
Status
=
sMap
.
get
(
"Status"
);
Object
ErrorMsg
=
sMap
.
get
(
"ErrorMsg"
);
if
(
Status
!=
null
)
{
Integer
code
=
((
Number
)
Status
).
intValue
();
if
(
code
!=
0
)
{
throwLoginError
(
ErrorMsg
);
}
}
else
{
throwLoginError
(
ErrorMsg
);
}
}
private
void
throwLoginError
(
Object
errorMsg
)
{
if
(
StringUtil
.
isBlank
(
errorMsg
))
{
errorMsg
=
"登陆失败"
;
}
throw
new
XException
((
String
)
errorMsg
);
}
}
}
\ No newline at end of file
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