提交 7c428a53 authored 作者: wangmenglong's avatar wangmenglong

阿里回调通知

上级 baf26715
...@@ -2,6 +2,8 @@ package com.jfb.recruit.controller.api; ...@@ -2,6 +2,8 @@ package com.jfb.recruit.controller.api;
import base.controller.BaseController; import base.controller.BaseController;
import base.result.BaseResult; import base.result.BaseResult;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException; import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient; import com.alipay.api.AlipayClient;
...@@ -14,13 +16,16 @@ import com.alipay.api.request.AlipayEbppIndustryJobResumeauthlogininfoGetRequest ...@@ -14,13 +16,16 @@ import com.alipay.api.request.AlipayEbppIndustryJobResumeauthlogininfoGetRequest
import com.alipay.api.request.AlipaySystemOauthTokenRequest; import com.alipay.api.request.AlipaySystemOauthTokenRequest;
import com.alipay.api.response.AlipayEbppIndustryJobResumeauthlogininfoGetResponse; import com.alipay.api.response.AlipayEbppIndustryJobResumeauthlogininfoGetResponse;
import com.alipay.api.response.AlipaySystemOauthTokenResponse; import com.alipay.api.response.AlipaySystemOauthTokenResponse;
import com.jfb.recruit.service.*;
import com.jfb.recruit.xsnowflake.SnowFlakeFactory; import com.jfb.recruit.xsnowflake.SnowFlakeFactory;
import data.recruit.Person; import data.recruit.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -41,6 +46,24 @@ public class ApiAliController extends BaseController { ...@@ -41,6 +46,24 @@ public class ApiAliController extends BaseController {
@Autowired @Autowired
SnowFlakeFactory snowFlakeFactory; SnowFlakeFactory snowFlakeFactory;
@Resource
PersonService personService;
@Resource
PersonEducationalService personEducationalService;
@Resource
QualificationService qualificationService;
@Resource
WorkExperienceService workExperienceService;
@Resource
ObjectiveService objectiveService;
@Resource
SignRecordService signRecordService;
/** /**
* @description: 获取openId * @description: 获取openId
* @author: wangmenglong * @author: wangmenglong
...@@ -192,6 +215,95 @@ public class ApiAliController extends BaseController { ...@@ -192,6 +215,95 @@ public class ApiAliController extends BaseController {
System.out.println("Key: " + entry.getKey() + ", Value: " + entry.getValue()); System.out.println("Key: " + entry.getKey() + ", Value: " + entry.getValue());
} }
//获取人员信息(自我评价)
Person person = personService.getDetailsByLoginOpenId(params.get("open_id"));
if(params.containsKey("self_introduction")){
person.setSelfEvaluation(params.get("self_introduction"));
}
//教育经历
if (params.containsKey("educational_background")){
PersonEducational personEducational = new PersonEducational();
personEducational.setPersonId(person.getId());
personEducational.setBaseCode(person.getBaseCode());
if(params.containsKey("education_level")){
Qualification qualification = qualificationService.queryByName(params.get("education_level"));
personEducational.setQualification(qualification.getName());
personEducational.setQualificationId(qualification.getId());
}
if(params.containsKey("school")){
personEducational.setSchool(params.get("school"));
}
if (params.containsKey("enrollment_date")){
personEducational.setStartTime(params.get("enrollment_date").replace(".", "-"));
}
if (params.containsKey("graduation_date")){
personEducational.setEndTime(params.get("graduation_date").replace(".", "-"));
}
if (params.containsKey("major")){
personEducational.setMajor(params.get("major"));
}
personEducationalService.createAli(personEducational);
}
//工作经历
if (params.containsKey("work_experience")){
List<WorkExperience> workExperiences = new ArrayList<>();
JSONArray workExperienceArray = JSON.parseArray(params.get("work_experience"));
for (int i = 0; i < workExperienceArray.size(); i++) {
JSONObject workExperienceJson = workExperienceArray.getJSONObject(i);
WorkExperience workExperience = new WorkExperience();
workExperience.setPersonId(person.getId());
workExperience.setBaseCode(person.getBaseCode());
workExperience.setJob(workExperienceJson.getString("job_name"));
workExperience.setOrgName(workExperienceJson.getString("company"));
workExperience.setStartTime(workExperienceJson.getString("start_date"));
workExperience.setEndTime(workExperienceJson.getString("end_date"));
workExperience.setIndustryId(workExperienceJson.getString("job_type_code"));
workExperience.setIndustryName(workExperienceJson.getString("job_name"));
workExperience.setDescr(workExperienceJson.getString("content"));
workExperiences.add(workExperience);
}
workExperienceService.createAli(workExperiences);
}
//求职意向
if (params.containsKey("job_intention_list")){
List<Objective> objectives = new ArrayList<>();
JSONArray objectivesArray = JSON.parseArray(params.get("job_intention_list"));
for (int i = 0; i < objectivesArray.size(); i++) {
JSONObject objectiveJson = objectivesArray.getJSONObject(i);
Objective objective = new Objective();
objective.setPersonId(person.getId());
objective.setBaseCode(person.getBaseCode());
objectives.add(objective);
}
objectiveService.createAli(objectives);
}
//报名管理
SignRecord signRecord = new SignRecord();
signRecord.setPersonId(person.getId());
signRecord.setRecruitId(params.get("out_job_id"));
if(signRecordService.isHave(signRecord.getRecruitId(),signRecord.getPersonId())){
signRecordService.del(signRecord.getRecruitId(),signRecord.getPersonId());
}else {
signRecordService.create(signRecord);
}
isPass = AlipaySignature.rsaCheckV1(params, alipayPublicKey, "UTF-8", "RSA2"); isPass = AlipaySignature.rsaCheckV1(params, alipayPublicKey, "UTF-8", "RSA2");
if(isPass) { if(isPass) {
// 2、验签成功:处理业务逻辑,并构造业务处理结果 // 2、验签成功:处理业务逻辑,并构造业务处理结果
......
package com.jfb.recruit.service; package com.jfb.recruit.service;
import data.recruit.Objective; import data.recruit.Objective;
import data.recruit.WorkExperience;
import java.util.List; import java.util.List;
...@@ -25,4 +26,6 @@ public interface ObjectiveService { ...@@ -25,4 +26,6 @@ public interface ObjectiveService {
boolean isHave(String userId, String industryId,String id); boolean isHave(String userId, String industryId,String id);
boolean createAli(List<Objective> objectives);
} }
...@@ -25,4 +25,6 @@ public interface PersonEducationalService { ...@@ -25,4 +25,6 @@ public interface PersonEducationalService {
boolean isHave(String school, String id); boolean isHave(String school, String id);
boolean createAli(PersonEducational personEducational);
} }
...@@ -16,5 +16,6 @@ public interface QualificationService { ...@@ -16,5 +16,6 @@ public interface QualificationService {
List<Qualification> listAll(Qualification qualification); List<Qualification> listAll(Qualification qualification);
Qualification queryByName(String name);
} }
...@@ -25,4 +25,6 @@ public interface WorkExperienceService { ...@@ -25,4 +25,6 @@ public interface WorkExperienceService {
boolean isHave(String orgName, String id); boolean isHave(String orgName, String id);
boolean createAli(List<WorkExperience> workExperiences);
} }
...@@ -14,6 +14,7 @@ import com.jfb.recruit.util.auth.UserUtils; ...@@ -14,6 +14,7 @@ import com.jfb.recruit.util.auth.UserUtils;
import com.jfb.recruit.xsnowflake.SnowFlakeFactory; import com.jfb.recruit.xsnowflake.SnowFlakeFactory;
import data.recruit.Objective; import data.recruit.Objective;
import data.recruit.Person; import data.recruit.Person;
import data.recruit.WorkExperience;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -158,4 +159,29 @@ public class ObjectiveServiceImpl extends ServiceImpl<ObjectiveMapper, Objective ...@@ -158,4 +159,29 @@ public class ObjectiveServiceImpl extends ServiceImpl<ObjectiveMapper, Objective
return super.count(qw)>0; return super.count(qw)>0;
} }
/**
* @description: 新增求职意向
* @author: wangmenglong
* @date; 2023/12/11 16:51
* @param: [workExperience]
* @return: boolean
**/
@Override
public boolean createAli(List<Objective> objectives) {
LambdaUpdateWrapper<Objective> qw = new LambdaUpdateWrapper<>();
qw.eq(Objective::getDel,false)
.eq(Objective::getPersonId, objectives.get(0).getPersonId())
.set(Objective::getDel,true);
super.update(qw);
objectives.stream().forEach(objective -> {
objective.setId(snowFlakeFactory.nextId());
objective.setDel(false);
objective.setCreateTime(DateUtil.now());
});
return super.saveBatch(objectives);
}
} }
...@@ -148,4 +148,29 @@ public class PersonEducationalServiceImpl extends ServiceImpl<PersonEducationalM ...@@ -148,4 +148,29 @@ public class PersonEducationalServiceImpl extends ServiceImpl<PersonEducationalM
return super.count(qw)>0; return super.count(qw)>0;
} }
/**
* @description: 新增教育经历
* @author: wangmenglong
* @date; 2023/12/11 16:51
* @param: [personEducational]
* @return: boolean
**/
@Override
public boolean createAli(PersonEducational personEducational) {
LambdaUpdateWrapper<PersonEducational> qw = new LambdaUpdateWrapper<>();
qw.eq(PersonEducational::getDel,false)
.eq(PersonEducational::getPersonId, personEducational.getPersonId())
.set(PersonEducational::getDel,true)
.set(PersonEducational::getDelTime, DateUtil.now());
super.update(qw);
personEducational.setId(snowFlakeFactory.nextId());
personEducational.setDel(false);
personEducational.setCreateTime(DateUtil.now());
return super.save(personEducational);
}
} }
...@@ -38,6 +38,18 @@ public class QualificationServiceImpl extends ServiceImpl<QualificationMapper, Q ...@@ -38,6 +38,18 @@ public class QualificationServiceImpl extends ServiceImpl<QualificationMapper, Q
return orgList; return orgList;
} }
/**
* @description: 根据名字获取
* @author: wangmenglong
**/
@Override
public Qualification queryByName(String name) {
//创建查询条件
LambdaQueryWrapper<Qualification> qw = new LambdaQueryWrapper<>();
qw.like(Qualification::getDel,false)
.eq(Qualification::getName, name);
//返回查询结果
return super.getOne(qw);
}
} }
...@@ -148,4 +148,29 @@ public class WorkExperienceServiceImpl extends ServiceImpl<WorkExperienceMapper, ...@@ -148,4 +148,29 @@ public class WorkExperienceServiceImpl extends ServiceImpl<WorkExperienceMapper,
return super.count(qw)>0; return super.count(qw)>0;
} }
/**
* @description: 新增工作经历
* @author: wangmenglong
* @date; 2023/12/11 16:51
* @param: [workExperience]
* @return: boolean
**/
@Override
public boolean createAli(List<WorkExperience> workExperiences) {
LambdaUpdateWrapper<WorkExperience> qw = new LambdaUpdateWrapper<>();
qw.eq(WorkExperience::getDel,false)
.eq(WorkExperience::getPersonId, workExperiences.get(0).getPersonId())
.set(WorkExperience::getDel,true);
super.update(qw);
workExperiences.stream().forEach(workExperience -> {
workExperience.setId(snowFlakeFactory.nextId());
workExperience.setDel(false);
workExperience.setCreateTime(DateUtil.now());
});
return super.saveBatch(workExperiences);
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论