@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand ;
import com.engine.common.biz.AbstractCommonCommand ;
import com.engine.common.entity.BizLogContext ;
import com.engine.common.entity.BizLogContext ;
import com.engine.core.interceptor.CommandContext ;
import com.engine.core.interceptor.CommandContext ;
import com.engine.kq.biz. * ;
import com.engine.kq.biz. KQReportBiz ;
import com.engine.kq.util.KQDurationCalculatorUtil ;
import com.engine.kq.util.KQDurationCalculatorUtil ;
import com.engine.kq.util.PageUidFactory ;
import com.engine.kq.util.PageUidFactory ;
import weaver.common.DateUtil ;
import weaver.common.DateUtil ;
@ -23,7 +23,6 @@ import weaver.systeminfo.SystemEnv;
import java.math.BigDecimal ;
import java.math.BigDecimal ;
import java.text.ParseException ;
import java.text.ParseException ;
import java.text.SimpleDateFormat ;
import java.text.SimpleDateFormat ;
import java.time.LocalDate ;
import java.util.* ;
import java.util.* ;
public class GetKQReportCmd extends AbstractCommonCommand < Map < String , Object > > {
public class GetKQReportCmd extends AbstractCommonCommand < Map < String , Object > > {
@ -44,12 +43,11 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
String pageUid = PageUidFactory . getHrmPageUid ( "KQReport" ) ;
String pageUid = PageUidFactory . getHrmPageUid ( "KQReport" ) ;
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo ( ) ;
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo ( ) ;
DepartmentComInfo departmentComInfo = new DepartmentComInfo ( ) ;
DepartmentComInfo departmentComInfo = new DepartmentComInfo ( ) ;
ResourceComInfo resourceComInfo = new ResourceComInfo ( ) ;
ResourceComInfo resourceComInfo = new ResourceComInfo ( ) ;
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo ( ) ;
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo ( ) ;
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz ( ) ;
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz ( ) ;
KQReportBiz kqReportBiz = new KQReportBiz ( ) ;
KQReportBiz kqReportBiz = new KQReportBiz ( ) ;
JSONObject jsonObj = JSON . parseObject ( Util . null2String ( params . get ( "data" ) ) ) ;
JSONObject jsonObj = JSON . parseObject ( Util . null2String ( params . get ( "data" ) ) ) ;
String attendanceSerial = Util . null2String ( jsonObj . get ( "attendanceSerial" ) ) ;
String attendanceSerial = Util . null2String ( jsonObj . get ( "attendanceSerial" ) ) ;
String fromDate = Util . null2String ( jsonObj . get ( "fromDate" ) ) ;
String fromDate = Util . null2String ( jsonObj . get ( "fromDate" ) ) ;
@ -101,7 +99,6 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
if ( KQReportFieldComInfo . cascadekey2fieldname . keySet ( ) . contains ( kqReportFieldComInfo . getFieldname ( ) ) ) continue ;
if ( KQReportFieldComInfo . cascadekey2fieldname . keySet ( ) . contains ( kqReportFieldComInfo . getFieldname ( ) ) ) continue ;
if ( ! kqReportFieldComInfo . getReportType ( ) . equals ( "all" ) & & ! kqReportFieldComInfo . getReportType ( ) . equals ( "month" ) ) continue ;
if ( ! kqReportFieldComInfo . getReportType ( ) . equals ( "all" ) & & ! kqReportFieldComInfo . getReportType ( ) . equals ( "month" ) ) continue ;
if ( "leave" . equalsIgnoreCase ( kqReportFieldComInfo . getFieldname ( ) ) & & leaveRules . size ( ) = = 0 ) continue ;
if ( "leave" . equalsIgnoreCase ( kqReportFieldComInfo . getFieldname ( ) ) & & leaveRules . size ( ) = = 0 ) continue ;
column = new HashMap ( ) ;
column = new HashMap ( ) ;
column . put ( "title" , SystemEnv . getHtmlLabelNames ( kqReportFieldComInfo . getFieldlabel ( ) , user . getLanguage ( ) ) ) ;
column . put ( "title" , SystemEnv . getHtmlLabelNames ( kqReportFieldComInfo . getFieldlabel ( ) , user . getLanguage ( ) ) ) ;
column . put ( "unit" , KQReportBiz . getUnitType ( kqReportFieldComInfo , user ) ) ;
column . put ( "unit" , KQReportBiz . getUnitType ( kqReportFieldComInfo , user ) ) ;
@ -124,20 +121,19 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
columns . addAll ( this . getCascadeKeyColumnsInfo ( kqReportFieldComInfo . getCascadekey ( ) , user ) ) ;
columns . addAll ( this . getCascadeKeyColumnsInfo ( kqReportFieldComInfo . getCascadekey ( ) , user ) ) ;
}
}
//Liuhao 新增列[ 夜班天数] --begin
//Liuhao 新增列[ 大 夜班天数] --begin
column = new HashMap ( ) ;
column = new HashMap ( ) ;
column . put ( "title" , " 夜班天数") ;
column . put ( "title" , " 大 夜班天数") ;
column . put ( "unit" , "天" ) ;
column . put ( "unit" , "天" ) ;
column . put ( "dataIndex" , "nightdays ") ;
column . put ( "dataIndex" , "nightdays d ") ;
column . put ( "type" , "businessLeave" ) ;
column . put ( "type" , "businessLeave" ) ;
column . put ( "key" , "nightdays ") ;
column . put ( "key" , "nightdays d ") ;
column . put ( "isSystem" , "1" ) ;
column . put ( "isSystem" , "1" ) ;
column . put ( "rowSpan" , "3" ) ;
column . put ( "rowSpan" , "3" ) ;
column . put ( "width" , 65 ) ;
column . put ( "width" , 65 ) ;
column . put ( "showDetial" , "1" ) ;
column . put ( "showDetial" , "1" ) ;
columns . add ( column ) ;
columns . add ( column ) ;
//Liuhao 新增列[夜班天数] --end
//Liuhao 新增列[夜班天数] --end
boolean isEnd = false ;
boolean isEnd = false ;
Calendar cal = DateUtil . getCalendar ( ) ;
Calendar cal = DateUtil . getCalendar ( ) ;
String today = DateUtil . getCurrentDate ( ) ;
String today = DateUtil . getCurrentDate ( ) ;
@ -176,26 +172,25 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
columns . add ( column ) ;
columns . add ( column ) ;
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) " ;
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) " ;
if ( rs . getDBType ( ) . equalsIgnoreCase ( "oracle" ) ) {
if ( rs . getDBType ( ) . equalsIgnoreCase ( "oracle" ) ) {
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) " ;
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) " ;
} else if ( ( rs . getDBType ( ) ) . equalsIgnoreCase ( "mysql" ) ) {
} else if ( ( rs . getDBType ( ) ) . equalsIgnoreCase ( "mysql" ) ) {
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) " ;
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) " ;
} else {
} else {
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) " ;
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) " ;
}
}
Map < String , Object > definedFieldInfo = new KQFormatBiz ( ) . getDefinedField ( ) ;
Map < String , Object > definedFieldInfo = new KQFormatBiz ( ) . getDefinedField ( ) ;
String definedFieldSum = Util . null2String ( definedFieldInfo . get ( "definedFieldSum" ) ) ;
String definedFieldSum = Util . null2String ( definedFieldInfo . get ( "definedFieldSum" ) ) ;
String backFields = " a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," +
String backFields = " a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," +
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, " +
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, " +
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+" + forgotBeginWorkCheck_field + " as forgotCheck " + ( definedFieldSum . length ( ) > 0 ? "," + definedFieldSum + "" : "" ) ;
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+" + forgotBeginWorkCheck_field + " as forgotCheck " + ( definedFieldSum . length ( ) > 0 ? "," + definedFieldSum + "" : "" ) ;
if ( rs . getDBType ( ) . equals ( "oracle" ) ) {
if ( rs . getDBType ( ) . equals ( "oracle" ) ) {
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ " + backFields ;
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ " + backFields ;
@ -206,7 +201,6 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
if ( subCompanyId . length ( ) > 0 ) {
if ( subCompanyId . length ( ) > 0 ) {
sqlWhere + = " and a.subcompanyid1 in(" + subCompanyId + ") " ;
sqlWhere + = " and a.subcompanyid1 in(" + subCompanyId + ") " ;
}
}
if ( departmentId . length ( ) > 0 ) {
if ( departmentId . length ( ) > 0 ) {
sqlWhere + = " and a.departmentid in(" + departmentId + ") " ;
sqlWhere + = " and a.departmentid in(" + departmentId + ") " ;
}
}
@ -226,14 +220,13 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
sqlWhere + = " and a.loginid is not null " + ( rs . getDBType ( ) . equals ( "oracle" ) ? "" : " and a.loginid<>'' " ) ;
sqlWhere + = " and a.loginid is not null " + ( rs . getDBType ( ) . equals ( "oracle" ) ? "" : " and a.loginid<>'' " ) ;
}
}
if ( status . length ( ) > 0 ) {
if ( status . length ( ) > 0 ) {
if ( ! status . equals ( "8" ) & & ! status . equals ( "9" ) ) {
if ( ! status . equals ( "8" ) & & ! status . equals ( "9" ) ) {
sqlWhere + = " and a.status = " + status + "" ;
sqlWhere + = " and a.status = " + status + "" ;
} else if ( status . equals ( "8" ) ) {
} else if ( status . equals ( "8" ) ) {
sqlWhere + = " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) " ;
sqlWhere + = " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) " ;
}
}
}
}
sql = " select count(*) as c from ( select 1 as c " + sqlFrom + sqlWhere + groupBy + ") t" ;
sql = " select count(*) as c from ( select 1 as c " + sqlFrom + sqlWhere + groupBy + ") t" ;
rs . execute ( sql ) ;
rs . execute ( sql ) ;
if ( rs . next ( ) ) {
if ( rs . next ( ) ) {
@ -286,12 +279,11 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
// orderBy = "order by "+orderBy;
// orderBy = "order by "+orderBy;
sql = backFields + sqlFrom + sqlWhere + groupBy ;
sql = backFields + sqlFrom + sqlWhere + groupBy ;
if ( pageIndex > 0 & & pageSize > 0 ) {
if ( pageIndex > 0 & & pageSize > 0 ) {
if ( rs . getDBType ( ) . equals ( "oracle" ) ) {
if ( rs . getDBType ( ) . equals ( "oracle" ) ) {
sql = " select * from (select " + sql + ") t " + orderBy ;
sql = " select * from (select " + sql + ") t " + orderBy ;
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
+ ( pageIndex * pageSize ) + ") where rownum_ > " + ( ( pageIndex - 1 ) * pageSize ) ;
+ ( pageIndex * pageSize ) + ") where rownum_ > " + ( ( pageIndex - 1 ) * pageSize ) ;
} else if ( rs . getDBType ( ) . equals ( "mysql" ) ) {
} else if ( rs . getDBType ( ) . equals ( "mysql" ) ) {
sql = " select * from (select " + sql + ") t " + orderBy ;
sql = " select * from (select " + sql + ") t " + orderBy ;
sql = "select t1.* from (" + sql + ") t1 limit " + ( ( pageIndex - 1 ) * pageSize ) + "," + pageSize ;
sql = "select t1.* from (" + sql + ") t1 limit " + ( ( pageIndex - 1 ) * pageSize ) + "," + pageSize ;
@ -309,7 +301,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
topSize = count - ( pageSize * ( pageIndex - 1 ) ) ;
topSize = count - ( pageSize * ( pageIndex - 1 ) ) ;
}
}
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
+ ( pageIndex * pageSize ) + sql + orderBy + " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy ;
+ ( pageIndex * pageSize ) + sql + orderBy + " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy ;
} else {
} else {
sql = " select top " + pageSize + sql + orderBy ;
sql = " select top " + pageSize + sql + orderBy ;
}
}
@ -318,7 +310,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
sql = " select " + sql ;
sql = " select " + sql ;
}
}
writeLog ( "howeccccccccccccggggggg10" + System . currentTimeMillis ( ) ) ;
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
String fullPathMainKey = "show_full_path" ;
String fullPathMainKey = "show_full_path" ;
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo ( ) ;
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo ( ) ;
@ -335,6 +327,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
rs . execute ( sql ) ;
rs . execute ( sql ) ;
writeLog ( "howeccccccccccccggggggg11" + System . currentTimeMillis ( ) ) ;
while ( rs . next ( ) ) {
while ( rs . next ( ) ) {
data = new HashMap < > ( ) ;
data = new HashMap < > ( ) ;
kqReportFieldComInfo . setTofirstRow ( ) ;
kqReportFieldComInfo . setTofirstRow ( ) ;
@ -388,8 +381,9 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
data . put ( serialIds . get ( i ) , kqReportBiz . getSerialCount ( id , fromDate , toDate , serialIds . get ( i ) ) ) ;
data . put ( serialIds . get ( i ) , kqReportBiz . getSerialCount ( id , fromDate , toDate , serialIds . get ( i ) ) ) ;
}
}
} else if ( kqReportFieldComInfo . getParentid ( ) . equals ( "overtime" ) | | kqReportFieldComInfo . getParentid ( ) . equals ( "overtime_nonleave" )
} else if ( kqReportFieldComInfo . getParentid ( ) . equals ( "overtime" ) | | kqReportFieldComInfo . getParentid ( ) . equals ( "overtime_nonleave" )
| | kqReportFieldComInfo . getParentid ( ) . equals ( "overtime_4leave" ) | | fieldName . equals ( "businessLeave" ) | | fieldName . equals ( "officialBusiness" ) ) {
| | kqReportFieldComInfo . getParentid ( ) . equals ( "overtime_4leave" ) | | fieldName . equals ( "businessLeave" ) | | fieldName . equals ( "officialBusiness" ) ) {
if ( fieldName . equals ( "overtimeTotal" ) ) {
if ( fieldName . equals ( "overtimeTotal" ) ) {
writeLog ( "howeccccccccccccggggggg12" + System . currentTimeMillis ( ) ) ;
double workingDayOvertime_4leave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|workingDayOvertime_4leave" ) ) ) ;
double workingDayOvertime_4leave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|workingDayOvertime_4leave" ) ) ) ;
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave ;
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave ;
double restDayOvertime_4leave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|restDayOvertime_4leave" ) ) ) ;
double restDayOvertime_4leave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|restDayOvertime_4leave" ) ) ) ;
@ -397,37 +391,37 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
double holidayOvertime_4leave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|holidayOvertime_4leave" ) ) ) ;
double holidayOvertime_4leave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|holidayOvertime_4leave" ) ) ) ;
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave ;
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave ;
double workingDayOvertime_nonleave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|workingDayOvertime_nonleave" ) ) ) ;
double workingDayOvertime_nonleave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|workingDayOvertime_nonleave" ) ) ) ;
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave ;
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave ;
double restDayOvertime_nonleave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|restDayOvertime_nonleave" ) ) ) ;
double restDayOvertime_nonleave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|restDayOvertime_nonleave" ) ) ) ;
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave ;
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave ;
double holidayOvertime_nonleave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|holidayOvertime_nonleave" ) ) ) ;
double holidayOvertime_nonleave = Util . getDoubleValue ( Util . null2String ( flowData . get ( id + "|holidayOvertime_nonleave" ) ) ) ;
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave ;
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave ;
fieldValue = KQDurationCalculatorUtil . getDurationRound ( String . valueOf ( workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
fieldValue = KQDurationCalculatorUtil . getDurationRound ( String . valueOf ( workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave ) ) ;
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave ) ) ;
} else if ( fieldName . equals ( "businessLeave" ) | | fieldName . equals ( "officialBusiness" ) ) {
} else if ( fieldName . equals ( "businessLeave" ) | | fieldName . equals ( "officialBusiness" ) ) {
String businessLeaveData = Util . null2s ( Util . null2String ( flowData . get ( id + "|" + fieldName ) ) , "0.0" ) ;
String businessLeaveData = Util . null2s ( Util . null2String ( flowData . get ( id + "|" + fieldName ) ) , "0.0" ) ;
String backType = fieldName + "_back" ;
String backType = fieldName + "_back" ;
String businessLeavebackData = Util . null2s ( Util . null2String ( flowData . get ( id + "|" + backType ) ) , "0.0" ) ;
String businessLeavebackData = Util . null2s ( Util . null2String ( flowData . get ( id + "|" + backType ) ) , "0.0" ) ;
String businessLeave = "" ;
String businessLeave = "" ;
try {
try {
//以防止出现精度问题
//以防止出现精度问题
if ( businessLeaveData . length ( ) = = 0 ) {
if ( businessLeaveData . length ( ) = = 0 ) {
businessLeaveData = "0.0" ;
businessLeaveData = "0.0" ;
}
}
if ( businessLeavebackData . length ( ) = = 0 ) {
if ( businessLeavebackData . length ( ) = = 0 ) {
businessLeavebackData = "0.0" ;
businessLeavebackData = "0.0" ;
}
}
BigDecimal b_businessLeaveData = new BigDecimal ( businessLeaveData ) ;
BigDecimal b_businessLeaveData = new BigDecimal ( businessLeaveData ) ;
BigDecimal b_businessLeavebackData = new BigDecimal ( businessLeavebackData ) ;
BigDecimal b_businessLeavebackData = new BigDecimal ( businessLeavebackData ) ;
businessLeave = b_businessLeaveData . subtract ( b_businessLeavebackData ) . toString ( ) ;
businessLeave = b_businessLeaveData . subtract ( b_businessLeavebackData ) . toString ( ) ;
if ( Util . getDoubleValue ( businessLeave , - 1 ) < 0 ) {
if ( Util . getDoubleValue ( businessLeave , - 1 ) < 0 ) {
businessLeave = "0.0" ;
businessLeave = "0.0" ;
}
} catch ( Exception e ) {
}
}
} catch ( Exception e ) {
fieldValue = KQDurationCalculatorUtil . getDurationRound ( businessLeave ) ;
}
fieldValue = KQDurationCalculatorUtil . getDurationRound ( businessLeave ) ;
} else {
} else {
fieldValue = KQDurationCalculatorUtil . getDurationRound ( Util . null2String ( flowData . get ( id + "|" + fieldName ) ) ) ;
fieldValue = KQDurationCalculatorUtil . getDurationRound ( Util . null2String ( flowData . get ( id + "|" + fieldName ) ) ) ;
}
}
@ -445,7 +439,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
}
}
data . put ( fieldName , fieldValue ) ;
data . put ( fieldName , fieldValue ) ;
}
}
writeLog ( "howeccccccccccccggggggg13" + System . currentTimeMillis ( ) ) ;
//请假
//请假
List < Map < String , Object > > allLeaveRules = kqLeaveRulesBiz . getAllLeaveRules ( ) ;
List < Map < String , Object > > allLeaveRules = kqLeaveRulesBiz . getAllLeaveRules ( ) ;
Map < String , Object > leaveRule = null ;
Map < String , Object > leaveRule = null ;
@ -456,31 +450,31 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
String flowLeaveBackType = Util . null2String ( "leavebackType_" + leaveRule . get ( "id" ) ) ;
String flowLeaveBackType = Util . null2String ( "leavebackType_" + leaveRule . get ( "id" ) ) ;
String leavebackData = Util . null2s ( Util . null2String ( flowData . get ( id + "|" + flowLeaveBackType ) ) , "0.0" ) ;
String leavebackData = Util . null2s ( Util . null2String ( flowData . get ( id + "|" + flowLeaveBackType ) ) , "0.0" ) ;
String b_flowLeaveData = "" ;
String b_flowLeaveData = "" ;
String flowLeaveData = "" ;
String flowLeaveData = "" ;
try {
try {
//以防止出现精度问题
//以防止出现精度问题
if ( leaveData . length ( ) = = 0 ) {
if ( leaveData . length ( ) = = 0 ) {
leaveData = "0.0" ;
leaveData = "0.0" ;
}
}
if ( leavebackData . length ( ) = = 0 ) {
if ( leavebackData . length ( ) = = 0 ) {
leavebackData = "0.0" ;
leavebackData = "0.0" ;
}
}
BigDecimal b_leaveData = new BigDecimal ( leaveData ) ;
BigDecimal b_leaveData = new BigDecimal ( leaveData ) ;
BigDecimal b_leavebackData = new BigDecimal ( leavebackData ) ;
BigDecimal b_leavebackData = new BigDecimal ( leavebackData ) ;
b_flowLeaveData = b_leaveData . subtract ( b_leavebackData ) . toString ( ) ;
b_flowLeaveData = b_leaveData . subtract ( b_leavebackData ) . toString ( ) ;
if ( Util . getDoubleValue ( b_flowLeaveData , - 1 ) < 0 ) {
if ( Util . getDoubleValue ( b_flowLeaveData , - 1 ) < 0 ) {
b_flowLeaveData = "0.0" ;
b_flowLeaveData = "0.0" ;
}
}
} catch ( Exception e ) {
} catch ( Exception e ) {
writeLog ( "GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e ) ;
writeLog ( "GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e ) ;
}
}
writeLog ( "howeccccccccccccggggggg14" + System . currentTimeMillis ( ) ) ;
//考虑下冻结的数据
//考虑下冻结的数据
if ( b_flowLeaveData . length ( ) > 0 ) {
if ( b_flowLeaveData . length ( ) > 0 ) {
flowLeaveData = KQDurationCalculatorUtil . getDurationRound ( b_flowLeaveData ) ;
flowLeaveData = KQDurationCalculatorUtil . getDurationRound ( b_flowLeaveData ) ;
} else {
} else {
flowLeaveData = KQDurationCalculatorUtil . getDurationRound ( Util . null2String ( Util . getDoubleValue ( leaveData , 0.0 ) - Util . getDoubleValue ( leavebackData , 0.0 ) ) ) ;
flowLeaveData = KQDurationCalculatorUtil . getDurationRound ( Util . null2String ( Util . getDoubleValue ( leaveData , 0.0 ) - Util . getDoubleValue ( leavebackData , 0.0 ) ) ) ;
}
}
data . put ( flowType , flowLeaveData ) ;
data . put ( flowType , flowLeaveData ) ;
}
}
@ -519,13 +513,13 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
s1 = s1 + "'" + strdate + "'," ;
s1 = s1 + "'" + strdate + "'," ;
}
}
s1 = s1 . substring ( 0 , s1 . length ( ) - 1 ) ;
s1 = s1 . substring ( 0 , s1 . length ( ) - 1 ) ;
//刘浩 大夜班天数
String sql88 = "select b.resourceid,b.signintime,b.signouttime,b.serialid from kq_format_detail b where b.resourceid = "+ resourceid + " and b.signintime is not null and b.signouttime is not null " +
String sql88 = "select b.resourceid,b.signintime,b.signouttime,b.serialid from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = "+ resourceid + " and b.signintime is not null and b.signouttime is not null " +
" and b.signintime !='' and b.signouttime !='' " +
" and b.signintime !='' and b.signouttime !='' " +
" and b.kqdate in(" + s1 + ") and b.serialid in (3,5,6) ";
" and b.kqdate in(" + s1 + ") and c.serial like '%值夜班%' ";
String sql99 = "select count(b.resourceid) as sums from kq_format_detail b where b.resourceid = "+ resourceid + " and b.signintime is not null and b.signouttime is not null " +
String sql99 = "select count(b.resourceid) as sums from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = "+ resourceid + " and b.signintime is not null and b.signouttime is not null " +
" and b.signintime !='' and b.signouttime !='' " +
" and b.signintime !='' and b.signouttime !='' " +
" and b.kqdate in(" + s1 + ") and b.serialid in (3,5,6) ";
" and b.kqdate in(" + s1 + ") and c.serial like '%值夜班%' ";
writeLog ( "howec:::::sql1:" + sql88 ) ;
writeLog ( "howec:::::sql1:" + sql88 ) ;
RecordSet rs99 = new RecordSet ( ) ;
RecordSet rs99 = new RecordSet ( ) ;
rs99 . execute ( sql99 ) ;
rs99 . execute ( sql99 ) ;
@ -533,16 +527,30 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
if ( rs99 . next ( ) ) {
if ( rs99 . next ( ) ) {
counts99 = String . valueOf ( rs99 . getInt ( "sums" ) ) ;
counts99 = String . valueOf ( rs99 . getInt ( "sums" ) ) ;
}
}
data . put ( "nightdays" , counts99 ) ;
data . put ( "nightdaysd" , counts99 ) ;
//刘浩 小夜班天数
sql88 = "select b.resourceid,b.signintime,b.signouttime,b.serialid from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = " + resourceid + " and b.signintime is not null and b.signouttime is not null " +
" and b.signintime !='' and b.signouttime !='' " +
" and b.kqdate in(" + s1 + ") and c.serial like '%两班夜班%'" ;
sql99 = "select count(b.resourceid) as sums from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = " + resourceid + " and b.signintime is not null and b.signouttime is not null " +
" and b.signintime !='' and b.signouttime !='' " +
" and b.kqdate in(" + s1 + ") and c.serial like '%两班夜班%'" ;
writeLog ( "howec:::::sql1-1:" + sql88 ) ;
rs99 = new RecordSet ( ) ;
rs99 . execute ( sql99 ) ;
counts99 = "0" ;
if ( rs99 . next ( ) ) {
counts99 = String . valueOf ( rs99 . getInt ( "sums" ) ) ;
}
data . put ( "nightdaysx" , counts99 ) ;
} else {
} else {
data . put ( "nightdays" , "0" ) ;
data . put ( "nightdaysd" , "0" ) ;
data . put ( "nightdaysx" , "0" ) ;
}
}
datas . add ( data ) ;
datas . add ( data ) ;
}
}
List < Object > lsHolidays = KQHolidaySetBiz . getHolidaySetListByScope ( "" + user . getUID ( ) , fromDate , toDate ) ;
List < Object > lsHolidays = KQHolidaySetBiz . getHolidaySetListByScope ( "" + user . getUID ( ) , fromDate , toDate ) ;
retmap . put ( "holidays" , lsHolidays ) ;
retmap . put ( "holidays" , lsHolidays ) ;
retmap . put ( "columns" , columns ) ;
retmap . put ( "columns" , columns ) ;
retmap . put ( "datas" , datas ) ;
retmap . put ( "datas" , datas ) ;
retmap . put ( "pagesize" , pageSize ) ;
retmap . put ( "pagesize" , pageSize ) ;
@ -576,7 +584,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
column . put ( "width" , 65 ) ;
column . put ( "width" , 65 ) ;
column . put ( "dataIndex" , serialIds . get ( i ) ) ;
column . put ( "dataIndex" , serialIds . get ( i ) ) ;
column . put ( "key" , serialIds . get ( i ) ) ;
column . put ( "key" , serialIds . get ( i ) ) ;
column . put ( "rowSpan" , 2 ) ;
column . put ( "rowSpan" , 2 ) ;
column . put ( "colSpan" , 1 ) ;
column . put ( "colSpan" , 1 ) ;
sumChildColumnWidth + = 65 ;
sumChildColumnWidth + = 65 ;
lsChildColumns . add ( column ) ;
lsChildColumns . add ( column ) ;
@ -602,48 +610,48 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
lsChildColumns . add ( column ) ;
lsChildColumns . add ( column ) ;
}
}
} else if ( parentid . equals ( "overtime" ) ) {
} else if ( parentid . equals ( "overtime" ) ) {
String [ ] overtimeChild = { "overtime_nonleave" , "overtime_4leave" , "overtimeTotal" } ;
String [ ] overtimeChild = { "overtime_nonleave" , "overtime_4leave" , "overtimeTotal" } ;
for ( int i = 0 ; i < overtimeChild . length ; i + + ) {
for ( int i = 0 ; i < overtimeChild . length ; i + + ) {
String id = overtimeChild [ i ] ;
String id = overtimeChild [ i ] ;
column = new HashMap ( ) ;
column = new HashMap ( ) ;
String fieldlabel = "" ;
String fieldlabel = "" ;
column . put ( "unit" , "" ) ;
column . put ( "unit" , "" ) ;
if ( "overtime_nonleave" . equalsIgnoreCase ( id ) ) {
if ( "overtime_nonleave" . equalsIgnoreCase ( id ) ) {
fieldlabel = "125805" ;
fieldlabel = "125805" ;
} else if ( "overtime_4leave" . equalsIgnoreCase ( id ) ) {
} else if ( "overtime_4leave" . equalsIgnoreCase ( id ) ) {
fieldlabel = "125804" ;
fieldlabel = "125804" ;
} else {
} else {
fieldlabel = "523" ;
fieldlabel = "523" ;
column . put ( "showDetial" , "1" ) ;
column . put ( "showDetial" , "1" ) ;
String unitType = ( KQOvertimeRulesBiz . getMinimumUnit ( ) = = 3 | | KQOvertimeRulesBiz . getMinimumUnit ( ) = = 5 | | KQOvertimeRulesBiz . getMinimumUnit ( ) = = 6 ) ? "2" : "1" ;
String unitType = ( KQOvertimeRulesBiz . getMinimumUnit ( ) = = 3 | | KQOvertimeRulesBiz . getMinimumUnit ( ) = = 5 | | KQOvertimeRulesBiz . getMinimumUnit ( ) = = 6 ) ? "2" : "1" ;
String unitTypeName = "" ;
String unitTypeName = "" ;
if ( Util . null2String ( unitType ) . length ( ) > 0 ) {
if ( Util . null2String ( unitType ) . length ( ) > 0 ) {
if ( unitType . equals ( "1" ) ) {
if ( unitType . equals ( "1" ) ) {
unitTypeName = SystemEnv . getHtmlLabelName ( 1925 , user . getLanguage ( ) ) ;
unitTypeName = SystemEnv . getHtmlLabelName ( 1925 , user . getLanguage ( ) ) ;
} else if ( unitType . equals ( "2" ) ) {
} else if ( unitType . equals ( "2" ) ) {
unitTypeName = SystemEnv . getHtmlLabelName ( 391 , user . getLanguage ( ) ) ;
unitTypeName = SystemEnv . getHtmlLabelName ( 391 , user . getLanguage ( ) ) ;
} else if ( unitType . equals ( "3" ) ) {
} else if ( unitType . equals ( "3" ) ) {
unitTypeName = SystemEnv . getHtmlLabelName ( 18083 , user . getLanguage ( ) ) ;
unitTypeName = SystemEnv . getHtmlLabelName ( 18083 , user . getLanguage ( ) ) ;
}
}
}
}
column . put ( "unit" , unitTypeName ) ;
column . put ( "unit" , unitTypeName ) ;
}
}
column . put ( "title" , SystemEnv . getHtmlLabelNames ( fieldlabel , user . getLanguage ( ) ) ) ;
column . put ( "title" , SystemEnv . getHtmlLabelNames ( fieldlabel , user . getLanguage ( ) ) ) ;
column . put ( "dataIndex" , id ) ;
column . put ( "dataIndex" , id ) ;
column . put ( "key" , id ) ;
column . put ( "key" , id ) ;
column . put ( "rowSpan" , 1 ) ;
column . put ( "rowSpan" , 1 ) ;
Map < String , Object > mapChildColumnInfo = getChildColumnsInfo ( id , user ) ;
Map < String , Object > mapChildColumnInfo = getChildColumnsInfo ( id , user ) ;
int childWidth = 65 ;
int childWidth = 65 ;
List < Object > childColumns = ( List < Object > ) mapChildColumnInfo . get ( "childColumns" ) ;
List < Object > childColumns = ( List < Object > ) mapChildColumnInfo . get ( "childColumns" ) ;
if ( childColumns . size ( ) > 0 ) { //跨列width取子列的width
if ( childColumns . size ( ) > 0 ) { //跨列width取子列的width
column . put ( "children" , childColumns ) ;
column . put ( "children" , childColumns ) ;
childWidth = Util . getIntValue ( Util . null2String ( mapChildColumnInfo . get ( "sumChildColumnWidth" ) ) , 65 ) ;
childWidth = Util . getIntValue ( Util . null2String ( mapChildColumnInfo . get ( "sumChildColumnWidth" ) ) , 65 ) ;
}
}
column . put ( "width" , childWidth + "" ) ;
column . put ( "width" , childWidth + "" ) ;
sumChildColumnWidth + = childWidth ;
sumChildColumnWidth + = childWidth ;
lsChildColumns . add ( column ) ;
lsChildColumns . add ( column ) ;
}
}
} else {
} else {
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo ( ) ;
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo ( ) ;
while ( kqReportFieldComInfo . next ( ) ) {
while ( kqReportFieldComInfo . next ( ) ) {
if ( kqReportFieldComInfo . getParentid ( ) . equals ( parentid ) ) {
if ( kqReportFieldComInfo . getParentid ( ) . equals ( parentid ) ) {