Commit f950ce7d by ilal Committed by chenzg

提交

parent a07b8871
......@@ -2581,6 +2581,8 @@ public class ClockInController {
}else {
ash.setIsdk(1);
}
}else if(ash.getSort() == daj.getSort()){
BeanUtil.copyProperties(daj, dkjl,"attdate","remarks","userId","attime","dkmxid","commentary","punchequipment","punchmode");
}
}
......@@ -2972,8 +2974,22 @@ public class ClockInController {
e.printStackTrace();
date_=new Date();
}
int dateOne= ClockInTool.getYearMonth(date_);
int dangqian = ClockInTool.getYearMonth(new Date());//当前
// int dateOne= ClockInTool.getYearMonth(date_);
// 准备第一个模板,从字符串中提取出日期数字
String pat1 = "yyyy-MM" ;
String pat = "yyyyMM";
SimpleDateFormat sdfi = new SimpleDateFormat(pat1) ; // 实例化模板对象
SimpleDateFormat sdf = new SimpleDateFormat(pat) ; // 实例化模板对象
Date d = null ;
try{
d = sdfi.parse(date) ; // 将给定的字符串中的日期提取出来
}catch(Exception e){ // 如果提供的字符串格式有错误,则进行异常处理
e.printStackTrace() ; // 打印异常信息
}
int dateOne = Integer.valueOf(sdf.format(d));
int dangqian = Integer.valueOf(new SimpleDateFormat("yyyyMM").format(new Date()));//当前
List<WorkbenchCalendarDto> workcal = new ArrayList<WorkbenchCalendarDto>();
......@@ -3105,7 +3121,6 @@ public class ClockInController {
wocal.setCalendar_status(2);//事务(请假,加班,调休,出差)
}
//0:无;1:事假;2:调休;3:病假;4:年假;5:产假;6:陪产假;7:婚假;8:例假;9:丧假;10:哺乳假;11:加班;12:出差;13:外出
if(asssum.getApprovalType() == 1) {
wocal.setCalendar_status_type(11);
......@@ -3306,6 +3321,103 @@ public class ClockInController {
}
}
}else {
String time = date+"-01";
String sdaet = ClockInTool.getMinMonthDate(time);
Long startMonth = ClockInTool.getStartTime(0,ClockInTool.getStringTime(sdaet,"yyyy-MM-dd")).getTime();
String edate = ClockInTool.getMaxMonthDate(time);
Long endMonth = ClockInTool.getnowEndTime(23,ClockInTool.getStringTime(edate,"yyyy-MM-dd")).getTime();
//固定排班
String[] rangeArray=ClockInTool.listToString(ClockInTool.getDays(df.format(startMonth),df.format(endMonth))).split(";");//目前为止所有日期
String[] range=rangeArray[0].split(",");
/******************/
String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd)
String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd)
//考勤组信息
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode());
//固定排班
if(attgro.getPbfs() == 1) {
List<KqglAssoTeshu> bxdklist = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), date,1);//当前月 必须打卡日期
int bxdk = bxdklist.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(), date,2);//当前月 无需打卡日期
String[] appmaps= new String[wxdk.size()];//特殊-无需打卡天数(休息日)
int d1 = 0;
for(KqglAssoTeshu spe:wxdk){
appmaps[d1] = spe.getTsrq();
d1++;
}
//应打卡周期时间
List<AttendanceWeeklySch> atwek = attendanceweeklyschmapper.selectAttendanceMadeByUserid(userBean.getEmpNum(),userBean.getOrgCode());
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++;
}
//目前为止应出勤天数
int w = 0,x=0;
int zj = 6;
for(String num : range) {
if(ClockInTool.useArrayUtils(needfig, String.valueOf(ClockInTool.dateToWeek(num)))) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj];
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length);
ycqtst[w] = num;
ycqts = ycqtst;
w++;
}else {
String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
xxtst[x] = num;
xxts = xxtst;
x++;
}
if(ClockInTool.useArrayUtils(bxdkss, num)) {//检查是否存在 必须打卡名单中
String[] ycqtst = new String[ycqts.length + zj];
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length);
ycqtst[w] = num;
ycqts = ycqtst;
w++;
xxts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(xxts), num);//为必须上班的话从休息日期中去除
}
if(ClockInTool.useArrayUtils(appmaps, num)) {//检查是否存在 无需打卡名单中
ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
xxtst[x] = num;
xxts = xxtst;
x++;
}
}
/******************/
for(String num : range) {
WorkbenchCalendarDto wocal = WorkbenchCalendarDto.builder().build();
wocal.setDate(num);
if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ycqts), num)) {
wocal.setCalendar_status(1);//
}
if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num)) {
wocal.setCalendar_status(4);//
}
if(!ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ycqts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num)) {
wocal.setCalendar_status(0);//
}
workcal.add(wocal);
}
}
}
return ResultUtil.data(workcal, "操作成功!");
......
......@@ -26,6 +26,7 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
public static boolean useArrayUtils(String[] arr, String targetValue) {
return ArrayUtils.contains(arr,targetValue);
}
......
......@@ -96,7 +96,7 @@ public class AttendanceTaskTiming{
//typeid:1-员工 2-考勤组
// @Scheduled(cron = "0 */5 * * * ?")
// @Scheduled(cron = "0 50 8 * * ?")
// @Scheduled(cron = "0 38 14 * * ?")
@Scheduled(cron = "0 0 8,12,16,20 * * ?")//每天上午8、12点,下午16点,20点 执行
public void AttendanceTask() throws ParseException {
......
......@@ -89,7 +89,7 @@ public class LastMonthtimingExport {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// @Scheduled(cron = "0 44 8 * * ?")
@Scheduled(cron = "0 0 4,20 * * ?")//每天上午4点,下午20点 执行
public void LastMonthtimingAttendanceTask() throws ParseException {
//获取前月的最后一天
......
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