培训需求新增
This commit is contained in:
parent
6ffa03bb2a
commit
9eec49a4ed
|
|
@ -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);
|
||||
})
|
||||
}
|
||||
});
|
||||
|
|
@ -1,17 +1,18 @@
|
|||
package weaver.interfaces.hzzx.action;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.MainTableInfo;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import weaver.soa.workflow.request.*;
|
||||
import weaver.workflow.webservices.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -24,6 +25,7 @@ public class TrainingManageCreateFlowAction implements Action {
|
|||
* 培训效果评估表 流程ID
|
||||
*/
|
||||
public static final String FLOW_ID = "65";
|
||||
// TODO 测试用 public static final String FLOW_ID = "19";
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
|
|
@ -46,6 +48,18 @@ public class TrainingManageCreateFlowAction implements Action {
|
|||
// 不是“培训效果评估表”,不做处理
|
||||
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();
|
||||
|
|
@ -57,7 +71,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(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 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 = {
|
||||
createWorkflowRequestTableField("xm", userId),
|
||||
createWorkflowRequestTableField("gh", workCode),
|
||||
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();
|
||||
WorkflowRequestTableRecord[] workflowRequestTableRecord = new WorkflowRequestTableRecord[1];
|
||||
workflowMainTableInfo.setRequestRecords(workflowRequestTableRecord);
|
||||
|
|
@ -97,15 +145,20 @@ public class TrainingManageCreateFlowAction implements Action {
|
|||
WorkflowDetailTableInfo[] workflowDetailTableInfoArray = new WorkflowDetailTableInfo[3];
|
||||
workflowDetailTableInfoArray[0] = new WorkflowDetailTableInfo();
|
||||
|
||||
// 明细表一
|
||||
WorkflowRequestTableRecord[] workflowRequestTableRecordDt = new WorkflowRequestTableRecord[1];
|
||||
|
||||
WorkflowRequestTableField[] workflowRequestTableFieldDt = {
|
||||
createWorkflowRequestTableField("pgxmpxkc", pxmc)
|
||||
};
|
||||
workflowRequestTableRecordDt[0] = new WorkflowRequestTableRecord();
|
||||
workflowRequestTableRecordDt[0].setWorkflowRequestTableFields(workflowRequestTableFieldDt);
|
||||
workflowDetailTableInfoArray[0].setWorkflowRequestTableRecords(workflowRequestTableRecordDt);
|
||||
if (CollectionUtils.isNotEmpty(detailList)) {
|
||||
// 明细表一
|
||||
WorkflowRequestTableRecord[] workflowRequestTableRecordDt = new WorkflowRequestTableRecord[detailList.size()];
|
||||
for (int i = 0; i < detailList.size(); i++) {
|
||||
Map<String, String> detailMap = detailList.get(i);
|
||||
WorkflowRequestTableField[] workflowRequestTableFieldDt = {
|
||||
// 插入课程名称
|
||||
createWorkflowRequestTableField("kcmc", detailMap.get("kcmc"))
|
||||
};
|
||||
workflowRequestTableRecordDt[i] = new WorkflowRequestTableRecord();
|
||||
workflowRequestTableRecordDt[i].setWorkflowRequestTableFields(workflowRequestTableFieldDt);
|
||||
}
|
||||
workflowDetailTableInfoArray[0].setWorkflowRequestTableRecords(workflowRequestTableRecordDt);
|
||||
}
|
||||
|
||||
createWorkflowRequest(FLOW_ID, "培训效果评估表-" + lastName + "-" + DateUtil.getCurrentDate(), userId, "1", workflowMainTableInfo, workflowDetailTableInfoArray);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,11 +44,35 @@ public class TrainingManageEndAction implements Action {
|
|||
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 pxxgpgfs = mainDataMap.get("pxxgpgfs");
|
||||
String pxmc = mainDataMap.get("pxmc");
|
||||
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)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
|
@ -75,8 +99,9 @@ public class TrainingManageEndAction implements Action {
|
|||
break;
|
||||
case "1":
|
||||
case "2":
|
||||
case "3":
|
||||
//考试、考核
|
||||
exam(String.valueOf(creatorId), mainDataMap, trainInfoMap, pxxgpgfs);
|
||||
exam(userIdList, String.valueOf(creatorId), mainDataMap, trainInfoMap, pxxgpgfs);
|
||||
default:
|
||||
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 {
|
||||
String drlzy = mainDataMap.get("drlzy");
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(drlzy)) {
|
||||
String[] userIds = drlzy.split(",");
|
||||
userIdList.addAll(Arrays.asList(userIds));
|
||||
}
|
||||
private void exam(List<String> userIdList, String creatorId, Map<String, String> mainDataMap, Map<String, String> trainInfoMap, String type) throws Exception {
|
||||
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 = ? ";
|
||||
|
||||
} else if ("3".equals(type)) {
|
||||
sql = "update uf_grqdtz set qt = 0 where xm = ? and pxmc = ? ";
|
||||
}
|
||||
String insertTableName = "uf_pxxx";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue