From c14c7ecfdc3bfe5ab2f97c519de31eed53afc2f0 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Wed, 20 Sep 2023 11:47:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=AD=9B=E9=80=89=E8=BD=AC?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=AD=9B=E9=80=89=E5=8F=8D=E9=A6=88=EF=BC=88?= =?UTF-8?q?=E5=8D=95=E4=B8=80=E3=80=81=E6=89=B9=E9=87=8F=EF=BC=89Action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recruit/wrapper/RecruitButtonWrapper.java | 2 +- .../BatchAddDeptScreeningModeExpand.java | 156 ++++++++++++++++++ ... => SingleAddDeptScreeningModeExpand.java} | 69 ++++---- .../process/RelatedStageModeExpand.java | 9 - 4 files changed, 189 insertions(+), 47 deletions(-) create mode 100644 src/weaver/formmode/recruit/departmentscreening/BatchAddDeptScreeningModeExpand.java rename src/weaver/formmode/recruit/departmentscreening/{AddDeptScreeningModeExpand.java => SingleAddDeptScreeningModeExpand.java} (72%) diff --git a/src/com/engine/recruit/wrapper/RecruitButtonWrapper.java b/src/com/engine/recruit/wrapper/RecruitButtonWrapper.java index 3ded352..f44659b 100644 --- a/src/com/engine/recruit/wrapper/RecruitButtonWrapper.java +++ b/src/com/engine/recruit/wrapper/RecruitButtonWrapper.java @@ -26,7 +26,7 @@ public class RecruitButtonWrapper extends Service { * @param classPath 类全路径 * @return */ - public RecruitButtonService getRecruitButtonService(User user, String classPath) { + private RecruitButtonService getRecruitButtonService(User user, String classPath) { return ServiceUtil.getService(RecruitButtonFactory.getClass(classPath), user); } diff --git a/src/weaver/formmode/recruit/departmentscreening/BatchAddDeptScreeningModeExpand.java b/src/weaver/formmode/recruit/departmentscreening/BatchAddDeptScreeningModeExpand.java new file mode 100644 index 0000000..8a4fdeb --- /dev/null +++ b/src/weaver/formmode/recruit/departmentscreening/BatchAddDeptScreeningModeExpand.java @@ -0,0 +1,156 @@ +package weaver.formmode.recruit.departmentscreening; + +import org.apache.commons.collections.CollectionUtils; +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.*; + +import java.util.*; + +/** + *

聚才林招聘

+ * 批量发起部门筛选,转部门筛选反馈数据 + * + * @author:dxfeng + * @createTime: 2023/09/18 + * @version: 1.0 + */ +public class BatchAddDeptScreeningModeExpand extends AbstractModeExpandJavaCodeNew { + /** + * JCL_部门筛选反馈(uf_jcl_bmsxfk) + */ + private static final String MODE_TABLE_NAME = "uf_jcl_bmsxfk"; + + @Override + public Map doModeExpand(Map param) { + Map result = new HashMap<>(); + try { + RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo"); + if (requestInfo != null) { + int formModeId = -1; + RecordSet rs = new RecordSet(); + rs.executeQuery("select id from modeinfo where formid =( select id from workflow_bill where tablename = ? )", MODE_TABLE_NAME); + if (rs.next()) { + formModeId = rs.getInt("id"); + } + MainTableInfo mainTableInfo = requestInfo.getMainTableInfo(); + Property[] properties = mainTableInfo.getProperty(); + Map mainDataMap = new HashMap<>(); + for (Property property : properties) { + mainDataMap.put(property.getName(), property.getValue()); + } + // 部门筛选ID + mainDataMap.put("bmsxid", requestInfo.getRequestid()); + // 结果 + mainDataMap.put("jg", "2"); + // 填充建模数据基本信息 + mainDataMap.put("formmodeid", formModeId); + mainDataMap.put("modedatacreater", requestInfo.getCreatorid()); + String dateTime = DateUtil.getFullDate(); + String[] split = dateTime.split(" "); + mainDataMap.put("modedatacreatedate", split[0]); + mainDataMap.put("modedatacreatetime", split[1]); + mainDataMap.put("modedatamodifier", requestInfo.getCreatorid()); + mainDataMap.put("modedatamodifydatetime", dateTime); + mainDataMap.put("modedatacreatertype", "0"); + + List> detailMapList = new ArrayList<>(); + DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo(); + DetailTable detailTable = detailTableInfo.getDetailTable(0); + Row[] rows = detailTable.getRow(); + for (Row row : rows) { + Map detailDataMap = new HashMap<>(mainDataMap); + Cell[] cells = row.getCell(); + for (Cell cell : cells) { + detailDataMap.put(cell.getName(), cell.getValue()); + } + detailMapList.add(detailDataMap); + } + + for (Map detailDataMap : detailMapList) { + List> paramList = new ArrayList<>(); + buildParamList(detailDataMap, paramList); + if (CollectionUtils.isNotEmpty(paramList)) { + String insertSql = "insert into " + MODE_TABLE_NAME + " (modeuuid, modedatacreatertype, formmodeid, modedatacreater, modedatacreatedate, modedatacreatetime, modedatamodifier, modedatamodifydatetime, bmsxid, ypz, ypzw, tdsj, jg, pcid, fkr) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + for (List objects : paramList) { + String uuid = UUID.randomUUID().toString(); + objects.add(0, uuid); + rs.executeUpdate(insertSql, objects); + refreshRight(rs, uuid, formModeId); + } + } + } + } + } catch (Exception e) { + new BaseBean().writeLog(e); + result.put("errmsg", "自定义出错信息"); + result.put("flag", "false"); + } + return result; + } + + /** + * 构建批量插入数据集合 + * + * @param map 表单参数 + * @param paramList 待插入数据集合 + */ + private void buildParamList(Map map, List> paramList) { + List param = new ArrayList<>(); + // 填充建模表相关字段 + param.add(map.get("modedatacreatertype")); + param.add(map.get("formmodeid")); + param.add(map.get("modedatacreater")); + param.add(map.get("modedatacreatedate")); + param.add(map.get("modedatacreatetime")); + param.add(map.get("modedatamodifier")); + param.add(map.get("modedatamodifydatetime")); + + //部门筛选ID + param.add(map.get("bmsxid")); + // 应聘者 + param.add(map.get("ypz")); + // 应聘职位 + param.add(map.get("ypzw")); + // 投递时间 + param.add(map.get("tdsj")); + // 状态 + param.add(map.get("jg")); + // 批次ID + param.add(map.get("pcid")); + // 反馈人 + String fkr = Util.null2String(map.get("fkr")); + if (StringUtils.isNotBlank(fkr)) { + String[] fkrArray = fkr.split(","); + for (String fkrId : fkrArray) { + ArrayList objects = new ArrayList<>(param); + objects.add(fkrId); + paramList.add(objects); + } + } + } + + /** + * 权限重构 + * + * @param rs RecordSet + * @param uuid UUID + * @param formModeId 建模ID + */ + private void refreshRight(RecordSet rs, String uuid, int formModeId) { + rs.executeQuery("select id from " + MODE_TABLE_NAME + " where modeuuid='" + uuid + "'"); + if (rs.next()) { + //建模数据的id + int bid = Util.getIntValue(rs.getString("id")); + ModeRightInfo modeRightInfo = new ModeRightInfo(); + modeRightInfo.setNewRight(true); + //新建的时候添加共享 + modeRightInfo.editModeDataShare(1, formModeId, bid); + } + } +} diff --git a/src/weaver/formmode/recruit/departmentscreening/AddDeptScreeningModeExpand.java b/src/weaver/formmode/recruit/departmentscreening/SingleAddDeptScreeningModeExpand.java similarity index 72% rename from src/weaver/formmode/recruit/departmentscreening/AddDeptScreeningModeExpand.java rename to src/weaver/formmode/recruit/departmentscreening/SingleAddDeptScreeningModeExpand.java index 951910e..f087681 100644 --- a/src/weaver/formmode/recruit/departmentscreening/AddDeptScreeningModeExpand.java +++ b/src/weaver/formmode/recruit/departmentscreening/SingleAddDeptScreeningModeExpand.java @@ -16,13 +16,13 @@ import java.util.*; /** *

聚才林招聘

- * 发起部门筛选,转部门筛选反馈数据 + * 单一发起部门筛选,转部门筛选反馈数据 * * @author:dxfeng * @createTime: 2023/09/18 * @version: 1.0 */ -public class AddDeptScreeningModeExpand extends AbstractModeExpandJavaCodeNew { +public class SingleAddDeptScreeningModeExpand extends AbstractModeExpandJavaCodeNew { /** * JCL_部门筛选反馈(uf_jcl_bmsxfk) */ @@ -67,7 +67,7 @@ public class AddDeptScreeningModeExpand extends AbstractModeExpandJavaCodeNew { List> paramList = new ArrayList<>(); buildParamList(dataMap, paramList); if (CollectionUtils.isNotEmpty(paramList)) { - String insertSql = "insert into " + MODE_TABLE_NAME + " (modeuuid, modedatacreatertype, formmodeid, modedatacreater, modedatacreatedate, modedatacreatetime, modedatamodifier, modedatamodifydatetime, bmsxid, ypz, ypzw, tdsj, jg, fkr) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + String insertSql = "insert into " + MODE_TABLE_NAME + " (modeuuid, modedatacreatertype, formmodeid, modedatacreater, modedatacreatedate, modedatacreatetime, modedatamodifier, modedatamodifydatetime, bmsxid, ypz, ypzw, tdsj, jg, pcid, fkr) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; for (List objects : paramList) { String uuid = UUID.randomUUID().toString(); objects.add(0, uuid); @@ -91,41 +91,36 @@ public class AddDeptScreeningModeExpand extends AbstractModeExpandJavaCodeNew { * @param paramList 待插入数据集合 */ private void buildParamList(Map map, List> paramList) { - String ypz = Util.null2String(map.get("ypz")); - String[] ypzIds = ypz.split(","); - for (String ypzId : ypzIds) { - if (StringUtils.isBlank(ypzId)) { - continue; - } - List param = new ArrayList<>(); - // 填充建模表相关字段 - param.add(map.get("modedatacreatertype")); - param.add(map.get("formmodeid")); - param.add(map.get("modedatacreater")); - param.add(map.get("modedatacreatedate")); - param.add(map.get("modedatacreatetime")); - param.add(map.get("modedatamodifier")); - param.add(map.get("modedatamodifydatetime")); + List param = new ArrayList<>(); + // 填充建模表相关字段 + param.add(map.get("modedatacreatertype")); + param.add(map.get("formmodeid")); + param.add(map.get("modedatacreater")); + param.add(map.get("modedatacreatedate")); + param.add(map.get("modedatacreatetime")); + param.add(map.get("modedatamodifier")); + param.add(map.get("modedatamodifydatetime")); - //部门筛选ID - param.add(map.get("bmsxid")); - // 应聘者 - param.add(ypzId); - // 应聘职位 - param.add(map.get("ypzw")); - // 投递时间 - param.add(map.get("tdsj")); - // 状态 - param.add(map.get("jg")); - // 反馈人 - String fkr = Util.null2String(map.get("fkr")); - if (StringUtils.isNotBlank(fkr)) { - String[] fkrArray = fkr.split(","); - for (String fkrId : fkrArray) { - ArrayList objects = new ArrayList<>(param); - objects.add(fkrId); - paramList.add(objects); - } + //部门筛选ID + param.add(map.get("bmsxid")); + // 应聘者 + param.add(map.get("ypz")); + // 应聘职位 + param.add(map.get("ypzw")); + // 投递时间 + param.add(map.get("tdsj")); + // 状态 + param.add(map.get("jg")); + // 批次ID + param.add(map.get("pcid")); + // 反馈人 + String fkr = Util.null2String(map.get("fkr")); + if (StringUtils.isNotBlank(fkr)) { + String[] fkrArray = fkr.split(","); + for (String fkrId : fkrArray) { + ArrayList objects = new ArrayList<>(param); + objects.add(fkrId); + paramList.add(objects); } } } diff --git a/src/weaver/formmode/recruit/process/RelatedStageModeExpand.java b/src/weaver/formmode/recruit/process/RelatedStageModeExpand.java index 06702e2..3cf56f6 100644 --- a/src/weaver/formmode/recruit/process/RelatedStageModeExpand.java +++ b/src/weaver/formmode/recruit/process/RelatedStageModeExpand.java @@ -10,7 +10,6 @@ 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.*; @@ -37,13 +36,6 @@ public class RelatedStageModeExpand extends AbstractModeExpandJavaCodeNew { 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 mainDataMap = new HashMap<>(); @@ -58,7 +50,6 @@ public class RelatedStageModeExpand extends AbstractModeExpandJavaCodeNew { String jsjd = mainDataMap.get("jsjd"); // 查询所有的操作阶段信息 relatedStageData(requestInfo.getCreatorid(), billId, ksjd, gcjd, jsjd); - } } catch (Exception e) { new BaseBean().writeLog(e);