招聘流程,页面布局相关接口开发

This commit is contained in:
dxfeng 2023-10-12 13:33:49 +08:00
parent 16fe39b742
commit fee1614a53
8 changed files with 232 additions and 19 deletions

View File

@ -9,7 +9,7 @@ import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
@ -26,7 +26,7 @@ public class RecruitFlowController {
return ServiceUtil.getService(RecruitFlowWrapper.class, user);
}
@POST
@GET
@Path("/getButtonList")
@Produces(MediaType.APPLICATION_JSON)
public String getButtonList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
@ -34,4 +34,13 @@ public class RecruitFlowController {
Map<String, Object> params = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitFlowWrapper(user)::getButtonList, params);
}
@GET
@Path("/getRecruitStepList")
@Produces(MediaType.APPLICATION_JSON)
public String getRecruitStepList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> params = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitFlowWrapper(user)::getRecruitStepList, params);
}
}

View File

@ -17,6 +17,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@Builder
public class RecruitButton {
private String key;
private String buttonName;
private String tabName;
private String tabLink;

View File

@ -0,0 +1,20 @@
package com.engine.recruit.entity.recruitflow.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author:dxfeng
* @createTime: 2023/10/12
* @version: 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RecruitStepPo {
private int key;
private String description;
}

View File

@ -0,0 +1,60 @@
package com.engine.recruit.entity.recruitflow.po;
import com.engine.recruit.util.RecruitFlowUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2023/10/11
* @version: 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RecruitTabPo {
private static final String SEARCH_URL = "/main/cube/search";
private String key;
private String title;
private String url;
private String viewcondition;
private String billId;
public String getUrl() {
if (StringUtils.isNotBlank(url)) {
url = url.replaceAll("\\$parentid\\$", billId);
}
return url;
}
public String getTitle() {
if (StringUtils.isNotBlank(url) && url.contains(SEARCH_URL)) {
Map<String, String> paramMap = RecruitFlowUtil.parseURL(getUrl());
String customId = paramMap.get("customid");
if (StringUtils.isBlank(customId)) {
return title;
}
// 查询对应查询列表的表名
RecordSet rs = new RecordSet();
rs.executeQuery("select tablename from workflow_bill where id = (select formid from mode_customsearch where id = ?)", customId);
if (rs.next()) {
String tableName = rs.getString("tablename");
String tabCount = "0";
rs.executeQuery("select count(1) as num from " + tableName + " where pcid = ?", billId);
if (rs.next()) {
tabCount = rs.getString("num");
}
title += "(" + tabCount + ")";
}
}
return title;
}
}

View File

@ -14,8 +14,16 @@ public interface RecruitFlowService {
/**
* 获取当前阶段操作按钮
*
* @param params 参数
* @param param 参数
* @return 操作按钮
*/
Map<String, Object> getButtonList(Map<String, Object> params);
Map<String, Object> getButtonList(Map<String, Object> param);
/**
* 获取招聘阶段信息
*
* @param param 参数
* @return 招聘阶段
*/
Map<String, Object> getRecruitStepList(Map<String, Object> param);
}

View File

@ -2,6 +2,9 @@ package com.engine.recruit.service.impl;
import com.engine.core.impl.Service;
import com.engine.recruit.entity.recruitflow.po.RecruitButton;
import com.engine.recruit.entity.recruitflow.po.RecruitStepPo;
import com.engine.recruit.entity.recruitflow.po.RecruitTabPo;
import com.engine.recruit.exception.CustomizeRunTimeException;
import com.engine.recruit.service.RecruitFlowService;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
@ -19,22 +22,29 @@ import java.util.Map;
*/
public class RecruitFlowServiceImpl extends Service implements RecruitFlowService {
@Override
public Map<String, Object> getButtonList(Map<String, Object> params) {
public Map<String, Object> getButtonList(Map<String, Object> param) {
Map<String, Object> returnMap = new HashMap<>();
String modeId = Util.null2String(params.get("modeId"));
String formId = Util.null2String(params.get("formId"));
String billId = Util.null2String(params.get("billId"));
String billId = Util.null2String(param.get("billId"));
// 当前阶段
String stageId = Util.null2String(params.get("stageId"));
// 招聘阶段ID
String stageId = "";
// 招聘流程ID
int recruitFlowId = -1;
//TODO 查询对应的招聘流程
int zplcId = 3;
List<RecruitButton> buttonList = new ArrayList<>();
RecordSet rs = new RecordSet();
rs.executeQuery("select zplc,zpjd from uf_jcl_yppc where id = ?", billId);
if (rs.next()) {
recruitFlowId = rs.getInt("zplc");
stageId = rs.getString("zpjd");
}
if (-1 == recruitFlowId) {
throw new CustomizeRunTimeException("未设置对应招聘流程");
}
if (StringUtils.isBlank(stageId)) {
// 查询开始环节
rs.executeQuery("select id from uf_jcl_zpjdsz where zplc = ? and hj = 0", zplcId);
rs.executeQuery("select id from uf_jcl_zpjdsz where zplc = ? and hj = 0", recruitFlowId);
if (rs.next()) {
stageId = rs.getString("id");
}
@ -42,20 +52,75 @@ public class RecruitFlowServiceImpl extends Service implements RecruitFlowServic
throw new RuntimeException("未找到对应招聘阶段");
}
}
rs.executeQuery("select a.zdyxsmc as buttonName, a.tzymbt as tabName, a.tzymdz as tabLink, a.zssx as orderNum, b.anbs as buttonKey, b.andz as buttonAction from uf_jcl_zpjdsz_dt1 a inner join uf_jcl_lcczan b on a.czan = b.id where a.sfqy = 0 and mainid = ? order by zssx", stageId);
rs.executeQuery("select a.id,a.zdyxsmc as buttonName, a.tzymbt as tabName, a.tzymdz as tabLink, a.zssx as orderNum, b.anbs as buttonKey, b.andz as buttonAction from uf_jcl_zpjdsz_dt1 a inner join uf_jcl_lcczan b on a.czan = b.id where a.sfqy = 0 and mainid = ? order by zssx", stageId);
List<RecruitButton> buttonList = new ArrayList<>();
List<RecruitTabPo> tabList = new ArrayList<>();
while (rs.next()) {
buttonList.add(RecruitButton.builder()
.key(rs.getString("id"))
.buttonName(rs.getString("buttonName"))
.tabName(rs.getString("tabName"))
.tabLink(rs.getString("tabLink"))
.buttonKey(rs.getString("buttonKey"))
.buttonAction(rs.getString("buttonAction"))
.orderNum(rs.getInt("orderNum"))
.build());
}
rs.executeQuery("select tzymbt as title,tzymdz as url,zssx as orderNum from uf_jcl_zpjdsz_dt1 where sfqy = 0 and tzymbt !='' and tzymdz !='' and mainid = ? " +
" union " +
"select ymbt as title,ymdz as url,zssx as orderNum from uf_jcl_zpjdsz_dt2 where mainid = ? order by orderNum", stageId, stageId);
int tabIndex = 0;
while (rs.next()) {
tabList.add(RecruitTabPo.builder()
.key(String.valueOf(tabIndex))
.viewcondition(String.valueOf(tabIndex))
.title(rs.getString("title"))
.url(rs.getString("url"))
.billId(billId)
.build());
tabIndex++;
}
// 当前阶段所有按钮信息
returnMap.put("buttonList", buttonList);
returnMap.put("tabList", tabList);
return returnMap;
}
@Override
public Map<String, Object> getRecruitStepList(Map<String, Object> param) {
Map<String, Object> returnMap = new HashMap<>();
String billId = Util.null2String(param.get("billId"));
// 招聘阶段ID
String stageId = "0";
int currentStageId = 0;
// 招聘流程ID
int recruitFlowId = -1;
RecordSet rs = new RecordSet();
rs.executeQuery("select zplc,zpjd from uf_jcl_yppc where id = ?", billId);
if (rs.next()) {
recruitFlowId = rs.getInt("zplc");
stageId = rs.getString("zpjd");
}
if (-1 == recruitFlowId) {
throw new CustomizeRunTimeException("未设置对应招聘流程");
}
rs.executeQuery("select id,jdmc from uf_jcl_zpjdsz where sfqy = 0 and zplc = ? order by zssx", recruitFlowId);
int stepIndex = 0;
List<RecruitStepPo> stepList = new ArrayList<>();
while (rs.next()) {
String id = rs.getString("id");
if (stageId.equals(id)) {
currentStageId = stepIndex;
}
stepList.add(RecruitStepPo.builder().key(stepIndex).description(rs.getString("jdmc")).build());
stepIndex++;
}
returnMap.put("stepList", stepList);
returnMap.put("currentStageId", currentStageId);
return returnMap;
}
}

View File

@ -0,0 +1,46 @@
package com.engine.recruit.util;
import com.engine.recruit.exception.CustomizeRunTimeException;
import org.apache.commons.lang3.StringUtils;
import weaver.general.BaseBean;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2023/10/12
* @version: 1.0
*/
public class RecruitFlowUtil {
/**
* 解析url中参数信息
*
* @param urlString url地址
* @return
*/
public static Map<String, String> parseURL(String urlString) {
Map<String, String> params = new HashMap<>();
try {
if (StringUtils.isNotBlank(urlString)) {
if (urlString.contains("?")) {
urlString = urlString.split("\\?")[1];
}
String[] paramPairs = urlString.split("&");
for (String paramPair : paramPairs) {
String[] keyValue = paramPair.split("=");
String key = URLDecoder.decode(keyValue[0], "UTF-8");
String value = URLDecoder.decode(keyValue[1], "UTF-8");
params.put(key, value);
}
}
} catch (Exception e) {
new BaseBean().writeLog(e);
throw new CustomizeRunTimeException(urlString + "解析失败");
}
return params;
}
}

View File

@ -18,7 +18,11 @@ public class RecruitFlowWrapper extends Service {
return ServiceUtil.getService(RecruitFlowServiceImpl.class, user);
}
public Map<String, Object> getButtonList(Map<String, Object> params) {
return getRecruitFlowService(user).getButtonList(params);
public Map<String, Object> getButtonList(Map<String, Object> param) {
return getRecruitFlowService(user).getButtonList(param);
}
public Map<String, Object> getRecruitStepList(Map<String, Object> param) {
return getRecruitFlowService(user).getRecruitStepList(param);
}
}