generated from dxfeng/secondev-chapanda-feishu
招聘流程-新建时,生成流程阶段关联数据
This commit is contained in:
parent
cbe4d20940
commit
d93a4b6c8b
|
|
@ -0,0 +1,192 @@
|
||||||
|
package weaver.formmode.recruit.process;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import weaver.common.DateUtil;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||||
|
import weaver.formmode.setup.ModeRightInfo;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.soa.workflow.request.MainTableInfo;
|
||||||
|
import weaver.soa.workflow.request.Property;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
import weaver.workflow.workflow.WorkflowBillComInfo;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>聚才林招聘</p>
|
||||||
|
*
|
||||||
|
* <p>招聘流程新建时,生成流程阶段关联数据</p>
|
||||||
|
*
|
||||||
|
* @author:dxfeng
|
||||||
|
* @createTime: 2023/09/19
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public class RelatedStageModeExpand extends AbstractModeExpandJavaCodeNew {
|
||||||
|
private static final String MODE_TABLE_NAME = "uf_jcl_zpjdsz";
|
||||||
|
private static final String MODE_TABLE_NAME_DT1 = "uf_jcl_zpjdsz_dt1";
|
||||||
|
private static final String MODE_TABLE_NAME_DT2 = "uf_jcl_zpjdsz_dt2";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||||
|
Map<String, String> result = new HashMap<>();
|
||||||
|
try {
|
||||||
|
String billId;
|
||||||
|
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||||
|
if (requestInfo != null) {
|
||||||
|
billId = requestInfo.getRequestid();
|
||||||
|
// 获取表单名称
|
||||||
|
String formId = Util.null2String(param.get("formid"));
|
||||||
|
String tableName = new WorkflowBillComInfo().getTablename(formId);
|
||||||
|
//String sql = "update " + tableName + " set xqzt = ? ,jssj = ?,wcsj = ? where id = ?";
|
||||||
|
//RecordSet rs = new RecordSet();
|
||||||
|
//// 更新状态为招聘完成,置空结束日期,完成日期取当前日期
|
||||||
|
//rs.executeUpdate(sql, RecruitStatusEnum.RECRUITMENT_COMPLETED.getValue(), null, DateUtil.getCurrentDate(), billId);
|
||||||
|
new BaseBean().writeLog("完成需求操作:billId=[" + billId + "]操作完成");
|
||||||
|
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||||
|
Property[] properties = mainTableInfo.getProperty();
|
||||||
|
Map<String, String> mainDataMap = new HashMap<>();
|
||||||
|
for (Property property : properties) {
|
||||||
|
mainDataMap.put(property.getName(), property.getValue());
|
||||||
|
}
|
||||||
|
// 开始阶段
|
||||||
|
String ksjd = mainDataMap.get("ksjd");
|
||||||
|
// 过程阶段
|
||||||
|
String gcjd = mainDataMap.get("gcjd");
|
||||||
|
// 结束阶段
|
||||||
|
String jsjd = mainDataMap.get("jsjd");
|
||||||
|
// 查询所有的操作阶段信息
|
||||||
|
relatedStageData(requestInfo.getCreatorid(), billId, ksjd, gcjd, jsjd);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
new BaseBean().writeLog(e);
|
||||||
|
;
|
||||||
|
result.put("errmsg", "完成需求操作失败");
|
||||||
|
result.put("flag", "false");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成关联的招聘阶段数据
|
||||||
|
*
|
||||||
|
* @param creator 创建者ID
|
||||||
|
* @param billId 当前数据ID
|
||||||
|
* @param processIds 路程表单所选阶段ID
|
||||||
|
*/
|
||||||
|
private void relatedStageData(String creator, String billId, String... processIds) {
|
||||||
|
String dateTime = DateUtil.getFullDate();
|
||||||
|
String[] dateSplit = dateTime.split(" ");
|
||||||
|
|
||||||
|
List<String> paramsList = new ArrayList<>();
|
||||||
|
// modedatacreater
|
||||||
|
paramsList.add(creator);
|
||||||
|
// modedatacreatedate
|
||||||
|
paramsList.add(dateSplit[0]);
|
||||||
|
// modedatacreatetime
|
||||||
|
paramsList.add(dateSplit[1]);
|
||||||
|
// modedatamodifier
|
||||||
|
paramsList.add(creator);
|
||||||
|
// modedatamodifydatetime
|
||||||
|
paramsList.add(dateTime);
|
||||||
|
// modedatacreatertype
|
||||||
|
paramsList.add("0");
|
||||||
|
|
||||||
|
String processIdsStr = StringUtils.join(Arrays.asList(processIds), ",");
|
||||||
|
String insertSql = "insert into " + MODE_TABLE_NAME + " (modeuuid, modedatacreater, modedatacreatedate, modedatacreatetime, modedatamodifier, modedatamodifydatetime, modedatacreatertype, formmodeid, jdmc, jdms, jdlx, hj, sfqy, zssx, zpjd, zplc) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
|
for (String processId : processIdsStr.split(",")) {
|
||||||
|
if (StringUtils.isBlank(processId)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
insertMainTableData(billId, processId, insertSql, paramsList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入主表数据
|
||||||
|
*
|
||||||
|
* @param billId 招聘流程表单ID
|
||||||
|
* @param processId 招聘阶段ID
|
||||||
|
* @param insertSql 插入SQL语句
|
||||||
|
* @param paramsList 待插入参数集合
|
||||||
|
*/
|
||||||
|
private void insertMainTableData(String billId, String processId, String insertSql, List<String> paramsList) {
|
||||||
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
ArrayList<String> insertList = new ArrayList<>(paramsList);
|
||||||
|
insertList.add(0, uuid);
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.executeQuery("select * from uf_jcl_zpjdsz where id = ?", processId);
|
||||||
|
if (rs.next()) {
|
||||||
|
String formModeId = rs.getString("formmodeid");
|
||||||
|
insertList.add(formModeId);
|
||||||
|
insertList.add(rs.getString("jdmc"));
|
||||||
|
insertList.add(rs.getString("jdms"));
|
||||||
|
insertList.add(rs.getString("jdlx"));
|
||||||
|
insertList.add(rs.getString("hj"));
|
||||||
|
insertList.add(rs.getString("sfqy"));
|
||||||
|
insertList.add(rs.getString("zssx"));
|
||||||
|
// zpjd
|
||||||
|
insertList.add(processId);
|
||||||
|
// zplc
|
||||||
|
insertList.add(billId);
|
||||||
|
// 插入主表数据
|
||||||
|
rs.executeUpdate(insertSql, insertList);
|
||||||
|
refreshRight(uuid, formModeId, processId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限重构,插入明细表数据
|
||||||
|
*
|
||||||
|
* @param uuid UUID
|
||||||
|
* @param formModeId formModeId
|
||||||
|
*/
|
||||||
|
private void refreshRight(String uuid, String formModeId, String processId) {
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.executeQuery("select id from " + MODE_TABLE_NAME + " where modeuuid='" + uuid + "'");
|
||||||
|
if (rs.next()) {
|
||||||
|
//建模数据的id
|
||||||
|
String bid = rs.getString("id");
|
||||||
|
ModeRightInfo modeRightInfo = new ModeRightInfo();
|
||||||
|
modeRightInfo.setNewRight(true);
|
||||||
|
//新建的时候添加共享
|
||||||
|
modeRightInfo.editModeDataShare(1, Util.getIntValue(formModeId), Util.getIntValue(bid));
|
||||||
|
|
||||||
|
// 插入明细表数据
|
||||||
|
rs.executeQuery("select * from " + MODE_TABLE_NAME_DT1 + " where mainid = ? ", processId);
|
||||||
|
List<List<String>> insertList = new ArrayList<>();
|
||||||
|
while (rs.next()) {
|
||||||
|
List<String> paramList = new ArrayList<>();
|
||||||
|
// mainid
|
||||||
|
paramList.add(bid);
|
||||||
|
paramList.add(rs.getString("czan"));
|
||||||
|
paramList.add(rs.getString("zdyxsmc"));
|
||||||
|
paramList.add(rs.getString("sfqy"));
|
||||||
|
paramList.add(rs.getString("tzymbt"));
|
||||||
|
paramList.add(rs.getString("tzymdz"));
|
||||||
|
paramList.add(rs.getString("zssx"));
|
||||||
|
insertList.add(paramList);
|
||||||
|
}
|
||||||
|
for (List<String> list : insertList) {
|
||||||
|
rs.executeUpdate("insert into " + MODE_TABLE_NAME_DT1 + " (mainid, czan, zdyxsmc, sfqy, tzymbt, tzymdz, zssx) values (?, ?, ?, ?, ?, ?, ?)", list);
|
||||||
|
}
|
||||||
|
|
||||||
|
insertList = new ArrayList<>();
|
||||||
|
rs.executeQuery("select * from " + MODE_TABLE_NAME_DT2 + " where mainid = ? ", processId);
|
||||||
|
while (rs.next()) {
|
||||||
|
List<String> paramList = new ArrayList<>();
|
||||||
|
// mainid
|
||||||
|
paramList.add(bid);
|
||||||
|
paramList.add(rs.getString("ymbt"));
|
||||||
|
paramList.add(rs.getString("ymdz"));
|
||||||
|
paramList.add(rs.getString("zssx"));
|
||||||
|
insertList.add(paramList);
|
||||||
|
}
|
||||||
|
for (List<String> list : insertList) {
|
||||||
|
rs.executeUpdate("insert into " + MODE_TABLE_NAME_DT2 + " (mainid, ymbt, ymdz, zssx) values (?, ?, ?, ?)", list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue