From 3dd10e588cc4812a0d11af3621529f18f3876cc2 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Thu, 18 Jul 2024 13:57:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E6=A0=87-=E9=9D=9E=E6=A0=87=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recruit/constant/RecruitConstant.java | 12 +- .../controller/InitRecruitDataController.java | 8 + .../service/InitRecruitDataService.java | 8 + .../impl/InitRecruitDataServiceImpl.java | 175 ++++++++++++++---- .../wrapper/InitRecruitDataWrapper.java | 4 + 5 files changed, 165 insertions(+), 42 deletions(-) diff --git a/src/com/engine/recruit/constant/RecruitConstant.java b/src/com/engine/recruit/constant/RecruitConstant.java index 0f9c81e..f602b9c 100644 --- a/src/com/engine/recruit/constant/RecruitConstant.java +++ b/src/com/engine/recruit/constant/RecruitConstant.java @@ -43,6 +43,8 @@ public class RecruitConstant { public static final String APP_ID; public static final String APP_SECRET; + public static final String MODE_APP_NAME; + static BaseBean baseBean = new BaseBean(); static { @@ -134,10 +136,16 @@ public class RecruitConstant { // 面试反馈地址 String interviewFeedbackUrl = getRecruitPropValue("INTERVIEW_FEEDBACK_URL"); - if(StringUtils.isBlank(interviewFeedbackUrl)){ + if (StringUtils.isBlank(interviewFeedbackUrl)) { interviewFeedbackUrl = "/spa/custom/static/index.html#/main/cs/app/9277c228302347dc88a958b69ee96234_Interview"; } - INTERVIEW_FEEDBACK_URL =getCompleteUrl(interviewFeedbackUrl); + INTERVIEW_FEEDBACK_URL = getCompleteUrl(interviewFeedbackUrl); + + String modeAppName = getRecruitPropValue("MODE_APP_NAME"); + if (StringUtils.isBlank(modeAppName)) { + modeAppName = "JCL_招聘管理"; + } + MODE_APP_NAME = modeAppName; } /** diff --git a/src/com/engine/recruit/controller/InitRecruitDataController.java b/src/com/engine/recruit/controller/InitRecruitDataController.java index 1ae8748..5c5f244 100644 --- a/src/com/engine/recruit/controller/InitRecruitDataController.java +++ b/src/com/engine/recruit/controller/InitRecruitDataController.java @@ -40,4 +40,12 @@ public class InitRecruitDataController { User user = HrmUserVarify.getUser(request, response); return new ResponseResult, Map>(user).run(getInitRecruitDataWrapper(user)::initRecruitData); } + + @POST + @Path("/updateRecruitData") + @Produces(MediaType.APPLICATION_JSON) + public String updateRecruitData(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, Map>(user).run(getInitRecruitDataWrapper(user)::updateRecruitData); + } } diff --git a/src/com/engine/recruit/service/InitRecruitDataService.java b/src/com/engine/recruit/service/InitRecruitDataService.java index 4f61233..50ab4f7 100644 --- a/src/com/engine/recruit/service/InitRecruitDataService.java +++ b/src/com/engine/recruit/service/InitRecruitDataService.java @@ -22,4 +22,12 @@ public interface InitRecruitDataService { * @return */ Map initRecruitData(); + + /** + * 更新招聘数据 + * + * @return + */ + Map updateRecruitData(); + } diff --git a/src/com/engine/recruit/service/impl/InitRecruitDataServiceImpl.java b/src/com/engine/recruit/service/impl/InitRecruitDataServiceImpl.java index 43ca5c3..5152905 100644 --- a/src/com/engine/recruit/service/impl/InitRecruitDataServiceImpl.java +++ b/src/com/engine/recruit/service/impl/InitRecruitDataServiceImpl.java @@ -1,20 +1,25 @@ package com.engine.recruit.service.impl; +import cn.hutool.core.convert.Convert; +import com.alibaba.fastjson.JSON; import com.engine.core.impl.Service; import com.engine.recruit.conn.ApplicantCommonInfo; import com.engine.recruit.conn.RecruitDataMap; import com.engine.recruit.conn.RecruitRecordSet; +import com.engine.recruit.constant.ModeSearchCodeConstant; +import com.engine.recruit.constant.ModeTreeCodeConstant; +import com.engine.recruit.constant.RecruitConstant; import com.engine.recruit.entity.init.po.*; import com.engine.recruit.exception.CustomizeRunTimeException; import com.engine.recruit.service.InitRecruitDataService; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import weaver.formmode.recruit.modeexpand.process.StageDataInsert; +import weaver.formmode.service.CustomPageService; +import weaver.general.BaseBean; +import weaver.general.Util; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; import java.util.stream.Collectors; /** @@ -27,12 +32,11 @@ public class InitRecruitDataServiceImpl extends Service implements InitRecruitDa public Map checkInitStatus() { RecordSet rs = new RecordSet(); - // 创建视图 - //createView(rs); - rs.executeQuery("select id from uf_jcl_zplc"); if (rs.next()) { - throw new CustomizeRunTimeException("当前已存在招聘流程数据,无需重复初始化"); + updateRecruitData(); + } else { + initRecruitData(); } return null; } @@ -45,6 +49,11 @@ public class InitRecruitDataServiceImpl extends Service implements InitRecruitDa rs.executeUpdate("delete from uf_jcl_zpjdsz_dt1;"); rs.executeUpdate("delete from uf_jcl_zpjdsz_dt2;"); rs.executeUpdate("delete from uf_jcl_lcczan;"); + // 刷新页面菜单 + rs.executeQuery("select * from hp_nonstandard_function_info where num='163' and name ='招聘管理'"); + if (rs.next()) { + refreshMenuUrl(); + } // 插入操作按钮数据, int buttonModeId = ApplicantCommonInfo.getModeIdByTableName("uf_jcl_lcczan"); @@ -64,45 +73,131 @@ public class InitRecruitDataServiceImpl extends Service implements InitRecruitDa return null; } + @Override + public Map updateRecruitData() { + RecordSet rs = new RecordSet(); + rs.executeQuery("select * from hp_nonstandard_function_info where num='163' and name ='招聘管理'"); + if (rs.next()) { + // 更新菜单地址 + refreshMenuUrl(); + } + return null; + } + /** - * 创建视图:v_zpmc - * - * @param rs + * 更新招聘管理相关菜单地址 */ - private void createView(RecordSet rs) { - String dbType = rs.getDBType(); - String sql = ""; - switch (dbType) { - case "oracle": - sql = "CREATE OR REPLACE VIEW v_zpmc AS SELECT a.id, a.zpzwmc, b.cnt, a.zpzwmc || '(' || b.cnt || ')' AS fname FROM uf_jcl_zp_zpzw a INNER JOIN ( SELECT ypzw, COUNT(*) AS cnt FROM uf_jcl_yppc WHERE zt = 1 GROUP BY ypzw ) b ON a.id = b.ypzw"; - break; - case "sqlserver": - sql = "CREATE VIEW v_zpmc AS SELECT a.id, a.zpzwmc, b.cnt, a.zpzwmc + '(' + CAST(b.cnt AS VARCHAR) + ')' AS fname FROM uf_jcl_zp_zpzw a INNER JOIN ( SELECT ypzw, COUNT(*) AS cnt FROM uf_jcl_yppc WHERE zt = 1 GROUP BY ypzw ) b ON a.id = b.ypzw"; - break; - case "mysql": - sql = "create or replace view v_zpmc as select a.id, a.zpzwmc, b.cnt, CONCAT(a.zpzwmc, '(', b.cnt, ')') as fname from uf_jcl_zp_zpzw a inner join ( select ypzw, count(*) cnt from uf_jcl_yppc where zt = 1 group by ypzw) b on a.id = b.ypzw"; - break; - case "postgresql": - sql = "create or replace view v_zpmc as select a.id, a.zpzwmc, b.cnt, CONCAT(a.zpzwmc, '(', b.cnt, ')') as fname from uf_jcl_zp_zpzw a inner join ( select ypzw, count(*) cnt from uf_jcl_yppc where zt = 1 group by ypzw) b on a.id = b.ypzw"; - break; - default: - break; - } - if (StringUtils.isBlank(sql)) { - throw new CustomizeRunTimeException("暂未支持当前数据库,DB类型[" + dbType + "]暂不支持);"); - } + private void refreshMenuUrl() { - // 执行SQL语句,创建视图 - if ("sqlserver".equals(dbType)) { - rs.executeQuery("SELECT 1 FROM sys.views WHERE name = 'v_zpmc'"); - if (rs.next()) { - // SqlServer,如果视图存在,先删除再创建 - rs.execute("drop view v_zpmc"); + List menuSqlList = new ArrayList<>(); + // 招聘需求 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.RECRUITMENT_DEMAND_MANAGEMENT) + "' where id = " + 100189); + // 招聘职位 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.RECRUITMENT_POSITIONS) + "' where id = " + 100190); + // 应聘者 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.APPLICANTS) + "' where id = " + 100192); + // 部门筛选 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.SCREENING_FEEDBACK) + "' where id = " + 100193); + // 笔试 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.WRITTEN_RESULTS) + "' where id = " + 100194); + // 面试 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.INTERVIEW) + "' where id = " + 100195); + // 薪酬谈判 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.SALARY_NEGOTIATION) + "' where id = " + 100196); + // 背调 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.BACK_TONE) + "' where id = " + 100197); + // offer + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.OFFER) + "' where id = " + 100198); + //// 人才库 + //menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.TALENT_POOL) + "' where id = " + 100200); + // 简历库 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.RESUME_LIBRARY) + "' where id = " + 100201); + // 工作地点 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.WORK_LOCATION) + "' where id = " + 100203); + // 字段类型名称 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.DATA_DICTIONARY_TYPE_NAME) + "' where id = " + 100205); + // 邮件通知模板 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.EMAIL_NOTIFICATION_TEMPLATE) + "' where id = " + 100206); + // 千里聆邮箱配置 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.QLL_EMAIL_CONFIG) + "' where id = " + 100207); + // 招聘需求 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.RECRUITMENT_DEMAND_MANAGEMENT) + "' where id = " + 100209); + // 我的筛选 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.SCREENING_FEEDBACK) + "' where id = " + 100210); + // 我的面试 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.PARTICIPATE_IN_INTERVIEWS) + "' where id = " + 100211); + // 招聘流程 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.RECRUITMENT_PROCESS_LIST) + "' where id = " + 100213); + // 招聘阶段 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.RECRUITMENT_STAGE_LIST) + "' where id = " + 100214); + // 操作按钮 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.LIST_OF_OPERATION_BUTTONS) + "' where id = " + 100215); + //// 入职管理 + //menuSqlList.add("update LeftMenuInfo set fullrouteurl= '/spa/cube/index.html#/main/cube/viewCustomPage?id=" + getCustomPageId("入职管理", ModeSearchCodeConstant.ENTRY_MANAGEMENT) + "&noTitleShow=1' where id = " + 100199); + // 数据字典 + menuSqlList.add("update LeftMenuInfo set fullrouteurl= '/spa/cube/index.html#/main/cube/tree?id=" + getCustomTreeId(ModeTreeCodeConstant.DATA_DICTIONARY_TREE) + "&noTitleShow=1' where id = " + 100204); + + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/search?customid=" + getCustomSearchId(ModeSearchCodeConstant.RESUME_SUBSCRIPTION) + "' where id = " + 100218); + + + // 处理自定义页面 + CustomPageService customPageService = new CustomPageService(); + customPageService.setUser(user); + int appId = getAppIdByName(RecruitConstant.MODE_APP_NAME); + List> customPageByModeIds = customPageService.getCustomPageByModeIds(appId); + new BaseBean().writeLog("MODE_APP_NAME:==" + RecruitConstant.MODE_APP_NAME); + new BaseBean().writeLog("appId:==" + appId); + new BaseBean().writeLog("customPageByModeIds:==" + JSON.toJSONString(customPageByModeIds)); + String rzglId = ""; + String rckId = ""; + for (Map map : customPageByModeIds) { + String name = Util.formatMultiLang(Util.null2String(map.get("customname")), "7"); + String id = Util.null2String(map.get("id")); + // 入职管理 + if ("入职管理".equals(name)) { + rzglId = id; + } else if ("人才库".equals(name)) { + rckId = id; } } - rs.execute(sql); + if (StringUtils.isBlank(rzglId)) { + throw new CustomizeRunTimeException("招聘管理菜单初始化失败,请检查建模引擎自定义页面[入职管理]是否存在"); + } + if (StringUtils.isBlank(rckId)) { + throw new CustomizeRunTimeException("招聘管理菜单初始化失败,请检查建模引擎自定义页面[人才库]是否存在"); + } + // 入职管理 + menuSqlList.add("update LeftMenuInfo set fullrouteurl= '/spa/cube/index.html#/main/cube/viewCustomPage?id=" + rzglId + "&noTitleShow=1' where id = " + 100199); + // 人才库 + menuSqlList.add("update LeftMenuInfo set fullrouteurl = '/spa/cube/index.html#/main/cube/viewCustomPage?id=" + rckId + "&noTitleShow=1' where id = " + 100200); + + + RecordSet rs = new RecordSet(); + for (String sql : menuSqlList) { + new BaseBean().writeLog("招聘目录初始化SQL:==" + sql); + rs.executeUpdate(sql); + } + } + + /** + * 获取名称获取APPID + * + * @param appName + * @return + */ + private int getAppIdByName(String appName) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select ID from modeTreeField where treefieldname like '%" + appName + "%'"); + String id = ""; + if (rs.next()) { + id = rs.getString("id"); + } + if (StringUtils.isNotBlank(id)) { + return Convert.toInt(id); + } + throw new CustomizeRunTimeException("招聘管理菜单初始化失败,请检查该名称建模应用是否存在[" + appName + "]"); } /** diff --git a/src/com/engine/recruit/wrapper/InitRecruitDataWrapper.java b/src/com/engine/recruit/wrapper/InitRecruitDataWrapper.java index 89ede7a..d5c1f8c 100644 --- a/src/com/engine/recruit/wrapper/InitRecruitDataWrapper.java +++ b/src/com/engine/recruit/wrapper/InitRecruitDataWrapper.java @@ -25,4 +25,8 @@ public class InitRecruitDataWrapper extends Service { public Map initRecruitData() { return getInitRecruitDataService(user).initRecruitData(); } + + public Map updateRecruitData() { + return getInitRecruitDataService(user).updateRecruitData(); + } }