Commit c00268a9 by ilal Committed by chenzg

提交

parent 4138957a
...@@ -402,7 +402,12 @@ ...@@ -402,7 +402,12 @@
<version>1.4.7.RELEASE</version> <version>1.4.7.RELEASE</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/net.sourceforge.htmlunit/htmlunit -->
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.43.0</version>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
......
package cn.timer.api.bean.kqmk;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author LAL 2020-09-22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "kqmk_redletter_day")
@ApiModel("节假日")
public class KqmkRedletterDay extends Model<KqmkRedletterDay> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "id id", example = "101")
private Integer id;
@ApiModelProperty(value = "日期 ", example = "日期")
private String holiday;
@ApiModelProperty(value = "假日名称 ", example = "假日名称")
private String holidayName;
@ApiModelProperty(value = "是否为节假日(0:否;1:是) 是否为节假日(0:否;1:是)", example = "101")
private Integer holidayStatus;
@ApiModelProperty(value = "年月", example = "101")
private String belongYearmonth;
}
\ No newline at end of file
...@@ -30,6 +30,7 @@ import cn.timer.api.bean.kqmk.KqglAssoRelationSummary; ...@@ -30,6 +30,7 @@ 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;
import cn.timer.api.bean.kqmk.KqmkRedletterDay;
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.bean.yggl.YgglMainLzb;
import cn.timer.api.controller.kqgl.ClockInController; import cn.timer.api.controller.kqgl.ClockInController;
...@@ -96,7 +97,7 @@ public class AttendanceTaskTiming{ ...@@ -96,7 +97,7 @@ public class AttendanceTaskTiming{
//typeid:1-员工 2-考勤组 //typeid:1-员工 2-考勤组
// @Scheduled(cron = "0 */5 * * * ?") // @Scheduled(cron = "0 */5 * * * ?")
// @Scheduled(cron = "0 15 16 * * ?") // @Scheduled(cron = "0 44 17 * * ?")
@Scheduled(cron = "0 0 8,12,16,20 * * ?")//每天上午8、12点,下午16点,20点 执行 @Scheduled(cron = "0 0 8,12,16,20 * * ?")//每天上午8、12点,下午16点,20点 执行
public void AttendanceTask() throws ParseException { public void AttendanceTask() throws ParseException {
...@@ -130,6 +131,9 @@ public class AttendanceTaskTiming{ ...@@ -130,6 +131,9 @@ public class AttendanceTaskTiming{
List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>());//系统中的所有公司 所有未到期的公司 List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>());//系统中的所有公司 所有未到期的公司
// List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>().lambda().eq(QyzxEntInfoM::getId, 1));
for(int t = 0;t<orgcodelist.size();t++){ for(int t = 0;t<orgcodelist.size();t++){
int org_code = orgcodelist.get(t).getId();//企业组织代码 int org_code = orgcodelist.get(t).getId();//企业组织代码
...@@ -140,9 +144,6 @@ public class AttendanceTaskTiming{ ...@@ -140,9 +144,6 @@ public class AttendanceTaskTiming{
.eq(YgglMainLzb::getEmpNum, user.getEmpnum())); .eq(YgglMainLzb::getEmpNum, user.getEmpnum()));
if(lzb == null) {//已离职 的人员不进入计算(已存在的不做任何处理) if(lzb == null) {//已离职 的人员不进入计算(已存在的不做任何处理)
// KqglAssoMonthPunchSummary.builder().build().delete(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getBelongYear, year)
// .eq(KqglAssoMonthPunchSummary::getBelongMonth, month).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code));
KqglAssoMonthPunchSummary sum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getOrgCode, org_code) 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())); .eq(KqglAssoMonthPunchSummary::getBelongYear, year).eq(KqglAssoMonthPunchSummary::getBelongMonth, month).eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()));
...@@ -225,6 +226,7 @@ public class AttendanceTaskTiming{ ...@@ -225,6 +226,7 @@ public class AttendanceTaskTiming{
// .eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code)); // .eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code));
String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd) String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd)
String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd) String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd)
String[] fdxx = new String[10];//法定休息的具体天数(yyyy-MM-dd)
List<String> rowData = new ArrayList<String>(); List<String> rowData = new ArrayList<String>();
//休息天数,应出勤天数,实际出勤 //休息天数,应出勤天数,实际出勤
double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0; double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0;
...@@ -271,9 +273,20 @@ public class AttendanceTaskTiming{ ...@@ -271,9 +273,20 @@ public class AttendanceTaskTiming{
needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几 needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几
e++; e++;
} }
//法定節假日
List<KqmkRedletterDay> etter = KqmkRedletterDay.builder().build().selectList(new QueryWrapper<KqmkRedletterDay>().lambda().eq(KqmkRedletterDay::getHolidayStatus, 1).eq(KqmkRedletterDay::getBelongYearmonth, ttstr));
String[] holidays = new String[etter.size()];//法定节假日沦为休息日计算
int h = 0;
for(KqmkRedletterDay spe:etter){
holidays[h] = spe.getHoliday();
h++;
}
String yemo = year + "-" + month; String yemo = year + "-" + month;
sdf1.setLenient(false); sdf1.setLenient(false);
int y = 0,q = 0; int y = 0,q = 0,jj = 0;//jj:节假日
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){ for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
Date date1 = sdf1.parse(yemo + "-" + i); Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){ for(int u=0;u<week.length;u++){
...@@ -283,11 +296,20 @@ public class AttendanceTaskTiming{ ...@@ -283,11 +296,20 @@ public class AttendanceTaskTiming{
if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){ if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){
y = y-1; y = y-1;
} }
if(attgro.getIsFdjjr().equals(1)) {
if(Arrays.asList(holidays).contains(String.valueOf(sdf1.format(date1)))){
y = y-1;
jj ++;
}
}
} }
} }
} }
//全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间 //全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size(); int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size()+jj;
daysOff = xiuxi; daysOff = xiuxi;
daysOnDuty = y+bxdk; 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(";");//目前为止所有日期
...@@ -295,6 +317,7 @@ public class AttendanceTaskTiming{ ...@@ -295,6 +317,7 @@ public class AttendanceTaskTiming{
//目前为止应出勤天数 //目前为止应出勤天数
int w = 0,x=0; int w = 0,x=0;
int zj = 6; int zj = 6;
int fd = 0;
for(String num : range) { for(String num : range) {
if(ClockInTool.useArrayUtils(needfig, String.valueOf(ClockInTool.dateToWeek(num)))) {//对比排班应打卡时间 if(ClockInTool.useArrayUtils(needfig, String.valueOf(ClockInTool.dateToWeek(num)))) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj]; String[] ycqtst = new String[ycqts.length + zj];
...@@ -337,6 +360,32 @@ public class AttendanceTaskTiming{ ...@@ -337,6 +360,32 @@ public class AttendanceTaskTiming{
xxts = xxtst; xxts = xxtst;
x++; x++;
} }
//当前考勤组开启法定节假日休息开关
if(attgro.getIsFdjjr().equals(1)) {
//法定节假日
if(ClockInTool.useArrayUtils(holidays, num)) {//法定节假日沦为休息日计算
// ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
if(ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num) != null) {
ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
}
fdxx[fd] = num;
fd ++;
zjgzts = zjgzts - 1;
String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
xxtst[x] = num;
xxts = xxtst;
x++;
}
}
} }
}else if(attgro.getPbfs() == 2){ //自由排班 }else if(attgro.getPbfs() == 2){ //自由排班
DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
...@@ -499,8 +548,10 @@ public class AttendanceTaskTiming{ ...@@ -499,8 +548,10 @@ public class AttendanceTaskTiming{
String sjs = "",qinjia = "",chuaca = "",waichu = "",buka = "",jiaban = ""; String sjs = "",qinjia = "",chuaca = "",waichu = "",buka = "",jiaban = "";
if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num) && ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(dkjtts),num)) { if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num) && ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(dkjtts),num)) {
rowData.add("休息并打卡"); rowData.add("休息并打卡");
}else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num)){ }else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(fdxx), num)){
rowData.add("休息"); rowData.add("休息");
}else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(fdxx), num)){
rowData.add("法定节假日休息");
}else { }else {
if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ycqts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(dkjtts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(leaves), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(travels), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(goouts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(cards), num)) { if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ycqts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(dkjtts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(leaves), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(travels), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(goouts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(cards), num)) {
rowData.add("旷工"); rowData.add("旷工");
...@@ -546,28 +597,20 @@ public class AttendanceTaskTiming{ ...@@ -546,28 +597,20 @@ public class AttendanceTaskTiming{
} }
} }
qinjia = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"请"+leavetype+lea.getDuration()+company; qinjia = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"请"+leavetype+lea.getDuration()+company;
// rowData.remove(u);
// rowData.add(u,(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"请"+leavetype+lea.getDuration()+company);
} }
if(ClockInTool.contains(ClockInTool.deleteArrayNull(travels),num)) { 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)); KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 3));
// rowData.remove(u);
// rowData.add(u,(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"出差"+lea.getDuration()+"天");
chuaca = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"出差"+lea.getDuration()+"天"; chuaca = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"出差"+lea.getDuration()+"天";
} }
if(ClockInTool.contains(ClockInTool.deleteArrayNull(goouts),num)) { 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)); KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 4));
// rowData.remove(u);
// rowData.add(u,(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"外出"+lea.getDuration()+"天");
waichu = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"外出"+lea.getDuration()+"天"; waichu = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"外出"+lea.getDuration()+"天";
} }
if(ClockInTool.contains(ClockInTool.deleteArrayNull(cards),num)) { 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)); KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 5));
// rowData.remove(u);
// rowData.add(u,"已补卡:"+(lea.getStartTime()).substring(5, 16));
buka = "#"+"已补卡:"+(lea.getStartTime()).substring(5, 16); buka = "#"+"已补卡:"+(lea.getStartTime()).substring(5, 16);
} }
if(ClockInTool.contains(ClockInTool.deleteArrayNull(overtimes),num)) { if(ClockInTool.contains(ClockInTool.deleteArrayNull(overtimes),num)) {
...@@ -589,8 +632,6 @@ public class AttendanceTaskTiming{ ...@@ -589,8 +632,6 @@ public class AttendanceTaskTiming{
else if(lea.getCompensateId() == 2) { method="转加班费"; } else if(lea.getCompensateId() == 2) { method="转加班费"; }
else {method="转调休或加班费";} else {method="转调休或加班费";}
// rowData.remove(u);
// rowData.add(u,(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"加班"+lea.getDuration()+company+"["+method+"]");
jiaban = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"加班"+lea.getDuration()+company+"["+method+"]"; jiaban = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"加班"+lea.getDuration()+company+"["+method+"]";
//防止多运算 //防止多运算
if(lea.getOrdernum() == lea.getTotals()) { if(lea.getOrdernum() == lea.getTotals()) {
...@@ -618,10 +659,8 @@ public class AttendanceTaskTiming{ ...@@ -618,10 +659,8 @@ public class AttendanceTaskTiming{
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 + 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 + lea.getDuration(); holidaytransferovertime = holidaytransferovertime + lea.getDuration();
} }
} }
......
...@@ -30,6 +30,7 @@ import cn.timer.api.bean.kqmk.KqglAssoRelationSummary; ...@@ -30,6 +30,7 @@ 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;
import cn.timer.api.bean.kqmk.KqmkRedletterDay;
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.bean.yggl.YgglMainLzb;
import cn.timer.api.controller.kqgl.ClockInController; import cn.timer.api.controller.kqgl.ClockInController;
...@@ -130,9 +131,6 @@ public class LastMonthtimingExport { ...@@ -130,9 +131,6 @@ public class LastMonthtimingExport {
.eq(YgglMainLzb::getEmpNum, user.getEmpnum())); .eq(YgglMainLzb::getEmpNum, user.getEmpnum()));
if(lzb == null) {//已离职 的人员不进入计算(已存在的不做任何处理) if(lzb == null) {//已离职 的人员不进入计算(已存在的不做任何处理)
// KqglAssoMonthPunchSummary.builder().build().delete(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getBelongYear, year)
// .eq(KqglAssoMonthPunchSummary::getBelongMonth, month).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code));
KqglAssoMonthPunchSummary sum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getOrgCode, org_code) 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())); .eq(KqglAssoMonthPunchSummary::getBelongYear, year).eq(KqglAssoMonthPunchSummary::getBelongMonth, month).eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()));
...@@ -215,6 +213,7 @@ public class LastMonthtimingExport { ...@@ -215,6 +213,7 @@ public class LastMonthtimingExport {
// .eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code)); // .eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code));
String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd) String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd)
String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd) String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd)
String[] fdxx = new String[10];//法定休息的具体天数(yyyy-MM-dd)
List<String> rowData = new ArrayList<String>(); List<String> rowData = new ArrayList<String>();
//休息天数,应出勤天数,实际出勤 //休息天数,应出勤天数,实际出勤
double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0; double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0;
...@@ -261,9 +260,19 @@ public class LastMonthtimingExport { ...@@ -261,9 +260,19 @@ public class LastMonthtimingExport {
needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几 needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几
e++; e++;
} }
//法定節假日
List<KqmkRedletterDay> etter = KqmkRedletterDay.builder().build().selectList(new QueryWrapper<KqmkRedletterDay>().lambda().eq(KqmkRedletterDay::getHolidayStatus, 1).eq(KqmkRedletterDay::getBelongYearmonth, ttstr));
String[] holidays = new String[etter.size()];//法定节假日沦为休息日计算
int h = 0;
for(KqmkRedletterDay spe:etter){
holidays[h] = spe.getHoliday();
h++;
}
String yemo = year + "-" + month; String yemo = year + "-" + month;
sdf1.setLenient(false); sdf1.setLenient(false);
int y = 0,q = 0; int y = 0,q = 0,jj = 0;//jj:节假日
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){ for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
Date date1 = sdf1.parse(yemo + "-" + i); Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){ for(int u=0;u<week.length;u++){
...@@ -273,11 +282,18 @@ public class LastMonthtimingExport { ...@@ -273,11 +282,18 @@ public class LastMonthtimingExport {
if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){ if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){
y = y-1; y = y-1;
} }
if(attgro.getIsFdjjr().equals(1)) {
if(Arrays.asList(holidays).contains(String.valueOf(sdf1.format(date1)))){
y = y-1;
jj ++;
}
}
} }
} }
} }
//全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间 //全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size(); int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size()+jj;
daysOff = xiuxi; daysOff = xiuxi;
daysOnDuty = y+bxdk; 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(";");//目前为止所有日期
...@@ -285,6 +301,7 @@ public class LastMonthtimingExport { ...@@ -285,6 +301,7 @@ public class LastMonthtimingExport {
//目前为止应出勤天数 //目前为止应出勤天数
int w = 0,x=0; int w = 0,x=0;
int zj = 6; int zj = 6;
int fd = 0;
for(String num : range) { for(String num : range) {
if(ClockInTool.useArrayUtils(needfig, String.valueOf(ClockInTool.dateToWeek(num)))) {//对比排班应打卡时间 if(ClockInTool.useArrayUtils(needfig, String.valueOf(ClockInTool.dateToWeek(num)))) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj]; String[] ycqtst = new String[ycqts.length + zj];
...@@ -327,6 +344,30 @@ public class LastMonthtimingExport { ...@@ -327,6 +344,30 @@ public class LastMonthtimingExport {
xxts = xxtst; xxts = xxtst;
x++; x++;
} }
//当前考勤组开启法定节假日休息开关
if(attgro.getIsFdjjr().equals(1)) {
//法定节假日
if(ClockInTool.useArrayUtils(holidays, num)) {//法定节假日沦为休息日计算
// ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
if(ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num) != null) {
ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
}
fdxx[fd] = num;
fd ++;
zjgzts = zjgzts - 1;
String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
xxtst[x] = num;
xxts = xxtst;
x++;
}
}
} }
}else if(attgro.getPbfs() == 2){ //自由排班 }else if(attgro.getPbfs() == 2){ //自由排班
DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
...@@ -488,8 +529,10 @@ public class LastMonthtimingExport { ...@@ -488,8 +529,10 @@ public class LastMonthtimingExport {
String sjs = "",qinjia = "",chuaca = "",waichu = "",buka = "",jiaban = ""; String sjs = "",qinjia = "",chuaca = "",waichu = "",buka = "",jiaban = "";
if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num) && ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(dkjtts),num)) { if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num) && ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(dkjtts),num)) {
rowData.add("休息并打卡"); rowData.add("休息并打卡");
}else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num)){ }else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(fdxx), num)){
rowData.add("休息"); rowData.add("休息");
}else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(fdxx), num)){
rowData.add("法定节假日休息");
}else { }else {
if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ycqts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(dkjtts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(leaves), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(travels), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(goouts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(cards), num)) { if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ycqts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(dkjtts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(leaves), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(travels), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(goouts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(cards), num)) {
rowData.add("旷工"); rowData.add("旷工");
......
...@@ -29,6 +29,7 @@ import cn.timer.api.bean.kqmk.KqglAssoRelationSummary; ...@@ -29,6 +29,7 @@ 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;
import cn.timer.api.bean.kqmk.KqmkRedletterDay;
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;
...@@ -205,6 +206,7 @@ public class RealTimeUpdate{ ...@@ -205,6 +206,7 @@ public class RealTimeUpdate{
// .eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code)); // .eq(KqglAssoMonthPunchSummary::getNum, user.getEmpnum()).eq(KqglAssoMonthPunchSummary::getOrgCode, org_code));
String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd) String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd)
String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd) String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd)
String[] fdxx = new String[10];//法定休息的具体天数(yyyy-MM-dd)
List<String> rowData = new ArrayList<String>(); List<String> rowData = new ArrayList<String>();
//休息天数,应出勤天数,实际出勤 //休息天数,应出勤天数,实际出勤
double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0; double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0;
...@@ -251,9 +253,19 @@ public class RealTimeUpdate{ ...@@ -251,9 +253,19 @@ public class RealTimeUpdate{
needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几 needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几
e++; e++;
} }
//法定節假日
List<KqmkRedletterDay> etter = KqmkRedletterDay.builder().build().selectList(new QueryWrapper<KqmkRedletterDay>().lambda().eq(KqmkRedletterDay::getHolidayStatus, 1).eq(KqmkRedletterDay::getBelongYearmonth, ttstr));
String[] holidays = new String[etter.size()];//法定节假日沦为休息日计算
int h = 0;
for(KqmkRedletterDay spe:etter){
holidays[h] = spe.getHoliday();
h++;
}
String yemo = year + "-" + month; String yemo = year + "-" + month;
sdf1.setLenient(false); sdf1.setLenient(false);
int y = 0,q = 0; int y = 0,q = 0,jj = 0;//jj:节假日
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){ for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
Date date1 = sdf1.parse(yemo + "-" + i); Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){ for(int u=0;u<week.length;u++){
...@@ -263,11 +275,18 @@ public class RealTimeUpdate{ ...@@ -263,11 +275,18 @@ public class RealTimeUpdate{
if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){ if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){
y = y-1; y = y-1;
} }
if(attgro.getIsFdjjr().equals(1)) {
if(Arrays.asList(holidays).contains(String.valueOf(sdf1.format(date1)))){
y = y-1;
jj ++;
}
}
} }
} }
} }
//全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间 //全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size(); int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size()+jj;
daysOff = xiuxi; daysOff = xiuxi;
daysOnDuty = y+bxdk; 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(";");//目前为止所有日期
...@@ -275,6 +294,7 @@ public class RealTimeUpdate{ ...@@ -275,6 +294,7 @@ public class RealTimeUpdate{
//目前为止应出勤天数 //目前为止应出勤天数
int w = 0,x=0; int w = 0,x=0;
int zj = 6; int zj = 6;
int fd = 0;
for(String num : range) { for(String num : range) {
if(Arrays.binarySearch(needfig, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间 if(Arrays.binarySearch(needfig, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj]; String[] ycqtst = new String[ycqts.length + zj];
...@@ -317,6 +337,31 @@ public class RealTimeUpdate{ ...@@ -317,6 +337,31 @@ public class RealTimeUpdate{
xxts = xxtst; xxts = xxtst;
x++; x++;
} }
//当前考勤组开启法定节假日休息开关
if(attgro.getIsFdjjr().equals(1)) {
//法定节假日
if(ClockInTool.useArrayUtils(holidays, num)) {//法定节假日沦为休息日计算
// ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
if(ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num) != null) {
ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
}
fdxx[fd] = num;
fd ++;
zjgzts = zjgzts - 1;
String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
xxtst[x] = num;
xxts = xxtst;
x++;
}
}
} }
}else if(attgro.getPbfs() == 2){ //自由排班 }else if(attgro.getPbfs() == 2){ //自由排班
DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
...@@ -473,32 +518,39 @@ public class RealTimeUpdate{ ...@@ -473,32 +518,39 @@ public class RealTimeUpdate{
// List<String> rowData = new ArrayList<String>(); // List<String> rowData = new ArrayList<String>();
//遍历目前为止所有日期 结合该用户发起的审批进行结合 //遍历目前为止所有日期 结合该用户发起的审批进行结合
//1:加班 2:请假 3:出差 4:外出 5:补卡 //1:加班 2:请假 3:出差 4:外出 5:补卡
int u = 0;
int p = 1;
for(String num : range) { for(String num : range) {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(dkjtts),num) >= 0) {
String sjs = "",qinjia = "",chuaca = "",waichu = "",buka = "",jiaban = "";
if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num) && ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(dkjtts),num)) {
rowData.add("休息并打卡"); rowData.add("休息并打卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) >= 0){ }else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(fdxx), num)){
rowData.add("休息"); rowData.add("休息");
}else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(fdxx), num)){
rowData.add("法定节假日休息");
}else { }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) { if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ycqts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(dkjtts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(leaves), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(travels), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(goouts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(cards), num)) {
rowData.add("旷工"); rowData.add("旷工");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) < 0) {//日期不在上班也不在休息里面即为未排班 }else if(!ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ycqts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num)) {//日期不在上班也不在休息里面即为未排班
rowData.add("未排班"); rowData.add("未排班");
}else if(sdf1.parse(beginTime).getTime() < sdf1.parse(num).getTime()) { }else if(sdf1.parse(beginTime).getTime() < sdf1.parse(num).getTime()) {
rowData.add("未到班期"); rowData.add("未到班期");
}else { }else {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0) { if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(sblacks), num)) {
rowData.add("上班缺卡"); rowData.add("上班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) { }else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(sblacks), num) && ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ztts), num)) {
rowData.add("上班缺卡,下班早退"); rowData.add("上班缺卡,下班早退");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0) { }else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(cdts), num)) {
rowData.add("上班迟到"); rowData.add("上班迟到");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) { }else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(cdts), num) && ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xblacks), num)) {
rowData.add("上班迟到,下班缺卡"); rowData.add("上班迟到,下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) { }else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(cdts), num) && ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ztts), num)) {
rowData.add("上班迟到,下班早退"); rowData.add("上班迟到,下班早退");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) { // }else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
}else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xblacks),num)) {
rowData.add("下班缺卡"); rowData.add("下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) { }else if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ztts), num)) {
rowData.add("下班早退"); rowData.add("下班早退");
}else { }else {
rowData.add("正常"); rowData.add("正常");
...@@ -506,6 +558,7 @@ public class RealTimeUpdate{ ...@@ -506,6 +558,7 @@ public class RealTimeUpdate{
} }
} }
/******/
if(ClockInTool.contains(ClockInTool.deleteArrayNull(leaves),num)) { 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)); 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 leavetype = "未知";//请假类型
...@@ -520,19 +573,22 @@ public class RealTimeUpdate{ ...@@ -520,19 +573,22 @@ public class RealTimeUpdate{
else { company = "小时"; } else { company = "小时"; }
} }
} }
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"请"+leavetype+lea.getDuration()+company); qinjia = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"请"+leavetype+lea.getDuration()+company;
} }
if(ClockInTool.contains(ClockInTool.deleteArrayNull(travels),num)) { 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)); 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()+"天");
chuaca = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"出差"+lea.getDuration()+"天";
} }
if(ClockInTool.contains(ClockInTool.deleteArrayNull(goouts),num)) { 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)); 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()+"天");
waichu = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"外出"+lea.getDuration()+"天";
} }
if(ClockInTool.contains(ClockInTool.deleteArrayNull(cards),num)) { 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)); 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());
buka = "#"+"已补卡:"+(lea.getStartTime()).substring(5, 16);
} }
if(ClockInTool.contains(ClockInTool.deleteArrayNull(overtimes),num)) { if(ClockInTool.contains(ClockInTool.deleteArrayNull(overtimes),num)) {
...@@ -552,7 +608,8 @@ public class RealTimeUpdate{ ...@@ -552,7 +608,8 @@ public class RealTimeUpdate{
if(lea.getCompensateId() == 1) { method="转调休"; } if(lea.getCompensateId() == 1) { method="转调休"; }
else if(lea.getCompensateId() == 2) { method="转加班费"; } else if(lea.getCompensateId() == 2) { method="转加班费"; }
else {method="转调休或加班费";} else {method="转调休或加班费";}
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"加班"+lea.getDuration()+company+"["+method+"]");
jiaban = "#"+(lea.getStartTime()).substring(5, 16) +"到"+ (lea.getEndTime()).substring(5, 16)+"加班"+lea.getDuration()+company+"["+method+"]";
//防止多运算 //防止多运算
if(lea.getOrdernum() == lea.getTotals()) { if(lea.getOrdernum() == lea.getTotals()) {
//加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费 //加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费
...@@ -579,18 +636,29 @@ public class RealTimeUpdate{ ...@@ -579,18 +636,29 @@ public class RealTimeUpdate{
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 + 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 + lea.getDuration(); holidaytransferovertime = holidaytransferovertime + lea.getDuration();
} }
} }
} }
} }
} }
}
if(rowData.size() == p) {
sjs = "";
if(("").equals(qinjia) && ("").equals(chuaca) && ("").equals(waichu) && ("").equals(buka) && ("").equals(jiaban)) {
sjs = rowData.get(u);
}else {
sjs = rowData.get(u)+";";
}
} }
rowData.remove(u);
rowData.add(u,sjs + qinjia+chuaca+waichu+buka+jiaban);
/****/
//////// ////////
...@@ -646,6 +714,9 @@ public class RealTimeUpdate{ ...@@ -646,6 +714,9 @@ public class RealTimeUpdate{
} }
} }
} }
u++;
p++;
} }
}else { }else {
for (String num2 : range) { for (String num2 : range) {
......
package cn.timer.api.controller.kqgl.holiday;
import java.util.Date;
public class ChinaDate {
/**
* 公历时间
*/
private Date solarDate;
/**
* 农历日
*/
private String lunar;
/**
* 公历日
*/
private String solar;
/**
* 是否是 休
*/
private boolean isVacation = false;
/**
* 如果是 休情况下的假期名字
*/
private String VacationName = "非假期";
/**
* 是否是 班
*/
private boolean isWorkFlag = false;
private boolean isSaturday = false;
private boolean isSunday = false;
/**
* @return the solarDate
*/
public Date getSolarDate() {
return solarDate;
}
/**
* @param solarDate the solarDate to set
*/
public void setSolarDate(Date solarDate) {
this.solarDate = solarDate;
}
/**
* @return the lunar
*/
public String getLunar() {
return lunar;
}
/**
* @param lunar the lunar to set
*/
public void setLunar(String lunar) {
this.lunar = lunar;
}
/**
* @return the solar
*/
public String getSolar() {
return solar;
}
/**
* @param solar the solar to set
*/
public void setSolar(String solar) {
this.solar = solar;
}
/**
* @return the isVacation
*/
public boolean isVacation() {
return isVacation;
}
/**
* @param isVacation the isVacation to set
*/
public void setVacation(boolean isVacation) {
this.isVacation = isVacation;
}
/**
* @return the vacationName
*/
public String getVacationName() {
return VacationName;
}
/**
* @param vacationName the vacationName to set
*/
public void setVacationName(String vacationName) {
VacationName = vacationName;
}
/**
* @return the isWorkFlag
*/
public boolean isWorkFlag() {
return isWorkFlag;
}
/**
* @param isWorkFlag the isWorkFlag to set
*/
public void setWorkFlag(boolean isWorkFlag) {
this.isWorkFlag = isWorkFlag;
}
/**
* @return the isSaturday
*/
public boolean isSaturday() {
return isSaturday;
}
/**
* @param isSaturday the isSaturday to set
*/
public void setSaturday(boolean isSaturday) {
this.isSaturday = isSaturday;
}
/**
* @return the isSunday
*/
public boolean isSunday() {
return isSunday;
}
/**
* @param isSunday the isSunday to set
*/
public void setSunday(boolean isSunday) {
this.isSunday = isSunday;
}
}
\ No newline at end of file
package cn.timer.api.controller.kqgl.holiday;
import java.io.IOException;
import java.net.MalformedURLException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomNodeList;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import cn.timer.api.bean.kqmk.KqmkRedletterDay;
import cn.timer.api.dao.kqmk.KqmkRedletterDayMapper;
public class Main {
private static String latestVocationName = "";
public String getVocationName(DomNodeList<HtmlElement> htmlElements, String date) throws ParseException {
String rst = "";
boolean pastTimeFlag = false;
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
Date paramDate = dateFormat.parse(date);
if (new Date().getTime() >= paramDate.getTime()) {
pastTimeFlag = true;
}
//first step //jugde if can get vocation name from html page
for (int i = 0; i < htmlElements.size(); i++) {
HtmlElement element = htmlElements.get(i);
if (element.getAttribute("class").indexOf("vacation") != -1) {
boolean hitFlag = false;
String voationName = "";
for (; i < htmlElements.size(); i++) {
HtmlElement elementTmp = htmlElements.get(i);
String liDate = elementTmp.getAttribute("date");
List<HtmlElement> lunar = elementTmp.getElementsByAttribute("span", "class", "lunar");
String lanarText = lunar.get(0).asText();
if (lanarText.equals("元旦")) {
voationName = "元旦";
} else if (lanarText.equals("除夕") || lanarText.equals("春节")) {
voationName = "春节";
} else if (lanarText.equals("清明")) {
voationName = "清明";
} else if (lanarText.equals("国际劳动节")) {
voationName = "国际劳动节";
} else if (lanarText.equals("端午节")) {
voationName = "端午节";
} else if (lanarText.equals("中秋节")) {
voationName = "中秋节";
} else if (lanarText.equals("国庆节")) {
voationName = "国庆节";
}
if (liDate.equals(date)) {
hitFlag = true;
}
if (elementTmp.getAttribute("class").indexOf("vacation") == -1) {
break;
}
}
if (hitFlag == true && !voationName.equals("")) {
rst = voationName;
break;
}
} else {
continue;
}
}
//if first step fail(rarely), get from the latest Vocation name
if (rst.equals("")) {
System.out.println("warning: fail to get vocation name from html page.");
//you can judge by some simple rule
//from the latest Vocation name
rst = Main.latestVocationName;
} else if (pastTimeFlag == true) {
//更新《当前时间,且最近一次的可见的假期名
Main.latestVocationName = rst;
}
return rst;
}
public List<ChinaDate> getCurrentDateInfo() {
WebClient webClient = null;
List<ChinaDate> dateList = null;
try {
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
dateList = new ArrayList<ChinaDate>();
webClient = new WebClient();
HtmlPage page = webClient.getPage("http://hao.360.cn/rili/");
//最大等待60秒
for (int k = 0; k < 60; k++) {
if (!page.getElementById("M-dates").asText().equals(""))
break;
Thread.sleep(1000);
}
//睡了8秒,等待页面加载完成...,有时候,页面可能获取不到,不稳定()
//Thread.sleep(8000);
DomNodeList<HtmlElement> htmlElements = page.getElementById("M-dates").getElementsByTagName("li");
//System.out.println(htmlElements.size());
for (HtmlElement element : htmlElements) {
ChinaDate chinaDate = new ChinaDate();
List<HtmlElement> lunar = element.getElementsByAttribute("span", "class", "lunar");
List<HtmlElement> solar = element.getElementsByAttribute("div", "class", "solar");
chinaDate.setLunar(lunar.get(0).asText());
chinaDate.setSolar(solar.get(0).asText());
chinaDate.setSolarDate(dateFormat.parse(element.getAttribute("date")));
if (element.getAttribute("class").indexOf("vacation") != -1) {
chinaDate.setVacation(true);
chinaDate.setVacationName(this.getVocationName(htmlElements, element.getAttribute("date")));
}
if (element.getAttribute("class").indexOf("weekend") != -1
&& element.getAttribute("class").indexOf("last") == -1) {
chinaDate.setSaturday(true);
}
if (element.getAttribute("class").indexOf("last weekend") != -1) {
chinaDate.setSunday(true);
}
if (element.getAttribute("class").indexOf("work") != -1) {
chinaDate.setWorkFlag(true);
} else if (chinaDate.isSaturday() == false && chinaDate.isSunday() == false
&& chinaDate.isVacation() == false) {
chinaDate.setWorkFlag(true);
} else {
chinaDate.setWorkFlag(false);
}
dateList.add(chinaDate);
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("get date from http://hao.360.cn/rili/ error~");
} finally {
webClient.close();
}
return dateList;
}
public ChinaDate getTodayInfo() {
List<ChinaDate> dateList = this.getCurrentDateInfo();
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
for (ChinaDate date : dateList) {
if (dateFormat.format(date.getSolarDate()).equals(dateFormat.format(new Date()))) {
return date;
}
}
return new ChinaDate();
}
public static void main(String[] args) throws FailingHttpStatusCodeException, MalformedURLException, IOException, InterruptedException {
List<ChinaDate> dateList = new Main().getCurrentDateInfo();
ChinaDate today = new Main().getTodayInfo();
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
System.out.println("本月详情:");
String yymm = new SimpleDateFormat("yyyy-MM").format(new Date()).toString();//
for (ChinaDate date : dateList) {
// System.out.println(dateFormat.format(date.getSolarDate()) + " " + date.getVacationName());
// System.out.println(dateFormat.format(date.getSolarDate()).replaceAll("/", "-") + " " + date.getVacationName());
String str = dateFormat.format(date.getSolarDate()).replaceAll("/", "-");
//INSERT INTO kqmk_redletter_day VALUES ( value1, value2,...valueN );
String jieri = date.getVacationName();
boolean status = jieri.contains("节");
int holidaystatus = 0;
if(status) {
holidaystatus = 1;
}
System.out.println("INSERT INTO kqmk_redletter_day(holiday,holiday_name,holiday_status,belong_yearmonth) VALUES(" + '"'+str +'"'+ "," +'"'+date.getVacationName()+'"'+ "," +holidaystatus+ "," + '"'+yymm+'"'+ ");");
}
// System.out.println("------------------------------------------------------------------------");
// System.out.println("今日详情:");
// System.out.println("日期:" + today.getSolarDate());
// System.out.println("农历:" + today.getLunar());
// System.out.println("公历:" + today.getSolar());
// System.out.println("假期名:" + today.getVacationName());
// System.out.println("是否周六:" + today.isSaturday());
// System.out.println("是否周日:" + today.isSunday());
// System.out.println("是否休假:" + today.isVacation());
// System.out.println("是否工作日:" + today.isWorkFlag());
// System.out.println("已发生的最近一次假期:" + Main.latestVocationName);
}
}
package cn.timer.api.dao.kqmk;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqmkRedletterDay;
/**
* 节假日
*
* @author LAL 2020-09-22
*/
@Repository
public interface KqmkRedletterDayMapper extends BaseMapper<KqmkRedletterDay> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.kqmk.KqmkRedletterDayMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.kqmk.KqmkRedletterDay" >
<id column="id" property="id" />
<result column="holiday" property="holiday" />
<result column="holiday_name" property="holidayName" />
<result column="holiday_status" property="holidayStatus" />
<result column="belong_yearmonth" property="belongYearmonth" />
</resultMap>
</mapper>
\ No newline at end of file
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