#NBJH-2# 周末排班对比文件后提交

main
shilei 2 years ago
parent d3cce7870d
commit c32e2ee510

@ -85,6 +85,43 @@ public class KQBalanceOfLeave extends BaseBean {
errorInfo = SystemEnv.getHtmlLabelName(389985, userlanguage);//ID和姓名不匹配
return errorInfo;
}
if (this.baseAmount < 0) {
errorInfo = "基数不能为负数";
return errorInfo;
}
if (this.extraAmount < 0) {
errorInfo = "额外不能为负数";
return errorInfo;
}
if (this.usedAmount < 0) {
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005288,weaver.general.ThreadVarLanguage.getLang())+"";
return errorInfo;
}
double _totalAmount = this.baseAmount+this.extraAmount;
if (_totalAmount < this.usedAmount) {
errorInfo = ""+ SystemEnv.getHtmlLabelName(508124,weaver.general.ThreadVarLanguage.getLang())+"";
return errorInfo;
}
if (this.baseAmount2 < 0) {
errorInfo = "福利基数不能为负数";
return errorInfo;
}
if (this.extraAmount2 < 0) {
errorInfo = "福利额外不能为负数";
return errorInfo;
}
if (this.usedAmount2 < 0) {
errorInfo = "福利已休不能大于总数";
return errorInfo;
}
double _totalAmount2 = this.baseAmount2+this.extraAmount2;
if (_totalAmount2 < this.usedAmount2) {
errorInfo = ""+ SystemEnv.getHtmlLabelName(508124,weaver.general.ThreadVarLanguage.getLang())+"";
return errorInfo;
}
return errorInfo;
}

