Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
shop-Mall
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
licc
shop-Mall
Commits
310d2c7f
Commit
310d2c7f
authored
Mar 05, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://111.203.232.171:8888/licc/shop-mall
into master
parents
ff5ea0c9
1b7104cc
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
281 additions
and
104 deletions
+281
-104
Page.java
...-common/src/main/java/cn/wisenergy/common/utils/Page.java
+132
-0
Result.java
...ommon/src/main/java/cn/wisenergy/common/utils/Result.java
+4
-1
ShopZxMapper.java
...apper/src/main/java/cn/wisenergy/mapper/ShopZxMapper.java
+2
-2
ShopZxMapper.xml
wisenergy-mapper/src/main/resources/mapper/ShopZxMapper.xml
+3
-1
UsersMapper.xml
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
+4
-4
UploadService.java
...src/main/java/cn/wisenergy/service/app/UploadService.java
+5
-1
UserService.java
...e/src/main/java/cn/wisenergy/service/app/UserService.java
+4
-2
UploadServiceImpl.java
...java/cn/wisenergy/service/app/impl/UploadServiceImpl.java
+39
-1
UserService.java
.../main/java/cn/wisenergy/service/app/impl/UserService.java
+0
-62
UserServiceImpl.java
...n/java/cn/wisenergy/service/app/impl/UserServiceImpl.java
+41
-21
UploadController.java
.../wisenergy/web/admin/controller/app/UploadController.java
+30
-4
loginController.java
...n/wisenergy/web/admin/controller/app/loginController.java
+7
-3
MvcConfiguration.java
...c/main/java/cn/wisenergy/web/config/MvcConfiguration.java
+2
-0
ShiroConfig.java
...min/src/main/java/cn/wisenergy/web/shiro/ShiroConfig.java
+2
-1
LoginInterceptor.java
...va/cn/wisenergy/web/sms/interceptor/LoginInterceptor.java
+6
-1
No files found.
wisenergy-common/src/main/java/cn/wisenergy/common/utils/Page.java
0 → 100644
View file @
310d2c7f
package
cn
.
wisenergy
.
common
.
utils
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 分页类
* Created by m1991 on 2021/2/28 23:06
*/
public
class
Page
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
5294589632707269745L
;
//默认页大小
private
static
int
DEFAULT_PAGE_SIZE
=
20
;
private
static
int
DEFAULT_PAGE_NO
=
1
;
//当前页码
private
int
pageNo
;
/**
* 每页的记录数
*/
private
int
pageSize
=
DEFAULT_PAGE_SIZE
;
/**
* 总记录数
*/
private
Integer
total
;
/**
* 总页数
*/
private
int
pages
;
/**
* 数据
*/
private
List
<
T
>
list
;
//开始位置
private
Integer
beginPos
;
public
Page
(
List
<
T
>
list
)
{
this
.
list
=
list
;
}
public
Page
(
int
pageNo
,
int
pageSize
,
Integer
total
)
{
pageNo
=
(
pageNo
==
0
)?
DEFAULT_PAGE_NO
:
pageNo
;
pageSize
=
(
pageSize
==
0
)?
DEFAULT_PAGE_SIZE
:
pageSize
;
this
.
beginPos
=(
pageNo
-
1
)*
pageSize
;
this
.
pageNo
=
pageNo
;
this
.
pageSize
=
pageSize
;
this
.
total
=
total
;
}
public
Page
(
List
<
T
>
list
,
int
pageNo
,
int
pageSize
,
int
total
)
{
this
.
list
=
list
;
this
.
pageNo
=
pageNo
;
this
.
setPageSize
(
pageSize
);
this
.
setTotal
(
total
);
}
public
Page
()
{
new
Page
<
T
>(
new
ArrayList
<
T
>(),
0
,
0
,
0
);
}
public
void
setPage
(
int
pageNo
,
int
pageSize
,
Integer
total
)
{
this
.
pageNo
=
pageNo
;
this
.
pageSize
=
pageSize
;
this
.
total
=
total
;
}
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
}
public
static
int
getDefaultPageSize
()
{
return
DEFAULT_PAGE_SIZE
;
}
public
static
void
setDefaultPageSize
(
int
defaultPageSize
)
{
DEFAULT_PAGE_SIZE
=
defaultPageSize
;
}
public
int
getPageNo
()
{
return
pageNo
;
}
public
void
setPageNo
(
int
pageNo
)
{
this
.
pageNo
=
pageNo
;
}
public
int
getPageSize
()
{
return
pageSize
;
}
public
void
setPageSize
(
int
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
public
long
getTotal
()
{
return
total
;
}
public
void
setTotal
(
Integer
total
)
{
this
.
total
=
total
;
}
public
List
<
T
>
getList
()
{
return
list
;
}
public
void
setList
(
List
<
T
>
list
)
{
this
.
list
=
list
;
}
public
int
getPages
()
{
return
pages
;
}
public
void
setPages
(
int
pages
)
{
this
.
pages
=
pages
;
}
public
Integer
getBeginPos
()
{
return
beginPos
;
}
public
void
setBeginPos
(
Integer
beginPos
)
{
this
.
beginPos
=
beginPos
;
}
}
wisenergy-common/src/main/java/cn/wisenergy/common/utils/Result.java
View file @
310d2c7f
...
@@ -20,8 +20,11 @@ public class Result<T> implements Serializable{
...
@@ -20,8 +20,11 @@ public class Result<T> implements Serializable{
/**
/**
* 无参构造
* 无参构造
* @param i
* @param success
* @param shopZxPage
*/
*/
public
Result
()
{}
public
Result
(
int
i
,
String
success
,
Page
shopZxPage
)
{}
/**
/**
* 根据code,msg创建一个Resutl
* 根据code,msg创建一个Resutl
...
...
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/ShopZxMapper.java
View file @
310d2c7f
...
@@ -23,11 +23,11 @@ public interface ShopZxMapper extends BaseMapper<shopZx> {
...
@@ -23,11 +23,11 @@ public interface ShopZxMapper extends BaseMapper<shopZx> {
int
zxadd
(
@Param
(
"zxUrl"
)
String
zxUrl
,
@Param
(
"userId"
)
String
userId
,
@Param
(
"zxName"
)
String
zxName
,
@Param
(
"zxField"
)
String
zxField
,
@Param
(
"imgUrl"
)
String
imgUrl
,
@Param
(
"zxAddress"
)
String
zxAddress
);
int
zxadd
(
@Param
(
"zxUrl"
)
String
zxUrl
,
@Param
(
"userId"
)
String
userId
,
@Param
(
"zxName"
)
String
zxName
,
@Param
(
"zxField"
)
String
zxField
,
@Param
(
"imgUrl"
)
String
imgUrl
,
@Param
(
"zxAddress"
)
String
zxAddress
);
/**分页 资讯内容倒叙查询
/**分页 资讯内容倒叙查询
* PageSize int, --每页的记录数量,比如10条
* PageSize int, --每页的记录数量,比如10条
#{beginPos},#{pageSize}
* @param
* @param
* @return
* @return
*/
*/
List
<
shopZx
>
selectAll
(
@Param
(
"PageSize"
)
int
PageSize
);
List
<
shopZx
>
selectAll
(
@Param
(
"PageSize"
)
int
PageSize
,
@Param
(
"beginPos"
)
int
beginPos
);
// /**查询方法
// /**查询方法
// * @param
// * @param
...
...
wisenergy-mapper/src/main/resources/mapper/ShopZxMapper.xml
View file @
310d2c7f
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
select zxid as zxid,zxUrl as zxUrl,
select zxid as zxid,zxUrl as zxUrl,
zxLikes as zxLikes,userid as userid,zxName as zxName,
zxLikes as zxLikes,userid as userid,zxName as zxName,
zxShenHe as zxShenHe,zxField as zxField,zxDate as zxDate,
zxShenHe as zxShenHe,zxField as zxField,zxDate as zxDate,
imgUrl as imgUrl,zxAddress as zxAddress from shop_zx order by zxid desc
LIMIT PageSize,10
imgUrl as imgUrl,zxAddress as zxAddress from shop_zx order by zxid desc
limit #{beginPos},#{pageSize}
</select>
</select>
<!--资讯总记录数查询-->
<!--资讯总记录数查询-->
...
@@ -60,4 +60,6 @@
...
@@ -60,4 +60,6 @@
select count (*) from shop_zx
select count (*) from shop_zx
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
View file @
310d2c7f
...
@@ -113,7 +113,7 @@
...
@@ -113,7 +113,7 @@
select
select
id
id
from
from
<include
refid=
"table"
/>
user_info
<where>
<where>
user_id=#{userId}
user_id=#{userId}
</where>
</where>
...
@@ -159,7 +159,7 @@
...
@@ -159,7 +159,7 @@
insert into user(user_id,invite_code,be_invited_code,user_level) value (#{userId},#{inviteCode},#{beInvitedCode},#{userLevel})
insert into user(user_id,invite_code,be_invited_code,user_level) value (#{userId},#{inviteCode},#{beInvitedCode},#{userLevel})
</insert>
</insert>
<insert
id=
"insertbyint"
>
<insert
id=
"insertbyint"
>
insert into user(user_id,be_invited_code) value (#{userId},#{beInvitedCode})
insert into user
_info
(user_id,be_invited_code) value (#{userId},#{beInvitedCode})
</insert>
</insert>
<select
id=
"queryUsersByPhone"
resultType=
"java.lang.Integer"
>
<select
id=
"queryUsersByPhone"
resultType=
"java.lang.Integer"
>
...
@@ -202,8 +202,8 @@
...
@@ -202,8 +202,8 @@
</where>
</where>
</select>
</select>
<update
id=
"edit1"
parameterType=
"cn.wisenergy.model.app.User"
>
<update
id=
"edit1"
parameterType=
"cn.wisenergy.model.app.User"
>
UPDATE
update
<include
refid=
"table"
/>
user_info
<set>
<set>
<if
test=
"userLevel != null"
>
user_level =#{userLevel},
</if>
<if
test=
"userLevel != null"
>
user_level =#{userLevel},
</if>
<if
test=
"inviteCode != null"
>
invite_code =#{inviteCode},
</if>
<if
test=
"inviteCode != null"
>
invite_code =#{inviteCode},
</if>
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/UploadService.java
View file @
310d2c7f
package
cn
.
wisenergy
.
service
.
app
;
package
cn
.
wisenergy
.
service
.
app
;
import
cn.wisenergy.model.app.Page
;
import
cn.wisenergy.model.app.shopZx
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -49,7 +51,9 @@ public interface UploadService {
...
@@ -49,7 +51,9 @@ public interface UploadService {
* @param
* @param
* @return
* @return
*/
*/
// List<shopZx> getList();
Map
getList
(
int
beginPos
,
int
pageSize
);
// public Page<shopZx> find();
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/UserService.java
View file @
310d2c7f
...
@@ -3,6 +3,8 @@ package cn.wisenergy.service.app;
...
@@ -3,6 +3,8 @@ package cn.wisenergy.service.app;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.model.app.User
;
import
java.util.Map
;
/**
/**
* @ Description: 用户接口
* @ Description: 用户接口
* @ Author : 86187
* @ Author : 86187
...
@@ -36,10 +38,10 @@ public interface UserService {
...
@@ -36,10 +38,10 @@ public interface UserService {
/**
/**
*用户注册
*用户注册
*/
*/
R
userByZx
(
String
userId
,
String
beInvitedCode
);
Map
userByZx
(
String
userId
,
String
beInvitedCode
);
// Integer selectbyint(String userId,String beInvitedCode);
// Integer selectbyint(String userId,String beInvitedCode);
//
//
//
Integer getuserIdById(String userId);
Integer
getuserIdById
(
String
userId
);
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UploadServiceImpl.java
View file @
310d2c7f
...
@@ -4,11 +4,13 @@ import cn.wisenergy.common.utils.FileException;
...
@@ -4,11 +4,13 @@ import cn.wisenergy.common.utils.FileException;
import
cn.wisenergy.common.utils.FileUtils
;
import
cn.wisenergy.common.utils.FileUtils
;
import
cn.wisenergy.common.utils.FrameGrabberKit
;
import
cn.wisenergy.common.utils.FrameGrabberKit
;
import
cn.wisenergy.model.app.Page
;
import
cn.wisenergy.model.app.shopZx
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.youzan.cloud.open.sdk.common.util.CheckUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.UrlResource
;
import
org.springframework.core.io.UrlResource
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -319,4 +321,40 @@ public class UploadServiceImpl implements UploadService {
...
@@ -319,4 +321,40 @@ public class UploadServiceImpl implements UploadService {
}
}
}
}
@Override
public
Map
getList
(
int
beginPos
,
int
pageSize
)
{
Map
map
=
new
HashMap
();
String
[]
ImgUrl
=
new
String
[
0
];
List
<
shopZx
>
date
=
shopZxMapper
.
selectAll
(
beginPos
,
pageSize
);
for
(
int
i
=
0
;
date
.
size
()>
0
;
i
++){
shopZx
s
=
(
shopZx
)
date
.
get
(
i
);
ImgUrl
=
s
.
getImgUrl
().
split
(
","
);
}
if
(
null
==
date
){
map
.
put
(
"code"
,
1
);
map
.
put
(
"msg"
,
"获取资讯分页数据失败!"
);
return
map
;
}
else
{
map
.
put
(
"date"
,
date
);
map
.
put
(
"ImgUrl"
,
ImgUrl
);
map
.
put
(
"code"
,
0
);
map
.
put
(
"msg"
,
"获取资讯分页数据成功!"
);
return
map
;
}
}
// @Override
// public Page<shopZx> find() {
// if (null == page) {
// page = 0;
// }
// if (CheckUtils.isEmpty(size)) {
// size = 10;
// }
// PageRequest pageable = PageRequest.of(page, size, Sort.Direction.DESC, "updateTime");
// Page<User> users = userRepository.findAll(pageable);
// return users;
// }
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserService.java
deleted
100644 → 0
View file @
ff5ea0c9
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.wisenergy.mapper.UsersMapper
;
import
cn.wisenergy.model.app.User
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* @ Description: 用户接口实现
* @ Author : 86187
* @ Date : 2021/1/6 16:11
* @author 86187
*/
@Service
@Slf4j
public
class
UserService
extends
ServiceImpl
<
UsersMapper
,
User
>
{
@Autowired
private
UsersMapper
userMapper
;
public
String
login
(
User
user
){
//TODO:登陆逻辑函数
try
{
User
userExistN
=
userMapper
.
findByName
(
String
.
valueOf
(
user
.
getUserId
()));
if
(
userExistN
!=
null
){
String
userExistP
=
userMapper
.
findPswByName
(
String
.
valueOf
(
user
.
getUserId
()));
if
(
userExistP
.
equals
(
user
.
getPassword
())){
return
user
.
getUserId
()+
" 用户登录成功,欢迎您!"
;
}
else
{
return
"登陆失败,密码错误!"
;
}
}
else
{
return
"登陆失败,账户不存在"
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
e
.
getMessage
();
}
}
public
String
regist
(
User
user
){
//TODO:注册判断逻辑函数
try
{
User
userExist
=
userMapper
.
findByName
(
String
.
valueOf
(
user
.
getUserId
()));
if
(
user
.
getUserId
().
equals
(
""
)){
return
"账户名不能为空"
;
}
else
if
(
user
.
getPassword
().
equals
(
""
)){
return
"密码不能为空"
;
}
else
if
(
userExist
!=
null
){
return
"账户已经存在"
;
}
else
{
userMapper
.
save
(
user
);
return
"注册成功"
;
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
e
.
getMessage
();
}
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserServiceImpl.java
View file @
310d2c7f
...
@@ -16,9 +16,7 @@ import org.springframework.stereotype.Service;
...
@@ -16,9 +16,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.util.HashMap
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author 86187
* @author 86187
...
@@ -75,13 +73,18 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
...
@@ -75,13 +73,18 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
}
}
@Override
@Override
public
R
userByZx
(
String
userId
,
String
beInvitedCode
)
{
public
Map
userByZx
(
String
userId
,
String
beInvitedCode
)
{
//查询数据库,看看是否存在该用户
int
yh
=
usersMapper
.
getuserIdById
(
userId
);
/**
/**
* 判断用户推荐人的邀请码是否为空,空的话填写1
* 判断用户推荐人的邀请码是否为空,空的话填写1
*/
*/
if
(
null
==
beInvitedCode
||
""
==
beInvitedCode
)
{
if
(
null
==
beInvitedCode
||
""
==
beInvitedCode
&&
0
==
yh
)
{
beInvitedCode
=
String
.
valueOf
(
1
);
beInvitedCode
=
"1"
;
}
// 插入用户手机号与推荐人邀请码
usersMapper
.
insertbyint
(
userId
,
beInvitedCode
);
}
else
if
(
"1"
.
equals
(
beInvitedCode
)){
//用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改
//用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改
User
user
=
usersMapper
.
getByBeInvitedCode
(
beInvitedCode
);
User
user
=
usersMapper
.
getByBeInvitedCode
(
beInvitedCode
);
int
ida
=
user
.
getId
();
int
ida
=
user
.
getId
();
...
@@ -91,16 +94,20 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
...
@@ -91,16 +94,20 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
int
idb
=
usersMapper
.
beInvitedCode1
(
beInvitedCode
);
int
idb
=
usersMapper
.
beInvitedCode1
(
beInvitedCode
);
//判断被邀请用户的创建时间是否比推荐人的用户时间晚
//判断被邀请用户的创建时间是否比推荐人的用户时间晚
if
(
idb
<
ida
){
if
(
idb
<
ida
){
return
R
.
error
(
1
,
"邀请码无效,请重新填写!"
);
Map
map
=
new
HashMap
();
R
.
error
(
1
,
"注册失败!邀请码无效,请重新填写!"
);
map
.
put
(
"code:"
,
1
);
map
.
put
(
"msg:"
,
"注册失败!邀请码无效,请重新填写!"
);
return
map
;
}
}
// 插入用户手机号与推荐人邀请码
}
usersMapper
.
insertbyint
(
userId
,
beInvitedCode
);
//根据插入的用户手机号,查询用户唯一ID
//根据插入的用户手机号,查询用户唯一ID
Integer
yqm
=
usersMapper
.
ByUserId
(
userId
);
long
yqm
=
usersMapper
.
ByUserId
(
userId
);
//用户唯一ID调用生成6位邀请码
//用户唯一ID调用生成6位邀请码
String
inviteCode
=
ShareCodeUtil
.
idToCode
(
yqm
);
String
inviteCode
=
ShareCodeUtil
.
idToCode
(
yqm
);
//根据用户手机号,更新用户信息
//根据用户手机号,更新用户信息
user
=
new
User
();
User
user
=
new
User
();
user
.
setInviteCode
(
inviteCode
);
user
.
setInviteCode
(
inviteCode
);
user
.
setUserLevel
(
0
);
user
.
setUserLevel
(
0
);
usersMapper
.
updateById
(
user
);
usersMapper
.
updateById
(
user
);
...
@@ -126,13 +133,26 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
...
@@ -126,13 +133,26 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
//更新直推表用户数据
//更新直推表用户数据
recommendUserMapper
.
updateById
(
recommendUser
);
recommendUserMapper
.
updateById
(
recommendUser
);
}
else
{
}
else
{
return
R
.
error
(
1
,
"验证码无效"
);
Map
map
=
new
HashMap
();
R
.
error
(
1
,
"注册失败!验证码无效,请重新填写!"
);
map
.
put
(
"code:"
,
1
);
map
.
put
(
"msg:"
,
"注册失败!验证码无效,请重新填写!"
);
return
map
;
}
}
//递归向上修改团队用户信息表
//递归向上修改团队用户信息表
teamgg
(
beInvitedCode
);
teamgg
(
beInvitedCode
);
return
R
.
ok
(
"直推表普通用户数量+1成功!"
,
0
);
Map
map
=
new
HashMap
();
R
.
ok
(
"直推表普通用户数量+1成功!"
,
0
);
map
.
put
(
"code:"
,
0
);
map
.
put
(
"msg:"
,
"直推表普通用户数量+1成功"
);
return
map
;
}
@Override
public
Integer
getuserIdById
(
String
userId
)
{
return
null
;
}
}
//私有构造方法-传入被邀请码
//私有构造方法-传入被邀请码
private
R
teamgg
(
String
beInvitedCode
)
{
private
R
teamgg
(
String
beInvitedCode
)
{
//用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改
//用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UploadController.java
View file @
310d2c7f
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
import
cn.wisenergy.common.utils.Result
;
import
cn.wisenergy.model.app.Page
;
import
cn.wisenergy.model.app.shopZx
;
import
cn.wisenergy.service.app.UploadService
;
import
cn.wisenergy.service.app.UploadService
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -47,10 +50,12 @@ public class UploadController {
...
@@ -47,10 +50,12 @@ public class UploadController {
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
@ApiOperation
(
value
=
"
上传视频,返回路径给前台"
,
notes
=
"上传视频,
返回路径给前台"
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"
资讯信息-文字/视频上传接口"
,
notes
=
"
返回路径给前台"
,
httpMethod
=
"POST"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"zxField"
,
value
=
"资讯文字"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"zxField"
,
value
=
"资讯文字"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户手机号"
,
required
=
true
,
dataType
=
"String"
)})
@ApiImplicitParam
(
name
=
"file"
,
value
=
"视频文件"
,
dataType
=
"MultipartFile"
),
@ApiImplicitParam
(
name
=
"zxAddress"
,
value
=
"资讯发布地址"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户手机号(发布人)"
,
required
=
true
,
dataType
=
"String"
)})
@RequestMapping
(
value
=
"/uploadVideo"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/uploadVideo"
,
method
=
RequestMethod
.
POST
)
public
Map
<
String
,
Object
>
uploadVideo
(
MultipartFile
file
,
HttpServletRequest
request
,
String
userId
,
String
zxField
,
String
zxAddress
)
throws
Exception
{
public
Map
<
String
,
Object
>
uploadVideo
(
MultipartFile
file
,
HttpServletRequest
request
,
String
userId
,
String
zxField
,
String
zxAddress
)
throws
Exception
{
return
uploadService
.
uploadVideo
(
file
,
request
,
userId
,
zxField
,
zxAddress
);
return
uploadService
.
uploadVideo
(
file
,
request
,
userId
,
zxField
,
zxAddress
);
...
@@ -63,9 +68,11 @@ public class UploadController {
...
@@ -63,9 +68,11 @@ public class UploadController {
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
@ApiOperation
(
value
=
"
上传图片,返回路径给前台"
,
notes
=
"上传图片,
返回路径给前台"
,
httpMethod
=
"POST"
,
produces
=
"application/json; charset=UTF-8"
)
@ApiOperation
(
value
=
"
资讯信息-文字/单图片上传接口"
,
notes
=
"
返回路径给前台"
,
httpMethod
=
"POST"
,
produces
=
"application/json; charset=UTF-8"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"zxField"
,
value
=
"资讯文字"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"zxField"
,
value
=
"资讯文字"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"file"
,
value
=
"单图片"
,
dataType
=
"MultipartFile"
),
@ApiImplicitParam
(
name
=
"zxAddress"
,
value
=
"资讯发布地址"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户手机号"
,
required
=
true
,
dataType
=
"String"
)})
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户手机号"
,
required
=
true
,
dataType
=
"String"
)})
@RequestMapping
(
value
=
"/uploadImage"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/uploadImage"
,
method
=
RequestMethod
.
POST
)
public
Map
<
String
,
Object
>
uploadImage
(
MultipartFile
file
,
HttpServletRequest
request
,
String
userId
,
String
zxField
,
String
zxAddress
)
throws
Exception
{
public
Map
<
String
,
Object
>
uploadImage
(
MultipartFile
file
,
HttpServletRequest
request
,
String
userId
,
String
zxField
,
String
zxAddress
)
throws
Exception
{
...
@@ -86,9 +93,10 @@ public class UploadController {
...
@@ -86,9 +93,10 @@ public class UploadController {
*/
*/
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UploadController
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UploadController
.
class
);
@ApiOperation
(
value
=
"
上传多图片,返回路径给前台
"
,
notes
=
"上传图片,返回路径给前台"
,
httpMethod
=
"POST"
,
produces
=
"application/json; charset=UTF-8"
)
@ApiOperation
(
value
=
"
资讯信息-文字/多图片上传接口
"
,
notes
=
"上传图片,返回路径给前台"
,
httpMethod
=
"POST"
,
produces
=
"application/json; charset=UTF-8"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"zxField"
,
value
=
"资讯文字"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"zxField"
,
value
=
"资讯文字"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"file[]"
,
value
=
"多图片"
,
dataType
=
"MultipartFile"
),
@ApiImplicitParam
(
name
=
"zxAddress"
,
value
=
"发表地址"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"zxAddress"
,
value
=
"发表地址"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户手机号"
,
required
=
true
,
dataType
=
"String"
)})
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户手机号"
,
required
=
true
,
dataType
=
"String"
)})
@RequestMapping
(
"/multipleImageUpload"
)
@RequestMapping
(
"/multipleImageUpload"
)
...
@@ -97,5 +105,23 @@ public class UploadController {
...
@@ -97,5 +105,23 @@ public class UploadController {
}
}
/**
* 资讯分页展示接口
* @param pageOffset
* @param pageSize
* @return
*/
@ApiOperation
(
value
=
"资讯信息-文字/多图片上传接口"
,
notes
=
"上传图片,返回路径给前台"
,
httpMethod
=
"POST"
,
produces
=
"application/json; charset=UTF-8"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"beginPos"
,
value
=
"从几开始"
,
required
=
true
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"展示数量(条数)"
,
required
=
true
,
dataType
=
"Integer"
)})
@RequestMapping
(
value
=
"/shop"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
public
Result
find
(
Integer
beginPos
,
Integer
pageSize
)
{
Page
<
shopZx
>
shopZxPage
=
(
Page
<
shopZx
>)
uploadService
.
getList
(
beginPos
,
pageSize
);
return
new
Result
(
String
.
valueOf
(
0
),
"success"
,
shopZxPage
);
}
}
}
\ No newline at end of file
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/loginController.java
View file @
310d2c7f
...
@@ -105,11 +105,11 @@ public class loginController {
...
@@ -105,11 +105,11 @@ public class loginController {
@ApiOperation
(
value
=
"用户注册"
,
notes
=
"用户注册"
,
httpMethod
=
"POST"
,
produces
=
"application/json; charset=UTF-8"
)
@ApiOperation
(
value
=
"用户注册"
,
notes
=
"用户注册"
,
httpMethod
=
"POST"
,
produces
=
"application/json; charset=UTF-8"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户手机号"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户手机号"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"beInvitedCode"
,
value
=
"推荐人邀请码"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"beInvitedCode"
,
value
=
"推荐人邀请码"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"sms"
,
value
=
"验证码"
,
dataType
=
"String"
)
@ApiImplicitParam
(
name
=
"sms"
,
value
=
"验证码"
,
required
=
true
,
dataType
=
"String"
)
})
})
@RequestMapping
(
"/register"
)
@RequestMapping
(
"/register"
)
public
Result
register
(
@RequestParam
String
userId
,
@RequestParam
String
beInvitedCode
,
String
sms
)
throws
Exception
{
public
Result
register
(
@RequestParam
String
userId
,
String
beInvitedCode
,
@RequestParam
String
sms
)
throws
Exception
{
User
users
=
null
;
User
users
=
null
;
String
key
=
StringUtil
.
formatKeyWithPrefix
(
Constants
.
RedisKey
.
PROJECT_PRIFIX
,
Constants
.
RedisKey
.
SMS_PRIFIX
,
userId
,
Constants
.
Sms
.
CodeType
.
LOGIN_OR_REGISTER
+
""
);
String
key
=
StringUtil
.
formatKeyWithPrefix
(
Constants
.
RedisKey
.
PROJECT_PRIFIX
,
Constants
.
RedisKey
.
SMS_PRIFIX
,
userId
,
Constants
.
Sms
.
CodeType
.
LOGIN_OR_REGISTER
+
""
);
String
redisCode
=
redisUtils
.
getValue
(
key
);
String
redisCode
=
redisUtils
.
getValue
(
key
);
...
@@ -121,6 +121,10 @@ public class loginController {
...
@@ -121,6 +121,10 @@ public class loginController {
if
(!
userId
.
matches
(
Constants
.
RegConstant
.
PHONE_REGSTR
)){
if
(!
userId
.
matches
(
Constants
.
RegConstant
.
PHONE_REGSTR
)){
throw
new
BaseException
(
ResultEnum
.
PHONE_ERROR
);
throw
new
BaseException
(
ResultEnum
.
PHONE_ERROR
);
}
}
// if(userId.equals())){
// throw new BaseException(ResultEnum.PHONE_ERROR);
// }
usersService
.
userByZx
(
userId
,
beInvitedCode
);
usersService
.
userByZx
(
userId
,
beInvitedCode
);
return
ResultUtils
.
returnFail
(
"注册成功!"
,
"0"
);
return
ResultUtils
.
returnFail
(
"注册成功!"
,
"0"
);
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/config/MvcConfiguration.java
View file @
310d2c7f
...
@@ -19,6 +19,7 @@ import org.springframework.web.servlet.config.annotation.CorsRegistry;
...
@@ -19,6 +19,7 @@ import org.springframework.web.servlet.config.annotation.CorsRegistry;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
...
@@ -34,6 +35,7 @@ import java.util.List;
...
@@ -34,6 +35,7 @@ import java.util.List;
* @author WYY
* @author WYY
* @date 2019/4/18
* @date 2019/4/18
*/
*/
@EnableSwagger2
@Configuration
@Configuration
public
class
MvcConfiguration
extends
WebMvcConfigurationSupport
{
public
class
MvcConfiguration
extends
WebMvcConfigurationSupport
{
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/shiro/ShiroConfig.java
View file @
310d2c7f
...
@@ -60,7 +60,8 @@ public class ShiroConfig {
...
@@ -60,7 +60,8 @@ public class ShiroConfig {
filterChainDefinitionMap
.
put
(
"/swagger-ui.html"
,
"anon"
);
// swagger接口-匿名访问
filterChainDefinitionMap
.
put
(
"/swagger-ui.html"
,
"anon"
);
// swagger接口-匿名访问
filterChainDefinitionMap
.
put
(
"/swagger/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/swagger/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/user/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/user/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/api/user/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/ZX/**"
,
"anon"
);
//资讯的访问地址
filterChainDefinitionMap
.
put
(
"/api/user/**"
,
"anon"
);
//登录注册路径
filterChainDefinitionMap
.
put
(
"/webjars/springfox-swagger-ui/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/webjars/springfox-swagger-ui/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/swagger-resources/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/swagger-resources/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/v2/api-docs"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/v2/api-docs"
,
"anon"
);
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/sms/interceptor/LoginInterceptor.java
View file @
310d2c7f
...
@@ -31,7 +31,12 @@ public class LoginInterceptor extends HandlerInterceptorAdapter {
...
@@ -31,7 +31,12 @@ public class LoginInterceptor extends HandlerInterceptorAdapter {
/**
/**
* 直接放行的接口
* 直接放行的接口
*/
*/
public
static
String
[]
EXCLUDE_URI
=
new
String
[]{
"/api/user/login"
,
"/pay/alipay/notify"
,
"/pay/alipay/return"
,
"/user/wechat/callback"
};
public
static
String
[]
EXCLUDE_URI
=
new
String
[]{
"/api/user/login"
,
"/pay/alipay/notify"
,
"/ZX/**"
,
"/pay/alipay/return"
,
"/user/wechat/callback"
};
/**
/**
* 需要登录才可以访问的接口
* 需要登录才可以访问的接口
...
...
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