完善swagger

This commit is contained in:
Unique-Jerry 2023-11-23 22:28:01 +08:00
parent 3d7a8fcc9b
commit 635a044411
11 changed files with 264 additions and 168 deletions

23
pom.xml
View File

@ -77,15 +77,15 @@
</dependency>
<!-- redis-clients -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<!-- redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>redis.clients</groupId>-->
<!-- <artifactId>jedis</artifactId>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; redis &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-redis</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
@ -117,6 +117,11 @@
<artifactId>commons-httpclient</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
<version>4.1.75.Final</version>
</dependency>
</dependencies>

View File

@ -1,40 +0,0 @@
package com.yzdx.AiInterviewer.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
/**
* @ClassName redisConfig
* @Description TODO
* @Author 加辣椒了吗?
* @Date 2022/4/28 2:33
* @Version 1.0
**/
@Configuration
public class RedisConfig {
@Bean
public RedisTemplate<String,Object> redisTemplate(RedisConnectionFactory factory){
// 将redis注入工厂
RedisTemplate<String,Object> template = new RedisTemplate<>();
template.setConnectionFactory(factory);
// 设置key的序列化方式
template.setKeySerializer (RedisSerializer.string());
//设置value的序列化方式
template.setValueSerializer (RedisSerializer.json());
// 设置hash的key的序列化方式
template. setHashKeySerializer (RedisSerializer.string());
// 设置hash的value的序列化方式
template.setHashValueSerializer (RedisSerializer.json());
// 使设置生效
template.afterPropertiesSet();
return template;
}
}

View File