@ -210,6 +210,10 @@ public class KQAttFlowSetBiz {
while(rs.next()){
Map<String,String> attSetMap = new HashMap<>();
String formid = Util.null2s(rs.getString("field002"),"");
String field005 = Util.null2s(rs.getString("field005"),"");
if(field005.equals("0")){
continue;
}
//TODO 这里需要改 如果一个表单被多个表单使用的情况
// if(formid.length() == 0){
// continue;
@ -461,7 +465,7 @@ public class KQAttFlowSetBiz {
String backSql = "select sum(duration) from "+back_table_name+" where "+back_table_name+".leavebackrequestid="+table_name+".requestid and "+back_table_name+".newleavetype="+table_name+".newleavetype and "+back_table_name+".resourceid="+table_name+".resourceid ";
if(fromDate.length() > 0 && toDate.length() > 0){
if("1".equalsIgnoreCase(isMyKQ)){
backSql += " and fromDate between'"+fromDate+"' and '"+toDate+"'";
backSql += " and belongdate between'"+fromDate+"' and '"+toDate+"'";
}else{
backSql += " and belongdate between'"+fromDate+"' and '"+toDate+"'";
}
@ -474,7 +478,7 @@ public class KQAttFlowSetBiz {
String baseSql = " select "+fields+" from "+tableName+" where tablenamedb is not null and (status is null or status != 1) ";
if(fromDate.length() > 0 && toDate.length() > 0){
if("1".equalsIgnoreCase(isMyKQ)){
baseSql += " and fromDate between'"+fromDate+"' and '"+toDate+"'";
baseSql += " and belongdate between'"+fromDate+"' and '"+toDate+"'";
}else{
baseSql += " and belongdate between'"+fromDate+"' and '"+toDate+"'";
}

@ -1,6 +1,7 @@
package com.engine.kq.biz;
import com.alibaba.fastjson.JSONObject;
import com.engine.kq.bean.KQLeaveRulesDetail;
import com.engine.kq.entity.KQBalanceOfLeaveEntity;
import com.engine.kq.entity.KQOvertimeRulesDetailEntity;
import com.engine.kq.entity.KQUsageHistoryEntity;
@ -13,7 +14,10 @@ import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import weaver.hrm.moduledetach.ManageDetachComInfo;
@ -455,7 +459,7 @@ public class KQBalanceOfLeaveBiz {
int ageLimit = getAgeLimit(dateOfBirth, baseAmountReleaseDate);
if (ageLimit >= 0 && ageLimit <= 2) {
String expirationDate = (Util.getIntValue(belongYear) + 1) + dateOfBirth.substring(4);
if (expirationDate.compareTo(searchDate) >= 0) {
if (expirationDate.compareTo(searchDate) > 0) {
status = true;
break;
} else {
@ -608,11 +612,16 @@ public class KQBalanceOfLeaveBiz {
//[调休]的假期类型的最小请假单位1-按天、2-按半天、3-按小时、4-按整天
int minimumUnit = Util.getIntValue(rulesComInfo.getMinimumUnit(leaveRulesId), -1);
//假期规则的缓存类
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
KQLeaveRulesDetail detailComInfo = new KQLeaveRulesDetail();
String seclevel = resourceComInfo.getSeclevel(resourceId);
String rulesDetailId = detailComInfo.getKqLeaveRulesId(resourceId, Util.getIntValue(seclevel, 0), leaveRulesId);
detailComInfo = detailComInfo.initCache(rulesDetailId);
//有效期规则0-永久有效、1-按自然年1月1日-12月31日、2-按入职日期起12个月、3-自定义次年失效日期、4-按天数失效
int validityRule = Util.getIntValue(detailComInfo.getValidityRule(leaveRulesId, subCompanyId));
int validityRule = Util.getIntValue(""+detailComInfo.getValidityRule());
//保留几位小数
int decimalDigit = Util.getIntValue(detailComInfo.getDecimalDigit(leaveRulesId, subCompanyId), 2);
int decimalDigit = Util.getIntValue(""+detailComInfo.getDecimalDigit(), 2);
logger.info("resourceId="+resourceId+",requestId="+requestId+",leaveRulesId="+leaveRulesId+",durationOfOvertime="+durationOfOvertime);
logger.info("resourceId="+resourceId+",requestId="+requestId+",seclevel="+seclevel+",rulesDetailId="+rulesDetailId+",validityRule="+validityRule+",decimalDigit="+decimalDigit);
/*如果没有设置调休的假期类型,则直接退出方法*/
if ("".equals(leaveRulesId)) {
@ -1341,11 +1350,14 @@ public class KQBalanceOfLeaveBiz {
/****************************************************************************************************************/
//假期规则缓存类(每个假期类型下可能存在多个假期规则)
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
KQLeaveRulesDetail detailComInfo = new KQLeaveRulesDetail();
String seclevel = resourceComInfo.getSeclevel(resourceId);
String rulesDetailId = detailComInfo.getKqLeaveRulesId(resourceId, Util.getIntValue(seclevel, 0), ruleId);
detailComInfo = detailComInfo.initCache(rulesDetailId);
//余额发放方式1-手动发放、2-按司龄自动发放、3-按工龄自动发放、4-每年自动发放固定天数、5-加班时长自动计入余额、6-按入职时长+工龄自动发放
int distributionMode = Util.getIntValue(detailComInfo.getDistributionMode(ruleId, subcompanyId));
int distributionMode = Util.getIntValue(detailComInfo.getDistributionMode());
//扣减优先级1-法定年假、2-福利年假
int priority = Util.getIntValue(detailComInfo.getPriority(ruleId, subcompanyId), 1);
int priority = Util.getIntValue(""+detailComInfo.getPriority(), 1);
/****************************************************************************************************************/
@ -1409,10 +1421,14 @@ public class KQBalanceOfLeaveBiz {
if (baseAmount.add(extraAmount).add(tiaoxiuAmount).subtract(usedAmount).add(baseAmount2).add(extraAmount2).subtract(usedAmount2).doubleValue() <= 0) {
continue;
}
baseAmount = getCanUseAmount(resourceId, ruleId, belongYear, baseAmount, "legal", fromDateDb);
baseAmount2 = getCanUseAmount(resourceId, ruleId, belongYear, baseAmount2, "welfare", fromDateDb);
} else {
if (baseAmount.add(extraAmount).add(tiaoxiuAmount).subtract(usedAmount).doubleValue() <= 0) {
continue;
}
baseAmount = getCanUseAmount(resourceId, ruleId, belongYear, baseAmount, "", fromDateDb);
}
//员工假期余额使用记录
@ -1441,6 +1457,7 @@ public class KQBalanceOfLeaveBiz {
updateList.add(updateSql);
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setBalanceOfLeaveId(id);
break;
} else {
temp = baseAmount.add(extraAmount).subtract(usedAmount).add(baseAmount2).add(extraAmount2).subtract(usedAmount2).subtract(_duration);
@ -1457,6 +1474,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setNewUsedAmount2(newUsedAmount2);
usageHistoryEntity.setBalanceOfLeaveId(id);
break;
}
if (temp.doubleValue() >= 0) {
@ -1467,6 +1485,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setNewUsedAmount2(newUsedAmount2);
usageHistoryEntity.setBalanceOfLeaveId(id);
break;
} else {
_duration = new BigDecimal("0").subtract(temp);
@ -1477,6 +1496,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setNewUsedAmount2(newUsedAmount2);
usageHistoryEntity.setBalanceOfLeaveId(id);
continue;
}
}
@ -1488,6 +1508,7 @@ public class KQBalanceOfLeaveBiz {
updateList.add(updateSql);
usageHistoryEntity.setNewUsedAmount2(newUsedAmount2);
usageHistoryEntity.setBalanceOfLeaveId(id);
break;
} else {
temp = baseAmount2.add(extraAmount2).subtract(usedAmount2).add(baseAmount).add(extraAmount).subtract(usedAmount).subtract(_duration);
@ -1504,6 +1525,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount2(newUsedAmount2);
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setBalanceOfLeaveId(id);
break;
}
if (temp.doubleValue() >= 0) {
@ -1514,6 +1536,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount2(newUsedAmount2);
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setBalanceOfLeaveId(id);
break;
} else {
_duration = new BigDecimal("0").subtract(temp);
@ -1524,6 +1547,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount2(newUsedAmount2);
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setBalanceOfLeaveId(id);
continue;
}
}
@ -1540,6 +1564,7 @@ public class KQBalanceOfLeaveBiz {
updateList.add(updateSql);
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setBalanceOfLeaveId(id);
break;
}
if (temp.doubleValue() >= 0) {
@ -1548,6 +1573,7 @@ public class KQBalanceOfLeaveBiz {
updateList.add(updateSql);
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setBalanceOfLeaveId(id);
break;
} else {
_duration = new BigDecimal("0").subtract(temp);
@ -1556,6 +1582,7 @@ public class KQBalanceOfLeaveBiz {
updateList.add(updateSql);
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setBalanceOfLeaveId(id);
continue;
}
}
@ -1650,11 +1677,14 @@ public class KQBalanceOfLeaveBiz {
/****************************************************************************************************************/
//假期规则缓存类(每个假期类型下可能存在多个假期规则)
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
KQLeaveRulesDetail detailComInfo = new KQLeaveRulesDetail();
String seclevel = resourceComInfo.getSeclevel(resourceId);
String rulesDetailId = detailComInfo.getKqLeaveRulesId(resourceId, Util.getIntValue(seclevel, 0), ruleId);
detailComInfo = detailComInfo.initCache(rulesDetailId);
//余额发放方式1-手动发放、2-按司龄自动发放、3-按工龄自动发放、4-每年自动发放固定天数、5-加班时长自动计入余额、6-按入职时长+工龄自动发放
int distributionMode = Util.getIntValue(detailComInfo.getDistributionMode(ruleId, subcompanyId));
int distributionMode = Util.getIntValue(detailComInfo.getDistributionMode());
//扣减优先级1-法定年假、2-福利年假
int priority = Util.getIntValue(detailComInfo.getDistributionMode(ruleId, subcompanyId));
int priority = Util.getIntValue(detailComInfo.getDistributionMode());
/****************************************************************************************************************/
@ -1719,6 +1749,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setNewUsedAmount2(usedAmount2.setScale(5, RoundingMode.HALF_UP).toPlainString());
usageHistoryEntity.setBalanceOfLeaveId(id);
usageHistoryEntityList.add(usageHistoryEntity);
break;
} else {
@ -1733,6 +1764,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setNewUsedAmount2(newUsedAmount2);
usageHistoryEntity.setBalanceOfLeaveId(id);
usageHistoryEntityList.add(usageHistoryEntity);
logger.info("此次销假流程的销假天数大于了他的已休假期,流程参数有误。" +
@ -1747,6 +1779,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setNewUsedAmount2(newUsedAmount2);
usageHistoryEntity.setBalanceOfLeaveId(id);
usageHistoryEntityList.add(usageHistoryEntity);
break;
} else {
@ -1757,6 +1790,7 @@ public class KQBalanceOfLeaveBiz {
if (usedAmount.doubleValue() != 0 || usedAmount2.doubleValue() != 0) {
usageHistoryEntity.setNewUsedAmount("0");
usageHistoryEntity.setNewUsedAmount2("0");
usageHistoryEntity.setBalanceOfLeaveId(id);
usageHistoryEntityList.add(usageHistoryEntity);
}
continue;
@ -1771,6 +1805,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount2(newUsedAmount2);
usageHistoryEntity.setNewUsedAmount(usedAmount.setScale(5, RoundingMode.HALF_UP).toPlainString());
usageHistoryEntity.setBalanceOfLeaveId(id);
usageHistoryEntityList.add(usageHistoryEntity);
break;
} else {
@ -1783,6 +1818,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount2("0.00");
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setBalanceOfLeaveId(id);
usageHistoryEntityList.add(usageHistoryEntity);
logger.info("此次销假流程的销假天数大于了他的已休假期,流程参数有误。" +
@ -1796,6 +1832,7 @@ public class KQBalanceOfLeaveBiz {
usageHistoryEntity.setNewUsedAmount2("0.00");
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setBalanceOfLeaveId(id);
usageHistoryEntityList.add(usageHistoryEntity);
break;
} else {
@ -1806,6 +1843,7 @@ public class KQBalanceOfLeaveBiz {
if (usedAmount.doubleValue() != 0 || usedAmount2.doubleValue() != 0) {
usageHistoryEntity.setNewUsedAmount2("0");
usageHistoryEntity.setNewUsedAmount("0");
usageHistoryEntity.setBalanceOfLeaveId(id);
usageHistoryEntityList.add(usageHistoryEntity);
}
continue;
@ -1821,6 +1859,7 @@ public class KQBalanceOfLeaveBiz {
updateList.add(updateSql);
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setBalanceOfLeaveId(id);
usageHistoryEntityList.add(usageHistoryEntity);
logger.info("此次销假流程的销假天数大于了他的已休假期,流程参数有误。" +
@ -1833,6 +1872,7 @@ public class KQBalanceOfLeaveBiz {
updateList.add(updateSql);
usageHistoryEntity.setNewUsedAmount(newUsedAmount);
usageHistoryEntity.setBalanceOfLeaveId(id);
usageHistoryEntityList.add(usageHistoryEntity);
break;
} else {
@ -1842,6 +1882,7 @@ public class KQBalanceOfLeaveBiz {
if (usedAmount.doubleValue() != 0) {
usageHistoryEntity.setNewUsedAmount("0");
usageHistoryEntity.setBalanceOfLeaveId(id);
usageHistoryEntityList.add(usageHistoryEntity);
}
continue;
@ -2003,6 +2044,21 @@ public class KQBalanceOfLeaveBiz {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
String allRightSubComIds = subCompanyComInfo.getRightSubCompany(Util.getIntValue(operator,1),"KQLeaveRulesEdit:Edit",0);
sql += " and " + Util.getSubINClause(allRightSubComIds, "subCompanyId1", "in");
} else {
if (!operator.equals("1")) {
User user = new User(Util.getIntValue(operator));
String rightLevel = HrmUserVarify.getRightLevel("KQLeaveRulesEdit:Edit", user);
int departmentID = user.getUserDepartment();
int subcompanyID = user.getUserSubCompany1();
if (rightLevel.equals("2")) {
// 总部级别的,什么也不返回
} else if (rightLevel.equals("1")) { // 分部级别的
sql += " and subCompanyId1=" + subcompanyID;
} else if (rightLevel.equals("0")) { // 部门级别
sql += " and departmentId=" + departmentID;
}
}
}
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql);
@ -2132,10 +2188,18 @@ public class KQBalanceOfLeaveBiz {
}
}
} else {
if (distributionMode == 6) {
String ageLimitChangeDate = belongYear + workStartDate.substring(4);
String ageLimitChangeDate2 = belongYear + companyStartDate.substring(4);
if (currentDate.compareTo(ageLimitChangeDate) < 0 && currentDate.compareTo(ageLimitChangeDate2) < 0) {
continue;
}
}else{
if(!addOrUpdate){
continue;
}
}
}
if(addOrUpdate){
if (currentDate.compareTo(expirationDate) != 0) {
continue;
@ -2939,11 +3003,25 @@ public class KQBalanceOfLeaveBiz {
return 0;
}
//如果批处理年份等于入职年份,那应该以【入职日期】来折算
String ageLimitChangeDatetemp = "";
if (belongYear.compareTo(companyStartDate.substring(0, 4)) == 0) {
//需要折算
needConvert = true;
//以【入职日期来折算】
calendar = DateUtil.getCalendar(companyStartDate);
//如果是按照司龄计算,就只按照司龄折算。
if(legalKey==1||welfareKey==1){
ageLimitChangeDatetemp = companyStartDate;
}else{
//如果是初始获得年,那么,入职日期和参加工作日期,取相对较晚的日期,作为变动日期
if(companyStartDate.substring(4).compareTo(workStartDate.substring(4)) <= 0){
ageLimitChangeDatetemp = belongYear + workStartDate.substring(4);
}else{
ageLimitChangeDatetemp = companyStartDate;
}
}
}
for (int i = 0; i < 1; i++) {
//如果【计算假期基数的日期】小于【假期基数发放日期】假期基数应该为0
@ -2997,7 +3075,12 @@ public class KQBalanceOfLeaveBiz {
&& (baseAmount_releaseDate.doubleValue() <= 0 || calcMethod == 2)) {
if (baseAmount_releaseDate.doubleValue() <= 0 && baseAmount_ageLimitChangeDate.doubleValue() > 0) {
needConvert = true;
//如果是当年入职,则按照【入职日期折算】
if (belongYear.compareTo(companyStartDate.substring(0, 4)) == 0) {
calendar = DateUtil.getCalendar(ageLimitChangeDatetemp);
}else{
calendar = DateUtil.getCalendar(ageLimitChangeDate);
}
baseAmount = baseAmount_ageLimitChangeDate;
} else {
@ -3011,8 +3094,11 @@ public class KQBalanceOfLeaveBiz {
&& (baseAmount_ageLimitChangeDate.doubleValue() <= 0 || calcMethod == 2)) {
if (baseAmount_ageLimitChangeDate.doubleValue() <= 0 && baseAmount_ageLimitChangeDate2.doubleValue() > 0) {
needConvert = true;
if (belongYear.compareTo(companyStartDate.substring(0, 4)) == 0) {
calendar = DateUtil.getCalendar(ageLimitChangeDatetemp);
}else{
calendar = DateUtil.getCalendar(ageLimitChangeDate2);
}
baseAmount = baseAmount_ageLimitChangeDate2;
} else {
if (calcMethod == 2) {
@ -3063,7 +3149,11 @@ public class KQBalanceOfLeaveBiz {
&& (baseAmount_releaseDate.doubleValue() <= 0 || calcMethod == 2)) {
if (baseAmount_releaseDate.doubleValue() <= 0 && baseAmount_ageLimitChangeDate2.doubleValue() > 0) {
needConvert = true;
if (belongYear.compareTo(companyStartDate.substring(0, 4)) == 0) {
calendar = DateUtil.getCalendar(ageLimitChangeDatetemp);
}else{
calendar = DateUtil.getCalendar(ageLimitChangeDate2);
}
baseAmount = baseAmount_ageLimitChangeDate2;
} else {
@ -3076,7 +3166,11 @@ public class KQBalanceOfLeaveBiz {
&& (baseAmount_ageLimitChangeDate2.doubleValue() <= 0 || calcMethod == 2)) {
if (baseAmount_ageLimitChangeDate2.doubleValue() <= 0 && baseAmount_ageLimitChangeDate.doubleValue() > 0) {
needConvert = true;
if (belongYear.compareTo(companyStartDate.substring(0, 4)) == 0) {
calendar = DateUtil.getCalendar(ageLimitChangeDatetemp);
}else{
calendar = DateUtil.getCalendar(ageLimitChangeDate);
}
baseAmount = baseAmount_ageLimitChangeDate;
} else {
@ -3396,6 +3490,9 @@ public class KQBalanceOfLeaveBiz {
String deptId = Util.null2String(params.get("deptId"));
String resourceId = Util.null2String(params.get("resourceId"));
String allLevel = Util.null2String(params.get("allLevel"));
//人员状态
String resourceStatus = Util.null2String(params.get("status"));
/**
* isNoAccounttrue-false-
*/
@ -3448,6 +3545,15 @@ public class KQBalanceOfLeaveBiz {
sql += " and (a.id=" + user.getUID() + " or a.managerid = " + user.getUID() + ")";
}
}
if(resourceStatus.length()>0){
if (!resourceStatus.equals("8") && !resourceStatus.equals("9")) {
sql += " and a.status = "+resourceStatus+ "";
}else if (resourceStatus.equals("8")) {
sql += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
}
}
if (isNoAccount.equals("false")) {
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")
|| recordSet.getDBType().equalsIgnoreCase("mysql")) {
@ -3964,7 +4070,7 @@ public class KQBalanceOfLeaveBiz {
public static ArrayList<String> getParentalLeaveDate(String resourceId) {
ArrayList<String> list = new ArrayList<>();
try {
String sql = "select birthday from hrmfamilyinfo where resourceid=? order by birthday ";
String sql = "select birthday from hrmfamilyinfo where WhetherChildren=1 and resourceid=? order by birthday ";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql,resourceId);
while (recordSet.next()) {

@ -92,7 +92,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);
@ -198,11 +198,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];//一天所有分钟数
@ -494,7 +496,7 @@ public class KQFormatData extends BaseBean {
if(signInTimeOutdx4Sign<signInTimeIndx4Sign){
signMins = 1440 + signInTimeOutdx4Sign - signInTimeIndx4Sign;
}else{
signMins = 1440 + signInTimeOutdx4Sign - signInTimeIndx4Sign;
signMins = signInTimeOutdx4Sign - signInTimeIndx4Sign;
}
}
}else{
@ -751,7 +753,7 @@ public class KQFormatData extends BaseBean {
forgotCheckMins = 0;
}
if (workTime.getIsExclude()) {//无需考勤人员没有异常状态
if (workminsNew == 0 || workTime.getIsExclude()) {//无需考勤人员没有异常状态
beLateMins = 0;
graveBeLateMins = 0;
leaveEarlyMins = 0;
@ -791,6 +793,10 @@ 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;
}

@ -1,5 +1,6 @@
package com.engine.kq.biz;
import com.alibaba.fastjson.JSONObject;
import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean;
import com.engine.kq.entity.KQOvertimeRulesDetailEntity;
import com.engine.kq.log.KQLog;
@ -17,7 +18,9 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.springframework.beans.BeanUtils;
import weaver.common.StringUtil;
import weaver.general.Util;
import weaver.hrm.User;
/**
*
@ -50,6 +53,9 @@ public class KQOverTimeFlowBiz {
String toDate = splitBean.getTodatedb();
String overtime_type = splitBean.getOvertime_type();
User tmp_user = User.getUser(Util.getIntValue(resourceid), 0);
KQShiftManagementComInfo kQShiftManagementComInfo = new KQShiftManagementComInfo();
LocalDate localFromDate = LocalDate.parse(fromDate);
LocalDate localToDate = LocalDate.parse(toDate);
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@ -113,6 +119,10 @@ public class KQOverTimeFlowBiz {
String next_beginwork_time = "";
String cur_beginwork_time = "";
String serialid = "";
boolean isRestshift_next = false;
boolean isRestshift = false;
String tmp_next_beginwork_time = "";
String tmp_cur_beginwork_time = "";
//需要知道明日的类型:如果今天是工作日的话,那么今天的加班临界点可能和明日的上班时间冲突,需要知道明日的上班时间进行比较,
// 如果今天是休息日,那么明天如果是工作日的话,默认规则下,明天的上班前都是属于今天的加班区间
if(next_changeType == 2){
@ -127,6 +137,33 @@ public class KQOverTimeFlowBiz {
}
}
}
//休息日有开发的休息班次,单独搞下
kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",next_changeType="+next_changeType);
if(next_changeType == 3){
if(null != tmp_user){
ShiftInfoBean next_shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(tmp_user, nextSplitDate, false,true,false);
if(next_shiftInfoBean != null){
int tmp_serialid = StringUtil.parseToInt(next_shiftInfoBean.getSerialid(), 0);
int restShift = StringUtil.parseToInt(kQShiftManagementComInfo.getRestShift(String.valueOf(tmp_serialid)), 0);
// kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",tmp_serialid="+ tmp_serialid+",restShift="+ restShift);
if(tmp_serialid > 0 && restShift == 1) {
isRestshift_next = true;
}
List<int[]> workLongTimeIndex = next_shiftInfoBean.getWorkLongTimeIndex();
List<int[]> real_workLongTimeIndex = Lists.newArrayList();
get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,next_shiftInfoBean,kqTimesArrayComInfo,splitBean);
if(real_workLongTimeIndex != null && !real_workLongTimeIndex.isEmpty()){
tmp_next_beginwork_time = kqTimesArrayComInfo.getTimesByArrayindex(real_workLongTimeIndex.get(0)[0]);
}
kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",tmp_next_beginwork_time="+ tmp_next_beginwork_time+",isRestshift_next="+ isRestshift_next);
}
}
}
// kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",changeType="+changeType);
if(changeType == 2){
ShiftInfoBean cur_shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(resourceid, splitDate, false);
if(cur_shiftInfoBean != null){
@ -139,6 +176,32 @@ public class KQOverTimeFlowBiz {
}
}
}
//休息日有开发的休息班次,单独搞下
if(changeType == 3){
// kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",tmp_user="+tmp_user);
if(null != tmp_user){
ShiftInfoBean tmp_shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(tmp_user, splitDate,false,true,false);
// kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",tmp_shiftInfoBean="+ JSONObject.toJSONString(tmp_shiftInfoBean));
if(tmp_shiftInfoBean != null){
int tmp_serialid = StringUtil.parseToInt(tmp_shiftInfoBean.getSerialid(), 0);
int restShift = StringUtil.parseToInt(kQShiftManagementComInfo.getRestShift(String.valueOf(tmp_serialid)), 0);
// kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",tmp_serialid="+ tmp_serialid+",restShift="+ restShift);
if(tmp_serialid > 0 && restShift == 1) {
isRestshift = true;
}
List<int[]> workLongTimeIndex = tmp_shiftInfoBean.getWorkLongTimeIndex();
List<int[]> real_workLongTimeIndex = Lists.newArrayList();
get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,tmp_shiftInfoBean,kqTimesArrayComInfo,splitBean);
if(real_workLongTimeIndex != null && !real_workLongTimeIndex.isEmpty()){
tmp_cur_beginwork_time = kqTimesArrayComInfo.getTimesByArrayindex(real_workLongTimeIndex.get(0)[0]);
}
kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",tmp_cur_beginwork_time="+ tmp_cur_beginwork_time+",isRestshift="+ isRestshift);
}
}
}
boolean needSplitByTime = false;
// 按照加班时长转调休的 时长设置
List<String> timepointList = null;
@ -165,10 +228,31 @@ public class KQOverTimeFlowBiz {
timepointList = balanceTimethDetailMap.get("timepointList");
}
}
kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",has_cut_point="+ has_cut_point+",changeType="+ changeType+",isRestshift="+ isRestshift+",isRestshift_next="+ isRestshift_next);
if(has_cut_point == 0){
if(changeType == 2){
overtime_cut_point = cur_beginwork_time;
}else {
if(changeType == 3){
if(isRestshift){
overtime_cut_point = tmp_cur_beginwork_time;
}
/**
* 09:00-18:0012:00-22:0012:00
*
*
if(isRestshift_next && overtime_cut_point.length() > 0 && tmp_next_beginwork_time.length() > 0){
int next_beginwork_time_index = kqTimesArrayComInfo.getArrayindexByTimes(tmp_next_beginwork_time);
int overtime_cut_point_index = kqTimesArrayComInfo.getArrayindexByTimes(overtime_cut_point);
if(overtime_cut_point_index > next_beginwork_time_index){
overtime_cut_point = next_beginwork_time;
}
}
*/
}
if(next_beginwork_time.length() > 0){
overtime_cut_point = next_beginwork_time;
}
@ -191,6 +275,7 @@ public class KQOverTimeFlowBiz {
}
int fromTime_index = 0;
int toTime_index = 0;
kqLog.info(i+"resourceid="+resourceid+",splitDate="+splitDate+",overtime_cut_point11="+ overtime_cut_point);
if(i == 0){
//i=0就是加班开始日期的前一天只有当加班临界点超过了加班流程开始时间的话i=0才会有可能计算出时长
if(overtime_cut_point.compareTo(fromTime) > 0){
@ -203,6 +288,7 @@ public class KQOverTimeFlowBiz {
toTime_index = oriTotime_index;
}
}
kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",fromTime_index="+ fromTime_index+",toTime_index="+ toTime_index);
Arrays.fill(initArrays, fromTime_index, toTime_index, 0);
// 1-节假日、2-工作日、3-休息日
if(changeType == 1){
@ -226,6 +312,7 @@ public class KQOverTimeFlowBiz {
//如果排除休息时间是扣除时长
curMins = handle_restlength(curMins,restTimeMap,changeType_key);
}
kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",curMins="+ curMins);
}else{
continue;
}
@ -247,10 +334,20 @@ public class KQOverTimeFlowBiz {
fromTime_index = kqTimesArrayComInfo.getArrayindexByTimes(fromTime);
}
}
kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",betweenDays="+ betweenDays);
if(i == betweenDays){
toTime_index = kqTimesArrayComInfo.getArrayindexByTimes(toTime);
}else{
toTime_index = kqTimesArrayComInfo.turn24to48TimeIndex(kqTimesArrayComInfo.getArrayindexByTimes(overtime_cut_point));
// kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",toTime_index22="+ toTime_index);
if(tmp_next_beginwork_time.length() > 0){
int overtime_cut_point_index = kqTimesArrayComInfo.getArrayindexByTimes(overtime_cut_point);
int next_beginwork_time_index = kqTimesArrayComInfo.getArrayindexByTimes(tmp_next_beginwork_time);
//如果临界点都已经超过第二天上班的开始时间了,要相应的缩短成第二天上班时间
if(overtime_cut_point_index > next_beginwork_time_index){
toTime_index = kqTimesArrayComInfo.turn24to48TimeIndex(next_beginwork_time_index);
}
}
if(next_beginwork_time.length() > 0){
int overtime_cut_point_index = kqTimesArrayComInfo.getArrayindexByTimes(overtime_cut_point);
int next_beginwork_time_index = kqTimesArrayComInfo.getArrayindexByTimes(next_beginwork_time);
@ -298,6 +395,7 @@ public class KQOverTimeFlowBiz {
//如果排除休息时间是扣除时长
curMins = handle_restlength(curMins,restTimeMap,changeType_key);
}
kqLog.info(i+">>>resourceid="+resourceid+",splitDate="+splitDate+",curMins111="+ curMins);
}
int minimumUnit = curKqOvertimeRulesDetailEntity.getMinimumLen();
if(curMins < minimumUnit){
@ -448,6 +546,41 @@ public class KQOverTimeFlowBiz {
}
}else {
String next_beginwork_time = "";
//单独搞下开发的休息班次
if(preChangeType == 3){
ShiftInfoBean pre_shiftInfoBean = KQDurationCalculatorUtil.getWorkTimeNew(resourceid, preSplitDate, false);
if(pre_shiftInfoBean != null){
int serialid = StringUtil.parseToInt(pre_shiftInfoBean.getSerialid(), 0);
KQShiftManagementComInfo kQShiftManagementComInfo = new KQShiftManagementComInfo();
int restShift = StringUtil.parseToInt(kQShiftManagementComInfo.getRestShift(String.valueOf(serialid)), 0);
if(serialid > 0 && restShift == 1) {
List<int[]> workLongTimeIndex = pre_shiftInfoBean.getWorkLongTimeIndex();
List<int[]> real_workLongTimeIndex = Lists.newArrayList();
get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,pre_shiftInfoBean,kqTimesArrayComInfo,splitBean);
if(real_workLongTimeIndex != null && !real_workLongTimeIndex.isEmpty()){
pre_overtime_cut_point = kqTimesArrayComInfo.getTimesByArrayindex(real_workLongTimeIndex.get(0)[0]);
}
}
}
// ShiftInfoBean next_shiftInfoBean = KQDurationCalculatorUtil.getWorkTimeNew(resourceid, splitDate, false);
// if(next_shiftInfoBean != null){
// int serialid = StringUtil.parseToInt(next_shiftInfoBean.getSerialid(), 0);
// KQShiftManagementComInfo kQShiftManagementComInfo = new KQShiftManagementComInfo();
// int restShift = StringUtil.parseToInt(kQShiftManagementComInfo.getRestShift(String.valueOf(serialid)), 0);
// if(serialid > 0 && restShift == 1) {
// List<int[]> workLongTimeIndex = next_shiftInfoBean.getWorkLongTimeIndex();
// List<int[]> real_workLongTimeIndex = Lists.newArrayList();
// get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,next_shiftInfoBean,kqTimesArrayComInfo,splitBean);
//
// if(real_workLongTimeIndex != null && !real_workLongTimeIndex.isEmpty()){
// next_beginwork_time = kqTimesArrayComInfo.getTimesByArrayindex(real_workLongTimeIndex.get(0)[0]);
// }
// }
// }
}
if(changeType == 2){
ShiftInfoBean next_shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(resourceid, splitDate, false);
if(next_shiftInfoBean != null){
@ -530,10 +663,16 @@ public class KQOverTimeFlowBiz {
if(restTimes.length == 2){
int restStart = kqTimesArrayComInfo.getArrayindexByTimes(restTimes[0]);
int restEnd = kqTimesArrayComInfo.getArrayindexByTimes(restTimes[1]);
if(shouldAcross && restEnd == 1439){
// if(shouldAcross && restEnd == 1439){
if(restEnd == 1439){
//针对跨天的休息时段单独处理排除掉23:59-00:00的时间
restEnd = 1440;
}
int hasRestMins = kqTimesArrayComInfo.getCnt(initArrays, restStart,restEnd,0);
if(hasRestMins == 0) {
restStart = kqTimesArrayComInfo.turn24to48TimeIndex(restStart);
restEnd = kqTimesArrayComInfo.turn24to48TimeIndex(restEnd);
}
Arrays.fill(initArrays, restStart, restEnd, 1);
}
}
@ -559,7 +698,7 @@ public class KQOverTimeFlowBiz {
//overlength 是满多少小时 cutlength是减去多少小时
double overlength = Util.getDoubleValue(restTimes[0],-1);
double cutlength = Util.getDoubleValue(restTimes[1],-1);
if(overlength > 0 && cutlength > 0){
if(overlength > -1 && cutlength > -1){
double min_overlength = overlength * 60;
double min_cutlength = cutlength * 60;
if(curMins >= min_overlength){

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean;
import com.engine.kq.entity.KQOvertimeRulesDetailEntity;
import com.engine.kq.entity.KQUsageHistoryEntity;
import com.engine.kq.entity.TimeScopeEntity;
import com.engine.kq.entity.WorkTimeEntity;
import com.engine.kq.log.KQLog;
@ -15,6 +16,8 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
@ -26,9 +29,13 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import java.util.stream.Collectors;
import weaver.attendance.service.OvertimeRuleComputingModeService;
import weaver.common.DateUtil;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.sqsddldcxt.attendance.service.OvertimeRuleComputingMode5Service;
/**
*
@ -75,6 +82,8 @@ public class KQOverTimeRuleCalBiz {
nextToDate = localToDate;
}
long betweenDays = nextToDate.toEpochDay() - preFromDate.toEpochDay();
OvertimeRuleComputingModeService modeService = new OvertimeRuleComputingModeService();
Map<Integer, String> cusModeMap = modeService.getNewComputingMode(7);
for (int i = 0; i <= betweenDays; i++) {
LocalDate curLocalDate = preFromDate.plusDays(i);
String splitDate = curLocalDate.format(dateFormatter);
@ -87,18 +96,20 @@ public class KQOverTimeRuleCalBiz {
// 需审批,以打卡为准,但是不能超过审批时长
doComputingMode2(resourceid,splitDate,dateFormatter,changeTypeMap,overRulesDetailMap,restTimeMap,
computingModeMap,kqTimesArrayComInfo,uuid);
}
if(computingMode == 3){
}else if(computingMode == 3){
// 无需审批,根据打卡时间计算加班时长
doComputingMode3(resourceid,splitDate,dateFormatter,changeTypeMap,overRulesDetailMap,restTimeMap,
computingModeMap,kqTimesArrayComInfo,uuid);
}
if(computingMode == 4){
} else if(computingMode == 4){
// 需审批,以打卡为准,取流程和打卡的交集
doComputingMode4(resourceid,splitDate,dateFormatter,changeTypeMap,overRulesDetailMap,restTimeMap,
computingModeMap,kqTimesArrayComInfo,uuid);
} else if(cusModeMap.containsKey(computingMode)) {
modeService.doComputingMode(computingMode, resourceid, splitDate, changeTypeMap, overRulesDetailMap, restTimeMap, computingModeMap, uuid);
}
}
fromDate=preFromDate.format(dateFormatter);
updateTiaoXiu(resourceid, fromDate, toDate);
}catch (Exception e){
kqLog.info("加班生成数据报错:KQOverTimeRuleCalBiz:");
StringWriter errorsWriter = new StringWriter();
@ -107,6 +118,116 @@ public class KQOverTimeRuleCalBiz {
}
}
/**
*
* @param resourceid
* @param fromDate
* @param toDate
*/
public void updateTiaoXiu(String resourceid, String fromDate, String toDate){
//假期类型的缓存类
KQLeaveRulesComInfo rulesComInfo = new KQLeaveRulesComInfo();
//[调休]的假期类型的ID
String leaveRulesId = "";
//找到[调休]的假期类型ID
rulesComInfo.setTofirstRow();
while (rulesComInfo.next()) {
if (KQLeaveRulesBiz.isTiaoXiu(rulesComInfo.getId())) {
if("1".equals(rulesComInfo.getIsEnable())){
leaveRulesId = rulesComInfo.getId();
break;
}
}
}
RecordSet recordSet = new RecordSet();
String sql = " select * from kq_balanceOfLeave " +
" where (isDelete is null or isDelete<>1) and resourceId=" + resourceid +
" and leaveRulesId=" + leaveRulesId +
" and effectiveDate>='" + fromDate + "' and effectiveDate<='" +toDate+"'"+
" order by belongYear asc,effectiveDate asc,id asc ";
recordSet.executeQuery(sql);
String all_tiaoxiuids = "";
BigDecimal duration = new BigDecimal("0");
while (recordSet.next()) {
//额外
BigDecimal extraAmount = new BigDecimal(Util.null2s(recordSet.getString("extraAmount"), "0"));
//加班生成调休
BigDecimal tiaoxiuAmount = new BigDecimal(Util.null2s(recordSet.getString("tiaoxiuamount"), "0"));
//已休
BigDecimal usedAmount = new BigDecimal(Util.null2s(recordSet.getString("usedAmount"), "0"));
if (extraAmount.add(tiaoxiuAmount).subtract(usedAmount).doubleValue() >= 0) {
continue;
}
String id = recordSet.getString("id");
if(id.length() > 0 && Util.getIntValue(id) > 0){
all_tiaoxiuids += ","+id;
duration =duration.add(extraAmount).add(tiaoxiuAmount).subtract(usedAmount);
}
}
duration = duration.abs();
List<String> updateList = new ArrayList<String>();
sql = " select * from kq_balanceOfLeave " +
" where (isDelete is null or isDelete<>1) and resourceId=" + resourceid +
" and leaveRulesId=" + leaveRulesId +
" and effectiveDate>='" + fromDate + "'"+
" order by belongYear asc,effectiveDate asc,id asc ";
recordSet.executeQuery(sql);
int total = recordSet.getCounts();
int index = 0;
while (recordSet.next()) {
index++;
String id = recordSet.getString("id");
//额外
BigDecimal extraAmount = new BigDecimal(Util.null2s(recordSet.getString("extraAmount"), "0"));
//加班生成调休
BigDecimal tiaoxiuAmount = new BigDecimal(Util.null2s(recordSet.getString("tiaoxiuamount"), "0"));
//已休
BigDecimal usedAmount = new BigDecimal(Util.null2s(recordSet.getString("usedAmount"), "0"));
if (extraAmount.add(tiaoxiuAmount).subtract(usedAmount).doubleValue() <= 0) {
continue;
}
BigDecimal temp = extraAmount.add(tiaoxiuAmount).subtract(usedAmount).subtract(duration);
/*该假期剩余假期余额不足以扣减,记录错误日志,退出方法*/
if (index == total && temp.doubleValue() < 0) {
kqLog.info("该人员的该假期所有的剩余假期余额都不足以扣减。" +
"resourceId=" + resourceid + ",date=" + fromDate + ",ruleId=" + leaveRulesId + ",duration=" + duration + ",extraAmount=" + extraAmount.doubleValue() + ",usedAmount=" + usedAmount.doubleValue());
String newUsedAmount = usedAmount.add(duration).setScale(5, RoundingMode.HALF_UP).toPlainString();
String updateSql = "update kq_balanceOfLeave set usedAmount=" + (newUsedAmount) + " where id=" + id;
updateList.add(updateSql);
break;
}
if (temp.doubleValue() >= 0) {
String newUsedAmount = usedAmount.add(duration).setScale(5, RoundingMode.HALF_UP).toPlainString();
String updateSql = "update kq_balanceOfLeave set usedAmount=" + (newUsedAmount) + " where id=" + id;
updateList.add(updateSql);
break;
} else {
duration = duration.add(usedAmount).subtract(extraAmount).subtract(tiaoxiuAmount);
String newUsedAmount = extraAmount.add(tiaoxiuAmount).setScale(5, RoundingMode.HALF_UP).toPlainString();
String updateSql = "update kq_balanceOfLeave set usedAmount=" + (newUsedAmount) + " where id=" + id;
updateList.add(updateSql);
continue;
}
}
if(all_tiaoxiuids.length() > 0) {
all_tiaoxiuids = all_tiaoxiuids.substring(1);
updateList.add("update kq_balanceOfLeave set isDelete=1 where id in (" +all_tiaoxiuids+")");
}
kqLog.info("updateList:"+updateList);
/*SQL操作批处理*/
for (int i = 0; i < updateList.size(); i++) {
boolean flag = recordSet.executeUpdate(updateList.get(i));
if (!flag) {
kqLog.info("刷新加班流程数据失败:数据库更新失败" );
return;
}
}
}
/**
*
* @param resourceid
@ -138,8 +259,22 @@ public class KQOverTimeRuleCalBiz {
Map<String,Object> eventMap = Maps.newLinkedHashMap();
Map<String, KQOvertimeCardBean> lsCheckInfoMaps = Maps.newLinkedHashMap();
logOvertimeMap(overtimeLogMap, "resourceid:"+resourceid+",splitDate:"+splitDate, "doComputingMode4.param.uuid:"+uuid);
/*String _change_key = splitDate + "_" + resourceid;
int _changeType = Util.getIntValue("" + changeTypeMap.get(_change_key), -1);
if(_changeType == 1 || _changeType == 3) {
//获取出差、公出数据
try {
OvertimeRuleComputingMode5Service service = new OvertimeRuleComputingMode5Service();
service.getFlowDataMap(resourceid, splitDate, splitDate, dateFormatter,kqTimesArrayComInfo,overRulesDetailMap,changeTypeMap,lsCheckInfoMaps,eventMap);
} catch (Exception e) {
}
}
logOvertimeMap(overtimeLogMap, "出差、公出数据", "change_key="+_change_key+", changeType="+_changeType+", lsCheckInfoMaps:"+JSON.toJSONString(lsCheckInfoMaps));
if(lsCheckInfoMaps.isEmpty()){*/
//获取加班打卡数据
getOverTimeCardDataMap(resourceid, splitDate, splitDate, dateFormatter,kqTimesArrayComInfo,overRulesDetailMap,changeTypeMap,lsCheckInfoMaps,eventMap);
getOverTimeCardDataMap(resourceid, splitDate, splitDate, dateFormatter,kqTimesArrayComInfo,overRulesDetailMap,changeTypeMap,lsCheckInfoMaps,eventMap,uuid);
//}
if(lsCheckInfoMaps.isEmpty()){
logOvertimeMap(overtimeLogMap, "没有打卡数据", "打卡和上下班数据|KQOvertimeCardBean");
@ -147,6 +282,7 @@ public class KQOverTimeRuleCalBiz {
kqEventLogBiz.logDetailEvent(resourceid,eventMap,uuid,"doComputingMode4|对应的加班流程数据|key|"+key);
return;
}
logOvertimeMap(overtimeLogMap, lsCheckInfoMaps, "doComputingMode4.lsCheckInfoMaps");
RecordSet rs = new RecordSet();
Iterator<Entry<String, KQOvertimeCardBean>> iterator = lsCheckInfoMaps.entrySet().iterator();
@ -160,6 +296,7 @@ public class KQOverTimeRuleCalBiz {
}
String realSplitDate = mapKeys[1];
String uuidKey = mapKey + ".uuid:"+uuid;
Map<String,List<SplitBean>> splitBeanMaps = Maps.newHashMap();
//获取加班流程数据
getOverTimeFlowData(resourceid,realSplitDate,realSplitDate,splitBeanMaps,dateFormatter);
@ -221,6 +358,7 @@ public class KQOverTimeRuleCalBiz {
continue;
}
}
logOvertimeMap(overtimeLogMap, splitBeanMaps, mapKey+"|splitBeanMaps");
if(splitBeanMaps.containsKey(mapKey)) {
List<SplitBean> splitBeans = splitBeanMaps.get(mapKey);
String flowinfo = "";
@ -1216,6 +1354,15 @@ public class KQOverTimeRuleCalBiz {
if(restTimes.length == 2){
int restStart = kqTimesArrayComInfo.getArrayindexByTimes(restTimes[0]);
int restEnd = kqTimesArrayComInfo.getArrayindexByTimes(restTimes[1]);
if(restEnd == 1439){
//针对跨天的休息时段单独处理排除掉23:59-00:00的时间
restEnd = 1440;
}
int hasRestMins = kqTimesArrayComInfo.getCnt(initArrays, restStart,restEnd,1);
if(hasRestMins == 0) {
restStart = kqTimesArrayComInfo.turn24to48TimeIndex(restStart);
restEnd = kqTimesArrayComInfo.turn24to48TimeIndex(restEnd);
}
if(restStart < restEnd){
Arrays.fill(initArrays, restStart, restEnd, -2);
}
@ -1432,11 +1579,20 @@ public class KQOverTimeRuleCalBiz {
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap,
Map<String, Integer> changeTypeMap, Map<String, KQOvertimeCardBean> lsCheckInfoMaps,
Map<String, Object> eventMap) throws Exception{
getOverTimeCardDataMap(resourceid, fromDate, toDate, dateFormatter, kqTimesArrayComInfo, overRulesDetailMap, changeTypeMap, lsCheckInfoMaps, eventMap, String.valueOf(StringUtil.getUUID()));
}
public void getOverTimeCardDataMap(String resourceid, String fromDate, String toDate,
DateTimeFormatter dateFormatter,
KQTimesArrayComInfo kqTimesArrayComInfo,
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap,
Map<String, Integer> changeTypeMap, Map<String, KQOvertimeCardBean> lsCheckInfoMaps,
Map<String, Object> eventMap, String uuid) throws Exception{
KQOverTimeFlowBiz kqOverTimeFlowBiz = new KQOverTimeFlowBiz();
List<Object> lsCheckInfos = Lists.newArrayList();
Map<String,String> result = getSignData(resourceid, fromDate, dateFormatter,eventMap,lsCheckInfos,changeTypeMap,overRulesDetailMap);
eventMap.put("getOverTimeCardDataMap.uuid:"+uuid, "resourceid:"+resourceid+",fromDate:"+fromDate);
Map<String,String> result = getSignData(resourceid, fromDate, dateFormatter,eventMap,lsCheckInfos,changeTypeMap,overRulesDetailMap, uuid);
//获取一下当天的上班时间
String firstworkDate = Util.null2String(result.get("firstworkDate"));
@ -1570,9 +1726,16 @@ public class KQOverTimeRuleCalBiz {
DateTimeFormatter dateFormatter, Map<String, Object> eventMap,
List<Object> lsCheckInfos, Map<String, Integer> changeTypeMap,
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap) throws Exception{
return getSignData(resourceid, belongDate, dateFormatter, eventMap, lsCheckInfos, changeTypeMap, overRulesDetailMap, String.valueOf(StringUtil.getUUID()));
}
public Map<String, String> getSignData(String resourceid, String belongDate,
DateTimeFormatter dateFormatter, Map<String, Object> eventMap,
List<Object> lsCheckInfos, Map<String, Integer> changeTypeMap,
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap, String uuid) throws Exception{
Map<String,String> result = Maps.newHashMap();
String firstworkDate = "";
String firstworkTime = "";
eventMap.put("getSignData.uuid:"+uuid, "resourceid:"+resourceid+",fromDate:"+belongDate);
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
LocalDate localbelongDate = LocalDate.parse(belongDate);
@ -1610,6 +1773,23 @@ public class KQOverTimeRuleCalBiz {
before_startTime =curKqOvertimeRulesDetailEntity.getBefore_startTime();
}
KQWorkTime kqWorkTime = new KQWorkTime();
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceid, splitDate);
String signBeginTime = "";
List<TimeScopeEntity> signTime = null;
TimeScopeEntity firstSignTime = null;
if(workTime != null) signTime = workTime.getSignTime();
if(signTime != null && signTime.size() > 0) firstSignTime = signTime.get(0);
if(firstSignTime != null) signBeginTime = firstSignTime.getBeginTime();
if(StringUtil.isNotNull(signBeginTime)) {
if(pre_cut_point.length() > 0 && signBeginTime.compareTo(pre_cut_point) < 0) {
pre_cut_point = signBeginTime;
}
if(cut_point.length() > 0 && signBeginTime.compareTo(cut_point) < 0) {
cut_point = signBeginTime;
}
}
result.put("pre_has_cut_point", ""+pre_has_cut_point);
result.put("pre_cut_point", pre_cut_point);
result.put("has_cut_point", ""+has_cut_point);
@ -1618,15 +1798,14 @@ public class KQOverTimeRuleCalBiz {
result.put("preChangeType", ""+preChangeType);
result.put("changeType", ""+changeType);
KQWorkTime kqWorkTime = new KQWorkTime();
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceid, splitDate);
LocalDate pre_curLocalDate = localbelongDate.minusDays(1);
String preDate = pre_curLocalDate.format(dateFormatter);
LocalDate next_curLocalDate = localbelongDate.plusDays(1);
String nextDate = next_curLocalDate.format(dateFormatter);
if (workTime == null || workTime.getWorkMins() == 0) {
eventMap.put("getSignData.param.uuid:"+uuid, "resourceid:"+resourceid+",belongDate:"+belongDate+",splitDate:"+splitDate+",preDate:"+preDate+",nextDate:"+nextDate);
if (workTime == null || (workTime.getWorkMins() == 0 && workTime.getRestShift() != 1)) {
Map<String, Object> signMap = getRestSignInfo(resourceid,splitDate,preDate,nextDate,curKqOvertimeRulesDetailEntity,eventMap,preKqOvertimeRulesDetailEntity);
if(signMap != null && !signMap.isEmpty()){
lsCheckInfos.add(signMap);
@ -1709,7 +1888,7 @@ public class KQOverTimeRuleCalBiz {
}
}
}
Map<String, Object> signMap = getSignInfo(resourceid,signTimeScope,workTimeScope,splitDate,preDate,nextDate,kqTimesArrayComInfo,eventMap,i,result);
Map<String, Object> signMap = getSignInfo(resourceid,signTimeScope,workTimeScope,splitDate,preDate,nextDate,kqTimesArrayComInfo,eventMap,i,result, uuid);
if(signMap != null && !signMap.isEmpty()){
//目前一天多次打卡的话,只获取第一次和最后一次打卡
lsCheckInfos.add(signMap);
@ -1723,6 +1902,8 @@ public class KQOverTimeRuleCalBiz {
result.put("firstworkDate", firstworkDate);
result.put("firstworkTime", firstworkTime);
}
eventMap.put("getSignData.result.uuid:"+uuid, JSON.toJSONString(result));
return result;
}
@ -1872,9 +2053,9 @@ public class KQOverTimeRuleCalBiz {
preKqOvertimeBean.setSignoutTime(overtime_cut_points);
preKqOvertimeBean.setBelongDate(preDate);
preKqOvertimeBean.setHas_cut_point("0");
lsCheckInfoMaps.put(preKey, preKqOvertimeBean);
if(signoutdatetime.length() > 0 && signoutdatetime.compareTo(date_cut_point) > 0){
lsCheckInfoMaps.put(preKey, preKqOvertimeBean);
KQOvertimeCardBean curOvertimeBean = new KQOvertimeCardBean();
curOvertimeBean.setSigninDate(splitDate);
curOvertimeBean.setSigninTime(overtime_cut_points);
@ -1902,7 +2083,7 @@ public class KQOverTimeRuleCalBiz {
* @param splitBeanMaps
* @param dateFormatter
*/
private void getOverTimeFlowData(String resourceid, String fromDate, String toDate,
public void getOverTimeFlowData(String resourceid, String fromDate, String toDate,
Map<String, List<SplitBean>> splitBeanMaps,
DateTimeFormatter dateFormatter) {
LocalDate localFromDate = LocalDate.parse(fromDate);
@ -2018,6 +2199,13 @@ public class KQOverTimeRuleCalBiz {
}
ore_signBeginDateTime = kqDate+" "+pre_Worktime4Today;
}
/**
2022/04/29 09:00:00----2022/04/29 23:59:59---2022/04/30 00:00:00----2022/04/30 02:00:00
2022-04-29 20:00---2022-04-30 03:00
2022-04-2900:003000:00-02:00
2900:0029pre_Worktime4Today
*/
pre_Worktime4Today = cut_point+":01";
}
}
if(pre_Worktime4Today.length() == 5){
@ -2141,6 +2329,12 @@ public class KQOverTimeRuleCalBiz {
TimeScopeEntity workTimeScope, String kqDate, String preDate,
String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo,Map<String, Object> eventMap,
int index,Map<String,String> result) {
return getSignInfo(userId, signTimeScope, workTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo, eventMap, index, result, String.valueOf(StringUtil.getUUID()));
}
public Map<String, Object> getSignInfo(String userId, TimeScopeEntity signTimeScope,
TimeScopeEntity workTimeScope, String kqDate, String preDate,
String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo,Map<String, Object> eventMap,
int index,Map<String,String> result, String uuid) {
Map<String, Object> signMap = Maps.newHashMap();
KQFormatSignData kqFormatSignData = new KQFormatSignData();
List<Object> lsCheckInfo = new ArrayList<>();
@ -2158,9 +2352,11 @@ public class KQOverTimeRuleCalBiz {
//流程抵扣打卡不处理
Map<String,String> flow_deduct_card_map = Maps.newHashMap();
eventMap.put("工作日打卡.uuid:"+uuid+"signTimeScope_"+index, "kqDate:"+kqDate+",preDate:"+preDate+",nextDate:"+nextDate+","+JSON.toJSONString(signTimeScope));
List<Map<String,String>> sqlConditions = kqFormatSignData.getCanSignInfo(signTimeScope,kqDate,preDate,nextDate,kqTimesArrayComInfo);
base_sql = kqFormatSignData.signSignSql(rs);
eventMap.put("工作日打卡.uuid:"+uuid+"sqlConditions_"+index, JSON.toJSONString(sqlConditions));
if(sqlConditions != null && !sqlConditions.isEmpty()){
for (int i = 0; i < sqlConditions.size(); i++) {
@ -2211,8 +2407,8 @@ public class KQOverTimeRuleCalBiz {
rs.executeQuery(sql, userId, signBeginDateTime, signEndDateTime);
String work_card_sql = "index:"+index+":idx:"+idx+"|sql:"+sql+"|resourceid|"+userId+"|signBeginDateTime|"+signBeginDateTime+"|signEndDateTime|"+signEndDateTime;
eventMap.put("工作日打卡sql|work_card_sql_"+index, work_card_sql);
eventMap.put("工作日打卡sql结果|work_card_sql_getCounts_"+index, rs.getCounts());
eventMap.put("工作日打卡.uuid:"+uuid+"sql|work_card_sql_"+index, work_card_sql);
eventMap.put("工作日打卡.uuid:"+uuid+"sql结果|work_card_sql_getCounts_"+index, rs.getCounts());
while (rs.next()) {
String signId = Util.null2String(rs.getString("id"));
String signdate = Util.null2String(rs.getString("signdate"));
@ -2282,7 +2478,7 @@ public class KQOverTimeRuleCalBiz {
* @param belongdate
* @param hasOverTimeList
*/
private void getHasOverTimeData(String resourceid, String belongdate,List<Map<String,String>> hasOverTimeList) {
public void getHasOverTimeData(String resourceid, String belongdate,List<Map<String,String>> hasOverTimeList) {
RecordSet rs = new RecordSet();
String sql = " select * from kq_flow_overtime where resourceid = ? and belongdate = ? ";
@ -2571,7 +2767,10 @@ public class KQOverTimeRuleCalBiz {
String delSql = "";
if(tiaoxiuidis0.length() > 0){
delSql = "delete from kq_balanceofleave where "+Util.getSubINClause(tiaoxiuidis0, "id", "in");
rs.executeUpdate(delSql);
boolean flag= rs.executeUpdate(delSql);
if (!flag) {
kqLog.info("加班流程删除之前的调休数据失败:数据库更新失败" );
}
}
String clearSql = "";
boolean isclearOk = false;

@ -1,11 +1,14 @@
package com.engine.kq.biz;
import com.engine.kq.biz.chain.cominfo.ShiftInfoCominfoBean;
import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean;
import com.engine.kq.entity.KQOvertimeRulesDetailEntity;
import com.engine.kq.log.KQLog;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
@ -290,15 +293,25 @@ public class KQOvertimeRulesBiz {
logger.writeLog("获取当前日期的日期类型错误。resourceId=" + resourceId + ",date=" + date + ",changeType=" + changeType);
}
int overtimeRuleId = 0;//加班规则的ID
//查询员工在指定日期时的班次
String shiftId = "";
ShiftInfoCominfoBean shiftBean = new KQWorkTime().getShiftInfoCominfoBeanIncludeHoliday(resourceId, date);
if(shiftBean != null) {
shiftId = shiftBean.getSerialid();
}
if(shiftId.length() == 0){
logger.writeLog("该人员在指定日期没有排班班次请为其设置。resourceId=" + resourceId + ",date=" + date+", groupId="+groupIds);
}
RecordSet recordSet = new RecordSet();
int overtimeRuleId = 0;//加班规则的ID
String sql = "select id from kq_OvertimeRules where (isDelete is null or isDelete !=1) ";
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")) {
sql += " and ','+groupIds+',' like '%," + groupIds + ",%'";
sql += " and ','+shiftIds+',' like '%," + shiftId + ",%'";
} else if (recordSet.getDBType().equalsIgnoreCase("mysql")) {
sql += " and concat(',',groupIds,',') like '%," + groupIds + ",%'";
sql += " and concat(',',shiftIds,',') like '%," + shiftId + ",%'";
} else {
sql += " and ','||groupIds||',' like '%," + groupIds + ",%'";
sql += " and ','||shiftIds||',' like '%," + shiftId + ",%'";
}
recordSet.executeQuery(sql);
if (recordSet.next()) {
@ -701,6 +714,16 @@ public class KQOvertimeRulesBiz {
return ;
}
//查询员工在指定日期时的班次
String shiftId = "";
ShiftInfoCominfoBean shiftBean = new KQWorkTime().getShiftInfoCominfoBeanIncludeHoliday(resourceId, date);
if(shiftBean != null) {
shiftId = shiftBean.getSerialid();
}
if(shiftId.length() == 0){
logger.writeLog("该人员在指定日期没有排班班次请为其设置。resourceId=" + resourceId + ",date=" + date+", groupId="+groupId);
}
changeType = KQHolidaySetBiz.getChangeType(groupId, date);
if (changeType != 1 && changeType != 2 && changeType != 3) {
KQWorkTime kqWorkTime = new KQWorkTime();
@ -714,11 +737,11 @@ public class KQOvertimeRulesBiz {
RecordSet recordSet = new RecordSet();
String sql = "select id from kq_OvertimeRules where (isDelete is null or isDelete !=1) ";
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")) {
sql += " and ','+groupIds+',' like '%," + groupId + ",%'";
sql += " and ','+shiftIds+',' like '%," + shiftId + ",%'";
} else if (recordSet.getDBType().equalsIgnoreCase("mysql")) {
sql += " and concat(',',groupIds,',') like '%," + groupId + ",%'";
sql += " and concat(',',shiftIds,',') like '%," + shiftId + ",%'";
} else {
sql += " and ','||groupIds||',' like '%," + groupId + ",%'";
sql += " and ','||shiftIds||',' like '%," + shiftId + ",%'";
}
recordSet.executeQuery(sql);
if (recordSet.next()) {
@ -857,7 +880,7 @@ public class KQOvertimeRulesBiz {
} else {
logger.writeLog("该人员所属的考勤组没有设置过任何加班规则请为其设置加班规则。resourceId=" + resourceId + ",date="+date+",changeType=" + changeType);
logger.writeLog("该人员所在的考勤组班次(ID="+shiftId+")没有设置过任何加班规则请为其设置加班规则。resourceId=" + resourceId + ",date="+date+",changeType=" + changeType);
}
return ;

@ -47,6 +47,14 @@ public class KQScheduleSignBiz {
*/
private String offSignSectionTime;
private int shiftCount;
private int shiftI;
private String count4NoonStartDateTime;
private String count4NoonEndDateTime;
private KQScheduleSignBiz(KQScheduleSignParamBuilder build){
this.resourceid = build.resourceid;
this.userType = build.userType;
@ -60,6 +68,10 @@ public class KQScheduleSignBiz {
this.signSectionEndTime = build.signSectionEndTime;
this.signSectionBeginTime = build.signSectionBeginTime;
this.offSignSectionTime = build.offSignSectionTime;
this.shiftCount = build.shiftCount;
this.shiftI = build.shiftI;
this.count4NoonStartDateTime = build.count4NoonStartDateTime;
this.count4NoonEndDateTime = build.count4NoonEndDateTime;
}
/**
@ -324,6 +336,10 @@ public class KQScheduleSignBiz {
private String belongdate;
private String signtype;
private String worksection;
private int shiftCount;
private int shiftI;
private String count4NoonStartDateTime;
private String count4NoonEndDateTime;
/**
* sql
*/
@ -361,6 +377,10 @@ public class KQScheduleSignBiz {
this.signSectionEndTime = "";
this.signSectionBeginTime = "";
this.offSignSectionTime = "";
this.shiftCount = 0;
this.shiftI = 0;
this.count4NoonStartDateTime = "";
this.count4NoonEndDateTime = "";
}
//成员方法返回其自身,所以可以链式调用
@ -374,6 +394,24 @@ public class KQScheduleSignBiz {
return this;
}
public KQScheduleSignParamBuilder shiftCountParam(final int shiftCount) {
this.shiftCount = shiftCount;
return this;
}
public KQScheduleSignParamBuilder count4NoonStartDateTimeParam(final String count4NoonStartDateTime) {
this.count4NoonStartDateTime = count4NoonStartDateTime;
return this;
}
public KQScheduleSignParamBuilder count4NoonEndDateTimeParam(final String count4NoonEndDateTime) {
this.count4NoonEndDateTime = count4NoonEndDateTime;
return this;
}
public KQScheduleSignParamBuilder shiftIParam(final int shiftI) {
this.shiftI = shiftI;
return this;
}
public KQScheduleSignBiz.KQScheduleSignParamBuilder signDateParam(final String signDate) {
this.signDate = signDate;
return this;

@ -8,6 +8,7 @@ import com.engine.kq.biz.chain.duration.WorkHalfUnitSplitChain;
import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean;
import com.engine.kq.entity.TimeScopeEntity;
import com.engine.kq.entity.WorkTimeEntity;
import com.engine.kq.enums.DurationTypeEnum;
import com.engine.kq.log.KQLog;
import com.engine.kq.wfset.bean.SplitBean;
import com.google.common.collect.Lists;
@ -473,13 +474,27 @@ public class KQShiftRuleInfoBiz {
SplitBean splitBean, List<int[]> real_workLongTimeIndex,
KQTimesArrayComInfo kqTimesArrayComInfo,
List<String> real_allLongWorkTime){
boolean is_flow_humanized = KQSettingsBiz.is_flow_humanized();
rest_workLongTimeIndex(shiftInfoBean,splitBean,real_workLongTimeIndex,kqTimesArrayComInfo,real_allLongWorkTime,false);
}
public void rest_workLongTimeIndex(ShiftInfoBean shiftInfoBean,
SplitBean splitBean, List<int[]> real_workLongTimeIndex,
KQTimesArrayComInfo kqTimesArrayComInfo,
List<String> real_allLongWorkTime,boolean is_flow_humanized){
// boolean is_flow_humanized = KQSettingsBiz.is_flow_humanized();
if(!is_flow_humanized){
return ;
}
boolean lateInlateOutWithFlow = KQSettingsBiz.showLeaveTypeSet("lateinlateout_kqflow");
//个性化设置只支持一次打卡的
Map<String,String> shifRuleMap = Maps.newHashMap();
if(lateInlateOutWithFlow && (splitBean.getDurationTypeEnum() == DurationTypeEnum.EVECTION
|| splitBean.getDurationTypeEnum() == DurationTypeEnum.OUT
|| splitBean.getDurationTypeEnum() == DurationTypeEnum.LEAVE)){
// KQShiftRuleInfoBiz.getShiftRuleInfo(shiftInfoBean,splitBean,shifRuleMap);
} else {
KQShiftRuleInfoBiz.getShiftRuleInfo(shiftInfoBean,splitBean.getResourceId(),shifRuleMap);
}
if(!shifRuleMap.isEmpty()){
if(shifRuleMap.containsKey("shift_beginworktime")){
String shift_beginworktime = Util.null2String(shifRuleMap.get("shift_beginworktime"));
@ -579,6 +594,544 @@ public class KQShiftRuleInfoBiz {
}
/**
* do4ShiftRule
* @param shiftInfoBean
* @param need_lateoutlatein
*/
public static void getShiftRuleInfo(ShiftInfoBean shiftInfoBean, SplitBean splitBean,Map<String,String> shifRuleMap,boolean need_lateoutlatein,List<String> logList) {
String resourceId = splitBean.getResourceId();
DateTimeFormatter fullFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
DateTimeFormatter minFormatter = DateTimeFormatter.ofPattern("HH:mm");
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
List<Object> earlyinearlyout = null;//早到早走规则
List<Object> lateinlateout = null;//晚到晚走规则
List<Object> lateoutlatein = null;//晚走晚到规则
if(shiftInfoBean == null){
return ;
}
String splitDate = shiftInfoBean.getSplitDate();
String preDate = DateUtil.addDate(splitDate, -1);//上一天日期
String nextDate = DateUtil.addDate(splitDate, 1);//下一天日期
KQWorkTime kqWorkTime = new KQWorkTime();
kqWorkTime.setIsFormat(true);
String tmpKQPreDate = preDate;
if(KQSettingsBiz.is_lateoutlatein()) {//开启开关
//前一天是非工作日,往前取到工作日
for(int i=0;i<31;i++){
WorkTimeEntity tmpworkTime = kqWorkTime.getWorkTime(resourceId, tmpKQPreDate);
if(tmpworkTime.getWorkMins()>0){
break;
}
tmpKQPreDate = DateUtil.addDate(tmpKQPreDate, -1);
}
}else{
//默认取前一天
}
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceId, tmpKQPreDate);
if(workTime == null || workTime.getWorkMins() == 0){//如果前一天是休息日,那么直接就不需要走晚走晚到了,因为压根不存在前一天的晚走情况
need_lateoutlatein = false;
}else{
Map<String, Object> preshiftRuleMap = workTime.getShiftRuleInfo();
if (preshiftRuleMap != null && !preshiftRuleMap.isEmpty() && preshiftRuleMap.containsKey("ruleDetail")) {
Map<String, Object> preruleDetail = (Map<String, Object>) preshiftRuleMap.get("ruleDetail");
if(preruleDetail != null && !preruleDetail.isEmpty()){
lateoutlatein = (List<Object>) preruleDetail.get("lateoutlatein");//晚走晚到应该取前一天的个性化班次的设置,而不是当天
}
}
}
Map<String, Object> shiftRuleMap = shiftInfoBean.getShiftRuleMap();
if (shiftRuleMap != null && !shiftRuleMap.isEmpty() && shiftRuleMap.containsKey("ruleDetail")) {//处理人性化设置其他规则
//允许迟到分钟数
boolean usepermitlateminutes = Util.null2String(shiftRuleMap.get("permitlatestatus")).equals("1");
//和蔡志军讨论,优先满足弹性,即如果晚到了,开启了弹性,那么就先按照弹性来处理,不满足弹性的部分再按照允许迟到来处理
usepermitlateminutes = false;
int permitlateminutes = Util.getIntValue(Util.null2String(shiftRuleMap.get("permitlateminutes")), 0);
// //允许早退分钟数
// boolean usepermitleaveearlyminutes = Util.null2String(shiftRuleMap.get("permitleaveearlystatus")).equals("1");
// int permitleaveearlyminutes = Util.getIntValue(Util.null2String(shiftRuleMap.get("permitleaveearlyminutes")), 0);
Map<String, Object> ruleDetail = (Map<String, Object>) shiftRuleMap.get("ruleDetail");
if(ruleDetail != null && !ruleDetail.isEmpty()){
earlyinearlyout = (List<Object>) ruleDetail.get("earlyinearlyout");
lateinlateout = (List<Object>) ruleDetail.get("lateinlateout");
//上面已经搞了下面注释掉
// lateoutlatein = (List<Object>) ruleDetail.get("lateoutlatein");
// KQWorkTime kqWorkTime = new KQWorkTime();
//如果设置了个性化规则,需要先获取下打卡数据
List<TimeScopeEntity> lsSignTime = new ArrayList<>();
List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
List<TimeScopeEntity> lsRestTime = new ArrayList<>();
lsSignTime = shiftInfoBean.getSignTime();//允许打卡时间
lsWorkTime = shiftInfoBean.getWorkTime();//工作时间
//只有一次签到签退才有个性化的这些设置
if(lsWorkTime != null && lsWorkTime.size() > 0){
//早到早走后,引起下班时间变化后的时间
LocalDateTime early_localEndDateTime = null;
//早到早走后,引起上班时间变化后的时间
LocalDateTime early_localBeginDateTime = null;
//晚到晚走后,引起下班时间变化后的时间
LocalDateTime late_localEndDateTime = null;
//晚到晚走后,引起上班时间变化后的时间
LocalDateTime late_localBeginDateTime = null;
//晚走晚到后,引起上班时间变化后的时间
LocalDateTime latein_localBeginDateTime = null;
TimeScopeEntity signTimeScope = lsSignTime.get(0);
TimeScopeEntity workTimeScope = lsWorkTime.get(0);
String signInDate = "";
String signInTime = "";
String signOutDate = "";
String signOutTime = "";
String workbeigintime = workTimeScope.getBeginTime();
boolean beginTimeAcross = workTimeScope.getBeginTimeAcross();
String workbegindate = splitDate;
if(beginTimeAcross){
workbegindate = nextDate;
workbeigintime = kqTimesArrayComInfo.turn48to24Time(workbeigintime);
}
String workbegindatetime = workbegindate+" "+workbeigintime+":00";
LocalDateTime localBeginDateTime = LocalDateTime.parse(workbegindatetime,fullFormatter);
String workendtime = workTimeScope.getEndTime();
boolean endTimeAcross = workTimeScope.getEndTimeAcross();
String workenddate = splitDate;
if(endTimeAcross){
workenddate = nextDate;
workendtime = kqTimesArrayComInfo.turn48to24Time(workendtime);
}
String workenddatetime = workenddate+" "+workendtime+":00";
LocalDateTime localEndDateTime = LocalDateTime.parse(workenddatetime,fullFormatter);
List<Object> lsCheckInfo = new KQFormatSignData().getSignInfo(resourceId,signTimeScope,workTimeScope,splitDate,preDate,nextDate,kqTimesArrayComInfo);
if(lsCheckInfo.isEmpty()){
//如果当天没有打卡数据,判断下是否存在昨天有打卡数据,晚走晚到的情况
if ((lateoutlatein != null && lateoutlatein.size() > 0) || (lateinlateout != null && lateinlateout.size() > 0)) {
}else{
return ;
}
}
if(lsCheckInfo.size() > 1){
for(int i = 0 ; i < lsCheckInfo.size() ; i++){
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(i);
if (checkInfo.get("signType").equals("1")) {
//签到
signInDate = Util.null2String(checkInfo.get("signDate"));
signInTime = Util.null2String(checkInfo.get("signTime"));
}
if (checkInfo.get("signType").equals("2")) {
//签退
signOutDate = Util.null2String(checkInfo.get("signDate"));
signOutTime = Util.null2String(checkInfo.get("signTime"));
}
}
}else if(lsCheckInfo.size() == 1){
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(0);
if (checkInfo.get("signType").equals("1")) {
//签到
signInDate = Util.null2String(checkInfo.get("signDate"));
signInTime = Util.null2String(checkInfo.get("signTime"));
}
if (checkInfo.get("signType").equals("2")) {
//签退
signOutDate = Util.null2String(checkInfo.get("signDate"));
signOutTime = Util.null2String(checkInfo.get("signTime"));
}
}
if (need_lateoutlatein && lateoutlatein != null && lateoutlatein.size() > 0) {
String log_str = "";
KQFormatShiftRule kqFormatShiftRule = new KQFormatShiftRule();
int preDayLateOutMins = kqFormatShiftRule.getPreDayLateOutMins(resourceId, splitDate,logList);
if(!logList.isEmpty()){
for(int i = 0 ; i < logList.size() ; i++){
if(i == 0){
log_str += ""+logList.get(i);
}else{
log_str += ","+logList.get(i);
}
}
logList.clear();
}
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();//允许晚到时间
boolean enablesame = Util.null2String(rule.get("enablesame")).equals("1");
if(log_str.length() > 0){
log_str += ","+(" "+"开启了晚走晚到,"+(enablesame?"相对时间,前一天晚走,第二天可以晚到,弹性限额"+postponetime+"分钟":"绝对时间"+",前一天晚走"+advancetime+"分钟,第二天上班可以晚到"+postponetime+"分钟"));
}else{
log_str += ""+(" "+"开启了晚走晚到,"+(enablesame?"相对时间,前一天晚走,第二天可以晚到,弹性限额"+postponetime+"分钟":"绝对时间"+",前一天晚走"+advancetime+"分钟,第二天上班可以晚到"+postponetime+"分钟"));
}
if (enablesame) {
if(preDayLateOutMins >= advancetime){
//如果昨日的晚走时长已经完全大于了设置的晚走时长,那么就可以晚到整个postponetime
latein_localBeginDateTime = localBeginDateTime.plusMinutes(postponetime);
}else{
latein_localBeginDateTime = localBeginDateTime.plusMinutes(preDayLateOutMins);
}
break;
}else{
if (preDayLateOutMins >= advancetime) {
//如果昨日的晚走时长已经完全大于了设置的晚走时长,那么就可以晚到整个postponetime
latein_localBeginDateTime = localBeginDateTime.plusMinutes(postponetime);
break;
}else{
logList.clear();
}
}
}else{
logList.clear();
}
}
if(latein_localBeginDateTime != null){
shifRuleMap.put("shift_type", "lateoutlatein");
String beginDate = latein_localBeginDateTime.format(dateFormatter);
String beginmin = latein_localBeginDateTime.format(minFormatter);
// 前一天的晚到影响了今天的早到或者晚到
workbegindatetime = latein_localBeginDateTime.format(fullFormatter);
localBeginDateTime = LocalDateTime.parse(workbegindatetime,fullFormatter);
log_str += ","+("满足了晚走晚到,所以今天的上班时间变化了,变成了:"+workbegindatetime+"-"+workenddatetime);
shifRuleMap.put("shift_begindate", beginDate);
if(beginDate.compareTo(splitDate) > 0){
shifRuleMap.put("shift_beginworktime", kqTimesArrayComInfo.turn24to48Time(beginmin));
}else{
shifRuleMap.put("shift_beginworktime", beginmin);
}
}else{
log_str = "";
}
if(log_str.length() > 0){
logList.add(log_str);
}else{
logList.clear();
}
}
String log_str = "";
long signIn_before_mins = 0;
long signIn_after_mins = 0;
long signOut_before_mins = 0;
long signOut_after_mins = 0;
// 针对流程的特殊处理
String flowFromDate = Util.null2String(splitBean.getFromdatedb());
String flowToDate = Util.null2String(splitBean.getTodatedb());
String flowFromTime = Util.null2String(splitBean.getFromtimedb());
String flowToTime = Util.null2String(splitBean.getTotimedb());
String flowFromDateTime = "";
String flowToDateTime = "";
if(!"".equals(flowFromDate) && !"".equals(flowToDate) && !"".equals(flowFromTime) && !"".equals(flowToTime)) {
if (!splitDate.equals(flowFromDate) && !splitDate.equals(flowToDate)) {
return;
}
long flowIn_after_mins = 0;
// 如果流程上的开始时间在打卡时间之前,验证流程
String signDateTime = signInDate+" "+signInTime;
if (splitDate.equals(flowFromDate)) {
flowFromDateTime = splitDate+" "+flowFromTime+":00";
if(flowFromDateTime.compareTo(workbegindatetime) >= 0) { // 如果流程上的开始时间小于打卡时间且要大于上班时间,则按流程走
// 流程上的开始时间
// flowIn_after_mins = Duration.between(LocalDateTime.parse(flowFromDateTime, fullFormatter), LocalDateTime.parse(workbegindatetime, fullFormatter)).toMinutes();
} else if(flowFromDateTime.compareTo(workbegindatetime) < 0) { // 如果流程上的开始时间小于上班时间,则不走弹性
return;
} else {
flowFromDateTime = "";
}
} else if (splitDate.equals(flowToDate)) {
flowToDateTime = splitDate+" "+flowToTime+":00";
if (flowToDateTime.compareTo(workbegindatetime) > 0) { // 请假流程的结束时间只要在9点之后的那就不走弹性
return;
}
}
}
boolean isFromFlow = false;
if(signInDate.length() > 0 && signInTime.length() > 0){
//判断下签到和上班时间,是否存在早到或者晚到的情况的情况
String fromDateTime = signInDate+" "+signInTime;
String toDateTime = workbegindatetime;
// 如果流程上的时间在打卡时间之前并且是在上班时间之后,则按流程进行班次变化
if(!"".equals(flowFromDateTime) && flowFromDateTime.compareTo(fromDateTime) <= 0 && flowFromDateTime.compareTo(workbegindatetime) >= 0) {
fromDateTime = flowFromDateTime;
signInTime = flowFromTime+":00";
isFromFlow = true;
}
long signIn_mins = Duration.between(LocalDateTime.parse(fromDateTime, fullFormatter), LocalDateTime.parse(toDateTime, fullFormatter)).toMinutes();
if(latein_localBeginDateTime != null){
signIn_mins = Duration.between(LocalDateTime.parse(fromDateTime, fullFormatter), latein_localBeginDateTime).toMinutes();
}
boolean need_plus_one_min = false;
new BaseBean().writeLog("fromDateTime="+fromDateTime+">>>toDateTime="+toDateTime);
if(signInTime.length() > 6){
String signMinTime = signInTime.substring(0,5)+":00";
if(signInTime.compareTo(signMinTime) > 0){
//如果签到时间是带秒的且是迟到,那么签到时间多一秒和多一分钟是一样的
need_plus_one_min = true;
String tmpfromDateTime = signInDate+" "+signMinTime;
if(need_plus_one_min){
signIn_mins = Duration.between(LocalDateTime.parse(tmpfromDateTime, fullFormatter).plusMinutes(1), LocalDateTime.parse(toDateTime, fullFormatter)).toMinutes();
if(latein_localBeginDateTime != null){
signIn_mins = Duration.between(LocalDateTime.parse(tmpfromDateTime, fullFormatter).plusMinutes(1), latein_localBeginDateTime).toMinutes();
}
}
}
}
if(signIn_mins > 0){
log_str = (splitDate+" 上班时间是:"+toDateTime+",签到时间是:"+fromDateTime+",早到"+signIn_mins+"分钟");
//确实是早到了
signIn_before_mins = signIn_mins;
}else if(signIn_mins < 0){
//这属于是晚到了
signIn_after_mins = Math.abs(signIn_mins);
if(isFromFlow) {
log_str = (splitDate+" "+"上班时间是:"+toDateTime+",流程开始时间是:"+fromDateTime+",晚到"+signIn_after_mins+"分钟");
} else {
log_str = (splitDate+" "+"上班时间是:"+toDateTime+",签到时间是:"+fromDateTime+",晚到"+signIn_after_mins+"分钟");
}
if (usepermitlateminutes) {//允许迟到分钟数
signIn_after_mins = signIn_after_mins - permitlateminutes;
}
}
} else {
// 没有签到卡的情况下,只看流程
if(!"".equals(flowFromDateTime) && flowFromDateTime.compareTo(workbegindatetime) >= 0) {
isFromFlow = true;
String toDateTime = workbegindatetime;
long flowIn_mins = Duration.between(LocalDateTime.parse(flowFromDateTime, fullFormatter), LocalDateTime.parse(toDateTime, fullFormatter)).toMinutes();
if(latein_localBeginDateTime != null){
flowIn_mins = Duration.between(LocalDateTime.parse(flowFromDateTime, fullFormatter), latein_localBeginDateTime).toMinutes();
}
boolean need_plus_one_min = false;
new BaseBean().writeLog("fromDateTime="+flowFromDateTime+">>>toDateTime="+toDateTime);
String flowMinTime = flowFromTime.substring(0,5)+":00";
if(flowFromTime.compareTo(flowMinTime) > 0){
//如果签到时间是带秒的且是迟到,那么签到时间多一秒和多一分钟是一样的
need_plus_one_min = true;
String tmpfromDateTime = signInDate+" "+flowMinTime;
if(need_plus_one_min){
flowIn_mins = Duration.between(LocalDateTime.parse(tmpfromDateTime, fullFormatter).plusMinutes(1), LocalDateTime.parse(toDateTime, fullFormatter)).toMinutes();
if(latein_localBeginDateTime != null){
flowIn_mins = Duration.between(LocalDateTime.parse(tmpfromDateTime, fullFormatter).plusMinutes(1), latein_localBeginDateTime).toMinutes();
}
}
}
if(flowIn_mins > 0){
log_str = (splitDate+" 上班时间是:"+toDateTime+",流程开始时间是:"+flowFromDateTime+",早到"+flowIn_mins+"分钟");
//确实是早到了
signIn_before_mins = flowIn_mins;
}else if(flowIn_mins < 0){
//这属于是晚到了
signIn_after_mins = Math.abs(flowIn_mins);
log_str = (splitDate+" "+"上班时间是:"+toDateTime+",流程开始时间是:"+flowFromDateTime+",晚到"+signIn_after_mins+"分钟");
if (usepermitlateminutes) {//允许迟到分钟数
signIn_after_mins = signIn_after_mins - permitlateminutes;
}
}
}
}
if(signOutDate.length() > 0 && signOutTime.length() > 0){
//判断下签退和下班时间,是否存在晚走的情况
String fromDateTime = workenddatetime;
String toDateTime = signOutDate+" "+signOutTime;
long signOut_mins = Duration.between(LocalDateTime.parse(fromDateTime, fullFormatter), LocalDateTime.parse(toDateTime, fullFormatter)).toMinutes();
if(signOut_mins > 0){
//这属于是晚走了
signOut_after_mins = signOut_mins;
}else if(signOut_mins < 0){
//这属于是早退了
signOut_before_mins = Math.abs(signOut_mins);
}
}
if (earlyinearlyout != null && earlyinearlyout.size() > 0 && signIn_before_mins > 0) {
//必须有早到时间才能继续下面的判断
for (int i = 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();//允许早走时间
boolean enablesame = Util.null2String(rule.get("enablesame")).equals("1");
if(log_str.length() > 0){
log_str += ","+(" "+"开启了早到早走,"+(enablesame?"相对时间,早到可以早走,弹性限额"+postponetime+"分钟":"绝对时间"+",上班早到"+advancetime+"分钟,下班可以早走"+postponetime+"分钟"));
}else{
log_str += ""+(" "+"开启了早到早走,"+(enablesame?"相对时间,早到可以早走,弹性限额"+postponetime+"分钟":"绝对时间"+",上班早到"+advancetime+"分钟,下班可以早走"+postponetime+"分钟"));
}
if (enablesame) {
//使用相对时间
if(signIn_before_mins >= advancetime){
//如果打卡的早到时长已经完全大于了设置的早到时长,那么就可以早走整个postponetime
early_localEndDateTime = localEndDateTime.minusMinutes(postponetime);
early_localBeginDateTime = localBeginDateTime.minusMinutes(advancetime);
}else{
early_localEndDateTime = localEndDateTime.minusMinutes(signIn_before_mins);
early_localBeginDateTime = localBeginDateTime.minusMinutes(signIn_before_mins);
}
break;
}else{
if(signIn_before_mins >= advancetime){
//如果打卡的早到时长已经完全大于了设置的早到时长,那么就可以早走整个postponetime
early_localEndDateTime = localEndDateTime.minusMinutes(postponetime);
early_localBeginDateTime = localBeginDateTime.minusMinutes(advancetime);
break;
}
}
}
}
String new_beginDateTime = "";
String new_endDateTime = "";
if(early_localBeginDateTime != null){
shifRuleMap.put("shift_type", "earlyinearlyout");
String beginDate = early_localBeginDateTime.format(dateFormatter);
String beginmin = early_localBeginDateTime.format(minFormatter);
shifRuleMap.put("shift_begindate", beginDate);
if(beginDate.compareTo(splitDate) > 0){
shifRuleMap.put("shift_beginworktime", kqTimesArrayComInfo.turn24to48Time(beginmin));
}else{
shifRuleMap.put("shift_beginworktime", beginmin);
}
new_beginDateTime = beginDate+" "+beginmin;
}
if(early_localEndDateTime != null){
shifRuleMap.put("shift_type", "earlyinearlyout");
String endDate = early_localEndDateTime.format(dateFormatter);
String endmin = early_localEndDateTime.format(minFormatter);
shifRuleMap.put("shift_enddate", endDate);
if(endDate.compareTo(splitDate) > 0){
shifRuleMap.put("shift_endworktime", kqTimesArrayComInfo.turn24to48Time(endmin));
}else{
shifRuleMap.put("shift_endworktime", endmin);
}
new_endDateTime = endDate+" "+endmin;
}
if(new_beginDateTime.length() > 0 && new_endDateTime.length() > 0){
log_str += ","+"满足了早到,所以"+splitDate+"的上班时间和下班时间变化了,上班时间变成了:"+new_beginDateTime+",下班时间变成了:"+new_endDateTime;
}else{
log_str += ",不满足规则,所以"+splitDate+"的上班时间和下班时间未发生变化,上班时间还是:"+workbegindatetime+",下班时间还是:"+workenddatetime;
}
if(log_str.length() > 0){
logList.add(log_str);
}
}
boolean isLateinlateout = false;
if (lateinlateout != null && lateinlateout.size() > 0) {
if(signIn_after_mins > 0){
isLateinlateout = true;
//必须有晚到时间才能继续下面的判断
for (int i = 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();//需要晚走时间
boolean enablesame = Util.null2String(rule.get("enablesame")).equals("1");
if(isFromFlow) {
if(log_str.length() > 0){
log_str += ","+(" "+"开启了晚到晚走,"+(enablesame?"相对时间,晚到可以晚走,弹性限额"+postponetime+"分钟":"绝对时间"+",流程开始时间晚到"+advancetime+"分钟,下班需要晚走"+postponetime+"分钟"));
}else{
log_str += ""+(" "+"开启了晚到晚走,"+(enablesame?"相对时间,晚到可以晚走,弹性限额"+postponetime+"分钟":"绝对时间"+",流程开始时间晚到"+advancetime+"分钟,下班需要晚走"+postponetime+"分钟"));
}
} else {
if(log_str.length() > 0){
log_str += ","+(" "+"开启了晚到晚走,"+(enablesame?"相对时间,晚到可以晚走,弹性限额"+postponetime+"分钟":"绝对时间"+",上班晚到"+advancetime+"分钟,下班需要晚走"+postponetime+"分钟"));
}else{
log_str += ""+(" "+"开启了晚到晚走,"+(enablesame?"相对时间,晚到可以晚走,弹性限额"+postponetime+"分钟":"绝对时间"+",上班晚到"+advancetime+"分钟,下班需要晚走"+postponetime+"分钟"));
}
}
if (enablesame) {
//使用相对时间
if(signIn_after_mins <= advancetime){
//如果打卡的晚到时长必须要小于等于设置的晚到时长,才算满足,晚到多久就可以晚走多久
late_localEndDateTime = localEndDateTime.plusMinutes(signIn_after_mins);
late_localBeginDateTime = localBeginDateTime.plusMinutes(signIn_after_mins);
break;
}else{
if(KQSettingsBiz.is_lateinlateout_outrule()){
late_localEndDateTime = localEndDateTime.plusMinutes(advancetime);
late_localBeginDateTime = localBeginDateTime.plusMinutes(advancetime);
break;
}
}
}else{
if (signIn_after_mins <= advancetime) {
//如果打卡的晚到时长已经完全小于了设置的晚到时长,那么需要晚走整个postponetime
late_localEndDateTime = localEndDateTime.plusMinutes(postponetime);
late_localBeginDateTime = localBeginDateTime.plusMinutes(advancetime);
break;
}else{
if(KQSettingsBiz.is_lateinlateout_outrule()){
late_localEndDateTime = localEndDateTime.plusMinutes(postponetime);
late_localBeginDateTime = localBeginDateTime.plusMinutes(advancetime);
break;
}
}
}
}
}
}
if(isLateinlateout){
String new_beginDateTime = "";
String new_endDateTime = "";
if(late_localBeginDateTime != null){
shifRuleMap.put("shift_type", "lateinlateout");
String beginDate = late_localBeginDateTime.format(dateFormatter);
String beginmin = late_localBeginDateTime.format(minFormatter);
shifRuleMap.put("shift_begindate", beginDate);
if(beginDate.compareTo(splitDate) > 0){
shifRuleMap.put("shift_beginworktime", kqTimesArrayComInfo.turn24to48Time(beginmin));
}else{
shifRuleMap.put("shift_beginworktime", beginmin);
}
new_beginDateTime = beginDate+" "+beginmin;
}
if(late_localEndDateTime != null){
shifRuleMap.put("shift_type", "lateinlateout");
String endDate = late_localEndDateTime.format(dateFormatter);
String endmin = late_localEndDateTime.format(minFormatter);
shifRuleMap.put("shift_enddate", endDate);
if(endDate.compareTo(splitDate) > 0){
shifRuleMap.put("shift_endworktime", kqTimesArrayComInfo.turn24to48Time(endmin));
}else{
shifRuleMap.put("shift_endworktime", endmin);
}
new_endDateTime = endDate+" "+endmin;
}
if(new_beginDateTime.length() > 0 && new_endDateTime.length() > 0){
log_str += ",满足了晚到,所以"+splitDate+"的上班时间和下班时间变化了,上班时间变成了:"+new_beginDateTime+",下班时间变成了:"+new_endDateTime;
}else{
log_str += ",不满足规则,所以"+splitDate+"的上班时间和下班时间未发生变化,上班时间还是:"+workbegindatetime+",下班时间还是:"+workenddatetime;
}
if(log_str.length() > 0){
logList.add(log_str);
}
}
}
}
}
}
}
/**
*
* @param ruleDetail

@ -9,6 +9,7 @@ import com.engine.kq.entity.TimeSignScopeEntity;
import com.engine.kq.entity.WorkTimeEntity;
import com.engine.kq.log.KQLog;
import weaver.common.DateUtil;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
@ -41,7 +42,10 @@ public class KQWorkTime extends BaseBean {
isWorkDay = true;
}
}else{
isWorkDay = Util.getIntValue(Util.null2String(serialInfo.get(workdate)))>0;
int serialid = Util.getIntValue(Util.null2String(serialInfo.get(workdate)), 0);
KQShiftManagementComInfo kQShiftManagementComInfo = new KQShiftManagementComInfo();
int restShift = StringUtil.parseToInt(kQShiftManagementComInfo.getRestShift(String.valueOf(serialid)), 0);
isWorkDay = restShift == 1 ? false : serialid > 0;
}
}
}
@ -52,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){
@ -91,7 +95,7 @@ public class KQWorkTime extends BaseBean {
KQShiftManagementComInfo kQShiftManagementComInfo = new KQShiftManagementComInfo();
Map<String,Object> serialInfo = getSerialInfo(userId, workdate, true);
if(isLog){
//kqLog.info("考勤组获取成员所在的班次 getWorkDuration:"+serialInfo);
kqLog.info("考勤组获取成员所在的班次 getWorkDuration:"+serialInfo);
}
if(serialInfo!=null&&serialInfo.size()>0){
String kqType = Util.null2String(serialInfo.get("kqType"));
@ -107,8 +111,8 @@ public class KQWorkTime extends BaseBean {
workTimeMap = kQShiftManagementComInfo.getWorkDuration(workdate,serialInfo,containYesterday);
if(workTimeMap!=null){
if(isLog) {
//kqLog.info(
// "考勤组获取成员所在的班次 getWorkDuration:workTimeMap:" + JSON.toJSONString(workTimeMap));
kqLog.info(
"考勤组获取成员所在的班次 getWorkDuration:workTimeMap:" + JSON.toJSONString(workTimeMap));
}
result.put("shiftInfoBean",workTimeMap.get("shiftInfoBean"));
}
@ -164,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) {
@ -180,19 +184,25 @@ public class KQWorkTime extends BaseBean {
workTimeEntity.setWorkMins(Util.getIntValue(Util.null2String(map.get("workMins"))));
workTimeEntity.setCalmethod(Util.null2String(map.get("calmethod")));
}
workTimeEntity.setRestShift(0);
}else{
int serialid = Util.getIntValue(Util.null2String(serialInfo.get(workdate)), 0);
int restShift = StringUtil.parseToInt(kQShiftManagementComInfo.getRestShift(String.valueOf(serialid)), 0);
if(kqType.equals("1") && KQHolidaySetBiz.isHoliday(userId,workdate)) restShift = 1;
workTimeEntity.setRestShift(restShift);
if (serialid > 0){
Map<String,Object> dateWorkTimeMap = kQShiftManagementComInfo.getWorkTimeMap(workdate, serialInfo);
workTimeEntity.setGroupId(Util.null2String(serialInfo.get("groupId")));
workTimeEntity.setGroupName(Util.null2String(serialInfo.get("groupName")));
workTimeEntity.setKQType(kqType);
workTimeEntity.setSerialId(""+serialid);
workTimeEntity.setRestTime(formatTimeScope((List<Object>)dateWorkTimeMap.get("restTime"),false));
workTimeEntity.setShiftRuleInfo(ShiftManagementToolKit.getShiftRuleInfo(""+serialid,true));
workTimeEntity.setSignTime(formatTimeScope((List<Object>)dateWorkTimeMap.get("signTime"),false));
workTimeEntity.setWorkTime(formatTimeScope((List<Object>)dateWorkTimeMap.get("workTime"),true));
workTimeEntity.setRestTime(formatTimeScope((List<Object>)dateWorkTimeMap.get("restTime"),false));
if(restShift != 1) {
workTimeEntity.setWorkMins(Util.getIntValue(Util.null2String(dateWorkTimeMap.get("workMins"))));
}
workTimeEntity.setIsAcross(Util.null2String(dateWorkTimeMap.get("isAcross")));
}
}
@ -251,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
@ -259,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 {
@ -273,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));//获取前一天的班次
@ -343,6 +378,8 @@ 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));
@ -371,7 +408,7 @@ public class KQWorkTime extends BaseBean {
String signStart = Util.null2String(kqGroupEntity.getSignstart());//签到开始时间
int workMins = Util.getIntValue(Util.getIntValues(""+Util.getDoubleValue(Util.null2String(kqGroupEntity.getWorkhour()))*60));//工作时长
if(signStart.length()>0 && workMins>0) {
String calmethod = Util.null2s(kqGroupEntity.getCalmethod(),"2");
String calmethod = Util.null2s(kqGroupEntity.getCalmethod(),"1");
Map<String, Object> map = null;
if (weekDay.contains(""+preDayOfweek) && !preDayIsHoliday) {//前一天
map = new HashMap<>();

@ -181,6 +181,8 @@ public class ShiftInfoCominfoBean implements Serializable {
private String uuid = "";
private String restShift;
public ShiftInfoCominfoBean() {
this.preWorkTime = new ArrayList<>();
@ -220,6 +222,7 @@ public class ShiftInfoCominfoBean implements Serializable {
this.uuid = UUID.randomUUID().toString();
this.halfcalpoint = "0";
this.halfcalpoint2cross = "0";
this.restShift = "0";
}
public List<String[]> getPreWorkTime() {
@ -504,5 +507,13 @@ public class ShiftInfoCominfoBean implements Serializable {
public void setHalfcalpoint2cross(String halfcalpoint2cross) {
this.halfcalpoint2cross = halfcalpoint2cross;
}
public String getRestShift() {
return restShift;
}
public void setRestShift(String restShift) {
this.restShift = restShift;
}
}

@ -3,6 +3,8 @@ package com.engine.kq.biz.chain.cominfo;
import com.engine.kq.biz.KQTimesArrayComInfo;
import java.util.List;
import java.util.Map;
import weaver.common.StringUtil;
import weaver.general.Util;
/**
@ -27,6 +29,7 @@ public class WorkShiftComIndex extends ShiftComIndex {
shiftInfoCominfoBean.setWorkmins(workmins);
String serialid = Util.null2String(workTimeMap.get("serialid"));
shiftInfoCominfoBean.setSerialid(serialid);
shiftInfoCominfoBean.setRestShift(StringUtil.vString(workTimeMap.get("restShift"), "0"));
setWorkDuration(workTimes, shiftInfoCominfoBean);

@ -47,11 +47,17 @@ public class GetButtonBaseInfoCmd extends AbstractCommonCommand<Map<String, Obje
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> retmap = new HashMap<String, Object>();
if(user == null) {
retmap.put("showbutton", "0");
retmap.put("status", "1");
retmap.put("userid", 1);
return retmap;
}
kqLog.info(user.getLastname()+":GetButtonBaseInfoCmd:params:"+params);
logMap.put("lastname", user.getLastname());
logMap.put("params", params);
Map<String, Object> retmap = new HashMap<String, Object>();
RecordSet rs = new RecordSet();
String sql = "";
try{
@ -145,9 +151,9 @@ public class GetButtonBaseInfoCmd extends AbstractCommonCommand<Map<String, Obje
}
if(groupid.length() > 0){
groupname = SystemEnv.getHtmlLabelName(10000801,weaver.general.Util.getIntValue(user.getLanguage()))+kqGroupComInfo.getGroupname(groupid);
groupname = SystemEnv.getHtmlLabelName(10000801, Util.getIntValue(user.getLanguage()))+kqGroupComInfo.getGroupname(groupid);
}else{
groupname = SystemEnv.getHtmlLabelName(10000799,weaver.general.Util.getIntValue(user.getLanguage()));
groupname = SystemEnv.getHtmlLabelName(10000799, Util.getIntValue(user.getLanguage()));
retmap.put("showbutton", "0");
}
@ -157,6 +163,7 @@ public class GetButtonBaseInfoCmd extends AbstractCommonCommand<Map<String, Obje
retmap.put("lastname", lastname);
retmap.put("shortname", shortname);
retmap.put("messagerurl", messagerurl);
retmap.put("groupid", groupid);
retmap.put("groupname", groupname);
retmap.put("locationshowaddress", locationshowaddress);
retmap.put("locationfacecheck", locationfacecheck);

@ -5,18 +5,22 @@ import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.bean.KQHrmScheduleSign;
import com.engine.kq.biz.KQCardLogBiz;
import com.engine.kq.biz.KQGroupComInfo;
import com.engine.kq.biz.KQGroupMemberComInfo;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.biz.KQScheduleSignBiz;
import com.engine.kq.biz.KQTimesArrayComInfo;
import com.engine.kq.biz.KQWorkTime;
import com.engine.kq.biz.*;
import com.engine.kq.entity.KQGroupEntity;
import com.engine.kq.entity.TimeScopeEntity;
import com.engine.kq.entity.WorkTimeEntity;
import com.engine.kq.log.KQLog;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.google.common.collect.Maps;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.dateformat.DateTransformer;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@ -136,7 +140,7 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
if (kqGroupEntity != null) {
outsidesign = kqGroupEntity.getOutsidesign();
}else{
groupname = SystemEnv.getHtmlLabelName(10000799,weaver.general.Util.getIntValue(user.getLanguage()));
groupname = SystemEnv.getHtmlLabelName(10000799, Util.getIntValue(user.getLanguage()));
retmap.put("showbutton", "0");
retmap.put("status", "1");
retmap.put("groupname", groupname);
@ -204,7 +208,7 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
retmap.put("lastname", lastname);
retmap.put("shortname", shortname);
retmap.put("messagerurl", messagerurl);
retmap.put("groupname", groupname+SystemEnv.getHtmlLabelName(10000800,weaver.general.Util.getIntValue(user.getLanguage())));
retmap.put("groupname", groupname+SystemEnv.getHtmlLabelName(10000800, Util.getIntValue(user.getLanguage())));
retmap.put("outsidesign", outsidesign);
retmap.put("date", curDate);
retmap.put("timeline", timelineList);
@ -255,9 +259,9 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
}
if(groupid.length() > 0){
groupname = SystemEnv.getHtmlLabelName(10000801,weaver.general.Util.getIntValue(user.getLanguage()))+kqGroupComInfo.getGroupname(groupid);
groupname = SystemEnv.getHtmlLabelName(10000801, Util.getIntValue(user.getLanguage()))+kqGroupComInfo.getGroupname(groupid);
}else{
groupname = SystemEnv.getHtmlLabelName(10000799,weaver.general.Util.getIntValue(user.getLanguage()));
groupname = SystemEnv.getHtmlLabelName(10000799, Util.getIntValue(user.getLanguage()));
}
retmap.put("lastname", lastname);
@ -300,7 +304,7 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
//获取当天的考勤数据
// List<Object> reports = kqReportBiz.getKqDateInfo(""+user.getUID(),curDate,curDate,true);
List<Object> reports = new ArrayList<>();
getSignButton(user.getUID()+"",todayLineButton,reports);
getSignButton(user.getUID()+"",todayLineButton,reports,curDate);
timelineList.addAll(todayLineButton);
}
}
@ -331,7 +335,7 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
}
getWorkTimeButton(false, nextdayLine,nextdayLineButton,true);
List<Object> reports = new ArrayList<>();
getSignButton(user.getUID()+"",nextdayLineButton,reports);
getSignButton(user.getUID()+"",nextdayLineButton,reports,nextday);
timelineList.addAll(nextdayLineButton);
}
}
@ -355,7 +359,7 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
//获取前一天的考勤数据
// List<Object> reports = kqReportBiz.getKqDateInfo(""+user.getUID(),yesterday,yesterday,true);
List<Object> reports = new ArrayList<>();
getSignButton(user.getUID()+"",yesterdayLineButton,reports);
getSignButton(user.getUID()+"",yesterdayLineButton,reports,yesterday);
timelineList.addAll(yesterdayLineButton);
}
}
@ -595,15 +599,49 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
* @param timelineList
* @param reports
*/
private void getSignButton(String resourceId,List<Object> timelineList,List<Object> reports) {
private void getSignButton(String resourceId,List<Object> timelineList,List<Object> reports,String kqDate) {
if(!timelineList.isEmpty()){
//获取当前时间
LocalDateTime now = getNow();
//因为工作时段是成对存在的所以timelineList一定是两两一对的复数[0,1] [2,3] [4,5]
int count = timelineList.size();
// 一天4次打卡单独做判断如果是上午下班打卡和下午上班打卡时间重叠那么上午的下班卡取最早的下午的上班卡取最晚的。用shiftCount是否等于-1判断-1就走标准不重叠。2就表示重叠走新的逻辑
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
KQWorkTime kqWorkTime = new KQWorkTime();
WorkTimeEntity workTime=kqWorkTime.getWorkTime(resourceId, kqDate);
String preDate = DateUtil.addDate(kqDate, -1);//上一天日期
String nextDate = DateUtil.addDate(kqDate, 1);//下一天日期
List<TimeScopeEntity> lsSignTime = new ArrayList<>();
List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
if (workTime != null) {
lsSignTime = workTime.getSignTime();//允许打卡时间
lsWorkTime = workTime.getWorkTime();//工作时间
}
int shiftCount = lsWorkTime == null ? 0 : lsWorkTime.size();
int shiftI = 0;
String signEndDateTimeZero = "";
for (int i = 0; lsWorkTime != null && i < lsWorkTime.size(); i++) {
shiftI = i;
TimeScopeEntity signTimeScope = lsSignTime.get(i);
String signBeginDateTime = signTimeScope.getBeginTimeAcross() ? nextDate : kqDate;
if(signTimeScope.isBeginTimePreAcross()){
signBeginDateTime = preDate;
}
signBeginDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(signTimeScope.getBeginTime())+":00";
String signEndDateTime = signTimeScope.getEndTimeAcross() ? nextDate : kqDate;
signEndDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(signTimeScope.getEndTime())+":59";
if (shiftCount == 2 && shiftI == 0) {
signEndDateTimeZero = signEndDateTime;
}
if (shiftCount == 2 && shiftI == 1) {
shiftCount = signBeginDateTime.compareTo(signEndDateTimeZero) <= 0 ? shiftCount : -1;
}
}
int workCnt = 0;
List<String> recordLastButtomInfo = new ArrayList<>();
String count4NoonStartDateTime = "";
String count4NoonEndDateTime = "";
for(int i = 0 ; i < count ; ){
//成对出现的上下班时间
int on_i = i;
@ -633,7 +671,10 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
}
if(signSectionEndTime.length() == 0 || signSectionBeginTime.length() == 0){
}
boolean isOn = false;
if(i == (count-2) && shiftCount == 4&&count4NoonEndDateTime.equals(onSignSectionTime)){
isOn = true;
}
LocalDateTime onLocalDateTime = LocalDateTime.parse(onSignSectionTime,fullFormatter);
LocalDateTime onLocalDateEndTime = null;
if(signSectionEndTime.length() > 0){
@ -687,8 +728,18 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
//签推是否在允许的打卡范围内
boolean isOffActive = false;
if((now.isAfter(onLocalDateTime) && now.isBefore(offLocalDateTime))||(now.isEqual(onLocalDateTime))||(now.isEqual(offLocalDateTime))){
if(isOn&&i == (count-2) && shiftCount == 4){ //如果当前工作时段是最后一个工作时段
if(now.isAfter(onLocalDateTime) && now.isBefore(offworkDateTime)||(now.isEqual(onLocalDateTime))||(now.isEqual(offworkDateTime))) {
if(recordLastButtomInfo.size() > 0 && "true".equals(recordLastButtomInfo.get(0))) {
isActive = true;
}
} else {
isActive = true;
}
} else {
isActive = true;
}
}
if(now.isAfter(onworkDateTime)){
timelineOnMap.put("isYellow", "1");
@ -721,9 +772,21 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
if(signSectionEndTime.length() > 0){
if(signSectionBeginTime.length() > 0){
//如果上班后,下班前打卡范围都做了控制
if(isOn&&shiftCount == 4) { // 针对一天4次卡的二开
if(onLocalDateTime.isAfter(offworkDateTime)) {
if((now.isAfter(onLocalDateTime) && now.isBefore(offworkDateTime)) ||(now.isEqual(onLocalDateTime))||(now.isEqual(offworkDateTime))){
isOnActive = true;
}
} else {
if((now.isAfter(onLocalDateTime) && now.isBefore(onLocalDateEndTime)) ||(now.isEqual(onLocalDateTime))||(now.isEqual(onLocalDateEndTime))){
isOnActive = true;
}
}
} else {
if((now.isAfter(onLocalDateTime) && now.isBefore(onLocalDateEndTime)) ||(now.isEqual(onLocalDateTime))||(now.isEqual(onLocalDateEndTime))){
isOnActive = true;
}
}
if((now.isAfter(offLocalDateBeginTime) && now.isBefore(offLocalDateTime)) ||(now.isEqual(offLocalDateBeginTime))||(now.isEqual(offLocalDateTime))){
isOffActive = true;
}
@ -738,9 +801,21 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
}else{
//如果只是上班后打卡范围做了控制
if(isOn&&shiftCount == 4) { // 针对一天4次卡的二开
if(onLocalDateTime.isAfter(offworkDateTime)) {
if((now.isAfter(onLocalDateTime) && now.isBefore(offworkDateTime)) ||(now.isEqual(onLocalDateTime))||(now.isEqual(offworkDateTime))){
isOnActive = true;
}
} else {
if((now.isAfter(onLocalDateTime) && now.isBefore(onLocalDateEndTime)) ||(now.isEqual(onLocalDateTime))||(now.isEqual(onLocalDateEndTime))){
isOnActive = true;
}
}
} else {
if((now.isAfter(onLocalDateTime) && now.isBefore(onLocalDateEndTime)) ||(now.isEqual(onLocalDateTime))||(now.isEqual(onLocalDateEndTime))){
isOnActive = true;
}
}
LocalDateTime tmp = LocalDateTime.parse(onLocalDateEndTime.plusMinutes(1).format(datetimeFormatter)+":00",fullFormatter);
String tmp_datetime = tmp.format(fullFormatter);
if((now.isAfter(tmp) && now.isBefore(offLocalDateTime)) ||(now.isEqual(tmp))||(now.isEqual(offLocalDateTime))){
@ -779,7 +854,12 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
timelineOnMap.put("signSectionEndTime", sign_signSectionEndTime);
timelineOffMap.put("signSectionBeginTime", sign_signSectionBeginTime);
}
KQScheduleSignBiz kqScheduleSignBiz = new KQScheduleSignBiz.KQScheduleSignParamBuilder().resourceidParam(resourceId)
if(shiftCount == 4 && i == 0) {
count4NoonStartDateTime = sign_signSectionEndTime.length()>0?sign_signSectionEndTime:offDateTime;
count4NoonEndDateTime = sign_offSignSectionTime;
}
KQScheduleSignBiz kqScheduleSignBiz = new KQScheduleSignBiz.KQScheduleSignParamBuilder().resourceidParam(resourceId).shiftCountParam(shiftCount).shiftIParam(i)
.count4NoonStartDateTimeParam(count4NoonStartDateTime).count4NoonEndDateTimeParam(count4NoonEndDateTime)
.userTypeParam(user.getLogintype()).signSectionTimeParam(sign_signSectionTime)
.signSectionEndTimeParam(sign_signSectionEndTime).signSectionBeginTimeParam(sign_signSectionBeginTime)
.offSignSectionTimeParam(sign_offSignSectionTime).build();
@ -826,8 +906,10 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
if(signSectionEndTime.length() == 0 && signSectionBeginTime.length() == 0){
getActiveRestSign(isActive, hasSignIn, hasSignOut, timelineOnMap, timelineOffMap);
}else{
getActiveSign(isActive, hasSignIn, hasSignOut, timelineOnMap, timelineOffMap,isOnActive,isOffActive);
getActiveSign(isActive, hasSignIn, hasSignOut, timelineOnMap, timelineOffMap,isOnActive,isOffActive,shiftCount, i);
}
String lastButtomInfo = ""+hasSignOut;
recordLastButtomInfo.add(lastButtomInfo);
}
i = i + 2;
@ -966,7 +1048,7 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
*/
private void getActiveSign(boolean isActive, boolean hasSignIn, boolean hasSignOut,
Map<String, Object> timelineOnMap, Map<String, Object> timelineOffMap,
boolean isOnActive, boolean isOffActive) {
boolean isOnActive, boolean isOffActive, int count, int i) {
if(isActive){
if(hasSignIn){
@ -977,9 +1059,13 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
timelineOffMap.put("active", "0");
timelineOffMap.put("needSign", "0");
if(isOffActive){
if(i == 0 && count == 4) { //如果当前工作时段是最后一个工作时段, 上午时段有过签退就不能再更新签退了,因为第二次打卡是下午的上班卡
} else {
if (isOffActive) {
timelineOffMap.put("reSign", "1");
}
}
}else{
//签到了,未签退
timelineOnMap.put("active", "0");
@ -1006,9 +1092,13 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
timelineOffMap.put("active", "0");
timelineOffMap.put("needSign", "0");
if(i == 0 && count == 4) { //如果当前工作时段是最后一个工作时段, 上午时段有过签退就不能再更新签退了,因为第二次打卡是下午的上班卡
} else {
if(isOffActive){
timelineOffMap.put("reSign", "1");
}
}
}else{
//未签到未签退
if(isOnActive){
@ -1017,7 +1107,7 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
}else{
timelineOnMap.put("active", "0");
}
if(isOffActive){
if(isOffActive && !isOnActive){
timelineOffMap.put("needSign", "1");
timelineOffMap.put("active", "1");
}else{
@ -1494,7 +1584,7 @@ public class GetButtonsCmd extends AbstractCommonCommand<Map<String, Object>> {
Map<String, Object> logMap){
LocalDateTime now_zone = null;
//处理多时区
String timeZoneConversion = Util.null2String(new weaver.general.BaseBean().getPropValue("weaver_timezone_conversion","timeZoneConversion")).trim();
String timeZoneConversion = Util.null2String(new BaseBean().getPropValue("weaver_timezone_conversion","timeZoneConversion")).trim();
logMap.put("timeZoneConversion", timeZoneConversion);
if("1".equals(timeZoneConversion)) {
DateTransformer dateTransformer=new DateTransformer();

@ -6,6 +6,7 @@ import com.cloudstore.dev.api.util.EMManager;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQShiftManagementComInfo;
import com.engine.kq.biz.KQCardLogBiz;
import com.engine.kq.biz.KQFormatBiz;
import com.engine.kq.biz.KQGroupBiz;
@ -36,12 +37,14 @@ import java.util.Map.Entry;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import weaver.common.DateUtil;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.dateformat.DateTransformer;
import weaver.dateformat.TimeZoneVar;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import org.apache.commons.codec.digest.DigestUtils;
/**
* 退
@ -135,6 +138,7 @@ public class PunchButtonCmd extends AbstractCommonCommand<Map<String, Object>> {
//手机打卡部分
String longitude = Util.null2String(params.get("longitude"));
String latitude = Util.null2String(params.get("latitude"));
String signData = Util.null2String(params.get("signData"));
double d_longitude = Util.getDoubleValue(longitude);
double d_latitude = Util.getDoubleValue(latitude);
if(d_latitude <= 0){
@ -147,6 +151,7 @@ public class PunchButtonCmd extends AbstractCommonCommand<Map<String, Object>> {
String mac = Util.null2String(params.get("mac"));
String sid = Util.null2String(params.get("sid"));
String addr = Util.null2String(params.get("position"));
String showaddress = "";
String ismobile = Util.null2String(params.get("ismobile"));
//区分是来自于钉钉还是EM7
String browser = Util.null2String(params.get("browser"));
@ -163,7 +168,7 @@ public class PunchButtonCmd extends AbstractCommonCommand<Map<String, Object>> {
String locationid = Util.null2String(params.get("locationid"));//办公地点id
if(locationid.length()>0){//如果开启统一显示,就用配置的地址
KQLoactionComInfo kqLoactionComInfo = new KQLoactionComInfo();
addr = kqLoactionComInfo.getLocationname(locationid);
showaddress = kqLoactionComInfo.getLocationname(locationid);
}
}
@ -220,7 +225,15 @@ public class PunchButtonCmd extends AbstractCommonCommand<Map<String, Object>> {
if (kqGroupEntity != null && ("," + kqGroupEntity.getExcludeid() + ",").indexOf("," + user.getUID() + ",")>-1) {//排除人员无需计算考勤时间
isExclude = true;
}
String text ="wea"+ userId + groupid;
kqLog.writeLog(user.getLastname()+"PunchButtonCmd>text=" + text+";ismobile="+ismobile);
String ma5Text = DigestUtils.md5Hex(text)+"ver";
kqLog.writeLog("PunchButtonCmd>ma5Text=" + ma5Text+";signData=" + signData);
if(!signData.equals(ma5Text) && "1".equalsIgnoreCase(ismobile)){
retmap.put("status", "0");
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
return ;
}
String[] signsections = signsection.split("#");
if(!"1".equalsIgnoreCase(isfree)){
if(signsections != null && signsections.length == 2){
@ -243,7 +256,7 @@ public class PunchButtonCmd extends AbstractCommonCommand<Map<String, Object>> {
if(nowDateTime.isBefore(startWorkDateTime)){
Duration duration = Duration.between(nowDateTime, startWorkDateTime);
retmap.put("status", "1");
retmap.put("message", ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005326,weaver.general.ThreadVarLanguage.getLang())+""+duration.toMinutes()+""+weaver.systeminfo.SystemEnv.getHtmlLabelName(15049,weaver.general.ThreadVarLanguage.getLang())+"");
retmap.put("message", ""+ SystemEnv.getHtmlLabelName(10005326,weaver.general.ThreadVarLanguage.getLang())+""+duration.toMinutes()+""+ SystemEnv.getHtmlLabelName(15049,weaver.general.ThreadVarLanguage.getLang())+"");
isInCom = "0";
}
@ -252,7 +265,7 @@ public class PunchButtonCmd extends AbstractCommonCommand<Map<String, Object>> {
if(nowDateTime.isAfter(endWorkDateTime)){
Duration duration = Duration.between(endWorkDateTime, nowDateTime);
retmap.put("status", "1");
retmap.put("message", ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005327,weaver.general.ThreadVarLanguage.getLang())+""+duration.toMinutes()+""+weaver.systeminfo.SystemEnv.getHtmlLabelName(15049,weaver.general.ThreadVarLanguage.getLang())+"");
retmap.put("message", ""+ SystemEnv.getHtmlLabelName(10005327,weaver.general.ThreadVarLanguage.getLang())+""+duration.toMinutes()+""+ SystemEnv.getHtmlLabelName(15049,weaver.general.ThreadVarLanguage.getLang())+"");
isInCom = "0";
}
}
@ -346,10 +359,11 @@ public class PunchButtonCmd extends AbstractCommonCommand<Map<String, Object>> {
signStatus = ButtonStatusEnum.NORMAL.getStatusCode();
}
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo) "+
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
deviceInfo = deviceInfo.replaceAll("\\?", "");
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,showaddress) "+
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
boolean isOk = rs.executeUpdate(punchSql,userId,userType,signType,signDate,signTime,clientAddress,isInCom,
timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo);
timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,showaddress);
if(!isOk){
retmap.put("status", "1");
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
@ -414,7 +428,7 @@ public class PunchButtonCmd extends AbstractCommonCommand<Map<String, Object>> {
if(!"1".equalsIgnoreCase(signStatus) && !"2".equalsIgnoreCase(signStatus)){
if("".equalsIgnoreCase(Util.null2String(retmap.get("message")))){
retmap.put("success", "1");
retmap.put("message", SystemEnv.getHtmlLabelName(512596,weaver.general.Util.getIntValue(user.getLanguage())));
retmap.put("message", SystemEnv.getHtmlLabelName(512596, Util.getIntValue(user.getLanguage())));
}
}
logMap.put("retmap", retmap);
@ -426,10 +440,22 @@ public class PunchButtonCmd extends AbstractCommonCommand<Map<String, Object>> {
String shift_begindateworktime = "";
String shift_enddateworktime = "";
ShiftInfoBean shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(userid, workdate,false);
User tmp_user = User.getUser(Util.getIntValue(userid), 0);
if(null == tmp_user){
return null;
}
ShiftInfoBean shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(tmp_user, workdate,false,true,false);
if(shiftInfoBean == null){
return signStatus;
}
//休息班次打卡去掉迟到、早退的打卡异常提醒
int serialid = StringUtil.parseToInt(shiftInfoBean.getSerialid(), 0);
KQShiftManagementComInfo kQShiftManagementComInfo = new KQShiftManagementComInfo();
int restShift = StringUtil.parseToInt(kQShiftManagementComInfo.getRestShift(String.valueOf(serialid)), 0);
if(serialid <= 0 || restShift == 1) {
return "-1";
}
Map<String,String> shifRuleMap = Maps.newHashMap();
KQShiftRuleInfoBiz.getShiftRuleInfo(shiftInfoBean,userid,shifRuleMap);
KQTimesArrayComInfo arrayComInfo = new KQTimesArrayComInfo();

@ -9,6 +9,7 @@ import com.engine.common.constant.BizLogType;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQBalanceOfLeaveBiz;
import com.engine.kq.biz.KQGroupComInfo;
import com.engine.kq.biz.KQLeaveRulesComInfo;
import com.engine.kq.biz.KQLeaveRulesDetailComInfo;
import com.engine.kq.util.KQTransMethod;
@ -16,7 +17,12 @@ import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.job.JobActivitiesComInfo;
import weaver.hrm.job.JobGroupsComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import java.util.*;
@ -102,6 +108,32 @@ public class AddLeaveRulesCmd extends AbstractCommonCommand<Map<String, Object>>
/*应用范围为分部时选择的分部ID*/
String scopeValue = Util.null2String(params.get("scopeValue"));
/*应用范围为部门时*/
String scopeValueDepartment = Util.null2String(params.get("scopeValueDepartment"));
/*应用范围为人员时*/
String scopeValueMember = Util.null2String(params.get("scopeValueMember"));
/*应用范围为岗位时*/
String scopeValueJobtitle = Util.null2String(params.get("scopeValueJobtitle"));
/*应用范围为安全级别时*/
int seclevel = Util.getIntValue(Util.null2String(params.get("seclevel")).trim(), 0);
int seclevelto = Util.getIntValue(Util.null2String(params.get("seclevelto")).trim(), 100);
/*应用范围为职务类别时*/
String scopeValueJobGroup = Util.null2String(params.get("scopeValueJobGroup"));
JobTitlesComInfo jobTitlesComInfo =new JobTitlesComInfo();
JobActivitiesComInfo jobActivitiesComInfo = new JobActivitiesComInfo();
JobGroupsComInfo jobGroupsComInfo = new JobGroupsComInfo();
if(scopeType == 2){
scopeValue = scopeValueDepartment;
}else if(scopeType == 3){
scopeValue = scopeValueMember;
}else if(scopeType == 4){
scopeValue = scopeValueJobtitle;
}else if(scopeType == 5){
scopeValue = scopeValueJobGroup;
}
/*余额发放方式1-手动发放、2-按司龄自动发放、3-按工龄自动发放、4-每年自动发放固定天数、5-加班时长自动计入余额、6-按司龄+工龄自动发放*/
int distributionMode = Util.getIntValue((String) params.get("distributionMode"), 1);
@ -163,12 +195,12 @@ public class AddLeaveRulesCmd extends AbstractCommonCommand<Map<String, Object>>
releaseRule = 0;
String sql = "select * from kq_LeaveRules where (isDelete is null or isDelete<>1) and id<>? and id in (select ruleId from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and distributionMode=5)";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505664, user.getLanguage()));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
return resultMap;
}
// recordSet.executeQuery(sql, ruleId);
// if (recordSet.next()) {
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(505664, user.getLanguage()));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
// return resultMap;
// }
} else if (distributionMode == 6) {
/*同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode<>6";
@ -215,22 +247,80 @@ public class AddLeaveRulesCmd extends AbstractCommonCommand<Map<String, Object>>
if (scopeType == 1 && scopeTypeTemp == 1) {
List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
for (String temp : scopeValueList)
if (scopeValueTempList.contains(temp)) {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
// if ((seclevelTemp < seclevel && secleveltoTemp < seclevel) || (seclevelTemp > seclevelto && secleveltoTemp > seclevelto)) {
//
// } else {
String subcomName = subCompanyComInfo.getSubCompanyname(temp);
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505668, user.getLanguage()).replace("$", subcomName));//该假期类型下已经新建过分部的假期规则,请勿重复新建
return resultMap;
// }
}
}
// if (scopeType == 2 && scopeTypeTemp == 2) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// DepartmentComInfo departmentComInfo = new DepartmentComInfo();
// for (String temp : scopeValueList){
// if (scopeValueTempList.contains(temp)) {
// String groupname = departmentComInfo.getDepartmentName(temp);
// resultMap.put("status", "-1");
// resultMap.put("message", "该假期类型下已经新建过部门:"+groupname+"的假期规则,请勿重复新建");
// return resultMap;
// }
// }
// }
// if (scopeType == 3 && scopeTypeTemp == 3) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// ResourceComInfo resourceComInfo = new ResourceComInfo();
// for (String temp : scopeValueList){
// if (scopeValueTempList.contains(temp)) {
// String groupname = resourceComInfo.getLastname(temp);
// resultMap.put("status", "-1");
// resultMap.put("message", "该假期类型下已经新建过人员:"+groupname+"的假期规则,请勿重复新建");
// return resultMap;
// }
// }
// }
// if (scopeType == 4 && scopeTypeTemp == 4) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
// for (String temp : scopeValueList){
// if (scopeValueTempList.contains(temp)) {
// String groupname = jobTitlesComInfo.getJobTitlesname(temp);
// resultMap.put("status", "-1");
// resultMap.put("message", "该假期类型下已经新建过岗位:"+groupname+"的假期规则,请勿重复新建");
// return resultMap;
// }
// }
// }
//职务类型
if (scopeType == 5 && scopeTypeTemp == 5) {
List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
for (String temp : scopeValueList){
if (scopeValueTempList.contains(temp)) {
String groupname = jobTitlesComInfo.getJobTitlesname(temp);
resultMap.put("status", "-1");
// resultMap.put("message", "该假期类型下已经新建过职务类型:"+jobGroupsComInfo.getJobGroupsname(temp)+"的假期规则,请勿重复新建");
resultMap.put("message", SystemEnv.getHtmlLabelName(545897, user.getLanguage()).replace("$", jobGroupsComInfo.getJobGroupsname(temp)));
;
return resultMap;
}
}
}
}
boolean flag = false;//数据是否插入成功
String sql = "insert into kq_LeaveRulesDetail(ruleId,ruleName,scopeType,scopeValue," +
"distributionMode,annualAmount,legalKey,welfareKey,priority,validityRule,effectiveDays,effectiveMonths,expirationMonth,expirationDay,extensionEnable,extendedDays,releaseRule,calcMethod,convertMode,excludeSubAccount,beforeFormal,isDelete) values(?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,0)";
"distributionMode,annualAmount,legalKey,welfareKey,priority,validityRule,effectiveDays,effectiveMonths,expirationMonth,expirationDay,extensionEnable,extendedDays,releaseRule,calcMethod,convertMode,excludeSubAccount,beforeFormal,seclevel,seclevelto,isDelete) values(?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,0)";
flag = recordSet.executeUpdate(sql, ruleId, ruleName, scopeType, scopeValue,
distributionMode, annualAmount, legalKey, welfareKey, priority, validityRule, effectiveDays, effectiveMonths, expirationMonth, expirationDay, extensionEnable, extendedDays, releaseRule, calcMethod, convertMode, excludeSubAccount, beforeFormal);
distributionMode, annualAmount, legalKey, welfareKey, priority, validityRule, effectiveDays, effectiveMonths, expirationMonth, expirationDay, extensionEnable, extendedDays, releaseRule, calcMethod, convertMode, excludeSubAccount, beforeFormal,seclevel,seclevelto);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败

@ -15,7 +15,12 @@ import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.job.JobActivitiesComInfo;
import weaver.hrm.job.JobGroupsComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import java.util.*;
@ -101,6 +106,31 @@ public class EditLeaveRulesCmd extends AbstractCommonCommand<Map<String, Object>
/*应用范围为分部时选择的分部ID*/
String scopeValue = Util.null2String(params.get("scopeValue"));
/*应用范围为部门时*/
String scopeValueDepartment = Util.null2String(params.get("scopeValueDepartment"));
/*应用范围为人员时*/
String scopeValueMember = Util.null2String(params.get("scopeValueMember"));
/*应用范围为岗位时*/
String scopeValueJobtitle = Util.null2String(params.get("scopeValueJobtitle"));
/*应用范围为安全级别时*/
int seclevel = Util.getIntValue(Util.null2String(params.get("seclevel")).trim(), 0);
int seclevelto = Util.getIntValue(Util.null2String(params.get("seclevelto")).trim(), 100);
/*应用范围为职务类别时*/
String scopeValueJobGroup = Util.null2String(params.get("scopeValueJobGroup"));
JobTitlesComInfo jobTitlesComInfo =new JobTitlesComInfo();
JobActivitiesComInfo jobActivitiesComInfo = new JobActivitiesComInfo();
JobGroupsComInfo jobGroupsComInfo = new JobGroupsComInfo();
if(scopeType == 2){
scopeValue = scopeValueDepartment;
}else if(scopeType == 3){
scopeValue = scopeValueMember;
}else if(scopeType == 4){
scopeValue = scopeValueJobtitle;
}else if(scopeType == 5){
scopeValue = scopeValueJobGroup;
}
/*余额发放方式1-手动发放、2-按司龄自动发放、3-按工龄自动发放、4-每年自动发放固定天数、 5-加班时长自动计入余额*/
int distributionMode = Util.getIntValue((String) params.get("distributionMode"), 1);
@ -163,12 +193,12 @@ public class EditLeaveRulesCmd extends AbstractCommonCommand<Map<String, Object>
/*两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式*/
String sql = "select * from kq_LeaveRules where (isDelete is null or isDelete<>1) and id<>? and id in (select ruleId from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and distributionMode=5)";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505664, user.getLanguage()));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
return resultMap;
}
// recordSet.executeQuery(sql, ruleId);
// if (recordSet.next()) {
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(505664, user.getLanguage()));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
// return resultMap;
// }
} else if (distributionMode == 6) {
/*同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode<>6";
@ -204,6 +234,8 @@ public class EditLeaveRulesCmd extends AbstractCommonCommand<Map<String, Object>
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(searchSql, ruleId, ruleDetailId);
while (recordSet.next()) {
int seclevelTemp = Util.getIntValue(recordSet.getString("seclevel"), 0);
int secleveltoTemp = Util.getIntValue(recordSet.getString("seclevelto"), 100);
int scopeTypeTemp = Util.getIntValue(recordSet.getString("scopeType"), 0);
String scopeValueTemp = recordSet.getString("scopeValue");
@ -223,14 +255,69 @@ public class EditLeaveRulesCmd extends AbstractCommonCommand<Map<String, Object>
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505668, user.getLanguage()).replace("$", subcomName));//该假期类型下已经新建过分部的假期规则,请勿重复新建
return resultMap;
// }
}
}
// if (scopeType == 2 && scopeTypeTemp == 2) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// DepartmentComInfo departmentComInfo = new DepartmentComInfo();
// for (String temp : scopeValueList){
// if (scopeValueTempList.contains(temp)) {
// String groupname = departmentComInfo.getDepartmentName(temp);
// resultMap.put("status", "-1");
// resultMap.put("message", "该假期类型下已经新建过部门:"+groupname+"的假期规则,请勿重复新建");
// return resultMap;
// }
// }
// }
// if (scopeType == 3 && scopeTypeTemp == 3) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// ResourceComInfo resourceComInfo = new ResourceComInfo();
// for (String temp : scopeValueList){
// if (scopeValueTempList.contains(temp)) {
// String groupname = resourceComInfo.getLastname(temp);
// resultMap.put("status", "-1");
// resultMap.put("message", "该假期类型下已经新建过人员:"+groupname+"的假期规则,请勿重复新建");
// return resultMap;
// }
// }
// }
// if (scopeType == 4 && scopeTypeTemp == 4) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
//// JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
// for (String temp : scopeValueList){
// if (scopeValueTempList.contains(temp)) {
// String groupname = jobTitlesComInfo.getJobTitlesname(temp);
// resultMap.put("status", "-1");
// resultMap.put("message", "该假期类型下已经新建过岗位:"+groupname+"的假期规则,请勿重复新建");
// return resultMap;
// }
// }
// }
//职务类型
if (scopeType == 5 && scopeTypeTemp == 5) {
List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
for (String temp : scopeValueList){
if (scopeValueTempList.contains(temp)) {
String groupname = jobTitlesComInfo.getJobTitlesname(temp);
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(545897, user.getLanguage()).replace("$", jobGroupsComInfo.getJobGroupsname(temp)));
return resultMap;
}
}
}
}
boolean flag = false;//数据是否更新成功
String sql = "update kq_LeaveRulesDetail set ruleId=?,ruleName=?,scopeType=?,scopeValue=?," +
"distributionMode=?,annualAmount=?,legalKey=?,welfareKey=?,priority=?,validityRule=?,effectiveDays=?,effectiveMonths=?,expirationMonth=?,expirationDay=?,extensionEnable=?,extendedDays=?,releaseRule=?,calcMethod=?,convertMode=?,excludeSubAccount=?,beforeFormal=? where id=?";
"distributionMode=?,annualAmount=?,legalKey=?,welfareKey=?,priority=?,validityRule=?,effectiveDays=?,effectiveMonths=?,expirationMonth=?,expirationDay=?,extensionEnable=?,extendedDays=?,releaseRule=?,calcMethod=?,convertMode=?,excludeSubAccount=?,beforeFormal=?,seclevel=?,seclevelto=? where id=?";
flag = recordSet.executeUpdate(sql, ruleId, ruleName, scopeType, scopeValue,
distributionMode, annualAmount, legalKey, welfareKey, priority, validityRule, effectiveDays, effectiveMonths, expirationMonth, expirationDay, extensionEnable, extendedDays, releaseRule, calcMethod, convertMode, excludeSubAccount, beforeFormal, ruleDetailId);
distributionMode, annualAmount, legalKey, welfareKey, priority, validityRule, effectiveDays, effectiveMonths, expirationMonth, expirationDay, extensionEnable, extendedDays, releaseRule, calcMethod, convertMode, excludeSubAccount, beforeFormal,seclevel,seclevelto, ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败

@ -2,6 +2,7 @@ package com.engine.kq.cmd.leaverules;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.api.browser.util.ConditionType;
import com.api.hrm.bean.HrmFieldBean;
import com.api.hrm.util.HrmFieldSearchConditionComInfo;
import com.engine.common.biz.AbstractCommonCommand;
@ -10,6 +11,7 @@ import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQLeaveRulesComInfo;
import weaver.conn.RecordSet;
import weaver.filter.XssUtil;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
@ -77,6 +79,10 @@ public class GetLeaveRulesFormCmd extends AbstractCommonCommand<Map<String, Obje
/*应用范围为分部时选择的分部ID*/
String scopeValue = "";
int seclevel = 0;
int seclevelto = 100;
/*余额发放方式1-手动发放、2-按司龄自动发放、3-按工龄自动发放、4-每年自动发放固定天数、5-加班时长自动计入余额、6-按工龄+司龄自动发放*/
int distributionMode = 1;
@ -163,6 +169,8 @@ public class GetLeaveRulesFormCmd extends AbstractCommonCommand<Map<String, Obje
welfareKey = "" + Util.getIntValue(recordSet.getString("welfareKey"), 1);
priority = Util.getIntValue(recordSet.getString("priority"), 1);
validityRule = Util.getIntValue(recordSet.getString("validityRule"), 0);
seclevel = Util.getIntValue(recordSet.getString("seclevel"), 0);
seclevelto = Util.getIntValue(recordSet.getString("seclevelto"), 100);
effectiveDays = Util.null2s(recordSet.getString("effectiveDays"), "30");
effectiveMonths = Util.null2s(recordSet.getString("effectiveMonths"),"1");
expirationMonth = Util.null2s(recordSet.getString("expirationMonth"), "1");
@ -328,7 +336,7 @@ public class GetLeaveRulesFormCmd extends AbstractCommonCommand<Map<String, Obje
/*应用范围是否能够选择总部,如果已经新建过总部的假期规则,则无法新建总部的假期规则*/
boolean canSelectCom = true;
/*已经新建过某分部的假期规则,则无法继续新建该分部的假期规则*/
String selectedSubcomIds = "";
String selectedSubcomIds = "", selectedDepartmentIds = "", selectedMemberIds = "",selectedJobtitleIds = "",selectedJobGroupIds = "";
/*新建假期规则的时候选择完假期类型后重亲请求了此接口*/
if (!ruleId.equals("") && !isEdit) {
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=?";
@ -340,13 +348,24 @@ public class GetLeaveRulesFormCmd extends AbstractCommonCommand<Map<String, Obje
if (scopeTypeTemp == 0) {
canSelectCom = false;
}
if (scopeTypeTemp == 1) {
} else if (scopeTypeTemp == 1) {
selectedSubcomIds += "," + scopeValueTemp;
} else if (scopeTypeTemp == 2) {
selectedDepartmentIds += "," + scopeValueTemp;
} else if (scopeTypeTemp == 3) {
selectedMemberIds += "," + scopeValueTemp;
} else if (scopeTypeTemp == 4){
selectedJobtitleIds += "," + scopeValueTemp;
} else if (scopeTypeTemp == 5){
selectedJobGroupIds += "," + scopeValueTemp;
}
}
}
selectedSubcomIds = selectedSubcomIds.length() > 0 ? selectedSubcomIds.substring(1) : "";
selectedDepartmentIds = selectedDepartmentIds.length() > 0 ? selectedDepartmentIds.substring(1) : "";
selectedMemberIds = selectedMemberIds.length() > 0 ? selectedMemberIds.substring(1) : "";
selectedJobtitleIds = selectedJobtitleIds.length() > 0 ? selectedJobtitleIds.substring(1) : "";
selectedJobGroupIds = selectedJobGroupIds.length() > 0 ? selectedJobGroupIds.substring(1) : "";
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldname("scopeType");//此规则适用范围
@ -359,9 +378,13 @@ public class GetLeaveRulesFormCmd extends AbstractCommonCommand<Map<String, Obje
optionsList = new ArrayList<SearchConditionOption>();
optionsList.add(new SearchConditionOption("0", SystemEnv.getHtmlLabelName(140, user.getLanguage()), scopeType == 0 || !canSelectCom));
optionsList.add(new SearchConditionOption("1", SystemEnv.getHtmlLabelName(33553, user.getLanguage()), scopeType == 1));
// optionsList.add(new SearchConditionOption("2", SystemEnv.getHtmlLabelName(124, user.getLanguage()), scopeType == 2));
// optionsList.add(new SearchConditionOption("3", SystemEnv.getHtmlLabelName(1867, user.getLanguage()), scopeType == 3));
// optionsList.add(new SearchConditionOption("4", SystemEnv.getHtmlLabelName(6086, user.getLanguage()), scopeType == 4));
optionsList.add(new SearchConditionOption("5", SystemEnv.getHtmlLabelName(805, user.getLanguage()), scopeType == 5));
searchConditionItem.setOptions(optionsList);
//对于一个请假类型各分部能够且仅能够设置一个属于本分部的假期规则如果未设置本分部的假期规则默认取总部的假期规则如果总部也未设置则假期基数视作0.00
searchConditionItem.setHelpfulTip(SystemEnv.getHtmlLabelName(505299, user.getLanguage()));
// searchConditionItem.setHelpfulTip(SystemEnv.getHtmlLabelName(534889, user.getLanguage()));
searchConditionItem.setRules("required|string");
if (hrmFieldBean.getViewAttr() == 1) {
Map<String, Object> OtherParamsMap = new HashMap<String, Object>();
@ -375,7 +398,7 @@ public class GetLeaveRulesFormCmd extends AbstractCommonCommand<Map<String, Obje
hrmFieldBean.setFieldlabel("33553");
hrmFieldBean.setFieldhtmltype("3");
hrmFieldBean.setType("170");
hrmFieldBean.setFieldvalue(scopeValue);
hrmFieldBean.setFieldvalue(scopeType == 1 ? scopeValue : "");
hrmFieldBean.setIsFormField(true);
hrmFieldBean.setViewAttr(isEnable == 0 ? 1 : 3);
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
@ -395,6 +418,165 @@ public class GetLeaveRulesFormCmd extends AbstractCommonCommand<Map<String, Obje
}
itemList.add(searchConditionItem);
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldname("scopeValueJobGroup");//职务类别
hrmFieldBean.setFieldlabel("805");
hrmFieldBean.setFieldhtmltype("3");
hrmFieldBean.setType("281");
hrmFieldBean.setFieldvalue(scopeType == 5 ? scopeValue : "");
hrmFieldBean.setIsFormField(true);
hrmFieldBean.setViewAttr(isEnable == 0 ? 1 : 3);
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
searchConditionItem.getBrowserConditionParam().getDataParams().put("rightStr", "KQLeaveRulesAdd:Add");
if (selectedJobtitleIds.length() > 0) {
XssUtil xssUtil = new XssUtil();
String sqlWhere = " id not in (" + selectedJobGroupIds + ") ";
searchConditionItem.getBrowserConditionParam().getDataParams().put("sqlWhere", xssUtil.put(sqlWhere));
searchConditionItem.getBrowserConditionParam().getCompleteParams().put("sqlWhere", xssUtil.put(sqlWhere));
searchConditionItem.getBrowserConditionParam().getDestDataParams().put("sqlWhere", xssUtil.put(sqlWhere));
}
searchConditionItem.setRules("required|string");
if (hrmFieldBean.getViewAttr() == 1) {
Map<String, Object> OtherParamsMap = new HashMap<String, Object>();
OtherParamsMap.put("hasBorder", true);
searchConditionItem.setOtherParams(OtherParamsMap);
}
itemList.add(searchConditionItem);
// hrmFieldBean = new HrmFieldBean();
// hrmFieldBean.setFieldname("scopeValueDepartment");//部门
// hrmFieldBean.setFieldlabel("124");
// hrmFieldBean.setFieldhtmltype("3");
// hrmFieldBean.setType("168");
// hrmFieldBean.setFieldvalue(scopeType == 2 ? scopeValue : "");
// hrmFieldBean.setIsFormField(true);
// hrmFieldBean.setViewAttr(isEnable == 0 ? 1 : 3);
// searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
// searchConditionItem.getBrowserConditionParam().getDataParams().put("rightStr", "KQLeaveRulesAdd:Add");
// if (selectedDepartmentIds.length() > 0) {
// XssUtil xssUtil = new XssUtil();
// String sqlWhere = " id not in (" + selectedDepartmentIds + ") ";
// searchConditionItem.getBrowserConditionParam().getDataParams().put("sqlWhere", xssUtil.put(sqlWhere));
// searchConditionItem.getBrowserConditionParam().getCompleteParams().put("sqlWhere", xssUtil.put(sqlWhere));
// searchConditionItem.getBrowserConditionParam().getDestDataParams().put("sqlWhere", xssUtil.put(sqlWhere));
// }
// searchConditionItem.setRules("required|string");
// if (hrmFieldBean.getViewAttr() == 1) {
// Map<String, Object> OtherParamsMap = new HashMap<String, Object>();
// OtherParamsMap.put("hasBorder", true);
// searchConditionItem.setOtherParams(OtherParamsMap);
// }
// itemList.add(searchConditionItem);
//
// hrmFieldBean = new HrmFieldBean();
// hrmFieldBean.setFieldname("scopeValueMember");//人员
// hrmFieldBean.setFieldlabel("1867");
// hrmFieldBean.setFieldhtmltype("3");
// hrmFieldBean.setType("166");
// hrmFieldBean.setFieldvalue(scopeType == 3 ? scopeValue : "");
// hrmFieldBean.setIsFormField(true);
// hrmFieldBean.setViewAttr(isEnable == 0 ? 1 : 3);
// searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
// searchConditionItem.getBrowserConditionParam().getDataParams().put("rightStr", "KQLeaveRulesAdd:Add");
// if (selectedMemberIds.length() > 0) {
// XssUtil xssUtil = new XssUtil();
// String sqlWhere = " id not in (" + selectedMemberIds + ") ";
// searchConditionItem.getBrowserConditionParam().getDataParams().put("sqlWhere", xssUtil.put(sqlWhere));
// searchConditionItem.getBrowserConditionParam().getCompleteParams().put("sqlWhere", xssUtil.put(sqlWhere));
// searchConditionItem.getBrowserConditionParam().getDestDataParams().put("sqlWhere", xssUtil.put(sqlWhere));
// }
// searchConditionItem.setRules("required|string");
// if (hrmFieldBean.getViewAttr() == 1) {
// Map<String, Object> OtherParamsMap = new HashMap<String, Object>();
// OtherParamsMap.put("hasBorder", true);
// searchConditionItem.setOtherParams(OtherParamsMap);
// }
// itemList.add(searchConditionItem);
// hrmFieldBean = new HrmFieldBean();
// hrmFieldBean.setFieldname("scopeValueJobtitle");//岗位
// hrmFieldBean.setFieldlabel("6086");
// hrmFieldBean.setFieldhtmltype("3");
// hrmFieldBean.setType("278");
// hrmFieldBean.setFieldvalue(scopeType == 4 ? scopeValue : "");
// hrmFieldBean.setIsFormField(true);
// hrmFieldBean.setViewAttr(isEnable == 0 ? 1 : 3);
// searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
// searchConditionItem.getBrowserConditionParam().getDataParams().put("rightStr", "KQLeaveRulesAdd:Add");
// if (selectedJobtitleIds.length() > 0) {
// XssUtil xssUtil = new XssUtil();
// String sqlWhere = " id not in (" + selectedJobtitleIds + ") ";
// searchConditionItem.getBrowserConditionParam().getDataParams().put("sqlWhere", xssUtil.put(sqlWhere));
// searchConditionItem.getBrowserConditionParam().getCompleteParams().put("sqlWhere", xssUtil.put(sqlWhere));
// searchConditionItem.getBrowserConditionParam().getDestDataParams().put("sqlWhere", xssUtil.put(sqlWhere));
// }
// searchConditionItem.setRules("required|string");
// if (hrmFieldBean.getViewAttr() == 1) {
// Map<String, Object> OtherParamsMap = new HashMap<String, Object>();
// OtherParamsMap.put("hasBorder", true);
// searchConditionItem.setOtherParams(OtherParamsMap);
// }
// itemList.add(searchConditionItem);
// hrmFieldBean = new HrmFieldBean();
// hrmFieldBean.setFieldname("seclevel");//安全级别1
// hrmFieldBean.setFieldlabel("683");
// hrmFieldBean.setFieldhtmltype("1");
// hrmFieldBean.setType("2");
// hrmFieldBean.setFieldvalue(seclevel);
// hrmFieldBean.setIsFormField(true);
// hrmFieldBean.setViewAttr(isEnable == 0 ? 1 : 3);
// searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
// searchConditionItem.setRules("required|integer");
// searchConditionItem.setMin("1");
// if (hrmFieldBean.getViewAttr() == 1) {
// Map<String, Object> OtherParamsMap = new HashMap<String, Object>();
// OtherParamsMap.put("hasBorder", true);
// searchConditionItem.setOtherParams(OtherParamsMap);
// }
// itemList.add(searchConditionItem);
//
// hrmFieldBean = new HrmFieldBean();
// hrmFieldBean.setFieldname("seclevelto");//安全级别2
// hrmFieldBean.setFieldlabel("683");
// hrmFieldBean.setFieldhtmltype("1");
// hrmFieldBean.setType("2");
// hrmFieldBean.setFieldvalue(seclevelto);
// hrmFieldBean.setIsFormField(true);
// hrmFieldBean.setViewAttr(isEnable == 0 ? 1 : 3);
// searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
// searchConditionItem.setRules("required|integer");
// searchConditionItem.setMin("1");
// if (hrmFieldBean.getViewAttr() == 1) {
// Map<String, Object> OtherParamsMap = new HashMap<String, Object>();
// OtherParamsMap.put("hasBorder", true);
// searchConditionItem.setOtherParams(OtherParamsMap);
// }
// itemList.add(searchConditionItem);
// HrmFieldSearchConditionComInfo hr = new HrmFieldSearchConditionComInfo();
// hrmFieldBean = new HrmFieldBean();
// hrmFieldBean.setFieldname("seclevel");
// hrmFieldBean.setFieldlabel("683");
// hrmFieldBean.setFieldhtmltype("1");
// hrmFieldBean.setType("2");
// hrmFieldBean.setIsScope(true);
// hrmFieldBean.setIsFormField(true);
// searchConditionItem = hr.getSearchConditionItem(hrmFieldBean, user);
// searchConditionItem.setLabelcol(6);
// searchConditionItem.setFieldcol(12);
// searchConditionItem.setMin("-999");
// searchConditionItem.setMax("999");
//
// List<Object> value1 = new ArrayList<Object>();
// value1.add(seclevel);
// value1.add(seclevelto);
// searchConditionItem.setValue(value1);
// searchConditionItem.setConditionType(ConditionType.INPUT_INTERVAL);
// itemList.add(searchConditionItem);
groupItem.put("items", itemList);
groupList.add(groupItem);

@ -70,6 +70,7 @@ public class GetSearchListCmd extends AbstractCommonCommand<Map<String, Object>>
"<sql backfields=\"" + backFields + "\" sqlform=\"" + sqlFrom + "\" sqlwhere=\"" + Util.toHtmlForSplitPage(sqlWhere) + "\" sqlorderby=\"" + orderBy + "\" sqlprimarykey=\"id\" sqlsortway=\"asc\" sqlisdistinct=\"false\"/>"
+ operateString +
" <head>" +
" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(15486, user.getLanguage()) + "\" column=\"id\" otherpara=\"" + user.getLanguage() + "\" />" +
" <col width=\"20%\" text=\"" + SystemEnv.getHtmlLabelName(19829, user.getLanguage()) + "\" column=\"ruleName\" otherpara=\"" + user.getLanguage() + "\" transmethod=\"weaver.general.Util.formatMultiLang\" />" +
" <col width=\"20%\" text=\"" + SystemEnv.getHtmlLabelName(129811, user.getLanguage()) + "\" column=\"ruleId\" otherpara=\"" + user.getLanguage() + "\" transmethod=\"com.engine.kq.util.KQTransMethod.getLeaveTypesName\"/>" +
" <col width=\"20%\" text=\"" + SystemEnv.getHtmlLabelName(388946, user.getLanguage()) + "\" column=\"distributionMode\" otherpara=\"" + user.getLanguage() + "\" transmethod=\"com.engine.kq.util.KQTransMethod.getDistributionModName\"/>" +

@ -480,6 +480,25 @@ public class GetHrmKQMonthReportInfoCmd extends AbstractCommonCommand<Map<String
String sql = "select * " + sqlFrom + sqlWhere;
RecordSet recordSet = new RecordSet();
Map<String,String> overtimemap = new HashMap<>();
if(flowType == 3){
String overtimesql = "select * from kq_flow_split_overtime where belongdate>='"+fromDate+"' and belongdate<='"+toDate+"'";
recordSet.executeQuery(overtimesql);
while(recordSet.next()){
String requestId = recordSet.getString("requestId");
String belongdate = recordSet.getString("belongdate");
String fromDatedb = recordSet.getString("fromDatedb");
String fromTimeTemp = recordSet.getString("fromTime");
String toDatedb = recordSet.getString("toDatedb");
String toTimeTemp = recordSet.getString("toTime");
if(belongdate.compareTo(fromDatedb)<0 || belongdate.compareTo(toDatedb)>0){//比如加班是2月1号但是属于前一天1月31
overtimemap.put(requestId,belongdate);
}
}
}
recordSet.executeQuery(sql);
while (recordSet.next()) {
String requestId = recordSet.getString("requestId");
@ -490,6 +509,12 @@ public class GetHrmKQMonthReportInfoCmd extends AbstractCommonCommand<Map<String
String fromTimeTemp = recordSet.getString("fromTime");
String toDateTemp = recordSet.getString("toDate");
String toTimeTemp = recordSet.getString("toTime");
String belongdate = "";
if(flowType == 3 && null != overtimemap && overtimemap.containsKey(requestId)){
belongdate = overtimemap.get(requestId);
}
String leaveRulesId = "";
String filterholidays = "";
String count = String.format("%.2f", duration) + "(" + ((durationrule == 3||durationrule == 5||durationrule == 6) ? SystemEnv.getHtmlLabelName(391, user.getLanguage()) : SystemEnv.getHtmlLabelName(1925, user.getLanguage())) + ")";
@ -552,6 +577,12 @@ public class GetHrmKQMonthReportInfoCmd extends AbstractCommonCommand<Map<String
}
}
//加班存在跨月的情况比如2023年1月31夜班【20:00-08:00】,2023年2月1是白班【09:00-18:00】申请加班2023年2月1【18:00-20:00】的加班
//因为默认归属逻辑该加班归属到前一天2023年1月31号而我的考勤日历上显示又是根据fromdatedb和todatedb来展示导致错开该加班流程1月31不显示2月1也不显示
//所以按归属日期belongdate来匹配否则下面的fromDateTemp=2023-02-01todateTemp=2023-02-01,匹配不到
if(!"".equals(belongdate)){
fromDateTemp = belongdate;//加班只有跨前一天的todateTemp不需要搞了
}
boolean isEnd = false;
for (String date = fromDateTemp; !isEnd; ) {
if (date.equals(toDateTemp)) {

@ -149,7 +149,7 @@ public class AddOvertimeRulesCmd extends AbstractCommonCommand<Map<String, Objec
boolean flag = false;//是否保存成功
String sql = "insert into kq_OvertimeRules(name,groupIds,isDelete) values(?,?,0)";
String sql = "insert into kq_OvertimeRules(name,shiftIds,isDelete) values(?,?,0)";
RecordSet recordSet = new RecordSet();
RecordSet recordSet1 = new RecordSet();
flag = recordSet.executeUpdate(sql, name, groupIds);

@ -157,7 +157,7 @@ public class EditOverTimeRulesCmd extends AbstractCommonCommand<Map<String, Obje
boolean flag = false;//是否保存成功
String sql = "update kq_OvertimeRules set name=?,groupIds=? where id=?";
String sql = "update kq_OvertimeRules set name=?,shiftIds=? where id=?";
RecordSet recordSet = new RecordSet();
RecordSet recordSet1 = new RecordSet();
RecordSet recordSet2 = new RecordSet();

@ -1,15 +1,24 @@
package com.engine.kq.cmd.overtimerules;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.api.hrm.bean.HrmFieldBean;
import com.api.hrm.util.HrmFieldSearchConditionComInfo;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.api.hrm.bean.HrmFieldBean;
import com.api.hrm.util.HrmFieldSearchConditionComInfo;
import com.engine.kq.biz.KQGroupComInfo;
import com.engine.kq.biz.KQShiftManagementComInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import weaver.attendance.service.OvertimeRuleComputingModeService;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.filter.XssUtil;
import weaver.general.Util;
@ -161,7 +170,7 @@ public class GetOvertimeRulesFormCmd extends AbstractCommonCommand<Map<String, O
Map<String,String> valueMap = Maps.newHashMap();
if (!ruleId.equals("")) {
String sql = "select t1.name,t1.groupids,t2.* from kq_OvertimeRules t1 left join kq_OvertimeRulesDetail t2 on t1.id=t2.ruleId where (t1.isDelete is null or t1.isDelete!=1) and t1.id=" + ruleId;
String sql = "select t1.name,t1.shiftIds as groupids,t2.* from kq_OvertimeRules t1 left join kq_OvertimeRulesDetail t2 on t1.id=t2.ruleId where (t1.isDelete is null or t1.isDelete!=1) and t1.id=" + ruleId;
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql);
int dayType = 0;//1-工作日、2-休息日、3-节假日
@ -341,20 +350,20 @@ public class GetOvertimeRulesFormCmd extends AbstractCommonCommand<Map<String, O
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldname("groupIds");//应用范围--考勤组
hrmFieldBean.setFieldlabel("19374");
hrmFieldBean.setFieldlabel("389098");
hrmFieldBean.setFieldhtmltype("3");
hrmFieldBean.setType("mkqgroup");
hrmFieldBean.setType("mkqshift");
hrmFieldBean.setFieldvalue(groupIds);
hrmFieldBean.setIsFormField(true);
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
KQGroupComInfo kqGroupComInfo = new KQGroupComInfo();
KQShiftManagementComInfo kqGroupComInfo = new KQShiftManagementComInfo();
List<Map<String, Object>> replaceDatas = new ArrayList<Map<String, Object>>();
Map<String, Object> datas = new HashMap<String, Object>();
String[] groupIdArr = groupIds.split(",");
for (String groupId : groupIdArr) {
datas = new HashMap<String, Object>();
datas.put("id", groupId);
datas.put("name", kqGroupComInfo.getGroupname(groupId));
datas.put("name", kqGroupComInfo.getSerial(groupId));
replaceDatas.add(datas);
}
searchConditionItem.getBrowserConditionParam().setReplaceDatas(replaceDatas);
@ -369,15 +378,17 @@ public class GetOvertimeRulesFormCmd extends AbstractCommonCommand<Map<String, O
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql);
while (recordSet.next()) {
String kqGroupIds = recordSet.getString("groupIds");
String kqGroupIds = recordSet.getString("shiftIds");
if (kqGroupIds.equals("")) {
continue;
}
kqGroupIdStr += "," + kqGroupIds;
}
XssUtil xssUtil = new XssUtil();
dataMap.put("sqlWhere", kqGroupIdStr.length() > 0 ? xssUtil.put(" kqType <>3 and id not in (" + kqGroupIdStr.substring(1) + ")") : xssUtil.put(" kqType <>3 "));
completeMap.put("sqlWhere", kqGroupIdStr.length() > 0 ? xssUtil.put(" kqType <>3 and id not in (" + kqGroupIdStr.substring(1) + ")") : xssUtil.put(" kqType <>3 "));
if(kqGroupIdStr.length() > 0) {
dataMap.put("sqlWhere", xssUtil.put(" id not in (" + kqGroupIdStr.substring(1) + ")"));
completeMap.put("sqlWhere", xssUtil.put(" id not in (" + kqGroupIdStr.substring(1) + ")"));
}
searchConditionItem.getBrowserConditionParam().setDataParams(dataMap);
searchConditionItem.getBrowserConditionParam().setCompleteParams(completeMap);
itemList.add(searchConditionItem);
@ -419,6 +430,10 @@ public class GetOvertimeRulesFormCmd extends AbstractCommonCommand<Map<String, O
statusOptions.add(new SearchConditionOption("1", SystemEnv.getHtmlLabelName(500382, user.getLanguage()),"1".equalsIgnoreCase(computingMode_value)));
statusOptions.add(new SearchConditionOption("2", SystemEnv.getHtmlLabelName(500383, user.getLanguage()),"2".equalsIgnoreCase(computingMode_value)));
statusOptions.add(new SearchConditionOption("4", SystemEnv.getHtmlLabelName(524827, user.getLanguage()),"4".equalsIgnoreCase(computingMode_value)));
Map<Integer, String> cusModeMap = new OvertimeRuleComputingModeService().getNewComputingMode(user.getLanguage());
for(Integer key : cusModeMap.keySet()) {
statusOptions.add(new SearchConditionOption(String.valueOf(key), StringUtil.vString(cusModeMap.get(key)),String.valueOf(key).equalsIgnoreCase(computingMode_value)));
}
statusOptions.add(new SearchConditionOption("3", SystemEnv.getHtmlLabelName(390837, user.getLanguage()),"3".equalsIgnoreCase(computingMode_value)));
searchConditionItem.setOptions(statusOptions);
searchConditionItem.setDetailtype(3);

@ -37,7 +37,7 @@ public class GetSearchListCmd extends AbstractCommonCommand<Map<String, Object>>
boolean canDelete = HrmUserVarify.checkUserRight("KQOvertimeRulesDelete:Delete", user);//是否具有删除的权限;
boolean canLog = HrmUserVarify.checkUserRight("KQOvertimeRules:Log", user);//是否具有查看日志的权限;
String backFields = " id,name,groupIds ";
String backFields = " id,name,shiftIds ";
String sqlFrom = " from kq_OvertimeRules ";
String sqlWhere = " where 1=1 and (isDelete is null or isDelete!=1) ";
String orderBy = " id ";
@ -56,7 +56,7 @@ public class GetSearchListCmd extends AbstractCommonCommand<Map<String, Object>>
" <head>" +
" <col width=\"25%\" text=\"" + SystemEnv.getHtmlLabelName(388831, user.getLanguage()) + "\" column=\"name\" transmethod=\"weaver.general.Util.formatMultiLang\" otherpara=\"" + user.getLanguage() + "\" orderkey=\"name\"/>" +
" <col width=\"40%\" text=\"" + SystemEnv.getHtmlLabelName(388832, user.getLanguage()) + "\" column=\"id\" transmethod=\"com.engine.kq.util.KQTransMethod.getRuleContent\" otherpara=\"" + user.getLanguage() + "\"/>" +
" <col width=\"25%\" text=\"" + SystemEnv.getHtmlLabelName(19374, user.getLanguage()) + "\" column=\"groupIds\" transmethod=\"com.engine.kq.util.KQTransMethod.getGroupName\" otherpara=\"" + user.getLanguage() + "\" />" +
" <col width=\"25%\" text=\"" + SystemEnv.getHtmlLabelName(19374, user.getLanguage()) + "\" column=\"shiftIds\" transmethod=\"com.engine.kq.util.KQTransMethod.getShiftName\" otherpara=\"" + user.getLanguage() + "\" />" +
" </head>" +
"</table>";
String sessionKey = pageUid + "_" + Util.getEncrypt(Util.getRandom());

@ -44,11 +44,11 @@ public class IsRepeatSettingCmd extends AbstractCommonCommand<Map<String, Object
String groupName = "";//考勤组的名称
String sql = "select * from kq_overtimeRules where (isDelete is null or isDelete!=1) ";
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")) {
sql += " and ','+groupIds+',' like '%," + groupId + ",%'";
sql += " and ','+shiftIds+',' like '%," + groupId + ",%'";
} else if (recordSet.getDBType().equalsIgnoreCase("mysql")) {
sql += " and contract(',',groupIds,',') like '%," + groupId + ",%'";
sql += " and contract(',',shiftIds,',') like '%," + groupId + ",%'";
} else {
sql += " and ','||groupIds||',' like '%," + groupId + ",%'";
sql += " and ','||shiftIds||',' like '%," + groupId + ",%'";
}
if (!ruleId.equals("")) {
sql += " and ruleId not in (" + ruleId + ")";

@ -73,6 +73,7 @@ public class GetShiftManagementBaseFormCmd extends AbstractCommonCommand<Map<Str
Map<String,Object> restSectionsMap = new HashMap<>();
String[] fields = new String[]{"serial,125818,1,1","subcompanyid,141,3,169","shiftonoffworkcount,388563,5,3","punchsettings,388564,4,1",
"rest_shift,536771,4,2",
"isresttimeopen,388565,4,2","restbeigin,388566,3,19","restend,388567,3,19","halfcalrule,513090,5,1","cardRemind,507833,4,2","cardRemOfSignIn,507835,5,1",
"minsBeforeSignIn,510106,1,2","cardRemOfSignOut,507837,5,1","minsAfterSignOut,510108,1,2","remindMode,501471,5,3","remindOnPC,513233,4,2",
"isoffdutyfreecheck,388568,4,2","halfcalpoint,513145,3,19","halfcalpoint2cross,513090,5,1"};
@ -99,7 +100,8 @@ public class GetShiftManagementBaseFormCmd extends AbstractCommonCommand<Map<Str
"remindOnPC".equalsIgnoreCase(fieldname) ||
"isoffdutyfreecheck".equalsIgnoreCase(fieldname) ||
"halfcalpoint".equalsIgnoreCase(fieldname) ||
"halfcalpoint2cross".equalsIgnoreCase(fieldname)){
"halfcalpoint2cross".equalsIgnoreCase(fieldname)||
"rest_shift".equalsIgnoreCase(fieldname)){
fieldvalue = Util.null2s(fieldvalue, "0");
}else if("minsBeforeSignIn".equalsIgnoreCase(fieldname)){
fieldvalue = Util.null2s(fieldvalue, "10");
@ -246,6 +248,9 @@ public class GetShiftManagementBaseFormCmd extends AbstractCommonCommand<Map<Str
if("halfcalpoint2cross".equals(hrmFieldBean.getFieldname())){
hrmFieldBean.setFieldvalue("0");
}
if("rest_shift".equals(hrmFieldBean.getFieldname())){
hrmFieldBean.setFieldvalue("0");
}
}
if("shiftonoffworkcount".equals(tmpField[0])){

@ -180,6 +180,7 @@ public class SaveShiftManagementBaseFormCmd extends AbstractCommonCommand<Map<St
String serialid = Util.null2String(jsonObj.get("id"));
String serial = Util.null2String(jsonObj.get("serial"));//班次名称
String subcompanyid = Util.null2o(Util.null2String(jsonObj.get("subcompanyid")));
int rest_shift = StringUtil.parseToInt(jsonObj.getString("rest_shift"),0);//休息班
String shiftOnOffWorkCount = Util.null2o(Util.null2String(jsonObj.get("shiftonoffworkcount")));//一天内上下班次数
String punchSettings = "1";//打卡时段是否开启 1表示开启
String isOffDutyFreeCheck = Util.null2o(Util.null2String(jsonObj.get("isoffdutyfreecheck")));//允许下班不打卡 1表示开启
@ -214,10 +215,10 @@ public class SaveShiftManagementBaseFormCmd extends AbstractCommonCommand<Map<St
}
String mainSql = "update kq_ShiftManagement set serial=?,subcompanyid=?,shiftonoffworkcount=?,punchsettings=?,isoffdutyfreecheck=?,isresttimeopen=?,worktime=?,color=?," +
"cardRemind=? ,cardRemOfSignIn=? ,minsBeforeSignIn=? ,cardRemOfSignOut=? ,minsAfterSignOut=? ,remindMode=? ,remindOnPC=?,halfcalrule=?,halfcalpoint=?,halfcalpoint2cross=? where id = ? ";
"cardRemind=? ,cardRemOfSignIn=? ,minsBeforeSignIn=? ,cardRemOfSignOut=? ,minsAfterSignOut=? ,remindMode=? ,remindOnPC=?,halfcalrule=?,halfcalpoint=?,halfcalpoint2cross=?,rest_shift= ? where id = ? ";
boolean isUpdated = rst.executeUpdate(mainSql, serial,subcompanyid,shiftOnOffWorkCount,punchSettings,isOffDutyFreeCheck,isRestTimeOpen,worktime,color,
cardRemind ,cardRemOfSignIn ,minsBeforeSignIn ,cardRemOfSignOut ,minsAfterSignOut ,remindMode ,remindOnPC,halfcalrule,halfcalpoint,halfcalpoint2cross,serialid);
cardRemind ,cardRemOfSignIn ,minsBeforeSignIn ,cardRemOfSignOut ,minsAfterSignOut ,remindMode ,remindOnPC,halfcalrule,halfcalpoint,halfcalpoint2cross,rest_shift,serialid);
if(isUpdated){
//对于休息时间和工作时间,直接删除后重新创建
@ -291,6 +292,7 @@ public class SaveShiftManagementBaseFormCmd extends AbstractCommonCommand<Map<St
rst.setAutoCommit(true);
RecordSet rs = new RecordSet();
String subcompanyid = Util.null2o(Util.null2String(jsonObj.get("subcompanyid")));
int rest_shift = StringUtil.parseToInt(jsonObj.getString("rest_shift"),0);//休息班
String serial = Util.null2String(jsonObj.get("serial"));//班次名称
String shiftOnOffWorkCount = Util.null2o(Util.null2String(jsonObj.get("shiftonoffworkcount")));//一天内上下班次数
String punchSettings = "1";//打卡时段是否开启 1表示开启
@ -331,11 +333,11 @@ public class SaveShiftManagementBaseFormCmd extends AbstractCommonCommand<Map<St
boforeLog(uuid);
String mainSql = "insert into kq_ShiftManagement(serial,subcompanyid,shiftonoffworkcount,punchsettings,isoffdutyfreecheck,isresttimeopen,worktime,uuid,color," +
"cardRemind ,cardRemOfSignIn ,minsBeforeSignIn ,cardRemOfSignOut ,minsAfterSignOut ,remindMode ,remindOnPC,halfcalrule,halfcalpoint,halfcalpoint2cross)"
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
"cardRemind ,cardRemOfSignIn ,minsBeforeSignIn ,cardRemOfSignOut ,minsAfterSignOut ,remindMode ,remindOnPC,halfcalrule,halfcalpoint,halfcalpoint2cross,rest_shift)"
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
boolean isUpdated = rst.executeUpdate(mainSql, serial,subcompanyid,shiftOnOffWorkCount,punchSettings,isOffDutyFreeCheck,isRestTimeOpen,worktime,uuid,color,
cardRemind ,cardRemOfSignIn ,minsBeforeSignIn ,cardRemOfSignOut ,minsAfterSignOut ,remindMode ,remindOnPC,halfcalrule,halfcalpoint,halfcalpoint2cross);
cardRemind ,cardRemOfSignIn ,minsBeforeSignIn ,cardRemOfSignOut ,minsAfterSignOut ,remindMode ,remindOnPC,halfcalrule,halfcalpoint,halfcalpoint2cross,rest_shift);
if(isUpdated){
int serialid = 0;

@ -20,6 +20,7 @@ public class WorkTimeEntity {
private String signstart;//自由工时开始打卡时间
private boolean isExclude;//无需考勤人员
private String calmethod;//自由班制计算方式
private int restShift;
public String getGroupId() {
return groupId;
@ -124,4 +125,12 @@ public class WorkTimeEntity {
public void setCalmethod(String calmethod) {
this.calmethod = calmethod;
}
public int getRestShift() {
return restShift;
}
public void setRestShift(int restShift) {
this.restShift = restShift;
}
}

@ -2,6 +2,7 @@ package com.engine.kq.util;
import com.engine.kq.biz.KQLeaveRulesBiz;
import com.engine.kq.biz.KQLeaveRulesComInfo;
import com.engine.kq.biz.KQShiftManagementComInfo;
import com.engine.kq.biz.KQWorkTime;
import com.engine.kq.biz.chain.cominfo.ShiftInfoCominfoBean;
import com.engine.kq.biz.chain.duration.NonDayUnitSplitChain;
@ -26,6 +27,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import weaver.common.StringUtil;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
@ -90,6 +93,14 @@ public class KQDurationCalculatorUtil extends BaseBean {
return getWorkTime(user, date,containYesterday);
}
public static ShiftInfoBean getWorkTimeNew(String resourceid, String date,boolean containYesterday){
User user = User.getUser(Util.getIntValue(resourceid), 0);
if(user == null){
return null;
}
return getWorkTime(user, date, containYesterday, true, false);
}
/**
*
* @param resourceid
@ -122,6 +133,10 @@ public class KQDurationCalculatorUtil extends BaseBean {
* @return
*/
public static ShiftInfoBean getWorkTime(User user, String date,boolean containYesterday,boolean isLog){
return getWorkTime(user, date, containYesterday, isLog, true);
}
public static ShiftInfoBean getWorkTime(User user, String date,boolean containYesterday,boolean isLog, boolean isUsedRestShift){
KQWorkTime kqWorkTime = new KQWorkTime();
Map<String, Object> kqWorkTimeMap = new HashMap<>();
kqWorkTimeMap = kqWorkTime.getWorkDuration(""+user.getUID(), date,containYesterday,isLog);
@ -145,6 +160,14 @@ public class KQDurationCalculatorUtil extends BaseBean {
}else{
if(kqWorkTimeMap.get("shiftInfoBean") != null){
ShiftInfoBean shiftInfoBean = (ShiftInfoBean)kqWorkTimeMap.get("shiftInfoBean");
if(isUsedRestShift) {
int serialid = Util.getIntValue(Util.null2String(shiftInfoBean.getSerialid()), 0);
KQShiftManagementComInfo kQShiftManagementComInfo = new KQShiftManagementComInfo();
int restShift = StringUtil.parseToInt(kQShiftManagementComInfo.getRestShift(String.valueOf(serialid)), 0);
if(restShift == 1) {
return null;
}
}
return shiftInfoBean;
}else{
return null;

@ -258,6 +258,8 @@ public class KQTransMethod {
scopeTypeName = SystemEnv.getHtmlLabelName(140, language);
} else if (scopeType.equals("1")) {
scopeTypeName = SystemEnv.getHtmlLabelName(33553, language);
} else if (scopeType.equals("5")) {
scopeTypeName = SystemEnv.getHtmlLabelName(805, language);
}
return scopeTypeName;
}
@ -788,6 +790,27 @@ public class KQTransMethod {
return resultStr;
}
/**
*
*
* @param groupIds
* @param languageId
* @return
*/
public String getShiftName(String shitIds, String languageId) {
int language = Util.getIntValue(languageId, 7);
if (shitIds.equals("")) {
return SystemEnv.getHtmlLabelName(165, language);
}
KQShiftManagementComInfo kqGroupComInfo = new KQShiftManagementComInfo();
String[] groupIdArr = shitIds.split(",");
String shiftName = kqGroupComInfo.getSerial(groupIdArr[0]);
if (groupIdArr.length > 1) {
shiftName = SystemEnv.getHtmlLabelName(537018, language).replace("{shiftName}", shiftName).replace("{count}", "" + groupIdArr.length);
}
return shiftName;
}
/**
*
*
@ -1340,7 +1363,7 @@ public class KQTransMethod {
WorkflowRequestComInfo workflowRequestComInfo = new WorkflowRequestComInfo();
String flowName = workflowRequestComInfo.getRequestName(requestid);
if (StringUtil.isNotNull(flowName)) {
String url = weaver.general.GCONST.getContextPath()+"/spa/workflow/static4mobileform/index.html#/req?requestid=" + requestid;
String url = weaver.general.GCONST.getContextPath()+"/spa/workflow/static4mobileform/index.html#/req?ismonitor=1&requestid=" + requestid;
String a_href = "<a href='javascript:void(0)' onclick=\"window.showHoverWindow('" + url + "','/req',false)\" >" + flowName + "</a>&nbsp;";
return a_href;
} else {
@ -1352,7 +1375,7 @@ public class KQTransMethod {
WorkflowRequestComInfo workflowRequestComInfo = new WorkflowRequestComInfo();
String flowName = workflowRequestComInfo.getRequestName(requestid);
if (StringUtil.isNotNull(flowName)) {
return "<a href='"+weaver.general.GCONST.getContextPath()+"/spa/workflow/index_form.jsp#/main/workflow/req?requestid=" + requestid + "'target='_blank'>" + flowName + "</a>&nbsp;";
return "<a href='"+weaver.general.GCONST.getContextPath()+"/spa/workflow/index_form.jsp#/main/workflow/req?ismonitor=1&requestid=" + requestid + "'target='_blank'>" + flowName + "</a>&nbsp;";
} else {
return "";
}
@ -1363,5 +1386,26 @@ public class KQTransMethod {
String labelId = otherParaArr[0];
String LanId = otherParaArr[1];
return SystemEnv.getHtmlLabelNames(labelId, LanId);
}
/**
*
*
* @param addr
* @param otherParams
* @return
*/
public String getShowAddress(String addr, String otherParams) {
String[] otherParamArr = otherParams.split("\\+", 3);
String userid = Util.null2String(otherParamArr[0].trim());
String signdate = Util.null2String(otherParamArr[1].trim());
String showaddress = Util.null2String(otherParamArr[2].trim());
KQGroupComInfo kqGroupComInfo = new KQGroupComInfo();
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
String groupid = Util.null2String(kqGroupMemberComInfo.getKQGroupId(userid, signdate));
String locationshowaddress = kqGroupComInfo.getLocationshowaddress(groupid);
if (locationshowaddress.equals("1") && showaddress.length() > 0) {
addr = showaddress;
}
return addr;
}
}

@ -0,0 +1,97 @@
package weaver.attendance.service;
import java.util.List;
import java.util.Map;
import com.engine.kq.entity.KQOvertimeRulesDetailEntity;
import com.google.common.collect.Maps;
import weaver.hrm.User;
import weaver.sqsddldcxt.attendance.service.OvertimeRuleComputingMode5Service;
public class OvertimeRuleComputingModeService {
private OvertimeRuleComputingMode5Service mode5Service;
public OvertimeRuleComputingModeService() {
this.mode5Service = new OvertimeRuleComputingMode5Service();
}
/**
* computingMode
* keyint
*
*
* 0=
* 1=
* 2=
* 3=
* 4=
*
* @param languageId
* @return
*/
public Map<Integer, String> getNewComputingMode(int languageId) {
Map<Integer, String> map = Maps.newLinkedHashMap();
// map.put(mode5Service.getComputingMode(), mode5Service.getComputingModeTitle(languageId));
return map;
}
/**
*
*
* @param computingMode
*
* @param params
* @param user
*/
public String buildTableString4CustomOvertimeFlow(int computingMode, Map<String, Object> params, User user) {
String result = "";
switch(computingMode) {
case 5:
result = mode5Service.buildTableString4CustomOvertimeFlow(params, user);
break;
}
return result;
}
/**
*
*
* @param computingMode
*
* @param resourceid
*
* @param splitDate
*
* @param changeTypeMap
*
* {key:splitDate+"_"+resourceId, value:1=2=3=}
* @param overRulesDetailMap
*
* {key:splitDate+"_"+changeType, value:}
* @param restTimeMap
*
* {key:splitDate+"_"+changeType, value: {[,]} }
* @param computingModeMap
*
* {key:splitDate+"_"+changeType, value:0=1=2=3=4==}
* @param main_uuid
* uuidkq_overtime_logkq_overtime_log_detail.main_uuid
* @throws Exception
*/
public void doComputingMode(int computingMode, String resourceid, String splitDate,
Map<String, Integer> changeTypeMap,
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap,
Map<String, List<String[]>> restTimeMap,
Map<String, Integer> computingModeMap,
String main_uuid) {
switch(computingMode) {
case 5:
mode5Service.doComputingMode(resourceid, splitDate, changeTypeMap, overRulesDetailMap, restTimeMap, computingModeMap, main_uuid);
break;
}
}
}

@ -0,0 +1,834 @@
package weaver.sqsddldcxt.attendance.service;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.cloudstore.dev.api.util.Util_TableMap;
import com.engine.kq.biz.KQBalanceOfLeaveBiz;
import com.engine.kq.biz.KQOverTimeFlowBiz;
import com.engine.kq.biz.KQOverTimeRuleCalBiz;
import com.engine.kq.biz.KQOvertimeLogBiz;
import com.engine.kq.biz.KQOvertimeRulesBiz;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.biz.KQTimesArrayComInfo;
import com.engine.kq.biz.KQWorkTime;
import com.engine.kq.biz.chain.cominfo.ShiftInfoCominfoBean;
import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean;
import com.engine.kq.entity.KQOvertimeRulesDetailEntity;
import com.engine.kq.entity.TimeScopeEntity;
import com.engine.kq.entity.WorkTimeEntity;
import com.engine.kq.log.KQLog;
import com.engine.kq.timer.KQOvertimeCardBean;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.wfset.bean.OvertimeBalanceTimeBean;
import com.engine.kq.wfset.bean.SplitBean;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
public class OvertimeRuleComputingMode5Service {
private KQLog kqLog = null;
private KQOverTimeRuleCalBiz calBiz = null;
private int computingMode = 5;
public int getComputingMode() {
return this.computingMode;
}
public String getComputingModeTitle(int languageId) {
return SystemEnv.getHtmlLabelName(536733, languageId);
}
public OvertimeRuleComputingMode5Service() {
this.kqLog = new KQLog();
this.calBiz = new KQOverTimeRuleCalBiz();
}
public void doComputingMode(String resourceid, String splitDate,
Map<String, Integer> changeTypeMap,
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap,
Map<String, List<String[]>> restTimeMap, Map<String, Integer> computingModeMap,
String main_uuid) {
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
String key = resourceid+"_"+splitDate;
//加班日志记录类
KQWorkTime kqWorkTime = new KQWorkTime();
WorkTimeEntity workTimeEntity = kqWorkTime.getWorkTime(resourceid, splitDate);
Map<String,Object> workTimeEntityLogMap = Maps.newHashMap();
workTimeEntityLogMap.put("resourceid", resourceid);
workTimeEntityLogMap.put("splitDate", splitDate);
workTimeEntityLogMap.put("workTimeEntity", workTimeEntity);
KQOvertimeLogBiz kqEventLogBiz = new KQOvertimeLogBiz();
String uuid = kqEventLogBiz.logDetailWorkTimeEntity(resourceid,workTimeEntityLogMap,main_uuid,"doComputingMode"+computingMode+"|加班计算,需审批,加班和出差、公出均统计,取两者的交集|key|"+key);
Map<String,Object> overtimeLogMap = Maps.newLinkedHashMap();
Map<String,Object> eventMap = Maps.newLinkedHashMap();
Map<String, KQOvertimeCardBean> lsCheckInfoMaps = Maps.newLinkedHashMap();
//获取出差、公出数据
try {
getFlowDataMap(resourceid, splitDate, splitDate, dateFormatter,kqTimesArrayComInfo,overRulesDetailMap,changeTypeMap,lsCheckInfoMaps,eventMap);
} catch (Exception e) {
}
if(lsCheckInfoMaps.isEmpty()){
calBiz.logOvertimeMap(overtimeLogMap, "没有出差、公出数据", "出差、公出数据");
kqEventLogBiz.logDetailOvertimeMap(resourceid,overtimeLogMap,uuid);
kqEventLogBiz.logDetailEvent(resourceid,eventMap,uuid,"doComputingMode"+computingMode+"|对应的加班流程数据|key|"+key);
return;
}
RecordSet rs = new RecordSet();
Iterator<Entry<String, KQOvertimeCardBean>> iterator = lsCheckInfoMaps.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, KQOvertimeCardBean> next = iterator.next();
String mapKey = next.getKey();
KQOvertimeCardBean kqOvertimeCardBean = next.getValue();
String[] mapKeys = mapKey.split("_");
if (mapKeys.length != 2) {
continue;
}
String realSplitDate = mapKeys[1];
Map<String,List<SplitBean>> splitBeanMaps = Maps.newHashMap();
//获取加班流程数据
calBiz.getOverTimeFlowData(resourceid,realSplitDate,realSplitDate,splitBeanMaps,dateFormatter);
String change_key = realSplitDate+"_"+resourceid;
int changeType = Util.getIntValue(""+changeTypeMap.get(change_key),-1);
String changeType_key = realSplitDate+"_"+changeType;
String changetypeName = 1==changeType ? "节假日" : (2 == changeType ? "工作日" : (3 == changeType ? "休息日" : "异常"));
String changetypeLogInfo = change_key+"|changeType|"+changeType+"|"+changetypeName;
calBiz.logOvertimeMap(overtimeLogMap, changetypeLogInfo, mapKey+"|"+"加班日期属性|changetypeLogInfo");
calBiz.clearOvertimeTX(resourceid, realSplitDate,overtimeLogMap,splitDate);
calBiz.logOvertimeMap(overtimeLogMap, kqOvertimeCardBean, mapKey+"|"+"出差、公出和加班数据|KQOvertimeCardBean");
KQOvertimeRulesDetailEntity kqOvertimeRulesDetailEntity = overRulesDetailMap.get(changeType_key);
if(kqOvertimeRulesDetailEntity == null){
String overRuleInfo = "changeType_key:"+changeType_key+":kqOvertimeRulesDetailEntity:"+kqOvertimeRulesDetailEntity;
calBiz.logOvertimeMap(overtimeLogMap, overRuleInfo, mapKey+"|"+"加班规则为null|kqOvertimeRulesDetailEntity");
continue;
}
int overtimeEnable = kqOvertimeRulesDetailEntity.getOvertimeEnable();
if(overtimeEnable != 1){
String overtimeEnableInfo = "overtimeEnable:"+overtimeEnable;
calBiz.logOvertimeMap(overtimeLogMap, overtimeEnableInfo, mapKey+"|"+"未开启加班规则|overtimeEnable");
continue;
}
if(kqOvertimeCardBean != null){
int[] initArrays = kqTimesArrayComInfo.getInitArr();
List<Map<String, String>> hasOverTime4SignList = Lists.newArrayList();
calBiz.getHasOverTimeData(resourceid,realSplitDate,hasOverTime4SignList);
Map<String, String> signinoffMap = null;
try {
signinoffMap = calBiz.buildOvertimeCard(kqOvertimeCardBean, resourceid, realSplitDate, kqTimesArrayComInfo, restTimeMap, changeType_key,initArrays,hasOverTime4SignList,
overRulesDetailMap,true,overtimeLogMap);
} catch (Exception e) {
}
if(signinoffMap == null) signinoffMap = Maps.newHashMap();
calBiz.logOvertimeMap(overtimeLogMap, signinoffMap, mapKey+"|"+"获取上下班出差、公出数据|signinoffMap");
String signinTime = Util.null2String(signinoffMap.get("signinTime"));
String signoutTime = Util.null2String(signinoffMap.get("signoutTime"));
String signinDate = Util.null2String(signinoffMap.get("signinDate"));
String signoutDate = Util.null2String(signinoffMap.get("signoutDate"));
int signinTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(signinTime);
int signoutTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(signoutTime);
if(signinTimeIndex < signoutTimeIndex){
//先覆盖出差、公出区间都是1
int over_count = kqTimesArrayComInfo.getCnt(initArrays, signinTimeIndex, signoutTimeIndex, 1);
String overCountLogInfo = "signinTimeIndex:"+signinTimeIndex+":signoutTimeIndex:"+signoutTimeIndex+":over_count:"+over_count;
calBiz.logOvertimeMap(overtimeLogMap, overCountLogInfo, mapKey+"|"+"出差、公出区间,得到出差、公出时长|over_count");
if(over_count > 0){
int restTimeType = 1;
String kqOvertimeRulesDetailEntityLogInfo = kqOvertimeRulesDetailEntity==null ? "" :JSON.toJSONString(kqOvertimeRulesDetailEntity);
calBiz.logOvertimeMap(overtimeLogMap, kqOvertimeRulesDetailEntityLogInfo, mapKey+"|具体这个人这一天对应的加班规则|KQOvertimeRulesDetailEntity");
int minimumLen = -1;
if(kqOvertimeRulesDetailEntity != null){
minimumLen = kqOvertimeRulesDetailEntity.getMinimumLen();
if(over_count < minimumLen){
String minInfo = "over_count:"+over_count+":minimumLen:"+minimumLen;
calBiz.logOvertimeMap(overtimeLogMap, minInfo, mapKey+"|出差、公出时长小于最小加班时长|over_count<minimumUnit");
continue;
}
}
if(splitBeanMaps.containsKey(mapKey)) {
List<SplitBean> splitBeans = splitBeanMaps.get(mapKey);
String flowinfo = "";
if(splitBeans != null && !splitBeans.isEmpty()){
flowinfo = JSON.toJSONString(splitBeans, SerializerFeature.DisableCheckSpecialChar,SerializerFeature.DisableCircularReferenceDetect);
}
eventMap.put(mapKey+"|"+"加班流程数据|flowinfo", flowinfo);
if(splitBeans == null || splitBeans.isEmpty()){
return;
}
for (int m = 0; m < splitBeans.size(); m++) {
SplitBean splitBean = splitBeans.get(m);
String dataid = splitBean.getDataId();
String detailid = splitBean.getDetailId();
String flow_fromdate = splitBean.getFromDate();
String flow_fromtime = splitBean.getFromTime();
String flow_todate = splitBean.getToDate();
String flow_totime = splitBean.getToTime();
String fromdatedb = splitBean.getFromdatedb();
String fromtimedb = splitBean.getFromtimedb();
String todatedb = splitBean.getTodatedb();
String totimedb = splitBean.getTotimedb();
String requestid = splitBean.getRequestId();
double d_mins = splitBean.getD_Mins();
if(d_mins <= 0){
continue;
}
String flow_key = mapKey+"|"+"flow_fromdate|"+flow_fromdate+"|flow_todate|"+flow_todate
+"|flow_fromtime|"+flow_fromtime+"|flow_totime|"+flow_totime;
//如果打卡数据有了,再拿流程数据去覆盖,得到有效的打卡区间,这个区间肯定已经是去除了上下班时间和休息时间还有重复打卡的部分
List<Integer> cross_time_list = Lists.newArrayList();
// cross_time_list里存的是排除了工作时间的打卡段找到1表示找到打卡开始的点了找到-2表示找到打卡结束的点了
calBiz.get_cross_time_list(cross_time_list,initArrays,signinTimeIndex,signoutTimeIndex,1,-2);
calBiz.logOvertimeMap(overtimeLogMap, cross_time_list, flow_key+"|cross_time_list");
int[] initArrays_flow = Arrays.copyOfRange(initArrays,0,initArrays.length);
if(flow_fromdate.compareTo(realSplitDate) > 0){
flow_fromtime = kqTimesArrayComInfo.turn24to48Time(flow_fromtime);
}
if(flow_todate.compareTo(realSplitDate) > 0){
flow_totime = kqTimesArrayComInfo.turn24to48Time(flow_totime);
}
int flow_fromIndex = kqTimesArrayComInfo.getArrayindexByTimes(flow_fromtime);
int flow_toIndex = kqTimesArrayComInfo.getArrayindexByTimes(flow_totime);
//在已经出差、公出的区间1上覆盖2那么在有效出差、公出范围内是2的就是交集的部分
Arrays.fill(initArrays_flow, flow_fromIndex, flow_toIndex,2);
int across_mins = 0;
for(int i = 0 ; i < cross_time_list.size() ;) {
int cross_fromtime_index = cross_time_list.get(i);
int cross_totime_index = cross_time_list.get(i + 1);
//前面打卡区间段已经都被流程给覆盖了所以取获取打卡区间段内有多少流程的标识2就是交叉部分了
int flow_count = kqTimesArrayComInfo.getCnt(initArrays_flow, cross_fromtime_index, cross_totime_index, 2);
calBiz.logOvertimeMap(overtimeLogMap, flow_count, flow_key+"|取出差、公出和加班相交的时长|flow_count");
if(flow_count > 0){
List<Integer> flow_cross_time_list = Lists.newArrayList();
// 找到2表示找到流程开始的点了找到1表示找到流程结束的点了
calBiz.get_cross_time_list(flow_cross_time_list,initArrays_flow,cross_fromtime_index,cross_totime_index,2,1);
calBiz.logOvertimeMap(overtimeLogMap, flow_cross_time_list, flow_key+"|取出差、公出和加班相交的区间|flow_cross_time_list");
for(int j = 0 ; j < flow_cross_time_list.size() ;){
int flow_cross_fromtime_index = flow_cross_time_list.get(j);
int flow_cross_totime_index = flow_cross_time_list.get(j+1);
int mins = flow_cross_totime_index-flow_cross_fromtime_index;
if(mins <= 0){
String crossInfo = "flow_cross_fromtime_index:"+flow_cross_fromtime_index+":flow_cross_totime_index:"+flow_cross_totime_index+":mins:"+mins;
calBiz.logOvertimeMap(overtimeLogMap, crossInfo, flow_key+"|出差、公出时长小于最小加班时长|crossInfo");
continue;
}
across_mins += mins;
String flow_cross_key = "加班计算区间|"+kqTimesArrayComInfo.getTimesByArrayindex(flow_cross_fromtime_index)+"-"+kqTimesArrayComInfo.getTimesByArrayindex(flow_cross_totime_index);
calBiz.logOvertimeMap(overtimeLogMap, mins, flow_cross_key+"|原始加班区间生成的加班时长|mins");
String cross_fromtime = kqTimesArrayComInfo.getTimesByArrayindex(flow_cross_fromtime_index);
String cross_totime = kqTimesArrayComInfo.getTimesByArrayindex(flow_cross_totime_index);
String cross_fromdate = realSplitDate;
String cross_todate = realSplitDate;
boolean needSplitByTime = false;
if(needSplitByTime){
// 按照加班时长转调休的 时长设置 这个逻辑如果后面要开启来可以直接用的
List<String> timepointList = null;
if(kqOvertimeRulesDetailEntity != null){
timepointList = calBiz.get_timepointList(kqOvertimeRulesDetailEntity);
calBiz.logOvertimeMap(overtimeLogMap, timepointList, flow_cross_key+"|如果要生成调休且是根据时间区间来转调休,返回对应的时间区间|timepointList");
}
List<OvertimeBalanceTimeBean> overtimeBalanceTimeBeans = Lists.newArrayList();
if(timepointList != null && !timepointList.isEmpty()){
int[] time_initArrays = kqTimesArrayComInfo.getInitArr();
for(int t = flow_cross_fromtime_index;t < flow_cross_totime_index; t++){
time_initArrays[t] = initArrays_flow[t];
}
calBiz.get_overtimeBalanceTimeBeans(timepointList,overtimeBalanceTimeBeans,kqTimesArrayComInfo,time_initArrays,flow_cross_totime_index,flow_cross_fromtime_index,2);
}
String overtimeBalanceTimeBeansLogInfo = "";
if(overtimeBalanceTimeBeans == null || overtimeBalanceTimeBeans.isEmpty()){
}else{
overtimeBalanceTimeBeansLogInfo = JSON.toJSONString(overtimeBalanceTimeBeans);
}
calBiz.logOvertimeMap(overtimeLogMap, overtimeBalanceTimeBeansLogInfo, flow_cross_key+"|如果要生成调休且是根据时间区间来转调休,返回对应的时间区间对应的时长|overtimeBalanceTimeBeans");
if(overtimeBalanceTimeBeans != null && !overtimeBalanceTimeBeans.isEmpty()){
String bean_cross_fromtime = cross_fromtime;
String bean_cross_totime = cross_totime;
for(int timeIndex = 0 ; timeIndex < overtimeBalanceTimeBeans.size() ;timeIndex++){
OvertimeBalanceTimeBean overtimeBalanceTimeBean = overtimeBalanceTimeBeans.get(timeIndex);
String timePointStart = overtimeBalanceTimeBean.getTimepoint_start();
String timePointEnd = overtimeBalanceTimeBean.getTimepoint_end();
boolean isNeedTX = overtimeBalanceTimeBean.isNeedTX();
int timePointStart_index = kqTimesArrayComInfo.getArrayindexByTimes(timePointStart);
int timePointEnd_index = kqTimesArrayComInfo.getArrayindexByTimes(timePointEnd);
if(timePointStart_index > flow_cross_fromtime_index){
bean_cross_fromtime = kqTimesArrayComInfo.getTimesByArrayindex(timePointStart_index);
}else{
bean_cross_fromtime = cross_fromtime;
}
if(timePointEnd_index < flow_cross_totime_index){
bean_cross_totime = kqTimesArrayComInfo.getTimesByArrayindex(timePointEnd_index);
}else{
bean_cross_totime = cross_totime;
}
int timepoint_mins = overtimeBalanceTimeBean.getTimepoint_mins();
if(timepoint_mins == 0){
continue;
}
mins = timepoint_mins;
}
}
}else{
}
j =j + 2;
} }else{
}
i = i +2;
}
if(kqOvertimeRulesDetailEntity != null){
//我这个方法是针对每次生成的加班数据做排除休息时长的处理
restTimeType = kqOvertimeRulesDetailEntity.getRestTimeType();
if(restTimeType == 2){
across_mins = new KQOverTimeFlowBiz().handle_restlength(across_mins,restTimeMap,changeType_key);
}
}
int card_mins = over_count;
double double_mins = calBiz.getD_MinsByUnit((1.0*across_mins));
across_mins = (int)double_mins;
if(across_mins <= 0){
calBiz.logOvertimeMap(overtimeLogMap, across_mins, flow_key+"|经过单位换算之后时长为0|across_mins");
continue;
}
if(across_mins < minimumLen){
String minInfo = "across_mins:"+across_mins+":minimumLen:"+minimumLen;
calBiz.logOvertimeMap(overtimeLogMap, minInfo, flow_key+"|出差、公出时长小于最小加班时长|over_count<minimumUnit");
continue;
}
String overtime_uuid = UUID.randomUUID().toString();
String tiaoxiuId = "";
String flow_dataid = "";
int unit = KQOvertimeRulesBiz.getMinimumUnit();
String workingHours = "";
String overtime_type = splitBean.getOvertime_type();
Map<String,Object> otherParam = Maps.newHashMap();
otherParam.put("overtime_type", overtime_type);
int paidLeaveEnableType = kqOvertimeRulesDetailEntity.getPaidLeaveEnableType();
if(2 == paidLeaveEnableType){
calBiz.logOvertimeMap(overtimeLogMap, overtime_type, flow_key+"|关联调休与否来自于流程选择,加班类型下拉框值|overtime_type");
}
int paidLeaveEnable = calBiz.getPaidLeaveEnable(kqOvertimeRulesDetailEntity, overtime_type);
//目前不处理按照时间段生成调休
boolean needSplitByTime = false;//getNeedSplitByTime(kqOvertimeRulesDetailEntity, paidLeaveEnable);
if(needSplitByTime){
}else{
otherParam.put("overtimeLogMap", overtimeLogMap);
calBiz.logOvertimeMap(overtimeLogMap, across_mins, flow_key+"|最终生成的加班分钟数|overtime_mins");
tiaoxiuId = KQBalanceOfLeaveBiz.addExtraAmountByDis5(resourceid,realSplitDate,across_mins+"","0",workingHours,requestid,"1",realSplitDate,otherParam);
if(Util.getIntValue(tiaoxiuId) > 0){
kqLog.info("doComputingMode"+computingMode+" 生成调休成功调休id:"+tiaoxiuId+":resourceid:"+resourceid+":realSplitDate:"+realSplitDate);
}else{
kqLog.info("doComputingMode"+computingMode+" 生成调休失败调休id:"+tiaoxiuId+":resourceid:"+resourceid+":realSplitDate:"+realSplitDate);
}
calBiz.logOvertimeMap(overtimeLogMap, tiaoxiuId, flow_key+"|最终生成的调休id|tiaoxiuId");
String flow_overtime_sql = "insert into kq_flow_overtime (requestid,resourceid,fromdate,fromtime,todate,totime,duration_min,expiringdate,belongdate,"
+ "workMins,durationrule,changetype,paidLeaveEnable,computingMode,tiaoxiuId,uuid,fromdatedb,fromtimedb,todatedb,totimedb,flow_mins,card_mins,ori_belongdate,flow_dataid)"+
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
signinTime = kqTimesArrayComInfo.turn48to24Time(signinTime);
signoutTime = kqTimesArrayComInfo.turn48to24Time(signoutTime);
if(signinTime.length() == 5){
signinTime = signinTime+":00";
}
if(signoutTime.length() == 5){
signoutTime = signoutTime+":00";
}
rs.executeUpdate(flow_overtime_sql, requestid,resourceid,signinDate,signinTime,signoutDate,signoutTime,across_mins,"",realSplitDate,
"",unit,changeType,paidLeaveEnable,computingMode,tiaoxiuId,overtime_uuid,fromdatedb,fromtimedb,todatedb,totimedb,d_mins,card_mins,splitDate,flow_dataid);
String overtimeid = calBiz.get_overtime_uuid(overtime_uuid);
kqEventLogBiz.updateOvertimeId(uuid, overtimeid);
}
}
}else{
//有打卡没有流程
calBiz.logOvertimeMap(overtimeLogMap, mapKey, mapKey+"|"+"加班流程为空");
}
}else{
calBiz.logOvertimeMap(overtimeLogMap, overCountLogInfo, mapKey+"|"+"出差、公出数据时长为0");
}
}else{
String overCountLogInfo = "signinTimeIndex:"+signinTimeIndex+":signoutTimeIndex:"+signoutTimeIndex;
calBiz.logOvertimeMap(overtimeLogMap, overCountLogInfo, mapKey+"|"+"出差、公出数据异常");
}
}else{
calBiz.logOvertimeMap(overtimeLogMap, "出差、公出数据KQOvertimeCardBean为null", mapKey+"|"+"出差、公出和加班数据|KQOvertimeCardBean");
}
}
kqEventLogBiz.logDetailOvertimeMap(resourceid,overtimeLogMap,uuid);
kqEventLogBiz.logDetailEvent(resourceid,eventMap,uuid,"doComputingMode"+computingMode+"|对应的加班流程数据|key|"+key);
}
/**
*
* @param resourceid
* @param fromDate
* @param toDate
* @param dateFormatter
* @param kqTimesArrayComInfo
* @param overRulesDetailMap
* @param changeTypeMap
* @param lsCheckInfoMaps
* @param eventMap
*/
public void getFlowDataMap(String resourceid, String fromDate, String toDate,
DateTimeFormatter dateFormatter,
KQTimesArrayComInfo kqTimesArrayComInfo,
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap,
Map<String, Integer> changeTypeMap, Map<String, KQOvertimeCardBean> lsCheckInfoMaps,
Map<String, Object> eventMap) throws Exception{
KQOverTimeFlowBiz kqOverTimeFlowBiz = new KQOverTimeFlowBiz();
List<KqFlowSplitData> lsCheckInfos = Lists.newArrayList();
Map<String,String> result = getFlowData(resourceid, fromDate, dateFormatter,eventMap,lsCheckInfos,changeTypeMap,overRulesDetailMap);
//获取一下当天的上班时间
String firstworkTime = Util.null2String(result.get("firstworkTime"));
int pre_has_cut_point = Util.getIntValue(Util.null2String(result.get("pre_has_cut_point")));
String pre_cut_point = Util.null2String(result.get("pre_cut_point"));
int has_cut_point = Util.getIntValue(Util.null2String(result.get("has_cut_point")));
String cut_point = Util.null2String(result.get("cut_point"));
int before_startTime = Util.getIntValue(Util.null2String(result.get("before_startTime")));
int preChangeType = Util.getIntValue(Util.null2String(result.get("preChangeType")));
int changeType = Util.getIntValue(Util.null2String(result.get("changeType")));
LocalDate localbelongDate = LocalDate.parse(fromDate);
String splitDate = localbelongDate.format(dateFormatter);
LocalDate preLocalDate = localbelongDate.minusDays(1);
String preSplitDate = preLocalDate.format(dateFormatter);
String nextSplitDate = localbelongDate.plusDays(1).format(dateFormatter);
String preKey = resourceid+"_"+preSplitDate;
String key = resourceid+"_"+splitDate;
String nextkey = resourceid+"_"+nextSplitDate;
eventMap.put("key:"+key+"|lsCheckInfos", lsCheckInfos);
if(!lsCheckInfos.isEmpty()){
KqFlowSplitData flowBean = (KqFlowSplitData) lsCheckInfos.get(0);
String signindate = "";
String signintime = "";
String signoutdate = "";
String signouttime = "";
if(flowBean != null){
signindate = flowBean.getFromdate();
signintime = flowBean.getFromtime();
signoutdate = flowBean.getTodate();
signouttime = flowBean.getTotime();
if(lsCheckInfos.size() > 1){
Map<String, Object> lastSignMap = (Map<String, Object>) lsCheckInfos.get(lsCheckInfos.size()-1);
signoutdate = Util.null2String(lastSignMap.get("signoutdate"));
signouttime = Util.null2String(lastSignMap.get("signouttime"));
}
}
KQOvertimeCardBean kqOvertimeBean = new KQOvertimeCardBean();
kqOvertimeBean.setSigninDate(signindate);
kqOvertimeBean.setSigninTime(signintime);
kqOvertimeBean.setSignoutDate(signoutdate);
kqOvertimeBean.setSignoutTime(signouttime);
kqOvertimeBean.setBelongDate(splitDate);
eventMap.put("pre_has_cut_point", pre_has_cut_point);
eventMap.put("has_cut_point", has_cut_point);
if(pre_has_cut_point == 0){
//未设置打卡归属
if(preChangeType == 2){
eventMap.put("preChangeType", preChangeType);
//如果前一天是工作日
String pre_overtime_cut_point = "";
ShiftInfoBean pre_shiftInfoBean = KQDurationCalculatorUtil
.getWorkTime(resourceid, preSplitDate, false);
if(pre_shiftInfoBean != null){
List<int[]> workLongTimeIndex = pre_shiftInfoBean.getWorkLongTimeIndex();
List<int[]> real_workLongTimeIndex = Lists.newArrayList();
SplitBean splitBean = new SplitBean();
splitBean.setResourceId(resourceid);
kqOverTimeFlowBiz.get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,pre_shiftInfoBean,kqTimesArrayComInfo,splitBean);
if(real_workLongTimeIndex != null && !real_workLongTimeIndex.isEmpty()){
pre_overtime_cut_point = kqTimesArrayComInfo.getTimesByArrayindex(real_workLongTimeIndex.get(0)[0]);
}
eventMap.put("pre_overtime_cut_point", pre_overtime_cut_point);
if(pre_overtime_cut_point.length() >= 0){
calBiz.rePutCheckInfoMap(lsCheckInfoMaps, kqOvertimeBean, preKey, key, pre_overtime_cut_point, splitDate,eventMap);
}
}else{
String errorMsg = "前一天是工作日但是前一天的ShiftInfoBean班次获取不到信息";
eventMap.put("errorMsg", errorMsg);
}
}else {
eventMap.put("changeType", changeType);
if(changeType == 2){
eventMap.put("firstworkTime", firstworkTime);
if(has_cut_point == 1 && before_startTime > 0){
firstworkTime = kqTimesArrayComInfo.getTimesByArrayindex(kqTimesArrayComInfo.getArrayindexByTimes(firstworkTime)-before_startTime);
}
//如果前一天是非工作日,今天是工作日的话
calBiz.rePutCheckInfoMap(lsCheckInfoMaps, kqOvertimeBean, preKey, key, firstworkTime, splitDate,
eventMap);
}else{
//如果前一天是非工作日,今天是非工作日的话,那就是打卡获取的是啥就是啥
lsCheckInfoMaps.put(key, kqOvertimeBean);
}
}
}else{
String pre_splittime = "";
List<KqFlowSplitData> pre_lsCheckInfos = Lists.newArrayList();
getFlowData(resourceid, preSplitDate, dateFormatter, eventMap, pre_lsCheckInfos, changeTypeMap, overRulesDetailMap);
if(!pre_lsCheckInfos.isEmpty()){
KqFlowSplitData preFlowBean = (KqFlowSplitData) pre_lsCheckInfos.get(0);
String pre_signindate = "";
String pre_signintime = "";
String pre_signoutdate = "";
String pre_signouttime = "";
if(preFlowBean != null){
pre_signindate = preFlowBean.getFromdate();
pre_signintime = preFlowBean.getFromtime();
pre_signoutdate = preFlowBean.getTodate();
pre_signouttime = preFlowBean.getTotime();
if(pre_signindate.length() > 0 && pre_signintime.length() > 0){
pre_splittime = pre_signindate+" "+pre_signintime;
}else if(pre_signoutdate.length() > 0 && pre_signouttime.length() > 0){
pre_splittime = pre_signoutdate+" "+pre_signouttime;
}
}
}
eventMap.put("pre_cut_point", pre_cut_point);
//设置了打卡归属 那么一天的打卡就可能被前一天给拆成两部分和后一天的打卡归属给拆分成两部分
calBiz.rePutCheckInfoCutPointMap(lsCheckInfoMaps, kqOvertimeBean, preKey, key, pre_cut_point, splitDate,
eventMap,cut_point,nextSplitDate,nextkey,has_cut_point,pre_splittime);
}
}
}
/**
*
* @param resourceid
* @param belongDate
* @param dateFormatter
* @param eventMap
* @param lsCheckInfos
* @param changeTypeMap
* @param overRulesDetailMap
*/
private Map<String, String> getFlowData(String resourceid, String belongDate,
DateTimeFormatter dateFormatter, Map<String, Object> eventMap,
List<KqFlowSplitData> lsCheckInfos, Map<String, Integer> changeTypeMap,
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap) throws Exception{
Map<String,String> result = Maps.newHashMap();
String firstworkDate = belongDate;
String firstworkTime = "";
KQWorkTime kqWorkTime = new KQWorkTime();
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceid, belongDate);
if(workTime == null || workTime.getWorkMins() == 0) {
firstworkTime = "00:00";
} else if(workTime.getKQType().equals("3")) {
firstworkTime = StringUtil.vString(workTime.getSignStart());
} else {
List<TimeScopeEntity> lsWorkTime = workTime.getWorkTime();
for(TimeScopeEntity time : lsWorkTime) {
firstworkTime = StringUtil.vString(time.getBeginTime());
break;
}
}
LocalDate localbelongDate = LocalDate.parse(belongDate);
String splitDate = localbelongDate.format(dateFormatter);
LocalDate preLocalDate = localbelongDate.minusDays(1);
String preSplitDate = preLocalDate.format(dateFormatter);
String change_key = splitDate+"_"+resourceid;
String preChange_key = preSplitDate+"_"+resourceid;
int changeType = Util.getIntValue(""+changeTypeMap.get(change_key),-1);
int preChangeType = Util.getIntValue(""+changeTypeMap.get(preChange_key),-1);
String changeType_key = splitDate+"_"+changeType;
String preChangeType_key = preSplitDate+"_"+preChangeType;
KQOvertimeRulesDetailEntity curKqOvertimeRulesDetailEntity = overRulesDetailMap.get(changeType_key);
KQOvertimeRulesDetailEntity preKqOvertimeRulesDetailEntity = overRulesDetailMap.get(preChangeType_key);
int pre_has_cut_point = 0;
String pre_cut_point = "";
if(preKqOvertimeRulesDetailEntity != null){
pre_has_cut_point = preKqOvertimeRulesDetailEntity.getHas_cut_point();
pre_cut_point = preKqOvertimeRulesDetailEntity.getCut_point();
}
int has_cut_point = 0;
String cut_point = "";
int before_startTime = -1;
if(curKqOvertimeRulesDetailEntity != null){
has_cut_point = curKqOvertimeRulesDetailEntity.getHas_cut_point();
cut_point = curKqOvertimeRulesDetailEntity.getCut_point();
before_startTime =curKqOvertimeRulesDetailEntity.getBefore_startTime();
}
result.put("pre_has_cut_point", ""+pre_has_cut_point);
result.put("pre_cut_point", pre_cut_point);
result.put("has_cut_point", ""+has_cut_point);
result.put("cut_point", cut_point);
result.put("before_startTime", ""+before_startTime);
result.put("preChangeType", ""+preChangeType);
result.put("changeType", ""+changeType);
lsCheckInfos.addAll(getFlowInfo(resourceid,splitDate,eventMap));
if(firstworkDate.length() > 0 && firstworkTime.length() > 0){
result.put("firstworkDate", firstworkDate);
result.put("firstworkTime", firstworkTime);
}
return result;
}
/**
*
* @param userId
* @param kqDate
* @param eventMap
* @return
*/
private List<KqFlowSplitData> getFlowInfo(String userId, String kqDate, Map<String, Object> eventMap) {
List<KqFlowSplitData> list = Lists.newArrayList();
RecordSet rs = new RecordSet();
StringBuffer sql = new StringBuffer().append("select t.* from (")
.append(" select t.resourceid, t.fromdate, t.fromtime, t.todate, t.totime, t.belongDate from kq_flow_split_evection t where t.resourceid = ? and t.belongDate = ?")
.append(" UNION ALL")
.append(" select t.resourceid, t.fromdate, t.fromtime, t.todate, t.totime, t.belongDate from kq_flow_split_out t where t.resourceid = ? and t.belongDate = ?")
.append(") t order by t.resourceid, t.fromdate, t.fromtime");
rs.executeQuery(sql.toString(), userId, kqDate, userId, kqDate);
String work_card_sql = "sql:"+sql.toString()+"|resourceid|"+userId+"|kqDate|"+kqDate;
eventMap.put("出差、公出sql|work_card_sql", work_card_sql);
eventMap.put("出差、公出sql结果|work_card_sql_getCounts", rs.getCounts());
while (rs.next()) {
KqFlowSplitData bean = new KqFlowSplitData();
bean.setResourceid(StringUtil.vString(rs.getString("resourceid")));
bean.setBelongdate(StringUtil.vString(rs.getString("belongDate")));
bean.setFromdate(StringUtil.vString(rs.getString("fromdate")));
bean.setFromtime(StringUtil.vString(rs.getString("fromtime")));
bean.setTodate(StringUtil.vString(rs.getString("todate")));
bean.setTotime(StringUtil.vString(rs.getString("totime")));
list.add(bean);
}
return list;
}
class KqFlowSplitData {
private String resourceid;
private String belongdate;
private String fromdate;
private String fromtime;
private String todate;
private String totime;
public String getResourceid() {
return resourceid;
}
public void setResourceid(String resourceid) {
this.resourceid = resourceid;
}
public String getBelongdate() {
return belongdate;
}
public void setBelongdate(String belongdate) {
this.belongdate = belongdate;
}
public String getKey() {
return resourceid + "_"+ belongdate;
}
public String getFromdate() {
return fromdate;
}
public void setFromdate(String fromdate) {
this.fromdate = fromdate;
}
public String getFromtime() {
return fromtime;
}
public void setFromtime(String fromtime) {
this.fromtime = fromtime;
}
public String getTodate() {
return todate;
}
public void setTodate(String todate) {
this.todate = todate;
}
public String getTotime() {
return totime;
}
public void setTotime(String totime) {
this.totime = totime;
}
}
/**
*
* @param params
* @param user
*/
public String buildTableString4CustomOvertimeFlow(Map<String, Object> params, User user) {
String backfields = " * ";
String fromDate = Util.null2String(params.get("fromDate"));
String toDate = Util.null2String(params.get("toDate"));
String typeselect =Util.null2String(params.get("typeselect"));
String belongdateWhere = "";
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");
}
}
if (fromDate.length() > 0 && toDate.length() > 0){
belongdateWhere += " and ( belongdate between '"+fromDate+"' and '"+toDate+"' or belongdate between '"+fromDate+"' and '"+toDate+"' "
+ " or '"+fromDate+"' between belongdate and belongdate or '"+toDate+"' between belongdate and belongdate) ";
}
String overtimeTable = " select requestid,resourceid,fromdate,fromtime,todate,totime,fromdatedb,fromtimedb,todatedb,totimedb,computingmode,paidLeaveEnable,expiringdate,duration_min,durationrule from kq_flow_overtime where computingmode = "+computingMode+" "+(belongdateWhere.length() == 0 ? "" :belongdateWhere);
String fromSql = " (select b.lastname,b.loginid,b.subcompanyid1,b.departmentid,b.jobtitle,b.managerid,b.managerstr,a.* from ("+overtimeTable+") a left join hrmresource b on a.resourceid = b.id) f ";
String sqlWhere = " 1=1 ";
String tableString = "";
String tabletype="none";
String orderby = " computingmode ";
String tabkey = Util.null2String(params.get("tabKey"));
int kqtype = Util.getIntValue(Util.null2String(params.get("kqtype")),-1);
String resourceId = Util.null2String(params.get("resourceId"));
String subCompanyId = Util.null2String(params.get("subCompanyId"));
String departmentId = Util.null2String(params.get("departmentId"));
//来自我的考勤,resourceid为空时默认取当前用户的id
String source =Util.null2String(params.get("source"));
if(source.equals("isMyKq")){
if(resourceId.equals("")){
resourceId = user.getUID()+"";
}
}
String keyWord = Util.null2String(params.get("keyWord"));
String requestId =Util.null2String(params.get("requestId"));
String viewScope = Util.null2String(params.get("viewScope"));
String allLevel = Util.null2String(params.get("allLevel"));
String isNoAccount = Util.null2String(params.get("isNoAccount"));
String isMyKQ = Util.null2String(params.get("isMyKQ"));
boolean isFinished = false;
if("1".equalsIgnoreCase(tabkey)){
//已归档
isFinished = true;
}
if (keyWord.length() > 0){
sqlWhere += " and lastname = "+keyWord;
}
if(resourceId.length() > 0){
sqlWhere += " and resourceId in("+resourceId+")";
}
if(subCompanyId.length()>0){
sqlWhere +=" and subcompanyid1 in("+subCompanyId+") ";
}
if(departmentId.length()>0){
sqlWhere +=" and departmentid in("+departmentId+") ";
}
if(viewScope.equals("4")){//我的下属
if(allLevel.equals("1")){//所有下属
sqlWhere+=" and managerstr like '%,"+user.getUID()+",%'";
}else{
sqlWhere+=" and managerid="+user.getUID();//直接下属
}
}
if (!"1".equals(isNoAccount)) {
sqlWhere += " and loginid is not null "+(new RecordSet().getDBType().equals("oracle")?"":" and loginid<>'' ");
}
String rightSql = new KQReportBiz().getReportRight("1",""+user.getUID(),"aa");
String hrmSql = " select id from hrmresource aa where 1=1 "+rightSql;
if (null != rightSql && rightSql.length()>0) {
sqlWhere += " and resourceId in("+hrmSql+")";
}
new KQLog().info("KQ_OvertimeTotal_Detail_FlowInCard>>>>>>backfields:"+backfields+">>>>>fromSql:"+fromSql +">>>>>sqlWhere:"+sqlWhere);
String otherPram = user.getLanguage()+"";
String timePram = "column:fromtime+column:todate+column:totime";
String fromTimePram = kqtype+"+0+"+user.getLanguage()+"++column:durationrule";
String toTimePram = kqtype+"+1+"+user.getLanguage()+"++column:durationrule";
String pageUid = "dfb4c634-5769-432f-a65e-787b99ab9872";//UUID.randomUUID()
tableString =" <table pageUid=\""+pageUid+"\" tabletype=\""+tabletype+"\" pagesize=\"10\" >"+
" <sql backfields=\""+backfields+"\" sqlform=\""+fromSql+"\" sqlwhere=\""+Util.toHtmlForSplitPage(sqlWhere)+"\" sqlorderby=\""+orderby+"\" sqlprimarykey=\"a.id\" sqlsortway=\"desc\" sqlisdistinct=\"false\"/>"+
" <head>";
tableString += " <col width=\"10%\" text=\""+ SystemEnv.getHtmlLabelName(413,user.getLanguage()) +"\" column=\"lastname\" orderkey=\"lastname\" />";
tableString += " <col width=\"10%\" text=\""+ SystemEnv.getHtmlLabelName(714,user.getLanguage()) +"\" column=\"resourceId\" orderkey=\"resourceId\" transmethod=\"weaver.hrm.resource.ResourceComInfo.getWorkcode\" />";
tableString += " <col width=\"10%\" text=\""+ SystemEnv.getHtmlLabelName(124,user.getLanguage()) +"\" column=\"departmentId\" orderkey=\"departmentId\" transmethod=\"weaver.hrm.company.DepartmentComInfo.getDepartmentname\" />";
tableString += " <col width=\"10%\" text=\""+ SystemEnv.getHtmlLabelName(740,user.getLanguage()) +"\" column=\"fromdatedb\" orderkey=\"fromdatedb\" transmethod=\"com.engine.kq.util.TransMethod.getRequestLink\" otherpara=\"column:requestid\" />";
tableString += " <col width=\"10%\" text=\""+ SystemEnv.getHtmlLabelName(742,user.getLanguage()) +"\" column=\"fromtimedb\" orderkey=\"fromtimedb\" transmethod=\"com.engine.kq.util.TransMethod.getFlowTimeByUnit\" otherpara=\""+fromTimePram+"\" />";
tableString += " <col width=\"10%\" text=\""+ SystemEnv.getHtmlLabelName(741,user.getLanguage()) +"\" column=\"todatedb\" orderkey=\"todatedb\" />";
tableString += " <col width=\"10%\" text=\""+ SystemEnv.getHtmlLabelName(743,user.getLanguage()) +"\" column=\"totimedb\" orderkey=\"totimedb\" transmethod=\"com.engine.kq.util.TransMethod.getFlowTimeByUnit\" otherpara=\""+toTimePram+"\" />";
tableString += " <col width=\"20%\" text=\""+ SystemEnv.getHtmlLabelName(536756,user.getLanguage()) +"\" column=\"fromdate\" orderkey=\"fromdate\" transmethod=\"com.engine.kq.util.TransMethod.getOvertimeCard\" otherpara=\""+timePram+"\" />";
tableString += " <col width=\"10%\" text=\""+ SystemEnv.getHtmlLabelName(509604,user.getLanguage()) +"\" column=\"duration_min\" orderkey=\"duration_min\" transmethod=\"com.engine.kq.util.TransMethod.getDuration_minByUnit\" />";
tableString += " <col width=\"10%\" text=\""+ SystemEnv.getHtmlLabelName(125804,user.getLanguage()) +"\" column=\"paidLeaveEnable\" orderkey=\"paidLeaveEnable\" transmethod=\"com.engine.kq.util.TransMethod.getPaidLeaveEnable\" otherpara=\""+otherPram+"\" />";
tableString +=" </head>"+
" </table>";
String sessionkey = pageUid + "_" + Util.getEncrypt(Util.getRandom());
Util_TableMap.setVal(sessionkey, tableString);
return sessionkey;
}
}
Loading…
Cancel
Save