svn版本

dev_zm
李栋 1 year ago
parent 144e9a7f51
commit 1d3ff5be48

@ -86,7 +86,7 @@ public class KQFormatData extends BaseBean {
//没有考勤组不需格式化
return resultMap;
}
if (workTime == null || workTime.getWorkMins() == 0) {
if (workTime == null || (workTime.getWorkMins() == 0 && workTime.getRestShift() != 1)) {
kqLog.info("workTime == null || workTime.getWorkMins() == 0 插入空记录");
nonlsParam = new ArrayList<>();
formatNonWork(userId, kqDate, nonlsParam, workTime, workFlowInfo);
@ -133,8 +133,8 @@ public class KQFormatData extends BaseBean {
" resourceid,kqdate,groupid,serialid,serialnumber,workbegindate,workbegintime,workenddate,workendtime,workmins," +
" signindate,signintime,signinid,signoutdate,signouttime,signoutid,signMins," +
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins," +
" leaveMins,leaveinfo,evectionMins,outMins,forgotbeginworkcheckmins,otherinfo" + (definedField.length() > 0 ? "," + definedField + "" : "") + ") " +
" values(?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?" + (definedField.length() > 0 ? "," + definedParam + "" : "") + ")";
" leaveMins,leaveinfo,evectionMins,outMins,forgotbeginworkcheckmins,otherinfo,flowinfo" + (definedField.length() > 0 ? "," + definedField + "" : "") + ") " +
" values(?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?" + (definedField.length() > 0 ? "," + definedParam + "" : "") + ")";
for (int i = 0; i < lsParam.size(); i++) {
List<Object> param = lsParam.get(i);
boolean isok = rs.executeUpdate(sql, param);
@ -147,8 +147,12 @@ public class KQFormatData extends BaseBean {
" leaveMins,evectionMins,outMins,forgotbeginworkcheck,forgotbeginworkcheckmins" + (definedField.length() > 0 ? "," + definedField + "" : "") + ") " +
" select a.resourceid,kqdate,b.subcompanyid1,b.departmentid,b.jobtitle,groupid,serialid," +
" case when sum(workmins)>0 then 1 end as workdays, sum(workmins) as workmins," +
" cast(sum(attendanceMins)AS decimal(10, 2))/sum(workmins) as attendancedays, sum(attendanceMins) as attendanceMins," +
" cast(sum(signmins)AS decimal(10, 2))/sum(workmins) as signdays, sum(signmins) as signmins," +
" case when sum(workmins)>0 then cast(sum(attendanceMins)AS decimal(10, 2))/sum(workmins) else 0 end as attendancedays, sum(attendanceMins) as attendanceMins," +
// " cast(sum(attendanceMins)AS decimal(10, 2))/sum(workmins) as attendancedays, sum(attendanceMins) as attendanceMins," +
" case when sum(workmins)>0 then cast(sum(signmins)AS decimal(10, 2))/sum(workmins) else 0 end as signdays, sum(signmins) as signmins," +
// " cast(sum(signmins)AS decimal(10, 2))/sum(workmins) as signdays, sum(signmins) as signmins," +
" sum(case when belatemins> 0 then 1 else 0 end) as belate,sum(belatemins) as belatemins," +
" sum(case when graveBeLateMins> 0 then 1 else 0 end) as graveBeLate,sum(graveBeLateMins) as graveBeLateMins," +
" sum(case when leaveearlymins> 0 then 1 else 0 end) as leaveearly,sum(leaveearlymins) as leaveearlymins," +
@ -193,11 +197,13 @@ public class KQFormatData extends BaseBean {
List<TimeScopeEntity> lsRestTime = new ArrayList<>();
List<Object> workFlow = null;
int workminsNew = 0;
if (workTime != null) {
lsSignTime = workTime.getSignTime();//允许打卡时间
lsWorkTime = workTime.getWorkTime();//工作时间
lsRestTime = workTime.getRestTime();//休息时段时间
oneSign = lsWorkTime != null && lsWorkTime.size() == 1;
workminsNew = workTime.getWorkMins();
}
int[] dayMins = new int[2880];//一天所有分钟数
@ -279,6 +285,8 @@ public class KQFormatData extends BaseBean {
//用来计算实际打卡时长用的
int signInTimeIndx4Sign = -1;
int signInTimeOutdx4Sign = -1;
Map<String,Object> flowinfo = new HashMap<>();//流程信息
String signBeginDateTime = signTimeScope.getBeginTimeAcross() ? nextDate : kqDate;
if (signTimeScope.isBeginTimePreAcross()) {
@ -543,7 +551,7 @@ public class KQFormatData extends BaseBean {
if (workFlowInfo.get(dateKey) != null) {
workFlow = (List<Object>) workFlowInfo.get(dateKey);
}
List<Object> flowList = Lists.newArrayList();
for (int j = 0; workFlow != null && j < workFlow.size(); j++) {
Map<String, Object> data = (Map<String, Object>) workFlow.get(j);
String flowType = Util.null2String(data.get("flowtype"));
@ -551,11 +559,27 @@ public class KQFormatData extends BaseBean {
String signtype = Util.null2String(data.get("signtype"));
String serial = Util.null2String(data.get("serial"));
String requestId = Util.null2String(data.get("requestId"));
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("begintime")));
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("endtime")));
// beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("begintime")));
// endIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("endtime")));
String begintime = Util.null2String(data.get("begintime"));
String endtime = Util.null2String(data.get("endtime"));
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(begintime);
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(endtime);
if (beginIdx >= endIdx) {
continue;
}
Map<String,String> flowMap = Maps.newHashMap();
flowMap.put("newLeaveType", newLeaveType);
flowMap.put("begintime", begintime);
flowMap.put("endtime", endtime);
List<Map<String,String>> flowMapList = Lists.newArrayList();
if(flowinfo.containsKey(flowType)){
List<Map<String,String>> tmpFlowMapList = (List<Map<String, String>>) flowinfo.get(flowType);
tmpFlowMapList.add(flowMap);
}else{
flowMapList.add(flowMap);
flowinfo.put(flowType, flowMapList);
}
if (flowType.equals(FlowReportTypeEnum.EVECTION.getFlowType())) {
Arrays.fill(dayMins, beginIdx, endIdx, 7);//出差抵扣时段标识 7
@ -746,7 +770,7 @@ public class KQFormatData extends BaseBean {
forgotCheckMins = 0;
}
if (workTime.getIsExclude()) {//无需考勤人员没有异常状态
if (workminsNew == 0 || workTime.getIsExclude()) {//无需考勤人员没有异常状态
beLateMins = 0;
graveBeLateMins = 0;
leaveEarlyMins = 0;
@ -786,9 +810,14 @@ public class KQFormatData extends BaseBean {
if ("0".equals(nosign_is_absent)) {
attendanceMins = attendanceMins - forgotCheckMins - forgotBeginWorkCheckMins;
}
if(workminsNew == 0) {
attendanceMins = 0;
workMins = 0;
}
if(beforeBegin || attendanceMins < 0) {//还未到上班时间,不用计算任何状体
attendanceMins = 0;
}
kqLog.info("实际出勤计算公式" + "实际出勤=应出勤- 旷工-请假-迟到-早退 userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid);
kqLog.info("实际出勤计算结果" + attendanceMins + "=" + workMins + "- " + absenteeismMins + "-" + leaveMins + "-" + (beLateMins + graveBeLateMins) + "-" + (leaveEarlyMins - graveLeaveEarlyMins) + " userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid);
if (this.writeLog) {
@ -820,6 +849,10 @@ public class KQFormatData extends BaseBean {
params.add(kqTimesArrayComInfo.turn48to24Time(ori_workBeginTime));
params.add(workEndDate);
params.add(kqTimesArrayComInfo.turn48to24Time(ori_workEndTime));
//二开 休班次 工作时长计算0
if (workTime.getRestShift() == 1) {
workMins = 0;
}
params.add(workMins);
params.add(signInDate);
params.add(signInTime);
@ -839,6 +872,7 @@ public class KQFormatData extends BaseBean {
if (workTime.getRestShift() == 1 && absenteeismMins > 0) {
absenteeismMins = 0;
}
params.add(absenteeismMins);
params.add(forgotCheckMins);
params.add(leaveMins);
@ -847,6 +881,7 @@ public class KQFormatData extends BaseBean {
params.add(outMins);
params.add(forgotBeginWorkCheckMins);
params.add(JSONObject.toJSONString(otherinfo));
params.add(JSONObject.toJSONString(flowinfo));
Map<String, Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
String[] definedFields = Util.splitString(Util.null2String(definedFieldInfo.get("definedField")), ",");

@ -1225,7 +1225,7 @@ public class KQOverTimeRuleCalBiz {
}
}
if(all_has_duration_min > 0){
for(Entry<String,String> me : hasCardMap.entrySet()){
for(Map.Entry<String,String> me : hasCardMap.entrySet()){
String cardKey = me.getKey();
String cardValue = me.getValue();
if(cardKey.equalsIgnoreCase(nowCardKey)){

@ -1,8 +1,11 @@
package com.engine.kq.biz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean;
import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
import com.engine.kq.enums.FlowReportTypeEnum;
import com.engine.kq.enums.KqSplitFlowTypeEnum;
import com.engine.kq.log.KQLog;
import com.engine.kq.util.KQDurationCalculatorUtil;
@ -321,6 +324,97 @@ public class KQReportBiz extends BaseBean {
return datas;
}
/**
*
* @param params
* @param user
* @return
*/
public Map<String,Object> getSaturdayFlowLeaveBackData(Map<String,Object> params, User user){
Map<String,Object> datas = new HashMap<>();;
RecordSet rs = new RecordSet();
String sql = "";
String sqlWhere = " ";
try{
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
String fromDate = Util.null2String(jsonObj.get("fromDate"));
String toDate = Util.null2String(jsonObj.get("toDate"));
String typeselect =Util.null2String(jsonObj.get("typeselect"));
if(typeselect.length()==0)typeselect = "3";
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
if(typeselect.equals("1")){
fromDate = TimeUtil.getCurrentDateString();
toDate = TimeUtil.getCurrentDateString();
}else{
fromDate = TimeUtil.getDateByOption(typeselect,"0");
toDate = TimeUtil.getDateByOption(typeselect,"1");
}
}
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
String departmentId = Util.null2String(jsonObj.get("departmentId"));
String resourceId = Util.null2String(jsonObj.get("resourceId"));
String allLevel = Util.null2String(jsonObj.get("allLevel"));
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
String viewScope = Util.null2String(jsonObj.get("viewScope"));
if(subCompanyId.length()>0){
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
}
if(departmentId.length()>0){
sqlWhere +=" and a.departmentid in("+departmentId+") ";
}
if(resourceId.length()>0){
sqlWhere +=" and b.resourceid in("+resourceId+") ";
}
if(viewScope.equals("4")){//我的下属
if(allLevel.equals("1")){//所有下属
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
}else{
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
}
}
if (!"1".equals(isNoAccount)) {
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
}
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = groupId) " +sqlWhere +
" group by resourceid, newleavetype, durationrule ";
rs.execute(sql);
while (rs.next()) {
String resourceid = rs.getString("resourceid");
String newleavetype = rs.getString("newleavetype");
String durationrule = rs.getString("durationrule");
double value = rs.getDouble("val")<0?0:rs.getDouble("val");
double proportion = Util.getDoubleValue(kqLeaveRulesComInfo.getProportion(newleavetype));
if(KQUnitBiz.isLeaveHour(newleavetype,kqLeaveRulesComInfo)){//按小时
if(!KQUnitBiz.isLeaveHour(durationrule)){
if(proportion>0) value = value*proportion;
}
}else{//按天
if(KQUnitBiz.isLeaveHour(durationrule)){
if(proportion>0) value = value/proportion;
}
}
String key = resourceid+"|leavebackType_"+newleavetype;
if(datas.containsKey(key)){
value += Util.getDoubleValue(Util.null2String(datas.get(key)));
}
//df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了
df.setMaximumFractionDigits(5);
datas.put(key,df.format(value));
}
}catch (Exception e){
writeLog(e);
}
return datas;
}
/**
*
* @param params
@ -379,7 +473,7 @@ public class KQReportBiz extends BaseBean {
}
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " +sqlWhere +
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = groupId) " +sqlWhere +
" group by resourceid, newleavetype, durationrule ";
rs.execute(sql);
while (rs.next()) {
@ -416,6 +510,98 @@ public class KQReportBiz extends BaseBean {
return datas;
}
/**
*
* @param params
* @param user
* @return
*/
public Map<String,Object> getDailySaturdayFlowLeaveBackData(Map<String,Object> params, User user){
Map<String,Object> datas = new HashMap<>();;
RecordSet rs = new RecordSet();
String sql = "";
String sqlWhere = " ";
try{
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
String fromDate = Util.null2String(jsonObj.get("fromDate"));
String toDate = Util.null2String(jsonObj.get("toDate"));
String typeselect =Util.null2String(jsonObj.get("typeselect"));
if(typeselect.length()==0)typeselect = "3";
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
if(typeselect.equals("1")){
fromDate = TimeUtil.getCurrentDateString();
toDate = TimeUtil.getCurrentDateString();
}else{
fromDate = TimeUtil.getDateByOption(typeselect,"0");
toDate = TimeUtil.getDateByOption(typeselect,"1");
}
}
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
String departmentId = Util.null2String(jsonObj.get("departmentId"));
String resourceId = Util.null2String(jsonObj.get("resourceId"));
String allLevel = Util.null2String(jsonObj.get("allLevel"));
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
String viewScope = Util.null2String(jsonObj.get("viewScope"));
if(subCompanyId.length()>0){
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
}
if(departmentId.length()>0){
sqlWhere +=" and a.departmentid in("+departmentId+") ";
}
if(resourceId.length()>0){
sqlWhere +=" and b.resourceid in("+resourceId+") ";
}
if(viewScope.equals("4")){//我的下属
if(allLevel.equals("1")){//所有下属
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
}else{
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
}
}
if (!"1".equals(isNoAccount)) {
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
}
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = groupId) " +sqlWhere +
" group by resourceid, newleavetype, durationrule,belongdate ";
rs.execute(sql);
while (rs.next()) {
String resourceid = rs.getString("resourceid");
String belongdate = rs.getString("belongdate");
String newleavetype = rs.getString("newleavetype");
String durationrule = rs.getString("durationrule");
double value = rs.getDouble("val")<0?0:rs.getDouble("val");
double proportion = Util.getDoubleValue(kqLeaveRulesComInfo.getProportion(newleavetype));
if(KQUnitBiz.isLeaveHour(newleavetype,kqLeaveRulesComInfo)){//按小时
if(!KQUnitBiz.isLeaveHour(durationrule)){
if(proportion>0) value = value*proportion;
}
}else{//按天
if(KQUnitBiz.isLeaveHour(durationrule)){
if(proportion>0) value = value/proportion;
}
}
String key = resourceid+"|"+belongdate+"|leavebackType_"+newleavetype;
if(datas.containsKey(key)){
value += Util.getDoubleValue(Util.null2String(datas.get(key)));
}
//df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了
df.setMaximumFractionDigits(5);
datas.put(key,df.format(value));
}
}catch (Exception e){
writeLog(e);
}
return datas;
}
/**
*
* @param params
@ -473,7 +659,7 @@ public class KQReportBiz extends BaseBean {
}
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " +sqlWhere +
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = groupId) " +sqlWhere +
" group by resourceid, newleavetype, durationrule,belongdate ";
rs.execute(sql);
while (rs.next()) {
@ -1832,6 +2018,17 @@ public class KQReportBiz extends BaseBean {
int evectionMins = Util.getIntValue(Util.null2String(signInfo.get("evectionMins")));
int outMins = Util.getIntValue(Util.null2String(signInfo.get("outMins")));
String resourceId = Util.null2String(signInfo.get("resourceId"));
String kqDate = Util.null2String(signInfo.get("kqdate"));
String flowinfo = Util.null2String(signInfo.get("flowinfo"));
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
int split_time_index = 0;
ShiftInfoBean shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(resourceId, kqDate, false);
List<int[]> halfWorkIndex = shiftInfoBean.getHalfWorkIndex();
if(halfWorkIndex != null && !halfWorkIndex.isEmpty()) {
int[] halfWorkIndexs = halfWorkIndex.get(0);
split_time_index = halfWorkIndexs[1];//半天的时间
}
if(worktime.length()>0){
if (absenteeismMins > 0) {//旷工
text = SystemEnv.getHtmlLabelName(20085, user.getLanguage())+absenteeismMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage());
@ -1860,21 +2057,71 @@ public class KQReportBiz extends BaseBean {
if (leaveMins > 0) {//请假
Map<String,Object> jsonObject = null;
if(leaveInfo.length()>0){
jsonObject = JSON.parseObject(leaveInfo);
for (Entry<String,Object> entry : jsonObject.entrySet()) {
String newLeaveType = entry.getKey();
String tmpLeaveMins = Util.null2String(entry.getValue());
if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){
if (text.length() > 0) text += " ";
//text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage());
text += Util.formatMultiLang(kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage());
// if(leaveInfo.length()>0){
// jsonObject = JSON.parseObject(leaveInfo);
// for (Map.Entry<String,Object> entry : jsonObject.entrySet()) {
// String newLeaveType = entry.getKey();
// String tmpLeaveMins = Util.null2String(entry.getValue());
// if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){
// if (text.length() > 0) text += " ";
// //text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage());
// text += Util.formatMultiLang(kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage());
// }
// }
// }else{
// if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) {
// if (text.length() > 0) text += " ";
// text += SystemEnv.getHtmlLabelName(670, user.getLanguage());
// }
// }
if(flowinfo.length() > 0) {
jsonObject = JSON.parseObject(flowinfo);
String jsonKey = "";
String jsonValue = "";
if (jsonObject.containsKey(FlowReportTypeEnum.LEAVE.getFlowType())) {
jsonKey = FlowReportTypeEnum.LEAVE.getFlowType();
jsonValue = SystemEnv.getHtmlLabelName(670, user.getLanguage());
}
if (jsonKey.length() > 0) {
JSONArray jsonArray = (JSONArray) jsonObject.get(jsonKey);
String text4temp = "";
if (jsonArray != null && !jsonArray.isEmpty()) {
//客户不存在多个重复流程的情况,只是显示第一个就行
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject1 = (JSONObject) jsonArray.get(i);
if (jsonObject1 != null && !jsonObject1.isEmpty()) {
String newLeaveType = Util.null2s(Util.null2String(jsonObject1.get("newLeaveType")), "");
String begintime = Util.null2s(Util.null2String(jsonObject1.get("begintime")), "");
String endtime = Util.null2s(Util.null2String(jsonObject1.get("endtime")), "");
int beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(begintime);
int endIdx = kqTimesArrayComInfo.getArrayindexByTimes(endtime);
if (jsonKey.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())) {
if (newLeaveType.length() > 0) {
jsonValue = kqLeaveRulesComInfo.getLeaveName(newLeaveType);
}
}
if (beginIdx <= split_time_index && endIdx <= split_time_index) {
//上午
if ("on".equalsIgnoreCase(onOrOff)) {
text4temp = jsonValue;
}
} else if (beginIdx >= split_time_index && endIdx >= split_time_index) {
//下午
if ("off".equalsIgnoreCase(onOrOff)) {
text4temp = jsonValue;
}
} else {
if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) {
//全天
text4temp = jsonValue;
}
}
}
if(text4temp.length()>0){
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(670, user.getLanguage());
text += text4temp;
}
}
}
}
}
@ -2206,6 +2453,7 @@ public class KQReportBiz extends BaseBean {
RecordSet rs = new RecordSet();
int sixnight_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","sixnight_serialid"));
int twelvehours_night_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","twelvehours_night_serialid"));
int night_rest_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","night_rest_serialid"));
rs.executeQuery("select * from kq_format_total where kqdate = ? and resourceid=?",kqdate,userid);
rs.writeLog("select * from kq_format_total where kqdate = '"+ kqdate +"' and resourceid="+ userid);
while(rs.next()){
@ -2213,11 +2461,18 @@ public class KQReportBiz extends BaseBean {
double attendanceMins = Util.getDoubleValue(rs.getString("attendanceMins"),0.00);
double overTimeTotal = getOverTimeTotal(kqdate,userid);
double time = attendanceMins+overTimeTotal;
//1、 12小时工作制夜班、做六休一夜班有夜班补贴并且出勤上班时间+加班时间)>=8小时统计一次
if(serialid == sixnight_serialid|| serialid == twelvehours_night_serialid){
if(time >= 8){
result = 1;
}
}
//2、当一线人员排“夜休”班次并且加班台账当天导入的加班时长>=8小时统计一次。
if(serialid == night_rest_serialid){
if(overTimeTotal >= 8){
result += 1;
}
}
}
return result;
}

@ -188,7 +188,7 @@ public class KQShiftManagementComInfo extends CacheBase implements Serializable
CacheItem cacheItem = createCacheItem();
Iterator<Entry<String, Object>> iterator = shiftInfoBeanMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, Object> entry = iterator.next();
Map.Entry<String, Object> entry = iterator.next();
String id = entry.getKey();
Object value = entry.getValue();
cacheItem.set(PK_INDEX, id);
@ -292,7 +292,7 @@ public class KQShiftManagementComInfo extends CacheBase implements Serializable
if(shiftInfoBeanMap.size()>0){
Iterator<Entry<String, Object>> iterator = shiftInfoBeanMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, Object> entry = iterator.next();
Map.Entry<String, Object> entry = iterator.next();
String id = entry.getKey();
Object value = entry.getValue();
CacheItem cacheItem = createCacheItem();

@ -56,7 +56,7 @@ public class KQWorkTime extends BaseBean {
Map<String, Object> result = new HashMap<>();
try {
KQShiftManagementComInfo kQShiftManagementComInfo = new KQShiftManagementComInfo();
Map<String,Object> serialInfo = getSerialInfo(userId, workdate, containYesterday);
Map<String,Object> serialInfo = getSerialInfo(userId, workdate, containYesterday,true);
kqLog.info("考勤组获取成员所在的班次 getWorkButton:serialInfo:"+ serialInfo);
String kqType = Util.null2String(serialInfo.get("kqType"));
if(serialInfo!=null&&serialInfo.size()>0){
@ -94,7 +94,6 @@ public class KQWorkTime extends BaseBean {
Map<String,Object> workTimeMap = null;
KQShiftManagementComInfo kQShiftManagementComInfo = new KQShiftManagementComInfo();
Map<String,Object> serialInfo = getSerialInfo(userId, workdate, true);
writeLog("getWorkDuration-serialInfo-" + userId + "-" + workdate + serialInfo);
if(isLog){
kqLog.info("考勤组获取成员所在的班次 getWorkDuration:"+serialInfo);
}
@ -169,7 +168,7 @@ public class KQWorkTime extends BaseBean {
try {
KQShiftManagementComInfo kQShiftManagementComInfo = new KQShiftManagementComInfo();
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
Map<String,Object> serialInfo = getSerialInfo(userId, workdate, false);
Map<String,Object> serialInfo = getSerialInfo(userId, workdate, false,true);
workTimeEntity.setIsExclude(Util.null2String(serialInfo.get("isExclude")).equals("1"));
workTimeEntity.setGroupId(Util.null2String(serialInfo.get("groupId")));
if(serialInfo!=null&&serialInfo.size()>0) {
@ -262,6 +261,27 @@ public class KQWorkTime extends BaseBean {
return serialInfo!=null?Util.null2String(serialInfo.get(workdate)):"";
}
/**
*
* @param userId
* @param workdate
* @return
*/
public ShiftInfoCominfoBean getShiftInfoCominfoBeanIncludeHoliday(String userId, String workdate) {
ShiftInfoCominfoBean shiftInfoCominfoBean = null;
try {
KQShiftManagementComInfo kQShiftManagementComInfo = new KQShiftManagementComInfo();
Map<String,Object> serialInfo = getSerialInfo(userId, workdate, false, true);
if(serialInfo!=null&&serialInfo.size()>0){
shiftInfoCominfoBean = kQShiftManagementComInfo.getShiftInfoCominfoBean(workdate,serialInfo);
}
} catch (Exception e) {
writeLog(e);
}
return shiftInfoCominfoBean;
}
/**
*
* @param userId
@ -270,6 +290,10 @@ public class KQWorkTime extends BaseBean {
* @return
*/
public Map<String,Object> getSerialInfo(String userId, String workdate, boolean containYesterday) {
return getSerialInfo(userId, workdate, containYesterday, false);
}
public Map<String,Object> getSerialInfo(String userId, String workdate, boolean containYesterday , boolean includeHoliday) {
Map<String, Object> serialInfo = new HashMap<>();
String preworkdate = "";
try {
@ -284,7 +308,7 @@ public class KQWorkTime extends BaseBean {
preworkdate = DateUtil.addDate(workdate,-1);
if(containYesterday){
Map<String, Object> pre_serialInfo = getSerialInfo(userId, preworkdate, false);
Map<String, Object> pre_serialInfo = getSerialInfo(userId, preworkdate, false, includeHoliday);
if(pre_serialInfo != null && !pre_serialInfo.isEmpty()){
if(pre_serialInfo.containsKey(preworkdate)){
serialInfo.put(preworkdate,pre_serialInfo.get(preworkdate));//获取前一天的班次
@ -354,6 +378,7 @@ public class KQWorkTime extends BaseBean {
serialInfo.put("groupName",groupname);
serialInfo.put("kqType",kqtype);
serialInfo.put("isHoliday",isHoliday);
if(includeHoliday) isHoliday = false;
if (kqtype.equals("1")) {//固定班
// if(containYesterday && !serialInfo.containsKey(preworkdate)) {
// serialid = Util.null2String(kqFixedSchedulceComInfo.getSerialid(groupid,preDayOfweek));
@ -374,6 +399,7 @@ public class KQWorkTime extends BaseBean {
// serialInfo.put(preworkdate,Util.null2String(kqShiftScheduleComInfo.getSerialId(userId,preworkdate)));//获取前一天的班次
// }
serialid = Util.null2String(kqShiftScheduleComInfo.getSerialId(userId,workdate));
if(serialid.length()>0 && !isHoliday && Util.getIntValue(serialid) > 0){
serialInfo.put(workdate,Util.null2String(kqShiftScheduleComInfo.getSerialId(userId,workdate)));//获取当天的班次
}

@ -44,7 +44,7 @@ public class GetLeaveWorkDurationCmd extends AbstractCommonCommand<Map<String, O
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())+"");
retmap.put("message", rci.getLastname(resourceId)+","+fromDate+""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005329,weaver.general.ThreadVarLanguage.getLang())+"");
return retmap;
}

@ -5,7 +5,14 @@ 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.biz.KQFormatBiz;
import com.engine.kq.biz.KQLeaveRulesBiz;
import com.engine.kq.biz.KQOvertimeRulesBiz;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.biz.KQReportFieldComInfo;
import com.engine.kq.biz.KQSettingsComInfo;
import com.engine.kq.biz.KQShiftManagementComInfo;
import com.engine.kq.biz.KQUnitBiz;
import com.engine.kq.util.ExcelUtil;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.UtilKQ;
@ -272,6 +279,10 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
//System.out.println("start" + DateUtil.getFullDate());
Map<String, Object> flowData = new KQReportBiz().getFlowData(params, user);
Map<String, Object> saturdayFlowLeaveData = kqReportBiz.getSaturdayFlowLeaveData(params, user);
Map<String, Object> saturdayFlowLeaveBackData = kqReportBiz.getSaturdayFlowLeaveBackData(params, user);
if ((!CollectionUtils.isEmpty(saturdayFlowLeaveBackData)) || saturdayFlowLeaveBackData.size() > 0) {
saturdayFlowLeaveData.putAll(saturdayFlowLeaveBackData);
}
//System.out.println("end" + DateUtil.getFullDate());
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
@ -465,7 +476,7 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
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")) {
if (fieldName.contains("LateMins") || fieldName.contains("EarlyMins")) {
fieldValue = rs.getString(lsCascadekey.get(i));
} else {
fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)), kqReportFieldComInfo.getUnittype(fieldid));
@ -487,9 +498,10 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
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++) {
for (int ia = 0; allLeaveRules != null && ia < allLeaveRules.size(); ia++) {
leaveRule = (Map<String, Object>) allLeaveRules.get(ia);
int i = Integer.valueOf(leaveRule.get("id").toString());
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"));
@ -540,9 +552,10 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
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++) {
for (int ia = 0; allLeaveRules != null && ia < allLeaveRules.size(); ia++) {
leaveRule = (Map<String, Object>) allLeaveRules.get(ia);
int i = Integer.valueOf(leaveRule.get("id").toString());
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"));

@ -13,6 +13,7 @@ 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.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
@ -151,10 +152,10 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
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," +
String backFields = " (select zma.workdays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate 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 zma.attendancedays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate 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 zma.workdays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate 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 zma.attendancedays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate 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.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," +
@ -242,6 +243,10 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
}
Map<String, Object> flowData = kqReportBiz.getDailyFlowData(params, user);
Map<String, Object> dailySaturdayFlowLeaveData = kqReportBiz.getDailySaturdayFlowLeaveData(params, user);
Map<String, Object> dailySaturdayFlowLeaveBackData = kqReportBiz.getDailySaturdayFlowLeaveBackData(params, user);
if ((!CollectionUtils.isEmpty(dailySaturdayFlowLeaveBackData)) || dailySaturdayFlowLeaveBackData.size() > 0) {
dailySaturdayFlowLeaveData.putAll(dailySaturdayFlowLeaveBackData);
}
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
String fullPathMainKey = "show_full_path";
@ -403,10 +408,11 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
}
String sjbjcjRes = "0.0";
String hjsjRes = "0.0";
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
for (int ia = 0; allLeaveRules != null && ia < allLeaveRules.size(); ia++) {
leaveRule = (Map<String, Object>) allLeaveRules.get(ia);
int i = Integer.valueOf(leaveRule.get("id").toString());
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"));
@ -641,7 +647,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
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" +
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid,flowinfo \n" +
" from kq_format_detail b \n" +
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
" order by serialnumber \n";
@ -670,6 +676,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
int leaveMins = rs.getInt("leaveMins");
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
String flowinfo = Util.null2String(rs.getString("flowinfo"));
int evectionMins = rs.getInt("evectionMins");
int outMins = rs.getInt("outMins");
@ -677,6 +684,11 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
if (serialid.length() > 0) {
if (workbegintime.length() > 0) {
signStatusInfo = new HashMap();
signStatusInfo.put("resourceId",resourceid);
signStatusInfo.put("kqdate",kqdate);
signStatusInfo.put("flowinfo",flowinfo);
signStatusInfo.put("workbegintime",workbegintime);
signStatusInfo.put("workendtime",workendtime);
signStatusInfo.put("workdate", workbegindate);
signStatusInfo.put("worktime", workbegintime);
signStatusInfo.put("beLateMins", beLateMins);
@ -689,11 +701,21 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
signStatusInfo.put("outMins", outMins);
data.put("signintime" + serialnumber, signintime.length() == 0 ? SystemEnv.getHtmlLabelName(25994, user.getLanguage()) : signintime);
if(workMins == 0){
data.put("signinstatus" + serialnumber, "休息");
}else {
data.put("signinstatus" + serialnumber, KQReportBiz.getSignStatus(signStatusInfo, user, "on"));
}
}
if (workendtime.length() > 0) {
signStatusInfo = new HashMap();
signStatusInfo.put("resourceId",resourceid);
signStatusInfo.put("kqdate",kqdate);
signStatusInfo.put("flowinfo",flowinfo);
signStatusInfo.put("workbegintime",workbegintime);
signStatusInfo.put("workendtime",workendtime);
signStatusInfo.put("workdate", workenddate);
signStatusInfo.put("worktime", kqTimesArrayComInfo.turn48to24Time(workendtime));
signStatusInfo.put("leaveEarlyMins", leaveEarlyMins);
@ -705,20 +727,27 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
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);
if(workMins == 0){
data.put("signoutstatus" + serialnumber, "休息");
}else{
data.put("signoutstatus" + serialnumber, KQReportBiz.getSignStatus(signStatusInfo, user, "off"));
}
}
} else {
if (workMins > 0) {
//弹性工时打卡时间取自签到签退数据
}
signStatusInfo = new HashMap();
signStatusInfo.put("resourceId",resourceid);
signStatusInfo.put("kqdate",kqdate);
signStatusInfo.put("leaveMins",leaveMins);
signStatusInfo.put("leaveInfo",leaveInfo);
signStatusInfo.put("evectionMins",evectionMins);
signStatusInfo.put("outMins",outMins);
signStatusInfo.put("flowinfo",flowinfo);
signStatusInfo.put("workbegintime",workbegintime);
signStatusInfo.put("workendtime",workendtime);
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"));

@ -5,7 +5,15 @@ 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.biz.KQFormatBiz;
import com.engine.kq.biz.KQHolidaySetBiz;
import com.engine.kq.biz.KQLeaveRulesBiz;
import com.engine.kq.biz.KQOvertimeRulesBiz;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.biz.KQReportFieldComInfo;
import com.engine.kq.biz.KQSettingsComInfo;
import com.engine.kq.biz.KQShiftManagementComInfo;
import com.engine.kq.biz.KQUnitBiz;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.PageUidFactory;
import org.apache.commons.lang3.StringUtils;
@ -190,11 +198,11 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
//支援班次统计
String supportSerId = new BaseBean().getPropValue("nbkq_main", "supportSerId");
String backFields = " (select sum(workdays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and (DATEPART(dw, kqdate) = 7 or DATEPART(dw, kqdate) = 1)) as saturdayworkdays," +
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(attendancedays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and (DATEPART(dw, kqdate) = 7 or DATEPART(dw, kqdate) = 1)) as saturdayattendancedays," +
" (select sum(workdays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and DATEPART(dw, kqdate) != 7 and DATEPART(dw, kqdate) != 1) as weekdayworkdays," +
" (select sum(attendancedays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and DATEPART(dw, kqdate) != 7 and DATEPART(dw, kqdate) != 1) as weekdayattendancedays," +
" (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, " +
@ -333,6 +341,10 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
Map<String, Object> flowData = kqReportBiz.getFlowData(params, user);
Map<String, Object> saturdayFlowLeaveData = kqReportBiz.getSaturdayFlowLeaveData(params, user);
Map<String, Object> saturdayFlowLeaveBackData = kqReportBiz.getSaturdayFlowLeaveBackData(params, user);
if ((!CollectionUtils.isEmpty(saturdayFlowLeaveBackData)) || saturdayFlowLeaveBackData.size() > 0) {
saturdayFlowLeaveData.putAll(saturdayFlowLeaveBackData);
}
rs.execute(sql);
rs.writeLog("========== GetKQReportCmd sql ========== " + sql);
while (rs.next()) {
@ -504,10 +516,11 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
}
String sjbjcjRes = "0.0";
String hjsjRes = "0.0";
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
for (int ia = 0; allLeaveRules != null && ia < allLeaveRules.size(); ia++) {
leaveRule = (Map<String, Object>) allLeaveRules.get(ia);
int i = Integer.valueOf(leaveRule.get("id").toString());
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(saturdayFlowLeaveData.get(id + "|" + flowType));
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));

@ -20,7 +20,6 @@ import com.engine.kq.enums.DurationTypeEnum;
import com.engine.kq.log.KQLog;
import com.engine.kq.wfset.bean.SplitBean;
import com.engine.kq.wfset.util.KQFlowUtil;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
@ -37,6 +36,7 @@ import weaver.hrm.report.schedulediff.HrmScheduleDiffUtil;
public class KQDurationCalculatorUtil extends BaseBean {
private KQLog kqLog = new KQLog();
private final String resourceid;
private String fromDate;
private String toDate;
@ -80,14 +80,12 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
*
*
* @param resourceid
* @param date
* @param containYesterday
* @return
*/
public static ShiftInfoBean getWorkTime(String resourceid, String date,boolean containYesterday){
User user = User.getUser(Util.getIntValue(resourceid), 0);
if(user == null){
return null;
@ -105,7 +103,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
*
*
* @param resourceid
* @param date
* @param containYesterday
@ -129,7 +126,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
* user
*
* @param user
* @param date
* @param containYesterday
@ -181,7 +177,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
* user
*
* @param user
* @param date
* @param containYesterday
@ -206,7 +201,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
*
*
* @return
*/
public Map<String,Object> getNonWorkDuration(){
@ -294,11 +288,9 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
*
*
* @return
*/
public Map<String,Object> getWorkDuration(){
writeLog("KQDurationCalculatorUtil-getWorkDuration");
Map<String,Object> durationMap = new HashMap<>();
try{
@ -332,7 +324,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
splitBean.setDurationTypeEnum(durationTypeEnum);
splitBean.setComputingMode(computingMode);
splitBean.setNewLeaveType(newLeaveType);
writeLog("getWorkDuration-" + splitBean);
if("2".equalsIgnoreCase(computingMode)){
double oneDayHour = KQFlowUtil.getOneDayHour(durationTypeEnum,newLeaveType);
splitBean.setOneDayHour(oneDayHour);
@ -382,7 +373,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
*
*
* @return false
*/
private boolean isValidate(String fromDate,String toDate,String fromTime,String toTime) {
@ -410,7 +400,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
*
*
* @param fromDate
* @param fromTime
* @param toDate
@ -419,7 +408,7 @@ public class KQDurationCalculatorUtil extends BaseBean {
* @return
*/
public Map<String,Object> getTotalWorkingDurations(String fromDate,String fromTime,String toDate,String toTime,String resourceid){
KQDurationCalculatorUtil kqDurationCalculatorUtil = new DurationParamBuilder(resourceid).
KQDurationCalculatorUtil kqDurationCalculatorUtil =new KQDurationCalculatorUtil.DurationParamBuilder(resourceid).
fromDateParam(fromDate).toDateParam(toDate).fromTimeParam(fromTime).toTimeParam(toTime).durationRuleParam("1")
.computingModeParam("1").durationTypeEnumParam(DurationTypeEnum.COMMON_CAL).build();
@ -429,7 +418,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
*
*
* @param fromDate
* @param fromTime
* @param toDate
@ -446,7 +434,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
*
*
* @param fromDate
* @param fromTime
* @param toDate
@ -464,7 +451,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
*
*
* @param fromDate
* @param fromTime
* @param toDate
@ -481,7 +467,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
*
*
* @param fromDate
* @param fromTime
* @param toDate
@ -490,7 +475,7 @@ public class KQDurationCalculatorUtil extends BaseBean {
* @return
*/
public String getTotalNonWorkingDays(String fromDate,String fromTime,String toDate,String toTime,String resourceid){
KQDurationCalculatorUtil kqDurationCalculatorUtil = new DurationParamBuilder(resourceid).
KQDurationCalculatorUtil kqDurationCalculatorUtil =new KQDurationCalculatorUtil.DurationParamBuilder(resourceid).
fromDateParam(fromDate).toDateParam(toDate).fromTimeParam(fromTime).toTimeParam(toTime).computingModeParam("1").
durationRuleParam("1").durationTypeEnumParam(DurationTypeEnum.OVERTIME).build();
Map<String,Object> durationMap = kqDurationCalculatorUtil.getNonWorkDuration();
@ -501,7 +486,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
*
*
* @param fromDate
* @param fromTime
* @param toDate
@ -510,7 +494,7 @@ public class KQDurationCalculatorUtil extends BaseBean {
* @return
*/
public String getTotalNonWorkingHours(String fromDate,String fromTime,String toDate,String toTime,String resourceid){
KQDurationCalculatorUtil kqDurationCalculatorUtil = new DurationParamBuilder(resourceid).
KQDurationCalculatorUtil kqDurationCalculatorUtil =new KQDurationCalculatorUtil.DurationParamBuilder(resourceid).
fromDateParam(fromDate).toDateParam(toDate).fromTimeParam(fromTime).toTimeParam(toTime).computingModeParam("1").
durationRuleParam("3").durationTypeEnumParam(DurationTypeEnum.OVERTIME).build();
Map<String,Object> durationMap = kqDurationCalculatorUtil.getNonWorkDuration();
@ -521,7 +505,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
* 2
*
* @param duration
* @return
*/
@ -534,7 +517,6 @@ public class KQDurationCalculatorUtil extends BaseBean {
/**
* 5
*
* @param duration
* @return
*/
@ -627,17 +609,14 @@ public class KQDurationCalculatorUtil extends BaseBean {
this.durationrule = durationrule;
return this;
}
public DurationParamBuilder computingModeParam(final String computingMode) {
this.computingMode = computingMode;
return this;
}
public DurationParamBuilder overtime_typeParam(final String overtime_type) {
this.overtime_type = overtime_type;
return this;
}
public DurationParamBuilder durationTypeEnumParam(final DurationTypeEnum durationTypeEnum) {
this.durationTypeEnum = durationTypeEnum;
return this;

@ -2,7 +2,17 @@ package com.engine.kq.wfset.util;
import com.alibaba.fastjson.JSON;
import com.engine.kq.bean.KQHrmScheduleSign;
import com.engine.kq.biz.*;
import com.engine.kq.biz.KQBalanceOfLeaveBiz;
import com.engine.kq.biz.KQFlowDataBiz;
import com.engine.kq.biz.KQOverTimeRuleCalBiz;
import com.engine.kq.biz.KQOvertimeRulesBiz;
import com.engine.kq.biz.KQScheduleSignBiz;
import com.engine.kq.biz.KQSettingsBiz;
import com.engine.kq.biz.KQShiftPersonalizedRuleCominfo;
import com.engine.kq.biz.KQShiftPersonalizedRuleDetailComInfo;
import com.engine.kq.biz.KQShiftRuleInfoBiz;
import com.engine.kq.biz.KQTimesArrayComInfo;
import com.engine.kq.biz.KQWorkTime;
import com.engine.kq.biz.chain.duration.WorkHalfUnitSplitChain;
import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean;
import com.engine.kq.entity.KQOvertimeRulesDetailEntity;

@ -186,4 +186,19 @@ public class UpdateCcTimeAction implements Action {
rsInsert.executeUpdate(sql, requestid, userid, fromDate, "08:00", toDate, "17:00", MaxHours, durationrule, fromDate, newleavetype, subcompany, department, wfid, tablename);
bb.writeLog("insertSql:" + sql);
}
public static void main(String[] args) {
Set<String> all = new HashSet<>();
all.add("2023-12-20");
List<String> back = days("2023-12-20", "2023-12-20");
all.addAll(back);
all.add("2023-12-20");
for (String date : all) {
System.out.println(date);
}
}
}

Loading…
Cancel
Save