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
21a10411
Commit
21a10411
authored
Sep 17, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
78413d49
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
38 deletions
+94
-38
UserController.java
src/main/java/com/egolm/shop/controller/UserController.java
+32
-34
UserService.java
src/main/java/com/egolm/shop/service/UserService.java
+1
-1
UserServiceImpl.java
...ain/java/com/egolm/shop/service/impl/UserServiceImpl.java
+61
-3
No files found.
src/main/java/com/egolm/shop/controller/UserController.java
View file @
21a10411
...
@@ -80,40 +80,6 @@ public class UserController {
...
@@ -80,40 +80,6 @@ public class UserController {
return
userService
.
login
(
params
);
return
userService
.
login
(
params
);
}
}
@ApiOperation
(
"小程序登陆"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"openID"
,
dataType
=
"String"
,
required
=
false
,
value
=
"OPENID"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"mobile"
,
dataType
=
"String"
,
required
=
false
,
value
=
"手机号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
false
,
value
=
"语言"
,
defaultValue
=
"936"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"terminal"
,
dataType
=
"String"
,
required
=
true
,
value
=
"终端标识"
,
defaultValue
=
"wechat"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"sign"
,
dataType
=
"String"
,
required
=
true
,
value
=
"签名"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"timestamp"
,
dataType
=
"String"
,
required
=
true
,
value
=
"时间戳"
,
defaultValue
=
""
)
})
@RequestMapping
(
value
=
"/loginByOpenId"
,
method
=
RequestMethod
.
POST
)
public
String
loginByOpenId
(
String
openId
,
String
mobile
,
String
langID
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
Object
>
customerMap
=
userService
.
queryCustomerByOpenId
(
openId
);
if
(
customerMap
==
null
)
{
customerMap
=
userService
.
queryCustomerByMobile
(
mobile
);
}
if
(
customerMap
==
null
)
{
if
(
StringUtil
.
isNotBlank
(
openId
,
mobile
))
{
throw
new
XException
(
"手机号码和OPENID不能为空"
);
}
customerMap
=
userService
.
createCustomer
(
openId
,
mobile
);
}
String
custNo
=
(
String
)
customerMap
.
get
(
"sCustNO"
);
List
<
Map
<
String
,
Object
>>
shopList
=
userService
.
queryShopList
(
custNo
);
if
(
shopList
.
size
()
==
0
)
{
shopList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
shopMap
=
userService
.
createShop
(
customerMap
);
shopList
.
add
(
shopMap
);
}
return
Rjx
.
jsonOk
().
set
(
"customer"
,
customerMap
).
set
(
"shopList"
,
shopList
).
setMessage
(
I18NUtils
.
getMessage
(
langID
,
"Msg_Login_success"
)).
toJson
();
}
@ApiOperation
(
"获取用户信息"
)
@ApiOperation
(
"获取用户信息"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"custNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"账号编码"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"custNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"账号编码"
,
defaultValue
=
""
),
...
@@ -205,6 +171,38 @@ public class UserController {
...
@@ -205,6 +171,38 @@ public class UserController {
return
userService
.
sendSms
(
params
);
return
userService
.
sendSms
(
params
);
}
}
@ApiOperation
(
"小程序登陆"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"openID"
,
dataType
=
"String"
,
required
=
false
,
value
=
"OPENID"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"mobile"
,
dataType
=
"String"
,
required
=
false
,
value
=
"手机号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"orgNo"
,
dataType
=
"String"
,
required
=
false
,
value
=
"orgNo"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
false
,
value
=
"语言"
,
defaultValue
=
"936"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"terminal"
,
dataType
=
"String"
,
required
=
true
,
value
=
"终端标识"
,
defaultValue
=
"wechat"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"sign"
,
dataType
=
"String"
,
required
=
true
,
value
=
"签名"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"timestamp"
,
dataType
=
"String"
,
required
=
true
,
value
=
"时间戳"
,
defaultValue
=
""
)
})
@RequestMapping
(
value
=
"/loginByOpenId"
,
method
=
RequestMethod
.
POST
)
public
String
loginByOpenId
(
String
openId
,
String
mobile
,
String
orgNo
,
String
langID
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
Object
>
customerMap
=
userService
.
queryCustomerByOpenId
(
openId
);
if
(
customerMap
==
null
)
{
customerMap
=
userService
.
queryCustomerByMobile
(
mobile
);
}
if
(
customerMap
==
null
)
{
if
(
StringUtil
.
isNotBlank
(
openId
,
mobile
))
{
throw
new
XException
(
"手机号码和OPENID不能为空"
);
}
customerMap
=
userService
.
createCustomer
(
openId
,
mobile
);
}
String
custNo
=
(
String
)
customerMap
.
get
(
"sCustNO"
);
List
<
Map
<
String
,
Object
>>
shopList
=
userService
.
queryShopList
(
custNo
);
if
(
shopList
.
size
()
==
0
)
{
shopList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
shopMap
=
userService
.
createShop
(
orgNo
,
customerMap
);
shopList
.
add
(
shopMap
);
}
return
Rjx
.
jsonOk
().
set
(
"customer"
,
customerMap
).
set
(
"shopList"
,
shopList
).
setMessage
(
I18NUtils
.
getMessage
(
langID
,
"Msg_Login_success"
)).
toJson
();
}
@ApiOperation
(
"修改认证信息"
)
@ApiOperation
(
"修改认证信息"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
name
=
"shopId"
,
value
=
"店铺ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
name
=
"shopId"
,
value
=
"店铺ID"
),
...
...
src/main/java/com/egolm/shop/service/UserService.java
View file @
21a10411
...
@@ -33,6 +33,6 @@ public interface UserService {
...
@@ -33,6 +33,6 @@ public interface UserService {
public
List
<
Map
<
String
,
Object
>>
queryShopList
(
String
custNo
);
public
List
<
Map
<
String
,
Object
>>
queryShopList
(
String
custNo
);
public
Map
<
String
,
Object
>
createShop
(
Map
<
String
,
Object
>
customerMap
);
public
Map
<
String
,
Object
>
createShop
(
String
orgNo
,
Map
<
String
,
Object
>
customerMap
);
}
}
src/main/java/com/egolm/shop/service/impl/UserServiceImpl.java
View file @
21a10411
package
com
.
egolm
.
shop
.
service
.
impl
;
package
com
.
egolm
.
shop
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.text.MessageFormat
;
import
java.text.MessageFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -13,6 +17,9 @@ import org.apache.commons.logging.LogFactory;
...
@@ -13,6 +17,9 @@ import org.apache.commons.logging.LogFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.jdbc.core.PreparedStatementCreator
;
import
org.springframework.jdbc.support.GeneratedKeyHolder
;
import
org.springframework.jdbc.support.KeyHolder
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -20,7 +27,9 @@ import com.egolm.common.HttpsUtil;
...
@@ -20,7 +27,9 @@ import com.egolm.common.HttpsUtil;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.StringUtil
;
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.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.shop.encrypt.EgoPasswordEncoder
;
import
com.egolm.shop.encrypt.EgoPasswordEncoder
;
import
com.egolm.shop.pojo.TCommon
;
import
com.egolm.shop.pojo.TCommon
;
import
com.egolm.shop.pojo.TCustomer
;
import
com.egolm.shop.pojo.TCustomer
;
...
@@ -483,9 +492,58 @@ public class UserServiceImpl implements UserService {
...
@@ -483,9 +492,58 @@ public class UserServiceImpl implements UserService {
}
}
@Override
@Override
public
Map
<
String
,
Object
>
createShop
(
Map
<
String
,
Object
>
customerMap
)
{
public
Map
<
String
,
Object
>
createShop
(
String
orgNo
,
Map
<
String
,
Object
>
customerMap
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
String
sCustNO
=
(
String
)
customerMap
.
get
(
"sCustNO"
);
map
.
put
(
"sCustNO"
,
sCustNO
);
map
.
put
(
"sShopNO"
,
""
);
map
.
put
(
"sShopName"
,
"无名小店"
);
map
.
put
(
"sOrgNO"
,
orgNo
);
map
.
put
(
"sShopTypeID"
,
"1"
);
map
.
put
(
"sShopType"
,
"杂货店"
);
map
.
put
(
"sScopeTypeID"
,
"1"
);
map
.
put
(
"sScopeType"
,
"杂货店"
);
map
.
put
(
"sProvinceID"
,
""
);
map
.
put
(
"sProvince"
,
""
);
map
.
put
(
"sCityID"
,
""
);
map
.
put
(
"sCity"
,
""
);
map
.
put
(
"sDistrictID"
,
""
);
map
.
put
(
"sDistrict"
,
""
);
map
.
put
(
"nTag"
,
0
);
map
.
put
(
"sCreateUser"
,
""
);
map
.
put
(
"dCreateDate"
,
new
Date
());
map
.
put
(
"dLastUpdateTime"
,
new
Date
());
map
.
put
(
"nProperty"
,
0
);
map
.
put
(
"nAgreementStatus"
,
1
);
return
null
;
Dialect
dialect
=
jdbcTemplate
.
getDialect
();
Sql
desc
=
dialect
.
argsInsert
(
"tShop"
,
map
);
String
sql
=
desc
.
getSql
();
Object
[]
args
=
desc
.
getArgs
();
KeyHolder
keyHolder
=
new
GeneratedKeyHolder
();
jdbcTemplate
.
update
(
new
PreparedStatementCreator
()
{
public
PreparedStatement
createPreparedStatement
(
Connection
connection
)
throws
SQLException
{
PreparedStatement
ps
=
connection
.
prepareStatement
(
sql
,
Statement
.
RETURN_GENERATED_KEYS
);
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
Object
argObj
=
args
[
i
];
if
(
argObj
instanceof
java
.
util
.
Date
)
{
java
.
util
.
Date
argDate
=
(
java
.
util
.
Date
)
argObj
;
ps
.
setObject
(
i
+
1
,
new
java
.
sql
.
Timestamp
(
argDate
.
getTime
()));
}
else
if
(
argObj
.
getClass
().
isEnum
())
{
ps
.
setObject
(
i
+
1
,
args
[
i
].
toString
());
}
else
{
ps
.
setObject
(
i
+
1
,
args
[
i
]);
}
}
return
ps
;
}
},
keyHolder
);
Object
key
=
keyHolder
.
getKey
();
jdbcTemplate
.
update
(
"update tShop set sShopNO = RIGHT('00000000'+ CAST(nShopID as varchar(8)), 8) where nShopID = ?"
,
key
);
String
sShopNO
=
jdbcTemplate
.
queryForString
(
"select sShopNO from tShop where nShopID = ?"
,
key
);
map
.
put
(
"sShopNO"
,
sShopNO
);
return
map
;
}
}
}
}
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