报表代码还原

dev_zm
李栋 1 year ago
parent 57a78725a6
commit cff3198ba1

@ -1,11 +1,8 @@
package com.engine.kq.biz; package com.engine.kq.biz;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean;
import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum; import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
import com.engine.kq.enums.FlowReportTypeEnum;
import com.engine.kq.enums.KqSplitFlowTypeEnum; import com.engine.kq.enums.KqSplitFlowTypeEnum;
import com.engine.kq.log.KQLog; import com.engine.kq.log.KQLog;
import com.engine.kq.util.KQDurationCalculatorUtil; import com.engine.kq.util.KQDurationCalculatorUtil;
@ -324,99 +321,6 @@ public class KQReportBiz extends BaseBean {
return datas; return datas;
} }
/**
*
* @param params
* @param user
* @return
*/
public Map<String,Object> getSaturdayFlowLeaveBackData(Map<String,Object> params, User user){
Map<String,Object> datas = new HashMap<>();;
RecordSet rs = new RecordSet();
String sql = "";
String sqlWhere = " ";
try{
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
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 resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " +
"and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = " +
"(select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid and serialid = b.serialid and kqdate = b.belongdate)) " +sqlWhere +
" group by resourceid, newleavetype, durationrule ";
rs.execute(sql);
while (rs.next()) {
String resourceid = rs.getString("resourceid");
String newleavetype = rs.getString("newleavetype");
String durationrule = rs.getString("durationrule");
double value = rs.getDouble("val")<0?0:rs.getDouble("val");
double proportion = Util.getDoubleValue(kqLeaveRulesComInfo.getProportion(newleavetype));
if(KQUnitBiz.isLeaveHour(newleavetype,kqLeaveRulesComInfo)){//按小时
if(!KQUnitBiz.isLeaveHour(durationrule)){
if(proportion>0) value = value*proportion;
}
}else{//按天
if(KQUnitBiz.isLeaveHour(durationrule)){
if(proportion>0) value = value/proportion;
}
}
String key = resourceid+"|leavebackType_"+newleavetype;
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;
}
/** /**
* *
* @param params * @param params
@ -475,10 +379,7 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and " + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " +sqlWhere +
"(DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 " +
"AND groupid = (select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid " +
" and serialid = b.serialid and kqdate = b.belongdate)) " +sqlWhere +
" group by resourceid, newleavetype, durationrule "; " group by resourceid, newleavetype, durationrule ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
@ -515,100 +416,6 @@ public class KQReportBiz extends BaseBean {
return datas; return datas;
} }
/**
*
* @param params
* @param user
* @return
*/
public Map<String,Object> getDailySaturdayFlowLeaveBackData(Map<String,Object> params, User user){
Map<String,Object> datas = new HashMap<>();;
RecordSet rs = new RecordSet();
String sql = "";
String sqlWhere = " ";
try{
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
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 resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " +
"and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = " +
"(select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid and serialid = b.serialid and kqdate = b.belongdate)) " +sqlWhere +
" group by resourceid, newleavetype, durationrule,belongdate ";
rs.execute(sql);
while (rs.next()) {
String resourceid = rs.getString("resourceid");
String belongdate = rs.getString("belongdate");
String newleavetype = rs.getString("newleavetype");
String durationrule = rs.getString("durationrule");
double value = rs.getDouble("val")<0?0:rs.getDouble("val");
double proportion = Util.getDoubleValue(kqLeaveRulesComInfo.getProportion(newleavetype));
if(KQUnitBiz.isLeaveHour(newleavetype,kqLeaveRulesComInfo)){//按小时
if(!KQUnitBiz.isLeaveHour(durationrule)){
if(proportion>0) value = value*proportion;
}
}else{//按天
if(KQUnitBiz.isLeaveHour(durationrule)){
if(proportion>0) value = value/proportion;
}
}
String key = resourceid+"|"+belongdate+"|leavebackType_"+newleavetype;
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;
}
/** /**
* *
* @param params * @param params
@ -666,9 +473,7 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " +sqlWhere +
"and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = " +
"(select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid and serialid = b.serialid and kqdate = b.belongdate)) " +sqlWhere +
" group by resourceid, newleavetype, durationrule,belongdate "; " group by resourceid, newleavetype, durationrule,belongdate ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
@ -2027,17 +1832,6 @@ public class KQReportBiz extends BaseBean {
int evectionMins = Util.getIntValue(Util.null2String(signInfo.get("evectionMins"))); int evectionMins = Util.getIntValue(Util.null2String(signInfo.get("evectionMins")));
int outMins = Util.getIntValue(Util.null2String(signInfo.get("outMins"))); int outMins = Util.getIntValue(Util.null2String(signInfo.get("outMins")));
String resourceId = Util.null2String(signInfo.get("resourceId"));
String kqDate = Util.null2String(signInfo.get("kqdate"));
String flowinfo = Util.null2String(signInfo.get("flowinfo"));
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
int split_time_index = 0;
ShiftInfoBean shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(resourceId, kqDate, false);
List<int[]> halfWorkIndex = shiftInfoBean.getHalfWorkIndex();
if(halfWorkIndex != null && !halfWorkIndex.isEmpty()) {
int[] halfWorkIndexs = halfWorkIndex.get(0);
split_time_index = halfWorkIndexs[1];//半天的时间
}
if(worktime.length()>0){ if(worktime.length()>0){
if (absenteeismMins > 0) {//旷工 if (absenteeismMins > 0) {//旷工
text = SystemEnv.getHtmlLabelName(20085, user.getLanguage())+absenteeismMins+ SystemEnv.getHtmlLabelName(15049, user.getLanguage()); text = SystemEnv.getHtmlLabelName(20085, user.getLanguage())+absenteeismMins+ SystemEnv.getHtmlLabelName(15049, user.getLanguage());
@ -2066,71 +1860,21 @@ public class KQReportBiz extends BaseBean {
if (leaveMins > 0) {//请假 if (leaveMins > 0) {//请假
Map<String, Object> jsonObject = null; Map<String, Object> jsonObject = null;
// if(leaveInfo.length()>0){ if(leaveInfo.length()>0){
// jsonObject = JSON.parseObject(leaveInfo); jsonObject = JSON.parseObject(leaveInfo);
// for (Map.Entry<String,Object> entry : jsonObject.entrySet()) { for (Entry<String, Object> entry : jsonObject.entrySet()) {
// String newLeaveType = entry.getKey(); String newLeaveType = entry.getKey();
// String tmpLeaveMins = Util.null2String(entry.getValue()); String tmpLeaveMins = Util.null2String(entry.getValue());
// if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){ if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){
// if (text.length() > 0) text += " "; if (text.length() > 0) text += " ";
// //text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage()); //text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage());
// text += Util.formatMultiLang(kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage()); text += Util.formatMultiLang(kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage());
// }
// }
// }else{
// if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) {
// if (text.length() > 0) text += " ";
// text += SystemEnv.getHtmlLabelName(670, user.getLanguage());
// }
// }
if(flowinfo.length() > 0) {
jsonObject = JSON.parseObject(flowinfo);
String jsonKey = "";
String jsonValue = "";
if (jsonObject.containsKey(FlowReportTypeEnum.LEAVE.getFlowType())) {
jsonKey = FlowReportTypeEnum.LEAVE.getFlowType();
jsonValue = SystemEnv.getHtmlLabelName(670, user.getLanguage());
}
if (jsonKey.length() > 0) {
JSONArray jsonArray = (JSONArray) jsonObject.get(jsonKey);
String text4temp = "";
if (jsonArray != null && !jsonArray.isEmpty()) {
//客户不存在多个重复流程的情况,只是显示第一个就行
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject1 = (JSONObject) jsonArray.get(i);
if (jsonObject1 != null && !jsonObject1.isEmpty()) {
String newLeaveType = Util.null2s(Util.null2String(jsonObject1.get("newLeaveType")), "");
String begintime = Util.null2s(Util.null2String(jsonObject1.get("begintime")), "");
String endtime = Util.null2s(Util.null2String(jsonObject1.get("endtime")), "");
int beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(begintime);
int endIdx = kqTimesArrayComInfo.getArrayindexByTimes(endtime);
if (jsonKey.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())) {
if (newLeaveType.length() > 0) {
jsonValue = kqLeaveRulesComInfo.getLeaveName(newLeaveType);
}
}
if (beginIdx <= split_time_index && endIdx <= split_time_index) {
//上午
if ("on".equalsIgnoreCase(onOrOff)) {
text4temp = jsonValue;
} }
} else if (beginIdx >= split_time_index && endIdx >= split_time_index) {
//下午
if ("off".equalsIgnoreCase(onOrOff)) {
text4temp = jsonValue;
} }
}else{ }else{
//全天 if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) {
text4temp = jsonValue;
}
}
}
if(text4temp.length()>0){
if (text.length() > 0) text += " "; if (text.length() > 0) text += " ";
text += text4temp; text += SystemEnv.getHtmlLabelName(670, user.getLanguage());
}
}
} }
} }
} }
@ -2462,25 +2206,16 @@ public class KQReportBiz extends BaseBean {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
int sixnight_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","sixnight_serialid")); int sixnight_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","sixnight_serialid"));
int twelvehours_night_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","twelvehours_night_serialid")); int twelvehours_night_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","twelvehours_night_serialid"));
int night_rest_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","night_rest_serialid"));
rs.executeQuery("select * from kq_format_total where kqdate = ? and resourceid=?",kqdate,userid); rs.executeQuery("select * from kq_format_total where kqdate = ? and resourceid=?",kqdate,userid);
rs.writeLog("select * from kq_format_total where kqdate = '"+ kqdate +"' and resourceid="+ userid); rs.writeLog("select * from kq_format_total where kqdate = '"+ kqdate +"' and resourceid="+ userid);
while(rs.next()){ while(rs.next()){
int serialid = Util.getIntValue(rs.getString("serialid")); int serialid = Util.getIntValue(rs.getString("serialid"));
double attendanceMins = Util.getDoubleValue(rs.getString("attendanceMins"),0.00); double attendanceMins = Util.getDoubleValue(rs.getString("attendanceMins"),0.00);
attendanceMins = attendanceMins / 60;
double overTimeTotal = getOverTimeTotal(kqdate,userid); double overTimeTotal = getOverTimeTotal(kqdate,userid);
double time = attendanceMins+overTimeTotal; double time = attendanceMins+overTimeTotal;
//1、 12小时工作制夜班、做六休一夜班有夜班补贴并且出勤上班时间+加班时间)>=8小时统计一次
if(serialid == sixnight_serialid|| serialid == twelvehours_night_serialid){ if(serialid == sixnight_serialid|| serialid == twelvehours_night_serialid){
if(time >= 8){ if(time >= 8){
result ++; result = 1;
}
}
//2、当一线人员排“夜休”班次并且加班台账当天导入的加班时长>=8小时统计一次。
if(serialid == night_rest_serialid){
if(overTimeTotal >= 8){
result ++;
} }
} }
} }
@ -2499,32 +2234,19 @@ public class KQReportBiz extends BaseBean {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
int sixnight_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","sixnight_serialid")); int sixnight_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","sixnight_serialid"));
int twelvehours_night_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","twelvehours_night_serialid")); int twelvehours_night_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","twelvehours_night_serialid"));
int night_rest_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","night_rest_serialid"));
rs.executeQuery("select * from kq_format_total where kqdate >= ? and kqdate <= ? and resourceid=?",fromDate,toDate,userid); rs.executeQuery("select * from kq_format_total where kqdate >= ? and kqdate <= ? and resourceid=?",fromDate,toDate,userid);
rs.writeLog("select * from kq_format_total where kqdate >= '"+ fromDate +"' and kqdate <= '"+ toDate +"' and resourceid="+ userid); rs.writeLog("select * from kq_format_total where kqdate >= '"+ fromDate +"' and kqdate <= '"+ toDate +"' and resourceid="+ userid);
while(rs.next()){ while(rs.next()){
int serialid = Util.getIntValue(rs.getString("serialid")); int serialid = Util.getIntValue(rs.getString("serialid"));
String kqdate = Util.null2String(rs.getString("kqdate")); String kqdate = Util.null2String(rs.getString("kqdate"));
double attendanceMins = Util.getDoubleValue(rs.getString("attendanceMins"),0.00); double attendanceMins = Util.getDoubleValue(rs.getString("attendanceMins"),0.00);
attendanceMins = attendanceMins / 60;
rs.writeLog("========= getNightSubsidyTotal attendanceMins ========== "+ attendanceMins);
double overTimeTotal = getOverTimeTotal(kqdate,userid); double overTimeTotal = getOverTimeTotal(kqdate,userid);
rs.writeLog("========= getNightSubsidyTotal overTimeTotal ========== "+ overTimeTotal);
double time = attendanceMins+overTimeTotal; double time = attendanceMins+overTimeTotal;
rs.writeLog("========= getNightSubsidyTotal time ========== "+ time);
if(serialid == sixnight_serialid|| serialid == twelvehours_night_serialid){ if(serialid == sixnight_serialid|| serialid == twelvehours_night_serialid){
if(time >= 8){ if(time >= 8){
result++; result++;
} }
} }
rs.writeLog("========= getNightSubsidyTotal result 111 ========== "+ result);
//2、当一线人员排“夜休”班次并且加班台账当天导入的加班时长>=8小时统计一次。
if(serialid == night_rest_serialid){
if(overTimeTotal >= 8){
result ++;
}
}
rs.writeLog("========= getNightSubsidyTotal result 222 ========== "+ result);
} }
return result; return result;
} }
@ -2559,10 +2281,11 @@ public class KQReportBiz extends BaseBean {
String tablename_dt = tablename+"_dt1"; String tablename_dt = tablename+"_dt1";
rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c" + rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c" +
"where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3" + "where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3" +
"and a.detail_signdate >=? and a.detail_signdate <=? and a.resourceId=?",fromDate,toDate,userid); "and a.ksrq >=? and a.jsrq <=? and a.resourceId=?",fromDate,toDate,userid);
while(rs.next()){ if(rs.next()){
result++;
} }
result = rs.getCounts();
return result; return result;
} }
@ -2580,8 +2303,8 @@ public class KQReportBiz extends BaseBean {
rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c" + rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c" +
"where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3" + "where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3" +
"and b.detail_signdate =? and a.resourceId=?",kqdate,userid); "and b.detail_signdate =? and a.resourceId=?",kqdate,userid);
while(rs.next()){ if(rs.next()){
result ++; result = 1;
} }
return result; return result;
} }

@ -5,15 +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.KQFormatBiz; import com.engine.kq.biz.*;
import com.engine.kq.biz.KQHolidaySetBiz;
import com.engine.kq.biz.KQLeaveRulesBiz;
import com.engine.kq.biz.KQOvertimeRulesBiz;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.biz.KQReportFieldComInfo;
import com.engine.kq.biz.KQSettingsComInfo;
import com.engine.kq.biz.KQShiftManagementComInfo;
import com.engine.kq.biz.KQUnitBiz;
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 org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -31,11 +23,7 @@ import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv; import weaver.systeminfo.SystemEnv;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> { public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
@ -198,11 +186,11 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum")); String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
//支援班次统计 //支援班次统计
String supportSerId = new BaseBean().getPropValue("nbkq_main", "supportSerId"); String supportSerId = new BaseBean().getPropValue("nbkq_main", "supportSerId");
String backFields = " (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayworkdays," + String backFields = " (select sum(workdays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and (DATEPART(dw, kqdate) = 7 or DATEPART(dw, kqdate) = 1)) as saturdayworkdays," +
" (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid=" + supportSerId + " )as supportTotal," + " (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid=" + supportSerId + " )as supportTotal," +
" (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," + " (select sum(attendancedays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and (DATEPART(dw, kqdate) = 7 or DATEPART(dw, kqdate) = 1)) as saturdayattendancedays," +
" (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," + " (select sum(workdays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and DATEPART(dw, kqdate) != 7 and DATEPART(dw, kqdate) != 1) as weekdayworkdays," +
" (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayattendancedays," + " (select sum(attendancedays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and DATEPART(dw, kqdate) != 7 and DATEPART(dw, kqdate) != 1) as weekdayattendancedays," +
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," + "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, " +
@ -341,10 +329,6 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
Map<String, Object> flowData = kqReportBiz.getFlowData(params, user); Map<String, Object> flowData = kqReportBiz.getFlowData(params, user);
Map<String, Object> saturdayFlowLeaveData = kqReportBiz.getSaturdayFlowLeaveData(params, user); Map<String, Object> saturdayFlowLeaveData = kqReportBiz.getSaturdayFlowLeaveData(params, user);
Map<String, Object> saturdayFlowLeaveBackData = kqReportBiz.getSaturdayFlowLeaveBackData(params, user);
if ((!CollectionUtils.isEmpty(saturdayFlowLeaveBackData)) || saturdayFlowLeaveBackData.size() > 0) {
saturdayFlowLeaveData.putAll(saturdayFlowLeaveBackData);
}
rs.execute(sql); rs.execute(sql);
rs.writeLog("========== GetKQReportCmd sql ========== " + sql); rs.writeLog("========== GetKQReportCmd sql ========== " + sql);
while (rs.next()) { while (rs.next()) {
@ -516,11 +500,10 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
} }
String sjbjcjRes = "0.0"; String sjbjcjRes = "0.0";
String hjsjRes = "0.0"; String hjsjRes = "0.0";
for (int ia = 0; allLeaveRules != null && ia < allLeaveRules.size(); ia++) { for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
leaveRule = (Map<String, Object>) allLeaveRules.get(ia);
int i = Integer.valueOf(leaveRule.get("id").toString());
if (((!CollectionUtils.isEmpty(sjbjcjidList)) && sjbjcjidList.contains(i)) || if (((!CollectionUtils.isEmpty(sjbjcjidList)) && sjbjcjidList.contains(i)) ||
((!CollectionUtils.isEmpty(hjsjidList)) && hjsjidList.contains(i))) { ((!CollectionUtils.isEmpty(hjsjidList)) && hjsjidList.contains(i))) {
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
String flowType = Util.null2String("leaveType_" + leaveRule.get("id")); String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
String leaveData = Util.null2String(saturdayFlowLeaveData.get(id + "|" + flowType)); String leaveData = Util.null2String(saturdayFlowLeaveData.get(id + "|" + flowType));
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id")); String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));

@ -28,6 +28,7 @@ import java.util.*;
import java.io.*; import java.io.*;
import java.net.*; import java.net.*;
import com.sun.net.ssl.internal.www.protocol.https.BASE64Encoder;
import org.apache.oro.text.regex.*; import org.apache.oro.text.regex.*;
import weaver.system.*; import weaver.system.*;
@ -1478,7 +1479,7 @@ public class SendMail extends MailErrorBean {
InputStream is = (InputStream) fileContentList.get(i); InputStream is = (InputStream) fileContentList.get(i);
String filename = (String) fileNameList.get(i); String filename = (String) fileNameList.get(i);
String ctype = FileTypeMap.getDefaultFileTypeMap().getContentType(filename); String ctype = FileTypeMap.getDefaultFileTypeMap().getContentType(filename);
sun.misc.BASE64Encoder enc = new sun.misc.BASE64Encoder(); BASE64Encoder enc = new BASE64Encoder();
filename = "=?UTF-8?B?" + enc.encode(filename.getBytes("UTF-8")) + "?="; filename = "=?UTF-8?B?" + enc.encode(filename.getBytes("UTF-8")) + "?=";
filename = filename.replace("\n", ""); // 当文件名过长时 filename = filename.replace("\n", ""); // 当文件名过长时
StringBuffer sb = new StringBuffer(filename.length()); // 需要 StringBuffer sb = new StringBuffer(filename.length()); // 需要

Loading…
Cancel
Save