人员快照功能完成

五院杭州中心
Chengliang 2 weeks ago
parent 7faf9eb4af
commit 70d69fb039

@ -4,7 +4,7 @@ workPeopleType=field53
#在岗状态 #在岗状态
workStatus=field54 workStatus=field54
#政治面貌 #政治面貌
policy=field54 policy=field55
#座机号码 #座机号码
landNumber=field45 landNumber=field45
#办公邮箱 #办公邮箱
@ -18,7 +18,7 @@ personType=field57
#年龄 #年龄
age=field33 age=field33
#民族 #民族
nation=field59 nation=field48
#出生地 #出生地
birthplace=field58 birthplace=field58
#户籍地址 #户籍地址
@ -135,4 +135,8 @@ teamLeader=field93
dingId=field5 dingId=field5
#人员快照建模表modeId
modeId=417

@ -0,0 +1,54 @@
package com.engine.wysecond.util;
import weaver.conn.RecordSet;
import weaver.general.Util;
/**
* @Author liang.cheng
* @Date 2025/4/8 13:47
* @Description:
* @Version 1.0
*/
public class FieldTransUtils {
public static String selectHrmItem(String fieldName,Integer selectValue,String language) {
RecordSet rs = new RecordSet();
rs.executeQuery("select selectname from hrm_selectitem where fieldid = (select fieldid from hrm_formfield where fieldname = '"+fieldName+"') and selectvalue = ?",selectValue);
rs.next();
return Util.formatMultiLang(Util.null2String(rs.getString("selectname")),language);
}
public static String selectItemValue(String field, Integer selectValue,String language) {
RecordSet rs = new RecordSet();
rs.executeQuery("select selectname from cus_selectitem where fieldid = ? and selectvalue = ?",field,selectValue);
rs.next();
return Util.formatMultiLang(Util.null2String(rs.getString("selectname")),language);
}
public static String selectNationName(String value) {
RecordSet rs = new RecordSet();
rs.executeQuery("select mz from uf_mz_ where id = ?",value);
rs.next();
return Util.null2String(rs.getString("mz"));
}
public static String selectPostionType(String value) {
RecordSet rs = new RecordSet();
rs.executeQuery("select ywzwxl from uf_ywzwxl where id = ?",value);
rs.next();
return Util.null2String(rs.getString("ywzwxl"));
}
public static String selectPostion(String value) {
RecordSet rs = new RecordSet();
rs.executeQuery("select ywzwcj from uf_ywzwcj where id = ?",value);
rs.next();
return Util.null2String(rs.getString("ywzwcj"));
}
}

