@
目录一、系统介绍
学生 : 个人信息、查看企业岗位信息、简历信息管理、我的应聘
辅导员 : 学生信息管理、三方协议书审核、查看班级就业统计信息
企业 :企业信息、岗位企业信息管理、查看学生简历信息、应聘信息管理
管理员:首页、个人信息管理、用户信息管理、学院专业管理、企业岗位管理、类型信息管理、简历信息管理、学生三方协议书审核、就业统计
运行环境 : idea、mysql、maven
二、功能展示
1.用户登陆注册
2.个人信息(学生端)
3.查看企业岗位信息(学生端)
4.我的应聘(学生端)
5.学生信息管理(辅导员)
6.三方协议书审核(辅导员)
7.查看班级就业统计信息(辅导员)
8.企业信息(企业)
9.岗位信息管理(企业)
10.查看学生简历信息(企业)
11.应聘信息管理(企业)
12.后台管理(管理员)
三、代码展示
package com.fang.backgroundapi.controller;
import com.fang.backgroundapi.common.ResponseCode;
import com.fang.backgroundapi.common.ServerResponse;
import com.fang.backgroundapi.exception.MyException;
import com.fang.backgroundapi.pojo.DO.ImageUpload;
import com.fang.backgroundapi.service.impl.ImageUploadServiceImpl;
import com.google.gson.Gson;
import com.qiniu.common.QiniuException;
import com.qiniu.http.Response;
import com.qiniu.storage.Configuration;
import com.qiniu.storage.Region;
import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.util.Auth;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* @author
* @Description: OSS对象存储控制器
* @create 2022/1/16 14:36
**/
@RestController
@RequestMapping("/oss")
@Api(tags = "OSS对象存储控制器")
@Slf4j
public class OSSController extends BaseController {
@Autowired
private ImageUploadServiceImpl imageUploadService;
private final String ACCESS_KEY = "tz2qyudkdq8-vBpT_U93E3TBZxUXXRCDkSMo5Q9C";
private final String SECRET_KEY = "5FChEdodFIOUQ4wCNRN8_ZTPMTYGDsC1ShJNnnLS";
private final String BUCKET = "img9527";
@PostMapping("/upload")
@ApiOperation(value = "上传接口", response = ServerResponse.class, httpMethod = "POST")
public ServerResponse upload(MultipartFile file) throws MyException {
if (file.isEmpty()) {
return ServerResponse.error(ResponseCode.FAIL.getCode(), ResponseCode.FAIL.getDesc(), null);
}
String authorId = super.getAuthorId();
//检查格式
String[] fileType = file.getContentType().split("/");
log.info("{}---->上传", authorId);
log.info("上传文件类型:{}", fileType);
if (!("png".equals(fileType[1]) || "jpeg".equals(fileType[1]))) {
log.info("不支持上传{}类型", fileType);
return ServerResponse.error(ResponseCode.FAIL.getCode(), ResponseCode.FAIL.getDesc(), null);
}
//文件大小做了整体配置,超过2M无法上传
// 自检通过,上传到七牛云,这些都是默认配置
Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);
String upToken = auth.uploadToken(BUCKET);
Region region = new Region.Builder().
region("z2").
srcUpHost("up-z2.qiniup.com", "up-dg.qiniup.com", "up-fs.qiniup.com").
accUpHost("upload-z2.qiniup.com", "upload-dg.qiniup.com", "upload-fs.qiniup.com").
iovipHost("iovip-z2.qbox.me").
rsHost("rs-z2.qbox.me").
rsfHost("rsf-z2.qbox.me").
apiHost("api-z2.qiniu.com").
build();
Configuration cfg = new Configuration(region);
cfg.useHttpsDomains = false;
UploadManager uploadManager = new UploadManager(cfg);
DefaultPutRet putRet = null;
try {
Response response = uploadManager.put(file.getInputStream(),null,upToken,null, null);
//解析上传成功的结果
putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
System.out.println(putRet.key);
System.out.println(putRet.hash);
} catch (QiniuException ex) {
ex.printStackTrace();
log.error("OSS存储错误-----> {}", ex.getMessage());
throw new MyException("出错了", 5000, ex);
} catch (IOException e) {
e.printStackTrace();
log.error("OSS存储错误-----> {}", e.getMessage());
throw new MyException("出错了", 5000, e);
}
if (putRet != null){
// 数据库保存
ImageUpload imageUpload = new ImageUpload();
imageUpload.setAuthorId(authorId);
imageUpload.setOriginalName(file.getOriginalFilename());
imageUpload.setSize(file.getSize());
imageUpload.setAddress("http://r96uify9u.hn-bkt.clouddn.com/" + putRet.key);
imageUpload.setUploader(authorId);
imageUpload.setType(fileType[1]);
imageUploadService.save(imageUpload);
return ServerResponse.success(imageUpload.getAddress());
}
return ServerResponse.error(5000,"oss存储失败", "NullPointerException");
}
}
四.获取源码
点击下载
基于Springboot+Mybatis+mysql+element-vue高校就业管理系统