10.10考勤优化

dev-zm
zhangming 6 months ago
parent 71072bae31
commit 70f4538f39

@ -100,6 +100,26 @@ public class HandleCBDataThread extends BaseBean implements Runnable{
if (cnt > 0) {
return;
}
// 判断是否关账, 关账则不更新
int userSubCompany1 = 0;
int userDepartment = 0;
if (userSubCompany1 <= 0 || userDepartment <= 0) {
rs.execute("select departmentid, subcompanyid1 from hrmresource where id = " + userId);
if (rs.next()) {
userSubCompany1 = rs.getInt("subcompanyid1");
userDepartment = rs.getInt("departmentid");
}
}
String gzSql = "select count(*) as cnt from uf_kqfz where (','+CAST(bm AS varchar(max))+',' like '%,'+CAST("+userDepartment+" AS varchar(10))+',%' " +
"or ','+CAST(fb AS varchar(max))+',' like '%,'+CAST("+userSubCompany1+" AS varchar(10))+',%') and fczt = 1 and fzksrq <= '" + kqDate +"' and fzjsrq >= '" + kqDate + "'";
rs.execute(gzSql);
int cntTemp = 0;
if (rs.next()) {
cntTemp = rs.getInt("cnt");
}
if (cntTemp > 0) {
return;
}
//获取加班时长
Map<String,Object> dailyFlowOverTimeData = getDailyFlowOverTimeDataAllowance(userId, kqDate);

@ -1015,7 +1015,28 @@ public class KQFormatData extends BaseBean {
/*考勤二开--零点补助start*/
int zeroPointSub = 0;
// 判断是否关账
RecordSet rs = new RecordSet();
int userSubCompany1 = 0;
int userDepartment = 0;
if (userSubCompany1 <= 0 || userDepartment <= 0) {
rs.execute("select departmentid, subcompanyid1 from hrmresource where id = " + userId);
if (rs.next()) {
userSubCompany1 = rs.getInt("subcompanyid1");
userDepartment = rs.getInt("departmentid");
}
}
String gzSql = "select count(*) as cnt from uf_kqfz where (','+CAST(bm AS varchar(max))+',' like '%,'+CAST("+userDepartment+" AS varchar(10))+',%' " +
"or ','+CAST(fb AS varchar(max))+',' like '%,'+CAST("+userSubCompany1+" AS varchar(10))+',%') and fczt = 1 and fzksrq <= '" + kqDate +"' and fzjsrq >= '" + kqDate + "'";
rs.execute(gzSql);
boolean isClose = false;
if (rs.next()) {
int cnt = rs.getInt("cnt");
if (cnt > 0) {
isClose = true;
}
}
if (!isClose) {
Map<String, Object> groupMap = new HashMap<>();
String acqSql = "select kqgroup, grouptype from uf_ZeroPointSubSft";
rs.executeQuery(acqSql);
@ -1171,6 +1192,16 @@ public class KQFormatData extends BaseBean {
if (offGood && inGood) {
zeroPointSub = 1;
}
} else {
rs.executeQuery("select zeropoint from kq_format_total where resourceid = ? and kqdate = ?", userId, kqDate);
if (rs.next()) {
String value = rs.getString("zeropoint");
if (StringUtils.isEmpty(value)) {
value = "0";
}
zeroPointSub = Integer.parseInt(value);
}
}
bb.writeLog("zeroPointSub: " + zeroPointSub);
/*考勤二开--零点补助end*/

@ -291,10 +291,10 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
bb.writeLog("params: " + params);
bb.writeLog("signdate: " + signDate);
//先判断是否有外出出差流程
String evectionTableName = Util.null2String(bb.getPropValue("project_hostar","evectionTableName"));
String outTableName = Util.null2String(bb.getPropValue("project_hostar","outTableName"));
String evectionTableName = Util.null2String(bb.getPropValue("project_hostar", "evectionTableName"));
String outTableName = Util.null2String(bb.getPropValue("project_hostar", "outTableName"));
if ( StringUtils.isNotBlank(evectionTableName) && StringUtils.isNotBlank(outTableName) ) {
if (StringUtils.isNotBlank(evectionTableName) && StringUtils.isNotBlank(outTableName)) {
Integer number = 0;
String sqlDate = "";
if (StringUtils.isNotBlank(belongdate)) {
@ -307,7 +307,7 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
// +userId+" AS varchar(10))+',%') and ksrq <='" + sqlDate + "' and (((sjjsrq is null or sjjsrq = '') and yjjsrq >= '"
// + sqlDate + "') or (sjjsrq is not null and sjjsrq != '' and sjjsrq >= '" + sqlDate + "'))) ";
String acqEvecAndOutSql = " SELECT requestid,kssj FROM " + evectionTableName + " WHERE (sjccr = '" + userId + "' or ','+CAST(nbtxr AS varchar(max))+',' like '%,'+CAST("
+userId+" AS varchar(10))+',%') and ksrq <='" + sqlDate + "' and (((sjjsrq is null or sjjsrq = '') and yjjsrq >= '"
+ userId + " AS varchar(10))+',%') and ksrq <='" + sqlDate + "' and (((sjjsrq is null or sjjsrq = '') and yjjsrq >= '"
+ sqlDate + "') or (sjjsrq is not null and sjjsrq != '' and sjjsrq >= '" + sqlDate + "')) ";
// " AND currentnodetype = 3 " +
// " UNION all " +
@ -352,6 +352,33 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
bb.writeLog("number: " + number);
if (number > 0) {
// 判断是否关账
int userSubCompany1 = user.getUserSubCompany1();
int userDepartment = user.getUserDepartment();
if (userSubCompany1 <= 0 || userDepartment <= 0) {
rs.execute("select departmentid, subcompanyid1 from hrmresource where id = " + userId);
if (rs.next()) {
userSubCompany1 = rs.getInt("subcompanyid1");
userDepartment = rs.getInt("departmentid");
}
}
String sqlDateA = "";
if (StringUtils.isNotBlank(belongdate)) {
sqlDateA = belongdate;
} else {
sqlDateA = signDate;
}
String gzSql = "select count(*) as cnt from uf_kqfz where (','+CAST(bm AS varchar(max))+',' like '%,'+CAST("+userDepartment+" AS varchar(10))+',%' " +
"or ','+CAST(fb AS varchar(max))+',' like '%,'+CAST("+userSubCompany1+" AS varchar(10))+',%') and fczt = 1 and fzksrq <= '" + sqlDateA +"' and fzjsrq >= '" + sqlDateA + "'";
rs.execute(gzSql);
boolean isClose = false;
if (rs.next()) {
int cnt = rs.getInt("cnt");
if (cnt > 0) {
isClose = true;
}
}
if (!isClose) {
boolean isInIp = true;
String userType = user.getLogintype();
String signType = "on".equalsIgnoreCase(type) ? "1" : "2";
@ -359,37 +386,37 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
String isInCom = isInIp ? "1" : "0";
JSONObject jsonObject = null;
String deviceInfo = Util.null2String(params.get("deviceInfo"));
if(deviceInfo.length() > 0){
if (deviceInfo.length() > 0) {
jsonObject = JSON.parseObject(deviceInfo);
JSONObject jsonObject1 = new JSONObject();
Set<Entry<String, Object>> jsonSet = jsonObject.entrySet();
for(Entry<String, Object> js : jsonSet){
for (Entry<String, Object> js : jsonSet) {
String key = js.getKey();
String value = Util.null2String(js.getValue());
jsonObject1.put(key, value);
}
if(!jsonObject1.isEmpty()){
if (!jsonObject1.isEmpty()) {
deviceInfo = jsonObject1.toJSONString();
}
}
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,isdev) "+
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,isdev) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
boolean isok = rs.executeUpdate(punchSql,userId,userType,signType,signDate,signTime,clientAddress,isInCom,
timeZone,belongdate,signfrom,longitude,latitude,address,deviceInfo,"1");
boolean isok = rs.executeUpdate(punchSql, userId, userType, signType, signDate, signTime, clientAddress, isInCom,
timeZone, belongdate, signfrom, longitude, latitude, address, deviceInfo, "1");
bb.writeLog("isok: " + isok);
//自动对班
kqLog.info("PunchOutButtonCmd.format in >>>>>userId" + userId + "kqDate==" + signDate+"format.groupId:"+groupid+"format.serialId:"+workTimeEntity.getSerialId());
kqLog.info("PunchOutButtonCmd.format in >>>>>userId" + userId + "kqDate==" + signDate + "format.groupId:" + groupid + "format.serialId:" + workTimeEntity.getSerialId());
//责任制考勤组id收集
rs.executeQuery("select kqzid from uf_zrzkqz");
while (rs.next()){
while (rs.next()) {
LIST.add(Util.null2String(rs.getString("kqzid")));
}
kqLog.info("PunchOutButtonCmd.LIST"+LIST);
if(LIST.contains(groupid)) {
kqLog.info("PunchOutButtonCmd.LIST" + LIST);
if (LIST.contains(groupid)) {
RecordSet rt = new RecordSet();
boolean b;
BaseBean bb= new BaseBean();
BaseBean bb = new BaseBean();
//休息日或节假日给休息班次
//int changeType = KQOvertimeRulesBiz.getChangeType(Util.null2String(userId), signDate);
String fixedSerialid = Util.null2String(bb.getPropValue("project_hostar", "fixedSerialid"));
@ -399,54 +426,55 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
String fixedUserId = "";
//查询指定和考勤组成员
String query_sql = "select distinct typevalue from kq_groupmember where groupid = ? ";
rs.executeQuery(query_sql,fixedSerialid);
rs.executeQuery(query_sql, fixedSerialid);
if (rs.next()) {
fixedUserId = rs.getString("typevalue");
}
boolean holiday = KQHolidaySetBiz.isHoliday(fixedUserId, signDate,true);
boolean holiday = KQHolidaySetBiz.isHoliday(fixedUserId, signDate, true);
kqLog.info("format.holiday:" + holiday);
//String sql = "insert into kq_shiftschedule(kqdate,serialid,resourceid,groupid,isdelete)values(?,?,?,?,?)";
String sql = "update kq_shiftschedule set serialid = ? where resourceid = ? and kqdate= ? and groupid = ? and isdelete = 0 ";
//考勤当天是节假日或者休息日
if (holiday) {
//节假日休息班
b = rt.executeUpdate(sql, signDate, holidayDefaultSerialid, Util.null2String(userId),signDate,groupid);
b = rt.executeUpdate(sql, signDate, holidayDefaultSerialid, Util.null2String(userId), signDate, groupid);
kqLog.info("PunchOutButtonCmd.b1:" + b);
}else{
} else {
//周末休息班
// if(DateUtil.getWeek(signDate) == 6 || DateUtil.getWeek(signDate) == 7){
// b = rt.executeUpdate(sql,weekendDefaultSerialid, Util.null2String(userId), signDate,groupid);
// kqLog.info("PunchOutButtonCmd.b2:"+b);
// }else{
//设置考勤班次为对应班次
b = rt.executeUpdate(sql,defaultSerialid, Util.null2String(userId), signDate,groupid);
kqLog.info("PunchOutButtonCmd.b3:"+b);
b = rt.executeUpdate(sql, defaultSerialid, Util.null2String(userId), signDate, groupid);
kqLog.info("PunchOutButtonCmd.b3:" + b);
//}
}
}
//同步更新考勤数据到考勤报表
if(belongdateIsNull){
if (belongdateIsNull) {
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
bb.writeLog("PunchOutButtonCmd:userId:"+userId+":belongdate:"+DateUtil.getYesterday());
new KQFormatBiz().formatDate(""+userId,DateUtil.getYesterday());
bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + DateUtil.getYesterday());
new KQFormatBiz().formatDate("" + userId, DateUtil.getYesterday());
}
bb.writeLog("PunchOutButtonCmd:userId:"+userId+":belongdate:"+(belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
// if(belongdate.length()==0){
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
new KQFormatBiz().formatDate(""+userId,DateUtil.getYesterday());
new KQFormatBiz().formatDate("" + userId, DateUtil.getYesterday());
// }
new KQFormatBiz().formatDate(""+userId,(belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
new KQFormatBiz().formatDate("" + userId, (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
//外勤签到转的考勤 处理加班规则
SplitActionUtil.pushOverTimeTasksAll(belongdate,belongdate,""+userId);
SplitActionUtil.pushOverTimeTasksAll(signDate,signDate,""+userId);
SplitActionUtil.pushOverTimeTasksAll(belongdate, belongdate, "" + userId);
SplitActionUtil.pushOverTimeTasksAll(signDate, signDate, "" + userId);
LocalDate specifiedDate = LocalDate.parse(signDate, dateFormatter);
SplitActionUtil.pushOverTimeTasksAll(specifiedDate.minusDays(1).toString(),specifiedDate.minusDays(1).toString(),""+userId);
SplitActionUtil.pushOverTimeTasksAll(specifiedDate.minusDays(1).toString(), specifiedDate.minusDays(1).toString(), "" + userId);
if (StringUtils.isNotEmpty(belongdate) && !StringUtils.equals(belongdate, signData)) {
LocalDate specifiedDateA = LocalDate.parse(belongdate, dateFormatter);
SplitActionUtil.pushOverTimeTasksAll(specifiedDateA.minusDays(1).toString(),specifiedDateA.minusDays(1).toString(),""+userId);
SplitActionUtil.pushOverTimeTasksAll(specifiedDateA.minusDays(1).toString(), specifiedDateA.minusDays(1).toString(), "" + userId);
}
} else {
bb.writeLog("已关账.");
String acqSql = "select id from mobile_sign where operater = ? and operate_date = ? and operate_time = ? ";
rs.executeQuery(acqSql, userId, signDate, signTime);
RecordSet rsTz = new RecordSet();
@ -462,16 +490,87 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
String isInCom = isInIp ? "1" : "0";
JSONObject jsonObject = null;
String deviceInfo = Util.null2String(params.get("deviceInfo"));
if(deviceInfo.length() > 0){
if (deviceInfo.length() > 0) {
jsonObject = JSON.parseObject(deviceInfo);
JSONObject jsonObject1 = new JSONObject();
Set<Entry<String, Object>> jsonSet = jsonObject.entrySet();
for(Entry<String, Object> js : jsonSet){
for (Entry<String, Object> js : jsonSet) {
String key = js.getKey();
String value = Util.null2String(js.getValue());
jsonObject1.put(key, value);
}
if(!jsonObject1.isEmpty()){
if (!jsonObject1.isEmpty()) {
deviceInfo = jsonObject1.toJSONString();
}
}
signInfo.put("userId", userId);
signInfo.put("userType", userType);
signInfo.put("signType", signType);
signInfo.put("signDate", signDate);
signInfo.put("signTime", signTime);
signInfo.put("clientAddress", clientAddress);
signInfo.put("isInCom", isInCom);
signInfo.put("timeZone", timeZone);
signInfo.put("belongdate", belongdate);
signInfo.put("signfrom", signfrom);
signInfo.put("longitude", longitude);
signInfo.put("latitude", latitude);
signInfo.put("address", address);
signInfo.put("deviceInfo", deviceInfo);
signInfo.put("isdev", "1");
signInfo.put("belongdateIsNull", belongdateIsNull);
String signInfoString = signInfo.toString();
String outSignTypeModeId = bb.getPropValue("project_hostar", "outSignTypeModeId");
Integer modedatacreater = 1;
Integer modedatacreatertype = 0;
String modedatacreatedate = cn.hutool.core.date.DateUtil.format(new Date(), "yyyy-MM-dd");
String modedatacreatetime = cn.hutool.core.date.DateUtil.format(new Date(), "HH:mm:ss");
String abnUuid = UUID.randomUUID().toString();
String syncSql = "insert into uf_outsigntype (outsignid, signinfo, formmodeid, modedatacreater, " +
"modedatacreatertype, modedatacreatedate, modedatacreatetime, MODEUUID) values (?, ?, ?, ?, ?, ?, ?, ?)";
boolean b = rsTz.executeUpdate(syncSql, id, signInfoString, outSignTypeModeId, modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime, abnUuid);
if (b) {
RecordSet rsTz1 = new RecordSet();
String billid = "-1";
String acqModeIdSql = "select id from uf_outsigntype where MODEUUID = ?";
rsTz1.executeQuery(acqModeIdSql, abnUuid);
while (rsTz1.next()) {
billid = Util.null2String(rsTz1.getString("id"));
}
bb.writeLog("billid" + billid);
new HostarUtil().modePerRecon(modedatacreater, outSignTypeModeId, billid);
}
}
}
}
} else {
String acqSql = "select id from mobile_sign where operater = ? and operate_date = ? and operate_time = ? ";
rs.executeQuery(acqSql, userId, signDate, signTime);
RecordSet rsTz = new RecordSet();
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
if (StringUtils.isNotBlank(id)) {
//整理原始打卡信息
Map<String, Object> signInfo = new HashMap<>();
boolean isInIp = true;
String userType = user.getLogintype();
String signType = "on".equalsIgnoreCase(type) ? "1" : "2";
String clientAddress = Util.getIpAddr(request);
String isInCom = isInIp ? "1" : "0";
JSONObject jsonObject = null;
String deviceInfo = Util.null2String(params.get("deviceInfo"));
if (deviceInfo.length() > 0) {
jsonObject = JSON.parseObject(deviceInfo);
JSONObject jsonObject1 = new JSONObject();
Set<Entry<String, Object>> jsonSet = jsonObject.entrySet();
for (Entry<String, Object> js : jsonSet) {
String key = js.getKey();
String value = Util.null2String(js.getValue());
jsonObject1.put(key, value);
}
if (!jsonObject1.isEmpty()) {
deviceInfo = jsonObject1.toJSONString();
}
}

@ -98,7 +98,8 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
}else if(showColumn.equals("signin3")){
cascadekey = "signout3";
}else if(showColumn.equals("beLate")){
cascadekey = "beLateMins";
// cascadekey = "beLateMins";
cascadekey = "";
}else if(showColumn.equals("leaveEearly")){
cascadekey = "leaveEarlyMins";
}else if(showColumn.equals("graveBeLate")){
@ -243,7 +244,7 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
long endTime = System.currentTimeMillis();
long elapsedTime = endTime - startTime; // 执行时间
bb.writeLog("getDailyMealAllowanceData执行时间" + elapsedTime/1000 + "秒");
bb.writeLog("getDailyMealAllowanceData执行时间" + elapsedTime);
// /*考勤二开--驻点餐补start*/
// HostarUtil hostarUtil = new HostarUtil();
// List<String> subComoanyList = new ArrayList<>();
@ -269,13 +270,19 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
// }
// }
// /*考勤二开--夜班餐补end*/
long startTimeA = System.currentTimeMillis();
Map<String, Map<String, Object>> signDetailInfoBatch = getSignDetailInfoBatch(fromDate, toDate);
long endTimeB = System.currentTimeMillis();
elapsedTime = endTimeB - startTimeA; // 执行时间
bb.writeLog("getDailyMealAllowanceData执行时间" + elapsedTime);
bb.writeLog("ExportDailyExcelCmd sql:" + sql);
rs.execute(sql);
while (rs.next()) {
data = new ArrayList<>();
String id = rs.getString("id");
String kqdate = rs.getString("kqdate");
Map<String,Object> signDetailInfo = this.getSignDetailInfo(id,kqdate);
// Map<String,Object> signDetailInfo = this.getSignDetailInfo(id,kqdate);
Map<String,Object> signDetailInfo = signDetailInfoBatch.get(id + "-" + kqdate);
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
@ -538,7 +545,12 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
// continue;
} else if(fieldName.equals("kqdate")){
fieldValue=kqdate+" "+com.engine.portal.util.DateUtil.getDayWeekOfDate1(DateUtil.parseToDate(kqdate));
} else {
} else if (fieldName.equals("beLateMinsOther")) {
fieldValue = Util.null2String(rs.getString("beLateMins"));
if (StringUtils.isEmpty(fieldValue)) {
fieldValue = "0.0";
}
}else {
fieldValue = Util.null2String(rs.getString(fieldName));
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
}
@ -773,6 +785,127 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
return data;
}
public Map<String, Map<String, Object>> getSignDetailInfoBatch(String startDate, String endDate){
Map<String, Map<String, Object>> resultMap = new HashMap<>();
Map<String,Object> signStatusInfo = null;
RecordSet rs = new RecordSet();
String sql = "";
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
try{
/*考勤二开--增加打卡地址start*/
sql = " select a.kqdate,a.resourceid,a.serialid,a.serialnumber,a.workbegindate,a.workbegintime, " +
" a.workenddate,a.workendtime,a.workmins,a.signindate,a.signintime,a.signoutdate,a.signouttime, \n" +
" a.attendanceMins,a.belatemins,a.graveBeLateMins,a.leaveearlymins,a.graveLeaveEarlyMins,a.absenteeismmins,a.forgotcheckMins,a.forgotBeginWorkCheckMins," +
" a.leaveMins,a.leaveInfo,a.evectionMins,a.outMins,a.signinid,a.signoutid, b.addr as signinaddr, c.addr as signoutaddr \n" +
" from kq_format_detail a " +
" left join hrmschedulesign b on b.id = a.signinid \n" +
" left join hrmschedulesign c on c.id = a.signoutid \n" +
" where a.kqdate >= '" + startDate + "' and a.kqdate <='" + endDate + "' \n" +
" order by a.serialnumber \n";
/*考勤二开--增加打卡地址end*/
rs.execute(sql);
while (rs.next()) {
String resourceid = Util.null2String(rs.getString("resourceid"));
String kqdate = Util.null2String(rs.getString("kqdate"));
String serialid = Util.null2String(rs.getString("serialid"));
int serialnumber = rs.getInt("serialnumber")+1;
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
int workMins = rs.getInt("workMins");
String signintime = Util.null2String(rs.getString("signintime")).trim();
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
int attendanceMins = rs.getInt("attendanceMins");
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
String signinid = Util.null2String(rs.getString("signinid")).trim();
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
int leaveMins = rs.getInt("leaveMins");
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
int evectionMins = rs.getInt("evectionMins");
int outMins = rs.getInt("outMins");
String signInAddr = Util.null2String(rs.getString("signinaddr"));
String signOutAddr = Util.null2String(rs.getString("signoutaddr"));
// bb.writeLog("signInAddr: " + signInAddr);
// bb.writeLog("signOutAddr: " + signOutAddr);
Map<String, Object> data = new HashMap<>();
if(serialid.length()>0){
if (workbegintime.length() > 0) {
signStatusInfo = new HashMap();
signStatusInfo.put("workdate",workbegindate);
signStatusInfo.put("worktime",workbegintime);
signStatusInfo.put("beLateMins",beLateMins);
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
signStatusInfo.put("absenteeismMins",absenteeismMins);
signStatusInfo.put("leaveMins",leaveMins);
signStatusInfo.put("leaveInfo",leaveInfo);
signStatusInfo.put("evectionMins",evectionMins);
signStatusInfo.put("outMins",outMins);
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
data.put("signinaddress"+serialnumber, signInAddr);
}
if (workendtime.length() > 0) {
signStatusInfo = new HashMap();
signStatusInfo.put("workdate",workenddate);
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
signStatusInfo.put("absenteeismMins",absenteeismMins);
signStatusInfo.put("leaveMins",leaveMins);
signStatusInfo.put("leaveInfo",leaveInfo);
signStatusInfo.put("evectionMins",evectionMins);
signStatusInfo.put("outMins",outMins);
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
data.put("signoutaddress"+serialnumber, signOutAddr);
}
}else{
if(workMins>0){
//弹性工时打卡时间取自签到签退数据
}
signStatusInfo = new HashMap();
signStatusInfo.put("leaveMins",leaveMins);
signStatusInfo.put("leaveInfo",leaveInfo);
signStatusInfo.put("evectionMins",evectionMins);
signStatusInfo.put("outMins",outMins);
if(signinid.length() > 0){
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
data.put("signinaddress"+serialnumber, signInAddr);
if(signoutid.length() > 0){
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
data.put("signoutaddress"+serialnumber, signOutAddr);
}
}else{
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
}
}
resultMap.put(resourceid + "-" + kqdate, data);
}
}catch (Exception e){
writeLog("getSignDetailInfoBatch error:" + e);
}
return resultMap;
}
private String getFieldValueByUnitType(String fieldValue,String unittype){
if (Util.null2String(unittype).length() > 0) {
if (fieldValue.length() == 0) {

@ -10,6 +10,7 @@ import com.engine.kq.biz.*;
import com.engine.kq.util.ExcelUtil;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.UtilKQ;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
@ -89,7 +90,8 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
tmpShowColumns.add(showColumn);
String cascadekey = "";
if(showColumn.equals("beLate")){
cascadekey = "beLateMins";
// cascadekey = "beLateMins";
cascadekey = "";
}else if(showColumn.equals("leaveEearly")){
cascadekey = "leaveEarlyMins";
}else if(showColumn.equals("graveBeLate")){
@ -548,6 +550,11 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
data.add(fieldValue);
}
continue;
} else if (fieldName.equals("beLateMinsOther")) {
fieldValue = Util.null2String(rs.getString("beLateMins"));
if (StringUtils.isEmpty(fieldValue)) {
fieldValue = "0.0";
}
}else {
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));

@ -448,7 +448,13 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
// }
//// bb.writeLog("fieldValue: " + fieldValue);
// data.put(fieldName, fieldValue);
} else {
} else if (fieldName.equals("beLateMinsOther")) {
fieldValue = Util.null2String(rs.getString("beLateMins"));
if (StringUtils.isEmpty(fieldValue)) {
fieldValue = "0.0";
}
data.put(fieldName, fieldValue);
}else {
fieldValue = Util.null2String(rs.getString(fieldName));
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));

@ -9,6 +9,7 @@ import com.engine.hostar.util.HostarUtil;
import com.engine.kq.biz.*;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.PageUidFactory;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
@ -536,7 +537,13 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
// }
//// bb.writeLog("fieldValue: " + fieldValue);
// data.put(fieldName, fieldValue);
} else {
} else if (fieldName.equals("beLateMinsOther")) {
fieldValue = Util.null2String(rs.getString("beLateMins"));
if (StringUtils.isEmpty(fieldValue)) {
fieldValue = "0.0";
}
data.put(fieldName, fieldValue);
}else {
fieldValue = Util.null2String(rs.getString(fieldName));
if(Util.null2String(kqReportFieldComInfo.getUnittype()).length()>0) {
if(fieldValue.length() == 0){

@ -127,7 +127,33 @@ public class OutSignSyncAction implements Action {
// continue;
// }
// }
// 判断是否关账
int userSubCompany1 = 0;
int userDepartment = 0;
if (userSubCompany1 <= 0 || userDepartment <= 0) {
rs.execute("select departmentid, subcompanyid1 from hrmresource where id = " + userId);
if (rs.next()) {
userSubCompany1 = rs.getInt("subcompanyid1");
userDepartment = rs.getInt("departmentid");
}
}
String sqlDateA = "";
if (StringUtils.isNotBlank(belongdate)) {
sqlDateA = belongdate;
} else {
sqlDateA = signDate;
}
String gzSql = "select count(*) as cnt from uf_kqfz where (','+CAST(bm AS varchar(max))+',' like '%,'+CAST("+userDepartment+" AS varchar(10))+',%' " +
"or ','+CAST(fb AS varchar(max))+',' like '%,'+CAST("+userSubCompany1+" AS varchar(10))+',%') and fczt = 1 and fzksrq <= '" + sqlDateA +"' and fzjsrq >= '" + sqlDateA + "'";
rs.execute(gzSql);
boolean isClose = false;
if (rs.next()) {
int cnt = rs.getInt("cnt");
if (cnt > 0) {
isClose = true;
}
}
if (!isClose) {
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,isdev) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
boolean isok = rs.executeUpdate(punchSql, userId, userType, signType, signDate, signTime, clientAddress, isInCom,
@ -169,8 +195,10 @@ public class OutSignSyncAction implements Action {
SplitActionUtil.pushOverTimeTasksAll(previousDayAString, previousDayAString, userId);
}
} else {
bb.writeLog("OutSignSyncAction is close:" + userId + "、" + sqlDateA);
}
}
}
}
} catch (Exception e) {

@ -198,6 +198,27 @@ public class UpdateCbxxjlDataJob extends BaseCronJob {
return;
}
// 判断是否关账, 关账则不更新
int userSubCompany1 = 0;
int userDepartment = 0;
if (userSubCompany1 <= 0 || userDepartment <= 0) {
rs.execute("select departmentid, subcompanyid1 from hrmresource where id = " + userId);
if (rs.next()) {
userSubCompany1 = rs.getInt("subcompanyid1");
userDepartment = rs.getInt("departmentid");
}
}
String gzSql = "select count(*) as cnt from uf_kqfz where (','+CAST(bm AS varchar(max))+',' like '%,'+CAST("+userDepartment+" AS varchar(10))+',%' " +
"or ','+CAST(fb AS varchar(max))+',' like '%,'+CAST("+userSubCompany1+" AS varchar(10))+',%') and fczt = 1 and fzksrq <= '" + kqDate +"' and fzjsrq >= '" + kqDate + "'";
rs.execute(gzSql);
int cntTemp = 0;
if (rs.next()) {
cntTemp = rs.getInt("cnt");
}
if (cntTemp > 0) {
return;
}
//获取加班时长
Map<String,Object> dailyFlowOverTimeData = getDailyFlowOverTimeDataAllowance(userId, kqDate);

Loading…
Cancel
Save