培训、招聘模块 问题处理

This commit is contained in:
dxfeng 2025-03-28 09:19:43 +08:00
parent fd691a4eef
commit f83d7d4bb6
6 changed files with 300 additions and 11 deletions

View File

@ -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 = '接口请求异常,请联系管理员处理';
}
});
}

View File

@ -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;

View File

@ -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<String, Object> getRecruitDemandList(Map<String, Object> 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<String> 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<RecruitingPlan> 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<String, Object> resultMap = new HashMap<>();
resultMap.put("details", resultList);
resultMap.put("year", year);
return resultMap;
}
}

View File

@ -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];

View File

@ -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<String, String> mainDataMap = new HashMap<>();
for (Property property : properties) {
mainDataMap.put(property.getName(), property.getValue());
}
List<Map<String, String>> detailDataList = new ArrayList<>();
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
DetailTable detailTable = detailTableInfo.getDetailTable(0);
Row[] rows = detailTable.getRow();
for (Row row : rows) {
Map<String, String> 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<String, String> 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<String, String> 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<String, String> 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<String, String> mainDataMap, Map<String, String> 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<String> 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<String, String> 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<String, String> 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<String, String> mainDataMap, Map<String, String> trainInfoMap, String type) throws Exception {
String drlzy = mainDataMap.get("drlzy");
List<String> 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<String, String> 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<String, String> 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<String, String> 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);
}
}

View File

@ -33,7 +33,7 @@ public class RecordUserCountJob extends BaseCronJob {
// 遍历recruitingPlanList插入明细表数据
for (RecruitingPlan plan : recruitingPlanList) {
insertMainData(plan, DateUtil.getCurrentDate());
insertMainData(plan, DateUtil.getYear());
}