|
|
|
@ -1,12 +1,17 @@
|
|
|
|
|
package weaver.interfaces.mzg.action.interview;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.mzg.conn.RecruitCommon;
|
|
|
|
|
import com.engine.mzg.enums.EmailTemplateEnum;
|
|
|
|
|
import com.engine.mzg.util.RecruitUtil;
|
|
|
|
|
import com.engine.workflowDesign.biz.AutoForecastBiz;
|
|
|
|
|
import com.engine.workplan.service.impl.WorkPlanBaseServiceImpl;
|
|
|
|
|
import com.weaver.formmodel.data.manager.FormInfoManager;
|
|
|
|
|
import com.weaver.formmodel.data.model.Formfield;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.formmode.IgnoreCaseHashMap;
|
|
|
|
@ -16,6 +21,7 @@ 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.workflow.request.RequestNodeFlow;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
@ -32,6 +38,7 @@ public class SubmitInterviewAction implements Action {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String execute(RequestInfo requestInfo) {
|
|
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
try {
|
|
|
|
|
if (StringUtils.isBlank(interviewStep)) {
|
|
|
|
@ -43,15 +50,47 @@ public class SubmitInterviewAction implements Action {
|
|
|
|
|
String billTableName = requestInfo.getRequestManager().getBillTableName();
|
|
|
|
|
int formId = requestInfo.getRequestManager().getFormid();
|
|
|
|
|
User user = requestInfo.getRequestManager().getUser();
|
|
|
|
|
int requestId = requestInfo.getRequestManager().getRequestid();
|
|
|
|
|
int nodeId = requestInfo.getRequestManager().getNodeid();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Set<String> userIdSet = new HashSet<>();
|
|
|
|
|
|
|
|
|
|
RequestNodeFlow flow = new AutoForecastBiz().getRequestNodeFlow(requestId, Util.getIntValue(nodeId), user);
|
|
|
|
|
flow.getNextNodes();
|
|
|
|
|
ArrayList operatorshts = flow.getOperatorshts();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(operatorshts)) {
|
|
|
|
|
for (Object obj : operatorshts) {
|
|
|
|
|
JSONObject jsonObject = (JSONObject) JSON.toJSON(obj);
|
|
|
|
|
// 使用流式处理遍历 JSONObject 的所有键
|
|
|
|
|
jsonObject.keySet().stream().forEach(key -> {
|
|
|
|
|
JSONArray jsonArrayForKey = jsonObject.getJSONArray((String) key);
|
|
|
|
|
if (jsonArrayForKey.size() > 0) {
|
|
|
|
|
String stringValue = jsonArrayForKey.getString(0);
|
|
|
|
|
// 分割字符串并提取数字
|
|
|
|
|
String[] parts = stringValue.split("_");
|
|
|
|
|
if (parts.length > 0) {
|
|
|
|
|
userIdSet.add(parts[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 去除创建者
|
|
|
|
|
userIdSet.remove(String.valueOf(user.getUID()));
|
|
|
|
|
|
|
|
|
|
IgnoreCaseHashMap<String, String> mainDataMap = new IgnoreCaseHashMap<>();
|
|
|
|
|
Property[] propertyArray = mainTableInfo.getProperty();
|
|
|
|
|
for (Property property : propertyArray) {
|
|
|
|
|
mainDataMap.put(property.getName(), property.getValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Optional<String> userIdOptional = userIdSet.stream().findFirst();
|
|
|
|
|
String msg = null;
|
|
|
|
|
if (userIdOptional.isPresent()) {
|
|
|
|
|
msg = userIdOptional.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 根据轮次
|
|
|
|
|
String msgKey;
|
|
|
|
@ -76,18 +115,22 @@ public class SubmitInterviewAction implements Action {
|
|
|
|
|
} else {
|
|
|
|
|
return SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
mainDataMap.put(msgField,msg);
|
|
|
|
|
// 更新表单字段
|
|
|
|
|
rs.executeUpdate("update " + billTableName + " set " + msgField + " = ? where id = ?", msg, billId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Formfield> fieldList = FormInfoManager.getInstance().getAllField(formId);
|
|
|
|
|
Map<String, Formfield> fieldMap = fieldList.stream().collect(Collectors.toMap(Formfield::getFieldname, item -> item, (k1, k2) -> k1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Set<String> userIdSet = new HashSet<>();
|
|
|
|
|
userIdSet.add(Util.null2String(mainDataMap.get(msgField)));
|
|
|
|
|
//userIdSet.add(Util.null2String(mainDataMap.get(msgField)));
|
|
|
|
|
String interviewDate = Util.null2String(mainDataMap.get(msrqField));
|
|
|
|
|
String msgContent = RecruitCommon.getSettingValue(msgKey,fieldMap, mainDataMap);
|
|
|
|
|
String msgContent = RecruitCommon.getSettingValue(msgKey, fieldMap, mainDataMap);
|
|
|
|
|
String msgCenterId = RecruitCommon.getSettingValue("MSG_CENTER_ID");
|
|
|
|
|
String planTitleInterview = RecruitCommon.getSettingValue("PLAN_TITLE_INTERVIEW",fieldMap, mainDataMap);
|
|
|
|
|
String msgTitleInterview = RecruitCommon.getSettingValue("MSG_TITLE_INTERVIEW",fieldMap, mainDataMap);
|
|
|
|
|
String planTitleInterview = RecruitCommon.getSettingValue("PLAN_TITLE_INTERVIEW", fieldMap, mainDataMap);
|
|
|
|
|
String planContentInterview = RecruitCommon.getSettingValue("PLAN_CONTENT_INTERVIEW", fieldMap, mainDataMap);
|
|
|
|
|
String msgTitleInterview = RecruitCommon.getSettingValue("MSG_TITLE_INTERVIEW", fieldMap, mainDataMap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 消息不为空,发送消息
|
|
|
|
@ -99,13 +142,25 @@ public class SubmitInterviewAction implements Action {
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
|
|
|
|
LocalDateTime dateTime = LocalDateTime.parse(interviewDate, formatter);
|
|
|
|
|
LocalDateTime newDateTime = dateTime.plusHours(1);
|
|
|
|
|
// 日程类型
|
|
|
|
|
maps.put("workPlanType", "0");
|
|
|
|
|
// 工作计划名称
|
|
|
|
|
maps.put("planName", planTitleInterview);
|
|
|
|
|
// 系统参与人
|
|
|
|
|
maps.put("memberIDs", StringUtils.join(userIdSet, ","));
|
|
|
|
|
// 紧急程度
|
|
|
|
|
maps.put("urgentLevel", "1");
|
|
|
|
|
// 开始时间
|
|
|
|
|
maps.put("beginDateTime", interviewDate);
|
|
|
|
|
// 结束时间
|
|
|
|
|
maps.put("endDateTime", newDateTime.format(formatter));
|
|
|
|
|
maps.put("isEnableSecondAuth", "0");
|
|
|
|
|
// 内容
|
|
|
|
|
maps.put("description", planContentInterview);
|
|
|
|
|
// 相关文档
|
|
|
|
|
maps.put("docIDs", mainDataMap.get("zp"));
|
|
|
|
|
maps.put("requestIDs", requestId);
|
|
|
|
|
String workId = getPlanIdByRequestId(rs, requestId);
|
|
|
|
|
maps.put("workid", workId);
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = ServiceUtil.getService(WorkPlanBaseServiceImpl.class, user).addWorkPlan(maps);
|
|
|
|
|
Integer workplanId = (Integer) result.get("workplanid");
|
|
|
|
@ -134,6 +189,26 @@ public class SubmitInterviewAction implements Action {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取关联该流程的日程ID
|
|
|
|
|
*
|
|
|
|
|
* @param rs
|
|
|
|
|
* @param requestId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private String getPlanIdByRequestId(RecordSet rs, int requestId) {
|
|
|
|
|
if (requestId < 0) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
rs.executeQuery("select id from WorkPlan where requestid = ? ", requestId);
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getString("id");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getInterviewStep() {
|
|
|
|
|
return interviewStep;
|
|
|
|
|
}
|
|
|
|
|