验证码
parent
99063fcd8f
commit
e29df7e02c
|
|
@ -89,6 +89,10 @@
|
|||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
package com.ruoyi.app.controller;
|
||||
|
||||
public class AppLoginController {
|
||||
}
|
||||
|
|
@ -3,15 +3,11 @@ package com.ruoyi.app.controller;
|
|||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
|
|
@ -30,6 +26,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/school")
|
||||
@Api(tags = "学校配置接口" , description = "学校配置接口")
|
||||
public class AppSchoolController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
|
|
@ -38,33 +35,42 @@ public class AppSchoolController extends BaseController
|
|||
/**
|
||||
* 查询学校配置列表
|
||||
*/
|
||||
@RequiresPermissions("app:school:list")
|
||||
// @RequiresPermissions("app:school:list")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value = "获取学校列表集合", notes = "获取学校列表集合", httpMethod = "GET")
|
||||
public TableDataInfo list(AppSchool appSchool)
|
||||
{
|
||||
startPage();
|
||||
List<AppSchool> list = appSchoolService.selectAppSchoolList(appSchool);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@GetMapping("/listAll")
|
||||
@ApiOperation(value = "获取学校列表集合", notes = "获取学校列表集合", httpMethod = "GET")
|
||||
public AjaxResult list(@RequestParam(value = "name",required = false) String name)
|
||||
{
|
||||
List<AppSchool> list = appSchoolService.selectAppSchoolAllList(name);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出学校配置列表
|
||||
*/
|
||||
@RequiresPermissions("app:school:export")
|
||||
@Log(title = "学校配置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AppSchool appSchool)
|
||||
{
|
||||
List<AppSchool> list = appSchoolService.selectAppSchoolList(appSchool);
|
||||
ExcelUtil<AppSchool> util = new ExcelUtil<AppSchool>(AppSchool.class);
|
||||
util.exportExcel(response, list, "学校配置数据");
|
||||
}
|
||||
// @RequiresPermissions("app:school:export")
|
||||
// @Log(title = "学校配置", businessType = BusinessType.EXPORT)
|
||||
// @PostMapping("/export")
|
||||
// public void export(HttpServletResponse response, AppSchool appSchool)
|
||||
// {
|
||||
// List<AppSchool> list = appSchoolService.selectAppSchoolList(appSchool);
|
||||
// ExcelUtil<AppSchool> util = new ExcelUtil<AppSchool>(AppSchool.class);
|
||||
// util.exportExcel(response, list, "学校配置数据");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取学校配置详细信息
|
||||
*/
|
||||
@RequiresPermissions("app:school:query")
|
||||
// @RequiresPermissions("app:school:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "获取学校配置详细信息", notes = "获取学校配置详细信息", httpMethod = "GET")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(appSchoolService.selectAppSchoolById(id));
|
||||
|
|
@ -76,6 +82,7 @@ public class AppSchoolController extends BaseController
|
|||
@RequiresPermissions("app:school:add")
|
||||
@Log(title = "学校配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增学校配置", notes = "新增学校配置", httpMethod = "POST")
|
||||
public AjaxResult add(@RequestBody AppSchool appSchool)
|
||||
{
|
||||
return toAjax(appSchoolService.insertAppSchool(appSchool));
|
||||
|
|
@ -87,6 +94,7 @@ public class AppSchoolController extends BaseController
|
|||
@RequiresPermissions("app:school:edit")
|
||||
@Log(title = "学校配置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改学校配置", notes = "修改学校配置", httpMethod = "PUT")
|
||||
public AjaxResult edit(@RequestBody AppSchool appSchool)
|
||||
{
|
||||
return toAjax(appSchoolService.updateAppSchool(appSchool));
|
||||
|
|
@ -98,6 +106,7 @@ public class AppSchoolController extends BaseController
|
|||
@RequiresPermissions("app:school:remove")
|
||||
@Log(title = "学校配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation(value = "删除学校配置", notes = "删除学校配置", httpMethod = "DELETE")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(appSchoolService.deleteAppSchoolByIds(ids));
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package com.ruoyi.app.controller;
|
|||
import com.ruoyi.app.utils.aliyun.sms.SendNoteUtil;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.Authorization;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -12,12 +15,14 @@ import org.springframework.web.bind.annotation.*;
|
|||
@RequestMapping("/api/msm")
|
||||
@SuppressWarnings("ALL")
|
||||
@CrossOrigin
|
||||
@Api(tags = "短信验证码接口" , description = "短信验证码接口")
|
||||
public class PhoneCodeController {
|
||||
|
||||
@Autowired
|
||||
private SendNoteUtil sendNoteUtil;
|
||||
|
||||
@GetMapping(value = "/send")
|
||||
@ApiOperation(value = "发送短信验证码", notes = "发送短信验证码", httpMethod = "GET")
|
||||
public AjaxResult sendCode(@RequestParam("phoneNum") String phoneNum){
|
||||
|
||||
String send = sendNoteUtil.sendNoteMessgae(phoneNum);
|
||||
|
|
@ -36,6 +41,8 @@ public class PhoneCodeController {
|
|||
* @return 返回验证状态
|
||||
*/
|
||||
@GetMapping(value ="/check")
|
||||
|
||||
@ApiOperation(value = "验证验证码", notes = "验证验证码", httpMethod = "GET")
|
||||
public AjaxResult check(@RequestParam("phoneNum") String phoneNumber, @RequestParam("code") String code) {
|
||||
String verificationResults = sendNoteUtil.check(phoneNumber, code);
|
||||
if (StringUtils.isNotBlank(verificationResults)) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.app.mapper;
|
|||
|
||||
import java.util.List;
|
||||
import com.ruoyi.app.domain.AppSchool;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 学校配置Mapper接口
|
||||
|
|
@ -58,4 +59,6 @@ public interface AppSchoolMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteAppSchoolByIds(Long[] ids);
|
||||
|
||||
List<AppSchool> selectAppSchoolAllList(@Param("name") String name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.ruoyi.app.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "alisms")
|
||||
@Data
|
||||
public class AliSmsProperties {
|
||||
@Value(value = "${alisms.accessKeyId}")
|
||||
private String accessKeyId;
|
||||
@Value(value = "${alisms.accessKeySecret}")
|
||||
private String accessKeySecret;
|
||||
|
||||
}
|
||||
|
|
@ -58,4 +58,6 @@ public interface IAppSchoolService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteAppSchoolById(Long id);
|
||||
|
||||
List<AppSchool> selectAppSchoolAllList(String name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.app.service.impl;
|
|||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.app.mapper.AppSchoolMapper;
|
||||
|
|
@ -55,6 +56,8 @@ public class AppSchoolServiceImpl implements IAppSchoolService
|
|||
{
|
||||
appSchool.setCreateTime(DateUtils.getNowDate());
|
||||
appSchool.setUpdateTime(DateUtils.getNowDate());
|
||||
appSchool.setCreateBy(SecurityUtils.getUsername());
|
||||
appSchool.setUpdateBy(SecurityUtils.getUsername());
|
||||
return appSchoolMapper.insertAppSchool(appSchool);
|
||||
}
|
||||
|
||||
|
|
@ -68,6 +71,7 @@ public class AppSchoolServiceImpl implements IAppSchoolService
|
|||
public int updateAppSchool(AppSchool appSchool)
|
||||
{
|
||||
appSchool.setUpdateTime(DateUtils.getNowDate());
|
||||
appSchool.setUpdateBy(SecurityUtils.getUsername());
|
||||
return appSchoolMapper.updateAppSchool(appSchool);
|
||||
}
|
||||
|
||||
|
|
@ -94,4 +98,10 @@ public class AppSchoolServiceImpl implements IAppSchoolService
|
|||
{
|
||||
return appSchoolMapper.deleteAppSchoolById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppSchool> selectAppSchoolAllList(String name) {
|
||||
return appSchoolMapper.selectAppSchoolAllList(name);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.aliyuncs.exceptions.ClientException;
|
|||
import com.aliyuncs.exceptions.ServerException;
|
||||
import com.aliyuncs.http.MethodType;
|
||||
import com.aliyuncs.profile.DefaultProfile;
|
||||
import com.ruoyi.app.properties.AliSmsProperties;
|
||||
import com.ruoyi.common.redis.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -21,27 +22,29 @@ import java.util.concurrent.TimeUnit;
|
|||
public class SendNoteUtil {
|
||||
|
||||
/**
|
||||
* 阿里云 accessKeyId
|
||||
* 阿里云 accessKeyId : "fEZZyFvWkETS8Clm73f7qmY9ohcTpc"
|
||||
*/
|
||||
@Value("${aliSms.accessKeyId}")
|
||||
@Value("${alisms.accessKeyId}")
|
||||
private String accessKeyId;
|
||||
|
||||
/**
|
||||
* 阿里云 secret
|
||||
* 阿里云 secret : "LTAI5tM1LeE2pkiS3qEFQkfb"
|
||||
*/
|
||||
@Value("${aliSms.accessKeySecret}")
|
||||
@Value("${alisms.accessKeySecret}")
|
||||
private String accessKeySecret;
|
||||
@Autowired
|
||||
private AliSmsProperties aliSmsProperties;
|
||||
|
||||
/**
|
||||
* 阿里云签名
|
||||
*/
|
||||
@Value("${aliSms.signName}")
|
||||
@Value("${alisms.signName}")
|
||||
private String signName;
|
||||
|
||||
/**
|
||||
* 阿里云短信模板Code
|
||||
*/
|
||||
@Value("${aliSms.templateCode}")
|
||||
@Value("${alisms.templateCode}")
|
||||
private String templateCode;
|
||||
|
||||
|
||||
|
|
@ -66,7 +69,6 @@ public class SendNoteUtil {
|
|||
* @return 返回发送状态
|
||||
*/
|
||||
public String sendNoteMessgae(String PhoneNumber) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Random random = new Random();
|
||||
String randomNumber = String.valueOf(random.nextInt(9000) + 1000);
|
||||
|
||||
|
|
|
|||
|
|
@ -63,4 +63,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectAppSchoolAllList" resultMap="AppSchoolResult">
|
||||
<include refid="selectAppSchoolVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
6
pom.xml
6
pom.xml
|
|
@ -35,6 +35,7 @@
|
|||
<minio.version>8.2.2</minio.version>
|
||||
<poi.version>4.1.2</poi.version>
|
||||
<aliyun.sms.version>2.0.24</aliyun.sms.version>
|
||||
<knife4j.version>3.0.3</knife4j.version>
|
||||
<transmittable-thread-local.version>2.14.4</transmittable-thread-local.version>
|
||||
</properties>
|
||||
|
||||
|
|
@ -222,6 +223,11 @@
|
|||
<artifactId>ruoyi-api-system</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
<!--阿里云短信包-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
|
|
|
|||
Loading…
Reference in New Issue