generated from dxfeng/secondev-chapanda-feishu
职位发布-添加职位类型字段
This commit is contained in:
parent
7505981c76
commit
00a5d271f4
|
|
@ -3,11 +3,10 @@ package com.engine.recruit.service.impl;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.ConditionType;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.recruit.exception.CustomizeRunTimeException;
|
||||
import com.engine.recruit.service.RecruitPositionService;
|
||||
import com.engine.recruit.util.RecruitFormItemUtil;
|
||||
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;
|
||||
|
|
@ -51,73 +50,136 @@ public class RecruitPositionServiceImpl extends Service implements RecruitPositi
|
|||
Map<String, Object> apidatas = new HashMap<>();
|
||||
apidatas.put("hasRight", true);
|
||||
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
|
||||
ResumeJobDynamicField resumeJobDynamicField = client.getResumeJobDynamicField();
|
||||
|
||||
//输入框类
|
||||
List<SearchConditionItem> inputItems = new ArrayList<>();
|
||||
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
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);
|
||||
|
||||
SearchConditionItem demo_input = conditionFactory.createCondition(ConditionType.INPUT,502327, "input");
|
||||
demo_input.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行
|
||||
demo_input.setFieldcol(12); //条件输入框所占宽度,默认值18
|
||||
demo_input.setViewAttr(3); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2
|
||||
demo_input.setLength(10); // 设置输入长度
|
||||
demo_input.setLabel("文本输入框"); //设置文本值 这个将覆盖多语言标签的值
|
||||
demo_input.setRules("required"); //设置字段填入规则
|
||||
demo_input.setValue("我是默认值"); //这里设置数据的默认值,开发可以通过从数据库取出数据传入
|
||||
inputItems.add(demo_input);
|
||||
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);
|
||||
|
||||
//整数
|
||||
SearchConditionItem demo_inputnumber = conditionFactory.createCondition(ConditionType.INPUTNUMBER,502227, "inputNumber");
|
||||
demo_inputnumber.setColSpan(2);
|
||||
demo_inputnumber.setFieldcol(12);
|
||||
demo_inputnumber.setViewAttr(2); //
|
||||
demo_inputnumber.setLabel("数字输入框");
|
||||
demo_inputnumber.setRules("required"); //设置字段填入规则
|
||||
inputItems.add(demo_inputnumber);
|
||||
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);
|
||||
|
||||
SearchConditionItem cascaderItem = conditionFactory.createCondition(ConditionType.CASCADER,"388482,1329","cascader");
|
||||
cascaderItem.setFieldcol(12);
|
||||
cascaderItem.setViewAttr(3);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{\n" +
|
||||
" type: 'select',\n" +
|
||||
" parent: {type:'div',style:{float:'left'}},\n" +
|
||||
" style: {width: 120},\n" +
|
||||
" options: ");
|
||||
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);
|
||||
|
||||
List<String> pathIdList = new ArrayList<>();
|
||||
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
|
||||
ResumeJobDynamicField resumeJobDynamicField = client.getResumeJobDynamicField();
|
||||
List<ResumeJobDynamicField.Item> boss_type = (List<ResumeJobDynamicField.Item>)resumeJobDynamicField.getBoss_type();
|
||||
String bossTypeStr = JSON.toJSONString(boss_type);
|
||||
bossTypeStr = bossTypeStr.replace("value","key").replace("label","showname").replace("children","subChildren");
|
||||
//for (ResumeJobDynamicField.Item item : boss_type) {
|
||||
// String pathId = item.get;
|
||||
// String pathName = Util.null2String(rs.getString("name"));
|
||||
// pathIdList.add(pathId);
|
||||
// sb.append("{\n" +
|
||||
// " key: \""+pathId+"\",\n" +
|
||||
// " selected: true,\n" +
|
||||
// " showname: '"+pathName+"'\n" +
|
||||
// " },");
|
||||
//}
|
||||
sb.append(bossTypeStr);
|
||||
//sb.append("]");
|
||||
sb.append(" }");
|
||||
|
||||
System.out.println(JSON.parseObject(sb.toString()));
|
||||
cascaderItem.setCompDef(JSON.parseObject(sb.toString()));
|
||||
inputItems.add(cascaderItem);
|
||||
|
||||
addGroups.add(new SearchConditionGroup("输入框类",true,inputItems));
|
||||
apidatas.put("condition", addGroups );
|
||||
addGroups.add(new SearchConditionGroup("职位类别", true, inputItems));
|
||||
apidatas.put("condition", addGroups);
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建职位类型,级联组件数据
|
||||
*
|
||||
* @param typeList
|
||||
* @return
|
||||
*/
|
||||
private String convertPositionType(List<ResumeJobDynamicField.Item> typeList) {
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{\n" +
|
||||
" type: 'select',\n" +
|
||||
" customProps: {'*':{viewAttr:3,rules:'required'}},\n" +
|
||||
|
||||
" 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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import java.util.Map;
|
|||
* @Date 2024/1/24
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Deprecated
|
||||
public class RecruitFormItemUtil {
|
||||
|
||||
/**
|
||||
|
|
@ -49,6 +48,28 @@ public class RecruitFormItemUtil {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* cascader
|
||||
*
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param viewAttr
|
||||
* @param label
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem cascaderItem(User user, int colSpan, int fieldcol,
|
||||
int viewAttr, String label, String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem cascader = conditionFactory.createCondition(ConditionType.CASCADER, 502327, name);
|
||||
cascader.setColSpan(colSpan);
|
||||
cascader.setFieldcol(fieldcol);
|
||||
cascader.setViewAttr(viewAttr);
|
||||
cascader.setLabel(label);
|
||||
return cascader;
|
||||
}
|
||||
|
||||
/**
|
||||
* checkbox
|
||||
*
|
||||
|
|
@ -120,7 +141,7 @@ public class RecruitFormItemUtil {
|
|||
}
|
||||
|
||||
public static SearchConditionItem uploadItem(User user, int colSpan, int fieldcol,
|
||||
int viewAttr, int length, String label, String name,int maxUploadSize,int maxFilesNumber,String limitType) {
|
||||
int viewAttr, int length, String label, String name, int maxUploadSize, int maxFilesNumber, String limitType) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem upload = conditionFactory.createCondition(ConditionType.UPLOAD, 25034, name);
|
||||
upload.setColSpan(colSpan);
|
||||
|
|
|
|||
Loading…
Reference in New Issue