@ -1,5 +1,7 @@
package test; package test;
import weaver.common.DateUtil;
/** /**
* @Author weaver_cl * @Author weaver_cl
* @Description: * @Description:
@ -9,6 +11,8 @@ package test;
public class MainTest { public class MainTest {
public static void main(String[] args) { public static void main(String[] args) {
String month = DateUtil.getCurrentDate().substring(0,7);
System.out.println(month);
} }
} }

@ -1,11 +1,24 @@
package weaver.interfaces.wysecond; package weaver.interfaces.wysecond;
import com.engine.wysecond.util.FieldTransUtils;
import weaver.conn.RecordSetTrans;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.job.EducationLevelComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.location.LocationComInfo;
import weaver.interfaces.schedule.BaseCronJob; import weaver.interfaces.schedule.BaseCronJob;
import java.util.ArrayList;
import java.util.List;
/** /**
* @Author liang.cheng * @Author
* @Date 2025/4/1 18:04 * @Date 2025/4/1 18:04
* @Description: id * @Description: 87
* @Version 1.0 * @Version 1.0
*/ */
public class ResourceInfoSnipCron extends BaseCronJob { public class ResourceInfoSnipCron extends BaseCronJob {
@ -13,5 +26,236 @@ public class ResourceInfoSnipCron extends BaseCronJob {
@Override @Override
public void execute() { public void execute() {
RecordSet rs = new RecordSet();
//1.基本信息
String workPeopleType = rs.getPropValue("wysecond", "workPeopleType");
String workStatus = rs.getPropValue("wysecond", "workStatus");
String policy = rs.getPropValue("wysecond", "policy");
String landNumber = rs.getPropValue("wysecond", "landNumber");
String officeEmail = rs.getPropValue("wysecond", "officeEmail");
String position = rs.getPropValue("wysecond", "position");
String personType = rs.getPropValue("wysecond", "personType");
//2.个人信息
String age = rs.getPropValue("wysecond", "age");
String nation = rs.getPropValue("wysecond", "nation");
String birthplace = rs.getPropValue("wysecond", "birthplace");
String residenceAddress = rs.getPropValue("wysecond", "residenceAddress");
String currentAddress = rs.getPropValue("wysecond", "currentAddress");
String residenceType = rs.getPropValue("wysecond", "residenceType");
String maritalStatus = rs.getPropValue("wysecond", "maritalStatus");
String marryDate = rs.getPropValue("wysecond", "marryDate");
String religious = rs.getPropValue("wysecond", "religious");
String joinLeagueDate = rs.getPropValue("wysecond", "joinLeagueDate");
String joinPartyDate = rs.getPropValue("wysecond", "joinPartyDate");
String contactAddress = rs.getPropValue("wysecond", "contactAddress");
String mobile = rs.getPropValue("wysecond", "mobile");
String email = rs.getPropValue("wysecond", "email");
String emergencyName = rs.getPropValue("wysecond", "emergencyName");
String emergencyType = rs.getPropValue("wysecond", "emergencyType");
String emergencyPhone = rs.getPropValue("wysecond", "emergencyPhone");
String highEducation = rs.getPropValue("wysecond", "highEducation");
String highDegree = rs.getPropValue("wysecond", "highDegree");
String highMajor = rs.getPropValue("wysecond", "highMajor");
String schollType = rs.getPropValue("wysecond", "schollType");
String jobCall = rs.getPropValue("wysecond", "jobCall");
String schoolName = rs.getPropValue("wysecond", "schoolName");
//3.工作信息
String cardNumber = rs.getPropValue("wysecond", "cardNumber");
String bankName = rs.getPropValue("wysecond", "bankName");
String highPersonType = rs.getPropValue("wysecond", "highPersonType");
String identity = rs.getPropValue("wysecond", "identity");
String socialWorkYear = rs.getPropValue("wysecond", "socialWorkYear");
String partyPosition = rs.getPropValue("wysecond", "partyPosition");
String tradePosition = rs.getPropValue("wysecond", "tradePosition");
String trialStartDate = rs.getPropValue("wysecond", "trialStartDate");
String trialEndDate = rs.getPropValue("wysecond", "trialEndDate");
String regularDate = rs.getPropValue("wysecond", "regularDate");
String workStartDate = rs.getPropValue("wysecond", "workStartDate");
String graduatesJoin = rs.getPropValue("wysecond", "graduatesJoin");
String proTechnical = rs.getPropValue("wysecond", "proTechnical");
String proLevel = rs.getPropValue("wysecond", "proLevel");
String postionType = rs.getPropValue("wysecond", "postionType");
String postion = rs.getPropValue("wysecond", "postion");
String beStartDate = rs.getPropValue("wysecond", "beStartDate");
String beEndDate = rs.getPropValue("wysecond", "beEndDate");
String belongUnit = rs.getPropValue("wysecond", "belongUnit");
String interStartDate = rs.getPropValue("wysecond", "interStartDate");
String beJob = rs.getPropValue("wysecond", "beJob");
String interEndDate = rs.getPropValue("wysecond", "interEndDate");
String interLastDay = rs.getPropValue("wysecond", "interLastDay");
String onDegree = rs.getPropValue("wysecond", "onDegree");
String onMajor = rs.getPropValue("wysecond", "onMajor");
String onSchollType = rs.getPropValue("wysecond", "onSchollType");
String onSchollName = rs.getPropValue("wysecond", "onSchollName");
String classifiedLevel = rs.getPropValue("wysecond", "classifiedLevel");
String joinDeptDate = rs.getPropValue("wysecond", "joinDeptDate");
String joinJobDate = rs.getPropValue("wysecond", "joinJobDate");
String jobType = rs.getPropValue("wysecond", "jobType");
String skillLevel = rs.getPropValue("wysecond", "skillLevel");
String belongTeam = rs.getPropValue("wysecond", "belongTeam");
String teamLeader = rs.getPropValue("wysecond", "teamLeader");
String dingId = rs.getPropValue("wysecond", "dingId");
String month = DateUtil.getCurrentDate().substring(0,7);
String modeId = rs.getPropValue("wysecond", "modeId");
String currentDate = TimeUtil.getCurrentDateString();
String currentTime = TimeUtil.getOnlyCurrentTimeString();
DepartmentComInfo dept = new DepartmentComInfo();
JobTitlesComInfo job = new JobTitlesComInfo();
LocationComInfo location = new LocationComInfo();
EducationLevelComInfo education = new EducationLevelComInfo();
List<List<Object>> insertList = new ArrayList<>();
rs.executeQuery("select a.id,a.workcode,a.lastname,a.sex,b."+workPeopleType+" as workPeopleType,b."+workStatus+" as workStatus,\n" +
"b."+policy+" as policy,b."+landNumber+" as landNumber,b."+officeEmail+" as officeEmail,b."+position+" as position,b."+personType+" as personType,\n" +
"a.departmentid,a.jobtitle,a.loginid,a.accounttype,a.belongto,a.status,a.resourceimageid,a.locationid,\n" +
"a.certificatenum,a.birthday,c."+age+" as age,a.height,a.weight,c."+nation+" as nation,a.nativeplace,c."+birthplace+" as birthplace,a.healthinfo,\n" +
"c."+residenceAddress+" as residenceAddress,c."+currentAddress+" as currentAddress,c."+residenceType+" as residenceType,c."+maritalStatus+" as maritalStatus,\n" +
"c."+marryDate+" as marryDate,c."+religious+" as religious,c."+joinLeagueDate+" as joinLeagueDate,c."+joinPartyDate+" as joinPartyDate,\n" +
"c."+contactAddress+" as contactAddress,c."+mobile+" as mobile,c."+email+" as email,\n" +
"c."+emergencyName+" as emergencyName,c."+emergencyType+" as emergencyType,c."+emergencyPhone+" as emergencyPhone,c."+highEducation+" as highEducation,\n" +
"c."+highDegree+" as highDegree,c."+highMajor+" as highMajor,c."+schollType+" as schollType,c."+jobCall+" as jobCall,c."+schoolName+" as schoolName,\n" +
"d."+cardNumber+" as cardNumber,d."+bankName+" as bankName,d."+highPersonType+" as highPersonType,d."+identity+" as identity,a.workyear,d."+socialWorkYear+" as socialWorkYear,\n" +
"a.companyworkyear,d."+partyPosition+" as partyPosition,d."+tradePosition+" as tradePosition,a.companystartdate,a.startdate,\n" +
"a.enddate,d."+trialStartDate+" as trialStartDate,d."+trialEndDate+" as trialEndDate,d."+regularDate+" as regularDate,d."+workStartDate+" as workStartDate,\n" +
"d."+graduatesJoin+" as graduatesJoin,d."+proTechnical+" as proTechnical,d."+proLevel+" as proLevel,d."+postionType+" as postionType,d."+postion+" as postion,d."+beStartDate+" as beStartDate,\n" +
"d."+beEndDate+" as beEndDate,d."+belongUnit+" as belongUnit,d."+interStartDate+" as interStartDate,d."+beJob+" as beJob,d."+interEndDate+" as interEndDate,\n" +
"d."+interLastDay+" as interLastDay,d."+onDegree+" as onDegree,d."+onMajor+" as onMajor,d."+onSchollType+" as onSchollType,d."+onSchollName+" as onSchollName,d."+classifiedLevel+" as classifiedLevel,\n" +
"d."+joinDeptDate+" as joinDeptDate,d."+joinJobDate+" as joinJobDate,d."+jobType+" as jobType,d."+skillLevel+" as skillLevel,d."+belongTeam+" as belongTeam,d."+teamLeader+" as teamLeader,d."+dingId+" as dingId\n" +
"from hrmresource a \n" +
"left join cus_fielddata b on a.id = b.id and b.scopeid = -1 and b.scope = 'HrmCustomFieldByInfoType'\n" +
"left join cus_fielddata c on a.id = c.id and c.scopeid = 1 and c.scope = 'HrmCustomFieldByInfoType'\n" +
"left join cus_fielddata d on a.id = d.id and d.scopeid = 3 and d.scope = 'HrmCustomFieldByInfoType'");
while (rs.next()) {
List<Object> peopleList = new ArrayList<>();
peopleList.add(Util.getIntValue(rs.getString("id")));
peopleList.add(month);
peopleList.add(Util.null2String(rs.getString("workcode")));
peopleList.add(Util.null2String(rs.getString("lastname")));
peopleList.add(FieldTransUtils.selectHrmItem("sex",Util.getIntValue(rs.getString("sex")),"7"));
peopleList.add(FieldTransUtils.selectItemValue(workPeopleType.substring("field".length()),Util.getIntValue(rs.getString("workPeopleType")),"7"));
peopleList.add(FieldTransUtils.selectItemValue(workStatus.substring("field".length()),Util.getIntValue(rs.getString("workStatus")),"7"));
peopleList.add(FieldTransUtils.selectItemValue(policy.substring("field".length()),Util.getIntValue(rs.getString("policy")),"7"));
peopleList.add(Util.null2String(rs.getString("landNumber")));
peopleList.add(Util.null2String(rs.getString("officeEmail")));
peopleList.add(FieldTransUtils.selectItemValue(position.substring("field".length()),Util.getIntValue(rs.getString("position")),"7"));
peopleList.add(FieldTransUtils.selectItemValue(personType.substring("field".length()),Util.getIntValue(rs.getString("personType")),"7"));
peopleList.add(dept.getDepartmentname(Util.null2String(rs.getString("departmentid"))));
peopleList.add(job.getJobTitlesname(Util.null2String(rs.getString("jobtitle"))));
peopleList.add(Util.null2String(rs.getString("loginid")));
peopleList.add(FieldTransUtils.selectHrmItem("accounttype",Util.getIntValue(rs.getString("accounttype")),"7"));
peopleList.add(Util.getIntValue(rs.getString("belongto")));
peopleList.add(FieldTransUtils.selectHrmItem("status",Util.getIntValue(rs.getString("status")),"7"));
peopleList.add(Util.getIntValue(rs.getString("resourceimageid")));
peopleList.add(location.getLocationname(Util.null2String(rs.getString("locationid"))));
peopleList.add(Util.null2String(rs.getString("certificatenum")));
peopleList.add(Util.null2String(rs.getString("birthday")));
peopleList.add(Util.getIntValue(rs.getString("age")));
peopleList.add(Util.getIntValue(rs.getString("height")));
peopleList.add(Util.getIntValue(rs.getString("weight")));
peopleList.add(FieldTransUtils.selectNationName(Util.null2String(rs.getString("nation"))));
peopleList.add(Util.null2String(rs.getString("nativeplace")));
peopleList.add(Util.null2String(rs.getString("birthplace")));
peopleList.add(FieldTransUtils.selectHrmItem("healthinfo",Util.getIntValue(rs.getString("healthinfo")),"7"));
peopleList.add(Util.null2String(rs.getString("residenceAddress")));
peopleList.add(Util.null2String(rs.getString("currentAddress")));
peopleList.add(FieldTransUtils.selectItemValue(residenceType.substring("field".length()),Util.getIntValue(rs.getString("residenceType")),"7"));
peopleList.add(FieldTransUtils.selectItemValue(maritalStatus.substring("field".length()),Util.getIntValue(rs.getString("maritalStatus")),"7"));
peopleList.add(Util.null2String(rs.getString("marryDate")));
peopleList.add(FieldTransUtils.selectItemValue(religious.substring("field".length()),Util.getIntValue(rs.getString("religious")),"7"));
peopleList.add(Util.null2String(rs.getString("joinLeagueDate")));
peopleList.add(Util.null2String(rs.getString("joinPartyDate")));
peopleList.add(Util.null2String(rs.getString("contactAddress")));
peopleList.add(Util.null2String(rs.getString("mobile")));
peopleList.add(Util.null2String(rs.getString("email")));
peopleList.add(Util.null2String(rs.getString("emergencyName")));
peopleList.add(Util.null2String(rs.getString("emergencyType")));
peopleList.add(Util.null2String(rs.getString("emergencyPhone")));
peopleList.add(FieldTransUtils.selectItemValue(highEducation.substring("field".length()),Util.getIntValue(rs.getString("highEducation")),"7"));
peopleList.add(FieldTransUtils.selectItemValue(highDegree.substring("field".length()),Util.getIntValue(rs.getString("highDegree")),"7"));
peopleList.add(Util.null2String(rs.getString("highMajor")));
peopleList.add(FieldTransUtils.selectItemValue(schollType.substring("field".length()),Util.getIntValue(rs.getString("schollType")),"7"));
peopleList.add(FieldTransUtils.selectItemValue(jobCall.substring("field".length()),Util.getIntValue(rs.getString("jobCall")),"7"));
peopleList.add(Util.null2String(rs.getString("schoolName")));
peopleList.add(Util.null2String(rs.getString("cardNumber")));
peopleList.add(Util.null2String(rs.getString("bankName")));
peopleList.add(FieldTransUtils.selectItemValue(highPersonType.substring("field".length()),Util.getIntValue(rs.getString("highPersonType")),"7"));
peopleList.add(FieldTransUtils.selectItemValue(identity.substring("field".length()),Util.getIntValue(rs.getString("identity")),"7"));
peopleList.add(Util.null2String(rs.getString("workyear")));
peopleList.add(Util.null2String(rs.getString("socialWorkYear")));
peopleList.add(Util.null2String(rs.getString("companyworkyear")));
peopleList.add(Util.null2String(rs.getString("partyPosition")));
peopleList.add(Util.null2String(rs.getString("tradePosition")));
peopleList.add(Util.null2String(rs.getString("companystartdate")));
peopleList.add(Util.null2String(rs.getString("startdate")));
peopleList.add(Util.null2String(rs.getString("enddate")));
peopleList.add(Util.null2String(rs.getString("trialStartDate")));
peopleList.add(Util.null2String(rs.getString("trialEndDate")));
peopleList.add(Util.null2String(rs.getString("regularDate")));
peopleList.add(Util.null2String(rs.getString("workStartDate")));
peopleList.add(FieldTransUtils.selectItemValue(graduatesJoin.substring("field".length()),Util.getIntValue(rs.getString("graduatesJoin")),"7"));
peopleList.add(FieldTransUtils.selectItemValue(proTechnical.substring("field".length()),Util.getIntValue(rs.getString("proTechnical")),"7"));
peopleList.add(FieldTransUtils.selectItemValue(proLevel.substring("field".length()),Util.getIntValue(rs.getString("proLevel")),"7"));
peopleList.add(FieldTransUtils.selectPostionType(Util.null2String(rs.getString("postionType"))));
peopleList.add(FieldTransUtils.selectPostion(Util.null2String(rs.getString("postion"))));
peopleList.add(Util.null2String(rs.getString("beStartDate")));
peopleList.add(Util.null2String(rs.getString("beEndDate")));
peopleList.add(Util.null2String(rs.getString("belongUnit")));
peopleList.add(Util.null2String(rs.getString("interStartDate")));
peopleList.add(Util.null2String(rs.getString("beJob")));
peopleList.add(Util.null2String(rs.getString("interEndDate")));
peopleList.add(Util.null2String(rs.getString("interLastDay")));
peopleList.add(Util.formatMultiLang(education.getEducationLevelname(Util.null2String(rs.getString("onDegree"))),"7"));
peopleList.add(Util.null2String(rs.getString("onMajor")));
peopleList.add(FieldTransUtils.selectItemValue(onSchollType.substring("field".length()),Util.getIntValue(rs.getString("onSchollType")),"7"));
peopleList.add(Util.null2String(rs.getString("onSchollName")));
peopleList.add(FieldTransUtils.selectItemValue(classifiedLevel.substring("field".length()),Util.getIntValue(rs.getString("classifiedLevel")),"7"));
peopleList.add(Util.null2String(rs.getString("joinDeptDate")));
peopleList.add(Util.null2String(rs.getString("joinJobDate")));
peopleList.add(FieldTransUtils.selectItemValue(jobType.substring("field".length()),Util.getIntValue(rs.getString("jobType")),"7"));
peopleList.add(FieldTransUtils.selectItemValue(skillLevel.substring("field".length()),Util.getIntValue(rs.getString("skillLevel")),"7"));
peopleList.add(Util.null2String(rs.getString("belongTeam")));
peopleList.add(FieldTransUtils.selectItemValue(teamLeader.substring("field".length()),Util.getIntValue(rs.getString("teamLeader")),"7"));
peopleList.add(Util.null2String(rs.getString("dingId")));
peopleList.add(modeId);
peopleList.add(1);//创建人
peopleList.add(currentDate);
peopleList.add(currentTime);
insertList.add(peopleList);
}
RecordSetTrans rsTrans = new RecordSetTrans();
try {
rsTrans.setAutoCommit(false);
rsTrans.executeUpdate("delete from uf_resourcesnip where ny = ?",month);
//throw new RuntimeException("当月数据已存在,请去对应人员快照表删除后重新记录");
String sql = "insert into uf_resourcesnip(ryid,ny,bh,xm,xb,yglb,zgzt,zzmm,zjhm,bgyx,zw,rylb,bm,gw,dlm,zhlx,zzh,zt,zp,bgdd,sfzhm,csrq,nl,sg," +
"tz,mz,jg,csd,jkzk,hjdz,xtxdz,hklb,hyzk,lzsj,zjxy,rtsj,cjdpsj,lxzz,yddh,gryx,jjlxrxm,jjlxrgx,jjlxrdh,zgxl,zgxw,zgxlxlzy,byyxlx,zyjszgmc,zgxlxwbyyx," +
"yxkh,yxkhxqc,hzsgccrcxx,grsf,gl,kjshgl,sl,dnzw,ghzw,rzrq,htksrq,htjsrq,syqksrq,syqjzrq,zzrq,sccjgzsj,sfyjsrz,zyjszgxl,zyjszgjb,ywzwxl,ywzwcj," +
"pzqssj,pzzzsj,ldgxszdw,sxksrq,pzryszdwdrzwgw,sxdqrq,sxzhgzr,zdxl,zdzy,zdyxlx,zdyx,smdj,jrdqbmsj,jrdqgwsj,gwlb,zyjndj,szbz,sfwbzc,ddid,formmodeid," +
"modedatacreater,modedatacreatedate,modedatacreatetime) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," +
"?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
rsTrans.executeBatchSql(sql, insertList);
rsTrans.commit();
} catch (Exception e) {
rsTrans.rollback();
e.printStackTrace();
}
} }
} }

Loading…
Cancel
Save