Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
c6b23de1
Commit
c6b23de1
authored
Oct 15, 2020
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.商家端注册;
2.优化托管出售
parent
e20ae98d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
822 additions
and
367 deletions
+822
-367
api-app/src/main/java/com/jumeirah/api/app/service/impl/AppSmsServiceImpl.java
+1
-1
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantSmsController.java
+45
-0
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantUserController.java
+7
-0
api-merchant/src/main/java/com/jumeirah/api/merchant/service/MerchantSmsService.java
+39
-0
api-merchant/src/main/java/com/jumeirah/api/merchant/service/MerchantSmsServiceImpl.java
+117
-0
api-merchant/src/main/java/com/jumeirah/api/merchant/service/MerchantUserApiService.java
+28
-0
api-system/src/main/java/com/jumeirah/api/system/controller/DownloadController.java
+79
-79
api-system/src/main/java/com/jumeirah/api/system/controller/ResourceController.java
+65
-65
api-system/src/main/java/com/jumeirah/api/system/controller/SysSmsController.java
+43
-0
api-system/src/main/java/com/jumeirah/api/system/controller/SysUserController.java
+0
-4
api-system/src/main/java/com/jumeirah/api/system/controller/UploadController.java
+98
-98
api-system/src/main/java/com/jumeirah/api/system/controller/VerificationCodeController.java
+113
-113
api-system/src/main/java/com/jumeirah/api/system/service/SysSmsService.java
+44
-0
api-system/src/main/java/com/jumeirah/api/system/service/SysSmsServiceImpl.java
+123
-0
common/src/main/java/com/jumeirah/common/entity/BusinessPlain.java
+5
-0
common/src/main/java/com/jumeirah/common/param/BusinessPlainPageParam.java
+3
-0
common/src/main/java/com/jumeirah/common/service/impl/BusinessPlainServiceImpl.java
+1
-1
common/src/main/java/com/jumeirah/common/vo/BusinessPlainQueryForAppVo.java
+8
-4
common/src/main/resources/mapper/BusinessPlainMapper.xml
+3
-2
No files found.
api-app/src/main/java/com/jumeirah/api/app/service/impl/AppSmsServiceImpl.java
View file @
c6b23de1
...
...
@@ -109,7 +109,7 @@ public class AppSmsServiceImpl implements AppSmsService {
*/
String
getRandomCode
()
{
// 如果为测试环境则生成默认
if
(
profiles
.
equals
(
DEV_PROFILE
))
{
if
(
profiles
.
equals
(
DEV_PROFILE
)
||
profiles
.
equals
(
"test"
)
)
{
return
DEFAULT_DEV_SMS_CODE
;
}
else
{
return
Arrays
.
toString
(
RandomUtil
.
randomInts
(
6
));
...
...
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantSmsController.java
0 → 100644
View file @
c6b23de1
package
com
.
jumeirah
.
api
.
merchant
.
controller
;
import
com.jumeirah.api.merchant.service.MerchantSmsService
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* APP用户 控制器
*
* @author wei
* @since 2020-09-23
*/
@Slf4j
@RestController
//@Module("api-app")
@Api
(
value
=
"短信验证码"
,
tags
=
{
"APP短信验证码相关"
})
@RequestMapping
(
"/app/sms/"
)
public
class
MerchantSmsController
extends
BaseController
{
@Autowired
private
MerchantSmsService
merchantSmsService
;
/**
* 获取注册验证码
*/
@GetMapping
(
"/registerCode"
)
@OperationLog
(
name
=
"获取注册或登陆的验证码"
,
type
=
OperationLogType
.
INFO
)
@ApiOperation
(
value
=
"获取注册或登陆的验证码"
,
response
=
Object
.
class
,
notes
=
"本地环境默认666666"
)
public
ApiResult
<
Object
>
registerOrLoginCode
(
@RequestParam
String
phoneArea
,
@RequestParam
String
phone
)
throws
Exception
{
return
merchantSmsService
.
registerCode
(
phoneArea
,
phone
);
}
}
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantUserController.java
View file @
c6b23de1
...
...
@@ -108,5 +108,12 @@ public class MerchantUserController extends BaseController {
return
merchantUserService
.
login
(
loginParam
,
response
,
language
);
}
@PostMapping
(
"/register"
)
@OperationLogIgnore
@ApiOperation
(
value
=
"注册"
,
notes
=
"商家注册"
,
response
=
LoginSysUserTokenVo
.
class
)
public
ApiResult
<
LoginSysUserTokenVo
>
register
(
@Validated
@RequestBody
LoginParam
loginParam
,
HttpServletResponse
response
,
@RequestHeader
(
required
=
false
)
String
language
)
throws
Exception
{
return
merchantUserService
.
login
(
loginParam
,
response
,
language
);
}
}
api-merchant/src/main/java/com/jumeirah/api/merchant/service/MerchantSmsService.java
0 → 100644
View file @
c6b23de1
package
com
.
jumeirah
.
api
.
merchant
.
service
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
public
interface
MerchantSmsService
{
void
deleteRegisterCode
(
String
area
,
String
number
);
/**
* 获取注册验证码
*/
ApiResult
<
Object
>
registerCode
(
String
phoneArea
,
String
phone
);
/**
* 获取注册验证码
*/
ApiResult
LoginType
(
String
area
,
String
number
);
/**
* 校验注册验证码
*
* @param area
* @param number
* @param code
* @return
*/
boolean
equalsRegisterCode
(
String
area
,
String
number
,
String
code
);
/**
* 校验验登陆证码
*
* @param area
* @param number
* @param code
* @return
*/
boolean
equalsLoginCode
(
String
area
,
String
number
,
String
code
);
}
api-merchant/src/main/java/com/jumeirah/api/merchant/service/MerchantSmsServiceImpl.java
0 → 100644
View file @
c6b23de1
package
com
.
jumeirah
.
api
.
merchant
.
service
;
import
cn.hutool.core.util.RandomUtil
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
java.time.Duration
;
import
java.util.Arrays
;
@Service
@Slf4j
public
class
MerchantSmsServiceImpl
implements
MerchantSmsService
{
/**
* 获取当前环境
*/
@Value
(
"${spring.profiles.active}"
)
private
String
profiles
;
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 测试环境
*/
private
static
final
String
DEV_PROFILE
=
"dev"
;
/**
* 测试环境默认短信验证码
*/
private
static
final
String
DEFAULT_DEV_SMS_CODE
=
"666666"
;
/**
* 短信验证码redis的key值
*/
private
static
final
String
SMS_REGIEST
=
"mer:sms:register:%s_%s"
;
/**
* 短信验证码redis的key值
*/
private
static
final
String
SMS_LOGIN
=
"mer:sms:login:%s_%s"
;
@Override
public
void
deleteRegisterCode
(
String
area
,
String
number
)
{
redisTemplate
.
delete
(
String
.
format
(
SMS_REGIEST
,
area
,
number
));
}
@Override
public
ApiResult
<
Object
>
registerCode
(
String
area
,
String
number
)
{
return
getSmsCodeApiResult
(
String
.
format
(
SMS_REGIEST
,
area
,
number
),
area
,
number
);
}
private
ApiResult
<
Object
>
getSmsCodeApiResult
(
String
key
,
String
area
,
String
number
)
{
String
randomCode
=
getRandomCode
();
// 过期时间(秒)
long
expire
=
120L
;
Duration
expireDuration
=
Duration
.
ofSeconds
(
expire
);
redisTemplate
.
opsForValue
().
set
(
key
,
randomCode
,
expireDuration
);
log
.
info
(
area
+
","
+
number
+
":"
+
randomCode
);
// TODO 需要补充调用短信平台发送短信代码 2020年09月30日09:48:42
return
ApiResult
.
ok
(
null
);
}
@Override
public
ApiResult
LoginType
(
String
area
,
String
number
)
{
return
getSmsCodeApiResult
(
String
.
format
(
SMS_LOGIN
,
area
,
number
),
area
,
number
);
}
@Override
public
boolean
equalsRegisterCode
(
String
area
,
String
number
,
String
code
)
{
return
equalsSms
(
SMS_REGIEST
,
area
,
number
,
code
);
}
private
boolean
equalsSms
(
String
type
,
String
area
,
String
number
,
String
code
)
{
String
formatKey
=
String
.
format
(
type
,
area
,
number
);
Object
key
=
redisTemplate
.
opsForValue
().
get
(
formatKey
);
if
(
key
==
null
)
{
return
false
;
}
return
String
.
valueOf
(
key
).
equals
(
code
);
}
@Override
public
boolean
equalsLoginCode
(
String
area
,
String
number
,
String
code
)
{
return
equalsSms
(
SMS_LOGIN
,
area
,
number
,
code
);
}
/**
* 生成验证码code
*
* @return
*/
String
getRandomCode
()
{
// 如果为测试环境则生成默认
if
(
profiles
.
equals
(
DEV_PROFILE
)
||
profiles
.
equals
(
"test"
))
{
return
DEFAULT_DEV_SMS_CODE
;
}
else
{
return
Arrays
.
toString
(
RandomUtil
.
randomInts
(
6
));
}
}
}
api-merchant/src/main/java/com/jumeirah/api/merchant/service/MerchantUserApiService.java
0 → 100644
View file @
c6b23de1
package
com
.
jumeirah
.
api
.
merchant
.
service
;
import
com.jumeirah.common.param.app.AppSmsRegisterParam
;
import
com.jumeirah.common.param.app.AppUserInfoParam
;
import
com.jumeirah.common.vo.app.LoginAppUserTokenVo
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
public
interface
MerchantUserApiService
{
/**
* 注册
* @param loginParam
* @param language
* @return
* @throws Exception
*/
ApiResult
<
LoginAppUserTokenVo
>
register
(
AppSmsRegisterParam
loginParam
,
String
language
)
throws
Exception
;
// ApiResult<LoginAppUserTokenVo> login(AppSmsRegisterParam loginParam, String language) throws Exception;
/**
* 修改或补充用户信息
* @param appUserInfoParam
* @return
* @throws Exception
*/
boolean
updateAppUser
(
AppUserInfoParam
appUserInfoParam
)
throws
Exception
;
}
api-system/src/main/java/com/jumeirah/api/system/controller/DownloadController.java
View file @
c6b23de1
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
jumeirah
.
api
.
system
.
controller
;
import
io.geekidea.springbootplus.config.properties.SpringBootPlusProperties
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.log.annotation.Module
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.geekidea.springbootplus.framework.util.DownloadUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 下载控制器
*
* @author geekidea
* @date 2019/8/20
* @since 1.2.1-RELEASE
*/
@Slf4j
@Controller
@RequestMapping
(
"/sys/download"
)
@Module
(
"system"
)
@Api
(
value
=
"文件下载"
,
tags
=
{
"文件下载"
})
public
class
DownloadController
{
@Autowired
private
SpringBootPlusProperties
springBootPlusProperties
;
/**
* 下载文件
*/
@GetMapping
(
"/{downloadFileName}"
)
@OperationLog
(
name
=
"下载文件"
,
type
=
OperationLogType
.
download
)
@ApiOperation
(
value
=
"下载文件"
,
notes
=
"下载文件"
,
response
=
ApiResult
.
class
)
public
void
download
(
@PathVariable
(
required
=
true
)
String
downloadFileName
,
HttpServletResponse
response
)
throws
Exception
{
// 下载目录,既是上传目录
String
downloadDir
=
springBootPlusProperties
.
getUploadPath
();
// 允许下载的文件后缀
List
<
String
>
allowFileExtensions
=
springBootPlusProperties
.
getAllowDownloadFileExtensions
();
// 文件下载,使用默认下载处理器
// 文件下载,使用自定义下载处理器
DownloadUtil
.
download
(
downloadDir
,
downloadFileName
,
allowFileExtensions
,
response
,
(
dir
,
fileName
,
file
,
fileExtension
,
contentType
,
length
)
->
{
// 下载自定义处理,返回true:执行下载,false:取消下载
log
.
info
(
"dir = "
+
dir
);
log
.
info
(
"fileName = "
+
fileName
);
log
.
info
(
"file = "
+
file
);
log
.
info
(
"fileExtension = "
+
fileExtension
);
log
.
info
(
"contentType = "
+
contentType
);
log
.
info
(
"length = "
+
length
);
return
true
;
});
}
}
/
//
*
//
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
//
*
//
* Licensed under the Apache License, Version 2.0 (the "License");
//
* you may not use this file except in compliance with the License.
//
* You may obtain a copy of the License at
//
*
//
* http://www.apache.org/licenses/LICENSE-2.0
//
*
//
* Unless required by applicable law or agreed to in writing, software
//
* distributed under the License is distributed on an "AS IS" BASIS,
//
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
* See the License for the specific language governing permissions and
//
* limitations under the License.
//
*/
//
//
package com.jumeirah.api.system.controller;
//
//
import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties;
//
import io.geekidea.springbootplus.framework.common.api.ApiResult;
//
import io.geekidea.springbootplus.framework.log.annotation.Module;
//
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
//
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
//
import io.geekidea.springbootplus.framework.util.DownloadUtil;
//
import io.swagger.annotations.Api;
//
import io.swagger.annotations.ApiOperation;
//
import lombok.extern.slf4j.Slf4j;
//
import org.springframework.beans.factory.annotation.Autowired;
//
import org.springframework.stereotype.Controller;
//
import org.springframework.web.bind.annotation.GetMapping;
//
import org.springframework.web.bind.annotation.PathVariable;
//
import org.springframework.web.bind.annotation.RequestMapping;
//
//
import javax.servlet.http.HttpServletResponse;
//
import java.util.List;
//
/
//
**
//
* 下载控制器
//
*
//
* @author geekidea
//
* @date 2019/8/20
//
* @since 1.2.1-RELEASE
//
*/
//
@Slf4j
//
@Controller
//
@RequestMapping("/sys/download")
//
@Module("system")
//
@Api(value = "文件下载", tags = {"文件下载"})
//
public class DownloadController {
//
//
@Autowired
//
private SpringBootPlusProperties springBootPlusProperties;
//
//
/**
//
* 下载文件
//
*/
//
@GetMapping("/{downloadFileName}")
//
@OperationLog(name = "下载文件", type = OperationLogType.download)
//
@ApiOperation(value = "下载文件", notes = "下载文件", response = ApiResult.class)
//
public void download(@PathVariable(required = true) String downloadFileName, HttpServletResponse response) throws Exception {
//
// 下载目录,既是上传目录
//
String downloadDir = springBootPlusProperties.getUploadPath();
//
// 允许下载的文件后缀
//
List<String> allowFileExtensions = springBootPlusProperties.getAllowDownloadFileExtensions();
//
// 文件下载,使用默认下载处理器
//
// 文件下载,使用自定义下载处理器
//
DownloadUtil.download(downloadDir, downloadFileName, allowFileExtensions, response, (dir, fileName, file, fileExtension, contentType, length) -> {
//
// 下载自定义处理,返回true:执行下载,false:取消下载
//
log.info("dir = " + dir);
//
log.info("fileName = " + fileName);
//
log.info("file = " + file);
//
log.info("fileExtension = " + fileExtension);
//
log.info("contentType = " + contentType);
//
log.info("length = " + length);
//
return true;
//
});
//
}
//
//
}
api-system/src/main/java/com/jumeirah/api/system/controller/ResourceController.java
View file @
c6b23de1
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
jumeirah
.
api
.
system
.
controller
;
import
io.geekidea.springbootplus.config.properties.SpringBootPlusProperties
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.log.annotation.Module
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 图片等文件资源访问控制器
* /api/resource 访问路径 用于区分 文件访问虚拟目录映射 /resource
*
* @author geekidea
* @date 2019/8/20
* @since 1.2.1-RELEASE
*/
@Slf4j
@Controller
@RequestMapping
(
"/api/resource"
)
@Module
(
"system"
)
@Api
(
value
=
"资源访问"
,
tags
=
{
"资源访问"
})
public
class
ResourceController
{
@Autowired
private
SpringBootPlusProperties
springBootPlusProperties
;
/**
* 访问资源
*/
@GetMapping
(
"/image/{imageFileName}"
)
@OperationLog
(
name
=
"访问资源"
,
type
=
OperationLogType
.
ADD
)
@ApiOperation
(
value
=
"访问资源"
,
response
=
ApiResult
.
class
)
public
void
getImage
(
@PathVariable
(
required
=
true
)
String
imageFileName
,
HttpServletResponse
response
)
throws
Exception
{
log
.
info
(
"imageFileName:{}"
,
imageFileName
);
// 重定向到图片访问路径
response
.
sendRedirect
(
springBootPlusProperties
.
getResourceAccessPath
()
+
imageFileName
);
}
}
/
//
*
//
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
//
*
//
* Licensed under the Apache License, Version 2.0 (the "License");
//
* you may not use this file except in compliance with the License.
//
* You may obtain a copy of the License at
//
*
//
* http://www.apache.org/licenses/LICENSE-2.0
//
*
//
* Unless required by applicable law or agreed to in writing, software
//
* distributed under the License is distributed on an "AS IS" BASIS,
//
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
* See the License for the specific language governing permissions and
//
* limitations under the License.
//
*/
//
//
package com.jumeirah.api.system.controller;
//
//
import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties;
//
import io.geekidea.springbootplus.framework.common.api.ApiResult;
//
import io.geekidea.springbootplus.framework.log.annotation.Module;
//
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
//
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
//
import io.swagger.annotations.Api;
//
import io.swagger.annotations.ApiOperation;
//
import lombok.extern.slf4j.Slf4j;
//
import org.springframework.beans.factory.annotation.Autowired;
//
import org.springframework.stereotype.Controller;
//
import org.springframework.web.bind.annotation.GetMapping;
//
import org.springframework.web.bind.annotation.PathVariable;
//
import org.springframework.web.bind.annotation.RequestMapping;
//
//
import javax.servlet.http.HttpServletResponse;
//
/
//
**
//
* 图片等文件资源访问控制器
//
* /api/resource 访问路径 用于区分 文件访问虚拟目录映射 /resource
//
*
//
* @author geekidea
//
* @date 2019/8/20
//
* @since 1.2.1-RELEASE
//
*/
//
@Slf4j
//
@Controller
//
@RequestMapping("/api/resource")
//
@Module("system")
//
@Api(value = "资源访问", tags = {"资源访问"})
//
public class ResourceController {
//
//
@Autowired
//
private SpringBootPlusProperties springBootPlusProperties;
//
//
/**
//
* 访问资源
//
*/
//
@GetMapping("/image/{imageFileName}")
//
@OperationLog(name = "访问资源", type = OperationLogType.ADD)
//
@ApiOperation(value = "访问资源", response = ApiResult.class)
//
public void getImage(@PathVariable(required = true) String imageFileName, HttpServletResponse response) throws Exception {
//
log.info("imageFileName:{}", imageFileName);
//
// 重定向到图片访问路径
//
response.sendRedirect(springBootPlusProperties.getResourceAccessPath() + imageFileName);
//
}
//
//
}
api-system/src/main/java/com/jumeirah/api/system/controller/SysSmsController.java
0 → 100644
View file @
c6b23de1
package
com
.
jumeirah
.
api
.
system
.
controller
;
import
com.jumeirah.api.system.service.SysSmsService
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* APP用户 控制器
*
* @author wei
* @since 2020-09-23
*/
@Slf4j
@RestController
@Api
(
value
=
"短信验证码"
,
tags
=
{
"短信验证码相关"
})
@RequestMapping
(
"/sys/sms/"
)
public
class
SysSmsController
extends
BaseController
{
@Autowired
private
SysSmsService
appSmsService
;
/**
* 获取注册验证码
*/
@GetMapping
(
"/registerCode"
)
@OperationLog
(
name
=
"获取注册验证码"
,
type
=
OperationLogType
.
INFO
)
@ApiOperation
(
value
=
"获取注册验证码"
,
response
=
Object
.
class
,
notes
=
"本地环境默认666666"
)
public
ApiResult
<
Object
>
registerOrLoginCode
(
@RequestParam
String
phoneArea
,
@RequestParam
String
phone
)
throws
Exception
{
return
appSmsService
.
registerOrLoginCode
(
phoneArea
,
phone
);
}
}
api-system/src/main/java/com/jumeirah/api/system/controller/SysUserController.java
View file @
c6b23de1
...
...
@@ -23,7 +23,6 @@ import com.jumeirah.common.param.sysuser.UpdatePasswordParam;
import
com.jumeirah.common.param.sysuser.UploadHeadParam
;
import
com.jumeirah.common.service.SysUserService
;
import
com.jumeirah.common.vo.SysUserQueryVo
;
import
io.geekidea.springbootplus.config.properties.SpringBootPlusProperties
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
...
...
@@ -63,9 +62,6 @@ public class SysUserController extends BaseController {
@Autowired
private
SysUserService
sysUserService
;
@Autowired
private
SpringBootPlusProperties
springBootPlusProperties
;
/**
* 添加系统用户
*/
...
...
api-system/src/main/java/com/jumeirah/api/system/controller/UploadController.java
View file @
c6b23de1
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
jumeirah
.
api
.
system
.
controller
;
import
io.geekidea.springbootplus.config.properties.SpringBootPlusProperties
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.log.annotation.Module
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.geekidea.springbootplus.framework.util.UploadUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang3.RandomStringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
/**
* 上传控制器
*
* @author geekidea
* @date 2019/8/20
* @since 1.2.1-RELEASE
*/
@Slf4j
@RestController
@RequestMapping
(
"/sys/upload"
)
@Module
(
"system"
)
@Api
(
value
=
"文件上传"
,
tags
=
{
"文件上传"
})
public
class
UploadController
{
@Autowired
private
SpringBootPlusProperties
springBootPlusProperties
;
/**
* 上传单个文件
*
* @return
*/
@PostMapping
@OperationLog
(
name
=
"上传单个文件"
,
type
=
OperationLogType
.
UPLOAD
)
@ApiOperation
(
value
=
"上传单个文件"
,
response
=
ApiResult
.
class
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"file"
,
value
=
"文件"
,
required
=
true
,
dataType
=
"__file"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"类型 head:头像"
,
required
=
true
)
})
public
ApiResult
<
String
>
upload
(
@RequestParam
(
"file"
)
MultipartFile
multipartFile
,
@RequestParam
(
"type"
)
String
type
)
throws
Exception
{
log
.
info
(
"multipartFile = "
+
multipartFile
);
log
.
info
(
"ContentType = "
+
multipartFile
.
getContentType
());
log
.
info
(
"OriginalFilename = "
+
multipartFile
.
getOriginalFilename
());
log
.
info
(
"Name = "
+
multipartFile
.
getName
());
log
.
info
(
"Size = "
+
multipartFile
.
getSize
());
log
.
info
(
"type = "
+
type
);
// 上传文件,返回保存的文件名称
String
saveFileName
=
UploadUtil
.
upload
(
springBootPlusProperties
.
getUploadPath
(),
multipartFile
,
originalFilename
->
{
// 文件后缀
String
fileExtension
=
FilenameUtils
.
getExtension
(
originalFilename
);
// 这里可自定义文件名称,比如按照业务类型/文件格式/日期
String
dateString
=
LocalDateTime
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmssS"
))
+
RandomStringUtils
.
randomNumeric
(
6
);
String
fileName
=
dateString
+
"."
+
fileExtension
;
return
fileName
;
});
// 上传成功之后,返回访问路径,请根据实际情况设置
String
fileAccessPath
=
springBootPlusProperties
.
getResourceAccessUrl
()
+
saveFileName
;
log
.
info
(
"fileAccessPath:{}"
,
fileAccessPath
);
return
ApiResult
.
ok
(
fileAccessPath
);
}
}
/
//
*
//
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
//
*
//
* Licensed under the Apache License, Version 2.0 (the "License");
//
* you may not use this file except in compliance with the License.
//
* You may obtain a copy of the License at
//
*
//
* http://www.apache.org/licenses/LICENSE-2.0
//
*
//
* Unless required by applicable law or agreed to in writing, software
//
* distributed under the License is distributed on an "AS IS" BASIS,
//
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
* See the License for the specific language governing permissions and
//
* limitations under the License.
//
*/
//
//
package com.jumeirah.api.system.controller;
//
//
import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties;
//
import io.geekidea.springbootplus.framework.common.api.ApiResult;
//
import io.geekidea.springbootplus.framework.log.annotation.Module;
//
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
//
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
//
import io.geekidea.springbootplus.framework.util.UploadUtil;
//
import io.swagger.annotations.Api;
//
import io.swagger.annotations.ApiImplicitParam;
//
import io.swagger.annotations.ApiImplicitParams;
//
import io.swagger.annotations.ApiOperation;
//
import lombok.extern.slf4j.Slf4j;
//
import org.apache.commons.io.FilenameUtils;
//
import org.apache.commons.lang3.RandomStringUtils;
//
import org.springframework.beans.factory.annotation.Autowired;
//
import org.springframework.web.bind.annotation.PostMapping;
//
import org.springframework.web.bind.annotation.RequestMapping;
//
import org.springframework.web.bind.annotation.RequestParam;
//
import org.springframework.web.bind.annotation.RestController;
//
import org.springframework.web.multipart.MultipartFile;
//
//
import java.time.LocalDateTime;
//
import java.time.format.DateTimeFormatter;
//
/
//
**
//
* 上传控制器
//
*
//
* @author geekidea
//
* @date 2019/8/20
//
* @since 1.2.1-RELEASE
//
*/
//
@Slf4j
//
@RestController
//
@RequestMapping("/sys/upload")
//
@Module("system")
//
@Api(value = "文件上传", tags = {"文件上传"})
//
public class UploadController {
//
//
@Autowired
//
private SpringBootPlusProperties springBootPlusProperties;
//
//
/**
//
* 上传单个文件
//
*
//
* @return
//
*/
//
@PostMapping
//
@OperationLog(name = "上传单个文件", type = OperationLogType.UPLOAD)
//
@ApiOperation(value = "上传单个文件", response = ApiResult.class)
//
@ApiImplicitParams({
//
@ApiImplicitParam(name = "file", value = "文件", required = true, dataType = "__file"),
//
@ApiImplicitParam(name = "type", value = "类型 head:头像", required = true)
//
})
//
public ApiResult<String> upload(@RequestParam("file") MultipartFile multipartFile,
//
@RequestParam("type") String type) throws Exception {
//
log.info("multipartFile = " + multipartFile);
//
log.info("ContentType = " + multipartFile.getContentType());
//
log.info("OriginalFilename = " + multipartFile.getOriginalFilename());
//
log.info("Name = " + multipartFile.getName());
//
log.info("Size = " + multipartFile.getSize());
//
log.info("type = " + type);
//
//
// 上传文件,返回保存的文件名称
//
String saveFileName = UploadUtil.upload(springBootPlusProperties.getUploadPath(), multipartFile, originalFilename -> {
//
// 文件后缀
//
String fileExtension = FilenameUtils.getExtension(originalFilename);
//
// 这里可自定义文件名称,比如按照业务类型/文件格式/日期
//
String dateString = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssS")) + RandomStringUtils.randomNumeric(6);
//
String fileName = dateString + "." + fileExtension;
//
return fileName;
//
});
//
//
// 上传成功之后,返回访问路径,请根据实际情况设置
//
//
String fileAccessPath = springBootPlusProperties.getResourceAccessUrl() + saveFileName;
//
log.info("fileAccessPath:{}", fileAccessPath);
//
//
return ApiResult.ok(fileAccessPath);
//
}
//
//
}
api-system/src/main/java/com/jumeirah/api/system/controller/VerificationCodeController.java
View file @
c6b23de1
This diff is collapsed.
Click to expand it.
api-system/src/main/java/com/jumeirah/api/system/service/SysSmsService.java
0 → 100644
View file @
c6b23de1
package
com
.
jumeirah
.
api
.
system
.
service
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
public
interface
SysSmsService
{
void
deleteRegisterCode
(
String
area
,
String
number
);
/**
* 获取注册验证码
*/
ApiResult
<
Object
>
registerOrLoginCode
(
String
phoneArea
,
String
phone
);
/**
* 获取注册验证码
*/
ApiResult
<
Object
>
registerCode
(
String
area
,
String
phone
);
/**
* 获取注册验证码
*/
ApiResult
LoginType
(
String
area
,
String
number
);
/**
* 校验注册验证码
*
* @param area
* @param number
* @param code
* @return
*/
boolean
equalsRegisterCode
(
String
area
,
String
number
,
String
code
);
/**
* 校验验登陆证码
*
* @param area
* @param number
* @param code
* @return
*/
boolean
equalsLoginCode
(
String
area
,
String
number
,
String
code
);
}
api-system/src/main/java/com/jumeirah/api/system/service/SysSmsServiceImpl.java
0 → 100644
View file @
c6b23de1
package
com
.
jumeirah
.
api
.
system
.
service
;
import
cn.hutool.core.util.RandomUtil
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
java.time.Duration
;
import
java.util.Arrays
;
@Service
@Slf4j
public
class
SysSmsServiceImpl
implements
SysSmsService
{
/**
* 获取当前环境
*/
@Value
(
"${spring.profiles.active}"
)
private
String
profiles
;
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 测试环境
*/
private
static
final
String
DEV_PROFILE
=
"dev"
;
/**
* 测试环境默认短信验证码
*/
private
static
final
String
DEFAULT_DEV_SMS_CODE
=
"666666"
;
/**
* 短信验证码redis的key值
*/
private
static
final
String
SMS_REGIEST
=
"sys:sms:register:%s_%s"
;
/**
* 短信验证码redis的key值
*/
private
static
final
String
SMS_LOGIN
=
"sys:sms:login:%s_%s"
;
@Override
public
void
deleteRegisterCode
(
String
area
,
String
number
)
{
redisTemplate
.
delete
(
String
.
format
(
SMS_REGIEST
,
area
,
number
));
}
@Override
public
ApiResult
<
Object
>
registerOrLoginCode
(
String
area
,
String
phone
)
{
return
getSmsCodeApiResult
(
String
.
format
(
SMS_REGIEST
,
area
,
phone
),
area
,
phone
);
}
@Override
public
ApiResult
<
Object
>
registerCode
(
String
area
,
String
phone
)
{
return
getSmsCodeApiResult
(
String
.
format
(
SMS_REGIEST
,
area
,
phone
),
area
,
phone
);
}
private
ApiResult
<
Object
>
getSmsCodeApiResult
(
String
key
,
String
area
,
String
number
)
{
String
randomCode
=
getRandomCode
();
// 过期时间(秒)
long
expire
=
120L
;
Duration
expireDuration
=
Duration
.
ofSeconds
(
expire
);
redisTemplate
.
opsForValue
().
set
(
key
,
randomCode
,
expireDuration
);
// SmsCode smsCode = new SmsCode();
// smsCode.setSmsCode(randomCode);
// log.info(area + "," + number + ":" + randomCode);
// TODO 需要补充调用短信平台发送短信代码 2020年09月30日09:48:42
return
ApiResult
.
ok
(
null
);
}
@Override
public
ApiResult
LoginType
(
String
area
,
String
number
)
{
return
getSmsCodeApiResult
(
String
.
format
(
SMS_LOGIN
,
area
,
number
),
area
,
number
);
}
@Override
public
boolean
equalsRegisterCode
(
String
area
,
String
number
,
String
code
)
{
return
equalsSms
(
SMS_REGIEST
,
area
,
number
,
code
);
}
private
boolean
equalsSms
(
String
type
,
String
area
,
String
number
,
String
code
)
{
String
formatKey
=
String
.
format
(
type
,
area
,
number
);
Object
key
=
redisTemplate
.
opsForValue
().
get
(
formatKey
);
if
(
key
==
null
)
{
return
false
;
}
return
String
.
valueOf
(
key
).
equals
(
code
);
}
@Override
public
boolean
equalsLoginCode
(
String
area
,
String
number
,
String
code
)
{
return
equalsSms
(
SMS_LOGIN
,
area
,
number
,
code
);
}
/**
* 生成验证码code
*
* @return
*/
String
getRandomCode
()
{
// 如果为测试环境则生成默认
if
(
profiles
.
equals
(
DEV_PROFILE
)
||
profiles
.
equals
(
"test"
))
{
return
DEFAULT_DEV_SMS_CODE
;
}
else
{
return
Arrays
.
toString
(
RandomUtil
.
randomInts
(
6
));
}
}
}
common/src/main/java/com/jumeirah/common/entity/BusinessPlain.java
View file @
c6b23de1
...
...
@@ -63,4 +63,9 @@ public class BusinessPlain extends BaseEntity {
@ApiModelProperty
(
"更新时间(时间戳)"
)
private
Date
updateTime
;
@ApiModelProperty
(
"图片高"
)
private
Integer
imageListHeight
;
@ApiModelProperty
(
"图片宽"
)
private
Integer
imageListWidth
;
}
common/src/main/java/com/jumeirah/common/param/BusinessPlainPageParam.java
View file @
c6b23de1
...
...
@@ -2,6 +2,7 @@ package com.jumeirah.common.param;
import
io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
...
...
@@ -20,4 +21,6 @@ import lombok.experimental.Accessors;
@ApiModel
(
value
=
"公务机出售/托管表分页参数"
)
public
class
BusinessPlainPageParam
extends
BasePageOrderParam
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"类型,0-出售,1-托管"
)
private
Integer
type
;
}
common/src/main/java/com/jumeirah/common/service/impl/BusinessPlainServiceImpl.java
View file @
c6b23de1
...
...
@@ -63,7 +63,7 @@ public class BusinessPlainServiceImpl extends BaseServiceImpl<BusinessPlainMappe
@Override
public
Paging
<
BusinessPlainQueryForAppVo
>
getBusinessPlainPageListForApp
(
BusinessPlainPageParam
businessPlainPageParam
)
throws
Exception
{
Page
<
BusinessPlainQueryForAppVo
>
page
=
new
PageInfo
<>(
businessPlainPageParam
,
OrderItem
.
desc
(
getLambdaColumn
(
BusinessPlain:
:
getCreateTime
)
));
Page
<
BusinessPlainQueryForAppVo
>
page
=
new
PageInfo
<>(
businessPlainPageParam
,
OrderItem
.
desc
(
"bp.create_time"
));
IPage
<
BusinessPlainQueryForAppVo
>
iPage
=
businessPlainMapper
.
getBusinessPlainPageListForApp
(
page
,
businessPlainPageParam
);
return
new
Paging
<>(
iPage
);
}
...
...
common/src/main/java/com/jumeirah/common/vo/BusinessPlainQueryForAppVo.java
View file @
c6b23de1
...
...
@@ -22,10 +22,7 @@ public class BusinessPlainQueryForAppVo implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"商家name"
)
private
Long
mcName
;
@ApiModelProperty
(
"业务类型,0-出售,1-托管"
)
private
Integer
businessType
;
private
String
mcName
;
@ApiModelProperty
(
"图片url"
)
private
String
imgUrl
;
...
...
@@ -42,4 +39,10 @@ public class BusinessPlainQueryForAppVo implements Serializable {
@ApiModelProperty
(
"微信号"
)
private
String
wechat
;
@ApiModelProperty
(
"商家头像"
)
private
String
mcHead
;
@ApiModelProperty
(
"图片高"
)
private
Integer
imageListHeight
;
@ApiModelProperty
(
"图片宽"
)
private
Integer
imageListWidth
;
}
\ No newline at end of file
common/src/main/resources/mapper/BusinessPlainMapper.xml
View file @
c6b23de1
...
...
@@ -4,7 +4,7 @@
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, mc_id, business_type, img_url, introduction, name, phone, wechat, status, create_time, update_time
id, mc_id, business_type, img_url, introduction, name, phone, wechat, status, create_time, update_time
,image_list_height,image_list_width
</sql>
<sql
id=
"Base_Column_ListForApp"
>
...
...
@@ -27,9 +27,10 @@
<select
id=
"getBusinessPlainPageListForApp"
parameterType=
"com.jumeirah.common.param.BusinessPlainPageParam"
resultType=
"com.jumeirah.common.vo.BusinessPlainQueryForAppVo"
>
select
<include
refid=
"Base_Column_ListForApp"
/>
<include
refid=
"Base_Column_ListForApp"
/>
,bp.image_list_height,bp.image_list_width,m.`head` AS mcHead
from business_plain bp
INNER JOIN merchant m ON bp.mc_id=m.id
where bp.business_type=#{param.type}
</select>
</mapper>
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