|
@@ -7,11 +7,16 @@ import com.jpsoft.employment.modules.common.utils.PojoUtils;
|
|
|
import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.employment.modules.job.entity.Recruitment;
|
|
|
+import com.jpsoft.employment.modules.job.entity.WorkCategory;
|
|
|
import com.jpsoft.employment.modules.job.service.RecruitmentService;
|
|
|
+import com.jpsoft.employment.modules.job.service.WorkCategoryService;
|
|
|
import com.jpsoft.employment.modules.sys.entity.DataDictionary;
|
|
|
+import com.jpsoft.employment.modules.sys.entity.User;
|
|
|
import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
|
|
|
+import com.jpsoft.employment.modules.sys.service.UserService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -34,6 +39,10 @@ public class RecruitmentController {
|
|
|
private CompanyService companyService;
|
|
|
@Autowired
|
|
|
private DataDictionaryService dataDictionaryService;
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+ @Autowired
|
|
|
+ private WorkCategoryService workCategoryService;
|
|
|
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@GetMapping("create")
|
|
@@ -41,6 +50,9 @@ public class RecruitmentController {
|
|
|
MessageResult<Recruitment> msgResult = new MessageResult<>();
|
|
|
|
|
|
Recruitment recruitment = new Recruitment();
|
|
|
+ recruitment.setEducation("-1");
|
|
|
+ recruitment.setWorkYear("-1");
|
|
|
+
|
|
|
|
|
|
msgResult.setData(recruitment);
|
|
|
msgResult.setResult(true);
|
|
@@ -54,11 +66,56 @@ public class RecruitmentController {
|
|
|
MessageResult<Recruitment> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
+ User user = userService.get(subject);
|
|
|
+
|
|
|
+ if(user==null){
|
|
|
+ throw new Exception("用户未登录,请先登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+ Company company = companyService.get(user.getCompanyId());
|
|
|
+
|
|
|
+ if(company==null){
|
|
|
+ throw new Exception("未查询到登录人员所在公司!");
|
|
|
+ }
|
|
|
+
|
|
|
recruitment.setId(UUID.randomUUID().toString());
|
|
|
recruitment.setDelFlag(false);
|
|
|
recruitment.setCreateBy(subject);
|
|
|
recruitment.setCreateTime(new Date());
|
|
|
-
|
|
|
+ recruitment.setCompanyId(user.getCompanyId());
|
|
|
+ recruitment.setStatus("1");
|
|
|
+ recruitment.setApproveStatus("2");
|
|
|
+ recruitment.setReadingTimes(0);
|
|
|
+ recruitment.setCollectionTimes(0);
|
|
|
+ recruitment.setDeliveryTimes(0);
|
|
|
+ if(company!=null){
|
|
|
+ recruitment.setArea(company.getArea());
|
|
|
+ }
|
|
|
+
|
|
|
+ //是否面议
|
|
|
+ if("0".equals(recruitment.getWelfare())){
|
|
|
+ recruitment.setIsDiscussPersonally(true);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ recruitment.setIsDiscussPersonally(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //福利待遇相关数据保存
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(recruitment.getCheckboxGroup1())){
|
|
|
+ jsonObject.put("checkboxGroup1",recruitment.getCheckboxGroup1());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(recruitment.getDynamicTags())){
|
|
|
+ jsonObject.put("dynamicTags",recruitment.getDynamicTags());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(jsonObject!=null){
|
|
|
+ recruitment.setWelfare(jsonObject.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
int affectCount = recruitmentService.insert(recruitment);
|
|
|
|
|
|
if (affectCount > 0) {
|
|
@@ -81,13 +138,91 @@ public class RecruitmentController {
|
|
|
|
|
|
@ApiOperation(value="获取信息")
|
|
|
@GetMapping("edit/{id}")
|
|
|
- public MessageResult<Recruitment> edit(@PathVariable("id") String id){
|
|
|
+ public MessageResult<Recruitment> edit(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
|
MessageResult<Recruitment> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
+ User user = userService.get(subject);
|
|
|
+
|
|
|
+ if(user==null){
|
|
|
+ throw new Exception("用户未登录,请先登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+ Company company = companyService.get(user.getCompanyId());
|
|
|
+
|
|
|
+ if(company==null){
|
|
|
+ throw new Exception("未查询到登录人员所在公司!");
|
|
|
+ }
|
|
|
+
|
|
|
Recruitment recruitment = recruitmentService.get(id);
|
|
|
|
|
|
+ recruitment.setCompanyName(company.getName());
|
|
|
+ recruitment.setCompanyLogo(company.getLogo());
|
|
|
+
|
|
|
+ recruitment.setCompanyIndustryN(dataDictionaryService.getName(company.getIndustry()));
|
|
|
+ recruitment.setCompanyScaleN(dataDictionaryService.getName(company.getScale()));
|
|
|
+ recruitment.setWorkYearName(dataDictionaryService.getName(recruitment.getWorkYear()));
|
|
|
+ recruitment.setEducationName(dataDictionaryService.getName(recruitment.getEducation()));
|
|
|
+ recruitment.setWageTypeName(dataDictionaryService.getName(recruitment.getWageType()));
|
|
|
+
|
|
|
if (recruitment != null) {
|
|
|
+ if(StringUtils.isNotEmpty(recruitment.getWelfare())) {
|
|
|
+ String welfare = recruitment.getWelfare();
|
|
|
+
|
|
|
+ List<String> tagList = new ArrayList<>();
|
|
|
+
|
|
|
+ JSONObject jsonObject = JSONObject.fromObject(welfare);
|
|
|
+ if(jsonObject!=null){
|
|
|
+ String checkboxGroup1 = jsonObject.get("checkboxGroup1").toString();
|
|
|
+ String dynamicTags = jsonObject.get("dynamicTags").toString();
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(checkboxGroup1)){
|
|
|
+ recruitment.setCheckboxGroup1(checkboxGroup1);
|
|
|
+
|
|
|
+ String[] checkboxGroupArray = checkboxGroup1.split(",");
|
|
|
+ for (String dicId:checkboxGroupArray) {
|
|
|
+ DataDictionary dataDictionary = dataDictionaryService.get(dicId);
|
|
|
+ if(dataDictionary!=null){
|
|
|
+ tagList.add(dataDictionary.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(dynamicTags)){
|
|
|
+ recruitment.setDynamicTags(dynamicTags);
|
|
|
+ String[] dynamicTagArray = dynamicTags.split(",");
|
|
|
+ for (String name:dynamicTagArray) {
|
|
|
+ tagList.add(name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ recruitment.setTagList(tagList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ recruitment.setCompanyName(company.getName());
|
|
|
+ recruitment.setCompanyLogo(company.getLogo());
|
|
|
+ recruitment.setIsCertification(company.getIsCertification());
|
|
|
+ recruitment.setCompanyScaleN(dataDictionaryService.getName(company.getScale()));
|
|
|
+ recruitment.setCompanyIndustryN(dataDictionaryService.getName(company.getIndustry()));
|
|
|
+
|
|
|
+ recruitment.setWorkYearName(dataDictionaryService.getName(recruitment.getWorkYear()));
|
|
|
+ recruitment.setEducationName(dataDictionaryService.getName(recruitment.getEducation()));
|
|
|
+ recruitment.setWageTypeName(dataDictionaryService.getName(recruitment.getWageType()));
|
|
|
+
|
|
|
+ WorkCategory workCategory = workCategoryService.get(recruitment.getPosition());
|
|
|
+ if(workCategory!=null){
|
|
|
+ recruitment.setPositionName(workCategory.getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(recruitment.getPositionSex())){
|
|
|
+ recruitment.setPositionSexN(dataDictionaryService.getName(recruitment.getPositionSex()));
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ recruitment.setPositionSexN("男女不限");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(recruitment);
|
|
|
} else {
|
|
@@ -113,6 +248,38 @@ public class RecruitmentController {
|
|
|
try {
|
|
|
recruitment.setUpdateBy(subject);
|
|
|
recruitment.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ //是否面议
|
|
|
+ if("0".equals(recruitment.getWelfare())){
|
|
|
+ recruitment.setIsDiscussPersonally(true);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ recruitment.setIsDiscussPersonally(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //福利待遇相关数据保存
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(recruitment.getCheckboxGroup1())){
|
|
|
+ jsonObject.put("checkboxGroup1",recruitment.getCheckboxGroup1());
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ jsonObject.put("checkboxGroup1","");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(recruitment.getDynamicTags())){
|
|
|
+ jsonObject.put("dynamicTags",recruitment.getDynamicTags());
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ jsonObject.put("dynamicTags","");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(jsonObject!=null){
|
|
|
+ recruitment.setWelfare(jsonObject.toString());
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ recruitment.setWelfare("");
|
|
|
+ }
|
|
|
|
|
|
int affectCount = recruitmentService.update(recruitment);
|
|
|
|
|
@@ -166,6 +333,40 @@ public class RecruitmentController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @ApiOperation(value="下架")
|
|
|
+ @PostMapping("down/{id}")
|
|
|
+ public MessageResult<Integer> down(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
|
+ MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ Recruitment recruitment = recruitmentService.get(id);
|
|
|
+ recruitment.setStatus("0");
|
|
|
+ recruitment.setUpdateBy(subject);
|
|
|
+ recruitment.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ int affectCount = recruitmentService.update(recruitment);
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(affectCount);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("下架失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@ApiOperation(value="批量删除")
|
|
|
@PostMapping("batchDelete")
|
|
|
public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
|
|
@@ -204,7 +405,7 @@ public class RecruitmentController {
|
|
|
@ApiOperation(value="列表")
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
public MessageResult<Map> pageList(
|
|
|
- String id,
|
|
|
+ String companyId, String area, String position, String status, String approveStatus,
|
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
@RequestAttribute String subject){
|
|
@@ -219,8 +420,20 @@ public class RecruitmentController {
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("id_","asc"));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
- searchParams.put("id","%" + id + "%");
|
|
|
+ if (StringUtils.isNotEmpty(companyId)) {
|
|
|
+ searchParams.put("companyId",companyId);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(area)) {
|
|
|
+ searchParams.put("area",area);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(position)) {
|
|
|
+ searchParams.put("position",position);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
+ searchParams.put("status",status);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(approveStatus)) {
|
|
|
+ searchParams.put("approveStatus",approveStatus);
|
|
|
}
|
|
|
|
|
|
Page<Recruitment> page = recruitmentService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
@@ -231,6 +444,10 @@ public class RecruitmentController {
|
|
|
recruitment.setWorkYearName(dataDictionaryService.getName(recruitment.getWorkYear()));
|
|
|
recruitment.setEducationName(dataDictionaryService.getName(recruitment.getEducation()));
|
|
|
recruitment.setWageTypeName(dataDictionaryService.getName(recruitment.getWageType()));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
msgResult.setResult(true);
|
|
@@ -238,4 +455,124 @@ public class RecruitmentController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="HR招聘岗位列表")
|
|
|
+ @RequestMapping(value = "pageListHR",method = RequestMethod.POST)
|
|
|
+ public MessageResult<Map> pageListHR(
|
|
|
+ String status,String approveStatus,String position,
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ @RequestAttribute String subject){
|
|
|
+
|
|
|
+ //当前用户ID
|
|
|
+ System.out.println(subject);
|
|
|
+
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
+ searchParams.put("status",status);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(approveStatus)) {
|
|
|
+ searchParams.put("approveStatus",approveStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(position)) {
|
|
|
+ searchParams.put("position",position);
|
|
|
+ }
|
|
|
+
|
|
|
+ Page<Recruitment> page = recruitmentService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+
|
|
|
+ for(Recruitment recruitment : page.getResult()){
|
|
|
+ Company company = companyService.get(recruitment.getCompanyId());
|
|
|
+ recruitment.setCompanyName(company.getName());
|
|
|
+
|
|
|
+ recruitment.setWorkYearName(dataDictionaryService.getName(recruitment.getWorkYear()));
|
|
|
+ recruitment.setEducationName(dataDictionaryService.getName(recruitment.getEducation()));
|
|
|
+ recruitment.setWageTypeName(dataDictionaryService.getName(recruitment.getWageType()));
|
|
|
+
|
|
|
+ WorkCategory workCategory = workCategoryService.get(recruitment.getPosition());
|
|
|
+ if(workCategory!=null){
|
|
|
+ recruitment.setPositionName(workCategory.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="下架")
|
|
|
+ @PostMapping("offShelf/{id}")
|
|
|
+ public MessageResult<Integer> offShelf(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
|
+ MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ Recruitment recruitment = recruitmentService.get(id);
|
|
|
+ recruitment.setStatus("0");
|
|
|
+ recruitment.setUpdateBy(subject);
|
|
|
+ recruitment.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ int affectCount = recruitmentService.update(recruitment);
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(affectCount);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("下架失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="批量下架")
|
|
|
+ @PostMapping("batchOffShelf")
|
|
|
+ public MessageResult<Integer> batchOffShelf(@RequestBody List<String> idList,@RequestAttribute String subject){
|
|
|
+ MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ int affectCount = 0;
|
|
|
+
|
|
|
+ for (String id : idList) {
|
|
|
+ Recruitment recruitment = recruitmentService.get(id);
|
|
|
+ recruitment.setStatus("0");
|
|
|
+ recruitment.setUpdateBy(subject);
|
|
|
+ recruitment.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ affectCount += recruitmentService.update(recruitment);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(affectCount);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("下架失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|