|
|
|
@ -6,10 +6,8 @@ import com.engine.common.biz.AbstractCommonCommand;
|
|
|
|
|
import com.engine.common.entity.BizLogContext;
|
|
|
|
|
import com.engine.core.interceptor.CommandContext;
|
|
|
|
|
import com.engine.kq.biz.*;
|
|
|
|
|
import com.engine.kq.enums.KqSplitFlowTypeEnum;
|
|
|
|
|
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;
|
|
|
|
@ -20,20 +18,13 @@ 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;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import static com.api.formmode.cache.ModeExpandPageComInfo.groupid;
|
|
|
|
|
|
|
|
|
|
public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|
|
|
|
|
|
|
|
|
BaseBean bb = new BaseBean();
|
|
|
|
@ -319,7 +310,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();
|
|
|
|
@ -333,64 +324,12 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|
|
|
|
params.put("uintType",uintType);
|
|
|
|
|
params.put("hoursToDay",hoursToDay);
|
|
|
|
|
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
|
|
|
|
|
|
|
|
|
|
//考勤二开--请假时长
|
|
|
|
|
Map<String, Object> leaveInfos = getLeaveInfos(fromDate, toDate);
|
|
|
|
|
|
|
|
|
|
/*考勤二开--转事假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*/
|
|
|
|
|
/*考勤二开--入离职时间start*/
|
|
|
|
|
Map<String, Map<String, String>> employAndResignDates = getAllEmployAndResignDateById();
|
|
|
|
|
/*考勤二开--入离职时间end*/
|
|
|
|
|
|
|
|
|
|
bb.writeLog("汇总报表sql: " + sql);
|
|
|
|
|
|
|
|
|
|
rs.execute(sql);
|
|
|
|
|
|
|
|
|
|
writeLog("howeccccccccccccggggggg11"+ System.currentTimeMillis());
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
data = new HashMap<>();
|
|
|
|
|
kqReportFieldComInfo.setTofirstRow();
|
|
|
|
@ -428,82 +367,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|
|
|
|
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
|
|
|
|
|
|
|
|
|
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
|
|
|
|
}else if(fieldName.equals("firstLevelDepartment")){
|
|
|
|
|
//根据id查询多级部门信息
|
|
|
|
|
//String multiLevelDepartmentStr = getMultiLevelDepartmentById(id);
|
|
|
|
|
String departmentid = Util.null2String(rs.getString("departmentid"));
|
|
|
|
|
data.put("firstLevelDepartment",departmentid);
|
|
|
|
|
fieldValue = departmentComInfo.getDepartmentRealPath(departmentid, "/", "0");
|
|
|
|
|
String[] split = fieldValue.split("/");
|
|
|
|
|
if(split.length>=1){
|
|
|
|
|
fieldValue = split[0];
|
|
|
|
|
}else {
|
|
|
|
|
fieldValue = "";
|
|
|
|
|
}
|
|
|
|
|
}else if(fieldName.equals("secondaryDepartment")){
|
|
|
|
|
//根据id查询多级部门信息
|
|
|
|
|
//String multiLevelDepartmentStr = getMultiLevelDepartmentById(id);
|
|
|
|
|
String departmentid = Util.null2String(rs.getString("departmentid"));
|
|
|
|
|
data.put("secondaryDepartment",departmentid);
|
|
|
|
|
fieldValue = departmentComInfo.getDepartmentRealPath(departmentid, "/", "0");
|
|
|
|
|
String[] split = fieldValue.split("/");
|
|
|
|
|
if(split.length>=2){
|
|
|
|
|
fieldValue = split[1];
|
|
|
|
|
}else {
|
|
|
|
|
fieldValue = "";
|
|
|
|
|
}
|
|
|
|
|
}else if(fieldName.equals("thirdLevelDepartment")){
|
|
|
|
|
//根据id查询多级部门信息
|
|
|
|
|
//String multiLevelDepartmentStr = getMultiLevelDepartmentById(id);
|
|
|
|
|
String departmentid = Util.null2String(rs.getString("departmentid"));
|
|
|
|
|
data.put("thirdLevelDepartment",departmentid);
|
|
|
|
|
fieldValue = departmentComInfo.getDepartmentRealPath(departmentid, "/", "0");
|
|
|
|
|
String[] split = fieldValue.split("/");
|
|
|
|
|
if(split.length>=3){
|
|
|
|
|
fieldValue = split[2];
|
|
|
|
|
}else {
|
|
|
|
|
fieldValue = "";
|
|
|
|
|
}
|
|
|
|
|
}else if(fieldName.equals("fourthLevelDepartment")){
|
|
|
|
|
//根据id查询多级部门信息
|
|
|
|
|
//String multiLevelDepartmentStr = getMultiLevelDepartmentById(id);
|
|
|
|
|
String departmentid = Util.null2String(rs.getString("departmentid"));
|
|
|
|
|
data.put("fourthLevelDepartment",departmentid);
|
|
|
|
|
fieldValue = departmentComInfo.getDepartmentRealPath(departmentid, "/", "0");
|
|
|
|
|
String[] split = fieldValue.split("/");
|
|
|
|
|
if(split.length>=4){
|
|
|
|
|
fieldValue = split[3];
|
|
|
|
|
}else {
|
|
|
|
|
fieldValue = "";
|
|
|
|
|
}
|
|
|
|
|
}else if(fieldName.equals("overtimeType")){
|
|
|
|
|
writeLog("overtimeType123"+fieldName);
|
|
|
|
|
//根据id查询加班类别
|
|
|
|
|
String overtimeType = getOvertimeTypeById(id);
|
|
|
|
|
if("6".equals(overtimeType)){
|
|
|
|
|
overtimeType = "调休";
|
|
|
|
|
}else if("5".equals(overtimeType)){
|
|
|
|
|
overtimeType = "隔月发放";
|
|
|
|
|
}else if("4".equals(overtimeType)){
|
|
|
|
|
overtimeType = "当月发放";
|
|
|
|
|
}else {
|
|
|
|
|
overtimeType = "无";
|
|
|
|
|
}
|
|
|
|
|
data.put("overtimeType",overtimeType);
|
|
|
|
|
fieldValue = overtimeType;
|
|
|
|
|
}else if(fieldName.equals("companystartdate")){
|
|
|
|
|
//根据id查询入职日期
|
|
|
|
|
//Map<String, String> map = getEmployAndResignDateById(id);
|
|
|
|
|
Map<String, String> map = employAndResignDates.get(id);
|
|
|
|
|
data.put("companystartdate",map.get("companystartdate"));
|
|
|
|
|
fieldValue = map.get("companystartdate");
|
|
|
|
|
}else if(fieldName.equals("resignDate")){
|
|
|
|
|
//根据id查询离职日期
|
|
|
|
|
//Map<String, String> map = getEmployAndResignDateById(id);
|
|
|
|
|
Map<String, String> map = employAndResignDates.get(id);
|
|
|
|
|
data.put("resignDate",map.get("resignDate"));
|
|
|
|
|
fieldValue = map.get("resignDate");
|
|
|
|
|
} else if(fieldName.equals("jobtitle")){
|
|
|
|
|
}else if(fieldName.equals("jobtitle")){
|
|
|
|
|
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
|
|
|
|
if(tmpJobtitleId.length()==0){
|
|
|
|
|
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
|
|
|
@ -518,68 +382,10 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|
|
|
|
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
|
|
|
|
data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
|
|
|
|
}
|
|
|
|
|
}else if(fieldName.equals("reissuecard")){
|
|
|
|
|
int intValue = Util.getIntValue(Util.null2String(flowData.get(id + "|reissueCard")));
|
|
|
|
|
if (intValue < 0) {
|
|
|
|
|
fieldValue = "0";
|
|
|
|
|
} else {
|
|
|
|
|
fieldValue = String.valueOf(intValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else if(kqReportFieldComInfo.getParentid().equals("thisRemOt")){//当月加班剩余
|
|
|
|
|
if ("3".equals(typeselect) || "7".equals(typeselect)) {
|
|
|
|
|
Map<String, Object> allTiaoxius = getAllTiaoxius(id, fromDate, toDate);
|
|
|
|
|
if("workRemot".equals(fieldName)){
|
|
|
|
|
double max = Math.max(Util.getDoubleValue(Util.null2String(allTiaoxius.get("2"))), 0.00);
|
|
|
|
|
|
|
|
|
|
fieldValue = String.valueOf(max);
|
|
|
|
|
data.put(fieldName,fieldValue);
|
|
|
|
|
}
|
|
|
|
|
if("restRemot".equals(fieldName)){
|
|
|
|
|
double max = Math.max(Util.getDoubleValue(Util.null2String(allTiaoxius.get("3"))), 0.00);
|
|
|
|
|
|
|
|
|
|
fieldValue = String.valueOf(max);
|
|
|
|
|
data.put(fieldName,fieldValue);
|
|
|
|
|
}
|
|
|
|
|
if("holiRemot".equals(fieldName)){
|
|
|
|
|
double max = Math.max(Util.getDoubleValue(Util.null2String(allTiaoxius.get("1"))), 0.00);
|
|
|
|
|
|
|
|
|
|
fieldValue = String.valueOf(max);
|
|
|
|
|
data.put(fieldName,fieldValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if(kqReportFieldComInfo.getParentid().equals("lastRemOt")){//上月加班剩余
|
|
|
|
|
if ("3".equals(typeselect) || "7".equals(typeselect)) {
|
|
|
|
|
Map<String, Object> allTiaoxius = getLastAllTiaoxius(id, fromDate, toDate);
|
|
|
|
|
if("lastWorkRemot".equals(fieldName)){
|
|
|
|
|
double max = Math.max(Util.getDoubleValue(Util.null2String(allTiaoxius.get("2"))), 0.00);
|
|
|
|
|
|
|
|
|
|
bb.writeLog("lastWorkRemot max: " + max);
|
|
|
|
|
fieldValue = String.valueOf(max);
|
|
|
|
|
data.put(fieldName,fieldValue);
|
|
|
|
|
}
|
|
|
|
|
if("lastRestRemot".equals(fieldName)){
|
|
|
|
|
double max = Math.max(Util.getDoubleValue(Util.null2String(allTiaoxius.get("3"))), 0.00);
|
|
|
|
|
|
|
|
|
|
bb.writeLog("lastRestRemot max: " + max);
|
|
|
|
|
fieldValue = String.valueOf(max);
|
|
|
|
|
data.put(fieldName,fieldValue);
|
|
|
|
|
}
|
|
|
|
|
if("lastHoliRemot".equals(fieldName)){
|
|
|
|
|
double max = Math.max(Util.getDoubleValue(Util.null2String(allTiaoxius.get("1"))), 0.00);
|
|
|
|
|
|
|
|
|
|
bb.writeLog("lastHoliRemot max: " + max);
|
|
|
|
|
fieldValue = String.valueOf(max);
|
|
|
|
|
data.put(fieldName,fieldValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} 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")));
|
|
|
|
@ -621,113 +427,36 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|
|
|
|
}else{
|
|
|
|
|
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id+"|"+fieldName)));
|
|
|
|
|
}
|
|
|
|
|
} else if("holiDuration".equals(fieldName)){//考勤二开--公休工时
|
|
|
|
|
|
|
|
|
|
}else if("holiDuration".equals(fieldName)){
|
|
|
|
|
int intValue = Util.getIntValue(Util.null2String(flowData.get("HoliDurationData|" + id)));
|
|
|
|
|
|
|
|
|
|
if (intValue >= 0) {
|
|
|
|
|
fieldValue = String.valueOf(intValue);
|
|
|
|
|
|
|
|
|
|
data.put(fieldName,intValue);
|
|
|
|
|
} else {
|
|
|
|
|
fieldValue = "0";
|
|
|
|
|
data.put(fieldName,"0");
|
|
|
|
|
}
|
|
|
|
|
} else if("absenceDuration".equals(fieldName)){//考勤二开--缺勤工时
|
|
|
|
|
//缺勤工时 = 请假+公休+入离职工时
|
|
|
|
|
bb.writeLog("absenceDuration start ");
|
|
|
|
|
//请假
|
|
|
|
|
double leaveMins = Math.max(Util.getDoubleValue(Util.null2String(leaveInfos.get(id))), 0.00);
|
|
|
|
|
bb.writeLog("absenceDuration leaveMins: " + leaveMins);
|
|
|
|
|
BigDecimal leaveHours = new BigDecimal(leaveMins).divide(new BigDecimal(60), 2, RoundingMode.HALF_UP);
|
|
|
|
|
|
|
|
|
|
//公休
|
|
|
|
|
int hodHours = Math.max(Util.getIntValue(Util.null2String(flowData.get("HoliDurationData|" + id))),0) * 8;
|
|
|
|
|
bb.writeLog("absenceDuration hodHours: " + hodHours);
|
|
|
|
|
|
|
|
|
|
//入离职工时
|
|
|
|
|
int absenceDays = 0;
|
|
|
|
|
absenceDays = getStartOrEndDays(id, fromDate, toDate, typeselect, employAndResignDates);
|
|
|
|
|
bb.writeLog("absenceDuration absenceDays: " + absenceDays);
|
|
|
|
|
|
|
|
|
|
fieldValue = new BigDecimal(hodHours).add(new BigDecimal(absenceDays).multiply(new BigDecimal(8))).add(leaveHours)
|
|
|
|
|
.setScale(2, RoundingMode.HALF_UP).toString();
|
|
|
|
|
bb.writeLog("absenceDuration fieldValue: " + fieldValue);
|
|
|
|
|
|
|
|
|
|
data.put(fieldName,fieldValue);
|
|
|
|
|
} else if ("resourceType".equals(fieldName)) {//考勤二开--员工类型显示
|
|
|
|
|
} else if ("laborHours".equals(kqReportFieldComInfo.getParentid()) ) {
|
|
|
|
|
|
|
|
|
|
if ("laborHoursTotal".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);
|
|
|
|
|
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);
|
|
|
|
|
// data.put("restday", restdayValue);
|
|
|
|
|
fieldValue = String.valueOf(total);
|
|
|
|
|
|
|
|
|
|
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)) {//考勤二开--员工劳务公司
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
|
String labCom = Util.null2String(resLabComMap.get(id));
|
|
|
|
|
double temp = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|" + fieldName)), 0.00);
|
|
|
|
|
fieldValue = String.valueOf(temp);
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(labCom)) {
|
|
|
|
|
fieldValue = Util.null2String(laborCompaniesMap.get(labCom));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.put(fieldName, fieldValue);
|
|
|
|
|
} else if ("startOrEndDays".equals(fieldName)) {//考勤二开--入离职工时
|
|
|
|
|
int absenceDays = 0;
|
|
|
|
|
|
|
|
|
|
//优化--转成小时
|
|
|
|
|
absenceDays = getStartOrEndDays(id, fromDate, toDate, typeselect, employAndResignDates);
|
|
|
|
|
|
|
|
|
|
fieldValue = new BigDecimal(absenceDays).multiply(new BigDecimal(8)).setScale(2,RoundingMode.HALF_UP).toString();
|
|
|
|
|
|
|
|
|
|
data.put(fieldName, fieldValue);
|
|
|
|
|
} else if ("workmins".equals(fieldName)) {//考勤二开--应出勤时长
|
|
|
|
|
|
|
|
|
|
bb.writeLog("workMins id: " + id);
|
|
|
|
|
//入离职工时
|
|
|
|
|
int absenceDays = 0;
|
|
|
|
|
absenceDays = getStartOrEndDays(id, fromDate, toDate, typeselect, employAndResignDates);
|
|
|
|
|
bb.writeLog("workMins absenceDays: " + absenceDays);
|
|
|
|
|
|
|
|
|
|
fieldValue = new BigDecimal(Math.max(Util.getDoubleValue(Util.null2String(rs.getString("workMins"))),0.00)).add(new BigDecimal(absenceDays).multiply(new BigDecimal(480))).divide(new BigDecimal(60), 2, RoundingMode.HALF_UP).toString();
|
|
|
|
|
bb.writeLog("workMins fieldValue: " + fieldValue);
|
|
|
|
|
|
|
|
|
|
data.put(fieldName, fieldValue);
|
|
|
|
|
} else if ("workdays".equals(fieldName)) {//考勤二开--应出勤天数
|
|
|
|
|
|
|
|
|
|
//入离职工时
|
|
|
|
|
int absenceDays = 0;
|
|
|
|
|
absenceDays = getStartOrEndDays(id, fromDate, toDate, typeselect, employAndResignDates);
|
|
|
|
|
bb.writeLog("workdays absenceDays: " + absenceDays);
|
|
|
|
|
|
|
|
|
|
fieldValue = new BigDecimal(Math.max(Util.getDoubleValue(Util.null2String(rs.getString("workdays"))),0.00)).add(new BigDecimal(absenceDays)).setScale(2, RoundingMode.HALF_UP).toString();
|
|
|
|
|
bb.writeLog("workdays fieldValue: " + fieldValue);
|
|
|
|
|
|
|
|
|
|
data.put(fieldName, fieldValue);
|
|
|
|
|
} else if ("holidaylaborHours".equals(fieldName)) {//考勤二开--节假日劳务工时
|
|
|
|
|
double temp = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|" + fieldName)), 0.00);
|
|
|
|
|
fieldValue = String.valueOf(temp);
|
|
|
|
|
data.put(fieldName,fieldValue);
|
|
|
|
|
} else if ("workdaylaborHours".equals(fieldName)) {//考勤二开--工作日劳务工时
|
|
|
|
|
double temp = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|" + fieldName)), 0.00);
|
|
|
|
|
fieldValue = String.valueOf(temp);
|
|
|
|
|
data.put(fieldName,fieldValue);
|
|
|
|
|
} else if ("restdaylaborHours".equals(fieldName)) {//考勤二开--休息日劳务工时
|
|
|
|
|
double temp = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|" + fieldName)), 0.00);
|
|
|
|
|
fieldValue = String.valueOf(temp);
|
|
|
|
|
data.put(fieldName,fieldValue);
|
|
|
|
|
} else if ("laborHoursTotal".equals(fieldName) ) {//考勤二开--劳务工时总计
|
|
|
|
|
|
|
|
|
|
double holidayValue = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|holidaylaborHours")), 0.00);
|
|
|
|
|
double workdayValue = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|workdaylaborHours")), 0.00);
|
|
|
|
|
double restdayValue = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|restdaylaborHours")), 0.00);
|
|
|
|
|
double total = holidayValue + workdayValue + restdayValue;
|
|
|
|
|
|
|
|
|
|
fieldValue = String.valueOf(total);
|
|
|
|
|
|
|
|
|
|
data.put(fieldName,fieldValue);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
fieldValue = Util.null2String(rs.getString(fieldName));
|
|
|
|
@ -744,8 +473,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;
|
|
|
|
@ -774,7 +503,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);
|
|
|
|
@ -784,29 +513,28 @@ 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*/
|
|
|
|
|
|
|
|
|
@ -884,6 +612,7 @@ 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);
|
|
|
|
@ -902,95 +631,6 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|
|
|
|
return retmap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*获取人员多级部门*/
|
|
|
|
|
private String getMultiLevelDepartmentById(String id){
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String str = "总部";
|
|
|
|
|
String field31 = "";
|
|
|
|
|
String field32 = "";
|
|
|
|
|
String field33 = "";
|
|
|
|
|
String field34 = "";
|
|
|
|
|
String sql = "select field31,field32,field33,field34 from cus_fielddata where" +
|
|
|
|
|
" id = ? and scope='HrmCustomFieldByInfoType' and scopeid= -1";
|
|
|
|
|
rs.executeQuery(sql,id);
|
|
|
|
|
if(rs.next()){
|
|
|
|
|
field31 = Util.null2String(rs.getString("field31"));
|
|
|
|
|
field32 = Util.null2String(rs.getString("field32"));
|
|
|
|
|
field33 = Util.null2String(rs.getString("field33"));
|
|
|
|
|
field34 = Util.null2String(rs.getString("field34"));
|
|
|
|
|
}
|
|
|
|
|
if(!"".equals(field31)){
|
|
|
|
|
str = str+"/"+field31;
|
|
|
|
|
}else if(!"".equals(field32)){
|
|
|
|
|
str = str+"/"+field32;
|
|
|
|
|
}else if(!"".equals(field33)){
|
|
|
|
|
str = str+"/"+field33;
|
|
|
|
|
}else if(!"".equals(field34)){
|
|
|
|
|
str = str+"/"+field34;
|
|
|
|
|
}
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*获取人员加班类别*/
|
|
|
|
|
private String getOvertimeTypeById(String id){
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String field28 = "";
|
|
|
|
|
String sql = "select field28 from cus_fielddata where" +
|
|
|
|
|
" id = ? and scope='HrmCustomFieldByInfoType' and scopeid= 3";
|
|
|
|
|
rs.executeQuery(sql,id);
|
|
|
|
|
if(rs.next()){
|
|
|
|
|
field28 = Util.null2String(rs.getString("field28"));
|
|
|
|
|
}
|
|
|
|
|
return field28;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*获取人员入离职时间*/
|
|
|
|
|
private Map<String,Map<String,String>> getAllEmployAndResignDateById(){
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
Map<String,Map<String,String>> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
String companystartdate = "";//入职时间
|
|
|
|
|
String id = "";//人员
|
|
|
|
|
String created = "";//创建日期
|
|
|
|
|
String field30 = "";//离职时间
|
|
|
|
|
String sql = "select a.id, b.companystartdate,b.created,a.field30 from cus_fielddata a left join hrmresource b on" +
|
|
|
|
|
" a.id = b.id where a.scope='HrmCustomFieldByInfoType' and a.scopeid= 3 ";
|
|
|
|
|
rs.executeQuery(sql);
|
|
|
|
|
while (rs.next()){
|
|
|
|
|
id = Util.null2String(rs.getString("id"));
|
|
|
|
|
companystartdate = Util.null2String(rs.getString("companystartdate"));
|
|
|
|
|
created = Util.null2String(rs.getString("created"));
|
|
|
|
|
field30 = Util.null2String(rs.getString("field30"));
|
|
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
|
|
companystartdate = "".equals(companystartdate)?created:companystartdate;
|
|
|
|
|
map.put("companystartdate",companystartdate);
|
|
|
|
|
map.put("resignDate",field30);
|
|
|
|
|
result.put(id, map);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*获取人员入离职时间*/
|
|
|
|
|
private Map<String,String> getEmployAndResignDateById(String id){
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
|
|
String companystartdate = "";//入职时间
|
|
|
|
|
String created = "";//创建日期
|
|
|
|
|
String field30 = "";//离职时间
|
|
|
|
|
String sql = "select b.companystartdate,b.created,a.field30 from cus_fielddata a left join hrmresource b on" +
|
|
|
|
|
" a.id = b.id where a.scope='HrmCustomFieldByInfoType' and a.scopeid= 3 and a.id = ? ";
|
|
|
|
|
rs.executeQuery(sql,id);
|
|
|
|
|
if(rs.next()){
|
|
|
|
|
companystartdate = Util.null2String(rs.getString("companystartdate"));
|
|
|
|
|
created = Util.null2String(rs.getString("created"));
|
|
|
|
|
field30 = Util.null2String(rs.getString("field30"));
|
|
|
|
|
}
|
|
|
|
|
companystartdate = "".equals(companystartdate)?created:companystartdate;
|
|
|
|
|
map.put("companystartdate",companystartdate);
|
|
|
|
|
map.put("resignDate",field30);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
|
|
|
|
Map<String,Object> returnMap = new HashMap<>();
|
|
|
|
|
List<Object> lsChildColumns = new ArrayList<>();
|
|
|
|
@ -1036,8 +676,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|
|
|
|
lsChildColumns.add(column);
|
|
|
|
|
}
|
|
|
|
|
}else if(parentid.equals("overtime")){
|
|
|
|
|
// String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
|
|
|
|
String[] overtimeChild = {"overtime_4leave","overtimeTotal"};
|
|
|
|
|
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
|
|
|
|
for(int i=0;i<overtimeChild.length;i++){
|
|
|
|
|
String id = overtimeChild[i];
|
|
|
|
|
column = new HashMap();
|
|
|
|
@ -1132,288 +771,6 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|
|
|
|
return lsChildColumns;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取入离职工时
|
|
|
|
|
* @param resourceId
|
|
|
|
|
* @param startDate
|
|
|
|
|
* @param endDate
|
|
|
|
|
* @param groupDate
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public int getAbsenceDays(String resourceId, String startDate, String endDate, String groupDate){
|
|
|
|
|
int days = 0;
|
|
|
|
|
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
|
|
|
|
|
LocalDate startDateL = LocalDate.parse(startDate, formatter);
|
|
|
|
|
LocalDate endDateL = LocalDate.parse(endDate, formatter);
|
|
|
|
|
|
|
|
|
|
List<String> dates = new ArrayList<>();
|
|
|
|
|
LocalDate currentDate = startDateL;
|
|
|
|
|
|
|
|
|
|
while (!currentDate.isAfter(endDateL)) {
|
|
|
|
|
dates.add("'"+currentDate.format(formatter)+"'");
|
|
|
|
|
currentDate = currentDate.plusDays(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String selDates = String.join(",", dates);
|
|
|
|
|
int size = dates.size();
|
|
|
|
|
|
|
|
|
|
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
|
|
|
|
String groupid = Util.null2String(kqGroupMemberComInfo.getKQGroupId(resourceId, groupDate));
|
|
|
|
|
String acqNumberSql = "select count(*) as number from KQ_HolidaySet where groupid = " + groupid +" and changeType in (1,3) " +
|
|
|
|
|
"and holidayDate in ("+selDates+")";
|
|
|
|
|
bb.writeLog("acqNumberSql: " + acqNumberSql);
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
rs.executeQuery(acqNumberSql);
|
|
|
|
|
int number = 0;
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
number = Math.max(Util.getIntValue(Util.null2String(rs.getString("number"))), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
days = size - number;
|
|
|
|
|
|
|
|
|
|
return days;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取请假时长
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String, Object> getLeaveInfos(String startDate, String endDate){
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String acqLeaveSql = "select resourceid, sum(d_mins) as mins from kq_flow_split_leave " +
|
|
|
|
|
"where belongdate >='"+startDate+"' and belongdate <='"+endDate+"' " +
|
|
|
|
|
"group by resourceid " +
|
|
|
|
|
"order by resourceid ";
|
|
|
|
|
bb.writeLog("getLeaveInfos acqLeaveSql: " + acqLeaveSql);
|
|
|
|
|
rs.executeQuery(acqLeaveSql);
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String resourceid = Util.null2String(rs.getString("resourceid"));
|
|
|
|
|
String mins = Util.null2String(rs.getString("mins"));
|
|
|
|
|
result.put(resourceid, mins);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String acqLeaveBackSql = "select resourceid, sum(d_mins) as mins from kq_flow_split_leaveback " +
|
|
|
|
|
"where belongdate >='"+startDate+"' and belongdate <='"+endDate+"' " +
|
|
|
|
|
"group by resourceid " +
|
|
|
|
|
"order by resourceid ";
|
|
|
|
|
bb.writeLog("getLeaveInfos acqLeaveBackSql: " + acqLeaveBackSql);
|
|
|
|
|
rs.executeQuery(acqLeaveBackSql);
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String resourceid = Util.null2String(rs.getString("resourceid"));
|
|
|
|
|
int mins = Math.max(Util.getIntValue(Util.null2String(rs.getString("mins"))), 0);
|
|
|
|
|
if (mins > 0) {
|
|
|
|
|
int temp = Math.max(Util.getIntValue(Util.null2String(result.get(resourceid))), 0);
|
|
|
|
|
int remins = Math.max(temp - mins, 0);
|
|
|
|
|
result.put(resourceid, remins);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bb.writeLog("getLeaveInfos result: " + result);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 入离职工时
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public int getStartOrEndDays(String id, String fromDate, String toDate, String typeselect, Map<String, Map<String, String>> employAndResignDates){
|
|
|
|
|
int absenceDays = 0;
|
|
|
|
|
if ("3".equals(typeselect) || "7".equals(typeselect)) {
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
bb.writeLog("getStartOrEndDays employAndResignDates: " + JSONObject.toJSONString(employAndResignDates));
|
|
|
|
|
|
|
|
|
|
Map<String, String> tempMap = employAndResignDates.get(id);
|
|
|
|
|
String companystartdate = Util.null2String(tempMap.get("companystartdate"));
|
|
|
|
|
String resignDate = Util.null2String(tempMap.get("resignDate"));
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(companystartdate) && StringUtils.isBlank(resignDate)) {
|
|
|
|
|
String substring1 = companystartdate.substring(0, 7);
|
|
|
|
|
String substring2 = fromDate.substring(0, 7);
|
|
|
|
|
if (substring1.equals(substring2)) {
|
|
|
|
|
LocalDate companystartdateL = LocalDate.parse(companystartdate, formatter);
|
|
|
|
|
LocalDate localDate = companystartdateL.minusDays(1);
|
|
|
|
|
companystartdate = localDate.format(formatter);
|
|
|
|
|
|
|
|
|
|
absenceDays = getAbsenceDays(id, fromDate, companystartdate, toDate);
|
|
|
|
|
}
|
|
|
|
|
} else if (StringUtils.isBlank(companystartdate) && StringUtils.isNotBlank(resignDate)) {
|
|
|
|
|
String substring1 = resignDate.substring(0, 7);
|
|
|
|
|
String substring2 = toDate.substring(0, 7);
|
|
|
|
|
if (substring1.equals(substring2)) {
|
|
|
|
|
|
|
|
|
|
LocalDate resignDateL = LocalDate.parse(resignDate, formatter);
|
|
|
|
|
LocalDate localDate = resignDateL.plusDays(1);
|
|
|
|
|
resignDate = localDate.format(formatter);
|
|
|
|
|
|
|
|
|
|
absenceDays = getAbsenceDays(id, resignDate, toDate, fromDate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (StringUtils.isNotBlank(companystartdate) && StringUtils.isNotBlank(resignDate)) {
|
|
|
|
|
String substring1 = companystartdate.substring(0, 7);
|
|
|
|
|
String substring2 = resignDate.substring(0, 7);
|
|
|
|
|
String substring3 = fromDate.substring(0, 7);
|
|
|
|
|
String substring4 = toDate.substring(0, 7);
|
|
|
|
|
if ( substring1.equals(substring2) && substring2.equals(substring3)
|
|
|
|
|
&& substring3.equals(substring4) ) {//考勤月入职且离职
|
|
|
|
|
LocalDate resignDateL = LocalDate.parse(resignDate, formatter);
|
|
|
|
|
LocalDate localDate = resignDateL.plusDays(1);
|
|
|
|
|
resignDate = localDate.format(formatter);
|
|
|
|
|
|
|
|
|
|
LocalDate companystartdateL = LocalDate.parse(companystartdate, formatter);
|
|
|
|
|
LocalDate localDate1 = companystartdateL.minusDays(1);
|
|
|
|
|
companystartdate = localDate1.format(formatter);
|
|
|
|
|
|
|
|
|
|
int temp1 = getAbsenceDays(id, fromDate, companystartdate, toDate);
|
|
|
|
|
int temp2 = getAbsenceDays(id, resignDate, toDate, fromDate);
|
|
|
|
|
absenceDays = temp1 + temp2;
|
|
|
|
|
} else if (substring1.equals(substring3) && !substring2.equals(substring3)) {//考勤月入职,非考勤月离职
|
|
|
|
|
LocalDate companystartdateL = LocalDate.parse(companystartdate, formatter);
|
|
|
|
|
LocalDate localDate = companystartdateL.minusDays(1);
|
|
|
|
|
companystartdate = localDate.format(formatter);
|
|
|
|
|
|
|
|
|
|
absenceDays = getAbsenceDays(id, fromDate, companystartdate, toDate);
|
|
|
|
|
} else if ( !substring1.equals(substring3) && substring2.equals(substring3)){//非考勤月入职,考勤月离职
|
|
|
|
|
LocalDate resignDateL = LocalDate.parse(resignDate, formatter);
|
|
|
|
|
LocalDate localDate = resignDateL.plusDays(1);
|
|
|
|
|
resignDate = localDate.format(formatter);
|
|
|
|
|
|
|
|
|
|
absenceDays = getAbsenceDays(id, resignDate, toDate, fromDate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return absenceDays;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取各种类型的调休时长
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String, Object> getAllTiaoxius(String resourceid ,String fromdate, String todate) {
|
|
|
|
|
Map<String, Object> result = new HashMap<String, Object>();
|
|
|
|
|
String acqSql = "SELECT " +
|
|
|
|
|
" a.resourceid, " +
|
|
|
|
|
" GREATEST( SUM(COALESCE(extraamount, 0)) + SUM(COALESCE(tiaoxiuamount, 0)) - SUM(COALESCE(usedamount, 0)), 0.00000) AS difference_amounts, " +
|
|
|
|
|
" COALESCE(datetype, b.changetype) AS grouping_date, " +
|
|
|
|
|
" CASE " +
|
|
|
|
|
" WHEN datetype IS NOT NULL THEN datetype " +
|
|
|
|
|
" ELSE b.changetype " +
|
|
|
|
|
" END AS displayed_date " +
|
|
|
|
|
"FROM " +
|
|
|
|
|
" kq_balanceofleave a " +
|
|
|
|
|
"LEFT JOIN " +
|
|
|
|
|
" kq_flow_overtime b ON b.tiaoxiuid = a.id " +
|
|
|
|
|
"WHERE " +
|
|
|
|
|
" a.leaverulesid = 5 " +
|
|
|
|
|
" AND a.effectiveDate >= '"+fromdate+"' " +
|
|
|
|
|
" AND a.effectiveDate <= '"+todate+"' " +
|
|
|
|
|
" AND a.expirationDate >= '"+todate+"' " +
|
|
|
|
|
" AND a.resourceid = "+resourceid+" " +
|
|
|
|
|
"GROUP BY " +
|
|
|
|
|
" a.resourceid, " +
|
|
|
|
|
" COALESCE(datetype, b.changetype) " +
|
|
|
|
|
"ORDER BY " +
|
|
|
|
|
" grouping_date;";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
rs.executeQuery(acqSql);
|
|
|
|
|
while (rs.next()){
|
|
|
|
|
String differenceAmounts = Util.null2String(rs.getString("difference_amounts"));
|
|
|
|
|
String displayedDate = Util.null2String(rs.getString("displayed_date"));
|
|
|
|
|
if (StringUtils.isNotBlank(differenceAmounts) && StringUtils.isNotBlank(displayedDate)) {
|
|
|
|
|
result.put(displayedDate, differenceAmounts);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取上月各种类型的调休时长
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String, Object> getLastAllTiaoxius(String resourceid ,String fromdate, String todate) {
|
|
|
|
|
Map<String, Object> result = new HashMap<String, Object>();
|
|
|
|
|
Map<String, Object> lastMonthFirstAndLastDay = getLastMonthFirstAndLastDay(fromdate);
|
|
|
|
|
bb.writeLog("lastMonthFirstAndLastDay: " + lastMonthFirstAndLastDay);
|
|
|
|
|
|
|
|
|
|
if (lastMonthFirstAndLastDay != null && lastMonthFirstAndLastDay.size() > 0) {
|
|
|
|
|
String firstDay = Util.null2String(lastMonthFirstAndLastDay.get("firstDay"));
|
|
|
|
|
String lastDay = Util.null2String(lastMonthFirstAndLastDay.get("lastDay"));
|
|
|
|
|
if (StringUtils.isNotBlank(firstDay)) {
|
|
|
|
|
fromdate = firstDay;
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(lastDay)) {
|
|
|
|
|
todate = lastDay;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String acqSql = "SELECT " +
|
|
|
|
|
" a.resourceid, " +
|
|
|
|
|
" SUM(tiaoxiuamount) AS tiaoxiuamounts, " +
|
|
|
|
|
" SUM(usedamount) AS usedamounts, " +
|
|
|
|
|
" GREATEST( SUM(COALESCE(extraamount, 0)) + SUM(COALESCE(tiaoxiuamount, 0)) - SUM(COALESCE(usedamount, 0)), 0.00000) AS difference_amounts, " +
|
|
|
|
|
" COALESCE(datetype, b.changetype) AS grouping_date, " +
|
|
|
|
|
" CASE " +
|
|
|
|
|
" WHEN datetype IS NOT NULL THEN datetype " +
|
|
|
|
|
" ELSE b.changetype " +
|
|
|
|
|
" END AS displayed_date " +
|
|
|
|
|
"FROM " +
|
|
|
|
|
" kq_balanceofleave a " +
|
|
|
|
|
"LEFT JOIN " +
|
|
|
|
|
" kq_flow_overtime b ON b.tiaoxiuid = a.id " +
|
|
|
|
|
"WHERE " +
|
|
|
|
|
" a.leaverulesid = 5 " +
|
|
|
|
|
" AND a.effectiveDate >= '"+fromdate+"' " +
|
|
|
|
|
" AND a.effectiveDate <= '"+todate+"' " +
|
|
|
|
|
" AND a.expirationDate >= '"+todate+"' " +
|
|
|
|
|
" AND a.resourceid = "+resourceid+" " +
|
|
|
|
|
"GROUP BY " +
|
|
|
|
|
" a.resourceid, " +
|
|
|
|
|
" COALESCE(datetype, b.changetype) " +
|
|
|
|
|
"ORDER BY " +
|
|
|
|
|
" grouping_date;";
|
|
|
|
|
bb.writeLog("acqSql: " + acqSql);
|
|
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
rs.executeQuery(acqSql);
|
|
|
|
|
while (rs.next()){
|
|
|
|
|
String differenceAmounts = Util.null2String(rs.getString("difference_amounts"));
|
|
|
|
|
String displayedDate = Util.null2String(rs.getString("displayed_date"));
|
|
|
|
|
if (StringUtils.isNotBlank(differenceAmounts) && StringUtils.isNotBlank(displayedDate)) {
|
|
|
|
|
result.put(displayedDate, differenceAmounts);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bb.writeLog("result: " + result);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Map<String,Object> getLastMonthFirstAndLastDay(String dateString) {
|
|
|
|
|
|
|
|
|
|
Map<String,Object> result = new HashMap<String,Object>();
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
// 解析给定的日期字符串
|
|
|
|
|
LocalDate date = LocalDate.parse(dateString, formatter);
|
|
|
|
|
|
|
|
|
|
// 获取上个月的第一天
|
|
|
|
|
LocalDate firstDayOfLastMonth = date.with(TemporalAdjusters.firstDayOfMonth()).minusMonths(1);
|
|
|
|
|
|
|
|
|
|
// 获取上个月的最后一天
|
|
|
|
|
LocalDate lastDayOfLastMonth = date.with(TemporalAdjusters.lastDayOfMonth()).minusMonths(1);
|
|
|
|
|
|
|
|
|
|
// 格式化日期为字符串并返回
|
|
|
|
|
result.put("firstDay", firstDayOfLastMonth.format(formatter));
|
|
|
|
|
result.put("lastDay", lastDayOfLastMonth.format(formatter));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BizLogContext getLogContext() {
|
|
|
|
|
return null;
|
|
|
|
|