diff --git a/gan-modules/ruoyi-gan/pom.xml b/gan-modules/ruoyi-gan/pom.xml index 4252941..c4245b3 100644 --- a/gan-modules/ruoyi-gan/pom.xml +++ b/gan-modules/ruoyi-gan/pom.xml @@ -89,6 +89,10 @@ aliyun-java-sdk-dysmsapi + + com.github.xiaoymin + knife4j-spring-boot-starter + org.projectlombok lombok diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppLoginController.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppLoginController.java new file mode 100644 index 0000000..f65ac93 --- /dev/null +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppLoginController.java @@ -0,0 +1,4 @@ +package com.ruoyi.app.controller; + +public class AppLoginController { +} diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppSchoolController.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppSchoolController.java index c626c58..5d55169 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppSchoolController.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppSchoolController.java @@ -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 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 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 list = appSchoolService.selectAppSchoolList(appSchool); - ExcelUtil util = new ExcelUtil(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 list = appSchoolService.selectAppSchoolList(appSchool); +// ExcelUtil util = new ExcelUtil(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)); diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/PhoneCodeController.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/PhoneCodeController.java index 885f7f9..35de760 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/PhoneCodeController.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/PhoneCodeController.java @@ -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)) { diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/mapper/AppSchoolMapper.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/mapper/AppSchoolMapper.java index 86fe534..e87327b 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/mapper/AppSchoolMapper.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/mapper/AppSchoolMapper.java @@ -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 selectAppSchoolAllList(@Param("name") String name); } diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/properties/AliSmsProperties.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/properties/AliSmsProperties.java new file mode 100644 index 0000000..b52af87 --- /dev/null +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/properties/AliSmsProperties.java @@ -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; + +} diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/IAppSchoolService.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/IAppSchoolService.java index eeeeeb7..314dcbb 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/IAppSchoolService.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/IAppSchoolService.java @@ -58,4 +58,6 @@ public interface IAppSchoolService * @return 结果 */ public int deleteAppSchoolById(Long id); + + List selectAppSchoolAllList(String name); } diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppSchoolServiceImpl.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppSchoolServiceImpl.java index 49ba1df..1a6a23d 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppSchoolServiceImpl.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppSchoolServiceImpl.java @@ -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 selectAppSchoolAllList(String name) { + return appSchoolMapper.selectAppSchoolAllList(name); + + } } diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/utils/aliyun/sms/SendNoteUtil.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/utils/aliyun/sms/SendNoteUtil.java index 23733fe..a1e7f72 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/utils/aliyun/sms/SendNoteUtil.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/utils/aliyun/sms/SendNoteUtil.java @@ -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; @@ -55,7 +58,7 @@ public class SendNoteUtil { //验证平台信息 开发者无需任何更改 private static final String dysmsapi = "dysmsapi.aliyuncs.com"; - DefaultProfile profile = DefaultProfile.getProfile("default", "LTAI5tM1LeE2pkiS3qEFQkfb", "fEZZyFvWkETS8Clm73f7qmY9ohcTpc"); + DefaultProfile profile = DefaultProfile.getProfile("default","LTAI5tM1LeE2pkiS3qEFQkfb", "fEZZyFvWkETS8Clm73f7qmY9ohcTpc"); IAcsClient client = new DefaultAcsClient(profile); //这一步的两个参数,一个是要发送验证码的手机号 一个是模板Code用来区分登录注册 @@ -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); diff --git a/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppSchoolMapper.xml b/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppSchoolMapper.xml index d2ece43..8678300 100644 --- a/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppSchoolMapper.xml +++ b/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppSchoolMapper.xml @@ -63,4 +63,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index b573fa2..5eae3fc 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ 8.2.2 4.1.2 2.0.24 + 3.0.3 2.14.4 @@ -222,6 +223,11 @@ ruoyi-api-system ${ruoyi.version} + + com.github.xiaoymin + knife4j-spring-boot-starter + ${knife4j.version} + com.aliyun