@ -7,7 +7,7 @@ import com.yzdx.AiInterviewer.entity.LogoEntity;
import com.yzdx.AiInterviewer.service.InterviewBackgroundService;
import com.yzdx.AiInterviewer.service.InterviewImagesService;
import com.yzdx.AiInterviewer.service.InterviewLogoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,6 +33,7 @@ public class InterviewController {
* @return R
*/
@GetMapping("/get_logoList")
@ApiOperation(value = "根据编码获取logo图片列表",notes = "")
public R getLogoList(@ApiParam("传入的值为:(String)encoding") String encoding){
if(encoding==null){
@ -51,6 +52,7 @@ public class InterviewController {
* @return R
*/
@PostMapping("/add_logo")
@ApiOperation(value = "添加logo图片",notes = "")
public R addLogo(@RequestBody @ApiParam("传入的值为addInfo:{(String)name,(String)encoding,(String)image,(Integer)userId,(String)filename}") Map<String,Object> addInfo) {
if(addInfo.size()==0){
@ -79,6 +81,7 @@ public class InterviewController {
* @return R
*/
@DeleteMapping("/delete_logo")
@ApiOperation(value = "删除logo图片",notes = "")
public R deleteLogoById(@ApiParam("传入的值为:(Integer)id") Integer id){
Integer rows = LogoService.deleteLogoById(id);
@ -94,6 +97,7 @@ public class InterviewController {
* @param encoding 公司编码
* @return R
*/
@ApiOperation(value = "根据公司编码搜索背景列表",notes = "")
@GetMapping("/get_backgroundList")
public R getBackgroundList(@ApiParam("传入的值:(String)encoding") String encoding){
@ -113,6 +117,7 @@ public class InterviewController {
* @return R
*/
@PostMapping("/add_background")
@ApiOperation(value = "添加背景图片",notes = "")
public R addBackground(@RequestBody @ApiParam("传入的值为:(String)name,(encoding)String,(String)image,(Integer)userId,(String)filename") Map<String,Object> addInfo) {
if(addInfo.size()==0){
@ -141,6 +146,7 @@ public class InterviewController {
* @return R
*/
@DeleteMapping("/delete_background")
@ApiOperation(value = "删除背景图片",notes = "")
public R deleteBackgroundById(@ApiParam("传入的值为:(Integer)id") Integer id){
Integer rows = backgroundService.deleteBackgroundById(id);
@ -157,6 +163,7 @@ public class InterviewController {
* @return R
*/
@GetMapping("/get_imagesList")
@ApiOperation(value = "根据公司编码获取面试官形象图片列表",notes = "")
public R getImagesList(@ApiParam("传入的值为:(String)encoding") String encoding){
if(encoding==null){
@ -175,6 +182,7 @@ public class InterviewController {
* @return R
*/
@PostMapping("/add_image")
@ApiOperation(value = "添加面试管形象",notes = "")
public R addImage(@RequestBody @ApiParam("传入的值addInfo:{(String)name,(encoding)String,(String)image,(Integer)userId,(String)filename}") Map<String,Object> addInfo) {
if(addInfo.size()==0){
@ -205,6 +213,7 @@ public class InterviewController {
* @return R
*/
@DeleteMapping("/delete_image")
@ApiOperation(value = "根据形象id删除面试官形象图片",notes = "")
public R deleteImageById(@ApiParam("传入的值:(Integer)id") Integer id){
Integer rows = imagesService.deleteImageById(id);

View File

@ -9,6 +9,7 @@ import com.yzdx.AiInterviewer.entity.dto.SharedQuestionBankDto;
import com.yzdx.AiInterviewer.entity.dto.SharedQuestionDto;
import com.yzdx.AiInterviewer.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -38,6 +39,7 @@ public class QuestionController {
* @return 返回的该公司下的公司题库
* */
@GetMapping("/get_typeList")
@ApiOperation(value = "根据编码获取题库列表",notes = "")
public R getTypeListByEncoding(@RequestParam @ApiParam("传入前端存入的encoding数据") String encoding){
List<QuestionBank> typeList = questionBankService.getTypeList(encoding);
@ -53,6 +55,7 @@ public class QuestionController {
* @return R
*/
@GetMapping("/search_typeName")
@ApiOperation(value = "根据题库名称搜索题库",notes = "")
public R searchTypeList(@ApiParam("传入的值为:(String)name,(String)type,(String)encoding") String name,String type,String encoding){
if(name==null&&encoding==null){
@ -69,6 +72,7 @@ public class QuestionController {
* @return R
*/
@GetMapping("/get_typeListByType")
@ApiOperation(value = "根据题库类型获取题库列表",notes = "")
public R getTypeListByType(@ApiParam("传入的值为:(String)encoding,(Integer)type") String encoding,Integer type){
if(encoding==null||type==null){
@ -85,7 +89,8 @@ public class QuestionController {
* @return R
* */
@PostMapping("/add_typeName")
public R addTypeName(@RequestBody @ApiParam("传入的值:{addInfo:(String)typeName,(String)encoding,(Integer)userId}") Map<String ,Object> addInfo){
@ApiOperation(value = "根据编码获取logo图片列表",notes = "")
public R addTypeName(@RequestBody @ApiParam("传入的值:addInfo:{(String)typeName,(String)encoding,(Integer)userId}") Map<String ,Object> addInfo){
if(addInfo.size()==0||addInfo.get("typeName")==null){
return R.error("添加失败,请检查输入");
@ -116,6 +121,7 @@ public class QuestionController {
* return R
* */
@DeleteMapping("/delete_type")
@ApiOperation(value = "根据id删除题库信息",notes = "")
public R deleteTypeName(@RequestParam @ApiParam("typeId:传入的题库id") Integer typeId){
if(typeId==null){
return R.error("提交的信息错误,请检查输入");
@ -125,7 +131,6 @@ public class QuestionController {
//判断是否删除成功
if(row==0){
return R.error("删除失败,请联系管理员");
}
return R.success("删除成功");
@ -136,7 +141,8 @@ public class QuestionController {
* return R
* */
@PostMapping("/change_type")
public R changeTypeName(@RequestBody @ApiParam("updateType:修改的内容 typeId 修改的题库id typeName 修改的题库名称 userId 修改人的id") Map<String ,Object> updateType){
@ApiOperation(value = "根据编码获取logo图片列表",notes = "")
public R changeTypeName(@RequestBody @ApiParam("updateType:{修改的内容 typeId 修改的题库id typeName 修改的题库名称 userId 修改人的id}") Map<String ,Object> updateType){
if(updateType.size()==0){
@ -171,6 +177,7 @@ public class QuestionController {
}
@GetMapping("/get_typeById")
@ApiOperation(value = "根据题库ID获取题库信息",notes = "")
public R getTypeById(Integer id){
QuestionBank bankById = questionBankService.getBankById(id);
@ -187,6 +194,7 @@ public class QuestionController {
* return R
* */
@GetMapping("/get_questionList")
@ApiOperation(value = "根据编码获取题目列表",notes = "")
public R getQuestionList( @ApiParam("传入的值:(String)encoding") String encoding){
if(encoding==null){
return R.error("出错了!请联系管理员");
@ -196,7 +204,8 @@ public class QuestionController {
}
@GetMapping("/search_questionList")
public R searchQuestionList(String name,String type,String encoding){
@ApiOperation(value = "搜索题目",notes = "")
public R searchQuestionList(@ApiParam("传入的值String name,String type,String encoding 注释name和type字段名可选一个填写,encoding是必填字段") String name,String type,String encoding){
List<QuestionDto> questionDtos = questionService.searchQuestionList(name, type, encoding);
return R.success(questionDtos);
}
@ -206,6 +215,7 @@ public class QuestionController {
* return R
* */
@PostMapping("add_question")
@ApiOperation(value = "添加题目",notes = "")
public R addQuestion(@RequestBody @ApiParam("传入的值addQuestionInfo:{(String)encoding,(Integer)banId,(String)details,(String)promote,(Integer)userId),(String)title}") Map<String,Object> addQuestionInfo){
String title=(String)addQuestionInfo.get("title");
Integer bankId=(Integer) addQuestionInfo.get("bankId");
@ -232,6 +242,8 @@ public class QuestionController {
* return R
* */
@PostMapping("update_question")
@ApiOperation(value = "更新题目",notes = "")
public R updateQuestion(@RequestBody @ApiParam("传入的值addQuestionInfo:{(Integer)id,(Integer)banId,(String)details,(String)promote,(String)encoding,(Integer)userId),(String)title}") Map<String,Object> addQuestionInfo){
Integer id=(Integer) addQuestionInfo.get("id");
String title=(String)addQuestionInfo.get("title");
@ -257,6 +269,7 @@ public class QuestionController {
* return R
* */
@DeleteMapping("/del_question")
@ApiOperation(value = "根据题目ID删除题目",notes = "")
public R deleteQuestion(@ApiParam("传入的值:(Integer)id") Integer id){
Integer rows=questionService.deleteQuestion(id);
@ -268,6 +281,7 @@ public class QuestionController {
}
@GetMapping("/get_sharedQuestionType")
@ApiOperation(value = "题库广场",notes = "不需要参数")
public R getSharedQuestionBankList(){
List<SharedQuestionBankDto> sharedQuestionBank = sharedQuestionBankService.getSharedQuestionBank();
@ -276,7 +290,8 @@ public class QuestionController {
@PostMapping("/add_sharedQuestionBank")
public R addSharedQuestionType(@RequestBody Map<String ,Object> addInfo){
@ApiOperation(value = "添加分享题目",notes = "")
public R addSharedQuestionType(@RequestBody @ApiParam("传入的值: addInfo:{(String) typeName,(Integer) type,(String) description,(Integer) userId,(String) encoding}") Map<String ,Object> addInfo){
String typeName=(String) addInfo.get("typeName");
Integer type=(Integer) addInfo.get("type");
String description=(String) addInfo.get("description");
@ -292,6 +307,7 @@ public class QuestionController {
}
@GetMapping("/get_sharedQuestion")
@ApiOperation(value = "题目广场",notes = "不需要参数")
public R getSharedQuestionList(){
List<SharedQuestionDto> sharedQuestionList = sharedQuestionService.getSharedQuestionList();
@ -299,7 +315,8 @@ public class QuestionController {
return R.success(sharedQuestionList);
}
@GetMapping("/get_sharedQuestionByBankId")
public R getSharedQuestionListBySharedBankId(Integer sharedBankId){
@ApiOperation(value = "获取分享题库下的题目列表",notes = "")
public R getSharedQuestionListBySharedBankId( @ApiParam("Integer sharedBankId")Integer sharedBankId){
List<SharedQuestionDto> sharedQuestionList = sharedQuestionService.getSharedQuestionListBySharedBankId(sharedBankId);
@ -307,7 +324,8 @@ public class QuestionController {
}
@PostMapping("/add_sharedQuestion")
public R addSharedQuestion(@RequestBody Map<String,Object> addInfo){
@ApiOperation(value = "添加分享的题目",notes = "")
public R addSharedQuestion(@RequestBody @ApiParam("addInfo:{(Integer) sharedBankId, (List<Integer>) selectQuestionId,(Integer) userId,(String) encoding}") Map<String,Object> addInfo){
Integer sharedBankId=(Integer) addInfo.get("sharedBankId");
List<Integer> selectQuestionId=(List<Integer>) addInfo.get("selectQuestionId");
Integer userId =(Integer) addInfo.get("userId");
@ -321,18 +339,21 @@ public class QuestionController {
return R.error(result);
}
@GetMapping("/search_sharedQuestionType")
public R searchSharedQuestionType(String searchName){
@ApiOperation(value = "搜索分享题库",notes = "")
public R searchSharedQuestionType(@ApiParam("String searchName") String searchName){
List<SharedQuestionBankDto> sharedQuestionBankDtoList = sharedQuestionBankService.searchSharedQuestionType(searchName);
return R.success(sharedQuestionBankDtoList);
}
@GetMapping("/search_sharedQuestion")
public R searchSharedQuestion(String searchName){
@ApiOperation(value = "搜索分享题目",notes = "")
public R searchSharedQuestion(@ApiParam("String searchName")String searchName){
List<SharedQuestionDto> sharedQuestionDtos = sharedQuestionService.searchSharedQuestion(searchName);
return R.success(sharedQuestionDtos);
}
@PostMapping("/add_QuestionBankFromShare")
public R addQuestionBankFromShare(@RequestBody Map<String,Object> addInfo){
@ApiOperation(value = "从题库广场中导入到本地",notes = "")
public R addQuestionBankFromShare(@RequestBody @ApiParam("addInfo{List<Integer>SharedBankIds,Integer userId,String) encoding}") Map<String,Object> addInfo){
List<Integer> sharedBankIds = (List<Integer>) addInfo.get("SharedBankIds");
Integer userId =(Integer) addInfo.get("userId");
String encoding =(String) addInfo.get("encoding");
@ -344,7 +365,8 @@ public class QuestionController {
return R.error(result);
}
@PostMapping("/add_QuestionFromShare")
public R addQuestionFromShare(@RequestBody Map<String,Object> addInfo){
@ApiOperation(value = "从题目广场中导入到本地",notes = "")
public R addQuestionFromShare(@RequestBody @ApiParam("addInfo:{(List<Integer>) selectSharedQuestionIds,(Integer) bankId,(Integer) userId,(String) encoding}") Map<String,Object> addInfo){
List<Integer> selectSharedQuestionIds=(List<Integer>) addInfo.get("selectSharedQuestionIds");
Integer bankId=(Integer) addInfo.get("bankId");
Integer userId =(Integer) addInfo.get("userId");
@ -356,18 +378,21 @@ public class QuestionController {
return R.error(result);
}
@GetMapping("/get_OurQuestionTypeList")
public R getOurSharedQuestionTypeList(String encoding){
@ApiOperation(value = "我的分享题库",notes = "")
public R getOurSharedQuestionTypeList(@ApiParam("String encoding") String encoding){
List<SharedQuestionBankDto> ourQuestionTypeList = sharedQuestionBankService.getOurQuestionTypeList(encoding);
return R.success(ourQuestionTypeList);
}
@GetMapping("/search_OurSharedQuestionType")
public R searchOurSharedQuestionType(String encoding,String searchName){
@ApiOperation(value = "搜索我的分享题库",notes = "")
public R searchOurSharedQuestionType(@ApiParam("(String) encoding,(String) searchName")String encoding,String searchName){
List<SharedQuestionBankDto> sharedQuestionBankDtoList = sharedQuestionBankService.searchOurSharedQuestionType(encoding, searchName);
return R.success(sharedQuestionBankDtoList);
}
@PostMapping("/edit_OurSharedQuestionType")
public R editOurSharedQuestionType(@RequestBody Map<String, Object> updateInfo) {
@ApiOperation(value = "修改我的分享题库",notes = "")
public R editOurSharedQuestionType(@RequestBody @ApiParam("updateInfo:{(Integer) id,(String) typeName,(String) description,(Integer) type,(Integer) userId}") Map<String, Object> updateInfo) {
Integer id = (Integer) updateInfo.get("id");
String typeName = (String) updateInfo.get("typeName");
String description = (String) updateInfo.get("description");
@ -382,33 +407,59 @@ public class QuestionController {
}
@DeleteMapping("/delete_OurSharedQuestionType")
public R deleteOurSharedQuestionType(Integer id){
@ApiOperation(value = "删除我的分享题库",notes = "")
public R deleteOurSharedQuestionType(@ApiParam("Integer id") Integer id){
sharedQuestionBankService.deleteOurSharedQuestionType(id);
return R.success("删除成功");
}
@GetMapping("/get_OurQuestionList")
public R getOurSharedQuestionList(String encoding){
@ApiOperation(value = "获取我的分享题目",notes = "")
public R getOurSharedQuestionList(@ApiParam("String encoding") String encoding){
List<SharedQuestionDto> ourQuestionList = sharedQuestionService.getOurQuestionList(encoding);
return R.success(ourQuestionList);
}
@GetMapping("/search_OurSharedQuestion")
public R searchOurSharedQuestion(String encoding,String searchName){
@ApiOperation(value = "搜索我的分享题目",notes = "")
public R searchOurSharedQuestion(@ApiParam("(String) encoding,(String) searchName ")String encoding,String searchName){
List<SharedQuestionDto> sharedQuestionDtoList = sharedQuestionService.searchOurSharedQuestion(encoding, searchName);
return R.success(sharedQuestionDtoList);
}
@PostMapping("/delete_OurSharedQuestion")
public R deleteOurSharedQuestion(@RequestBody Map<String,Object> sharedQuestionId){
@ApiOperation(value = "删除我的分享题目",notes = "")
public R deleteOurSharedQuestion(@RequestBody @ApiParam(" List<Integer> sharedQuestionId") Map<String,Object> sharedQuestionId){
List<Integer> ids=(List<Integer>) sharedQuestionId.get("sharedQuestionId");
Integer rows= sharedQuestionService.deleteOurSharedQuestion(ids);
return R.success("删除成功,删除"+rows+"分享题目");
}
@PostMapping("/update_OurSharedQuestion")
@ApiOperation(value = "更新我的分享题目",notes = "")
public R updateOurSharedQuestion(@RequestBody@ApiParam("updateInfo:{(Integer) id,\n" +
" (String) title,\n" +
" (String) details ,\n" +
" (String) promote,\n" +
" (Integer) bankId ,\n" +
" (Integer) userId }") Map<String,Object> updateInfo){
Integer id = (Integer) updateInfo.get("id");
String title = (String) updateInfo.get("title");
String details = (String) updateInfo.get("details");
String promote = (String) updateInfo.get("promote");
Integer bankId = (Integer) updateInfo.get("bankId");
Integer userId = (Integer) updateInfo.get("userId");
Integer rows=sharedQuestionService.updateOurSharedQuestion(id, title, details , promote, bankId , userId);
if(rows==1){
return R.success("修改成功");
}
return R.error("修改失败");
}
}

View File

@ -9,6 +9,8 @@ import com.yzdx.AiInterviewer.service.CompanyService;
import com.yzdx.AiInterviewer.service.InterviewSettingService;
import com.yzdx.AiInterviewer.service.JobListService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@ -26,7 +28,22 @@ public class RecruitmentController {
private CompanyService companyService;
@PostMapping("/add_job")
public R addJob(@RequestBody Map<String,Object> addInfo){
@ApiOperation(value = "添加岗位",notes = "")
public R addJob(@RequestBody @ApiParam("addInfo:{(List<String>) address,\n" +
" (String) address_detail,\n" +
" (String) details,\n" +
" (String) jobName,\n" +
" (String) startTime,\n" +
" (String) endTime,\n" +
" (List<String>) jobTips,\n" +
" (Integer) jobType,\n" +
" (String) min_salary,\n" +
" (String) max_salary,\n" +
" (String) min_number,\n" +
" (String) max_number,\n" +
" (Integer) requirement,\n" +
" (Integer) userId,\n" +
" (String) encoding}") Map<String,Object> addInfo){
if (addInfo.size()!=15){
return R.error("表格数据不全,请检查输入");
@ -55,7 +72,8 @@ public class RecruitmentController {
}
@GetMapping("/get_jobList")
public R getJobList(String encoding){
@ApiOperation(value = "根据公司编码获取岗位列表",notes = "")
public R getJobList(@ApiParam("String encoding") String encoding){
if (encoding==null){
return R.error(401,"身份验证失败,请重新登陆");
}
@ -65,7 +83,9 @@ public class RecruitmentController {
}
@GetMapping("/search_job")
public R searchJob(String jobName,String jobType,String encoding){
@ApiOperation(value = "搜索岗位",notes = "")
public R searchJob(@ApiParam("(String) jobName,(String) jobType,(String) encoding 注释jobName和jobType可选填一个encoding必填")String jobName,String jobType,String encoding){
List<JobDto> jobEntities = jobListService.searchJob(jobName, jobType, encoding);
@ -74,7 +94,9 @@ public class RecruitmentController {
}
@GetMapping("/get_jobById")
public R getJobById(Integer id){
@ApiOperation(value = "根据岗位ID获取岗位信息",notes = "")
public R getJobById(@ApiParam("Integer id") Integer id){
if(id==null){
return R.error("获取失败");
}
@ -87,7 +109,23 @@ public class RecruitmentController {
}
@PostMapping("/update_job")
public R updateJob(@RequestBody Map<String,Object> updateInfo){
@ApiOperation(value = "更新岗位信息",notes = "")
public R updateJob(@RequestBody @ApiParam("updateInfo:{(Integer) id,\n" +
" (List<String>) address,\n" +
" (String) address_detail,\n" +
" (String) details,\n" +
" (String) jobName,\n" +
" (String) startTime,\n" +
" (String) endTime,\n" +
" (List<String>) jobTips,\n" +
" (Integer) jobType,\n" +
" (String) min_salary,\n" +
" (String) max_salary,\n" +
" (String) min_number,\n" +
" (String) max_number,\n" +
" (Integer) requirement,\n" +
" (Integer) userId,\n" +
" (String) encoding}") Map<String,Object> updateInfo){
if (updateInfo.size()!=16){
return R.error("表格数据不全,请检查输入");
@ -121,7 +159,9 @@ public class RecruitmentController {
}
@PostMapping("/update_jobStatus")
public R changeJobStatus(@RequestBody Map<String,Object> updateInfo){
@ApiOperation(value = "更新岗位状态",notes = "")
public R changeJobStatus(@RequestBody @ApiParam("updateInfo:{(Integer) id, (Integer) userId}") Map<String,Object> updateInfo){
if(updateInfo.size()!=2){
// 修改状态失败
@ -140,7 +180,8 @@ public class RecruitmentController {
}
@DeleteMapping("/delete_job")
public R deleteJob(Integer id) {
@ApiOperation(value = "删除岗位",notes = "")
public R deleteJob(@ApiParam("Integer id") Integer id) {
if (id == null) {
return R.error("出错了,请联系管理员!");
@ -154,7 +195,17 @@ public class RecruitmentController {
}
@PostMapping("/add_jobSetting")
public R addJobSetting(@RequestBody Map<String,Object> addInfo){
@ApiOperation(value = "添加面试设置",notes = "")
public R addJobSetting(@RequestBody @ApiParam("addInfo:{(Integer) jobId,\n" +
" (Integer) imagesId,\n" +
" (Integer) backgroundId,\n" +
" (Integer) logoId,\n" +
" (Integer) Professional,\n" +
" (Integer) Comprehensive,\n" +
" (Integer) Psychology,\n" +
" (Integer) userId,\n" +
" (String) jobPromote,\n" +
" (String) encoding}") Map<String,Object> addInfo){
Integer jobId = (Integer) addInfo.get("jobId");
Integer imagesId = (Integer) addInfo.get("imagesId");
@ -191,19 +242,22 @@ public class RecruitmentController {
}
@GetMapping("/get_jobSettingList")
public R getJobSettingList(String encoding){
@ApiOperation(value = "获取面试设置",notes = "")
public R getJobSettingList(@ApiParam("String encoding") String encoding){
List<JobSettingDto> jobSettingList = interviewSettingService.getJobSettingList(encoding);
return R.success(jobSettingList);
}
@GetMapping("/search_setting")
public R searchJobSettings(String jobName,String encoding){
@ApiOperation(value = "搜索面试设置",notes = "")
public R searchJobSettings(@ApiParam("String jobName,String encoding")String jobName,String encoding){
List<JobSettingDto> jobSettingDtos = interviewSettingService.searchJobSetting(jobName, encoding);
return R.success(jobSettingDtos);
}
@DeleteMapping("/delete_jobJobSetting")
@ApiOperation(value = "删除面试设置",notes = "")
public R deleteJobSetting(Integer id){
Integer rows = interviewSettingService.deleteJobSetting(id);
@ -215,7 +269,18 @@ public class RecruitmentController {
}
@PostMapping("/update_jobJobSetting")
public R updateJobSetting(@RequestBody Map<String,Object> updateInfo){
@ApiOperation(value = "更新面试设置",notes = "")
public R updateJobSetting(@RequestBody @ApiParam("updateInfo:{(Integer) id,\n" +
" (Integer) jobId,\n" +
" (Integer) imagesId,\n" +
" (Integer) backgroundId,\n" +
" (Integer) logoId,\n" +
" (Integer) Professional,\n" +
" (Integer) Comprehensive,\n" +
" (Integer) Psychology,\n" +
" (Integer) userId,\n" +
" (String) jobPromote,\n" +
" (String) encoding}") Map<String,Object> updateInfo){
Integer id = (Integer) updateInfo.get("id");
Integer jobId = (Integer) updateInfo.get("jobId");
Integer imagesId = (Integer) updateInfo.get("imagesId");
@ -253,7 +318,9 @@ public class RecruitmentController {
@GetMapping("/get_companyDetail")
public R getCompanyDetail(String encoding){
@ApiOperation(value = "获取公司详情",notes = "")
public R getCompanyDetail(@ApiParam ("String encoding") String encoding){
if(encoding==null){
return R.error("获取失败");
@ -267,7 +334,19 @@ public class RecruitmentController {
}
@PostMapping("/update_companyDetail")
public R UpdateCompanyDetail(@RequestBody Map<String,Object> updateInfo){
@ApiOperation(value = "更新公司详情",notes = "")
public R UpdateCompanyDetail(@RequestBody @ApiParam("updateInfo:{(String) address,\n" +
" (String) addressDetail,\n" +
" (String) companyDetail,\n" +
" (String) companyName,\n" +
" (String) creditCode,\n" +
" (String) encoding,\n" +
" (String) established,\n" +
" (String) images,\n" +
" (String) legalRepresentative,\n" +
" (String) treatment,\n" +
" (String) registeredCapital,\n" +
" (Integer) userId}") Map<String,Object> updateInfo){
List<String> address=(List<String>) updateInfo.get("address");

View File

@ -4,6 +4,8 @@ package com.yzdx.AiInterviewer.controller;
import com.yzdx.AiInterviewer.comment.R;
import com.yzdx.AiInterviewer.utiles.ParseResumeUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -40,6 +42,8 @@ public class UploadController {
* @return R
*/
@PostMapping("/upload_picture")
@ApiOperation(value = "上传图片",notes = "")
public R upLoadPicture(HttpServletRequest request, @RequestParam("file") MultipartFile file){
@ -104,6 +108,8 @@ public class UploadController {
* @return R
*/
@PostMapping("/upload_video")
@ApiOperation(value = "上传视频",notes = "")
public R upLoadVideo(HttpServletRequest request, @RequestParam("file") MultipartFile file ){
@ -163,7 +169,9 @@ public class UploadController {
* @return R
*/
@DeleteMapping("/delete_picture")
public R deletePicture(HttpServletRequest request,String imagePath){
@ApiOperation(value = "删除图片",notes = "")
public R deletePicture(@ApiParam("String imagePath") HttpServletRequest request, String imagePath){
if(imagePath==null||imagePath.equals("")){
return R.error("删除失败!");
}
@ -191,7 +199,9 @@ public class UploadController {
* @return R
*/
@DeleteMapping("/delete_video")
public R deleteVideo(HttpServletRequest request,String videoPath){
@ApiOperation(value = "删除图片",notes = "")
public R deleteVideo(@ApiParam("String videoPath") HttpServletRequest request,String videoPath){
if(videoPath==null||videoPath.equals("")){
return R.error("删除失败!");
}
@ -219,6 +229,8 @@ public class UploadController {
* @return R
*/
@PostMapping("/upload_resume")
@ApiOperation(value = "上传简历",notes = "")
public R uploadResume(HttpServletRequest request, @RequestParam("file") MultipartFile file){
if(file.isEmpty()){
return R.error("请选择文件");
@ -283,7 +295,9 @@ public class UploadController {
* @return R
*/
@DeleteMapping("/delete_resume")
public R deleteResume(HttpServletRequest request,String resumePath){
@ApiOperation(value = "删除简历",notes = "")
public R deleteResume(@ApiParam("String resumePath") HttpServletRequest request,String resumePath){
if(resumePath==null||resumePath.equals("")){
return R.error("删除失败!");
}

View File

@ -4,8 +4,7 @@ import com.yzdx.AiInterviewer.comment.R;
import com.yzdx.AiInterviewer.entity.User;
import com.yzdx.AiInterviewer.service.UserService;
import com.yzdx.AiInterviewer.utiles.JWT;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -24,8 +23,12 @@ public class UserController {
* @param loginForm 用户输入的账号密码公司编码
* @return R
* */
@ApiOperation(value = "管理员登录",notes = "")
@PostMapping("/login")
public R adminLogin(@RequestBody @ApiParam("传入的值:loginForm:{(String)phone,(String)encoding,(String)password}") Map<String,Object> loginForm){
public R adminLogin(@RequestBody @ApiParam("传入的值:loginForm:{" +
"(String)phone," +
"(String)encoding," +
"(String)password}") Map<String,Object> loginForm){
if(loginForm.size()==0){
return R.error("传来的数据有误,请检查输入");
@ -42,6 +45,7 @@ public class UserController {
* @return R
*/
@GetMapping("/get_userInfo")
@ApiOperation(value = "获取用户信息",notes = "")
public R getUserInfo( @ApiParam("传入的值:(String)token值") String token) {
if(token==null){
@ -74,6 +78,7 @@ public class UserController {
* @return R
*/
@GetMapping("/logout")
@ApiOperation(value = "管理员登出",notes = "")
public R adminLogout(@ApiParam("传入的值:(String)token值") String token){
Integer row = userService.adminLogout(token);
@ -91,6 +96,7 @@ public class UserController {
* @param encoding 公司编码
* @return R
*/
@ApiOperation(value = "根据公司编码获取管理员列表",notes = "")
@GetMapping("/get_adminList")
public R getAdminList(@ApiParam("传入的值:(String)encoding") String encoding){
@ -105,6 +111,8 @@ public class UserController {
* @param encoding 公司编码
* @return R
*/
@ApiOperation(value = "根据名字搜索管理员",notes = "")
@GetMapping("/search_admin")
public R searchAdmin(@ApiParam("传入的值:(String)name,(String)encoding") String name,String encoding){
if(name==null&&encoding==null){
@ -121,6 +129,7 @@ public class UserController {
* @return R
*/
@PostMapping("/add_admin")
@ApiOperation(value = "添加管理员",notes = "")
public R addAdmin(@RequestBody @ApiParam("传入的值 addAdminInfo:{(String)encoding,(Integer)userId,(String)username,(String)phone,(String)role}") Map<String ,Object> addAdminInfo){
String encoding=(String) addAdminInfo.get("encoding");
Integer userId=(Integer) addAdminInfo.get("userId");
@ -148,6 +157,7 @@ public class UserController {
* @return R
*/
@DeleteMapping("/del_admin")
@ApiOperation(value = "删除管理员",notes = "")
public R deleteAdmin(@ApiParam("传入的值 (Integer)userId,(Integer)deleteId")Integer deleteId,Integer userId){
@ -173,6 +183,8 @@ public class UserController {
* @return R
*/
@PostMapping("/change_avatar")
@ApiOperation(value = "根据ID修改头像",notes = "")
public R changeAvatar(@RequestBody @ApiParam("传入的值为updateInfo:(Integer)userId,(String)avatar") Map<String,Object> updateInfo){
Integer userId=(Integer) updateInfo.get("userId") ;
String avatar=(String)updateInfo.get("avatar") ;
@ -192,6 +204,8 @@ public class UserController {
* @return R
*/
@PostMapping("/reset_password")
@ApiOperation(value = "根据id更改密码",notes = "")
public R resetPassword(@RequestBody @ApiParam("传入的值为updateInfo:(Integer)userId,(String)oldPassword,(String)password") Map<String,Object> updateInfo){
Integer userId=(Integer)updateInfo.get("userId") ;
@ -210,6 +224,7 @@ public class UserController {
* @return R
*/
@PostMapping("/upload_userInfo")
@ApiOperation(value = "根据ID更新用户信息",notes = "")
public R updateUserInfo(@RequestBody @ApiParam("传入的值为updateInfo:(Integer)userId,(Integer)updateId,(String)username,(String)age,(String)email,(String)sex") Map<String,Object> updateInfo){
Integer userId=(Integer) updateInfo.get("userId");

View File

@ -65,5 +65,22 @@ public interface SharedQuestionService extends IService<SharedQuestion> {
Integer deleteOurSharedQuestion(List<Integer> ids);
/**
* 修改分享题库详情
* @param id 分享题目ID
* @param title 题目标题
* @param details 题目详情
* @param promote 题目promote
* @param bankId 分享题库ID
* @param userId 修改人ID
*
* */
Integer updateOurSharedQuestion(Integer id,
String title,
String details ,
String promote,
Integer bankId ,
Integer userId );
}

View File

@ -296,5 +296,28 @@ public class SharedQuestionServiceImpl extends ServiceImpl<SharedQuestionMapper,
return rows;
}
@Override
public Integer updateOurSharedQuestion(Integer id, String title, String details, String promote, Integer bankId, Integer userId) {
LambdaQueryWrapper<SharedQuestion> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(SharedQuestion::getId,id);
SharedQuestion findSharedQuestion= sharedQuestionMapper.selectOne(queryWrapper);
findSharedQuestion.setTitle(title);
findSharedQuestion.setDetails(details);
findSharedQuestion.setPromote(promote);
findSharedQuestion.setBankId(bankId);
findSharedQuestion.setUpdateUser(userId);
findSharedQuestion.setUpdateTime(TimeUtil.getTime());
return sharedQuestionMapper.updateById(findSharedQuestion);
}
}

View File

@ -1,72 +0,0 @@
package com.yzdx.AiInterviewer.utiles;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;
/**
* redis工具类
*/
@Component
public class RedisUtil {
@Resource
private RedisTemplate<String, Object> redisTemplate;
// 指定缓存失效时间
public Boolean expire(final String key, final long time) {
try {
if (time > 0) {
redisTemplate.expire(key, time, TimeUnit.SECONDS);
}
return true;
} catch (final Exception e) {
e.printStackTrace();
return false;
}
}
// 根据键获取值
public Object get(final String key) {
return key == null ? null : redisTemplate.opsForValue().get(key);
}
// <key, value>键值对存入redis
public Boolean set(final String key, final Object value) {
try {
redisTemplate.opsForValue().set(key, value);
return true;
} catch (final Exception e) {
e.printStackTrace();
return false;
}
}
// 将键值对存入value并设置过期时间
public Boolean set(final String key, final Object value, final long time) {
try {
if (time > 0) {
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
} else {
set(key, value);
}
return true;
} catch (final Exception e) {
e.printStackTrace();
return false;
}
}
// 删除键
public Boolean del(final String key) {
try {
redisTemplate.opsForValue().getAndDelete(key);
return true;
} catch (final Exception e) {
e.printStackTrace();
return false;
}
}
}

View File

@ -3,9 +3,9 @@ server:
spring:
datasource:
url: jdbc:mysql://101.43.255.47:3306/ai_interviewer?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: Jerry
password: 2002811
url: jdbc:mysql://localhost:3306/ai_interviewer?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
jackson:
default-property-inclusion: non_null
@ -18,11 +18,6 @@ spring:
profiles:
active: dev
redis:
database: 11
host: localhost
port: 6379
servlet:
multipart:
max-file-size: 50MB #单个文件大小限制