培训模块:培训报名日期校验、培训完成后写入人员档案
This commit is contained in:
parent
98f184c802
commit
4da853355b
|
|
@ -0,0 +1,91 @@
|
|||
let enable = true;
|
||||
let isExecuted = false;
|
||||
|
||||
//配置流程
|
||||
const workflowidArr = [18];
|
||||
|
||||
ecodeSDK.overwritePropsFnQueueMapSet('WeaReqTop', {
|
||||
fn: (newProps) => {
|
||||
if (!enable) return; //开关打开
|
||||
if (isExecuted || !window.WfForm) return;
|
||||
|
||||
const {hash} = window.location;
|
||||
if (hash.indexOf('#/main/workflow/req') === -1) return;
|
||||
const {workflowid} = WfForm.getBaseInfo() || {};
|
||||
if (!workflowid || !workflowidArr.includes(workflowid)) return;
|
||||
if (!ecCom.WeaTools.Base64) return; //完整组件库加载完成
|
||||
if (newProps.buttons.length >= 1) {
|
||||
let requestid = getRouterPara("requestid");
|
||||
if (requestid) {
|
||||
return newProps;
|
||||
}
|
||||
let pxmcid = getRouterPara("pxmcid");
|
||||
let sourceFlowId = getRouterPara("sourceFlowId");
|
||||
let pxmc = '';
|
||||
let msg = '';
|
||||
|
||||
// 调用接口,判断是否超期
|
||||
$.ajax({
|
||||
url: `/api/jcl/training/management/verificationDeadline?pxmcid=${pxmcid}&sourceFlowId=${sourceFlowId}`,
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
async: false,
|
||||
success: function (res) {
|
||||
if (res.api_status && res.data) {
|
||||
pxmc = res.data.pxmc;
|
||||
msg = res.data.msg;
|
||||
} else {
|
||||
console.log("接口请求异常,请联系管理员处理,res", res);
|
||||
msg = '接口请求异常,请联系管理员处理';
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.log("接口请求异常,请联系管理员处理,error", error);
|
||||
msg = '接口请求异常,请联系管理员处理';
|
||||
}
|
||||
});
|
||||
if (msg) {
|
||||
WfForm.showConfirm(msg, function () {
|
||||
WfForm.controlBtnDisabled(true);
|
||||
}, function () {
|
||||
WfForm.controlBtnDisabled(true);
|
||||
});
|
||||
}
|
||||
|
||||
let pxmc_id = WfForm.convertFieldNameToId('pxmc', "detail_1");
|
||||
|
||||
WfForm.registerAction(WfForm.ACTION_ADDROW + "1", function (index) {
|
||||
WfForm.changeFieldValue(pxmc_id + "_" + index, {
|
||||
value: pxmcid,
|
||||
specialobj: [
|
||||
{id: pxmcid, name: pxmc}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
isExecuted = true; // 标记已执行
|
||||
|
||||
}
|
||||
return newProps;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 根据参数名解析路由参数
|
||||
*/
|
||||
const getRouterPara = (name) => {
|
||||
const hash = window.location.hash;
|
||||
const querys = hash.slice(hash.indexOf('?') + 1).split('&');
|
||||
let id = '';
|
||||
querys.forEach((query) => {
|
||||
const qus = query.split('=');
|
||||
if (qus.length > 1 && qus[0] === name) {
|
||||
id = qus[1];
|
||||
}
|
||||
});
|
||||
return id;
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
let enable = true;
|
||||
|
||||
//配置流程
|
||||
const workflowidArr = [17];
|
||||
|
||||
// 报名工作流程
|
||||
const signFlowId = 18;
|
||||
|
||||
const createUrl = '/spa/workflow/static4form/index.html#/main/workflow/req?iscreate=1&workflowid='
|
||||
|
||||
ecodeSDK.overwritePropsFnQueueMapSet('WeaReqTop', {
|
||||
fn: (newProps) => {
|
||||
if (!enable) return; //开关打开
|
||||
const {hash} = window.location;
|
||||
if (hash.indexOf('#/main/workflow/req') === -1) return;
|
||||
const {workflowid} = WfForm.getBaseInfo() || {};
|
||||
if (!workflowid || !workflowidArr.includes(workflowid)) return;
|
||||
if (!ecCom.WeaTools.Base64) return; //完整组件库加载完成
|
||||
if (newProps.buttons.length >= 1) {
|
||||
let bm_id = WfForm.convertFieldNameToId('bm');
|
||||
let pxmc_id = WfForm.convertFieldNameToId('pxmc');
|
||||
WfForm.bindFieldChangeEvent(pxmc_id, function (obj, id, value) {
|
||||
if (value) {
|
||||
// 添加字段联动
|
||||
let origin = window.location.origin;
|
||||
let url = origin + createUrl + signFlowId + '&pxmcid=' + value + '&sourceFlowId=' + workflowid;
|
||||
wfform.changeFieldValue(bm_id, {value: url})
|
||||
WfForm.changeFieldAttr(bm_id, 1); //字段修改为只读
|
||||
} else {
|
||||
wfform.changeFieldValue(bm_id, {value: ''})
|
||||
WfForm.changeFieldAttr(bm_id, 2); //字段修改为可编辑
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return newProps;
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.hzzx.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
|
||||
@Path("/jcl/training/management")
|
||||
public class TrainingManagementController extends com.engine.hzzx.web.TrainingManagementController {
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
package com.api.xxx.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
|
||||
@Path("/jcl/xxx/demand")
|
||||
public class RecruitDemandController extends com.engine.xxx.web.RecruitDemandController{
|
||||
}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
package com.engine.hzzx.conn;
|
||||
|
||||
import com.engine.hzzx.exception.CustomizeRunTimeException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/02/27
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class DataUtil {
|
||||
|
||||
/**
|
||||
* 根据流程ID获取流程表名
|
||||
*
|
||||
* @param workflowId
|
||||
* @return
|
||||
*/
|
||||
public static String getTableNameById(String workflowId) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select formid from workflow_base where id= ?", workflowId);
|
||||
if (rs.next()) {
|
||||
String formId = rs.getString("formid");
|
||||
if (StringUtils.isNotBlank(formId)) {
|
||||
rs.executeQuery("select tablename from workflow_bill wb where id = ?", formId);
|
||||
if (rs.next()) {
|
||||
return rs.getString("tablename");
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据建模表名,获取建模ID
|
||||
*
|
||||
* @param modeTable
|
||||
* @return
|
||||
*/
|
||||
public static int getModeIdByTableName(String modeTable) {
|
||||
int formModeId = -1;
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from modeinfo where formid =( select id from workflow_bill where tablename = ? ) and isdelete = 0 order by id", modeTable);
|
||||
if (rs.next()) {
|
||||
formModeId = rs.getInt("id");
|
||||
}
|
||||
return formModeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入数据
|
||||
*
|
||||
* @param dataMap 数据集合
|
||||
* @param tableName 表名
|
||||
*/
|
||||
public static void insertData(Map<String, String> dataMap, String tableName) {
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<String> dataList = new ArrayList<>();
|
||||
List<String> paramList = new ArrayList<>();
|
||||
|
||||
dataMap.forEach((key, value) -> {
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
fieldList.add(key);
|
||||
dataList.add(value);
|
||||
paramList.add("?");
|
||||
}
|
||||
});
|
||||
String insertSql = " insert into " + tableName + "(" + StringUtils.join(fieldList, ",") + ") values (" + StringUtils.join(paramList, ",") + ")";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate(insertSql, dataList);
|
||||
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
|
||||
throw new CustomizeRunTimeException(rs.getExceptionMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建建模表基本数据
|
||||
*
|
||||
* @param mainDataMap 参数集合
|
||||
*/
|
||||
public static void buildModeInsertFields(Map<String, String> mainDataMap, String userId) {
|
||||
String dateTime = DateUtil.getFullDate();
|
||||
String[] dateSplit = dateTime.split(" ");
|
||||
mainDataMap.put("modedatacreater", userId);
|
||||
mainDataMap.put("modedatacreatedate", dateSplit[0]);
|
||||
mainDataMap.put("modedatacreatetime", dateSplit[1]);
|
||||
mainDataMap.put("modedatacreatertype", "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建建模表基本数据
|
||||
*
|
||||
* @param mainDataMap 参数集合
|
||||
*/
|
||||
public static void buildModeUpdateFields(Map<String, String> mainDataMap, String userId) {
|
||||
String dateTime = DateUtil.getFullDate();
|
||||
mainDataMap.put("modedatamodifier", userId);
|
||||
mainDataMap.put("modedatamodifydatetime", dateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 建模表数据权限重构
|
||||
*
|
||||
* @param uuid
|
||||
* @param modeTable
|
||||
* @param formModeId
|
||||
*/
|
||||
public static int refreshRight(String uuid, String modeTable, int formModeId, String creator) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from " + modeTable + " where modeuuid='" + uuid + "'");
|
||||
if (rs.next()) {
|
||||
//建模数据的id
|
||||
int bid = Util.getIntValue(rs.getString("id"));
|
||||
ModeRightInfo modeRightInfo = new ModeRightInfo();
|
||||
modeRightInfo.setNewRight(true);
|
||||
//新建的时候添加共享
|
||||
modeRightInfo.editModeDataShare(Integer.parseInt(creator), formModeId, bid);
|
||||
return bid;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.engine.xxx.exception;
|
||||
package com.engine.hzzx.exception;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.engine.hzzx.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface TrainingManagementService {
|
||||
|
||||
Map<String, Object> verificationDeadline(Map<String, Object> param);
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.engine.hzzx.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hzzx.conn.DataUtil;
|
||||
import com.engine.hzzx.service.TrainingManagementService;
|
||||
import com.engine.hzzx.exception.CustomizeRunTimeException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class TrainingManagementServiceImpl extends Service implements TrainingManagementService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> verificationDeadline(Map<String, Object> param) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String pxmcId = Util.null2String(param.get("pxmcid"));
|
||||
String sourceFlowId = Util.null2String(param.get("sourceFlowId"));
|
||||
String tableName = DataUtil.getTableNameById(sourceFlowId);
|
||||
if (StringUtils.isBlank(tableName)) {
|
||||
throw new CustomizeRunTimeException("数据异常,请联系管理员");
|
||||
}
|
||||
// 查询最新的截止时间
|
||||
String deadLineTime = "";
|
||||
rs.executeQuery("select bmjzsj from " + tableName + " where pxmc = ?", pxmcId);
|
||||
if (rs.next()) {
|
||||
deadLineTime = rs.getString("bmjzsj");
|
||||
}
|
||||
// 校验时间是否截止
|
||||
if (StringUtils.isBlank(deadLineTime)) {
|
||||
throw new CustomizeRunTimeException("报名截止时间获取异常,请联系管理员");
|
||||
}
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||
LocalDateTime deadLineFormatTime = LocalDateTime.parse(deadLineTime, formatter);
|
||||
LocalDateTime currentDateTime = LocalDateTime.parse(DateUtil.getDateTime(), formatter);
|
||||
|
||||
|
||||
if(deadLineFormatTime.isBefore(currentDateTime)){
|
||||
returnMap.put("msg", "报名时间已截止,暂时无法报名");
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
//查询培训名称
|
||||
rs.executeQuery("select pxmc from uf_pxsssq where id = ?", pxmcId);
|
||||
if(rs.next()){
|
||||
returnMap.put("pxmc",rs.getString("pxmc"));
|
||||
}
|
||||
return returnMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.engine.xxx.util;
|
||||
package com.engine.hzzx.util;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package com.engine.xxx.util;
|
||||
package com.engine.hzzx.util;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.engine.core.exception.ECException;
|
||||
import com.engine.xxx.exception.CustomizeRunTimeException;
|
||||
import com.engine.hzzx.exception.CustomizeRunTimeException;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -50,7 +50,7 @@ public class ResponseResult<T, R> {
|
|||
log.info("run api , param {}", t);
|
||||
}
|
||||
return getJsonString(f.apply(t));
|
||||
} catch (com.engine.xxx.exception.CustomizeRunTimeException e) {
|
||||
} catch (com.engine.hzzx.exception.CustomizeRunTimeException e) {
|
||||
log.error("api run fail", e);
|
||||
return Error(e.getMessage());
|
||||
} catch (ECException e) {
|
||||
|
|
@ -72,7 +72,7 @@ public class ResponseResult<T, R> {
|
|||
log.info("run api , param {}", t);
|
||||
}
|
||||
return Ok(f.apply(t));
|
||||
} catch (com.engine.xxx.exception.CustomizeRunTimeException e) {
|
||||
} catch (com.engine.hzzx.exception.CustomizeRunTimeException e) {
|
||||
log.error("api run fail", e);
|
||||
return Error(e.getMessage());
|
||||
} catch (ECException e) {
|
||||
|
|
@ -95,7 +95,7 @@ public class ResponseResult<T, R> {
|
|||
}
|
||||
f.accept(t);
|
||||
return Ok();
|
||||
} catch (com.engine.xxx.exception.CustomizeRunTimeException e) {
|
||||
} catch (com.engine.hzzx.exception.CustomizeRunTimeException e) {
|
||||
log.error("api run fail", e);
|
||||
return Error(e.getMessage());
|
||||
} catch (ECException e) {
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package com.engine.xxx.web;
|
||||
package com.engine.hzzx.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.xxx.service.RecruitDemandService;
|
||||
import com.engine.xxx.service.impl.RecruitDemandServiceImpl;
|
||||
import com.engine.xxx.util.ResponseResult;
|
||||
import com.engine.hzzx.service.TrainingManagementService;
|
||||
import com.engine.hzzx.service.impl.TrainingManagementServiceImpl;
|
||||
import com.engine.hzzx.util.ResponseResult;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -19,21 +19,21 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/29
|
||||
* @createTime: 2025/02/27
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class RecruitDemandController {
|
||||
public RecruitDemandService getService(User user) {
|
||||
return ServiceUtil.getService(RecruitDemandServiceImpl.class, user);
|
||||
public class TrainingManagementController {
|
||||
public TrainingManagementService getService(User user) {
|
||||
return ServiceUtil.getService(TrainingManagementServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getStaffNum")
|
||||
@Path("/verificationDeadline")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getStaffNum(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
public String verificationDeadline(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getStaffNum, params);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::verificationDeadline, params);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.engine.xxx.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface RecruitDemandService {
|
||||
|
||||
Map<String, Object> getStaffNum(Map<String, Object> param);
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package com.engine.xxx.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.xxx.service.RecruitDemandService;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class RecruitDemandServiceImpl extends Service implements RecruitDemandService {
|
||||
@Override
|
||||
public Map<String, Object> getStaffNum(Map<String, Object> param) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sqbm = Util.null2String(param.get("sqbm"));
|
||||
String xqgw = Util.null2String(param.get("xqgw"));
|
||||
|
||||
|
||||
rs.executeQuery("select a.staff_num, a.permanent_num from jcl_org_staff a inner join JCL_ORG_STAFFPLAN b on a.plan_id = b.id and b.forbidden_tag = 0 and b.delete_type = 0 where a.delete_type = 0 and a.ec_department = ? and a.job_id = ? order by a.id desc", sqbm, xqgw);
|
||||
if(rs.next()) {
|
||||
String staffNum = rs.getString("staff_num");
|
||||
String permanentNum = rs.getString("permanent_num");
|
||||
returnMap.put("staffNum", staffNum);
|
||||
returnMap.put("permanentNum", permanentNum);
|
||||
}
|
||||
|
||||
return returnMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package weaver.interfaces.hzzx.action;
|
||||
|
||||
import com.engine.hzzx.conn.DataUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 5.2.2.2培训实施申请
|
||||
* 流程归档,写入建模表
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/02/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class TrainingApplicationAction implements Action {
|
||||
|
||||
private static final String MODE_TABLE_NAME = "uf_pxsssq";
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
try {
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
Map<String, String> mainDataMap = new HashMap<>();
|
||||
for (Property property : properties) {
|
||||
mainDataMap.put(property.getName(), property.getValue());
|
||||
}
|
||||
|
||||
// 插入主表数据,并生成ID
|
||||
int mainId = insertMainTable(mainDataMap);
|
||||
if (-1 == mainId) {
|
||||
requestInfo.getRequestManager().setMessagecontent("流程数据写入建模主表失败");
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
|
||||
DetailTable[] detailTables = detailTableInfo.getDetailTable();
|
||||
for (int i = 0; i < detailTables.length; i++) {
|
||||
String detailTableName = MODE_TABLE_NAME + "_" + (i + 1);
|
||||
DetailTable table = detailTables[i];
|
||||
Row[] rows = table.getRow();
|
||||
for (Row row : rows) {
|
||||
Map<String, String> detailDataMap = new HashMap<>();
|
||||
detailDataMap.put("mainid", String.valueOf(mainId));
|
||||
Cell[] cells = row.getCell();
|
||||
for (Cell cell : cells) {
|
||||
detailDataMap.put(cell.getName(), cell.getValue());
|
||||
}
|
||||
// 插入明细表数据
|
||||
insertDetailTable(detailDataMap, detailTableName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
} catch (Exception e) {
|
||||
rs.writeLog(e);
|
||||
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入主表
|
||||
*
|
||||
* @param mainDataMap
|
||||
* @return
|
||||
*/
|
||||
private int insertMainTable(Map<String, String> mainDataMap) {
|
||||
String operateId = mainDataMap.get("sqr");
|
||||
|
||||
Map<String, String> insertData = new HashMap<>();
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
insertData.put("modeuuid", uuid);
|
||||
int formModeId = DataUtil.getModeIdByTableName(MODE_TABLE_NAME);
|
||||
insertData.put("formmodeid", String.valueOf(formModeId));
|
||||
DataUtil.buildModeInsertFields(mainDataMap, operateId);
|
||||
|
||||
insertData.put("pxrs", mainDataMap.get("pxrs"));
|
||||
insertData.put("pxdx", mainDataMap.get("pxdx"));
|
||||
insertData.put("szbm", mainDataMap.get("szbm"));
|
||||
insertData.put("pxdd", mainDataMap.get("pxdd"));
|
||||
insertData.put("jssjyc", mainDataMap.get("jssjyc"));
|
||||
insertData.put("pxsj", mainDataMap.get("pxsj"));
|
||||
insertData.put("sqr", mainDataMap.get("sqr"));
|
||||
// insertData.put("pxzt",mainDataMap.get("pxzt"));
|
||||
insertData.put("sfzndjhn", mainDataMap.get("sfzndjhn"));
|
||||
insertData.put("pxmc", mainDataMap.get("pxmc"));
|
||||
insertData.put("xs", mainDataMap.get("xs"));
|
||||
insertData.put("jf", mainDataMap.get("jf"));
|
||||
DataUtil.insertData(insertData, MODE_TABLE_NAME);
|
||||
return DataUtil.refreshRight(uuid, MODE_TABLE_NAME, formModeId, operateId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 插入子表
|
||||
*
|
||||
* @param detailDataMap
|
||||
* @param detailTableName
|
||||
*/
|
||||
private void insertDetailTable(Map<String, String> detailDataMap, String detailTableName) {
|
||||
DataUtil.insertData(detailDataMap, detailTableName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package weaver.interfaces.hzzx.action;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/02/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class TrainingEffectAction implements Action {
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
try {
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
Map<String, String> mainDataMap = new HashMap<>();
|
||||
for (Property property : properties) {
|
||||
mainDataMap.put(property.getName(), property.getValue());
|
||||
}
|
||||
|
||||
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
|
||||
DetailTable[] detailTables = detailTableInfo.getDetailTable();
|
||||
List<Map<String, String>> detailDataList = new ArrayList<>();
|
||||
DetailTable table = detailTables[0];
|
||||
Row[] rows = table.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 xm = mainDataMap.get("xm");
|
||||
|
||||
// 更新签到表“培训效果评估表是否提交”字段,为“是”
|
||||
for (Map<String, String> detailData : detailDataList) {
|
||||
String pgxmpxkc = detailData.get("pgxmpxkc");
|
||||
rs.executeUpdate("update uf_grqdtz set pxxgpgbsftj = 1 where xm = ? and pxmc = ? ", xm, pgxmpxkc);
|
||||
}
|
||||
return SUCCESS;
|
||||
} catch (Exception e) {
|
||||
rs.writeLog(e);
|
||||
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
package weaver.interfaces.hzzx.action;
|
||||
|
||||
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/02/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class TrainingEffectManageAction implements Action {
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
try {
|
||||
String creatorId = requestInfo.getCreatorid();
|
||||
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 pxmc = mainDataMap.get("pxmc");
|
||||
// 培训效果评估方式
|
||||
String pxxgpgfs = mainDataMap.get("pxxgpgfs");
|
||||
// 培训已完成组织
|
||||
String pxywczz = mainDataMap.get("pxywczz");
|
||||
// 培训符合归档要求
|
||||
String pxfhgdyq = mainDataMap.get("pxfhgdyq");
|
||||
|
||||
/*查询培训基本信息*/
|
||||
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("pxzt", rs.getString("pxzt"));
|
||||
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"));
|
||||
}
|
||||
|
||||
Map<String, String> trainEmployeesMap = new HashMap<>();
|
||||
trainEmployeesMap.put("pxmc", pxmc);
|
||||
trainEmployeesMap.put("pxqssj", trainInfoMap.get("pxsj"));
|
||||
trainEmployeesMap.put("pxjssj", trainInfoMap.get("jssjyc"));
|
||||
trainEmployeesMap.put("pxzt", trainInfoMap.get("pxzt"));
|
||||
trainEmployeesMap.put("pxxs", trainInfoMap.get("xs"));
|
||||
trainEmployeesMap.put("pxjf", trainInfoMap.get("jf"));
|
||||
trainEmployeesMap.put("pxzzdw", mainDataMap.get("szbm"));
|
||||
// TODO 待确定
|
||||
trainEmployeesMap.put("pxxs_", null);
|
||||
|
||||
// 写入员工培训信息
|
||||
insertTrainEmployees(creatorId, pxmc, pxxgpgfs, new HashMap<>(trainEmployeesMap));
|
||||
|
||||
Map<String, String> trainerMap = new HashMap<>();
|
||||
trainerMap.put("pxmc", pxmc);
|
||||
trainerMap.put("pxqssj", trainInfoMap.get("pxsj"));
|
||||
trainerMap.put("pxjssj", trainInfoMap.get("jssjyc"));
|
||||
trainerMap.put("pxzt", trainInfoMap.get("pxzt"));
|
||||
trainerMap.put("pxzzdw", mainDataMap.get("szbm"));
|
||||
|
||||
if (!"0".equals(pxywczz)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
// 写入培训授课信息
|
||||
for (Map<String, String> detailData : detailDataList) {
|
||||
String pxsnb = detailData.get("pxsnb");
|
||||
if (StringUtils.isNotBlank(pxsnb)) {
|
||||
insertTrainer(pxsnb, creatorId, pxmc, new HashMap<>(trainerMap));
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
} catch (Exception e) {
|
||||
rs.writeLog(e);
|
||||
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据培训名称、查询培训签到表的数据,如果满足任一条件,员工培训记录写入员工档案
|
||||
*
|
||||
* @param creatorId
|
||||
* @param pxmc
|
||||
* @param pxxgpgfs
|
||||
* @param trainEmployeesMap
|
||||
*/
|
||||
private void insertTrainEmployees(String creatorId, String pxmc, String pxxgpgfs, Map<String, String> trainEmployeesMap) throws Exception {
|
||||
String sql = "select xm from uf_grqdtz where pxmc = ? ";
|
||||
// 培训效果评估方式 == 培训效果评估表
|
||||
if ("0".equals(pxxgpgfs)) {
|
||||
sql += " and pxxgpgbsftj = 0 ";
|
||||
} else {
|
||||
sql += " and (pxxgpgbsftj = 0 or kssftg = 0 or khsftg = 0)";
|
||||
}
|
||||
rs.executeQuery(sql, pxmc);
|
||||
List<String> list = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
list.add(rs.getString("xm"));
|
||||
}
|
||||
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
String insertTableName = "uf_pxxx";
|
||||
|
||||
int formModeId = DataUtil.getModeIdByTableName(insertTableName);
|
||||
trainEmployeesMap.put("formmodeid", String.valueOf(formModeId));
|
||||
DataUtil.buildModeInsertFields(trainEmployeesMap, creatorId);
|
||||
|
||||
// 遍历人员,插入培训信息表
|
||||
for (String userId : list) {
|
||||
String workCode = resourceComInfo.getWorkcode(userId);
|
||||
trainEmployeesMap.put("gh", workCode);
|
||||
trainEmployeesMap.put("xm", userId);
|
||||
// 插入数据
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
trainEmployeesMap.put("modeuuid", uuid);
|
||||
DataUtil.insertData(trainEmployeesMap, insertTableName);
|
||||
DataUtil.refreshRight(uuid, insertTableName, formModeId, creatorId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 插入培训授课信息
|
||||
*
|
||||
* @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);
|
||||
DataUtil.insertData(trainerMap, insertTableName);
|
||||
DataUtil.refreshRight(uuid, insertTableName, formModeId, creatorId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue