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
78413d49
Commit
78413d49
authored
Sep 16, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
b7790b56
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
117 additions
and
2 deletions
+117
-2
CategoryController.java
...in/java/com/egolm/shop/controller/CategoryController.java
+18
-2
UserController.java
src/main/java/com/egolm/shop/controller/UserController.java
+37
-0
CategoryService.java
src/main/java/com/egolm/shop/service/CategoryService.java
+2
-0
UserService.java
src/main/java/com/egolm/shop/service/UserService.java
+12
-0
CategoryServiceImpl.java
...java/com/egolm/shop/service/impl/CategoryServiceImpl.java
+6
-0
UserServiceImpl.java
...ain/java/com/egolm/shop/service/impl/UserServiceImpl.java
+42
-0
No files found.
src/main/java/com/egolm/shop/controller/CategoryController.java
View file @
78413d49
package
com
.
egolm
.
shop
.
controller
;
package
com
.
egolm
.
shop
.
controller
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.shop.service.CategoryService
;
import
com.egolm.shop.service.CategoryService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -35,14 +37,28 @@ public class CategoryController {
...
@@ -35,14 +37,28 @@ public class CategoryController {
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"sign"
,
dataType
=
"String"
,
required
=
true
,
value
=
"签名"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"sign"
,
dataType
=
"String"
,
required
=
true
,
value
=
"签名"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"timestamp"
,
dataType
=
"String"
,
required
=
true
,
value
=
"时间戳"
,
defaultValue
=
""
)
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"timestamp"
,
dataType
=
"String"
,
required
=
true
,
value
=
"时间戳"
,
defaultValue
=
""
)
})
})
@RequestMapping
(
value
=
"/queryCategory"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/queryCategory"
,
method
=
RequestMethod
.
GET
)
public
String
queryCategory
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
String
queryCategory
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"orgNO"
,
request
.
getParameter
(
"orgNO"
));
params
.
put
(
"orgNO"
,
request
.
getParameter
(
"orgNO"
));
params
.
put
(
"scopeTypeID"
,
request
.
getParameter
(
"scopeTypeID"
));
params
.
put
(
"scopeTypeID"
,
request
.
getParameter
(
"scopeTypeID"
));
params
.
put
(
"langID"
,
request
.
getParameter
(
"langID"
)==
null
?
936
:
request
.
getParameter
(
"langID"
));
params
.
put
(
"langID"
,
request
.
getParameter
(
"langID"
)==
null
?
936
:
request
.
getParameter
(
"langID"
));
return
categoryService
.
queryCategory
(
params
);
return
categoryService
.
queryCategory
(
params
);
}
}
@ApiOperation
(
"分类列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"level"
,
dataType
=
"int"
,
required
=
true
,
value
=
"级别"
,
defaultValue
=
"3"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"orgNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"组织机构"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"scopeTypeID"
,
dataType
=
"String"
,
required
=
true
,
value
=
"店铺类型"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"terminal"
,
dataType
=
"String"
,
required
=
false
,
value
=
"终端标识"
,
defaultValue
=
"wechat"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
false
,
value
=
"语言"
,
defaultValue
=
"936"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"sign"
,
dataType
=
"String"
,
required
=
true
,
value
=
"签名"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"timestamp"
,
dataType
=
"String"
,
required
=
true
,
value
=
"时间戳"
,
defaultValue
=
""
)
})
@RequestMapping
(
value
=
"/queryCategoryByLevel"
,
method
=
RequestMethod
.
GET
)
public
String
queryCategoryByLevel
(
String
orgNO
,
String
scopeTypeID
,
Integer
level
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
List
<
Map
<
String
,
Object
>>
list
=
categoryService
.
queryCategoryByLevel
(
orgNO
,
scopeTypeID
,
level
);
return
Rjx
.
jsonOk
().
set
(
"list"
,
list
).
toJson
();
}
}
}
src/main/java/com/egolm/shop/controller/UserController.java
View file @
78413d49
package
com
.
egolm
.
shop
.
controller
;
package
com
.
egolm
.
shop
.
controller
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -13,8 +15,10 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -13,8 +15,10 @@ import org.springframework.web.bind.annotation.RestController;
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.shop.config.XException
;
import
com.egolm.shop.pojo.TCustomer
;
import
com.egolm.shop.pojo.TCustomer
;
import
com.egolm.shop.service.UserService
;
import
com.egolm.shop.service.UserService
;
import
com.egolm.shop.util.I18NUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
...
@@ -76,6 +80,39 @@ public class UserController {
...
@@ -76,6 +80,39 @@ 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
({
...
...
src/main/java/com/egolm/shop/service/CategoryService.java
View file @
78413d49
package
com
.
egolm
.
shop
.
service
;
package
com
.
egolm
.
shop
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
public
interface
CategoryService
{
public
interface
CategoryService
{
public
String
queryCategory
(
Map
<
String
,
Object
>
params
);
public
String
queryCategory
(
Map
<
String
,
Object
>
params
);
public
List
<
Map
<
String
,
Object
>>
queryCategoryByLevel
(
String
orgNO
,
String
scopeTypeID
,
Integer
level
);
}
}
src/main/java/com/egolm/shop/service/UserService.java
View file @
78413d49
package
com
.
egolm
.
shop
.
service
;
package
com
.
egolm
.
shop
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.egolm.shop.pojo.TCustomer
;
import
com.egolm.shop.pojo.TCustomer
;
...
@@ -23,4 +24,15 @@ public interface UserService {
...
@@ -23,4 +24,15 @@ public interface UserService {
public
boolean
checkShopExists
(
String
custNO
,
String
shopNO
);
public
boolean
checkShopExists
(
String
custNO
,
String
shopNO
);
public
String
modifyShopAuthInfo
(
Map
<
String
,
Object
>
parameters
);
public
String
modifyShopAuthInfo
(
Map
<
String
,
Object
>
parameters
);
public
Map
<
String
,
Object
>
queryCustomerByOpenId
(
String
openId
);
public
Map
<
String
,
Object
>
queryCustomerByMobile
(
String
mobile
);
public
Map
<
String
,
Object
>
createCustomer
(
String
openId
,
String
mobile
);
public
List
<
Map
<
String
,
Object
>>
queryShopList
(
String
custNo
);
public
Map
<
String
,
Object
>
createShop
(
Map
<
String
,
Object
>
customerMap
);
}
}
src/main/java/com/egolm/shop/service/impl/CategoryServiceImpl.java
View file @
78413d49
...
@@ -65,4 +65,10 @@ public class CategoryServiceImpl implements CategoryService {
...
@@ -65,4 +65,10 @@ public class CategoryServiceImpl implements CategoryService {
}
}
}
}
public
List
<
Map
<
String
,
Object
>>
queryCategoryByLevel
(
String
orgNO
,
String
scopeTypeID
,
Integer
level
)
{
String
three
=
"select categoryID=sCategoryNO,categoryName=sCategoryDesc,parentID=sUpCategoryNO from tOrgCategory where sOrgNO=? and sScopeTypeID=? and nCategoryLevel= ?"
;
List
<
Map
<
String
,
Object
>>
list3
=
jdbcTemplate
.
queryForList
(
three
,
orgNO
,
scopeTypeID
,
level
);
return
list3
;
}
}
}
src/main/java/com/egolm/shop/service/impl/UserServiceImpl.java
View file @
78413d49
...
@@ -446,4 +446,46 @@ public class UserServiceImpl implements UserService {
...
@@ -446,4 +446,46 @@ public class UserServiceImpl implements UserService {
return
Rjx
.
jsonOk
().
setMessage
(
I18NUtils
.
getMessage
(
langID
,
"Msg_SMS_success"
)).
toJson
();
return
Rjx
.
jsonOk
().
setMessage
(
I18NUtils
.
getMessage
(
langID
,
"Msg_SMS_success"
)).
toJson
();
}
}
@Override
public
Map
<
String
,
Object
>
queryCustomerByOpenId
(
String
openId
)
{
List
<
Map
<
String
,
Object
>>
list
=
jdbcTemplate
.
queryForList
(
"select * from tCustomer where sOpenID = ?"
,
openId
);
return
list
.
size
()
==
0
?
null
:
list
.
get
(
0
);
}
@Override
public
Map
<
String
,
Object
>
queryCustomerByMobile
(
String
mobile
)
{
List
<
Map
<
String
,
Object
>>
list
=
jdbcTemplate
.
queryForList
(
"select * from tCustomer where sMobile = ?"
,
mobile
);
return
list
.
size
()
==
0
?
null
:
list
.
get
(
0
);
}
@Override
public
Map
<
String
,
Object
>
createCustomer
(
String
openId
,
String
mobile
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"sOpenID"
,
openId
);
map
.
put
(
"sMobile"
,
mobile
);
map
.
put
(
"sCustNO"
,
mobile
);
map
.
put
(
"sCustName"
,
mobile
);
map
.
put
(
"sCustLevelType"
,
"普通客户"
);
map
.
put
(
"sCustLevelTypeID"
,
"1"
);
map
.
put
(
"nTag"
,
0
);
map
.
put
(
"sCreateUser"
,
""
);
map
.
put
(
"dCreateDate"
,
new
Date
());
map
.
put
(
"dLastUpdateTime"
,
new
Date
());
map
.
put
(
"nStep"
,
1
);
jdbcTemplate
.
save
(
"tCustomer"
,
map
);
return
map
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryShopList
(
String
custNo
)
{
List
<
Map
<
String
,
Object
>>
shopList
=
jdbcTemplate
.
queryForList
(
"select * from tShop where sCustNO = ?"
,
custNo
);
return
shopList
;
}
@Override
public
Map
<
String
,
Object
>
createShop
(
Map
<
String
,
Object
>
customerMap
)
{
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