diff --git a/src/main/java/com/yzdx/AiInterviewer/config/WebMvcConfig.java b/src/main/java/com/yzdx/AiInterviewer/config/WebMvcConfig.java index c42a09e..6176c0e 100644 --- a/src/main/java/com/yzdx/AiInterviewer/config/WebMvcConfig.java +++ b/src/main/java/com/yzdx/AiInterviewer/config/WebMvcConfig.java @@ -22,6 +22,7 @@ public class WebMvcConfig implements WebMvcConfigurer { .excludePathPatterns("/admin/login") // 添加swagger-ui的放行路径 .excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**","/doc.html/**") + .excludePathPatterns("/upload/**") ; } } \ No newline at end of file diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java b/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java index 4d6aa0d..1f67e08 100644 --- a/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java +++ b/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java @@ -143,13 +143,14 @@ public class InterviewController { String name=(String)addInfo.get("name"); String encoding=(String)addInfo.get("encoding"); String image=(String)addInfo.get("image"); + String video=(String)addInfo.get("video"); Integer userId=(Integer) addInfo.get("userId"); String filename=(String) addInfo.get("filename"); if(filename.equals("")){ return R.error("请添加图片!"); } - Integer row = imagesService.addImageLogo(name, encoding, image, userId,filename); + Integer row = imagesService.addImageLogo(name,encoding,image,video,userId,filename); if(row!=1){ return R.error("添加失败!"); diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/RecruitmentController.java b/src/main/java/com/yzdx/AiInterviewer/controller/RecruitmentController.java index 8be8ae2..69902ff 100644 --- a/src/main/java/com/yzdx/AiInterviewer/controller/RecruitmentController.java +++ b/src/main/java/com/yzdx/AiInterviewer/controller/RecruitmentController.java @@ -271,4 +271,34 @@ public class RecruitmentController { return R.success(companyDetail); } + @PostMapping("/update_companyDetail") + public R UpdateCompanyDetail(@RequestBody Map updateInfo){ + + List address=(List) updateInfo.get("address"); + + String addressDetail=(String) updateInfo.get("addressDetail"); + String companyDetail=(String) updateInfo.get("companyDetail"); + String companyName=(String) updateInfo.get("companyName"); + String creditCode=(String) updateInfo.get("creditCode"); + String encoding=(String) updateInfo.get("encoding"); + String established=(String) updateInfo.get("established"); + String images=(String) updateInfo.get("images"); + String legalRepresentative=(String) updateInfo.get("legalRepresentative"); + String treatment=(String)updateInfo.get("treatment"); + String registeredCapital=(String) updateInfo.get("registeredCapital"); + Integer userId=(Integer) updateInfo.get("userId"); + Integer row = companyService.updateCompanyDetail(address.toString(), addressDetail, + companyDetail, companyName, + creditCode, encoding, established, + images, legalRepresentative, + treatment, registeredCapital, userId + ); + if (row==-1){ + return R.error("更新失败"); + } + return R.success("更新成功"); + + + } + } diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/UploadController.java b/src/main/java/com/yzdx/AiInterviewer/controller/UploadController.java index 2cda6ec..031883c 100644 --- a/src/main/java/com/yzdx/AiInterviewer/controller/UploadController.java +++ b/src/main/java/com/yzdx/AiInterviewer/controller/UploadController.java @@ -4,14 +4,13 @@ package com.yzdx.AiInterviewer.controller; import com.yzdx.AiInterviewer.comment.R; import com.yzdx.AiInterviewer.utiles.ParseResumeUtil; 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.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpServletRequest; import java.io.File; import java.io.IOException; import java.util.*; @@ -25,9 +24,6 @@ public class UploadController { //设置上传文件的最大大小 public static final int MAX_SIZE=10*1024*1024; - public static final String UPLOAD_AVATAR_PATH = "D:\\vueStudy\\Ai-interviewer-ui\\src\\upload\\picture";//获取上传文件的路径(获取项目中名为‘upload’的文件夹) - public static final String UPLOAD_RESUME_PATH = "D:\\vueStudy\\Ai-interviewer-ui\\src\\upload\\resume";//获取上传文件的路径(获取项目中名为‘upload’的文件夹) - //设置文件的类型 public static final List AVATAR_TYPE=new ArrayList<>(); @@ -39,8 +35,8 @@ public class UploadController { AVATAR_TYPE.add("image/jpeg"); } - @PostMapping("/upload_companyImage") - public R upLoadPicture(HttpSession session, @RequestParam("file") MultipartFile file ,String encoding){ + @PostMapping("/upload_picture") + public R upLoadPicture(HttpServletRequest request, @RequestParam("file") MultipartFile file){ //MultipartFile是spring提供的类,可以接收所有的文件的类 @@ -58,12 +54,14 @@ public class UploadController { return R.error("文件类型不匹配"); } -// String uploadPath = session.getServletContext().getRealPath("upload");//获取上传文件的路径(获取项目中名为‘upload’的文件夹) + String uploadPath = request.getSession().getServletContext().getRealPath("/upload/picture/");//获取上传文件的路径(获取项目中名为‘upload’的文件夹) // String uploadPath = "D:\\vue学习\\Ai-interviewer-ui\\src\\upload";//获取上传文件的路径(获取项目中名为‘upload’的文件夹) // -// log.info(uploadPath); + log.info(uploadPath); - File dir=new File(UPLOAD_AVATAR_PATH);//指向名为‘upload’文件夹 + //指向名为‘upload’文件夹 + + File dir= new File(uploadPath); if(!dir.exists()){ dir.mkdirs();//若不存在,则创建该文件夹 @@ -88,21 +86,73 @@ public class UploadController { return R.error("文件存储出现异常"); } - String RealFilePath="http://localhost:5173/src/upload/picture/"+filename; + String RealFilePath="http://localhost:8080/upload/picture/"+filename; Map data=new HashMap<>(); data.put("image",RealFilePath); data.put("filename",filename); return R.success(data);//返回图片存储在服务器的地址 } + @PostMapping("/upload_video") + public R upLoadVideo(HttpServletRequest request, @RequestParam("file") MultipartFile file ){ + + +//MultipartFile是spring提供的类,可以接收所有的文件的类 + + log.info(file.getContentType()); + + if(file.isEmpty()){ + return R.error("请选择文件"); + } + + if (file.getSize() >MAX_SIZE){//file.getSize()获取接收文件的大小 + return R.error("文件大小超出最大限制"); + } + + + String uploadPath = request.getSession().getServletContext().getRealPath("/upload/video/");//获取上传文件的路径(获取项目中名为‘upload’的文件夹) + + + File dir= new File(uploadPath);//指向名为‘upload’文件夹 + + if(!dir.exists()){ + dir.mkdirs();//若不存在,则创建该文件夹 + } + + String originalFilename = file.getOriginalFilename();//获取文件的真实文件名 + + int index = originalFilename.lastIndexOf(".");//获取文件的后缀名‘.’的位置 + + String substring = originalFilename.substring(index);//返回文件类型名 例如:.jpg + + String filename = UUID.randomUUID().toString().toUpperCase()+substring;//新创建的文件名 + + File dest=new File(dir,filename);//创建一个空的文件 + + try { + + file.transferTo(dest); + + } catch (IOException e) { + + return R.error("文件存储出现异常"); + + } + + String RealFilePath="http://localhost:8080/upload/video/"+filename; + Map data=new HashMap<>(); + data.put("video",RealFilePath); + data.put("filename",filename); + return R.success(data);//返回图片存储在服务器的地址 + } @GetMapping("/delete_picture") - public R deletePicture(String imagePath){ + public R deletePicture(HttpServletRequest request,String imagePath){ if(imagePath==null||imagePath.equals("")){ return R.error("删除失败!"); } - + String uploadPath = request.getSession().getServletContext().getRealPath("/upload/picture/"); try { - File folder = new File(UPLOAD_AVATAR_PATH); + File folder = new File(uploadPath); File[] files = folder.listFiles(); for(File file:files){ if(file.getName().equals(imagePath)){ @@ -115,10 +165,31 @@ public class UploadController { } + } + @GetMapping("/delete_video") + public R deleteVideo(HttpServletRequest request,String videoPath){ + if(videoPath==null||videoPath.equals("")){ + return R.error("删除失败!"); + } + String uploadPath = request.getSession().getServletContext().getRealPath("/upload/picture/"); + try { + File folder = new File(uploadPath); + File[] files = folder.listFiles(); + for(File file:files){ + if(file.getName().equals(videoPath)){ + file.delete(); + } + } + return R.success("删除成功"); + } catch (Exception e) { + return R.error("删除失败"); + } + + } @PostMapping("/upload_resume") - public R uploadResume(HttpSession session, @RequestParam("file") MultipartFile file){ + public R uploadResume(HttpServletRequest request, @RequestParam("file") MultipartFile file){ if(file.isEmpty()){ return R.error("请选择文件"); } @@ -127,12 +198,9 @@ public class UploadController { return R.error("文件大小超出最大限制"); } -// String uploadPath = session.getServletContext().getRealPath("upload");//获取上传文件的路径(获取项目中名为‘upload’的文件夹) -// String uploadPath = "D:\\vue学习\\Ai-interviewer-ui\\src\\upload";//获取上传文件的路径(获取项目中名为‘upload’的文件夹) -// -// log.info(uploadPath); + String uploadPath = request.getSession().getServletContext().getRealPath("/upload/resume/"); - File dir=new File(UPLOAD_RESUME_PATH);//指向名为‘upload’文件夹 + File dir= new File(uploadPath); if(!dir.exists()){ dir.mkdirs();//若不存在,则创建该文件夹 @@ -157,12 +225,13 @@ public class UploadController { return R.error("文件存储出现异常"); } - String RealFilePath="http://localhost:5173/src/upload/resume/"+fileName; + String RealFilePath="http://localhost:8080/upload/resume/"+fileName; ExecutorService pool= Executors.newCachedThreadPool(); pool.submit(new Runnable() { @Override public void run() { - ParseResumeUtil.ParseChineseResume(UPLOAD_RESUME_PATH+"\\"+fileName); + + ParseResumeUtil.ParseChineseResume( request.getSession().getServletContext().getRealPath("/upload/resume/")+"\\"+fileName); } }); @@ -178,13 +247,14 @@ public class UploadController { } @GetMapping("/delete_resume") - public R deleteResume(String resumePath){ + public R deleteResume(HttpServletRequest request,String resumePath){ if(resumePath==null||resumePath.equals("")){ return R.error("删除失败!"); } + String uploadPath = request.getSession().getServletContext().getRealPath("/upload/resume/"); try { - File folder = new File(UPLOAD_AVATAR_PATH); + File folder = new File(uploadPath); File[] files = folder.listFiles(); for(File file:files){ if(file.getName().equals(resumePath)){ @@ -200,62 +270,6 @@ public class UploadController { } - @PostMapping("/upload_picture") - public R uploadCompanyImage(HttpSession session, @RequestParam("file") MultipartFile file){ - //MultipartFile是spring提供的类,可以接收所有的文件的类 - - log.info(file.getContentType()); - - if(file.isEmpty()){ - return R.error("请选择文件"); - } - - if (file.getSize() >MAX_SIZE){//file.getSize()获取接收文件的大小 - return R.error("文件大小超出最大限制"); - } - if(!AVATAR_TYPE.contains(file.getContentType())){//自定义接收文件的类型 - return R.error("文件类型不匹配"); - } - -// String uploadPath = session.getServletContext().getRealPath("upload");//获取上传文件的路径(获取项目中名为‘upload’的文件夹) -// String uploadPath = "D:\\vue学习\\Ai-interviewer-ui\\src\\upload";//获取上传文件的路径(获取项目中名为‘upload’的文件夹) -// -// log.info(uploadPath); - - File dir=new File(UPLOAD_AVATAR_PATH);//指向名为‘upload’文件夹 - - if(!dir.exists()){ - dir.mkdirs();//若不存在,则创建该文件夹 - } - - String originalFilename = file.getOriginalFilename();//获取文件的真实文件名 - - int index = originalFilename.lastIndexOf(".");//获取文件的后缀名‘.’的位置 - - String substring = originalFilename.substring(index);//返回文件类型名 例如:.jpg - - String filename= UUID.randomUUID().toString().toUpperCase()+substring;//新创建的文件名 - - File dest=new File(dir,filename);//创建一个空的文件 - - try { - - file.transferTo(dest); - - } catch (IOException e) { - - return R.error("文件存储出现异常"); - - } - String RealFilePath="http://localhost:5173/src/upload/picture/"+filename; - - Map data=new HashMap<>(); - data.put("image",RealFilePath); - data.put("filename",filename); - - return R.success(data);//返回图片存储在服务器的地址 - - } } diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/UserController.java b/src/main/java/com/yzdx/AiInterviewer/controller/UserController.java index c55b621..1aab99f 100644 --- a/src/main/java/com/yzdx/AiInterviewer/controller/UserController.java +++ b/src/main/java/com/yzdx/AiInterviewer/controller/UserController.java @@ -156,4 +156,25 @@ public class UserController { } return userService.resetPassword(userId,oldPassword,password); } + + @PostMapping("/upload_userInfo") + public R updateUserInfo(@RequestBody Map updateInfo){ + + Integer userId=(Integer) updateInfo.get("userId"); + Integer updateId=(Integer) updateInfo.get("updateId"); + String username=(String) updateInfo.get("username"); + String age=(String) updateInfo.get("age"); + String email=(String) updateInfo.get("email"); + String sex=(String) updateInfo.get("sex"); + + if(updateId==userId||userId==null||userId.equals("")){ + userId=null; + User user = userService.updateUserInfo(userId, updateId, username, age, email, sex); + + return R.success(user); + }else{ + User user = userService.updateUserInfo(userId, updateId, username, age, email, sex); + return R.success(user); + } + } } diff --git a/src/main/java/com/yzdx/AiInterviewer/entity/Company.java b/src/main/java/com/yzdx/AiInterviewer/entity/Company.java index 9c75bf0..d43534f 100644 --- a/src/main/java/com/yzdx/AiInterviewer/entity/Company.java +++ b/src/main/java/com/yzdx/AiInterviewer/entity/Company.java @@ -34,7 +34,7 @@ public class Company extends BaseEntity{ @ApiModelProperty("注册资本") private String registeredCapital; @ApiModelProperty("成立日期") - private Date established; + private String established; @ApiModelProperty("统一信用编码") private String creditCode; @ApiModelProperty("公司图片") diff --git a/src/main/java/com/yzdx/AiInterviewer/entity/ImagesEntity.java b/src/main/java/com/yzdx/AiInterviewer/entity/ImagesEntity.java index fb87385..f90c15e 100644 --- a/src/main/java/com/yzdx/AiInterviewer/entity/ImagesEntity.java +++ b/src/main/java/com/yzdx/AiInterviewer/entity/ImagesEntity.java @@ -12,8 +12,10 @@ public class ImagesEntity extends BaseEntity{ @ApiModelProperty("面试官形象id") @TableId(type = IdType.AUTO) private Integer id; - @ApiModelProperty("面试官形象url地址") + @ApiModelProperty("面试官形象图片url地址") private String image; + @ApiModelProperty("面试官形象视频url地址") + private String video; @ApiModelProperty("形象图片名称") private String picName; @ApiModelProperty("公司编码") diff --git a/src/main/java/com/yzdx/AiInterviewer/entity/SharedQuestion.java b/src/main/java/com/yzdx/AiInterviewer/entity/SharedQuestion.java new file mode 100644 index 0000000..4e01476 --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/entity/SharedQuestion.java @@ -0,0 +1,25 @@ +package com.yzdx.AiInterviewer.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("分享题目实体类") +@TableName("sharedQuestion") +public class SharedQuestion extends BaseEntity { + @ApiModelProperty("题目id") + @TableId(type = IdType.AUTO) + private Integer id; + @ApiModelProperty("题目标题") + private String title; + @ApiModelProperty("题目详情") + private String details; + @ApiModelProperty("题目对应的promote") + private String promote; + @ApiModelProperty("题库id") + private Integer bankId; +} diff --git a/src/main/java/com/yzdx/AiInterviewer/entity/SharedQuestionBank.java b/src/main/java/com/yzdx/AiInterviewer/entity/SharedQuestionBank.java new file mode 100644 index 0000000..fdd4530 --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/entity/SharedQuestionBank.java @@ -0,0 +1,23 @@ +package com.yzdx.AiInterviewer.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@ApiModel("分享题库实体类") +@Data +@TableName("sharedBank") +public class SharedQuestionBank extends BaseEntity{ + @ApiModelProperty("题库id") + @TableId(type = IdType.AUTO) + private Integer id; + @ApiModelProperty("题库名称") + private String typeName; + @ApiModelProperty("题库类型") + private Integer type; + @ApiModelProperty("描述") + private String description; +} diff --git a/src/main/java/com/yzdx/AiInterviewer/mapper/SharedQuestionBankMapper.java b/src/main/java/com/yzdx/AiInterviewer/mapper/SharedQuestionBankMapper.java new file mode 100644 index 0000000..b4e9a24 --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/mapper/SharedQuestionBankMapper.java @@ -0,0 +1,9 @@ +package com.yzdx.AiInterviewer.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yzdx.AiInterviewer.entity.SharedQuestionBank; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SharedQuestionBankMapper extends BaseMapper { +} diff --git a/src/main/java/com/yzdx/AiInterviewer/mapper/SharedQuestionMapper.java b/src/main/java/com/yzdx/AiInterviewer/mapper/SharedQuestionMapper.java new file mode 100644 index 0000000..e40ec93 --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/mapper/SharedQuestionMapper.java @@ -0,0 +1,9 @@ +package com.yzdx.AiInterviewer.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yzdx.AiInterviewer.entity.SharedQuestion; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SharedQuestionMapper extends BaseMapper { +} diff --git a/src/main/java/com/yzdx/AiInterviewer/service/CompanyService.java b/src/main/java/com/yzdx/AiInterviewer/service/CompanyService.java index 278c060..67130a3 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/CompanyService.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/CompanyService.java @@ -12,4 +12,33 @@ public interface CompanyService extends IService { * * */ Company getCompanyDetail(String encoding); +/** + * 更新公司详情 + * @param userId 跟新人的id + * @param encoding 跟心公司的编码 + * @param address 公司地址 + * @param companyDetail 公司详情 + * @param addressDetail 公司详情地址 + * @param companyName 公司名称 + * @param creditCode 公司统一编码 + * @param established 公司的注册资金 + * @param images 公司图片 + * @param legalRepresentative 法定人 + * @param registeredCapital 注册资金 + * @param treatment 公司待遇 + * @return 影响的行数 + * + * */ + Integer updateCompanyDetail(String address, + String addressDetail, + String companyDetail, + String companyName, + String creditCode, + String encoding, + String established, + String images, + String legalRepresentative, + String treatment, + String registeredCapital, + Integer userId); } diff --git a/src/main/java/com/yzdx/AiInterviewer/service/InterviewImagesService.java b/src/main/java/com/yzdx/AiInterviewer/service/InterviewImagesService.java index 32c9c85..3efb884 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/InterviewImagesService.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/InterviewImagesService.java @@ -25,7 +25,7 @@ public interface InterviewImagesService extends IService { * @return 映像的行数 * * */ - Integer addImageLogo(String name,String encoding,String image,Integer userId,String filename); + Integer addImageLogo(String name,String encoding,String image,String video,Integer userId,String filename); /** * 添加logo diff --git a/src/main/java/com/yzdx/AiInterviewer/service/SharedQuestionBankService.java b/src/main/java/com/yzdx/AiInterviewer/service/SharedQuestionBankService.java new file mode 100644 index 0000000..8b047a5 --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/service/SharedQuestionBankService.java @@ -0,0 +1,9 @@ +package com.yzdx.AiInterviewer.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.yzdx.AiInterviewer.entity.SharedQuestionBank; + +public interface SharedQuestionBankService extends IService { + + +} diff --git a/src/main/java/com/yzdx/AiInterviewer/service/SharedQuestionService.java b/src/main/java/com/yzdx/AiInterviewer/service/SharedQuestionService.java new file mode 100644 index 0000000..34eeec0 --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/service/SharedQuestionService.java @@ -0,0 +1,7 @@ +package com.yzdx.AiInterviewer.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.yzdx.AiInterviewer.entity.SharedQuestion; + +public interface SharedQuestionService extends IService { +} diff --git a/src/main/java/com/yzdx/AiInterviewer/service/UserService.java b/src/main/java/com/yzdx/AiInterviewer/service/UserService.java index 8b952dd..6b61649 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/UserService.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/UserService.java @@ -85,5 +85,17 @@ public interface UserService extends IService { * */ R resetPassword(Integer userId,String oldPassword,String password); + /** + * @param userId 操作人的id + * @param updateId 更新人的id + * @param username 修改的名称 + * @param age 修改的年龄 + * @param email 修改的电子邮箱 + * @param sex 修改的性别 + * @return 返回user对象 + * + * */ + User updateUserInfo(Integer userId,Integer updateId,String username,String age,String email,String sex); + } diff --git a/src/main/java/com/yzdx/AiInterviewer/service/impl/CompanyServiceImpl.java b/src/main/java/com/yzdx/AiInterviewer/service/impl/CompanyServiceImpl.java index f271bbb..ec0e825 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/impl/CompanyServiceImpl.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/impl/CompanyServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.yzdx.AiInterviewer.entity.Company; import com.yzdx.AiInterviewer.mapper.CompanyMapper; import com.yzdx.AiInterviewer.service.CompanyService; +import com.yzdx.AiInterviewer.utiles.TimeUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -24,4 +25,33 @@ public class CompanyServiceImpl extends ServiceImpl impl return company; } + + @Override + public Integer updateCompanyDetail(String address, String addressDetail, String companyDetail, String companyName, String creditCode, String encoding, String established, String images, String legalRepresentative, String treatment, String registeredCapital, Integer userId) { + if (address==null||addressDetail==null||companyDetail==null||companyName==null||creditCode==null||established==null||images==null||legalRepresentative==null + ||treatment==null||registeredCapital==null||userId==null){ + return -1; + } + //通过公司编码查询公司 + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(Company::getEncoding,encoding); + Company company = companyMapper.selectOne(queryWrapper); + company.setAddress(address); + company.setAddressDetail(addressDetail); + company.setCompanyDetail(companyDetail); + company.setCompanyName(companyName); + company.setCreditCode(creditCode); + company.setEstablished(established); + company.setImages(images); + company.setLegalRepresentative(legalRepresentative); + company.setTreatment(treatment); + company.setRegisteredCapital(registeredCapital); + company.setUpdateTime(TimeUtil.getTime()); + company.setUpdateUser(userId); + Integer i = companyMapper.updateById(company); + return i; + + } + + } diff --git a/src/main/java/com/yzdx/AiInterviewer/service/impl/InterviewImagesServiceImpl.java b/src/main/java/com/yzdx/AiInterviewer/service/impl/InterviewImagesServiceImpl.java index 599d1e1..dd918e4 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/impl/InterviewImagesServiceImpl.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/impl/InterviewImagesServiceImpl.java @@ -30,17 +30,32 @@ public class InterviewImagesServiceImpl extends ServiceImpl implements SharedQuestionBankService{ + @Autowired + private SharedQuestionBankMapper sharedQuestionBankMapper; + + + +} diff --git a/src/main/java/com/yzdx/AiInterviewer/service/impl/SharedQuestionServiceImpl.java b/src/main/java/com/yzdx/AiInterviewer/service/impl/SharedQuestionServiceImpl.java new file mode 100644 index 0000000..7fbaebb --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/service/impl/SharedQuestionServiceImpl.java @@ -0,0 +1,15 @@ +package com.yzdx.AiInterviewer.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yzdx.AiInterviewer.entity.SharedQuestion; +import com.yzdx.AiInterviewer.mapper.SharedQuestionBankMapper; +import com.yzdx.AiInterviewer.mapper.SharedQuestionMapper; +import com.yzdx.AiInterviewer.service.SharedQuestionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class SharedQuestionServiceImpl extends ServiceImpl implements SharedQuestionService { + + +} diff --git a/src/main/java/com/yzdx/AiInterviewer/service/impl/UserServiceImpl.java b/src/main/java/com/yzdx/AiInterviewer/service/impl/UserServiceImpl.java index 3311656..7597f5c 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/impl/UserServiceImpl.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/impl/UserServiceImpl.java @@ -253,7 +253,7 @@ public class UserServiceImpl extends ServiceImpl implements Us String findUserPassword = findUser.getPassword(); oldPassword = MD5Util.GetMD5Password(oldPassword, salt); if(!findUserPassword.equals(oldPassword)){ - return R.error("旧密码输入错误,请检查输入"); + return R.error("旧密码输入错误,请检查输入,或联系管理员修改密码!"); } //密码正确 password = MD5Util.GetMD5Password(password, salt); @@ -271,6 +271,44 @@ public class UserServiceImpl extends ServiceImpl implements Us } + @Override + public User updateUserInfo(Integer userId, Integer updateId,String username, String age, String email, String sex) { + //判断是否用户自己修改自己的数据 + if (userId==null||userId.equals("")) { + //查找对象 + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + + queryWrapper.eq(User::getId,updateId); + + User findUser = userMapper.selectOne(queryWrapper); + + findUser.setUsername(username); + + findUser.setAge(age); + + findUser.setEmail(email); + + findUser.setSex(sex); + + findUser.setUpdateUser(updateId); + + findUser.setUpdateTime(TimeUtil.getTime()); + + userMapper.updateById(findUser); + + //对敏感数据进行处理 + findUser.setPassword(""); + + findUser.setSalt(""); + + return findUser; + }else { + + return null; + } + + } + } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 6fa8e38..08b7d81 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,11 +1,11 @@ server: - port: 80 + port: 8080 spring: datasource: - url: jdbc:mysql://101.43.255.47:3306/ai_interviewer?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai + url: jdbc:mysql://localhost:3306/ai_interviewer?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai username: root - password: 2002811 + password: root jackson: default-property-inclusion: non_null