package service;
import domain.CurrentUser;
import domain.Job;
import domain.UidJid;
import view.IndexView;
import java.io.*;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class JobService {
static {
File file=new File("src/information/yourWorkInformation.txt");
if (!file.exists()){
try {
file.createNewFile();
HashSet<UidJid>list=new HashSet<>();
ObjectOutputStream ois=new ObjectOutputStream(new FileOutputStream("src/information/yourWorkInformation.txt"));
ois.writeObject(list);
ois.flush();
ois.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
final static String JOB_INFORMATION="src/information/jobInformation.txt";
Date workStart=new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
public static void getJobInformation(Integer jid, String companyName, String jobName, String jobTypeName, Integer jobLevel, String jobContent, Integer jobDemand, Integer jobTime,
Integer salary,Integer status) throws IOException, ClassNotFoundException {
File file=new File(JOB_INFORMATION);
if(!file.exists()){
file.createNewFile();
ArrayList<Job>list=new ArrayList<>();
ObjectOutputStream ois=new ObjectOutputStream(new FileOutputStream(JOB_INFORMATION));
ois.writeObject(list);
ois.flush();
ois.close();
}
ObjectInputStream ins=new ObjectInputStream(new FileInputStream(JOB_INFORMATION));
ArrayList<Job>js=(ArrayList<Job>)ins.readObject();
js.add(new Job(jid,companyName,jobName,jobTypeName,jobLevel,jobContent,jobDemand,
jobTime, salary,status));
FileOutputStream fos = new FileOutputStream(JOB_INFORMATION);
ObjectOutputStream os = new ObjectOutputStream(fos);
os.writeObject(js);
os.flush();
System.out.println("兼职信息录入完成.");
fos.close();
os.close();
}
public static void checkWorkAll() throws IOException, ClassNotFoundException {
ObjectInputStream jis = new ObjectInputStream(new FileInputStream(JOB_INFORMATION));
ArrayList<Job> list = (ArrayList<Job>)jis.readObject();
for (int i = 0; i < list.size(); i++ ){
Job j = list.get(i);
System.out.println(j);
}
jis.close();
}
public static void checkWork() throws IOException, ClassNotFoundException {
ObjectInputStream jis = new ObjectInputStream(new FileInputStream("src/information/yourWorkInformation.txt"));
HashSet<UidJid> list = (HashSet<UidJid>)jis.readObject();
jis.close();
for (UidJid uidJid : list) {
if (uidJid.getUid().equals(CurrentUser.currentUser.getUid())){
ObjectInputStream ins=new ObjectInputStream(new FileInputStream(new File(JOB_INFORMATION)));
ArrayList<Job>jjs=(ArrayList<Job>)ins.readObject();
ins.close();
for (Job jj : jjs) {
if (jj.getJid().equals(uidJid.getJid
校园兼职平台部分内容
最新推荐文章于 2024-10-01 18:51:18 发布
本文介绍了使用Java技术开发的一款校园兼职平台,详细讨论了其功能实现和设计思路,包括用户注册登录、职位发布、简历投递等核心模块。通过Java的面向对象特性,实现了高效的数据管理和交互操作,为在校学生提供了方便的兼职信息获取渠道。
摘要由CSDN通过智能技术生成