Commit da53c5d2 by leialin

Merge branch 'lal' into 'develop'

Lal

See merge request 8timerv2/8timerapiv200!281
parents 2c346f9c 5b0df65a
......@@ -164,86 +164,7 @@ public class AttController {
SimpleDateFormat sdf2 = new SimpleDateFormat("EEE");
/*******班次管理--开始*********/
/**
* 获取班次数据
*/
@GetMapping(value="/ShiftDataList")
@ApiOperation(value = "获取班次数据-根据 组织机构代码", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 1)
public Result<PageInfo<ShiftManagement>> getShiftDataList(@CurrentUser UserBean userBean,@ApiParam("当前页") @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@ApiParam("每页条数") @RequestParam(value = "pageSize", required = false, defaultValue = "9999") Integer pageSize) {
int qyid = userBean.getOrgCode();//坏小孩【企业id】
PageHelper.startPage(pageNum, pageSize);
List<ShiftManagement> shiftList = shiftmanagementservice.selectByPrimaryByQyid(qyid);
PageInfo<ShiftManagement> pageInfo = new PageInfo<>(shiftList);
return ResultUtil.data(pageInfo);
}
/**
* 新增班次信息
*/
@PostMapping(value = "/Shif")
@ApiOperation(value = "新增班次信息", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 2)
public Result<ShiftManagement> ShiftInformation(@CurrentUser UserBean userBean,@RequestBody ShiftManagement shif) {
int qyid = userBean.getOrgCode();//坏小孩【企业id】
int userid = userBean.getEmpNum();//用户id
shif.setQyid(qyid);
shif.setLusjTime(new Date().getTime());
shif.setLuryid(userid);//录入人员
if(shiftmanagementservice.insertSelective(shif)>0){
return ResultUtil.data(shif, "新增班次成功");
}else{
return ResultUtil.error("新增班次失败");
}
}
/**
* 删除班次信息
*/
@DeleteMapping(value = "/Shif/{id}")
@ApiOperation(value = "删除班次信息", httpMethod = "DELETE", notes = "接口发布说明")
@ApiOperationSupport(order = 3)
public Result<Integer> deleteShiftInformation(@PathVariable("id") Integer id) {
if (shiftmanagementservice.deleteByPrimaryKey(id) > 0) {
return ResultUtil.data(id,"删除成功");
}
return ResultUtil.error("删除失败");
}
/**
* 根据班次id获取班次信息
*/
@GetMapping(value="/Shifts/{id}")
@ApiOperation(value = "获取班次信息-根据班次id", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 4)
public Result<ShiftManagement> getShiftCenter(@PathVariable("id") Integer id) {
ShiftManagement shifs = shiftmanagementservice.selectByPrimaryKey(id);
return ResultUtil.data(shifs);
}
/**
* 修改班次信息
*/
@PutMapping(value = "/Shif")
@ApiOperation(value = "修改班次信息", httpMethod = "PUT", notes = "接口发布说明")
@ApiOperationSupport(order = 5)
public Result<ShiftManagement> updateShiftInformation(@CurrentUser UserBean userBean,@RequestBody ShiftManagement shif) {
int qyid = userBean.getOrgCode();//坏小孩【企业id】
int userid = userBean.getEmpNum();//用户id
shif.setQyid(qyid);//企业id
shif.setLusjTime(new Date().getTime());//录入时间
shif.setLuryid(userid);//录入人员
if (shiftmanagementservice.updateByPrimaryKeySelective(shif) > 0) {
return ResultUtil.data(shif,"修改班次信息成功");
}
return ResultUtil.error("修改班次信息失败");
}
/*******班次管理 结束*********/
/*********考勤机***********/
......@@ -428,16 +349,16 @@ public class AttController {
Long xbdk3 = 0l;
if(banci != null){
if(banci.getSxbcs()== 1 || banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk1 = Long.valueOf(dateToStamp(data+" "+banci.getSbdk1()+":00"));
xbdk1 = Long.valueOf(dateToStamp(data+" "+banci.getXbdk1()+":00"));
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(dateToStamp(data+" "+banci.getSbdk2()+":00"));
xbdk2 = Long.valueOf(dateToStamp(data+" "+banci.getXbdk2()+":00"));
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(dateToStamp(data+" "+banci.getSbdk3()+":00"));
xbdk3 = Long.valueOf(dateToStamp(data+" "+banci.getXbdk3()+":00"));
sbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk3()+":00"));
xbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk3()+":00"));
}
}
//之前打卡的班次
......@@ -1673,10 +1594,10 @@ public class AttController {
if(!("").equals(attendancedetails.getStart())){
try {
String sdaet = getMinMonthDate(attendancedetails.getStart());
String sdaet = ClockInTool.getMinMonthDate(attendancedetails.getStart());
startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(sdaet,"yyyy-MM-dd")).getTime();
String edate = getMaxMonthDate(attendancedetails.getEnd());
String edate = ClockInTool.getMaxMonthDate(attendancedetails.getEnd());
endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(edate,"yyyy-MM-dd")).getTime();
} catch (ParseException e) {
e.printStackTrace();
......@@ -2087,10 +2008,10 @@ public class AttController {
if(!("").equals(atttions.getDate())){
try {
String sdaet = getMinMonthDate(str);
String sdaet = ClockInTool.getMinMonthDate(str);
startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(sdaet,"yyyy-MM-dd")).getTime();
String edate = getMaxMonthDate(str);
String edate = ClockInTool.getMaxMonthDate(str);
endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(edate,"yyyy-MM-dd")).getTime();
} catch (ParseException e) {
e.printStackTrace();
......@@ -2338,10 +2259,10 @@ public class AttController {
if(!("").equals(attconditions.getDate())){
try {
String sdaet = getMinMonthDate(str);
String sdaet = ClockInTool.getMinMonthDate(str);
startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(sdaet,"yyyy-MM-dd")).getTime();
String edate = getMaxMonthDate(str);
String edate = ClockInTool.getMaxMonthDate(str);
endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(edate,"yyyy-MM-dd")).getTime();
} catch (ParseException e) {
e.printStackTrace();
......@@ -2452,7 +2373,7 @@ public class AttController {
}
}
int week = Integer.valueOf(dateToWeek(famt.format(da)));//2
int week = Integer.valueOf(ClockInTool.dateToWeek(famt.format(da)));//2
AttendanceWeeklySch atwek = attendanceweeklyschservice.selectZhouDetail(attgro.getId(),week);//固定周排班
if(atwek != null){//有固定周排班
......@@ -2602,17 +2523,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(1);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getSbdk1(),2)+":00")));
as.setStarttime(("").equals(shifs.getSbqjks1())? 0 :Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getSbqjks1(),2)+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs1()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getSbqjjs1(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbdk1()+":00")));
as.setStarttime(("").equals(shifs.getSbqjks1())? 0 :Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjks1()+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjjs1()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(2);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getXbdk1(),2)+":00")));
as.setStarttime(("").equals(shifs.getXbqjks1()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getXbqjks1(),2)+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs1()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getXbqjjs1(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbdk1()+":00")));
as.setStarttime(("").equals(shifs.getXbqjks1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjks1()+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjjs1()+":00")));
atts.add(as);
}
}
......@@ -2624,17 +2545,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(3);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getSbdk2(),2)+":00")));
as.setStarttime(("").equals(shifs.getSbqjks2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getSbqjks2(),2)+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getSbqjjs2(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbdk2()+":00")));
as.setStarttime(("").equals(shifs.getSbqjks2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjks2()+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjjs2()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(4);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getXbdk2(),2)+":00")));
as.setStarttime(("").equals(shifs.getXbqjks2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getXbqjks2(),2)+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getXbqjjs2(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbdk2()+":00")));
as.setStarttime(("").equals(shifs.getXbqjks2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjks2()+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjjs2()+":00")));
atts.add(as);
}
}
......@@ -2646,17 +2567,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(5);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getSbdk3(),2)+":00")));
as.setStarttime(("").equals(shifs.getSbqjks3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getSbqjks3(),2)+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getSbqjjs3(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbdk3()+":00")));
as.setStarttime(("").equals(shifs.getSbqjks3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjks3()+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjjs3()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(6);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getXbdk3(),2)+":00")));
as.setStarttime(("").equals(shifs.getXbqjks3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getXbqjks3(),2)+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shifs.getXbqjjs3(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbdk3()+":00")));
as.setStarttime(("").equals(shifs.getXbqjks3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjks3()+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjjs3()+":00")));
atts.add(as);
}
}
......@@ -2877,7 +2798,7 @@ public class AttController {
}
}
int week = Integer.valueOf(dateToWeek(famt.format(da)));//2
int week = Integer.valueOf(ClockInTool.dateToWeek(famt.format(da)));//2
AttendanceWeeklySch atwek = attendanceweeklyschservice.selectFreeWorkingHours(attgro.getId(),week);//自由工时
......@@ -2951,345 +2872,335 @@ public class AttController {
} catch (ParseException e) {
e.printStackTrace();
}
int qyid = userBean.getOrgCode();//坏小孩【企业id】
int userid = userBean.getEmpNum();//用户id
int qyid = userBean.getOrgCode();//坏小孩【企业id】
int userid = userBean.getEmpNum();//用户id
AttendanceGroup attgro = attendancegroupservice.getAttendanceGroupInformationByUserid(userid,qyid); //考勤组信息
//pbfs:排班方式 1:固定排班;2:自由排班;3:自由工时
if(attgro != null){//判断当前用户是否加入到考勤组
//排班制
Schedule jrpb = scheduleservice.getScheduleSpecificAttendance(attgro.getId(),userid,str);
//固定排班
int week = Integer.valueOf(ClockInTool.dateToWeek(str));//4
AttendanceWeeklySch atwek = attendanceweeklyschservice.selectZhouDetail(attgro.getId(),week);//固定周排班
// QueryWrapper<YgglAttaHtxxb> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("org_code",qyid).eq("emp_num", userid);
AttendanceGroup attgro = attendancegroupservice.getAttendanceGroupInformationByUserid(userid,qyid); //考勤组信息
//pbfs:排班方式 1:固定排班;2:自由排班;3:自由工时
if(attgro != null){//判断当前用户是否加入到考勤组
//排班制
Schedule jrpb = scheduleservice.getScheduleSpecificAttendance(attgro.getId(),userid,str);
//固定排班
int week = Integer.valueOf(dateToWeek(str));//4
AttendanceWeeklySch atwek = attendanceweeklyschservice.selectZhouDetail(attgro.getId(),week);//固定周排班
if(attgro.getPbfs() == 1){//固定排班
// int week = Integer.valueOf(dateToWeek(str));//4
// AttendanceWeeklySch atwek = attendanceweeklyschservice.selectZhouDetail(attgro.getId(),week);
if(atwek != null){//有固定周排班
SpecialDate rest = specialdateservice.SpecialDateSpecialDayOff(attgro.getId(), str);//查询打卡当天是否在特殊休息日期里面存在
if(rest != null){//今天休息 Sort返回0【特殊日期--休息】
List<AttSchedule> atts = new ArrayList<AttSchedule>();
AttSchedule as = new AttSchedule();
as.setId(0);
as.setSort(0);//0:表示今天为休息日
as.setTime(0l);
as.setStarttime(0l);
as.setEndtime(0l);
atts.add(as);
attcar.setAttsch(atts);
}else{//今天上班
ShiftManagement bcz = shiftmanagementservice.selectByPrimaryKey(atwek.getBcid());
if(bcz != null){
Getshiftinformationbatch(bcz,attcar,str);
}
}
}else{
//必须打卡
SpecialDate tsri = specialdateservice.SpecialDateTroubleshooting(attgro.getId(), str);//判断特殊日期
if(tsri != null){
ShiftManagement tsrq = shiftmanagementservice.selectByPrimaryKey(tsri.getBcid());
if(tsrq!=null){
Getshiftinformationbatch(tsrq,attcar,str);
}
}else{
//休息
List<AttSchedule> atts = new ArrayList<AttSchedule>();
AttSchedule as = new AttSchedule();
as.setId(0);
as.setSort(0);//0:表示今天为休息日
as.setTime(0l);
as.setStarttime(0l);
as.setEndtime(0l);
atts.add(as);
attcar.setAttsch(atts);
if(attgro.getPbfs() == 1){//固定排班
// int week = Integer.valueOf(ClockInTool.dateToWeek(str));//4
// AttendanceWeeklySch atwek = attendanceweeklyschservice.selectZhouDetail(attgro.getId(),week);
if(atwek != null){//有固定周排班
SpecialDate rest = specialdateservice.SpecialDateSpecialDayOff(attgro.getId(), str);//查询打卡当天是否在特殊休息日期里面存在
if(rest != null){//今天休息 Sort返回0【特殊日期--休息】
List<AttSchedule> atts = new ArrayList<AttSchedule>();
AttSchedule as = new AttSchedule();
as.setId(0);
as.setSort(0);//0:表示今天为休息日
as.setTime(0l);
as.setStarttime(0l);
as.setEndtime(0l);
atts.add(as);
attcar.setAttsch(atts);
}else{//今天上班
ShiftManagement bcz = shiftmanagementservice.selectByPrimaryKey(atwek.getBcid());
if(bcz != null){
Getshiftinformationbatch(bcz,attcar,str);
}
}
}else if(attgro.getPbfs() == 2){//自由排班
//未排班时,员工可选择班次打卡
if(attgro.getIsXzbcdk() == 1){
attcar.setOptscheduling(true);
}else{
attcar.setOptscheduling(false);
}
// Schedule jrpb = scheduleservice.getScheduleSpecificAttendance(attgro.getId(),userid,str);
if(jrpb != null){
List<AttSchedule> atts = new ArrayList<AttSchedule>();
if(jrpb.getBcid() != 0){//有班次时("Bcid"不为0时)
if(jrpb.getSxbcs() == 1 || jrpb.getSxbcs() == 2 || jrpb.getSxbcs() == 3){//1次上下班
for(int o=0;o<2;o++){
if(o==0){
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(1);
as.setTime(Long.valueOf(dateToStamp(str+" "+jrpb.getSbdk1()+":00")));
as.setStarttime(("").equals(jrpb.getSbqjks1())? 0 :Long.valueOf(dateToStamp(str+" "+jrpb.getSbqjks1()+":00")));
as.setEndtime(("").equals(jrpb.getSbqjjs1()) ? 0 : Long.valueOf(dateToStamp(str+" "+jrpb.getSbqjjs1()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(2);
as.setTime(Long.valueOf(dateToStamp(str+" "+jrpb.getXbdk1()+":00")));
as.setStarttime(("").equals(jrpb.getXbqjks1()) ? 0 : Long.valueOf(dateToStamp(str+" "+jrpb.getXbqjks1()+":00")));
as.setEndtime(("").equals(jrpb.getXbqjjs1()) ? 0 : Long.valueOf(dateToStamp(str+" "+jrpb.getXbqjjs1()+":00")));
atts.add(as);
}
}
}else{
//必须打卡
SpecialDate tsri = specialdateservice.SpecialDateTroubleshooting(attgro.getId(), str);//判断特殊日期
if(tsri != null){
ShiftManagement tsrq = shiftmanagementservice.selectByPrimaryKey(tsri.getBcid());
if(tsrq!=null){
Getshiftinformationbatch(tsrq,attcar,str);
}
}else{
//休息
List<AttSchedule> atts = new ArrayList<AttSchedule>();
AttSchedule as = new AttSchedule();
as.setId(0);
as.setSort(0);//0:表示今天为休息日
as.setTime(0l);
as.setStarttime(0l);
as.setEndtime(0l);
atts.add(as);
attcar.setAttsch(atts);
}
}
}else if(attgro.getPbfs() == 2){//自由排班
//未排班时,员工可选择班次打卡
if(attgro.getIsXzbcdk() == 1){
attcar.setOptscheduling(true);
}else{
attcar.setOptscheduling(false);
}
// Schedule jrpb = scheduleservice.getScheduleSpecificAttendance(attgro.getId(),userid,str);
if(jrpb != null){
List<AttSchedule> atts = new ArrayList<AttSchedule>();
if(jrpb.getBcid() != 0){//有班次时("Bcid"不为0时)
if(jrpb.getSxbcs() == 1 || jrpb.getSxbcs() == 2 || jrpb.getSxbcs() == 3){//1次上下班
for(int o=0;o<2;o++){
if(o==0){
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(1);
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getSbdk1()+":00")));
as.setStarttime(("").equals(jrpb.getSbqjks1())? 0 :Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getSbqjks1()+":00")));
as.setEndtime(("").equals(jrpb.getSbqjjs1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getSbqjjs1()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(2);
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getXbdk1()+":00")));
as.setStarttime(("").equals(jrpb.getXbqjks1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getXbqjks1()+":00")));
as.setEndtime(("").equals(jrpb.getXbqjjs1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getXbqjjs1()+":00")));
atts.add(as);
}
attcar.setAttsch(atts);
}
if(jrpb.getSxbcs() == 2 || jrpb.getSxbcs() == 3){//2次上下班
for(int o=0;o<2;o++){
if(o==0){
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(3);
as.setTime(Long.valueOf(dateToStamp(str+" "+jrpb.getSbdk2()+":00")));
as.setStarttime(("").equals(jrpb.getSbqjks2()) ? 0 : Long.valueOf(dateToStamp(str+" "+jrpb.getSbqjks2()+":00")));
as.setEndtime(("").equals(jrpb.getSbqjjs2()) ? 0 : Long.valueOf(dateToStamp(str+" "+jrpb.getSbqjjs2()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(4);
as.setTime(Long.valueOf(dateToStamp(str+" "+jrpb.getXbdk2()+":00")));
as.setStarttime(("").equals(jrpb.getXbqjks2()) ? 0 : Long.valueOf(dateToStamp(str+" "+jrpb.getXbqjks2()+":00")));
as.setEndtime(("").equals(jrpb.getXbqjjs2()) ? 0 : Long.valueOf(dateToStamp(str+" "+jrpb.getXbqjjs2()+":00")));
atts.add(as);
}
attcar.setAttsch(atts);
}
if(jrpb.getSxbcs() == 2 || jrpb.getSxbcs() == 3){//2次上下班
for(int o=0;o<2;o++){
if(o==0){
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(3);
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getSbdk2()+":00")));
as.setStarttime(("").equals(jrpb.getSbqjks2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getSbqjks2()+":00")));
as.setEndtime(("").equals(jrpb.getSbqjjs2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getSbqjjs2()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(4);
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getXbdk2()+":00")));
as.setStarttime(("").equals(jrpb.getXbqjks2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getXbqjks2()+":00")));
as.setEndtime(("").equals(jrpb.getXbqjjs2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getXbqjjs2()+":00")));
atts.add(as);
}
attcar.setAttsch(atts);
}
if(jrpb.getSxbcs() == 3){//3次上下班
for(int o=0;o<2;o++){
if(o==0){
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(5);
as.setTime(Long.valueOf(dateToStamp(str+" "+jrpb.getSbdk3()+":00")));
as.setStarttime(("").equals(jrpb.getSbqjks3()) ? 0 : Long.valueOf(dateToStamp(str+" "+jrpb.getSbqjks3()+":00")));
as.setEndtime(("").equals(jrpb.getSbqjjs3()) ? 0 : Long.valueOf(dateToStamp(str+" "+jrpb.getSbqjjs3()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(6);
as.setTime(Long.valueOf(dateToStamp(str+" "+jrpb.getXbdk3()+":00")));
as.setStarttime(("").equals(jrpb.getXbqjks3()) ? 0 : Long.valueOf(dateToStamp(str+" "+jrpb.getXbqjks3()+":00")));
as.setEndtime(("").equals(jrpb.getXbqjjs3()) ? 0 : Long.valueOf(dateToStamp(str+" "+jrpb.getXbqjjs3()+":00")));
atts.add(as);
}
attcar.setAttsch(atts);
}
if(jrpb.getSxbcs() == 3){//3次上下班
for(int o=0;o<2;o++){
if(o==0){
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(5);
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getSbdk3()+":00")));
as.setStarttime(("").equals(jrpb.getSbqjks3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getSbqjks3()+":00")));
as.setEndtime(("").equals(jrpb.getSbqjjs3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getSbqjjs3()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(jrpb.getBcid());
as.setSort(6);
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getXbdk3()+":00")));
as.setStarttime(("").equals(jrpb.getXbqjks3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getXbqjks3()+":00")));
as.setEndtime(("").equals(jrpb.getXbqjjs3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+jrpb.getXbqjjs3()+":00")));
atts.add(as);
}
attcar.setAttsch(atts);
}
}else{//当天排班为休息
List<AttSchedule> atts1 = new ArrayList<AttSchedule>();
AttSchedule as = new AttSchedule();
as.setId(0);
as.setSort(0);//0:表示今天为休息日
as.setTime(0l);
as.setStarttime(0l);
as.setEndtime(0l);
atts1.add(as);
attcar.setAttsch(atts1);
attcar.setAttsch(atts);
}
}else{//当天考勤组为给排班
List<ShiftManagement> shifs = shiftmanagementservice.selectByPrimaryByQyid(qyid);
List<SystemShift> akms = new ArrayList<SystemShift>();
for(ShiftManagement ah:shifs){
SystemShift sys = new SystemShift();
sys.setId(ah.getId());
String name = ah.getName();
String context = "";
if(ah.getSxbcs() == 1 || ah.getSxbcs() == 2 || ah.getSxbcs() == 3){
context = ah.getSbdk1() + "-" + ah.getXbdk1();
}
if(ah.getSxbcs() == 2 || ah.getSxbcs() == 3){
context = context +" "+ ah.getSbdk2() + "-" + ah.getXbdk2();
}
if(ah.getSxbcs() == 3){
context = context +" "+ ah.getSbdk3() + "-" + ah.getXbdk3();
}
sys.setContext(name+ " " + context);
akms.add(sys);
}
attcar.setSsfh(akms);//无排班时 获取的系统班次
}
}else{//自由工时
//int week = Integer.valueOf(dateToWeek(str));//4
AttendanceWeeklySch wekz = attendanceweeklyschservice.WeeklyFreeRoster(attgro.getId(),week);
if(wekz != null){//
String dada = str+" "+attgro.getKqkssjTime()+":00";
attcar.setStapclotime(Long.valueOf(dateToStamp(dada)));
}
if(!("").equals(attgro.getJbzdsc())){
attcar.setCanpunchworkdate(Double.valueOf(attgro.getJbzdsc()));//上班打卡后多久大下班卡
}else{//当天排班为休息
List<AttSchedule> atts1 = new ArrayList<AttSchedule>();
AttSchedule as = new AttSchedule();
as.setId(0);
as.setSort(0);//0:表示今天为休息日
as.setTime(0l);
as.setStarttime(0l);
as.setEndtime(0l);
atts1.add(as);
attcar.setAttsch(atts1);
}
}else{//当天考勤组为给排班
List<ShiftManagement> shifs = shiftmanagementservice.selectByPrimaryByQyid(qyid);
List<SystemShift> akms = new ArrayList<SystemShift>();
for(ShiftManagement ah:shifs){
SystemShift sys = new SystemShift();
sys.setId(ah.getId());
String name = ah.getName();
String context = "";
if(ah.getSxbcs() == 1 || ah.getSxbcs() == 2 || ah.getSxbcs() == 3){
context = ah.getSbdk1() + "-" + ah.getXbdk1();
}
if(ah.getSxbcs() == 2 || ah.getSxbcs() == 3){
context = context +" "+ ah.getSbdk2() + "-" + ah.getXbdk2();
}
if(ah.getSxbcs() == 3){
context = context +" "+ ah.getSbdk3() + "-" + ah.getXbdk3();
}
sys.setContext(name+ " " + context);
akms.add(sys);
}
attcar.setSsfh(akms);//无排班时 获取的系统班次
}
if(jrpb != null || atwek != null){
ShiftManagement shif = null;
if(attgro.getPbfs() == 1){
shif = shiftmanagementservice.selectByPrimaryKey(atwek.getBcid());
}else if(attgro.getPbfs() == 2){
shif = shiftmanagementservice.selectByPrimaryKey(jrpb.getBcid());
}
if(shif != null){
if(shif.getIsXbdk() == 1){
attcar.setNoclockout(true);// 下班不用打卡
}else{
attcar.setNoclockout(false);// 下班不用打卡
}
attcar.setAllowlate(shif.getYxcdfzs());// 允许迟到分钟数
attcar.setSeriouslate(shif.getYzcdfzs());// 严重迟到分钟数
attcar.setAbsenteeismlate(shif.getKgcdfzs());// 旷工迟到分钟数
if(shif.getIsWzwd() == 1){
attcar.setIslatelate(true);// 晚走晚到
List<AttLateLate> atwzwd = new ArrayList<AttLateLate>();
int p = 0;
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1())){p = 2;}
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1()) && !("").equals(shif.getXbwz2()) && !("").equals(shif.getSbwd2())){p = 4;}
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1()) && !("").equals(shif.getXbwz2()) && !("").equals(shif.getSbwd2()) && !("").equals(shif.getXbwz3()) && !("").equals(shif.getSbwd3())){p = 6;}
AttLateLate ala = new AttLateLate();
ala.setLatewalk(shif.getXbwz1());
ala.setArrivelate(shif.getSbwd1());
atwzwd.add(ala);
if(p == 4 || p == 6){
AttLateLate alat = new AttLateLate();
alat.setLatewalk(shif.getXbwz2());
alat.setArrivelate(shif.getSbwd2());
atwzwd.add(alat);
}
if(p == 6){
AttLateLate alas = new AttLateLate();
alas.setLatewalk(shif.getXbwz3());
alas.setArrivelate(shif.getSbwd3());
atwzwd.add(alas);
}
attcar.setAttlat(atwzwd);
}else{
attcar.setIslatelate(false);// 晚走晚到
}
}
}
attcar.setAttgrouptype(attgro.getPbfs());//1:固定排班;2:自由排班;3:自由工时
//外勤 true:开 false:关
if(attgro.getIsWq() == 1) {
attcar.setFieldpersonnel(true);
}else {
attcar.setFieldpersonnel(false);
}
//打卡方式
List<AttGroupBinPunchMode> attmetlist = attgroupbinpunchmodeservice.selectByPrimaryByKqzId(attgro.getId());
for(AttGroupBinPunchMode agbp:attmetlist){
//类型(1:考勤机;2:地址;3:WIFI)
if(agbp.getType() == 1){
attcar.setAttmachine(true);
}else if(agbp.getType() == 2){
attcar.setAttaddress(true);
}else{
attcar.setAttwifi(true);
}
}
//详细打卡方式
List<AttClockMethod> akms = new ArrayList<AttClockMethod>();
for(AttGroupBinPunchMode abp:attmetlist){
if(abp.getType() == 1){
AttendanceMachine kqjs = attendancemachineservice.selectByPrimaryKey(abp.getDkfsid());
AttClockMethod akm = AttClockMethod.builder().build();
akm.setName(kqjs.getName());// 打卡名称
akm.setMac("");// wifi【wifi】
akm.setAttrange(0);// 范围【地址】
akm.setType(1);// 类型(1:考勤机;2:地址;3:WIFI)
akm.setLongitude(0);// 经度【地址】
akm.setLatitude(0);// 纬度【地址】
akms.add(akm);
}else if(abp.getType() == 2){
PunchCardAddress kqdzs = punchcardaddressservice.selectByPrimaryKey(abp.getDkfsid());
AttClockMethod akm = AttClockMethod.builder().build();
akm.setName(kqdzs.getName());// 打卡名称
akm.setMac("");// wifi【wifi】
akm.setAttrange(kqdzs.getDkfw());// 范围【地址】
akm.setType(2);// 类型(1:考勤机;2:地址;3:WIFI)
akm.setLongitude(kqdzs.getLon());// 经度【地址】
akm.setLatitude(kqdzs.getLat());// 纬度【地址】
akms.add(akm);
}else{
PunchCardWiFi kqwfs = punchcardwifiservice.selectByPrimaryKey(abp.getDkfsid());
AttClockMethod akm = AttClockMethod.builder().build();
akm.setName(kqwfs.getName());// 打卡名称
akm.setMac(kqwfs.getMac());// wifi【wifi】
akm.setAttrange(0);// 范围【地址】
akm.setType(3);// 类型(1:考勤机;2:地址;3:WIFI)
akm.setLongitude(0);// 经度【地址】
akm.setLatitude(0);// 纬度【地址】
akms.add(akm);
}
}
attcar.setMachine(akms);
}else{
//无排班
//系统班次
// List<ShiftManagement> shifs = shiftmanagementservice.selectByPrimaryByQyid(qyid);
// List<SystemShift> akms = new ArrayList<SystemShift>();
// for(ShiftManagement ah:shifs){
// SystemShift sys = new SystemShift();
// sys.setId(ah.getId());
//
// String name = ah.getName();
// String context = "";
// if(ah.getSxbcs() == 1 || ah.getSxbcs() == 2 || ah.getSxbcs() == 3){
// context = dealDateFormat(ah.getSbdk1(),2) + "-" + dealDateFormat(ah.getXbdk1(),2);
// }
// if(ah.getSxbcs() == 2 || ah.getSxbcs() == 3){
// context = context +" "+ dealDateFormat(ah.getSbdk2(),2) + "-" + dealDateFormat(ah.getXbdk2(),2);
// }
// if(ah.getSxbcs() == 3){
// context = context +" "+ dealDateFormat(ah.getSbdk3(),2) + "-" + dealDateFormat(ah.getXbdk3(),2);
// }
// sys.setContext(name+ " " + context);
//
// akms.add(sys);
// }
// attcar.setSsfh(akms);//无排班时 获取的系统班次
attcar.setAttgrouptype(0);//1:固定排班;2:自由排班;3:自由工时
}
//打卡记录
List<PunchRecord> dajllist = punchrecordservice.getDetailedRecordClock(startDate,endDate,userid);
attcar.setAttpr(dajllist);
}else{//自由工时
//int week = Integer.valueOf(ClockInTool.dateToWeek(str));//4
AttendanceWeeklySch wekz = attendanceweeklyschservice.WeeklyFreeRoster(attgro.getId(),week);
if(wekz != null){//
String dada = str+" "+attgro.getKqkssjTime()+":00";
attcar.setStapclotime(Long.valueOf(ClockInTool.dateToStamp(dada)));
}
if(!("").equals(attgro.getJbzdsc())){
attcar.setCanpunchworkdate(Double.valueOf(attgro.getJbzdsc()));//上班打卡后多久大下班卡
}
}
if(jrpb != null || atwek != null){
ShiftManagement shif = null;
if(attgro.getPbfs() == 1){
shif = shiftmanagementservice.selectByPrimaryKey(atwek.getBcid());
}else if(attgro.getPbfs() == 2){
shif = shiftmanagementservice.selectByPrimaryKey(jrpb.getBcid());
}
if(shif != null){
if(shif.getIsXbdk() == 1){
attcar.setNoclockout(true);// 下班不用打卡
}else{
attcar.setNoclockout(false);// 下班不用打卡
}
attcar.setAllowlate(shif.getYxcdfzs());// 允许迟到分钟数
attcar.setSeriouslate(shif.getYzcdfzs());// 严重迟到分钟数
attcar.setAbsenteeismlate(shif.getKgcdfzs());// 旷工迟到分钟数
if(shif.getIsWzwd() == 1){
attcar.setIslatelate(true);// 晚走晚到
List<AttLateLate> atwzwd = new ArrayList<AttLateLate>();
int p = 0;
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1())){p = 2;}
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1()) && !("").equals(shif.getXbwz2()) && !("").equals(shif.getSbwd2())){p = 4;}
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1()) && !("").equals(shif.getXbwz2()) && !("").equals(shif.getSbwd2()) && !("").equals(shif.getXbwz3()) && !("").equals(shif.getSbwd3())){p = 6;}
AttLateLate ala = new AttLateLate();
ala.setLatewalk(shif.getXbwz1());
ala.setArrivelate(shif.getSbwd1());
atwzwd.add(ala);
if(p == 4 || p == 6){
AttLateLate alat = new AttLateLate();
alat.setLatewalk(shif.getXbwz2());
alat.setArrivelate(shif.getSbwd2());
atwzwd.add(alat);
}
if(p == 6){
AttLateLate alas = new AttLateLate();
alas.setLatewalk(shif.getXbwz3());
alas.setArrivelate(shif.getSbwd3());
atwzwd.add(alas);
}
attcar.setAttlat(atwzwd);
}else{
attcar.setIslatelate(false);// 晚走晚到
}
}
}
attcar.setAttgrouptype(attgro.getPbfs());//1:固定排班;2:自由排班;3:自由工时
//外勤 true:开 false:关
if(attgro.getIsWq() == 1) {
attcar.setFieldpersonnel(true);
}else {
attcar.setFieldpersonnel(false);
}
//打卡方式
List<AttGroupBinPunchMode> attmetlist = attgroupbinpunchmodeservice.selectByPrimaryByKqzId(attgro.getId());
for(AttGroupBinPunchMode agbp:attmetlist){
//类型(1:考勤机;2:地址;3:WIFI)
if(agbp.getType() == 1){
attcar.setAttmachine(true);
}else if(agbp.getType() == 2){
attcar.setAttaddress(true);
}else{
attcar.setAttwifi(true);
}
}
//详细打卡方式
List<AttClockMethod> akms = new ArrayList<AttClockMethod>();
for(AttGroupBinPunchMode abp:attmetlist){
if(abp.getType() == 1){
AttendanceMachine kqjs = attendancemachineservice.selectByPrimaryKey(abp.getDkfsid());
AttClockMethod akm = AttClockMethod.builder().build();
akm.setName(kqjs.getName());// 打卡名称
akm.setMac("");// wifi【wifi】
akm.setAttrange(0);// 范围【地址】
akm.setType(1);// 类型(1:考勤机;2:地址;3:WIFI)
akm.setLongitude(0);// 经度【地址】
akm.setLatitude(0);// 纬度【地址】
akms.add(akm);
}else if(abp.getType() == 2){
PunchCardAddress kqdzs = punchcardaddressservice.selectByPrimaryKey(abp.getDkfsid());
AttClockMethod akm = AttClockMethod.builder().build();
akm.setName(kqdzs.getName());// 打卡名称
akm.setMac("");// wifi【wifi】
akm.setAttrange(kqdzs.getDkfw());// 范围【地址】
akm.setType(2);// 类型(1:考勤机;2:地址;3:WIFI)
akm.setLongitude(kqdzs.getLon());// 经度【地址】
akm.setLatitude(kqdzs.getLat());// 纬度【地址】
akms.add(akm);
}else{
PunchCardWiFi kqwfs = punchcardwifiservice.selectByPrimaryKey(abp.getDkfsid());
AttClockMethod akm = AttClockMethod.builder().build();
akm.setName(kqwfs.getName());// 打卡名称
akm.setMac(kqwfs.getMac());// wifi【wifi】
akm.setAttrange(0);// 范围【地址】
akm.setType(3);// 类型(1:考勤机;2:地址;3:WIFI)
akm.setLongitude(0);// 经度【地址】
akm.setLatitude(0);// 纬度【地址】
akms.add(akm);
}
}
attcar.setMachine(akms);
}else{
//无排班
//系统班次
// List<ShiftManagement> shifs = shiftmanagementservice.selectByPrimaryByQyid(qyid);
// List<SystemShift> akms = new ArrayList<SystemShift>();
// for(ShiftManagement ah:shifs){
// SystemShift sys = new SystemShift();
// sys.setId(ah.getId());
//
// String name = ah.getName();
// String context = "";
// if(ah.getSxbcs() == 1 || ah.getSxbcs() == 2 || ah.getSxbcs() == 3){
// context = ClockInTool.dealDateFormat(ah.getSbdk1(),2) + "-" + ClockInTool.dealDateFormat(ah.getXbdk1(),2);
// }
// if(ah.getSxbcs() == 2 || ah.getSxbcs() == 3){
// context = context +" "+ ClockInTool.dealDateFormat(ah.getSbdk2(),2) + "-" + ClockInTool.dealDateFormat(ah.getXbdk2(),2);
// }
// if(ah.getSxbcs() == 3){
// context = context +" "+ ClockInTool.dealDateFormat(ah.getSbdk3(),2) + "-" + ClockInTool.dealDateFormat(ah.getXbdk3(),2);
// }
// sys.setContext(name+ " " + context);
//
// akms.add(sys);
// }
// attcar.setSsfh(akms);//无排班时 获取的系统班次
return ResultUtil.data(attcar);
attcar.setAttgrouptype(0);//1:固定排班;2:自由排班;3:自由工时
}
//打卡记录
List<PunchRecord> dajllist = punchrecordservice.getDetailedRecordClock(startDate,endDate,userid);
attcar.setAttpr(dajllist);
return ResultUtil.data(attcar);
}
......@@ -3304,17 +3215,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(1);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbdk1(),2)+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks1()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjks1(),2)+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs1()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjjs1(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbdk1()+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjks1()+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjjs1()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(2);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbdk1(),2)+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks1()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjks1(),2)+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs1()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjjs1(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbdk1()+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjks1()+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjjs1()+":00")));
atts.add(as);
}
}
......@@ -3326,17 +3237,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(3);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbdk2(),2)+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjks2(),2)+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjjs2(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbdk2()+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjks2()+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjjs2()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(4);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbdk2(),2)+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjks2(),2)+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjjs2(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbdk2()+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjks2()+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjjs2()+":00")));
atts.add(as);
}
}
......@@ -3348,17 +3259,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(5);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbdk3(),2)+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjks3(),2)+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjjs3(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbdk3()+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjks3()+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjjs3()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(6);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbdk3(),2)+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjks3(),2)+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjjs3(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbdk3()+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjks3()+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjjs3()+":00")));
atts.add(as);
}
}
......@@ -3367,9 +3278,6 @@ public class AttController {
}
/**
* ??????
*/
public void Getshiftinformationbatch(ShiftManagement shiftm,AttendanceCardList attcar,String str){
List<AttSchedule> atts = new ArrayList<AttSchedule>();
if(shiftm.getSxbcs() == 1 || shiftm.getSxbcs() == 2 || shiftm.getSxbcs() == 3){//1次上下班
......@@ -3378,17 +3286,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(1);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbdk1(),2)+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks1()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjks1(),2)+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs1()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjjs1(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbdk1()+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjks1()+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjjs1()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(2);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbdk1(),2)+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks1()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjks1(),2)+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs1()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjjs1(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbdk1()+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjks1()+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjjs1()+":00")));
atts.add(as);
}
}
......@@ -3400,17 +3308,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(3);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbdk2(),2)+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjks2(),2)+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjjs2(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbdk2()+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjks2()+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjjs2()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(4);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbdk2(),2)+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjks2(),2)+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs2()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjjs2(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbdk2()+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjks2()+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjjs2()+":00")));
atts.add(as);
}
}
......@@ -3422,17 +3330,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(5);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbdk3(),2)+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjks3(),2)+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getSbqjjs3(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbdk3()+":00")));
as.setStarttime(("").equals(shiftm.getSbqjks3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjks3()+":00")));
as.setEndtime(("").equals(shiftm.getSbqjjs3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getSbqjjs3()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shiftm.getId());
as.setSort(6);
as.setTime(Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbdk3(),2)+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjks3(),2)+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs3()) ? 0 : Long.valueOf(dateToStamp(str+" "+dealDateFormat(shiftm.getXbqjjs3(),2)+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbdk3()+":00")));
as.setStarttime(("").equals(shiftm.getXbqjks3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjks3()+":00")));
as.setEndtime(("").equals(shiftm.getXbqjjs3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shiftm.getXbqjjs3()+":00")));
atts.add(as);
}
}
......@@ -3503,16 +3411,16 @@ public class AttController {
Long xbdk3 = 0l;
if(banci != null){
if(banci.getSxbcs()== 1 || banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk1 = Long.valueOf(dateToStamp(data+" "+banci.getSbdk1()+":00"));
xbdk1 = Long.valueOf(dateToStamp(data+" "+banci.getXbdk1()+":00"));
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(dateToStamp(data+" "+banci.getSbdk2()+":00"));
xbdk2 = Long.valueOf(dateToStamp(data+" "+banci.getXbdk2()+":00"));
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(dateToStamp(data+" "+banci.getSbdk3()+":00"));
xbdk3 = Long.valueOf(dateToStamp(data+" "+banci.getXbdk3()+":00"));
sbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getSbdk3()+":00"));
xbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+banci.getXbdk3()+":00"));
}
}
//之前打卡的班次
......@@ -4251,17 +4159,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(1);
as.setTime(Long.valueOf(dateToStamp(str+" "+shifs.getSbdk1()+":00")));
as.setStarttime(("").equals(shifs.getSbqjks1())? 0 :Long.valueOf(dateToStamp(str+" "+shifs.getSbqjks1()+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs1()) ? 0 : Long.valueOf(dateToStamp(str+" "+shifs.getSbqjjs1()+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbdk1()+":00")));
as.setStarttime(("").equals(shifs.getSbqjks1())? 0 :Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjks1()+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjjs1()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(2);
as.setTime(Long.valueOf(dateToStamp(str+" "+shifs.getXbdk1()+":00")));
as.setStarttime(("").equals(shifs.getXbqjks1()) ? 0 : Long.valueOf(dateToStamp(str+" "+shifs.getXbqjks1()+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs1()) ? 0 : Long.valueOf(dateToStamp(str+" "+shifs.getXbqjjs1()+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbdk1()+":00")));
as.setStarttime(("").equals(shifs.getXbqjks1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjks1()+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs1()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjjs1()+":00")));
atts.add(as);
}
}
......@@ -4273,17 +4181,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(3);
as.setTime(Long.valueOf(dateToStamp(str+" "+shifs.getSbdk2()+":00")));
as.setStarttime(("").equals(shifs.getSbqjks2()) ? 0 : Long.valueOf(dateToStamp(str+" "+shifs.getSbqjks2()+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs2()) ? 0 : Long.valueOf(dateToStamp(str+" "+shifs.getSbqjjs2()+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbdk2()+":00")));
as.setStarttime(("").equals(shifs.getSbqjks2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjks2()+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjjs2()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(4);
as.setTime(Long.valueOf(dateToStamp(str+" "+shifs.getXbdk2()+":00")));
as.setStarttime(("").equals(shifs.getXbqjks2()) ? 0 : Long.valueOf(dateToStamp(str+" "+shifs.getXbqjks2()+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs2()) ? 0 : Long.valueOf(dateToStamp(str+" "+shifs.getXbqjjs2()+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbdk2()+":00")));
as.setStarttime(("").equals(shifs.getXbqjks2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjks2()+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs2()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjjs2()+":00")));
atts.add(as);
}
}
......@@ -4295,17 +4203,17 @@ public class AttController {
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(5);
as.setTime(Long.valueOf(dateToStamp(str+" "+shifs.getSbdk3()+":00")));
as.setStarttime(("").equals(shifs.getSbqjks3()) ? 0 : Long.valueOf(dateToStamp(str+" "+shifs.getSbqjks3()+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs3()) ? 0 : Long.valueOf(dateToStamp(str+" "+shifs.getSbqjjs3()+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbdk3()+":00")));
as.setStarttime(("").equals(shifs.getSbqjks3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjks3()+":00")));
as.setEndtime(("").equals(shifs.getSbqjjs3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getSbqjjs3()+":00")));
atts.add(as);
}else{
AttSchedule as = new AttSchedule();
as.setId(shifs.getId());
as.setSort(6);
as.setTime(Long.valueOf(dateToStamp(str+" "+shifs.getXbdk3()+":00")));
as.setStarttime(("").equals(shifs.getXbqjks3()) ? 0 : Long.valueOf(dateToStamp(str+" "+shifs.getXbqjks3()+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs3()) ? 0 : Long.valueOf(dateToStamp(str+" "+shifs.getXbqjjs3()+":00")));
as.setTime(Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbdk3()+":00")));
as.setStarttime(("").equals(shifs.getXbqjks3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjks3()+":00")));
as.setEndtime(("").equals(shifs.getXbqjjs3()) ? 0 : Long.valueOf(ClockInTool.dateToStamp(str+" "+shifs.getXbqjjs3()+":00")));
atts.add(as);
}
}
......@@ -4817,7 +4725,7 @@ public class AttController {
}
pre.setQyid(qyid);// 企业id
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
pre.setAttdate(attdate_+" "+dateToWeek2(putime));// 考勤日期
pre.setAttdate(attdate_+" "+ClockInTool.dateToWeek2(putime));// 考勤日期
long date = new Date().getTime();
if(("0").equals(clock.getPunchcardtime())){
......@@ -4842,125 +4750,6 @@ public class AttController {
/************************************************************************************************************************************/
/***************************************************工具方法区***************************************************************************/
/************************************************************************************************************************************/
/**
* 时间转换时间戳
*/
public static String dateToStamp(String s){
String res;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = simpleDateFormat.parse(s);
} catch (ParseException e) {
e.printStackTrace();
}
long ts = date.getTime();
res = String.valueOf(ts);
return res;
}
/**
* 2019-10-24T00:30:23.000Z 转化时间
*/
public String dealDateFormat(String oldDateStr,int num) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); // yyyy-MM-dd'T'HH:mm:ss.SSSZ
Date date = null;
try {
date = df.parse(oldDateStr);
} catch (ParseException e) {
e.printStackTrace();
}
SimpleDateFormat df1 = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
Date date1 = null;
try {
date1 = df1.parse(date.toString());
} catch (ParseException e) {
e.printStackTrace();
}
DateFormat df2 = null;
if(num == 1){
df2 = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss");
}else if(num == 2){
df2 = new SimpleDateFormat("HH:mm");
}
return df2.format(date1);
}
/**
* 根据日期获取 星期 (2019-05-06 ——> 星期一)
* @param datetime
* @return
*/
public static String dateToWeek(String datetime) {
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
// String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
String[] weekDays = {"7", "1", "2", "3", "4", "5", "6"};
Calendar cal = Calendar.getInstance();
Date date;
try {
date = f.parse(datetime);
cal.setTime(date);
} catch (ParseException e) {
e.printStackTrace();
}
//一周的第几天
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
if (w < 0)
w = 0;
return weekDays[w];
}
public static String dateToWeek2(String datetime) {
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
// String[] weekDays = {"7", "1", "2", "3", "4", "5", "6"};
Calendar cal = Calendar.getInstance();
Date date;
try {
date = f.parse(datetime);
cal.setTime(date);
} catch (ParseException e) {
e.printStackTrace();
}
//一周的第几天
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
if (w < 0)
w = 0;
return weekDays[w];
}
/**
* 获取月份起始日期
*
* @param date
* @return
* @throws ParseException
*/
public String getMinMonthDate(String date) throws ParseException {
Calendar calendar = Calendar.getInstance();
calendar.setTime(famt.parse(date));
calendar.set(Calendar.DAY_OF_MONTH,
calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
return famt.format(calendar.getTime());
}
/**
* 获取月份最后日期
*
* @param date
* @return
* @throws ParseException
*/
public String getMaxMonthDate(String date) throws ParseException {
Calendar calendar = Calendar.getInstance();
calendar.setTime(famt.parse(date));
calendar.set(Calendar.DAY_OF_MONTH,
calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
return famt.format(calendar.getTime());
}
/**
* 对比两个字符串数组
......@@ -5064,10 +4853,10 @@ public class AttController {
if(!("").equals(attendancedetails.getStart())){
try {
String sdaet = getMinMonthDate(attendancedetails.getStart());
String sdaet = ClockInTool.getMinMonthDate(attendancedetails.getStart());
startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(sdaet,"yyyy-MM-dd")).getTime();
String edate = getMaxMonthDate(attendancedetails.getEnd());
String edate = ClockInTool.getMaxMonthDate(attendancedetails.getEnd());
endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(edate,"yyyy-MM-dd")).getTime();
} catch (ParseException e) {
e.printStackTrace();
......
......@@ -4,15 +4,13 @@ import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
......@@ -21,6 +19,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.json.JSONObject;
import cn.timer.api.bean.kqgl.AttendanceGroup;
import cn.timer.api.bean.kqgl.PunchCardDetails;
import cn.timer.api.bean.kqgl.PunchRecord;
import cn.timer.api.bean.kqgl.ShiftManagement;
import cn.timer.api.bean.kqmk.KqglAssoBcsz;
import cn.timer.api.bean.kqmk.KqglAssoDkjl;
import cn.timer.api.bean.kqmk.KqglAssoDkmx;
......@@ -30,7 +32,13 @@ import cn.timer.api.bean.kqmk.KqglAssoTeshu;
import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.dao.kqgl.AttendanceGroupMapper;
import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.kqgl.ShiftManagementMapper;
import cn.timer.api.dao.kqmk.KqglAssoBcszMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkjlMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkmxMapper;
......@@ -45,6 +53,7 @@ import cn.timer.api.utils.DateUtil;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
@Api(tags = "3.0[3]考勤打卡")
......@@ -58,10 +67,8 @@ public class ClockInController {
//打卡明细表
@Autowired
private KqglAssoDkmxMapper kqglassodkmxmapper;
@Autowired
private KqglAssoDkjlMapper kqglassodkjlmapper;
@Autowired
private KqglAssoBcszMapper kqglassobcszmapper;
......@@ -117,43 +124,28 @@ public class ClockInController {
//打卡当天开始时间,打卡当天结束时间
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
int dkmx = 0;
int shifid = 0;
long punchcardtime = 0,punchstart = 0,punchend = 0;//应打卡时间,应打卡开始时间,应打卡结束时间
boolean isRange = true;//是否在打卡时间范围内
int atttype = 0;
int execution_status = 0;//执行状态
boolean kskd = true;//识别是否更新最后一次打卡 针对于最后一次下班卡
boolean sbdkkd = false;//针对于上班 未超过上班卡打卡 视为无效打卡
ClockCollectData clockt = new ClockCollectData();
//putime: 根据日期 得到打卡所需的详细信息
AttendanceCardListDto attdate = MethodCall(qyid,userid,putime);
/*******/
if(attgro != null) {//判断考勤组是否存在
List<KqglAssoKqzdkfs> kqjs = KqglAssoKqzdkfs.builder().build().selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, attgro.getId()));
if(kqjs.size() > 0) {
/**
* 当考勤组为“固定排班”和“自定义排班”时 方可使用
*/
if(attdate.getAttgrouptype() != 3) {
//查询打卡当天是否有记录**********************************
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build();
//putime: 根据日期 得到打卡所需的详细信息
// AttendanceCardListDto attdate = MethodCall(qyid,userid,putime);
String dakariqi = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDateyesterday))+" "+ClockInTool.dateToWeek2(yesterday);
//检查昨日的班次是否存在次日打卡
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;
......@@ -162,9 +154,7 @@ public class ClockInController {
//班次信息
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;
if(ashss.size() > 0) {
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(ashss.get(0).getTime())));//当天应打的首次上班卡时间
Date sd2=df1.parse(current_time);//当前时间
......@@ -172,13 +162,11 @@ public class ClockInController {
dnck = true;
}
}
int isXbdk1Cr = shif.getIsXbdk1Cr();//下班1是否次日(0:否;1:是)
int isSbdk2Cr = shif.getIsSbdk2Cr();//上班2是否次日(0:否;1:是)
int isXbdk2Cr = shif.getIsXbdk2Cr();//下班2是否次日(0:否;1:是)
int isSbdk3Cr = shif.getIsSbdk3Cr();//上班3是否次日(0:否;1:是)
int isXbdk3Cr = shif.getIsXbdk3Cr();//下班3是否次日(0:否;1:是)
// boolean crdk = false;//当次打卡是否存在次日打卡
if(balan.getSort() < dkcs) {
if(balan.getSort()+1 == 2 && dkcs == 2) {
if(isXbdk1Cr > 0) {//次日
......@@ -210,7 +198,6 @@ public class ClockInController {
}else {
//无记录的话就找昨天的数据
// AttendanceCardListDto attdate1 = MethodCall(qyid,userid,yesterday);
}
if(crdk && dnck) {
......@@ -222,24 +209,15 @@ public class ClockInController {
}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();
if(EmptyUtil.isEmpty(attdate.getAttsch())) {
msg = "当前未排班";
sbyf = 0;
}else {
long iclock_time = time_;//
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;
int dakjg1 = 0,dakjg2 = 0,dakjg3 = 0,dakjg4 = 0,dakjg5 = 0,dakjg6 = 0;//打卡时间与应打卡时间的间隔分钟数
if(attdate.getAttsch().size() > 0) {
List<AttSchedule> ash = attdate.getAttsch();
int y = 0;
......@@ -248,27 +226,16 @@ public class ClockInController {
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();
dakjg1 = Math.abs(Integer.valueOf(String.valueOf((iclock_time - starttime1) / (1000 * 60))));
dakjg2 = Math.abs(Integer.valueOf(String.valueOf((iclock_time - endtime1) / (1000 * 60))));
}
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();
dakjg3 = Math.abs(Integer.valueOf(String.valueOf((iclock_time - starttime2) / (1000 * 60))));
dakjg4 = Math.abs(Integer.valueOf(String.valueOf((iclock_time - endtime2) / (1000 * 60))));
}
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();
dakjg5 = Math.abs(Integer.valueOf(String.valueOf((iclock_time - starttime3) / (1000 * 60))));
dakjg6 = Math.abs(Integer.valueOf(String.valueOf((iclock_time - endtime3) / (1000 * 60))));
}
Map<String, Integer> comparemap = new HashMap();
if(dkmc == null) {
kskd = false;
......@@ -298,7 +265,6 @@ public class ClockInController {
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;
......@@ -310,7 +276,6 @@ public class ClockInController {
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;
......@@ -322,7 +287,6 @@ public class ClockInController {
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;
......@@ -347,7 +311,6 @@ public class ClockInController {
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;
......@@ -361,7 +324,6 @@ public class ClockInController {
}
}
}
execution_status = 1;
}else {
execution_status = 2;
......@@ -383,10 +345,7 @@ public class ClockInController {
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) {
......@@ -398,7 +357,6 @@ public class ClockInController {
}else {
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) {
......@@ -410,7 +368,6 @@ public class ClockInController {
}else {
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) {
......@@ -422,7 +379,6 @@ public class ClockInController {
}else {
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) {
......@@ -434,10 +390,8 @@ public class ClockInController {
}else {
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) {
......@@ -447,7 +401,6 @@ public class ClockInController {
atttype = 5;
}
}else { 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) {
......@@ -460,8 +413,6 @@ public class ClockInController {
}
}
}
if(atttype == 1) {
punchcardtime = starttime1;
punchstart = starttime1ks;
......@@ -487,17 +438,13 @@ public class ClockInController {
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()));
}
//打卡记录录入 -- 打卡是否有时间范围限制
// boolean isRange = true;
if(attdate.getAttsch().size() == 2) {
if(punchstart>0 && punchend>0) {
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(punchstart);//应打卡开始时间
......@@ -512,18 +459,51 @@ public class ClockInController {
}
}
}
if(isRange) {
int yzcd = shif.getYzcdfzs();//严重迟到分钟数
int kgcdfzs = shif.getKgcdfzs();//旷工迟到分钟数
int dkcs_ = shif.getSxbcs();//上下班打卡次数
int iswzwd = shif.getIsWzwd();//是否开启晚走晚到(0:否;1:是)
//统一分钟数
double xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1
int sbwd1 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd1()) * 60));//上班晚到1
double xbwz2 = Double.valueOf(shif.getXbwz2()) * 60;//下班晚走2
int sbwd2 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd2()) * 60));//上班晚到2
double xbwz3 = Double.valueOf(shif.getXbwz3()) * 60;//下班晚走3
int sbwd3 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd3()) * 60));//上班晚到3
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) {
//获取前一天最后下班的时间
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());
......@@ -534,10 +514,49 @@ public class ClockInController {
}// 打卡结果
}
// if(time > 0){//上班1打卡结果
// sbdkjg = Math.abs(Integer.valueOf(time.toString()));
// }
//存在晚走玩到
if(iswzwd > 0) {
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{//下班
if(timeyes > 0){}else{
sbdkjg = Math.abs(Integer.valueOf(timeyes.toString()));
}
}
}
}
}
if(atttype == 1) {
pcd.setSbdk1(time_);
pcd.setSbdk1jg(sbdkjg);
......@@ -572,11 +591,9 @@ public class ClockInController {
throw new CustomException("打卡明细-新增异常-1");
}
dkmx = pcd.getId();
}else if(execution_status == 2){ //*****修改
dkmx = dkmc.getId();
KqglAssoDkmx pcd = KqglAssoDkmx.builder().build();
if(atttype == 2){//下班1
pcd.setId(dkmc.getId());
pcd.setXbdk1(time_);//下班1打卡时间
......@@ -588,7 +605,6 @@ public class ClockInController {
pcd.setXbdk1jg(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())));//只打一次卡时计算工作时长
......@@ -614,11 +630,8 @@ public class ClockInController {
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){//有应打卡时间时
......@@ -629,7 +642,6 @@ public class ClockInController {
pcd.setXbdk2jg(Math.abs(Integer.valueOf(time.toString())));
}
}
//班次为4次时,计算工作时长
if(dkmc.getSbdk2() != null){
Long time = (time_ - dkmc.getSbdk2())/1000/60;
......@@ -639,9 +651,7 @@ public class ClockInController {
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;
......@@ -652,18 +662,14 @@ public class ClockInController {
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(atttype == 6){//下班3
pcd.setId(dkmc.getId());
pcd.setXbdk3(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时
......@@ -682,14 +688,12 @@ public class ClockInController {
double worktime = Math.abs(om.add(on).doubleValue());
pcd.setGzsc(worktime);
}
}
pcd.setId(dkmc.getId());
if(atttype <= 6 && atttype > 0 && !sbdkkd){
int update = kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}
}
}else {
msg = "当前打卡时间不在范围内";
sbyf = 0;
......@@ -699,16 +703,11 @@ public class ClockInController {
sbyf = 0;
}
}
}else {
//自由工时打卡
Long stapclotime = attdate.getStapclotime();// 今天考勤 自由排班开始时间
int canpunchworkdate = Integer.valueOf(String.valueOf(attdate.getCanpunchworkdate()).replaceAll("(\\d+)(?:(\\.\\d*[^0])|\\.)0*", "$1$2"));// 上班打卡后多久大下班卡
KqglAssoDkmx zydkmc = KqglAssoDkmx.builder().build();
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(stapclotime)));//应打卡时间 2020-06-10 18:30:00
Date sd2=df1.parse(current_time);//当前时间 2020-06-10 16:06:58
if(sd1.after(sd2)) {//为true时 打的是昨天的卡
......@@ -722,8 +721,6 @@ public class ClockInController {
attendance_date = startDate;
toweek = putime;
}
if(zydkmc == null) {//新增
KqglAssoDkmx pcd = KqglAssoDkmx.builder().build();
if(sd1.after(sd2)) {
......@@ -731,7 +728,6 @@ public class ClockInController {
}else {
pcd = KqglAssoDkmx.builder().userid(userid).data(putime).sbdk1(time_).sbdk1jg(0).ydkcs(0).qyid(qyid).dksj(startDate).yzcdcs(0).yzcdsc(Double.valueOf(0)).kgcdfzs(0).build();
}
// KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(userid).data(putime).sbdk1(time_).sbdk1jg(0).ydkcs(0).qyid(qyid).dksj(startDate).yzcdcs(0).yzcdsc(Double.valueOf(0)).kgcdfzs(0).build();
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
......@@ -740,15 +736,11 @@ public class ClockInController {
atttype = 1;
}else {//修改
dkmx = zydkmc.getId();
KqglAssoDkmx zypcd = KqglAssoDkmx.builder().build();
if((!("").equals(zydkmc.getSbdk1()) || zydkmc.getSbdk1() != null) && (("").equals(zydkmc.getXbdk1()) || zydkmc.getXbdk1() == null)){//下班1
String clock_time = ClockInTool.requires_extra_times(ClockInTool.stampToDate(String.valueOf(zydkmc.getSbdk1())),canpunchworkdate,5,2);
Date zysd1=df1.parse(clock_time);//上班打卡后多久大下班卡的时间
Date zysd2=df1.parse(current_time);//当前时间
if(zysd1.after(zysd2)) {//当zysd1大于zysd2时,返回TRUE,当小于等于时,返回false;
msg = "自由工时:上班打卡后"+canpunchworkdate+"小时后,才可打下班卡";
sbyf = 0;
......@@ -761,7 +753,6 @@ public class ClockInController {
}
kqglassodkmxmapper.updateByPrimaryKeySelective(zypcd);//修改打卡记录
}
atttype = 2;
}else if((!("").equals(zydkmc.getSbdk1()) || zydkmc.getSbdk1() != null) && (!("").equals(zydkmc.getXbdk1()) || zydkmc.getXbdk1() != null)
&& (("").equals(zydkmc.getSbdk2()) || zydkmc.getSbdk2() == null)){//上班2
......@@ -771,9 +762,7 @@ public class ClockInController {
atttype = 3;
}else if((!("").equals(zydkmc.getSbdk1()) || zydkmc.getSbdk1() != null) && (!("").equals(zydkmc.getXbdk1()) || zydkmc.getXbdk1() != null)
&& (!("").equals(zydkmc.getSbdk2()) || zydkmc.getSbdk2() != null) && (("").equals(zydkmc.getXbdk2()) || zydkmc.getXbdk2() == null)){//下班2
String clock_time = ClockInTool.requires_extra_times(ClockInTool.stampToDate(String.valueOf(zydkmc.getSbdk2())),canpunchworkdate,5,2);
Date zysd1=df1.parse(clock_time);//上班打卡后多久大下班卡的时间
Date zysd2=df1.parse(current_time);//当前时间
if(zysd1.after(zysd2)) {//当zysd1大于zysd2时,返回TRUE,当小于等于时,返回false;
......@@ -803,9 +792,7 @@ public class ClockInController {
}else if((!("").equals(zydkmc.getSbdk1()) || zydkmc.getSbdk1() != null) && (!("").equals(zydkmc.getXbdk1()) || zydkmc.getXbdk1() != null)
&& (!("").equals(zydkmc.getSbdk2()) || zydkmc.getSbdk2() != null) && (!("").equals(zydkmc.getXbdk2()) || zydkmc.getXbdk2() != null)
&& (!("").equals(zydkmc.getSbdk3()) || zydkmc.getSbdk3() != null) && (("").equals(zydkmc.getXbdk3()) || zydkmc.getXbdk3() == null)){//下班3
String clock_time = ClockInTool.requires_extra_times(ClockInTool.stampToDate(String.valueOf(zydkmc.getSbdk3())),canpunchworkdate,5,2);
Date zysd1=df1.parse(clock_time);//上班打卡后多久大下班卡的时间
Date zysd2=df1.parse(current_time);//当前时间
if(zysd1.after(zysd2)) {//当zysd1大于zysd2时,返回TRUE,当小于等于时,返回false;
......@@ -836,8 +823,10 @@ public class ClockInController {
sbyf = 0;
}
/*************************************************************************************************************************************************************************************/
/*************************************************************************************************************************************************************************************/
/*****************************************************************************************************************************************************************************************************/
/*******************************************************************原始打卡记录数据录入**************************************************************************************************************/
/*****************************************************************************************************************************************************************************************************/
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(attendance_date));//转换打卡时间格式
//true:确认为最后一次打卡更新打卡时 之前打卡的一条数据变为“打卡更新数据”
......@@ -847,8 +836,7 @@ public class ClockInController {
KqglAssoDkjl.builder().id(dkjj.getId()).status(0).sort(0).build().updateById();
}
// 原始打卡记录数据录入
int results = 0;
Long time = (time_ - punchcardtime)/1000/60;
if(punchcardtime != 0){
......@@ -864,8 +852,6 @@ public class ClockInController {
}
}
}
int type,status = 0;
if((atttype)%2 > 0){
type = 1;// 类型(类型 0:无排班打卡 1:上班 2:下班) punchcardtime == 0:无班次打卡
......@@ -935,7 +921,6 @@ public class ClockInController {
}
long attime;
// if(punchcardtime == 0 && !isRange){attime = new Date().getTime();}else{attime = punchcardtime;}// 考勤时间(应打卡时间)
if(punchcardtime == 0){// 考勤时间(应打卡时间)
attime = new Date().getTime();
}else{
......@@ -982,7 +967,13 @@ public class ClockInController {
@Autowired
private KqglAssoPbmxMapper kqglassopbmxmapper;
/**
* @param qyid
* @param userid
* @param date
* @return
* 获取当天打卡班次数据
*/
public AttendanceCardListDto MethodCall(int qyid,int userid,String date) throws ParseException {
AttendanceCardListDto attcar = new AttendanceCardListDto();
......@@ -994,21 +985,15 @@ public class ClockInController {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
str = sdf.format(d);
}
// Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(str,"yyyy-MM-dd")).getTime();
// Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(str,"yyyy-MM-dd")).getTime();
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userid,qyid); //考勤组信息
//pbfs:排班方式 1:固定排班;2:自由排班;3:自由工时
if(attgro != null){//判断当前用户是否加入到考勤组
//排班制
KqglAssoPbmxDto jrpb = kqglassopbmxmapper.getScheduleSpecificAttendance(attgro.getId(),userid,str);
//固定排班
int week = Integer.valueOf(ClockInTool.dateToWeek(str));//4
KqglAssoZhoupaiban atwek = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, week).ne(KqglAssoZhoupaiban::getBcid, 0));
if(attgro.getPbfs() == 1){//固定排班
if(atwek != null){//有固定周排班
KqglAssoTeshu rest = KqglAssoTeshu.builder().build().selectOne(new QueryWrapper<KqglAssoTeshu>().lambda().eq(KqglAssoTeshu::getKqzid, attgro.getId())
......@@ -1062,7 +1047,6 @@ public class ClockInController {
}else{//自由工时
KqglAssoZhoupaiban wekz = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getBcid, 0).eq(KqglAssoZhoupaiban::getType, week));
if(wekz != null){//
String dada = str+" "+attgro.getKqkssjTime()+":00";
attcar.setStapclotime(Long.valueOf(ClockInTool.dateToStamp(dada)));
......@@ -1125,7 +1109,11 @@ public class ClockInController {
return attcar;
}
//
/**
* @param shiftm
* @param attcar
* @param str
*/
public void Getshiftinformationbatch(KqglAssoBcsz shiftm,AttendanceCardListDto attcar,String str){
int isXbdk1Cr = shiftm.getIsXbdk1Cr();//下班1是否次日(0:否;1:是)
int isSbdk2Cr = shiftm.getIsSbdk2Cr();//上班2是否次日(0:否;1:是)
......@@ -1239,4 +1227,443 @@ public class ClockInController {
attcar.setAttsch(atts);
}
}
/************************************************************************************************************************************************************************************************/
/************************************************************************** APP打卡 *************************************************************************************************************/
/************************************************************************************************************************************************************************************************/
//考勤组
@Autowired
private AttendanceGroupMapper attendancegroupmapper;
//班次
@Autowired
private ShiftManagementMapper shiftmanagementmapper;
//打卡明细表
@Autowired
private PunchCardDetailsMapper punchcarddetailsmapper;
//打卡记录
@Autowired
private PunchRecordMapper punchrecordmapper;
/**
* 考勤打卡------APP打卡
*/
@PostMapping(value = "/AttendanceCard")
@ApiOperation(value = "考勤打卡------APP打卡", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 53)
public Result<Void> AttendanceCard(@CurrentUser UserBean userBean,@RequestBody ClockCollectData clock) {
int qyid = userBean.getOrgCode();//坏小孩【企业id】
int userid = userBean.getEmpNum();//用户id
AttendanceGroup attgro = attendancegroupmapper.getAttendanceGroupInformationByUserid(userid,qyid); //考勤组信息
//pbfs;// 排班方式 1:固定排班;2:自由排班;3:自由工时
String putime = new SimpleDateFormat("yyyy-MM-dd").format(Double.valueOf(clock.getPunchtime()));//转换打卡时间格式
Long startDate = 0l;//打卡当天开始时间
Long endDate = 0l;//打卡当天结束时间
try {
startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
} catch (ParseException e) {
e.printStackTrace();
}
ShiftManagement shif = null;
if(clock.getShifid() > 0){//有无班次
shif = shiftmanagementmapper.selectByPrimaryKey(clock.getShifid());
}
int dkmx = 0;
PunchCardDetails dkmc = punchcarddetailsmapper.SingleAttendanceDays(userid,startDate,endDate);//查询打卡当天是否有记录
if(dkmc != null){//有记录就修改之前的
//修改
dkmx = dkmc.getId();
PunchCardDetails pcd = new PunchCardDetails();
if(clock.getType() == 1){
if(clock.getDiffer() == 1){//打卡
if(!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null){
return ResultUtil.error("重复打卡");
}
}else{//更新打卡
pcd.setId(dkmc.getId());
pcd.setSbdk1(Long.valueOf(clock.getPunchtime()));//上班1打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setSbdk1jg(Math.abs(Integer.valueOf(time.toString())));//上班1打卡结果
}else{
pcd.setSbdk1jg(0);// 打卡结果
}
}
punchcarddetailsmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}
}else if(clock.getType() == 2){
if(("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() == null){
pcd.setXbdk1(Long.valueOf(clock.getPunchtime()));//下班1打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时[有班次时]
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setXbdk1jg(0);// 打卡结果
}else{
pcd.setXbdk1jg(Math.abs(Integer.valueOf(time.toString())));//上班1打卡结果
}
}
}else{
if(clock.getDiffer() == 1){//打卡
return ResultUtil.error("重复打卡");
}else{//更新打卡
pcd.setId(dkmc.getId());
pcd.setXbdk1(Long.valueOf(clock.getPunchtime()));//下班1打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时[有班次时]
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setXbdk1jg(0);// 打卡结果
}else{
pcd.setXbdk1jg(Math.abs(Integer.valueOf(time.toString())));//上班1打卡结果
}
}
//班次为2次时,计算工作时长
if(dkmc.getSbdk1() != null){
Long time = (Long.valueOf(clock.getPunchtime()) - dkmc.getSbdk1())/1000/60;
pcd.setGzsc(Math.abs(Double.valueOf(time.toString())));//只打一次卡时计算工作时长
}
punchcarddetailsmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}
}
//班次为2次时,计算工作时长
if(dkmc.getSbdk1() != null){
Long time = (Long.valueOf(clock.getPunchtime()) - dkmc.getSbdk1())/1000/60;
pcd.setGzsc(Math.abs(Double.valueOf(time.toString())));//只打一次卡时计算工作时长
}
}else if(clock.getType() == 3){
if(("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() == null){
pcd.setSbdk2(Long.valueOf(clock.getPunchtime()));//上班2打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时[有班次时]
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setSbdk2jg(Math.abs(Integer.valueOf(time.toString())));//上班2打卡结果
}else{
pcd.setSbdk2jg(0);// 打卡结果
}
}
}else{
if(clock.getDiffer() == 1){//打卡
return ResultUtil.error("重复打卡");
}else{
pcd.setId(dkmc.getId());
pcd.setSbdk2(Long.valueOf(clock.getPunchtime()));//上班2打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时[有班次时]
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setSbdk2jg(Math.abs(Integer.valueOf(time.toString())));//上班2打卡结果
}else{
pcd.setSbdk2jg(0);// 打卡结果
}
}
punchcarddetailsmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}
}
}else if(clock.getType() == 4){
if(("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() == null){
pcd.setXbdk2(Long.valueOf(clock.getPunchtime()));//下班2打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时[有班次时]
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setXbdk2jg(0);// 打卡结果
}else{
pcd.setXbdk2jg(Math.abs(Integer.valueOf(time.toString())));//下班2打卡结果
}
}
}else{
if(clock.getDiffer() == 1){//打卡
return ResultUtil.error("重复打卡");
}else{
pcd.setId(dkmc.getId());
pcd.setXbdk2(Long.valueOf(clock.getPunchtime()));//下班2打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时[有班次时]
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setXbdk2jg(0);// 打卡结果
}else{
pcd.setXbdk2jg(Math.abs(Integer.valueOf(time.toString())));//下班2打卡结果
}
}
//班次为4次时,计算工作时长
if(dkmc.getSbdk2() != null){
Long time = (Long.valueOf(clock.getPunchtime()) - 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);
}
punchcarddetailsmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}
}
//班次为4次时,计算工作时长
if(dkmc.getSbdk2() != null){
Long time = (Long.valueOf(clock.getPunchtime()) - 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);
}
}else if(clock.getType() == 5){
if(("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() == null){
pcd.setSbdk3(Long.valueOf(clock.getPunchtime()));//上班3打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时[有班次时]
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setSbdk3jg(Math.abs(Integer.valueOf(time.toString())));//上班3打卡结果
}else{
pcd.setSbdk3jg(0);// 打卡结果
}
}
}else{
if(clock.getDiffer() == 1){//打卡
return ResultUtil.error("重复打卡");
}else{
pcd.setId(dkmc.getId());
pcd.setSbdk3(Long.valueOf(clock.getPunchtime()));//上班3打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时[有班次时]
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setSbdk3jg(Math.abs(Integer.valueOf(time.toString())));//上班3打卡结果
}else{
pcd.setSbdk3jg(0);// 打卡结果
}
}
punchcarddetailsmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}
}
}else if(clock.getType() == 6){
if(("").equals(dkmc.getXbdk3()) || dkmc.getXbdk3() == null){
pcd.setXbdk3(Long.valueOf(clock.getPunchtime()));//下班3打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时[有班次时]
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setXbdk3jg(0);// 打卡结果
}else{
pcd.setXbdk3jg(Math.abs(Integer.valueOf(time.toString())));//下班3打卡结果
}
}
}else{
if(clock.getDiffer() == 1){//打卡
return ResultUtil.error("重复打卡");
}else{
pcd.setId(dkmc.getId());
pcd.setXbdk3(Long.valueOf(clock.getPunchtime()));//下班3打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时[有班次时]
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setXbdk3jg(0);// 打卡结果
}else{
pcd.setXbdk3jg(Math.abs(Integer.valueOf(time.toString())));//下班3打卡结果
}
}
//班次为6次时,计算工作时长
if(dkmc.getSbdk3() != null){
Long time = (Long.valueOf(clock.getPunchtime()) - 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);
}
punchcarddetailsmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}
}
//班次为6次时,计算工作时长
if(dkmc.getSbdk3() != null){
Long time = (Long.valueOf(clock.getPunchtime()) - 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(clock.getType() <= 6){
int update = punchcarddetailsmapper.updateByPrimaryKeySelective(pcd);
}
}else{//没有数据就新增一条数据
//新增
if(clock.getDiffer() == 1){//打卡
PunchCardDetails pcd = new PunchCardDetails();
pcd.setUserid(userid);
pcd.setData(putime);//打卡日期(yyyy-MM-dd)
if(clock.getType() == 1){
pcd.setSbdk1(Long.valueOf(clock.getPunchtime()));//上班1打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setSbdk1jg(Math.abs(Integer.valueOf(time.toString())));//上班1打卡结果
}else{
pcd.setSbdk1jg(0);// 打卡结果
}
}
}else if(clock.getType() == 2){
pcd.setXbdk1(Long.valueOf(clock.getPunchtime()));//下班1打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setXbdk1jg(0);// 打卡结果
}else{
pcd.setXbdk1jg(Math.abs(Integer.valueOf(time.toString())));//上班1打卡结果
}
}
}else if(clock.getType() == 3){
pcd.setSbdk2(Long.valueOf(clock.getPunchtime()));//上班1打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setSbdk2jg(Math.abs(Integer.valueOf(time.toString())));
}else{
pcd.setSbdk2jg(0);// 打卡结果
}
}
}else if(clock.getType() == 4){
pcd.setXbdk2(Long.valueOf(clock.getPunchtime()));//下班1打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setXbdk2jg(0);// 打卡结果
}else{
pcd.setXbdk2jg(Math.abs(Integer.valueOf(time.toString())));
}
}
}else if(clock.getType() == 5){
pcd.setSbdk3(Long.valueOf(clock.getPunchtime()));//上班1打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setSbdk3jg(Math.abs(Integer.valueOf(time.toString())));
}else{
pcd.setSbdk3jg(0);// 打卡结果
}
}
}else if(clock.getType() == 6){
pcd.setXbdk3(Long.valueOf(clock.getPunchtime()));//下班1打卡时间
if(!("0").equals(clock.getPunchcardtime())){//有应打卡时间时
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(time > 0){
pcd.setXbdk3jg(0);// 打卡结果
}else{
pcd.setXbdk3jg(Math.abs(Integer.valueOf(time.toString())));
}
}
}
if(shif != null){
pcd.setYdkcs(shif.getSxbcs()*2);//应打卡次数
}
pcd.setQyid(qyid);//企业id
pcd.setDksj(startDate);//打卡时间
punchcarddetailsmapper.insertSelective(pcd);
dkmx = pcd.getId();
}
}
//打卡记录
if(clock.getDiffer() == 2){//更新打卡
PunchRecord punch = punchrecordmapper.selectPunchResults(startDate,endDate,userid,clock.getType());
if(punch != null){
PunchRecord pr = new PunchRecord();
pr.setId(punch.getId());
pr.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:补卡 4:请假)
pr.setSort(0);//序号(0:打卡无效:此记录已被更新)
punchrecordmapper.updateByPrimaryKeySelective(pr);
}else{
return ResultUtil.error("打卡失败");
}
}
PunchRecord pre = new PunchRecord();
pre.setDktime(Long.valueOf(clock.getPunchtime()));// 打卡时间
if(clock.getPunchcardtype() == 1){
pre.setLon(Double.valueOf(clock.getLon()));// 经度
pre.setLat(Double.valueOf(clock.getLat()));// 纬度
pre.setAddress(clock.getAddress());// 定位地址
}
Long time = (Long.valueOf(clock.getPunchtime()) - Long.valueOf(clock.getPunchcardtime()))/1000/60;
if(("0").equals(clock.getPunchcardtime())){
pre.setResults(0);// 打卡结果
}else{
if((clock.getType())%2 > 0){//上班
if(time > 0){
pre.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
pre.setResults(0);// 打卡结果
}
}else{//下班
if(time > 0){
pre.setResults(0);// 打卡结果
}else{
pre.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
}
}
pre.setUserId(userid);// 用户id
if((clock.getType())%2 > 0){
pre.setType(1);// 类型(类型 0:无排班打卡 1:上班 2:下班)
if(("0").equals(clock.getPunchcardtime())){//无班次打卡
pre.setStatus(1);
}else{
//打卡
if(time > 0){
pre.setStatus(3);// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
}else if(pre.getResults() == 0){
pre.setStatus(1);// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
}
}
}else{
pre.setType(2);// 类型(类型 0:无排班打卡 1:上班 2:下班)
if(("0").equals(clock.getPunchcardtime())){//无班次打卡
pre.setStatus(1);
}else{
//打卡
if(time < 0){
pre.setStatus(4);// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
}else if(pre.getResults() == 0){
pre.setStatus(1);// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
}
}
}
pre.setSort(clock.getType());// 序号
pre.setCardType(clock.getPunchcardtype());// 打卡类型(1:GPS,2:WIFI,3:考勤机)
if(clock.getPunchcardtype() == 2){
pre.setMac(clock.getMac());// mac地址
pre.setMacname(clock.getMacname());// WIFI名称
}
pre.setQyid(qyid);// 企业id
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
pre.setAttdate(attdate_+" "+ClockInTool.dateToWeek2(putime));// 考勤日期
long date = new Date().getTime();
if(("0").equals(clock.getPunchcardtime())){
pre.setAttime(date);// 考勤时间(应打卡时间)
}else{
pre.setAttime(Long.valueOf(clock.getPunchcardtime()));// 考勤时间(应打卡时间)
}
pre.setDkmxid(dkmx);// 打卡明细id
pre.setBcid(clock.getShifid());// 班次id
punchrecordmapper.insertSelective(pre);//新增打卡记录
return ResultUtil.data(null,"打卡成功");
}
}
......@@ -23,6 +23,10 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
public static double round(double value){
return Math.round(value*100)/100.0;
}
/**
* 判断某个字符串是否存在于数组中
* @param stringArray 原数组
......
......@@ -276,7 +276,7 @@ public class TimeCardController {
if(listAs.get(i).getAppliedScope() == 0) {//全公司
nary = new String[1];//用户名
naryid = new String[1];//用户名
nary[0] = "全公司";
nary[0] = "未使用";
naryid[0] = "0";
}else {
List<KqglAssoOvertimeRange> overtim = kqglassoovertimerangemapper.selectList(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getOvertimeRulesId, listAs.get(i).getId()));
......@@ -3296,4 +3296,30 @@ public class TimeCardController {
return ResultUtil.data(tabl, "操作成功!");
}
@PostMapping(value = "/isitused")
@ApiOperation(value = "(加班规则)当选择加班规则范围中存在已使用的考勤组时,在用户确认后给用户一个提示,提示用户哪个考勤组已被使用,是否修改", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> Isitused(@CurrentUser UserBean userBean,@RequestBody KqglAssoOvertimeRulesDto overrules) {
String msg = "";
String[] launchs = overrules.getApplyrangeid();
if(launchs.length > 0) {
for(int p=0;p<launchs.length;p++){
KqglAssoOvertimeRange ran = KqglAssoOvertimeRange.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, launchs[p]));
if(ran != null) {
KqglMainKqz kqz = KqglMainKqz.builder().build().selectOne(new QueryWrapper<KqglMainKqz>().lambda().eq(KqglMainKqz::getId, ran.getAttgroupId()));
if(p == 0) {
msg += kqz.getName();
}else {
msg += "、"+kqz.getName();
}
}
}
}
return ResultUtil.data(msg, "操作成功!");
}
}
package cn.timer.api.controller.kqgl.service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -135,6 +136,7 @@ public class KqglServiceImpl implements KqglService {
modifynumber = balan.getModifyNumber()+1;
}
KqglAssoYhkqz yhd = KqglAssoYhkqz.builder().build().selectOne(new QueryWrapper<KqglAssoYhkqz>().lambda().eq(KqglAssoYhkqz::getUserid, overappr.getUserid()).eq(KqglAssoYhkqz::getQyid, overappr.getOrgcode()));
if(yhd != null) {
KqglAssoOvertimeRange timeran = KqglAssoOvertimeRange.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, yhd.getKqzid()));
......@@ -170,6 +172,58 @@ public class KqglServiceImpl implements KqglService {
}
}
}
//调休单位是“天”时 按照=》加班时长/班次的工作时长=调休天数
if(learul.getCompany() == 1) {
try {
AttendanceCardListDto attdate = MethodCall(overappr.getOrgcode(),overappr.getUserid(),startdate);//获取当天打卡班次信息
long starttime1 = 0,endtime1 = 0,starttime2 = 0,endtime2 = 0,starttime3 = 0,endtime3 = 0;
double time1 = 0,time2 = 0,time3 = 0;
BigDecimal num0 = new BigDecimal(60);
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
List<AttSchedule> ash = attdate.getAttsch();//获取当天应打卡时间
if(attdate.getAttsch().size() == 2 || attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime1 = ash.get(0).getTime();
endtime1 = ash.get(1).getTime();
BigDecimal num = new BigDecimal((endtime1 - starttime1)/1000/60);
time1 = num.divide(num0,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime2 = ash.get(2).getTime();
endtime2 = ash.get(3).getTime();
BigDecimal num = new BigDecimal((endtime2 - starttime2)/1000/60);
time2 = num.divide(num0,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
if(attdate.getAttsch().size() == 6) {
starttime3 = ash.get(4).getTime();
endtime3 = ash.get(5).getTime();
BigDecimal num = new BigDecimal((endtime3 - starttime3)/1000/60);
time3 = num.divide(num0,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
}
BigDecimal num1 = new BigDecimal(time1);
BigDecimal num2 = new BigDecimal(time2);
BigDecimal num3 = num1.add(num2);
BigDecimal num4 = new BigDecimal(time3);
double shift_duration = ClockInTool.round(num3.add(num4).doubleValue());//班次时长
BigDecimal num5 = new BigDecimal(duration);
BigDecimal num6 = new BigDecimal(shift_duration);
//加班时长/班次的工作时长=调休天数
duration = num5.divide(num6,2,BigDecimal.ROUND_HALF_UP).doubleValue();
} catch (ParseException e) {
e.printStackTrace();
}
}
KqglAssoLeaveBalance.builder().leaveRulesId(learul.getId()).userid(overappr.getUserid()).modifyAction(2).balanceDays("+"+duration)
.reason("考勤加班审批").modifyUserid(emp.getEmpNum()).modifyTimer(overappr.getStarttime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
......
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