|
|
|
@ -1,13 +1,19 @@
|
|
|
|
|
package com.engine.kq.nbjh;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.engine.kq.biz.KQLeaveRulesComInfo;
|
|
|
|
|
import com.engine.kq.biz.KQWorkTime;
|
|
|
|
|
import weaver.common.DateUtil;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.general.TimeUtil;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
import weaver.systeminfo.SystemEnv;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Title
|
|
|
|
@ -18,6 +24,135 @@ import java.text.SimpleDateFormat;
|
|
|
|
|
*/
|
|
|
|
|
public class KqUtil {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取 实际出勤天数(带有哺乳假流程的,提前打卡的情况)
|
|
|
|
|
* @param resourceId
|
|
|
|
|
* @param fromdate
|
|
|
|
|
* @param todate
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public static double getAttendancedays(String resourceId,String fromdate,String todate,User user){
|
|
|
|
|
double result = 0.00;
|
|
|
|
|
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, "+
|
|
|
|
|
" leaveMins,leaveInfo,evectionMins,outMins " +
|
|
|
|
|
" from kq_format_detail " +
|
|
|
|
|
" where resourceid = ? and kqdate>=? and kqdate<=? "+
|
|
|
|
|
" order by resourceid, kqdate, serialnumber ";
|
|
|
|
|
rs.executeQuery(sql,resourceId,fromdate,todate);
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String userid = rs.getString("resourceid");
|
|
|
|
|
String kqdate = rs.getString("kqdate");
|
|
|
|
|
int workMins = rs.getInt("workMins");
|
|
|
|
|
int beLateMins = rs.getInt("beLateMins");
|
|
|
|
|
int leaveEarlyMins = rs.getInt("leaveEarlyMins");
|
|
|
|
|
int graveBeLateMins = rs.getInt("graveBeLateMins");
|
|
|
|
|
int absenteeismMins = rs.getInt("absenteeismMins");
|
|
|
|
|
int graveLeaveEarlyMins = rs.getInt("graveLeaveEarlyMins");
|
|
|
|
|
int forgotCheckMins = rs.getInt("forgotCheckMins");
|
|
|
|
|
int forgotBeginWorkCheckMins = rs.getInt("forgotBeginWorkCheckMins");
|
|
|
|
|
int leaveMins = rs.getInt("leaveMins");
|
|
|
|
|
String leaveInfo = rs.getString("leaveInfo");
|
|
|
|
|
int evectionMins = rs.getInt("evectionMins");
|
|
|
|
|
int outMins = rs.getInt("outMins");
|
|
|
|
|
|
|
|
|
|
// 判断 指定日期 是否在 哺乳假流程 日期范围内
|
|
|
|
|
boolean bool = checkIsBetweenRange(userid,kqdate);
|
|
|
|
|
String text = "";
|
|
|
|
|
|
|
|
|
|
if (workMins<=0) {
|
|
|
|
|
if(text.length()>0) text +=" ";
|
|
|
|
|
text += SystemEnv.getHtmlLabelName(26593, user.getLanguage());
|
|
|
|
|
} else {
|
|
|
|
|
if (absenteeismMins > 0) {//旷工
|
|
|
|
|
if(text.length()>0) text+=" ";
|
|
|
|
|
text += SystemEnv.getHtmlLabelName(20085, user.getLanguage());
|
|
|
|
|
}else {
|
|
|
|
|
if (beLateMins > 0) {//迟到
|
|
|
|
|
if (text.length() > 0) text += " ";
|
|
|
|
|
text += SystemEnv.getHtmlLabelName(20081, user.getLanguage());
|
|
|
|
|
}
|
|
|
|
|
if (graveBeLateMins > 0) {//严重迟到
|
|
|
|
|
if (text.length() > 0) text += " ";
|
|
|
|
|
text += SystemEnv.getHtmlLabelName(500546, user.getLanguage());
|
|
|
|
|
}
|
|
|
|
|
if (leaveEarlyMins > 0) {//早退
|
|
|
|
|
if (text.length() > 0) text += " ";
|
|
|
|
|
text += SystemEnv.getHtmlLabelName(20082, user.getLanguage());
|
|
|
|
|
}
|
|
|
|
|
if (graveLeaveEarlyMins > 0) {//严重早退
|
|
|
|
|
if (text.length() > 0) text += " ";
|
|
|
|
|
text += SystemEnv.getHtmlLabelName(500547, user.getLanguage());
|
|
|
|
|
}
|
|
|
|
|
if (forgotCheckMins > 0) {//漏签
|
|
|
|
|
if (text.length() > 0) text += " ";
|
|
|
|
|
text += SystemEnv.getHtmlLabelName(20086, user.getLanguage());
|
|
|
|
|
}
|
|
|
|
|
if (forgotBeginWorkCheckMins > 0) {//漏签
|
|
|
|
|
if (text.length() > 0) text += " ";
|
|
|
|
|
text += SystemEnv.getHtmlLabelName(20086, user.getLanguage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (leaveMins > 0) {//请假
|
|
|
|
|
Map<String, Object> jsonObject = null;
|
|
|
|
|
if(leaveInfo.length()>0){
|
|
|
|
|
jsonObject = JSON.parseObject(leaveInfo);
|
|
|
|
|
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
|
|
|
|
|
String newLeaveType = entry.getKey();
|
|
|
|
|
String tmpLeaveMins = Util.null2String(entry.getValue());
|
|
|
|
|
if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){
|
|
|
|
|
if (text.length() > 0) text += " ";
|
|
|
|
|
text += Util.formatMultiLang( kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) {
|
|
|
|
|
if (text.length() > 0) text += " ";
|
|
|
|
|
text += SystemEnv.getHtmlLabelName(670, user.getLanguage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (evectionMins > 0) {//出差
|
|
|
|
|
if(text.indexOf(SystemEnv.getHtmlLabelName(20084, user.getLanguage()))==-1) {
|
|
|
|
|
if (text.length() > 0) text += " ";
|
|
|
|
|
text += SystemEnv.getHtmlLabelName(20084, user.getLanguage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (outMins > 0) {//公出
|
|
|
|
|
if(text.indexOf(SystemEnv.getHtmlLabelName(24058, user.getLanguage()))==-1) {
|
|
|
|
|
if (text.length() > 0) text += " ";
|
|
|
|
|
text += SystemEnv.getHtmlLabelName(24058, user.getLanguage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(text.length()==0) {
|
|
|
|
|
result += 1;
|
|
|
|
|
}else{
|
|
|
|
|
//包含 漏签、早退、严重早退、迟到、严重迟到
|
|
|
|
|
if(checkHasSignInfo(userid,kqdate)) {
|
|
|
|
|
//当天有 哺乳假 或者 当天 在哺乳假的日期范围内
|
|
|
|
|
if(bool) {
|
|
|
|
|
result += 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rs.writeLog("================== KqUtil getAttendancedays ==================== "+ result);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean checkHasSignInfo(String userid,String date){
|
|
|
|
|
boolean bool = false;
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
rs.executeQuery("select * from HrmScheduleSign where userId=? and signDate=?",userid,date);
|
|
|
|
|
if(rs.next()){
|
|
|
|
|
bool = true;
|
|
|
|
|
}
|
|
|
|
|
return bool;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断日期是否在 哺乳假流程日期范围内
|
|
|
|
|
* @param userid
|
|
|
|
@ -170,5 +305,21 @@ public class KqUtil {
|
|
|
|
|
return bool;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 方法描述 : 对两个字符串进行金额的相加
|
|
|
|
|
* @param a
|
|
|
|
|
* @param b
|
|
|
|
|
* @return
|
|
|
|
|
* String
|
|
|
|
|
*/
|
|
|
|
|
public static String floatAdd(String a, String b) {
|
|
|
|
|
a=a.equals("")?"0":a;
|
|
|
|
|
b=b.equals("")?"0":b;
|
|
|
|
|
BigDecimal bg1 = new BigDecimal(a);
|
|
|
|
|
BigDecimal bg2 = new BigDecimal(b);
|
|
|
|
|
BigDecimal bd = bg1.add(bg2);
|
|
|
|
|
return bd.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|