培训需求新增

This commit is contained in:
dxfeng 2025-05-28 11:24:03 +08:00
parent 6ffa03bb2a
commit 9eec49a4ed
3 changed files with 123 additions and 23 deletions

View File

@ -0,0 +1,26 @@
const pxxgpgfs_id = WfForm.convertFieldNameToId("pxxgpgfs");
const drlzy_id = WfForm.convertFieldNameToId("drlzy");
var cjry_id = WfForm.convertFieldNameToId("cjry", "detail_2");
WfForm.bindFieldChangeEvent(pxxgpgfs_id, function (obj, id, value) {
console.log('value', value)
WfForm.delDetailRow("detail_2", "all");
if (value == '' || value == 0) {
return;
} else {
var drlzy_value = WfForm.getFieldValue(drlzy_id);
var drlzy_obj = mobx.toJS(wfform.getFieldValueObj(drlzy_id).specialobj);
const array = drlzy_value.split(",");
array.map((item, index) => {
var addObj = {};
addObj[cjry_id] = {
value: item,
specialobj: [drlzy_obj[index]]
};
console.log(addObj)
WfForm.addDetailRow("detail_2", addObj);
})
}
});

View File

@ -1,17 +1,18 @@
package weaver.interfaces.hzzx.action; package weaver.interfaces.hzzx.action;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import weaver.common.DateUtil; import weaver.common.DateUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.hrm.resource.ResourceComInfo; import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.workflow.action.Action; import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.MainTableInfo; import weaver.soa.workflow.request.*;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import weaver.workflow.webservices.*; import weaver.workflow.webservices.*;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -24,6 +25,7 @@ public class TrainingManageCreateFlowAction implements Action {
* 培训效果评估表 流程ID * 培训效果评估表 流程ID
*/ */
public static final String FLOW_ID = "65"; public static final String FLOW_ID = "65";
// TODO 测试用 public static final String FLOW_ID = "19";
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
@ -46,6 +48,18 @@ public class TrainingManageCreateFlowAction implements Action {
// 不是培训效果评估表,不做处理 // 不是培训效果评估表,不做处理
return SUCCESS; return SUCCESS;
} }
List<Map<String,String>> detailList = new ArrayList<>();
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
DetailTable detailTable = detailTableInfo.getDetailTable(2);
Row[] rows = detailTable.getRow();
for (Row row : rows) {
Map<String,String> detailData = new HashMap<>();
Cell[] cells = row.getCell();
for (Cell cell : cells) {
detailData.put(cell.getName(),cell.getValue());
}
detailList.add(detailData);
}
ResourceComInfo resourceComInfo = new ResourceComInfo(); ResourceComInfo resourceComInfo = new ResourceComInfo();
@ -57,7 +71,7 @@ public class TrainingManageCreateFlowAction implements Action {
String workCode = resourceComInfo.getWorkcode(userId); String workCode = resourceComInfo.getWorkcode(userId);
String departmentId = resourceComInfo.getDepartmentID(userId); String departmentId = resourceComInfo.getDepartmentID(userId);
rs.writeLog("lastName==" + lastName + "workCode==" + workCode + "departmentId==" + departmentId); rs.writeLog("lastName==" + lastName + "workCode==" + workCode + "departmentId==" + departmentId);
createWorkFLow(requestId, lastName, userId, workCode, departmentId, pxmc); createWorkFLow(requestId, lastName, userId, workCode, departmentId, pxmc,detailList);
} }
} }
@ -79,14 +93,48 @@ public class TrainingManageCreateFlowAction implements Action {
* @param departmentId * @param departmentId
* @param pxmc * @param pxmc
*/ */
private void createWorkFLow(String requestId, 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,List<Map<String,String>> detailList) throws Exception {
// 根据培训名称获取培新信息
String pxsj = "";
String jssjyc = "";
rs.executeQuery("select * from uf_pxsssq where id = ?", pxmc);
if (rs.next()) {
pxsj = rs.getString("pxsj");
jssjyc = rs.getString("jssjyc");
}
ResourceComInfo resourceComInfo = new ResourceComInfo();
List<String> teachers = new ArrayList<>();
//rs.executeQuery("select * from uf_pxsssq_dt1 where mainid = ?", pxsj);
//while (rs.next()) {
// String sklsnb = rs.getString("sklsnb");
// if (StringUtils.isNotBlank(sklsnb)) {
// String lastname = resourceComInfo.getLastname(sklsnb);
// if (StringUtils.isNotBlank(lastname)) {
// teachers.add(lastname);
// }
// }
// String sklswb = rs.getString("sklswb");
// if (StringUtils.isNotBlank(sklswb)) {
// teachers.add(sklswb);
// }
//}
teachers.add("aaa");
teachers.add("bbb");
// 构建主表流程数据 // 构建主表流程数据
WorkflowRequestTableField[] workflowRequestTableField = { WorkflowRequestTableField[] workflowRequestTableField = {
createWorkflowRequestTableField("xm", userId), createWorkflowRequestTableField("xm", userId),
createWorkflowRequestTableField("gh", workCode), createWorkflowRequestTableField("gh", workCode),
createWorkflowRequestTableField("bm", departmentId), createWorkflowRequestTableField("bm", departmentId),
createWorkflowRequestTableField("lc", requestId) createWorkflowRequestTableField("lc", requestId),
// 新加字段
createWorkflowRequestTableField("pxmc", pxmc),
createWorkflowRequestTableField("pxsj", pxsj),
createWorkflowRequestTableField("pxjsrq", jssjyc),
createWorkflowRequestTableField("pxs", StringUtils.join(teachers,",")),
}; };
WorkflowMainTableInfo workflowMainTableInfo = new WorkflowMainTableInfo(); WorkflowMainTableInfo workflowMainTableInfo = new WorkflowMainTableInfo();
WorkflowRequestTableRecord[] workflowRequestTableRecord = new WorkflowRequestTableRecord[1]; WorkflowRequestTableRecord[] workflowRequestTableRecord = new WorkflowRequestTableRecord[1];
workflowMainTableInfo.setRequestRecords(workflowRequestTableRecord); workflowMainTableInfo.setRequestRecords(workflowRequestTableRecord);
@ -97,15 +145,20 @@ public class TrainingManageCreateFlowAction implements Action {
WorkflowDetailTableInfo[] workflowDetailTableInfoArray = new WorkflowDetailTableInfo[3]; WorkflowDetailTableInfo[] workflowDetailTableInfoArray = new WorkflowDetailTableInfo[3];
workflowDetailTableInfoArray[0] = new WorkflowDetailTableInfo(); workflowDetailTableInfoArray[0] = new WorkflowDetailTableInfo();
// 明细表一 if (CollectionUtils.isNotEmpty(detailList)) {
WorkflowRequestTableRecord[] workflowRequestTableRecordDt = new WorkflowRequestTableRecord[1]; // 明细表一
WorkflowRequestTableRecord[] workflowRequestTableRecordDt = new WorkflowRequestTableRecord[detailList.size()];
WorkflowRequestTableField[] workflowRequestTableFieldDt = { for (int i = 0; i < detailList.size(); i++) {
createWorkflowRequestTableField("pgxmpxkc", pxmc) Map<String, String> detailMap = detailList.get(i);
}; WorkflowRequestTableField[] workflowRequestTableFieldDt = {
workflowRequestTableRecordDt[0] = new WorkflowRequestTableRecord(); // 插入课程名称
workflowRequestTableRecordDt[0].setWorkflowRequestTableFields(workflowRequestTableFieldDt); createWorkflowRequestTableField("kcmc", detailMap.get("kcmc"))
workflowDetailTableInfoArray[0].setWorkflowRequestTableRecords(workflowRequestTableRecordDt); };
workflowRequestTableRecordDt[i] = new WorkflowRequestTableRecord();
workflowRequestTableRecordDt[i].setWorkflowRequestTableFields(workflowRequestTableFieldDt);
}
workflowDetailTableInfoArray[0].setWorkflowRequestTableRecords(workflowRequestTableRecordDt);
}
createWorkflowRequest(FLOW_ID, "培训效果评估表-" + lastName + "-" + DateUtil.getCurrentDate(), userId, "1", workflowMainTableInfo, workflowDetailTableInfoArray); createWorkflowRequest(FLOW_ID, "培训效果评估表-" + lastName + "-" + DateUtil.getCurrentDate(), userId, "1", workflowMainTableInfo, workflowDetailTableInfoArray);

View File

@ -44,11 +44,35 @@ public class TrainingManageEndAction implements Action {
detailDataList.add(detailDataMap); detailDataList.add(detailDataMap);
} }
List<String> userIdList = new ArrayList<>();
DetailTable detailTable2 = detailTableInfo.getDetailTable(1);
Row[] rows2 = detailTable2.getRow();
for (Row row : rows2) {
Map<String, String> detailDataMap = new HashMap<>();
Cell[] cells = row.getCell();
for (Cell cell : cells) {
detailDataMap.put(cell.getName(), cell.getValue());
}
String sftg = detailDataMap.get("sftg");
String cjry = detailDataMap.get("cjry");
rs.writeLog("sftg===" + sftg);
rs.writeLog("cjry===" + cjry);
if ("0".equals(sftg) && StringUtils.isNotBlank(cjry)) {
userIdList.add(cjry);
}
}
// //
String pxfhgdyq = mainDataMap.get("pxfhgdyq"); String pxfhgdyq = mainDataMap.get("pxfhgdyq");
String pxxgpgfs = mainDataMap.get("pxxgpgfs"); String pxxgpgfs = mainDataMap.get("pxxgpgfs");
String pxmc = mainDataMap.get("pxmc"); String pxmc = mainDataMap.get("pxmc");
rs.writeLog("pxfhgdyq==" + pxfhgdyq + "pxxgpgfs==" + pxxgpgfs); rs.writeLog("pxfhgdyq==" + pxfhgdyq + "pxxgpgfs==" + pxxgpgfs);
// 培训效果评估 流程归档修改培训计划台账 该培训名称所关联的主题 是否组织完成为是
String sql = "update uf_bmjhbzsq set sfzzwc = 0 where id in =(select xzk from uf_pxsssq where id = ?)";
rs.executeUpdate(sql,pxmc);
if (!"0".equals(pxfhgdyq) || StringUtils.isBlank(pxxgpgfs)) { if (!"0".equals(pxfhgdyq) || StringUtils.isBlank(pxxgpgfs)) {
return SUCCESS; return SUCCESS;
} }
@ -75,8 +99,9 @@ public class TrainingManageEndAction implements Action {
break; break;
case "1": case "1":
case "2": case "2":
case "3":
//考试考核 //考试考核
exam(String.valueOf(creatorId), mainDataMap, trainInfoMap, pxxgpgfs); exam(userIdList, String.valueOf(creatorId), mainDataMap, trainInfoMap, pxxgpgfs);
default: default:
break; break;
} }
@ -151,18 +176,14 @@ public class TrainingManageEndAction implements Action {
} }
} }
private void exam(String creatorId, Map<String, String> mainDataMap, Map<String, String> trainInfoMap, String type) throws Exception { private void exam(List<String> userIdList, 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)); rs.writeLog("userIdList==" + JSON.toJSONString(userIdList));
String sql = "update uf_grqdtz set kssftg = 0 where xm = ? and pxmc = ? "; String sql = "update uf_grqdtz set kssftg = 0 where xm = ? and pxmc = ? ";
if ("2".equals(type)) { if ("2".equals(type)) {
sql = "update uf_grqdtz set khsftg = 0 where xm = ? and pxmc = ? "; sql = "update uf_grqdtz set khsftg = 0 where xm = ? and pxmc = ? ";
} else if ("3".equals(type)) {
sql = "update uf_grqdtz set qt = 0 where xm = ? and pxmc = ? ";
} }
String insertTableName = "uf_pxxx"; String insertTableName = "uf_pxxx";