parent
082e0631ce
commit
61825be40b
@ -0,0 +1,17 @@
|
||||
package edu.ahbvc.recruit;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author c215
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@MapperScan(basePackages = "edu.ahbvc.recruit.mapper")
|
||||
public class RecruitApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(RecruitApplication.class, args);
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package edu.ahbvc.recruit.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import edu.ahbvc.recruit.mapper.AdminInter;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import edu.ahbvc.recruit.model.Admin;
|
||||
|
||||
/**
|
||||
* @author c215
|
||||
*/
|
||||
@Service
|
||||
public class AdminServiceImpl {
|
||||
|
||||
private final AdminInter mapper;
|
||||
|
||||
public AdminServiceImpl(AdminInter mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
public Admin getOne(int id) {
|
||||
return mapper.getOne(id);
|
||||
}
|
||||
|
||||
public String isAdmin(String phone) {
|
||||
return mapper.isAdmin(phone);
|
||||
}
|
||||
|
||||
public Integer getAdminsNum(String name,String phone) {
|
||||
return mapper.getAdminsNum(name, phone);
|
||||
}
|
||||
|
||||
public Admin login(String num, String pwd) {
|
||||
return mapper.login(num, pwd);
|
||||
}
|
||||
|
||||
public List<Admin> getAdmins(int offset, int size, String name, String phone) {
|
||||
return mapper.getAdmins(offset, size, name, phone);
|
||||
}
|
||||
|
||||
public int addAdmin(Admin admin) {
|
||||
return mapper.addAdmin(admin);
|
||||
}
|
||||
|
||||
public int delAdmin(int id) {
|
||||
return mapper.delAdmin(id);
|
||||
}
|
||||
|
||||
public int updateAdmin(Admin ad) {
|
||||
return mapper.updateAdmin(ad);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,251 @@
|
||||
package edu.ahbvc.recruit.service;
|
||||
|
||||
import edu.ahbvc.recruit.mapper.ThingInter;
|
||||
import edu.ahbvc.recruit.model.Batch;
|
||||
import edu.ahbvc.recruit.model.Position;
|
||||
import edu.ahbvc.recruit.model.Thing;
|
||||
import edu.ahbvc.recruit.model.ThingWithUser;
|
||||
import edu.ahbvc.recruit.model.export.Excel;
|
||||
import edu.ahbvc.recruit.model.export.Ticket;
|
||||
import edu.ahbvc.recruit.util.AdmissionTicketCreater;
|
||||
import edu.ahbvc.recruit.util.ExcelExporter;
|
||||
import edu.ahbvc.recruit.util.file.FilePatch;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c215
|
||||
*/
|
||||
@Service
|
||||
public class ThingServiceImpl {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ThingServiceImpl.class);
|
||||
private final ThingInter mapper;
|
||||
|
||||
@Autowired
|
||||
public ThingServiceImpl(ThingInter mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<ThingWithUser> getThings(List<Integer> id) {
|
||||
return mapper.getThingsById(id);
|
||||
}
|
||||
|
||||
public List<ThingWithUser> getThings(int currentPage, int size, List<Integer> jobTitles,
|
||||
List<Integer> batch, List<Integer> status, String name) {
|
||||
List<ThingWithUser> list = mapper.getThings(currentPage, size, jobTitles, batch, status, name);
|
||||
if(!list.isEmpty()) {
|
||||
System.out.println(list.get(list.size()-1).getTime());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ThingWithUser> getAuditThings(int currentPage, int size, List<Integer> jobTitles,
|
||||
List<Integer> batch) {
|
||||
return mapper.getAuditThings(currentPage, size, jobTitles, batch);
|
||||
}
|
||||
|
||||
public Integer getThingsNum(List<Integer> jobTitles, List<Integer> batch, List<Integer> status, String name) {
|
||||
return mapper.getThingsNum(jobTitles, batch, status, name);
|
||||
}
|
||||
|
||||
public int getUnsettledThingsNum() {
|
||||
return mapper.getUnsettledThingsNum();
|
||||
}
|
||||
|
||||
|
||||
public List<Batch> getBatchOption() {
|
||||
return mapper.getBatchOption();
|
||||
}
|
||||
|
||||
public Batch getBatch(int id) {
|
||||
return mapper.getBatch(id);
|
||||
}
|
||||
|
||||
public int updateBatch(Batch batch) {
|
||||
return mapper.updateBatch(batch);
|
||||
}
|
||||
|
||||
public int switchBatchOpen(int id) {
|
||||
mapper.updateBatchClose();
|
||||
return mapper.updateBatchOpen(id);
|
||||
}
|
||||
|
||||
public int addBatch(Batch batch) {
|
||||
return mapper.addBatch(batch);
|
||||
}
|
||||
|
||||
public int delBatch(int id) {
|
||||
return mapper.delBatch(id);
|
||||
}
|
||||
|
||||
public List<Batch> getBatches(int currentPage, int size, String key, Integer state) {
|
||||
return mapper.getBatches(currentPage, size, key, state);
|
||||
}
|
||||
|
||||
public Batch getCurrentBatches() {
|
||||
return mapper.getCurrentBatch();
|
||||
}
|
||||
|
||||
public List<Batch> getOpenBatches() {
|
||||
return mapper.getBatches(0, Integer.MAX_VALUE, null, 1);
|
||||
}
|
||||
|
||||
public int getBatchesNum(String key, Integer state) {
|
||||
return mapper.getBatchesNum(key, state);
|
||||
}
|
||||
|
||||
public List<Position> getPositionOption() {
|
||||
return mapper.getPositionOption();
|
||||
}
|
||||
|
||||
public List<Position> getPositions(int currentPage, int size) {
|
||||
return mapper.getPositions(currentPage, size);
|
||||
}
|
||||
|
||||
public int getPositionsNum() {
|
||||
return mapper.getPositionsNum();
|
||||
}
|
||||
|
||||
public List<Position> getSomePosition(int batchId, int offset, int size) {
|
||||
return mapper.getSomePosition(batchId, offset, size);
|
||||
}
|
||||
|
||||
public Position getOnePosition(int id) {
|
||||
return mapper.getOnePosition(id);
|
||||
}
|
||||
|
||||
public int addPosition(Position p) {
|
||||
return mapper.addPosition(p);
|
||||
}
|
||||
|
||||
public int delPosition(int id) {
|
||||
return mapper.delPosition(id);
|
||||
}
|
||||
|
||||
public int delPositions(List<Integer> id) {
|
||||
int i;
|
||||
try {
|
||||
i = mapper.delPositions(id);
|
||||
} catch (DataIntegrityViolationException e) {
|
||||
// 记录异常信息
|
||||
log.error(e.getMessage());
|
||||
// 返回一个错误标志
|
||||
return -1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public int updatePosition(Position p) {
|
||||
return mapper.updatePosition(p);
|
||||
}
|
||||
|
||||
public List<Batch> getthingForuser(int userid, int batch) {
|
||||
return mapper.getthingForuser(userid, batch);
|
||||
}
|
||||
|
||||
public int refuseThing(int thingid, int status, String qualificationResult) {
|
||||
return mapper.refuseThing(thingid, status, qualificationResult);
|
||||
}
|
||||
|
||||
public int updateThingStatus(int thingid, int status) {
|
||||
return mapper.updateThingStatus(thingid, status);
|
||||
}
|
||||
|
||||
public int updateThingInfo(int thingid, String awardsAndPunishments, String note, String qualificationResult) {
|
||||
return mapper.updateThingInfo(thingid, awardsAndPunishments, note, qualificationResult);
|
||||
}
|
||||
|
||||
|
||||
public int updateThingInfo(int thingid, String qualificationResult) {
|
||||
return mapper.updateThingQualification(thingid, qualificationResult);
|
||||
}
|
||||
|
||||
public ThingWithUser getOneThing(int thingid) {
|
||||
return mapper.getOneThing(thingid);
|
||||
}
|
||||
|
||||
public List<Thing> getThingAboutUser(int userid) {
|
||||
return mapper.getThingAboutUser(userid);
|
||||
}
|
||||
|
||||
public List<Thing> getRecruits(int currentPage, int size, List<Integer> jobTitles, List<Integer> batch) {
|
||||
return mapper.getRecruits(currentPage, size, jobTitles, batch);
|
||||
}
|
||||
|
||||
public int getRecruitNum(List<Integer> jobTitles, List<Integer> batch) {
|
||||
return mapper.getRecruitNum(jobTitles, batch);
|
||||
}
|
||||
|
||||
public int addRecruit(Integer batchid, Integer positionid) {
|
||||
return mapper.addRecruit(batchid, positionid);
|
||||
}
|
||||
|
||||
public int updateRecruit(Integer id, Integer batchid, Integer positionid) {
|
||||
return mapper.updateRecruit(id, batchid, positionid);
|
||||
}
|
||||
|
||||
public int deleteRecruit(int id) {
|
||||
try {
|
||||
return mapper.deleteRecruit(id);
|
||||
} catch (DataIntegrityViolationException e) {
|
||||
// 捕获外键约束违反异常
|
||||
log.error(e.getMessage());
|
||||
// 返回一个错误标志
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public String outPutExcel() {
|
||||
String saveExcelFilePath = FilePatch.SaveExcelFilePath;
|
||||
ArrayList<Excel> printData = mapper.getPrintData();
|
||||
int excelFile = ExcelExporter.getExcelFile(saveExcelFilePath);
|
||||
|
||||
int excel = ExcelExporter.exportToExcel(printData,saveExcelFilePath);
|
||||
if(excel!=0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return saveExcelFilePath + "招聘总表.xlsx";
|
||||
}
|
||||
|
||||
public String previewTicket(Integer id, Integer recruitid) {
|
||||
Ticket ticketData = mapper.getTicketData(recruitid, id);
|
||||
return AdmissionTicketCreater.generateUserDocument(ticketData);
|
||||
}
|
||||
|
||||
public int conformPrintTicket(Integer thingid, Integer recruitid) {
|
||||
int ticketNum = mapper.getTicketNum(recruitid);
|
||||
int printedTicket = mapper.isPrintedTicket(thingid);
|
||||
int ticketData;
|
||||
if(printedTicket==0)
|
||||
// 如果是没有打印过准考证的,就去当前岗位中的最大值加一
|
||||
{
|
||||
ticketData = mapper.setTicketPrinted(ticketNum+1, thingid);
|
||||
} else
|
||||
// 否则就使用原来的准考证序号
|
||||
{
|
||||
ticketData = mapper.setTicketPrinted(printedTicket, thingid);
|
||||
}
|
||||
return ticketData;
|
||||
}
|
||||
|
||||
|
||||
public int getOldTicketNum(Integer thingid, Integer recruitid) {
|
||||
return mapper.isPrintedTicket(thingid);
|
||||
}
|
||||
|
||||
public boolean isPrintedTicket(Integer thingid) {
|
||||
int ticketData = mapper.isPrintedTicket(thingid);
|
||||
return ticketData!=0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package edu.ahbvc.recruit.service.api;
|
||||
|
||||
import edu.ahbvc.recruit.model.api.ImageCaptchaResponse;
|
||||
import edu.ahbvc.recruit.model.api.SMApiResponse;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 封装了第三方API服务
|
||||
* @author c215
|
||||
*/
|
||||
@Service
|
||||
public interface ApiService {
|
||||
String MOCK_CAPTCHA = "1";
|
||||
/**
|
||||
* 获取图片验证码
|
||||
* @return 图片验证码
|
||||
*/
|
||||
ImageCaptchaResponse getImgCode();
|
||||
|
||||
/**
|
||||
* 发送短信验证码
|
||||
* @param captcha 图片验证码
|
||||
* @param tel 手机号
|
||||
* @return 封装好的短信验证码响应
|
||||
*/
|
||||
SMApiResponse sendSM(String captcha, String tel);
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package edu.ahbvc.recruit.service.api;
|
||||
|
||||
import edu.ahbvc.recruit.model.api.ImageCaptchaResponse;
|
||||
import edu.ahbvc.recruit.model.api.JsonReader;
|
||||
import edu.ahbvc.recruit.model.api.SMApiResponse;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author c215
|
||||
*/
|
||||
@Profile("prod")
|
||||
@Repository
|
||||
public class RealApiServiceImpl implements ApiService {
|
||||
|
||||
/**
|
||||
* 使用Log4j2 LogManager获取Logger实例
|
||||
* 提供日志服务
|
||||
*/
|
||||
private static final Logger logger = LogManager.getLogger(RealApiServiceImpl.class);
|
||||
|
||||
|
||||
/**
|
||||
* 图片验证码
|
||||
* Image verification code
|
||||
* @return 自定义包装类, 包含图片验证码相关信息
|
||||
* @see <a href="https://www.apispace.com/eolink/api/lwtpyzmsc/apiDocument">接口文档</a>
|
||||
*/
|
||||
@Override
|
||||
public ImageCaptchaResponse getImgCode() {
|
||||
|
||||
URI url = null;
|
||||
try {
|
||||
url = new URI("https://eolink.o.apispace.com/lwtpyzmsc/common/verify/getComplicateVerifyImage");
|
||||
} catch (URISyntaxException e) {
|
||||
logger.error("图片验证码URI异常");
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
// 准备调用api的请求头
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
String MyKey = "p4jb13padiv8g31wdaqlva6xoeoygdnw";
|
||||
headers.add("X-APISpace-Token", MyKey);
|
||||
headers.add("Authorization-Type", "apikey");
|
||||
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
|
||||
JsonReader<ImageCaptchaResponse> jsonReader = new JsonReader<>();
|
||||
|
||||
// 准备调用api的请求体
|
||||
MultiValueMap<String, String> requestBody = new LinkedMultiValueMap<>();
|
||||
//验证码类型
|
||||
// (1:纯数字,2:小写字母,3:大写字母,4:数字+小写字母,5:数字+大写字母,6:数字+大小写字母,7:大小写字母)
|
||||
requestBody.add("codeType", "1");
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
// 发送调用api请求
|
||||
RequestEntity<MultiValueMap<String, String>> requestEntity = new RequestEntity<>(
|
||||
requestBody, headers, HttpMethod.POST, url);
|
||||
|
||||
// 返回结果是JSON,转换成字符串
|
||||
ResponseEntity<String> responseEntity = restTemplate.exchange(requestEntity, String.class);
|
||||
|
||||
// api返回的内容是JSON
|
||||
String responseData = responseEntity.getBody();
|
||||
|
||||
// 输出api返回的结果
|
||||
logger.debug("图片验证码api返回结果" + responseData);
|
||||
|
||||
ImageCaptchaResponse processApiResponse;
|
||||
|
||||
processApiResponse = jsonReader.processApiResponse(responseData, ImageCaptchaResponse.class);
|
||||
|
||||
return processApiResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SMApiResponse sendSM(String captcha, String tel){
|
||||
URI url = null;
|
||||
|
||||
try {
|
||||
url = new URI("http://api.1cloudsp.com/api/v2/single_send");
|
||||
} catch (URISyntaxException e) {
|
||||
logger.info("短信验证码URI异常");
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
// 准备调用api的请求头
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Authorization-Type", "apikey");
|
||||
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
|
||||
// 用户开发key
|
||||
String accesskey = "nBWSTPoSwKmBbP81";
|
||||
// 用户开发秘钥
|
||||
String accessSecret = "Tp5u0ff4K3qpzoqDcxtHaDgcTYGphSQw";
|
||||
|
||||
// 准备调用api的请求体
|
||||
MultiValueMap<String, String> requestBody = new LinkedMultiValueMap<>();
|
||||
requestBody.add("accesskey", accesskey);
|
||||
requestBody.add("secret", accessSecret);
|
||||
requestBody.add("sign", "299439");
|
||||
requestBody.add("templateId", "277804");
|
||||
requestBody.add("mobile", tel);
|
||||
requestBody.add("content", URLEncoder.encode(captcha, StandardCharsets.UTF_8));
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
JsonReader<SMApiResponse> jsonReader = new JsonReader<>();
|
||||
|
||||
// 发送调用api请求
|
||||
RequestEntity<MultiValueMap<String, String>> requestEntity = new RequestEntity<>(
|
||||
requestBody, headers, HttpMethod.POST, url);
|
||||
|
||||
// 返回结果是JSON,转换成字符串
|
||||
ResponseEntity<String> responseEntity = restTemplate.exchange(requestEntity, String.class);
|
||||
|
||||
// api返回的内容是JSON
|
||||
String responseData = responseEntity.getBody();
|
||||
|
||||
// 输出api返回的结果
|
||||
logger.info("短信验证码api返回结果" + responseData);
|
||||
|
||||
SMApiResponse processApiResponse;
|
||||
|
||||
processApiResponse = jsonReader.processApiResponse(responseData, SMApiResponse.class);
|
||||
|
||||
return processApiResponse;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,173 @@
|
||||
package edu.ahbvc.recruit.util;
|
||||
|
||||
|
||||
import edu.ahbvc.recruit.model.export.Excel;
|
||||
import edu.ahbvc.recruit.model.resume.Education;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author c215
|
||||
*/
|
||||
public class ExcelExporter {
|
||||
|
||||
/**
|
||||
* 使用Log4j2 LogManager获取Logger实例
|
||||
*/
|
||||
private static final Logger logger = LogManager.getLogger(ExcelExporter.class);
|
||||
|
||||
/**
|
||||
* @param data 导出的Excel的数据
|
||||
* @param path 导出的Excel的路径
|
||||
* @return 0:正常,,-1:异常
|
||||
*/
|
||||
public static int exportToExcel(ArrayList<Excel> data, String path) {
|
||||
if (data == null) {
|
||||
logger.warn("传入数据为空");
|
||||
return -1;
|
||||
}
|
||||
logger.info("开始生成总表");
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
Sheet sheet = workbook.createSheet("Data");
|
||||
// 设置样式解决含有'\n'不自动换行的问题
|
||||
CellStyle cellStyle = workbook.createCellStyle();
|
||||
// 设置单元格样式为自动换行
|
||||
cellStyle.setWrapText(true);
|
||||
// Create header row
|
||||
Row headerRow = sheet.createRow(0);
|
||||
// Assuming first column is "No", second is "Code", etc.
|
||||
String[] columnHeaders = {"序号", "岗位代码", "姓名", "性别", "出生日期", "身份证号码", "政治面貌", "民族", "毕业学校", "所学专业", "学历", "学位",
|
||||
"毕业时间", "联系电话", "资格审查结果", "备注"};
|
||||
for (int i = 0; i < columnHeaders.length; i++) {
|
||||
Cell cell = headerRow.createCell(i);
|
||||
cell.setCellValue(columnHeaders[i]);
|
||||
}
|
||||
|
||||
// Fill data
|
||||
int rowNum = 1;
|
||||
for (Excel item : data) {
|
||||
Row row = sheet.createRow(rowNum++);
|
||||
row.createCell(0).setCellValue(rowNum - 1);
|
||||
row.createCell(1).setCellValue(item.getCode());
|
||||
row.createCell(2).setCellValue(item.getName());
|
||||
row.createCell(3).setCellValue(item.getSex() == 1 ? "男" : "女");
|
||||
row.createCell(4).setCellValue(item.getBirthday());
|
||||
row.createCell(5).setCellValue(item.getIdnum());
|
||||
row.createCell(6).setCellValue(item.getZzmm());
|
||||
row.createCell(7).setCellValue(item.getNation());
|
||||
StringBuilder school = new StringBuilder();
|
||||
StringBuilder specialty = new StringBuilder();
|
||||
StringBuilder education = new StringBuilder();
|
||||
StringBuilder degree = new StringBuilder();
|
||||
StringBuilder graduationTime = new StringBuilder();
|
||||
for (int i = 0; i < item.getEducation().size(); i++) {
|
||||
boolean end = i == item.getEducation().size() - 1;
|
||||
Education e = item.getEducation().get(i);
|
||||
|
||||
String educations = switch (e.getEducation()) {
|
||||
case 0 -> "专科";
|
||||
case 1 -> "本科";
|
||||
case 2 -> "研究生";
|
||||
default -> "异常";
|
||||
};
|
||||
/* 将学历转换成汉字 */
|
||||
String degrees = switch (e.getDegree()) {
|
||||
case 0 -> "暂无";
|
||||
case 1 -> "学士";
|
||||
case 2 -> "硕士";
|
||||
case 3 -> "博士";
|
||||
default -> "异常";
|
||||
};
|
||||
school.append(e.getSchool());
|
||||
specialty.append(e.getSpecialty());
|
||||
education.append(educations);
|
||||
degree.append(degrees);
|
||||
graduationTime.append(e.getGraduationTime());
|
||||
|
||||
if (!end) {
|
||||
school.append("\n");
|
||||
specialty.append("\n");
|
||||
education.append("\n");
|
||||
degree.append("\n");
|
||||
graduationTime.append("\n");
|
||||
}
|
||||
}
|
||||
Cell schoolcell = row.createCell(8);
|
||||
schoolcell.setCellStyle(cellStyle);
|
||||
schoolcell.setCellValue(school.toString());
|
||||
Cell specialtycell = row.createCell(9);
|
||||
specialtycell.setCellStyle(cellStyle);
|
||||
specialtycell.setCellValue(specialty.toString());
|
||||
Cell educationcell = row.createCell(10);
|
||||
educationcell.setCellStyle(cellStyle);
|
||||
educationcell.setCellValue(education.toString());
|
||||
Cell degreecell = row.createCell(11);
|
||||
degreecell.setCellStyle(cellStyle);
|
||||
degreecell.setCellValue(degree.toString());
|
||||
Cell graduationTimecell = row.createCell(12);
|
||||
graduationTimecell.setCellStyle(cellStyle);
|
||||
graduationTimecell.setCellValue(graduationTime.toString());
|
||||
row.createCell(13).setCellValue(item.getPhone());
|
||||
|
||||
|
||||
String sta = switch (item.getStatus()) {
|
||||
case -2 -> "已拒绝";
|
||||
case -1 -> "拒绝待确认";
|
||||
case 0 -> "未处理";
|
||||
case 1 -> "同意待确认";
|
||||
case 2 -> "已同意";
|
||||
default -> "异常";
|
||||
};
|
||||
row.createCell(14).setCellValue(sta);
|
||||
|
||||
row.createCell(15).setCellValue(item.getNote());
|
||||
}
|
||||
|
||||
int graduationTimeColumnIndex = 12;
|
||||
// 生日列设12个字符宽
|
||||
sheet.setColumnWidth(4, 12 * 256);
|
||||
// 身份证号列设18个字符宽
|
||||
sheet.setColumnWidth(5, 20 * 256);
|
||||
// 毕业院校列设18个字符宽
|
||||
sheet.setColumnWidth(8, 18 * 256);
|
||||
// 专业列设18个字符宽
|
||||
sheet.setColumnWidth(9, 18 * 256);
|
||||
// 毕业时间列设8个字符宽
|
||||
sheet.setColumnWidth(12, 8 * 256);
|
||||
// 手机号列设12个字符宽
|
||||
sheet.setColumnWidth(13, 12 * 256);
|
||||
sheet.setColumnWidth(graduationTimeColumnIndex, 20 * 256);
|
||||
logger.error("生成总表Excel成功,开始保存 ");
|
||||
// Write the workbook to a file
|
||||
try {
|
||||
FileOutputStream outputStream = new FileOutputStream(path + "招聘总表.xlsx");
|
||||
workbook.write(outputStream);
|
||||
workbook.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("保存导出的Excel发生IO错误");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getExcelFile(String path) {
|
||||
|
||||
File folder = new File(path);
|
||||
File[] fileList = folder.listFiles();
|
||||
if (fileList == null || fileList.length == 0) {
|
||||
return 0;
|
||||
} else if (fileList.length > 1) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
||||
package edu.ahbvc.recruit.util.file;
|
||||
|
||||
public class FilePathModel {
|
||||
|
||||
private String path = "";
|
||||
|
||||
public FilePathModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
public FilePathModel(String path) {
|
||||
super();
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FilePath [path=" + path + "]";
|
||||
}
|
||||
}
|
Loading…
Reference in new issue