Skip to content

Commit

Permalink
1.完成简历添加,简历更新
Browse files Browse the repository at this point in the history
  • Loading branch information
yulongsun007 committed Dec 25, 2016
1 parent bc24e36 commit 03ec869
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,23 @@ public abstract class BaseController extends Controller {
public void renderSuccess() {
response.respSuccess();
renderJson(response);
return;
}

public void renderSuccess(String msg) {
response.respSuccess(msg);
renderJson(response);
return;
}

public void renderSuccess(Object object) {
ArrayList list = new ArrayList();
list.add(object);
response.respSuccess(list);
renderJson(response);
return;
}

public void renderSuccess(List object) {
response.respSuccess(object);
renderJson(response);
return;
}

public void renderSuccess(String msg, List object) {
Expand All @@ -61,13 +57,11 @@ public void renderSuccess(String msg, List object) {

public void renderError() {
renderJson(response);
return;
}

public void renderError(String msg) {
response.setMsg(msg);
renderJson(response);
return;
}


Expand Down
1 change: 1 addition & 0 deletions src/main/java/win/yulongsun/talents/config/MyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public void configRoute(Routes me) {
me.add("/resume", ResumeController.class);
me.add("/resume_exper", ResumeExperController.class);
me.add("/msg", MsgController.class);
me.add("/user_plan_r", UserPlanRController.class);
}

public void configPlugin(Plugins me) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public void deleteDeploy() {
}
}

//查询
//模糊查询,根据模板ID或者模板名
public void queryDeploy() {
String create_by = getPara("create_by");
String tmp_id = getPara("tmp_id");
Expand All @@ -214,4 +214,21 @@ public void queryDeploy() {
List<JobTemplateDeploy> list = JobTemplateDeploy.dao.find(sql);
renderSuccess(list);
}


//查询所有已发布的招聘信息
public void listAllDeploy() {
// ALL HR
List<User> userList = User.dao.find("select * from t_user where user_role_id=1");
//查出所有的已发布的招聘信息
List<JobTemplateDeploy> result = new ArrayList<JobTemplateDeploy>();
for (User user : userList) {
List<JobTemplateDeploy> list = JobTemplateDeploy.dao.find("SELECT d._id,d.start_at,d.ent_at,d.deploy_at,t.* " +
"FROM t_job_template_deploy d Left JOIN t_job_template t " +
"ON d.tmp_id=t.tmp_id " +
"WHERE t.create_by=? AND d.is_active=1 order by d._id desc", user.getUserId());
result.addAll(list);
}
renderSuccess(result);
}
}
16 changes: 10 additions & 6 deletions src/main/java/win/yulongsun/talents/controller/PlanController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import win.yulongsun.talents.model.Plan;
import win.yulongsun.talents.util.ValidateUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

Expand Down Expand Up @@ -34,19 +35,22 @@ public void add() {
plan.setCreateAt(new Date());
boolean save = plan.save();
if (save) {
renderSuccess();
renderSuccess(plan);
} else {
renderError(Response.MSG.ADD_ERROR);
}
}

public void list() {
Integer create_by = getParaToInt("create_by");
boolean isNull = ValidateUtils.validatePara(create_by);
if (isNull) {
renderError(Response.MSG.REQ_IS_NULL);
String job_template_id = getPara("job_template_id");
String create_by = getPara("create_by");
List<Plan> planList = new ArrayList<Plan>();
if (!ValidateUtils.validatePara(create_by)) {
planList = Plan.dao.find("select * from t_plan where create_by = ?", create_by);
}
if (!ValidateUtils.validatePara(job_template_id)) {
planList = Plan.dao.find("select * from t_plan where job_template_id = ?", job_template_id);
}
List<Plan> planList = Plan.dao.find("select * from t_plan where create_by = ?", create_by);
//查出对应培养计划下的课程列表
for (Plan plan : planList) {
List<Clazz> clazzList = Clazz.dao.find("select * from t_clazz where plan_id=? order by clazz_priority asc", plan.getPlanId());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
package win.yulongsun.talents.controller;

import com.jfinal.upload.UploadFile;
import win.yulongsun.talents.common.BaseController;
import win.yulongsun.talents.common.Response;
import win.yulongsun.talents.model.Resume;
import win.yulongsun.talents.model.ResumeExper;
import win.yulongsun.talents.util.IPUtils;
import win.yulongsun.talents.util.ValidateUtils;

import java.util.Date;
import java.util.List;

/**
* Created by sunyulong on 2016/12/10.
*/
public class ResumeController extends BaseController {
public void add() {
String resume_name = getPara("resume_name");
String resume_desc = getPara("resume_desc");
String resume_gender = getPara("resume_gender");
String resume_academy = getPara("resume_academy");
String resume_is_study = getPara("resume_is_study");
String resume_major = getPara("resume_major");
String resume_graduate_at = getPara("resume_graduate_at");
String resume_mobile = getPara("resume_mobile");
String resume_email = getPara("resume_email");
Integer create_by = getParaToInt("create_by");
UploadFile file = getFile("resume_img");
String resume_name = getPara("resume_name");
String resume_desc = getPara("resume_desc");
String resume_gender = getPara("resume_gender");
String resume_academy = getPara("resume_academy");
String resume_is_study = getPara("resume_is_study");
String resume_major = getPara("resume_major");
String resume_graduate_at = getPara("resume_graduate_at");
String resume_mobile = getPara("resume_mobile");
String resume_email = getPara("resume_email");
Integer create_by = getParaToInt("create_by");
boolean isNull = ValidateUtils.validatePara(resume_name, resume_desc, resume_gender, resume_academy, resume_is_study, resume_major,
resume_graduate_at, resume_mobile, resume_email, create_by);
if (isNull) {
renderError(Response.MSG.REQ_IS_NULL);
}
Resume resume = new Resume();
resume.setResumeImg(file.getFileName());
resume.setResumeName(resume_name);
resume.setResumeDesc(resume_desc);
resume.setResumeGender(resume_gender);
Expand All @@ -39,6 +44,8 @@ public void add() {
resume.setResumeMobile(resume_mobile);
resume.setResumeEmail(resume_email);
resume.setCreateBy(create_by);
resume.setCreateAt(new Date());
resume.setUpdateAt(new Date());
boolean save = resume.save();
if (save) {
renderSuccess();
Expand All @@ -53,17 +60,59 @@ public void list() {
if (isNull) {
renderError(Response.MSG.REQ_IS_NULL);
}
List<Resume> resumes = Resume.dao.find("select * from t_resume where create_by = ?", create_by);
for (Resume resume : resumes) {
Integer resumeId = resume.getResumeId();
List<ResumeExper> experList = ResumeExper.dao.find("select * from t_resume_exper where resume_id = ?", resumeId);
resume.put("experList", experList);
List<Resume> resumes = Resume.dao.find("select * from t_resume where create_by = ? order by resume_id desc", create_by);
for (Resume r : resumes) {
r.setResumeImg(IPUtils.getUploadPath() + r.getResumeImg());
List<ResumeExper> experList = ResumeExper.dao.find("select * from t_resume_exper where resume_id = ?", r.getResumeId());
r.put("experList", experList);
}
renderSuccess(resumes);
}

public void update() {

UploadFile file = getFile("resume_img");
Integer resume_id = getParaToInt("resume_id");
String resume_name = getPara("resume_name");
String resume_desc = getPara("resume_desc");
String resume_gender = getPara("resume_gender");
String resume_academy = getPara("resume_academy");
String resume_is_study = getPara("resume_is_study");
String resume_major = getPara("resume_major");
String resume_graduate_at = getPara("resume_graduate_at");
String resume_mobile = getPara("resume_mobile");
String resume_email = getPara("resume_email");
Integer create_by = getParaToInt("create_by");
boolean isNull = ValidateUtils.validatePara(resume_id, resume_name, resume_desc, resume_gender, resume_academy, resume_is_study, resume_major,
resume_graduate_at, resume_mobile, resume_email, create_by);
if (isNull) {
renderError(Response.MSG.REQ_IS_NULL);
}
Resume resume = new Resume();
resume.setResumeId(resume_id);
resume.setResumeImg(file.getFileName());
resume.setResumeName(resume_name);
resume.setResumeDesc(resume_desc);
resume.setResumeGender(resume_gender);
resume.setResumeAcademy(resume_academy);
resume.setResumeIsStudy(resume_is_study);
resume.setResumeMajor(resume_major);
resume.setResumeGraduateAt(resume_graduate_at);
resume.setResumeMobile(resume_mobile);
resume.setResumeEmail(resume_email);
resume.setCreateBy(create_by);
resume.setUpdateAt(new Date());
boolean save = resume.update();
if (save) {
List<Resume> resumes = Resume.dao.find("select * from t_resume where create_by = ? order by resume_id desc", create_by);
for (Resume r : resumes) {
r.setResumeImg(IPUtils.getUploadPath() + r.getResumeImg());
List<ResumeExper> experList = ResumeExper.dao.find("select * from t_resume_exper where resume_id = ?", r.getResumeId());
r.put("experList", experList);
}
renderSuccess(resumes);
} else {
renderError(Response.MSG.ADD_ERROR);
}
}

public void delete() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package win.yulongsun.talents.controller;

import win.yulongsun.talents.common.BaseController;
import win.yulongsun.talents.common.Response;
import win.yulongsun.talents.model.UserPlanR;
import win.yulongsun.talents.util.ValidateUtils;

import java.util.List;

/**
* Created by sunyulong on 2016/12/25.
*/
public class UserPlanRController extends BaseController {
public void add() {
Integer user_id = getParaToInt("user_id");
Integer plan_id = getParaToInt("plan_id");
Integer apply_status = getParaToInt("apply_status");
boolean isNull = ValidateUtils.validatePara(user_id, plan_id, apply_status);
if (isNull) {
renderError(Response.MSG.REQ_IS_NULL);
}
List<UserPlanR> learnedPlanList = UserPlanR.dao.find("select * from t_user_plan_r where user_id = ? and plan_id = ?", user_id, plan_id);
if (learnedPlanList.size() > 0) {
renderError("您已添加了此培养计划,无需重复添加");
return;
}
UserPlanR planR = new UserPlanR();
planR.setUserId(user_id);
planR.setPlanId(plan_id);
planR.setApplyStatus(apply_status);
boolean save = planR.save();
if (save) {
renderSuccess();
} else {
renderError(Response.MSG.ADD_ERROR);
}

}

public void list() {

}

public void update() {

}

public void delete() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
@SuppressWarnings("serial")
public class JobTemplateDeploy extends BaseJobTemplateDeploy<JobTemplateDeploy> {
public static final JobTemplateDeploy dao = new JobTemplateDeploy();


}
24 changes: 16 additions & 8 deletions src/main/java/win/yulongsun/talents/model/base/BaseResume.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ public java.lang.String getResumeName() {
return get("resume_name");
}

public void setResumeImg(java.lang.String resumeImg) {
set("resume_img", resumeImg);
}

public java.lang.String getResumeImg() {
return get("resume_img");
}

public void setResumeDesc(java.lang.String resumeDesc) {
set("resume_desc", resumeDesc);
}
Expand Down Expand Up @@ -89,14 +97,6 @@ public java.lang.String getResumeEmail() {
return get("resume_email");
}

public void setCreateAt(java.util.Date createAt) {
set("create_at", createAt);
}

public java.util.Date getCreateAt() {
return get("create_at");
}

public void setCreateBy(java.lang.Integer createBy) {
set("create_by", createBy);
}
Expand All @@ -105,6 +105,14 @@ public java.lang.Integer getCreateBy() {
return get("create_by");
}

public void setCreateAt(java.util.Date createAt) {
set("create_at", createAt);
}

public java.util.Date getCreateAt() {
return get("create_at");
}

public void setUpdateAt(java.util.Date updateAt) {
set("update_at", updateAt);
}
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/win/yulongsun/talents/util/IPUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package win.yulongsun.talents.util;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
* Created by sunyulong on 2016/12/25.
*/
public class IPUtils {

public static String getIp() {
try {
return String.valueOf(InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException e) {
e.printStackTrace();
}
return null;
}

public static String getUploadPath() {
return "http://" + getIp() + ":8081/talents/upload/";
}

public static void main(String agrs[]) {
System.out.printf(getIp());
}
}

0 comments on commit 03ec869

Please sign in to comment.