Lee
parent
1dab0ec245
commit
144e9a7f51
@ -0,0 +1,40 @@
|
||||
#宁波精华考勤需求
|
||||
#管理人员指定人员考勤组id
|
||||
glrygroupid=6
|
||||
#管理人员考勤组id
|
||||
glgroupid=3
|
||||
#事假病假产假id
|
||||
sjbjcjid=6,7,8
|
||||
#婚假丧假id
|
||||
hjsjid=10,11
|
||||
#预入职流程id
|
||||
yrzWfid=518
|
||||
#固定流程创建人id
|
||||
lccjr=43
|
||||
#目录id
|
||||
secid=187
|
||||
#管理人员12小时班制白班id
|
||||
searIdBb=3
|
||||
#管理人员12小时班制白班最大加班时长
|
||||
bbMaxMins=150
|
||||
#管理人员12小时班制夜班id
|
||||
searIdYb=2
|
||||
#管理人员12小时班制夜班最大加班时长
|
||||
ybMaxMins=240
|
||||
#加班申请流程表名
|
||||
lctableName=formtable_main_374
|
||||
#两小时起步加班休班次id
|
||||
twoStartSerId=12
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,485 @@
|
||||
package com.engine.kq.biz;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean;
|
||||
import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
|
||||
import com.engine.kq.entity.KQShiftRuleEntity;
|
||||
import com.engine.kq.entity.TimeScopeEntity;
|
||||
import com.engine.kq.entity.TimeSignScopeEntity;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 格式化数据 人性化规则
|
||||
*/
|
||||
public class KQFormatShiftRule extends BaseBean {
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public KQShiftRuleEntity doShiftRule(WorkTimeEntity workTime, KQShiftRuleEntity kqShiftRuleEntity) {
|
||||
Map<String, Object> shiftRuleInfo = workTime.getShiftRuleInfo();
|
||||
//人性化处理
|
||||
if (shiftRuleInfo != null && shiftRuleInfo.size() > 0) {
|
||||
Map<String, Object> ruleDetail = (Map<String, Object>) shiftRuleInfo.get("ruleDetail");
|
||||
//允许迟到分钟数
|
||||
boolean usepermitlateminutes = Util.null2String(shiftRuleInfo.get("permitlatestatus")).equals("1");
|
||||
int permitlateminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("permitlateminutes")), 0);
|
||||
boolean enableexcludelate = Util.null2String(shiftRuleInfo.get("enableexcludelate")).equals("1");
|
||||
//允许早退分钟数
|
||||
boolean usepermitleaveearlyminutes = Util.null2String(shiftRuleInfo.get("permitleaveearlystatus")).equals("1");
|
||||
int permitleaveearlyminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("permitleaveearlyminutes")), 0);
|
||||
boolean enableexcludeleaveearly = Util.null2String(shiftRuleInfo.get("enableexcludeleaveearly")).equals("1");
|
||||
|
||||
//严重迟到分钟数
|
||||
boolean useseriouslateminutes = Util.null2String(shiftRuleInfo.get("seriouslatestatus")).equals("1");
|
||||
int seriouslateminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("seriouslateminutes")), 0);
|
||||
//严重早退分钟数
|
||||
boolean useseriousleaveearlyminutes = Util.null2String(shiftRuleInfo.get("seriousleaveearlystatus")).equals("1");
|
||||
int seriousleaveearlyminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("seriousleaveearlyminutes")), 0);
|
||||
//迟到多少钟数算旷工
|
||||
boolean uselateabsentminutes = Util.null2String(shiftRuleInfo.get("lateabsentstatus")).equals("1");
|
||||
int lateabsentminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("lateabsentminutes")), 0);
|
||||
//早退多少钟数算旷工
|
||||
boolean useleaveearlyabsentminutes = Util.null2String(shiftRuleInfo.get("leaveearlyabsentstatus")).equals("1");
|
||||
int leaveearlyabsentminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("leaveearlyabsentminutes")), 0);
|
||||
//允许下班不打卡
|
||||
boolean isoffdutyfreecheck = Util.null2String(shiftRuleInfo.get("isoffdutyfreecheck")).equals("1");
|
||||
|
||||
String userId = kqShiftRuleEntity.getUserId();
|
||||
String kqDate = kqShiftRuleEntity.getKqDate();
|
||||
int beLateMins = kqShiftRuleEntity.getBelatemins();
|
||||
int graveBeLateMins = 0;
|
||||
int leaveEarlyMins = kqShiftRuleEntity.getLeaveearlymins();
|
||||
int graveLeaveEarlyMins = 0;
|
||||
int absenteeismMins = kqShiftRuleEntity.getAbsenteeismmins();
|
||||
int forgotcheckMins = kqShiftRuleEntity.getForgotcheckmins();
|
||||
int forgotBeginWorkCheckMins = kqShiftRuleEntity.getForgotBeginWorkCheckMins();
|
||||
int earlyInMins = kqShiftRuleEntity.getEarlyInMins();
|
||||
int lateOutMins = kqShiftRuleEntity.getLateOutMins();
|
||||
|
||||
List<Object> earlyinearlyout = null;//早到早走规则
|
||||
List<Object> lateinlateout = null;//晚到晚走规则
|
||||
List<Object> lateoutlatein = null;//晚走晚到规则
|
||||
|
||||
//这里个性化没法处理流程数据,逻辑改为在前面直接虚拟改掉了上下班时间
|
||||
if (ruleDetail != null && ruleDetail.size() > 0 && false) {//处理人性化设置其他规则
|
||||
earlyinearlyout = (List<Object>) ruleDetail.get("earlyinearlyout");
|
||||
lateinlateout = (List<Object>) ruleDetail.get("lateinlateout");
|
||||
lateoutlatein = (List<Object>) ruleDetail.get("lateoutlatein");
|
||||
|
||||
if (earlyinearlyout != null && earlyinearlyout.size() > 0 && leaveEarlyMins > 0) {
|
||||
for (int i = 0; earlyInMins > 0 && i < earlyinearlyout.size(); i++) {
|
||||
Map<String, Object> rule = (Map<String, Object>) earlyinearlyout.get(i);
|
||||
if (Util.null2String(rule.get("enable")).equals("1")) {
|
||||
int advancetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("advancetime"))))).intValue();//早到时间
|
||||
int postponetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("postponetime"))))).intValue();//允许早走时间
|
||||
if (Util.null2String(rule.get("enablesame")).equals("1")) {
|
||||
if(earlyInMins>postponetime){
|
||||
leaveEarlyMins -= postponetime;
|
||||
if (leaveEarlyMins < 0) leaveEarlyMins = 0;
|
||||
}else{
|
||||
leaveEarlyMins -= earlyInMins;
|
||||
if (leaveEarlyMins < 0) leaveEarlyMins = 0;
|
||||
}
|
||||
break;
|
||||
}else{
|
||||
if (earlyInMins >= advancetime) {
|
||||
leaveEarlyMins -= postponetime;
|
||||
if (leaveEarlyMins < 0) leaveEarlyMins = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lateinlateout != null && lateinlateout.size() > 0 && beLateMins > 0) {
|
||||
for (int i = 0; lateOutMins > 0 && i < lateinlateout.size(); i++) {
|
||||
Map<String, Object> rule = (Map<String, Object>) lateinlateout.get(i);
|
||||
if (Util.null2String(rule.get("enable")).equals("1")) {
|
||||
int advancetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("advancetime"))))).intValue();//晚到时间
|
||||
int postponetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("postponetime"))))).intValue();//需要晚走时间
|
||||
if (Util.null2String(rule.get("enablesame")).equals("1")) {
|
||||
if(lateOutMins>postponetime){
|
||||
beLateMins -= postponetime;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
}else{
|
||||
beLateMins -= lateOutMins;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
}
|
||||
break;
|
||||
}else{
|
||||
if (lateOutMins >= postponetime) {
|
||||
beLateMins -= advancetime;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lateoutlatein != null && lateoutlatein.size() > 0 && beLateMins > 0) {
|
||||
int preDayLateOutMins = getPreDayLateOutMins(userId, kqDate);
|
||||
for (int i = 0; preDayLateOutMins > 0 && i < lateoutlatein.size(); i++) {
|
||||
Map<String, Object> rule = (Map<String, Object>) lateoutlatein.get(i);
|
||||
if (Util.null2String(rule.get("enable")).equals("1")) {
|
||||
int advancetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("advancetime"))))).intValue();//晚走时间
|
||||
int postponetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("postponetime"))))).intValue();//允许晚到时间
|
||||
|
||||
if (Util.null2String(rule.get("enablesame")).equals("1")) {
|
||||
if(preDayLateOutMins>postponetime){
|
||||
beLateMins -= postponetime;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
}else{
|
||||
beLateMins -= preDayLateOutMins;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
}
|
||||
break;
|
||||
}else{
|
||||
if (preDayLateOutMins >= advancetime) {
|
||||
beLateMins -= postponetime;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (beLateMins > 0) {//迟到人性化设置
|
||||
if (usepermitlateminutes) {//允许迟到分钟数
|
||||
if(permitlateminutes >= beLateMins) {
|
||||
beLateMins = 0;
|
||||
}else if(enableexcludelate){
|
||||
beLateMins = beLateMins - permitlateminutes;
|
||||
}
|
||||
}
|
||||
|
||||
if (uselateabsentminutes && beLateMins >= lateabsentminutes) {//旷工
|
||||
absenteeismMins += beLateMins;
|
||||
beLateMins = 0;
|
||||
//leaveEarlyMins = 0;
|
||||
forgotcheckMins=0 ;
|
||||
} else if (useseriouslateminutes && beLateMins >= seriouslateminutes) {//严重迟到
|
||||
graveBeLateMins += beLateMins;
|
||||
//TODO 这有个问题,严重迟到了,还要不要算迟到?这两个是同时存在的吗?
|
||||
beLateMins = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (leaveEarlyMins > 0) {//早退人性化设置
|
||||
if (usepermitleaveearlyminutes) {//允许早退分钟数
|
||||
if(permitleaveearlyminutes >= leaveEarlyMins){
|
||||
leaveEarlyMins = 0;
|
||||
}else if (enableexcludeleaveearly) {
|
||||
leaveEarlyMins = leaveEarlyMins - permitleaveearlyminutes;
|
||||
}
|
||||
}
|
||||
if (useleaveearlyabsentminutes && leaveEarlyMins >= leaveearlyabsentminutes) {//旷工
|
||||
absenteeismMins += leaveEarlyMins;
|
||||
//beLateMins = 0;
|
||||
leaveEarlyMins = 0;
|
||||
forgotcheckMins=0 ;
|
||||
forgotBeginWorkCheckMins = 0;
|
||||
} else if (useseriousleaveearlyminutes && leaveEarlyMins >= seriousleaveearlyminutes) {//严重早退
|
||||
graveLeaveEarlyMins += leaveEarlyMins;
|
||||
//TODO 这有个问题,严重早退了,还要不要算早退?这两个是同时存在的吗?
|
||||
leaveEarlyMins = 0;
|
||||
}
|
||||
}
|
||||
//允许下班不打卡
|
||||
if (isoffdutyfreecheck) {
|
||||
forgotcheckMins = 0;
|
||||
}
|
||||
|
||||
kqShiftRuleEntity.setBelatemins(beLateMins);
|
||||
kqShiftRuleEntity.setGravebelatemins(graveBeLateMins);
|
||||
kqShiftRuleEntity.setLeaveearlymins(leaveEarlyMins);
|
||||
kqShiftRuleEntity.setGraveleaveearlymins(graveLeaveEarlyMins);
|
||||
kqShiftRuleEntity.setAbsenteeismmins(absenteeismMins);
|
||||
kqShiftRuleEntity.setForgotcheckmins(forgotcheckMins);
|
||||
kqShiftRuleEntity.setForgotBeginWorkCheckMins(forgotBeginWorkCheckMins);
|
||||
}
|
||||
return kqShiftRuleEntity;
|
||||
}
|
||||
|
||||
public int getEarlyInMins(String userId, String kqDate){
|
||||
int earlyInMins = 0;
|
||||
boolean oneSign = false;
|
||||
String preDate = DateUtil.addDate(kqDate, -1);//上一天日期
|
||||
String nextDate = DateUtil.addDate(kqDate, 1);//下一天日期
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId, kqDate);
|
||||
List<TimeScopeEntity> lsSignTime = new ArrayList<>();
|
||||
List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
|
||||
if (workTime != null) {
|
||||
lsSignTime = workTime.getSignTime();//允许打卡时间
|
||||
lsWorkTime = workTime.getWorkTime();//工作时间
|
||||
oneSign = lsWorkTime != null && lsWorkTime.size() == 1;
|
||||
}
|
||||
|
||||
if (oneSign) {
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
TimeScopeEntity signTimeScope = lsSignTime.get(0);
|
||||
TimeScopeEntity workTimeScope = lsWorkTime.get(0);
|
||||
int workBeginIdx = kqTimesArrayComInfo.getArrayindexByTimes(workTimeScope.getBeginTime());
|
||||
|
||||
List<Object> lsCheckInfo = new KQFormatSignData().getSignInfo(userId,signTimeScope,workTimeScope,kqDate,preDate,nextDate,kqTimesArrayComInfo);
|
||||
for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) {
|
||||
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(j);
|
||||
String signDate = Util.null2String(checkInfo.get("signDate"));
|
||||
String signTime = Util.null2String(checkInfo.get("signTime"));
|
||||
String deduct_signintime = Util.null2String(checkInfo.get("deduct_signintime"));
|
||||
if (checkInfo.get("signType").equals("1")) {//签到
|
||||
//有签到但是没有signTime是因为开启了流程抵扣打卡
|
||||
if(null == signTime || signTime.length()<5){
|
||||
continue;
|
||||
}else{
|
||||
writeLog("signDate:"+signDate+",signTime="+signTime+",checkInfo="+checkInfo.toString());
|
||||
}
|
||||
String signMinTime = signTime.substring(0,5)+":00";
|
||||
boolean signInWorkBeginTime = false;
|
||||
if(signTime.compareTo(signMinTime) > 0){
|
||||
//如果签到时间是带秒的且是迟到,那么签到时间多一秒和多一分钟是一样的
|
||||
signInWorkBeginTime = true;
|
||||
}
|
||||
String signInTime = signTime;
|
||||
int signInTimeIndx = kqTimesArrayComInfo.getArrayindexByTimes(signInTime);
|
||||
String flow_signInTime = "";
|
||||
if(deduct_signintime.length() > 0){
|
||||
if(signTime.length() > 0){
|
||||
if(deduct_signintime.compareTo(signTime) < 0){
|
||||
flow_signInTime = deduct_signintime;
|
||||
}
|
||||
}else{
|
||||
flow_signInTime = deduct_signintime;
|
||||
}
|
||||
}
|
||||
if(flow_signInTime.length() > 0){
|
||||
signInTimeIndx = kqTimesArrayComInfo.getArrayindexByTimes(flow_signInTime);
|
||||
}
|
||||
if(kqDate.compareTo(signDate) < 0)signInTimeIndx+=1440;
|
||||
if(signInWorkBeginTime){
|
||||
signInTimeIndx = signInTimeIndx + 1;
|
||||
}
|
||||
if(workBeginIdx>signInTimeIndx) {
|
||||
earlyInMins = workBeginIdx-signInTimeIndx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return earlyInMins;
|
||||
}
|
||||
|
||||
public int getLateOutMins(String userId, String kqDate){
|
||||
int lateOutMins = 0;
|
||||
boolean oneSign = false;
|
||||
String preDate = DateUtil.addDate(kqDate, -1);//上一天日期
|
||||
String nextDate = DateUtil.addDate(kqDate, 1);//下一天日期
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId, kqDate);
|
||||
List<TimeScopeEntity> lsSignTime = new ArrayList<>();
|
||||
List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
|
||||
if (workTime != null) {
|
||||
lsSignTime = workTime.getSignTime();//允许打卡时间
|
||||
lsWorkTime = workTime.getWorkTime();//工作时间
|
||||
oneSign = lsWorkTime != null && lsWorkTime.size() == 1;
|
||||
}
|
||||
|
||||
if (oneSign) {
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
TimeScopeEntity signTimeScope = lsSignTime.get(0);
|
||||
TimeScopeEntity workTimeScope = lsWorkTime.get(0);
|
||||
int workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(workTimeScope.getEndTime());
|
||||
|
||||
List<Object> lsCheckInfo = new KQFormatSignData().getSignInfo(userId,signTimeScope,workTimeScope,kqDate,preDate,nextDate,kqTimesArrayComInfo);
|
||||
for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) {
|
||||
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(j);
|
||||
String signDate = Util.null2String(checkInfo.get("signDate"));
|
||||
String signTime = Util.null2String(checkInfo.get("signTime"));
|
||||
String deduct_signofftime = Util.null2String(checkInfo.get("deduct_signofftime"));
|
||||
if (checkInfo.get("signType").equals("2")) {//签退
|
||||
String signOutTime = signTime;
|
||||
int signInTimeOutdx = kqTimesArrayComInfo.getArrayindexByTimes(signOutTime);
|
||||
String flow_signOutTime = signOutTime;
|
||||
if(deduct_signofftime.length() > 0){
|
||||
if(signTime.length() > 0){
|
||||
if(deduct_signofftime.compareTo(signTime) > 0){
|
||||
flow_signOutTime = deduct_signofftime;
|
||||
}
|
||||
}else{
|
||||
flow_signOutTime = deduct_signofftime;
|
||||
}
|
||||
}
|
||||
if(flow_signOutTime.length() > 0){
|
||||
signInTimeOutdx = kqTimesArrayComInfo.getArrayindexByTimes(flow_signOutTime);
|
||||
}
|
||||
if(kqDate.compareTo(signDate) < 0)signInTimeOutdx+=1440;
|
||||
if(signInTimeOutdx>workEndIdx) {
|
||||
lateOutMins = signInTimeOutdx-workEndIdx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return lateOutMins;
|
||||
}
|
||||
|
||||
public int getPreDayLateOutMins(String userId, String kqDate) {
|
||||
return getPreDayLateOutMins(userId, kqDate, Lists.newArrayList());
|
||||
}
|
||||
/**
|
||||
* 前一天晚走分钟数
|
||||
*/
|
||||
public int getPreDayLateOutMins(String userId, String kqDate,List<String> logList) {
|
||||
int preDayLateOutMins = 0;
|
||||
|
||||
boolean oneSign = false;
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
//前一天是非工作日,往前取到工作日
|
||||
String tmpKQPreDate = DateUtil.addDate(kqDate, -1);
|
||||
for(int i=0;i<31;i++){
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId, tmpKQPreDate);
|
||||
if(workTime.getWorkMins()>0){
|
||||
kqDate = DateUtil.addDate(tmpKQPreDate, 1);
|
||||
break;
|
||||
}
|
||||
tmpKQPreDate = DateUtil.addDate(tmpKQPreDate, -1);
|
||||
}
|
||||
String kqPreDate = DateUtil.addDate(kqDate, -1);;
|
||||
String kqPrePreDate = DateUtil.addDate(kqDate, -2);
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId, kqPreDate);
|
||||
List<TimeScopeEntity> lsSignTime = new ArrayList<>();
|
||||
List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
|
||||
if (workTime != null) {
|
||||
lsSignTime = workTime.getSignTime();//允许打卡时间
|
||||
lsWorkTime = workTime.getWorkTime();//工作时间
|
||||
oneSign = lsWorkTime != null && lsWorkTime.size() == 1;
|
||||
}
|
||||
|
||||
if (oneSign) {
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
TimeScopeEntity signTimeScope = lsSignTime.get(0);
|
||||
TimeScopeEntity workTimeScope = lsWorkTime.get(0);
|
||||
String signBeginDateTime = signTimeScope.getBeginTimeAcross() ? kqPrePreDate : kqPreDate;
|
||||
signBeginDateTime += " " + kqTimesArrayComInfo.turn48to24Time(signTimeScope.getBeginTime()) + ":00";
|
||||
String signEndDateTime = signTimeScope.getEndTimeAcross() ? kqDate : kqPreDate;
|
||||
signEndDateTime += " " + kqTimesArrayComInfo.turn48to24Time(signTimeScope.getEndTime()) + ":00";
|
||||
String workBeginDateTime = workTimeScope.getBeginTimeAcross() ? kqPrePreDate : kqPreDate;
|
||||
workBeginDateTime += " " + kqTimesArrayComInfo.turn48to24Time(workTimeScope.getBeginTime()) + ":00";
|
||||
String workEndDateTime = workTimeScope.getEndTimeAcross() ? kqDate : kqPreDate;
|
||||
workEndDateTime += " " + kqTimesArrayComInfo.turn48to24Time(workTimeScope.getEndTime()) + ":00";
|
||||
|
||||
Map<String, String> shifRuleMap = Maps.newHashMap();
|
||||
String shif_workEndTime = "";
|
||||
getPre_ShiftRuleInfo(kqPreDate,workTime,lsSignTime,lsWorkTime,userId,shifRuleMap,logList);
|
||||
if(!shifRuleMap.isEmpty()){
|
||||
if(shifRuleMap.containsKey("shift_endworktime")){
|
||||
String shift_endworktime = Util.null2String(shifRuleMap.get("shift_endworktime"));
|
||||
if(shift_endworktime.length() > 0){
|
||||
shif_workEndTime = Util.null2String(shift_endworktime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Object> lsCheckInfo = new KQFormatSignData().getSignInfo(userId,signTimeScope,workTimeScope,kqPreDate,kqPrePreDate,kqDate,kqTimesArrayComInfo);
|
||||
Map<String, Object> checkInfo = null;
|
||||
if (lsCheckInfo.size() == 2) {
|
||||
for(int i = 0 ;i < lsCheckInfo.size() ;i++){
|
||||
checkInfo = (Map<String, Object>) lsCheckInfo.get(i);
|
||||
String signType = Util.null2String(checkInfo.get("signType"));
|
||||
if("2".equalsIgnoreCase(signType)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
String signDate = Util.null2String(checkInfo.get("signDate"));
|
||||
String signTime = Util.null2String(checkInfo.get("signTime"));
|
||||
String workEndTime = Util.null2String(workTimeScope.getEndTime());
|
||||
int workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(workEndTime);
|
||||
if(shif_workEndTime.length() > 0){
|
||||
workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(shif_workEndTime);
|
||||
}
|
||||
if (!kqPreDate.equals(signDate)) { //跨天
|
||||
signTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}
|
||||
int signOutTimeIdx = kqTimesArrayComInfo.getArrayindexByTimes(signTime);
|
||||
if (signOutTimeIdx > workEndIdx) {
|
||||
preDayLateOutMins = signOutTimeIdx - workEndIdx;
|
||||
logList.add("签退时间是:"+(signDate+" "+kqTimesArrayComInfo.turn48to24Time(signTime))+",晚走了"+preDayLateOutMins+"分钟");
|
||||
}
|
||||
}else if(!lsCheckInfo.isEmpty()){
|
||||
for(int i = 0 ;i < lsCheckInfo.size() ;i++){
|
||||
Map<String, Object> checkInfoMap = (Map<String, Object>) lsCheckInfo.get(i);
|
||||
String signType = Util.null2String(checkInfoMap.get("signType"));
|
||||
if("2".equalsIgnoreCase(signType)){
|
||||
String signDate = Util.null2String(checkInfoMap.get("signDate"));
|
||||
String signTime = Util.null2String(checkInfoMap.get("signTime"));
|
||||
String workEndTime = Util.null2String(workTimeScope.getEndTime());
|
||||
int workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(workEndTime);
|
||||
if(shif_workEndTime.length() > 0){
|
||||
workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(shif_workEndTime);
|
||||
}
|
||||
if (!kqPreDate.equals(signDate)) { //跨天
|
||||
signTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}
|
||||
int signOutTimeIdx = kqTimesArrayComInfo.getArrayindexByTimes(signTime);
|
||||
if (signOutTimeIdx > workEndIdx) {
|
||||
preDayLateOutMins = signOutTimeIdx - workEndIdx;
|
||||
logList.add(",签退时间是:"+(signDate+" "+signTime)+",晚走了"+preDayLateOutMins+"分钟");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return preDayLateOutMins;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取前一天的弹性时间
|
||||
* @param kqPreDate
|
||||
* @param workTime
|
||||
* @param lsSignTime
|
||||
* @param lsWorkTime
|
||||
* @param userId
|
||||
* @param logList
|
||||
*/
|
||||
public void getPre_ShiftRuleInfo(String kqPreDate, WorkTimeEntity workTime,
|
||||
List<TimeScopeEntity> lsSignTime, List<TimeScopeEntity> lsWorkTime, String userId,
|
||||
Map<String, String> shifRuleMap,List<String> logList) {
|
||||
ShiftInfoBean shiftInfoBean = new ShiftInfoBean();
|
||||
shiftInfoBean.setSplitDate(kqPreDate);
|
||||
shiftInfoBean.setShiftRuleMap(workTime.getShiftRuleInfo());
|
||||
shiftInfoBean.setSignTime(lsSignTime);
|
||||
shiftInfoBean.setWorkTime(lsWorkTime);
|
||||
KQShiftRuleInfoBiz.getShiftRuleInfo(shiftInfoBean, userId, shifRuleMap,false,logList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班次设置里面的上下班不打卡数据
|
||||
* @param i
|
||||
* @param serialId
|
||||
*/
|
||||
public Map<String, String> getModel_ShiftRule(int i,String serialId) {
|
||||
RecordSet rs = new RecordSet();
|
||||
HashMap<String,String> sectionMap = new HashMap<>();
|
||||
String getStartWorkSections = "select * from kq_ShiftOnOffWorkSections where SERIALID=? and record=? ";
|
||||
rs.executeQuery(getStartWorkSections,serialId,i);
|
||||
while (rs.next()) {
|
||||
String onoffworktype = Util.null2String(rs.getString("onoffworktype"));
|
||||
String clockinnot = Util.null2s(Util.null2String(rs.getString("clockinnot")), "0");
|
||||
sectionMap.put(onoffworktype, clockinnot);
|
||||
}
|
||||
return sectionMap;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,78 @@
|
||||
package com.engine.kq.cmd.attendanceEvent;
|
||||
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.kq.biz.KQGroupMemberComInfo;
|
||||
import com.engine.kq.biz.KQLeaveRulesBiz;
|
||||
import com.engine.kq.enums.DurationTypeEnum;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 请假用的时长计算
|
||||
*/
|
||||
public class GetLeaveWorkDurationCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetLeaveWorkDurationCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try{
|
||||
String newLeaveType = Util.null2String(params.get("newLeaveType"));
|
||||
String resourceId = Util.null2String(params.get("resourceId"));
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
String toDate = Util.null2String(params.get("toDate"));
|
||||
String fromTime = Util.null2String(params.get("fromTime"));
|
||||
String toTime = Util.null2String(params.get("toTime"));
|
||||
String timestamp = Util.null2String(params.get("timestamp"));
|
||||
|
||||
ResourceComInfo rci = new ResourceComInfo();
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
String groupid = kqGroupMemberComInfo.getKQGroupId(resourceId,fromDate);
|
||||
if(resourceId.length() > 0 && groupid.length() == 0){
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", rci.getLastname(resourceId)+","+fromDate+""+ SystemEnv.getHtmlLabelName(10005329,weaver.general.ThreadVarLanguage.getLang())+"");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String durationrule = Util.null2String(KQLeaveRulesBiz.getMinimumUnit(newLeaveType));
|
||||
String computingMode = Util.null2String(KQLeaveRulesBiz.getComputingMode(newLeaveType));
|
||||
|
||||
KQDurationCalculatorUtil kqDurationCalculatorUtil =new KQDurationCalculatorUtil.DurationParamBuilder(resourceId).
|
||||
fromDateParam(fromDate).toDateParam(toDate).fromTimeParam(fromTime).toTimeParam(toTime).
|
||||
newLeaveTypeParam(newLeaveType).durationRuleParam(durationrule).
|
||||
computingModeParam(computingMode).durationTypeEnumParam(DurationTypeEnum.LEAVE).build();
|
||||
|
||||
Map<String,Object> durationMap = kqDurationCalculatorUtil.getWorkDuration();
|
||||
|
||||
retmap.put("duration", Util.null2String(durationMap.get("duration")));
|
||||
retmap.put("min_duration", Util.null2String(durationMap.get("min_duration")));
|
||||
retmap.put("timestamp", timestamp);
|
||||
retmap.put("status", "1");
|
||||
}catch (Exception e) {
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,764 @@
|
||||
package com.engine.kq.cmd.report;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.UtilKQ;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
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 status = Util.null2String(jsonObj.get("status"));
|
||||
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"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")), ",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.removeIf(showColumn -> showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for (String showColumn : showColumns) {
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if (showColumn.equals("beLate")) {
|
||||
cascadekey = "beLateMins";
|
||||
} else if (showColumn.equals("leaveEearly")) {
|
||||
cascadekey = "leaveEarlyMins";
|
||||
} else if (showColumn.equals("graveBeLate")) {
|
||||
cascadekey = "graveBeLateMins";
|
||||
} else if (showColumn.equals("graveLeaveEarly")) {
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
} else if (showColumn.equals("absenteeism")) {
|
||||
cascadekey = "absenteeismMins";
|
||||
} else if (showColumn.equals("overtime")) {
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if (cascadekey.length() > 0) {
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("1", "" + user.getUID(), "a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String, Object>> constraintList = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (Util.null2String(kqReportFieldComInfo.getParentid()).length() > 0) continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals("kqCalendar")) continue;
|
||||
if (KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))
|
||||
continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))
|
||||
continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname()) && !showColumns.contains(kqReportFieldComInfo.getParentid()))
|
||||
continue;
|
||||
if ("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname()) && leaveRules.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if (unitType.length() > 0) {
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + unitType + ")");
|
||||
} else {
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width", 30 * 256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(), user);
|
||||
childColumns = (List<Object>) mapChildColumnInfo.get("childColumns");
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
} else {
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
|
||||
titleList.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(), user));
|
||||
}
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if (DateUtil.compDate(today, toDate) > 0) {//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// }
|
||||
|
||||
if (showColumns.contains("kqCalendar")) {
|
||||
childColumns = new ArrayList<>();
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
title = new HashMap<>();
|
||||
title.put("title", UtilKQ.getWeekDayShort(DateUtil.getWeek(date) - 1, user.getLanguage()) + "\r\n" + DateUtil.geDayOfMonth(date));
|
||||
title.put("width", 30 * 256);
|
||||
childColumns.add(title);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
title = new HashMap();
|
||||
title.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if (rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
} else if ((rs.getDBType()).equalsIgnoreCase("mysql")) {
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
} else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String, Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
//支援班次统计
|
||||
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," +
|
||||
" (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(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(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," +
|
||||
" 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.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.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" 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 + "" : "");
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ " + backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b,kq_ShiftManagement c " +
|
||||
"where a.id= b.resourceid and c.id=b.serialid and (c.rest_shift is null or c.rest_shift=0) " +
|
||||
"and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
|
||||
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 a.id 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<>'' ");
|
||||
}
|
||||
|
||||
if (status.length() > 0) {
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = " + status + "";
|
||||
} else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select " + backFields + sqlFrom + sqlWhere + groupBy + orderBy;
|
||||
|
||||
//System.out.println("start" + DateUtil.getFullDate());
|
||||
Map<String, Object> flowData = new KQReportBiz().getFlowData(params, user);
|
||||
Map<String, Object> saturdayFlowLeaveData = kqReportBiz.getSaturdayFlowLeaveData(params, user);
|
||||
//System.out.println("end" + DateUtil.getFullDate());
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey), "0");
|
||||
|
||||
|
||||
rs.execute(sql);
|
||||
rs.writeLog("========== ExportExcelCmd sql ========== " + sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
for (int fieldDataKeyIdx = 0; fieldDataKeyIdx < lsFieldDataKey.size(); fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
//补卡次数int
|
||||
if (fieldName.equals("fillCard")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(kqReportBiz.getFillCardCount(fromDate, toDate, id)));
|
||||
} else if (fieldName.equals("subcompany")) {
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if (tmpSubcompanyId.length() == 0) {
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if (tmpDepartmentId.length() == 0) {
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if (tmpJobtitleId.length() == 0) {
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if (fieldName.equals("attendanceSerial")) {
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
for (int i = 0; serialIds != null && i < serialIds.size(); i++) {
|
||||
data.add(kqReportBiz.getSerialCount(id, fromDate, toDate, serialIds.get(i)));
|
||||
}
|
||||
} else {
|
||||
data.add("");
|
||||
}
|
||||
continue;
|
||||
} else if (fieldName.equals("leave")) {//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if (Util.getDoubleValue(b_flowLeaveData, -1) < 0) {
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.add(flowLeaveData);
|
||||
}
|
||||
continue;
|
||||
} else if (fieldName.equals("overtime")) {
|
||||
//加班数据 — 取加班台账的数据
|
||||
//加班不关联调休工作日加班
|
||||
double workingDayOvertime_nonleave = kqReportBiz.getOverTimeCount(fromDate, toDate, id, "0", "1");
|
||||
//加班不关联调休休息日加班
|
||||
double restDayOvertime_nonleave = kqReportBiz.getOverTimeCount(fromDate, toDate, id, "1", "1");
|
||||
//加班不关联调休节假日加班
|
||||
double holidayOvertime_nonleave = kqReportBiz.getOverTimeCount(fromDate, toDate, id, "2", "1");
|
||||
//加班关联调休工作日加班
|
||||
double workingDayOvertime_4leave = kqReportBiz.getOverTimeCount(fromDate, toDate, id, "0", "0");
|
||||
//加班关联调休休息日加班
|
||||
double restDayOvertime_4leave = kqReportBiz.getOverTimeCount(fromDate, toDate, id, "1", "0");
|
||||
//加班关联调休节假日加班
|
||||
double holidayOvertime_4leave = kqReportBiz.getOverTimeCount(fromDate, toDate, id, "2", "0");
|
||||
|
||||
data.add(workingDayOvertime_nonleave);
|
||||
data.add(restDayOvertime_nonleave);
|
||||
data.add(holidayOvertime_nonleave);
|
||||
data.add(workingDayOvertime_4leave);
|
||||
data.add(restDayOvertime_4leave);
|
||||
data.add(holidayOvertime_4leave);
|
||||
|
||||
String overtimeTotal = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
data.add(overtimeTotal);
|
||||
|
||||
// fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_nonleave")));
|
||||
// data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
//
|
||||
// fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_nonleave")));
|
||||
// data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
//
|
||||
// fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_nonleave")));
|
||||
// data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
//
|
||||
// fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_4leave")));
|
||||
// data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
//
|
||||
// fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_4leave")));
|
||||
// data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
//
|
||||
// fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_4leave")));
|
||||
// data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
//
|
||||
// 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")));
|
||||
// restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
// double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
// holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
//
|
||||
// double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
// workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
// double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
// restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
// double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
// holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
// fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
// workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
// data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
} else if (fieldName.equals("nightSubsidy")) {
|
||||
//夜班补贴次数
|
||||
double nightSubsidy = kqReportBiz.getNightSubsidyTotal(fromDate, toDate, id);
|
||||
data.add(nightSubsidy);
|
||||
continue;
|
||||
} else if (fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id + "|" + fieldName)), "0.0");
|
||||
String backType = fieldName + "_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + backType)), "0.0");
|
||||
String businessLeave = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (businessLeaveData.length() == 0) {
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if (businessLeavebackData.length() == 0) {
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if (Util.getDoubleValue(businessLeave, -1) < 0) {
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
} else if (Util.null2String(kqReportFieldComInfo.getCascadekey(fieldid)).length() > 0) {
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)), "" + user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
|
||||
List<String> lsCascadekey = Util.splitString2List(kqReportFieldComInfo.getCascadekey(fieldid), ",");
|
||||
for (int i = 0; i < lsCascadekey.size(); i++) {
|
||||
if (Util.null2String(rs.getString(lsCascadekey.get(i))).length() > 0) {
|
||||
fieldid = KQReportFieldComInfo.field2Id.get(lsCascadekey.get(i));
|
||||
//迟到早退使用分钟
|
||||
if (lsCascadekey.get(i).contains("LateMins") || lsCascadekey.get(i).contains("EarlyMins")) {
|
||||
fieldValue = rs.getString(lsCascadekey.get(i));
|
||||
} else {
|
||||
fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)), kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
} else {
|
||||
fieldValue = "0";
|
||||
}
|
||||
data.add(fieldValue);
|
||||
}
|
||||
continue;
|
||||
} else if (fieldName.equals("saturdaysbcjsc")) {
|
||||
BaseBean baseBean = new BaseBean();
|
||||
String sjbjcjidStr = baseBean.getPropValue("nbkq_main", "sjbjcjid");
|
||||
String[] sjbjcjidArr = sjbjcjidStr.split(",");
|
||||
List<Integer> sjbjcjidList = new ArrayList<>();
|
||||
for (String idT : sjbjcjidArr) {
|
||||
sjbjcjidList.add(Integer.valueOf(idT));
|
||||
}
|
||||
String sjbjcjRes = "0.0";
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
if (((!CollectionUtils.isEmpty(sjbjcjidList)) && sjbjcjidList.contains(i))) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(saturdayFlowLeaveData.get(id + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(saturdayFlowLeaveData.get(id + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if (Util.getDoubleValue(b_flowLeaveData, -1) < 0) {
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
if (StringUtils.isEmpty(flowLeaveData)) {
|
||||
flowLeaveData = "0.0";
|
||||
}
|
||||
if ((!CollectionUtils.isEmpty(sjbjcjidList)) && sjbjcjidList.contains(i)) {
|
||||
sjbjcjRes = new BigDecimal(sjbjcjRes).add(new BigDecimal(flowLeaveData)).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
fieldValue = sjbjcjRes;
|
||||
} else if (fieldName.equals("saturdayshjsc")) {
|
||||
BaseBean baseBean = new BaseBean();
|
||||
String hjsjidStr = baseBean.getPropValue("nbkq_main", "hjsjid");
|
||||
String[] hjsjidArr = hjsjidStr.split(",");
|
||||
List<Integer> hjsjidList = new ArrayList<>();
|
||||
for (String idT : hjsjidArr) {
|
||||
hjsjidList.add(Integer.valueOf(idT));
|
||||
}
|
||||
String hjsjRes = "0.0";
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
if (((!CollectionUtils.isEmpty(hjsjidList)) && hjsjidList.contains(i))) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(saturdayFlowLeaveData.get(id + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(saturdayFlowLeaveData.get(id + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if (Util.getDoubleValue(b_flowLeaveData, -1) < 0) {
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
if (StringUtils.isEmpty(flowLeaveData)) {
|
||||
flowLeaveData = "0.0";
|
||||
}
|
||||
if ((!CollectionUtils.isEmpty(hjsjidList)) && hjsjidList.contains(i)) {
|
||||
hjsjRes = new BigDecimal(hjsjRes).add(new BigDecimal(flowLeaveData)).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
fieldValue = hjsjRes;
|
||||
} else {
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)), "" + user.getLanguage());
|
||||
fieldValue = getFieldValueByUnitType(fieldValue, kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
fieldValue = Util.formatMultiLang(fieldValue, "" + user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
if (showColumns.contains("kqCalendar")) {
|
||||
Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user);
|
||||
isEnd = false;
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
if (DateUtil.compDate(today, date) > 0) {
|
||||
data.add("");
|
||||
} else {
|
||||
if (detialDatas.get(id + "|" + date) != null) {
|
||||
data.add(((Map<String, Object>) detialDatas.get(id + "|" + date)).get("text"));
|
||||
} else {
|
||||
data.add(SystemEnv.getHtmlLabelName(26593, user.getLanguage()));
|
||||
}
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
}
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList", constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390351, user.getLanguage()) + " " + fromDate + " " + toDate;
|
||||
workbook.put("fileName", fileName);
|
||||
ExcelUtil ExcelUtil = new ExcelUtil();
|
||||
Map<String, Object> exportMap = ExcelUtil.export(workbook, request, response);
|
||||
retmap.putAll(exportMap);
|
||||
retmap.put("status", "1");
|
||||
} catch (Exception e) {
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", SystemEnv.getHtmlLabelName(382661, user.getLanguage()));
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
private Map<String, Object> getChildColumnsInfo(String parentid, User user) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if (parentid.equals("attendanceSerial")) {//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
}
|
||||
for (int i = 0; serialIds != null && i < serialIds.size(); i++) {
|
||||
title = new HashMap<>();
|
||||
title.put("title", Util.formatMultiLang(kqShiftManagementComInfo.getSerial(serialIds.get(i)), "" + user.getLanguage()));
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
} else if (parentid.equals("leave")) {
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for (int i = 0; leaveRules != null && i < leaveRules.size(); i++) {
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")), "" + user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
String unitName = (KQUnitBiz.isLeaveHour(unitType)) ? SystemEnv.getHtmlLabelName(391, user.getLanguage()) : SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
title = new HashMap<>();
|
||||
title.put("title", name + "(" + unitName + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
} else if (parentid.equals("overtime")) {
|
||||
String[] overtimeChild = {"overtime_nonleave", "overtime_4leave", "overtimeTotal"};
|
||||
for (int i = 0; i < overtimeChild.length; i++) {
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if ("overtime_nonleave".equalsIgnoreCase(id)) {
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan", "2");
|
||||
} else if ("overtime_4leave".equalsIgnoreCase(id)) {
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan", "2");
|
||||
} else {
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial", "1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit() == 3 || KQOvertimeRulesBiz.getMinimumUnit() == 5 || KQOvertimeRulesBiz.getMinimumUnit() == 6) ? "2" : "1";
|
||||
String unitTypeName = "";
|
||||
if (Util.null2String(unitType).length() > 0) {
|
||||
if (unitType.equals("1")) {
|
||||
unitTypeName = SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
} else if (unitType.equals("2")) {
|
||||
unitTypeName = SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
} else if (unitType.equals("3")) {
|
||||
unitTypeName = SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()) + "(" + unitTypeName + ")");
|
||||
}
|
||||
|
||||
Map<String, Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>) mapChildColumnInfo.get("childColumns");
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")), 65);
|
||||
}
|
||||
title.put("width", childWidth + "");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else {
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if (!kqReportFieldComInfo.getReportType().equals("month")) continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns", titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user) {
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if (Util.null2String(cascadeKey).length() == 0) {
|
||||
return titleList;
|
||||
}
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey, ",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for (int i = 0; i < lsCascadeKey.size(); i++) {
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!kqReportFieldComInfo.getReportType().equals("month")) continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))) {
|
||||
title = new HashMap<>();
|
||||
//二开 迟到使用分钟
|
||||
if (kqReportFieldComInfo.getFieldname().contains("LateMins") || kqReportFieldComInfo.getFieldname().contains("EarlyMins")) {
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(分钟)");
|
||||
} else {
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
}
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
return titleList;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue, String unittype) {
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,745 @@
|
||||
package com.engine.kq.cmd.report;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public GetKQDailyReportCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
String pageUid = PageUidFactory.getHrmPageUid("KQDailyReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2", "" + user.getUID(), "a");
|
||||
|
||||
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 status = Util.null2String(jsonObj.get("status"));
|
||||
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 (typeselect.length() == 0) typeselect = "3";
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")), pageUid, user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String, Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String, Object> data = null;
|
||||
Map<String, Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (Util.null2String(kqReportFieldComInfo.getParentid()).length() > 0) continue;
|
||||
boolean isDaily = kqReportFieldComInfo.getReportType().equals("daily");
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !isDaily) continue;
|
||||
if ("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname()) && leaveRules.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(), user);
|
||||
childColumns = (List<Object>) mapChildColumnInfo.get("childColumns");
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
} else {
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
if (kqReportFieldComInfo.getReportType1().equals("daily")) {
|
||||
column.put("isdaily", "1");
|
||||
}
|
||||
column.put("showDetial", kqReportFieldComInfo.getShowDetial());
|
||||
//2024-01-31 二开 迟到时长使用分钟
|
||||
String title = (String) column.get("title");
|
||||
if (title.contains("迟到时长") || title.contains("早退时长")) {
|
||||
column.put("title", title + "(分钟)");
|
||||
column.put("unit", "");
|
||||
}
|
||||
if ("姓名".equals(column.get("title"))) {
|
||||
column.put("fixed", "left");
|
||||
}
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
// String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if (rs.getDBType().equalsIgnoreCase("oracle") && !Util.null2String(rs.getOrgindbtype()).equals("dm") && !Util.null2String(rs.getOrgindbtype()).equals("st") && !Util.null2String(rs.getOrgindbtype()).equals("jc")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
} else if ((rs.getDBType()).equalsIgnoreCase("mysql")) {
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
} else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
String backFields = " (select workdays from kq_format_total where resourceid = a.id and kqdate = b.kqdate and (DATEPART(dw, kqdate) = 7 or DATEPART(dw, kqdate) = 1)) as saturdayworkdays," +
|
||||
" (select attendancedays from kq_format_total where resourceid = a.id and kqdate = b.kqdate and (DATEPART(dw, kqdate) = 7 or DATEPART(dw, kqdate) = 1)) as saturdayattendancedays," +
|
||||
" (select workdays from kq_format_total where resourceid = a.id and kqdate = b.kqdate and DATEPART(dw, kqdate) != 7 and DATEPART(dw, kqdate) != 1) as weekdayworkdays," +
|
||||
" (select attendancedays from kq_format_total where resourceid = a.id and kqdate = b.kqdate and DATEPART(dw, kqdate) != 7 and DATEPART(dw, kqdate) != 1) as weekdayattendancedays," +
|
||||
" a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
|
||||
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
|
||||
" b.signdays,b.signmins, " +
|
||||
" b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism ,b.absenteeismMins ,(b.forgotCheck+" + forgotBeginWorkCheck_field + ") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'";
|
||||
String sqlWhere = rightSql;
|
||||
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 a.id 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<>'' ");
|
||||
}
|
||||
if (status.length() > 0) {
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = " + status + "";
|
||||
} else if (status.equals("8")) {
|
||||
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 + ") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()) {
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc, b.kqdate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc, b.kqdate desc ";
|
||||
sql = backFields + sqlFrom + sqlWhere + orderBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
} else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + pageSize + " offset " + ((pageIndex - 1) * pageSize);
|
||||
} else {
|
||||
orderBy = " order by dsporder asc, lastname asc, kqdate asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc, kqdate desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql + " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
Map<String, Object> flowData = kqReportBiz.getDailyFlowData(params, user);
|
||||
Map<String, Object> dailySaturdayFlowLeaveData = kqReportBiz.getDailySaturdayFlowLeaveData(params, user);
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey), "0");
|
||||
|
||||
new BaseBean().writeLog("kkkkkk:" + sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(id, kqdate);
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1")) continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))
|
||||
continue;
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String fieldValueID = rs.getString("subcompanyid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
//fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getSubCompanyID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String fieldValueID = rs.getString("departmentid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
//fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getDepartmentID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String fieldValueID = rs.getString("jobtitle");
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle"));
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getJobTitle(id);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
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")) {
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave < 0 ? 0 : restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
} else {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("serialid")) {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (fieldValue.length() > 0) {//弹性工作制没有班次
|
||||
data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage()));
|
||||
}
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
//2024-01-31 二开 迟到使用分钟
|
||||
writeLog("testreport-" + fieldName + fieldValue);
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0
|
||||
&& !fieldName.contains("LateMins") && !fieldName.contains("EarlyMins")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
data.putAll(this.getSignDetailInfo(id, kqdate));
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if (Util.getDoubleValue(b_flowLeaveData, -1) < 0) {
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
kqLog.info("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.put(flowType, flowLeaveData);
|
||||
}
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
String sjbjcjidStr = baseBean.getPropValue("nbkq_main", "sjbjcjid");
|
||||
String[] sjbjcjidArr = sjbjcjidStr.split(",");
|
||||
List<Integer> sjbjcjidList = new ArrayList<>();
|
||||
for (String idT : sjbjcjidArr) {
|
||||
sjbjcjidList.add(Integer.valueOf(idT));
|
||||
}
|
||||
String hjsjidStr = baseBean.getPropValue("nbkq_main", "hjsjid");
|
||||
String[] hjsjidArr = hjsjidStr.split(",");
|
||||
List<Integer> hjsjidList = new ArrayList<>();
|
||||
for (String idT : hjsjidArr) {
|
||||
hjsjidList.add(Integer.valueOf(idT));
|
||||
}
|
||||
String sjbjcjRes = "0.0";
|
||||
String hjsjRes = "0.0";
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
if (((!CollectionUtils.isEmpty(sjbjcjidList)) && sjbjcjidList.contains(i)) ||
|
||||
((!CollectionUtils.isEmpty(hjsjidList)) && hjsjidList.contains(i))) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(dailySaturdayFlowLeaveData.get(id + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(dailySaturdayFlowLeaveData.get(id + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if (Util.getDoubleValue(b_flowLeaveData, -1) < 0) {
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
if (StringUtils.isEmpty(flowLeaveData)) {
|
||||
flowLeaveData = "0.0";
|
||||
}
|
||||
if ((!CollectionUtils.isEmpty(sjbjcjidList)) && sjbjcjidList.contains(i)) {
|
||||
sjbjcjRes = new BigDecimal(sjbjcjRes).add(new BigDecimal(flowLeaveData)).toString();
|
||||
}
|
||||
if ((!CollectionUtils.isEmpty(hjsjidList)) && hjsjidList.contains(i)) {
|
||||
hjsjRes = new BigDecimal(hjsjRes).add(new BigDecimal(flowLeaveData)).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
data.put("saturdaysbcjsc", sjbjcjRes); // 周六事假病假产假时长
|
||||
data.put("saturdayshjsc", hjsjRes); // 周六丧假婚假时长
|
||||
|
||||
//加班数据 — 取加班台账的数据
|
||||
//加班不关联调休工作日加班
|
||||
double workingDayOvertime_nonleave = kqReportBiz.getOverTimeDailyCount(kqdate, id, "0", "1");
|
||||
//加班不关联调休休息日加班
|
||||
double restDayOvertime_nonleave = kqReportBiz.getOverTimeDailyCount(kqdate, id, "1", "1");
|
||||
//加班不关联调休节假日加班
|
||||
double holidayOvertime_nonleave = kqReportBiz.getOverTimeDailyCount(kqdate, id, "2", "1");
|
||||
//加班关联调休工作日加班
|
||||
double workingDayOvertime_4leave = kqReportBiz.getOverTimeDailyCount(kqdate, id, "0", "0");
|
||||
//加班关联调休休息日加班
|
||||
double restDayOvertime_4leave = kqReportBiz.getOverTimeDailyCount(kqdate, id, "1", "0");
|
||||
//加班关联调休节假日加班
|
||||
double holidayOvertime_4leave = kqReportBiz.getOverTimeDailyCount(kqdate, id, "2", "0");
|
||||
|
||||
rs.writeLog("================ GetKQDailyReportCmd workingDayOvertime_nonleave ============" + workingDayOvertime_nonleave);
|
||||
rs.writeLog("================ GetKQDailyReportCmd restDayOvertime_nonleave ============" + restDayOvertime_nonleave);
|
||||
rs.writeLog("================ GetKQDailyReportCmd holidayOvertime_nonleave ============" + holidayOvertime_nonleave);
|
||||
rs.writeLog("================ GetKQDailyReportCmd workingDayOvertime_4leave ============" + workingDayOvertime_4leave);
|
||||
rs.writeLog("================ GetKQDailyReportCmd restDayOvertime_4leave ============" + restDayOvertime_4leave);
|
||||
rs.writeLog("================ GetKQDailyReportCmd holidayOvertime_4leave ============" + holidayOvertime_4leave);
|
||||
|
||||
data.put("workingDayOvertime_nonleave", workingDayOvertime_nonleave);
|
||||
data.put("restDayOvertime_nonleave", restDayOvertime_nonleave);
|
||||
data.put("holidayOvertime_nonleave", holidayOvertime_nonleave);
|
||||
data.put("workingDayOvertime_4leave", workingDayOvertime_4leave);
|
||||
data.put("restDayOvertime_4leave", restDayOvertime_4leave);
|
||||
data.put("holidayOvertime_4leave", holidayOvertime_4leave);
|
||||
|
||||
String totalValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + workingDayOvertime_nonleave));
|
||||
data.put("workdayovertotal", totalValue);
|
||||
totalValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(restDayOvertime_4leave + restDayOvertime_nonleave));
|
||||
data.put("restdayovertotal", totalValue);
|
||||
totalValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(holidayOvertime_4leave + holidayOvertime_nonleave));
|
||||
data.put("holidayovertotal", totalValue);
|
||||
|
||||
String overtimeTotal = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
data.put("overtimeTotal", overtimeTotal);
|
||||
|
||||
//夜班补贴次数
|
||||
String nightSubsidy = KQDurationCalculatorUtil.getDurationRound(String.valueOf(kqReportBiz.getNightSubsidyDaily(kqdate, id)));
|
||||
data.put("nightSubsidy", nightSubsidy);
|
||||
|
||||
//补卡次数
|
||||
String fillCard = KQDurationCalculatorUtil.getDurationRound(String.valueOf(kqReportBiz.getFillCardCountDaily(kqdate, id)));
|
||||
data.put("fillCard", fillCard);
|
||||
|
||||
data.put("resourceId", id);
|
||||
data.put("kqdate", kqdate);
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope("" + user.getUID(), fromDate, toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
retmap.put("columns", columns);
|
||||
retmap.put("datas", datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
private String getUnitType(String unitType, User user) {
|
||||
String unitTypeName = "";
|
||||
if (Util.null2String(unitType).length() > 0) {
|
||||
if (unitType.equals("1")) {
|
||||
unitTypeName = SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
} else if (unitType.equals("2")) {
|
||||
unitTypeName = SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
} else if (unitType.equals("3")) {
|
||||
unitTypeName = SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
return unitTypeName;
|
||||
}
|
||||
|
||||
private Map<String, Object> getChildColumnsInfo(String parentid, User user) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if (parentid.equals("leave")) {
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for (int i = 0; leaveRules != null && i < leaveRules.size(); i++) {
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_" + Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ? SystemEnv.getHtmlLabelName(391, user.getLanguage()) : SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial", "1");
|
||||
sumChildColumnWidth += 65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
} else if (parentid.equals("overtime")) {
|
||||
String[] overtimeChild = {"overtime_nonleave", "overtime_4leave", "overtimeTotal", "workdayovertotal", "restdayovertotal", "holidayovertotal"};
|
||||
for (int i = 0; i < overtimeChild.length; i++) {
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if ("overtime_nonleave".equalsIgnoreCase(id)) {
|
||||
fieldlabel = "125805";
|
||||
} else if ("overtime_4leave".equalsIgnoreCase(id)) {
|
||||
fieldlabel = "125804";
|
||||
} else if ("workdayovertotal".equalsIgnoreCase(id)) {
|
||||
fieldlabel = "1";
|
||||
} else if ("restdayovertotal".equalsIgnoreCase(id)) {
|
||||
fieldlabel = "2";
|
||||
} else if ("holidayovertotal".equalsIgnoreCase(id)) {
|
||||
fieldlabel = "3";
|
||||
}else {
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial", "1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit() == 3 || KQOvertimeRulesBiz.getMinimumUnit() == 5 || KQOvertimeRulesBiz.getMinimumUnit() == 6) ? "2" : "1";
|
||||
String unitTypeName = "";
|
||||
if (Util.null2String(unitType).length() > 0) {
|
||||
if (unitType.equals("1")) {
|
||||
unitTypeName = SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
} else if (unitType.equals("2")) {
|
||||
unitTypeName = SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
} else if (unitType.equals("3")) {
|
||||
unitTypeName = SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String, Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>) mapChildColumnInfo.get("childColumns");
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")), 65);
|
||||
}
|
||||
column.put("width", childWidth + "");
|
||||
sumChildColumnWidth += childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
} else {
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if (!kqReportFieldComInfo.getReportType().equals("daily")) continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily") ? "1" : "0");
|
||||
sumChildColumnWidth += Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns", lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth", sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String, Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try {
|
||||
sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
int serialnumber = rs.getInt("serialnumber") + 1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
int workMins = rs.getInt("workMins");
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins = Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins = Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins = Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if (serialid.length() > 0) {
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate", workbegindate);
|
||||
signStatusInfo.put("worktime", workbegintime);
|
||||
signStatusInfo.put("beLateMins", beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins", forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins", graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins", absenteeismMins);
|
||||
signStatusInfo.put("leaveMins", leaveMins);
|
||||
signStatusInfo.put("leaveInfo", leaveInfo);
|
||||
signStatusInfo.put("evectionMins", evectionMins);
|
||||
signStatusInfo.put("outMins", outMins);
|
||||
|
||||
data.put("signintime" + serialnumber, signintime.length() == 0 ? SystemEnv.getHtmlLabelName(25994, user.getLanguage()) : signintime);
|
||||
data.put("signinstatus" + serialnumber, KQReportBiz.getSignStatus(signStatusInfo, user, "on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate", workenddate);
|
||||
signStatusInfo.put("worktime", kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins", leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins", graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins", forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins", forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins", absenteeismMins);
|
||||
signStatusInfo.put("leaveMins", leaveMins);
|
||||
signStatusInfo.put("leaveInfo", leaveInfo);
|
||||
signStatusInfo.put("evectionMins", evectionMins);
|
||||
signStatusInfo.put("outMins", outMins);
|
||||
|
||||
data.put("signouttime" + serialnumber, signouttime.length() == 0 ? SystemEnv.getHtmlLabelName(25994, user.getLanguage()) : signouttime);
|
||||
data.put("signoutstatus" + serialnumber, KQReportBiz.getSignStatus(signStatusInfo, user, "off"));
|
||||
}
|
||||
} else {
|
||||
if (workMins > 0) {
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins", leaveMins);
|
||||
signStatusInfo.put("leaveInfo", leaveInfo);
|
||||
signStatusInfo.put("evectionMins", evectionMins);
|
||||
signStatusInfo.put("outMins", outMins);
|
||||
|
||||
if (signinid.length() > 0) {
|
||||
data.put("signintime" + serialnumber, signintime.length() == 0 ? SystemEnv.getHtmlLabelName(25994, user.getLanguage()) : signintime);
|
||||
data.put("signinstatus" + serialnumber, KQReportBiz.getSignStatus(signStatusInfo, user, "on"));
|
||||
if (signoutid.length() > 0) {
|
||||
data.put("signouttime" + serialnumber, signouttime.length() == 0 ? SystemEnv.getHtmlLabelName(25994, user.getLanguage()) : signouttime);
|
||||
data.put("signoutstatus" + serialnumber, KQReportBiz.getSignStatus(signStatusInfo, user, "off"));
|
||||
}
|
||||
} else {
|
||||
data.put("signinstatus" + serialnumber, KQReportBiz.getSignStatus(signStatusInfo, user, "on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
package com.engine.kq.cmd.reportdetial;
|
||||
|
||||
import com.cloudstore.dev.api.util.Util_TableMap;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.hrm.util.HrmUtil;
|
||||
import com.engine.kq.biz.KQReportBiz;
|
||||
import com.engine.kq.enums.FlowReportTypeEnum;
|
||||
import com.engine.kq.enums.ReportColumnEnum;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* 迟到相关信息
|
||||
*/
|
||||
public class GetBeLateInfoCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetBeLateInfoCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try{
|
||||
String dialogTitle = SystemEnv.getHtmlLabelName(20088, user.getLanguage());
|
||||
String tabKey = Util.null2String(params.get("tabKey"));
|
||||
String resourceId = Util.null2String(params.get("resourceId"));
|
||||
String keyWord = Util.null2String(params.get("keyWord"));
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
String toDate = Util.null2String(params.get("toDate"));
|
||||
String typeselect =Util.null2String(params.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 viewScope = Util.null2String(params.get("viewScope"));
|
||||
String subCompanyId = Util.null2String(params.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(params.get("departmentId"));
|
||||
String allLevel = Util.null2String(params.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(params.get("isNoAccount"));
|
||||
String formula = Util.null2String(params.get("formula"));
|
||||
|
||||
String backFields = " a.id, b.resourceid,a.departmentid, a.lastname, a.workcode, a.status, a.dsporder, kqdate, serialid, serialid as serialid1," +
|
||||
" workbegintime,workendtime, signintime,signouttime, beLateMins, graveBeLateMins ";
|
||||
String sqlFrom = "from hrmresource a, kq_format_detail b ";
|
||||
String sqlWhere = " where a.id = b.resourceid";
|
||||
String orderby = " kqdate asc, workbegintime asc, a.id asc " ;
|
||||
String tableString = "";
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("1",""+user.getUID(),"a");
|
||||
if(rightSql.length()>0){
|
||||
sqlWhere += rightSql;
|
||||
}
|
||||
|
||||
if (keyWord.length() > 0){
|
||||
sqlWhere += " and lastname = "+keyWord;
|
||||
}
|
||||
|
||||
if (fromDate.length() > 0){
|
||||
sqlWhere += " and kqdate >= '"+fromDate+"'";
|
||||
}
|
||||
|
||||
if (toDate.length() > 0){
|
||||
sqlWhere += " and kqdate <= '"+toDate+"'";
|
||||
}
|
||||
|
||||
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<>'' ");
|
||||
}
|
||||
|
||||
if(tabKey.equals("2")){
|
||||
sqlWhere += " and graveBeLateMins>0 ";
|
||||
}else{
|
||||
sqlWhere += " and beLateMins>0 ";
|
||||
}
|
||||
|
||||
if(formula.length()>0){
|
||||
formula = formula.replace("${beLateMins}>","").replace("${beLateMins}<=","").replace("?1:0","").replace(" && ","-");
|
||||
String[] tmpValue = Util.splitString(formula,"-");
|
||||
sqlWhere += " and beLateMins>"+tmpValue[0]+" and beLateMins<= "+tmpValue[1];
|
||||
}
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径需求
|
||||
String transMethodString = HrmUtil.getKqDepartmentTransMethod();
|
||||
|
||||
String pageUid = PageUidFactory.getHrmPageUid("KQReportDetialList");
|
||||
|
||||
tableString=""+
|
||||
"<table pageUid=\""+pageUid+"\" pagesize=\"10\" tabletype=\"none\">"+
|
||||
"<sql backfields=\""+backFields+"\" sqlform=\""+Util.toHtmlForSplitPage(sqlFrom)+"\" sqlprimarykey=\"b.id\" sqlorderby=\""+orderby+"\" sqlsortway=\"asc\" sqldistinct=\"true\" sqlwhere=\""+Util.toHtmlForSplitPage(sqlWhere)+"\"/>"+
|
||||
"<head>"+
|
||||
" <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(413,user.getLanguage())+"\" column=\"lastname\" orderkey=\"lastname\"/>"+
|
||||
" <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(714,user.getLanguage())+"\" column=\"workcode\" orderkey=\"workcode\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(124,user.getLanguage())+"\" column=\"departmentid\" orderkey=\"departmentid\" transmethod=\""+transMethodString+"\"/>"+
|
||||
" <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(602,user.getLanguage())+"\" column=\"status\" orderkey=\"status\" transmethod=\"weaver.hrm.resource.ResourceComInfo.getStatusName\" otherpara=\""+user.getLanguage()+"\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(97,user.getLanguage())+"\" column=\"kqdate\" orderkey=\"kqdate\"/>"+
|
||||
" <col width=\"20%\" text=\""+SystemEnv.getHtmlLabelName(390054,user.getLanguage())+"\" column=\"serialid\" orderkey=\"serialid\" transmethod=\"com.engine.kq.util.TransMethod.getSerailName\" otherpara=\"column:workbegintime+column:workendtime\"/>"+
|
||||
" <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(18949,user.getLanguage())+"\" column=\"serialid1\" orderkey=\"serialid1\" transmethod=\"com.engine.kq.util.TransMethod.getReportDetialSignTime\" otherpara=\"column:signintime++column:kqdate+column:resourceid+"+user.getLanguage()+"\"/>";
|
||||
if(tabKey.equals("2")){
|
||||
tableString += " <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(391413,user.getLanguage())+"\" column=\"graveBeLateMins\" orderkey=\"graveBeLateMins\"/>";
|
||||
}else{
|
||||
tableString += " <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(391413,user.getLanguage())+"\" column=\"beLateMins\" orderkey=\"beLateMins\"/>";
|
||||
}
|
||||
tableString += "</head>"+
|
||||
"</table>";
|
||||
|
||||
//主要用于 显示定制列以及 表格 每页展示记录数选择
|
||||
String sessionkey = pageUid + "_" + Util.getEncrypt(Util.getRandom());
|
||||
Util_TableMap.setVal(sessionkey, tableString);
|
||||
|
||||
retmap.put("dialogTitle",dialogTitle);
|
||||
retmap.put("sessionkey", sessionkey);
|
||||
retmap.put("status", "1");
|
||||
}catch (Exception e) {
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
package com.engine.kq.cmd.reportdetial;
|
||||
|
||||
import com.cloudstore.dev.api.util.Util_TableMap;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.hrm.util.HrmUtil;
|
||||
import com.engine.kq.biz.KQReportBiz;
|
||||
import com.engine.kq.enums.FlowReportTypeEnum;
|
||||
import com.engine.kq.enums.ReportColumnEnum;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* 早退相关信息
|
||||
*/
|
||||
public class GetLeaveEearlyInfoCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetLeaveEearlyInfoCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try{
|
||||
String dialogTitle = SystemEnv.getHtmlLabelName(20089, user.getLanguage());
|
||||
String tabKey = Util.null2String(params.get("tabKey"));
|
||||
String resourceId = Util.null2String(params.get("resourceId"));
|
||||
String keyWord = Util.null2String(params.get("keyWord"));
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
String toDate = Util.null2String(params.get("toDate"));
|
||||
String typeselect =Util.null2String(params.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 viewScope = Util.null2String(params.get("viewScope"));
|
||||
String subCompanyId = Util.null2String(params.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(params.get("departmentId"));
|
||||
String allLevel = Util.null2String(params.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(params.get("isNoAccount"));
|
||||
String formula = Util.null2String(params.get("formula"));
|
||||
|
||||
String backFields = " a.id, b.resourceid,a.departmentid, a.lastname, a.workcode, a.status, a.dsporder, kqdate, serialid, serialid as serialid1," +
|
||||
" workbegintime,workendtime, signintime,signouttime, leaveEarlyMins, graveLeaveEarlyMins ";
|
||||
String sqlFrom = "from hrmresource a, kq_format_detail b ";
|
||||
String sqlWhere = " where a.id = b.resourceid";
|
||||
String orderby = " kqdate asc, workbegintime asc " ;
|
||||
String tableString = "";
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("1",""+user.getUID(),"a");
|
||||
if(rightSql.length()>0){
|
||||
sqlWhere += rightSql;
|
||||
}
|
||||
|
||||
if (keyWord.length() > 0){
|
||||
sqlWhere += " and lastname = "+keyWord;
|
||||
}
|
||||
|
||||
if (fromDate.length() > 0){
|
||||
sqlWhere += " and kqdate >= '"+fromDate+"'";
|
||||
}
|
||||
|
||||
if (toDate.length() > 0){
|
||||
sqlWhere += " and kqdate <= '"+toDate+"'";
|
||||
}
|
||||
|
||||
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<>'' ");
|
||||
}
|
||||
|
||||
if(tabKey.equals("2")){
|
||||
sqlWhere += " and graveLeaveEarlyMins>0 ";
|
||||
}else{
|
||||
sqlWhere += " and leaveEarlyMins>0 ";
|
||||
}
|
||||
|
||||
if(formula.length()>0){
|
||||
formula = formula.replace("${leaveEarlyMins}>","").replace("${leaveEarlyMins}<=","").replace("?1:0","").replace(" && ","-");
|
||||
String[] tmpValue = Util.splitString(formula,"-");
|
||||
sqlWhere += " and leaveEarlyMins>"+tmpValue[0]+" and leaveEarlyMins<= "+tmpValue[1];
|
||||
}
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径需求
|
||||
String transMethodString = HrmUtil.getKqDepartmentTransMethod();
|
||||
|
||||
String pageUid = PageUidFactory.getHrmPageUid("KQReportDetialList");
|
||||
|
||||
tableString=""+
|
||||
"<table pageUid=\""+pageUid+"\" pagesize=\"10\" tabletype=\"none\">"+
|
||||
"<sql backfields=\""+backFields+"\" sqlform=\""+Util.toHtmlForSplitPage(sqlFrom)+"\" sqlprimarykey=\"b.id\" sqlorderby=\""+orderby+"\" sqlsortway=\"asc\" sqldistinct=\"true\" sqlwhere=\""+Util.toHtmlForSplitPage(sqlWhere)+"\"/>"+
|
||||
"<head>"+
|
||||
" <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(413,user.getLanguage())+"\" column=\"lastname\" orderkey=\"lastname\"/>"+
|
||||
" <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(714,user.getLanguage())+"\" column=\"workcode\" orderkey=\"workcode\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(124,user.getLanguage())+"\" column=\"departmentid\" orderkey=\"departmentid\" transmethod=\""+transMethodString+"\"/>"+
|
||||
" <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(602,user.getLanguage())+"\" column=\"status\" orderkey=\"status\" transmethod=\"weaver.hrm.resource.ResourceComInfo.getStatusName\" otherpara=\""+user.getLanguage()+"\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(97,user.getLanguage())+"\" column=\"kqdate\" orderkey=\"kqdate\"/>"+
|
||||
" <col width=\"20%\" text=\""+SystemEnv.getHtmlLabelName(390054,user.getLanguage())+"\" column=\"serialid\" orderkey=\"serialid\" transmethod=\"com.engine.kq.util.TransMethod.getSerailName\" otherpara=\"column:workbegintime+column:workendtime\"/>"+
|
||||
" <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(18949,user.getLanguage())+"\" column=\"serialid1\" orderkey=\"serialid1\" transmethod=\"com.engine.kq.util.TransMethod.getReportDetialSignTime\" otherpara=\"+column:signouttime+column:kqdate+column:resourceid+"+user.getLanguage()+"\"/>";
|
||||
if(tabKey.equals("2")){
|
||||
tableString += " <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(391414,user.getLanguage())+"\" column=\"graveLeaveEarlyMins\" orderkey=\"graveLeaveEarlyMins\" />";
|
||||
}else{
|
||||
tableString += " <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(391414,user.getLanguage())+"\" column=\"leaveEarlyMins\" orderkey=\"leaveEarlyMins\" />";
|
||||
}
|
||||
tableString += "</head>"+
|
||||
"</table>";
|
||||
|
||||
//主要用于 显示定制列以及 表格 每页展示记录数选择
|
||||
String sessionkey = pageUid + "_" + Util.getEncrypt(Util.getRandom());
|
||||
Util_TableMap.setVal(sessionkey, tableString);
|
||||
|
||||
retmap.put("dialogTitle",dialogTitle);
|
||||
retmap.put("sessionkey", sessionkey);
|
||||
retmap.put("status", "1");
|
||||
}catch (Exception e) {
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
package com.engine.kq.cmd.reportdetial;
|
||||
|
||||
import com.cloudstore.dev.api.util.Util_TableMap;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.hrm.util.HrmUtil;
|
||||
import com.engine.kq.biz.KQReportBiz;
|
||||
import com.engine.kq.enums.FlowReportTypeEnum;
|
||||
import com.engine.kq.enums.ReportColumnEnum;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* 应出勤明细
|
||||
*/
|
||||
public class GetWorkDayInfoCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetWorkDayInfoCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try{
|
||||
String dialogTitle = SystemEnv.getHtmlLabelName(390956,user.getLanguage());
|
||||
String resourceId = Util.null2String(params.get("resourceId"));
|
||||
String keyWord = Util.null2String(params.get("keyWord"));
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
String toDate = Util.null2String(params.get("toDate"));
|
||||
String typeselect =Util.null2String(params.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 viewScope = Util.null2String(params.get("viewScope"));
|
||||
String subCompanyId = Util.null2String(params.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(params.get("departmentId"));
|
||||
String allLevel = Util.null2String(params.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(params.get("isNoAccount"));
|
||||
String backFields = " a.id, b.resourceid,a.departmentid, a.lastname, a.workcode, a.status, a.dsporder, kqdate, " +
|
||||
" serialid, workmins, workbegintime,workendtime ";
|
||||
String sqlFrom = "from hrmresource a, kq_format_detail b,kq_ShiftManagement c ";
|
||||
String sqlWhere = " where a.id = b.resourceid and workmins>0 and b.serialid=c.id and (c.rest_shift is null or c.rest_shift=0) ";
|
||||
String orderby = " kqdate asc, workbegintime asc " ;
|
||||
String tableString = "";
|
||||
String rightSql = new KQReportBiz().getReportRight("1",""+user.getUID(),"a");
|
||||
if(rightSql.length()>0){
|
||||
sqlWhere += rightSql;
|
||||
}
|
||||
if (keyWord.length() > 0){
|
||||
sqlWhere += " and lastname = "+keyWord;
|
||||
}
|
||||
|
||||
if (fromDate.length() > 0){
|
||||
sqlWhere += " and kqdate >= '"+fromDate+"'";
|
||||
}
|
||||
|
||||
if (toDate.length() > 0){
|
||||
sqlWhere += " and kqdate <= '"+toDate+"'";
|
||||
}
|
||||
|
||||
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<>'' ");
|
||||
}
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径需求
|
||||
String transMethodString = HrmUtil.getKqDepartmentTransMethod();
|
||||
|
||||
String pageUid = PageUidFactory.getHrmPageUid("KQReportDetialList");
|
||||
|
||||
tableString=""+
|
||||
"<table pageUid=\""+pageUid+"\" pagesize=\"10\" tabletype=\"none\">"+
|
||||
"<sql backfields=\""+backFields+"\" sqlform=\""+Util.toHtmlForSplitPage(sqlFrom)+"\" sqlprimarykey=\"b.id\" sqlorderby=\""+orderby+"\" sqlsortway=\"asc\" sqldistinct=\"true\" sqlwhere=\""+Util.toHtmlForSplitPage(sqlWhere)+"\"/>"+
|
||||
"<head>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(413,user.getLanguage())+"\" column=\"lastname\" orderkey=\"lastname\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(714,user.getLanguage())+"\" column=\"workcode\" orderkey=\"workcode\"/>"+
|
||||
" <col width=\"20%\" text=\""+SystemEnv.getHtmlLabelName(124,user.getLanguage())+"\" column=\"departmentid\" orderkey=\"departmentid\" transmethod=\""+transMethodString+"\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(602,user.getLanguage())+"\" column=\"status\" orderkey=\"status\" transmethod=\"weaver.hrm.resource.ResourceComInfo.getStatusName\" otherpara=\""+user.getLanguage()+"\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(97,user.getLanguage())+"\" column=\"kqdate\" orderkey=\"kqdate\"/>"+
|
||||
" <col width=\"25%\" text=\""+SystemEnv.getHtmlLabelName(390054,user.getLanguage())+"\" column=\"serialid\" orderkey=\"serialid\" transmethod=\"com.engine.kq.util.TransMethod.getSerailName\" otherpara=\"column:workbegintime+column:workendtime\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(132055,user.getLanguage())+"\" column=\"workmins\" orderkey=\"workmins\" transmethod=\"com.engine.kq.util.TransMethod.getReportDetialMinToHour\"/>"+
|
||||
"</head>"+
|
||||
"</table>";
|
||||
|
||||
//主要用于 显示定制列以及 表格 每页展示记录数选择
|
||||
String sessionkey = pageUid + "_" + Util.getEncrypt(Util.getRandom());
|
||||
Util_TableMap.setVal(sessionkey, tableString);
|
||||
|
||||
retmap.put("dialogTitle",dialogTitle);
|
||||
retmap.put("sessionkey", sessionkey);
|
||||
retmap.put("status", "1");
|
||||
}catch (Exception e) {
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package com.engine.kq.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* 工作时间
|
||||
*/
|
||||
public class WorkTimeEntity {
|
||||
private String groupId;//所属考勤组
|
||||
private String groupName;//所属考勤组
|
||||
private String kqType;//考勤类型
|
||||
private String serialId;//班次
|
||||
private Map<String,Object> shiftRuleInfo;//班次人性化规则
|
||||
private List<TimeScopeEntity> signTime;//允许打卡时间
|
||||
private List<TimeScopeEntity> workTime;//工作时间
|
||||
private List<TimeScopeEntity> restTime;//休息时间
|
||||
private int workMins;//工作时长
|
||||
private String isAcross;//是否跨天
|
||||
private String signstart;//自由工时开始打卡时间
|
||||
private boolean isExclude;//无需考勤人员
|
||||
private String calmethod;//自由班制计算方式
|
||||
private int restShift;
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public String getKQType() {
|
||||
return kqType;
|
||||
}
|
||||
|
||||
public void setKQType(String kqType) {
|
||||
this.kqType = kqType;
|
||||
}
|
||||
|
||||
public String getSerialId() {
|
||||
return serialId;
|
||||
}
|
||||
|
||||
public void setSerialId(String serialId) {
|
||||
this.serialId = serialId;
|
||||
}
|
||||
|
||||
public Map<String, Object> getShiftRuleInfo() {
|
||||
return shiftRuleInfo;
|
||||
}
|
||||
|
||||
public void setShiftRuleInfo(Map<String, Object> shiftRuleInfo) {
|
||||
this.shiftRuleInfo = shiftRuleInfo;
|
||||
}
|
||||
|
||||
public List<TimeScopeEntity> getWorkTime() {
|
||||
return workTime;
|
||||
}
|
||||
|
||||
public void setWorkTime(List<TimeScopeEntity> workTime) {
|
||||
this.workTime = workTime;
|
||||
}
|
||||
|
||||
public List<TimeScopeEntity> getRestTime() {
|
||||
return restTime;
|
||||
}
|
||||
|
||||
public void setRestTime(List<TimeScopeEntity> restTime) {
|
||||
this.restTime = restTime;
|
||||
}
|
||||
|
||||
public int getWorkMins() {
|
||||
return workMins;
|
||||
}
|
||||
|
||||
public void setWorkMins(int workMins) {
|
||||
this.workMins = workMins;
|
||||
}
|
||||
|
||||
public String getIsAcross() {
|
||||
return isAcross;
|
||||
}
|
||||
|
||||
public void setIsAcross(String isAcross) {
|
||||
this.isAcross = isAcross;
|
||||
}
|
||||
|
||||
public String getSignStart() {
|
||||
return signstart;
|
||||
}
|
||||
|
||||
public void setSignStart(String signstart) {
|
||||
this.signstart = signstart;
|
||||
}
|
||||
|
||||
public List<TimeScopeEntity> getSignTime() {
|
||||
return signTime;
|
||||
}
|
||||
|
||||
public void setSignTime(List<TimeScopeEntity> signTime) {
|
||||
this.signTime = signTime;
|
||||
}
|
||||
|
||||
public boolean getIsExclude() {
|
||||
return isExclude;
|
||||
}
|
||||
|
||||
public void setIsExclude(boolean isExclude) {
|
||||
this.isExclude = isExclude;
|
||||
}
|
||||
|
||||
public String getCalmethod() {
|
||||
return calmethod;
|
||||
}
|
||||
|
||||
public void setCalmethod(String calmethod) {
|
||||
this.calmethod = calmethod;
|
||||
}
|
||||
|
||||
public int getRestShift() {
|
||||
return restShift;
|
||||
}
|
||||
|
||||
public void setRestShift(int restShift) {
|
||||
this.restShift = restShift;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.engine.kq.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.kq.cmd.reportdetial.*;
|
||||
import com.engine.kq.service.KQReportDetailService;
|
||||
import weaver.hrm.User;
|
||||
import java.util.Map;
|
||||
|
||||
public class KQReportDetailServiceImpl extends Service implements KQReportDetailService {
|
||||
@Override
|
||||
public Map<String, Object> getTabs(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new GetTabsCmd(params, user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getWorkDayInfo(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new GetWorkDayInfoCmd(params, user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSignInfo(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new GetSignInfoCmd(params, user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBeLateInfo(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new GetBeLateInfoCmd(params, user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getLeaveEearlyInfo(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new GetLeaveEearlyInfoCmd(params, user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAbsenteeismInfo(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new GetAbsenteeismInfoCmd(params, user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getForgotCheckInfo(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new GetForgotCheckInfoCmd(params, user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getLeaveInfo(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new GetLeaveInfoCmd(params, user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getDailyDetialInfo(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new GetDailyDetialInfoCmd(params, user));
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.engine.kq.util;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalTime;
|
||||
|
||||
public class TimeRangeCalculator {
|
||||
public static double getRestTime(String startTime, String endTime, String restStartTime, String restEndTime) {
|
||||
LocalTime workStart = LocalTime.parse(startTime);
|
||||
LocalTime workEnd = LocalTime.parse(endTime);
|
||||
LocalTime restStart = LocalTime.parse(restStartTime);
|
||||
LocalTime restEnd = LocalTime.parse(restEndTime);
|
||||
Duration restDuration = Duration.ZERO;
|
||||
if (!restStart.isAfter(workEnd) && !restEnd.isBefore(workStart)) {
|
||||
|
||||
LocalTime effectiveRestStart = restStart.isBefore(workStart) ? workStart : restStart;
|
||||
LocalTime effectiveRestEnd = restEnd.isAfter(workEnd) ? workEnd : restEnd;
|
||||
restDuration = Duration.between(effectiveRestStart, effectiveRestEnd);
|
||||
}
|
||||
return restDuration.getSeconds();
|
||||
}
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package com.engine.kq.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.kq.biz.KQReportFieldComInfo;
|
||||
import com.engine.kq.enums.KqSplitFlowTypeEnum;
|
||||
import com.engine.kq.service.KQReportDetailService;
|
||||
import com.engine.kq.service.impl.KQReportDetailServiceImpl;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 考勤报表
|
||||
*/
|
||||
public class KQReportDetailAction extends BaseBean {
|
||||
|
||||
private KQReportDetailService getService(User user) {
|
||||
return (KQReportDetailService) ServiceUtil.getService(KQReportDetailServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取考勤报表明细Tabs
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/getTabs")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String getTabs(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
apidatas = getService(user).getTabs(ParamUtil.request2Map(request), user);
|
||||
} catch (Exception e) {
|
||||
apidatas.put("status", "-1");
|
||||
writeLog(e);
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取考勤报表明细
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/getKQReportDetail")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String getKQReportDetail(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
Map<String,Object> params =ParamUtil.request2Map(request) ;
|
||||
params.put("isNoAccount","1") ;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
String type = Util.null2String(request.getParameter("type"));
|
||||
String reportType = Util.null2String(request.getParameter("reportType"));
|
||||
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(type)){
|
||||
type=KQReportFieldComInfo.cascadekey2fieldname.get(type);
|
||||
}
|
||||
if(reportType.equals("month")) {
|
||||
sql = "select formula from kq_report_field where fieldname = ? ";
|
||||
rs.executeQuery(sql, type);
|
||||
if(rs.next()){
|
||||
String formula = Util.null2String(rs.getString("formula"));
|
||||
if(formula.indexOf("beLateMins")>-1){
|
||||
type = "beLate";
|
||||
params.put("type",type);
|
||||
}else if(formula.indexOf("leaveEarlyMins")>-1){
|
||||
type = "leaveEearly";
|
||||
params.put("type",type);
|
||||
}
|
||||
params.put("formula",formula);
|
||||
}
|
||||
}
|
||||
|
||||
if(type.equals("workdays")||type.equals("workmins")){
|
||||
apidatas = getService(user).getWorkDayInfo(params, user);
|
||||
}else if(type.equals("attendancedays")||type.equals("attendanceMins")||
|
||||
type.equals("signdays")||type.equals("signmins")){
|
||||
apidatas = getService(user).getSignInfo(params, user);
|
||||
}else if(type.equals("beLate")||type.equals("beLateMins")||
|
||||
type.equals("graveBeLate")||type.equals("graveBeLateMins")){
|
||||
apidatas = getService(user).getBeLateInfo(params, user);
|
||||
}else if(type.equals("leaveEearly")||type.equals("leaveEarlyMins")||
|
||||
type.equals("graveLeaveEarly")||type.equals("graveLeaveEarlyMins")){
|
||||
apidatas = getService(user).getLeaveEearlyInfo(params, user);
|
||||
}else if(type.equals("absenteeism")||type.equals("absenteeismMins")){
|
||||
apidatas = getService(user).getAbsenteeismInfo(params, user);
|
||||
}else if(type.equals("forgotCheck")){
|
||||
apidatas = getService(user).getForgotCheckInfo(params, user);
|
||||
}else if(type.equals("leave")||type.startsWith("leaveType_")||type.equals("overtimeTotal")||
|
||||
type.equals("businessLeave")||type.equals("officialBusiness")||
|
||||
type.equals("leaveDeduction")){
|
||||
apidatas = getService(user).getLeaveInfo(params, user);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
apidatas.put("status", "-1");
|
||||
writeLog(e);
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取考勤报表明细信息
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/getDailyDetialInfo")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String getDailyDetialInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
apidatas = getService(user).getDailyDetialInfo(ParamUtil.request2Map(request), user);
|
||||
} catch (Exception e) {
|
||||
apidatas.put("status", "-1");
|
||||
writeLog(e);
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,189 @@
|
||||
|
||||
package weaver.interfaces.bnkq.action;
|
||||
|
||||
import com.engine.kq.biz.KQWorkTime;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.workflow.service.HtmlToPdfService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.PinyinUtil;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 更新出差时长Action
|
||||
*/
|
||||
public class UpdateCcTimeAction implements Action {
|
||||
|
||||
static String dateFormat = "yyyy-MM-dd";
|
||||
static SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
|
||||
public UpdateCcTimeAction() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo info) {
|
||||
new BaseBean();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("更新人员出差时长");
|
||||
RecordSet rs = new RecordSet();
|
||||
int userid = info.getRequestManager().getUser().getUID();
|
||||
String wfid = info.getWorkflowid();
|
||||
String reqid = info.getRequestid();
|
||||
String tablaName = info.getRequestManager().getBillTableName();
|
||||
try {
|
||||
//获取主表数据
|
||||
Map mainInfo = getMainInfo(info);
|
||||
//申请人
|
||||
String sqr = Util.null2String(mainInfo.get("ccr"));
|
||||
//实际出差开始时间
|
||||
String sjksrq = Util.null2String(mainInfo.get("sjccksrq"));
|
||||
//实际出差结束时间
|
||||
String sjccjsrq = Util.null2String(mainInfo.get("sjccjsrq"));
|
||||
//部门
|
||||
String szbm = Util.null2String(mainInfo.get("szbm"));
|
||||
//分部
|
||||
String szgs = Util.null2String(mainInfo.get("szgs"));
|
||||
//相差天数
|
||||
Integer cz = TimeUtil.dateInterval(sjksrq, sjccjsrq) + 1;
|
||||
//插入出差表
|
||||
Double czours = multiply(String.valueOf(cz), "8");
|
||||
|
||||
Set<String> all = new HashSet<>();
|
||||
all.add(sjksrq);
|
||||
List<String> back = days(sjksrq, sjccjsrq);
|
||||
all.addAll(back);
|
||||
all.add(sjccjsrq);
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
kqWorkTime.setIsFormat(true);
|
||||
|
||||
for (String date : all) {
|
||||
bb.writeLog("date:" + date);
|
||||
WorkTimeEntity tmpworkTime = kqWorkTime.getWorkTime(sqr, date);
|
||||
if (tmpworkTime.getWorkMins() > 0) {
|
||||
bb.writeLog("当天排班了:" + tmpworkTime.getWorkMins());
|
||||
insertLeave(reqid, Integer.valueOf(sqr), date, 8.00, "3", "1", szgs, szbm, date, wfid, tablaName);
|
||||
insertDetail(sqr, date, rs);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
bb.writeLog(e);
|
||||
bb.writeLog("更新人员出差时长error" + e.getMessage());
|
||||
info.getRequestManager().setMessageid("2000");
|
||||
info.getRequestManager().setMessagecontent("更新人员出差时长error");
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
private void insertDetail(String resourceId, String date, RecordSet rs) {
|
||||
String sql = "update kq_format_detail set evectionMins=480,absenteeismMins=0 where resourceid=? and kqdate='" + date + "'";
|
||||
rs.executeUpdate(sql, resourceId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取两个日期之间所有的日期
|
||||
*
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList days(String date1, String date2) {
|
||||
ArrayList L = new ArrayList();
|
||||
if (date1.equals(date2)) {
|
||||
System.out.println("两个日期相等!");
|
||||
return L;
|
||||
}
|
||||
|
||||
String tmp;
|
||||
if (date1.compareTo(date2) > 0) { // 确保 date1的日期不晚于date2
|
||||
tmp = date1;
|
||||
date1 = date2;
|
||||
date2 = tmp;
|
||||
}
|
||||
|
||||
tmp = format.format(str2Date(date1).getTime() + 3600 * 24 * 1000);
|
||||
|
||||
int num = 0;
|
||||
while (tmp.compareTo(date2) < 0) {
|
||||
L.add(tmp);
|
||||
num++;
|
||||
tmp = format.format(str2Date(tmp).getTime() + 3600 * 24 * 1000);
|
||||
}
|
||||
|
||||
if (num == 0)
|
||||
System.out.println("两个日期相邻!");
|
||||
return L;
|
||||
}
|
||||
|
||||
private static Date str2Date(String str) {
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
return format.parse(str);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取主表数据
|
||||
*
|
||||
* @param requestInfo
|
||||
* @return
|
||||
*/
|
||||
private static Map getMainInfo(RequestInfo requestInfo) {
|
||||
Map map = new HashMap();
|
||||
Property[] property = requestInfo.getMainTableInfo().getProperty();
|
||||
for (int i = 0; i < property.length; i++) {
|
||||
map.put(property[i].getName().toLowerCase(), Util.null2String(property[i].getValue()));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的乘法运算。
|
||||
*
|
||||
* @param v1 被加数
|
||||
* @param v2 加数
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static Double multiply(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.multiply(b2).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入请假拆分表
|
||||
*
|
||||
* @param requestid
|
||||
* @param userid
|
||||
* @param fromDate
|
||||
* @param MaxHours
|
||||
*/
|
||||
private static void insertLeave(String requestid, Integer userid, String fromDate, Double MaxHours, String durationrule, String newleavetype, String subcompany, String department, String toDate, String wfid, String tablename) {
|
||||
BaseBean bb = new BaseBean();
|
||||
//插入加班时间
|
||||
RecordSet rsInsert = new RecordSet();
|
||||
String sql = "insert into kq_flow_split_evection (requestid,resourceid,fromdate,fromtime,todate,totime,duration,durationrule,belongdate,newleavetype,subcompanyid,departmentid,workflowid,tablenamedb) "
|
||||
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
|
||||
rsInsert.executeUpdate(sql, requestid, userid, fromDate, "08:00", toDate, "17:00", MaxHours, durationrule, fromDate, newleavetype, subcompany, department, wfid, tablename);
|
||||
bb.writeLog("insertSql:" + sql);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue