From f83d7d4bb6280aa640fdd5839dc44d3beb120e65 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Fri, 28 Mar 2025 09:19:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E3=80=81=E6=8B=9B=E8=81=98?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=20=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/ecode/五院杭州中心/招聘模块/代码块.js | 47 ++++ .../engine/hzzx/entity/RecruitingPlan.java | 4 +- .../impl/RecruitDemandServiceImpl.java | 13 +- .../TrainingManageCreateFlowAction.java | 12 +- .../hzzx/action/TrainingManageEndAction.java | 233 ++++++++++++++++++ .../hzzx/cronjob/RecordUserCountJob.java | 2 +- 6 files changed, 300 insertions(+), 11 deletions(-) create mode 100644 js/ecode/五院杭州中心/招聘模块/代码块.js create mode 100644 src/weaver/interfaces/hzzx/action/TrainingManageEndAction.java diff --git a/js/ecode/五院杭州中心/招聘模块/代码块.js b/js/ecode/五院杭州中心/招聘模块/代码块.js new file mode 100644 index 0000000..1f4e072 --- /dev/null +++ b/js/ecode/五院杭州中心/招聘模块/代码块.js @@ -0,0 +1,47 @@ +const bm_id = WfForm.convertFieldNameToId("bm", "detail_1"); +const nd_id = WfForm.convertFieldNameToId("nd", "detail_1"); +const jhzprs_id = WfForm.convertFieldNameToId("jhzprs", "detail_1"); +const nmzgrs_id = WfForm.convertFieldNameToId("nmzgrs", "detail_1"); +const nmyjddzrs_id = WfForm.convertFieldNameToId("nmyjddzrs", "detail_1"); +const count = WfForm.getDetailRowCount("detail_1"); +if (count == 0) { + + $.ajax({ + url: `/api/jcl/recruit/demand/getRecruitDemandList`, + type: 'GET', + dataType: 'json', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + async: false, + success: function (res) { + if (res.api_status && res.data && res.data.details) { + let year = res.data.year; + let detailList = res.data.details; + for (let i = 0; i < detailList.length; i++) { + let detail = detailList[i]; + var addObj = {}; + addObj[bm_id] = { + value: detail.departmentId, + specialobj: [ + {id: detail.departmentId, name: detail.departmentName} + ] + }; + addObj[nd_id] = {value: year}; + addObj[jhzprs_id] = {value: detail.plannedNumber}; + addObj[nmzgrs_id] = {value: detail.onJobNumber}; + addObj[nmyjddzrs_id] = {value: detail.totalNumber}; + WfForm.addDetailRow("detail_1", addObj); + } + + } else { + console.log("接口请求异常,请联系管理员处理,res", res); + msg = res.errormsg; + } + }, + error: function (error) { + console.log("接口请求异常,请联系管理员处理,error", error); + msg = '接口请求异常,请联系管理员处理'; + } + }); +} \ No newline at end of file diff --git a/src/com/engine/hzzx/entity/RecruitingPlan.java b/src/com/engine/hzzx/entity/RecruitingPlan.java index 897b748..bef1ba5 100644 --- a/src/com/engine/hzzx/entity/RecruitingPlan.java +++ b/src/com/engine/hzzx/entity/RecruitingPlan.java @@ -24,12 +24,14 @@ public class RecruitingPlan { this.onJobNumber = onJobNumber; } - public RecruitingPlan(Integer departmentId, Integer plannedNumber, Integer onJobNumber) { + public RecruitingPlan(String departmentName,Integer departmentId, Integer plannedNumber, Integer onJobNumber) { + this.departmentName = departmentName; this.departmentId = departmentId; this.plannedNumber = plannedNumber; this.onJobNumber = onJobNumber; } + private String departmentName; private Integer departmentId; private Integer plannedNumber; private Integer onJobNumber; diff --git a/src/com/engine/hzzx/service/impl/RecruitDemandServiceImpl.java b/src/com/engine/hzzx/service/impl/RecruitDemandServiceImpl.java index c4a818b..8d6ccff 100644 --- a/src/com/engine/hzzx/service/impl/RecruitDemandServiceImpl.java +++ b/src/com/engine/hzzx/service/impl/RecruitDemandServiceImpl.java @@ -6,6 +6,7 @@ import com.engine.hzzx.service.RecruitDemandService; import org.apache.commons.collections.CollectionUtils; import weaver.common.DateUtil; import weaver.conn.RecordSet; +import weaver.hrm.company.DepartmentComInfo; import java.util.ArrayList; import java.util.HashMap; @@ -21,8 +22,9 @@ public class RecruitDemandServiceImpl extends Service implements RecruitDemandSe @Override public Map getRecruitDemandList(Map params) { RecordSet rs = new RecordSet(); + String year = DateUtil.getYear(); // 查询当前年度提交的数据 - rs.executeQuery("select * from uf_zpxqhztz where sqrq '" + DateUtil.getYear() + "'"); + rs.executeQuery("select * from uf_zpxqhztz where sqrq like '%" + year + "%'"); List mainIds = new ArrayList<>(); while (rs.next()) { mainIds.add(rs.getString("id")); @@ -33,7 +35,7 @@ public class RecruitDemandServiceImpl extends Service implements RecruitDemandSe if (CollectionUtils.isNotEmpty(mainIds)) { rs.executeQuery("select * from uf_zpxqhztz_dt1 where mainid in (" + String.join(",", mainIds) + ")"); while (rs.next()) { - recruitingPlans.add(new RecruitingPlan(rs.getInt("zpbm"), rs.getInt("xqrs"), 0)); + recruitingPlans.add(new RecruitingPlan("", rs.getInt("zpbm"), rs.getInt("xqrs"), 0)); } } // 遍历recruitingPlans 汇总相同部门下的总招聘人数 @@ -56,19 +58,22 @@ public class RecruitDemandServiceImpl extends Service implements RecruitDemandSe } // 汇总部门数据 + DepartmentComInfo departmentComInfo = new DepartmentComInfo(); List resultList = new ArrayList<>(); departmentSum.forEach((department, requiredTotal) -> { // 查询当年年度统计的年末在岗人数 int onJobNumber = 0; - rs.executeQuery("select nmzgrs from uf_nmgbmzgrs where nd = '" + DateUtil.getYear() + "' and bm = " + department); + rs.executeQuery("select nmzgrs from uf_nmgbmzgrs where nd = '" + year + "' and bm = " + department); if (rs.next()) { onJobNumber = rs.getInt("nmzgrs"); } - resultList.add(new RecruitingPlan(department, onJobNumber, requiredTotal)); + String departmentname = departmentComInfo.getDepartmentname(String.valueOf(department)); + resultList.add(new RecruitingPlan(departmentname, department, onJobNumber, requiredTotal)); }); Map resultMap = new HashMap<>(); resultMap.put("details", resultList); + resultMap.put("year", year); return resultMap; } } diff --git a/src/weaver/interfaces/hzzx/action/TrainingManageCreateFlowAction.java b/src/weaver/interfaces/hzzx/action/TrainingManageCreateFlowAction.java index 0446ffe..6184532 100644 --- a/src/weaver/interfaces/hzzx/action/TrainingManageCreateFlowAction.java +++ b/src/weaver/interfaces/hzzx/action/TrainingManageCreateFlowAction.java @@ -23,7 +23,7 @@ public class TrainingManageCreateFlowAction implements Action { /** * 培训效果评估表 流程ID */ - private String FLOW_ID = "65"; + public static final String FLOW_ID = "65"; RecordSet rs = new RecordSet(); @@ -40,7 +40,8 @@ public class TrainingManageCreateFlowAction implements Action { String pxxgpgfs = mainDataMap.get("pxxgpgfs"); String drlzy = mainDataMap.get("drlzy"); String pxmc = mainDataMap.get("pxmc"); - rs.writeLog("pxxgpgfs==" + pxxgpgfs + ",drlzy==" + drlzy + ",pxmc==" + pxmc ); + String requestId = requestInfo.getRequestid(); + rs.writeLog("pxxgpgfs==" + pxxgpgfs + ",drlzy==" + drlzy + ",pxmc==" + pxmc); if (!"0".equals(pxxgpgfs)) { // 不是“培训效果评估表”,不做处理 return SUCCESS; @@ -56,7 +57,7 @@ public class TrainingManageCreateFlowAction implements Action { String workCode = resourceComInfo.getWorkcode(userId); String departmentId = resourceComInfo.getDepartmentID(userId); rs.writeLog("lastName==" + lastName + ",workCode==" + workCode + ",departmentId==" + departmentId); - createWorkFLow(lastName, userId, workCode, departmentId, pxmc); + createWorkFLow(requestId, lastName, userId, workCode, departmentId, pxmc); } } @@ -78,12 +79,13 @@ public class TrainingManageCreateFlowAction implements Action { * @param departmentId * @param pxmc */ - private void createWorkFLow(String lastName, String userId, String workCode, String departmentId, String pxmc) { + private void createWorkFLow(String requestId, String lastName, String userId, String workCode, String departmentId, String pxmc) { // 构建主表流程数据 WorkflowRequestTableField[] workflowRequestTableField = { createWorkflowRequestTableField("xm", userId), createWorkflowRequestTableField("gh", workCode), - createWorkflowRequestTableField("bm", departmentId) + createWorkflowRequestTableField("bm", departmentId), + createWorkflowRequestTableField("lc", requestId) }; WorkflowMainTableInfo workflowMainTableInfo = new WorkflowMainTableInfo(); WorkflowRequestTableRecord[] workflowRequestTableRecord = new WorkflowRequestTableRecord[1]; diff --git a/src/weaver/interfaces/hzzx/action/TrainingManageEndAction.java b/src/weaver/interfaces/hzzx/action/TrainingManageEndAction.java new file mode 100644 index 0000000..b134937 --- /dev/null +++ b/src/weaver/interfaces/hzzx/action/TrainingManageEndAction.java @@ -0,0 +1,233 @@ +package weaver.interfaces.hzzx.action; + +import com.alibaba.fastjson.JSON; +import com.engine.hzzx.conn.DataUtil; +import org.apache.commons.lang.StringUtils; +import weaver.conn.RecordSet; +import weaver.hrm.resource.ResourceComInfo; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.*; + +import java.util.*; + +/** + * @author:dxfeng + * @createTime: 2025/03/27 + * @version: 1.0 + */ +public class TrainingManageEndAction implements Action { + RecordSet rs = new RecordSet(); + + @Override + public String execute(RequestInfo requestInfo) { + try { + String trainingEffectFlowId = TrainingManageCreateFlowAction.FLOW_ID; + String trainingEffectTableName = DataUtil.getTableNameById(trainingEffectFlowId); + String requestId = requestInfo.getRequestid(); + int creatorId = requestInfo.getRequestManager().getCreater(); + MainTableInfo mainTableInfo = requestInfo.getMainTableInfo(); + Property[] properties = mainTableInfo.getProperty(); + Map mainDataMap = new HashMap<>(); + for (Property property : properties) { + mainDataMap.put(property.getName(), property.getValue()); + } + List> detailDataList = new ArrayList<>(); + DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo(); + DetailTable detailTable = detailTableInfo.getDetailTable(0); + Row[] rows = detailTable.getRow(); + for (Row row : rows) { + Map detailDataMap = new HashMap<>(); + Cell[] cells = row.getCell(); + for (Cell cell : cells) { + detailDataMap.put(cell.getName(), cell.getValue()); + } + detailDataList.add(detailDataMap); + } + + // + String pxfhgdyq = mainDataMap.get("pxfhgdyq"); + String pxxgpgfs = mainDataMap.get("pxxgpgfs"); + String pxmc = mainDataMap.get("pxmc"); + rs.writeLog("pxfhgdyq==" + pxfhgdyq + ",pxxgpgfs==" + pxxgpgfs); + if (!"0".equals(pxfhgdyq) || StringUtils.isBlank(pxxgpgfs)) { + return SUCCESS; + } + //查询培训基本信息 + Map trainInfoMap = new HashMap<>(); + rs.executeQuery("select * from uf_pxsssq where id = ? ", pxmc); + if (rs.next()) { + trainInfoMap.put("pxmc", rs.getString("pxmc")); + trainInfoMap.put("xzk", rs.getString("xzk")); + trainInfoMap.put("pxsj", rs.getString("pxsj")); + trainInfoMap.put("jssjyc", rs.getString("jssjyc")); + trainInfoMap.put("pxdd", rs.getString("pxdd")); + trainInfoMap.put("szbm", rs.getString("szbm")); + trainInfoMap.put("pxdx", rs.getString("pxdx")); + trainInfoMap.put("pxrs", rs.getString("pxrs")); + trainInfoMap.put("xs", rs.getString("xs")); + trainInfoMap.put("jf", rs.getString("jf")); + } + + switch (pxxgpgfs) { + case "0": + // 培训效果评估表 + assessment(String.valueOf(creatorId), requestId, trainingEffectTableName, mainDataMap, trainInfoMap); + break; + case "1": + case "2": + //考试、考核 + exam(String.valueOf(creatorId), mainDataMap, trainInfoMap, pxxgpgfs); + default: + break; + } + + + Map trainerMap = new HashMap<>(); + trainerMap.put("pxmc", pxmc); + trainerMap.put("pxqssj", mainDataMap.get("sjpxjhkssj")); + trainerMap.put("pxjssj", mainDataMap.get("sjpxjhjssj")); + trainerMap.put("pxzt", trainInfoMap.get("xzk")); + trainerMap.put("pxzzdw", mainDataMap.get("pxzzbm")); + + // 写入培训授课信息 + for (Map detailData : detailDataList) { + String pxsnb = detailData.get("pxsnb"); + rs.writeLog("pxsnb==" + pxsnb); + if (StringUtils.isNotBlank(pxsnb)) { + insertTrainer(pxsnb, String.valueOf(creatorId), pxmc, new HashMap<>(trainerMap)); + } + } + + return SUCCESS; + } catch (Exception e) { + rs.writeLog(e); + requestInfo.getRequestManager().setMessagecontent(e.getMessage()); + return FAILURE_AND_CONTINUE; + } + } + + /** + * 培训效果评估表 + * + * @param mainDataMap + */ + private void assessment(String creatorId, String requestId, String trainingEffectTableName, Map mainDataMap, Map trainInfoMap) throws Exception { + // 查询流程归档的人 + rs.executeQuery("select a.xm from " + trainingEffectTableName + " a inner join workflow_requestbase b on a.requestid =b.requestid and b.currentnodetype =3 where a.lc= ? ", requestId); + List userIdList = new ArrayList<>(); + while (rs.next()) { + userIdList.add(rs.getString("xm")); + } + rs.writeLog("userIdList==" + JSON.toJSONString(userIdList)); + String insertTableName = "uf_pxxx"; + + ResourceComInfo resourceComInfo = new ResourceComInfo(); + Map trainEmployeesMap = new HashMap<>(); + trainEmployeesMap.put("pxmc", mainDataMap.get("pxmc")); + trainEmployeesMap.put("pxqssj", mainDataMap.get("sjpxjhkssj")); + trainEmployeesMap.put("pxjssj", mainDataMap.get("sjpxjhjssj")); + trainEmployeesMap.put("pxzt", trainInfoMap.get("xzk")); + trainEmployeesMap.put("pxxs", trainInfoMap.get("xs")); + trainEmployeesMap.put("pxjf", trainInfoMap.get("jf")); + trainEmployeesMap.put("pxzzdw", mainDataMap.get("pxzzbm")); + + int formModeId = DataUtil.getModeIdByTableName(insertTableName); + trainEmployeesMap.put("formmodeid", String.valueOf(formModeId)); + DataUtil.buildModeInsertFields(trainEmployeesMap, creatorId); + for (String userId : userIdList) { + Map insertMap = new HashMap<>(trainEmployeesMap); + insertMap.put("xm", userId); + insertMap.put("gh", resourceComInfo.getWorkcode(userId)); + + // 插入数据 + String uuid = UUID.randomUUID().toString(); + insertMap.put("modeuuid", uuid); + rs.writeLog("insertMap==" + JSON.toJSONString(insertMap)); + DataUtil.insertData(insertMap, insertTableName); + DataUtil.refreshRight(uuid, insertTableName, formModeId, creatorId); + + // 更新个人签到台账 + rs.executeUpdate("update uf_grqdtz set pxxgpgbsftj = 0 where xm = ? and pxmc = ? ", userId, mainDataMap.get("pxmc")); + } + } + + private void exam(String creatorId, Map mainDataMap, Map trainInfoMap, String type) throws Exception { + String drlzy = mainDataMap.get("drlzy"); + List userIdList = new ArrayList<>(); + if (StringUtils.isNotBlank(drlzy)) { + String[] userIds = drlzy.split(","); + userIdList.addAll(Arrays.asList(userIds)); + } + rs.writeLog("userIdList==" + JSON.toJSONString(userIdList)); + String sql = "update uf_grqdtz set kssftg = 0 where xm = ? and pxmc = ? "; + if ("2".equals(type)) { + sql = "update uf_grqdtz set khsftg = 0 where xm = ? and pxmc = ? "; + + } + String insertTableName = "uf_pxxx"; + + ResourceComInfo resourceComInfo = new ResourceComInfo(); + Map trainEmployeesMap = new HashMap<>(); + trainEmployeesMap.put("pxmc", mainDataMap.get("pxmc")); + trainEmployeesMap.put("pxqssj", mainDataMap.get("sjpxjhkssj")); + trainEmployeesMap.put("pxjssj", mainDataMap.get("sjpxjhjssj")); + trainEmployeesMap.put("pxzt", trainInfoMap.get("xzk")); + trainEmployeesMap.put("pxxs", trainInfoMap.get("xs")); + trainEmployeesMap.put("pxjf", trainInfoMap.get("jf")); + trainEmployeesMap.put("pxzzdw", mainDataMap.get("pxzzbm")); + + int formModeId = DataUtil.getModeIdByTableName(insertTableName); + trainEmployeesMap.put("formmodeid", String.valueOf(formModeId)); + DataUtil.buildModeInsertFields(trainEmployeesMap, creatorId); + for (String userId : userIdList) { + Map insertMap = new HashMap<>(trainEmployeesMap); + insertMap.put("xm", userId); + insertMap.put("gh", resourceComInfo.getWorkcode(userId)); + + // 插入数据 + String uuid = UUID.randomUUID().toString(); + insertMap.put("modeuuid", uuid); + rs.writeLog("insertMap==" + JSON.toJSONString(insertMap)); + DataUtil.insertData(insertMap, insertTableName); + DataUtil.refreshRight(uuid, insertTableName, formModeId, creatorId); + + // 更新个人签到台账 + rs.executeUpdate(sql, userId, mainDataMap.get("pxmc")); + } + } + + /** + * 插入培训授课信息 + * + * @param trainer + * @param creatorId + * @param pxmc + * @param trainerMap + * @throws Exception + */ + private void insertTrainer(String trainer, String creatorId, String pxmc, Map trainerMap) throws Exception { + ResourceComInfo resourceComInfo = new ResourceComInfo(); + String workCode = resourceComInfo.getWorkcode(trainer); + trainerMap.put("gh", workCode); + trainerMap.put("xm", trainer); + // 查询导师数据 + rs.executeQuery("select * from uf_pxsssq_dt1 where sklsnb = ? and mainid = ?", trainer, pxmc); + if (rs.next()) { + String jf = rs.getString("jf"); + String xs = rs.getString("xs"); + trainerMap.put("pxskxs", xs); + trainerMap.put("pxskjf", jf); + } + + String insertTableName = "uf_pxskxx"; + int formModeId = DataUtil.getModeIdByTableName(insertTableName); + trainerMap.put("formmodeid", String.valueOf(formModeId)); + DataUtil.buildModeInsertFields(trainerMap, creatorId); + // 插入数据 + String uuid = UUID.randomUUID().toString(); + trainerMap.put("modeuuid", uuid); + rs.writeLog("trainerMap==" + JSON.toJSONString(trainerMap)); + DataUtil.insertData(trainerMap, insertTableName); + DataUtil.refreshRight(uuid, insertTableName, formModeId, creatorId); + } +} diff --git a/src/weaver/interfaces/hzzx/cronjob/RecordUserCountJob.java b/src/weaver/interfaces/hzzx/cronjob/RecordUserCountJob.java index 0dbca69..ec2b725 100644 --- a/src/weaver/interfaces/hzzx/cronjob/RecordUserCountJob.java +++ b/src/weaver/interfaces/hzzx/cronjob/RecordUserCountJob.java @@ -33,7 +33,7 @@ public class RecordUserCountJob extends BaseCronJob { // 遍历recruitingPlanList,插入明细表数据 for (RecruitingPlan plan : recruitingPlanList) { - insertMainData(plan, DateUtil.getCurrentDate()); + insertMainData(plan, DateUtil.getYear()); }