generated from dxfeng/secondev-chapanda-feishu
131 lines
5.0 KiB
Java
131 lines
5.0 KiB
Java
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 com.engine.recruit.util.RecruitFlowUtil;
|
|
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) {
|
|
Map<String, Object> returnMap = new HashMap<>();
|
|
String billId = Util.null2String(param.get("billId"));
|
|
|
|
// 招聘阶段ID
|
|
String stageId = "";
|
|
// 招聘流程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("未设置对应招聘流程");
|
|
}
|
|
|
|
|
|
if (StringUtils.isBlank(stageId)) {
|
|
// 查询开始环节
|
|
rs.executeQuery("select id from uf_jcl_zpjdsz where zplc = ? and hj = 0", recruitFlowId);
|
|
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 buttonType 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"))
|
|
.buttonKey(rs.getString("buttonKey"))
|
|
.tabName(rs.getString("tabName"))
|
|
.tabLink(RecruitFlowUtil.replaceURL(rs.getString("tabLink"), billId))
|
|
.buttonType(rs.getString("buttonType"))
|
|
.orderNum(rs.getInt("orderNum"))
|
|
.build());
|
|
}
|
|
|
|
rs.executeQuery("select ymbt as title,ymdz as url,zssx as orderNum from uf_jcl_zpjdsz_dt2 where mainid = ? order by orderNum", stageId);
|
|
int tabIndex = 0;
|
|
while (rs.next()) {
|
|
tabList.add(RecruitTabPo.builder()
|
|
.key(String.valueOf(tabIndex))
|
|
.viewcondition(String.valueOf(tabIndex))
|
|
.title(rs.getString("title"))
|
|
.url(RecruitFlowUtil.replaceURL(rs.getString("url"), billId))
|
|
.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 = "";
|
|
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++;
|
|
}
|
|
if ("-1".equals(stageId)) {
|
|
currentStageId = stepList.size();
|
|
}
|
|
|
|
returnMap.put("stepList", stepList);
|
|
returnMap.put("currentStageId", currentStageId);
|
|
return returnMap;
|
|
}
|
|
}
|