Commit 40dd6715 by ilal Committed by chenzg

提交

parent 7ab22bdc
...@@ -31,6 +31,7 @@ import cn.timer.api.bean.kqmk.KqglAssoTeshu; ...@@ -31,6 +31,7 @@ import cn.timer.api.bean.kqmk.KqglAssoTeshu;
import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban; import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz; import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.qyzx.QyzxEntInfoM; import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.bean.yggl.YgglMainLzb;
import cn.timer.api.controller.kqgl.ClockInController; import cn.timer.api.controller.kqgl.ClockInController;
import cn.timer.api.controller.kqgl.ClockInTool; import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.controller.kqgl.EmptyUtil; import cn.timer.api.controller.kqgl.EmptyUtil;
...@@ -173,634 +174,640 @@ public class AttendanceTaskTiming{ ...@@ -173,634 +174,640 @@ public class AttendanceTaskTiming{
List<AdditionalDto> userlist = kqglassoleavebalancemapper.selectAdditionalList(org_code); List<AdditionalDto> userlist = kqglassoleavebalancemapper.selectAdditionalList(org_code);
for(AdditionalDto user : userlist) { for(AdditionalDto user : userlist) {
// KqglAssoMonthPunchSummary.builder().build().delete(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getBelongYear, year) YgglMainLzb lzb = YgglMainLzb.builder().build().selectOne(new QueryWrapper<YgglMainLzb>().lambda().eq(YgglMainLzb::getOrgCode, org_code).eq(YgglMainLzb::getJobStatus, 3)
// .eq(KqglAssoMonthPunchSummary::getBelongMonth, month).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code)); .eq(YgglMainLzb::getEmpNum, user.getEmpnum()));
if(lzb == null) {//已离职 的人员不进入计算(已存在的不做任何处理)
KqglAssoMonthPunchSummary sum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getOrgCode, org_code)
.eq(KqglAssoMonthPunchSummary::getBelongYear, year).eq(KqglAssoMonthPunchSummary::getBelongMonth, month).eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum())); // KqglAssoMonthPunchSummary.builder().build().delete(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getBelongYear, year)
// .eq(KqglAssoMonthPunchSummary::getBelongMonth, month).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code));
if(sum != null) {
summaryid = sum.getId(); KqglAssoMonthPunchSummary sum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getOrgCode, org_code)
} .eq(KqglAssoMonthPunchSummary::getBelongYear, year).eq(KqglAssoMonthPunchSummary::getBelongMonth, month).eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()));
double traveltotal = 0,egresstotal = 0,overtimetotal = 0; if(sum != null) {
//出差总时长 summaryid = sum.getId();
KqglAssoRelationSummary travel = kqglassorelationsummarymapper.SecondaryValue(user.getEmpnum(), 3, ttstr);
if(travel !=null) { traveltotal = travel.getDuration(); }
//外出总时长
KqglAssoRelationSummary egress = kqglassorelationsummarymapper.SecondaryValue(user.getEmpnum(), 4, ttstr);
if(egress!=null) { egresstotal = egress.getDuration(); }
//加班总时长
KqglAssoRelationSummary overtime = kqglassorelationsummarymapper.SecondaryValue(user.getEmpnum(), 1, ttstr);
if(overtime!= null) { overtimetotal = overtime.getDuration(); }
//考勤组信息
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(user.getEmpnum(),org_code);
//目前为止打卡记录
List<PunchCardDetails> attendance = punchcarddetailsmapper.selectAttendanceDays(user.getEmpnum(), startDate, endDateyesterday);
int dkjl = 0;//目前为止打卡次数
int sbqkcs = 0,xbqkcs = 0,dk=0;
String[] sblacks = new String[31];//上班缺卡天数
String[] xblacks = new String[31];//下班缺卡天数
String[] dkjtts = new String[attendance.size()];//目前打卡日期明细
int bccs = 0;
if(attendance.size() > 0) {
dkjl = attendance.size();
for(PunchCardDetails pcd:attendance){
AttendanceCardListDto attdate = clockincontroller.MethodCall(org_code, user.getEmpnum(), pcd.getData());
List<AttSchedule> ashss = attdate.getAttsch();//获取今天应打卡时间
if(EmptyUtil.isNotEmpty(attdate.getAttsch()) && ashss.get(0).getId() != 0) {//班次不为空
bccs = attdate.getAttsch().size();
}
dkjtts[dk] = pcd.getData();
dk++;
if(bccs == 2 || bccs == 4 || bccs == 6){
if(pcd.getSbdk1() == null){
sblacks[sbqkcs] = pcd.getData();
sbqkcs++;
}
if(pcd.getXbdk1() == null){
xblacks[xbqkcs] = pcd.getData();
xbqkcs++;
}
}
if(bccs == 4 || bccs == 6){
if(pcd.getSbdk2() == null){
sblacks[sbqkcs] = pcd.getData();
sbqkcs++;
}
if(pcd.getXbdk2() == null){
xblacks[xbqkcs] = pcd.getData();
xbqkcs++;
}
}
if(bccs == 6){
if(pcd.getSbdk3() == null){
sblacks[sbqkcs] = pcd.getData();
sbqkcs++;
}
if(pcd.getXbdk3() == null){
xblacks[xbqkcs] = pcd.getData();
xbqkcs++;
}
}
}
sblacks = ClockInTool.deleteArrayNull(sblacks);
sbqkcs= sblacks.length;
xblacks = ClockInTool.deleteArrayNull(xblacks);
xbqkcs = xblacks.length;
} }
//具体打卡时间入汇总表(打卡成功才会录入汇总表)
// KqglAssoMonthPunchSummary isyessum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda() double traveltotal = 0,egresstotal = 0,overtimetotal = 0;
// .eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code)); //出差总时长
String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd) KqglAssoRelationSummary travel = kqglassorelationsummarymapper.SecondaryValue(user.getEmpnum(), 3, ttstr);
String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd) if(travel !=null) { traveltotal = travel.getDuration(); }
List<String> rowData = new ArrayList<String>(); //外出总时长
//休息天数,应出勤天数,实际出勤 KqglAssoRelationSummary egress = kqglassorelationsummarymapper.SecondaryValue(user.getEmpnum(), 4, ttstr);
double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0; if(egress!=null) { egresstotal = egress.getDuration(); }
int zjgzts = 0;//目前为止应该出勤的天数 //加班总时长
//工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数 KqglAssoRelationSummary overtime = kqglassorelationsummarymapper.SecondaryValue(user.getEmpnum(), 1, ttstr);
double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0; if(overtime!= null) { overtimetotal = overtime.getDuration(); }
// 迟到次数 迟到时长 早退次数 早退时长 //考勤组信息
int latenum = 0,latehours = 0,leanum = 0,leahours = 0;// 迟到次数 KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(user.getEmpnum(),org_code);
int answer =0;//班次ID //目前为止打卡记录
//工作日(转调休)、休息日(转调休)、节假日(转调休) List<PunchCardDetails> attendance = punchcarddetailsmapper.selectAttendanceDays(user.getEmpnum(), startDate, endDateyesterday);
double workingturncompenleave = 0,restturncompenleave = 0,holidayturncompenleave = 0;//工作日(转调休) int dkjl = 0;//目前为止打卡次数
//工作日(转加班费)、休息日(转加班费)、节假日(转加班费) int sbqkcs = 0,xbqkcs = 0,dk=0;
double workingtransferovertime = 0,resttransferovertime = 0,holidaytransferovertime = 0; String[] sblacks = new String[31];//上班缺卡天数
int attgroid = 0; String[] xblacks = new String[31];//下班缺卡天数
if(attgro != null){//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数 String[] dkjtts = new String[attendance.size()];//目前打卡日期明细
attgroid = attgro.getId(); int bccs = 0;
// KqglAssoBcsz shif = KqglAssoBcsz.builder().build(); if(attendance.size() > 0) {
// //休息天数,应出勤天数,实际出勤 dkjl = attendance.size();
// double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0; for(PunchCardDetails pcd:attendance){
// int zjgzts = 0;//目前为止应该出勤的天数 AttendanceCardListDto attdate = clockincontroller.MethodCall(org_code, user.getEmpnum(), pcd.getData());
if(attgro.getPbfs() == 1){ //固定排班 List<AttSchedule> ashss = attdate.getAttsch();//获取今天应打卡时间
List<KqglAssoTeshu> bxdklist = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), ttstr,1);//当前月 必须打卡日期 if(EmptyUtil.isNotEmpty(attdate.getAttsch()) && ashss.get(0).getId() != 0) {//班次不为空
int bxdk = bxdklist.size(); bccs = attdate.getAttsch().size();
String[] bxdkss = new String[bxdk];////特殊-必须打卡天数(工作日)
int b = 0;
for(KqglAssoTeshu bxd : bxdklist) {
bxdkss[b] = bxd.getTsrq();
b++;
}
List<KqglAssoTeshu> wxdk = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), ttstr,2);//当前月 无需打卡日期
String[] appmaps= new String[wxdk.size()];//特殊-无需打卡天数(休息日)
int d1 = 0;
for(KqglAssoTeshu spe:wxdk){
appmaps[d1] = spe.getTsrq();
d1++;
}
//应打卡周期时间
List<AttendanceWeeklySch> atwek = attendanceweeklyschmapper.selectAttendanceMadeByUserid(user.getEmpnum(),org_code);
String[] week= new String[atwek.size()];
String[] needfig = new String[atwek.size()];//应打卡周期时间
int e = 0;
for(AttendanceWeeklySch awek : atwek){
week[e] = awek.getWekmc();
needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几
e++;
}
String yemo = year + "-" + month;
sdf1.setLenient(false);
int y = 0,q = 0;
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){
if(sdf2.format(date1).equals(week[u])){
q++;
y++;
if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){
y = y-1;
}
}
}
}
//全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size();
daysOff = xiuxi;
daysOnDuty = y+bxdk;
// String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
// int zjgzts = 0;//目前为止应该出勤的天数
//目前为止应出勤天数
int w = 0,x=0;
int zj = 6;
for(String num : range) {
if(Arrays.binarySearch(needfig, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj];
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length);
ycqtst[w] = num;
ycqts = ycqtst;
//ycqts[w] = num;
w++;
zjgzts++;
}else {
String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
xxtst[x] = num;
xxts = xxtst;
//xxts[x] = num;
x++;
} }
if(Arrays.binarySearch(bxdkss, num) >= 0) {//检查是否存在 必须打卡名单中 dkjtts[dk] = pcd.getData();
String[] ycqtst = new String[ycqts.length + zj]; dk++;
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length); if(bccs == 2 || bccs == 4 || bccs == 6){
ycqtst[w] = num; if(pcd.getSbdk1() == null){
ycqts = ycqtst; sblacks[sbqkcs] = pcd.getData();
sbqkcs++;
//ycqts[w] = num; }
w++; if(pcd.getXbdk1() == null){
zjgzts++; xblacks[xbqkcs] = pcd.getData();
xxts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(xxts), num);//为必须上班的话从休息日期中去除 xbqkcs++;
}
}
if(bccs == 4 || bccs == 6){
if(pcd.getSbdk2() == null){
sblacks[sbqkcs] = pcd.getData();
sbqkcs++;
}
if(pcd.getXbdk2() == null){
xblacks[xbqkcs] = pcd.getData();
xbqkcs++;
}
}
if(bccs == 6){
if(pcd.getSbdk3() == null){
sblacks[sbqkcs] = pcd.getData();
sbqkcs++;
}
if(pcd.getXbdk3() == null){
xblacks[xbqkcs] = pcd.getData();
xbqkcs++;
}
}
}
sblacks = ClockInTool.deleteArrayNull(sblacks);
sbqkcs= sblacks.length;
xblacks = ClockInTool.deleteArrayNull(xblacks);
xbqkcs = xblacks.length;
}
//具体打卡时间入汇总表(打卡成功才会录入汇总表)
// KqglAssoMonthPunchSummary isyessum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda()
// .eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code));
String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd)
String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd)
List<String> rowData = new ArrayList<String>();
//休息天数,应出勤天数,实际出勤
double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0;
int zjgzts = 0;//目前为止应该出勤的天数
//工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
// 迟到次数 迟到时长 早退次数 早退时长
int latenum = 0,latehours = 0,leanum = 0,leahours = 0;// 迟到次数
int answer =0;//班次ID
//工作日(转调休)、休息日(转调休)、节假日(转调休)
double workingturncompenleave = 0,restturncompenleave = 0,holidayturncompenleave = 0;//工作日(转调休)
//工作日(转加班费)、休息日(转加班费)、节假日(转加班费)
double workingtransferovertime = 0,resttransferovertime = 0,holidaytransferovertime = 0;
int attgroid = 0;
if(attgro != null){//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数
attgroid = attgro.getId();
// KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
// //休息天数,应出勤天数,实际出勤
// double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0;
// int zjgzts = 0;//目前为止应该出勤的天数
if(attgro.getPbfs() == 1){ //固定排班
List<KqglAssoTeshu> bxdklist = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), ttstr,1);//当前月 必须打卡日期
int bxdk = bxdklist.size();
String[] bxdkss = new String[bxdk];////特殊-必须打卡天数(工作日)
int b = 0;
for(KqglAssoTeshu bxd : bxdklist) {
bxdkss[b] = bxd.getTsrq();
b++;
} }
if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中 List<KqglAssoTeshu> wxdk = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), ttstr,2);//当前月 无需打卡日期
ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除 String[] appmaps= new String[wxdk.size()];//特殊-无需打卡天数(休息日)
zjgzts = zjgzts - 1; int d1 = 0;
for(KqglAssoTeshu spe:wxdk){
String[] xxtst = new String[xxts.length + zj]; appmaps[d1] = spe.getTsrq();
System.arraycopy(xxts, 0, xxtst, 0, xxts.length); d1++;
xxtst[x] = num;
//xxts[x] = num;
xxts = xxtst;
x++;
} }
} //应打卡周期时间
}else if(attgro.getPbfs() == 2){ //自由排班 List<AttendanceWeeklySch> atwek = attendanceweeklyschmapper.selectAttendanceMadeByUserid(user.getEmpnum(),org_code);
DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); String[] week= new String[atwek.size()];
List<Schedule> ycqs = schedulemapper.getAttendanceShouldList(user.getEmpnum(),startDate,endDate); String[] needfig = new String[atwek.size()];//应打卡周期时间
int xiuxi = 0,shangban = 0,z=0; int e = 0;
String[] ziyoupb = new String[ycqs.size()]; for(AttendanceWeeklySch awek : atwek){
for(Schedule sc : ycqs){ week[e] = awek.getWekmc();
String data = new SimpleDateFormat("yyyy-MM-dd").format(df.parse(String.valueOf(sc.getData())));// 获得格式化后的日期字符串 needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几
ziyoupb[z] = data; e++;
z++;
if(sc.getBcid().equals(0)){
xiuxi++;
}else{
shangban++;
} }
} String yemo = year + "-" + month;
daysOff = xiuxi; sdf1.setLenient(false);
daysOnDuty = shangban; int y = 0,q = 0;
//目前为止应出勤天数 for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
int y = 0,x=0; Date date1 = sdf1.parse(yemo + "-" + i);
for(String num : range) { for(int u=0;u<week.length;u++){
if(Arrays.binarySearch(ziyoupb, num) >= 0) { if(sdf2.format(date1).equals(week[u])){
KqglAssoPbmx pbx = KqglAssoPbmx.builder().build().selectOne(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, user.getEmpnum()).eq(KqglAssoPbmx::getData, num).eq(KqglAssoPbmx::getKqzid, attgro.getId())); q++;
if(pbx!=null && pbx.getBcid()!=0) { y++;
ycqts[y] = num; if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){
y++; y = y-1;
}
}
}
}
//全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size();
daysOff = xiuxi;
daysOnDuty = y+bxdk;
// String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
// int zjgzts = 0;//目前为止应该出勤的天数
//目前为止应出勤天数
int w = 0,x=0;
int zj = 6;
for(String num : range) {
if(Arrays.binarySearch(needfig, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj];
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length);
ycqtst[w] = num;
ycqts = ycqtst;
//ycqts[w] = num;
w++;
zjgzts++; zjgzts++;
}else { }else {
xxts[x] = num; String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
xxtst[x] = num;
xxts = xxtst;
//xxts[x] = num;
x++;
}
if(Arrays.binarySearch(bxdkss, num) >= 0) {//检查是否存在 必须打卡名单中
String[] ycqtst = new String[ycqts.length + zj];
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length);
ycqtst[w] = num;
ycqts = ycqtst;
//ycqts[w] = num;
w++;
zjgzts++;
xxts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(xxts), num);//为必须上班的话从休息日期中去除
}
if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中
ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
zjgzts = zjgzts - 1;
String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
xxtst[x] = num;
//xxts[x] = num;
xxts = xxtst;
x++; x++;
} }
}
}else if(attgro.getPbfs() == 2){ //自由排班
DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
List<Schedule> ycqs = schedulemapper.getAttendanceShouldList(user.getEmpnum(),startDate,endDate);
int xiuxi = 0,shangban = 0,z=0;
String[] ziyoupb = new String[ycqs.size()];
for(Schedule sc : ycqs){
String data = new SimpleDateFormat("yyyy-MM-dd").format(df.parse(String.valueOf(sc.getData())));// 获得格式化后的日期字符串
ziyoupb[z] = data;
z++;
if(sc.getBcid().equals(0)){
xiuxi++;
}else{
shangban++;
}
} }
} daysOff = xiuxi;
}else{ daysOnDuty = shangban;
List<AttendanceWeeklySch> atwek = attendanceweeklyschmapper.selectAttendanceMadeByUserid(user.getEmpnum(),org_code); //目前为止应出勤天数
String[] week= new String[atwek.size()]; int y = 0,x=0;
int e = 0; for(String num : range) {
String[] ziyoupb = new String[atwek.size()]; if(Arrays.binarySearch(ziyoupb, num) >= 0) {
for(AttendanceWeeklySch awek : atwek){ KqglAssoPbmx pbx = KqglAssoPbmx.builder().build().selectOne(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, user.getEmpnum()).eq(KqglAssoPbmx::getData, num).eq(KqglAssoPbmx::getKqzid, attgro.getId()));
week[e] = awek.getWekmc(); if(pbx!=null && pbx.getBcid()!=0) {
ziyoupb[e] = String.valueOf(awek.getType()); ycqts[y] = num;
e++;
}
String yemo = year + "-" + month;
sdf1.setLenient(false);
int y = 0;
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){
if(sdf2.format(date1).equals(week[u])){
y++; y++;
zjgzts++;
}else {
xxts[x] = num;
x++;
} }
} }
} }
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - y; }else{
daysOff = xiuxi; List<AttendanceWeeklySch> atwek = attendanceweeklyschmapper.selectAttendanceMadeByUserid(user.getEmpnum(),org_code);
daysOnDuty = y; String[] week= new String[atwek.size()];
//目前为止应出勤天数 int e = 0;
int g = 0,x=0; String[] ziyoupb = new String[atwek.size()];
for(String num : range) { for(AttendanceWeeklySch awek : atwek){
if(Arrays.binarySearch(ziyoupb, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间 week[e] = awek.getWekmc();
ycqts[g] = num; ziyoupb[e] = String.valueOf(awek.getType());
g++; e++;
zjgzts++; }
}else { String yemo = year + "-" + month;
xxts[x] = num; sdf1.setLenient(false);
x++; int y = 0;
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){
if(sdf2.format(date1).equals(week[u])){
y++;
}
}
} }
} int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - y;
} daysOff = xiuxi;
List<PunchRecord> initial = punchrecordmapper.getMaintenancePunchCardList(startDate,endDateyesterday,user.getEmpnum()); daysOnDuty = y;
// // 迟到次数 迟到时长 早退次数 早退时长 //目前为止应出勤天数
// int latenum = 0,latehours = 0,leanum = 0,leahours = 0;// 迟到次数 int g = 0,x=0;
String[] cdts = new String[31];//迟到的具体天数 for(String num : range) {
String[] ztts = new String[31];//早退的具体天数 if(Arrays.binarySearch(ziyoupb, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
if(initial.size() > 0){ ycqts[g] = num;
for(PunchRecord prd : initial){ g++;
if(prd.getType() == 1 && prd.getResults() > 0){ zjgzts++;
cdts[latenum] = new SimpleDateFormat("yyyy-MM-dd").format(prd.getDktime()); }else {
latenum++; xxts[x] = num;
latehours += prd.getResults(); x++;
}
}
} }
if(prd.getType() == 2 && prd.getResults() > 0){ List<PunchRecord> initial = punchrecordmapper.getMaintenancePunchCardList(startDate,endDateyesterday,user.getEmpnum());
ztts[leanum] = new SimpleDateFormat("yyyy-MM-dd").format(prd.getDktime()); // // 迟到次数 迟到时长 早退次数 早退时长
leanum++; // int latenum = 0,latehours = 0,leanum = 0,leahours = 0;// 迟到次数
leahours += prd.getResults(); String[] cdts = new String[31];//迟到的具体天数
String[] ztts = new String[31];//早退的具体天数
if(initial.size() > 0){
for(PunchRecord prd : initial){
if(prd.getType() == 1 && prd.getResults() > 0){
cdts[latenum] = new SimpleDateFormat("yyyy-MM-dd").format(prd.getDktime());
latenum++;
latehours += prd.getResults();
}
if(prd.getType() == 2 && prd.getResults() > 0){
ztts[leanum] = new SimpleDateFormat("yyyy-MM-dd").format(prd.getDktime());
leanum++;
leahours += prd.getResults();
}
} }
} }
} AttSubsidiaryDto subs = kqglassodkmxmapper.subsidiary(user.getEmpnum(), ttstr);
AttSubsidiaryDto subs = kqglassodkmxmapper.subsidiary(user.getEmpnum(), ttstr); // //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
// //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数 // double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
// double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0; if(subs != null) {
if(subs != null) { workinghours = subs.getGzsctotalgzsc();
workinghours = subs.getGzsctotalgzsc(); seriouslatetimes = subs.getYzcdcstotal();
seriouslatetimes = subs.getYzcdcstotal(); seriouslatehours = subs.getYzcdsctotal();
seriouslatehours = subs.getYzcdsctotal(); absenlatetimes = subs.getKgcdfzstotal();
absenlatetimes = subs.getKgcdfzstotal();
}
//具体请假天数
List<KqglAssoRelationSummary> leavetotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 2, ttstr);
String[] leaves = new String[leavetotal.size()];
int l = 0;
if(leavetotal.size()>0) {
for(KqglAssoRelationSummary lea : leavetotal){
leaves[l] = lea.getAppTime();
l++;
}
}
//具体加班天数
List<KqglAssoRelationSummary> overtitotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 1, ttstr);
String[] overtimes = new String[overtitotal.size()];
int o = 0;
if(overtitotal.size() > 0) {
for(KqglAssoRelationSummary over : overtitotal) {
overtimes[o] = over.getAppTime();
o++;
} }
} //具体请假天数
//具体出差天数 List<KqglAssoRelationSummary> leavetotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 2, ttstr);
List<KqglAssoRelationSummary> trtotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 3, ttstr); String[] leaves = new String[leavetotal.size()];
String[] travels = new String[trtotal.size()]; int l = 0;
int cx = 0; if(leavetotal.size()>0) {
if(trtotal.size()>0) { for(KqglAssoRelationSummary lea : leavetotal){
for(KqglAssoRelationSummary trt : trtotal) { leaves[l] = lea.getAppTime();
travels[cx] = trt.getAppTime(); l++;
cx++; }
} }
} //具体加班天数
//具体外出天数 List<KqglAssoRelationSummary> overtitotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 1, ttstr);
List<KqglAssoRelationSummary> goouttotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 4, ttstr); String[] overtimes = new String[overtitotal.size()];
String[] goouts = new String[goouttotal.size()]; int o = 0;
int wc = 0; if(overtitotal.size() > 0) {
if(goouttotal.size()>0) { for(KqglAssoRelationSummary over : overtitotal) {
for(KqglAssoRelationSummary go:goouttotal) { overtimes[o] = over.getAppTime();
goouts[wc] = go.getAppTime(); o++;
wc++; }
} }
} //具体出差天数
//具体补卡天数 List<KqglAssoRelationSummary> trtotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 3, ttstr);
List<KqglAssoRelationSummary> cardtotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 5, ttstr); String[] travels = new String[trtotal.size()];
String[] cards = new String[cardtotal.size()]; int cx = 0;
int bk = 0; if(trtotal.size()>0) {
if(cardtotal.size()>0) { for(KqglAssoRelationSummary trt : trtotal) {
for(KqglAssoRelationSummary car : cardtotal) { travels[cx] = trt.getAppTime();
cards[bk] = car.getAppTime(); cx++;
bk++; }
} }
} //具体外出天数
List<KqglAssoRelationSummary> goouttotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 4, ttstr);
//排查请假是否在最后一次打卡范围内 查询当月的请假所有日期 String[] goouts = new String[goouttotal.size()];
List<KqglAssoRelationSummary> leainv = kqglassorelationsummarymapper.LeaveInvestigation(user.getEmpnum(), 2, ttstr,org_code); int wc = 0;
// KqglAssoBcsz shif = KqglAssoBcsz.builder().build(); if(goouttotal.size()>0) {
String beginTime = sdf1.format(new Date()); for(KqglAssoRelationSummary go:goouttotal) {
// List<String> rowData = new ArrayList<String>(); goouts[wc] = go.getAppTime();
//遍历目前为止所有日期 结合该用户发起的审批进行结合 wc++;
//1:加班 2:请假 3:出差 4:外出 5:补卡 }
for(String num : range) { }
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(dkjtts),num) >= 0) { //具体补卡天数
rowData.add("休息并打卡"); List<KqglAssoRelationSummary> cardtotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 5, ttstr);
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) >= 0){ String[] cards = new String[cardtotal.size()];
rowData.add("休息"); int bk = 0;
}else { if(cardtotal.size()>0) {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(dkjtts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(leaves), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(travels), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(goouts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(cards), num) < 0) { for(KqglAssoRelationSummary car : cardtotal) {
rowData.add("旷工"); cards[bk] = car.getAppTime();
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) < 0) {//日期不在上班也不在休息里面即为未排班 bk++;
rowData.add("未排班");
}else if(sdf1.parse(beginTime).getTime() < sdf1.parse(num).getTime()) {
rowData.add("未到班期");
}else {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0) {
rowData.add("上班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("上班缺卡,下班早退");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0) {
rowData.add("上班迟到");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
rowData.add("上班迟到,下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("上班迟到,下班早退");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
rowData.add("下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("下班早退");
}else {
rowData.add("正常");
}
} }
} }
if(ClockInTool.contains(ClockInTool.deleteArrayNull(leaves),num)) { //排查请假是否在最后一次打卡范围内 查询当月的请假所有日期
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 2)); List<KqglAssoRelationSummary> leainv = kqglassorelationsummarymapper.LeaveInvestigation(user.getEmpnum(), 2, ttstr,org_code);
String leavetype = "未知";//请假类型 // KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
String company = "未知";//请假单位 String beginTime = sdf1.format(new Date());
if(lea != null) { // List<String> rowData = new ArrayList<String>();
KqglAssoLeaveRules rul = KqglAssoLeaveRules.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getId, lea.getLeaveTypeId())); //遍历目前为止所有日期 结合该用户发起的审批进行结合
if(rul != null) { //1:加班 2:请假 3:出差 4:外出 5:补卡
leavetype = rul.getName(); for(String num : range) {
//1:按天请假;2:按半天;3:按小时 if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(dkjtts),num) >= 0) {
if(rul.getCompany() == 1) { company = "天"; } rowData.add("休息并打卡");
else if(rul.getCompany() == 2) { company = "半天"; } }else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) >= 0){
else { company = "小时"; } rowData.add("休息");
}else {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(dkjtts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(leaves), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(travels), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(goouts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(cards), num) < 0) {
rowData.add("旷工");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) < 0) {//日期不在上班也不在休息里面即为未排班
rowData.add("未排班");
}else if(sdf1.parse(beginTime).getTime() < sdf1.parse(num).getTime()) {
rowData.add("未到班期");
}else {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0) {
rowData.add("上班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("上班缺卡,下班早退");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0) {
rowData.add("上班迟到");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
rowData.add("上班迟到,下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("上班迟到,下班早退");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
rowData.add("下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("下班早退");
}else {
rowData.add("正常");
}
} }
} }
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"请"+leavetype+lea.getDuration()+company);
}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(travels),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 3));
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"出差"+lea.getDuration()+"天");
}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(goouts),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 4));
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"外出"+lea.getDuration()+"天");
}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(cards),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 5));
rowData.add("已补卡:"+lea.getStartTime());
}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(overtimes),num)) {
String company = "未知",method = "无";//加班单位、加班补偿方式 if(ClockInTool.contains(ClockInTool.deleteArrayNull(leaves),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 2));
List<KqglAssoRelationSummary> leas = KqglAssoRelationSummary.builder().build().selectList(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 1)); String leavetype = "未知";//请假类型
for(KqglAssoRelationSummary lea : leas) { String company = "未知";//请假单位
if(lea != null) {
KqglAssoLeaveRules rul = KqglAssoLeaveRules.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getId, lea.getLeaveTypeId()));
if(rul != null) {
leavetype = rul.getName();
//1:按天请假;2:按半天;3:按小时
if(rul.getCompany() == 1) { company = "天"; }
else if(rul.getCompany() == 2) { company = "半天"; }
else { company = "小时"; }
}
}
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"请"+leavetype+lea.getDuration()+company);
}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(travels),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 3));
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"出差"+lea.getDuration()+"天");
}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(goouts),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 4));
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"外出"+lea.getDuration()+"天");
}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(cards),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 5));
rowData.add("已补卡:"+lea.getStartTime());
}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(overtimes),num)) {
//最小加班单位 1:按分钟加班、2:按半小时加班、3:按小时加班、4:按半天加班、5:按天加班 String company = "未知",method = "无";//加班单位、加班补偿方式
KqglAssoOvertimeBasics basics = KqglAssoOvertimeBasics.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeBasics>().lambda().eq(KqglAssoOvertimeBasics::getOrgCode, org_code));
if(basics.getMinimumUnit() == 1) { company = "分钟"; } List<KqglAssoRelationSummary> leas = KqglAssoRelationSummary.builder().build().selectList(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 1));
else if(basics.getMinimumUnit() == 2) { company = "半小时";} for(KqglAssoRelationSummary lea : leas) {
else if(basics.getMinimumUnit() == 3) { company = "小时";}
else if(basics.getMinimumUnit() == 4) { company = "半天";} //最小加班单位 1:按分钟加班、2:按半小时加班、3:按小时加班、4:按半天加班、5:按天加班
else if(basics.getMinimumUnit() == 5) { company = "天";} KqglAssoOvertimeBasics basics = KqglAssoOvertimeBasics.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeBasics>().lambda().eq(KqglAssoOvertimeBasics::getOrgCode, org_code));
//1:转调休;2:转加班费;3:转调休或加班费 if(basics.getMinimumUnit() == 1) { company = "分钟"; }
if(lea.getCompensateId() == 1) { method="转调休"; } else if(basics.getMinimumUnit() == 2) { company = "半小时";}
else if(lea.getCompensateId() == 2) { method="转加班费"; } else if(basics.getMinimumUnit() == 3) { company = "小时";}
else {method="转调休或加班费";} else if(basics.getMinimumUnit() == 4) { company = "半天";}
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"加班"+lea.getDuration()+company+"["+method+"]"); else if(basics.getMinimumUnit() == 5) { company = "天";}
//防止多运算 //1:转调休;2:转加班费;3:转调休或加班费
if(lea.getOrdernum() == lea.getTotals()) { if(lea.getCompensateId() == 1) { method="转调休"; }
//加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费 else if(lea.getCompensateId() == 2) { method="转加班费"; }
//工作日 else {method="转调休或加班费";}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(ycqts),num)) { rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"加班"+lea.getDuration()+company+"["+method+"]");
if(lea.getOvertimeTypeId() == 1) { //防止多运算
if(lea.getCompensateId() == 1 || lea.getCompensateId() == 3) { if(lea.getOrdernum() == lea.getTotals()) {
workingturncompenleave = workingturncompenleave + lea.getDuration(); //加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费
}else if(lea.getCompensateId() == 2 || lea.getCompensateId() == 4) { //工作日
workingtransferovertime = workingtransferovertime + + lea.getDuration(); if(ClockInTool.contains(ClockInTool.deleteArrayNull(ycqts),num)) {
if(lea.getOvertimeTypeId() == 1) {
if(lea.getCompensateId() == 1 || lea.getCompensateId() == 3) {
workingturncompenleave = workingturncompenleave + lea.getDuration();
}else if(lea.getCompensateId() == 2 || lea.getCompensateId() == 4) {
workingtransferovertime = workingtransferovertime + + lea.getDuration();
}
} }
} }
} //休息日
//休息日 if(ClockInTool.contains(ClockInTool.deleteArrayNull(xxts),num)) {
if(ClockInTool.contains(ClockInTool.deleteArrayNull(xxts),num)) { if(lea.getOvertimeTypeId() == 2) {
if(lea.getOvertimeTypeId() == 2) { if(lea.getCompensateId() == 1 || lea.getCompensateId() == 3) {
if(lea.getCompensateId() == 1 || lea.getCompensateId() == 3) { restturncompenleave = restturncompenleave + lea.getDuration();
restturncompenleave = restturncompenleave + lea.getDuration(); }else if(lea.getCompensateId() == 2 || lea.getCompensateId() == 4) {
}else if(lea.getCompensateId() == 2 || lea.getCompensateId() == 4) { resttransferovertime = resttransferovertime + lea.getDuration();
resttransferovertime = resttransferovertime + lea.getDuration(); }
} }
} }
} if(!ClockInTool.contains(ClockInTool.deleteArrayNull(ycqts),num) && !ClockInTool.contains(ClockInTool.deleteArrayNull(xxts),num)) {
if(!ClockInTool.contains(ClockInTool.deleteArrayNull(ycqts),num) && !ClockInTool.contains(ClockInTool.deleteArrayNull(xxts),num)) { if(lea.getOvertimeTypeId() == 3) {
if(lea.getOvertimeTypeId() == 3) { if(lea.getCompensateId() == 1 || lea.getCompensateId() == 3) {
if(lea.getCompensateId() == 1 || lea.getCompensateId() == 3) { // holidayturncompenleave++;
// holidayturncompenleave++; holidayturncompenleave = holidayturncompenleave + lea.getDuration();
holidayturncompenleave = holidayturncompenleave + lea.getDuration(); }else if(lea.getCompensateId() == 2 || lea.getCompensateId() == 4) {
}else if(lea.getCompensateId() == 2 || lea.getCompensateId() == 4) { // holidaytransferovertime++;
// holidaytransferovertime++; holidaytransferovertime = holidaytransferovertime + lea.getDuration();
holidaytransferovertime = holidaytransferovertime + lea.getDuration(); }
} }
} }
} }
} }
} }
} ////////
//////// KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
KqglAssoBcsz shif = KqglAssoBcsz.builder().build(); if(attgro.getPbfs() == 1){
int several = Integer.valueOf(ClockInTool.dateToWeek(num));//
if(attgro.getPbfs() == 1){ KqglAssoTeshu tesu = KqglAssoTeshu.builder().build().selectOne(new QueryWrapper<KqglAssoTeshu>().lambda().eq(KqglAssoTeshu::getKqzid, attgro.getId()).eq(KqglAssoTeshu::getTsrq, num));
int several = Integer.valueOf(ClockInTool.dateToWeek(num));// if(tesu == null) {
KqglAssoTeshu tesu = KqglAssoTeshu.builder().build().selectOne(new QueryWrapper<KqglAssoTeshu>().lambda().eq(KqglAssoTeshu::getKqzid, attgro.getId()).eq(KqglAssoTeshu::getTsrq, num)); //获取该员工最新班次
if(tesu == null) { KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, several));
if(gudingpb!=null) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
}
}else {
if(tesu.getBcid() > 0) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, tesu.getBcid()));
}
}
//获取该员工最新班次 //获取该员工最新班次
KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId()) KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, several)); .eq(KqglAssoZhoupaiban::getType, several));
if(gudingpb!=null) { if(gudingpb != null) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid())); shif = KqglAssoBcsz.builder().build();
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
} }
}else { }else if(attgro.getPbfs() == 2){
if(tesu.getBcid() > 0) { KqglAssoPbmx pbmxx = KqglAssoPbmx.builder().build().selectOne(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, user.getEmpnum()).eq(KqglAssoPbmx::getData, num).eq(KqglAssoPbmx::getKqzid, attgro.getId()));
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, tesu.getBcid())); if(pbmxx != null && pbmxx.getBcid() != 0) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, pbmxx.getBcid()));
} }
}
//获取该员工最新班次
KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, several));
if(gudingpb != null) {
shif = KqglAssoBcsz.builder().build();
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
} }
}else if(attgro.getPbfs() == 2){
KqglAssoPbmx pbmxx = KqglAssoPbmx.builder().build().selectOne(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, user.getEmpnum()).eq(KqglAssoPbmx::getData, num).eq(KqglAssoPbmx::getKqzid, attgro.getId())); if(shif != null && shif.getSxbcs() != null) {
if(pbmxx != null && pbmxx.getBcid() != 0) { System.out.println(shif.getSxbcs());
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, pbmxx.getBcid())); answer = shif.getSxbcs();//1=2次 2=4次 3=6次
//未打最后一次卡的时候 判断最后一次打卡时间是否在请假范围内 相对应减少下班缺卡次数
//最后一次应打卡时间
String latimeclock = "";
if(answer == 1) {
latimeclock = num +" "+ shif.getXbdk1();//ClockInTool.dealDateFormat(shif.getXbdk1(),3);
}else if(answer == 2) {
latimeclock = num +" "+ shif.getXbdk2();//ClockInTool.dealDateFormat(shif.getXbdk2(),3);
}else {
latimeclock = num +" "+ shif.getXbdk3();//ClockInTool.dealDateFormat(shif.getXbdk3(),3);
}
for(KqglAssoRelationSummary learel:leainv) {
boolean adopt = ClockInTool.hourMinuteBetween(latimeclock, learel.getStartTime().substring(0, 16), learel.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
if(adopt) {
xbqkcs = xbqkcs-1;
}
}
} }
} }
}else {
for (String num2 : range) {
if (Arrays.binarySearch(dkjtts, num2) >= 0) {
rowData.add("未排班并打卡");
}else{
rowData.add("未排班");
}
}
System.err.print("该员工未加入考勤组");
}
if(shif != null && shif.getSxbcs() != null) { String[] range1=ClockInTool.listToString(rowData).split(";");
System.out.println(shif.getSxbcs()); String[] noticesArray=range1[0].split(",");
answer = shif.getSxbcs();//1=2次 2=4次 3=6次 noticesArray = ClockInTool.arrycopy(noticesArray);
//未打最后一次卡的时候 判断最后一次打卡时间是否在请假范围内 相对应减少下班缺卡次数 for(int ct=noticesArray.length-1;ct<31;ct++) {
//最后一次应打卡时间 noticesArray[ct] = "";
String latimeclock = ""; if(ct<30) {
if(answer == 1) { noticesArray = ClockInTool.arrycopy(noticesArray);
latimeclock = num +" "+ shif.getXbdk1();//ClockInTool.dealDateFormat(shif.getXbdk1(),3);
}else if(answer == 2) {
latimeclock = num +" "+ shif.getXbdk2();//ClockInTool.dealDateFormat(shif.getXbdk2(),3);
}else {
latimeclock = num +" "+ shif.getXbdk3();//ClockInTool.dealDateFormat(shif.getXbdk3(),3);
}
for(KqglAssoRelationSummary learel:leainv) {
boolean adopt = ClockInTool.hourMinuteBetween(latimeclock, learel.getStartTime().substring(0, 16), learel.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
if(adopt) {
xbqkcs = xbqkcs-1;
}
}
} }
} }
}else { String department = "",position="";
for (String num2 : range) { if(user.getDepartment() != null) {
if (Arrays.binarySearch(dkjtts, num2) >= 0) { department = user.getDepartment();
rowData.add("未排班并打卡");
}else{
rowData.add("未排班");
}
} }
System.err.print("该员工未加入考勤组"); if(user.getPosition() != null) {
} position = user.getPosition();
String[] range1=ClockInTool.listToString(rowData).split(";");
String[] noticesArray=range1[0].split(",");
noticesArray = ClockInTool.arrycopy(noticesArray);
for(int ct=noticesArray.length-1;ct<31;ct++) {
noticesArray[ct] = "";
if(ct<30) {
noticesArray = ClockInTool.arrycopy(noticesArray);
} }
KqglAssoMonthPunchSummary summary = KqglAssoMonthPunchSummary.builder().name(user.getEmpname()).num(user.getEmpnum()).dept(department)
.post(position).attGroup(attgroid).shift(answer).build();
summary.setDaysOnDuty(daysOnDuty);//应出勤天数
summary.setActualAttDays(Double.valueOf(dkjl));//实际出勤天数
summary.setDaysOff(daysOff);//休息天数
summary.setWorkingHours(workinghours);
summary.setLateTimes(Double.valueOf(latenum));//迟到次数
summary.setLateHours(Double.valueOf(latehours));//迟到时长(分钟)
summary.setSeriousLateTimes(seriouslatetimes);//严重迟到次数
summary.setSeriousLateHours(seriouslatehours);//严重迟到时长(分钟)
summary.setAbsenLateTimes(absenlatetimes);//旷工迟到次数
summary.setEarlyLeaveTimes(Double.valueOf(leanum));//早退次数
summary.setLengthEarlyLeave(Double.valueOf(leahours));//早退时长(分钟)
summary.setNumberWorkCardShortage(Double.valueOf(sbqkcs));//上班缺卡次数
summary.setNumberDutyCardShortage(Double.valueOf(xbqkcs < 0 ? 0 : xbqkcs));//下班缺卡次数
summary.setLengthBusinessTrip(traveltotal);//出差时长
summary.setTimeOut(egresstotal);//外出时长
summary.setTotalOvertimeHours(overtimetotal);//加班总时长
summary.setBelongYear(ca.get(Calendar.YEAR));
summary.setBelongMonth(ca.get(Calendar.MONTH)+1);
summary.setOrgCode(org_code);
summary.setLastModified(new Date().getTime());
int absenteeismdays=0;
if(zjgzts-dkjl > 0) { absenteeismdays = zjgzts-dkjl; }
summary.setAbsenteeismDays(Double.valueOf(absenteeismdays));//旷工天数
summary.setWorkingTurnCompenLeave(workingturncompenleave);//工作日(转调休)
summary.setRestTurnCompenLeave(restturncompenleave);//休息日(转调休)
summary.setHolidayTurnCompenLeave(holidayturncompenleave);//节假日(转调休)
summary.setWorkingTransferOvertime(workingtransferovertime);//工作日(转加班费)
summary.setRestTransferOvertime(resttransferovertime);//休息日(转加班费)
summary.setHolidayTransferOvertime(holidaytransferovertime);//节假日(转加班费)
summary.setDay1(noticesArray[0]);
summary.setDay2(noticesArray[1]);
summary.setDay3(noticesArray[2]);
summary.setDay4(noticesArray[3]);
summary.setDay5(noticesArray[4]);
summary.setDay6(noticesArray[5]);
summary.setDay7(noticesArray[6]);
summary.setDay8(noticesArray[7]);
summary.setDay9(noticesArray[8]);
summary.setDay10(noticesArray[9]);
summary.setDay11(noticesArray[10]);
summary.setDay12(noticesArray[11]);
summary.setDay13(noticesArray[12]);
summary.setDay14(noticesArray[13]);
summary.setDay15(noticesArray[14]);
summary.setDay16(noticesArray[15]);
summary.setDay17(noticesArray[16]);
summary.setDay18(noticesArray[17]);
summary.setDay19(noticesArray[18]);
summary.setDay20(noticesArray[19]);
summary.setDay21(noticesArray[20]);
summary.setDay22(noticesArray[21]);
summary.setDay23(noticesArray[22]);
summary.setDay24(noticesArray[23]);
summary.setDay25(noticesArray[24]);
summary.setDay26(noticesArray[25]);
summary.setDay27(noticesArray[26]);
summary.setDay28(noticesArray[27]);
summary.setDay29(noticesArray[28]);
summary.setDay30(noticesArray[29]);
summary.setDay31(noticesArray[30]);
if(summaryid > 0) {
summary.setId(summaryid);
summary.updateById();
}else {
summary.insert();
}
// summary.insertOrUpdate();
} }
String department = "",position="";
if(user.getDepartment() != null) {
department = user.getDepartment();
}
if(user.getPosition() != null) {
position = user.getPosition();
}
KqglAssoMonthPunchSummary summary = KqglAssoMonthPunchSummary.builder().name(user.getEmpname()).num(user.getEmpnum()).dept(department)
.post(position).attGroup(attgroid).shift(answer).build();
summary.setDaysOnDuty(daysOnDuty);//应出勤天数
summary.setActualAttDays(Double.valueOf(dkjl));//实际出勤天数
summary.setDaysOff(daysOff);//休息天数
summary.setWorkingHours(workinghours);
summary.setLateTimes(Double.valueOf(latenum));//迟到次数
summary.setLateHours(Double.valueOf(latehours));//迟到时长(分钟)
summary.setSeriousLateTimes(seriouslatetimes);//严重迟到次数
summary.setSeriousLateHours(seriouslatehours);//严重迟到时长(分钟)
summary.setAbsenLateTimes(absenlatetimes);//旷工迟到次数
summary.setEarlyLeaveTimes(Double.valueOf(leanum));//早退次数
summary.setLengthEarlyLeave(Double.valueOf(leahours));//早退时长(分钟)
summary.setNumberWorkCardShortage(Double.valueOf(sbqkcs));//上班缺卡次数
summary.setNumberDutyCardShortage(Double.valueOf(xbqkcs < 0 ? 0 : xbqkcs));//下班缺卡次数
summary.setLengthBusinessTrip(traveltotal);//出差时长
summary.setTimeOut(egresstotal);//外出时长
summary.setTotalOvertimeHours(overtimetotal);//加班总时长
summary.setBelongYear(ca.get(Calendar.YEAR));
summary.setBelongMonth(ca.get(Calendar.MONTH)+1);
summary.setOrgCode(org_code);
summary.setLastModified(new Date().getTime());
int absenteeismdays=0;
if(zjgzts-dkjl > 0) { absenteeismdays = zjgzts-dkjl; }
summary.setAbsenteeismDays(Double.valueOf(absenteeismdays));//旷工天数
summary.setWorkingTurnCompenLeave(workingturncompenleave);//工作日(转调休)
summary.setRestTurnCompenLeave(restturncompenleave);//休息日(转调休)
summary.setHolidayTurnCompenLeave(holidayturncompenleave);//节假日(转调休)
summary.setWorkingTransferOvertime(workingtransferovertime);//工作日(转加班费)
summary.setRestTransferOvertime(resttransferovertime);//休息日(转加班费)
summary.setHolidayTransferOvertime(holidaytransferovertime);//节假日(转加班费)
summary.setDay1(noticesArray[0]);
summary.setDay2(noticesArray[1]);
summary.setDay3(noticesArray[2]);
summary.setDay4(noticesArray[3]);
summary.setDay5(noticesArray[4]);
summary.setDay6(noticesArray[5]);
summary.setDay7(noticesArray[6]);
summary.setDay8(noticesArray[7]);
summary.setDay9(noticesArray[8]);
summary.setDay10(noticesArray[9]);
summary.setDay11(noticesArray[10]);
summary.setDay12(noticesArray[11]);
summary.setDay13(noticesArray[12]);
summary.setDay14(noticesArray[13]);
summary.setDay15(noticesArray[14]);
summary.setDay16(noticesArray[15]);
summary.setDay17(noticesArray[16]);
summary.setDay18(noticesArray[17]);
summary.setDay19(noticesArray[18]);
summary.setDay20(noticesArray[19]);
summary.setDay21(noticesArray[20]);
summary.setDay22(noticesArray[21]);
summary.setDay23(noticesArray[22]);
summary.setDay24(noticesArray[23]);
summary.setDay25(noticesArray[24]);
summary.setDay26(noticesArray[25]);
summary.setDay27(noticesArray[26]);
summary.setDay28(noticesArray[27]);
summary.setDay29(noticesArray[28]);
summary.setDay30(noticesArray[29]);
summary.setDay31(noticesArray[30]);
if(summaryid > 0) {
summary.setId(summaryid);
summary.updateById();
}else {
summary.insert();
}
// summary.insertOrUpdate();
} }
} }
......
...@@ -18,6 +18,8 @@ public class AttendanceSummaryQueryDto extends Page { ...@@ -18,6 +18,8 @@ public class AttendanceSummaryQueryDto extends Page {
private String query; private String query;
private String times; private String times;
private Integer attid; private Integer attid;
private Integer turnover_status;
private String year; private String year;
private String month; private String month;
......
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{orgcode} where emp.org_code = #{orgcode}
and emp.job_status != 3 <!-- and emp.job_status != 3 -->
</select> </select>
<select id="RealTimeUpdate" resultMap="AdditionalMap"> <select id="RealTimeUpdate" resultMap="AdditionalMap">
......
...@@ -288,6 +288,9 @@ ...@@ -288,6 +288,9 @@
<if test="param.attid != null and param.attid != ''"> <if test="param.attid != null and param.attid != ''">
and sum.att_group = #{param.attid} and sum.att_group = #{param.attid}
</if> </if>
<if test="param.turnover_status == 1">
and sum.num not in (select em.emp_num from yggl_main_lzb em where em.org_code = #{param.orgCode} and em.job_status = 3)
</if>
<!-- yz.id as yzid, <!-- yz.id as yzid,
yz.leave_rules_id as leaverulesid, yz.leave_rules_id as leaverulesid,
...@@ -479,6 +482,9 @@ ...@@ -479,6 +482,9 @@
<if test="param.attid != null and param.attid != ''"> <if test="param.attid != null and param.attid != ''">
and sum.att_group = #{param.attid} and sum.att_group = #{param.attid}
</if> </if>
<if test="param.turnover_status == 1">
and sum.num not in (select em.emp_num from yggl_main_lzb em where em.org_code = #{param.orgCode} and em.job_status = 3)
</if>
<!-- LEFT JOIN kqgl_asso_leave_employee_balance as mrtj on mrtj.userid = sum.num <!-- LEFT JOIN kqgl_asso_leave_employee_balance as mrtj on mrtj.userid = sum.num
IFNULL(mrtj.leave_rules_id,'') as leaverulesid, IFNULL(mrtj.leave_rules_id,'') as leaverulesid,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment