Commit feebf920 by lal

提交

parent 2b76eb67
...@@ -58,6 +58,7 @@ import cn.timer.api.dao.kqmk.KqglAssoBcszMapper; ...@@ -58,6 +58,7 @@ import cn.timer.api.dao.kqmk.KqglAssoBcszMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkjlMapper; import cn.timer.api.dao.kqmk.KqglAssoDkjlMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkmxMapper; import cn.timer.api.dao.kqmk.KqglAssoDkmxMapper;
import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper; import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper;
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.dto.kqmk.AttClockMethod; import cn.timer.api.dto.kqmk.AttClockMethod;
...@@ -89,6 +90,8 @@ public class ClockInController { ...@@ -89,6 +90,8 @@ public class ClockInController {
private KqglAssoDkjlMapper kqglassodkjlmapper; private KqglAssoDkjlMapper kqglassodkjlmapper;
@Autowired @Autowired
private KqglAssoBcszMapper kqglassobcszmapper; private KqglAssoBcszMapper kqglassobcszmapper;
@Autowired
private KqglAssoRelationSummaryMapper kqglassorelationsummarymapper;
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
...@@ -119,6 +122,7 @@ public class ClockInController { ...@@ -119,6 +122,7 @@ public class ClockInController {
String msg = "未知错误,请联系管理员"; String msg = "未知错误,请联系管理员";
int sbyf = 1;//0:失败;1:成功 int sbyf = 1;//0:失败;1:成功
int status_ = 0;
JSONObject jsonArray = new JSONObject(json); JSONObject jsonArray = new JSONObject(json);
String asDevId = jsonArray.get("dev_id").toString();//考勤机编码 String asDevId = jsonArray.get("dev_id").toString();//考勤机编码
...@@ -139,6 +143,8 @@ public class ClockInController { ...@@ -139,6 +143,8 @@ public class ClockInController {
/*******/ /*******/
long time_ = DateUtil.getStringTime(sStdIoTime, "yyyy-MM-dd HH:mm:ss");//打卡时间戳 long time_ = DateUtil.getStringTime(sStdIoTime, "yyyy-MM-dd HH:mm:ss");//打卡时间戳
String putime = new SimpleDateFormat("yyyy-MM-dd").format(time_);//转换打卡时间格式 年月日 String putime = new SimpleDateFormat("yyyy-MM-dd").format(time_);//转换打卡时间格式 年月日
String putimehhmm = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_);//转换打卡时间格式 年月日
//打卡当天开始时间,打卡当天结束时间 //打卡当天开始时间,打卡当天结束时间
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime(); Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime(); Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
...@@ -161,7 +167,7 @@ public class ClockInController { ...@@ -161,7 +167,7 @@ public class ClockInController {
* 当考勤组为“固定排班”和“自定义排班”时 方可使用 * 当考勤组为“固定排班”和“自定义排班”时 方可使用
*/ */
if(attdate.getAttgrouptype() != 3) { if(attdate.getAttgrouptype() != 3) {
//查询打卡当天是否有记录********************************** //查询打卡当天是否有记录**********************************
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build(); KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build();
String dakariqi = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDateyesterday))+" "+ClockInTool.dateToWeek2(yesterday); String dakariqi = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDateyesterday))+" "+ClockInTool.dateToWeek2(yesterday);
//检查昨日的班次是否存在次日打卡 //检查昨日的班次是否存在次日打卡
...@@ -233,557 +239,573 @@ public class ClockInController { ...@@ -233,557 +239,573 @@ public class ClockInController {
if(EmptyUtil.isEmpty(attdate.getAttsch())) { if(EmptyUtil.isEmpty(attdate.getAttsch())) {
msg = "当前未排班"; msg = "当前未排班";
sbyf = 0; sbyf = 0;
status_ = 2;
}else { }else {
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0, //排查请假是否在最后一次打卡范围内 查询当月的请假所有日期
endtime3 = 0,endtime3ks = 0,endtime3js = 0; KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userid, 2, putime,qyid);
if(attdate.getAttsch().size() > 0) { boolean adopt = false;
List<AttSchedule> ash = attdate.getAttsch(); if(leainv != null) {
int y = 0; adopt = ClockInTool.hourMinuteBetween(putimehhmm, leainv.getStartTime().substring(0, 16), leainv.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
clockt.setShifid(ash.get(y).getId()); }
shifid = ash.get(y).getId();//班次id
if(attdate.getAttsch().size() == 2 || attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) { if(adopt) {
starttime1 = ash.get(0).getTime();starttime1ks = ash.get(0).getStarttime();starttime1js = ash.get(0).getEndtime(); msg = "已请假";
endtime1 = ash.get(1).getTime();endtime1ks = ash.get(1).getStarttime();endtime1js = ash.get(1).getEndtime(); sbyf = 0;
} status_ = 2;
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) { }else {
starttime2 = ash.get(2).getTime();starttime2ks = ash.get(2).getStarttime();starttime2js = ash.get(2).getEndtime(); long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0,
endtime2 = ash.get(3).getTime();endtime2ks = ash.get(3).getStarttime();endtime2js = ash.get(3).getEndtime(); endtime3 = 0,endtime3ks = 0,endtime3js = 0;
} if(attdate.getAttsch().size() > 0) {
if(attdate.getAttsch().size() == 6) { List<AttSchedule> ash = attdate.getAttsch();
starttime3 = ash.get(4).getTime();starttime3ks = ash.get(4).getStarttime();starttime3js = ash.get(4).getEndtime(); int y = 0;
endtime3 = ash.get(5).getTime();endtime3ks = ash.get(5).getStarttime();endtime3js = ash.get(5).getEndtime(); clockt.setShifid(ash.get(y).getId());
} shifid = ash.get(y).getId();//班次id
if(attdate.getAttsch().size() == 2 || attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
if(dkmc == null) { starttime1 = ash.get(0).getTime();starttime1ks = ash.get(0).getStarttime();starttime1js = ash.get(0).getEndtime();
kskd = false; endtime1 = ash.get(1).getTime();endtime1ks = ash.get(1).getStarttime();endtime1js = ash.get(1).getEndtime();
}
if(attdate.getAttsch().size() == 2) {//一套上下班 上班1 if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(starttime1)));//应打卡时间 starttime2 = ash.get(2).getTime();starttime2ks = ash.get(2).getStarttime();starttime2js = ash.get(2).getEndtime();
Date sd2=df1.parse(sStdIoTime);//打卡时间 endtime2 = ash.get(3).getTime();endtime2ks = ash.get(3).getStarttime();endtime2js = ash.get(3).getEndtime();
Date sd3=df1.parse(ClockInTool.stampToDate(String.valueOf(endtime1)));//应打卡时间 }
if(sd2.before(sd3)) { if(attdate.getAttsch().size() == 6) {
atttype = 1; starttime3 = ash.get(4).getTime();starttime3ks = ash.get(4).getStarttime();starttime3js = ash.get(4).getEndtime();
} endtime3 = ash.get(5).getTime();endtime3ks = ash.get(5).getStarttime();endtime3js = ash.get(5).getEndtime();
}
if(sd2.after(sd1) && sd2.after(sd3)) {
atttype = 2; if(dkmc == null) {
} kskd = false;
}else { if(attdate.getAttsch().size() == 2) {//一套上下班 上班1
boolean getinto = true; Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(starttime1)));//应打卡时间
//打卡时间 对比班次 接近哪个时间就打哪个时间的卡 Date sd2=df1.parse(sStdIoTime);//打卡时间
Date sd3=df1.parse(ClockInTool.stampToDate(String.valueOf(endtime1)));//应打卡时间
if(sd2.before(sd3)) {
atttype = 1;
}
if(sd2.after(sd1) && sd2.after(sd3)) {
atttype = 2;
}
}else {
boolean getinto = true;
//打卡时间 对比班次 接近哪个时间就打哪个时间的卡
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
//punchstart 应打卡开始时间 punchend:应打卡结束时间 time_:打卡时间
boolean effectiveDate1 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1js),"yyyy-MM-dd HH:mm");
if (effectiveDate1) {//在范围内就打卡
atttype = 1;
getinto = false;
}else {
if(getinto) {
isRange = false;
}
}
boolean effectiveDate2 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1js),"yyyy-MM-dd HH:mm");
if (effectiveDate2) {//在范围内就打卡
atttype = 2;
isRange = true;//在范围
getinto = false;
}else {
if(getinto) {
isRange = false;
}
}
boolean effectiveDate3 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime2ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime2js),"yyyy-MM-dd HH:mm");
if (effectiveDate3) {//在范围内就打卡
atttype = 3;
isRange = true;//在范围
getinto = false;
}else {
if(getinto) {
isRange = false;
}
}
boolean effectiveDate4 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime2ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime2js),"yyyy-MM-dd HH:mm");
if (effectiveDate4) {//在范围内就打卡
atttype = 4;
isRange = true;//在范围
getinto = false;
}else {
if(getinto) {
isRange = false;
}
}
}
if(attdate.getAttsch().size() == 6) {
boolean effectiveDate5 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime3ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime3js),"yyyy-MM-dd HH:mm");
if (effectiveDate5) {//在范围内就打卡
atttype = 5;
isRange = true;//在范围
getinto = false;
}else {
if(getinto) {
isRange = false;
}
}
boolean effectiveDate6 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime3ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime3js),"yyyy-MM-dd HH:mm");
if (effectiveDate6) {//在范围内就打卡
atttype = 6;
isRange = true;//在范围
getinto = false;
}else {
if(getinto) {
isRange = false;
}
}
}
}
execution_status = 1;
}else {
boolean getinto2 = true;
execution_status = 2;
if(attdate.getAttsch().size() == 2) { //下班1
if(dkmc.getSbdk1() != null && dkmc.getXbdk1() == null){
//如果第二次后打卡,未超过上班时间 即为打卡失效
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(starttime1)));//应打卡时间
Date sd2=df1.parse(sStdIoTime);//打卡时间
if(sd1.after(sd2)) {
sbdkkd = true;//打卡无效
// atttype = 1;
}else {
kskd = false;
// atttype = 2;
}
}else {
//最后一次卡的时候 再继续打视为更新最后一次打卡
kskd = true;
atttype = 2;
}
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) { if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
//punchstart 应打卡开始时间 punchend:应打卡结束时间 time_:打卡时间
boolean effectiveDate1 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1js),"yyyy-MM-dd HH:mm"); boolean effectiveDate1 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1js),"yyyy-MM-dd HH:mm");
if (effectiveDate1) {//在范围内就打卡 if (effectiveDate1) {//在范围内就打卡
atttype = 1; if(dkmc.getSbdk1() != null) {
getinto = false; sbdkkd = true;//打卡无效
}else { // atttype = 1;
if(getinto) { }else {
isRange = false; atttype = 1;
getinto2 = false;
isRange = true;//在范围
}
}else {
if(getinto2) {
isRange = false;
} }
} }
boolean effectiveDate2 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1js),"yyyy-MM-dd HH:mm"); boolean effectiveDate2 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1js),"yyyy-MM-dd HH:mm");
if (effectiveDate2) {//在范围内就打卡 if (effectiveDate2) {//在范围内就打卡
atttype = 2; if(dkmc.getXbdk1() != null) {
isRange = true;//在范围 kskd = true;
atttype = 2;
getinto = false; }else {
}else { kskd = false;
if(getinto) { // atttype = 2;
isRange = false; getinto2 = false;
isRange = true;//在范围
} }
} }else {
boolean effectiveDate3 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime2ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime2js),"yyyy-MM-dd HH:mm"); if(getinto2) {
isRange = false;
}
}
boolean effectiveDate3 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime2ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime2js),"yyyy-MM-dd HH:mm");
if (effectiveDate3) {//在范围内就打卡 if (effectiveDate3) {//在范围内就打卡
atttype = 3; if(dkmc.getSbdk2() != null) {
isRange = true;//在范围 sbdkkd = true;//
// atttype = 3;
getinto = false; }else {
}else { atttype = 3;
if(getinto) { getinto2 = false;
isRange = false; isRange = true;//在范围
}
}else {
if(getinto2) {
isRange = false;
} }
} }
boolean effectiveDate4 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime2ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime2js),"yyyy-MM-dd HH:mm"); boolean effectiveDate4 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime2ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime2js),"yyyy-MM-dd HH:mm");
if (effectiveDate4) {//在范围内就打卡 if (effectiveDate4) {//在范围内就打卡
atttype = 4; if(dkmc.getXbdk2() != null) {
isRange = true;//在范围 kskd = true;//更新最后一次打卡
atttype = 4;
getinto = false; }else {
}else { kskd = false;
if(getinto) { // atttype = 4;
isRange = false; getinto2 = false;
isRange = true;//在范围
}
}else {
if(getinto2) {
isRange = false;
} }
} }
} }
if(attdate.getAttsch().size() == 6) { if(attdate.getAttsch().size() == 6) {
boolean effectiveDate5 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime3ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime3js),"yyyy-MM-dd HH:mm"); boolean effectiveDate5 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime3ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime3js),"yyyy-MM-dd HH:mm");
if (effectiveDate5) {//在范围内就打卡 if (effectiveDate5) {//在范围内就打卡
atttype = 5; if(dkmc.getSbdk2() != null) {
isRange = true;//在范围 sbdkkd = true;//
// atttype = 5;
getinto = false; }else {
}else { atttype = 5;
if(getinto) { getinto2 = false;
isRange = false; isRange = true;//在范围
} }
}else {
if(getinto2) {
isRange = false;
}
} }
boolean effectiveDate6 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime3ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime3js),"yyyy-MM-dd HH:mm"); boolean effectiveDate6 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime3ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime3js),"yyyy-MM-dd HH:mm");
if (effectiveDate6) {//在范围内就打卡 if (effectiveDate6) {//在范围内就打卡
atttype = 6; if(dkmc.getXbdk2() != null) {
isRange = true;//在范围 kskd = true;////更新最后一次打卡
atttype = 6;
getinto = false; }else {
}else { kskd = false;
if(getinto) { // atttype = 6;
isRange = false; getinto2 = false;
isRange = true;//在范围
} }
}else {
if(getinto2) {
isRange = false;
}
} }
} }
} }
execution_status = 1;
}else {
boolean getinto2 = true;
execution_status = 2;
if(attdate.getAttsch().size() == 2) { //下班1
if(dkmc.getSbdk1() != null && dkmc.getXbdk1() == null){
//如果第二次后打卡,未超过上班时间 即为打卡失效
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(starttime1)));//应打卡时间
Date sd2=df1.parse(sStdIoTime);//打卡时间
if(sd1.after(sd2)) {
sbdkkd = true;//打卡无效
// atttype = 1;
}else {
kskd = false;
// atttype = 2;
}
}else {
//最后一次卡的时候 再继续打视为更新最后一次打卡
kskd = true;
atttype = 2;
}
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
boolean effectiveDate1 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1js),"yyyy-MM-dd HH:mm");
if (effectiveDate1) {//在范围内就打卡
if(dkmc.getSbdk1() != null) {
sbdkkd = true;//打卡无效
// atttype = 1;
}else {
atttype = 1;
getinto2 = false;
isRange = true;//在范围
}
}else {
if(getinto2) {
isRange = false;
}
}
boolean effectiveDate2 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1js),"yyyy-MM-dd HH:mm");
if (effectiveDate2) {//在范围内就打卡
if(dkmc.getXbdk1() != null) {
kskd = true;
atttype = 2;
}else {
kskd = false;
// atttype = 2;
getinto2 = false;
isRange = true;//在范围
}
}else {
if(getinto2) {
isRange = false;
}
}
boolean effectiveDate3 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime2ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime2js),"yyyy-MM-dd HH:mm");
if (effectiveDate3) {//在范围内就打卡
if(dkmc.getSbdk2() != null) {
sbdkkd = true;//
// atttype = 3;
}else {
atttype = 3;
getinto2 = false;
isRange = true;//在范围
}
}else {
if(getinto2) {
isRange = false;
}
}
boolean effectiveDate4 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime2ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime2js),"yyyy-MM-dd HH:mm");
if (effectiveDate4) {//在范围内就打卡
if(dkmc.getXbdk2() != null) {
kskd = true;//更新最后一次打卡
atttype = 4;
}else {
kskd = false;
// atttype = 4;
getinto2 = false;
isRange = true;//在范围
}
}else {
if(getinto2) {
isRange = false;
}
}
}
if(attdate.getAttsch().size() == 6) {
boolean effectiveDate5 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime3ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime3js),"yyyy-MM-dd HH:mm");
if (effectiveDate5) {//在范围内就打卡
if(dkmc.getSbdk2() != null) {
sbdkkd = true;//
// atttype = 5;
}else {
atttype = 5;
getinto2 = false;
isRange = true;//在范围
}
}else {
if(getinto2) {
isRange = false;
}
}
boolean effectiveDate6 = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime3ks), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime3js),"yyyy-MM-dd HH:mm");
if (effectiveDate6) {//在范围内就打卡
if(dkmc.getXbdk2() != null) {
kskd = true;////更新最后一次打卡
atttype = 6;
}else {
kskd = false;
// atttype = 6;
getinto2 = false;
isRange = true;//在范围
}
}else {
if(getinto2) {
isRange = false;
}
}
}
}
}
if(atttype == 1) {
punchcardtime = starttime1;
punchstart = starttime1ks;
punchend = starttime1js;
}else if(atttype == 2) {
punchcardtime = endtime1;
punchstart = endtime1ks;
punchend = endtime1js;
}else if(atttype == 3) {
punchcardtime = starttime2;
punchstart = starttime2ks;
punchend = starttime2js;
}else if(atttype == 4) {
punchcardtime = endtime2;
punchstart = endtime2ks;
punchend = endtime2js;
}else if(atttype == 5) {
punchcardtime = starttime3;
punchstart = starttime3ks;
punchend = starttime3js;
}else if(atttype == 6) {
punchcardtime = endtime3;
punchstart = endtime3ks;
punchend = endtime3js;
}
if(clockt.getShifid() != 0) {
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
if(attdate.getAttsch().size() > 0 && clockt.getShifid() > 0){//有无班次
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, clockt.getShifid()));
} }
//打卡记录录入 -- 打卡是否有时间范围限制 if(atttype == 1) {
if(attdate.getAttsch().size() == 2) { punchcardtime = starttime1;
if(punchstart>0 && punchend>0) { punchstart = starttime1ks;
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(punchstart);//应打卡开始时间 punchend = starttime1js;
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(punchend);//应打卡结束时间 }else if(atttype == 2) {
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_);//打卡时间 punchcardtime = endtime1;
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm"); punchstart = endtime1ks;
if (!effectiveDate) { punchend = endtime1js;
System.out.println("当前打卡时间不在范围内"); }else if(atttype == 3) {
// 手动抛出异常 punchcardtime = starttime2;
isRange = false; punchstart = starttime2ks;
// throw new Exception(); punchend = starttime2js;
}else if(atttype == 4) {
punchcardtime = endtime2;
punchstart = endtime2ks;
punchend = endtime2js;
}else if(atttype == 5) {
punchcardtime = starttime3;
punchstart = starttime3ks;
punchend = starttime3js;
}else if(atttype == 6) {
punchcardtime = endtime3;
punchstart = endtime3ks;
punchend = endtime3js;
}
if(clockt.getShifid() != 0) {
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
if(attdate.getAttsch().size() > 0 && clockt.getShifid() > 0){//有无班次
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, clockt.getShifid()));
}
//打卡记录录入 -- 打卡是否有时间范围限制
if(attdate.getAttsch().size() == 2) {
if(punchstart>0 && punchend>0) {
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(punchstart);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(punchend);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_);//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
System.out.println("当前打卡时间不在范围内");
// 手动抛出异常
isRange = false;
// throw new Exception();
}
} }
} }
} if(isRange) {
if(isRange) { int yzcd = shif.getYzcdfzs();//严重迟到分钟数
int yzcd = shif.getYzcdfzs();//严重迟到分钟数 int kgcdfzs = shif.getKgcdfzs();//旷工迟到分钟数
int kgcdfzs = shif.getKgcdfzs();//旷工迟到分钟数
int dkcs_ = shif.getSxbcs();//上下班打卡次数
int iswzwd = shif.getIsWzwd();//是否开启晚走晚到(0:否;1:是)
long rest_time = 0;
if(shif.getStartTime() != null && shif.getEndTime() != null) {
long kaishixiuxi = Long.valueOf(ClockInTool.dateToStamp(putime + " " +shif.getStartTime()+":00"));
long jieshuxiuxi = Long.valueOf(ClockInTool.dateToStamp(putime + " " +shif.getEndTime()+":00"));
rest_time = (jieshuxiuxi - kaishixiuxi)/1000/60;//休息时间
}
double xbwz1 = 0,xbwz2=0,xbwz3=0;
int sbwd1=0,sbwd2=0,sbwd3=0;
int arrive_late = 0;//晚到时间
String clock_date = "";//应打卡时间
Long latetime = 0l;//前天晚走时长(分钟)
KqglAssoDkmx yesterdaymx = KqglAssoDkmx.builder().build();
AttendanceCardListDto attdateyesterday;
long yesendtime1=0,yesendtime2=0,yesendtime3=0;
//存在晚走玩到
if(iswzwd > 0) {
//统一分钟数
xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1
String sbwd1_ = String.valueOf(Double.valueOf(shif.getSbwd1()) * 60);
sbwd1 = Integer.valueOf(sbwd1_.substring(0, sbwd1_.lastIndexOf(".")));//上班晚到1
xbwz2 = Double.valueOf(shif.getXbwz2()) * 60;//下班晚走2 int dkcs_ = shif.getSxbcs();//上下班打卡次数
String sbwd2_ = String.valueOf(Double.valueOf(shif.getSbwd2()) * 60); int iswzwd = shif.getIsWzwd();//是否开启晚走晚到(0:否;1:是)
sbwd2 = Integer.valueOf(sbwd2_.substring(0, sbwd2_.lastIndexOf(".")));//上班晚到2
xbwz3 = Double.valueOf(shif.getXbwz3()) * 60;//下班晚走3 long rest_time = 0;
String sbwd3_ = String.valueOf(Double.valueOf(shif.getSbwd3()) * 60); if(shif.getStartTime() != null && shif.getEndTime() != null) {
sbwd3 = Integer.valueOf(sbwd3_.substring(0, sbwd3_.lastIndexOf(".")));//上班晚到3 long kaishixiuxi = Long.valueOf(ClockInTool.dateToStamp(putime + " " +shif.getStartTime()+":00"));
long jieshuxiuxi = Long.valueOf(ClockInTool.dateToStamp(putime + " " +shif.getEndTime()+":00"));
//获取前一天最后下班的时间 rest_time = (jieshuxiuxi - kaishixiuxi)/1000/60;//休息时间
yesterdaymx = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid)
.ge(KqglAssoDkmx::getDksj, startDateyesterday).le(KqglAssoDkmx::getDksj, endDateyesterday));
attdateyesterday = MethodCall(qyid,userid,yesterday);
List<AttSchedule> ash = attdateyesterday.getAttsch();
if(attdateyesterday.getAttsch().size() == 2 || attdateyesterday.getAttsch().size() == 4 || attdateyesterday.getAttsch().size() == 6) {
yesendtime1 = ash.get(1).getTime();
}
if(attdateyesterday.getAttsch().size() == 4 || attdateyesterday.getAttsch().size() == 6) {
yesendtime2 = ash.get(3).getTime();
}
if(attdateyesterday.getAttsch().size() == 6) {
yesendtime3 = ash.get(5).getTime();
}
}
if(execution_status == 1) {//上班1 ****新增
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(userid).data(putime).qyid(qyid).dksj(startDate).build();
int sbdkjg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if((atttype)%2 > 0){//上班
if(time > 0){
sbdkjg = Integer.valueOf(time.toString());
}// 打卡结果
}else{//下班
if(time > 0){}else{
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}// 打卡结果
}
//存在晚走玩到
if(iswzwd > 0 && yesterdaymx != null) {
if(dkcs_ == 1) {
if(yesterdaymx.getXbdk1() != null && yesterdaymx.getXbdk1jg() == 0) {
latetime = (yesterdaymx.getXbdk1() - yesendtime1)/1000/60;
}
}else if(dkcs_ == 2){
if(yesterdaymx.getXbdk2() != null && yesterdaymx.getXbdk2jg() == 0) {
latetime = (yesterdaymx.getXbdk2() - yesendtime2)/1000/60;
}
}else {
if(yesterdaymx.getXbdk3() != null && yesterdaymx.getXbdk3jg() == 0) {
latetime = (yesterdaymx.getXbdk3() - yesendtime3)/1000/60;
}
}
if(latetime != 0) {
double latetime_ = Double.valueOf(String.valueOf(latetime));//前天晚走时长(分钟)
if(latetime_ > xbwz1 && latetime_ < xbwz2) {
arrive_late = sbwd1;
}else if(latetime_ > xbwz2 && latetime_ < xbwz3) {
arrive_late = sbwd2;
}else if(latetime_ > xbwz3) {
arrive_late = sbwd3;
}
clock_date = ClockInTool.stampToDate(String.valueOf(punchcardtime));
Long changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(clock_date, "+"+arrive_late)));//晚到后应打卡时间
punchcardtime = changed_time;//更换当天打卡时间
Long timeyes = (time_ - changed_time)/1000/60;//
if((atttype)%2 > 0){//上班
if(timeyes > 0){
sbdkjg = Integer.valueOf(timeyes.toString());
}else {
sbdkjg = 0;
}
}else{//下班
if(timeyes > 0){
sbdkjg = 0;
}else{
sbdkjg = Math.abs(Integer.valueOf(timeyes.toString()));
}
}
}
}
}
if(atttype == 1) {
pcd.setSbdk1(time_);
pcd.setSbdk1jg(sbdkjg);
}else if(atttype == 2) {
pcd.setXbdk1(time_);
pcd.setXbdk1jg(sbdkjg);
}else if(atttype == 3) {
pcd.setSbdk2(time_);
pcd.setSbdk2jg(sbdkjg);
}else if(atttype == 4) {
pcd.setXbdk2(time_);
pcd.setXbdk2jg(sbdkjg);
}else if(atttype == 5) {
pcd.setSbdk3(time_);
pcd.setSbdk3jg(sbdkjg);
}else if(atttype == 6) {
pcd.setXbdk3(time_);
pcd.setXbdk3jg(sbdkjg);
} }
int ydkcs = 0;
if(shif != null){ydkcs = shif.getSxbcs()*2;}//应打卡次数 double xbwz1 = 0,xbwz2=0,xbwz3=0;
if(sbdkjg > yzcd && yzcd>0) { int sbwd1=0,sbwd2=0,sbwd3=0;
yzcdcs++;
yzcdsc = sbdkjg - yzcd; int arrive_late = 0;//晚到时间
} String clock_date = "";//应打卡时间
if(sbdkjg > kgcdfzs && kgcdfzs>0) {kgcdcs++;} Long latetime = 0l;//前天晚走时长(分钟)
pcd.setYdkcs(ydkcs);
pcd.setYzcdcs(yzcdcs); KqglAssoDkmx yesterdaymx = KqglAssoDkmx.builder().build();
pcd.setYzcdsc(Double.valueOf(yzcdsc)); AttendanceCardListDto attdateyesterday;
pcd.setKgcdfzs(kgcdcs); long yesendtime1=0,yesendtime2=0,yesendtime3=0;
if (!pcd.insert()) { //存在晚走玩到
throw new CustomException("打卡明细-新增异常-1"); if(iswzwd > 0) {
} //统一分钟数
dkmx = pcd.getId(); xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1
}else if(execution_status == 2){ //*****修改 String sbwd1_ = String.valueOf(Double.valueOf(shif.getSbwd1()) * 60);
dkmx = dkmc.getId(); sbwd1 = Integer.valueOf(sbwd1_.substring(0, sbwd1_.lastIndexOf(".")));//上班晚到1
KqglAssoDkmx pcd = KqglAssoDkmx.builder().build();
if(atttype == 2){//下班1 xbwz2 = Double.valueOf(shif.getXbwz2()) * 60;//下班晚走2
pcd.setId(dkmc.getId()); String sbwd2_ = String.valueOf(Double.valueOf(shif.getSbwd2()) * 60);
pcd.setXbdk1(time_);//下班1打卡时间 sbwd2 = Integer.valueOf(sbwd2_.substring(0, sbwd2_.lastIndexOf(".")));//上班晚到2
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60; xbwz3 = Double.valueOf(shif.getXbwz3()) * 60;//下班晚走3
if(time > 0){ String sbwd3_ = String.valueOf(Double.valueOf(shif.getSbwd3()) * 60);
pcd.setXbdk1jg(0);// 打卡结果 sbwd3 = Integer.valueOf(sbwd3_.substring(0, sbwd3_.lastIndexOf(".")));//上班晚到3
}else{
pcd.setXbdk1jg(Math.abs(Integer.valueOf(time.toString()))); //获取前一天最后下班的时间
} yesterdaymx = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid)
} .ge(KqglAssoDkmx::getDksj, startDateyesterday).le(KqglAssoDkmx::getDksj, endDateyesterday));
if(dkmc.getSbdk1() != null){ attdateyesterday = MethodCall(qyid,userid,yesterday);
Long time = (time_ - dkmc.getSbdk1())/1000/60 - rest_time;
pcd.setGzsc(Math.abs(Double.valueOf(time.toString())));//只打一次卡时计算工作时长
}
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if(atttype == 3){//上班2 List<AttSchedule> ash = attdateyesterday.getAttsch();
if(attdateyesterday.getAttsch().size() == 2 || attdateyesterday.getAttsch().size() == 4 || attdateyesterday.getAttsch().size() == 6) {
int sbdk2jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0; yesendtime1 = ash.get(1).getTime();
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){sbdk2jg = Math.abs(Integer.valueOf(time.toString()));}
} }
if(sbdk2jg > yzcd&& yzcd>0) { if(attdateyesterday.getAttsch().size() == 4 || attdateyesterday.getAttsch().size() == 6) {
yzcdcs = dkmc.getYzcdcs()+1; yesendtime2 = ash.get(3).getTime();
yzcdsc = sbdk2jg - yzcd;
} }
if(sbdk2jg > kgcdfzs&& kgcdfzs>0) {kgcdcs++;} if(attdateyesterday.getAttsch().size() == 6) {
yesendtime3 = ash.get(5).getTime();
pcd.setId(dkmc.getId()); }
pcd.setSbdk2(time_);//上班1打卡时间 }
pcd.setSbdk2jg(sbdk2jg);
pcd.setYzcdcs(yzcdcs); if(execution_status == 1) {//上班1 ****新增
pcd.setYzcdsc(Double.valueOf(yzcdsc)); KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(userid).data(putime).qyid(qyid).dksj(startDate).build();
pcd.setKgcdfzs(kgcdcs); int sbdkjg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if(atttype == 4){//下班2
pcd.setId(dkmc.getId());
pcd.setXbdk2(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时 if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60; Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){ if((atttype)%2 > 0){//上班
pcd.setXbdk2jg(0);// 打卡结果 if(time > 0){
}else{ sbdkjg = Integer.valueOf(time.toString());
pcd.setXbdk2jg(Math.abs(Integer.valueOf(time.toString()))); }// 打卡结果
}else{//下班
if(time > 0){}else{
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}// 打卡结果
} }
}
//班次为4次时,计算工作时长
if(dkmc.getSbdk2() != null){
Long time = (time_ - dkmc.getSbdk2())/1000/60;
BigDecimal om = new BigDecimal(dkmc.getGzsc());
BigDecimal on = new BigDecimal(time);
BigDecimal worktime_ = new BigDecimal(Math.abs(om.add(on).doubleValue()));
BigDecimal xx = new BigDecimal(rest_time);
double worktime = Math.abs(worktime_.subtract(xx).doubleValue()); //存在晚走玩到
if(iswzwd > 0 && yesterdaymx != null) {
if(dkcs_ == 1) {
if(yesterdaymx.getXbdk1() != null && yesterdaymx.getXbdk1jg() == 0) {
latetime = (yesterdaymx.getXbdk1() - yesendtime1)/1000/60;
}
}else if(dkcs_ == 2){
if(yesterdaymx.getXbdk2() != null && yesterdaymx.getXbdk2jg() == 0) {
latetime = (yesterdaymx.getXbdk2() - yesendtime2)/1000/60;
}
}else {
if(yesterdaymx.getXbdk3() != null && yesterdaymx.getXbdk3jg() == 0) {
latetime = (yesterdaymx.getXbdk3() - yesendtime3)/1000/60;
}
}
if(latetime != 0) {
double latetime_ = Double.valueOf(String.valueOf(latetime));//前天晚走时长(分钟)
if(latetime_ > xbwz1 && latetime_ < xbwz2) {
arrive_late = sbwd1;
}else if(latetime_ > xbwz2 && latetime_ < xbwz3) {
arrive_late = sbwd2;
}else if(latetime_ > xbwz3) {
arrive_late = sbwd3;
}
clock_date = ClockInTool.stampToDate(String.valueOf(punchcardtime));
Long changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(clock_date, "+"+arrive_late)));//晚到后应打卡时间
punchcardtime = changed_time;//更换当天打卡时间
Long timeyes = (time_ - changed_time)/1000/60;//
if((atttype)%2 > 0){//上班
if(timeyes > 0){
sbdkjg = Integer.valueOf(timeyes.toString());
}else {
sbdkjg = 0;
}
}else{//下班
if(timeyes > 0){
sbdkjg = 0;
}else{
sbdkjg = Math.abs(Integer.valueOf(timeyes.toString()));
}
}
}
}
pcd.setGzsc(worktime);
}
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if(atttype == 5){//上班3
int sbdk3jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){sbdk3jg = Math.abs(Integer.valueOf(time.toString()));}
} }
if(sbdk3jg > yzcd&& yzcd>0) {
yzcdcs = dkmc.getYzcdcs()+1; if(atttype == 1) {
yzcdsc = sbdk3jg - yzcd; pcd.setSbdk1(time_);
pcd.setSbdk1jg(sbdkjg);
}else if(atttype == 2) {
pcd.setXbdk1(time_);
pcd.setXbdk1jg(sbdkjg);
}else if(atttype == 3) {
pcd.setSbdk2(time_);
pcd.setSbdk2jg(sbdkjg);
}else if(atttype == 4) {
pcd.setXbdk2(time_);
pcd.setXbdk2jg(sbdkjg);
}else if(atttype == 5) {
pcd.setSbdk3(time_);
pcd.setSbdk3jg(sbdkjg);
}else if(atttype == 6) {
pcd.setXbdk3(time_);
pcd.setXbdk3jg(sbdkjg);
}
int ydkcs = 0;
if(shif != null){ydkcs = shif.getSxbcs()*2;}//应打卡次数
if(sbdkjg > yzcd && yzcd>0) {
yzcdcs++;
yzcdsc = sbdkjg - yzcd;
} }
if(sbdk3jg > kgcdfzs&& kgcdfzs>0) {kgcdcs++;} if(sbdkjg > kgcdfzs && kgcdfzs>0) {kgcdcs++;}
pcd.setId(dkmc.getId()); pcd.setYdkcs(ydkcs);
pcd.setSbdk3(time_);//上班1打卡时间
pcd.setSbdk3jg(sbdk3jg);
pcd.setYzcdcs(yzcdcs); pcd.setYzcdcs(yzcdcs);
pcd.setYzcdsc(Double.valueOf(yzcdsc)); pcd.setYzcdsc(Double.valueOf(yzcdsc));
pcd.setKgcdfzs(kgcdcs); pcd.setKgcdfzs(kgcdcs);
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录 if (!pcd.insert()) {
}else if(atttype == 6){//下班3 throw new CustomException("打卡明细-新增异常-1");
pcd.setId(dkmc.getId());
pcd.setXbdk3(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){
pcd.setXbdk3jg(0);// 打卡结果
}else{
pcd.setXbdk3jg(Math.abs(Integer.valueOf(time.toString())));
}
} }
//班次为6次时,计算工作时长 dkmx = pcd.getId();
if(dkmc.getSbdk3() != null){ }else if(execution_status == 2){ //*****修改
Long time = (time_ - dkmc.getSbdk3())/1000/60; dkmx = dkmc.getId();
BigDecimal om = new BigDecimal(dkmc.getGzsc());//第二次 KqglAssoDkmx pcd = KqglAssoDkmx.builder().build();
BigDecimal on = new BigDecimal(time); if(atttype == 2){//下班1
BigDecimal worktime_ = new BigDecimal(Math.abs(om.add(on).doubleValue())); pcd.setId(dkmc.getId());
pcd.setXbdk1(time_);//下班1打卡时间
BigDecimal xx = new BigDecimal(rest_time); if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){
pcd.setXbdk1jg(0);// 打卡结果
}else{
pcd.setXbdk1jg(Math.abs(Integer.valueOf(time.toString())));
}
}
if(dkmc.getSbdk1() != null){
Long time = (time_ - dkmc.getSbdk1())/1000/60 - rest_time;
pcd.setGzsc(Math.abs(Double.valueOf(time.toString())));//只打一次卡时计算工作时长
}
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
double worktime = Math.abs(worktime_.subtract(xx).doubleValue()); }else if(atttype == 3){//上班2
int sbdk2jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){sbdk2jg = Math.abs(Integer.valueOf(time.toString()));}
}
if(sbdk2jg > yzcd&& yzcd>0) {
yzcdcs = dkmc.getYzcdcs()+1;
yzcdsc = sbdk2jg - yzcd;
}
if(sbdk2jg > kgcdfzs&& kgcdfzs>0) {kgcdcs++;}
pcd.setGzsc(worktime); pcd.setId(dkmc.getId());
pcd.setSbdk2(time_);//上班1打卡时间
pcd.setSbdk2jg(sbdk2jg);
pcd.setYzcdcs(yzcdcs);
pcd.setYzcdsc(Double.valueOf(yzcdsc));
pcd.setKgcdfzs(kgcdcs);
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if(atttype == 4){//下班2
pcd.setId(dkmc.getId());
pcd.setXbdk2(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){
pcd.setXbdk2jg(0);// 打卡结果
}else{
pcd.setXbdk2jg(Math.abs(Integer.valueOf(time.toString())));
}
}
//班次为4次时,计算工作时长
if(dkmc.getSbdk2() != null){
Long time = (time_ - dkmc.getSbdk2())/1000/60;
BigDecimal om = new BigDecimal(dkmc.getGzsc());
BigDecimal on = new BigDecimal(time);
BigDecimal worktime_ = new BigDecimal(Math.abs(om.add(on).doubleValue()));
BigDecimal xx = new BigDecimal(rest_time);
double worktime = Math.abs(worktime_.subtract(xx).doubleValue());
pcd.setGzsc(worktime);
}
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if(atttype == 5){//上班3
int sbdk3jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){sbdk3jg = Math.abs(Integer.valueOf(time.toString()));}
}
if(sbdk3jg > yzcd&& yzcd>0) {
yzcdcs = dkmc.getYzcdcs()+1;
yzcdsc = sbdk3jg - yzcd;
}
if(sbdk3jg > kgcdfzs&& kgcdfzs>0) {kgcdcs++;}
pcd.setId(dkmc.getId());
pcd.setSbdk3(time_);//上班1打卡时间
pcd.setSbdk3jg(sbdk3jg);
pcd.setYzcdcs(yzcdcs);
pcd.setYzcdsc(Double.valueOf(yzcdsc));
pcd.setKgcdfzs(kgcdcs);
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if(atttype == 6){//下班3
pcd.setId(dkmc.getId());
pcd.setXbdk3(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){
pcd.setXbdk3jg(0);// 打卡结果
}else{
pcd.setXbdk3jg(Math.abs(Integer.valueOf(time.toString())));
}
}
//班次为6次时,计算工作时长
if(dkmc.getSbdk3() != null){
Long time = (time_ - dkmc.getSbdk3())/1000/60;
BigDecimal om = new BigDecimal(dkmc.getGzsc());//第二次
BigDecimal on = new BigDecimal(time);
BigDecimal worktime_ = new BigDecimal(Math.abs(om.add(on).doubleValue()));
BigDecimal xx = new BigDecimal(rest_time);
double worktime = Math.abs(worktime_.subtract(xx).doubleValue());
pcd.setGzsc(worktime);
}
}
pcd.setId(dkmc.getId());
if(atttype <= 6 && atttype > 0 && !sbdkkd){
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
} }
}
pcd.setId(dkmc.getId());
if(atttype <= 6 && atttype > 0 && !sbdkkd){
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
} }
}else {
msg = "当前打卡时间不在范围内";
sbyf = 0;
} }
}else { }else {
msg = "当前打卡时间不在范围内"; msg = "当前是休息时间";
sbyf = 0; sbyf = 0;
} }
}else { }
msg = "当前是休息时间"; }
sbyf = 0;
}
}
}else { }else {
//自由工时打卡 //自由工时打卡
Long stapclotime = attdate.getStapclotime();// 今天考勤 自由排班开始时间 Long stapclotime = attdate.getStapclotime();// 今天考勤 自由排班开始时间
...@@ -935,63 +957,65 @@ public class ClockInController { ...@@ -935,63 +957,65 @@ public class ClockInController {
} }
} }
} }
int type,status = 0; int type = 0,status = 0;
if((atttype)%2 > 0){ if(atttype != 0) {
type = 1;// 类型(类型 0:无排班打卡 1:上班 2:下班) punchcardtime == 0:无班次打卡 if((atttype)%2 > 0){
if(attdate.getAttgrouptype() != 3) { type = 1;// 类型(类型 0:无排班打卡 1:上班 2:下班) punchcardtime == 0:无班次打卡
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) { if(attdate.getAttgrouptype() != 3) {
if(punchcardtime == 0 && clockt.getShifid() != 0){ if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {
status = 1; if(punchcardtime == 0 && clockt.getShifid() != 0){
}if(punchcardtime == 0 && clockt.getShifid() == 0) { status = 1;
status = 2; }if(punchcardtime == 0 && clockt.getShifid() == 0) {
}else{
if(isRange) {// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
if(time > 0){
status = 3;
}else if(results == 0){
status = 1;
}
}else {
status = 2; status = 2;
}else{
if(isRange) {// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
if(time > 0){
status = 3;
}else if(results == 0){
status = 1;
}
}else {
status = 2;
}
} }
}else if(EmptyUtil.isEmpty(attdate.getAttsch())) {
status = 2;
} }
}else if(EmptyUtil.isEmpty(attdate.getAttsch())) {
status = 2;
}
}else {
if(sbyf == 1) {
status = 1;
}else { }else {
status = 2; if(sbyf == 1) {
}
}
}else{
type = 2;// 类型(类型 0:无排班打卡 1:上班 2:下班)
if(attdate.getAttgrouptype() != 3) {
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {
if(punchcardtime == 0 && clockt.getShifid() != 0){
status = 1; status = 1;
}if(punchcardtime == 0 && clockt.getShifid() == 0) { }else {
status = 2; status = 2;
}else{ }
if(isRange) { }
if(time < 0){ }else{
status = 4; type = 2;// 类型(类型 0:无排班打卡 1:上班 2:下班)
}else if(results == 0){ if(attdate.getAttgrouptype() != 3) {
status = 1; if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {
} if(punchcardtime == 0 && clockt.getShifid() != 0){
}else { status = 1;
}if(punchcardtime == 0 && clockt.getShifid() == 0) {
status = 2; status = 2;
}else{
if(isRange) {
if(time < 0){
status = 4;
}else if(results == 0){
status = 1;
}
}else {
status = 2;
}
} }
}else if(EmptyUtil.isEmpty(attdate.getAttsch())) {
status = 2;
} }
}else if(EmptyUtil.isEmpty(attdate.getAttsch())) {
status = 2;
}
}else {
if(sbyf == 1) {
status = 1;
}else { }else {
status = 2; if(sbyf == 1) {
status = 1;
}else {
status = 2;
}
} }
} }
} }
...@@ -1025,6 +1049,9 @@ public class ClockInController { ...@@ -1025,6 +1049,9 @@ public class ClockInController {
commentary = "打卡成功"; commentary = "打卡成功";
}else { }else {
commentary = msg; commentary = msg;
if(status_ == 2) {
status = status_;
}
} }
//cardtype--1:GPS,2:WIFI,3:考勤机 //cardtype--1:GPS,2:WIFI,3:考勤机
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(time_).results(results).userId(userid).type(type).status(status).sort(atttype) KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(time_).results(results).userId(userid).type(type).status(status).sort(atttype)
...@@ -2214,6 +2241,9 @@ public class ClockInController { ...@@ -2214,6 +2241,9 @@ public class ClockInController {
String stampToDate = ClockInTool.stampToDate(String.valueOf(endDate));//当天打卡的最后时间 String stampToDate = ClockInTool.stampToDate(String.valueOf(endDate));//当天打卡的最后时间
Timestamp d = Timestamp.valueOf(stampToDate); Timestamp d = Timestamp.valueOf(stampToDate);
Timestamp b = Timestamp.valueOf(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));//当前时间
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode()); //考勤组信息 KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode()); //考勤组信息
if(attgro != null) { if(attgro != null) {
...@@ -2240,10 +2270,19 @@ public class ClockInController { ...@@ -2240,10 +2270,19 @@ public class ClockInController {
bc++; bc++;
ash.setIsdk(1); ash.setIsdk(1);
} }
//是否请假
KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userBean.getEmpNum(), 2, str,userBean.getOrgCode());
boolean adopt = false;
if(leainv != null) {
String time = ClockInTool.stampToDate4(String.valueOf(ash.getTime()));//当天打卡的最后时间
adopt = ClockInTool.hourMinuteBetween(time, leainv.getStartTime().substring(0, 16), leainv.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
}
if(adopt) {
ash.setIsleave(1);
}
}else { }else {
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ash.getId())); KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ash.getId()));
Timestamp b = Timestamp.valueOf(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));//
String xbdk1 = (str+" "+shif.getXbdk1()+":00").replaceAll("\r|\n", ""); String xbdk1 = (str+" "+shif.getXbdk1()+":00").replaceAll("\r|\n", "");
Timestamp a = Timestamp.valueOf(xbdk1); Timestamp a = Timestamp.valueOf(xbdk1);
String sbdk1 = (str+" "+shif.getSbdk1()+":00").replaceAll("\r|\n", ""); String sbdk1 = (str+" "+shif.getSbdk1()+":00").replaceAll("\r|\n", "");
...@@ -2265,10 +2304,22 @@ public class ClockInController { ...@@ -2265,10 +2304,22 @@ public class ClockInController {
bsz = 1; bsz = 1;
ash.setIsdk(0); ash.setIsdk(0);
}else { }else {
bc++;
ash.setIsdk(1); ash.setIsdk(1);
} }
} }
r++; r++;
//是否请假
KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userBean.getEmpNum(), 2, str,userBean.getOrgCode());
boolean adopt = false;
if(leainv != null) {
String time = ClockInTool.stampToDate4(String.valueOf(ash.getTime()));//当天打卡的最后时间
adopt = ClockInTool.hourMinuteBetween(time, leainv.getStartTime().substring(0, 16), leainv.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
}
if(adopt) {
ash.setIsleave(1);
}
} }
}else { }else {
boolean ectivedate = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(nowdate), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getStarttime()), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getEndtime()),"yyyy-MM-dd HH:mm"); boolean ectivedate = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(nowdate), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getStarttime()), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getEndtime()),"yyyy-MM-dd HH:mm");
...@@ -2279,6 +2330,17 @@ public class ClockInController { ...@@ -2279,6 +2330,17 @@ public class ClockInController {
bc++; bc++;
ash.setIsdk(1); ash.setIsdk(1);
} }
//是否请假
KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userBean.getEmpNum(), 2, str,userBean.getOrgCode());
boolean adopt = false;
if(leainv != null) {
String time = ClockInTool.stampToDate4(String.valueOf(ash.getTime()));//当天打卡的最后时间
adopt = ClockInTool.hourMinuteBetween(time, leainv.getStartTime().substring(0, 16), leainv.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
}
if(adopt) {
ash.setIsleave(1);
}
} }
List<KqglAssoDkjl> dajllist_ = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum()); List<KqglAssoDkjl> dajllist_ = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum());
...@@ -2298,9 +2360,12 @@ public class ClockInController { ...@@ -2298,9 +2360,12 @@ public class ClockInController {
} }
//全部为 1 时 //全部为 1 时
if(bccs == bc) { if(bccs == bc && b.before(d)) {
KqglAssoDkjl dk = KqglAssoDkjl.builder().build().selectOne(new QueryWrapper<KqglAssoDkjl>().lambda().eq(KqglAssoDkjl::getQyid, userBean.getOrgCode()) KqglAssoDkjl dk = KqglAssoDkjl.builder().build().selectOne(new QueryWrapper<KqglAssoDkjl>().lambda().eq(KqglAssoDkjl::getQyid, userBean.getOrgCode())
.eq(KqglAssoDkjl::getUserId, userBean.getEmpNum()).ge(KqglAssoDkjl::getDktime, startDate).le(KqglAssoDkjl::getDktime, endDate).orderByDesc(KqglAssoDkjl::getSort).last("LIMIT 1")); .eq(KqglAssoDkjl::getUserId, userBean.getEmpNum()).ge(KqglAssoDkjl::getDktime, startDate).le(KqglAssoDkjl::getDktime, endDate)
.ne(KqglAssoDkjl::getSort, 0).ne(KqglAssoDkjl::getStatus, 2).ne(KqglAssoDkjl::getStatus, 0)
.orderByDesc(KqglAssoDkjl::getSort).last("LIMIT 1"));
if(dk != null && attdate.getAttsch().size() != dk.getSort()) { if(dk != null && attdate.getAttsch().size() != dk.getSort()) {
AttSchedule att = attsch.get(dk.getSort()); AttSchedule att = attsch.get(dk.getSort());
att.setIsdk(0); att.setIsdk(0);
...@@ -2431,15 +2496,22 @@ public class ClockInController { ...@@ -2431,15 +2496,22 @@ public class ClockInController {
KqglAssoDkmx yesterdaymx = KqglAssoDkmx.builder().build(); KqglAssoDkmx yesterdaymx = KqglAssoDkmx.builder().build();
AttendanceCardListDto attdateyesterday; AttendanceCardListDto attdateyesterday;
long yesendtime1=0,yesendtime2=0,yesendtime3=0; long yesendtime1=0,yesendtime2=0,yesendtime3=0;
String regex = "(\\d+)(?:(\\.\\d*[^0])|\\.)0*";
//存在晚走玩到 //存在晚走玩到
if(iswzwd > 0) { if(iswzwd > 0) {
//统一分钟数 //统一分钟数
xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1 xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1
sbwd1 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd1()) * 60));//上班晚到1
String as = String.valueOf(Double.valueOf(shif.getSbwd1()) * 60);
sbwd1 = Integer.valueOf(as.replaceAll(regex, "$1$2"));//上班晚到1
xbwz2 = Double.valueOf(shif.getXbwz2()) * 60;//下班晚走2 xbwz2 = Double.valueOf(shif.getXbwz2()) * 60;//下班晚走2
sbwd2 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd2()) * 60));//上班晚到2 String qw = String.valueOf(Double.valueOf(shif.getSbwd2()) * 60);
sbwd2 = Integer.valueOf(qw.replaceAll(regex, "$1$2"));//上班晚到2
xbwz3 = Double.valueOf(shif.getXbwz3()) * 60;//下班晚走3 xbwz3 = Double.valueOf(shif.getXbwz3()) * 60;//下班晚走3
sbwd3 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd3()) * 60));//上班晚到3
String ed = String.valueOf(Double.valueOf(shif.getSbwd3()) * 60);
sbwd3 = Integer.valueOf(ed.replaceAll(regex, "$1$2"));//上班晚到3
//获取前一天最后下班的时间 //获取前一天最后下班的时间
yesterdaymx = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum()) yesterdaymx = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum())
...@@ -2456,20 +2528,23 @@ public class ClockInController { ...@@ -2456,20 +2528,23 @@ public class ClockInController {
if(attdateyesterday.getAttsch().size() == 6) { if(attdateyesterday.getAttsch().size() == 6) {
yesendtime3 = ashyes.get(5).getTime(); yesendtime3 = ashyes.get(5).getTime();
} }
if(dkcs_ == 1) { if(yesterdaymx != null) {
if(yesterdaymx.getXbdk1() != null && yesterdaymx.getXbdk1jg() == 0) { if(dkcs_ == 1) {
latetime = (yesterdaymx.getXbdk1() - yesendtime1)/1000/60; if(yesterdaymx.getXbdk1() != null && yesterdaymx.getXbdk1jg() == 0) {
} latetime = (yesterdaymx.getXbdk1() - yesendtime1)/1000/60;
}else if(dkcs_ == 2){ }
if(yesterdaymx.getXbdk2() != null && yesterdaymx.getXbdk2jg() == 0) { }else if(dkcs_ == 2){
latetime = (yesterdaymx.getXbdk2() - yesendtime2)/1000/60; if(yesterdaymx.getXbdk2() != null && yesterdaymx.getXbdk2jg() == 0) {
} latetime = (yesterdaymx.getXbdk2() - yesendtime2)/1000/60;
}else { }
if(yesterdaymx.getXbdk3() != null && yesterdaymx.getXbdk3jg() == 0) { }else {
latetime = (yesterdaymx.getXbdk3() - yesendtime3)/1000/60; if(yesterdaymx.getXbdk3() != null && yesterdaymx.getXbdk3jg() == 0) {
latetime = (yesterdaymx.getXbdk3() - yesendtime3)/1000/60;
}
} }
} }
if(latetime != 0) { if(latetime != 0) {
latetime_ = Double.valueOf(String.valueOf(latetime));//前天晚走时长(分钟) latetime_ = Double.valueOf(String.valueOf(latetime));//前天晚走时长(分钟)
if(latetime_ > xbwz1 && latetime_ < xbwz2) { if(latetime_ > xbwz1 && latetime_ < xbwz2) {
......
...@@ -658,6 +658,7 @@ public class ClockInTool { ...@@ -658,6 +658,7 @@ public class ClockInTool {
return res; return res;
} }
/** /**
* 时间戳转换时间 * 时间戳转换时间
*/ */
...@@ -682,6 +683,18 @@ public class ClockInTool { ...@@ -682,6 +683,18 @@ public class ClockInTool {
return res; return res;
} }
/**
* 时间戳转换时间
*/
public static String stampToDate4(String s){
String res;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
long lt = new Long(s);
Date date = new Date(lt);
res = simpleDateFormat.format(date);
return res;
}
public static String Str_Time_formatting(String str,String Format) { public static String Str_Time_formatting(String str,String Format) {
SimpleDateFormat sdf = new SimpleDateFormat(Format); SimpleDateFormat sdf = new SimpleDateFormat(Format);
......
...@@ -31,7 +31,9 @@ import cn.timer.api.bean.kqmk.KqglAssoTeshu; ...@@ -31,7 +31,9 @@ import cn.timer.api.bean.kqmk.KqglAssoTeshu;
import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban; import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz; import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.qyzx.QyzxEntInfoM; import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.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.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.PunchRecordMapper;
...@@ -43,7 +45,9 @@ import cn.timer.api.dao.kqmk.KqglAssoTeshuMapper; ...@@ -43,7 +45,9 @@ 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.AttSchedule;
import cn.timer.api.dto.kqmk.AttSubsidiaryDto; import cn.timer.api.dto.kqmk.AttSubsidiaryDto;
import cn.timer.api.dto.kqmk.AttendanceCardListDto;
import cn.timer.api.utils.DateUtil; import cn.timer.api.utils.DateUtil;
/** /**
...@@ -99,6 +103,10 @@ public class AttendanceTaskTiming{ ...@@ -99,6 +103,10 @@ public class AttendanceTaskTiming{
private PunchRecordMapper punchrecordmapper; private PunchRecordMapper punchrecordmapper;
@Autowired @Autowired
private KqglAssoDkmxMapper kqglassodkmxmapper; private KqglAssoDkmxMapper kqglassodkmxmapper;
@Autowired
private ClockInController clockincontroller;
/** /**
* @return * @return
* @throws ParseException * @throws ParseException
...@@ -109,7 +117,7 @@ public class AttendanceTaskTiming{ ...@@ -109,7 +117,7 @@ public class AttendanceTaskTiming{
// @Scheduled(cron = "0 22 15 * * ?") // 测试:5秒执行一次 0 0 19 * * ? // @Scheduled(cron = "0 22 15 * * ?") // 测试:5秒执行一次 0 0 19 * * ?
// @Scheduled(cron = "0 */5 * * * ?") // @Scheduled(cron = "0 */5 * * * ?")
// @Scheduled(cron = "0 40 17 * * ?") // @Scheduled(cron = "0 24 10 * * ?")
public void AttendanceTask() throws ParseException { public void AttendanceTask() throws ParseException {
// boolean implement = false; // boolean implement = false;
...@@ -179,12 +187,18 @@ public class AttendanceTaskTiming{ ...@@ -179,12 +187,18 @@ public class AttendanceTaskTiming{
String[] sblacks = new String[31];//上班缺卡天数 String[] sblacks = new String[31];//上班缺卡天数
String[] xblacks = new String[31];//下班缺卡天数 String[] xblacks = new String[31];//下班缺卡天数
String[] dkjtts = new String[attendance.size()];//目前打卡日期明细 String[] dkjtts = new String[attendance.size()];//目前打卡日期明细
int bccs = 0;
if(attendance.size() > 0) { if(attendance.size() > 0) {
dkjl = attendance.size(); dkjl = attendance.size();
for(PunchCardDetails pcd:attendance){ for(PunchCardDetails pcd:attendance){
AttendanceCardListDto attdate = clockincontroller.MethodCall(org_code, user.getEmpnum(), pcd.getData());
List<AttSchedule> ashss = attdate.getAttsch();//获取今天应打卡时间
if(EmptyUtil.isNotEmpty(attdate.getAttsch()) && ashss.get(0).getId() != 0) {//班次不为空
bccs = attdate.getAttsch().size();
}
dkjtts[dk] = pcd.getData(); dkjtts[dk] = pcd.getData();
dk++; dk++;
if(pcd.getYdkcs() == 2 || pcd.getYdkcs() == 4 || pcd.getYdkcs() == 6){ if(bccs == 2 || bccs == 4 || bccs == 6){
if(pcd.getSbdk1() == null){ if(pcd.getSbdk1() == null){
sblacks[sbqkcs] = pcd.getData(); sblacks[sbqkcs] = pcd.getData();
sbqkcs++; sbqkcs++;
...@@ -194,7 +208,7 @@ public class AttendanceTaskTiming{ ...@@ -194,7 +208,7 @@ public class AttendanceTaskTiming{
xbqkcs++; xbqkcs++;
} }
} }
if(pcd.getYdkcs() == 4 || pcd.getYdkcs() == 6){ if(bccs == 4 || bccs == 6){
if(pcd.getSbdk2() == null){ if(pcd.getSbdk2() == null){
sblacks[sbqkcs] = pcd.getData(); sblacks[sbqkcs] = pcd.getData();
sbqkcs++; sbqkcs++;
...@@ -204,7 +218,7 @@ public class AttendanceTaskTiming{ ...@@ -204,7 +218,7 @@ public class AttendanceTaskTiming{
xbqkcs++; xbqkcs++;
} }
} }
if(pcd.getYdkcs() == 6){ if(bccs == 6){
if(pcd.getSbdk3() == null){ if(pcd.getSbdk3() == null){
sblacks[sbqkcs] = pcd.getData(); sblacks[sbqkcs] = pcd.getData();
sbqkcs++; sbqkcs++;
...@@ -215,6 +229,12 @@ public class AttendanceTaskTiming{ ...@@ -215,6 +229,12 @@ public class AttendanceTaskTiming{
} }
} }
} }
sblacks = ClockInTool.deleteArrayNull(sblacks);
sbqkcs= sblacks.length;
xblacks = ClockInTool.deleteArrayNull(xblacks);
xbqkcs = xblacks.length;
} }
//具体打卡时间入汇总表(打卡成功才会录入汇总表) //具体打卡时间入汇总表(打卡成功才会录入汇总表)
// KqglAssoMonthPunchSummary isyessum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda() // KqglAssoMonthPunchSummary isyessum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda()
...@@ -789,6 +809,4 @@ public class AttendanceTaskTiming{ ...@@ -789,6 +809,4 @@ public class AttendanceTaskTiming{
// return null; // return null;
// } // }
} }
} }
...@@ -76,6 +76,7 @@ import cn.timer.api.dao.spmk.SpmkApproveSummaryMapper; ...@@ -76,6 +76,7 @@ import cn.timer.api.dao.spmk.SpmkApproveSummaryMapper;
import cn.timer.api.dao.spmk.SpmkCustomApprovalMapper; import cn.timer.api.dao.spmk.SpmkCustomApprovalMapper;
import cn.timer.api.dao.spmk.SpmkExecutorMapper; import cn.timer.api.dao.spmk.SpmkExecutorMapper;
import cn.timer.api.dao.spmk.SpmkInitiatorConfigMapper; import cn.timer.api.dao.spmk.SpmkInitiatorConfigMapper;
import cn.timer.api.dto.spmk.ApprovedQuantityDto;
import cn.timer.api.dto.spmk.ApprovingDto; import cn.timer.api.dto.spmk.ApprovingDto;
import cn.timer.api.dto.spmk.FlowChildren; import cn.timer.api.dto.spmk.FlowChildren;
import cn.timer.api.dto.spmk.FromData; import cn.timer.api.dto.spmk.FromData;
...@@ -926,4 +927,44 @@ public class SpmkController { ...@@ -926,4 +927,44 @@ public class SpmkController {
return ResultUtil.data(msg); return ResultUtil.data(msg);
} }
@PostMapping(value = "/approved_quantity")
@ApiOperation(value = "APP-我发起的/我审批的/抄送我的-数量", httpMethod = "POST", notes = "")
public Result<Object> ApprovedQuantity(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mysummaryquerydto){
ApprovedQuantityDto qna = ApprovedQuantityDto.builder().build();
mysummaryquerydto.setEndTime(null);
mysummaryquerydto.setStartTime(null);
mysummaryquerydto.setOrgCode(userBean.getOrgCode());
mysummaryquerydto.setEmpNum(userBean.getEmpNum());
mysummaryquerydto.setSts(5);//状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝 4:(2/3) 5:全部
int istartedit=0,ccme=0,iapprovedit=0;
mysummaryquerydto.setType(0);//我发起的
List<SpmkApproveSummary> istartedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(istartedit_.size() > 0) {
istartedit = istartedit_.size();
}
mysummaryquerydto.setType(1);//抄送我的
List<SpmkApproveSummary> ccme_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(ccme_.size() > 0) {
ccme = ccme_.size();
}
mysummaryquerydto.setType(2);//我审批的
List<SpmkApproveSummary> iapprovedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(iapprovedit_.size() > 0) {
iapprovedit = iapprovedit_.size();
}
qna.setIstartedit(istartedit);
qna.setCcme(ccme);
qna.setIapprovedit(iapprovedit);
return ResultUtil.data(qna);
}
} }
...@@ -23,4 +23,6 @@ public interface KqglAssoRelationSummaryMapper extends BaseMapper<KqglAssoRelati ...@@ -23,4 +23,6 @@ public interface KqglAssoRelationSummaryMapper extends BaseMapper<KqglAssoRelati
List<KqglAssoRelationSummary> LeaveInvestigation(int userid,int approvaltype,String apptime,int orgcode); List<KqglAssoRelationSummary> LeaveInvestigation(int userid,int approvaltype,String apptime,int orgcode);
KqglAssoRelationSummary selectTabledata(int userid,int approvaltype,String apptime); KqglAssoRelationSummary selectTabledata(int userid,int approvaltype,String apptime);
KqglAssoRelationSummary leaveinvesti(int userid,int approvaltype,String apptime,int orgcode);
} }
package cn.timer.api.dao.spmk; package cn.timer.api.dao.spmk;
import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -21,5 +23,7 @@ public interface SpmkApproveSummaryMapper extends BaseMapper<SpmkApproveSummary> ...@@ -21,5 +23,7 @@ public interface SpmkApproveSummaryMapper extends BaseMapper<SpmkApproveSummary>
IPage<SpmkApproveSummary> selectPageByQuery(IPage<SpmkApproveSummary> page,@Param("param") SummaryQueryDto summaryQueryDto); IPage<SpmkApproveSummary> selectPageByQuery(IPage<SpmkApproveSummary> page,@Param("param") SummaryQueryDto summaryQueryDto);
IPage<SpmkApproveSummary> selectPageByQueryForEmpNum(IPage<SpmkApproveSummary> page,@Param("param") MySummaryQueryDto mySummaryQueryDto); IPage<SpmkApproveSummary> selectPageByQueryForEmpNum(IPage<SpmkApproveSummary> page,@Param("param") MySummaryQueryDto mySummaryQueryDto);
List<SpmkApproveSummary> selectPageByQueryForEmpNum(@Param("param") MySummaryQueryDto mySummaryQueryDto);
} }
...@@ -26,6 +26,7 @@ public class AttSchedule implements Serializable{ ...@@ -26,6 +26,7 @@ public class AttSchedule implements Serializable{
private Long starttime; private Long starttime;
private Long endtime; private Long endtime;
private int isleave;//是否请假
private int isupdate;//是否跟新打卡 private int isupdate;//是否跟新打卡
private int isdk;//0:当前打卡 1:已过打卡 private int isdk;//0:当前打卡 1:已过打卡
private KqglAssoDkjl dajl; private KqglAssoDkjl dajl;
......
package cn.timer.api.dto.spmk;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ApprovedQuantityDto {
@ApiModelProperty(value = "我发起的", example = "11")
private Integer istartedit;
@ApiModelProperty(value = "抄送我的", example = "22")
private Integer ccme;
@ApiModelProperty(value = "我审批的", example = "33")
private Integer iapprovedit;
}
...@@ -24,16 +24,16 @@ public class MySummaryQueryDto extends Page{ ...@@ -24,16 +24,16 @@ public class MySummaryQueryDto extends Page{
private Integer empNum; private Integer empNum;
@ApiModelProperty(value = "关键字 标题/审批人名称/审批总汇id", example = "请假") @ApiModelProperty(value = "关键字 标题/审批人名称/审批总汇id", example = "")
private String query; private String query;
@ApiModelProperty(value = "状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝", example = "0") @ApiModelProperty(value = "状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝", example = "0")
private Integer sts; private Integer sts;
@ApiModelProperty(value = "开始时间 ", example = "2000-10-10 10:10:10") @ApiModelProperty(value = "开始时间 ", example = "")
private String startTime; private String startTime;
@ApiModelProperty(value = "结束时间 ", example = "2020-10-10 10:10:10") @ApiModelProperty(value = "结束时间 ", example = "")
private String endTime; private String endTime;
@NotNull(message = ValidationMsg.NOTNULL) @NotNull(message = ValidationMsg.NOTNULL)
......
...@@ -68,6 +68,16 @@ ...@@ -68,6 +68,16 @@
and SUBSTR(res.app_time,1,7) = #{apptime} and SUBSTR(res.app_time,1,7) = #{apptime}
GROUP BY res.start_time,res.end_time; GROUP BY res.start_time,res.end_time;
</select> </select>
<select id="leaveinvesti" resultMap="BaseResultMap">
select res.start_time,
res.end_time
from kqgl_asso_relation_summary res
where res.user_id = #{userid}
and res.org_code = #{orgcode}
and res.approval_type = #{approvaltype}
and res.app_time = #{apptime}
GROUP BY res.start_time,res.end_time;
</select>
<select id="selectTabledata" resultMap="BaseResultMap"> <select id="selectTabledata" resultMap="BaseResultMap">
select SUM(res.duration) as duration select SUM(res.duration) as duration
......
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