weaver-hrm-recruit/src/com/engine/recruit/service/impl/RecruitPositionServiceImpl....

186 lines
8.5 KiB
Java
Raw Normal View History

2023-10-10 09:28:06 +08:00
package com.engine.recruit.service.impl;
2024-04-07 11:25:16 +08:00
import com.alibaba.fastjson.JSON;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
2023-10-10 09:28:06 +08:00
import com.engine.core.impl.Service;
import com.engine.recruit.exception.CustomizeRunTimeException;
import com.engine.recruit.service.RecruitPositionService;
2024-04-08 09:08:37 +08:00
import com.engine.recruit.util.RecruitFormItemUtil;
2024-04-07 11:25:16 +08:00
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobDynamicField;
import com.weaver.rpa.sdk.clients.core.ERPASDKClients;
2023-10-10 09:28:06 +08:00
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
2024-04-07 11:25:16 +08:00
import java.util.ArrayList;
2023-10-10 09:28:06 +08:00
import java.util.HashMap;
2024-04-07 11:25:16 +08:00
import java.util.List;
2023-10-10 09:28:06 +08:00
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2023/10/09
* @version: 1.0
*/
public class RecruitPositionServiceImpl extends Service implements RecruitPositionService {
@Override
public Map<String, Object> updatePostInfo(Map<String, Object> param) {
Map<String, Object> returnMap = new HashMap<>();
String zpzwfzr = Util.null2String(param.get("zpzwfzr"));
String zpxzr = Util.null2String(param.get("zpxzr"));
String ids = Util.null2String(param.get("ids"));
if (StringUtils.isBlank(ids)) {
throw new CustomizeRunTimeException("数据有误,请重试");
}
RecordSet rs = new RecordSet();
2023-11-16 10:01:27 +08:00
if (StringUtils.isNotBlank(zpzwfzr)) {
rs.executeUpdate(" update uf_jcl_zp_zpzw set zpzwfzr = ? where id in (" + ids + ")", zpzwfzr);
}
if (StringUtils.isNotBlank(zpxzr)) {
rs.executeUpdate(" update uf_jcl_zp_zpzw set zpxzr = ? where id in (" + ids + ")", zpxzr);
}
2023-10-10 09:28:06 +08:00
return returnMap;
}
2024-04-07 11:25:16 +08:00
@Override
public Map<String, Object> getFormCondition(Map<String, Object> param) {
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("hasRight", true);
2024-04-08 09:08:37 +08:00
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
ResumeJobDynamicField resumeJobDynamicField = client.getResumeJobDynamicField();
2024-04-07 11:25:16 +08:00
//输入框类
List<SearchConditionItem> inputItems = new ArrayList<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
2024-04-08 09:08:37 +08:00
List<ResumeJobDynamicField.Item> boss_type = (List<ResumeJobDynamicField.Item>) resumeJobDynamicField.getBoss_type();
String bossType = convertPositionType(boss_type);
SearchConditionItem bossItem = RecruitFormItemUtil.cascaderItem(user, 1, 18, 3, "BOSS直聘", "boss");
bossItem.setRules("required");
bossItem.setViewAttr(3);
bossItem.setCompDef(JSON.parseObject(bossType));
inputItems.add(bossItem);
List<ResumeJobDynamicField.Item> liepin_type = (List<ResumeJobDynamicField.Item>) resumeJobDynamicField.getLiepin_type();
String liepinType = convertPositionType(liepin_type);
SearchConditionItem liepinItem = RecruitFormItemUtil.cascaderItem(user, 1, 18, 3, "猎聘", "liepin");
liepinItem.setCompDef(JSON.parseObject(liepinType));
liepinItem.setRules("required");
liepinItem.setViewAttr(3);
inputItems.add(liepinItem);
List<ResumeJobDynamicField.Item> lagou_type = (List<ResumeJobDynamicField.Item>) resumeJobDynamicField.getLagou_type();
String lagouType = convertPositionType(lagou_type);
SearchConditionItem lagouItem = RecruitFormItemUtil.cascaderItem(user, 1, 18, 3, "拉钩", "lagou");
lagouItem.setCompDef(JSON.parseObject(lagouType));
lagouItem.setRules("required");
lagouItem.setViewAttr(3);
inputItems.add(lagouItem);
List<ResumeJobDynamicField.Item> job51_type = (List<ResumeJobDynamicField.Item>) resumeJobDynamicField.getJob51_type();
String job51Type = convertPositionType(job51_type);
SearchConditionItem job51Item = RecruitFormItemUtil.cascaderItem(user, 1, 18, 3, "前程无忧", "job51");
job51Item.setCompDef(JSON.parseObject(job51Type));
job51Item.setRules("required");
job51Item.setViewAttr(3);
inputItems.add(job51Item);
List<ResumeJobDynamicField.Item> zhilian_type = (List<ResumeJobDynamicField.Item>) resumeJobDynamicField.getZhilian_type();
String zhilianType = convertPositionType(zhilian_type);
SearchConditionItem zhilianItem = RecruitFormItemUtil.cascaderItem(user, 1, 18, 3, "智联招聘", "zhilian");
zhilianItem.setCompDef(JSON.parseObject(zhilianType));
zhilianItem.setRules("required");
zhilianItem.setViewAttr(3);
inputItems.add(zhilianItem);
addGroups.add(new SearchConditionGroup("职位类别", true, inputItems));
apidatas.put("condition", addGroups);
return apidatas;
}
2024-04-07 11:25:16 +08:00
2024-04-08 09:08:37 +08:00
/**
* 构建职位类型级联组件数据
*
* @param typeList
* @return
*/
private String convertPositionType(List<ResumeJobDynamicField.Item> typeList) {
StringBuffer sb = new StringBuffer();
2024-04-07 11:25:16 +08:00
sb.append("{\n" +
" type: 'select',\n" +
2024-04-08 09:08:37 +08:00
" customProps: {'*':{viewAttr:3,rules:'required'}},\n" +
2024-04-07 11:25:16 +08:00
2024-04-08 09:08:37 +08:00
" key: 'one',\n" +
//" viewAttr: 3,\n" +
" style: {\n" +
" 'width': '120px'\n" +
" },\n" +
" options: [\n");
for (ResumeJobDynamicField.Item item : typeList) {
String j_typeId = item.getValue();
String j_typeName = item.getLabel();
sb.append(" {\n" +
" key: \"" + j_typeId + "\",\n" +
" selected: false,\n" +
" showname: \"" + j_typeName + "\"\n" +
" },\n");
}
sb.append(
" ],\n" +
" subChildren: {\n");
for (ResumeJobDynamicField.Item item : typeList) {
String j_type = item.getValue();
sb.append(" \"" + j_type + "\": {\n" +
" type: 'select',\n" +
" key: 'two',\n" +
" style: {\n" +
" 'width': '120px'\n" +
" },\n" +
" options: [\n");
List<ResumeJobDynamicField.Item> childrenList = (List<ResumeJobDynamicField.Item>) item.getChildren();
for (ResumeJobDynamicField.Item child : childrenList) {
String j_typeId = child.getValue();
String j_typeName = child.getLabel();
sb.append(" {\n" +
" key: \"" + j_typeId + "\",\n" +
" selected: false,\n" +
" showname: \"" + j_typeName + "\"\n" +
" },\n");
}
sb.append("],\n subChildren:{\n");
for (ResumeJobDynamicField.Item child : childrenList) {
sb.append(" \"" + child.getValue() + "\": {\n");
sb.append("type:'select',\n");
sb.append("key:'three',\n");
sb.append("style:{ 'width': '120px' },\n");
sb.append("options: [\n");
List<ResumeJobDynamicField.Item> childChildren = (List<ResumeJobDynamicField.Item>) child.getChildren();
for (ResumeJobDynamicField.Item childChild : childChildren) {
String j_typeId = childChild.getValue();
String j_typeName = childChild.getLabel();
sb.append(" {\n" +
" key: \"" + j_typeId + "\",\n" +
" selected: false,\n" +
" showname: \"" + j_typeName + "\"\n" +
" },\n");
}
sb.append("],\n");
//sb.append("multiple: 'false'\n");
sb.append("},");
}
sb.append(" }\n");
sb.append(" } ,\n");
}
sb.append(" }\n" +
" }");
return sb.toString();
2024-04-07 11:25:16 +08:00
}
2023-10-10 09:28:06 +08:00
}