Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
OSmall
/
linjiashop
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d26ae2d7
authored
Dec 21, 2020
by
tyfanchz
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
2 parents
bc92bb0a
b97e7478
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
75 additions
and
26 deletions
shop-admin-api/src/main/java/com/glsx/shop/api/controller/system/UserController.java
shop-core/src/main/java/com/glsx/shop/bean/dto/AppUserDTO.java
shop-core/src/main/java/com/glsx/shop/bean/dto/UserDto.java → shop-core/src/main/java/com/glsx/shop/bean/dto/UserDTO.java
shop-core/src/main/java/com/glsx/shop/bean/entity/shop/PlatformCustomer.java
shop-core/src/main/java/com/glsx/shop/core/factory/UserFactory.java
shop-core/src/main/java/com/glsx/shop/web/package-info.java
shop-mobile-api/pom.xml
shop-mobile-api/src/main/java/com/glsx/shop/mobile/controller/AppLoginController.java
shop-mobile-api/src/main/resources/application-prod.properties
shop-admin-api/src/main/java/com/glsx/shop/api/controller/system/UserController.java
View file @
d26ae2d
package
com
.
glsx
.
shop
.
api
.
controller
.
system
;
import
javax.validation.Valid
;
import
java.util.List
;
import
com.glsx.shop.bean.constant.Const
;
import
com.glsx.shop.bean.constant.factory.PageFactory
;
import
com.glsx.shop.bean.constant.state.ManagerStatus
;
import
com.glsx.shop.bean.core.BusinessLog
;
import
com.glsx.shop.bean.dto.UserD
to
;
import
com.glsx.shop.bean.dto.UserD
TO
;
import
com.glsx.shop.bean.entity.system.User
;
import
com.glsx.shop.bean.enumeration.Permission
;
import
com.glsx.shop.bean.exception.ApplicationException
;
...
...
@@ -31,6 +29,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
java.util.List
;
/**
* UserController
*
...
...
@@ -64,7 +65,7 @@ public class UserController extends BaseController {
@RequestMapping
(
method
=
RequestMethod
.
POST
)
@BusinessLog
(
value
=
"编辑管理员"
,
key
=
"name"
)
@RequiresPermissions
(
value
=
{
Permission
.
USER_EDIT
})
public
Object
save
(
@Valid
UserD
to
user
,
BindingResult
result
)
{
public
Object
save
(
@Valid
UserD
TO
user
,
BindingResult
result
)
{
if
(
user
.
getId
()
==
null
)
{
// 判断账号是否重复
User
theUser
=
managerService
.
findByAccount
(
user
.
getAccount
());
...
...
shop-core/src/main/java/com/glsx/shop/bean/dto/AppUserDTO.java
0 → 100644
View file @
d26ae2d
package
com
.
glsx
.
shop
.
bean
.
dto
;
import
lombok.Data
;
/**
* @author think.wang
* @version 1.0.0
* @Title AppUserDTO
* @Package com.glsx.shop.bean.dto
* @Description APP传过来参数
* @date 2020/12/21
*/
@Data
public
class
AppUserDTO
{
private
String
contactNumber
;
private
String
channel
;
private
Integer
appAccountId
;
private
String
nickname
;
private
String
wechatId
;
private
Integer
province
;
private
Integer
city
;
}
shop-core/src/main/java/com/glsx/shop/bean/dto/UserD
to
.java
→
shop-core/src/main/java/com/glsx/shop/bean/dto/UserD
TO
.java
View file @
d26ae2d
...
...
@@ -13,7 +13,7 @@ import java.util.Date;
* @Date 2017/5/5 22:40
*/
@Data
public
class
UserD
to
{
public
class
UserD
TO
{
private
Long
id
;
...
...
shop-core/src/main/java/com/glsx/shop/bean/entity/shop/PlatformCustomer.java
View file @
d26ae2d
...
...
@@ -48,10 +48,8 @@ public class PlatformCustomer implements Serializable {
private
String
address
;
@Column
(
columnDefinition
=
"TINYINT(11) COMMENT '账号状态 0 停用 1 正常 2 待审核 3 审核未通过'"
)
private
Integer
status
;
@Column
(
columnDefinition
=
"VARCHAR(256) COMMENT '公钥'"
)
private
String
publicKey
;
@Column
(
columnDefinition
=
"VARCHAR(256) COMMENT '私钥'"
)
private
String
privateKey
;
@Column
(
columnDefinition
=
"INT(11) COMMENT '秘钥 t_platform_secretkey的id'"
)
private
Integer
keyId
;
@Column
(
columnDefinition
=
"VARCHAR(32) COMMENT '渠道号'"
)
private
String
channelNumber
;
@Column
(
columnDefinition
=
"INT(11) COMMENT '创建人'"
)
...
...
shop-core/src/main/java/com/glsx/shop/core/factory/UserFactory.java
View file @
d26ae2d
package
com
.
glsx
.
shop
.
core
.
factory
;
import
com.glsx.shop.bean.dto.UserD
to
;
import
com.glsx.shop.bean.dto.UserD
TO
;
import
com.glsx.shop.bean.entity.system.User
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -12,7 +12,7 @@ import org.springframework.beans.BeanUtils;
*/
public
class
UserFactory
{
public
static
User
createUser
(
UserD
to
userDto
,
User
user
)
{
public
static
User
createUser
(
UserD
TO
userDto
,
User
user
)
{
if
(
userDto
==
null
)
{
return
null
;
}
else
{
...
...
@@ -21,7 +21,7 @@ public class UserFactory {
}
}
public
static
User
updateUser
(
UserD
to
userDto
,
User
user
)
{
public
static
User
updateUser
(
UserD
TO
userDto
,
User
user
)
{
if
(
userDto
==
null
)
{
return
null
;
}
else
{
...
...
shop-core/src/main/java/com/glsx/shop/web/package-info.java
deleted
100644 → 0
View file @
bc92bb0
/**
* @author glsx
* @date :Created in 11/5/2019 7:45 PM
*/
package
com
.
glsx
.
shop
.
web
;
shop-mobile-api/pom.xml
View file @
d26ae2d
...
...
@@ -86,6 +86,14 @@
<encoding>
UTF-8
</encoding>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.5
</version>
<configuration>
<skipTests>
true
</skipTests>
</configuration>
</plugin>
</plugins>
</build>
...
...
shop-mobile-api/src/main/java/com/glsx/shop/mobile/controller/AppLoginController.java
View file @
d26ae2d
...
...
@@ -2,6 +2,7 @@ package com.glsx.shop.mobile.controller;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.glsx.shop.bean.dto.AppUserDTO
;
import
com.glsx.shop.bean.entity.shop.PlatformCustomer
;
import
com.glsx.shop.bean.entity.shop.PlatformUser
;
import
com.glsx.shop.bean.exception.ApplicationExceptionEnum
;
...
...
@@ -15,11 +16,12 @@ import com.glsx.shop.utils.HttpUtils;
import
com.glsx.shop.utils.StringUtil
;
import
com.glsx.shop.web.controller.BaseController
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Date
;
...
...
@@ -50,23 +52,24 @@ public class AppLoginController extends BaseController {
@Autowired
private
PlatformCustomerService
customerService
;
@RequestMapping
(
value
=
"/loginOrRegister"
,
method
=
RequestMethod
.
POST
)
public
Object
loginOrRegister
(
@Request
Param
String
mobile
,
@RequestParam
String
channel
)
{
if
(
StringUtil
.
isEmpty
(
mobile
)
||
StringUtil
.
isEmpty
(
channel
)){
@RequestMapping
(
value
=
"/loginOrRegister"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
}
)
public
Object
loginOrRegister
(
@Request
Body
AppUserDTO
userDTO
)
{
if
(
StringUtil
.
isEmpty
(
userDTO
.
getContactNumber
())
||
StringUtil
.
isEmpty
(
userDTO
.
getChannel
()
)){
return
Rets
.
failure
(
ApplicationExceptionEnum
.
PARAM_IS_EMPTY
);
}
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
4
);
PlatformCustomer
customer
=
customerService
.
findByChannelNumber
(
channel
);
PlatformCustomer
customer
=
customerService
.
findByChannelNumber
(
userDTO
.
getChannel
()
);
if
(
customer
==
null
){
return
Rets
.
failure
(
ApplicationExceptionEnum
.
PARAM_ERROR
);
}
JwtUser
jwtUser
=
new
JwtUser
();
//JWT用户信息封装
Date
now
=
new
Date
();
PlatformUser
user
=
platformUserService
.
findByContactNumber
(
mobile
);
PlatformUser
user
=
platformUserService
.
findByContactNumber
(
userDTO
.
getContactNumber
()
);
if
(
user
!=
null
){
result
.
put
(
"tuYaId"
,
user
.
getTuYaId
());
jwtUser
.
setId
(
user
.
getId
());
jwtUser
.
setUserName
(
user
.
getNickname
());
BeanUtils
.
copyProperties
(
userDTO
,
user
);
user
.
setLastLoginTime
(
now
);
if
(
user
.
getStatus
().
equals
(
0
)){
//注销用户重新注册
user
.
setStatus
(
1
);
//用户正常
...
...
@@ -76,19 +79,20 @@ public class AppLoginController extends BaseController {
platformUserService
.
update
(
user
);
}
else
{
//用户首次注册
PlatformUser
pUser
=
new
PlatformUser
();
pUser
.
setContactNumber
(
mobile
);
BeanUtils
.
copyProperties
(
userDTO
,
pUser
);
pUser
.
setCustomerId
(
customer
.
getId
().
intValue
());
pUser
.
setCreateTime
(
now
);
pUser
.
setCreateBy
(-
1
);
pUser
.
setStatus
(
1
);
//默认用户正常
pUser
.
setLastLoginTime
(
now
);
Integer
tuYaId
=
this
.
syncUser
(
mobile
);
//同步用户到涂鸦
Integer
tuYaId
=
this
.
syncUser
(
userDTO
.
getContactNumber
()
);
//同步用户到涂鸦
pUser
.
setTuYaId
(
tuYaId
);
PlatformUser
returnUser
=
platformUserService
.
insert
(
pUser
);
jwtUser
.
setId
(
returnUser
.
getId
());
result
.
put
(
"tuYaId"
,
tuYaId
);
}
//JWT信息缓存
jwtUser
.
setPassword
(
channel
);
jwtUser
.
setPassword
(
userDTO
.
getChannel
()
);
String
token
=
userService
.
loginForToken
(
jwtUser
);
result
.
put
(
"token"
,
token
);
return
Rets
.
success
(
result
);
...
...
shop-mobile-api/src/main/resources/application-prod.properties
View file @
d26ae2d
...
...
@@ -15,3 +15,16 @@ wx.notify-url=http://linjiashop.microapp.store/pay/wx/notify
# \u5546\u6237\u8BC1\u4E66\u6587\u4EF6\u8DEF\u5F84
wx.key-
path
=
xxxxx
#server.servlet.context-path=/api
# FastDFS Configuration
fdfs.so-
timeout
=
1500
fdfs.connect-
timeout
=
600
fdfs.thumb-
image.height
=
150
fdfs.thumb-
image.width
=
150
fdfs.pool.max-
total
=
100
fdfs.pool.max-wait-
millis
=
500
fdfs.tracker-
list
=
192.168.3.222:22122
fdfs_tracker_nginx_domain
=
http://qcimg01.glsx.net:7060
#fdfs_tracker_nginx_port=80
#\u6D82\u9E26\u540C\u6B65\u7528\u6237\u63A5\u53E3
tu_ya_sync_interface
=
http://192.168.3.137:8091/smartApi/sync_user
Write
Preview
Markdown
is supported
Attach a file
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 post a comment