58 lines
2.2 KiB
Java
58 lines
2.2 KiB
Java
package weaver.interfaces.zhuyou.action;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import weaver.conn.RecordSet;
|
|
import weaver.general.BaseBean;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @version 1.0
|
|
* @Title ecology-9
|
|
* @Company 泛微软件
|
|
* @CreateDate 2025/4/28
|
|
* @Description action处理调用方法
|
|
* @Author Lee
|
|
*/
|
|
public class ActionHandle {
|
|
|
|
public static void autoSchedule(String userId, String companyId, String effectiveDate, String kqGroupId, String kqType) {
|
|
BaseBean bb = new BaseBean();
|
|
try {
|
|
RecordSet rs = new RecordSet();
|
|
//查询考勤组成员表,无数据则新增
|
|
String sql = "select id from kq_groupmember where type=1 and typevalue=? and groupid=?";
|
|
rs.executeQuery(sql, userId, kqGroupId);
|
|
if (rs.getCounts() > 0) {
|
|
//do nothing
|
|
} else {
|
|
sql = "insert into kq_groupmember (type, typevalue, groupid, validatefrom, validateto) values (?,?,?,?,?)";
|
|
rs.executeUpdate(sql, 1, userId, kqGroupId, effectiveDate, "2999-12-31");
|
|
}
|
|
//每日班次查询
|
|
ArrayList<List> lists = new ArrayList<>();
|
|
sql = "select rq,zb from uf_gznl where rzgs=? and bb=? and rq>=? order by rq asc";
|
|
rs.executeQuery(sql, companyId, kqType, effectiveDate);
|
|
while (rs.next()) {
|
|
String rq = rs.getString("rq");
|
|
String zb = rs.getString("zb");
|
|
ArrayList<String> list = new ArrayList<>();
|
|
list.add(rq);
|
|
list.add(zb);
|
|
list.add(userId);
|
|
list.add(kqGroupId);
|
|
lists.add(list);
|
|
}
|
|
if (lists.size() > 0) {
|
|
sql = "delete from kq_shiftschedule where resourceid=? and kqdate>=?";
|
|
rs.executeUpdate(sql, userId, effectiveDate);
|
|
String insertSql = "insert into kq_shiftschedule (kqdate,serialid,resourceid,groupid)values(?,?,?,?)";
|
|
rs.executeBatchSql(insertSql, lists);
|
|
}
|
|
} catch (Exception e) {
|
|
bb.writeLog("autoSchedule-e-" + e.getMessage());
|
|
}
|
|
}
|
|
}
|