Commit 57debb35 by lal Committed by chenzg

提价BUG

parent 214aab91
......@@ -147,13 +147,15 @@ public class ClockInController {
//检查昨日的班次是否存在次日打卡
KqglAssoDkjl balan = kqglassodkjlmapper.selectOne(new QueryWrapper<KqglAssoDkjl>().lambda().eq(KqglAssoDkjl::getUserId, userid).eq(KqglAssoDkjl::getAttdate, dakariqi).ne(KqglAssoDkjl::getBcid, 0).orderByDesc(KqglAssoDkjl :: getSort).last("LIMIT 1"));
boolean dnck = false;
boolean crdk = false;//当次打卡是否存在次日打卡
if(balan != null) {//前一天是否打过卡 去班次id查询是否存在次日打卡
//班次信息
KqglAssoBcsz shif = kqglassobcszmapper.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, balan.getBcid()));
int dkcs = shif.getSxbcs()*2;
List<AttSchedule> ashss = attdate.getAttsch();//获取今天应打卡时间
boolean dnck = false;
// boolean dnck = false;
if(ashss.size() > 0) {
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(ashss.get(0).getTime())));//当天应打的首次上班卡时间
Date sd2=df1.parse(current_time);//当前时间
......@@ -167,7 +169,7 @@ public class ClockInController {
int isXbdk2Cr = shif.getIsXbdk2Cr();//下班2是否次日(0:否;1:是)
int isSbdk3Cr = shif.getIsSbdk3Cr();//上班3是否次日(0:否;1:是)
int isXbdk3Cr = shif.getIsXbdk3Cr();//下班3是否次日(0:否;1:是)
boolean crdk = false;//当次打卡是否存在次日打卡
// boolean crdk = false;//当次打卡是否存在次日打卡
if(balan.getSort() < dkcs) {
if(balan.getSort()+1 == 2 && dkcs == 2) {
if(isXbdk1Cr > 0) {//次日
......@@ -195,265 +197,275 @@ public class ClockInController {
}
}
}
if(crdk && dnck) {
dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid)
.ge(KqglAssoDkmx::getDksj, startDateyesterday).le(KqglAssoDkmx::getDksj, endDateyesterday));
attdate = MethodCall(qyid,userid,yesterday);
attendance_date = startDateyesterday;
toweek = yesterday;
}else {
dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid)
.ge(KqglAssoDkmx::getDksj, startDate).le(KqglAssoDkmx::getDksj, endDate));
// attdate = MethodCall(qyid,userid,putime);
attendance_date = startDate;
toweek = putime;
}
}else {
//无记录的话就找昨天的数据
AttendanceCardListDto attdate1 = MethodCall(qyid,userid,yesterday);
// AttendanceCardListDto attdate1 = MethodCall(qyid,userid,yesterday);
}
if(crdk && dnck) {
dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid)
.ge(KqglAssoDkmx::getDksj, startDateyesterday).le(KqglAssoDkmx::getDksj, endDateyesterday));
attdate = MethodCall(qyid,userid,yesterday);
attendance_date = startDateyesterday;
toweek = yesterday;
}else {
dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid)
.ge(KqglAssoDkmx::getDksj, startDate).le(KqglAssoDkmx::getDksj, endDate));
// attdate = MethodCall(qyid,userid,putime);
attendance_date = startDate;
toweek = putime;
}
//putime: 根据日期 得到打卡所需的详细信息
// AttendanceCardListDto attdate = MethodCall(qyid,userid,putime);
// ClockCollectData clockt = new ClockCollectData();
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;
if(attdate.getAttsch().size() > 0) {
List<AttSchedule> ash = attdate.getAttsch();
int y = 0;
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) {
starttime1 = ash.get(0).getTime();starttime1ks = ash.get(0).getStarttime();starttime1js = ash.get(0).getEndtime();
endtime1 = ash.get(1).getTime();endtime1ks = ash.get(1).getStarttime();endtime1js = ash.get(1).getEndtime();
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime2 = ash.get(2).getTime();starttime2ks = ash.get(2).getStarttime();starttime2js = ash.get(2).getEndtime();
endtime2 = ash.get(3).getTime();endtime2ks = ash.get(3).getStarttime();endtime2js = ash.get(3).getEndtime();
}
if(attdate.getAttsch().size() == 6) {
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(EmptyUtil.isEmpty(attdate.getAttsch())) {
msg = "当前未排班";
sbyf = 0;
}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;
if(attdate.getAttsch().size() > 0) {
List<AttSchedule> ash = attdate.getAttsch();
int y = 0;
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) {
starttime1 = ash.get(0).getTime();starttime1ks = ash.get(0).getStarttime();starttime1js = ash.get(0).getEndtime();
endtime1 = ash.get(1).getTime();endtime1ks = ash.get(1).getStarttime();endtime1js = ash.get(1).getEndtime();
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime2 = ash.get(2).getTime();starttime2ks = ash.get(2).getStarttime();starttime2js = ash.get(2).getEndtime();
endtime2 = ash.get(3).getTime();endtime2ks = ash.get(3).getStarttime();endtime2js = ash.get(3).getEndtime();
}
if(attdate.getAttsch().size() == 6) {
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();
}
}
}
// long punchcardtime,punchstart,punchend = 0;//应打卡时间,应打卡开始时间,应打卡结束时间
// int atttype = 0;
if(dkmc == null) {//上班1 ****新增
punchcardtime = starttime1;
punchstart = starttime1ks;
punchend = starttime1js;
atttype = 1;
}else {
if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() == null)){ //下班1
punchcardtime = endtime1;
punchstart = endtime1ks;
punchend = endtime1js;
atttype = 2;
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() == null)){ //上班2
punchcardtime = starttime2;
punchstart = starttime2ks;
punchend = starttime2js;
atttype = 3;
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() == null)){ //下班2
punchcardtime = endtime2;
punchstart = endtime2ks;
punchend = endtime2js;
atttype = 4;
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() == null)){ //上班3
punchcardtime = starttime3;
punchstart = starttime3ks;
punchend = starttime3js;
atttype = 5;
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (!("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() != null) && (("").equals(dkmc.getXbdk3()) || dkmc.getXbdk3() == null)){ //下班3
punchcardtime = endtime3;
punchstart = endtime3ks;
punchend = endtime3js;
atttype = 6;
}else {
punchcardtime = 0;punchstart = 0;punchend = 0;atttype = 7;
}
}
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()));
// long punchcardtime,punchstart,punchend = 0;//应打卡时间,应打卡开始时间,应打卡结束时间
// int atttype = 0;
if(dkmc == null) {//上班1 ****新增
punchcardtime = starttime1;
punchstart = starttime1ks;
punchend = starttime1js;
atttype = 1;
}else {
if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() == null)){ //下班1
punchcardtime = endtime1;
punchstart = endtime1ks;
punchend = endtime1js;
atttype = 2;
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() == null)){ //上班2
punchcardtime = starttime2;
punchstart = starttime2ks;
punchend = starttime2js;
atttype = 3;
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() == null)){ //下班2
punchcardtime = endtime2;
punchstart = endtime2ks;
punchend = endtime2js;
atttype = 4;
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() == null)){ //上班3
punchcardtime = starttime3;
punchstart = starttime3ks;
punchend = starttime3js;
atttype = 5;
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (!("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() != null) && (("").equals(dkmc.getXbdk3()) || dkmc.getXbdk3() == null)){ //下班3
punchcardtime = endtime3;
punchstart = endtime3ks;
punchend = endtime3js;
atttype = 6;
}else {
punchcardtime = 0;punchstart = 0;punchend = 0;atttype = 7;
}
}
//打卡记录录入 -- 打卡是否有时间范围限制
// boolean isRange = true;
if(punchstart>0 && punchend>0) {
String staputime = new SimpleDateFormat("HH:mm").format(punchstart);//应打卡开始时间
String entputime = new SimpleDateFormat("HH:mm").format(punchend);//应打卡结束时间
String DKputime = new SimpleDateFormat("HH:mm").format(time_);//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"HH:mm");
if (!effectiveDate) {
System.out.println("当前打卡时间不在范围内");
// 手动抛出异常
isRange = false;
// throw new Exception();
}
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(isRange) {
int yzcd = shif.getYzcdfzs();//严重迟到分钟数
int kgcdfzs = shif.getKgcdfzs();//旷工迟到分钟数
if(dkmc == null) {//上班1 ****新增
int sbdk1jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){sbdk1jg = Math.abs(Integer.valueOf(time.toString()));}//上班1打卡结果
}
int ydkcs = 0;
if(shif != null){ydkcs = shif.getSxbcs()*2;}//应打卡次数
if(sbdk1jg > yzcd) {
yzcdcs++;
yzcdsc = sbdk1jg - yzcd;
}
if(sbdk1jg > kgcdfzs) {kgcdcs++;}
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(userid).data(putime).sbdk1(time_).sbdk1jg(sbdk1jg).ydkcs(ydkcs).qyid(qyid).dksj(startDate).yzcdcs(yzcdcs).yzcdsc(Double.valueOf(yzcdsc)).kgcdfzs(kgcdcs).build();
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
//打卡记录录入 -- 打卡是否有时间范围限制
// boolean isRange = true;
if(punchstart>0 && punchend>0) {
String staputime = new SimpleDateFormat("HH:mm").format(punchstart);//应打卡开始时间
String entputime = new SimpleDateFormat("HH:mm").format(punchend);//应打卡结束时间
String DKputime = new SimpleDateFormat("HH:mm").format(time_);//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"HH:mm");
if (!effectiveDate) {
System.out.println("当前打卡时间不在范围内");
// 手动抛出异常
isRange = false;
// throw new Exception();
}
dkmx = pcd.getId();
}else { //*****修改
dkmx = dkmc.getId();
KqglAssoDkmx pcd = KqglAssoDkmx.builder().build();
if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() == null)){//下班1
pcd.setId(dkmc.getId());
pcd.setXbdk1(time_);//下班1打卡时间
}
if(isRange) {
int yzcd = shif.getYzcdfzs();//严重迟到分钟数
int kgcdfzs = shif.getKgcdfzs();//旷工迟到分钟数
if(dkmc == null) {//上班1 ****新增
int sbdk1jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){
pcd.setXbdk1jg(0);// 打卡结果
}else{
pcd.setXbdk1jg(Math.abs(Integer.valueOf(time.toString())));//上班1打卡结果
}
if(time > 0){sbdk1jg = Math.abs(Integer.valueOf(time.toString()));}//上班1打卡结果
}
if(dkmc.getSbdk1() != null){
Long time = (time_ - dkmc.getSbdk1())/1000/60;
pcd.setGzsc(Math.abs(Double.valueOf(time.toString())));//只打一次卡时计算工作时长
}
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() == null)){//上班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()));}
int ydkcs = 0;
if(shif != null){ydkcs = shif.getSxbcs()*2;}//应打卡次数
if(sbdk1jg > yzcd) {
yzcdcs++;
yzcdsc = sbdk1jg - yzcd;
}
if(sbdk2jg > yzcd) {
yzcdcs = dkmc.getYzcdcs()+1;
yzcdsc = sbdk2jg - yzcd;
if(sbdk1jg > kgcdfzs) {kgcdcs++;}
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(userid).data(putime).sbdk1(time_).sbdk1jg(sbdk1jg).ydkcs(ydkcs).qyid(qyid).dksj(startDate).yzcdcs(yzcdcs).yzcdsc(Double.valueOf(yzcdsc)).kgcdfzs(kgcdcs).build();
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
if(sbdk2jg > kgcdfzs) {kgcdcs++;}
dkmx = pcd.getId();
}else { //*****修改
dkmx = dkmc.getId();
KqglAssoDkmx pcd = KqglAssoDkmx.builder().build();
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((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() == null)){//下班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())));
if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() == null)){//下班1
pcd.setId(dkmc.getId());
pcd.setXbdk1(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){
pcd.setXbdk1jg(0);// 打卡结果
}else{
pcd.setXbdk1jg(Math.abs(Integer.valueOf(time.toString())));//上班1打卡结果
}
}
}
//班次为4次时,计算工作时长
if(dkmc.getSbdk2() != null){
Long time = (time_ - dkmc.getSbdk2())/1000/60;
BigDecimal om = new BigDecimal(dkmc.getGzsc());
BigDecimal on = new BigDecimal(time);
double worktime = Math.abs(om.add(on).doubleValue());
pcd.setGzsc(worktime);
}
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() == null)){//上班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) {
yzcdcs = dkmc.getYzcdcs()+1;
yzcdsc = sbdk3jg - yzcd;
}
if(sbdk3jg > kgcdfzs) {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((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (!("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() != null) && (("").equals(dkmc.getXbdk3()) || dkmc.getXbdk3() == null)){//下班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())));
if(dkmc.getSbdk1() != null){
Long time = (time_ - dkmc.getSbdk1())/1000/60;
pcd.setGzsc(Math.abs(Double.valueOf(time.toString())));//只打一次卡时计算工作时长
}
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() == null)){//上班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) {
yzcdcs = dkmc.getYzcdcs()+1;
yzcdsc = sbdk2jg - yzcd;
}
if(sbdk2jg > kgcdfzs) {kgcdcs++;}
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((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() == null)){//下班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);
double worktime = Math.abs(om.add(on).doubleValue());
pcd.setGzsc(worktime);
}
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() == null)){//上班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) {
yzcdcs = dkmc.getYzcdcs()+1;
yzcdsc = sbdk3jg - yzcd;
}
if(sbdk3jg > kgcdfzs) {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((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (!("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() != null) && (("").equals(dkmc.getXbdk3()) || dkmc.getXbdk3() == null)){//下班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);
double worktime = Math.abs(om.add(on).doubleValue());
pcd.setGzsc(worktime);
}
}
pcd.setId(dkmc.getId());
if(atttype <= 6){
int update = kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}
//班次为6次时,计算工作时长
if(dkmc.getSbdk3() != null){
Long time = (time_ - dkmc.getSbdk3())/1000/60;
BigDecimal om = new BigDecimal(dkmc.getGzsc());//第二次
BigDecimal on = new BigDecimal(time);
double worktime = Math.abs(om.add(on).doubleValue());
pcd.setGzsc(worktime);
}
}
pcd.setId(dkmc.getId());
if(atttype <= 6){
int update = kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}
}else {
msg = "当前打卡时间不在范围内";
sbyf = 0;
}
}else {
msg = "当前打卡时间不在范围内";
sbyf = 0;
}
}else {
msg = "当前是休息时间";
sbyf = 0;
}
}else {
msg = "当前是休息时间";
sbyf = 0;
}
}
}else {
//自由工时打卡
......@@ -610,20 +622,24 @@ public class ClockInController {
if((atttype)%2 > 0){
type = 1;// 类型(类型 0:无排班打卡 1:上班 2:下班) punchcardtime == 0:无班次打卡
if(attdate.getAttgrouptype() != 3) {
if(punchcardtime == 0 && clockt.getShifid() != 0){
status = 1;
}if(punchcardtime == 0 && clockt.getShifid() == 0) {
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 {
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {
if(punchcardtime == 0 && clockt.getShifid() != 0){
status = 1;
}if(punchcardtime == 0 && clockt.getShifid() == 0) {
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(sbyf == 1) {
......@@ -632,24 +648,27 @@ public class ClockInController {
status = 2;
}
}
}else{
type = 2;// 类型(类型 0:无排班打卡 1:上班 2:下班)
if(attdate.getAttgrouptype() != 3) {
if(punchcardtime == 0 && clockt.getShifid() != 0){
status = 1;
}if(punchcardtime == 0 && clockt.getShifid() == 0) {
status = 2;
}else{
if(isRange) {
if(time < 0){
status = 4;
}else if(results == 0){
status = 1;
}
}else {
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {
if(punchcardtime == 0 && clockt.getShifid() != 0){
status = 1;
}if(punchcardtime == 0 && clockt.getShifid() == 0) {
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(sbyf == 1) {
......
package cn.timer.api.controller.kqgl;
import java.util.List;
public class EmptyUtil {
/**
* 判断对象为空
*
* @param obj 对象名
* @return 是否为空
*/
// @SuppressWarnings("rawtypes")
public static boolean isEmpty(Object obj) {
if (obj == null) {
return true;
}
if ((obj instanceof List)) {
return ((List) obj).size() == 0;
}
if ((obj instanceof String)) {
return ((String) obj).trim().equals("");
}
return false;
}
/**
* 判断对象不为空
*
* @param obj 对象名
* @return 是否不为空
*/
public static boolean isNotEmpty(Object obj) {
return !isEmpty(obj);
}
}
......@@ -302,15 +302,23 @@ public class TimeCardController {
}else if(launchs != null && launchs.length>0){
for(int p=0;p<launchs.length;p++){
KqglAssoOvertimeRange.builder().build().delete(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getOvertimeRulesId, id));
KqglAssoOvertimeRange.builder().build().delete(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, Integer.valueOf(launchs[p])));
KqglAssoOvertimeRange vice = KqglAssoOvertimeRange.builder().build();
vice.setOvertimeRulesId(id);
vice.setAttgroupId(Integer.valueOf(launchs[p]));
overatts.add(vice);
//应用范围应用到相对应的考勤组************
KqglMainKqz.builder().id(Integer.valueOf(launchs[p])).overtimeRulesId(id).build().updateById();
}
}
if(overatts.size() > 0) {
kqglassoovertimerangemapper.insertovertimerangelist(overatts);
}
List<KqglAssOvertimeVice> overtimes=new ArrayList<KqglAssOvertimeVice>();
StartTimeRestDto[] rest = overrules.getStarttime();
if(rest != null && rest.length>0){
......@@ -364,6 +372,13 @@ public class TimeCardController {
if(!KqglAssoOvertimeRules.builder().id(id).build().deleteById()) {
throw new Exception();
}else {
List<KqglAssoOvertimeRange> rans = kqglassoovertimerangemapper.selectList(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getOvertimeRulesId, id));
for(KqglAssoOvertimeRange ran:rans) {
KqglMainKqz.builder().id(ran.getAttgroupId()).overtimeRulesId(0).build().updateById();
}
KqglAssoOvertimeRange.builder().build().delete(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getOvertimeRulesId, id));
KqglAssOvertimeVice.builder().build().delete(new QueryWrapper<KqglAssOvertimeVice>().lambda().eq(KqglAssOvertimeVice::getOvertimeRulesId, id));
return ResultUtil.success("删除成功!");
}
......
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