考勤报表迟到早退自定义列使用分钟显示

main
李栋 1 year ago
parent e0aab92179
commit 3467b26296

@ -292,9 +292,13 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
//补卡次数int
if (fieldName.equals("fillCard")) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(kqReportBiz.getFillCardCount(fromDate, toDate, id)));
} else if (fieldName.equals("attendancedays")) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(KqUtil.getAttendancedays(id, fromDate, toDate, user)));
data.add(fieldValue);
continue;
}
//哺乳假
else if(fieldName.equals("breastfeedLeave")){
else if (fieldName.equals("breastfeedLeave")) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(KqUtil.getBreastfeedLeave(fromDate, toDate, id)));
} else if (fieldName.equals("subcompany")) {
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
@ -469,10 +473,13 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
if (Util.null2String(rs.getString(lsCascadekey.get(i))).length() > 0) {
fieldid = KQReportFieldComInfo.field2Id.get(lsCascadekey.get(i));
//迟到早退使用分钟
if (lsCascadekey.get(i).contains("LateMins") || lsCascadekey.get(i).contains("EarlyMins")) {
String lsCascadeValue = lsCascadekey.get(i);
String unittype = kqReportFieldComInfo.getUnittype(fieldid);
if (unittype.equals("2")&&
(lsCascadeValue.contains("LateMins") || lsCascadeValue.contains("EarlyMins") || lsCascadeValue.contains("cd") || lsCascadeValue.contains("zt"))) {
fieldValue = rs.getString(lsCascadekey.get(i));
} else {
fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)), kqReportFieldComInfo.getUnittype(fieldid));
fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)), kqReportFieldComInfo.getUnittype(fieldid));
}
} else {
fieldValue = "0";
@ -736,11 +743,14 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
if (!kqReportFieldComInfo.getReportType().equals("month")) continue;
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))) {
title = new HashMap<>();
//二开 迟到使用分钟
if (kqReportFieldComInfo.getFieldname().contains("LateMins") || kqReportFieldComInfo.getFieldname().contains("EarlyMins")) {
//二开 迟到早退使用分钟
String fieldname = kqReportFieldComInfo.getFieldname();
String unittype = kqReportFieldComInfo.getUnittype();
if (unittype.equals("2") && (fieldname.contains("LateMins") || fieldname.contains("EarlyMins")
|| fieldname.contains("cd") || fieldname.contains("zt"))) {
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(分钟)");
} else {
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
}
title.put("width", 30 * 256);
titleList.add(title);

@ -129,7 +129,9 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
columnsInfo.stream().forEach(item -> {
Map<String, Object> map = (Map<String, Object>) item;
String title = (String) map.get("title");
if (title.contains("迟到时长") || title.contains("早退时长")) {
String dataIndex = (String) map.get("dataIndex");
String unit = (String) map.get("unit");
if ((title.contains("迟到时长") || title.contains("早退时长") || dataIndex.contains("zt") || dataIndex.contains("cd")) && unit.contains("小时")) {
map.put("title", title + "(分钟)");
map.put("unit", "");
}
@ -187,7 +189,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
//支援班次统计
String supportSerId = new BaseBean().getPropValue("nbkq_main", "supportSerId");
String backFields = " (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayworkdays," +
String backFields = " (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayworkdays," +
" (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid in (" + supportSerId + ") )as supportTotal," +
" (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," +
" (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," +
@ -439,10 +441,10 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
if (fieldValue.length() == 0) {
fieldValue = "0";
} else {
//2024-01-31 二开 迟到使用分钟
//2024-01-31 二开 迟到使用分钟 20240424迟到早退自定义列
writeLog("testreport-" + fieldName + fieldValue);
if (kqReportFieldComInfo.getUnittype().equals("2")
&& !fieldName.contains("LateMins") && !fieldName.contains("EarlyMins")) {
&& !fieldName.contains("LateMins") && !fieldName.contains("EarlyMins") && !fieldName.contains("cd") && !fieldName.contains("zt")) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
}
}
@ -598,6 +600,10 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
String breastfeedLeave = KQDurationCalculatorUtil.getDurationRound(String.valueOf(KqUtil.getBreastfeedLeave(fromDate, toDate, id)));
data.put("breastfeedLeave", breastfeedLeave);
//实际出勤天数
String attendancedays = KQDurationCalculatorUtil.getDurationRound(String.valueOf(KqUtil.getAttendancedays(id, fromDate, toDate, user)));
data.put("attendancedays", attendancedays);
//夜班补贴次数
String nightSubsidy = KQDurationCalculatorUtil.getDurationRound(String.valueOf(kqReportBiz.getNightSubsidyTotal(fromDate, toDate, id)));
data.put("nightSubsidy", nightSubsidy);

@ -1,13 +1,19 @@
package com.engine.kq.nbjh;
import com.alibaba.fastjson.JSON;
import com.engine.kq.biz.KQLeaveRulesComInfo;
import com.engine.kq.biz.KQWorkTime;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Map;
/**
* @Title
@ -18,6 +24,135 @@ import java.text.SimpleDateFormat;
*/
public class KqUtil {
/**
*
* @param resourceId
* @param fromdate
* @param todate
* @return
*/
public static double getAttendancedays(String resourceId,String fromdate,String todate,User user){
double result = 0.00;
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
RecordSet rs = new RecordSet();
String sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, "+
" leaveMins,leaveInfo,evectionMins,outMins " +
" from kq_format_detail " +
" where resourceid = ? and kqdate>=? and kqdate<=? "+
" order by resourceid, kqdate, serialnumber ";
rs.executeQuery(sql,resourceId,fromdate,todate);
while (rs.next()) {
String userid = rs.getString("resourceid");
String kqdate = rs.getString("kqdate");
int workMins = rs.getInt("workMins");
int beLateMins = rs.getInt("beLateMins");
int leaveEarlyMins = rs.getInt("leaveEarlyMins");
int graveBeLateMins = rs.getInt("graveBeLateMins");
int absenteeismMins = rs.getInt("absenteeismMins");
int graveLeaveEarlyMins = rs.getInt("graveLeaveEarlyMins");
int forgotCheckMins = rs.getInt("forgotCheckMins");
int forgotBeginWorkCheckMins = rs.getInt("forgotBeginWorkCheckMins");
int leaveMins = rs.getInt("leaveMins");
String leaveInfo = rs.getString("leaveInfo");
int evectionMins = rs.getInt("evectionMins");
int outMins = rs.getInt("outMins");
// 判断 指定日期 是否在 哺乳假流程 日期范围内
boolean bool = checkIsBetweenRange(userid,kqdate);
String text = "";
if (workMins<=0) {
if(text.length()>0) text +=" ";
text += SystemEnv.getHtmlLabelName(26593, user.getLanguage());
} else {
if (absenteeismMins > 0) {//旷工
if(text.length()>0) text+=" ";
text += SystemEnv.getHtmlLabelName(20085, user.getLanguage());
}else {
if (beLateMins > 0) {//迟到
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20081, user.getLanguage());
}
if (graveBeLateMins > 0) {//严重迟到
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(500546, user.getLanguage());
}
if (leaveEarlyMins > 0) {//早退
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20082, user.getLanguage());
}
if (graveLeaveEarlyMins > 0) {//严重早退
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(500547, user.getLanguage());
}
if (forgotCheckMins > 0) {//漏签
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20086, user.getLanguage());
}
if (forgotBeginWorkCheckMins > 0) {//漏签
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20086, user.getLanguage());
}
}
}
if (leaveMins > 0) {//请假
Map<String, Object> jsonObject = null;
if(leaveInfo.length()>0){
jsonObject = JSON.parseObject(leaveInfo);
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
String newLeaveType = entry.getKey();
String tmpLeaveMins = Util.null2String(entry.getValue());
if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){
if (text.length() > 0) text += " ";
text += Util.formatMultiLang( kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage());
}
}
}else{
if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) {
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(670, user.getLanguage());
}
}
}
if (evectionMins > 0) {//出差
if(text.indexOf(SystemEnv.getHtmlLabelName(20084, user.getLanguage()))==-1) {
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20084, user.getLanguage());
}
}
if (outMins > 0) {//公出
if(text.indexOf(SystemEnv.getHtmlLabelName(24058, user.getLanguage()))==-1) {
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(24058, user.getLanguage());
}
}
if(text.length()==0) {
result += 1;
}else{
//包含 漏签、早退、严重早退、迟到、严重迟到
if(checkHasSignInfo(userid,kqdate)) {
//当天有 哺乳假 或者 当天 在哺乳假的日期范围内
if(bool) {
result += 1;
}
}
}
}
rs.writeLog("================== KqUtil getAttendancedays ==================== "+ result);
return result;
}
public static boolean checkHasSignInfo(String userid,String date){
boolean bool = false;
RecordSet rs = new RecordSet();
rs.executeQuery("select * from HrmScheduleSign where userId=? and signDate=?",userid,date);
if(rs.next()){
bool = true;
}
return bool;
}
/**
*
* @param userid
@ -170,5 +305,21 @@ public class KqUtil {
return bool;
}
/**
* :
* @param a
* @param b
* @return
* String
*/
public static String floatAdd(String a, String b) {
a=a.equals("")?"0":a;
b=b.equals("")?"0":b;
BigDecimal bg1 = new BigDecimal(a);
BigDecimal bg2 = new BigDecimal(b);
BigDecimal bd = bg1.add(bg2);
return bd.toString();
}
}

Loading…
Cancel
Save