劳务转自招申请-归档同步人员卡片自定义字段

dev-chenwnj
howec 1 year ago
parent f5baa91e86
commit 0dfe105276

@ -0,0 +1,18 @@
package weaver.haikang.cronjob;
import weaver.integration.logging.Logger;
import weaver.integration.logging.LoggerFactory;
import weaver.interfaces.schedule.BaseCronJob;
public class FlowLaowuZzCron extends BaseCronJob {
private final Logger log = LoggerFactory.getLogger(FlowLaowuZzCron.class);
@Override
public void execute() {
log.error("劳务转自招申请开始定时任务开启-------");
new Thread( ()->{
FlowLaowuZzService flowLaowuZzService = new FlowLaowuZzService();
flowLaowuZzService.execute();
}).start();
log.error("劳务转自招申请开始定时任务结束-------");
}
}

@ -0,0 +1,114 @@
package weaver.haikang.cronjob;
import com.weaver.file.Prop;
import weaver.conn.RecordSet;
import weaver.integration.logging.Logger;
import weaver.integration.logging.LoggerFactory;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
public class FlowLaowuZzService {
private final Logger log = LoggerFactory.getLogger(FlowLaowuZzService.class);
private static final String zzzrzlx = Prop.getPropValue("FlowLaowuZz","zzzrzlx");
private static final String zzzsxrq = Prop.getPropValue("FlowLaowuZz","zzzsxrq");
private static final String zzzygxz = Prop.getPropValue("FlowLaowuZz","zzzygxz");
private static final String flowid = Prop.getPropValue("FlowLaowuZz","flowid");
private static final String flowtablename = Prop.getPropValue("FlowLaowuZz","flowtablename");
public synchronized void execute() {
String nowny = getNowNy();
RecordSet recordSeta = new RecordSet();
RecordSet recordSetb = new RecordSet();
RecordSet recordSetc = new RecordSet();
RecordSet recordSetd = new RecordSet();
RecordSet recordSetd1 = new RecordSet();
RecordSet recordSetb_0 = new RecordSet();
RecordSet recordSetb_1 = new RecordSet();
RecordSet recordSetb_3 = new RecordSet();
String sql1log = "select a.*, b.* from ( select workflowid, workflowtype, iscomplete, requestid, nodeid from workflow_currentoperator where iscomplete = 1 and WORKFLOWID = "+flowid+" group by requestid ) a inner join "+flowtablename+" b on a.requestid = b.requestId";
String sql = "select b.xm1,b.zzzsxrq from (select workflowid,workflowtype ,iscomplete ,requestid ,nodeid from workflow_currentoperator where iscomplete = 1 and WORKFLOWID = "+flowid+" group by requestid) a inner join "+flowtablename+" b on a.requestid = b.requestId";
log.error("sql::::::::::::1:"+sql1log);
recordSeta.executeQuery(sql);
while (recordSeta.next()) {
String uid = recordSeta.getString("xm1");
String date3 = recordSeta.getString("zzzsxrq");
if(uid.length()>0 && date3.length()>0) {
if(judgeRq(nowny,date3)) {
String sql3_0 = "select count(id) as nums from cus_fielddata where scopeid = 3 and scope = 'HrmCustomFieldByInfoType' and id = "+uid;
log.error("howec:::::::::::::::::1:"+sql3_0);
recordSetb_0.executeQuery(sql3_0);
recordSetb_0.next();
int nums = recordSetb_0.getInt("nums");
if(nums == 0) {
//新增
String insertsql = "insert into cus_fielddata("+zzzrzlx+","+zzzsxrq+",scopeid,scope,id) values (?,?,?,?,?)";
recordSetb_1.executeUpdate(insertsql,1,date3,3,"HrmCustomFieldByInfoType",uid);
log.error("howec:::::::::::::::::2:"+insertsql);
}else {
//更新
//更新个人信息
String sql3 = "select "+zzzrzlx+","+zzzsxrq+" from cus_fielddata where scopeid = 3 and scope = 'HrmCustomFieldByInfoType' and id = "+uid;
log.error("sql3 =::::::::::::3:"+sql3);
recordSetb.executeQuery(sql3);
while (recordSetb.next()) {
String zzzrzlx1 = recordSetb.getString(zzzrzlx);//入职类型
String zzzsxrq1 = recordSetb.getString(zzzsxrq);//转入职生效日期
if(!("1".equals(zzzrzlx1))) {
String sql4 = "update cus_fielddata set "+zzzrzlx+" = '1' , "+zzzsxrq+" = '"+date3+"' where scopeid = 3 and scope = 'HrmCustomFieldByInfoType' and id = "+uid;
recordSetc.executeUpdate(sql4);
log.error("sql4 =::::::::::::4:"+sql4);
}
}
}
String sql4_0 = "select count(id) as nums from cus_fielddata where scopeid = -1 and scope = 'HrmCustomFieldByInfoType' and id = "+uid;
log.error("howec:::::::::::::::::3:"+sql4_0);
recordSetb_3.executeQuery(sql4_0);
recordSetb_3.next();
int nums1 = recordSetb_3.getInt("nums");
if(nums1 == 0) {
String insertsql = "insert into cus_fielddata("+zzzygxz+",scopeid,scope,id) values (?,?,?,?)";
recordSetb_1.executeUpdate(insertsql,1,-1,"HrmCustomFieldByInfoType",uid);
log.error("howec:::::::::::::::::5:"+insertsql);
}else {
String sqlx = "select "+zzzygxz+" from cus_fielddata where scopeid = -1 and scope = 'HrmCustomFieldByInfoType' and id = "+uid;
log.error("howec:::::::::::::::::6:"+sqlx);
recordSetd1.executeQuery(sqlx);
recordSetd1.next();
String zzzygxz2 = recordSetd1.getString(zzzygxz);
if(zzzygxz2.length() == 0) {
String sql5 = "update cus_fielddata set "+zzzygxz+" = '1' where scopeid = -1 and scope = 'HrmCustomFieldByInfoType' and id = "+uid;
recordSetd.executeUpdate(sql5);
log.error("sql5 =::::::::::::5:"+sql5);
}
}
}
}
}
}
private boolean judgeRq(String now,String jl) {
LocalDate d1 = LocalDate.parse(now);
LocalDate d2 = LocalDate.parse(jl);
if (d1.isBefore(d2)) {
return false;
} else if (d1.isAfter(d2)) {
return true;
} else {
return true;
}
}
private String getNowNy() {
LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String previousMonthString = currentDate.format(formatter);
return previousMonthString;
}
}
Loading…
Cancel
Save