Compare commits
48 Commits
Author | SHA1 | Date |
---|---|---|
|
a4cfa1d307 | 1 year ago |
|
fb8689160d | 1 year ago |
|
280bd6d7fe | 1 year ago |
|
8a94de0d05 | 1 year ago |
|
3727c0a5db | 1 year ago |
|
a5de914ee9 | 1 year ago |
|
2fa5df47ab | 1 year ago |
|
e445596114 | 1 year ago |
|
c4b72324cb | 1 year ago |
|
29e8b1151f | 1 year ago |
|
99f62328cf | 1 year ago |
|
36601a10fb | 1 year ago |
|
60ca792a56 | 1 year ago |
|
5015d873d6 | 1 year ago |
|
677e414802 | 1 year ago |
|
52e0d2f699 | 1 year ago |
|
04b390e056 | 1 year ago |
|
ac4574470e | 1 year ago |
|
7bef807a51 | 1 year ago |
|
33722523d3 | 1 year ago |
|
93a9d1f237 | 1 year ago |
|
9285635aee | 1 year ago |
|
623fc926d2 | 1 year ago |
|
e853bde2d5 | 1 year ago |
|
30ebc44bb8 | 1 year ago |
|
dd07f9838e | 1 year ago |
|
bf0c6a2b46 | 1 year ago |
|
39c8d460cb | 1 year ago |
|
08f0477879 | 1 year ago |
|
435ac5bbfa | 1 year ago |
|
43dad8ee44 | 1 year ago |
|
ccfbb426ac | 1 year ago |
|
15ab092f8b | 1 year ago |
|
2066506e17 | 1 year ago |
|
5337fba611 | 1 year ago |
|
60659fe90d | 1 year ago |
|
2a6faf096e | 1 year ago |
|
ae383628d5 | 1 year ago |
|
7cb5afa79d | 1 year ago |
|
98b6e1847f | 1 year ago |
|
7a0a3e889c | 1 year ago |
|
f581a7d9da | 1 year ago |
|
24212fc10b | 1 year ago |
|
c808c6d907 | 1 year ago |
|
d2cf61fbb7 | 1 year ago |
|
81ac13a7b2 | 1 year ago |
|
4faaec7639 | 1 year ago |
|
321a7878d2 | 1 year ago |
@ -0,0 +1,2 @@
|
|||||||
|
# 餐补信息记录模块ID
|
||||||
|
cbxxjl_modeid=82
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,167 @@
|
|||||||
|
package weaver.interfaces.hostar.action;
|
||||||
|
|
||||||
|
import com.engine.kq.biz.KQFormatBiz;
|
||||||
|
import com.engine.kq.wfset.util.SplitActionUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import weaver.common.DateUtil;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.interfaces.workflow.action.Action;
|
||||||
|
import weaver.soa.workflow.request.Property;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class OutSignSyncAction implements Action {
|
||||||
|
|
||||||
|
BaseBean bb = new BaseBean();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo requestInfo) {
|
||||||
|
bb.writeLog("OutSignSyncAction-start");
|
||||||
|
String startDate = "";
|
||||||
|
String endDate = "";
|
||||||
|
String resourceid = "";
|
||||||
|
String nbtxr = "";
|
||||||
|
String sjjsrq = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Property[] properties = requestInfo.getMainTableInfo().getProperty();
|
||||||
|
for (Property property : properties) {
|
||||||
|
if ("ksrq".equals(property.getName())) {
|
||||||
|
startDate = Util.null2String(property.getValue());
|
||||||
|
}
|
||||||
|
if ("yjjsrq".equals(property.getName())) {
|
||||||
|
endDate = Util.null2String(property.getValue());
|
||||||
|
}
|
||||||
|
if ("sjccr".equals(property.getName())) {
|
||||||
|
resourceid = Util.null2String(property.getValue());
|
||||||
|
}
|
||||||
|
if ("nbtxr".equals(property.getName())) {
|
||||||
|
nbtxr = Util.null2String(property.getValue());
|
||||||
|
}
|
||||||
|
if ("sjjsrq".equals(property.getName())) {
|
||||||
|
sjjsrq = Util.null2String(property.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果实际结束日期不为空,则用实际结束日期
|
||||||
|
if (StringUtils.isNotBlank(sjjsrq)) {
|
||||||
|
endDate = sjjsrq;
|
||||||
|
}
|
||||||
|
bb.writeLog("start to handle data.");
|
||||||
|
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate) && StringUtils.isNotBlank(resourceid)) {
|
||||||
|
// 内部同行人也要考虑
|
||||||
|
if (StringUtils.isNotBlank(nbtxr)) {
|
||||||
|
resourceid = resourceid + "," + nbtxr;
|
||||||
|
}
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
List<String> infos = new ArrayList<>();
|
||||||
|
String acqOutSignSql = "select a.id, c.signinfo " +
|
||||||
|
"from mobile_sign a " +
|
||||||
|
"left join uf_outsigntype c " +
|
||||||
|
"on c.outsignid = a.id " +
|
||||||
|
"where operate_date >= '" + startDate + "' and operate_date <= '" + endDate + "' and operater in (?) ";
|
||||||
|
rs.executeQuery(acqOutSignSql, resourceid);
|
||||||
|
while (rs.next()) {
|
||||||
|
String signinfo = Util.null2String(rs.getString("signinfo"));
|
||||||
|
infos.add(signinfo);
|
||||||
|
}
|
||||||
|
bb.writeLog("infos is:" + infos);
|
||||||
|
for (String inf : infos) {
|
||||||
|
if (StringUtils.isNotEmpty(inf)) {
|
||||||
|
Map<String, Object> in = mapStringToMap(inf);
|
||||||
|
String userId = Util.null2String(in.get("userId"));
|
||||||
|
String userType = Util.null2String(in.get("userType"));
|
||||||
|
String signType = Util.null2String(in.get("signType"));
|
||||||
|
String signDate = Util.null2String(in.get("signDate"));
|
||||||
|
String signTime = Util.null2String(in.get("signTime"));
|
||||||
|
String clientAddress = Util.null2String(in.get("clientAddress"));
|
||||||
|
String isInCom = Util.null2String(in.get("isInCom"));
|
||||||
|
String timeZone = Util.null2String(in.get("timeZone"));
|
||||||
|
String belongdate = Util.null2String(in.get("belongdate"));
|
||||||
|
String signfrom = Util.null2String(in.get("signfrom"));
|
||||||
|
String longitude = Util.null2String(in.get("longitude"));
|
||||||
|
String latitude = Util.null2String(in.get("latitude"));
|
||||||
|
String address = Util.null2String(in.get("address"));
|
||||||
|
String deviceInfo = Util.null2String(in.get("deviceInfo"));
|
||||||
|
String belongdateIsNull = Util.null2String(in.get("belongdateIsNull"));
|
||||||
|
|
||||||
|
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,isdev) " +
|
||||||
|
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||||
|
boolean isok = rs.executeUpdate(punchSql, resourceid, userType, signType, signDate, signTime, clientAddress, isInCom,
|
||||||
|
timeZone, belongdate, signfrom, longitude, latitude, address, deviceInfo, "1");
|
||||||
|
bb.writeLog("isok: " + isok);
|
||||||
|
//同步更新考勤数据到考勤报表
|
||||||
|
if ("true".equals(belongdateIsNull)) {
|
||||||
|
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
|
||||||
|
bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + DateUtil.getYesterday());
|
||||||
|
new KQFormatBiz().formatDate("" + userId, DateUtil.getYesterday());
|
||||||
|
}
|
||||||
|
bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
|
||||||
|
if (belongdate.length() == 0) {
|
||||||
|
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
|
||||||
|
new KQFormatBiz().formatDate("" + userId, DateUtil.getYesterday());
|
||||||
|
}
|
||||||
|
new KQFormatBiz().formatDate("" + userId, (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
|
||||||
|
//外勤签到转的考勤 处理加班规则
|
||||||
|
SplitActionUtil.pushOverTimeTasksAll(belongdate, belongdate, "" + userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
bb.writeLog("OutSignSyncAction Exception: " + e.getMessage());
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, Object> mapStringToMap(String str) {
|
||||||
|
str = str.substring(1, str.length() - 1);
|
||||||
|
List<String> strs = splitString(str);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
for (String string : strs) {
|
||||||
|
String[] splits = string.split("=");
|
||||||
|
String key = splits[0];
|
||||||
|
String value = "";
|
||||||
|
if (splits.length > 1) {
|
||||||
|
value = splits[1];
|
||||||
|
}
|
||||||
|
// 去掉头部空格
|
||||||
|
String key1 = key.trim();
|
||||||
|
String value1 = value.trim();
|
||||||
|
map.put(key1, value1);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> splitString(String input) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
int braceLevel = 0;
|
||||||
|
int startIndex = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < input.length(); i++) {
|
||||||
|
char ch = input.charAt(i);
|
||||||
|
if (ch == '{') {
|
||||||
|
braceLevel++;
|
||||||
|
} else if (ch == '}') {
|
||||||
|
braceLevel--;
|
||||||
|
} else if (ch == ',' && braceLevel == 0) {
|
||||||
|
result.add(input.substring(startIndex, i));
|
||||||
|
startIndex = i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startIndex < input.length()) {
|
||||||
|
result.add(input.substring(startIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,98 @@
|
|||||||
|
package weaver.interfaces.hostar.job;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.engine.hostar.thread.HandleCBDataThread;
|
||||||
|
import com.engine.hostar.util.HostarUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.ThreadPoolUtil;
|
||||||
|
import weaver.interfaces.schedule.BaseCronJob;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 1.0
|
||||||
|
* @Title ecology-9
|
||||||
|
* @Company 泛微软件
|
||||||
|
* @CreateDate 2024/3/12
|
||||||
|
* @Description 更新餐补信息记录数据定时任务
|
||||||
|
* @Author AdminZm
|
||||||
|
*/
|
||||||
|
public class UpdateCbxxjlDataJob extends BaseCronJob {
|
||||||
|
|
||||||
|
BaseBean baseBean = new BaseBean();
|
||||||
|
|
||||||
|
private String ryParam;
|
||||||
|
|
||||||
|
private String startDate;
|
||||||
|
|
||||||
|
private String endDate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
baseBean.writeLog("UpdateCbxxjlDataJob start, param is:" + ryParam + "、" + startDate + "、" + endDate);
|
||||||
|
try {
|
||||||
|
String today = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||||
|
if (StringUtils.isEmpty(endDate)) {
|
||||||
|
endDate = today;
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(startDate)) {
|
||||||
|
startDate = today;
|
||||||
|
}
|
||||||
|
String date1 = String.valueOf(startDate);
|
||||||
|
String date2 = String.valueOf(endDate);
|
||||||
|
List<String> allDates = getAllDates(date1, date2);
|
||||||
|
baseBean.writeLog("UpdateCbxxjlDataJob allDatas:" + allDates);
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
List<String> userIds = new ArrayList<>();
|
||||||
|
if (StringUtils.isEmpty(ryParam) || StringUtils.equals(ryParam, "null")) {
|
||||||
|
baseBean.writeLog("1111.");
|
||||||
|
rs.executeQuery("select id from hrmresource");
|
||||||
|
while (rs.next()) {
|
||||||
|
userIds.add(rs.getString("id"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
baseBean.writeLog("2222.");
|
||||||
|
rs.executeQuery("select id from hrmresource where workcode = ?", ryParam);
|
||||||
|
while (rs.next()) {
|
||||||
|
userIds.add(rs.getString("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
baseBean.writeLog("userIds:" + userIds);
|
||||||
|
if ((CollectionUtils.isEmpty(userIds) && userIds.isEmpty()) || (CollectionUtils.isEmpty(allDates) && allDates.isEmpty())) {
|
||||||
|
baseBean.writeLog("no user or date.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExecutorService executorService = ThreadPoolUtil.getThreadPool(null, null);
|
||||||
|
for (String userId : userIds) {
|
||||||
|
for (String kqDate : allDates) {
|
||||||
|
executorService.execute(new HandleCBDataThread(userId, kqDate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (executorService.isTerminated()) {
|
||||||
|
executorService.shutdown();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
baseBean.writeLog("UpdateCbxxjlDataJob error:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllDates(String startDate, String endDate) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
LocalDate start = LocalDate.parse(startDate, formatter);
|
||||||
|
LocalDate end = LocalDate.parse(endDate, formatter);
|
||||||
|
while (!start.isAfter(end)) {
|
||||||
|
result.add(start.format(formatter));
|
||||||
|
start = start.plusDays(1);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue