北森接口代码调整 数据写入建模表逻辑开发
This commit is contained in:
parent
c8368082b4
commit
26cc7d7fa4
|
|
@ -24,3 +24,5 @@ target/
|
|||
/src/META-INF
|
||||
|
||||
/log
|
||||
|
||||
dxfeng.jsp
|
||||
|
|
@ -128,4 +128,41 @@ public class DataUtil {
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表单下拉框展示文本
|
||||
*
|
||||
* @param formId 表单ID
|
||||
* @param fieldName 字段明湖曾
|
||||
* @param value 下拉框值
|
||||
* @return
|
||||
*/
|
||||
public static String getSelectName(String formId, String fieldName, String value) {
|
||||
String cancelReason = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select selectname from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? ) and selectvalue = ?", formId, fieldName, value);
|
||||
if (rs.next()) {
|
||||
cancelReason = rs.getString("selectname");
|
||||
}
|
||||
return cancelReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表单下拉框值
|
||||
*
|
||||
* @param formId 表单ID
|
||||
* @param fieldName 字段明湖曾
|
||||
* @param selectName 下拉框展示内容
|
||||
* @return
|
||||
*/
|
||||
public static String getSelectValue(String formId, String fieldName, String selectName) {
|
||||
String selectValue = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select selectvalue from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? ) and selectname = ?", formId, fieldName, selectName);
|
||||
if (rs.next()) {
|
||||
selectValue = rs.getString("selectvalue");
|
||||
}
|
||||
return selectValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,30 +15,30 @@ public class Employee {
|
|||
private String lastSchool;
|
||||
private String modifiedTime;
|
||||
private String nation;
|
||||
private long userID;
|
||||
private Long userID;
|
||||
private String major;
|
||||
private String applicantIdV6;
|
||||
private String createdTime;
|
||||
private int applicantId;
|
||||
private Integer applicantId;
|
||||
private Date certificateValidityTerm;
|
||||
private int nationality;
|
||||
private int sourceType;
|
||||
private Integer nationality;
|
||||
private Integer sourceType;
|
||||
private String name;
|
||||
private boolean stdIsDeleted;
|
||||
private int gender;
|
||||
private Integer gender;
|
||||
private String iDType;
|
||||
private String backupMail;
|
||||
private String certificateStartDate;
|
||||
private String businessModifiedTime;
|
||||
private long businessModifiedBy;
|
||||
private Long businessModifiedBy;
|
||||
private String _Name;
|
||||
private String educationLevel;
|
||||
private long modifiedBy;
|
||||
private Long modifiedBy;
|
||||
private String email;
|
||||
private String objectId;
|
||||
private String politicalStatus;
|
||||
private long createdBy;
|
||||
private int age;
|
||||
private Long createdBy;
|
||||
private Integer age;
|
||||
private String departmentCode;
|
||||
private String positionCode;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,121 @@
|
|||
package com.engine.hzzx.entity;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/17
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class EmployeeTrans {
|
||||
private static final Map<String, String> POLITICAL_MAP;
|
||||
|
||||
static {
|
||||
POLITICAL_MAP = new HashMap<>();
|
||||
POLITICAL_MAP.put("4", "群众");
|
||||
POLITICAL_MAP.put("1", "中共党员");
|
||||
POLITICAL_MAP.put("6", "中共预备党员");
|
||||
POLITICAL_MAP.put("2", "共青团员");
|
||||
POLITICAL_MAP.put("7", "民革党员");
|
||||
POLITICAL_MAP.put("8", "民盟盟员");
|
||||
POLITICAL_MAP.put("9", "民建会员");
|
||||
POLITICAL_MAP.put("10", "民进会员");
|
||||
POLITICAL_MAP.put("11", "农工党党员");
|
||||
POLITICAL_MAP.put("13", "九三学社社员");
|
||||
POLITICAL_MAP.put("14", "台盟盟员");
|
||||
POLITICAL_MAP.put("15", "无党派人士");
|
||||
POLITICAL_MAP.put("5", "其他");
|
||||
}
|
||||
|
||||
public static String getPoliticalStr(String politicalStatus) {
|
||||
return POLITICAL_MAP.get(politicalStatus);
|
||||
}
|
||||
|
||||
public static String getDepartmentId(String departmentCode) {
|
||||
String departmentId = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
if (StringUtils.isBlank(departmentCode)) {
|
||||
return departmentId;
|
||||
}
|
||||
rs.executeQuery("select id from hrmdepartment where departmentcode = ?", departmentCode);
|
||||
if (rs.next()) {
|
||||
departmentId = rs.getString("id");
|
||||
}
|
||||
return departmentId;
|
||||
}
|
||||
|
||||
|
||||
public static String getJobtitleId(String jobtitleCode) {
|
||||
String jobtitleId = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
if (StringUtils.isBlank(jobtitleCode)) {
|
||||
return jobtitleId;
|
||||
}
|
||||
rs.executeQuery("select id from hrmjobtitles where jobtitlecode = ?", jobtitleCode);
|
||||
if (rs.next()) {
|
||||
jobtitleId = rs.getString("id");
|
||||
}
|
||||
return jobtitleId;
|
||||
}
|
||||
|
||||
public static String getEducationLevelId(String educationLevel) {
|
||||
if (StringUtils.isBlank(educationLevel)) {
|
||||
return "";
|
||||
}
|
||||
String educationLevelId = "";
|
||||
switch (educationLevel) {
|
||||
case "1":
|
||||
// 本科
|
||||
educationLevelId = "7";
|
||||
break;
|
||||
case "2":
|
||||
// 硕士研究生
|
||||
educationLevelId = "8";
|
||||
break;
|
||||
case "3":
|
||||
// 高中
|
||||
educationLevelId = "3";
|
||||
break;
|
||||
case "4":
|
||||
// 中技(中专/技校/职高)
|
||||
educationLevelId = "4";
|
||||
break;
|
||||
case "5":
|
||||
// 大专
|
||||
educationLevelId = "6";
|
||||
break;
|
||||
case "6":
|
||||
// MBA
|
||||
educationLevelId = "10";
|
||||
break;
|
||||
case "7":
|
||||
// 博士研究生
|
||||
educationLevelId = "9";
|
||||
break;
|
||||
case "8":
|
||||
// 初中
|
||||
educationLevelId = "2";
|
||||
break;
|
||||
case "9":
|
||||
// 小学
|
||||
case "10":
|
||||
// 保密
|
||||
case "130":
|
||||
// MPA
|
||||
educationLevelId = "1";
|
||||
break;
|
||||
case "120":
|
||||
// EMBA
|
||||
educationLevelId = "11";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return educationLevelId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ public class TrainingApplicationAction implements Action {
|
|||
insertData.put("modeuuid", uuid);
|
||||
int formModeId = DataUtil.getModeIdByTableName(MODE_TABLE_NAME);
|
||||
insertData.put("formmodeid", String.valueOf(formModeId));
|
||||
DataUtil.buildModeInsertFields(mainDataMap, operateId);
|
||||
DataUtil.buildModeInsertFields(insertData, operateId);
|
||||
|
||||
insertData.put("pxrs", mainDataMap.get("pxrs"));
|
||||
insertData.put("pxdx", mainDataMap.get("pxdx"));
|
||||
|
|
|
|||
|
|
@ -3,17 +3,19 @@ package weaver.interfaces.hzzx.cronjob;
|
|||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.hzzx.conn.DataUtil;
|
||||
import com.engine.hzzx.entity.Department;
|
||||
import com.engine.hzzx.entity.Employee;
|
||||
import com.engine.hzzx.entity.EmployeeTrans;
|
||||
import com.engine.hzzx.entity.Position;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -29,6 +31,11 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
private static final String APP_KEY = "EE7D602509E04A59AE5DEFF0841F6A1C";
|
||||
private static final String APP_SECRET = "F5229D9D83BF45DEBFA1EF8DAC13C0339D0074419CFE45FA8BAC2A0B9D170798";
|
||||
|
||||
private static final String EMPLOYEE_TABLE = "uf_sxszqbssjtz";
|
||||
private static final String INTERNSHIP_TABLE = "uf_ybygzqbssjtz";
|
||||
|
||||
private static final String OPERATE_ID = "1";
|
||||
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
|
|
@ -115,9 +122,11 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
|
||||
Employee employeeObject = JSONObject.parseObject(employeeInfo.toJSONString(), Employee.class);
|
||||
if (null != department) {
|
||||
// 设置部门编号
|
||||
employeeObject.setDepartmentCode(department.getCode());
|
||||
}
|
||||
if (null != position) {
|
||||
// 设置岗位编号
|
||||
employeeObject.setPositionCode(position.getCode());
|
||||
}
|
||||
employeeList.add(employeeObject);
|
||||
|
|
@ -226,4 +235,125 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
return position;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 插入一般员工数据
|
||||
*
|
||||
* @param employee
|
||||
*/
|
||||
private void insertEmployee(Employee employee) {
|
||||
Map<String, String> insertData = new HashMap<>();
|
||||
// 判断是否存在
|
||||
String objectId = employee.getObjectId();
|
||||
String sql = "select id from " + EMPLOYEE_TABLE + " where modeuuid = ?";
|
||||
if (StringUtils.isNotBlank(objectId)) {
|
||||
rs.executeQuery(sql, objectId);
|
||||
if (rs.next()) {
|
||||
rs.writeLog("查询员工信息,objectId==" + objectId + ",oaId==" + rs.getString("id"));
|
||||
// 重复数据不做插入操作,直接返回
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
objectId = UUID.randomUUID().toString();
|
||||
}
|
||||
// 构建插入数据
|
||||
insertData.put("xm", employee.getName());
|
||||
insertData.put("xb", Util.null2String(employee.getGender()));
|
||||
insertData.put("nl", String.valueOf(employee.getAge()));
|
||||
// 政治面貌
|
||||
String politicalStr = EmployeeTrans.getPoliticalStr(employee.getPoliticalStatus());
|
||||
if (StringUtils.isNotBlank(politicalStr)) {
|
||||
insertData.put("zzmm", DataUtil.getSelectValue(EMPLOYEE_TABLE, "zzmm", politicalStr));
|
||||
}
|
||||
// 部门
|
||||
String departmentId = EmployeeTrans.getDepartmentId(employee.getDepartmentCode());
|
||||
if (StringUtils.isNotBlank(departmentId)) {
|
||||
insertData.put("ypbm", departmentId);
|
||||
}
|
||||
// 职位
|
||||
String jobtitleId = EmployeeTrans.getJobtitleId(employee.getPositionCode());
|
||||
if (StringUtils.isNotBlank(jobtitleId)) {
|
||||
insertData.put("ypgw", jobtitleId);
|
||||
}
|
||||
// 学历
|
||||
String educationLevelId = EmployeeTrans.getEducationLevelId(employee.getEducationLevel());
|
||||
if (StringUtils.isNotBlank(educationLevelId)) {
|
||||
insertData.put("xl", educationLevelId);
|
||||
}
|
||||
// 学校
|
||||
// TODO insertData.put("xx", employee.getLastSchool());
|
||||
// 专业
|
||||
insertData.put("zy", employee.getMajor());
|
||||
// 工作年限
|
||||
|
||||
|
||||
// 构建建模基本数据
|
||||
insertData.put("modeuuid", objectId);
|
||||
int formModeId = DataUtil.getModeIdByTableName(EMPLOYEE_TABLE);
|
||||
insertData.put("formmodeid", String.valueOf(formModeId));
|
||||
DataUtil.buildModeInsertFields(insertData, OPERATE_ID);
|
||||
|
||||
// 插入数据,刷新权限
|
||||
DataUtil.insertData(insertData, EMPLOYEE_TABLE);
|
||||
DataUtil.refreshRight(objectId, EMPLOYEE_TABLE, formModeId, OPERATE_ID);
|
||||
}
|
||||
|
||||
private void insertInternshipEmployee(Employee employee) {
|
||||
Map<String, String> insertData = new HashMap<>();
|
||||
// 判断是否存在
|
||||
String objectId = employee.getObjectId();
|
||||
String sql = "select id from " + INTERNSHIP_TABLE + " where modeuuid = ?";
|
||||
if (StringUtils.isNotBlank(objectId)) {
|
||||
rs.executeQuery(sql, objectId);
|
||||
if (rs.next()) {
|
||||
rs.writeLog("查询实习生信息,objectId==" + objectId + ",oaId==" + rs.getString("id"));
|
||||
// 重复数据不做插入操作,直接返回
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
objectId = UUID.randomUUID().toString();
|
||||
}
|
||||
// 构建插入数据
|
||||
insertData.put("xm", employee.getName());
|
||||
insertData.put("xb", Util.null2String(employee.getGender()));
|
||||
insertData.put("nl", String.valueOf(employee.getAge()));
|
||||
// 政治面貌
|
||||
String politicalStr = EmployeeTrans.getPoliticalStr(employee.getPoliticalStatus());
|
||||
if (StringUtils.isNotBlank(politicalStr)) {
|
||||
insertData.put("zzmm", DataUtil.getSelectValue(INTERNSHIP_TABLE, "zzmm", politicalStr));
|
||||
}
|
||||
// 部门
|
||||
String departmentId = EmployeeTrans.getDepartmentId(employee.getDepartmentCode());
|
||||
if (StringUtils.isNotBlank(departmentId)) {
|
||||
insertData.put("ypbm", departmentId);
|
||||
}
|
||||
// 职位
|
||||
String jobtitleId = EmployeeTrans.getJobtitleId(employee.getPositionCode());
|
||||
if (StringUtils.isNotBlank(jobtitleId)) {
|
||||
insertData.put("ypgw", jobtitleId);
|
||||
}
|
||||
// 学历
|
||||
String educationLevelId = EmployeeTrans.getEducationLevelId(employee.getEducationLevel());
|
||||
if (StringUtils.isNotBlank(educationLevelId)) {
|
||||
insertData.put("xl", educationLevelId);
|
||||
}
|
||||
// 学校
|
||||
// TODO insertData.put("xx", employee.getLastSchool());
|
||||
// 专业
|
||||
insertData.put("zy", employee.getMajor());
|
||||
// 工作年限
|
||||
|
||||
|
||||
// 构建建模基本数据
|
||||
insertData.put("modeuuid", objectId);
|
||||
int formModeId = DataUtil.getModeIdByTableName(INTERNSHIP_TABLE);
|
||||
insertData.put("formmodeid", String.valueOf(formModeId));
|
||||
DataUtil.buildModeInsertFields(insertData, OPERATE_ID);
|
||||
|
||||
// 插入数据,刷新权限
|
||||
DataUtil.insertData(insertData, INTERNSHIP_TABLE);
|
||||
DataUtil.refreshRight(objectId, INTERNSHIP_TABLE, formModeId, OPERATE_ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue