weaver-hrm-recruit/src/com/engine/recruit/service/impl/RecruitFlowServiceImpl.java

127 lines
4.9 KiB
Java
Raw Normal View History

2023-09-25 16:35:58 +08:00
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;
2023-09-25 16:35:58 +08:00
import com.engine.recruit.service.RecruitFlowService;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2023/09/22
* @version: 1.0
*/
public class RecruitFlowServiceImpl extends Service implements RecruitFlowService {
@Override
public Map<String, Object> getButtonList(Map<String, Object> param) {
2023-09-25 16:35:58 +08:00
Map<String, Object> returnMap = new HashMap<>();
String billId = Util.null2String(param.get("billId"));
2023-09-25 16:35:58 +08:00
// 招聘阶段ID
String stageId = "";
// 招聘流程ID
int recruitFlowId = -1;
2023-09-25 16:35:58 +08:00
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("未设置对应招聘流程");
}
2023-09-25 16:35:58 +08:00
if (StringUtils.isBlank(stageId)) {
// 查询开始环节
rs.executeQuery("select id from uf_jcl_zpjdsz where zplc = ? and hj = 0", recruitFlowId);
2023-09-25 16:35:58 +08:00
if (rs.next()) {
stageId = rs.getString("id");
}
if (StringUtils.isBlank(stageId)) {
throw new RuntimeException("未找到对应招聘阶段");
}
}
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<>();
2023-09-25 16:35:58 +08:00
while (rs.next()) {
buttonList.add(RecruitButton.builder()
.key(rs.getString("id"))
2023-09-25 16:35:58 +08:00
.buttonName(rs.getString("buttonName"))
.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++;
}
2023-09-25 16:35:58 +08:00
// 当前阶段所有按钮信息
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);
2023-09-25 16:35:58 +08:00
return returnMap;
}
}