出差流程没有外勤打卡不计算考勤

dev
chenwei 1 year ago
parent 6cf48877fe
commit b9ee2a3cd3

@ -898,6 +898,11 @@ public class KQFormatData extends BaseBean {
}
/*考勤二开--阶梯式记旷工start*/
//优化:先去除相同人员和日期的数据
RecordSet rs = new RecordSet();
String delSql = "delete from uf_AbnAttToComLeave where resourceid = '" + userId + "' and belongdate = '" + kqDate + "'";
bb.writeLog("优化 delSql" + delSql);
rs.executeUpdate(delSql );
//迟到、早退(注意严重迟到、严重早退的情况) belateMins--迟到 graveBeLateMins--严重迟到 leaveEarlyMins--早退 graveLeaveEarlyMins--严重早退
String changeBeforeData = "beLateMins:" + beLateMins + "graveBeLateMins:" + graveBeLateMins + "leaveEarlyMins:" + leaveEarlyMins + "graveLeaveEarlyMins:" + graveLeaveEarlyMins;
int abnormalMins = beLateMins + graveBeLateMins + leaveEarlyMins + graveLeaveEarlyMins;
@ -916,7 +921,7 @@ public class KQFormatData extends BaseBean {
leaveMins = 240;
//转事假
SskjUtil sskjUtil = new SskjUtil();
RecordSet rs = new RecordSet();
String toCusLeaveSql = "insert into uf_AbnAttToComLeave (resourceid, belongdate, duration, formmodeid, modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime, MODEUUID) values (?,?,?,?,?,?,?,?,?)";
Integer abnAttToComLeaveModeId = Util.getIntValue(Util.null2String(bb.getPropValue("project_sskj", "abnAttToComLeaveModeId")));
Integer modedatacreater = 1;

@ -97,7 +97,7 @@ public class KQReportBiz extends BaseBean {
}
return sectionMap;
}
/***
*
* @param resourceId
@ -372,19 +372,19 @@ public class KQReportBiz extends BaseBean {
datas.putAll(getSignDetailInfoData(params,user));
//考勤二开--增加补卡字段
basebean.writeLog("getDailyFlowData to do ");
datas.putAll(getDailyReissueCardData(params,user));
//考勤二开--加班申请情况
basebean.writeLog("getDailyFlowData appFprOvertime");
datas.putAll(getDailyAppForOvertimeData(params,user));
//考勤二开--转事假
basebean.writeLog("getDailyFlowData toComLeave");
datas.putAll(getDailyToComLeaveData(params,user));
//考勤二开--异常考勤转事假
basebean.writeLog("getDailyFlowData abnAttToComLeave");
datas.putAll(getDailyAbnAttToComLeaveData(params,user));
@ -412,23 +412,23 @@ public class KQReportBiz extends BaseBean {
//end
//考勤二开--加班申请情况
basebean.writeLog("getFlowData appFprOvertime");
datas.putAll(getAppForOvertimeData(params,user));
//考勤二开--转事假
basebean.writeLog("getFlowData getToComLeaveData");
datas.putAll(getToComLeaveData(params,user));
//考勤二开--统计公休时长
basebean.writeLog("getFlowData getHoliDurationData");
datas.putAll(getHoliDurationData(params,user));
//考勤二开--统计劳务工时
basebean.writeLog("getFlowData getLaborHoursData");
datas.putAll(getLaborHoursData(params,user));
//考勤二开--异常考勤转事假
basebean.writeLog("getFlowData getAbnAttToComLeaveData");
datas.putAll(getAbnAttToComLeaveData(params,user));
}catch (Exception e){
@ -491,10 +491,10 @@ public class KQReportBiz extends BaseBean {
//获取劳务工人员
List<String> empTypes = new ArrayList<>();
String empType = Util.null2String(PropBean.getUfPropValue("empType"),"field9");
basebean.writeLog("empType: " + empType);
String acqLaSql = "select id from cus_fielddata where scopeid = -1 and scope = 'HrmCustomFieldByInfoType' and " + empType + " = 1";
basebean.writeLog("acqLaSql: " + acqLaSql);
rs.executeQuery(acqLaSql);
while (rs.next()) {
@ -508,7 +508,7 @@ public class KQReportBiz extends BaseBean {
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
sql = "select a.attendancemins, a.resourceid, a.kqdate from kq_format_total a left join hrmresource b on a.resourceid = b.id " +
" where a.resourceid in (" + String.join(",", empTypes) + ") and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' " + sqlWhere;
basebean.writeLog("sql: " + sql);
rs.executeQuery(sql);
while (rs.next()) {
@ -642,12 +642,12 @@ public class KQReportBiz extends BaseBean {
/*考勤二开--公休时长统计start*/
String offdutyId = Util.null2String(PropBean.getUfPropValue("shift.offduty.id"),"7");
basebean.writeLog("offdutyId: " + offdutyId);
/*考勤二开--公休时长统计end*/
sql = " select a.resourceid, count(*) as number from kq_format_total a left join hrmresource b on b.id = a. resourceid" +
" where a.serialid = " + offdutyId + " " + sqlWhere;
basebean.writeLog("getHoliDurationData sql: " + sql);
rs.executeQuery(sql);
while (rs.next()) {
@ -702,7 +702,7 @@ public class KQReportBiz extends BaseBean {
}
if (resourceId.length() > 0) {
sqlWhere += " and c.resourceid in(" + resourceId + ") ";
sqlWhere += " and c.id in(" + resourceId + ") ";
}
if (viewScope.equals("4")) {//我的下属
@ -801,14 +801,17 @@ public class KQReportBiz extends BaseBean {
sql = sql = " select * from (select a.resourceId, a.duration, a.belongDate, b.subcompanyid1, b.departmentid, b.managerstr, b.managerid, b.loginid " +
" from uf_AbnAttToComLeave a left join hrmresource b on b.id = a.resourceid " +
" where a.belongdate >='" + fromDate + "' and a.belongdate <='" + toDate + "' ) c where 1=1 " + sqlWhere;
basebean.writeLog("getAbnAttToComLeaveData sql: " + sql);
rs.executeQuery(sql);
while (rs.next()) {
double duration = Util.getDoubleValue(Util.null2String(rs.getString("duration")));
String resId = Util.null2String(rs.getString("resourceId"));
if ( duration > 0.00){
double temp = Util.getDoubleValue(Util.null2String(datas.get("-AbnAttToComLeaveData|" + resId )));
if (temp <= 0.00) {
datas.put("-AbnAttToComLeaveData|" + resId , duration);
} else {
@ -879,15 +882,19 @@ public class KQReportBiz extends BaseBean {
sql = " select * from (select a.resourceId, a.duration, a.belongDate, b.subcompanyid1, b.departmentid, b.managerstr, b.managerid, b.loginid " +
" from uf_AbnAttToComLeave a left join hrmresource b on b.id = a.resourceid " +
" where a.belongdate >='" + fromDate + "' and a.belongdate <='" + toDate + "' ) c where 1=1 " + sqlWhere;
basebean.writeLog("getDailyAbnAttToComLeaveData sql: " + sql);
rs.executeQuery(sql);
while (rs.next()) {
double duration = Util.getDoubleValue(Util.null2String(rs.getString("duration")));
String kqdate = Util.null2String(rs.getString("belongDate"));
String resId = Util.null2String(rs.getString("resourceId"));
if ( duration > 0.00){
double temp = Util.getDoubleValue(Util.null2String(datas.get("DailyAbnAttToComLeaveData|" + resId + "|" + kqdate)));
if (temp <= 0.00) {
datas.put("DailyAbnAttToComLeaveData|" + resId + "|" + kqdate, duration);
} else {
@ -2204,15 +2211,10 @@ public class KQReportBiz extends BaseBean {
/*考勤二开--当前时间在当天班次下班点之前不显示旷工start*/
String nowDay = cn.hutool.core.date.DateUtil.format(new Date(), "yyyy-MM-dd");
String nowTime = cn.hutool.core.date.DateUtil.format(new Date(), "HH:mm");
basebean.writeLog("nowDay: " + nowDay);
basebean.writeLog("nowTime: " + nowTime);
basebean.writeLog("workenddate: " + workenddate);
basebean.writeLog("workendtime: " + kqTimesArrayComInfo.turn48to24Time(workendtime));
if (workenddate.equals(nowDay) && nowTime.compareTo(kqTimesArrayComInfo.turn48to24Time(workendtime)) < 0) {
signStatusInfo.put("isneedcal","1");
}
basebean.writeLog("signStatusInfo: " + signStatusInfo);
/*考勤二开--当前时间在当天班次下班点之前不显示旷工end*/
data.put(tmpkey+"signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
@ -2237,15 +2239,10 @@ public class KQReportBiz extends BaseBean {
/*考勤二开--当前时间在当天班次下班点之前不显示旷工start*/
String nowDay = cn.hutool.core.date.DateUtil.format(new Date(), "yyyy-MM-dd");
String nowTime = cn.hutool.core.date.DateUtil.format(new Date(), "HH:mm");
basebean.writeLog("nowDay: " + nowDay);
basebean.writeLog("nowTime: " + nowTime);
basebean.writeLog("workenddate: " + workenddate);
basebean.writeLog("workendtime: " + kqTimesArrayComInfo.turn48to24Time(workendtime));
if (workenddate.equals(nowDay) && nowTime.compareTo(kqTimesArrayComInfo.turn48to24Time(workendtime)) < 0) {
signStatusInfo.put("isneedcal","1");
}
basebean.writeLog("signStatusInfo: " + signStatusInfo);
/*考勤二开--当前时间在当天班次下班点之前不显示旷工end*/
data.put(tmpkey+"signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);

@ -111,20 +111,20 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
cascadekey = "absenteeismMins";
}else if(showColumn.equals("overtime")){
tmpShowColumns.add("overtime_4leave");
tmpShowColumns.add("overtime_nonleave");
tmpShowColumns.add("workingDayOvertime_nonleave");
// tmpShowColumns.add("overtime_nonleave");
// tmpShowColumns.add("workingDayOvertime_nonleave");
tmpShowColumns.add("workingDayOvertime_4leave");
tmpShowColumns.add("restDayOvertime_nonleave");
// tmpShowColumns.add("restDayOvertime_nonleave");
tmpShowColumns.add("restDayOvertime_4leave");
tmpShowColumns.add("holidayOvertime_4leave");
tmpShowColumns.add("holidayOvertime_nonleave");
// tmpShowColumns.add("holidayOvertime_nonleave");
}
if(cascadekey.length()>0){
tmpShowColumns.add(cascadekey);
}
}
showColumns = tmpShowColumns;
bb.writeLog("showColumns: " + showColumns);
String today = DateUtil.getCurrentDate();
if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
@ -267,7 +267,7 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
/*考勤二开--公休时长统计start*/
String offdutyId = Util.null2String(PropBean.getUfPropValue("shift.offduty.id"),"7");
bb.writeLog("offdutyId: " + offdutyId);
/*考勤二开--公休时长统计end*/
/*考勤二开--劳务工时start*/
@ -283,6 +283,33 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
}
}
/*考勤二开--劳务工时end*/
/*考勤二开--劳务公司start*/
//获取人员的劳务公司
Map<String, Object> resLabComMap = new HashMap<>();
String laborCompanies = Util.null2String(PropBean.getUfPropValue("laborCompanies"),"field25");
String acqResLaborComSql = "select id, " + laborCompanies + " from cus_fielddata where scopeid = 3 and scope = 'HrmCustomFieldByInfoType'";
rs.executeQuery(acqResLaborComSql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
String value = Util.null2String(rs.getString(laborCompanies));
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) {
resLabComMap.put(id, value);
}
}
bb.writeLog("resLabComMap: " + resLabComMap);
//获取所有劳务公司
Map<String, Object> laborCompaniesMap = new HashMap<>();
String acqLabComSql = "select id, gsmc from uf_lwgs ";
rs.executeQuery(acqLabComSql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
String value = Util.null2String(rs.getString("gsmc"));
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) {
laborCompaniesMap.put(id, value);
}
}
bb.writeLog("laborCompaniesMap: " + laborCompaniesMap);
/*考勤二开--劳务公司end*/
rs.execute(sql);
while (rs.next()) {
@ -300,7 +327,6 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
bb.writeLog("-=-=-fieldName: " + fieldName);
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
String fieldValue = "";
if(fieldName.equals("subcompany")){
@ -389,12 +415,12 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
data.add(fieldValue);
continue;
}else if ("appForOvertime".equals(fieldName)) {
bb.writeLog("appForOvertime");
LocalDate date = LocalDate.parse(kqdate, formatter);
LocalDate kqdateL = date.plusDays(1);
String kqdateN = kqdateL.format(formatter);
int intValue = Util.getIntValue(Util.null2String(flowData.get(id + "|" + kqdateN + "|" + "appForOvertime")));
bb.writeLog("intValue: " + intValue);
if (intValue == 1) {
data.add("正常");
@ -402,6 +428,28 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
data.add("异常");
}
continue;
} else if ("resourceType".equals(fieldName)) {//考勤二开--员工类型显示
int emp = Util.getIntValue(Util.null2String(empTypes.get(id)));
if(emp == 0) {
fieldValue = "正式工";
}else if(emp == 1) {
fieldValue = "劳务工";
}
data.add( fieldValue);
continue;
} else if ("laborCompanies".equals(fieldName)) {//考勤二开--员工劳务公司
String labCom = Util.null2String(resLabComMap.get(id));
bb.writeLog("劳务公司 labCom: " + labCom);
if (StringUtils.isNotBlank(labCom)) {
fieldValue = Util.null2String(laborCompaniesMap.get(labCom));
}
bb.writeLog("劳务公司 fieldValue: " + fieldValue);
data.add( fieldValue);
continue;
} else if(fieldName.equals("leave")){
//请假
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
@ -440,28 +488,28 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
}
/*考勤二开--转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
bb.writeLog("flowLeaveData: " + flowLeaveData);
double temp = Util.getDoubleValue(Util.null2String(flowData.get("DailyToComLeaveData|" + resourceId + "|" + kqdate)));
bb.writeLog("temp: " + temp);
if (temp >= 0.00) {
temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0)));
double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData));
flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp);
}
bb.writeLog("flowLeaveData: " + flowLeaveData);
}
/*考勤二开--转事假end*/
/*考勤二开--异常考勤转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
bb.writeLog("-flowLeaveData: " + flowLeaveData);
double temp = Util.getDoubleValue(Util.null2String(flowData.get("DailyAbnAttToComLeaveData|" + id + "|" + kqdate)));
bb.writeLog("-temp: " + temp);
if (temp >= 0.00) {
temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0)));
double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData));
flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp);
}
bb.writeLog("-flowLeaveData: " + flowLeaveData);
}
/*考勤二开--异常考勤转事假end*/
@ -528,23 +576,21 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
}
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
} else if ("holiDuration".equals(fieldName)) {//考勤二开--公休时长统计
bb.writeLog("holiDuration");
String serialid = Util.null2String(rs.getString("serialid"));
bb.writeLog("serialid: " + serialid);
if (offdutyId.equals(serialid)) {
fieldValue = "8";
} else {
fieldValue = "0";
}
bb.writeLog("fieldValue: " + fieldValue);
data.add(fieldValue);
continue;
} else if ("laborHours".equals(fieldName) ) {
bb.writeLog("laborHours");
bb.writeLog("fieldName: " + fieldName);
int emp = Util.getIntValue(Util.null2String(empTypes.get(id)));
bb.writeLog("id: " + id);
bb.writeLog("emp: " + emp);
if (emp == 1) {
double attendanceMins = Util.getDoubleValue(Util.null2String(rs.getString("attendanceMins")), 0.00);
double attendanceHours = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(String.valueOf(attendanceMins / 60.0)), 0.00);

@ -9,6 +9,7 @@ import com.engine.kq.biz.*;
import com.engine.kq.util.ExcelUtil;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.UtilKQ;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
@ -19,6 +20,7 @@ import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.sskj.comInfo.PropBean;
import weaver.systeminfo.SystemEnv;
import javax.servlet.http.HttpServletRequest;
@ -98,13 +100,13 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
cascadekey = "absenteeismMins";
}else if(showColumn.equals("overtime")){
tmpShowColumns.add("overtime_4leave");
tmpShowColumns.add("overtime_nonleave");
tmpShowColumns.add("workingDayOvertime_nonleave");
// tmpShowColumns.add("overtime_nonleave");
// tmpShowColumns.add("workingDayOvertime_nonleave");
tmpShowColumns.add("workingDayOvertime_4leave");
tmpShowColumns.add("restDayOvertime_nonleave");
// tmpShowColumns.add("restDayOvertime_nonleave");
tmpShowColumns.add("restDayOvertime_4leave");
tmpShowColumns.add("holidayOvertime_4leave");
tmpShowColumns.add("holidayOvertime_nonleave");
// tmpShowColumns.add("holidayOvertime_nonleave");
}
if(cascadekey.length()>0){
tmpShowColumns.add(cascadekey);
@ -295,6 +297,51 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
/*考勤二开--转事假start*/
String calLeaveId = bb.getPropValue("project_sskj", "calLeaveId");
/*考勤二开--转事假end*/
/*考勤二开--公休时长统计start*/
String offdutyId = Util.null2String(PropBean.getUfPropValue("shift.offduty.id"),"7");
/*考勤二开--公休时长统计end*/
/*考勤二开--劳务工时start*/
Map<String, Object> empTypes = new HashMap<>();
String empType = Util.null2String(PropBean.getUfPropValue("empType"),"field9");
String acqLaSql = "select id, " + empType + " from cus_fielddata where scopeid = -1 and scope = 'HrmCustomFieldByInfoType'";
rs.executeQuery(acqLaSql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
String empTypeValue = Util.null2String(rs.getString(empType));
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(empTypeValue)) {
empTypes.put(id, empTypeValue);
}
}
/*考勤二开--劳务工时end*/
/*考勤二开--劳务公司start*/
//获取人员的劳务公司
Map<String, Object> resLabComMap = new HashMap<>();
String laborCompanies = Util.null2String(PropBean.getUfPropValue("laborCompanies"),"field25");
String acqResLaborComSql = "select id, " + laborCompanies + " from cus_fielddata where scopeid = 3 and scope = 'HrmCustomFieldByInfoType'";
rs.executeQuery(acqResLaborComSql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
String value = Util.null2String(rs.getString(laborCompanies));
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) {
resLabComMap.put(id, value);
}
}
bb.writeLog("resLabComMap: " + resLabComMap);
//获取所有劳务公司
Map<String, Object> laborCompaniesMap = new HashMap<>();
String acqLabComSql = "select id, gsmc from uf_lwgs ";
rs.executeQuery(acqLabComSql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
String value = Util.null2String(rs.getString("gsmc"));
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) {
laborCompaniesMap.put(id, value);
}
}
bb.writeLog("laborCompaniesMap: " + laborCompaniesMap);
/*考勤二开--劳务公司end*/
rs.execute(sql);
while (rs.next()) {
@ -306,7 +353,7 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
String fieldValue = "";
if(fieldName.equals("nightdaysx") || fieldName.equals("nightdaysd") ) {
continue;
continue;
}
if (fieldName.equals("subcompany")) {
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
@ -384,17 +431,24 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
/*考勤二开--转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
bb.writeLog("ExportExcelCmd flowLeaveData start ");
bb.writeLog("flowLeaveData: " + flowLeaveData);
double temp = Util.getDoubleValue(Util.null2String(flowData.get("ToComLeaveData|" + resourceId)));
bb.writeLog("temp: " + temp);
if (temp >= 0.00) {
flowLeaveData = flowLeaveData + temp;
}
bb.writeLog("flowLeaveData: " + flowLeaveData);
}
/*考勤二开--转事假end*/
/*考勤二开--异常考勤转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
double temp = Util.getDoubleValue(Util.null2String(flowData.get("-AbnAttToComLeaveData|" + id )));
if (temp >= 0.00) {
temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0)));
double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData));
flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp);
}
}
/*考勤二开--异常考勤转事假end*/
data.add(flowLeaveData);
}
continue;
@ -406,7 +460,29 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
data.add("0");
}
continue;
}else if ("laborHours".equals(fieldName) ) {
} else if ("resourceType".equals(fieldName)) {//考勤二开--员工类型显示
int emp = Util.getIntValue(Util.null2String(empTypes.get(id)));
if(emp == 0) {
fieldValue = "正式工";
}else if(emp == 1) {
fieldValue = "劳务工";
}
data.add( fieldValue);
continue;
} else if ("laborCompanies".equals(fieldName)) {//考勤二开--员工劳务公司
String labCom = Util.null2String(resLabComMap.get(id));
bb.writeLog("劳务公司 labCom: " + labCom);
if (StringUtils.isNotBlank(labCom)) {
fieldValue = Util.null2String(laborCompaniesMap.get(labCom));
}
bb.writeLog("劳务公司 fieldValue: " + fieldValue);
data.add( fieldValue);
continue;
} else if ("laborHours".equals(fieldName) ) {
double holidayValue = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|holiday")), 0.00);
double workdayValue = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|workday")), 0.00);
@ -454,7 +530,7 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
continue;
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){

@ -241,7 +241,6 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
/*考勤二开--公休时长统计start*/
String offdutyId = Util.null2String(PropBean.getUfPropValue("shift.offduty.id"),"7");
bb.writeLog("offdutyId: " + offdutyId);
/*考勤二开--公休时长统计end*/
/*考勤二开--劳务工时start*/
@ -256,9 +255,36 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
empTypes.put(id, empTypeValue);
}
}
bb.writeLog("empTypes: " + empTypes);
/*考勤二开--劳务工时end*/
/*考勤二开--劳务公司start*/
//获取人员的劳务公司
Map<String, Object> resLabComMap = new HashMap<>();
String laborCompanies = Util.null2String(PropBean.getUfPropValue("laborCompanies"),"field25");
String acqResLaborComSql = "select id, " + laborCompanies + " from cus_fielddata where scopeid = 3 and scope = 'HrmCustomFieldByInfoType'";
rs.executeQuery(acqResLaborComSql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
String value = Util.null2String(rs.getString(laborCompanies));
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) {
resLabComMap.put(id, value);
}
}
bb.writeLog("resLabComMap: " + resLabComMap);
//获取所有劳务公司
Map<String, Object> laborCompaniesMap = new HashMap<>();
String acqLabComSql = "select id, gsmc from uf_lwgs ";
rs.executeQuery(acqLabComSql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
String value = Util.null2String(rs.getString("gsmc"));
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) {
laborCompaniesMap.put(id, value);
}
}
bb.writeLog("laborCompaniesMap: " + laborCompaniesMap);
/*考勤二开--劳务公司end*/
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
String fullPathMainKey = "show_full_path";
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
@ -330,14 +356,17 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
}
data.put(fieldName, fieldValue);
}else if(fieldName.equals("overtimeType")){
//根据id查询加班类型
String overtimeType = getOvertimeTypeById(id);
if("0".equals(overtimeType)){
overtimeType = "有加班费";
}else{
overtimeType = "无加班费";
}
fieldValue = overtimeType;
data.put(fieldName,fieldValue);
}else if(fieldName.equals("companystartdate")){
//根据id查询入职日期
@ -349,8 +378,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
Map<String, String> map = getEmployAndResignDateById(id);
fieldValue = map.get("resignDate");
data.put(fieldName,fieldValue);
}
else if (fieldName.equals("jobtitle")) {
} else if (fieldName.equals("jobtitle")) {
String fieldValueID = rs.getString("jobtitle");
fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle"));
if (fieldValue.length() == 0) {
@ -399,12 +427,12 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
}
}
} else if ("appForOvertime".equals(fieldName)) {
bb.writeLog("appForOvertime");
LocalDate date = LocalDate.parse(kqdate, formatter);
LocalDate kqdateL = date.plusDays(1);
String kqdateN = kqdateL.format(formatter);
int intValue = Util.getIntValue(Util.null2String(flowData.get(id + "|" + kqdateN + "|" + "appForOvertime")));
bb.writeLog("intValue: " + intValue);
if (intValue == 1) {
data.put(fieldName, "正常");
@ -412,25 +440,45 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
data.put(fieldName, "异常");
}
} else if ("holiDuration".equals(fieldName)) {//考勤二开--公休时长统计
bb.writeLog("holiDuration");
String serialid = Util.null2String(rs.getString("serialid"));
bb.writeLog("serialid: " + serialid);
if (offdutyId.equals(serialid)) {
fieldValue = "8";
} else {
fieldValue = "0";
}
bb.writeLog("fieldValue: " + fieldValue);
data.put(fieldName, fieldValue);
} else if ("resourceType".equals(fieldName)) {//考勤二开--员工类型显示
int emp = Util.getIntValue(Util.null2String(empTypes.get(id)));
if(emp == 0) {
fieldValue = "正式工";
}else if(emp == 1) {
fieldValue = "劳务工";
}
data.put(fieldName, fieldValue);
} else if ("laborCompanies".equals(fieldName)) {//考勤二开--员工劳务公司
String labCom = Util.null2String(resLabComMap.get(id));
bb.writeLog("劳务公司 labCom: " + labCom);
if (StringUtils.isNotBlank(labCom)) {
fieldValue = Util.null2String(laborCompaniesMap.get(labCom));
}
bb.writeLog("劳务公司 fieldValue: " + fieldValue);
data.put(fieldName, fieldValue);
} else if ("laborHours".equals(kqReportFieldComInfo.getParentid()) ) {
bb.writeLog("laborHours start ");
int emp = Util.getIntValue(Util.null2String(empTypes.get(id)));
bb.writeLog("emp: " + emp);
if (emp == 1) {
double attendanceMins = Util.getDoubleValue(Util.null2String(rs.getString("attendanceMins")), 0.00);
double attendanceHours = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(String.valueOf(attendanceMins / 60.0)), 0.00);
bb.writeLog("attendanceHours: " + attendanceHours);
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
@ -449,7 +497,6 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(attendanceHours + workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
bb.writeLog("fieldValue: " + fieldValue);
int changeType = KQOvertimeRulesBiz.getChangeType(id, kqdate);
@ -514,28 +561,29 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
}
/*考勤二开--转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
bb.writeLog("flowLeaveData: " + flowLeaveData);
double temp = Util.getDoubleValue(Util.null2String(flowData.get("DailyToComLeaveData|" + id + "|" + kqdate)));
bb.writeLog("temp: " + temp);
if (temp >= 0.00) {
temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0)));
double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData));
flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp);
}
bb.writeLog("flowLeaveData: " + flowLeaveData);
}
/*考勤二开--转事假end*/
/*考勤二开--异常考勤转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
bb.writeLog("-flowLeaveData: " + flowLeaveData);
double temp = Util.getDoubleValue(Util.null2String(flowData.get("DailyAbnAttToComLeaveData|" + id + "|" + kqdate)));
bb.writeLog("-temp: " + temp);
if (temp >= 0.00) {
temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0)));
double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData));
flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp);
}
bb.writeLog("-flowLeaveData: " + flowLeaveData);
}
/*考勤二开--异常考勤转事假end*/
data.put(flowType, flowLeaveData);
@ -589,6 +637,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
}
return str;
}
/*获取人员加班类型*/
private String getOvertimeTypeById(String id){
RecordSet rs = new RecordSet();
@ -601,6 +650,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
}
return field35;
}
/*获取人员入离职时间*/
private Map<String,String> getEmployAndResignDateById(String id){
RecordSet rs = new RecordSet();
@ -735,7 +785,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
String sql = "";
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
try{
bb.writeLog("-----getSignDetailInfo start-----");
sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " +
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
@ -744,7 +794,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
" order by serialnumber \n";
rs.execute(sql);
bb.writeLog("sql: " + sql);
while (rs.next()) {
String resourceid = Util.null2String(rs.getString("resourceid"));
String kqdate = Util.null2String(rs.getString("kqdate"));
@ -789,15 +839,12 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
/*考勤二开--当前时间在当天班次下班点之前不显示旷工start*/
String nowDay = DateUtil.format(new Date(), "yyyy-MM-dd");
String nowTime = DateUtil.format(new Date(), "HH:mm");
bb.writeLog("nowDay: " + nowDay);
bb.writeLog("nowTime: " + nowTime);
bb.writeLog("workenddate: " + workenddate);
bb.writeLog("workendtime: " + kqTimesArrayComInfo.turn48to24Time(workendtime));
if (workenddate.equals(nowDay) && nowTime.compareTo(kqTimesArrayComInfo.turn48to24Time(workendtime)) < 0) {
signStatusInfo.put("isneedcal","1");
}
bb.writeLog("signStatusInfo: " + signStatusInfo);
/*考勤二开--当前时间在当天班次下班点之前不显示旷工end*/
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
@ -820,15 +867,11 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
/*考勤二开--当前时间在当天班次下班点之前不显示旷工start*/
String nowDay = DateUtil.format(new Date(), "yyyy-MM-dd");
String nowTime = DateUtil.format(new Date(), "HH:mm");
bb.writeLog("nowDay: " + nowDay);
bb.writeLog("nowTime: " + nowTime);
bb.writeLog("workenddate: " + workenddate);
bb.writeLog("workendtime: " + kqTimesArrayComInfo.turn48to24Time(workendtime));
if (workenddate.equals(nowDay) && nowTime.compareTo(kqTimesArrayComInfo.turn48to24Time(workendtime)) < 0) {
signStatusInfo.put("isneedcal","1");
}
bb.writeLog("signStatusInfo: " + signStatusInfo);
/*考勤二开--当前时间在当天班次下班点之前不显示旷工end*/
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);

@ -8,6 +8,7 @@ import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.*;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.PageUidFactory;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
@ -18,6 +19,7 @@ import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.sskj.comInfo.PropBean;
import weaver.systeminfo.SystemEnv;
import java.math.BigDecimal;
@ -310,7 +312,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
sql = " select " + sql;
}
writeLog("howeccccccccccccggggggg10"+ System.currentTimeMillis());
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
String fullPathMainKey = "show_full_path";
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
@ -327,9 +329,52 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
/*考勤二开--转事假start*/
String calLeaveId = bb.getPropValue("project_sskj", "calLeaveId");
/*考勤二开--转事假end*/
/*考勤二开--公休时长统计start*/
String offdutyId = Util.null2String(PropBean.getUfPropValue("shift.offduty.id"),"7");
/*考勤二开--公休时长统计end*/
/*考勤二开--劳务公司start*/
//获取人员的劳务公司
Map<String, Object> resLabComMap = new HashMap<>();
String laborCompanies = Util.null2String(PropBean.getUfPropValue("laborCompanies"),"field25");
String acqResLaborComSql = "select id, " + laborCompanies + " from cus_fielddata where scopeid = 3 and scope = 'HrmCustomFieldByInfoType'";
rs.executeQuery(acqResLaborComSql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
String value = Util.null2String(rs.getString(laborCompanies));
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) {
resLabComMap.put(id, value);
}
}
bb.writeLog("resLabComMap: " + resLabComMap);
//获取所有劳务公司
Map<String, Object> laborCompaniesMap = new HashMap<>();
String acqLabComSql = "select id, gsmc from uf_lwgs ";
rs.executeQuery(acqLabComSql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
String value = Util.null2String(rs.getString("gsmc"));
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) {
laborCompaniesMap.put(id, value);
}
}
bb.writeLog("laborCompaniesMap: " + laborCompaniesMap);
/*考勤二开--劳务公司end*/
/*考勤二开--劳务工时start*/
Map<String, Object> empTypes = new HashMap<>();
String empType = Util.null2String(PropBean.getUfPropValue("empType"),"field9");
String acqLaSql = "select id, " + empType + " from cus_fielddata where scopeid = -1 and scope = 'HrmCustomFieldByInfoType'";
rs.executeQuery(acqLaSql);
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
String empTypeValue = Util.null2String(rs.getString(empType));
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(empTypeValue)) {
empTypes.put(id, empTypeValue);
}
}
/*考勤二开--劳务工时end*/
rs.execute(sql);
writeLog("howeccccccccccccggggggg11"+ System.currentTimeMillis());
while (rs.next()) {
data = new HashMap<>();
kqReportFieldComInfo.setTofirstRow();
@ -415,7 +460,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
} else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
if(fieldName.equals("overtimeTotal")){
writeLog("howeccccccccccccggggggg12"+ System.currentTimeMillis());
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
@ -464,7 +509,27 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
} else {
data.put(fieldName,"0");
}
} else if ("laborHours".equals(kqReportFieldComInfo.getParentid()) ) {
} else if ("resourceType".equals(fieldName)) {//考勤二开--员工类型显示
int emp = Util.getIntValue(Util.null2String(empTypes.get(id)));
if(emp == 0) {
fieldValue = "正式工";
}else if(emp == 1) {
fieldValue = "劳务工";
}
data.put(fieldName, fieldValue);
} else if ("laborCompanies".equals(fieldName)) {//考勤二开--员工劳务公司
String labCom = Util.null2String(resLabComMap.get(id));
bb.writeLog("劳务公司 labCom: " + labCom);
if (StringUtils.isNotBlank(labCom)) {
fieldValue = Util.null2String(laborCompaniesMap.get(labCom));
}
bb.writeLog("劳务公司 fieldValue: " + fieldValue);
data.put(fieldName, fieldValue);
}else if ("laborHours".equals(kqReportFieldComInfo.getParentid()) ) {
if ("laborHoursTotal".equals(fieldName)) {
//
@ -473,7 +538,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
double restdayValue = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|restday")), 0.00);
//
double total = holidayValue + workdayValue + restdayValue;
bb.writeLog("--total: " +total);
//
// data.put("holiday", holidayValue);
// data.put("workday", workdayValue);
@ -506,8 +571,8 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
data.put(fieldName,fieldValue);
}
bb.writeLog("--end data: " +data);
writeLog("howeccccccccccccggggggg13"+ System.currentTimeMillis());
//请假
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
Map<String, Object> leaveRule = null;
@ -536,7 +601,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
}catch (Exception e){
writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e);
}
writeLog("howeccccccccccccggggggg14"+ System.currentTimeMillis());
//考虑下冻结的数据
if(b_flowLeaveData.length() > 0){
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
@ -546,28 +611,29 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
/*考勤二开--转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
bb.writeLog("flowLeaveData: " + flowLeaveData);
double temp = Util.getDoubleValue(Util.null2String(flowData.get("-ToComLeaveData|" + id)));
bb.writeLog("temp: " + temp);
if (temp >= 0.00) {
temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0)));
double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData));
flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp);
}
bb.writeLog("flowLeaveData: " + flowLeaveData);
}
/*考勤二开--转事假end*/
/*考勤二开--异常考勤转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
bb.writeLog("-flowLeaveData: " + flowLeaveData);
double temp = Util.getDoubleValue(Util.null2String(flowData.get("-AbnAttToComLeaveData|" + id )));
bb.writeLog("-temp: " + temp);
if (temp >= 0.00) {
temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0)));
double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData));
flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp);
}
bb.writeLog("-flowLeaveData: " + flowLeaveData);
}
/*考勤二开--异常考勤转事假end*/
@ -645,7 +711,6 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
}
datas.add(data);
}
bb.writeLog("--datas: " +datas);
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
retmap.put("holidays", lsHolidays);

Loading…
Cancel
Save