Commit 01940151 by ilal

提交

parent 0df12b67
......@@ -95,9 +95,11 @@ import cn.timer.api.dao.kqgl.ShiftManagementMapper;
import cn.timer.api.dao.kqgl.SpecialDateMapper;
import cn.timer.api.dao.kqgl.UserAttendanceRelMapper;
import cn.timer.api.dao.kqgl.UserEquiRelationMapper;
import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.KqglAssoPbmxDto;
import cn.timer.api.dto.kqmk.KqglMainKqzDto;
import cn.timer.api.utils.DateUtil;
import cn.timer.api.utils.Result;
......@@ -314,6 +316,10 @@ public class AttController {
return ResultUtil.data(shifs);
}
@Autowired
private KqglAssoPbmxMapper kqglassopbmxmapper;
/**
* 修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改)
*/
......@@ -327,120 +333,270 @@ public class AttController {
int qyid = userBean.getOrgCode();//坏小孩【企业id】
int userid = userBean.getEmpNum();//用户id
AttendanceGroup qttgrop = attendancegroupservice.selectByPrimaryKey(Integer.valueOf(attass.getAttgroupid()));
String dastr = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();//
AttendanceGroup qttgrop = attendancegroupservice.selectByPrimaryKey(Integer.valueOf(attass.getAttgroupid()));
boolean xiugai = true;
//记录排班(排班制)
List<Schedule> schlist=new ArrayList<Schedule>();
Schedule[] schedules = attass.getSchedules();// 排班日期【排班制】--班次id、日期
if(schedules.length>0 && attass.getAtttype() == 2){
for(int p=0;p<schedules.length;p++){
Schedule sch = new Schedule();
sch.setUserid(schedules[p].getUserid());//用户id
sch.setData(schedules[p].getData());//排班日期 格式:yyyy-MM-dd
sch.setBcid(schedules[p].getBcid());//班次id 0为休息
sch.setKqzid(Integer.valueOf(attass.getAttgroupid()));//考勤组id
schlist.add(sch);
/*****************************/
//转换日期
String data = mat.format(new Date(schedules[p].getData().toString()));
Long startDate = 0l;
Long endDate = 0l;
try {
startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
} catch (ParseException e) {
e.printStackTrace();
String date = String.valueOf(schedules[0].getData());
Date dt=new Date(date);
SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
System.out.println(famt.format(dt));
if(!(famt.format(dt)).equals(dastr)) {
xiugai = false;
for(int p=0;p<schedules.length;p++){
Schedule sch = new Schedule();
sch.setUserid(schedules[p].getUserid());//用户id
sch.setData(schedules[p].getData());//排班日期 格式:yyyy-MM-dd
sch.setBcid(schedules[p].getBcid());//班次id 0为休息
sch.setKqzid(Integer.valueOf(attass.getAttgroupid()));//考勤组id
schlist.add(sch);
}
//当天修改后的班次
ShiftManagement banci = shiftmanagementservice.selectByPrimaryKey(schedules[p].getBcid());
Long sbdk1 = 0l;
Long xbdk1 = 0l;
Long sbdk2 = 0l;
Long xbdk2 = 0l;
Long sbdk3 = 0l;
Long xbdk3 = 0l;
if(banci != null){
if(banci.getSxbcs()== 1 || banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk1()+":00"));
xbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk1()+":00"));
if(schlist.size()>0){
scheduleservice.insertKqglAssoPbmxList(schlist);
}
}else {
xiugai = true;
for(int p=0;p<schedules.length;p++){
Schedule sch = new Schedule();
sch.setUserid(schedules[p].getUserid());//用户id
sch.setData(schedules[p].getData());//排班日期 格式:yyyy-MM-dd
sch.setBcid(schedules[p].getBcid());//班次id 0为休息
sch.setKqzid(Integer.valueOf(attass.getAttgroupid()));//考勤组id
schlist.add(sch);
/*****************************/
//转换日期
String data = mat.format(new Date(schedules[p].getData().toString()));
Long startDate = 0l;
Long endDate = 0l;
try {
startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
} catch (ParseException e) {
e.printStackTrace();
}
if(banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk2 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk2()+":00"));
xbdk2 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk2()+":00"));
//当天修改后的班次
ShiftManagement banci = shiftmanagementservice.selectByPrimaryKey(schedules[p].getBcid());
Long sbdk1 = 0l;
Long xbdk1 = 0l;
Long sbdk2 = 0l;
Long xbdk2 = 0l;
Long sbdk3 = 0l;
Long xbdk3 = 0l;
if(banci != null){
if(banci.getSxbcs()== 1 || banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk1()+":00"));
xbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk1()+":00"));
}
if(banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk2 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk2()+":00"));
xbdk2 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk2()+":00"));
}
if(banci.getSxbcs()== 3){
sbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk3()+":00"));
xbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk3()+":00"));
}
}
if(banci.getSxbcs()== 3){
sbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk3()+":00"));
xbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk3()+":00"));
//之前打卡的班次
PunchRecord mapuca = punchrecordservice.MaintenancePunchCard(startDate,endDate,schedules[p].getUserid());
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){
List<PunchRecord> initial = punchrecordservice.getMaintenancePunchCardList(startDate,endDate,schedules[p].getUserid());
if(initial.size() > 0){
RestMethod(initial,initial.get(0).getDkmxid());
}
}
}
//之前打卡的班次
PunchRecord mapuca = punchrecordservice.MaintenancePunchCard(startDate,endDate,schedules[p].getUserid());
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){
List<PunchRecord> initial = punchrecordservice.getMaintenancePunchCardList(startDate,endDate,schedules[p].getUserid());
if(initial.size() > 0){
RestMethod(initial,initial.get(0).getDkmxid());
//当天的所有打卡记录
List<PunchRecord> mapucalist = punchrecordservice.getMaintenancePunchCardList(startDate,endDate,schedules[p].getUserid());
PunchRecord minAttid = null;
PunchRecord maxAttid = null;
int dkmxid = 0;
if(mapucalist.size() > 0){
//最小值
minAttid = mapucalist.stream().min(Comparator.comparing(PunchRecord::getId)).get();
// System.out.println(minAttid.getAttdate() + "---min---" +minAttid.getId());
//最大值
maxAttid = mapucalist.stream().max(Comparator.comparing(PunchRecord::getId)).get();
// System.out.println(maxAttid.getAttdate() + "---max---" + maxAttid.getId());
//对应打卡明细表id
dkmxid = maxAttid.getDkmxid();
}
}
//当天的所有打卡记录
List<PunchRecord> mapucalist = punchrecordservice.getMaintenancePunchCardList(startDate,endDate,schedules[p].getUserid());
PunchRecord minAttid = null;
PunchRecord maxAttid = null;
int dkmxid = 0;
if(mapucalist.size() > 0){
//最小值
minAttid = mapucalist.stream().min(Comparator.comparing(PunchRecord::getId)).get();
// System.out.println(minAttid.getAttdate() + "---min---" +minAttid.getId());
//最大值
maxAttid = mapucalist.stream().max(Comparator.comparing(PunchRecord::getId)).get();
// System.out.println(maxAttid.getAttdate() + "---max---" + maxAttid.getId());
//对应打卡明细表id
dkmxid = maxAttid.getDkmxid();
}
//当天有打卡记录且当天打卡班次和当前修改后的班次不匹配再进行重新维护
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){
if(banci != null){//修改后有班次打卡
if(banci.getSxbcs() == 1){//修改后一天打两次
if(mapucalist.size() > 2){/////当天打卡多条的话 取最开始打的卡和最后打的卡 作为新一轮的上下班考勤
for(PunchRecord pre : mapucalist){/********/
if(pre.getId() != minAttid.getId() && pre.getId() != maxAttid.getId()){//去除最大和最小 其他均改为“打卡无效:此记录已被更新”
PunchRecord record = new PunchRecord();
record.setId(pre.getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
if((pre.getSort())%2 > 0){//上班
Long time = (pre.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setResults(0);// 打卡结果
//当天有打卡记录且当天打卡班次和当前修改后的班次不匹配再进行重新维护
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){
if(banci != null){//修改后有班次打卡
if(banci.getSxbcs() == 1){//修改后一天打两次
if(mapucalist.size() > 2){/////当天打卡多条的话 取最开始打的卡和最后打的卡 作为新一轮的上下班考勤
for(PunchRecord pre : mapucalist){/********/
if(pre.getId() != minAttid.getId() && pre.getId() != maxAttid.getId()){//去除最大和最小 其他均改为“打卡无效:此记录已被更新”
PunchRecord record = new PunchRecord();
record.setId(pre.getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
if((pre.getSort())%2 > 0){//上班
Long time = (pre.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//上班应打卡时间
}else{//下班
Long time = (pre.getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setResults(0);// 打卡结果
}else{
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
}
record.setAttime(sbdk1);//上班应打卡时间
}else{//下班
Long time = (pre.getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setResults(0);// 打卡结果
}else{
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}else{
if(pre.getId() == minAttid.getId()){//上班
PunchRecord record = new PunchRecord();
record.setId(pre.getId());
record.setType(1);//上班
Long time = (pre.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}else if(pre.getId() == maxAttid.getId()){//下班
PunchRecord record = new PunchRecord();
record.setId(pre.getId());
record.setType(2);//下班
Long time = (pre.getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);
record.setBcid(banci.getId());//班次id
record.setSort(2);
punchrecordservice.updateByPrimaryKeySelective(record);
}
record.setAttime(xbdk1);//下班应打卡时间
}
}
//修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
//
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//上班
PunchCardDetails max = new PunchCardDetails();
max.setId(dkmxid);//需修改的明细id
max.setXbdk1(maxdata.getDktime());
max.setXbdk1jg(maxdata.getResults());// 下班1打卡结果
Long woktimes = (maxdata.getDktime() - mindata.getDktime())/1000/60;
max.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(max);
}else{////
PunchRecord mindataone = null;
//当天打卡记录为1条
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}else{
if(pre.getId() == minAttid.getId()){//上班
//
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
//当天打卡记录为2条
if(maxAttid != null && minAttid.getId() != maxAttid.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());
record.setType(2);//下班
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);
record.setBcid(banci.getId());//班次id
record.setSort(2);
punchrecordservice.updateByPrimaryKeySelective(record);
//
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班
PunchCardDetails max = new PunchCardDetails();
max.setId(dkmxid);//需修改的明细id
max.setXbdk1(maxdata.getDktime());
max.setXbdk1jg(maxdata.getResults());// 下班1打卡结果
Long woktimes = (maxdata.getDktime() - mindataone.getDktime())/1000/60;
max.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(max);
}
}
}else if(banci.getSxbcs() == 2){//修改后一天打四次
if(mapucalist.size() > 4){//当天打卡多次
String[] str= new String[3];
for(int y=0;y<mapucalist.size();y++){
if(y == 0){//上班
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchRecord record = new PunchRecord();
record.setId(pre.getId());
record.setType(1);//上班
Long time = (pre.getDktime() - sbdk1)/1000/60;
record.setId(mapucalist.get(y).getId());
// record.setType(1);//上班
Long time = (mindata.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
......@@ -451,11 +607,49 @@ public class AttController {
record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}else if(pre.getId() == maxAttid.getId()){//下班
}
if(y == 1 || y == 2){
PunchRecord record = new PunchRecord();
record.setId(pre.getId());
record.setId(mapucalist.get(y).getId());
if((mapucalist.get(y).getSort())%2 == 0){//下班
Long time = (mapucalist.get(y).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
str[0] = String.valueOf(mapucalist.get(y).getId());
}else{//上班
Long time = (mapucalist.get(y).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//上班应打卡时间
str[1] = String.valueOf(mapucalist.get(y).getId());
}
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班
if(mapucalist.get(y).getId() == maxdata.getId()){//下班
PunchRecord record = new PunchRecord();
record.setId(maxdata.getId());
record.setType(2);//下班
Long time = (pre.getDktime() - xbdk1)/1000/60;
Long time = (maxdata.getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
......@@ -463,111 +657,123 @@ public class AttController {
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);
record.setSort(4);
record.setAttime(xbdk2);
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
str[2] = String.valueOf(maxdata.getId());
}
if(y == 3 || y > 3 && mapucalist.get(y).getId() != maxdata.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
record.setResults(0);// 打卡结果
record.setAttime(mapucalist.get(y).getDktime());//上班应打卡时间
record.setBcid(banci.getId());//班次id
record.setSort(2);
punchrecordservice.updateByPrimaryKeySelective(record);
}
}
}
//修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
//
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//上班
PunchCardDetails max = new PunchCardDetails();
max.setId(dkmxid);//需修改的明细id
max.setXbdk1(maxdata.getDktime());
max.setXbdk1jg(maxdata.getResults());// 下班1打卡结果
Long woktimes = (maxdata.getDktime() - mindata.getDktime())/1000/60;
max.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(max);
}else{////
PunchRecord mindataone = null;
//当天打卡记录为1条
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
//修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
for(int t=0;t<str.length;t++){
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(Integer.valueOf(str[t]));//单条打卡明细
PunchCardDetails dkmx = new PunchCardDetails();
dkmx.setId(dkmxid);//需修改的明细id
if(t == 0){
dkmx.setXbdk1(dtdkmx.getDktime());
dkmx.setXbdk1jg(dtdkmx.getResults());// 下班1打卡结果
}else if(t == 1){
dkmx.setSbdk2(dtdkmx.getDktime());
dkmx.setSbdk2jg(dtdkmx.getResults());// 上班2打卡结果
}else{
dkmx.setXbdk2(dtdkmx.getDktime());
dkmx.setXbdk2jg(dtdkmx.getResults());// 下班2打卡结果
}
Long woktimes = (dtdkmx.getDktime() - mindata.getDktime())/1000/60;
dkmx.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
//
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
//当天打卡记录为2条
if(maxAttid != null && minAttid.getId() != maxAttid.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());
record.setType(2);//下班
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}else{//打卡小于4次
PunchRecord mindataone = null;
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
//
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
record.setAttime(xbdk1);
record.setBcid(banci.getId());//班次id
record.setSort(2);
punchrecordservice.updateByPrimaryKeySelective(record);
//
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班
PunchCardDetails max = new PunchCardDetails();
max.setId(dkmxid);//需修改的明细id
max.setXbdk1(maxdata.getDktime());
max.setXbdk1jg(maxdata.getResults());// 下班1打卡结果
Long woktimes = (maxdata.getDktime() - mindataone.getDktime())/1000/60;
max.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(max);
}
}
}else if(banci.getSxbcs() == 2){//修改后一天打四次
if(mapucalist.size() > 4){//当天打卡多次
String[] str= new String[3];
for(int y=0;y<mapucalist.size();y++){
if(y == 0){//上班
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails pcd = new PunchCardDetails();
if(mapucalist.size() >= 2){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
// record.setType(1);//上班
Long time = (mindata.getDktime() - sbdk1)/1000/60;
record.setId(mapucalist.get(1).getId());//当天一条记录的id
record.setType(2);
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(1).getId());//单条打卡明细
pcd.setXbdk1(dtdkmx.getDktime());
pcd.setXbdk1jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 3){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(2).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(2).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
......@@ -575,52 +781,238 @@ public class AttController {
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);
record.setAttime(sbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
}
if(y == 1 || y == 2){
if(mapucalist.size() >= 4){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
if((mapucalist.get(y).getSort())%2 == 0){//下班
Long time = (mapucalist.get(y).getDktime() - xbdk1)/1000/60;
record.setId(maxAttid.getId());//当天一条记录的id
record.setType(2);
Long time = (maxAttid.getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
}
}else if(banci.getSxbcs() == 3){//修改后一天打六次
if(mapucalist.size() > 6){//当天打卡多次
String[] str= new String[5];
for(int y=0;y<mapucalist.size();y++){
if(y == 0){//上班
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
Long time = (mindata.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
if(y == 1 || y == 2 || y == 3 || y == 4){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
str[0] = String.valueOf(mapucalist.get(y).getId());
}else{//上班
Long time = (mapucalist.get(y).getDktime() - sbdk2)/1000/60;
if((mapucalist.get(y).getSort())%2 == 0){//下班
if(y == 1){
Long time = (mapucalist.get(y).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
str[0] = String.valueOf(mapucalist.get(y).getId());
}
if(y == 3){
Long time = (mapucalist.get(y).getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk2);//下班应打卡时间
str[2] = String.valueOf(mapucalist.get(y).getId());
}
}else{//上班
if(y == 2){
Long time = (mapucalist.get(y).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//上班应打卡时间
str[1] = String.valueOf(mapucalist.get(y).getId());
}
if(y == 4){
Long time = (mapucalist.get(y).getDktime() - sbdk3)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk3);//上班应打卡时间
str[3] = String.valueOf(mapucalist.get(y).getId());
}
}
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班
if(mapucalist.get(y).getId() == maxdata.getId()){//下班
PunchRecord record = new PunchRecord();
record.setId(maxdata.getId());
record.setType(2);//下班
Long time = (maxdata.getDktime() - xbdk3)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(sbdk2);//上班应打卡时间
record.setSort(6);
record.setAttime(xbdk3);
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
str[1] = String.valueOf(mapucalist.get(y).getId());
str[4] = String.valueOf(maxdata.getId());
}
if(y == 5 || y > 5 && mapucalist.get(y).getId() != maxdata.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
record.setResults(0);// 打卡结果
record.setAttime(mapucalist.get(y).getDktime());//上班应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
}
//修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
for(int t=0;t<str.length;t++){
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(Integer.valueOf(str[t]));//单条打卡明细
PunchCardDetails dkmx = new PunchCardDetails();
dkmx.setId(dkmxid);//需修改的明细id
if(t == 0){
dkmx.setXbdk1(dtdkmx.getDktime());
dkmx.setXbdk1jg(dtdkmx.getResults());// 下班1打卡结果
}else if(t == 1){
dkmx.setSbdk2(dtdkmx.getDktime());
dkmx.setSbdk2jg(dtdkmx.getResults());// 上班2打卡结果
}else if(t == 2){
dkmx.setXbdk2(dtdkmx.getDktime());
dkmx.setXbdk2jg(dtdkmx.getResults());// 下班2打卡结果
}else if(t == 3){
dkmx.setSbdk3(dtdkmx.getDktime());
dkmx.setSbdk3jg(dtdkmx.getResults());// 上班3打卡结果
}else{
dkmx.setXbdk3(dtdkmx.getDktime());
dkmx.setXbdk3jg(dtdkmx.getResults());// 下班3打卡结果
}
Long woktimes = (dtdkmx.getDktime() - mindata.getDktime())/1000/60;
dkmx.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
}
}else{
/**aaa**/
PunchRecord mindataone = null;
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
//
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班
if(mapucalist.get(y).getId() == maxdata.getId()){//下班
PunchCardDetails pcd = new PunchCardDetails();
if(mapucalist.size() >= 2){
/***/
PunchRecord record = new PunchRecord();
record.setId(maxdata.getId());
record.setType(2);//下班
Long time = (maxdata.getDktime() - xbdk2)/1000/60;
record.setId(mapucalist.get(1).getId());//当天一条记录的id
record.setType(2);
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
......@@ -628,172 +1020,43 @@ public class AttController {
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setSort(4);
record.setAttime(xbdk2);
record.setAttime(xbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
str[2] = String.valueOf(maxdata.getId());
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(1).getId());//单条打卡明细
pcd.setXbdk1(dtdkmx.getDktime());
pcd.setXbdk1jg(dtdkmx.getResults());
}
if(y == 3 || y > 3 && mapucalist.get(y).getId() != maxdata.getId()){
if(mapucalist.size() >= 3){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
record.setResults(0);// 打卡结果
record.setAttime(mapucalist.get(y).getDktime());//上班应打卡时间
record.setId(mapucalist.get(2).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(2).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
}
}
//修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
for(int t=0;t<str.length;t++){
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(Integer.valueOf(str[t]));//单条打卡明细
PunchCardDetails dkmx = new PunchCardDetails();
dkmx.setId(dkmxid);//需修改的明细id
if(t == 0){
dkmx.setXbdk1(dtdkmx.getDktime());
dkmx.setXbdk1jg(dtdkmx.getResults());// 下班1打卡结果
}else if(t == 1){
dkmx.setSbdk2(dtdkmx.getDktime());
dkmx.setSbdk2jg(dtdkmx.getResults());// 上班2打卡结果
}else{
dkmx.setXbdk2(dtdkmx.getDktime());
dkmx.setXbdk2jg(dtdkmx.getResults());// 下班2打卡结果
}
Long woktimes = (dtdkmx.getDktime() - mindata.getDktime())/1000/60;
dkmx.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
}
}else{//打卡小于4次
PunchRecord mindataone = null;
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
//
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
PunchCardDetails pcd = new PunchCardDetails();
if(mapucalist.size() >= 2){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());//当天一条记录的id
record.setType(2);
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(1).getId());//单条打卡明细
pcd.setXbdk1(dtdkmx.getDktime());
pcd.setXbdk1jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 3){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(2).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(2).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 4){
/***/
PunchRecord record = new PunchRecord();
record.setId(maxAttid.getId());//当天一条记录的id
record.setType(2);
Long time = (maxAttid.getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
}
}else if(banci.getSxbcs() == 3){//修改后一天打六次
if(mapucalist.size() > 6){//当天打卡多次
String[] str= new String[5];
for(int y=0;y<mapucalist.size();y++){
if(y == 0){//上班
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
if(mapucalist.size() >= 4){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
Long time = (mindata.getDktime() - sbdk1)/1000/60;
record.setId(mapucalist.get(3).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(3).getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
......@@ -801,80 +1064,45 @@ public class AttController {
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);
record.setAttime(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(3).getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
if(y == 1 || y == 2 || y == 3 || y == 4){
if(mapucalist.size() >= 5){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
if((mapucalist.get(y).getSort())%2 == 0){//下班
if(y == 1){
Long time = (mapucalist.get(y).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
str[0] = String.valueOf(mapucalist.get(y).getId());
}
if(y == 3){
Long time = (mapucalist.get(y).getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk2);//下班应打卡时间
str[2] = String.valueOf(mapucalist.get(y).getId());
}
}else{//上班
if(y == 2){
Long time = (mapucalist.get(y).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//上班应打卡时间
str[1] = String.valueOf(mapucalist.get(y).getId());
}
if(y == 4){
Long time = (mapucalist.get(y).getDktime() - sbdk3)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk3);//上班应打卡时间
str[3] = String.valueOf(mapucalist.get(y).getId());
}
record.setId(mapucalist.get(4).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(4).getDktime() - sbdk3)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk3);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(4).getId());//单条打卡明细
pcd.setSbdk3(dtdkmx.getDktime());
pcd.setSbdk3jg(dtdkmx.getResults());
}
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班
if(mapucalist.get(y).getId() == maxdata.getId()){//下班
if(mapucalist.size() >= 6){
/***/
PunchRecord record = new PunchRecord();
record.setId(maxdata.getId());
record.setType(2);//下班
Long time = (maxdata.getDktime() - xbdk3)/1000/60;
record.setId(maxAttid.getId());//当天一条记录的id
record.setType(2);
Long time = (maxAttid.getDktime() - xbdk3)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
......@@ -882,235 +1110,38 @@ public class AttController {
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setSort(6);
record.setAttime(xbdk3);
record.setAttime(xbdk3);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
str[4] = String.valueOf(maxdata.getId());
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk3(dtdkmx.getDktime());
pcd.setXbdk3jg(dtdkmx.getResults());
}
if(y == 5 || y > 5 && mapucalist.get(y).getId() != maxdata.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
record.setResults(0);// 打卡结果
record.setAttime(mapucalist.get(y).getDktime());//上班应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
}
//修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
for(int t=0;t<str.length;t++){
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(Integer.valueOf(str[t]));//单条打卡明细
PunchCardDetails dkmx = new PunchCardDetails();
dkmx.setId(dkmxid);//需修改的明细id
if(t == 0){
dkmx.setXbdk1(dtdkmx.getDktime());
dkmx.setXbdk1jg(dtdkmx.getResults());// 下班1打卡结果
}else if(t == 1){
dkmx.setSbdk2(dtdkmx.getDktime());
dkmx.setSbdk2jg(dtdkmx.getResults());// 上班2打卡结果
}else if(t == 2){
dkmx.setXbdk2(dtdkmx.getDktime());
dkmx.setXbdk2jg(dtdkmx.getResults());// 下班2打卡结果
}else if(t == 3){
dkmx.setSbdk3(dtdkmx.getDktime());
dkmx.setSbdk3jg(dtdkmx.getResults());// 上班3打卡结果
}else{
dkmx.setXbdk3(dtdkmx.getDktime());
dkmx.setXbdk3jg(dtdkmx.getResults());// 下班3打卡结果
}
Long woktimes = (dtdkmx.getDktime() - mindata.getDktime())/1000/60;
dkmx.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
pcd.setId(dkmxid);
punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
/**bbb***/
}
}else{
/**aaa**/
PunchRecord mindataone = null;
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
//
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
PunchCardDetails pcd = new PunchCardDetails();
if(mapucalist.size() >= 2){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());//当天一条记录的id
record.setType(2);
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(1).getId());//单条打卡明细
pcd.setXbdk1(dtdkmx.getDktime());
pcd.setXbdk1jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 3){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(2).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(2).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 4){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(3).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(3).getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(3).getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 5){
/***/
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(4).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(4).getDktime() - sbdk3)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk3);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(4).getId());//单条打卡明细
pcd.setSbdk3(dtdkmx.getDktime());
pcd.setSbdk3jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 6){
/***/
PunchRecord record = new PunchRecord();
record.setId(maxAttid.getId());//当天一条记录的id
record.setType(2);
Long time = (maxAttid.getDktime() - xbdk3)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk3);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk3(dtdkmx.getDktime());
pcd.setXbdk3jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
/**bbb***/
}
}else{////修改后班次为休息的
RestMethod(mapucalist,dkmxid);
}
}else{////修改后班次为休息的
RestMethod(mapucalist,dkmxid);
}
/***********************/
}
/***********************/
}
}//判断新增或修改
}
if(schlist.size()>0){
if(schlist.size()>0 && xiugai){
//删除排班明细表(自由排班)
scheduleservice.deleteByPrimaryBykqzid(id);
scheduleservice.insertKqglAssoPbmxList(schlist);
return ResultUtil.data(schlist,"修改考勤组排班成功");
}
return ResultUtil.error("修改考勤组排班失败");
return ResultUtil.data(schlist,"修改考勤组排班成功");
// return ResultUtil.error("修改考勤组排班失败");
}
/**
......
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