Commit b6bb94b4 by 邓实川
parents 6467418f c0a991a9
...@@ -51,13 +51,19 @@ public class KqglAssoRelationSummary extends Model<KqglAssoRelationSummary> { ...@@ -51,13 +51,19 @@ public class KqglAssoRelationSummary extends Model<KqglAssoRelationSummary> {
@ApiModelProperty(value = "时长 时长", example = "101") @ApiModelProperty(value = "时长 时长", example = "101")
private double duration; private double duration;
@ApiModelProperty(value="假期类型id",example="101") @ApiModelProperty(value = "假期类型id", example = "101")
private Integer leaveTypeId; private Integer leaveTypeId;
@ApiModelProperty(value="加班类型id",example="101") @ApiModelProperty(value = "加班类型id", example = "101")
private Integer overtimeTypeId; private Integer overtimeTypeId;
@ApiModelProperty(value="加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费",example="101") @ApiModelProperty(value = "加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费", example = "101")
private Integer compensateId; private Integer compensateId;
@ApiModelProperty(value = "开始时间 ", example = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间 ", example = "结束时间")
private String endTime;
} }
\ No newline at end of file
...@@ -151,7 +151,7 @@ public class ClockInController { ...@@ -151,7 +151,7 @@ public class ClockInController {
String staputime = new SimpleDateFormat("HH:mm").format(punchstart);//应打卡开始时间 String staputime = new SimpleDateFormat("HH:mm").format(punchstart);//应打卡开始时间
String entputime = new SimpleDateFormat("HH:mm").format(punchend);//应打卡结束时间 String entputime = new SimpleDateFormat("HH:mm").format(punchend);//应打卡结束时间
String DKputime = new SimpleDateFormat("HH:mm").format(time_);//打卡时间 String DKputime = new SimpleDateFormat("HH:mm").format(time_);//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime); boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"HH:mm");
if (!effectiveDate) { if (!effectiveDate) {
System.out.println("当前打卡时间不在范围内"); System.out.println("当前打卡时间不在范围内");
// 手动抛出异常 // 手动抛出异常
......
package cn.timer.api.controller.kqgl; package cn.timer.api.controller.kqgl;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -9,6 +8,7 @@ import java.util.Arrays; ...@@ -9,6 +8,7 @@ import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
...@@ -21,6 +21,57 @@ public class ClockInTool { ...@@ -21,6 +21,57 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd"); static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
// 数组容量的扩容,当空间(.length)不够的时候,增加一
public static String[] arrycopy(String[] ss) {
// TODO Auto-generated method stub
String[] ii = new String[ss.length + 1];
System.arraycopy(ss, 0, ii, 0, ss.length);
return ii;
}
public static String[] replaceNull(String[] str) {
// 用StringBuffer来存放数组中的非空元素,用“;”分隔
StringBuffer sb = new StringBuffer();
for (int i = 0; i < str.length; i++) {
if ("".equals(str[i])) {
continue;
}
sb.append(str[i]);
if (i != str.length - 1) {
sb.append(";");
}
}
// 用String的split方法分割,得到数组
str = sb.toString().split(";");
return str;
}
/**
* 删除数组中的指定值 或者数组中的元素包含指定值
*
* @param filters 数组
* @param target 指定值
* @return
*/
public static String[] doChinFilters(String[] filters, String target) {
String[] res = null;
if (filters.length > 0) {
List<String> tempList = Arrays.asList(filters);
// Arrays.asList(filters) 迭代器实现类 不支持remove() 删除,多一步转化
List<String> arrList = new ArrayList<String>(tempList);
Iterator<String> it = arrList.iterator();
while (it.hasNext()) {
String x = it.next();
if (x.indexOf(target) != -1) {
it.remove();
}
}
res = new String[arrList.size()];
arrList.toArray(res);
}
return res;
}
/** /**
* 获取两个日期之间的所有日期 * 获取两个日期之间的所有日期
*/ */
...@@ -218,13 +269,20 @@ public class ClockInTool { ...@@ -218,13 +269,20 @@ public class ClockInTool {
* @return true在时间段内,false不在时间段内 * @return true在时间段内,false不在时间段内
* @throws Exception * @throws Exception
*/ */
public static boolean hourMinuteBetween(String nowDate, String startDate, String endDate) throws Exception { public static boolean hourMinuteBetween(String nowDate, String startDate, String endDate,String date_format){
SimpleDateFormat format = new SimpleDateFormat("HH:mm"); SimpleDateFormat format = new SimpleDateFormat(date_format);
Date now = format.parse(nowDate); Date now = null;
Date start = format.parse(startDate); Date start = null;
Date end = format.parse(endDate); Date end = null;
try {
now = format.parse(nowDate);
start = format.parse(startDate);
end = format.parse(endDate);
} catch (ParseException e) {
e.printStackTrace();
}
long nowTime = now.getTime(); long nowTime = now.getTime();
long startTime = start.getTime(); long startTime = start.getTime();
...@@ -283,6 +341,8 @@ public class ClockInTool { ...@@ -283,6 +341,8 @@ public class ClockInTool {
df2 = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss"); df2 = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss");
} else if (num == 2) { } else if (num == 2) {
df2 = new SimpleDateFormat("HH:mm"); df2 = new SimpleDateFormat("HH:mm");
}else if (num == 3) {
df2 = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm");
} }
return df2.format(date1); return df2.format(date1);
......
...@@ -928,9 +928,6 @@ public class TimeCardController { ...@@ -928,9 +928,6 @@ public class TimeCardController {
return ResultUtil.data(yggl); return ResultUtil.data(yggl);
} }
//用户和考勤组关系
@Autowired
private UserAttendanceRelMapper userattendancerelservice;
//用户与设备关系表 //用户与设备关系表
@Autowired @Autowired
private UserEquiRelationMapper userequirelationmapper; private UserEquiRelationMapper userequirelationmapper;
......
...@@ -2,6 +2,7 @@ package cn.timer.api.controller.kqgl.atttimer; ...@@ -2,6 +2,7 @@ package cn.timer.api.controller.kqgl.atttimer;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
...@@ -18,12 +19,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -18,12 +19,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.timer.api.bean.kqgl.AttendanceWeeklySch; import cn.timer.api.bean.kqgl.AttendanceWeeklySch;
import cn.timer.api.bean.kqgl.PunchCardDetails; import cn.timer.api.bean.kqgl.PunchCardDetails;
import cn.timer.api.bean.kqgl.PunchRecord;
import cn.timer.api.bean.kqgl.Schedule; import cn.timer.api.bean.kqgl.Schedule;
import cn.timer.api.bean.kqmk.KqglAssoBcsz; import cn.timer.api.bean.kqmk.KqglAssoBcsz;
import cn.timer.api.bean.kqmk.KqglAssoDkjl; import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.kqmk.KqglAssoDkmx;
import cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary; import cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary;
import cn.timer.api.bean.kqmk.KqglAssoOvertimeBasics;
import cn.timer.api.bean.kqmk.KqglAssoPbmx; import cn.timer.api.bean.kqmk.KqglAssoPbmx;
import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
import cn.timer.api.bean.kqmk.KqglAssoTeshu; 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;
...@@ -32,13 +35,16 @@ import cn.timer.api.bean.qyzx.QyzxEntInfoM; ...@@ -32,13 +35,16 @@ import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.controller.kqgl.ClockInTool; import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.dao.kqgl.AttendanceWeeklySchMapper; import cn.timer.api.dao.kqgl.AttendanceWeeklySchMapper;
import cn.timer.api.dao.kqgl.PunchCardDetailsMapper; import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.kqgl.ScheduleMapper; import cn.timer.api.dao.kqgl.ScheduleMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkjlMapper; import cn.timer.api.dao.kqmk.KqglAssoDkmxMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper; import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
import cn.timer.api.dao.kqmk.KqglAssoRelationSummaryMapper;
import cn.timer.api.dao.kqmk.KqglAssoTeshuMapper; import cn.timer.api.dao.kqmk.KqglAssoTeshuMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper; import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dao.qyzx.QyzxEntInfoMMapper; import cn.timer.api.dao.qyzx.QyzxEntInfoMMapper;
import cn.timer.api.dto.kqmk.AdditionalDto; import cn.timer.api.dto.kqmk.AdditionalDto;
import cn.timer.api.dto.kqmk.AttSubsidiaryDto;
import cn.timer.api.utils.DateUtil; import cn.timer.api.utils.DateUtil;
/** /**
...@@ -61,18 +67,13 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -61,18 +67,13 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
@Autowired @Autowired
private KqglAssoTeshuMapper kqglassoteshumapper; private KqglAssoTeshuMapper kqglassoteshumapper;
@Autowired @Autowired
private KqglAssoDkjlMapper kqglassodkjlmapper;
@Autowired
private PunchCardDetailsMapper punchcarddetailsmapper; private PunchCardDetailsMapper punchcarddetailsmapper;
@Autowired @Autowired
private AttendanceWeeklySchMapper attendanceweeklyschmapper; private AttendanceWeeklySchMapper attendanceweeklyschmapper;
@Autowired @Autowired
private ScheduleMapper schedulemapper; private ScheduleMapper schedulemapper;
static SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
static SimpleDateFormat sdf2 = new SimpleDateFormat("EEE");
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("EEE");
/** /**
* 数据库动态更改定时配置(attendance_socks) * 数据库动态更改定时配置(attendance_socks)
*/ */
...@@ -91,30 +92,37 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -91,30 +92,37 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
}); });
} }
@Autowired
private KqglAssoRelationSummaryMapper kqglassorelationsummarymapper;
@Autowired
private PunchRecordMapper punchrecordmapper;
@Autowired
private KqglAssoDkmxMapper kqglassodkmxmapper;
/** /**
* @return * @return
* @throws ParseException * @throws ParseException
*/ */
// @Scheduled(cron = "0/5 * * * * ?") // 测试:5秒执行一次 // @Scheduled(cron = "0/5 * * * * ?") // 测试:5秒执行一次
@SuppressWarnings("unused")
public String AttendanceTask() throws ParseException { public String AttendanceTask() throws ParseException {
boolean implement = false; boolean implement = false;
KqglTaskTiming sock = KqglTaskTiming.builder().build().selectOne(new QueryWrapper<KqglTaskTiming>().lambda().eq(KqglTaskTiming::getTask, "AttendanceTask")); // int sockid = 0;
if(sock == null) { // KqglTaskTiming sock = KqglTaskTiming.builder().build().selectOne(new QueryWrapper<KqglTaskTiming>().lambda().eq(KqglTaskTiming::getTask, "AttendanceTask"));
KqglTaskTiming.builder().task("AttendanceTask").executionStatus(1).lastExecutionTime(new Date().getTime()).build().insert(); // if(sock == null) {
implement = true; // KqglTaskTiming sock1 = KqglTaskTiming.builder().task("AttendanceTask").executionStatus(1).lastExecutionTime(new Date().getTime()).build();
}else { // sock1.insert();
if(sock.getExecutionStatus() == 0) { // sockid = sock1.getId();
KqglTaskTiming.builder().task("AttendanceTask").id(sock.getId()).executionStatus(1).lastExecutionTime(new Date().getTime()).build().updateById(); // implement = true;
implement = true; // }else {
} // sockid = sock.getId();
} // if(sock.getExecutionStatus() == 0) {
// KqglTaskTiming.builder().task("AttendanceTask").id(sock.getId()).executionStatus(1).lastExecutionTime(new Date().getTime()).build().updateById();
// implement = true;
// }
// }
//逻辑 //逻辑
if(false) { if(implement) {
System.err.println("当前时间:" + dateFormat.format(new Date())); System.err.println("时间:" + dateFormat.format(new Date()));
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0); c.add(Calendar.MONTH, 0);
...@@ -128,244 +136,550 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -128,244 +136,550 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>());//系统中的所有公司 所有未到期的公司 List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>());//系统中的所有公司 所有未到期的公司
String str = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();// String str = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();//
String ttstr = new SimpleDateFormat("yyyy-MM").format(new Date()).toString();//
String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期 String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
for(int t = 0;t<orgcodelist.size();t++){ int year = Calendar.getInstance().get(Calendar.YEAR);
int org_code = orgcodelist.get(t).getId();//企业组织代码 int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
KqglAssoMonthPunchSummary.builder().build().delete(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getBelongYear, year).eq(KqglAssoMonthPunchSummary::getBelongMonth, month));
// for(int t = 0;t<orgcodelist.size();t++){
int org_code = 117;//orgcodelist.get(t).getId();//企业组织代码
List<AdditionalDto> userlist = kqglassoleavebalancemapper.selectAdditionalList(org_code); List<AdditionalDto> userlist = kqglassoleavebalancemapper.selectAdditionalList(org_code);
for(AdditionalDto user : userlist) { for(AdditionalDto user : userlist) {
/*****/ for(String num : range) {//遍历目前为止所有日期 double traveltotal = 0,egresstotal = 0,overtimetotal = 0;
//出差总时长
Long startDatestop = DateUtil.getStartTime(0,DateUtil.getStringTime(num,"yyyy-MM-dd")).getTime(); KqglAssoRelationSummary travel = kqglassorelationsummarymapper.SecondaryValue(user.getEmpnum(), 3, ttstr);
Long endDatestop = DateUtil.getnowEndTime(23,DateUtil.getStringTime(num,"yyyy-MM-dd")).getTime(); 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); KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(user.getEmpnum(),org_code);
//目前为止打卡记录 //目前为止打卡记录
List<PunchCardDetails> attendance = punchcarddetailsmapper.selectAttendanceDays(Integer.valueOf(user.getEmpnum()), startDate, new Date().getTime()); List<PunchCardDetails> attendance = punchcarddetailsmapper.selectAttendanceDays(user.getEmpnum(), startDate, new Date().getTime());
int dkjl = 0;//目前为止打卡次数 int dkjl = 0;//目前为止打卡次数
if(attendance.size() > 0) { dkjl = attendance.size(); } int sbqkcs = 0,xbqkcs = 0,dk=0;
String[] sblacks = new String[31];//上班缺卡天数
String[] xblacks = new String[31];//下班缺卡天数
String[] dkjtts = new String[attendance.size()];//目前打卡日期明细
if(attendance.size() > 0) {
dkjl = attendance.size();
for(PunchCardDetails pcd:attendance){
dkjtts[dk] = pcd.getData();
dk++;
if(pcd.getYdkcs() == 2 || pcd.getYdkcs() == 4 || pcd.getYdkcs() == 6){
if(pcd.getSbdk1() == null){ sblacks[sbqkcs] = pcd.getData(); sbqkcs++; }
if(pcd.getXbdk1() == null){ xblacks[xbqkcs] = pcd.getData(); xbqkcs++; }
}
if(pcd.getYdkcs() == 4 || pcd.getYdkcs() == 6){
if(pcd.getSbdk2() == null){ sblacks[sbqkcs] = pcd.getData(); sbqkcs++; }
if(pcd.getXbdk2() == null){ xblacks[xbqkcs] = pcd.getData(); xbqkcs++; }
}
if(pcd.getYdkcs() == 6){
if(pcd.getSbdk3() == null){ sblacks[sbqkcs] = pcd.getData(); sbqkcs++; }
if(pcd.getXbdk3() == null){ xblacks[xbqkcs] = pcd.getData(); xbqkcs++; }
}
}
}
//具体打卡时间入汇总表(打卡成功才会录入汇总表) //具体打卡时间入汇总表(打卡成功才会录入汇总表)
KqglAssoMonthPunchSummary isyessum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda() // KqglAssoMonthPunchSummary isyessum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda()
.eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code)); // .eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code));
int year = Calendar.getInstance().get(Calendar.YEAR);
int month = Calendar.getInstance().get(Calendar.MONTH) + 1; String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd)
if(attgro != null){//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数 String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd)
KqglAssoBcsz shif = KqglAssoBcsz.builder().build(); List<String> rowData = new ArrayList<String>();
//休息天数,应出勤天数,实际出勤 //休息天数,应出勤天数,实际出勤
double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0; double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0;
int zjgzts = 0;//目前为止应该出勤的天数 int zjgzts = 0;//目前为止应该出勤的天数
if(attgro.getPbfs() == 1){ //固定排班 KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
int several = Integer.valueOf(ClockInTool.dateToWeek(str));// //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
KqglAssoTeshu tesu = KqglAssoTeshu.builder().build().selectOne(new QueryWrapper<KqglAssoTeshu>().lambda().eq(KqglAssoTeshu::getKqzid, attgro.getId()).eq(KqglAssoTeshu::getTsrq, str)); double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
if(tesu == null) { // 迟到次数 迟到时长 早退次数 早退时长
//获取该员工最新班次 int latenum = 0,latehours = 0,leanum = 0,leahours = 0;// 迟到次数
KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, several)); double workingturncompenleave = 0;//工作日(转调休)
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid())); double restturncompenleave = 0;//休息日(转调休)
}else { double holidayturncompenleave = 0;//节假日(转调休)
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, tesu.getBcid())); double workingtransferovertime = 0;//工作日(转加班费)
} double resttransferovertime = 0;//休息日(转加班费)
double holidaytransferovertime = 0;//节假日(转加班费)
//获取该员工最新班次
KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId()) int attgroid = 0;
.eq(KqglAssoZhoupaiban::getType, several));
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid())); if(attgro != null){//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数
attgroid = attgro.getId();
List<KqglAssoTeshu> bxdklist = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), month,1);//当前月 必须打卡日期 // KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
int bxdk = bxdklist.size(); // //休息天数,应出勤天数,实际出勤
String[] bxdkss = new String[bxdk]; // double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0;
int b = 0; // int zjgzts = 0;//目前为止应该出勤的天数
for(KqglAssoTeshu bxd : bxdklist) { if(attgro.getPbfs() == 1){ //固定排班
bxdkss[b] = bxd.getTsrq();
b++; List<KqglAssoTeshu> bxdklist = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), ttstr,1);//当前月 必须打卡日期
} int bxdk = bxdklist.size();
List<KqglAssoTeshu> wxdk = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), month,2);//当前月 无需打卡日期 String[] bxdkss = new String[bxdk];////特殊-必须打卡天数(工作日)
String[] appmaps= new String[wxdk.size()]; int b = 0;
int d1 = 0; for(KqglAssoTeshu bxd : bxdklist) {
for(KqglAssoTeshu spe:wxdk){ bxdkss[b] = bxd.getTsrq();
appmaps[d1] = spe.getTsrq(); b++;
d1++; }
} List<KqglAssoTeshu> wxdk = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), ttstr,2);//当前月 无需打卡日期
List<AttendanceWeeklySch> atwek = attendanceweeklyschmapper.selectAttendanceMadeByUserid(Integer.valueOf(user.getEmpnum())); String[] appmaps= new String[wxdk.size()];//特殊-无需打卡天数(休息日)
String[] week= new String[atwek.size()]; int d1 = 0;
String[] needfig = new String[atwek.size()]; for(KqglAssoTeshu spe:wxdk){
int e = 0; appmaps[d1] = spe.getTsrq();
for(AttendanceWeeklySch awek : atwek){ d1++;
week[e] = awek.getWekmc(); }
needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几
e++;
} List<AttendanceWeeklySch> atwek = attendanceweeklyschmapper.selectAttendanceMadeByUserid(user.getEmpnum());
String yemo = year + "-" + month; String[] week= new String[atwek.size()];
sdf1.setLenient(false); String[] needfig = new String[atwek.size()];//应打卡周期时间
int y = 0,q = 0; int e = 0;
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){ for(AttendanceWeeklySch awek : atwek){
Date date1 = sdf1.parse(yemo + "-" + i); week[e] = awek.getWekmc();
for(int u=0;u<week.length;u++){ needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几
if(sdf2.format(date1).equals(week[u])){ e++;
q++; }
y++; String yemo = year + "-" + month;
if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){ sdf1.setLenient(false);
y = y-1; 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; int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size();
daysOnDuty = y+bxdk; daysOff = xiuxi;
daysOnDuty = y+bxdk;
// String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期 // String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
// int zjgzts = 0;//目前为止应该出勤的天数 // int zjgzts = 0;//目前为止应该出勤的天数
//目前为止应出勤天数 //目前为止应出勤天数
int w = 0,x=0;
for(String num : range) {
if(Arrays.binarySearch(needfig, Integer.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间 if(Arrays.binarySearch(needfig, Integer.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
ycqts[w] = num;
w++;
zjgzts++; zjgzts++;
}else {
xxts[x] = num;
x++;
} }
if(Arrays.binarySearch(bxdkss, num) >= 0) {//检查是否存在 必须打卡名单中 if(Arrays.binarySearch(bxdkss, num) >= 0) {//检查是否存在 必须打卡名单中
ycqts[w] = num;
w++;
zjgzts++; zjgzts++;
ClockInTool.doChinFilters(xxts, num);//为必须上班的话从休息日期中去除
} }
if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中 if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中
ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除
zjgzts = zjgzts - 1; zjgzts = zjgzts - 1;
xxts[x] = num;
x++;
} }
}else if(attgro.getPbfs() == 2){ //自由排班 }
KqglAssoPbmx pbmxx = KqglAssoPbmx.builder().build().selectOne(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, user.getEmpnum()).eq(KqglAssoPbmx::getData, str).eq(KqglAssoPbmx::getKqzid, attgro.getId())); }else if(attgro.getPbfs() == 2){ //自由排班
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, pbmxx.getBcid())); List<Schedule> ycqs = schedulemapper.getAttendanceShouldList(user.getEmpnum(),startDate,endDate);
List<Schedule> ycqs = schedulemapper.getAttendanceShouldList(Integer.valueOf(user.getEmpnum()),startDate,endDate); int xiuxi = 0,shangban = 0,z=0;
int xiuxi = 0,shangban = 0,z=0; String[] ziyoupb = new String[ycqs.size()];
String[] ziyoupb = new String[ycqs.size()]; for(Schedule sc : ycqs){
for(Schedule sc : ycqs){ ziyoupb[z] = String.valueOf(sc.getData());
ziyoupb[z] = String.valueOf(sc.getData()); z++;
z++; if(sc.getBcid().equals(0)){
if(sc.getBcid().equals(0)){ xiuxi++;
xiuxi++; }else{
}else{ shangban++;
shangban++;
}
} }
daysOff = xiuxi; }
daysOnDuty = shangban; daysOff = xiuxi;
//目前为止应出勤天数 daysOnDuty = shangban;
//目前为止应出勤天数
int y = 0,x=0;
for(String num : range) {
if(Arrays.binarySearch(ziyoupb, num) >= 0) { if(Arrays.binarySearch(ziyoupb, num) >= 0) {
KqglAssoPbmx pbx = KqglAssoPbmx.builder().build().selectOne(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, user.getEmpnum()).eq(KqglAssoPbmx::getData, num).eq(KqglAssoPbmx::getKqzid, attgro.getId())); KqglAssoPbmx pbx = KqglAssoPbmx.builder().build().selectOne(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, user.getEmpnum()).eq(KqglAssoPbmx::getData, num).eq(KqglAssoPbmx::getKqzid, attgro.getId()));
if(pbx!=null && pbx.getBcid()!=0) { if(pbx!=null && pbx.getBcid()!=0) {
ycqts[y] = num;
zjgzts++; zjgzts++;
}else {
xxts[x] = num;
x++;
} }
} }
}else{ }
List<AttendanceWeeklySch> atwek = attendanceweeklyschmapper.selectAttendanceMadeByUserid(Integer.valueOf(user.getEmpnum())); }else{
String[] week= new String[atwek.size()]; List<AttendanceWeeklySch> atwek = attendanceweeklyschmapper.selectAttendanceMadeByUserid(user.getEmpnum());
int e = 0; String[] week= new String[atwek.size()];
String[] ziyoupb = new String[atwek.size()]; int e = 0;
for(AttendanceWeeklySch awek : atwek){ String[] ziyoupb = new String[atwek.size()];
week[e] = awek.getWekmc(); for(AttendanceWeeklySch awek : atwek){
ziyoupb[e] = String.valueOf(awek.getType()); week[e] = awek.getWekmc();
e++; ziyoupb[e] = String.valueOf(awek.getType());
} e++;
String yemo = year + "-" + month; }
sdf1.setLenient(false); String yemo = year + "-" + month;
int y = 0; sdf1.setLenient(false);
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){ int y = 0;
Date date1 = sdf1.parse(yemo + "-" + i); for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
for(int u=0;u<week.length;u++){ Date date1 = sdf1.parse(yemo + "-" + i);
if(sdf2.format(date1).equals(week[u])){ for(int u=0;u<week.length;u++){
y++; if(sdf2.format(date1).equals(week[u])){
} y++;
} }
} }
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - y; }
daysOff = xiuxi; int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - y;
daysOnDuty = y; daysOff = xiuxi;
//目前为止应出勤天数 daysOnDuty = y;
//目前为止应出勤天数
int g = 0,x=0;
for(String num : range) {
if(Arrays.binarySearch(ziyoupb, Integer.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间 if(Arrays.binarySearch(ziyoupb, Integer.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
zjgzts++; ycqts[g] = num;
zjgzts++;
}else {
xxts[x] = num;
x++;
}
}
}
List<PunchRecord> initial = punchrecordmapper.getMaintenancePunchCardList(startDate,new Date().getTime(),user.getEmpnum());
// // 迟到次数 迟到时长 早退次数 早退时长
// int latenum = 0,latehours = 0,leanum = 0,leahours = 0;// 迟到次数
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);
// //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
// double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
if(subs != null) {
workinghours = subs.getGzsctotalgzsc();
seriouslatetimes = subs.getYzcdcstotal();
seriouslatehours = subs.getYzcdsctotal();
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> trtotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 3, ttstr);
String[] travels = new String[trtotal.size()];
int cx = 0;
if(trtotal.size()>0) {
for(KqglAssoRelationSummary trt : trtotal) {
travels[cx] = trt.getAppTime();
cx++;
}
}
//具体外出天数
List<KqglAssoRelationSummary> goouttotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 4, ttstr);
String[] goouts = new String[goouttotal.size()];
int wc = 0;
if(goouttotal.size()>0) {
for(KqglAssoRelationSummary go:goouttotal) {
goouts[wc] = go.getAppTime();
wc++;
}
}
//具体补卡天数
List<KqglAssoRelationSummary> cardtotal = kqglassorelationsummarymapper.SpecificLeave(user.getEmpnum(), 5, ttstr);
String[] cards = new String[cardtotal.size()];
int bk = 0;
if(cardtotal.size()>0) {
for(KqglAssoRelationSummary car : cardtotal) {
cards[bk] = car.getAppTime();
bk++;
}
}
//排查请假是否在最后一次打卡范围内
List<KqglAssoRelationSummary> leainv = kqglassorelationsummarymapper.LeaveInvestigation(user.getEmpnum(), 2, ttstr);
int answer = shif.getSxbcs();//1=2次 2=4次 3=6次
String beginTime = sdf1.format(new Date());
// List<String> rowData = new ArrayList<String>();
//遍历目前为止所有日期 结合该用户发起的审批进行结合
//1:加班 2:请假 3:出差 4:外出 5:补卡
for(String num : range) {
if(Arrays.binarySearch(ClockInTool.replaceNull(xxts), num) >= 0 && Arrays.binarySearch(ClockInTool.replaceNull(dkjtts),num) >= 0) {
rowData.add("休息并打卡");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(xxts), num) >= 0){
rowData.add("休息");
}else {
if(Arrays.binarySearch(ClockInTool.replaceNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(leaves), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(travels), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(goouts), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(cards), num) < 0) {
rowData.add("旷工");
}else if(sdf1.parse(beginTime).getTime() <= sdf1.parse(num).getTime()) {
rowData.add("未到班期");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(leaves), num) >= 0) {//请假
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 2));
String leavetype = "未知";//请假类型
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);
}else if(Arrays.binarySearch(ClockInTool.replaceNull(travels), num) >= 0) {//出差
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()+"天");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(goouts), num) >= 0){//外出
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()+"天");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(cards), num) >= 0){//补卡
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());
}else if(Arrays.binarySearch(ClockInTool.replaceNull(overtimes), num) >= 0) {//加班
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 1));
String company = "未知",method = "无";//加班单位、加班补偿方式
//最小加班单位 1:按分钟加班、2:按半小时加班、3:按小时加班、4:按半天加班、5:按天加班
KqglAssoOvertimeBasics basics = KqglAssoOvertimeBasics.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeBasics>().lambda().eq(KqglAssoOvertimeBasics::getOrgCode, org_code));
if(basics.getMinimumUnit() == 1) { company = "分钟"; }
else if(basics.getMinimumUnit() == 2) { company = "半小时";}
else if(basics.getMinimumUnit() == 3) { company = "小时";}
else if(basics.getMinimumUnit() == 4) { company = "半天";}
else if(basics.getMinimumUnit() == 5) { company = "天";}
//1:转调休;2:转加班费;3:转调休或加班费
if(lea.getCompensateId() == 1) { method="转调休"; }
else if(lea.getCompensateId() == 2) { method="转加班费"; }
else {method="转调休或加班费";}
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"加班"+lea.getDuration()+company+"["+method+"]");
//加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费
//工作日
if(Arrays.binarySearch(ClockInTool.replaceNull(ycqts), num) >= 0) {
if(lea.getCompensateId() == 1) {
workingturncompenleave++;
}else if(lea.getCompensateId() == 2) {
workingtransferovertime++;
}
}
//休息日
if(Arrays.binarySearch(ClockInTool.replaceNull(xxts), num) >= 0) {
if(lea.getCompensateId() == 1) {
restturncompenleave++;
}else if(lea.getCompensateId() == 2) {
resttransferovertime++;
}
}
if(Arrays.binarySearch(ClockInTool.replaceNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(xxts), num) < 0) {
if(lea.getCompensateId() == 1) {
holidayturncompenleave++;
}else if(lea.getCompensateId() == 2) {
holidaytransferovertime++;
} }
}
}else{
if(Arrays.binarySearch(ClockInTool.replaceNull(sblacks), num) >= 0) {
rowData.add("上班缺卡");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(sblacks), num) >= 0 && Arrays.binarySearch(ClockInTool.replaceNull(ztts), num) >= 0) {
rowData.add("上班缺卡,下班早退");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(cdts), num) >= 0) {
rowData.add("上班迟到");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.replaceNull(xblacks), num) >= 0) {
rowData.add("上班迟到,下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.replaceNull(ztts), num) >= 0) {
rowData.add("上班迟到,下班早退");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(xblacks), num) >= 0) {
rowData.add("下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(ztts), num) >= 0) {
rowData.add("下班早退");
}else {
rowData.add("正常");
}
} }
int answer = shif.getSxbcs();//1=2次 2=4次 3=6次 }
//当天打卡是否是最后一次 --- 归档
List<KqglAssoDkjl> zdkcs = kqglassodkjlmapper.selectList(new QueryWrapper<KqglAssoDkjl>().lambda().eq(KqglAssoDkjl::getUserId, user.getEmpnum())
.ne(KqglAssoDkjl::getStatus, 0).gt(KqglAssoDkjl::getDktime, startDatestop).lt(KqglAssoDkjl::getDktime, endDatestop)); /****************************************/
if(attgro.getPbfs() == 1){
int several = Integer.valueOf(ClockInTool.dateToWeek(num));//
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));
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
}else {
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())
.eq(KqglAssoZhoupaiban::getType, several));
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
KqglAssoDkmx dkmc1 = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, user.getEmpnum()) }else if(attgro.getPbfs() == 2){
.gt(KqglAssoDkmx::getDksj, startDatestop).lt(KqglAssoDkmx::getDksj, endDatestop)); 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(isyessum == null) {//无汇总记录 shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, pbmxx.getBcid()));
KqglAssoMonthPunchSummary summary = KqglAssoMonthPunchSummary.builder().name(user.getEmpname()).num(user.getEmpnum()).dept(user.getDepartment()) }
.post(user.getPosition()).attGroup(attgro.getId()).build();
summary.setDaysOnDuty(daysOnDuty);//应出勤天数 //未打最后一次卡的时候 判断最后一次打卡时间是否在请假范围内 相对应减少下班缺卡次数
summary.setActualAttDays(Double.valueOf(dkjl));//实际出勤天数 //最后一次应打卡时间
summary.setDaysOff(daysOff);//休息天数 String latimeclock = "";
summary.setWorkingHours(dkmc1.getGzsc()); if(answer == 1) {
int lateTimes = 0,leavetimes = 0,sbqkcs = 0,xbqkcs = 0;double lateHours = 0,earlyleave=0; latimeclock = ClockInTool.dealDateFormat(shif.getXbdk1(),3);
if(answer == 1 || answer == 2 || answer == 3) { }else if(answer == 2) {
if(dkmc1.getSbdk1jg() > 0) {lateTimes++;} latimeclock = ClockInTool.dealDateFormat(shif.getXbdk2(),3);
if(dkmc1.getXbdk1jg() > 0) {leavetimes++;}
lateHours = dkmc1.getSbdk1jg();
earlyleave = dkmc1.getXbdk1jg();
if(dkmc1.getSbdk1() == null) {sbqkcs++;}
if(dkmc1.getXbdk1() == null) {xbqkcs++;}
}
if(answer == 2 || answer == 3) {
if(dkmc1.getSbdk2jg() > 0) {lateTimes++;}
if(dkmc1.getXbdk2jg() > 0) {leavetimes++;}
lateHours = lateHours + dkmc1.getSbdk2jg();
earlyleave = earlyleave + dkmc1.getXbdk2jg();
if(dkmc1.getSbdk2() == null) {sbqkcs++;}
if(dkmc1.getXbdk2() == null) {xbqkcs++;}
}
if(answer == 3) {
if(dkmc1.getSbdk3jg() > 0) {lateTimes++;}
if(dkmc1.getXbdk3jg() > 0) {leavetimes++;}
lateHours = lateHours + dkmc1.getSbdk3jg();
earlyleave = earlyleave + dkmc1.getXbdk3jg();
if(dkmc1.getSbdk3() == null) {sbqkcs++;}
if(dkmc1.getXbdk3() == null) {xbqkcs++;}
}
summary.setLateTimes(Double.valueOf(lateTimes));//迟到次数
summary.setLateHours(lateHours);//迟到时长(分钟)
summary.setSeriousLateTimes(Double.valueOf(dkmc1.getYzcdcs()));
summary.setSeriousLateHours(dkmc1.getYzcdsc());
summary.setAbsenLateTimes(Double.valueOf(dkmc1.getKgcdfzs()));
summary.setEarlyLeaveTimes(Double.valueOf(leavetimes));//早退次数
summary.setLengthEarlyLeave(earlyleave);//早退时长(分钟)
summary.setNumberWorkCardShortage(Double.valueOf(sbqkcs));
summary.setNumberDutyCardShortage(Double.valueOf(xbqkcs));
int absenteeismdays=0;
if(zjgzts-dkjl > 0) { absenteeismdays = zjgzts-dkjl; }
summary.setAbsenteeismDays(Double.valueOf(absenteeismdays));//旷工天数
//出差时长
//外出时长
//加班总时长
//工作日(转调休)
//休息日(转调休)
//节假日(转调休)
//工作日(转加班费)
//休息日(转加班费)
//节假日(转加班费)
summary.setBelongYear(ca.get(Calendar.YEAR));
summary.setBelongMonth(ca.get(Calendar.MONTH)+1);
summary.setOrgCode(org_code);
summary.setLastModified(new Date().getTime());
/******审批接口----对接*******/
}else {
int id = isyessum.getId();
}
}else { }else {
System.out.println("该员工未加入考勤组"); latimeclock = 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("该员工未加入考勤组");
}
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);
}
}
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).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));//下班缺卡次数
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]);
summary.insert();
} }
} // }
/****************************************************************/
KqglTaskTiming.builder().task("AttendanceTask").id(sock.getId()).executionStatus(0).lastExecutionTime(new Date().getTime()).build().updateById();
// KqglTaskTiming.builder().task("AttendanceTask").id(sockid).executionStatus(0).lastExecutionTime(new Date().getTime()).build().updateById();
return new Exception().getStackTrace()[0].getMethodName(); return new Exception().getStackTrace()[0].getMethodName();
}else {
}else {
return null; return null;
} }
} }
......
...@@ -33,16 +33,15 @@ public class KqglServiceImpl implements KqglService { ...@@ -33,16 +33,15 @@ public class KqglServiceImpl implements KqglService {
*/ */
@Override @Override
public boolean attleaveapproval(AttLeaveApprovalDto leaveappr) { public boolean attleaveapproval(AttLeaveApprovalDto leaveappr) {
String startdate = new SimpleDateFormat("yyyy-MM-dd").format(leaveappr.getStarttime()); String startdate = new SimpleDateFormat("yyyy-MM-dd").format(leaveappr.getStarttime());
String enddate = new SimpleDateFormat("yyyy-MM-dd").format(leaveappr.getEndtime()); String enddate = new SimpleDateFormat("yyyy-MM-dd").format(leaveappr.getEndtime());
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";"); String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";");
for(String num : days) { for(String num : days) {
//记入打卡月汇总关联表 //记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(leaveappr.getUserid()).appTime(num).approvalId(leaveappr.getLeaveid()).approvalType(2).duration(leaveappr.getDuration()) KqglAssoRelationSummary.builder().userId(leaveappr.getUserid()).appTime(num).approvalId(leaveappr.getLeaveid()).approvalType(2).duration(leaveappr.getDuration())
.leaveTypeId(leaveappr.getLeavetype()).build().insert(); .leaveTypeId(leaveappr.getLeavetype()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getEndtime())).build().insert();
} }
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, leaveappr.getUserid())); YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, leaveappr.getUserid()));
int modifynumber = 1; int modifynumber = 1;
KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, leaveappr.getUserid()) KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, leaveappr.getUserid())
...@@ -50,10 +49,8 @@ public class KqglServiceImpl implements KqglService { ...@@ -50,10 +49,8 @@ public class KqglServiceImpl implements KqglService {
if(balan != null) { if(balan != null) {
modifynumber = balan.getModifyNumber()+1; modifynumber = balan.getModifyNumber()+1;
} }
KqglAssoLeaveBalance.builder().leaveRulesId(leaveappr.getLeavetype()).userid(leaveappr.getUserid()).modifyAction(2).balanceDays("-"+leaveappr.getDuration()) KqglAssoLeaveBalance.builder().leaveRulesId(leaveappr.getLeavetype()).userid(leaveappr.getUserid()).modifyAction(2).balanceDays("-"+leaveappr.getDuration())
.reason("系统按照规则自动").modifyUserid(emp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额 .reason("系统按照规则自动").modifyUserid(emp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
return true; return true;
} }
...@@ -62,7 +59,6 @@ public class KqglServiceImpl implements KqglService { ...@@ -62,7 +59,6 @@ public class KqglServiceImpl implements KqglService {
*/ */
@Override @Override
public boolean attovertimeapproval(AttOvertimeApprovalDto overappr) { public boolean attovertimeapproval(AttOvertimeApprovalDto overappr) {
String startdate = new SimpleDateFormat("yyyy-MM-dd").format(overappr.getStarttime()); String startdate = new SimpleDateFormat("yyyy-MM-dd").format(overappr.getStarttime());
String enddate = new SimpleDateFormat("yyyy-MM-dd").format(overappr.getEndtime()); String enddate = new SimpleDateFormat("yyyy-MM-dd").format(overappr.getEndtime());
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";"); String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";");
...@@ -70,11 +66,9 @@ public class KqglServiceImpl implements KqglService { ...@@ -70,11 +66,9 @@ public class KqglServiceImpl implements KqglService {
//记入打卡月汇总关联表 //记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(overappr.getUserid()).appTime(num).approvalId(overappr.getOvertimeid()).approvalType(1).duration(overappr.getDuration()) KqglAssoRelationSummary.builder().userId(overappr.getUserid()).appTime(num).approvalId(overappr.getOvertimeid()).approvalType(1).duration(overappr.getDuration())
.overtimeTypeId(overappr.getOvertimetype()).compensateId(overappr.getCompensate()).build().insert(); .overtimeTypeId(overappr.getOvertimetype()).compensateId(overappr.getCompensate()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getEndtime())).build().insert();
} }
return true; return true;
} }
...@@ -89,7 +83,8 @@ public class KqglServiceImpl implements KqglService { ...@@ -89,7 +83,8 @@ public class KqglServiceImpl implements KqglService {
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";"); String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";");
for(String num : days) { for(String num : days) {
//记入打卡月汇总关联表 //记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(3).build().insert(); KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(3)
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime())).build().insert();
} }
}else { //外出 }else { //外出
String startdate = new SimpleDateFormat("yyyy-MM-dd").format(evecappr.getStarttime()); String startdate = new SimpleDateFormat("yyyy-MM-dd").format(evecappr.getStarttime());
...@@ -97,7 +92,8 @@ public class KqglServiceImpl implements KqglService { ...@@ -97,7 +92,8 @@ public class KqglServiceImpl implements KqglService {
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";"); String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";");
for(String num : days) { for(String num : days) {
//记入打卡月汇总关联表 //记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(4).build().insert(); KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(4)
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime())).build().insert();
} }
} }
return true; return true;
...@@ -108,12 +104,9 @@ public class KqglServiceImpl implements KqglService { ...@@ -108,12 +104,9 @@ public class KqglServiceImpl implements KqglService {
*/ */
@Override @Override
public boolean attrepairapproval(AttRepairApprovalDto repaappr) { public boolean attrepairapproval(AttRepairApprovalDto repaappr) {
String cardrepltime = new SimpleDateFormat("yyyy-MM-dd").format(repaappr.getCardrepltime());//补卡时间 String cardrepltime = new SimpleDateFormat("yyyy-MM-dd").format(repaappr.getCardrepltime());//补卡时间
//记入打卡月汇总关联表 //记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(repaappr.getUserid()).appTime(cardrepltime).approvalId(repaappr.getRepairid()).approvalType(5).build().insert(); KqglAssoRelationSummary.builder().userId(repaappr.getUserid()).appTime(cardrepltime).approvalId(repaappr.getRepairid()).approvalType(5).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(repaappr.getCardrepltime())).build().insert();
return true; return true;
} }
......
package cn.timer.api.dao.kqmk; package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoDkmx; import cn.timer.api.bean.kqmk.KqglAssoDkmx;
import cn.timer.api.dto.kqmk.AttSubsidiaryDto;
/** /**
* 打卡明细表 * 打卡明细表
...@@ -12,5 +14,6 @@ import cn.timer.api.bean.kqmk.KqglAssoDkmx; ...@@ -12,5 +14,6 @@ import cn.timer.api.bean.kqmk.KqglAssoDkmx;
*/ */
@Repository @Repository
public interface KqglAssoDkmxMapper extends BaseMapper<KqglAssoDkmx> { public interface KqglAssoDkmxMapper extends BaseMapper<KqglAssoDkmx> {
AttSubsidiaryDto subsidiary(int userid, String data);
} }
package cn.timer.api.dao.kqmk; package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import java.util.List;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoRelationSummary; import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
/** /**
...@@ -12,5 +15,10 @@ import cn.timer.api.bean.kqmk.KqglAssoRelationSummary; ...@@ -12,5 +15,10 @@ import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
*/ */
@Repository @Repository
public interface KqglAssoRelationSummaryMapper extends BaseMapper<KqglAssoRelationSummary> { public interface KqglAssoRelationSummaryMapper extends BaseMapper<KqglAssoRelationSummary> {
KqglAssoRelationSummary SecondaryValue(int userid, int approvaltype, String time);
List<KqglAssoRelationSummary> SpecificLeave(int userid,int approvaltype,String apptime);
List<KqglAssoRelationSummary> LeaveInvestigation(int userid,int approvaltype,String apptime);
} }
...@@ -18,6 +18,6 @@ public interface KqglAssoTeshuMapper extends BaseMapper<KqglAssoTeshu> { ...@@ -18,6 +18,6 @@ public interface KqglAssoTeshuMapper extends BaseMapper<KqglAssoTeshu> {
int insertKqglAssoTeshuList(List<KqglAssoTeshu> kqglassoteshu); int insertKqglAssoTeshuList(List<KqglAssoTeshu> kqglassoteshu);
List<KqglAssoTeshu> ShouldSpecialDatessetByKqzid(int kqzid,int tsrq,int type); List<KqglAssoTeshu> ShouldSpecialDatessetByKqzid(int kqzid,String tsrq,int type);
} }
package cn.timer.api.dto.kqmk;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttSubsidiaryDto {
@ApiModelProperty(value = "工作总时长", example = "字段说明")
private double gzsctotalgzsc;
@ApiModelProperty(value = "严重迟到总次数", example = "字段说明")
private double yzcdcstotal;
@ApiModelProperty(value = "严重迟到总时长(分钟) ", example = "字段说明")
private double yzcdsctotal;
@ApiModelProperty(value = "旷工迟到总次数", example = "字段说明")
private double kgcdfzstotal;
}
...@@ -27,6 +27,13 @@ ...@@ -27,6 +27,13 @@
<result column="yzcdsc" property="yzcdsc" /> <result column="yzcdsc" property="yzcdsc" />
<result column="kgcdfzs" property="kgcdfzs" /> <result column="kgcdfzs" property="kgcdfzs" />
</resultMap> </resultMap>
<resultMap id="AttSubsidiary" type="cn.timer.api.dto.kqmk.AttSubsidiaryDto" >
<result column="gzsctotalgzsc" property="gzsctotalgzsc" />
<result column="yzcdcstotal" property="yzcdcstotal" />
<result column="yzcdsctotal" property="yzcdsctotal" />
<result column="kgcdfzstotal" property="kgcdfzstotal" />
</resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, id,
...@@ -78,6 +85,17 @@ ...@@ -78,6 +85,17 @@
kgcdfzs KqglAssoDkmx_kgcdfzs kgcdfzs KqglAssoDkmx_kgcdfzs
</sql> </sql>
<select id="subsidiary" resultMap="AttSubsidiary">
select SUM(dk.gzsc) as gzsctotalgzsc,
SUM(dk.yzcdcs) as yzcdcstotal,
SUM(dk.yzcdsc) as yzcdsctotal,
SUM(dk.kgcdfzs) as kgcdfzstotal
from kqgl_asso_dkmx dk
where dk.userid = #{userid}
and SUBSTR(dk.`data`,1,7) = #{data}
GROUP BY dk.userid
</select>
<!-- <!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkmx"> <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkmx">
......
...@@ -102,8 +102,8 @@ ...@@ -102,8 +102,8 @@
<select id="selectAdditionalList" resultMap="AdditionalMap"> <select id="selectAdditionalList" resultMap="AdditionalMap">
SELECT emp.emp_num as empnum, SELECT emp.emp_num as empnum,
emp.`name` as empname, emp.`name` as empname,
IFNULL(c.name,'') as department, IFNULL(c.name,null) as department,
gw.`name` as position IFNULL(gw.`name`,null) as position
from yggl_main_emp emp from yggl_main_emp emp
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
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
<result column="leave_type_id" property="leaveTypeId" /> <result column="leave_type_id" property="leaveTypeId" />
<result column="overtime_type_id" property="overtimeTypeId" /> <result column="overtime_type_id" property="overtimeTypeId" />
<result column="compensate_id" property="compensateId" /> <result column="compensate_id" property="compensateId" />
<result column="start_time" property="startTime" />
<result column="end_time" property="endTime" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -24,7 +26,9 @@ ...@@ -24,7 +26,9 @@
duration, duration,
leave_type_id, leave_type_id,
overtime_type_id, overtime_type_id,
compensate_id compensate_id,
start_time,
end_time
</sql> </sql>
<sql id="Base_Column_List_Alias"> <sql id="Base_Column_List_Alias">
...@@ -36,9 +40,42 @@ ...@@ -36,9 +40,42 @@
duration KqglAssoRelationSummary_duration, duration KqglAssoRelationSummary_duration,
leave_type_id KqglAssoRelationSummary_leave_type_id, leave_type_id KqglAssoRelationSummary_leave_type_id,
overtime_type_id KqglAssoRelationSummary_overtime_type_id, overtime_type_id KqglAssoRelationSummary_overtime_type_id,
compensate_id KqglAssoRelationSummary_compensate_id compensate_id KqglAssoRelationSummary_compensate_id,
start_time KqglAssoRelationSummary_start_time,
end_time KqglAssoRelationSummary_end_time
</sql> </sql>
<select id="SecondaryValue" resultMap="BaseResultMap">
select a.user_id,
SUM(a.duration) as duration
from (select res.user_id,res.duration
from kqgl_asso_relation_summary res
where res.user_id = #{userid}
and res.approval_type = #{approvaltype}
and SUBSTR(res.app_time,1,7) = #{time}
GROUP BY res.approval_id) as a
GROUP BY a.user_id
</select>
<select id="SpecificLeave" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from kqgl_asso_relation_summary res
where res.user_id = #{userid}
and res.approval_type = #{approvaltype}
and SUBSTR(res.app_time,1,7) = #{apptime}
</select>
<select id="LeaveInvestigation" resultMap="BaseResultMap">
select res.start_time,
res.end_time
from kqgl_asso_relation_summary res
where res.user_id = #{userid}
and res.approval_type = #{approvaltype}
and SUBSTR(res.app_time,1,7) = #{apptime}
GROUP BY res.start_time,res.end_time;
</select>
<!-- <!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoRelationSummary"> <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoRelationSummary">
...@@ -66,7 +103,13 @@ ...@@ -66,7 +103,13 @@
overtime_type_id, overtime_type_id,
</if> </if>
<if test ='null != compensateId'> <if test ='null != compensateId'>
compensate_id compensate_id,
</if>
<if test ='null != startTime'>
start_time,
</if>
<if test ='null != endTime'>
end_time
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
...@@ -92,7 +135,13 @@ ...@@ -92,7 +135,13 @@
#{overtimeTypeId}, #{overtimeTypeId},
</if> </if>
<if test ='null != compensateId'> <if test ='null != compensateId'>
#{compensateId} #{compensateId},
</if>
<if test ='null != startTime'>
#{startTime},
</if>
<if test ='null != endTime'>
#{endTime}
</if> </if>
</trim> </trim>
</insert> </insert>
...@@ -112,7 +161,9 @@ ...@@ -112,7 +161,9 @@
<if test ='null != duration'>duration = #{duration},</if> <if test ='null != duration'>duration = #{duration},</if>
<if test ='null != leaveTypeId'>leave_type_id = #{leaveTypeId},</if> <if test ='null != leaveTypeId'>leave_type_id = #{leaveTypeId},</if>
<if test ='null != overtimeTypeId'>overtime_type_id = #{overtimeTypeId},</if> <if test ='null != overtimeTypeId'>overtime_type_id = #{overtimeTypeId},</if>
<if test ='null != compensateId'>compensate_id = #{compensateId}</if> <if test ='null != compensateId'>compensate_id = #{compensateId},</if>
<if test ='null != startTime'>start_time = #{startTime},</if>
<if test ='null != endTime'>end_time = #{endTime}</if>
</set> </set>
WHERE id = #{id} WHERE id = #{id}
</update> </update>
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
select <include refid="Base_Column_List" /> select <include refid="Base_Column_List" />
from kqgl_asso_teshu teshu from kqgl_asso_teshu teshu
where teshu.kqzid = #{kqzid} where teshu.kqzid = #{kqzid}
and substring(teshu.tsrq,6,2) = #{tsrq} and SUBSTR(teshu.tsrq,1,7) = #{tsrq}
and teshu.type = #{type} and teshu.type = #{type}
</select> </select>
......
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