@ -303,16 +303,22 @@ public class KQReportBiz extends BaseBean {
return unitTypeName ;
return unitTypeName ;
}
}
public Map < String , Object > getFlowData ( Map < String , Object > params , User user ) {
public Map < String , Object > getFlowData ( Map < String , Object > params , User user ) {
Map < String , Object > datas = new HashMap < > ( ) ; ;
Map < String , Object > datas = new HashMap < > ( ) ;
try {
try {
datas . putAll ( getFlowLeaveData ( params , user ) ) ;
datas . putAll ( getFlowLeaveData ( params , user , "" ) ) ;
datas . putAll ( getFlowEvectionOutData ( params , user ) ) ;
datas . putAll ( getFlowEvectionOutData ( params , user ) ) ;
datas . putAll ( getFlowOverTimeDataNew ( params , user ) ) ;
datas . putAll ( getFlowOverTimeDataNew ( params , user ) ) ;
datas . putAll ( getFlowOtherData ( params , user ) ) ;
datas . putAll ( getFlowOtherData ( params , user ) ) ;
datas . putAll ( getFlowLeaveBackData ( params , user ) ) ;
datas . putAll ( getFlowLeaveBackData ( params , user ) ) ;
datas . putAll ( getFlowProcessChangeData ( params , user ) ) ;
datas . putAll ( getFlowProcessChangeData ( params , user ) ) ;
} catch ( Exception e ) {
// 新创元二开:跨厂办公时长
// datas.putAll(getFlowKCBGData(params, user));
// 新创元二开: 补卡次数
datas . putAll ( getFlowBKCSData ( params , user ) ) ;
// 新创元二开: 年累计事假
datas . putAll ( getFlowLeaveData ( params , user , "1" ) ) ;
} catch ( Exception e ) {
writeLog ( e ) ;
writeLog ( e ) ;
}
}
return datas ;
return datas ;
@ -324,14 +330,18 @@ public class KQReportBiz extends BaseBean {
* @param user
* @param user
* @return
* @return
* /
* /
public Map < String , Object > getDailyFlowData ( Map < String , Object > params , User user ) {
public Map < String , Object > getDailyFlowData ( Map < String , Object > params , User user ) {
Map < String , Object > datas = new HashMap < > ( ) ; ;
Map < String , Object > datas = new HashMap < > ( ) ;
try {
try {
datas . putAll ( getDailyFlowLeaveData ( params , user ) ) ;
datas . putAll ( getDailyFlowLeaveData ( params , user ) ) ;
datas . putAll ( getDailyFlowEvectionOutData ( params , user ) ) ;
datas . putAll ( getDailyFlowEvectionOutData ( params , user ) ) ;
datas . putAll ( getDailyFlowOverTimeData ( params , user ) ) ;
datas . putAll ( getDailyFlowOverTimeData ( params , user ) ) ;
datas . putAll ( getDailyFlowLeaveBackData ( params , user ) ) ;
datas . putAll ( getDailyFlowLeaveBackData ( params , user ) ) ;
} catch ( Exception e ) {
// 新创元二开:跨厂办公时长
// datas.putAll(getFlowKCBGData(params, user));
// 新创元二开:补卡次数
datas . putAll ( getFlowBKCSData ( params , user ) ) ;
} catch ( Exception e ) {
writeLog ( e ) ;
writeLog ( e ) ;
}
}
return datas ;
return datas ;
@ -399,18 +409,19 @@ public class KQReportBiz extends BaseBean {
}
}
for ( String table : tables ) {
for ( String table : tables ) {
sql = " select resourceid, durationrule, sum(duration) as val from hrmresource a, "+ table + " b "+
sql = " select b. resourceid, durationrule, sum(b. duration) as val,CCSQLX from hrmresource a, "+ table + " b ,"+ kcbgFlowTable + " c "+
" where a.id = b.resourceid and (b.status is null or b.status<>1) and belongdate >='"+ fromDate + "' and belongdate <='" + toDate + "' " + sqlWhere +
" where a.id = b.resourceid AND b.REQUESTID = c.REQUESTID and (b.status is null or b.status<>1) and belongdate >='"+ fromDate + "' and belongdate <='" + toDate + "' " + sqlWhere +
" group by resourceid, durationrule ";
" group by b. resourceid, durationrule, CCSQLX ";
rs . execute ( sql ) ;
rs . execute ( sql ) ;
while ( rs . next ( ) ) {
while ( rs . next ( ) ) {
String resourceid = rs . getString ( "resourceid" ) ;
String resourceid = rs . getString ( "resourceid" ) ;
double value = rs . getDouble ( "val" ) ;
double value = rs . getDouble ( "val" ) ;
String durationrule = rs . getString ( "durationrule" ) ;
String durationrule = rs . getString ( "durationrule" ) ;
String evectionType = rs . getString ( "CCSQLX" ) ; //此次出差类型
String flowType = "" ;
String flowType = "" ;
if ( KqSplitFlowTypeEnum . EVECTION . getTablename ( ) . equals ( table ) ) {
if ( KqSplitFlowTypeEnum . EVECTION . getTablename ( ) . equals ( table ) ) {
flowType = "businessLeave ";
flowType = "businessLeave | "+ evectionType ;
minimumUnit = KQTravelRulesBiz . getMinimumUnit ( ) ; //单位类型
minimumUnit = KQTravelRulesBiz . getMinimumUnit ( ) ; //单位类型
proportion = Util . getDoubleValue ( KQTravelRulesBiz . getHoursToDay ( ) ) ; //换算关系
proportion = Util . getDoubleValue ( KQTravelRulesBiz . getHoursToDay ( ) ) ; //换算关系
@ -507,19 +518,20 @@ public class KQReportBiz extends BaseBean {
}
}
for ( String table : tables ) {
for ( String table : tables ) {
sql = " select resourceid, durationrule, sum(duration) as val,belongdate from hrmresource a, "+ table + " b "+
sql = " select b. resourceid, durationrule, sum(b. duration) as val,belongdate,CCSQLX from hrmresource a, "+ table + " b ,"+ kcbgFlowTable + " c "+
" where a.id = b.resourceid and (b.status is null or b.status<>1) and belongdate >='"+ fromDate + "' and belongdate <='" + toDate + "' " + sqlWhere +
" where a.id = b.resourceid and b.REQUESTID = c.REQUESTID and (b.status is null or b.status<>1) and belongdate >='"+ fromDate + "' and belongdate <='" + toDate + "' " + sqlWhere +
" group by resourceid, durationrule,belongdate ";
" group by b. resourceid, durationrule,belongdate,CCSQLX ";
rs . execute ( sql ) ;
rs . execute ( sql ) ;
while ( rs . next ( ) ) {
while ( rs . next ( ) ) {
String resourceid = rs . getString ( "resourceid" ) ;
String resourceid = rs . getString ( "resourceid" ) ;
String belongdate = rs . getString ( "belongdate" ) ;
String belongdate = rs . getString ( "belongdate" ) ;
double value = rs . getDouble ( "val" ) ;
double value = rs . getDouble ( "val" ) ;
String durationrule = rs . getString ( "durationrule" ) ;
String durationrule = rs . getString ( "durationrule" ) ;
String evectionType = rs . getString ( "CCSQLX" ) ; //此次出差类型
String flowType = "" ;
String flowType = "" ;
if ( KqSplitFlowTypeEnum . EVECTION . getTablename ( ) . equals ( table ) ) {
if ( KqSplitFlowTypeEnum . EVECTION . getTablename ( ) . equals ( table ) ) {
flowType = "businessLeave" ;
flowType = "businessLeave" +"|" + evectionType ;
minimumUnit = KQTravelRulesBiz . getMinimumUnit ( ) ; //单位类型
minimumUnit = KQTravelRulesBiz . getMinimumUnit ( ) ; //单位类型
proportion = Util . getDoubleValue ( KQTravelRulesBiz . getHoursToDay ( ) ) ; //换算关系
proportion = Util . getDoubleValue ( KQTravelRulesBiz . getHoursToDay ( ) ) ; //换算关系
} else if ( KqSplitFlowTypeEnum . OUT . getTablename ( ) . equals ( table ) ) {
} else if ( KqSplitFlowTypeEnum . OUT . getTablename ( ) . equals ( table ) ) {
@ -559,7 +571,7 @@ public class KQReportBiz extends BaseBean {
* @param user
* @param user
* @return
* @return
* /
* /
public Map < String , Object > getFlowLeaveData ( Map < String , Object > params , User user ){
public Map < String , Object > getFlowLeaveData ( Map < String , Object > params , User user ,String type ){
Map < String , Object > datas = new HashMap < > ( ) ; ;
Map < String , Object > datas = new HashMap < > ( ) ; ;
RecordSet rs = new RecordSet ( ) ;
RecordSet rs = new RecordSet ( ) ;
String sql = "" ;
String sql = "" ;
@ -567,6 +579,7 @@ public class KQReportBiz extends BaseBean {
try {
try {
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo ( ) ;
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo ( ) ;
JSONObject jsonObj = JSON . parseObject ( Util . null2String ( params . get ( "data" ) ) ) ;
JSONObject jsonObj = JSON . parseObject ( Util . null2String ( params . get ( "data" ) ) ) ;
String fromDate = Util . null2String ( jsonObj . get ( "fromDate" ) ) ;
String fromDate = Util . null2String ( jsonObj . get ( "fromDate" ) ) ;
String toDate = Util . null2String ( jsonObj . get ( "toDate" ) ) ;
String toDate = Util . null2String ( jsonObj . get ( "toDate" ) ) ;
String typeselect = Util . null2String ( jsonObj . get ( "typeselect" ) ) ;
String typeselect = Util . null2String ( jsonObj . get ( "typeselect" ) ) ;
@ -580,6 +593,13 @@ public class KQReportBiz extends BaseBean {
toDate = TimeUtil . getDateByOption ( typeselect , "1" ) ;
toDate = TimeUtil . getDateByOption ( typeselect , "1" ) ;
}
}
}
}
if ( type . equals ( "1" ) ) { //二开: type =1 时,统计请假 汇总值(本年累加)
fromDate = TimeUtil . getDateByOption ( "5" , "0" ) ; //本年第一天
if ( typeselect . equals ( "6" ) ) {
fromDate = fromDate . substring ( 0 , 4 ) + "-01-01" ;
}
}
String subCompanyId = Util . null2String ( jsonObj . get ( "subCompanyId" ) ) ;
String subCompanyId = Util . null2String ( jsonObj . get ( "subCompanyId" ) ) ;
String departmentId = Util . null2String ( jsonObj . get ( "departmentId" ) ) ;
String departmentId = Util . null2String ( jsonObj . get ( "departmentId" ) ) ;
String resourceId = Util . null2String ( jsonObj . get ( "resourceId" ) ) ;
String resourceId = Util . null2String ( jsonObj . get ( "resourceId" ) ) ;
@ -631,6 +651,9 @@ public class KQReportBiz extends BaseBean {
}
}
String key = resourceid + "|leaveType_" + newleavetype ;
String key = resourceid + "|leaveType_" + newleavetype ;
if ( type . equals ( "1" ) ) { //二开:汇总
key = resourceid + "|leaveType_all_" + newleavetype ;
}
if ( datas . containsKey ( key ) ) {
if ( datas . containsKey ( key ) ) {
value + = Util . getDoubleValue ( Util . null2String ( datas . get ( key ) ) ) ;
value + = Util . getDoubleValue ( Util . null2String ( datas . get ( key ) ) ) ;
}
}
@ -1437,6 +1460,7 @@ public class KQReportBiz extends BaseBean {
Map < String , Object > tmpdata = null ;
Map < String , Object > tmpdata = null ;
Map < String , Object > tmpmap = null ;
Map < String , Object > tmpmap = null ;
RecordSet rs = new RecordSet ( ) ;
RecordSet rs = new RecordSet ( ) ;
RecordSet recordSet = new RecordSet ( ) ;
String sql = "" ;
String sql = "" ;
try {
try {
sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, " +
sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, " +
@ -1447,6 +1471,7 @@ public class KQReportBiz extends BaseBean {
rs . executeQuery ( sql , resourceId , fromDate , toDate ) ;
rs . executeQuery ( sql , resourceId , fromDate , toDate ) ;
while ( rs . next ( ) ) {
while ( rs . next ( ) ) {
String key = rs . getString ( "resourceid" ) + "|" + rs . getString ( "kqdate" ) ;
String key = rs . getString ( "resourceid" ) + "|" + rs . getString ( "kqdate" ) ;
String kqdate = rs . getString ( "kqdate" ) ;
int workMins = rs . getInt ( "workMins" ) ;
int workMins = rs . getInt ( "workMins" ) ;
int beLateMins = rs . getInt ( "beLateMins" ) ;
int beLateMins = rs . getInt ( "beLateMins" ) ;
int leaveEarlyMins = rs . getInt ( "leaveEarlyMins" ) ;
int leaveEarlyMins = rs . getInt ( "leaveEarlyMins" ) ;
@ -1529,6 +1554,12 @@ public class KQReportBiz extends BaseBean {
}
}
}
}
if ( evectionMins > 0 ) { //出差
if ( evectionMins > 0 ) { //出差
String kcbgsql = "select a.REQUESTID from kq_flow_split_evection a," + kcbgFlowTable + " b\n" +
"WHERE a.REQUESTID = b.REQUESTID AND b.ccsqlx = 1 and b.RESOURCEID ='" + resourceId + "' AND a.FROMDATE >= '" + kqdate + "' AND a.TODATE <= '" + kqdate + "'" ;
recordSet . execute ( kcbgsql ) ;
if ( recordSet . next ( ) ) {
text + = "跨厂办公" ;
}
if ( text . indexOf ( SystemEnv . getHtmlLabelName ( 20084 , user . getLanguage ( ) ) ) = = - 1 ) {
if ( text . indexOf ( SystemEnv . getHtmlLabelName ( 20084 , user . getLanguage ( ) ) ) = = - 1 ) {
if ( text . length ( ) > 0 ) text + = " " ;
if ( text . length ( ) > 0 ) text + = " " ;
text + = SystemEnv . getHtmlLabelName ( 20084 , user . getLanguage ( ) ) ;
text + = SystemEnv . getHtmlLabelName ( 20084 , user . getLanguage ( ) ) ;
@ -1796,6 +1827,161 @@ public class KQReportBiz extends BaseBean {
return text ;
return text ;
}
}
/ * *
* 获 取 出 差 / 跨 厂 办 公 审 批 流 中 出 差 时 长
* @param params
* @param user
* @return
* /
public Map < String , Object > getFlowKCBGData ( Map < String , Object > params , User user ) {
Map < String , Object > datas = new HashMap < > ( ) ; ;
RecordSet rs = new RecordSet ( ) ;
String sql = "" ;
String sqlWhere = " " ;
try {
JSONObject jsonObj = JSON . parseObject ( Util . null2String ( params . get ( "data" ) ) ) ;
String fromDate = Util . null2String ( jsonObj . get ( "fromDate" ) ) ;
String toDate = Util . null2String ( jsonObj . get ( "toDate" ) ) ;
String typeselect = Util . null2String ( jsonObj . get ( "typeselect" ) ) ;
if ( typeselect . length ( ) = = 0 ) typeselect = "3" ;
if ( ! typeselect . equals ( "" ) & & ! typeselect . equals ( "0" ) & & ! typeselect . equals ( "6" ) ) {
if ( typeselect . equals ( "1" ) ) {
fromDate = TimeUtil . getCurrentDateString ( ) ;
toDate = TimeUtil . getCurrentDateString ( ) ;
} else {
fromDate = TimeUtil . getDateByOption ( typeselect , "0" ) ;
toDate = TimeUtil . getDateByOption ( typeselect , "1" ) ;
}
}
String subCompanyId = Util . null2String ( jsonObj . get ( "subCompanyId" ) ) ;
String departmentId = Util . null2String ( jsonObj . get ( "departmentId" ) ) ;
String resourceId = Util . null2String ( jsonObj . get ( "resourceId" ) ) ;
String allLevel = Util . null2String ( jsonObj . get ( "allLevel" ) ) ;
String isNoAccount = Util . null2String ( jsonObj . get ( "isNoAccount" ) ) ;
String viewScope = Util . null2String ( jsonObj . get ( "viewScope" ) ) ;
if ( subCompanyId . length ( ) > 0 ) {
sqlWhere + = " and a.subcompanyid1 in(" + subCompanyId + ") " ;
}
if ( departmentId . length ( ) > 0 ) {
sqlWhere + = " and a.departmentid in(" + departmentId + ") " ;
}
if ( resourceId . length ( ) > 0 ) {
sqlWhere + = " and b.resourceid in(" + resourceId + ") " ;
}
if ( viewScope . equals ( "4" ) ) { //我的下属
if ( allLevel . equals ( "1" ) ) { //所有下属
sqlWhere + = " and a.managerstr like '%," + user . getUID ( ) + ",%'" ;
} else {
sqlWhere + = " and a.managerid=" + user . getUID ( ) ; //直接下属
}
}
if ( ! "1" . equals ( isNoAccount ) ) {
sqlWhere + = " and a.loginid is not null " + ( rs . getDBType ( ) . equals ( "oracle" ) ? "" : " and a.loginid<>'' " ) ;
}
sql = "SELECT b.resourceid,b.REQUESTID,max(c.duration) duration FROM HRMRESOURCE a, kq_flow_split_evection b," + kcbgFlowTable + " c\n" +
"WHERE a.id=b.RESOURCEID AND b.REQUESTID = c.REQUESTID AND c.ccsqlx='2' and fromdatedb >='" + fromDate + "' and fromdatedb <='" + toDate + "' " + sqlWhere +
"GROUP BY b.resourceid,b.REQUESTID " ;
rs . execute ( sql ) ;
while ( rs . next ( ) ) {
String resourceid = rs . getString ( "resourceid" ) ;
double value = rs . getDouble ( "duration" ) ;
String flowType = "kcbg" ;
String key = resourceid + "|" + flowType ;
if ( datas . containsKey ( key ) ) {
value + = Util . getDoubleValue ( Util . null2String ( datas . get ( key ) ) ) ;
}
//df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了
df . setMaximumFractionDigits ( 5 ) ;
datas . put ( key , df . format ( value ) ) ;
}
} catch ( Exception e ) {
writeLog ( e ) ;
}
return datas ;
}
// 补卡流程
private static final String bkWorkFlowMainTable = new BaseBean ( ) . getPropValue ( "xcy_kq" , "xcy_kq_bk_mainTab" ) ;
private static final String bkWorkFlowDetTable = new BaseBean ( ) . getPropValue ( "xcy_kq" , "xcy_kq_bk_detailTab" ) ;
// 跨厂办公流程表
private static final String kcbgFlowTable = new BaseBean ( ) . getPropValue ( "xcy_kq" , "xcy_kq_cckcbg" ) ;
/ * *
* 获 取 补 卡 次 数
* @param params
* @param user
* @return
* /
public Map < String , Object > getFlowBKCSData ( Map < String , Object > params , User user ) {
Map < String , Object > datas = new HashMap < > ( ) ; ;
RecordSet rs = new RecordSet ( ) ;
String sql = "" ;
String fromSql = " from hrmResource a," + bkWorkFlowMainTable + " b, " + bkWorkFlowDetTable + " c " ;
String sqlWhere = "" ;
try {
JSONObject jsonObj = JSON . parseObject ( Util . null2String ( params . get ( "data" ) ) ) ;
String fromDate = Util . null2String ( jsonObj . get ( "fromDate" ) ) ;
String toDate = Util . null2String ( jsonObj . get ( "toDate" ) ) ;
String typeselect = Util . null2String ( jsonObj . get ( "typeselect" ) ) ;
if ( typeselect . length ( ) = = 0 ) typeselect = "3" ;
if ( ! typeselect . equals ( "" ) & & ! typeselect . equals ( "0" ) & & ! typeselect . equals ( "6" ) ) {
if ( typeselect . equals ( "1" ) ) {
fromDate = TimeUtil . getCurrentDateString ( ) ;
toDate = TimeUtil . getCurrentDateString ( ) ;
} else {
fromDate = TimeUtil . getDateByOption ( typeselect , "0" ) ;
toDate = TimeUtil . getDateByOption ( typeselect , "1" ) ;
}
}
String subCompanyId = Util . null2String ( jsonObj . get ( "subCompanyId" ) ) ;
String departmentId = Util . null2String ( jsonObj . get ( "departmentId" ) ) ;
String resourceId = Util . null2String ( jsonObj . get ( "resourceId" ) ) ;
String allLevel = Util . null2String ( jsonObj . get ( "allLevel" ) ) ;
String isNoAccount = Util . null2String ( jsonObj . get ( "isNoAccount" ) ) ;
String viewScope = Util . null2String ( jsonObj . get ( "viewScope" ) ) ;
if ( subCompanyId . length ( ) > 0 ) {
sqlWhere + = " and a.subcompanyid1 in(" + subCompanyId + ") " ;
}
if ( departmentId . length ( ) > 0 ) {
sqlWhere + = " and a.departmentid in(" + departmentId + ") " ;
}
if ( resourceId . length ( ) > 0 ) {
sqlWhere + = " and b.resourceid in(" + resourceId + ") " ;
}
if ( viewScope . equals ( "4" ) ) { //我的下属
if ( allLevel . equals ( "1" ) ) { //所有下属
sqlWhere + = " and a.managerstr like '%," + user . getUID ( ) + ",%'" ;
} else {
sqlWhere + = " and a.managerid=" + user . getUID ( ) ; //直接下属
}
}
if ( ! "1" . equals ( isNoAccount ) ) {
sqlWhere + = " and a.loginid is not null " + ( rs . getDBType ( ) . equals ( "oracle" ) ? "" : " and a.loginid<>'' " ) ;
}
sql = "SELECT b.resourceId,c.detail_signdate,count(1) AS bkcs " + fromSql +
"WHERE a.id=b.resourceId AND b.id=c.mainid AND c.bkyy=0 AND c.detail_signdate >='" + fromDate + "' and c.detail_signdate <='" + toDate + "' " + sqlWhere +
"GROUP BY b.resourceId,c.detail_signdate" ;
rs . execute ( sql ) ;
while ( rs . next ( ) ) {
String resourceid = rs . getString ( "resourceId" ) ;
String value = rs . getString ( "bkcs" ) ;
String flowType = "bkcs" ;
String key = resourceid + "|" + flowType ;
datas . put ( key , value ) ;
}
} catch ( Exception e ) {
writeLog ( e ) ;
}
return datas ;
}
public static boolean getShowFlowText ( String leaveInfo , String onOrOff ) {
public static boolean getShowFlowText ( String leaveInfo , String onOrOff ) {
Map < String , Object > jsonObject = null ;
Map < String , Object > jsonObject = null ;
jsonObject = JSON . parseObject ( leaveInfo ) ;
jsonObject = JSON . parseObject ( leaveInfo ) ;